_ZN3ada4idna13utf8_to_utf32EPKcmPDi:
  160|  2.54k|size_t utf8_to_utf32(const char* buf, size_t len, char32_t* utf32_output) {
  161|  2.54k|  const uint8_t* data = reinterpret_cast<const uint8_t*>(buf);
  162|  2.54k|  size_t pos = 0;
  163|  2.54k|  const char32_t* start{utf32_output};
  164|  26.9k|  while (pos < len) {
  ------------------
  |  Branch (164:10): [True: 24.5k, False: 2.38k]
  ------------------
  165|       |    // try to convert the next block of 16 ASCII bytes
  166|  24.5k|    if (pos + 16 <= len) {  // if it is safe to read 16 more
  ------------------
  |  Branch (166:9): [True: 8.35k, False: 16.2k]
  ------------------
  167|       |                            // bytes, check that they are ascii
  168|  8.35k|      uint64_t v1;
  169|  8.35k|      std::memcpy(&v1, data + pos, sizeof(uint64_t));
  170|  8.35k|      uint64_t v2;
  171|  8.35k|      std::memcpy(&v2, data + pos + sizeof(uint64_t), sizeof(uint64_t));
  172|  8.35k|      uint64_t v{v1 | v2};
  173|  8.35k|      if ((v & 0x8080808080808080) == 0) {
  ------------------
  |  Branch (173:11): [True: 1.08k, False: 7.27k]
  ------------------
  174|  1.08k|        size_t final_pos = pos + 16;
  175|  18.4k|        while (pos < final_pos) {
  ------------------
  |  Branch (175:16): [True: 17.3k, False: 1.08k]
  ------------------
  176|  17.3k|          *utf32_output++ = char32_t(buf[pos]);
  177|  17.3k|          pos++;
  178|  17.3k|        }
  179|  1.08k|        continue;
  180|  1.08k|      }
  181|  8.35k|    }
  182|  23.5k|    uint8_t leading_byte = data[pos];  // leading byte
  183|  23.5k|    if (leading_byte < 0b10000000) {
  ------------------
  |  Branch (183:9): [True: 16.1k, False: 7.32k]
  ------------------
  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.49k, False: 4.82k]
  ------------------
  188|       |      // We have a two-byte UTF-8
  189|  2.49k|      if (pos + 1 >= len) {
  ------------------
  |  Branch (189:11): [True: 3, False: 2.49k]
  ------------------
  190|      3|        return 0;
  191|      3|      }  // minimal bound checking
  192|  2.49k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (192:11): [True: 41, False: 2.45k]
  ------------------
  193|     41|        return 0;
  194|     41|      }
  195|       |      // range check
  196|  2.45k|      uint32_t code_point =
  197|  2.45k|          (leading_byte & 0b00011111) << 6 | (data[pos + 1] & 0b00111111);
  198|  2.45k|      if (code_point < 0x80 || 0x7ff < code_point) {
  ------------------
  |  Branch (198:11): [True: 2, False: 2.45k]
  |  Branch (198:32): [True: 0, False: 2.45k]
  ------------------
  199|      2|        return 0;
  200|      2|      }
  201|  2.45k|      *utf32_output++ = char32_t(code_point);
  202|  2.45k|      pos += 2;
  203|  4.82k|    } else if ((leading_byte & 0b11110000) == 0b11100000) {
  ------------------
  |  Branch (203:16): [True: 4.33k, False: 488]
  ------------------
  204|       |      // We have a three-byte UTF-8
  205|  4.33k|      if (pos + 2 >= len) {
  ------------------
  |  Branch (205:11): [True: 5, False: 4.33k]
  ------------------
  206|      5|        return 0;
  207|      5|      }  // minimal bound checking
  208|       |
  209|  4.33k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (209:11): [True: 9, False: 4.32k]
  ------------------
  210|      9|        return 0;
  211|      9|      }
  212|  4.32k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (212:11): [True: 4, False: 4.32k]
  ------------------
  213|      4|        return 0;
  214|      4|      }
  215|       |      // range check
  216|  4.32k|      uint32_t code_point = (leading_byte & 0b00001111) << 12 |
  217|  4.32k|                            (data[pos + 1] & 0b00111111) << 6 |
  218|  4.32k|                            (data[pos + 2] & 0b00111111);
  219|  4.32k|      if (code_point < 0x800 || 0xffff < code_point ||
  ------------------
  |  Branch (219:11): [True: 5, False: 4.31k]
  |  Branch (219:33): [True: 0, False: 4.31k]
  ------------------
  220|  4.31k|          (0xd7ff < code_point && code_point < 0xe000)) {
  ------------------
  |  Branch (220:12): [True: 1.89k, False: 2.42k]
  |  Branch (220:35): [True: 1, False: 1.89k]
  ------------------
  221|      6|        return 0;
  222|      6|      }
  223|  4.31k|      *utf32_output++ = char32_t(code_point);
  224|  4.31k|      pos += 3;
  225|  4.31k|    } else if ((leading_byte & 0b11111000) == 0b11110000) {  // 0b11110000
  ------------------
  |  Branch (225:16): [True: 422, False: 66]
  ------------------
  226|       |      // we have a 4-byte UTF-8 word.
  227|    422|      if (pos + 3 >= len) {
  ------------------
  |  Branch (227:11): [True: 5, False: 417]
  ------------------
  228|      5|        return 0;
  229|      5|      }  // minimal bound checking
  230|    417|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (230:11): [True: 10, False: 407]
  ------------------
  231|     10|        return 0;
  232|     10|      }
  233|    407|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (233:11): [True: 2, False: 405]
  ------------------
  234|      2|        return 0;
  235|      2|      }
  236|    405|      if ((data[pos + 3] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (236:11): [True: 2, False: 403]
  ------------------
  237|      2|        return 0;
  238|      2|      }
  239|       |
  240|       |      // range check
  241|    403|      uint32_t code_point = (leading_byte & 0b00000111) << 18 |
  242|    403|                            (data[pos + 1] & 0b00111111) << 12 |
  243|    403|                            (data[pos + 2] & 0b00111111) << 6 |
  244|    403|                            (data[pos + 3] & 0b00111111);
  245|    403|      if (code_point <= 0xffff || 0x10ffff < code_point) {
  ------------------
  |  Branch (245:11): [True: 5, False: 398]
  |  Branch (245:35): [True: 2, False: 396]
  ------------------
  246|      7|        return 0;
  247|      7|      }
  248|    396|      *utf32_output++ = char32_t(code_point);
  249|    396|      pos += 4;
  250|    396|    } else {
  251|     66|      return 0;
  252|     66|    }
  253|  23.5k|  }
  254|  2.38k|  return utf32_output - start;
  255|  2.54k|}
_ZN3ada4idna22utf32_length_from_utf8EPKcm:
  270|  2.54k|size_t utf32_length_from_utf8(const char* buf, size_t len) {
  271|  2.54k|  const int8_t* p = reinterpret_cast<const int8_t*>(buf);
  272|  2.54k|  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.54k|    return c > -65;
  276|  2.54k|  });
  277|  2.54k|}
_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|    172|void ascii_map(char* input, size_t length) {
 5127|    172|  auto broadcast = [](uint8_t v) -> uint64_t {
 5128|    172|    return 0x101010101010101ull * v;
 5129|    172|  };
 5130|    172|  uint64_t broadcast_80 = broadcast(0x80);
 5131|    172|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 5132|    172|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 5133|    172|  size_t i = 0;
 5134|       |
 5135|    570|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (5135:10): [True: 398, False: 172]
  ------------------
 5136|    398|    uint64_t word{};
 5137|    398|    std::memcpy(&word, input + i, sizeof(word));
 5138|    398|    word ^=
 5139|    398|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5140|    398|    std::memcpy(input + i, &word, sizeof(word));
 5141|    398|  }
 5142|    172|  if (i < length) {
  ------------------
  |  Branch (5142:7): [True: 134, False: 38]
  ------------------
 5143|    134|    uint64_t word{};
 5144|    134|    std::memcpy(&word, input + i, length - i);
 5145|    134|    word ^=
 5146|    134|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5147|    134|    std::memcpy(input + i, &word, length - i);
 5148|    134|  }
 5149|    172|}
_ZN3ada4idna3mapENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIDiS4_NS1_9allocatorIDiEEEE:
 5153|  3.42k|bool map(std::u32string_view input, std::u32string& out) {
 5154|       |  //  [Map](https://www.unicode.org/reports/tr46/#ProcessingStepMap).
 5155|  3.42k|  out.clear();
 5156|  3.42k|  if (!ensure_tables()) {
  ------------------
  |  Branch (5156:7): [True: 0, False: 3.42k]
  ------------------
 5157|      0|    return false;
 5158|      0|  }
 5159|       |
 5160|       |  // Pass 1: validate and compute exact output length.
 5161|  3.42k|  size_t out_size = 0;
 5162|  46.2k|  for (char32_t x : input) {
  ------------------
  |  Branch (5162:19): [True: 46.2k, False: 3.21k]
  ------------------
 5163|  46.2k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5164|  46.2k|    if (status == IDNA_DISALLOWED) {
  ------------------
  |  Branch (5164:9): [True: 207, False: 46.0k]
  ------------------
 5165|    207|      return false;
 5166|    207|    }
 5167|  46.0k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5167:9): [True: 38.1k, False: 7.91k]
  ------------------
 5168|  38.1k|      ++out_size;
 5169|  38.1k|      continue;
 5170|  38.1k|    }
 5171|  7.91k|    if (static_cast<size_t>(status) >= idna_utf8_mappings_size) {
  ------------------
  |  Branch (5171:9): [True: 0, False: 7.91k]
  ------------------
 5172|      0|      return false;
 5173|      0|    }
 5174|  7.91k|    out_size += utf8_count_codepoints(idna_utf8_mappings + status);
 5175|  7.91k|  }
 5176|       |
 5177|       |  // Pass 2: write into a single allocation.
 5178|  3.21k|  out.resize(out_size);
 5179|  3.21k|  size_t w = 0;
 5180|  45.8k|  for (char32_t x : input) {
  ------------------
  |  Branch (5180:19): [True: 45.8k, False: 3.21k]
  ------------------
 5181|  45.8k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5182|  45.8k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5182:9): [True: 37.9k, False: 7.91k]
  ------------------
 5183|  37.9k|      out[w++] = x;
 5184|  37.9k|      continue;
 5185|  37.9k|    }
 5186|       |    // IGNORED or mapped (status already validated in pass 1).
 5187|  7.91k|    const uint8_t* ptr = idna_utf8_mappings + status;
 5188|  42.6k|    while (*ptr != 0) {
  ------------------
  |  Branch (5188:12): [True: 34.6k, False: 7.91k]
  ------------------
 5189|  34.6k|      out[w++] = utf8_next(ptr);
 5190|  34.6k|    }
 5191|  7.91k|  }
 5192|  3.21k|  return true;
 5193|  3.42k|}
_ZN3ada4idna28compute_decomposition_lengthENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5286|    854|    const std::u32string_view input) noexcept {
 5287|    854|  bool decomposition_needed{false};
 5288|    854|  size_t additional_elements{0};
 5289|  15.7k|  for (char32_t current_character : input) {
  ------------------
  |  Branch (5289:35): [True: 15.7k, False: 854]
  ------------------
 5290|  15.7k|    size_t decomposition_length{0};
 5291|       |
 5292|  15.7k|    if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5292:9): [True: 1.09k, False: 14.6k]
  ------------------
 5293|  1.09k|        current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5293:9): [True: 519, False: 577]
  ------------------
 5294|       |      // Full NFD-style Hangul decomp for the decompose() step.
 5295|    519|      decomposition_length = 2;
 5296|    519|      if ((current_character - hangul_sbase) % hangul_tcount) {
  ------------------
  |  Branch (5296:11): [True: 287, False: 232]
  ------------------
 5297|    287|        decomposition_length = 3;
 5298|    287|      }
 5299|  15.2k|    } else if (current_character < 0x110000) {
  ------------------
  |  Branch (5299:16): [True: 15.2k, False: 0]
  ------------------
 5300|  15.2k|      const uint8_t di = decomposition_index[current_character >> 8];
 5301|  15.2k|      const uint16_t* const decomposition =
 5302|  15.2k|          decomposition_block_row(di) + (current_character % 256);
 5303|  15.2k|      decomposition_length = (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5304|  15.2k|      if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5304:11): [True: 1.32k, False: 13.8k]
  |  Branch (5304:41): [True: 0, False: 1.32k]
  ------------------
 5305|      0|        decomposition_length = 0;
 5306|      0|      }
 5307|  15.2k|    }
 5308|  15.7k|    if (decomposition_length != 0) {
  ------------------
  |  Branch (5308:9): [True: 1.84k, False: 13.8k]
  ------------------
 5309|  1.84k|      decomposition_needed = true;
 5310|  1.84k|      additional_elements += decomposition_length - 1;
 5311|  1.84k|    }
 5312|  15.7k|  }
 5313|    854|  return {decomposition_needed, additional_elements};
 5314|    854|}
_ZN3ada4idna9decomposeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEEm:
 5316|    554|void decompose(std::u32string& input, size_t additional_elements) {
 5317|    554|  input.resize(input.size() + additional_elements);
 5318|    554|  for (size_t descending_idx = input.size(),
 5319|    554|              input_count = descending_idx - additional_elements;
 5320|  10.5k|       input_count--;) {
  ------------------
  |  Branch (5320:8): [True: 9.98k, False: 554]
  ------------------
 5321|  9.98k|    if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5321:9): [True: 822, False: 9.16k]
  ------------------
 5322|    822|        input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5322:9): [True: 519, False: 303]
  ------------------
 5323|       |      // Hangul decomposition.
 5324|    519|      char32_t s_index = input[input_count] - hangul_sbase;
 5325|    519|      if (s_index % hangul_tcount != 0) {
  ------------------
  |  Branch (5325:11): [True: 287, False: 232]
  ------------------
 5326|    287|        input[--descending_idx] = hangul_tbase + s_index % hangul_tcount;
 5327|    287|      }
 5328|    519|      input[--descending_idx] =
 5329|    519|          hangul_vbase + (s_index % hangul_ncount) / hangul_tcount;
 5330|    519|      input[--descending_idx] = hangul_lbase + s_index / hangul_ncount;
 5331|  9.46k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5331:16): [True: 9.46k, False: 0]
  ------------------
 5332|  9.46k|      const uint16_t* decomposition =
 5333|  9.46k|          decomposition_block_row(
 5334|  9.46k|              decomposition_index[input[input_count] >> 8]) +
 5335|  9.46k|          (input[input_count] % 256);
 5336|  9.46k|      uint16_t decomposition_length =
 5337|  9.46k|          (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5338|  9.46k|      if (decomposition_length > 0 && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5338:11): [True: 1.32k, False: 8.14k]
  |  Branch (5338:39): [True: 0, False: 1.32k]
  ------------------
 5339|      0|        decomposition_length = 0;
 5340|      0|      }
 5341|  9.46k|      if (decomposition_length > 0) {
  ------------------
  |  Branch (5341:11): [True: 1.32k, False: 8.14k]
  ------------------
 5342|  1.32k|        const size_t base = static_cast<size_t>(decomposition[0] >> 2);
 5343|  1.32k|        if (base + decomposition_length > decomposition_data_size) {
  ------------------
  |  Branch (5343:13): [True: 0, False: 1.32k]
  ------------------
 5344|      0|          input[--descending_idx] = input[input_count];
 5345|  1.32k|        } else {
 5346|  4.51k|          while (decomposition_length-- > 0) {
  ------------------
  |  Branch (5346:18): [True: 3.19k, False: 1.32k]
  ------------------
 5347|  3.19k|            input[--descending_idx] =
 5348|  3.19k|                decomposition_data[base + decomposition_length];
 5349|  3.19k|          }
 5350|  1.32k|        }
 5351|  8.14k|      } else {
 5352|  8.14k|        input[--descending_idx] = input[input_count];
 5353|  8.14k|      }
 5354|  9.46k|    } else {
 5355|      0|      input[--descending_idx] = input[input_count];
 5356|      0|    }
 5357|  9.98k|  }
 5358|    554|}
_ZN3ada4idna7get_cccEDi:
 5360|   220k|uint8_t get_ccc(char32_t c) noexcept {
 5361|   220k|  if (c >= 0x110000) {
  ------------------
  |  Branch (5361:7): [True: 0, False: 220k]
  ------------------
 5362|      0|    return 0;
 5363|      0|  }
 5364|   220k|  return ccc_block_row(ccc_index[c >> 8])[c % 256];
 5365|   220k|}
_ZN3ada4idna10sort_marksERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5367|    854|void sort_marks(std::u32string& input) {
 5368|  18.4k|  for (size_t idx = 1; idx < input.size(); idx++) {
  ------------------
  |  Branch (5368:24): [True: 17.5k, False: 854]
  ------------------
 5369|  17.5k|    uint8_t ccc = get_ccc(input[idx]);
 5370|  17.5k|    if (ccc == 0) {
  ------------------
  |  Branch (5370:9): [True: 14.0k, False: 3.49k]
  ------------------
 5371|  14.0k|      continue;
 5372|  14.0k|    }
 5373|  3.49k|    auto current_character = input[idx];
 5374|  3.49k|    size_t back_idx = idx;
 5375|  5.19k|    while (back_idx != 0 && get_ccc(input[back_idx - 1]) > ccc) {
  ------------------
  |  Branch (5375:12): [True: 5.10k, False: 87]
  |  Branch (5375:29): [True: 1.70k, False: 3.40k]
  ------------------
 5376|  1.70k|      input[back_idx] = input[back_idx - 1];
 5377|  1.70k|      back_idx--;
 5378|  1.70k|    }
 5379|  3.49k|    input[back_idx] = current_character;
 5380|  3.49k|  }
 5381|    854|}
_ZN3ada4idna13decompose_nfcERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5383|    854|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|    854|  auto [decomposition_needed, additional_elements] =
 5389|    854|      compute_decomposition_length(input);
 5390|    854|  if (decomposition_needed) {
  ------------------
  |  Branch (5390:7): [True: 554, False: 300]
  ------------------
 5391|    554|    decompose(input, additional_elements);
 5392|    554|  }
 5393|    854|  sort_marks(input);
 5394|    854|}
_ZN3ada4idna14is_already_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5477|  3.66k|bool is_already_nfc(std::u32string_view input) noexcept {
 5478|  3.66k|  if (input.empty()) {
  ------------------
  |  Branch (5478:7): [True: 0, False: 3.66k]
  ------------------
 5479|      0|    return true;
 5480|      0|  }
 5481|  3.66k|  if (!tables_are_ready() && !ensure_tables()) {
  ------------------
  |  Branch (5481:7): [True: 0, False: 3.66k]
  |  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|  76.8k|  for (char32_t c : input) {
  ------------------
  |  Branch (5486:19): [True: 76.8k, False: 3.66k]
  ------------------
 5487|  76.8k|    if (canonical_decomp_length(c) == 1) {
  ------------------
  |  Branch (5487:9): [True: 0, False: 76.8k]
  ------------------
 5488|      0|      return false;
 5489|      0|    }
 5490|  76.8k|  }
 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.66k|  uint8_t prev_ccc = 0;
 5495|  67.7k|  for (char32_t c : input) {
  ------------------
  |  Branch (5495:19): [True: 67.7k, False: 2.52k]
  ------------------
 5496|  67.7k|    uint8_t ccc = get_ccc(c);
 5497|  67.7k|    if (ccc != 0 && prev_ccc > ccc) {
  ------------------
  |  Branch (5497:9): [True: 3.91k, False: 63.8k]
  |  Branch (5497:21): [True: 1.13k, False: 2.78k]
  ------------------
 5498|  1.13k|      return false;
 5499|  1.13k|    }
 5500|  66.6k|    prev_ccc = trailing_ccc(c);
 5501|  66.6k|  }
 5502|       |  // 3) No pairwise composition would apply (including Hangul L+V / LV+T).
 5503|  2.52k|  return !would_compose(input);
 5504|  3.66k|}
_ZN3ada4idna7composeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5506|    854|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|    854|  size_t input_count{0};
 5512|    854|  size_t composition_count{0};
 5513|  14.8k|  for (; input_count < input.size(); input_count++, composition_count++) {
  ------------------
  |  Branch (5513:10): [True: 14.0k, False: 854]
  ------------------
 5514|  14.0k|    input[composition_count] = input[input_count];
 5515|  14.0k|    if (input[input_count] >= hangul_lbase &&
  ------------------
  |  Branch (5515:9): [True: 2.40k, False: 11.5k]
  ------------------
 5516|  2.40k|        input[input_count] < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5516:9): [True: 982, False: 1.42k]
  ------------------
 5517|    982|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5517:11): [True: 969, False: 13]
  ------------------
 5518|    969|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5518:11): [True: 709, False: 260]
  ------------------
 5519|    709|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5519:11): [True: 601, False: 108]
  ------------------
 5520|    601|        input[composition_count] =
 5521|    601|            hangul_sbase +
 5522|    601|            ((input[input_count] - hangul_lbase) * hangul_vcount +
 5523|    601|             input[input_count + 1] - hangul_vbase) *
 5524|    601|                hangul_tcount;
 5525|    601|        input_count++;
 5526|    601|        if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5526:13): [True: 585, False: 16]
  ------------------
 5527|    585|            input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5527:13): [True: 374, False: 211]
  ------------------
 5528|    374|            input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5528:13): [True: 287, False: 87]
  ------------------
 5529|    287|          input[composition_count] += input[++input_count] - hangul_tbase;
 5530|    287|        }
 5531|    601|      }
 5532|  13.0k|    } else if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5532:16): [True: 428, False: 12.5k]
  ------------------
 5533|    428|               input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5533:16): [True: 0, False: 428]
  ------------------
 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|  13.0k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5540:16): [True: 13.0k, False: 0]
  ------------------
 5541|  13.0k|      const uint16_t* composition =
 5542|  13.0k|          composition_block_row(composition_index[input[input_count] >> 8]) +
 5543|  13.0k|          (input[input_count] % 256);
 5544|  13.0k|      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.7k, False: 821]
  ------------------
 5546|  15.7k|           input_count++) {
 5547|  15.7k|        uint8_t ccc = get_ccc(input[input_count + 1]);
 5548|       |
 5549|  15.7k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5549:13): [True: 6.12k, False: 9.59k]
  |  Branch (5549:49): [True: 5.87k, False: 249]
  ------------------
 5550|  5.87k|          int left = composition[0];
 5551|  5.87k|          int right = composition[1];
 5552|  5.87k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5552:15): [True: 0, False: 5.87k]
  |  Branch (5552:27): [True: 0, False: 5.87k]
  ------------------
 5553|  5.87k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5553:15): [True: 0, False: 5.87k]
  ------------------
 5554|      0|            break;
 5555|      0|          }
 5556|  15.8k|          while (left + 2 < right) {
  ------------------
  |  Branch (5556:18): [True: 9.94k, False: 5.87k]
  ------------------
 5557|  9.94k|            int middle = left + (((right - left) >> 1) & ~1);
 5558|  9.94k|            if (composition_data[static_cast<size_t>(middle)] <=
  ------------------
  |  Branch (5558:17): [True: 3.47k, False: 6.47k]
  ------------------
 5559|  9.94k|                input[input_count + 1]) {
 5560|  3.47k|              left = middle;
 5561|  3.47k|            }
 5562|  9.94k|            if (composition_data[static_cast<size_t>(middle)] >=
  ------------------
  |  Branch (5562:17): [True: 8.07k, False: 1.87k]
  ------------------
 5563|  9.94k|                input[input_count + 1]) {
 5564|  8.07k|              right = middle;
 5565|  8.07k|            }
 5566|  9.94k|          }
 5567|  5.87k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5567:15): [True: 5.87k, False: 0]
  ------------------
 5568|  5.87k|              composition_data[static_cast<size_t>(left)] ==
  ------------------
  |  Branch (5568:15): [True: 2.03k, False: 3.84k]
  ------------------
 5569|  5.87k|                  input[input_count + 1]) {
 5570|  2.03k|            char32_t composed = composition_data[static_cast<size_t>(left + 1)];
 5571|  2.03k|            input[initial_composition_count] = composed;
 5572|  2.03k|            composition =
 5573|  2.03k|                composition_block_row(composition_index[composed >> 8]) +
 5574|  2.03k|                (composed % 256);
 5575|  2.03k|            continue;
 5576|  2.03k|          }
 5577|  5.87k|        }
 5578|       |
 5579|  13.6k|        if (ccc == 0) {
  ------------------
  |  Branch (5579:13): [True: 12.1k, False: 1.48k]
  ------------------
 5580|  12.1k|          break;
 5581|  12.1k|        }
 5582|  1.48k|        previous_ccc = ccc;
 5583|  1.48k|        input[++composition_count] = input[input_count + 1];
 5584|  1.48k|      }
 5585|  13.0k|    }
 5586|  14.0k|  }
 5587|       |
 5588|    854|  if (composition_count < input_count) {
  ------------------
  |  Branch (5588:7): [True: 741, False: 113]
  ------------------
 5589|    741|    input.resize(composition_count);
 5590|    741|  }
 5591|    854|}
_ZN3ada4idna9normalizeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5593|    854|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|    854|  if (!ensure_tables() || decomposition_index == nullptr ||
  ------------------
  |  Branch (5598:7): [True: 0, False: 854]
  |  Branch (5598:27): [True: 0, False: 854]
  ------------------
 5599|    854|      composition_index == nullptr) {
  ------------------
  |  Branch (5599:7): [True: 0, False: 854]
  ------------------
 5600|      0|    return false;
 5601|      0|  }
 5602|    854|  if (is_already_nfc(input)) {
  ------------------
  |  Branch (5602:7): [True: 0, False: 854]
  ------------------
 5603|      0|    return true;
 5604|      0|  }
 5605|    854|  decompose_nfc(input);
 5606|    854|  compose(input);
 5607|    854|  return true;
 5608|    854|}
_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: 247, False: 960]
  ------------------
 5677|  1.97k|    for (uint8_t c : input.substr(0, end_of_ascii)) {
  ------------------
  |  Branch (5677:20): [True: 1.97k, False: 247]
  ------------------
 5678|  1.97k|      if (c >= 0x80) {
  ------------------
  |  Branch (5678:11): [True: 0, False: 1.97k]
  ------------------
 5679|      0|        return false;
 5680|      0|      }
 5681|  1.97k|      out.push_back(c);
 5682|  1.97k|      written_out++;
 5683|  1.97k|    }
 5684|    247|    input.remove_prefix(end_of_ascii + 1);
 5685|    247|  }
 5686|  7.95k|  while (!input.empty()) {
  ------------------
  |  Branch (5686:10): [True: 6.86k, False: 1.09k]
  ------------------
 5687|  6.86k|    int32_t oldi = i;
 5688|  6.86k|    int32_t w = 1;
 5689|  11.7k|    for (int32_t k = base;; k += base) {
 5690|  11.7k|      if (input.empty()) {
  ------------------
  |  Branch (5690:11): [True: 45, False: 11.6k]
  ------------------
 5691|     45|        return false;
 5692|     45|      }
 5693|  11.6k|      uint8_t code_point = input.front();
 5694|  11.6k|      input.remove_prefix(1);
 5695|  11.6k|      int32_t digit = char_to_digit_value(code_point);
 5696|  11.6k|      if (digit < 0) {
  ------------------
  |  Branch (5696:11): [True: 35, False: 11.6k]
  ------------------
 5697|     35|        return false;
 5698|     35|      }
 5699|  11.6k|      if (digit > (0x7fffffff - i) / w) {
  ------------------
  |  Branch (5699:11): [True: 5, False: 11.6k]
  ------------------
 5700|      5|        return false;
 5701|      5|      }
 5702|  11.6k|      i = i + digit * w;
 5703|  11.6k|      int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5703:19): [True: 2.85k, False: 8.77k]
  |  Branch (5703:38): [True: 8.16k, False: 618]
  ------------------
 5704|  11.6k|      if (digit < t) {
  ------------------
  |  Branch (5704:11): [True: 6.77k, False: 4.85k]
  ------------------
 5705|  6.77k|        break;
 5706|  6.77k|      }
 5707|  4.85k|      if (w > 0x7fffffff / (base - t)) {
  ------------------
  |  Branch (5707:11): [True: 0, False: 4.85k]
  ------------------
 5708|      0|        return false;
 5709|      0|      }
 5710|  4.85k|      w = w * (base - t);
 5711|  4.85k|    }
 5712|  6.77k|    bias = adapt(i - oldi, written_out + 1, oldi == 0);
 5713|  6.77k|    if (i / (written_out + 1) > int32_t(0x7fffffff - n)) {
  ------------------
  |  Branch (5713:9): [True: 26, False: 6.74k]
  ------------------
 5714|     26|      return false;
 5715|     26|    }
 5716|  6.74k|    n = n + i / (written_out + 1);
 5717|  6.74k|    i = i % (written_out + 1);
 5718|  6.74k|    if (n < 0x80) {
  ------------------
  |  Branch (5718:9): [True: 0, False: 6.74k]
  ------------------
 5719|      0|      return false;
 5720|      0|    }
 5721|  6.74k|    out.insert(out.begin() + i, n);
 5722|  6.74k|    written_out++;
 5723|  6.74k|    ++i;
 5724|  6.74k|  }
 5725|       |  // See https://github.com/whatwg/url/issues/803
 5726|       |  // Reject labels whose decoded form begins with "xn--" (double-encoded ACE).
 5727|  1.09k|  if (out.size() >= 4 && out[0] == U'x' && out[1] == U'n' && out[2] == U'-' &&
  ------------------
  |  Branch (5727:7): [True: 450, False: 646]
  |  Branch (5727:26): [True: 130, False: 320]
  |  Branch (5727:44): [True: 88, False: 42]
  |  Branch (5727:62): [True: 44, False: 44]
  ------------------
 5728|     44|      out[3] == U'-') {
  ------------------
  |  Branch (5728:7): [True: 1, False: 43]
  ------------------
 5729|      1|    return false;
 5730|      1|  }
 5731|  1.09k|  return true;
 5732|  1.09k|}
_ZN3ada4idna17utf32_to_punycodeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIcNS3_IcEENS1_9allocatorIcEEEE:
 5812|  2.16k|bool utf32_to_punycode(std::u32string_view input, std::string &out) {
 5813|  2.16k|  out.reserve(input.size() + out.size());
 5814|  2.16k|  uint32_t n = initial_n;
 5815|  2.16k|  int32_t d = 0;
 5816|  2.16k|  int32_t bias = initial_bias;
 5817|  2.16k|  size_t h = 0;
 5818|       |  // first push the ascii content
 5819|  16.6k|  for (uint32_t c : input) {
  ------------------
  |  Branch (5819:19): [True: 16.6k, False: 2.16k]
  ------------------
 5820|  16.6k|    if (c < 0x80) {
  ------------------
  |  Branch (5820:9): [True: 3.74k, False: 12.9k]
  ------------------
 5821|  3.74k|      ++h;
 5822|  3.74k|      out.push_back(char(c));
 5823|  3.74k|    }
 5824|  16.6k|    if (c > 0x10ffff || (c >= 0xd800 && c < 0xe000)) {
  ------------------
  |  Branch (5824:9): [True: 0, False: 16.6k]
  |  Branch (5824:26): [True: 532, False: 16.1k]
  |  Branch (5824:41): [True: 0, False: 532]
  ------------------
 5825|      0|      return false;
 5826|      0|    }
 5827|  16.6k|  }
 5828|  2.16k|  size_t b = h;
 5829|  2.16k|  if (b > 0) {
  ------------------
  |  Branch (5829:7): [True: 631, False: 1.53k]
  ------------------
 5830|    631|    out.push_back('-');
 5831|    631|  }
 5832|  7.27k|  while (h < input.size()) {
  ------------------
  |  Branch (5832:10): [True: 5.10k, False: 2.16k]
  ------------------
 5833|  5.10k|    uint32_t m = 0x10FFFF;
 5834|   149k|    for (auto code_point : input) {
  ------------------
  |  Branch (5834:26): [True: 149k, False: 5.10k]
  ------------------
 5835|   149k|      if (code_point >= n && code_point < m) m = code_point;
  ------------------
  |  Branch (5835:11): [True: 58.0k, False: 91.2k]
  |  Branch (5835:30): [True: 7.59k, False: 50.4k]
  ------------------
 5836|   149k|    }
 5837|       |
 5838|  5.10k|    if ((m - n) > (0x7fffffff - d) / (h + 1)) {
  ------------------
  |  Branch (5838:9): [True: 0, False: 5.10k]
  ------------------
 5839|      0|      return false;
 5840|      0|    }
 5841|  5.10k|    d = d + int32_t((m - n) * (h + 1));
 5842|  5.10k|    n = m;
 5843|   149k|    for (auto c : input) {
  ------------------
  |  Branch (5843:17): [True: 149k, False: 5.10k]
  ------------------
 5844|   149k|      if (c < n) {
  ------------------
  |  Branch (5844:11): [True: 91.2k, False: 58.0k]
  ------------------
 5845|  91.2k|        if (d == 0x7fffffff) {
  ------------------
  |  Branch (5845:13): [True: 0, False: 91.2k]
  ------------------
 5846|      0|          return false;
 5847|      0|        }
 5848|  91.2k|        ++d;
 5849|  91.2k|      }
 5850|   149k|      if (c == n) {
  ------------------
  |  Branch (5850:11): [True: 12.9k, False: 136k]
  ------------------
 5851|  12.9k|        int32_t q = d;
 5852|  22.7k|        for (int32_t k = base;; k += base) {
 5853|  22.7k|          int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5853:23): [True: 5.19k, False: 17.5k]
  |  Branch (5853:42): [True: 16.2k, False: 1.34k]
  ------------------
 5854|       |
 5855|  22.7k|          if (q < t) {
  ------------------
  |  Branch (5855:15): [True: 12.9k, False: 9.81k]
  ------------------
 5856|  12.9k|            break;
 5857|  12.9k|          }
 5858|  9.81k|          out.push_back(digit_to_char(t + ((q - t) % (base - t))));
 5859|  9.81k|          q = (q - t) / (base - t);
 5860|  9.81k|        }
 5861|  12.9k|        out.push_back(digit_to_char(q));
 5862|  12.9k|        bias = adapt(d, int32_t(h + 1), h == b);
 5863|  12.9k|        d = 0;
 5864|  12.9k|        ++h;
 5865|  12.9k|      }
 5866|   149k|    }
 5867|  5.10k|    ++d;
 5868|  5.10k|    ++n;
 5869|  5.10k|  }
 5870|  2.16k|  return true;
 5871|  2.16k|}
_ZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5955|  3.47k|bool is_label_valid(const std::u32string_view label) {
 5956|  3.47k|  if (label.empty()) {
  ------------------
  |  Branch (5956:7): [True: 0, False: 3.47k]
  ------------------
 5957|      0|    return true;
 5958|      0|  }
 5959|  3.47k|  if (!ensure_tables() || combining_ranges == nullptr || dir_start == nullptr ||
  ------------------
  |  Branch (5959:7): [True: 0, False: 3.47k]
  |  Branch (5959:27): [True: 0, False: 3.47k]
  |  Branch (5959:58): [True: 0, False: 3.47k]
  ------------------
 5960|  3.47k|      dir_final == nullptr || dir_value == nullptr) {
  ------------------
  |  Branch (5960:7): [True: 0, False: 3.47k]
  |  Branch (5960:31): [True: 0, False: 3.47k]
  ------------------
 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|  3.47k|  const std::span<const uint32_t[2]> comb_span{combining_ranges,
 5986|  3.47k|                                               combining_range_count};
 5987|  3.47k|  const auto comb_it = std::ranges::lower_bound(
 5988|  3.47k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
 5989|  3.47k|  if (comb_it != comb_span.end() && label.front() >= (*comb_it)[0]) {
  ------------------
  |  Branch (5989:7): [True: 3.47k, False: 0]
  |  Branch (5989:7): [True: 95, False: 3.37k]
  |  Branch (5989:37): [True: 95, False: 3.37k]
  ------------------
 5990|     95|    return false;
 5991|     95|  }
 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|  3.37k|  constexpr static uint32_t virama[] = {
 6004|  3.37k|      0x094D,  0x09CD,  0x0A4D,  0x0ACD,  0x0B4D,  0x0BCD,  0x0C4D,  0x0CCD,
 6005|  3.37k|      0x0D3B,  0x0D3C,  0x0D4D,  0x0DCA,  0x0E3A,  0x0EBA,  0x0F84,  0x1039,
 6006|  3.37k|      0x103A,  0x1714,  0x1734,  0x17D2,  0x1A60,  0x1B44,  0x1BAA,  0x1BAB,
 6007|  3.37k|      0x1BF2,  0x1BF3,  0x2D7F,  0xA806,  0xA82C,  0xA8C4,  0xA953,  0xA9C0,
 6008|  3.37k|      0xAAF6,  0xABED,  0x10A3F, 0x11046, 0x1107F, 0x110B9, 0x11133, 0x11134,
 6009|  3.37k|      0x111C0, 0x11235, 0x112EA, 0x1134D, 0x11442, 0x114C2, 0x115BF, 0x1163F,
 6010|  3.37k|      0x116B6, 0x1172B, 0x11839, 0x1193D, 0x1193E, 0x119E0, 0x11A34, 0x11A47,
 6011|  3.37k|      0x11A99, 0x11C3F, 0x11D44, 0x11D45, 0x11D97};
 6012|  3.37k|  constexpr static uint32_t R[] = {
 6013|  3.37k|      0x622, 0x623, 0x624, 0x625, 0x627, 0x629, 0x62f, 0x630, 0x631,
 6014|  3.37k|      0x632, 0x648, 0x671, 0x672, 0x673, 0x675, 0x676, 0x677, 0x688,
 6015|  3.37k|      0x689, 0x68a, 0x68b, 0x68c, 0x68d, 0x68e, 0x68f, 0x690, 0x691,
 6016|  3.37k|      0x692, 0x693, 0x694, 0x695, 0x696, 0x697, 0x698, 0x699, 0x6c0,
 6017|  3.37k|      0x6c3, 0x6c4, 0x6c5, 0x6c6, 0x6c7, 0x6c8, 0x6c9, 0x6ca, 0x6cb,
 6018|  3.37k|      0x6cd, 0x6cf, 0x6d2, 0x6d3, 0x6d5, 0x6ee, 0x6ef, 0x710, 0x715,
 6019|  3.37k|      0x716, 0x717, 0x718, 0x719, 0x71e, 0x728, 0x72a, 0x72c, 0x72f,
 6020|  3.37k|      0x74d, 0x759, 0x75a, 0x75b, 0x854, 0x8aa, 0x8ab, 0x8ac};
 6021|  3.37k|  constexpr static uint32_t L[] = {0xa872};
 6022|  3.37k|  constexpr static uint32_t D[] = {
 6023|  3.37k|      0x620,  0x626,  0x628,  0x62a,  0x62b,  0x62c,  0x62d,  0x62e,  0x633,
 6024|  3.37k|      0x634,  0x635,  0x636,  0x637,  0x638,  0x639,  0x63a,  0x63b,  0x63c,
 6025|  3.37k|      0x63d,  0x63e,  0x63f,  0x641,  0x642,  0x643,  0x644,  0x645,  0x646,
 6026|  3.37k|      0x647,  0x649,  0x64a,  0x66e,  0x66f,  0x678,  0x679,  0x67a,  0x67b,
 6027|  3.37k|      0x67c,  0x67d,  0x67e,  0x67f,  0x680,  0x681,  0x682,  0x683,  0x684,
 6028|  3.37k|      0x685,  0x686,  0x687,  0x69a,  0x69b,  0x69c,  0x69d,  0x69e,  0x69f,
 6029|  3.37k|      0x6a0,  0x6a1,  0x6a2,  0x6a3,  0x6a4,  0x6a5,  0x6a6,  0x6a7,  0x6a8,
 6030|  3.37k|      0x6a9,  0x6aa,  0x6ab,  0x6ac,  0x6ad,  0x6ae,  0x6af,  0x6b0,  0x6b1,
 6031|  3.37k|      0x6b2,  0x6b3,  0x6b4,  0x6b5,  0x6b6,  0x6b7,  0x6b8,  0x6b9,  0x6ba,
 6032|  3.37k|      0x6bb,  0x6bc,  0x6bd,  0x6be,  0x6bf,  0x6c1,  0x6c2,  0x6cc,  0x6ce,
 6033|  3.37k|      0x6d0,  0x6d1,  0x6fa,  0x6fb,  0x6fc,  0x6ff,  0x712,  0x713,  0x714,
 6034|  3.37k|      0x71a,  0x71b,  0x71c,  0x71d,  0x71f,  0x720,  0x721,  0x722,  0x723,
 6035|  3.37k|      0x724,  0x725,  0x726,  0x727,  0x729,  0x72b,  0x72d,  0x72e,  0x74e,
 6036|  3.37k|      0x74f,  0x750,  0x751,  0x752,  0x753,  0x754,  0x755,  0x756,  0x757,
 6037|  3.37k|      0x758,  0x75c,  0x75d,  0x75e,  0x75f,  0x760,  0x761,  0x762,  0x763,
 6038|  3.37k|      0x764,  0x765,  0x766,  0x850,  0x851,  0x852,  0x853,  0x855,  0x8a0,
 6039|  3.37k|      0x8a2,  0x8a3,  0x8a4,  0x8a5,  0x8a6,  0x8a7,  0x8a8,  0x8a9,  0x1807,
 6040|  3.37k|      0x1820, 0x1821, 0x1822, 0x1823, 0x1824, 0x1825, 0x1826, 0x1827, 0x1828,
 6041|  3.37k|      0x1829, 0x182a, 0x182b, 0x182c, 0x182d, 0x182e, 0x182f, 0x1830, 0x1831,
 6042|  3.37k|      0x1832, 0x1833, 0x1834, 0x1835, 0x1836, 0x1837, 0x1838, 0x1839, 0x183a,
 6043|  3.37k|      0x183b, 0x183c, 0x183d, 0x183e, 0x183f, 0x1840, 0x1841, 0x1842, 0x1843,
 6044|  3.37k|      0x1844, 0x1845, 0x1846, 0x1847, 0x1848, 0x1849, 0x184a, 0x184b, 0x184c,
 6045|  3.37k|      0x184d, 0x184e, 0x184f, 0x1850, 0x1851, 0x1852, 0x1853, 0x1854, 0x1855,
 6046|  3.37k|      0x1856, 0x1857, 0x1858, 0x1859, 0x185a, 0x185b, 0x185c, 0x185d, 0x185e,
 6047|  3.37k|      0x185f, 0x1860, 0x1861, 0x1862, 0x1863, 0x1864, 0x1865, 0x1866, 0x1867,
 6048|  3.37k|      0x1868, 0x1869, 0x186a, 0x186b, 0x186c, 0x186d, 0x186e, 0x186f, 0x1870,
 6049|  3.37k|      0x1871, 0x1872, 0x1873, 0x1874, 0x1875, 0x1876, 0x1877, 0x1887, 0x1888,
 6050|  3.37k|      0x1889, 0x188a, 0x188b, 0x188c, 0x188d, 0x188e, 0x188f, 0x1890, 0x1891,
 6051|  3.37k|      0x1892, 0x1893, 0x1894, 0x1895, 0x1896, 0x1897, 0x1898, 0x1899, 0x189a,
 6052|  3.37k|      0x189b, 0x189c, 0x189d, 0x189e, 0x189f, 0x18a0, 0x18a1, 0x18a2, 0x18a3,
 6053|  3.37k|      0x18a4, 0x18a5, 0x18a6, 0x18a7, 0x18a8, 0x18aa, 0xa840, 0xa841, 0xa842,
 6054|  3.37k|      0xa843, 0xa844, 0xa845, 0xa846, 0xa847, 0xa848, 0xa849, 0xa84a, 0xa84b,
 6055|  3.37k|      0xa84c, 0xa84d, 0xa84e, 0xa84f, 0xa850, 0xa851, 0xa852, 0xa853, 0xa854,
 6056|  3.37k|      0xa855, 0xa856, 0xa857, 0xa858, 0xa859, 0xa85a, 0xa85b, 0xa85c, 0xa85d,
 6057|  3.37k|      0xa85e, 0xa85f, 0xa860, 0xa861, 0xa862, 0xa863, 0xa864, 0xa865, 0xa866,
 6058|  3.37k|      0xa867, 0xa868, 0xa869, 0xa86a, 0xa86b, 0xa86c, 0xa86d, 0xa86e, 0xa86f,
 6059|  3.37k|      0xa870, 0xa871};
 6060|       |
 6061|  36.1k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6061:22): [True: 33.2k, False: 2.94k]
  ------------------
 6062|  33.2k|    uint32_t c = label[i];
 6063|  33.2k|    if (c == 0x200c) {
  ------------------
  |  Branch (6063:9): [True: 349, False: 32.9k]
  ------------------
 6064|    349|      if (i > 0) {
  ------------------
  |  Branch (6064:11): [True: 348, False: 1]
  ------------------
 6065|    348|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6065:13): [True: 28, False: 320]
  ------------------
 6066|     28|          return true;
 6067|     28|        }
 6068|    348|      }
 6069|    321|      if ((i == 0) || (i + 1 >= label.size())) {
  ------------------
  |  Branch (6069:11): [True: 1, False: 320]
  |  Branch (6069:23): [True: 29, False: 291]
  ------------------
 6070|     30|        return false;
 6071|     30|      }
 6072|       |      // we go backward looking for L or D
 6073|    291|      auto is_l_or_d = [](uint32_t code) {
 6074|    291|        return std::ranges::binary_search(L, code) ||
 6075|    291|               std::ranges::binary_search(D, code);
 6076|    291|      };
 6077|    291|      auto is_r_or_d = [](uint32_t code) {
 6078|    291|        return std::ranges::binary_search(R, code) ||
 6079|    291|               std::ranges::binary_search(D, code);
 6080|    291|      };
 6081|    291|      std::u32string_view before = label.substr(0, i);
 6082|    291|      std::u32string_view after = label.substr(i + 1);
 6083|    291|      return (std::find_if(before.begin(), before.end(), is_l_or_d) !=
  ------------------
  |  Branch (6083:14): [True: 248, False: 43]
  ------------------
 6084|    291|              before.end()) &&
 6085|    248|             (std::find_if(after.begin(), after.end(), is_r_or_d) !=
  ------------------
  |  Branch (6085:14): [True: 169, False: 79]
  ------------------
 6086|    248|              after.end());
 6087|  32.9k|    } else if (c == 0x200d) {
  ------------------
  |  Branch (6087:16): [True: 82, False: 32.8k]
  ------------------
 6088|     82|      if (i > 0) {
  ------------------
  |  Branch (6088:11): [True: 80, False: 2]
  ------------------
 6089|     80|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6089:13): [True: 53, False: 27]
  ------------------
 6090|     53|          return true;
 6091|     53|        }
 6092|     80|      }
 6093|     29|      return false;
 6094|     82|    }
 6095|  33.2k|  }
 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|  2.94k|  size_t last_non_nsm_char = find_last_not_of_nsm(label);
 6128|  2.94k|  if (last_non_nsm_char == std::u32string_view::npos) {
  ------------------
  |  Branch (6128:7): [True: 0, False: 2.94k]
  ------------------
 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|  2.94k|  if (is_rtl_label(label)) {
  ------------------
  |  Branch (6135:7): [True: 1.06k, False: 1.88k]
  ------------------
 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.06k|    if (find_direction(label[0]) == direction::L) {
  ------------------
  |  Branch (6140:9): [True: 150, False: 915]
  ------------------
 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.48k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6145:26): [True: 1.48k, False: 0]
  ------------------
 6146|  1.48k|        const direction d = find_direction(label[i]);
 6147|  1.48k|        if (!(d == direction::L || d == direction::EN || d == direction::ES ||
  ------------------
  |  Branch (6147:15): [True: 527, False: 962]
  |  Branch (6147:36): [True: 104, False: 858]
  |  Branch (6147:58): [True: 97, False: 761]
  ------------------
 6148|    761|              d == direction::CS || d == direction::ET || d == direction::ON ||
  ------------------
  |  Branch (6148:15): [True: 111, False: 650]
  |  Branch (6148:37): [True: 95, False: 555]
  |  Branch (6148:59): [True: 117, False: 438]
  ------------------
 6149|    438|              d == direction::BN || d == direction::NSM)) {
  ------------------
  |  Branch (6149:15): [True: 208, False: 230]
  |  Branch (6149:37): [True: 80, False: 150]
  ------------------
 6150|    150|          return false;
 6151|    150|        }
 6152|  1.48k|      }
 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|    915|    } 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|    915|      const direction first_dir = find_direction(label[0]);
 6167|    915|      if (first_dir != direction::R && first_dir != direction::AL) {
  ------------------
  |  Branch (6167:11): [True: 570, False: 345]
  |  Branch (6167:40): [True: 30, False: 540]
  ------------------
 6168|     30|        return false;
 6169|     30|      }
 6170|       |
 6171|    885|      bool has_an = false;
 6172|    885|      bool has_en = false;
 6173|  3.42k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6173:26): [True: 2.65k, False: 773]
  ------------------
 6174|  2.65k|        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|  2.65k|        if ((d == direction::EN && ((has_en = true) && has_an)) ||
  ------------------
  |  Branch (6178:14): [True: 252, False: 2.40k]
  |  Branch (6178:37): [True: 252, False: 0]
  |  Branch (6178:56): [True: 1, False: 251]
  ------------------
 6179|  2.65k|            (d == direction::AN && ((has_an = true) && has_en))) {
  ------------------
  |  Branch (6179:14): [True: 101, False: 2.55k]
  |  Branch (6179:37): [True: 101, False: 0]
  |  Branch (6179:56): [True: 1, False: 100]
  ------------------
 6180|      2|          return false;
 6181|      2|        }
 6182|       |
 6183|  2.65k|        if (!(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6183:15): [True: 460, False: 2.19k]
  |  Branch (6183:36): [True: 997, False: 1.19k]
  |  Branch (6183:58): [True: 100, False: 1.09k]
  ------------------
 6184|  1.09k|              d == direction::EN || d == direction::ES || d == direction::CS ||
  ------------------
  |  Branch (6184:15): [True: 251, False: 845]
  |  Branch (6184:37): [True: 82, False: 763]
  |  Branch (6184:59): [True: 87, False: 676]
  ------------------
 6185|    676|              d == direction::ET || d == direction::ON || d == direction::BN ||
  ------------------
  |  Branch (6185:15): [True: 81, False: 595]
  |  Branch (6185:37): [True: 117, False: 478]
  |  Branch (6185:59): [True: 207, False: 271]
  ------------------
 6186|    271|              d == direction::NSM)) {
  ------------------
  |  Branch (6186:15): [True: 216, False: 55]
  ------------------
 6187|     55|          return false;
 6188|     55|        }
 6189|       |
 6190|  2.59k|        if (i == last_non_nsm_char &&
  ------------------
  |  Branch (6190:13): [True: 828, False: 1.77k]
  ------------------
 6191|    828|            !(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6191:15): [True: 275, False: 553]
  |  Branch (6191:36): [True: 363, False: 190]
  |  Branch (6191:58): [True: 40, False: 150]
  ------------------
 6192|    150|              d == direction::EN)) {
  ------------------
  |  Branch (6192:15): [True: 95, False: 55]
  ------------------
 6193|     55|          return false;
 6194|     55|        }
 6195|  2.59k|      }
 6196|       |
 6197|    773|      return true;
 6198|    885|    }
 6199|  1.06k|  }
 6200|       |
 6201|  1.88k|  return true;
 6202|  2.94k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6359|  2.71k|[[nodiscard]] bool to_ascii(std::string_view ut8_string, std::string& out) {
 6360|  2.71k|  out.clear();
 6361|  2.71k|  if (ut8_string.size() > max_domain_input_bytes) {
  ------------------
  |  Branch (6361:7): [True: 0, False: 2.71k]
  ------------------
 6362|      0|    return false;
 6363|      0|  }
 6364|  2.71k|  if (is_ascii(ut8_string)) {
  ------------------
  |  Branch (6364:7): [True: 172, False: 2.54k]
  ------------------
 6365|    172|    from_ascii_to_ascii(ut8_string, out);
 6366|    172|    return true;
 6367|    172|  }
 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.54k|  size_t utf32_length =
 6380|  2.54k|      ada::idna::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6381|  2.54k|  if (utf32_length == 0 && !ut8_string.empty()) {
  ------------------
  |  Branch (6381:7): [True: 3, False: 2.54k]
  |  Branch (6381:28): [True: 3, False: 0]
  ------------------
 6382|      3|    return false;
 6383|      3|  }
 6384|  2.54k|  std::u32string working(utf32_length, U'\0');
 6385|  2.54k|  size_t actual_utf32_length = ada::idna::utf8_to_utf32(
 6386|  2.54k|      ut8_string.data(), ut8_string.size(), working.data());
 6387|  2.54k|#endif
 6388|  2.54k|  if (actual_utf32_length == 0 || actual_utf32_length != utf32_length) {
  ------------------
  |  Branch (6388:7): [True: 162, False: 2.38k]
  |  Branch (6388:35): [True: 0, False: 2.38k]
  ------------------
 6389|    162|    return false;
 6390|    162|  }
 6391|  2.38k|  working.resize(actual_utf32_length);
 6392|       |
 6393|       |  // Map into a second buffer with exact sizing (no growth reallocs).
 6394|  2.38k|  std::u32string mapped;
 6395|  2.38k|  if (!ada::idna::map(working, mapped)) {
  ------------------
  |  Branch (6395:7): [True: 41, False: 2.34k]
  ------------------
 6396|     41|    return false;
 6397|     41|  }
 6398|       |  // Drop UTF-32 input; reuse `working` as scratch for ACE validation below.
 6399|  2.34k|  working.clear();
 6400|       |
 6401|       |  // Skip NFC when already normalized (ASCII is a fast subset of this check).
 6402|  2.34k|  if (!is_ascii(mapped) && !is_already_nfc(mapped)) {
  ------------------
  |  Branch (6402:7): [True: 1.96k, False: 375]
  |  Branch (6402:28): [True: 418, False: 1.54k]
  ------------------
 6403|    418|    if (!normalize(mapped)) {
  ------------------
  |  Branch (6403:9): [True: 0, False: 418]
  ------------------
 6404|      0|      return false;
 6405|      0|    }
 6406|    418|  }
 6407|       |
 6408|       |  // Estimate ASCII output size (punycode may expand non-ASCII labels).
 6409|  2.34k|  out.reserve(mapped.size() + 8);
 6410|       |
 6411|       |  // Walk labels with a single pointer scan (no repeated string::find).
 6412|  2.34k|  const char32_t* p = mapped.data();
 6413|  2.34k|  const char32_t* const end = p + mapped.size();
 6414|  2.34k|  std::u32string post_map;
 6415|       |
 6416|  6.91k|  while (p < end) {
  ------------------
  |  Branch (6416:10): [True: 5.60k, False: 1.30k]
  ------------------
 6417|  5.60k|    const char32_t* label_begin = p;
 6418|  63.7k|    while (p < end && *p != U'.') {
  ------------------
  |  Branch (6418:12): [True: 62.4k, False: 1.30k]
  |  Branch (6418:23): [True: 58.1k, False: 4.29k]
  ------------------
 6419|  58.1k|      ++p;
 6420|  58.1k|    }
 6421|  5.60k|    const size_t label_size = static_cast<size_t>(p - label_begin);
 6422|  5.60k|    std::u32string_view label_view(label_begin, label_size);
 6423|  5.60k|    const bool is_last_label = (p == end);
 6424|  5.60k|    if (p < end) {
  ------------------
  |  Branch (6424:9): [True: 4.29k, False: 1.30k]
  ------------------
 6425|  4.29k|      ++p;  // skip dot
 6426|  4.29k|    }
 6427|       |
 6428|  5.60k|    if (label_size == 0) {
  ------------------
  |  Branch (6428:9): [True: 166, False: 5.43k]
  ------------------
 6429|       |      // empty label
 6430|  5.43k|    } else if (is_ace_prefix(label_view)) {
  ------------------
  |  Branch (6430:16): [True: 1.22k, False: 4.21k]
  ------------------
 6431|  19.7k|      for (char32_t c : label_view) {
  ------------------
  |  Branch (6431:23): [True: 19.7k, False: 1.20k]
  ------------------
 6432|  19.7k|        if (c >= 0x80) {
  ------------------
  |  Branch (6432:13): [True: 14, False: 19.7k]
  ------------------
 6433|     14|          out.clear();
 6434|     14|          return false;
 6435|     14|        }
 6436|  19.7k|      }
 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: 112, False: 1.09k]
  ------------------
 6442|    112|        out.clear();
 6443|    112|        return false;
 6444|    112|      }
 6445|  1.09k|      if (is_ascii(working)) {
  ------------------
  |  Branch (6445:11): [True: 51, False: 1.04k]
  ------------------
 6446|     51|        out.clear();
 6447|     51|        return false;
 6448|     51|      }
 6449|  1.04k|      if (!ada::idna::map(working, post_map) || working != post_map) {
  ------------------
  |  Branch (6449:11): [True: 166, False: 878]
  |  Branch (6449:49): [True: 36, False: 842]
  ------------------
 6450|    202|        out.clear();
 6451|    202|        return false;
 6452|    202|      }
 6453|       |      // Mapping must be stable; NFC must not change the mapped form either.
 6454|    842|      if (!is_ascii(post_map) && !is_already_nfc(post_map)) {
  ------------------
  |  Branch (6454:11): [True: 842, False: 0]
  |  Branch (6454:34): [True: 436, False: 406]
  ------------------
 6455|    436|        if (!normalize(post_map) || post_map != working) {
  ------------------
  |  Branch (6455:13): [True: 0, False: 436]
  |  Branch (6455:37): [True: 85, False: 351]
  ------------------
 6456|     85|          out.clear();
 6457|     85|          return false;
 6458|     85|        }
 6459|    436|      }
 6460|    757|      if (post_map.empty() || !is_label_valid(post_map)) {
  ------------------
  |  Branch (6460:11): [True: 0, False: 757]
  |  Branch (6460:31): [True: 18, False: 739]
  ------------------
 6461|     18|        out.clear();
 6462|     18|        return false;
 6463|     18|      }
 6464|  4.21k|    } else if (is_ascii(label_view)) {
  ------------------
  |  Branch (6464:16): [True: 1.49k, False: 2.71k]
  ------------------
 6465|  1.49k|      append_ascii_label(out, label_view);
 6466|  2.71k|    } else {
 6467|  2.71k|      if (!is_label_valid(label_view)) {
  ------------------
  |  Branch (6467:11): [True: 550, False: 2.16k]
  ------------------
 6468|    550|        out.clear();
 6469|    550|        return false;
 6470|    550|      }
 6471|  2.16k|      out.append("xn--");
 6472|  2.16k|      if (!ada::idna::utf32_to_punycode(label_view, out)) {
  ------------------
  |  Branch (6472:11): [True: 0, False: 2.16k]
  ------------------
 6473|      0|        out.clear();
 6474|      0|        return false;
 6475|      0|      }
 6476|  2.16k|    }
 6477|  4.56k|    if (!is_last_label) {
  ------------------
  |  Branch (6477:9): [True: 3.27k, False: 1.29k]
  ------------------
 6478|  3.27k|      out.push_back('.');
 6479|  3.27k|    }
 6480|  4.56k|  }
 6481|  1.30k|  return true;
 6482|  2.34k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6484|  2.71k|std::string to_ascii(std::string_view ut8_string) {
 6485|  2.71k|  std::string out;
 6486|  2.71k|  if (!to_ascii(ut8_string, out)) {
  ------------------
  |  Branch (6486:7): [True: 1.23k, False: 1.48k]
  ------------------
 6487|  1.23k|    return {};
 6488|  1.23k|  }
 6489|  1.48k|  return out;
 6490|  2.71k|}
_ZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7349|  42.6k|                    std::string& out) {
 7350|  42.6k|  ada_log("percent_encode ", input, " to output string while ",
 7351|  42.6k|          append ? "appending" : "overwriting");
 7352|  42.6k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7353|  42.6k|    return character_sets::bit_at(character_set, c);
 7354|  42.6k|  });
 7355|  42.6k|  ada_log("percent_encode done checking, moved to ",
 7356|  42.6k|          std::distance(input.begin(), pointer));
 7357|       |
 7358|       |  // Optimization: Don't iterate if percent encode is not required
 7359|  42.6k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7359:7): [True: 40.3k, False: 2.34k]
  ------------------
 7360|  40.3k|    ada_log("percent_encode encoding not needed.");
 7361|  40.3k|    return false;
 7362|  40.3k|  }
 7363|       |  if constexpr (!append) {
 7364|       |    out.clear();
 7365|       |  }
 7366|  2.34k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7367|  2.34k|          " bytes");
 7368|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7369|  2.34k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7370|  2.34k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7371|  2.34k|          " bytes");
 7372|  55.7k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7372:10): [True: 53.3k, False: 2.34k]
  ------------------
 7373|  53.3k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7373:9): [True: 28.2k, False: 25.1k]
  ------------------
 7374|  28.2k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7375|  28.2k|    } else {
 7376|  25.1k|      out += *pointer;
 7377|  25.1k|    }
 7378|  53.3k|  }
 7379|  2.34k|  return true;
 7380|  42.6k|}
_ZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7349|  45.3k|                    std::string& out) {
 7350|  45.3k|  ada_log("percent_encode ", input, " to output string while ",
 7351|  45.3k|          append ? "appending" : "overwriting");
 7352|  45.3k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7353|  45.3k|    return character_sets::bit_at(character_set, c);
 7354|  45.3k|  });
 7355|  45.3k|  ada_log("percent_encode done checking, moved to ",
 7356|  45.3k|          std::distance(input.begin(), pointer));
 7357|       |
 7358|       |  // Optimization: Don't iterate if percent encode is not required
 7359|  45.3k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7359:7): [True: 42.1k, False: 3.21k]
  ------------------
 7360|  42.1k|    ada_log("percent_encode encoding not needed.");
 7361|  42.1k|    return false;
 7362|  42.1k|  }
 7363|  3.21k|  if constexpr (!append) {
 7364|  3.21k|    out.clear();
 7365|  3.21k|  }
 7366|  3.21k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7367|  3.21k|          " bytes");
 7368|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7369|  3.21k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7370|  3.21k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7371|  3.21k|          " bytes");
 7372|  61.0k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7372:10): [True: 57.8k, False: 3.21k]
  ------------------
 7373|  57.8k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7373:9): [True: 33.3k, False: 24.4k]
  ------------------
 7374|  33.3k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7375|  33.3k|    } else {
 7376|  24.4k|      out += *pointer;
 7377|  24.4k|    }
 7378|  57.8k|  }
 7379|  3.21k|  return true;
 7380|  45.3k|}
_ZN3ada7unicode14percent_decodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 7180|  1.08k|std::string percent_decode(const std::string_view input, size_t first_percent) {
 7181|       |  // next line is for safety only, we expect users to avoid calling
 7182|       |  // percent_decode when first_percent is outside the range.
 7183|  1.08k|  if (first_percent == std::string_view::npos) {
  ------------------
  |  Branch (7183:7): [True: 0, False: 1.08k]
  ------------------
 7184|      0|    return std::string(input);
 7185|      0|  }
 7186|       |
 7187|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7188|  1.08k|  const char* const src = input.data();
 7189|  1.08k|  const char* const end = src + input.size();
 7190|       |
 7191|       |  // Decoding never grows the string, so a single pre-sized buffer written via
 7192|       |  // bulk memcpy of the plain runs (then shrunk to the final length) avoids the
 7193|       |  // byte-at-a-time appends of the naive version.
 7194|  1.08k|  std::string out(input.size(), '\0');
 7195|  1.08k|  char* d = out.data();
 7196|  1.08k|  char* const d0 = d;
 7197|       |
 7198|  1.08k|  std::memcpy(d, src, first_percent);
 7199|  1.08k|  d += first_percent;
 7200|       |
 7201|  1.08k|  const char* p = src + first_percent;
 7202|  5.58k|  while (p < end) {
  ------------------
  |  Branch (7202:10): [True: 4.49k, False: 1.08k]
  ------------------
 7203|  4.49k|    if (*p == '%') {
  ------------------
  |  Branch (7203:9): [True: 2.72k, False: 1.76k]
  ------------------
 7204|       |      // Decode runs of valid %XX tightly (common for nested/encoded URLs).
 7205|  7.84k|      while (p + 2 < end && *p == '%') {
  ------------------
  |  Branch (7205:14): [True: 7.26k, False: 578]
  |  Branch (7205:29): [True: 6.44k, False: 820]
  ------------------
 7206|  6.44k|        if (!is_ascii_hex_digit(p[1]) || !is_ascii_hex_digit(p[2])) {
  ------------------
  |  Branch (7206:13): [True: 818, False: 5.62k]
  |  Branch (7206:42): [True: 508, False: 5.11k]
  ------------------
 7207|  1.32k|          break;
 7208|  1.32k|        }
 7209|  5.11k|        *d++ = static_cast<char>(convert_hex_to_binary(p[1]) * 16 +
 7210|  5.11k|                                 convert_hex_to_binary(p[2]));
 7211|  5.11k|        p += 3;
 7212|  5.11k|      }
 7213|  2.72k|      if (p < end && *p == '%') {
  ------------------
  |  Branch (7213:11): [True: 2.42k, False: 303]
  |  Branch (7213:22): [True: 1.46k, False: 955]
  ------------------
 7214|       |        // Not a valid escape (too few chars left or bad hex): copy '%'
 7215|       |        // literally and keep scanning after it.
 7216|  1.46k|        *d++ = *p++;
 7217|  1.46k|      }
 7218|  2.72k|    } else {
 7219|  1.76k|      const char* q = static_cast<const char*>(
 7220|  1.76k|          std::memchr(p, '%', static_cast<size_t>(end - p)));
 7221|  1.76k|      const char* run_end = q ? q : end;
  ------------------
  |  Branch (7221:29): [True: 1.06k, False: 701]
  ------------------
 7222|  1.76k|      const size_t n = static_cast<size_t>(run_end - p);
 7223|  1.76k|      std::memcpy(d, p, n);
 7224|  1.76k|      d += n;
 7225|  1.76k|      p = run_end;
 7226|  1.76k|    }
 7227|  4.49k|  }
 7228|       |
 7229|  1.08k|  out.resize(static_cast<size_t>(d - d0));
 7230|  1.08k|  return out;
 7231|  1.08k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7319|  50.6k|                           const uint8_t character_set[]) {
 7320|  50.6k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7321|  50.6k|    return character_sets::bit_at(character_set, c);
 7322|  50.6k|  });
 7323|       |  // Optimization: Don't iterate if percent encode is not required
 7324|  50.6k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7324:7): [True: 47.8k, False: 2.76k]
  ------------------
 7325|  47.8k|    return std::string(input);
 7326|  47.8k|  }
 7327|       |
 7328|  2.76k|  std::string result;
 7329|  2.76k|  result.reserve(input.length());  // in the worst case, percent encoding might
 7330|       |                                   // produce 3 characters.
 7331|  2.76k|  result.append(input.substr(0, std::distance(input.begin(), pointer)));
 7332|  2.76k|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7332:7): [True: 486, False: 2.27k]
  ------------------
 7333|    486|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7334|    486|                          result);
 7335|  2.27k|  } else {
 7336|  28.5k|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7336:12): [True: 26.2k, False: 2.27k]
  ------------------
 7337|  26.2k|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7337:11): [True: 14.6k, False: 11.5k]
  ------------------
 7338|  14.6k|        result.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7339|  14.6k|      } else {
 7340|  11.5k|        result += *pointer;
 7341|  11.5k|      }
 7342|  26.2k|    }
 7343|  2.27k|  }
 7344|  2.76k|  return result;
 7345|  50.6k|}
_ZN3ada7unicode8to_asciiERNSt3__18optionalINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS1_17basic_string_viewIcS5_EEm:
 7390|  2.71k|              size_t first_percent) {
 7391|  2.71k|  std::string percent_decoded_buffer;
 7392|  2.71k|  std::string_view input = plain;
 7393|  2.71k|  if (first_percent != std::string_view::npos) {
  ------------------
  |  Branch (7393:7): [True: 147, False: 2.57k]
  ------------------
 7394|    147|    percent_decoded_buffer = unicode::percent_decode(plain, first_percent);
 7395|    147|    input = percent_decoded_buffer;
 7396|    147|  }
 7397|       |  // input is a non-empty UTF-8 string, must be percent decoded
 7398|  2.71k|  std::string idna_ascii = ada::idna::to_ascii(input);
 7399|  2.71k|  if (idna_ascii.empty() || contains_forbidden_domain_code_point(
  ------------------
  |  Branch (7399:7): [True: 1.24k, False: 1.47k]
  |  Branch (7399:29): [True: 245, False: 1.23k]
  ------------------
 7400|  1.48k|                                idna_ascii.data(), idna_ascii.size())) {
 7401|  1.48k|    return false;
 7402|  1.48k|  }
 7403|  1.23k|  out = std::move(idna_ascii);
 7404|  1.23k|  return true;
 7405|  2.71k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhm:
 7408|  41.8k|                           const uint8_t character_set[], size_t index) {
 7409|  41.8k|  std::string out;
 7410|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7411|  41.8k|  out.append(input.data(), index);
 7412|  41.8k|  auto pointer = input.begin() + index;
 7413|  41.8k|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7413:7): [True: 794, False: 41.0k]
  ------------------
 7414|    794|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7415|    794|                          out);
 7416|  41.0k|  } else {
 7417|  58.3k|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7417:12): [True: 17.3k, False: 41.0k]
  ------------------
 7418|  17.3k|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7418:11): [True: 7.05k, False: 10.3k]
  ------------------
 7419|  7.05k|        out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7420|  10.3k|      } else {
 7421|  10.3k|        out += *pointer;
 7422|  10.3k|      }
 7423|  17.3k|    }
 7424|  41.0k|  }
 7425|  41.8k|  return out;
 7426|  41.8k|}
_ZN3ada7unicode21percent_encode_suffixEPKcS2_PKhRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
 7720|  1.28k|                           const uint8_t character_set[], std::string& out) {
 7721|  1.28k|#if ADA_UNICODE_SSSE3 || ADA_NEON || ADA_RVV
 7722|  1.28k|  if (static_cast<size_t>(end - p) >= kPercentEncodeSimdMin) {
  ------------------
  |  Branch (7722:7): [True: 1.28k, False: 0]
  ------------------
 7723|  1.28k|    percent_encode_to_wide(p, end, character_set, out);
 7724|  1.28k|    return;
 7725|  1.28k|  }
 7726|      0|#endif
 7727|      0|  percent_encode_to_scalar(p, end, character_set, out);
 7728|      0|}
_ZN3ada11serializers36find_longest_sequence_of_ipv6_piecesERKNSt3__15arrayItLm8EEERmS6_:
 7793|  13.9k|    size_t& compress_length) noexcept {
 7794|  13.9k|  compress = 0;
 7795|  13.9k|  compress_length = 0;
 7796|  13.9k|  size_t i = 0;
 7797|   119k|  while (i < 8) {
  ------------------
  |  Branch (7797:10): [True: 105k, False: 13.9k]
  ------------------
 7798|   105k|    if (address[i] != 0) {
  ------------------
  |  Branch (7798:9): [True: 100k, False: 4.87k]
  ------------------
 7799|   100k|      ++i;
 7800|   100k|      continue;
 7801|   100k|    }
 7802|  4.87k|    size_t next = i + 1;
 7803|  11.0k|    while (next < 8 && address[next] == 0) {
  ------------------
  |  Branch (7803:12): [True: 10.2k, False: 792]
  |  Branch (7803:24): [True: 6.21k, False: 4.08k]
  ------------------
 7804|  6.21k|      ++next;
 7805|  6.21k|    }
 7806|  4.87k|    const size_t count = next - i;
 7807|  4.87k|    if (count > compress_length) {
  ------------------
  |  Branch (7807:9): [True: 4.40k, False: 471]
  ------------------
 7808|  4.40k|      compress_length = count;
 7809|  4.40k|      compress = i;
 7810|  4.40k|    }
 7811|  4.87k|    i = next;
 7812|  4.87k|  }
 7813|  13.9k|}
_ZN3ada11serializers4ipv6ERKNSt3__15arrayItLm8EEE:
 7815|  6.99k|std::string ipv6(const std::array<uint16_t, 8>& address) {
 7816|  6.99k|  size_t compress = 0;
 7817|  6.99k|  size_t compress_length = 0;
 7818|  6.99k|  find_longest_sequence_of_ipv6_pieces(address, compress, compress_length);
 7819|       |
 7820|       |  // Skip compression when the longest zero run is a single piece.
 7821|  6.99k|  if (compress_length <= 1) {
  ------------------
  |  Branch (7821:7): [True: 5.94k, False: 1.05k]
  ------------------
 7822|  5.94k|    compress = compress_length = 8;
 7823|  5.94k|  }
 7824|       |
 7825|       |  // Max: '[' + 8*4 hex + 7 ':' + ']' = 41
 7826|  6.99k|  std::string output(4 * 8 + 7 + 2, '\0');
 7827|  6.99k|  char* point = output.data();
 7828|  6.99k|  *point++ = '[';
 7829|  6.99k|  size_t piece_index = 0;
 7830|  52.0k|  while (true) {
  ------------------
  |  Branch (7830:10): [True: 52.0k, Folded]
  ------------------
 7831|  52.0k|    if (piece_index == compress) {
  ------------------
  |  Branch (7831:9): [True: 1.05k, False: 51.0k]
  ------------------
 7832|  1.05k|      *point++ = ':';
 7833|       |      // If we skip a value initially, we need to write '::'.
 7834|  1.05k|      if (piece_index == 0) {
  ------------------
  |  Branch (7834:11): [True: 434, False: 616]
  ------------------
 7835|    434|        *point++ = ':';
 7836|    434|      }
 7837|  1.05k|      piece_index += compress_length;
 7838|  1.05k|      if (piece_index == 8) {
  ------------------
  |  Branch (7838:11): [True: 334, False: 716]
  ------------------
 7839|    334|        break;
 7840|    334|      }
 7841|  1.05k|    }
 7842|  51.7k|    point = write_hex_u16(point, address[piece_index]);
 7843|  51.7k|    ++piece_index;
 7844|  51.7k|    if (piece_index == 8) {
  ------------------
  |  Branch (7844:9): [True: 6.65k, False: 45.0k]
  ------------------
 7845|  6.65k|      break;
 7846|  6.65k|    }
 7847|  45.0k|    *point++ = ':';
 7848|  45.0k|  }
 7849|  6.99k|  *point++ = ']';
 7850|  6.99k|  output.resize(static_cast<size_t>(point - output.data()));
 7851|  6.99k|  return output;
 7852|  6.99k|}
_ZN3ada11serializers4ipv4Em:
 7854|  7.68k|std::string ipv4(const uint64_t address) {
 7855|  7.68k|  std::string output(15, '\0');
 7856|  7.68k|  char* point = output.data();
 7857|  7.68k|  point = write_u8(point, static_cast<uint8_t>(address >> 24));
 7858|  7.68k|  *point++ = '.';
 7859|  7.68k|  point = write_u8(point, static_cast<uint8_t>(address >> 16));
 7860|  7.68k|  *point++ = '.';
 7861|  7.68k|  point = write_u8(point, static_cast<uint8_t>(address >> 8));
 7862|  7.68k|  *point++ = '.';
 7863|  7.68k|  point = write_u8(point, static_cast<uint8_t>(address));
 7864|  7.68k|  output.resize(static_cast<size_t>(point - output.data()));
 7865|  7.68k|  return output;
 7866|  7.68k|}
_ZN3ada5parseINS_14url_aggregatorEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 8268|  13.1k|    std::string_view input, const result_type* base_url) {
 8269|  13.1k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 8270|  13.1k|  if (!u.is_valid) {
  ------------------
  |  Branch (8270:7): [True: 10.7k, False: 2.35k]
  ------------------
 8271|  10.7k|    return tl::unexpected(errors::type_error);
 8272|  10.7k|  }
 8273|  2.35k|  return u;
 8274|  13.1k|}
_ZN3ada20get_max_input_lengthEv:
 7889|  13.1k|uint32_t get_max_input_length() {
 7890|  13.1k|  return max_input_length_.load(std::memory_order_relaxed);
 7891|  13.1k|}
_ZN3ada7helpers18trim_c0_whitespaceERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9243|  11.9k|void trim_c0_whitespace(std::string_view& input) noexcept {
 9244|  11.9k|  while (!input.empty() &&
  ------------------
  |  Branch (9244:10): [True: 11.9k, False: 0]
  ------------------
 9245|  11.9k|         ada::unicode::is_c0_control_or_space(input.front())) {
  ------------------
  |  Branch (9245:10): [True: 0, False: 11.9k]
  ------------------
 9246|      0|    input.remove_prefix(1);
 9247|      0|  }
 9248|  11.9k|  while (!input.empty() && ada::unicode::is_c0_control_or_space(input.back())) {
  ------------------
  |  Branch (9248:10): [True: 11.9k, False: 0]
  |  Branch (9248:28): [True: 0, False: 11.9k]
  ------------------
 9249|      0|    input.remove_suffix(1);
 9250|      0|  }
 9251|  11.9k|}
_ZN3ada7helpers8overlapsENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERKNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 9418|      2|bool overlaps(std::string_view input1, const std::string& input2) noexcept {
 9419|      2|  ada_log("helpers::overlaps check if string_view '", input1, "' [",
 9420|      2|          input1.size(), " bytes] is part of string '", input2, "' [",
 9421|      2|          input2.size(), " bytes]");
 9422|      2|  return !input1.empty() && !input2.empty() && input1.data() >= input2.data() &&
  ------------------
  |  Branch (9422:10): [True: 2, False: 0]
  |  Branch (9422:29): [True: 2, False: 0]
  |  Branch (9422:48): [True: 2, False: 0]
  ------------------
 9423|      2|         input1.data() < input2.data() + input2.size();
  ------------------
  |  Branch (9423:10): [True: 0, False: 2]
  ------------------
 9424|      2|}
_ZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
11946|  4.58k|                                                result_type& out) {
11947|  4.58k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11948|  4.58k|  constexpr bool is_aggregator =
11949|  4.58k|      std::is_same_v<result_type, ada::url_aggregator>;
11950|  4.58k|  static_assert(is_ada_url || is_aggregator);
11951|       |
11952|  4.58k|  const size_t len = input.size();
11953|       |  // Shortest accepted form is "ws://x" (6).
11954|  4.58k|  if (len < 6) [[unlikely]] {
  ------------------
  |  Branch (11954:7): [True: 0, False: 4.58k]
  ------------------
11955|      0|    return false;
11956|      0|  }
11957|  4.58k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
11958|       |
11959|  4.58k|  size_t pos = 0;
11960|  4.58k|  ada::scheme::type scheme_type = ada::scheme::type::NOT_SPECIAL;
11961|  4.58k|  uint32_t protocol_end = 0;
11962|  4.58k|#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
11963|  4.58k|    defined(_M_X64) || defined(_M_IX86) || defined(_M_AMD64)
11964|       |  // One 8-byte load + integer compare is a single cmp/jcc on x86-64.
11965|       |  // Masked compares cover the shorter special schemes without extra loads.
11966|  4.58k|  if (len >= 8) {
  ------------------
  |  Branch (11966:7): [True: 4.58k, False: 0]
  ------------------
11967|  4.58k|    uint64_t first8 = 0;
11968|  4.58k|    std::memcpy(&first8, b, 8);
11969|  4.58k|    if (first8 == 0x2f2f3a7370747468ull) {  // "https://"
  ------------------
  |  Branch (11969:9): [True: 0, False: 4.58k]
  ------------------
11970|      0|      pos = 8;
11971|      0|      scheme_type = ada::scheme::type::HTTPS;
11972|      0|      protocol_end = 6;
11973|  4.58k|    } else if ((first8 & 0x00ffffffffffffffull) ==
  ------------------
  |  Branch (11973:16): [True: 4.58k, False: 0]
  ------------------
11974|  4.58k|               0x002f2f3a70747468ull) {  // "http://"
11975|  4.58k|      pos = 7;
11976|  4.58k|      scheme_type = ada::scheme::type::HTTP;
11977|  4.58k|      protocol_end = 5;
11978|  4.58k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (11978:16): [True: 0, False: 0]
  ------------------
11979|      0|               0x00002f2f3a737377ull) {  // "wss://"
11980|      0|      pos = 6;
11981|      0|      scheme_type = ada::scheme::type::WSS;
11982|      0|      protocol_end = 4;
11983|      0|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (11983:16): [True: 0, False: 0]
  ------------------
11984|      0|               0x00002f2f3a707466ull) {  // "ftp://"
11985|      0|      pos = 6;
11986|      0|      scheme_type = ada::scheme::type::FTP;
11987|      0|      protocol_end = 4;
11988|      0|    } else if ((first8 & 0x000000ffffffffffull) ==
  ------------------
  |  Branch (11988:16): [True: 0, False: 0]
  ------------------
11989|      0|               0x0000002f2f3a7377ull) {  // "ws://"
11990|      0|      pos = 5;
11991|      0|      scheme_type = ada::scheme::type::WS;
11992|      0|      protocol_end = 3;
11993|      0|    } else {
11994|      0|      return false;
11995|      0|    }
11996|  4.58k|  } else if (b[0] == 'w' && b[1] == 's') {
  ------------------
  |  Branch (11996:14): [True: 0, False: 0]
  |  Branch (11996:29): [True: 0, False: 0]
  ------------------
11997|      0|    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
  ------------------
  |  Branch (11997:9): [True: 0, False: 0]
  |  Branch (11997:24): [True: 0, False: 0]
  |  Branch (11997:39): [True: 0, False: 0]
  ------------------
11998|      0|      pos = 5;
11999|      0|      scheme_type = ada::scheme::type::WS;
12000|      0|      protocol_end = 3;
12001|      0|    } else if (b[2] == 's' && b[3] == ':' && b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12001:16): [True: 0, False: 0]
  |  Branch (12001:31): [True: 0, False: 0]
  |  Branch (12001:46): [True: 0, False: 0]
  |  Branch (12001:61): [True: 0, False: 0]
  ------------------
12002|      0|      pos = 6;
12003|      0|      scheme_type = ada::scheme::type::WSS;
12004|      0|      protocol_end = 4;
12005|      0|    } else {
12006|      0|      return false;
12007|      0|    }
12008|      0|  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
  ------------------
  |  Branch (12008:14): [True: 0, False: 0]
  |  Branch (12008:29): [True: 0, False: 0]
  |  Branch (12008:44): [True: 0, False: 0]
  |  Branch (12008:59): [True: 0, False: 0]
  ------------------
12009|      0|             b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12009:14): [True: 0, False: 0]
  |  Branch (12009:29): [True: 0, False: 0]
  ------------------
12010|      0|    pos = 6;
12011|      0|    scheme_type = ada::scheme::type::FTP;
12012|      0|    protocol_end = 4;
12013|      0|  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
  ------------------
  |  Branch (12013:14): [True: 0, False: 0]
  |  Branch (12013:26): [True: 0, False: 0]
  |  Branch (12013:41): [True: 0, False: 0]
  |  Branch (12013:56): [True: 0, False: 0]
  ------------------
12014|      0|             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (12014:14): [True: 0, False: 0]
  |  Branch (12014:29): [True: 0, False: 0]
  |  Branch (12014:44): [True: 0, False: 0]
  |  Branch (12014:59): [True: 0, False: 0]
  ------------------
12015|      0|    pos = 7;
12016|      0|    scheme_type = ada::scheme::type::HTTP;
12017|      0|    protocol_end = 5;
12018|      0|  } else {
12019|      0|    return false;
12020|      0|  }
12021|       |#else
12022|       |  // Big-endian / uncommon arches: byte-wise special-scheme match.
12023|       |  if (len >= 8 && b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p' &&
12024|       |      b[4] == 's' && b[5] == ':' && b[6] == '/' && b[7] == '/') {
12025|       |    pos = 8;
12026|       |    scheme_type = ada::scheme::type::HTTPS;
12027|       |    protocol_end = 6;
12028|       |  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
12029|       |             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
12030|       |    pos = 7;
12031|       |    scheme_type = ada::scheme::type::HTTP;
12032|       |    protocol_end = 5;
12033|       |  } else if (b[0] == 'w' && b[1] == 's') {
12034|       |    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
12035|       |      pos = 5;
12036|       |      scheme_type = ada::scheme::type::WS;
12037|       |      protocol_end = 3;
12038|       |    } else if (len >= 6 && b[2] == 's' && b[3] == ':' && b[4] == '/' &&
12039|       |               b[5] == '/') {
12040|       |      pos = 6;
12041|       |      scheme_type = ada::scheme::type::WSS;
12042|       |      protocol_end = 4;
12043|       |    } else {
12044|       |      return false;
12045|       |    }
12046|       |  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
12047|       |             b[4] == '/' && b[5] == '/') {
12048|       |    pos = 6;
12049|       |    scheme_type = ada::scheme::type::FTP;
12050|       |    protocol_end = 4;
12051|       |  } else {
12052|       |    return false;
12053|       |  }
12054|       |#endif
12055|  4.58k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (12055:7): [True: 4.58k, False: 0]
  |  Branch (12055:21): [True: 25, False: 4.55k]
  |  Branch (12055:38): [True: 6, False: 4.55k]
  ------------------
12056|     31|    return false;
12057|     31|  }
12058|       |
12059|       |  // Digit-led hosts are IPv4/numeric; '[' is IPv6. Skip before scanning.
12060|  4.55k|  if (pos < len && ((b[pos] >= '0' && b[pos] <= '9') || b[pos] == '[')) {
  ------------------
  |  Branch (12060:7): [True: 4.55k, False: 0]
  |  Branch (12060:22): [True: 3.70k, False: 842]
  |  Branch (12060:39): [True: 0, False: 3.70k]
  |  Branch (12060:57): [True: 0, False: 4.55k]
  ------------------
12061|      0|    return false;
12062|      0|  }
12063|       |
12064|  4.55k|  const size_t host_start = pos;
12065|  4.55k|  bool has_upper = false;
12066|  4.55k|  bool has_x = false;
12067|  4.55k|  size_t host_end = pos;
12068|  4.55k|  if (!scan_plain_host(b, pos, len, host_end, has_upper, has_x)) {
  ------------------
  |  Branch (12068:7): [True: 2.75k, False: 1.79k]
  ------------------
12069|  2.75k|    return false;
12070|  2.75k|  }
12071|  1.79k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (12071:7): [True: 11, False: 1.78k]
  ------------------
12072|     11|    return false;
12073|     11|  }
12074|  1.78k|  const size_t host_len = host_end - host_start;
12075|  1.78k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (12075:7): [True: 0, False: 1.78k]
  ------------------
12076|      0|    return false;
12077|      0|  }
12078|  1.78k|  {
12079|  1.78k|    std::string_view hv(input.data() + host_start, host_len);
12080|  1.78k|    char host_buf[256];
12081|  1.78k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (12081:9): [True: 483, False: 1.30k]
  ------------------
12082|    483|      std::memcpy(host_buf, input.data() + host_start, host_len);
12083|    483|      unicode::to_lower_ascii(host_buf, host_len);
12084|    483|      hv = std::string_view(host_buf, host_len);
12085|    483|    }
12086|  1.78k|    if (ada::checkers::last_label_may_be_a_number(hv)) [[unlikely]] {
  ------------------
  |  Branch (12086:9): [True: 274, False: 1.51k]
  ------------------
12087|    274|      return false;
12088|    274|    }
12089|       |    // Punycode is "xn--...". The host scan already notes a lowercase 'x';
12090|       |    // uppercase 'X' is covered by has_upper after the in-place lower.
12091|  1.51k|    static constexpr std::string_view xn{"xn-", 3};
12092|  1.51k|    if ((has_x || has_upper) && hv.find(xn) != std::string_view::npos)
  ------------------
  |  Branch (12092:10): [True: 203, False: 1.31k]
  |  Branch (12092:19): [True: 267, False: 1.04k]
  |  Branch (12092:33): [True: 36, False: 434]
  ------------------
12093|     36|        [[unlikely]] {
12094|     36|      return false;
12095|     36|    }
12096|  1.51k|  }
12097|       |
12098|  1.47k|  if (host_end < len && b[host_end] == ':') [[unlikely]] {
  ------------------
  |  Branch (12098:7): [True: 1.47k, False: 0]
  |  Branch (12098:25): [True: 417, False: 1.06k]
  ------------------
12099|    417|    return finish_simple_absolute_with_port(input, out, scheme_type,
12100|    417|                                            protocol_end, host_start, host_end,
12101|    417|                                            host_len, has_upper);
12102|    417|  }
12103|       |
12104|  1.06k|  size_t i = host_end;
12105|  1.06k|  size_t path_start = host_end;
12106|  1.06k|  size_t path_end = host_end;
12107|  1.06k|  size_t query_start = std::string_view::npos;
12108|  1.06k|  size_t hash_start = std::string_view::npos;
12109|  1.06k|  bool has_path = false;
12110|  1.06k|  bool maybe_dot_segment = false;
12111|  1.06k|  bool rest_simple = true;
12112|       |
12113|  1.06k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12113:7): [True: 1.06k, False: 0]
  |  Branch (12113:18): [True: 861, False: 200]
  ------------------
12114|    861|    has_path = true;
12115|    861|    path_start = i;
12116|    861|    ++i;
12117|    861|    scan_path_run(b, i, len, maybe_dot_segment);
12118|    861|    if (i < len) {
  ------------------
  |  Branch (12118:9): [True: 616, False: 245]
  ------------------
12119|    616|      const uint8_t cls = k_path[b[i]];
12120|    616|      if (cls == 1) {
  ------------------
  |  Branch (12120:11): [True: 95, False: 521]
  ------------------
12121|     95|        path_end = i;
12122|     95|        if (b[i] == '?') {
  ------------------
  |  Branch (12122:13): [True: 56, False: 39]
  ------------------
12123|     56|          query_start = i;
12124|     56|          ++i;
12125|     56|          goto scan_query;
12126|     56|        }
12127|     39|        hash_start = i;
12128|     39|        ++i;
12129|     39|        goto scan_hash;
12130|     95|      }
12131|    521|      rest_simple = false;
12132|  11.0k|      for (; i < len; ++i) {
  ------------------
  |  Branch (12132:14): [True: 10.5k, False: 452]
  ------------------
12133|  10.5k|        if (b[i] == '?') {
  ------------------
  |  Branch (12133:13): [True: 48, False: 10.5k]
  ------------------
12134|     48|          path_end = i;
12135|     48|          query_start = i;
12136|     48|          ++i;
12137|     48|          goto scan_query_boundary;
12138|     48|        }
12139|  10.5k|        if (b[i] == '#') {
  ------------------
  |  Branch (12139:13): [True: 21, False: 10.5k]
  ------------------
12140|     21|          path_end = i;
12141|     21|          hash_start = i;
12142|     21|          ++i;
12143|     21|          goto after_rest;
12144|     21|        }
12145|  10.5k|      }
12146|    452|      path_end = i;
12147|    452|      goto after_rest;
12148|    521|    }
12149|    245|    path_end = i;
12150|    245|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12150:14): [True: 200, False: 0]
  |  Branch (12150:25): [True: 109, False: 91]
  ------------------
12151|    109|    query_start = i;
12152|    109|    ++i;
12153|    109|    goto scan_query;
12154|    109|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12154:14): [True: 91, False: 0]
  |  Branch (12154:25): [True: 91, False: 0]
  ------------------
12155|     91|    hash_start = i;
12156|     91|    ++i;
12157|     91|    goto scan_hash;
12158|     91|  }
12159|    245|  goto after_rest;
12160|       |
12161|    245|scan_query:
12162|    165|  scan_query_run(b, i, len);
12163|    165|  if (i < len) {
  ------------------
  |  Branch (12163:7): [True: 98, False: 67]
  ------------------
12164|     98|    if (b[i] == '#') {
  ------------------
  |  Branch (12164:9): [True: 16, False: 82]
  ------------------
12165|     16|      hash_start = i;
12166|     16|      ++i;
12167|     16|      goto scan_hash;
12168|     16|    }
12169|     82|    rest_simple = false;
12170|     82|    goto scan_query_boundary;
12171|     98|  }
12172|     67|  goto after_rest;
12173|       |
12174|    130|scan_query_boundary:
12175|  1.63k|  for (; i < len; ++i) {
  ------------------
  |  Branch (12175:10): [True: 1.51k, False: 114]
  ------------------
12176|  1.51k|    if (b[i] == '#') {
  ------------------
  |  Branch (12176:9): [True: 16, False: 1.50k]
  ------------------
12177|     16|      hash_start = i;
12178|     16|      ++i;
12179|     16|      goto after_rest;
12180|     16|    }
12181|  1.51k|  }
12182|    114|  goto after_rest;
12183|       |
12184|    146|scan_hash:
12185|    146|  scan_hash_run(b, i, len);
12186|    146|  if (i < len) {
  ------------------
  |  Branch (12186:7): [True: 79, False: 67]
  ------------------
12187|     79|    rest_simple = false;
12188|     79|  }
12189|       |
12190|  1.06k|after_rest:
12191|  1.06k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12191:7): [True: 379, False: 682]
  |  Branch (12191:22): [True: 270, False: 109]
  ------------------
12192|    270|    const std::string_view path_body(input.data() + path_start,
12193|    270|                                     path_end - path_start);
12194|    270|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12194:9): [True: 163, False: 107]
  ------------------
12195|    163|      rest_simple = false;
12196|    163|    }
12197|    270|  }
12198|       |
12199|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12200|       |  // trailing C0 control or space; this fast path does neither. A query or
12201|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12202|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12203|       |  // inputs back to the slow path.
12204|  1.06k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12204:7): [True: 845, False: 216]
  |  Branch (12204:24): [True: 0, False: 845]
  ------------------
12205|    845|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12205:24): [True: 58, False: 787]
  ------------------
12206|     58|    return false;
12207|     58|  }
12208|       |
12209|  1.00k|  out.type = scheme_type;
12210|  1.00k|  out.is_valid = true;
12211|  1.00k|  out.has_opaque_path = false;
12212|  1.00k|  out.host_type = DEFAULT;
12213|       |
12214|  1.00k|  if (!rest_simple) {
  ------------------
  |  Branch (12214:7): [True: 787, False: 216]
  ------------------
12215|       |    // Host is a plain domain. Finish path/query/hash with
12216|       |    // the regular helpers
12217|       |    // so percent-encoding and dot segments do not re-parse the authority.
12218|    787|    const std::string_view path_view =
12219|    787|        has_path
  ------------------
  |  Branch (12219:9): [True: 666, False: 121]
  ------------------
12220|    787|            ? std::string_view(input.data() + path_start, path_end - path_start)
12221|    787|            : std::string_view{};
12222|    787|    auto apply_query_and_hash = [&]() {
12223|    787|      if (query_start != std::string_view::npos) {
12224|    787|        const size_t q_end =
12225|    787|            (hash_start != std::string_view::npos) ? hash_start : len;
12226|    787|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12227|    787|                                                q_end - query_start - 1),
12228|    787|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12229|    787|      }
12230|    787|      if (hash_start != std::string_view::npos) {
12231|    787|        out.update_unencoded_base_hash(std::string_view(
12232|    787|            input.data() + hash_start + 1, len - hash_start - 1));
12233|    787|      }
12234|    787|    };
12235|    787|    if constexpr (is_aggregator) {
12236|    787|      out.buffer.assign(input.substr(0, host_end));
12237|    787|      if (has_upper) {
  ------------------
  |  Branch (12237:11): [True: 106, False: 681]
  ------------------
12238|    106|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12239|    106|      }
12240|    787|      out.components.protocol_end = protocol_end;
12241|    787|      out.components.username_end = protocol_end + 2;
12242|    787|      out.components.host_start = protocol_end + 2;
12243|    787|      out.components.host_end = static_cast<uint32_t>(host_end);
12244|    787|      out.components.port = url_components::omitted;
12245|    787|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12246|    787|      out.components.search_start = url_components::omitted;
12247|    787|      out.components.hash_start = url_components::omitted;
12248|    787|      out.parse_path(path_view);
12249|    787|      apply_query_and_hash();
12250|       |    } else {
12251|       |      std::string host_str(input.substr(host_start, host_len));
12252|       |      if (has_upper) {
12253|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
12254|       |      }
12255|       |      out.host = std::move(host_str);
12256|       |      out.parse_path(path_view);
12257|       |      apply_query_and_hash();
12258|       |    }
12259|    787|    return true;
12260|    787|  }
12261|       |
12262|    216|  const bool need_slash = !has_path;
12263|    216|  if constexpr (is_aggregator) {
12264|    216|    if (!need_slash) {
  ------------------
  |  Branch (12264:9): [True: 155, False: 61]
  ------------------
12265|       |      // assign copies once. resize()+memcpy would value-init then overwrite.
12266|    155|      out.buffer.assign(input);
12267|    155|      if (has_upper) {
  ------------------
  |  Branch (12267:11): [True: 28, False: 127]
  ------------------
12268|     28|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12269|     28|      }
12270|    155|      out.components.protocol_end = protocol_end;
12271|    155|      out.components.username_end = protocol_end + 2;
12272|    155|      out.components.host_start = protocol_end + 2;
12273|    155|      out.components.host_end = static_cast<uint32_t>(host_end);
12274|    155|      out.components.port = url_components::omitted;
12275|    155|      out.components.pathname_start = static_cast<uint32_t>(path_start);
12276|    155|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12276:37): [True: 15, False: 140]
  ------------------
12277|    155|                                        ? static_cast<uint32_t>(query_start)
12278|    155|                                        : url_components::omitted;
12279|    155|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12279:35): [True: 11, False: 144]
  ------------------
12280|    155|                                      ? static_cast<uint32_t>(hash_start)
12281|    155|                                      : url_components::omitted;
12282|    155|    } else {
12283|     61|      out.buffer.clear();
12284|     61|      out.buffer.reserve(len + 1);
12285|     61|      out.buffer.append(input.substr(0, host_end));
12286|     61|      out.buffer.push_back('/');
12287|     61|      if (host_end < len) {
  ------------------
  |  Branch (12287:11): [True: 61, False: 0]
  ------------------
12288|     61|        out.buffer.append(input.substr(host_end));
12289|     61|      }
12290|     61|      if (has_upper) {
  ------------------
  |  Branch (12290:11): [True: 14, False: 47]
  ------------------
12291|     14|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12292|     14|      }
12293|     61|      out.components.protocol_end = protocol_end;
12294|     61|      out.components.username_end = protocol_end + 2;
12295|     61|      out.components.host_start = protocol_end + 2;
12296|     61|      out.components.host_end = static_cast<uint32_t>(host_end);
12297|     61|      out.components.port = url_components::omitted;
12298|     61|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12299|     61|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12299:37): [True: 35, False: 26]
  ------------------
12300|     61|                                        ? static_cast<uint32_t>(query_start + 1)
12301|     61|                                        : url_components::omitted;
12302|     61|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12302:35): [True: 36, False: 25]
  ------------------
12303|     61|                                      ? static_cast<uint32_t>(hash_start + 1)
12304|     61|                                      : url_components::omitted;
12305|     61|    }
12306|       |  } else {
12307|       |    std::string host_str(input.substr(host_start, host_len));
12308|       |    if (has_upper) {
12309|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
12310|       |    }
12311|       |    out.host = std::move(host_str);
12312|       |    if (need_slash) {
12313|       |      out.path = "/";
12314|       |    } else {
12315|       |      out.path.assign(input.data() + path_start, path_end - path_start);
12316|       |    }
12317|       |    if (query_start != std::string_view::npos) {
12318|       |      const size_t q_end =
12319|       |          (hash_start != std::string_view::npos) ? hash_start : len;
12320|       |      out.query.emplace(input.data() + query_start + 1,
12321|       |                        q_end - query_start - 1);
12322|       |    }
12323|       |    if (hash_start != std::string_view::npos) {
12324|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12325|       |    }
12326|       |  }
12327|    216|  return true;
12328|  1.00k|}
_ZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmb:
11674|    417|    bool has_upper) {
11675|    417|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11676|    417|  constexpr bool is_aggregator =
11677|    417|      std::is_same_v<result_type, ada::url_aggregator>;
11678|    417|  static_assert(is_ada_url || is_aggregator);
11679|       |
11680|    417|  const size_t len = input.size();
11681|    417|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
11682|    417|  size_t p = host_end + 1;
11683|    417|  uint32_t port_value = 0;
11684|    417|  bool any_digit = false;
11685|    991|  while (p < len && b[p] >= '0' && b[p] <= '9') {
  ------------------
  |  Branch (11685:10): [True: 991, False: 0]
  |  Branch (11685:21): [True: 663, False: 328]
  |  Branch (11685:36): [True: 589, False: 74]
  ------------------
11686|    589|    any_digit = true;
11687|    589|    port_value = port_value * 10 + static_cast<uint32_t>(b[p] - '0');
11688|    589|    if (port_value > 65535) [[unlikely]] {
  ------------------
  |  Branch (11688:9): [True: 15, False: 574]
  ------------------
11689|     15|      return false;
11690|     15|    }
11691|    574|    ++p;
11692|    574|  }
11693|    402|  if (p < len && b[p] != '/' && b[p] != '?' && b[p] != '#') [[unlikely]] {
  ------------------
  |  Branch (11693:7): [True: 402, False: 0]
  |  Branch (11693:18): [True: 260, False: 142]
  |  Branch (11693:33): [True: 212, False: 48]
  |  Branch (11693:48): [True: 167, False: 45]
  ------------------
11694|    167|    return false;
11695|    167|  }
11696|    235|  uint32_t parsed_port = url_components::omitted;
11697|    235|  const uint16_t default_port = ada::scheme::get_special_port(scheme_type);
11698|    235|  if (any_digit && port_value != default_port) {
  ------------------
  |  Branch (11698:7): [True: 100, False: 135]
  |  Branch (11698:20): [True: 98, False: 2]
  ------------------
11699|     98|    parsed_port = port_value;
11700|     98|  }
11701|    235|  const size_t authority_end = p;
11702|       |
11703|    235|  size_t i = authority_end;
11704|    235|  size_t path_start = host_end;
11705|    235|  size_t path_end = host_end;
11706|    235|  size_t query_start = std::string_view::npos;
11707|    235|  size_t hash_start = std::string_view::npos;
11708|    235|  bool has_path = false;
11709|    235|  bool maybe_dot_segment = false;
11710|    235|  bool rest_simple = true;
11711|       |
11712|    235|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (11712:7): [True: 235, False: 0]
  |  Branch (11712:18): [True: 142, False: 93]
  ------------------
11713|    142|    has_path = true;
11714|    142|    path_start = i;
11715|    142|    ++i;
11716|    142|    scan_path_run(b, i, len, maybe_dot_segment);
11717|    142|    if (i < len) {
  ------------------
  |  Branch (11717:9): [True: 100, False: 42]
  ------------------
11718|    100|      const uint8_t cls = k_path[b[i]];
11719|    100|      if (cls == 1) {
  ------------------
  |  Branch (11719:11): [True: 26, False: 74]
  ------------------
11720|     26|        path_end = i;
11721|     26|        if (b[i] == '?') {
  ------------------
  |  Branch (11721:13): [True: 15, False: 11]
  ------------------
11722|     15|          query_start = i;
11723|     15|          ++i;
11724|     15|          goto scan_query;
11725|     15|        }
11726|     11|        hash_start = i;
11727|     11|        ++i;
11728|     11|        goto scan_hash;
11729|     26|      }
11730|     74|      rest_simple = false;
11731|  1.27k|      for (; i < len; ++i) {
  ------------------
  |  Branch (11731:14): [True: 1.21k, False: 63]
  ------------------
11732|  1.21k|        if (b[i] == '?') {
  ------------------
  |  Branch (11732:13): [True: 7, False: 1.20k]
  ------------------
11733|      7|          path_end = i;
11734|      7|          query_start = i;
11735|      7|          ++i;
11736|      7|          goto scan_query_boundary;
11737|      7|        }
11738|  1.20k|        if (b[i] == '#') {
  ------------------
  |  Branch (11738:13): [True: 4, False: 1.20k]
  ------------------
11739|      4|          path_end = i;
11740|      4|          hash_start = i;
11741|      4|          ++i;
11742|      4|          goto after_rest;
11743|      4|        }
11744|  1.20k|      }
11745|     63|      path_end = i;
11746|     63|      goto after_rest;
11747|     74|    }
11748|     42|    path_end = i;
11749|     93|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (11749:14): [True: 93, False: 0]
  |  Branch (11749:25): [True: 48, False: 45]
  ------------------
11750|     48|    query_start = i;
11751|     48|    ++i;
11752|     48|    goto scan_query;
11753|     48|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (11753:14): [True: 45, False: 0]
  |  Branch (11753:25): [True: 45, False: 0]
  ------------------
11754|     45|    hash_start = i;
11755|     45|    ++i;
11756|     45|    goto scan_hash;
11757|     45|  }
11758|     42|  goto after_rest;
11759|       |
11760|     63|scan_query:
11761|     63|  scan_query_run(b, i, len);
11762|     63|  if (i < len) {
  ------------------
  |  Branch (11762:7): [True: 38, False: 25]
  ------------------
11763|     38|    if (b[i] == '#') {
  ------------------
  |  Branch (11763:9): [True: 5, False: 33]
  ------------------
11764|      5|      hash_start = i;
11765|      5|      ++i;
11766|      5|      goto scan_hash;
11767|      5|    }
11768|     33|    rest_simple = false;
11769|     33|    goto scan_query_boundary;
11770|     38|  }
11771|     25|  goto after_rest;
11772|       |
11773|     40|scan_query_boundary:
11774|    327|  for (; i < len; ++i) {
  ------------------
  |  Branch (11774:10): [True: 297, False: 30]
  ------------------
11775|    297|    if (b[i] == '#') {
  ------------------
  |  Branch (11775:9): [True: 10, False: 287]
  ------------------
11776|     10|      hash_start = i;
11777|     10|      ++i;
11778|     10|      goto after_rest;
11779|     10|    }
11780|    297|  }
11781|     30|  goto after_rest;
11782|       |
11783|     61|scan_hash:
11784|     61|  scan_hash_run(b, i, len);
11785|     61|  if (i < len) {
  ------------------
  |  Branch (11785:7): [True: 14, False: 47]
  ------------------
11786|     14|    rest_simple = false;
11787|     14|  }
11788|       |
11789|    235|after_rest:
11790|    235|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (11790:7): [True: 114, False: 121]
  |  Branch (11790:22): [True: 40, False: 74]
  ------------------
11791|     40|    const std::string_view path_body(input.data() + path_start,
11792|     40|                                     path_end - path_start);
11793|     40|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (11793:9): [True: 5, False: 35]
  ------------------
11794|      5|      rest_simple = false;
11795|      5|    }
11796|     40|  }
11797|       |
11798|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
11799|       |  // trailing C0 control or space; this fast path does neither. A query or
11800|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
11801|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
11802|       |  // inputs back to the slow path.
11803|    235|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (11803:7): [True: 126, False: 109]
  |  Branch (11803:24): [True: 0, False: 126]
  ------------------
11804|    126|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (11804:24): [True: 14, False: 112]
  ------------------
11805|     14|    return false;
11806|     14|  }
11807|       |
11808|    221|  out.type = scheme_type;
11809|    221|  out.is_valid = true;
11810|    221|  out.has_opaque_path = false;
11811|    221|  out.host_type = DEFAULT;
11812|       |
11813|    221|  const uint32_t port_bytes = (parsed_port != url_components::omitted)
  ------------------
  |  Branch (11813:31): [True: 97, False: 124]
  ------------------
11814|    221|                                  ? (1 + port_decimal_digit_count(parsed_port))
11815|    221|                                  : 0;
11816|       |
11817|    221|  if (!rest_simple) {
  ------------------
  |  Branch (11817:7): [True: 112, False: 109]
  ------------------
11818|    112|    const std::string_view path_view =
11819|    112|        has_path
  ------------------
  |  Branch (11819:9): [True: 76, False: 36]
  ------------------
11820|    112|            ? std::string_view(input.data() + path_start, path_end - path_start)
11821|    112|            : std::string_view{};
11822|    112|    auto apply_query_and_hash = [&]() {
11823|    112|      if (query_start != std::string_view::npos) {
11824|    112|        const size_t q_end =
11825|    112|            (hash_start != std::string_view::npos) ? hash_start : len;
11826|    112|        out.update_base_search(std::string_view(input.data() + query_start + 1,
11827|    112|                                                q_end - query_start - 1),
11828|    112|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
11829|    112|      }
11830|    112|      if (hash_start != std::string_view::npos) {
11831|    112|        out.update_unencoded_base_hash(std::string_view(
11832|    112|            input.data() + hash_start + 1, len - hash_start - 1));
11833|    112|      }
11834|    112|    };
11835|    112|    if constexpr (is_aggregator) {
11836|    112|      out.buffer.assign(input.substr(0, host_end));
11837|    112|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (11837:11): [True: 24, False: 88]
  ------------------
11838|     24|        append_canonical_port(out.buffer, parsed_port);
11839|     24|      }
11840|    112|      if (has_upper) {
  ------------------
  |  Branch (11840:11): [True: 34, False: 78]
  ------------------
11841|     34|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
11842|     34|      }
11843|    112|      out.components.protocol_end = protocol_end;
11844|    112|      out.components.username_end = protocol_end + 2;
11845|    112|      out.components.host_start = protocol_end + 2;
11846|    112|      out.components.host_end = static_cast<uint32_t>(host_end);
11847|    112|      out.components.port = parsed_port;
11848|    112|      out.components.pathname_start = static_cast<uint32_t>(out.buffer.size());
11849|    112|      out.components.search_start = url_components::omitted;
11850|    112|      out.components.hash_start = url_components::omitted;
11851|    112|      out.parse_path(path_view);
11852|    112|      apply_query_and_hash();
11853|       |    } else {
11854|       |      std::string host_str(input.substr(host_start, host_len));
11855|       |      if (has_upper) {
11856|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
11857|       |      }
11858|       |      out.host = std::move(host_str);
11859|       |      if (parsed_port != url_components::omitted) {
11860|       |        out.port = static_cast<uint16_t>(parsed_port);
11861|       |      }
11862|       |      out.parse_path(path_view);
11863|       |      apply_query_and_hash();
11864|       |    }
11865|    112|    return true;
11866|    112|  }
11867|       |
11868|    109|  const bool insert_slash = !has_path;
11869|    109|  if constexpr (is_aggregator) {
11870|    109|    const size_t out_len =
11871|    109|        host_end + port_bytes + (insert_slash ? 1 : 0) + (len - authority_end);
  ------------------
  |  Branch (11871:34): [True: 57, False: 52]
  ------------------
11872|    109|    const bool omit_port_bytes = parsed_port == url_components::omitted;
11873|    109|    if (out_len == len && !insert_slash && !omit_port_bytes) {
  ------------------
  |  Branch (11873:9): [True: 26, False: 83]
  |  Branch (11873:27): [True: 21, False: 5]
  |  Branch (11873:44): [True: 21, False: 0]
  ------------------
11874|     21|      out.buffer.assign(input);
11875|     88|    } else {
11876|     88|      out.buffer.clear();
11877|     88|      out.buffer.reserve(out_len);
11878|     88|      out.buffer.append(input.substr(0, host_end));
11879|     88|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (11879:11): [True: 52, False: 36]
  ------------------
11880|     52|        append_canonical_port(out.buffer, parsed_port);
11881|     52|      }
11882|     88|      if (insert_slash) {
  ------------------
  |  Branch (11882:11): [True: 57, False: 31]
  ------------------
11883|     57|        out.buffer.push_back('/');
11884|     57|      }
11885|     88|      if (authority_end < len) {
  ------------------
  |  Branch (11885:11): [True: 88, False: 0]
  ------------------
11886|     88|        out.buffer.append(input.substr(authority_end));
11887|     88|      }
11888|     88|    }
11889|    109|    if (has_upper) {
  ------------------
  |  Branch (11889:9): [True: 30, False: 79]
  ------------------
11890|     30|      unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
11891|     30|    }
11892|    109|    const uint32_t pathname_start =
11893|    109|        static_cast<uint32_t>(host_end) + port_bytes;
11894|    109|    const int32_t tail_delta = static_cast<int32_t>(pathname_start) +
11895|    109|                               (insert_slash ? 1 : 0) -
  ------------------
  |  Branch (11895:33): [True: 57, False: 52]
  ------------------
11896|    109|                               static_cast<int32_t>(authority_end);
11897|    109|    out.components.protocol_end = protocol_end;
11898|    109|    out.components.username_end = protocol_end + 2;
11899|    109|    out.components.host_start = protocol_end + 2;
11900|    109|    out.components.host_end = static_cast<uint32_t>(host_end);
11901|    109|    out.components.port = parsed_port;
11902|    109|    out.components.pathname_start = pathname_start;
11903|    109|    out.components.search_start =
11904|    109|        (query_start != std::string_view::npos)
  ------------------
  |  Branch (11904:9): [True: 27, False: 82]
  ------------------
11905|    109|            ? static_cast<uint32_t>(static_cast<int32_t>(query_start) +
11906|     27|                                    tail_delta)
11907|    109|            : url_components::omitted;
11908|    109|    out.components.hash_start =
11909|    109|        (hash_start != std::string_view::npos)
  ------------------
  |  Branch (11909:9): [True: 45, False: 64]
  ------------------
11910|    109|            ? static_cast<uint32_t>(static_cast<int32_t>(hash_start) +
11911|     45|                                    tail_delta)
11912|    109|            : url_components::omitted;
11913|       |  } else {
11914|       |    std::string host_str(input.substr(host_start, host_len));
11915|       |    if (has_upper) {
11916|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
11917|       |    }
11918|       |    out.host = std::move(host_str);
11919|       |    if (parsed_port != url_components::omitted) {
11920|       |      out.port = static_cast<uint16_t>(parsed_port);
11921|       |    }
11922|       |    if (insert_slash) {
11923|       |      out.path = "/";
11924|       |    } else {
11925|       |      out.path.assign(input.data() + path_start, path_end - path_start);
11926|       |    }
11927|       |    if (query_start != std::string_view::npos) {
11928|       |      const size_t q_end =
11929|       |          (hash_start != std::string_view::npos) ? hash_start : len;
11930|       |      out.query.emplace(input.data() + query_start + 1,
11931|       |                        q_end - query_start - 1);
11932|       |    }
11933|       |    if (hash_start != std::string_view::npos) {
11934|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
11935|       |    }
11936|       |  }
11937|    109|  return true;
11938|    221|}
_ZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
12517|  13.1k|                           const result_type* base_url) {
12518|       |  // We can specialize the implementation per type.
12519|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
12520|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
12521|       |  // something else } is free (at runtime). This means that ada::url_aggregator
12522|       |  // and ada::url **do not have to support the exact same API**.
12523|  13.1k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
12524|  13.1k|  constexpr bool result_type_is_ada_url_aggregator =
12525|  13.1k|      std::is_same_v<url_aggregator, result_type>;
12526|  13.1k|  static_assert(result_type_is_ada_url ||
12527|  13.1k|                result_type_is_ada_url_aggregator);  // We don't support
12528|       |                                                     // anything else for now.
12529|       |
12530|  13.1k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
12531|  13.1k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
12532|  13.1k|          ")");
12533|       |
12534|  13.1k|  result_type url{};
12535|       |
12536|  13.1k|  const uint32_t max_input_length = ada::get_max_input_length();
12537|       |
12538|       |  // Normalization (percent-encoding, IDNA) can push the serialized URL past
12539|       |  // max_input_length even when the input fit under it. The check at the end of
12540|       |  // the state machine covers URLs that run to completion, but several states
12541|       |  // return early after appending a query or fragment, so run the same check on
12542|       |  // those exits too. Without this, a query- or fragment-terminated URL such as
12543|       |  // file://x/?<...> or https://user@x/?<...> is accepted while the equivalent
12544|       |  // https://x/?<...> that takes the absolute fast path is rejected.
12545|  13.1k|  const auto enforce_max_input_length = [&]() {
12546|  13.1k|    if constexpr (store_values) {
12547|  13.1k|      if (url.is_valid) {
12548|  13.1k|        if constexpr (result_type_is_ada_url_aggregator) {
12549|  13.1k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
12550|  13.1k|            url.is_valid = false;
12551|  13.1k|          }
12552|  13.1k|        } else {
12553|  13.1k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
12554|  13.1k|            url.is_valid = false;
12555|  13.1k|          }
12556|  13.1k|        }
12557|  13.1k|      }
12558|  13.1k|    }
12559|  13.1k|  };
12560|       |
12561|       |  // We refuse to parse URL strings that exceed the maximum input length.
12562|       |  // By default, this is 4GB but can be configured via
12563|       |  // ada::set_max_input_length().
12564|  13.1k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12564:7): [True: 0, False: 13.1k]
  ------------------
12565|      0|    url.is_valid = false;
12566|      0|  }
12567|       |  // Going forward, user_input.size() is in [0,
12568|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
12569|       |  // base, or the optional_url was invalid, we must return.
12570|  13.1k|  if (base_url != nullptr) {
  ------------------
  |  Branch (12570:7): [True: 0, False: 13.1k]
  ------------------
12571|      0|    url.is_valid &= base_url->is_valid;
12572|      0|  }
12573|  13.1k|  if (!url.is_valid) {
  ------------------
  |  Branch (12573:7): [True: 0, False: 13.1k]
  ------------------
12574|      0|    return url;
12575|      0|  }
12576|       |
12577|       |  // Simple absolute / relative fast paths (before tabs/newline scan).
12578|  13.1k|  if constexpr (store_values) {
12579|  13.1k|    bool hit_fast_path = false;
12580|  13.1k|    if (base_url == nullptr) {
  ------------------
  |  Branch (12580:9): [True: 13.1k, False: 0]
  ------------------
12581|       |      // IPv4/IPv6 and userinfo miss the fast path. Skip the never_inline
12582|       |      // call so those URLs (including SetHref) do not pay for a miss.
12583|  13.1k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
12584|  13.1k|      const size_t n = user_input.size();
12585|  13.1k|      size_t host_start = 0;
12586|  13.1k|      if (n >= 8 && p[4] == ':' && p[5] == '/' && p[6] == '/') {
  ------------------
  |  Branch (12586:11): [True: 13.1k, False: 0]
  |  Branch (12586:21): [True: 13.1k, False: 0]
  |  Branch (12586:36): [True: 13.1k, False: 0]
  |  Branch (12586:51): [True: 13.1k, False: 0]
  ------------------
12587|  13.1k|        host_start = 7;
12588|  13.1k|      } else if (n >= 9 && p[5] == ':' && p[6] == '/' && p[7] == '/') {
  ------------------
  |  Branch (12588:18): [True: 0, False: 0]
  |  Branch (12588:28): [True: 0, False: 0]
  |  Branch (12588:43): [True: 0, False: 0]
  |  Branch (12588:58): [True: 0, False: 0]
  ------------------
12589|      0|        host_start = 8;
12590|      0|      }
12591|  13.1k|      const uint8_t host_first = host_start != 0 ? p[host_start] : 0;
  ------------------
  |  Branch (12591:34): [True: 13.1k, False: 0]
  ------------------
12592|  13.1k|      const bool skip_ip =
12593|  13.1k|          host_first == '[' || (host_first >= '0' && host_first <= '9');
  ------------------
  |  Branch (12593:11): [True: 7.16k, False: 5.95k]
  |  Branch (12593:33): [True: 5.07k, False: 889]
  |  Branch (12593:54): [True: 1.20k, False: 3.86k]
  ------------------
12594|  13.1k|      const bool skip_userinfo =
12595|  13.1k|          host_start != 0 && authority_has_at(p, host_start, n);
  ------------------
  |  Branch (12595:11): [True: 13.1k, False: 0]
  |  Branch (12595:30): [True: 189, False: 12.9k]
  ------------------
12596|  13.1k|      hit_fast_path = !skip_ip && !skip_userinfo &&
  ------------------
  |  Branch (12596:23): [True: 4.75k, False: 8.36k]
  |  Branch (12596:35): [True: 4.58k, False: 176]
  ------------------
12597|  4.58k|                      try_parse_simple_absolute(user_input, url);
  ------------------
  |  Branch (12597:23): [True: 1.22k, False: 3.35k]
  ------------------
12598|  13.1k|    } else {
12599|      0|      hit_fast_path = try_parse_simple_relative(user_input, *base_url, url);
12600|      0|    }
12601|  13.1k|    if (hit_fast_path) {
  ------------------
  |  Branch (12601:9): [True: 1.22k, False: 11.9k]
  ------------------
12602|  1.22k|      if constexpr (result_type_is_ada_url_aggregator) {
12603|  1.22k|        if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12603:13): [True: 0, False: 1.22k]
  ------------------
12604|      0|          url.is_valid = false;
12605|      0|        }
12606|       |      } else {
12607|       |        // For a small absolute input, even worst-case normalization cannot
12608|       |        // exceed the limit: percent encoding expands at most 3x and IDNA at
12609|       |        // most 4.5x. Avoid traversing every stored component on the common
12610|       |        // default-limit path.
12611|       |        if ((base_url != nullptr ||
12612|       |             user_input.size() > static_cast<size_t>(max_input_length) / 5) &&
12613|       |            url.get_href_size() > max_input_length) [[unlikely]] {
12614|       |          url.is_valid = false;
12615|       |        }
12616|       |      }
12617|  1.22k|      return url;
12618|  1.22k|    }
12619|  13.1k|  }
12620|       |
12621|  11.9k|  state state = state::SCHEME_START;
12622|       |
12623|  13.1k|  std::string tmp_buffer;
12624|  13.1k|  std::string_view url_data;
12625|  13.1k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (12625:7): [True: 138, False: 12.9k]
  ------------------
12626|    138|    tmp_buffer = user_input;
12627|       |    // Optimization opportunity: Instead of copying and then pruning, we could
12628|       |    // just directly build the string from user_input.
12629|    138|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
12630|    138|    url_data = tmp_buffer;
12631|  12.9k|  } else [[likely]] {
12632|  12.9k|    url_data = user_input;
12633|  12.9k|  }
12634|       |
12635|       |  // Leading and trailing control characters are uncommon and easy to deal with
12636|       |  // (no performance concern).
12637|  13.1k|  helpers::trim_c0_whitespace(url_data);
12638|       |
12639|  13.1k|  if constexpr (result_type_is_ada_url_aggregator && store_values) {
12640|       |    // Most of the time, we just need user_input.size().
12641|       |    // In some instances, we may need a bit more.
12642|       |    ///////////////////////////
12643|       |    // This is *very* important. This line should *not* be removed
12644|       |    // hastily. There are principled reasons why reserve is important
12645|       |    // for performance. If you have a benchmark with small inputs,
12646|       |    // it may not matter, but in other instances, it could.
12647|       |    ////
12648|       |    // This rounds up to the next power of two.
12649|       |    // We know that user_input.size() is in [0,
12650|       |    // std::numeric_limits<uint32_t>::max).
12651|  13.1k|    uint32_t reserve_capacity =
12652|  13.1k|        (0xFFFFFFFF >>
12653|  13.1k|         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
12654|  13.1k|        1;
12655|  13.1k|    url.reserve(reserve_capacity);
12656|  13.1k|  }
12657|       |
12658|       |  // Optimization opportunity. Most websites do not have fragment.
12659|  13.1k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
12660|       |  // We add it last so that an implementation like ada::url_aggregator
12661|       |  // can append it last to its internal buffer, thus improving performance.
12662|       |
12663|       |  // Here url_data no longer has its fragment.
12664|       |  // We are going to access the data from url_data (it is immutable).
12665|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
12666|       |  // The input_position variable should range from 0 to input_size.
12667|       |  // It is illegal to access url_data at input_size.
12668|  13.1k|  size_t input_position = 0;
12669|  13.1k|  const size_t input_size = url_data.size();
12670|       |  // Keep running the following state machine by switching on state.
12671|       |  // If after a run pointer points to the EOF code point, go to the next step.
12672|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
12673|       |  // We never decrement input_position.
12674|  64.4k|  while (input_position <= input_size) {
  ------------------
  |  Branch (12674:10): [True: 62.5k, False: 1.88k]
  ------------------
12675|  62.5k|    ada_log("In parsing at ", input_position, " out of ", input_size,
12676|  62.5k|            " in state ", ada::to_string(state));
12677|  62.5k|    switch (state) {
12678|  11.9k|      case state::SCHEME_START: {
  ------------------
  |  Branch (12678:7): [True: 11.9k, False: 50.6k]
  ------------------
12679|  11.9k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
12680|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
12681|       |        // state to scheme state.
12682|  11.9k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12682:13): [True: 11.9k, False: 0]
  ------------------
12683|  11.9k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (12683:13): [True: 11.9k, False: 0]
  ------------------
12684|  11.9k|          state = state::SCHEME;
12685|  11.9k|          input_position++;
12686|  11.9k|        } else {
12687|       |          // Otherwise, if state override is not given, set state to no scheme
12688|       |          // state and decrease pointer by 1.
12689|      0|          state = state::NO_SCHEME;
12690|      0|        }
12691|  11.9k|        break;
12692|      0|      }
12693|  11.9k|      case state::SCHEME: {
  ------------------
  |  Branch (12693:7): [True: 11.9k, False: 50.6k]
  ------------------
12694|  11.9k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
12695|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
12696|       |        // append c, lowercased, to buffer.
12697|  47.6k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (12697:16): [True: 47.6k, False: 0]
  ------------------
12698|  47.6k|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (12698:16): [True: 35.7k, False: 11.9k]
  ------------------
12699|  35.7k|          input_position++;
12700|  35.7k|        }
12701|       |        // Otherwise, if c is U+003A (:), then:
12702|  11.9k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12702:13): [True: 11.9k, False: 0]
  ------------------
12703|  11.9k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (12703:13): [True: 11.9k, False: 0]
  ------------------
12704|  11.9k|          ada_log("SCHEME the scheme should be ",
12705|  11.9k|                  url_data.substr(0, input_position));
12706|       |          if constexpr (result_type_is_ada_url) {
12707|       |            if (!url.parse_scheme(url_data.substr(0, input_position))) {
12708|       |              return url;
12709|       |            }
12710|  11.9k|          } else {
12711|       |            // we pass the colon along instead of painfully adding it back.
12712|  11.9k|            if (!url.parse_scheme_with_colon(
  ------------------
  |  Branch (12712:17): [True: 0, False: 11.9k]
  ------------------
12713|  11.9k|                    url_data.substr(0, input_position + 1))) {
12714|      0|              return url;
12715|      0|            }
12716|  11.9k|          }
12717|  11.9k|          ada_log("SCHEME the scheme is ", url.get_protocol());
12718|       |
12719|       |          // If url's scheme is "file", then:
12720|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
12721|  11.9k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (12721:15): [True: 0, False: 11.9k]
  ------------------
12722|       |            // Set state to file state.
12723|      0|            state = state::FILE;
12724|      0|          }
12725|       |          // Otherwise, if url is special, base is non-null, and base's scheme
12726|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
12727|       |          // != nullptr is false.
12728|  11.9k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (12728:20): [True: 11.9k, False: 0]
  |  Branch (12728:40): [True: 0, False: 11.9k]
  ------------------
12729|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (12729:20): [True: 0, False: 0]
  ------------------
12730|       |            // Set state to special relative or authority state.
12731|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
12732|      0|          }
12733|       |          // Otherwise, if url is special, set state to special authority
12734|       |          // slashes state.
12735|  11.9k|          else if (url.is_special()) {
  ------------------
  |  Branch (12735:20): [True: 11.9k, False: 0]
  ------------------
12736|  11.9k|            state = state::SPECIAL_AUTHORITY_SLASHES;
12737|  11.9k|          }
12738|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
12739|       |          // path or authority state and increase pointer by 1.
12740|      0|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (12740:20): [True: 0, False: 0]
  ------------------
12741|      0|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (12741:20): [True: 0, False: 0]
  ------------------
12742|      0|            state = state::PATH_OR_AUTHORITY;
12743|      0|            input_position++;
12744|      0|          }
12745|       |          // Otherwise, set url's path to the empty string and set state to
12746|       |          // opaque path state.
12747|      0|          else {
12748|      0|            state = state::OPAQUE_PATH;
12749|      0|          }
12750|  11.9k|        }
12751|       |        // Otherwise, if state override is not given, set buffer to the empty
12752|       |        // string, state to no scheme state, and start over (from the first code
12753|       |        // point in input).
12754|      0|        else {
12755|      0|          state = state::NO_SCHEME;
12756|      0|          input_position = 0;
12757|      0|          break;
12758|      0|        }
12759|  11.9k|        input_position++;
12760|  11.9k|        break;
12761|  11.9k|      }
12762|      0|      case state::NO_SCHEME: {
  ------------------
  |  Branch (12762:7): [True: 0, False: 62.5k]
  ------------------
12763|      0|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
12764|       |        // The fragment was pruned from url_data before the state machine ran,
12765|       |        // so 'c is U+0023 (#)' holds exactly when a fragment was found and
12766|       |        // nothing else remains in front of it.
12767|      0|        const bool c_is_hash =
12768|      0|            fragment.has_value() && input_position == input_size;
  ------------------
  |  Branch (12768:13): [True: 0, False: 0]
  |  Branch (12768:37): [True: 0, False: 0]
  ------------------
12769|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
12770|       |        // validation error, return failure.
12771|      0|        if (base_url == nullptr || (base_url->has_opaque_path && !c_is_hash)) {
  ------------------
  |  Branch (12771:13): [True: 0, False: 0]
  |  Branch (12771:37): [True: 0, False: 0]
  |  Branch (12771:66): [True: 0, False: 0]
  ------------------
12772|      0|          ada_log("NO_SCHEME validation error");
12773|      0|          url.is_valid = false;
12774|      0|          return url;
12775|      0|        }
12776|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
12777|       |        // set url's scheme to base's scheme, url's path to base's path, url's
12778|       |        // query to base's query, and set state to fragment state.
12779|      0|        else if (base_url->has_opaque_path && c_is_hash) {
  ------------------
  |  Branch (12779:18): [True: 0, False: 0]
  |  Branch (12779:47): [True: 0, False: 0]
  ------------------
12780|      0|          ada_log("NO_SCHEME opaque base with fragment");
12781|      0|          url.copy_scheme(*base_url);
12782|      0|          url.has_opaque_path = base_url->has_opaque_path;
12783|       |
12784|       |          if constexpr (result_type_is_ada_url) {
12785|       |            url.path = base_url->path;
12786|       |            url.query = base_url->query;
12787|      0|          } else {
12788|      0|            url.update_base_pathname(base_url->get_pathname());
12789|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (12789:17): [True: 0, False: 0]
  ------------------
12790|       |              // get_search() returns "" for an empty query string (URL ends
12791|       |              // with '?'). update_base_search("") would incorrectly clear the
12792|       |              // query, so pass "?" to preserve the empty query distinction.
12793|      0|              auto s = base_url->get_search();
12794|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (12794:38): [True: 0, False: 0]
  ------------------
12795|      0|            }
12796|      0|          }
12797|      0|          url.update_unencoded_base_hash(*fragment);
12798|      0|          enforce_max_input_length();
12799|      0|          return url;
12800|      0|        }
12801|       |        // Otherwise, if base's scheme is not "file", set state to relative
12802|       |        // state and decrease pointer by 1.
12803|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
12804|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (12804:18): [True: 0, False: 0]
  ------------------
12805|      0|          ada_log("NO_SCHEME non-file relative path");
12806|      0|          state = state::RELATIVE_SCHEME;
12807|      0|        }
12808|       |        // Otherwise, set state to file state and decrease pointer by 1.
12809|      0|        else {
12810|      0|          ada_log("NO_SCHEME file base type");
12811|      0|          state = state::FILE;
12812|      0|        }
12813|      0|        break;
12814|      0|      }
12815|  11.9k|      case state::AUTHORITY: {
  ------------------
  |  Branch (12815:7): [True: 11.9k, False: 50.6k]
  ------------------
12816|  11.9k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
12817|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
12818|       |        // about AUTHORITY. Of course, we could have @ and still not have to
12819|       |        // worry about AUTHORITY.
12820|       |        // TODO: Instead of just collecting a bool, collect the location of the
12821|       |        // '@' and do something useful with it.
12822|       |        // TODO: We could do various processing early on, using a single pass
12823|       |        // over the string to collect information about it, e.g., telling us
12824|       |        // whether there is a @ and if so, where (or how many).
12825|       |
12826|       |        // Check if url data contains an @.
12827|  11.9k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (12827:13): [True: 11.6k, False: 256]
  ------------------
12828|  11.6k|          state = state::HOST;
12829|  11.6k|          break;
12830|  11.6k|        }
12831|    256|        bool at_sign_seen{false};
12832|    256|        bool password_token_seen{false};
12833|       |        /**
12834|       |         * We expect something of the sort...
12835|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
12836|       |         * --------^
12837|       |         */
12838|  2.00k|        do {
12839|  2.00k|          std::string_view view = url_data.substr(input_position);
12840|       |          // The delimiters are @, /, ? \\.
12841|  2.00k|          size_t location =
12842|  2.00k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (12842:15): [True: 2.00k, False: 0]
  ------------------
12843|  2.00k|                               : helpers::find_authority_delimiter(view);
12844|  2.00k|          std::string_view authority_view = view.substr(0, location);
12845|  2.00k|          size_t end_of_authority = input_position + authority_view.size();
12846|       |          // If c is U+0040 (@), then:
12847|  2.00k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (12847:15): [True: 1.99k, False: 13]
  ------------------
12848|  1.99k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (12848:15): [True: 1.74k, False: 243]
  ------------------
12849|       |            // If atSignSeen is true, then prepend "%40" to buffer.
12850|  1.74k|            if (at_sign_seen) {
  ------------------
  |  Branch (12850:17): [True: 1.51k, False: 237]
  ------------------
12851|  1.51k|              if (password_token_seen) {
  ------------------
  |  Branch (12851:19): [True: 690, False: 821]
  ------------------
12852|       |                if constexpr (result_type_is_ada_url) {
12853|       |                  url.password += "%40";
12854|    690|                } else {
12855|    690|                  url.append_base_password("%40");
12856|    690|                }
12857|    821|              } else {
12858|       |                if constexpr (result_type_is_ada_url) {
12859|       |                  url.username += "%40";
12860|    821|                } else {
12861|    821|                  url.append_base_username("%40");
12862|    821|                }
12863|    821|              }
12864|  1.51k|            }
12865|       |
12866|  1.74k|            at_sign_seen = true;
12867|       |
12868|  1.74k|            if (!password_token_seen) {
  ------------------
  |  Branch (12868:17): [True: 1.05k, False: 690]
  ------------------
12869|  1.05k|              size_t password_token_location = authority_view.find(':');
12870|  1.05k|              password_token_seen =
12871|  1.05k|                  password_token_location != std::string_view::npos;
12872|       |
12873|  1.05k|              if constexpr (store_values) {
12874|  1.05k|                if (!password_token_seen) {
  ------------------
  |  Branch (12874:21): [True: 976, False: 82]
  ------------------
12875|       |                  if constexpr (result_type_is_ada_url) {
12876|       |                    url.username += unicode::percent_encode(
12877|       |                        authority_view,
12878|       |                        character_sets::USERINFO_PERCENT_ENCODE);
12879|    976|                  } else {
12880|    976|                    url.append_base_username(unicode::percent_encode(
12881|    976|                        authority_view,
12882|    976|                        character_sets::USERINFO_PERCENT_ENCODE));
12883|    976|                  }
12884|    976|                } else {
12885|       |                  if constexpr (result_type_is_ada_url) {
12886|       |                    url.username += unicode::percent_encode(
12887|       |                        authority_view.substr(0, password_token_location),
12888|       |                        character_sets::USERINFO_PERCENT_ENCODE);
12889|       |                    url.password += unicode::percent_encode(
12890|       |                        authority_view.substr(password_token_location + 1),
12891|       |                        character_sets::USERINFO_PERCENT_ENCODE);
12892|     82|                  } else {
12893|     82|                    url.append_base_username(unicode::percent_encode(
12894|     82|                        authority_view.substr(0, password_token_location),
12895|     82|                        character_sets::USERINFO_PERCENT_ENCODE));
12896|     82|                    url.append_base_password(unicode::percent_encode(
12897|     82|                        authority_view.substr(password_token_location + 1),
12898|     82|                        character_sets::USERINFO_PERCENT_ENCODE));
12899|     82|                  }
12900|     82|                }
12901|  1.05k|              }
12902|  1.05k|            } else if constexpr (store_values) {
12903|       |              if constexpr (result_type_is_ada_url) {
12904|       |                url.password += unicode::percent_encode(
12905|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
12906|    690|              } else {
12907|    690|                url.append_base_password(unicode::percent_encode(
12908|    690|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
12909|    690|              }
12910|    690|            }
12911|  1.74k|          }
12912|       |          // Otherwise, if one of the following is true:
12913|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
12914|       |          // - url is special and c is U+005C (\)
12915|    256|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (12915:20): [True: 13, False: 243]
  ------------------
12916|    243|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (12916:20): [True: 231, False: 12]
  ------------------
12917|     12|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (12917:20): [True: 11, False: 1]
  ------------------
12918|    256|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (12918:21): [True: 1, False: 0]
  |  Branch (12918:41): [True: 1, False: 0]
  ------------------
12919|       |            // If atSignSeen is true and authority_view is the empty string,
12920|       |            // validation error, return failure.
12921|    256|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (12921:17): [True: 237, False: 19]
  |  Branch (12921:33): [True: 3, False: 234]
  ------------------
12922|      3|              url.is_valid = false;
12923|      3|              return url;
12924|      3|            }
12925|    253|            state = state::HOST;
12926|    253|            break;
12927|    256|          }
12928|  1.74k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (12928:15): [True: 0, False: 1.74k]
  ------------------
12929|      0|            if constexpr (store_values) {
12930|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (12930:19): [True: 0, False: 0]
  ------------------
12931|      0|                url.update_unencoded_base_hash(*fragment);
12932|      0|              }
12933|      0|            }
12934|      0|            enforce_max_input_length();
12935|      0|            return url;
12936|      0|          }
12937|  1.74k|          input_position = end_of_authority + 1;
12938|  1.74k|        } while (true);
  ------------------
  |  Branch (12938:18): [True: 1.74k, Folded]
  ------------------
12939|       |
12940|    253|        break;
12941|    256|      }
12942|    253|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (12942:7): [True: 0, False: 62.5k]
  ------------------
12943|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
12944|      0|                helpers::substring(url_data, input_position));
12945|       |
12946|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
12947|       |        // then set state to special authority ignore slashes state and increase
12948|       |        // pointer by 1.
12949|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (12949:13): [True: 0, False: 0]
  ------------------
12950|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
12951|      0|          input_position += 2;
12952|      0|        } else {
12953|       |          // Otherwise, validation error, set state to relative state and
12954|       |          // decrease pointer by 1.
12955|      0|          state = state::RELATIVE_SCHEME;
12956|      0|        }
12957|       |
12958|      0|        break;
12959|    256|      }
12960|      0|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (12960:7): [True: 0, False: 62.5k]
  ------------------
12961|      0|        ada_log("PATH_OR_AUTHORITY ",
12962|      0|                helpers::substring(url_data, input_position));
12963|       |
12964|       |        // If c is U+002F (/), then set state to authority state.
12965|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12965:13): [True: 0, False: 0]
  ------------------
12966|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (12966:13): [True: 0, False: 0]
  ------------------
12967|      0|          state = state::AUTHORITY;
12968|      0|          input_position++;
12969|      0|        } else {
12970|       |          // Otherwise, set state to path state, and decrease pointer by 1.
12971|      0|          state = state::PATH;
12972|      0|        }
12973|       |
12974|      0|        break;
12975|    256|      }
12976|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (12976:7): [True: 0, False: 62.5k]
  ------------------
12977|      0|        ada_log("RELATIVE_SCHEME ",
12978|      0|                helpers::substring(url_data, input_position));
12979|       |
12980|       |        // Set url's scheme to base's scheme.
12981|      0|        url.copy_scheme(*base_url);
12982|       |
12983|       |        // If c is U+002F (/), then set state to relative slash state.
12984|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12984:13): [True: 0, False: 0]
  ------------------
12985|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
12986|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (12986:13): [True: 0, False: 0]
  ------------------
12987|      0|          ada_log(
12988|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
12989|      0|              "slash state");
12990|      0|          state = state::RELATIVE_SLASH;
12991|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (12991:20): [True: 0, False: 0]
  |  Branch (12991:40): [True: 0, False: 0]
  ------------------
12992|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (12992:20): [True: 0, False: 0]
  ------------------
12993|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
12994|       |          // set state to relative slash state.
12995|      0|          ada_log(
12996|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
12997|      0|              "error, set state to relative slash state");
12998|      0|          state = state::RELATIVE_SLASH;
12999|      0|        } else {
13000|      0|          ada_log("RELATIVE_SCHEME otherwise");
13001|       |          // Set url's username to base's username, url's password to base's
13002|       |          // password, url's host to base's host, url's port to base's port,
13003|       |          // url's path to a clone of base's path, and url's query to base's
13004|       |          // query.
13005|       |          if constexpr (result_type_is_ada_url) {
13006|       |            url.username = base_url->username;
13007|       |            url.password = base_url->password;
13008|       |            url.host = base_url->host;
13009|       |            url.port = base_url->port;
13010|       |            // cloning the base path includes cloning the has_opaque_path flag
13011|       |            url.has_opaque_path = base_url->has_opaque_path;
13012|       |            url.path = base_url->path;
13013|       |            url.query = base_url->query;
13014|      0|          } else {
13015|      0|            url.update_base_authority(base_url->get_href(),
13016|      0|                                      base_url->get_components());
13017|      0|            url.update_host_to_base_host(base_url->get_hostname());
13018|      0|            url.update_base_port(base_url->retrieve_base_port());
13019|       |            // cloning the base path includes cloning the has_opaque_path flag
13020|      0|            url.has_opaque_path = base_url->has_opaque_path;
13021|      0|            url.update_base_pathname(base_url->get_pathname());
13022|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13022:17): [True: 0, False: 0]
  ------------------
13023|       |              // get_search() returns "" for an empty query string (URL ends
13024|       |              // with '?'). update_base_search("") would incorrectly clear the
13025|       |              // query, so pass "?" to preserve the empty query distinction.
13026|      0|              auto s = base_url->get_search();
13027|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13027:38): [True: 0, False: 0]
  ------------------
13028|      0|            }
13029|      0|          }
13030|       |
13031|      0|          url.has_opaque_path = base_url->has_opaque_path;
13032|       |
13033|       |          // If c is U+003F (?), then set url's query to the empty string, and
13034|       |          // state to query state.
13035|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (13035:15): [True: 0, False: 0]
  ------------------
13036|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13036:15): [True: 0, False: 0]
  ------------------
13037|      0|            state = state::QUERY;
13038|      0|          }
13039|       |          // Otherwise, if c is not the EOF code point:
13040|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13040:20): [True: 0, False: 0]
  ------------------
13041|       |            // Set url's query to null.
13042|      0|            url.clear_search();
13043|       |            if constexpr (result_type_is_ada_url) {
13044|       |              // Shorten url's path.
13045|       |              helpers::shorten_path(url.path, url.type);
13046|      0|            } else {
13047|      0|              std::string_view path = url.get_pathname();
13048|      0|              if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13048:19): [True: 0, False: 0]
  ------------------
13049|      0|                url.update_base_pathname(std::move(std::string(path)));
13050|      0|              }
13051|      0|            }
13052|       |            // Set state to path state and decrease pointer by 1.
13053|      0|            state = state::PATH;
13054|      0|            break;
13055|      0|          }
13056|      0|        }
13057|      0|        input_position++;
13058|      0|        break;
13059|      0|      }
13060|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (13060:7): [True: 0, False: 62.5k]
  ------------------
13061|      0|        ada_log("RELATIVE_SLASH ",
13062|      0|                helpers::substring(url_data, input_position));
13063|       |
13064|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
13065|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13066|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13066:13): [True: 0, False: 0]
  |  Branch (13066:33): [True: 0, False: 0]
  ------------------
13067|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13067:14): [True: 0, False: 0]
  ------------------
13068|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13068:14): [True: 0, False: 0]
  ------------------
13069|       |          // Set state to special authority ignore slashes state.
13070|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13071|      0|        }
13072|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
13073|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13073:18): [True: 0, False: 0]
  ------------------
13074|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13074:18): [True: 0, False: 0]
  ------------------
13075|      0|          state = state::AUTHORITY;
13076|      0|        }
13077|       |        // Otherwise, set
13078|       |        // - url's username to base's username,
13079|       |        // - url's password to base's password,
13080|       |        // - url's host to base's host,
13081|       |        // - url's port to base's port,
13082|       |        // - state to path state, and then, decrease pointer by 1.
13083|      0|        else {
13084|       |          if constexpr (result_type_is_ada_url) {
13085|       |            url.username = base_url->username;
13086|       |            url.password = base_url->password;
13087|       |            url.host = base_url->host;
13088|       |            url.port = base_url->port;
13089|      0|          } else {
13090|      0|            url.update_base_authority(base_url->get_href(),
13091|      0|                                      base_url->get_components());
13092|      0|            url.update_host_to_base_host(base_url->get_hostname());
13093|      0|            url.update_base_port(base_url->retrieve_base_port());
13094|      0|          }
13095|      0|          state = state::PATH;
13096|      0|          break;
13097|      0|        }
13098|       |
13099|      0|        input_position++;
13100|      0|        break;
13101|      0|      }
13102|  11.9k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (13102:7): [True: 11.9k, False: 50.6k]
  ------------------
13103|  11.9k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
13104|  11.9k|                helpers::substring(url_data, input_position));
13105|       |
13106|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13107|       |        // then set state to special authority ignore slashes state and increase
13108|       |        // pointer by 1.
13109|  11.9k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13109:13): [True: 11.9k, False: 0]
  ------------------
13110|  11.9k|          input_position += 2;
13111|  11.9k|        }
13112|       |
13113|  11.9k|        [[fallthrough]];
13114|  11.9k|      }
13115|  11.9k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (13115:7): [True: 0, False: 62.5k]
  ------------------
13116|  11.9k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
13117|  11.9k|                helpers::substring(url_data, input_position));
13118|       |
13119|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
13120|       |        // authority state and decrease pointer by 1.
13121|  12.1k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13121:16): [True: 12.1k, False: 1]
  ------------------
13122|  12.1k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (13122:17): [True: 88, False: 12.0k]
  ------------------
13123|  12.0k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (13123:17): [True: 174, False: 11.8k]
  ------------------
13124|    262|          input_position++;
13125|    262|        }
13126|  11.9k|        state = state::AUTHORITY;
13127|       |
13128|  11.9k|        break;
13129|  11.9k|      }
13130|    404|      case state::QUERY: {
  ------------------
  |  Branch (13130:7): [True: 404, False: 62.1k]
  ------------------
13131|    404|        ada_log("QUERY ", helpers::substring(url_data, input_position));
13132|    404|        if constexpr (store_values) {
13133|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
13134|       |          // if url is special; otherwise the query percent-encode set.
13135|    404|          const uint8_t* query_percent_encode_set =
13136|    404|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (13136:15): [True: 404, False: 0]
  ------------------
13137|    404|                               : character_sets::QUERY_PERCENT_ENCODE;
13138|       |
13139|       |          // Percent-encode after encoding, with encoding, buffer, and
13140|       |          // queryPercentEncodeSet, and append the result to url's query.
13141|    404|          url.update_base_search(url_data.substr(input_position),
13142|    404|                                 query_percent_encode_set);
13143|    404|          ada_log("QUERY update_base_search completed ");
13144|    404|          if (fragment.has_value()) {
  ------------------
  |  Branch (13144:15): [True: 6, False: 398]
  ------------------
13145|      6|            url.update_unencoded_base_hash(*fragment);
13146|      6|          }
13147|    404|        }
13148|    404|        enforce_max_input_length();
13149|    404|        return url;
13150|  11.9k|      }
13151|  11.8k|      case state::HOST: {
  ------------------
  |  Branch (13151:7): [True: 11.8k, False: 50.6k]
  ------------------
13152|  11.8k|        ada_log("HOST ", helpers::substring(url_data, input_position));
13153|       |
13154|  11.8k|        std::string_view host_view = url_data.substr(input_position);
13155|  11.8k|        auto [location, found_colon] =
13156|  11.8k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
13157|  11.8k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (13157:26): [True: 11.8k, False: 0]
  ------------------
13158|  11.8k|                             ? input_position + location
13159|  11.8k|                             : input_size;
13160|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
13161|       |        // Note: the 'found_colon' value is true if and only if a colon was
13162|       |        // encountered while not inside brackets.
13163|  11.8k|        if (found_colon) {
  ------------------
  |  Branch (13163:13): [True: 731, False: 11.1k]
  ------------------
13164|       |          // If buffer is the empty string, validation error, return failure.
13165|       |          // Let host be the result of host parsing buffer with url is not
13166|       |          // special.
13167|    731|          ada_log("HOST parsing ", host_view);
13168|    731|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13168:15): [True: 185, False: 546]
  ------------------
13169|    185|            return url;
13170|    185|          }
13171|    546|          ada_log("HOST parsing results in ", url.get_hostname());
13172|       |          // Set url's host to host, buffer to the empty string, and state to
13173|       |          // port state.
13174|    546|          state = state::PORT;
13175|    546|          input_position++;
13176|    546|        }
13177|       |        // Otherwise, if one of the following is true:
13178|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13179|       |        // - url is special and c is U+005C (\)
13180|       |        // The get_host_delimiter_location function either brings us to
13181|       |        // the colon outside of the bracket, or to one of those characters.
13182|  11.1k|        else {
13183|       |          // If url is special and host_view is the empty string, validation
13184|       |          // error, return failure.
13185|  11.1k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (13185:15): [True: 5, False: 11.1k]
  |  Branch (13185:36): [True: 5, False: 0]
  ------------------
13186|      5|            url.is_valid = false;
13187|      5|            return url;
13188|      5|          }
13189|  11.1k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
13190|       |          // Let host be the result of host parsing host_view with url is not
13191|       |          // special.
13192|  11.1k|          if (host_view.empty()) {
  ------------------
  |  Branch (13192:15): [True: 0, False: 11.1k]
  ------------------
13193|      0|            url.update_base_hostname("");
13194|  11.1k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13194:22): [True: 10.0k, False: 1.06k]
  ------------------
13195|  10.0k|            return url;
13196|  10.0k|          }
13197|  1.06k|          ada_log("HOST parsing results in ", url.get_hostname(),
13198|  1.06k|                  " href=", url.get_href());
13199|       |
13200|       |          // Set url's host to host, and state to path start state.
13201|  1.06k|          state = state::PATH_START;
13202|  1.06k|        }
13203|       |
13204|  1.61k|        break;
13205|  11.8k|      }
13206|  1.61k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (13206:7): [True: 0, False: 62.5k]
  ------------------
13207|      0|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
13208|       |        // Opaque path, query, and fragment are structurally always valid:
13209|       |        // the parser would just percent-encode whatever is there. When we
13210|       |        // are not storing values (can_parse), we can return immediately.
13211|       |        // We must set has_opaque_path = true before returning so that when
13212|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
13213|       |        // correctly rejects relative inputs against an opaque-path base
13214|       |        // (e.g. can_parse("", &"W:") must return false).
13215|       |        if constexpr (!store_values) {
13216|       |          url.has_opaque_path = true;
13217|       |          return url;
13218|       |        }
13219|      0|        std::string_view view = url_data.substr(input_position);
13220|       |        // If c is U+003F (?), then set url's query to the empty string and
13221|       |        // state to query state.
13222|      0|        size_t location = view.find('?');
13223|      0|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (13223:13): [True: 0, False: 0]
  ------------------
13224|      0|          view.remove_suffix(view.size() - location);
13225|      0|          state = state::QUERY;
13226|      0|          input_position += location + 1;
13227|      0|        } else {
13228|      0|          input_position = input_size + 1;
13229|      0|        }
13230|      0|        url.has_opaque_path = true;
13231|       |
13232|       |        // This is a really unlikely scenario in real world. We should not seek
13233|       |        // to optimize it.
13234|      0|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (13234:13): [True: 0, False: 0]
  ------------------
13235|      0|          std::string modified_view =
13236|      0|              std::string(view.substr(0, view.size() - 1)) + "%20";
13237|      0|          url.update_base_pathname(unicode::percent_encode(
13238|      0|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13239|      0|        } else {
13240|      0|          url.update_base_pathname(unicode::percent_encode(
13241|      0|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13242|      0|        }
13243|      0|        break;
13244|  11.8k|      }
13245|    546|      case state::PORT: {
  ------------------
  |  Branch (13245:7): [True: 546, False: 62.0k]
  ------------------
13246|    546|        ada_log("PORT ", helpers::substring(url_data, input_position));
13247|    546|        std::string_view port_view = url_data.substr(input_position);
13248|    546|        input_position += url.parse_port(port_view, true);
13249|    546|        if (!url.is_valid) {
  ------------------
  |  Branch (13249:13): [True: 482, False: 64]
  ------------------
13250|    482|          return url;
13251|    482|        }
13252|     64|        state = state::PATH_START;
13253|     64|        [[fallthrough]];
13254|     64|      }
13255|  1.12k|      case state::PATH_START: {
  ------------------
  |  Branch (13255:7): [True: 1.06k, False: 61.5k]
  ------------------
13256|  1.12k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
13257|       |        // Path, query, and fragment are structurally always valid: the
13258|       |        // parser would just percent-encode whatever is there. When we are
13259|       |        // not storing values (can_parse), we can return immediately since
13260|       |        // no subsequent state can invalidate the URL.
13261|       |        if constexpr (!store_values) {
13262|       |          return url;
13263|       |        }
13264|       |
13265|       |        // If url is special, then:
13266|  1.12k|        if (url.is_special()) {
  ------------------
  |  Branch (13266:13): [True: 1.12k, False: 0]
  ------------------
13267|       |          // Set state to path state.
13268|  1.12k|          state = state::PATH;
13269|       |
13270|       |          // Optimization: Avoiding going into PATH state improves the
13271|       |          // performance of urls ending with /.
13272|  1.12k|          if (input_position == input_size) {
  ------------------
  |  Branch (13272:15): [True: 67, False: 1.06k]
  ------------------
13273|     67|            if constexpr (store_values) {
13274|     67|              url.update_base_pathname("/");
13275|     67|              if (fragment.has_value()) {
  ------------------
  |  Branch (13275:19): [True: 67, False: 0]
  ------------------
13276|     67|                url.update_unencoded_base_hash(*fragment);
13277|     67|              }
13278|     67|            }
13279|     67|            enforce_max_input_length();
13280|     67|            return url;
13281|     67|          }
13282|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
13283|       |          // by 1. We know that (input_position == input_size) is impossible
13284|       |          // here, because of the previous if-check.
13285|  1.06k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (13285:15): [True: 86, False: 975]
  ------------------
13286|     86|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (13286:15): [True: 82, False: 4]
  ------------------
13287|     82|            break;
13288|     82|          }
13289|  1.06k|        }
13290|       |        // Otherwise, if state override is not given and c is U+003F (?),
13291|       |        // set url's query to the empty string and state to query state.
13292|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13292:18): [True: 0, False: 0]
  ------------------
13293|      0|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13293:18): [True: 0, False: 0]
  ------------------
13294|      0|          state = state::QUERY;
13295|      0|        }
13296|       |        // Otherwise, if c is not the EOF code point:
13297|      0|        else if (input_position != input_size) {
  ------------------
  |  Branch (13297:18): [True: 0, False: 0]
  ------------------
13298|       |          // Set state to path state.
13299|      0|          state = state::PATH;
13300|       |
13301|       |          // If c is not U+002F (/), then decrease pointer by 1.
13302|      0|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (13302:15): [True: 0, False: 0]
  ------------------
13303|      0|            break;
13304|      0|          }
13305|      0|        }
13306|       |
13307|    979|        input_position++;
13308|    979|        break;
13309|  1.12k|      }
13310|  1.06k|      case state::PATH: {
  ------------------
  |  Branch (13310:7): [True: 1.06k, False: 61.5k]
  ------------------
13311|  1.06k|        ada_log("PATH ", helpers::substring(url_data, input_position));
13312|       |        // Path, query, and fragment are structurally always valid: the
13313|       |        // parser would just percent-encode whatever is there. When we are
13314|       |        // not storing values (can_parse), we can return immediately since
13315|       |        // no subsequent state can invalidate the URL.
13316|       |        if constexpr (!store_values) {
13317|       |          return url;
13318|       |        }
13319|  1.06k|        std::string_view view = url_data.substr(input_position);
13320|       |
13321|       |        // Most time, we do not need percent encoding.
13322|       |        // Furthermore, we can immediately locate the '?'.
13323|  1.06k|        size_t locofquestionmark = view.find('?');
13324|  1.06k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (13324:13): [True: 404, False: 657]
  ------------------
13325|    404|          state = state::QUERY;
13326|    404|          view.remove_suffix(view.size() - locofquestionmark);
13327|    404|          input_position += locofquestionmark + 1;
13328|    657|        } else {
13329|    657|          input_position = input_size + 1;
13330|    657|        }
13331|  1.06k|        if constexpr (store_values) {
13332|       |          if constexpr (result_type_is_ada_url) {
13333|       |            helpers::parse_prepared_path(view, url.type, url.path);
13334|  1.06k|          } else {
13335|  1.06k|            url.consume_prepared_path(view);
13336|  1.06k|            ADA_ASSERT_TRUE(url.validate());
13337|  1.06k|          }
13338|  1.06k|        }
13339|  1.06k|        break;
13340|  1.12k|      }
13341|      0|      case state::FILE_SLASH: {
  ------------------
  |  Branch (13341:7): [True: 0, False: 62.5k]
  ------------------
13342|      0|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
13343|       |
13344|       |        // If c is U+002F (/) or U+005C (\), then:
13345|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13345:13): [True: 0, False: 0]
  ------------------
13346|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13346:14): [True: 0, False: 0]
  ------------------
13347|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13347:14): [True: 0, False: 0]
  ------------------
13348|      0|          ada_log("FILE_SLASH c is U+002F or U+005C");
13349|       |          // Set state to file host state.
13350|      0|          state = state::FILE_HOST;
13351|      0|          input_position++;
13352|      0|        } else {
13353|      0|          ada_log("FILE_SLASH otherwise");
13354|       |          // If base is non-null and base's scheme is "file", then:
13355|       |          // Note: it is unsafe to do base_url->scheme unless you know that
13356|       |          // base_url_has_value() is true.
13357|      0|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13357:15): [True: 0, False: 0]
  |  Branch (13357:38): [True: 0, False: 0]
  ------------------
13358|       |            // Set url's host to base's host.
13359|       |            if constexpr (result_type_is_ada_url) {
13360|       |              url.host = base_url->host;
13361|      0|            } else {
13362|      0|              url.update_host_to_base_host(base_url->get_host());
13363|      0|            }
13364|       |            // If the code point substring from pointer to the end of input does
13365|       |            // not start with a Windows drive letter and base's path[0] is a
13366|       |            // normalized Windows drive letter, then append base's path[0] to
13367|       |            // url's path.
13368|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (13368:17): [True: 0, False: 0]
  ------------------
13369|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (13369:19): [True: 0, False: 0]
  ------------------
13370|      0|                      url_data.substr(input_position))) {
13371|      0|                std::string_view first_base_url_path =
13372|      0|                    base_url->get_pathname().substr(1);
13373|      0|                size_t loc = first_base_url_path.find('/');
13374|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (13374:21): [True: 0, False: 0]
  ------------------
13375|      0|                  helpers::resize(first_base_url_path, loc);
13376|      0|                }
13377|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (13377:21): [True: 0, False: 0]
  ------------------
13378|      0|                        first_base_url_path)) {
13379|       |                  if constexpr (result_type_is_ada_url) {
13380|       |                    url.path += '/';
13381|       |                    url.path += first_base_url_path;
13382|      0|                  } else {
13383|      0|                    url.append_base_pathname(
13384|      0|                        helpers::concat("/", first_base_url_path));
13385|      0|                  }
13386|      0|                }
13387|      0|              }
13388|      0|            }
13389|      0|          }
13390|       |
13391|       |          // Set state to path state, and decrease pointer by 1.
13392|      0|          state = state::PATH;
13393|      0|        }
13394|       |
13395|      0|        break;
13396|  1.12k|      }
13397|      0|      case state::FILE_HOST: {
  ------------------
  |  Branch (13397:7): [True: 0, False: 62.5k]
  ------------------
13398|      0|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
13399|      0|        std::string_view view = url_data.substr(input_position);
13400|       |
13401|      0|        size_t location = view.find_first_of("/\\?");
13402|      0|        std::string_view file_host_buffer = view.substr(
13403|      0|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (13403:16): [True: 0, False: 0]
  ------------------
13404|       |
13405|      0|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (13405:13): [True: 0, False: 0]
  ------------------
13406|      0|          state = state::PATH;
13407|      0|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (13407:20): [True: 0, False: 0]
  ------------------
13408|       |          // Set url's host to the empty string.
13409|       |          if constexpr (result_type_is_ada_url) {
13410|       |            url.host = "";
13411|      0|          } else {
13412|      0|            url.update_base_hostname("");
13413|      0|          }
13414|       |          // Set state to path start state.
13415|      0|          state = state::PATH_START;
13416|      0|        } else {
13417|      0|          size_t consumed_bytes = file_host_buffer.size();
13418|      0|          input_position += consumed_bytes;
13419|       |          // Let host be the result of host parsing buffer with url is not
13420|       |          // special.
13421|      0|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (13421:15): [True: 0, False: 0]
  ------------------
13422|      0|            return url;
13423|      0|          }
13424|       |
13425|       |          if constexpr (result_type_is_ada_url) {
13426|       |            // If host is "localhost", then set host to the empty string.
13427|       |            if (url.host.has_value() && url.host.value() == "localhost") {
13428|       |              url.host = "";
13429|       |            }
13430|      0|          } else {
13431|      0|            if (url.get_hostname() == "localhost") {
  ------------------
  |  Branch (13431:17): [True: 0, False: 0]
  ------------------
13432|      0|              url.update_base_hostname("");
13433|      0|            }
13434|      0|          }
13435|       |
13436|       |          // Set buffer to the empty string and state to path start state.
13437|      0|          state = state::PATH_START;
13438|      0|        }
13439|       |
13440|      0|        break;
13441|      0|      }
13442|      0|      case state::FILE: {
  ------------------
  |  Branch (13442:7): [True: 0, False: 62.5k]
  ------------------
13443|      0|        ada_log("FILE ", helpers::substring(url_data, input_position));
13444|      0|        std::string_view file_view = url_data.substr(input_position);
13445|       |
13446|      0|        url.set_protocol_as_file();
13447|       |        if constexpr (result_type_is_ada_url) {
13448|       |          // Set url's host to the empty string.
13449|       |          url.host = "";
13450|      0|        } else {
13451|      0|          url.update_base_hostname("");
13452|      0|        }
13453|       |        // If c is U+002F (/) or U+005C (\), then:
13454|      0|        if (input_position != input_size &&
  ------------------
  |  Branch (13454:13): [True: 0, False: 0]
  ------------------
13455|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13455:14): [True: 0, False: 0]
  ------------------
13456|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13456:14): [True: 0, False: 0]
  ------------------
13457|      0|          ada_log("FILE c is U+002F or U+005C");
13458|       |          // Set state to file slash state.
13459|      0|          state = state::FILE_SLASH;
13460|      0|        }
13461|       |        // Otherwise, if base is non-null and base's scheme is "file":
13462|      0|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13462:18): [True: 0, False: 0]
  |  Branch (13462:41): [True: 0, False: 0]
  ------------------
13463|       |          // Set url's host to base's host, url's path to a clone of base's
13464|       |          // path, and url's query to base's query.
13465|      0|          ada_log("FILE base non-null");
13466|       |          if constexpr (result_type_is_ada_url) {
13467|       |            url.host = base_url->host;
13468|       |            url.path = base_url->path;
13469|       |            url.query = base_url->query;
13470|      0|          } else {
13471|      0|            url.update_host_to_base_host(base_url->get_hostname());
13472|      0|            url.update_base_pathname(base_url->get_pathname());
13473|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13473:17): [True: 0, False: 0]
  ------------------
13474|       |              // get_search() returns "" for an empty query string (URL ends
13475|       |              // with '?'). update_base_search("") would incorrectly clear the
13476|       |              // query, so pass "?" to preserve the empty query distinction.
13477|      0|              auto s = base_url->get_search();
13478|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13478:38): [True: 0, False: 0]
  ------------------
13479|      0|            }
13480|      0|          }
13481|      0|          url.has_opaque_path = base_url->has_opaque_path;
13482|       |
13483|       |          // If c is U+003F (?), then set url's query to the empty string and
13484|       |          // state to query state.
13485|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (13485:15): [True: 0, False: 0]
  |  Branch (13485:47): [True: 0, False: 0]
  ------------------
13486|      0|            state = state::QUERY;
13487|      0|          }
13488|       |          // Otherwise, if c is not the EOF code point:
13489|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13489:20): [True: 0, False: 0]
  ------------------
13490|       |            // Set url's query to null.
13491|      0|            url.clear_search();
13492|       |            // If the code point substring from pointer to the end of input does
13493|       |            // not start with a Windows drive letter, then shorten url's path.
13494|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (13494:17): [True: 0, False: 0]
  ------------------
13495|       |              if constexpr (result_type_is_ada_url) {
13496|       |                helpers::shorten_path(url.path, url.type);
13497|      0|              } else {
13498|      0|                std::string_view path = url.get_pathname();
13499|      0|                if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13499:21): [True: 0, False: 0]
  ------------------
13500|      0|                  url.update_base_pathname(std::move(std::string(path)));
13501|      0|                }
13502|      0|              }
13503|      0|            }
13504|       |            // Otherwise:
13505|      0|            else {
13506|       |              // Set url's path to an empty list.
13507|      0|              url.clear_pathname();
13508|      0|              url.has_opaque_path = true;
13509|      0|            }
13510|       |
13511|       |            // Set state to path state and decrease pointer by 1.
13512|      0|            state = state::PATH;
13513|      0|            break;
13514|      0|          }
13515|      0|        }
13516|       |        // Otherwise, set state to path state, and decrease pointer by 1.
13517|      0|        else {
13518|      0|          ada_log("FILE go to path");
13519|      0|          state = state::PATH;
13520|      0|          break;
13521|      0|        }
13522|       |
13523|      0|        input_position++;
13524|      0|        break;
13525|      0|      }
13526|      0|      default:
  ------------------
  |  Branch (13526:7): [True: 0, False: 62.5k]
  ------------------
13527|      0|        unreachable();
13528|  62.5k|    }
13529|  62.5k|  }
13530|  1.88k|  if constexpr (store_values) {
13531|  1.88k|    if (fragment.has_value()) {
  ------------------
  |  Branch (13531:9): [True: 15, False: 1.86k]
  ------------------
13532|     15|      url.update_unencoded_base_hash(*fragment);
13533|     15|    }
13534|  1.88k|  }
13535|  1.88k|  enforce_max_input_length();
13536|  1.88k|  return url;
13537|  13.1k|}
_ZNK3ada14url_aggregator12get_hostnameEv:
14505|  3.02k|    ada_lifetime_bound {
14506|  3.02k|  ada_log("url_aggregator::get_hostname");
14507|       |  // Technically, we should check if there is a hostname, but
14508|       |  // the code below works even if there isn't.
14509|       |  // if(!has_hostname()) { return ""; }
14510|  3.02k|  size_t start = components.host_start;
14511|       |  // So host_start is not where the host begins.
14512|  3.02k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (14512:7): [True: 303, False: 2.72k]
  ------------------
14513|    303|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (14513:7): [True: 18, False: 285]
  ------------------
14514|     18|    start++;
14515|     18|  }
14516|  3.02k|  return helpers::substring(buffer, start, components.host_end);
14517|  3.02k|}
_ZN3ada14url_aggregator10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
14650|  2.29k|bool url_aggregator::parse_ipv4(std::string_view input, bool in_place) {
14651|  2.29k|  ada_log("parse_ipv4 ", input, " [", input.size(),
14652|  2.29k|          " bytes], overlaps with buffer: ",
14653|  2.29k|          helpers::overlaps(input, buffer) ? "yes" : "no");
14654|  2.29k|  ADA_ASSERT_TRUE(validate());
14655|  2.29k|  if (input.empty()) {
  ------------------
  |  Branch (14655:7): [True: 0, False: 2.29k]
  ------------------
14656|      0|    return is_valid = false;
14657|      0|  }
14658|  2.29k|  const bool trailing_dot = (input.back() == '.');
14659|  2.29k|  if (trailing_dot) {
  ------------------
  |  Branch (14659:7): [True: 29, False: 2.26k]
  ------------------
14660|     29|    input.remove_suffix(1);
14661|     29|    if (input.empty()) {
  ------------------
  |  Branch (14661:9): [True: 0, False: 29]
  ------------------
14662|      0|      return is_valid = false;
14663|      0|    }
14664|     29|  }
14665|       |
14666|  2.29k|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
14667|  2.29k|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (14667:7): [True: 4, False: 2.29k]
  ------------------
14668|       |    // Pure decimal: keep the buffer when it already holds the address.
14669|       |    // Otherwise write the (trailing-dot-stripped) input.
14670|      4|    if (!(in_place && !trailing_dot)) {
  ------------------
  |  Branch (14670:11): [True: 3, False: 1]
  |  Branch (14670:23): [True: 2, False: 1]
  ------------------
14671|      2|      if (helpers::overlaps(input, buffer)) {
  ------------------
  |  Branch (14671:11): [True: 0, False: 2]
  ------------------
14672|      0|        update_base_hostname(std::string(input));
14673|      2|      } else {
14674|      2|        update_base_hostname(input);
14675|      2|      }
14676|      2|    }
14677|      4|    host_type = IPV4;
14678|      4|    ADA_ASSERT_TRUE(validate());
14679|      4|    return true;
14680|      4|  }
14681|       |
14682|  2.29k|  const char* p = input.data();
14683|  2.29k|  const char* end = p + input.size();
14684|  2.29k|  uint64_t ipv4 = 0;
14685|  2.29k|  int digit_count = 0;
14686|  2.29k|  int pure_decimal_count = 0;
14687|       |
14688|  2.52k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (14688:10): [True: 2.52k, False: 6]
  |  Branch (14688:29): [True: 2.52k, False: 0]
  ------------------
14689|  2.52k|    uint64_t segment = 0;
14690|  2.52k|    bool pure = false;
14691|  2.52k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (14691:9): [True: 1.60k, False: 921]
  ------------------
14692|  1.60k|      return is_valid = false;
14693|  1.60k|    }
14694|    921|    if (pure) {
  ------------------
  |  Branch (14694:9): [True: 693, False: 228]
  ------------------
14695|    693|      ++pure_decimal_count;
14696|    693|    }
14697|    921|    if (p >= end) {
  ------------------
  |  Branch (14697:9): [True: 657, False: 264]
  ------------------
14698|    657|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
14699|    657|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (14699:11): [True: 15, False: 642]
  ------------------
14700|     15|        return is_valid = false;
14701|     15|      }
14702|    642|      ipv4 = (ipv4 << shift) | segment;
14703|    642|      goto ipv4_done;
14704|    657|    }
14705|    264|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (14705:9): [True: 27, False: 237]
  |  Branch (14705:26): [True: 0, False: 237]
  ------------------
14706|     27|      return is_valid = false;
14707|     27|    }
14708|    237|    ipv4 = (ipv4 << 8) | segment;
14709|    237|    ++p;
14710|    237|  }
14711|      6|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (14711:7): [True: 0, False: 6]
  |  Branch (14711:27): [True: 6, False: 0]
  ------------------
14712|      6|    return is_valid = false;
14713|      6|  }
14714|    642|ipv4_done:
14715|    642|  ada_log("url_aggregator::parse_ipv4 completed ", get_href(),
14716|    642|          " host: ", get_host());
14717|    642|  if (in_place && pure_decimal_count == 4 && !trailing_dot) {
  ------------------
  |  Branch (14717:7): [True: 622, False: 20]
  |  Branch (14717:19): [True: 0, False: 622]
  |  Branch (14717:46): [True: 0, False: 0]
  ------------------
14718|      0|    ada_log(
14719|      0|        "url_aggregator::parse_ipv4 completed and was already correct in the "
14720|      0|        "buffer");
14721|    642|  } else {
14722|    642|    update_base_hostname(ada::serializers::ipv4(ipv4));
14723|    642|  }
14724|    642|  host_type = IPV4;
14725|    642|  ADA_ASSERT_TRUE(validate());
14726|    642|  return true;
14727|      6|}
_ZN3ada14url_aggregator10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14729|  7.09k|bool url_aggregator::parse_ipv6(std::string_view input) {
14730|  7.09k|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
14731|  7.09k|  ADA_ASSERT_TRUE(validate());
14732|  7.09k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14733|  7.09k|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (14733:7): [True: 6, False: 7.09k]
  |  Branch (14733:24): [True: 2, False: 7.08k]
  ------------------
14734|      8|    return is_valid = false;
14735|      8|  }
14736|  7.08k|  std::array<uint16_t, 8> address{};
14737|       |#if defined(ADA_AVX512_IPV6)
14738|       |  if (bool simd_valid; detail::try_parse_ipv6_avx512(input.data(), input.size(),
14739|       |                                                     address, simd_valid)) {
14740|       |    if (!simd_valid) [[unlikely]] {
14741|       |      return is_valid = false;
14742|       |    }
14743|       |    const std::string serialized = ada::serializers::ipv6(address);
14744|       |    if (get_hostname() != serialized) {
14745|       |      update_base_hostname(serialized);
14746|       |    }
14747|       |    host_type = IPV6;
14748|       |    return true;
14749|       |  }
14750|       |  address = {};
14751|       |#endif
14752|  7.08k|  const char* pointer = input.data();
14753|  7.08k|  const char* const end = pointer + input.size();
14754|  7.08k|  int piece_index = 0;
14755|  7.08k|  int compress = -1;
14756|       |
14757|  7.08k|  if (*pointer == ':') {
  ------------------
  |  Branch (14757:7): [True: 15, False: 7.07k]
  ------------------
14758|     15|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (14758:9): [True: 1, False: 14]
  |  Branch (14758:30): [True: 1, False: 13]
  ------------------
14759|      2|      return is_valid = false;
14760|      2|    }
14761|     13|    pointer += 2;
14762|     13|    compress = ++piece_index;
14763|     13|  }
14764|       |
14765|  7.27k|  while (pointer != end) {
  ------------------
  |  Branch (14765:10): [True: 7.23k, False: 40]
  ------------------
14766|  7.23k|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (14766:9): [True: 2, False: 7.23k]
  ------------------
14767|      2|      return is_valid = false;
14768|      2|    }
14769|  7.23k|    if (*pointer == ':') {
  ------------------
  |  Branch (14769:9): [True: 14, False: 7.21k]
  ------------------
14770|     14|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (14770:11): [True: 2, False: 12]
  ------------------
14771|      2|        return is_valid = false;
14772|      2|      }
14773|     12|      ++pointer;
14774|     12|      compress = ++piece_index;
14775|     12|      continue;
14776|     14|    }
14777|       |
14778|  7.21k|    uint16_t value = 0;
14779|  7.21k|    const int length = detail::parse_hex_piece(pointer, end, value);
14780|       |
14781|  7.21k|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (14781:9): [True: 7.18k, False: 31]
  |  Branch (14781:27): [True: 52, False: 7.13k]
  ------------------
14782|     52|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (14782:11): [True: 1, False: 51]
  ------------------
14783|      1|        return is_valid = false;
14784|      1|      }
14785|     51|      pointer -= length;
14786|     51|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (14786:11): [True: 1, False: 50]
  ------------------
14787|      1|        return is_valid = false;
14788|      1|      }
14789|       |
14790|     50|      int numbers_seen = 0;
14791|    131|      while (pointer != end) {
  ------------------
  |  Branch (14791:14): [True: 123, False: 8]
  ------------------
14792|    123|        int ipv4_piece = -1;
14793|    123|        if (numbers_seen > 0) {
  ------------------
  |  Branch (14793:13): [True: 73, False: 50]
  ------------------
14794|     73|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (14794:15): [True: 55, False: 18]
  |  Branch (14794:34): [True: 54, False: 1]
  ------------------
14795|     54|            ++pointer;
14796|     54|          } else {
14797|     19|            return is_valid = false;
14798|     19|          }
14799|     73|        }
14800|    104|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (14800:13): [True: 9, False: 95]
  |  Branch (14800:31): [True: 5, False: 90]
  |  Branch (14800:49): [True: 3, False: 87]
  ------------------
14801|     17|          return is_valid = false;
14802|     17|        }
14803|     87|        ipv4_piece = *pointer - '0';
14804|     87|        ++pointer;
14805|     87|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (14805:13): [True: 83, False: 4]
  |  Branch (14805:31): [True: 38, False: 45]
  |  Branch (14805:50): [True: 36, False: 2]
  ------------------
14806|     36|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (14806:15): [True: 1, False: 35]
  ------------------
14807|      1|            return is_valid = false;
14808|      1|          }
14809|     35|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
14810|     35|          ++pointer;
14811|     35|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (14811:15): [True: 34, False: 1]
  |  Branch (14811:33): [True: 21, False: 13]
  |  Branch (14811:52): [True: 18, False: 3]
  ------------------
14812|     18|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
14813|     18|            ++pointer;
14814|     18|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (14814:17): [True: 5, False: 13]
  ------------------
14815|      5|              return is_valid = false;
14816|      5|            }
14817|     18|          }
14818|     35|        }
14819|     81|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
14820|     81|            address[static_cast<size_t>(piece_index)] * 0x100 +
14821|     81|            static_cast<uint16_t>(ipv4_piece));
14822|     81|        ++numbers_seen;
14823|     81|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (14823:13): [True: 24, False: 57]
  |  Branch (14823:34): [True: 6, False: 51]
  ------------------
14824|     30|          ++piece_index;
14825|     30|        }
14826|     81|      }
14827|      8|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (14827:11): [True: 5, False: 3]
  ------------------
14828|      5|        return is_valid = false;
14829|      5|      }
14830|      3|      break;
14831|      8|    }
14832|       |
14833|  7.16k|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (14833:9): [True: 6.97k, False: 187]
  ------------------
14834|  6.97k|      return is_valid = false;
14835|  6.97k|    }
14836|       |
14837|    187|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (14837:9): [True: 156, False: 31]
  |  Branch (14837:27): [True: 152, False: 4]
  ------------------
14838|    152|      ++pointer;
14839|    152|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (14839:11): [True: 7, False: 145]
  ------------------
14840|      7|        return is_valid = false;
14841|      7|      }
14842|    152|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (14842:16): [True: 4, False: 31]
  ------------------
14843|      4|      return is_valid = false;
14844|      4|    }
14845|       |
14846|    176|    address[static_cast<size_t>(piece_index)] = value;
14847|    176|    ++piece_index;
14848|    176|  }
14849|       |
14850|     43|  if (compress != -1) {
  ------------------
  |  Branch (14850:7): [True: 19, False: 24]
  ------------------
14851|     19|    const int right = piece_index - compress;
14852|     19|    if (right > 0) {
  ------------------
  |  Branch (14852:9): [True: 10, False: 9]
  ------------------
14853|     10|      const size_t dest = static_cast<size_t>(8 - right);
14854|     10|      const size_t src = static_cast<size_t>(compress);
14855|     10|      if (dest != src) {
  ------------------
  |  Branch (14855:11): [True: 8, False: 2]
  ------------------
14856|     29|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (14856:53): [True: 21, False: 8]
  ------------------
14857|     21|          address[dest + i] = address[src + i];
14858|     21|          address[src + i] = 0;
14859|     21|        }
14860|      8|      }
14861|     10|    }
14862|     24|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (14862:14): [True: 22, False: 2]
  ------------------
14863|     22|    return is_valid = false;
14864|     22|  }
14865|       |
14866|       |  // Serialize once; skip rewrite when hostname is already canonical.
14867|     21|  const std::string serialized = ada::serializers::ipv6(address);
14868|     21|  const std::string_view current = get_hostname();
14869|     21|  if (current.size() == serialized.size() &&
  ------------------
  |  Branch (14869:7): [True: 0, False: 21]
  ------------------
14870|      0|      std::memcmp(current.data(), serialized.data(), serialized.size()) == 0) {
  ------------------
  |  Branch (14870:7): [True: 0, False: 0]
  ------------------
14871|      0|    ada_log("parse_ipv6 in-place canonical match");
14872|     21|  } else {
14873|     21|    update_base_hostname(serialized);
14874|     21|  }
14875|     21|  ada_log("parse_ipv6 ", get_hostname());
14876|     21|  ADA_ASSERT_TRUE(validate());
14877|     21|  host_type = IPV6;
14878|     21|  return true;
14879|     43|}
serializers.cc:_ZZN3ada4idna22utf32_length_from_utf8EPKcmENK3$_0clEa:
  272|  55.4k|  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|  55.4k|    return c > -65;
  276|  55.4k|  });
_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|    516|  auto broadcast = [](uint8_t v) -> uint64_t {
 5128|    516|    return 0x101010101010101ull * v;
 5129|    516|  };
_ZN3ada4idna13ensure_tablesEv:
 4878|  7.75k|[[nodiscard]] inline bool ensure_tables() noexcept {
 4879|  7.75k|  uint8_t state = tables_init_state.load(std::memory_order_acquire);
 4880|  7.75k|  if (state == kTablesReady) {
  ------------------
  |  Branch (4880:7): [True: 7.75k, False: 1]
  ------------------
 4881|  7.75k|    return true;
 4882|  7.75k|  }
 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|  92.1k|static uint16_t idna_lookup(uint32_t cp) noexcept {
 5066|  92.1k|  if (cp < IDNA_LOW_RANGE_END) {
  ------------------
  |  Branch (5066:7): [True: 91.7k, False: 359]
  ------------------
 5067|  91.7k|    uint16_t ref = idna_stage1[cp >> IDNA_BLOCK_BITS];
 5068|  91.7k|    if (ref & IDNA_BOOL_FLAG) {
  ------------------
  |  Branch (5068:9): [True: 45.2k, False: 46.5k]
  ------------------
 5069|  45.2k|      uint32_t bit_idx =
 5070|  45.2k|          static_cast<uint32_t>(ref & ~IDNA_BOOL_FLAG) * IDNA_BLOCK_SIZE +
 5071|  45.2k|          (cp & IDNA_BLOCK_MASK);
 5072|  45.2k|      bool is_valid = (idna_bool_blocks[bit_idx >> 6] >> (bit_idx & 63u)) & 1u;
 5073|  45.2k|      return is_valid ? IDNA_VALID : IDNA_DISALLOWED;
  ------------------
  |  Branch (5073:14): [True: 45.2k, False: 10]
  ------------------
 5074|  45.2k|    }
 5075|  46.5k|    return idna_stage2[ref + (cp & IDNA_BLOCK_MASK)];
 5076|  91.7k|  }
 5077|       |
 5078|    359|  if (cp >= IDNA_HIGH_IGNORED_START && cp < IDNA_HIGH_IGNORED_END) {
  ------------------
  |  Branch (5078:7): [True: 329, False: 30]
  |  Branch (5078:40): [True: 194, False: 135]
  ------------------
 5079|    194|    return IDNA_IGNORED;
 5080|    194|  }
 5081|       |
 5082|    165|  return IDNA_DISALLOWED;
 5083|    359|}
serializers.cc:_ZN3ada4idnaL21utf8_count_codepointsEPKh:
 5108|  7.91k|static size_t utf8_count_codepoints(const uint8_t* ptr) noexcept {
 5109|  7.91k|  size_t n = 0;
 5110|  42.6k|  while (*ptr != 0) {
  ------------------
  |  Branch (5110:10): [True: 34.6k, False: 7.91k]
  ------------------
 5111|  34.6k|    ++n;
 5112|  34.6k|    if (*ptr < 0x80u) {
  ------------------
  |  Branch (5112:9): [True: 9.37k, False: 25.3k]
  ------------------
 5113|  9.37k|      ++ptr;
 5114|  25.3k|    } else if (*ptr < 0xE0u) {
  ------------------
  |  Branch (5114:16): [True: 20.8k, False: 4.51k]
  ------------------
 5115|  20.8k|      ptr += 2;
 5116|  20.8k|    } else if (*ptr < 0xF0u) {
  ------------------
  |  Branch (5116:16): [True: 3.93k, False: 580]
  ------------------
 5117|  3.93k|      ptr += 3;
 5118|  3.93k|    } else {
 5119|    580|      ptr += 4;
 5120|    580|    }
 5121|  34.6k|  }
 5122|  7.91k|  return n;
 5123|  7.91k|}
serializers.cc:_ZN3ada4idnaL9utf8_nextERPKh:
 5086|  34.6k|static char32_t utf8_next(const uint8_t*& ptr) noexcept {
 5087|  34.6k|  uint8_t b0 = *ptr++;
 5088|  34.6k|  if (b0 < 0x80u) return static_cast<char32_t>(b0);
  ------------------
  |  Branch (5088:7): [True: 9.37k, False: 25.3k]
  ------------------
 5089|  25.3k|  if (b0 < 0xE0u) {
  ------------------
  |  Branch (5089:7): [True: 20.8k, False: 4.51k]
  ------------------
 5090|  20.8k|    uint32_t cp = (b0 & 0x1Fu) << 6;
 5091|  20.8k|    cp |= (*ptr++ & 0x3Fu);
 5092|  20.8k|    return static_cast<char32_t>(cp);
 5093|  20.8k|  }
 5094|  4.51k|  if (b0 < 0xF0u) {
  ------------------
  |  Branch (5094:7): [True: 3.93k, False: 580]
  ------------------
 5095|  3.93k|    uint32_t cp = (b0 & 0x0Fu) << 12;
 5096|  3.93k|    cp |= ((*ptr++ & 0x3Fu) << 6);
 5097|  3.93k|    cp |= (*ptr++ & 0x3Fu);
 5098|  3.93k|    return static_cast<char32_t>(cp);
 5099|  3.93k|  }
 5100|    580|  uint32_t cp = (b0 & 0x07u) << 18;
 5101|    580|  cp |= ((*ptr++ & 0x3Fu) << 12);
 5102|    580|  cp |= ((*ptr++ & 0x3Fu) << 6);
 5103|    580|  cp |= (*ptr++ & 0x3Fu);
 5104|    580|  return static_cast<char32_t>(cp);
 5105|  4.51k|}
_ZN3ada4idna23decomposition_block_rowEh:
 4982|   168k|inline const uint16_t* decomposition_block_row(uint8_t bi) noexcept {
 4983|   168k|  if (bi >= kDecompBlockRows) {
  ------------------
  |  Branch (4983:7): [True: 0, False: 168k]
  ------------------
 4984|      0|    bi = 0;
 4985|      0|  }
 4986|   168k|  return decomposition_block_flat + static_cast<size_t>(bi) * kDecompBlockCols;
 4987|   168k|}
_ZN3ada4idna13ccc_block_rowEh:
 4989|   220k|inline const uint8_t* ccc_block_row(uint8_t bi) noexcept {
 4990|   220k|  if (bi >= kCccBlockRows) {
  ------------------
  |  Branch (4990:7): [True: 0, False: 220k]
  ------------------
 4991|      0|    bi = 0;
 4992|      0|  }
 4993|   220k|  return ccc_block_flat + static_cast<size_t>(bi) * kCccBlockCols;
 4994|   220k|}
_ZN3ada4idna16tables_are_readyEv:
 4873|  3.66k|[[nodiscard]] inline bool tables_are_ready() noexcept {
 4874|  3.66k|  return tables_init_state.load(std::memory_order_acquire) == kTablesReady;
 4875|  3.66k|}
serializers.cc:_ZN3ada4idnaL23canonical_decomp_lengthEDi:
 5265|   143k|static size_t canonical_decomp_length(char32_t current_character) noexcept {
 5266|   143k|  if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5266:7): [True: 5.60k, False: 137k]
  ------------------
 5267|  5.60k|      current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5267:7): [True: 2.40k, False: 3.19k]
  ------------------
 5268|       |    // Hangul precomposed syllables are NFC.
 5269|  2.40k|    return 0;
 5270|  2.40k|  }
 5271|   141k|  if (current_character >= 0x110000) {
  ------------------
  |  Branch (5271:7): [True: 0, False: 141k]
  ------------------
 5272|      0|    return 0;
 5273|      0|  }
 5274|   141k|  const uint8_t di = decomposition_index[current_character >> 8];
 5275|   141k|  const uint16_t* const decomposition =
 5276|   141k|      decomposition_block_row(di) + (current_character % 256);
 5277|   141k|  size_t decomposition_length =
 5278|   141k|      (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5279|   141k|  if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5279:7): [True: 5.87k, False: 135k]
  |  Branch (5279:37): [True: 0, False: 5.87k]
  ------------------
 5280|      0|    decomposition_length = 0;  // compatibility-only: ignored for NFC
 5281|      0|  }
 5282|   141k|  return decomposition_length;
 5283|   141k|}
serializers.cc:_ZN3ada4idnaL12trailing_cccEDi:
 5466|  66.6k|static uint8_t trailing_ccc(char32_t c) noexcept {
 5467|  66.6k|  const size_t length = canonical_decomp_length(c);
 5468|  66.6k|  if (length == 0) {
  ------------------
  |  Branch (5468:7): [True: 63.8k, False: 2.75k]
  ------------------
 5469|  63.8k|    return get_ccc(c);
 5470|  63.8k|  }
 5471|  2.75k|  const uint16_t* const decomposition =
 5472|  2.75k|      decomposition_block_row(decomposition_index[c >> 8]) + (c % 256);
 5473|  2.75k|  const size_t base = decomposition[0] >> 2;
 5474|  2.75k|  return get_ccc(decomposition_data[base + length - 1]);
 5475|  66.6k|}
serializers.cc:_ZN3ada4idnaL13would_composeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5397|  2.52k|static bool would_compose(std::u32string_view input) noexcept {
 5398|  51.9k|  for (size_t input_count = 0; input_count < input.size();) {
  ------------------
  |  Branch (5398:32): [True: 50.0k, False: 1.95k]
  ------------------
 5399|  50.0k|    const char32_t current = input[input_count];
 5400|  50.0k|    if (current >= hangul_lbase && current < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5400:9): [True: 6.59k, False: 43.4k]
  |  Branch (5400:36): [True: 740, False: 5.85k]
  ------------------
 5401|    740|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5401:11): [True: 718, False: 22]
  ------------------
 5402|    718|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5402:11): [True: 357, False: 361]
  ------------------
 5403|    357|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5403:11): [True: 154, False: 203]
  ------------------
 5404|    154|        return true;
 5405|    154|      }
 5406|    586|      ++input_count;
 5407|    586|      continue;
 5408|    740|    }
 5409|  49.3k|    if (current >= hangul_sbase && current < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5409:9): [True: 1.58k, False: 47.7k]
  |  Branch (5409:36): [True: 924, False: 659]
  ------------------
 5410|    924|      if ((current - hangul_sbase) % hangul_tcount &&
  ------------------
  |  Branch (5410:11): [True: 601, False: 323]
  ------------------
 5411|    601|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5411:11): [True: 568, False: 33]
  ------------------
 5412|    568|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5412:11): [True: 371, False: 197]
  ------------------
 5413|    371|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5413:11): [True: 92, False: 279]
  ------------------
 5414|     92|        return true;
 5415|     92|      }
 5416|    832|      ++input_count;
 5417|    832|      continue;
 5418|    924|    }
 5419|  48.3k|    if (current < 0x110000) {
  ------------------
  |  Branch (5419:9): [True: 48.3k, False: 0]
  ------------------
 5420|  48.3k|      const uint16_t* composition =
 5421|  48.3k|          composition_block_row(composition_index[current >> 8]) +
 5422|  48.3k|          (current % 256);
 5423|  48.3k|      int32_t previous_ccc = -1;
 5424|  48.3k|      size_t j = input_count;
 5425|  49.9k|      for (; j + 1 < input.size(); ++j) {
  ------------------
  |  Branch (5425:14): [True: 48.0k, False: 1.89k]
  ------------------
 5426|  48.0k|        uint8_t ccc = get_ccc(input[j + 1]);
 5427|  48.0k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5427:13): [True: 13.7k, False: 34.2k]
  |  Branch (5427:49): [True: 13.4k, False: 374]
  ------------------
 5428|  13.4k|          int left = composition[0];
 5429|  13.4k|          int right = composition[1];
 5430|  13.4k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5430:15): [True: 0, False: 13.4k]
  |  Branch (5430:27): [True: 0, False: 13.4k]
  ------------------
 5431|  13.4k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5431:15): [True: 0, False: 13.4k]
  ------------------
 5432|      0|            break;
 5433|      0|          }
 5434|  38.9k|          while (left + 2 < right) {
  ------------------
  |  Branch (5434:18): [True: 25.4k, False: 13.4k]
  ------------------
 5435|  25.4k|            int middle = left + (((right - left) >> 1) & ~1);
 5436|  25.4k|            if (composition_data[static_cast<size_t>(middle)] <= input[j + 1]) {
  ------------------
  |  Branch (5436:17): [True: 1.70k, False: 23.7k]
  ------------------
 5437|  1.70k|              left = middle;
 5438|  1.70k|            }
 5439|  25.4k|            if (composition_data[static_cast<size_t>(middle)] >= input[j + 1]) {
  ------------------
  |  Branch (5439:17): [True: 24.0k, False: 1.44k]
  ------------------
 5440|  24.0k|              right = middle;
 5441|  24.0k|            }
 5442|  25.4k|          }
 5443|  13.4k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5443:15): [True: 13.4k, False: 0]
  ------------------
 5444|  13.4k|              composition_data[static_cast<size_t>(left)] == input[j + 1]) {
  ------------------
  |  Branch (5444:15): [True: 324, False: 13.0k]
  ------------------
 5445|    324|            return true;
 5446|    324|          }
 5447|  13.4k|        }
 5448|  47.7k|        if (ccc == 0) {
  ------------------
  |  Branch (5448:13): [True: 46.1k, False: 1.58k]
  ------------------
 5449|  46.1k|          break;
 5450|  46.1k|        }
 5451|  1.58k|        previous_ccc = ccc;
 5452|  1.58k|      }
 5453|  48.0k|      input_count = j + 1;
 5454|  48.0k|      continue;
 5455|  48.3k|    }
 5456|      0|    ++input_count;
 5457|      0|  }
 5458|  1.95k|  return false;
 5459|  2.52k|}
_ZN3ada4idna21composition_block_rowEh:
 4996|  63.4k|inline const uint16_t* composition_block_row(uint8_t bi) noexcept {
 4997|  63.4k|  if (bi >= kCompBlockRows) {
  ------------------
  |  Branch (4997:7): [True: 0, False: 63.4k]
  ------------------
 4998|      0|    bi = 0;
 4999|      0|  }
 5000|  63.4k|  return composition_block_flat + static_cast<size_t>(bi) * kCompBlockCols;
 5001|  63.4k|}
serializers.cc:_ZN3ada4idnaL19char_to_digit_valueEc:
 5643|  11.6k|static constexpr int32_t char_to_digit_value(char value) {
 5644|  11.6k|  if (value >= 'a' && value <= 'z') return value - 'a';
  ------------------
  |  Branch (5644:7): [True: 8.91k, False: 2.75k]
  |  Branch (5644:23): [True: 8.91k, False: 1]
  ------------------
 5645|  2.75k|  if (value >= '0' && value <= '9') return value - '0' + 26;
  ------------------
  |  Branch (5645:7): [True: 2.72k, False: 29]
  |  Branch (5645:23): [True: 2.72k, False: 6]
  ------------------
 5646|     35|  return -1;
 5647|  2.75k|}
serializers.cc:_ZN3ada4idnaL5adaptEiib:
 5653|  19.7k|static constexpr int32_t adapt(int32_t d, int32_t n, bool firsttime) {
 5654|  19.7k|  if (firsttime) {
  ------------------
  |  Branch (5654:7): [True: 3.27k, False: 16.4k]
  ------------------
 5655|  3.27k|    d = d / damp;
 5656|  16.4k|  } else {
 5657|  16.4k|    d = d / 2;
 5658|  16.4k|  }
 5659|  19.7k|  d += d / n;
 5660|  19.7k|  int32_t k = 0;
 5661|  22.8k|  while (d > ((base - tmin) * tmax) / 2) {
  ------------------
  |  Branch (5661:10): [True: 3.14k, False: 19.7k]
  ------------------
 5662|  3.14k|    d /= base - tmin;
 5663|  3.14k|    k += base;
 5664|  3.14k|  }
 5665|  19.7k|  return k + (((base - tmin + 1) * d) / (d + skew));
 5666|  19.7k|}
serializers.cc:_ZN3ada4idnaL13digit_to_charEi:
 5649|  22.7k|static constexpr char digit_to_char(int32_t digit) {
 5650|  22.7k|  return digit < 26 ? char(digit + 97) : char(digit + 22);
  ------------------
  |  Branch (5650:10): [True: 17.4k, False: 5.28k]
  ------------------
 5651|  22.7k|}
serializers.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_0clIA2_jEEDaRKT_:
 5988|  29.7k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
serializers.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_1clEj:
 6073|    735|      auto is_l_or_d = [](uint32_t code) {
 6074|    735|        return std::ranges::binary_search(L, code) ||
  ------------------
  |  Branch (6074:16): [True: 30, False: 705]
  ------------------
 6075|    705|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6075:16): [True: 218, False: 487]
  ------------------
 6076|    735|      };
serializers.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_2clEj:
 6077|  1.07k|      auto is_r_or_d = [](uint32_t code) {
 6078|  1.07k|        return std::ranges::binary_search(R, code) ||
  ------------------
  |  Branch (6078:16): [True: 109, False: 969]
  ------------------
 6079|    969|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6079:16): [True: 60, False: 909]
  ------------------
 6080|  1.07k|      };
serializers.cc:_ZN3ada4idnaL20find_last_not_of_nsmENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5935|  2.94k|    const std::u32string_view label) noexcept {
 5936|  4.01k|  for (int i = static_cast<int>(label.size() - 1); i >= 0; i--)
  ------------------
  |  Branch (5936:52): [True: 4.01k, False: 0]
  ------------------
 5937|  4.01k|    if (find_direction(label[i]) != direction::NSM) return i;
  ------------------
  |  Branch (5937:9): [True: 2.94k, False: 1.06k]
  ------------------
 5938|       |
 5939|      0|  return std::u32string_view::npos;
 5940|  2.94k|}
serializers.cc:_ZN3ada4idnaL12is_rtl_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5944|  2.94k|inline static bool is_rtl_label(const std::u32string_view label) noexcept {
 5945|  2.94k|  const size_t mask =
 5946|  2.94k|      (1u << direction::R) | (1u << direction::AL) | (1u << direction::AN);
 5947|       |
 5948|  2.94k|  size_t directions = 0;
 5949|  28.2k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (5949:22): [True: 25.2k, False: 2.94k]
  ------------------
 5950|  25.2k|    directions |= 1u << find_direction(label[i]);
 5951|  25.2k|  }
 5952|  2.94k|  return (directions & mask) != 0;
 5953|  2.94k|}
serializers.cc:_ZN3ada4idnaL14find_directionEj:
 5916|  35.3k|inline static direction find_direction(uint32_t code_point) noexcept {
 5917|       |  // Binary search on dir_final (sorted upper bounds).
 5918|  35.3k|  size_t lo = 0, hi = dir_table_count;
 5919|   411k|  while (lo < hi) {
  ------------------
  |  Branch (5919:10): [True: 376k, False: 35.3k]
  ------------------
 5920|   376k|    size_t mid = lo + (hi - lo) / 2;
 5921|   376k|    if (dir_final[mid] < code_point) {
  ------------------
  |  Branch (5921:9): [True: 137k, False: 238k]
  ------------------
 5922|   137k|      lo = mid + 1;
 5923|   238k|    } else {
 5924|   238k|      hi = mid;
 5925|   238k|    }
 5926|   376k|  }
 5927|  35.3k|  if (lo == dir_table_count) {
  ------------------
  |  Branch (5927:7): [True: 0, False: 35.3k]
  ------------------
 5928|      0|    return direction::NONE;
 5929|      0|  }
 5930|  35.3k|  return code_point >= dir_start[lo] ? static_cast<direction>(dir_value[lo])
  ------------------
  |  Branch (5930:10): [True: 35.0k, False: 347]
  ------------------
 5931|  35.3k|                                     : direction::NONE;
 5932|  35.3k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6301|  2.71k|bool constexpr is_ascii(std::string_view view) {
 6302|  24.5k|  for (uint8_t c : view) {
  ------------------
  |  Branch (6302:18): [True: 24.5k, False: 172]
  ------------------
 6303|  24.5k|    if (c >= 0x80) {
  ------------------
  |  Branch (6303:9): [True: 2.54k, False: 22.0k]
  ------------------
 6304|  2.54k|      return false;
 6305|  2.54k|    }
 6306|  24.5k|  }
 6307|    172|  return true;
 6308|  2.71k|}
serializers.cc:_ZN3ada4idnaL19from_ascii_to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6338|    172|static void from_ascii_to_ascii(std::string_view ut8_string, std::string& out) {
 6339|    172|  out.assign(ut8_string);
 6340|    172|  ascii_map(out.data(), out.size());
 6341|    172|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6292|  8.49k|bool constexpr is_ascii(std::u32string_view view) {
 6293|  36.5k|  for (uint32_t c : view) {
  ------------------
  |  Branch (6293:19): [True: 36.5k, False: 1.92k]
  ------------------
 6294|  36.5k|    if (c >= 0x80) {
  ------------------
  |  Branch (6294:9): [True: 6.56k, False: 29.9k]
  ------------------
 6295|  6.56k|      return false;
 6296|  6.56k|    }
 6297|  36.5k|  }
 6298|  1.92k|  return true;
 6299|  8.49k|}
serializers.cc:_ZN3ada4idnaL13is_ace_prefixENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6354|  5.43k|static bool is_ace_prefix(std::u32string_view label) noexcept {
 6355|  5.43k|  return label.size() >= 4 && label[0] == U'x' && label[1] == U'n' &&
  ------------------
  |  Branch (6355:10): [True: 2.20k, False: 3.22k]
  |  Branch (6355:31): [True: 1.38k, False: 826]
  |  Branch (6355:51): [True: 1.30k, False: 78]
  ------------------
 6356|  1.30k|         label[2] == U'-' && label[3] == U'-';
  ------------------
  |  Branch (6356:10): [True: 1.25k, False: 48]
  |  Branch (6356:30): [True: 1.22k, False: 36]
  ------------------
 6357|  5.43k|}
serializers.cc:_ZN3ada4idnaL18append_ascii_labelERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_17basic_string_viewIDiNS3_IDiEEEE:
 6344|  2.70k|static void append_ascii_label(std::string& out, std::u32string_view label) {
 6345|  2.70k|  const size_t old = out.size();
 6346|  2.70k|  out.resize(old + label.size());
 6347|  2.70k|  char* dest = out.data() + old;
 6348|  23.0k|  for (char32_t c : label) {
  ------------------
  |  Branch (6348:19): [True: 23.0k, False: 2.70k]
  ------------------
 6349|  23.0k|    *dest++ = static_cast<char>(c);
 6350|  23.0k|  }
 6351|  2.70k|}
_ZZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7352|  31.0k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7353|  31.0k|    return character_sets::bit_at(character_set, c);
 7354|  31.0k|  });
_ZZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7352|  32.2k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7353|  32.2k|    return character_sets::bit_at(character_set, c);
 7354|  32.2k|  });
_ZN3ada7unicode18is_ascii_hex_digitEc:
 7086|  12.0k|ada_really_inline constexpr bool is_ascii_hex_digit(const char c) noexcept {
 7087|  12.0k|  return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') ||
  ------------------
  |  Branch (7087:11): [True: 10.9k, False: 1.11k]
  |  Branch (7087:23): [True: 5.53k, False: 5.42k]
  |  Branch (7087:37): [True: 5.40k, False: 1.13k]
  |  Branch (7087:49): [True: 4.05k, False: 1.35k]
  ------------------
 7088|  2.48k|         (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7088:11): [True: 1.29k, False: 1.18k]
  |  Branch (7088:23): [True: 1.15k, False: 138]
  ------------------
 7089|  12.0k|}
_ZN3ada7unicode21convert_hex_to_binaryEc:
 7176|  10.2k|unsigned constexpr convert_hex_to_binary(const char c) noexcept {
 7177|  10.2k|  return hex_to_binary_table[c - '0'];
 7178|  10.2k|}
serializers.cc:_ZZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhENK3$_0clEc:
 7320|  31.7k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7321|  31.7k|    return character_sets::bit_at(character_set, c);
 7322|  31.7k|  });
_ZN3ada7unicode36contains_forbidden_domain_code_pointEPKcm:
 7013|  8.44k|    const char* input, size_t length) noexcept {
 7014|  8.44k|  size_t i = 0;
 7015|  8.44k|  uint8_t accumulator{};
 7016|  51.6k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7016:10): [True: 43.2k, False: 8.44k]
  ------------------
 7017|  43.2k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7018|  43.2k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 1])];
 7019|  43.2k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 2])];
 7020|  43.2k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 3])];
 7021|  43.2k|  }
 7022|  19.5k|  for (; i < length; i++) {
  ------------------
  |  Branch (7022:10): [True: 11.1k, False: 8.44k]
  ------------------
 7023|  11.1k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7024|  11.1k|  }
 7025|  8.44k|  return accumulator;
 7026|  8.44k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_122percent_encode_to_wideEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7702|  1.28k|                            const uint8_t character_set[], std::string& out) {
 7703|       |  // Worst case every byte becomes %XX. Avoids realloc while walking windows.
 7704|  1.28k|  out.reserve(out.size() + static_cast<size_t>(end - p) * 3);
 7705|  1.28k|#if ADA_UNICODE_SSSE3
 7706|  1.28k|  const ssse3_percent_tables tables = load_ssse3_percent_tables(character_set);
 7707|  1.28k|  percent_encode_to_ssse3(p, end, character_set, tables, out);
 7708|       |#elif ADA_NEON
 7709|       |  percent_encode_to_neon(p, end, character_set,
 7710|       |                         load_neon_percent_table(character_set), out);
 7711|       |#elif ADA_RVV
 7712|       |  percent_encode_to_rvv(p, end, character_set, out);
 7713|       |#endif
 7714|  1.28k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_125load_ssse3_percent_tablesEPKh:
 7529|  1.28k|load_ssse3_percent_tables(const uint8_t character_set[]) noexcept {
 7530|  1.28k|  ssse3_percent_tables t{};
 7531|  1.28k|  t.cs_lo = _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set));
 7532|  1.28k|  t.cs_hi =
 7533|  1.28k|      _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set + 16));
 7534|       |  // 1 << (0..7), duplicated so pshufb(index & 7) works for every lane.
 7535|  1.28k|  t.pow2 =
 7536|  1.28k|      _mm_setr_epi8(1, 2, 4, 8, 16, 32, 64, -128, 1, 2, 4, 8, 16, 32, 64, -128);
 7537|  1.28k|  t.mask_0f = _mm_set1_epi8(0x0F);
 7538|  1.28k|  t.mask_07 = _mm_set1_epi8(0x07);
 7539|  1.28k|  t.zero = _mm_setzero_si128();
 7540|  1.28k|  return t;
 7541|  1.28k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_123percent_encode_to_ssse3EPKcS3_PKhRKNS1_20ssse3_percent_tablesERNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEE:
 7560|  1.28k|    const ssse3_percent_tables& tables, std::string& out) {
 7561|       |  // Pair 16-byte windows so a fully clean 32-byte run is one append.
 7562|  3.48k|  while (p + 32 <= end) {
  ------------------
  |  Branch (7562:10): [True: 2.20k, False: 1.28k]
  ------------------
 7563|  2.20k|    const __m128i word0 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7564|  2.20k|    const __m128i word1 =
 7565|  2.20k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + 16));
 7566|  2.20k|    const int mask0 = ssse3_percent_mask(word0, tables);
 7567|  2.20k|    const int mask1 = ssse3_percent_mask(word1, tables);
 7568|  2.20k|    if ((mask0 | mask1) == 0) {
  ------------------
  |  Branch (7568:9): [True: 421, False: 1.78k]
  ------------------
 7569|    421|      out.append(p, 32);
 7570|  1.78k|    } else {
 7571|  1.78k|      if (mask0 == 0) {
  ------------------
  |  Branch (7571:11): [True: 166, False: 1.61k]
  ------------------
 7572|    166|        out.append(p, 16);
 7573|  1.61k|      } else {
 7574|  1.61k|        encode_mask_window(p, static_cast<uint32_t>(mask0), 16, out);
 7575|  1.61k|      }
 7576|  1.78k|      if (mask1 == 0) {
  ------------------
  |  Branch (7576:11): [True: 219, False: 1.56k]
  ------------------
 7577|    219|        out.append(p + 16, 16);
 7578|  1.56k|      } else {
 7579|  1.56k|        encode_mask_window(p + 16, static_cast<uint32_t>(mask1), 16, out);
 7580|  1.56k|      }
 7581|  1.78k|    }
 7582|  2.20k|    p += 32;
 7583|  2.20k|  }
 7584|  1.28k|  if (p + 16 <= end) {
  ------------------
  |  Branch (7584:7): [True: 881, False: 399]
  ------------------
 7585|    881|    const __m128i word = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7586|    881|    const int mask = ssse3_percent_mask(word, tables);
 7587|    881|    if (mask == 0) {
  ------------------
  |  Branch (7587:9): [True: 172, False: 709]
  ------------------
 7588|    172|      out.append(p, 16);
 7589|    709|    } else {
 7590|    709|      encode_mask_window(p, static_cast<uint32_t>(mask), 16, out);
 7591|    709|    }
 7592|    881|    p += 16;
 7593|    881|  }
 7594|  1.28k|  percent_encode_to_scalar(p, end, character_set, out);
 7595|  1.28k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_118ssse3_percent_maskEDv2_xRKNS1_20ssse3_percent_tablesE:
 7544|  5.28k|    __m128i word, const ssse3_percent_tables& tables) noexcept {
 7545|  5.28k|  const __m128i idx = _mm_and_si128(_mm_srli_epi16(word, 3), tables.mask_0f);
 7546|  5.28k|  const __m128i lo = _mm_shuffle_epi8(tables.cs_lo, idx);
 7547|  5.28k|  const __m128i hi = _mm_shuffle_epi8(tables.cs_hi, idx);
 7548|       |  // Bytes 0x80-0xFF are signed-negative; select the high half of the bitmap.
 7549|  5.28k|  const __m128i high_byte = _mm_cmpgt_epi8(tables.zero, word);
 7550|  5.28k|  const __m128i cs_byte = _mm_or_si128(_mm_and_si128(hi, high_byte),
 7551|  5.28k|                                       _mm_andnot_si128(high_byte, lo));
 7552|  5.28k|  const __m128i bits =
 7553|  5.28k|      _mm_shuffle_epi8(tables.pow2, _mm_and_si128(word, tables.mask_07));
 7554|  5.28k|  const __m128i hits = _mm_and_si128(cs_byte, bits);
 7555|  5.28k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hits, tables.zero)) ^ 0xFFFF;
 7556|  5.28k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_118encode_mask_windowEPKcjmRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
 7484|  3.88k|                                          size_t width, std::string& out) {
 7485|  3.88k|  uint64_t bits = mask;
 7486|  3.88k|  size_t off = 0;
 7487|  40.0k|  while (bits != 0) {
  ------------------
  |  Branch (7487:10): [True: 36.1k, False: 3.88k]
  ------------------
 7488|  36.1k|    const int zero_run = trailing_zeroes32(static_cast<uint32_t>(bits));
 7489|  36.1k|    if (zero_run != 0) {
  ------------------
  |  Branch (7489:9): [True: 4.03k, False: 32.1k]
  ------------------
 7490|  4.03k|      out.append(p + off, static_cast<size_t>(zero_run));
 7491|  4.03k|    }
 7492|  36.1k|    off += static_cast<size_t>(zero_run);
 7493|  36.1k|    out.append(character_sets::hex + uint8_t(p[off]) * 4, 3);
 7494|  36.1k|    ++off;
 7495|  36.1k|    bits >>= static_cast<unsigned>(zero_run + 1);
 7496|  36.1k|  }
 7497|  3.88k|  if (off < width) {
  ------------------
  |  Branch (7497:7): [True: 1.74k, False: 2.14k]
  ------------------
 7498|  1.74k|    out.append(p + off, width - off);
 7499|  1.74k|  }
 7500|  3.88k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_117trailing_zeroes32Ej:
 7472|  36.1k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
 7473|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 7474|       |  unsigned long ret;
 7475|       |  _BitScanForward(&ret, input_num);
 7476|       |  return static_cast<int>(ret);
 7477|       |#else
 7478|  36.1k|  return __builtin_ctz(input_num);
 7479|  36.1k|#endif
 7480|  36.1k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_124percent_encode_to_scalarEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7505|  1.28k|                                                std::string& out) {
 7506|  4.51k|  for (; p != end; ++p) {
  ------------------
  |  Branch (7506:10): [True: 3.23k, False: 1.28k]
  ------------------
 7507|  3.23k|    if (character_sets::bit_at(character_set, *p)) {
  ------------------
  |  Branch (7507:9): [True: 1.25k, False: 1.98k]
  ------------------
 7508|  1.25k|      out.append(character_sets::hex + uint8_t(*p) * 4, 3);
 7509|  1.98k|    } else {
 7510|  1.98k|      out += *p;
 7511|  1.98k|    }
 7512|  3.23k|  }
 7513|  1.28k|}
serializers.cc:_ZN3ada11serializers12_GLOBAL__N_113write_hex_u16EPct:
 7769|  51.7k|ada_really_inline char* write_hex_u16(char* p, uint16_t v) noexcept {
 7770|  51.7k|  static constexpr char kHex[] = "0123456789abcdef";
 7771|  51.7k|  if (v >= 0x1000) {
  ------------------
  |  Branch (7771:7): [True: 46.2k, False: 5.53k]
  ------------------
 7772|  46.2k|    *p++ = kHex[(v >> 12) & 0xf];
 7773|  46.2k|    *p++ = kHex[(v >> 8) & 0xf];
 7774|  46.2k|    *p++ = kHex[(v >> 4) & 0xf];
 7775|  46.2k|    *p++ = kHex[v & 0xf];
 7776|  46.2k|  } else if (v >= 0x100) {
  ------------------
  |  Branch (7776:14): [True: 1.43k, False: 4.10k]
  ------------------
 7777|  1.43k|    *p++ = kHex[(v >> 8) & 0xf];
 7778|  1.43k|    *p++ = kHex[(v >> 4) & 0xf];
 7779|  1.43k|    *p++ = kHex[v & 0xf];
 7780|  4.10k|  } else if (v >= 0x10) {
  ------------------
  |  Branch (7780:14): [True: 2.12k, False: 1.97k]
  ------------------
 7781|  2.12k|    *p++ = kHex[(v >> 4) & 0xf];
 7782|  2.12k|    *p++ = kHex[v & 0xf];
 7783|  2.12k|  } else {
 7784|  1.97k|    *p++ = kHex[v & 0xf];
 7785|  1.97k|  }
 7786|  51.7k|  return p;
 7787|  51.7k|}
serializers.cc:_ZN3ada11serializers12_GLOBAL__N_18write_u8EPch:
 7755|  30.7k|ada_really_inline char* write_u8(char* p, uint8_t v) noexcept {
 7756|  30.7k|  if (v < 10) {
  ------------------
  |  Branch (7756:7): [True: 6.64k, False: 24.0k]
  ------------------
 7757|  6.64k|    *p++ = static_cast<char>('0' + v);
 7758|  24.0k|  } else if (v < 100) {
  ------------------
  |  Branch (7758:14): [True: 14.2k, False: 9.83k]
  ------------------
 7759|  14.2k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v) * 2], 2);
 7760|  14.2k|    p += 2;
 7761|  14.2k|  } else {
 7762|  9.83k|    *p++ = static_cast<char>('0' + v / 100);
 7763|  9.83k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v % 100) * 2], 2);
 7764|  9.83k|    p += 2;
 7765|  9.83k|  }
 7766|  30.7k|  return p;
 7767|  30.7k|}
_ZN3ada7unicode19has_tabs_or_newlineENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6862|  20.7k|    std::string_view user_input) noexcept {
 6863|       |  // first check for short strings in which case we do it naively.
 6864|  20.7k|  if (user_input.size() < 16) {  // slow path
  ------------------
  |  Branch (6864:7): [True: 6.63k, False: 14.1k]
  ------------------
 6865|  6.63k|    return std::ranges::any_of(user_input, is_tabs_or_newline);
 6866|  6.63k|  }
 6867|       |  // fast path for long strings (expected to be common)
 6868|  14.1k|  size_t i = 0;
 6869|  14.1k|  const __m128i mask1 = _mm_set1_epi8('\r');
 6870|  14.1k|  const __m128i mask2 = _mm_set1_epi8('\n');
 6871|  14.1k|  const __m128i mask3 = _mm_set1_epi8('\t');
 6872|       |  // If we supported SSSE3, we could use the algorithm that we use for NEON.
 6873|  14.1k|  __m128i running{0};
 6874|  48.4k|  for (; i + 15 < user_input.size(); i += 16) {
  ------------------
  |  Branch (6874:10): [True: 34.3k, False: 14.1k]
  ------------------
 6875|  34.3k|    __m128i word = _mm_loadu_si128((const __m128i*)(user_input.data() + i));
 6876|  34.3k|    running = _mm_or_si128(
 6877|  34.3k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 6878|  34.3k|                                           _mm_cmpeq_epi8(word, mask2))),
 6879|  34.3k|        _mm_cmpeq_epi8(word, mask3));
 6880|  34.3k|  }
 6881|  14.1k|  if (i < user_input.size()) {
  ------------------
  |  Branch (6881:7): [True: 13.2k, False: 905]
  ------------------
 6882|  13.2k|    __m128i word = _mm_loadu_si128(
 6883|  13.2k|        (const __m128i*)(user_input.data() + user_input.length() - 16));
 6884|  13.2k|    running = _mm_or_si128(
 6885|  13.2k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 6886|  13.2k|                                           _mm_cmpeq_epi8(word, mask2))),
 6887|  13.2k|        _mm_cmpeq_epi8(word, mask3));
 6888|  13.2k|  }
 6889|  14.1k|  return _mm_movemask_epi8(running) != 0;
 6890|  20.7k|}
_ZN3ada7unicode18is_tabs_or_newlineEc:
 6753|  51.5k|constexpr bool is_tabs_or_newline(char c) noexcept {
 6754|  51.5k|  return c == '\r' || c == '\n' || c == '\t';
  ------------------
  |  Branch (6754:10): [True: 46, False: 51.5k]
  |  Branch (6754:23): [True: 52, False: 51.4k]
  |  Branch (6754:36): [True: 42, False: 51.4k]
  ------------------
 6755|  51.5k|}
_ZN3ada7helpers27remove_ascii_tab_or_newlineERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 8558|    138|ada_really_inline void remove_ascii_tab_or_newline(std::string& input) {
 8559|       |  // if this ever becomes a performance issue, we could use an approach similar
 8560|       |  // to has_tabs_or_newline
 8561|    138|  std::erase_if(input, ada::unicode::is_ascii_tab_or_newline);
 8562|    138|}
_ZN3ada7unicode23is_ascii_tab_or_newlineEc:
 7107|  5.09k|    const char c) noexcept {
 7108|  5.09k|  return c == '\t' || c == '\n' || c == '\r';
  ------------------
  |  Branch (7108:10): [True: 171, False: 4.91k]
  |  Branch (7108:23): [True: 245, False: 4.67k]
  |  Branch (7108:36): [True: 136, False: 4.53k]
  ------------------
 7109|  5.09k|}
_ZN3ada7unicode22is_c0_control_or_spaceEc:
 7102|  24.7k|ada_really_inline constexpr bool is_c0_control_or_space(const char c) noexcept {
 7103|  24.7k|  return (unsigned char)c <= ' ';
 7104|  24.7k|}
_ZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7115|  4.15k|    std::string_view input) noexcept {
 7116|       |  // This will catch most cases:
 7117|       |  // The length must be 2,4 or 6.
 7118|       |  // We divide by two and require
 7119|       |  // that the result be between 1 and 3 inclusively.
 7120|  4.15k|  uint64_t half_length = uint64_t(input.size()) / 2;
 7121|  4.15k|  if (half_length - 1 > 2) {
  ------------------
  |  Branch (7121:7): [True: 2.49k, False: 1.66k]
  ------------------
 7122|  2.49k|    return false;
 7123|  2.49k|  }
 7124|       |  // We have a string of length 2, 4 or 6.
 7125|       |  // We now check the first character:
 7126|  1.66k|  if ((input[0] != '.') && (input[0] != '%')) {
  ------------------
  |  Branch (7126:7): [True: 866, False: 800]
  |  Branch (7126:28): [True: 238, False: 628]
  ------------------
 7127|    238|    return false;
 7128|    238|  }
 7129|       |  // We are unlikely the get beyond this point.
 7130|  1.42k|  int hash_value = (input.size() + (unsigned)(input[0])) & 3;
 7131|  1.42k|  const std::string_view target = table_is_double_dot_path_segment[hash_value];
 7132|  1.42k|  if (target.size() != input.size()) {
  ------------------
  |  Branch (7132:7): [True: 581, False: 847]
  ------------------
 7133|    581|    return false;
 7134|    581|  }
 7135|       |  // We almost never get here.
 7136|       |  // Optimizing the rest is relatively unimportant.
 7137|    847|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7138|    847|    uint16_t A, B;
 7139|    847|    memcpy(&A, a.data(), sizeof(A));
 7140|    847|    memcpy(&B, b.data(), sizeof(B));
 7141|    847|    return A == B;
 7142|    847|  };
 7143|    847|  if (!prefix_equal_unsafe(input, target)) {
  ------------------
  |  Branch (7143:7): [True: 295, False: 552]
  ------------------
 7144|    295|    return false;
 7145|    295|  }
 7146|    799|  for (size_t i = 2; i < input.size(); i++) {
  ------------------
  |  Branch (7146:22): [True: 460, False: 339]
  ------------------
 7147|    460|    char c = input[i];
 7148|    460|    if ((uint8_t((c | 0x20) - 0x61) <= 25 ? (c | 0x20) : c) != target[i]) {
  ------------------
  |  Branch (7148:9): [True: 213, False: 247]
  |  Branch (7148:10): [True: 181, False: 279]
  ------------------
 7149|    213|      return false;
 7150|    213|    }
 7151|    460|  }
 7152|    339|  return true;
 7153|       |  // The above code might be a bit better than the code below. Compilers
 7154|       |  // are not stupid and may use the fact that these strings have length 2,4 and
 7155|       |  // 6 and other tricks.
 7156|       |  // return input == ".." ||
 7157|       |  //  input == ".%2e" || input == ".%2E" ||
 7158|       |  //  input == "%2e." || input == "%2E." ||
 7159|       |  //  input == "%2e%2e" || input == "%2E%2E" || input == "%2E%2e" || input ==
 7160|       |  //  "%2e%2E";
 7161|    552|}
_ZZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEENKUlS5_S5_E_clES5_S5_:
 7137|    847|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7138|    847|    uint16_t A, B;
 7139|    847|    memcpy(&A, a.data(), sizeof(A));
 7140|    847|    memcpy(&B, b.data(), sizeof(B));
 7141|    847|    return A == B;
 7142|    847|  };
_ZN3ada7unicode26is_single_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7164|  7.62k|    std::string_view input) noexcept {
 7165|  7.62k|  return input == "." || input == "%2e" || input == "%2E";
  ------------------
  |  Branch (7165:10): [True: 477, False: 7.14k]
  |  Branch (7165:26): [True: 77, False: 7.06k]
  |  Branch (7165:44): [True: 0, False: 7.06k]
  ------------------
 7166|  7.62k|}
_ZN3ada6detail17parse_ipv4_numberERPKcS2_RmRb:
 9539|  2.52k|                              bool& is_pure_decimal) noexcept {
 9540|  2.52k|  is_pure_decimal = false;
 9541|  2.52k|  if (p >= end) [[unlikely]] {
  ------------------
  |  Branch (9541:7): [True: 0, False: 2.52k]
  ------------------
 9542|      0|    return false;
 9543|      0|  }
 9544|  2.52k|  if (end - p >= 2 && p[0] == '0' && ((p[1] | 0x20) == 'x')) {
  ------------------
  |  Branch (9544:7): [True: 2.17k, False: 351]
  |  Branch (9544:23): [True: 383, False: 1.78k]
  |  Branch (9544:38): [True: 200, False: 183]
  ------------------
 9545|    200|    p += 2;
 9546|    200|    if (p == end || *p == '.') {
  ------------------
  |  Branch (9546:9): [True: 7, False: 193]
  |  Branch (9546:21): [True: 11, False: 182]
  ------------------
 9547|     18|      value = 0;
 9548|     18|      return true;
 9549|     18|    }
 9550|    182|    uint64_t v = 0;
 9551|    182|    int digits = 0;
 9552|  1.19k|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9552:12): [True: 1.08k, False: 106]
  |  Branch (9552:23): [True: 1.06k, False: 22]
  ------------------
 9553|  1.06k|      const uint8_t nib = hex_nibble[static_cast<unsigned char>(*p)];
 9554|  1.06k|      if (nib == 0xff) [[unlikely]] {
  ------------------
  |  Branch (9554:11): [True: 5, False: 1.05k]
  ------------------
 9555|      5|        return false;
 9556|      5|      }
 9557|  1.05k|      if (v > (0xFFFFFFFFULL >> 4)) [[unlikely]] {
  ------------------
  |  Branch (9557:11): [True: 49, False: 1.00k]
  ------------------
 9558|     49|        return false;
 9559|     49|      }
 9560|  1.00k|      v = (v << 4) | nib;
 9561|  1.00k|      ++p;
 9562|  1.00k|      ++digits;
 9563|  1.00k|    }
 9564|    128|    if (digits == 0) [[unlikely]] {
  ------------------
  |  Branch (9564:9): [True: 0, False: 128]
  ------------------
 9565|      0|      return false;
 9566|      0|    }
 9567|    128|    value = v;
 9568|    128|    return true;
 9569|    128|  }
 9570|  2.32k|  if (end - p >= 2 && p[0] == '0' && p[1] >= '0' && p[1] <= '9') {
  ------------------
  |  Branch (9570:7): [True: 1.97k, False: 351]
  |  Branch (9570:23): [True: 183, False: 1.78k]
  |  Branch (9570:38): [True: 111, False: 72]
  |  Branch (9570:53): [True: 105, False: 6]
  ------------------
 9571|    105|    ++p;
 9572|    105|    uint64_t v = 0;
 9573|    966|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9573:12): [True: 898, False: 68]
  |  Branch (9573:23): [True: 884, False: 14]
  ------------------
 9574|    884|      const char c = *p;
 9575|    884|      if (c < '0' || c > '7') [[unlikely]] {
  ------------------
  |  Branch (9575:11): [True: 4, False: 880]
  |  Branch (9575:22): [True: 12, False: 868]
  ------------------
 9576|     16|        return false;
 9577|     16|      }
 9578|    868|      if (v > (0xFFFFFFFFULL >> 3)) [[unlikely]] {
  ------------------
  |  Branch (9578:11): [True: 7, False: 861]
  ------------------
 9579|      7|        return false;
 9580|      7|      }
 9581|    861|      v = (v << 3) | static_cast<uint64_t>(c - '0');
 9582|    861|      ++p;
 9583|    861|    }
 9584|     82|    value = v;
 9585|     82|    return true;
 9586|    105|  }
 9587|  2.21k|  if (*p < '0' || *p > '9') [[unlikely]] {
  ------------------
  |  Branch (9587:7): [True: 276, False: 1.94k]
  |  Branch (9587:19): [True: 1.20k, False: 740]
  ------------------
 9588|  1.47k|    return false;
 9589|  1.47k|  }
 9590|    740|  is_pure_decimal = true;
 9591|    740|  uint64_t v = static_cast<uint64_t>(*p - '0');
 9592|    740|  ++p;
 9593|  1.68k|  while (p < end && *p != '.') {
  ------------------
  |  Branch (9593:10): [True: 1.20k, False: 476]
  |  Branch (9593:21): [True: 989, False: 217]
  ------------------
 9594|    989|    const char c = *p;
 9595|    989|    if (c < '0' || c > '9') [[unlikely]] {
  ------------------
  |  Branch (9595:9): [True: 10, False: 979]
  |  Branch (9595:20): [True: 19, False: 960]
  ------------------
 9596|     29|      return false;
 9597|     29|    }
 9598|    960|    if (v > 429496729ULL) [[unlikely]] {
  ------------------
  |  Branch (9598:9): [True: 16, False: 944]
  ------------------
 9599|     16|      return false;
 9600|     16|    }
 9601|    944|    v = v * 10u + static_cast<uint64_t>(c - '0');
 9602|    944|    if (v > 0xFFFFFFFFULL) [[unlikely]] {
  ------------------
  |  Branch (9602:9): [True: 2, False: 942]
  ------------------
 9603|      2|      return false;
 9604|      2|    }
 9605|    942|    ++p;
 9606|    942|  }
 9607|    693|  value = v;
 9608|    693|  return true;
 9609|    740|}
_ZN3ada6detail15parse_hex_pieceERPKcS2_Rt:
 9613|  7.21k|                           uint16_t& value) noexcept {
 9614|  7.21k|  if (pointer == end) {
  ------------------
  |  Branch (9614:7): [True: 0, False: 7.21k]
  ------------------
 9615|      0|    return 0;
 9616|      0|  }
 9617|  7.21k|  const uint8_t n0 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9618|  7.21k|  if (n0 == 0xff) {
  ------------------
  |  Branch (9618:7): [True: 6.98k, False: 238]
  ------------------
 9619|  6.98k|    return 0;
 9620|  6.98k|  }
 9621|    238|  uint32_t v = n0;
 9622|    238|  ++pointer;
 9623|    238|  int length = 1;
 9624|    238|  if (pointer != end) {
  ------------------
  |  Branch (9624:7): [True: 222, False: 16]
  ------------------
 9625|    222|    const uint8_t n1 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9626|    222|    if (n1 != 0xff) {
  ------------------
  |  Branch (9626:9): [True: 89, False: 133]
  ------------------
 9627|     89|      v = (v << 4) | n1;
 9628|     89|      ++pointer;
 9629|     89|      ++length;
 9630|     89|      if (pointer != end) {
  ------------------
  |  Branch (9630:11): [True: 84, False: 5]
  ------------------
 9631|     84|        const uint8_t n2 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9632|     84|        if (n2 != 0xff) {
  ------------------
  |  Branch (9632:13): [True: 59, False: 25]
  ------------------
 9633|     59|          v = (v << 4) | n2;
 9634|     59|          ++pointer;
 9635|     59|          ++length;
 9636|     59|          if (pointer != end) {
  ------------------
  |  Branch (9636:15): [True: 54, False: 5]
  ------------------
 9637|     54|            const uint8_t n3 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9638|     54|            if (n3 != 0xff) {
  ------------------
  |  Branch (9638:17): [True: 21, False: 33]
  ------------------
 9639|     21|              v = (v << 4) | n3;
 9640|     21|              ++pointer;
 9641|     21|              ++length;
 9642|     21|            }
 9643|     54|          }
 9644|     59|        }
 9645|     84|      }
 9646|     89|    }
 9647|    222|  }
 9648|    238|  value = static_cast<uint16_t>(v);
 9649|    238|  return length;
 9650|  7.21k|}
_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: 873, False: 6.09k]
  ------------------
  102|  6.09k|  if (input.back() == '.') {
  ------------------
  |  Branch (102:7): [True: 125, False: 5.97k]
  ------------------
  103|    125|    if (input.size() > 254) return false;
  ------------------
  |  Branch (103:9): [True: 0, False: 125]
  ------------------
  104|  5.97k|  } else if (input.size() > 253)
  ------------------
  |  Branch (104:14): [True: 0, False: 5.97k]
  ------------------
  105|      0|    return false;
  106|       |
  107|  6.09k|  size_t start = 0;
  108|  20.7k|  while (start < input.size()) {
  ------------------
  |  Branch (108:10): [True: 15.5k, False: 5.18k]
  ------------------
  109|  15.5k|    auto dot_location = input.find('.', start);
  110|       |    // If not found, it's likely the end of the domain
  111|  15.5k|    if (dot_location == std::string_view::npos) dot_location = input.size();
  ------------------
  |  Branch (111:9): [True: 5.12k, False: 10.4k]
  ------------------
  112|       |
  113|  15.5k|    auto label_size = dot_location - start;
  114|  15.5k|    if (label_size > 63 || label_size == 0) return false;
  ------------------
  |  Branch (114:9): [True: 256, False: 15.2k]
  |  Branch (114:28): [True: 658, False: 14.6k]
  ------------------
  115|       |
  116|  14.6k|    start = dot_location + 1;
  117|  14.6k|  }
  118|       |
  119|  5.18k|  return true;
  120|  6.09k|}
_ZN3ada7unicode13is_alnum_plusEc:
 7079|  47.6k|ada_really_inline constexpr bool is_alnum_plus(const char c) noexcept {
 7080|  47.6k|  return is_alnum_plus_table[uint8_t(c)];
 7081|       |  // A table is almost surely much faster than the
 7082|       |  // following under most compilers: return
 7083|       |  // return (std::isalnum(c) || c == '+' || c == '-' || c == '.');
 7084|  47.6k|}
_ZN3ada7unicode14to_lower_asciiEPcm:
 6761|  8.09k|constexpr bool to_lower_ascii(char* input, size_t length) noexcept {
 6762|  8.09k|  uint64_t broadcast_80 = broadcast(0x80);
 6763|  8.09k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 6764|  8.09k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 6765|  8.09k|  uint64_t non_ascii = 0;
 6766|  8.09k|  size_t i = 0;
 6767|       |
 6768|  23.8k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (6768:10): [True: 15.7k, False: 8.09k]
  ------------------
 6769|  15.7k|    uint64_t word{};
 6770|  15.7k|    memcpy(&word, input + i, sizeof(word));
 6771|  15.7k|    non_ascii |= (word & broadcast_80);
 6772|  15.7k|    word ^=
 6773|  15.7k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 6774|  15.7k|    memcpy(input + i, &word, sizeof(word));
 6775|  15.7k|  }
 6776|  8.09k|  if (i < length) {
  ------------------
  |  Branch (6776:7): [True: 6.23k, False: 1.85k]
  ------------------
 6777|  6.23k|    uint64_t word{};
 6778|  6.23k|    memcpy(&word, input + i, length - i);
 6779|  6.23k|    non_ascii |= (word & broadcast_80);
 6780|  6.23k|    word ^=
 6781|  6.23k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 6782|  6.23k|    memcpy(input + i, &word, length - i);
 6783|  6.23k|  }
 6784|  8.09k|  return non_ascii == 0;
 6785|  8.09k|}
_ZN3ada7unicode9broadcastEh:
 6757|  24.2k|constexpr uint64_t broadcast(uint8_t v) noexcept {
 6758|  24.2k|  return 0x101010101010101ull * v;
 6759|  24.2k|}
_ZZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_ENKUlvE_clEv:
12222|    787|    auto apply_query_and_hash = [&]() {
12223|    787|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12223:11): [True: 149, False: 638]
  ------------------
12224|    149|        const size_t q_end =
12225|    149|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12225:13): [True: 19, False: 130]
  ------------------
12226|    149|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12227|    149|                                                q_end - query_start - 1),
12228|    149|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12229|    149|      }
12230|    787|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12230:11): [True: 123, False: 664]
  ------------------
12231|    123|        out.update_unencoded_base_hash(std::string_view(
12232|    123|            input.data() + hash_start + 1, len - hash_start - 1));
12233|    123|      }
12234|    787|    };
_ZZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmbENKUlvE_clEv:
11822|    112|    auto apply_query_and_hash = [&]() {
11823|    112|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (11823:11): [True: 43, False: 69]
  ------------------
11824|     43|        const size_t q_end =
11825|     43|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (11825:13): [True: 12, False: 31]
  ------------------
11826|     43|        out.update_base_search(std::string_view(input.data() + query_start + 1,
11827|     43|                                                q_end - query_start - 1),
11828|     43|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
11829|     43|      }
11830|    112|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (11830:11): [True: 30, False: 82]
  ------------------
11831|     30|        out.update_unencoded_base_hash(std::string_view(
11832|     30|            input.data() + hash_start + 1, len - hash_start - 1));
11833|     30|      }
11834|    112|    };
_ZN3ada7helpers10prune_hashERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8498|  11.9k|    std::string_view& input) noexcept {
 8499|       |  // compiles down to 20--30 instructions including a class to memchr (C
 8500|       |  // function). this function should be quite fast.
 8501|  11.9k|  size_t location_of_first = input.find('#');
 8502|  11.9k|  if (location_of_first == std::string_view::npos) {
  ------------------
  |  Branch (8502:7): [True: 11.7k, False: 123]
  ------------------
 8503|  11.7k|    return std::nullopt;
 8504|  11.7k|  }
 8505|    123|  std::string_view hash = input;
 8506|    123|  hash.remove_prefix(location_of_first + 1);
 8507|    123|  input.remove_suffix(input.size() - location_of_first);
 8508|    123|  return hash;
 8509|  11.9k|}
_ZN3ada7helpers32find_authority_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9451|  2.00k|find_authority_delimiter_special(std::string_view view) noexcept {
 9452|       |  // performance note: we might be able to gain further performance
 9453|       |  // with SIMD intrinsics.
 9454|  8.04k|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (9454:33): [True: 8.02k, False: 13]
  ------------------
 9455|  8.02k|    if (authority_delimiter_special[(uint8_t)*pos]) {
  ------------------
  |  Branch (9455:9): [True: 1.99k, False: 6.03k]
  ------------------
 9456|  1.99k|      return pos - view.begin();
 9457|  1.99k|    }
 9458|  8.02k|  }
 9459|     13|  return size_t(view.size());
 9460|  2.00k|}
_ZN3ada7helpers12shorten_pathERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_6scheme4typeE:
 8511|    339|ada_really_inline bool shorten_path(std::string& path, ada::scheme::type type) {
 8512|       |  // Let path be url's path.
 8513|       |  // If url's scheme is "file", path's size is 1, and path[0] is a normalized
 8514|       |  // Windows drive letter, then return.
 8515|    339|  if (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (8515:7): [True: 0, False: 339]
  ------------------
 8516|      0|      path.find('/', 1) == std::string_view::npos && !path.empty()) {
  ------------------
  |  Branch (8516:7): [True: 0, False: 0]
  |  Branch (8516:54): [True: 0, False: 0]
  ------------------
 8517|      0|    if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (8517:9): [True: 0, False: 0]
  ------------------
 8518|      0|            helpers::substring(path, 1))) {
 8519|      0|      return false;
 8520|      0|    }
 8521|      0|  }
 8522|       |
 8523|       |  // Remove path's last item, if any.
 8524|    339|  size_t last_delimiter = path.rfind('/');
 8525|    339|  if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (8525:7): [True: 164, False: 175]
  ------------------
 8526|    164|    path.erase(last_delimiter);
 8527|    164|    return true;
 8528|    164|  }
 8529|       |
 8530|    175|  return false;
 8531|    339|}
_ZN3ada7helpers27get_host_delimiter_locationEbRNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9164|  11.8k|    const bool is_special, std::string_view& view) noexcept {
 9165|       |  /**
 9166|       |   * The spec at https://url.spec.whatwg.org/#hostname-state expects us to
 9167|       |   * compute a variable called insideBrackets but this variable is only used
 9168|       |   * once, to check whether a ':' character was found outside brackets. Exact
 9169|       |   * text: "Otherwise, if c is U+003A (:) and insideBrackets is false, then:".
 9170|       |   * It is conceptually simpler and arguably more efficient to just return a
 9171|       |   * Boolean indicating whether ':' was found outside brackets.
 9172|       |   */
 9173|  11.8k|  const size_t view_size = view.size();
 9174|  11.8k|  size_t location = 0;
 9175|  11.8k|  bool found_colon = false;
 9176|       |  /**
 9177|       |   * Performance analysis:
 9178|       |   *
 9179|       |   * We are basically seeking the end of the hostname which can be indicated
 9180|       |   * by the end of the view, or by one of the characters ':', '/', '?', '\\'
 9181|       |   * (where '\\' is only applicable for special URLs). However, these must
 9182|       |   * appear outside a bracket range. E.g., if you have [something?]fd: then the
 9183|       |   * '?' does not count.
 9184|       |   *
 9185|       |   * So we can skip ahead to the next delimiter, as long as we include '[' in
 9186|       |   * the set of delimiters, and that we handle it first.
 9187|       |   *
 9188|       |   * So the trick is to have a fast function that locates the next delimiter.
 9189|       |   * Unless we find '[', then it only needs to be called once! Ideally, such a
 9190|       |   * function would be provided by the C++ standard library, but it seems that
 9191|       |   * find_first_of is not very fast, so we are forced to roll our own.
 9192|       |   *
 9193|       |   * We do not break into two loops for speed, but for clarity.
 9194|       |   */
 9195|  11.8k|  if (is_special) {
  ------------------
  |  Branch (9195:7): [True: 11.8k, False: 0]
  ------------------
 9196|       |    // We move to the next delimiter.
 9197|  11.8k|    location = find_next_host_delimiter_special(view, location);
 9198|       |    // Unless we find '[' then we are going only going to have to call
 9199|       |    // find_next_host_delimiter_special once.
 9200|  19.2k|    for (; location < view_size;
  ------------------
  |  Branch (9200:12): [True: 19.1k, False: 74]
  ------------------
 9201|  19.1k|         location = find_next_host_delimiter_special(view, location)) {
 9202|  19.1k|      if (view[location] == '[') {
  ------------------
  |  Branch (9202:11): [True: 7.50k, False: 11.6k]
  ------------------
 9203|  7.50k|        location = view.find(']', location);
 9204|  7.50k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9204:13): [True: 186, False: 7.32k]
  ------------------
 9205|       |          // performance: view.find might get translated to a memchr, which
 9206|       |          // has no notion of std::string_view::npos, so the code does not
 9207|       |          // reflect the assembly.
 9208|    186|          location = view_size;
 9209|    186|          break;
 9210|    186|        }
 9211|  11.6k|      } else {
 9212|  11.6k|        found_colon = view[location] == ':';
 9213|  11.6k|        break;
 9214|  11.6k|      }
 9215|  19.1k|    }
 9216|  11.8k|  } else {
 9217|       |    // We move to the next delimiter.
 9218|      0|    location = find_next_host_delimiter(view, location);
 9219|       |    // Unless we find '[' then we are going only going to have to call
 9220|       |    // find_next_host_delimiter_special once.
 9221|      0|    for (; location < view_size;
  ------------------
  |  Branch (9221:12): [True: 0, False: 0]
  ------------------
 9222|      0|         location = find_next_host_delimiter(view, location)) {
 9223|      0|      if (view[location] == '[') {
  ------------------
  |  Branch (9223:11): [True: 0, False: 0]
  ------------------
 9224|      0|        location = view.find(']', location);
 9225|      0|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9225:13): [True: 0, False: 0]
  ------------------
 9226|       |          // performance: view.find might get translated to a memchr, which
 9227|       |          // has no notion of std::string_view::npos, so the code does not
 9228|       |          // reflect the assembly.
 9229|      0|          location = view_size;
 9230|      0|          break;
 9231|      0|        }
 9232|      0|      } else {
 9233|      0|        found_colon = view[location] == ':';
 9234|      0|        break;
 9235|      0|      }
 9236|      0|    }
 9237|      0|  }
 9238|       |  // performance: remove_suffix may translate into a single instruction.
 9239|  11.8k|  view.remove_suffix(view_size - location);
 9240|  11.8k|  return {location, found_colon};
 9241|  11.8k|}
_ZN3ada7helpers32find_next_host_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 8754|  19.2k|    std::string_view view, size_t location) noexcept {
 8755|       |  // first check for short strings in which case we do it naively.
 8756|  19.2k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (8756:7): [True: 10.3k, False: 8.83k]
  ------------------
 8757|  41.1k|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (8757:31): [True: 41.1k, False: 56]
  ------------------
 8758|  41.1k|      if (view[i] == ':' || view[i] == '/' || view[i] == '\\' ||
  ------------------
  |  Branch (8758:11): [True: 546, False: 40.5k]
  |  Branch (8758:29): [True: 9.25k, False: 31.3k]
  |  Branch (8758:47): [True: 4, False: 31.3k]
  ------------------
 8759|  31.3k|          view[i] == '?' || view[i] == '[') {
  ------------------
  |  Branch (8759:11): [True: 67, False: 31.2k]
  |  Branch (8759:29): [True: 456, False: 30.8k]
  ------------------
 8760|  10.3k|        return i;
 8761|  10.3k|      }
 8762|  41.1k|    }
 8763|     56|    return size_t(view.size());
 8764|  10.3k|  }
 8765|       |  // fast path for long strings (expected to be common)
 8766|  8.83k|  size_t i = location;
 8767|  8.83k|  const __m128i mask1 = _mm_set1_epi8(':');
 8768|  8.83k|  const __m128i mask2 = _mm_set1_epi8('/');
 8769|  8.83k|  const __m128i mask3 = _mm_set1_epi8('\\');
 8770|  8.83k|  const __m128i mask4 = _mm_set1_epi8('?');
 8771|  8.83k|  const __m128i mask5 = _mm_set1_epi8('[');
 8772|       |
 8773|  11.5k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (8773:10): [True: 10.3k, False: 1.15k]
  ------------------
 8774|  10.3k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 8775|  10.3k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8776|  10.3k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8777|  10.3k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 8778|  10.3k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8779|  10.3k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8780|  10.3k|    __m128i m = _mm_or_si128(
 8781|  10.3k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 8782|  10.3k|    int mask = _mm_movemask_epi8(m);
 8783|  10.3k|    if (mask != 0) {
  ------------------
  |  Branch (8783:9): [True: 7.68k, False: 2.67k]
  ------------------
 8784|  7.68k|      return i + trailing_zeroes(mask);
 8785|  7.68k|    }
 8786|  10.3k|  }
 8787|  1.15k|  if (i < view.size()) {
  ------------------
  |  Branch (8787:7): [True: 1.14k, False: 4]
  ------------------
 8788|  1.14k|    __m128i word =
 8789|  1.14k|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 8790|  1.14k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8791|  1.14k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8792|  1.14k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 8793|  1.14k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8794|  1.14k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8795|  1.14k|    __m128i m = _mm_or_si128(
 8796|  1.14k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 8797|  1.14k|    int mask = _mm_movemask_epi8(m);
 8798|  1.14k|    if (mask != 0) {
  ------------------
  |  Branch (8798:9): [True: 1.13k, False: 14]
  ------------------
 8799|  1.13k|      return view.length() - 16 + trailing_zeroes(mask);
 8800|  1.13k|    }
 8801|  1.14k|  }
 8802|     18|  return size_t(view.length());
 8803|  1.15k|}
_ZN3ada7helpers15trailing_zeroesEj:
 8579|  8.81k|ada_really_inline int trailing_zeroes(uint32_t input_num) noexcept {
 8580|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 8581|       |  unsigned long ret;
 8582|       |  // Search the mask data from least significant bit (LSB)
 8583|       |  // to the most significant bit (MSB) for a set bit (1).
 8584|       |  _BitScanForward(&ret, input_num);
 8585|       |  return (int)ret;
 8586|       |#else   // ADA_REGULAR_VISUAL_STUDIO
 8587|  8.81k|  return __builtin_ctzl(input_num);
 8588|  8.81k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 8589|  8.81k|}
_ZN3ada7unicode30is_forbidden_domain_code_pointEc:
 7008|  32.0k|    const char c) noexcept {
 7009|  32.0k|  return is_forbidden_domain_code_point_table[uint8_t(c)];
 7010|  32.0k|}
_ZZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_ENKUlvE_clEv:
12545|  1.12k|  const auto enforce_max_input_length = [&]() {
12546|  1.12k|    if constexpr (store_values) {
12547|  1.12k|      if (url.is_valid) {
  ------------------
  |  Branch (12547:11): [True: 1.12k, False: 0]
  ------------------
12548|  1.12k|        if constexpr (result_type_is_ada_url_aggregator) {
12549|  1.12k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12549:15): [True: 0, False: 1.12k]
  ------------------
12550|      0|            url.is_valid = false;
12551|      0|          }
12552|       |        } else {
12553|       |          if (url.get_href_size() > max_input_length) [[unlikely]] {
12554|       |            url.is_valid = false;
12555|       |          }
12556|       |        }
12557|  1.12k|      }
12558|  1.12k|    }
12559|  1.12k|  };
serializers.cc:_ZN3ada6parser12_GLOBAL__N_124port_decimal_digit_countEj:
10875|     97|ada_really_inline uint32_t port_decimal_digit_count(uint32_t port) noexcept {
10876|     97|  uint32_t digits = 1;
10877|    313|  while (port >= 10) {
  ------------------
  |  Branch (10877:10): [True: 216, False: 97]
  ------------------
10878|    216|    port /= 10;
10879|    216|    ++digits;
10880|    216|  }
10881|     97|  return digits;
10882|     97|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_121append_canonical_portERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEj:
10885|     76|                                             uint32_t port) {
10886|     76|  buffer += ':';
10887|     76|  char port_buf[5];
10888|     76|  auto [ptr, ec] = std::to_chars(port_buf, port_buf + 5, port);
10889|     76|  (void)ec;
10890|     76|  buffer.append(port_buf, static_cast<size_t>(ptr - port_buf));
10891|     76|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_116authority_has_atEPKhmm:
11033|  13.1k|                                        size_t n) noexcept {
11034|  13.1k|  const size_t rem = n - host_start;
11035|  13.1k|  if (rem == 0) {
  ------------------
  |  Branch (11035:7): [True: 0, False: 13.1k]
  ------------------
11036|      0|    return false;
11037|      0|  }
11038|       |#if ADA_NEON
11039|       |  if (rem >= 16) {
11040|       |    const uint8x16_t w = vld1q_u8(p + host_start);
11041|       |    const uint64_t at = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('@')));
11042|       |    if (at == 0) {
11043|       |      return false;
11044|       |    }
11045|       |    const uint64_t delim = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('/'))) |
11046|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('?'))) |
11047|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('#')));
11048|       |    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
11049|       |  }
11050|       |#elif ADA_SSE2
11051|  13.1k|  if (rem >= 16) {
  ------------------
  |  Branch (11051:7): [True: 9.57k, False: 3.55k]
  ------------------
11052|  9.57k|    const __m128i w =
11053|  9.57k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + host_start));
11054|  9.57k|    const uint16_t at = static_cast<uint16_t>(
11055|  9.57k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('@'))));
11056|  9.57k|    if (at == 0) {
  ------------------
  |  Branch (11056:9): [True: 9.45k, False: 119]
  ------------------
11057|  9.45k|      return false;
11058|  9.45k|    }
11059|    119|    const uint16_t delim = static_cast<uint16_t>(
11060|    119|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) |
11061|    119|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('?'))) |
11062|    119|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('#'))));
11063|    119|    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
  ------------------
  |  Branch (11063:12): [True: 85, False: 34]
  |  Branch (11063:26): [True: 10, False: 24]
  ------------------
11064|  9.57k|  }
11065|  3.55k|#endif
11066|  3.55k|  const size_t lim = host_start + rem;
11067|  25.0k|  for (size_t i = host_start; i < lim; ++i) {
  ------------------
  |  Branch (11067:31): [True: 25.0k, False: 0]
  ------------------
11068|  25.0k|    const uint8_t c = p[i];
11069|  25.0k|    if (c == '@') {
  ------------------
  |  Branch (11069:9): [True: 94, False: 24.9k]
  ------------------
11070|     94|      return true;
11071|     94|    }
11072|  24.9k|    if (c == '/' || c == '?' || c == '#') {
  ------------------
  |  Branch (11072:9): [True: 3.21k, False: 21.7k]
  |  Branch (11072:21): [True: 136, False: 21.5k]
  |  Branch (11072:33): [True: 103, False: 21.4k]
  ------------------
11073|  3.45k|      return false;
11074|  3.45k|    }
11075|  24.9k|  }
11076|      0|  return false;
11077|  3.55k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_:
11084|  4.55k|                                     bool& has_x) noexcept {
11085|  4.55k|  has_upper = false;
11086|  4.55k|  has_x = false;
11087|  4.55k|  size_t i = start;
11088|  4.55k|#if ADA_PARSER_SSSE3
11089|  4.55k|  if (len - start >= 16) {
  ------------------
  |  Branch (11089:7): [True: 2.15k, False: 2.39k]
  ------------------
11090|  2.15k|    const __m128i lo_tbl = nibble_load(k_host_nibbles.low);
11091|  2.15k|    const __m128i hi_tbl = nibble_load(k_host_nibbles.high);
11092|  2.15k|    const __m128i x_splat = _mm_set1_epi8('x');
11093|  2.15k|    auto visit = [&](size_t at) noexcept -> bool {
11094|  2.15k|      const __m128i w =
11095|  2.15k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11096|  2.15k|      const int up = sse2_uppercase(w);
11097|  2.15k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11098|  2.15k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11099|  2.15k|      if (mask == 0) {
11100|  2.15k|        if (up != 0) {
11101|  2.15k|          has_upper = true;
11102|  2.15k|        }
11103|  2.15k|        if (xs != 0) {
11104|  2.15k|          has_x = true;
11105|  2.15k|        }
11106|  2.15k|        return false;
11107|  2.15k|      }
11108|  2.15k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11109|  2.15k|      const int valid = (1 << hit) - 1;
11110|  2.15k|      if ((up & valid) != 0) {
11111|  2.15k|        has_upper = true;
11112|  2.15k|      }
11113|  2.15k|      if ((xs & valid) != 0) {
11114|  2.15k|        has_x = true;
11115|  2.15k|      }
11116|  2.15k|      end = at + static_cast<size_t>(hit);
11117|  2.15k|      return true;
11118|  2.15k|    };
11119|  2.51k|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11119:12): [True: 1.32k, False: 1.19k]
  ------------------
11120|  1.32k|      if (visit(i) || visit(i + 16)) {
  ------------------
  |  Branch (11120:11): [True: 831, False: 493]
  |  Branch (11120:23): [True: 126, False: 367]
  ------------------
11121|    957|        return k_host_class[b[end]] == 1;
11122|    957|      }
11123|  1.32k|    }
11124|  1.42k|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11124:12): [True: 1.05k, False: 370]
  ------------------
11125|  1.05k|      if (visit(i)) {
  ------------------
  |  Branch (11125:11): [True: 825, False: 230]
  ------------------
11126|    825|        return k_host_class[b[end]] == 1;
11127|    825|      }
11128|  1.05k|    }
11129|       |    // Overlapping tail only after a full 16-byte step so the window cannot
11130|       |    // start before `start` (a prior '/' would otherwise look like a host stop).
11131|    370|    if (i > start && i < len) {
  ------------------
  |  Branch (11131:9): [True: 370, False: 0]
  |  Branch (11131:22): [True: 370, False: 0]
  ------------------
11132|    370|      if (visit(len - 16) && end >= i) {
  ------------------
  |  Branch (11132:11): [True: 370, False: 0]
  |  Branch (11132:30): [True: 370, False: 0]
  ------------------
11133|    370|        return k_host_class[b[end]] == 1;
11134|    370|      }
11135|      0|      end = len;
11136|      0|      return true;
11137|    370|    }
11138|    370|  }
11139|       |#elif ADA_SSE2
11140|       |  const __m128i x_splat = _mm_set1_epi8('x');
11141|       |  for (; i + 32 <= len; i += 32) {
11142|       |    for (size_t off = 0; off < 32; off += 16) {
11143|       |      const __m128i w =
11144|       |          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + off));
11145|       |      const int up = sse2_uppercase(w);
11146|       |      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11147|       |      const int mask = sse2_host_stop(w);
11148|       |      if (mask != 0) {
11149|       |        const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11150|       |        const int valid = (1 << hit) - 1;
11151|       |        if ((up & valid) != 0) {
11152|       |          has_upper = true;
11153|       |        }
11154|       |        if ((xs & valid) != 0) {
11155|       |          has_x = true;
11156|       |        }
11157|       |        end = i + off + static_cast<size_t>(hit);
11158|       |        return k_host_class[b[end]] == 1;
11159|       |      }
11160|       |      if (up != 0) {
11161|       |        has_upper = true;
11162|       |      }
11163|       |      if (xs != 0) {
11164|       |        has_x = true;
11165|       |      }
11166|       |    }
11167|       |  }
11168|       |  for (; i + 16 <= len; i += 16) {
11169|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11170|       |    const int up = sse2_uppercase(w);
11171|       |    const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11172|       |    const int mask = sse2_host_stop(w);
11173|       |    if (mask != 0) {
11174|       |      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11175|       |      const int valid = (1 << hit) - 1;
11176|       |      if ((up & valid) != 0) {
11177|       |        has_upper = true;
11178|       |      }
11179|       |      if ((xs & valid) != 0) {
11180|       |        has_x = true;
11181|       |      }
11182|       |      end = i + static_cast<size_t>(hit);
11183|       |      return k_host_class[b[end]] == 1;
11184|       |    }
11185|       |    if (up != 0) {
11186|       |      has_upper = true;
11187|       |    }
11188|       |    if (xs != 0) {
11189|       |      has_x = true;
11190|       |    }
11191|       |  }
11192|       |#elif ADA_NEON
11193|       |  if (len - start >= 16) {
11194|       |    const uint8x16_t lo_tbl = vld1q_u8(k_host_nibbles.low);
11195|       |    const uint8x16_t hi_tbl = vld1q_u8(k_host_nibbles.high);
11196|       |    const uint8x16_t x_splat = vdupq_n_u8('x');
11197|       |    auto visit = [&](size_t at) noexcept -> bool {
11198|       |      const uint8x16_t w = vld1q_u8(b + at);
11199|       |      const uint64_t up = neon_uppercase(w);
11200|       |      const uint64_t xs = neon_nibble_bits(vceqq_u8(w, x_splat));
11201|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11202|       |      if (bits == 0) {
11203|       |        if (up != 0) {
11204|       |          has_upper = true;
11205|       |        }
11206|       |        if (xs != 0) {
11207|       |          has_x = true;
11208|       |        }
11209|       |        return false;
11210|       |      }
11211|       |      const size_t hit = static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11212|       |      const uint64_t valid = (hit == 0) ? 0 : (uint64_t{1} << (hit * 4)) - 1;
11213|       |      if ((up & valid) != 0) {
11214|       |        has_upper = true;
11215|       |      }
11216|       |      if ((xs & valid) != 0) {
11217|       |        has_x = true;
11218|       |      }
11219|       |      end = at + hit;
11220|       |      return true;
11221|       |    };
11222|       |    for (; i + 32 <= len; i += 32) {
11223|       |      if (visit(i) || visit(i + 16)) {
11224|       |        return k_host_class[b[end]] == 1;
11225|       |      }
11226|       |    }
11227|       |    for (; i + 16 <= len; i += 16) {
11228|       |      if (visit(i)) {
11229|       |        return k_host_class[b[end]] == 1;
11230|       |      }
11231|       |    }
11232|       |    if (i > start && i < len) {
11233|       |      if (visit(len - 16) && end >= i) {
11234|       |        return k_host_class[b[end]] == 1;
11235|       |      }
11236|       |      end = len;
11237|       |      return true;
11238|       |    }
11239|       |  }
11240|       |#endif
11241|  5.38k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11241:10): [True: 5.38k, False: 0]
  ------------------
11242|  5.38k|    const uint8_t c = b[i];
11243|  5.38k|    const uint8_t cls = k_host_class[c];
11244|  5.38k|    if (cls == 1) {
  ------------------
  |  Branch (11244:9): [True: 857, False: 4.52k]
  ------------------
11245|    857|      end = i;
11246|    857|      return true;
11247|    857|    }
11248|  4.52k|    if (cls == 2) {
  ------------------
  |  Branch (11248:9): [True: 1.54k, False: 2.98k]
  ------------------
11249|  1.54k|      return false;
11250|  1.54k|    }
11251|  2.98k|    if (c >= 'A' && c <= 'Z') {
  ------------------
  |  Branch (11251:9): [True: 1.73k, False: 1.24k]
  |  Branch (11251:21): [True: 393, False: 1.34k]
  ------------------
11252|    393|      has_upper = true;
11253|  2.59k|    } else if (c == 'x') {
  ------------------
  |  Branch (11253:16): [True: 481, False: 2.11k]
  ------------------
11254|    481|      has_x = true;
11255|    481|    }
11256|  2.98k|  }
11257|      0|  end = len;
11258|      0|  return true;
11259|  2.39k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_111nibble_loadEPKh:
10914|  5.76k|ADA_PARSER_SIMD __m128i nibble_load(const uint8_t* t) noexcept {
10915|  5.76k|  return _mm_load_si128(reinterpret_cast<const __m128i*>(t));
10916|  5.76k|}
serializers.cc:_ZZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_ENK3$_0clEm:
11093|  3.24k|    auto visit = [&](size_t at) noexcept -> bool {
11094|  3.24k|      const __m128i w =
11095|  3.24k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11096|  3.24k|      const int up = sse2_uppercase(w);
11097|  3.24k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11098|  3.24k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11099|  3.24k|      if (mask == 0) {
  ------------------
  |  Branch (11099:11): [True: 1.09k, False: 2.15k]
  ------------------
11100|  1.09k|        if (up != 0) {
  ------------------
  |  Branch (11100:13): [True: 581, False: 509]
  ------------------
11101|    581|          has_upper = true;
11102|    581|        }
11103|  1.09k|        if (xs != 0) {
  ------------------
  |  Branch (11103:13): [True: 679, False: 411]
  ------------------
11104|    679|          has_x = true;
11105|    679|        }
11106|  1.09k|        return false;
11107|  1.09k|      }
11108|  2.15k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11109|  2.15k|      const int valid = (1 << hit) - 1;
11110|  2.15k|      if ((up & valid) != 0) {
  ------------------
  |  Branch (11110:11): [True: 483, False: 1.66k]
  ------------------
11111|    483|        has_upper = true;
11112|    483|      }
11113|  2.15k|      if ((xs & valid) != 0) {
  ------------------
  |  Branch (11113:11): [True: 536, False: 1.61k]
  ------------------
11114|    536|        has_x = true;
11115|    536|      }
11116|  2.15k|      end = at + static_cast<size_t>(hit);
11117|  2.15k|      return true;
11118|  3.24k|    };
serializers.cc:_ZN3ada6parser12_GLOBAL__N_114sse2_uppercaseEDv2_x:
11001|  3.24k|ada_really_inline int sse2_uppercase(__m128i w) noexcept {
11002|  3.24k|  return _mm_movemask_epi8(_mm_and_si128(
11003|  3.24k|      _mm_cmpgt_epi8(w, _mm_set1_epi8(static_cast<char>('A' - 1))),
11004|  3.24k|      _mm_cmplt_epi8(w, _mm_set1_epi8(static_cast<char>('Z' + 1)))));
11005|  3.24k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_117ssse3_nibble_maskEDv2_xS2_S2_:
10921|  4.76k|                                      __m128i hi_tbl) noexcept {
10922|  4.76k|  const __m128i nibble = _mm_set1_epi8(0x0F);
10923|  4.76k|  const __m128i lo = _mm_and_si128(w, nibble);
10924|  4.76k|  const __m128i hi = _mm_and_si128(_mm_srli_epi16(w, 4), nibble);
10925|  4.76k|  const __m128i hit =
10926|  4.76k|      _mm_and_si128(_mm_shuffle_epi8(lo_tbl, lo), _mm_shuffle_epi8(hi_tbl, hi));
10927|  4.76k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hit, _mm_setzero_si128())) ^ 0xFFFF;
10928|  4.76k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_117trailing_zeroes32Ej:
10893|  2.71k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
10894|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
10895|       |  unsigned long ret;
10896|       |  _BitScanForward(&ret, input_num);
10897|       |  return static_cast<int>(ret);
10898|       |#else
10899|  2.71k|  return __builtin_ctz(input_num);
10900|  2.71k|#endif
10901|  2.71k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_113scan_path_runEPKhRmmRb:
11319|  1.00k|                                   bool& maybe_dot_segment) noexcept {
11320|  1.00k|  const size_t run_start = i;
11321|  1.00k|#if ADA_PARSER_SSSE3
11322|  1.00k|  if (i + 16 <= len) {
  ------------------
  |  Branch (11322:7): [True: 547, False: 456]
  ------------------
11323|    547|    const __m128i lo_tbl = nibble_load(k_path_nibbles.low);
11324|    547|    const __m128i hi_tbl = nibble_load(k_path_nibbles.high);
11325|    772|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11325:12): [True: 438, False: 334]
  ------------------
11326|    438|      const __m128i w0 =
11327|    438|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11328|    438|      const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);
11329|    438|      if (m0 != 0) {
  ------------------
  |  Branch (11329:11): [True: 153, False: 285]
  ------------------
11330|    153|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m0));
11331|    153|        note_dots_in_window(b, i, run_start, w0, (1 << hit_bit) - 1,
11332|    153|                            maybe_dot_segment);
11333|    153|        i += static_cast<size_t>(hit_bit);
11334|    153|        return;
11335|    153|      }
11336|    285|      note_dots_in_window(b, i, run_start, w0, 0xFFFF, maybe_dot_segment);
11337|    285|      const __m128i w1 =
11338|    285|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));
11339|    285|      const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);
11340|    285|      if (m1 != 0) {
  ------------------
  |  Branch (11340:11): [True: 60, False: 225]
  ------------------
11341|     60|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m1));
11342|     60|        note_dots_in_window(b, i + 16, run_start, w1, (1 << hit_bit) - 1,
11343|     60|                            maybe_dot_segment);
11344|     60|        i += 16 + static_cast<size_t>(hit_bit);
11345|     60|        return;
11346|     60|      }
11347|    225|      note_dots_in_window(b, i + 16, run_start, w1, 0xFFFF, maybe_dot_segment);
11348|    225|    }
11349|    483|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11349:12): [True: 266, False: 217]
  ------------------
11350|    266|      const __m128i w =
11351|    266|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11352|    266|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11353|    266|      if (mask != 0) {
  ------------------
  |  Branch (11353:11): [True: 117, False: 149]
  ------------------
11354|    117|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11355|    117|        note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11356|    117|                            maybe_dot_segment);
11357|    117|        i += static_cast<size_t>(hit_bit);
11358|    117|        return;
11359|    117|      }
11360|    149|      note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11361|    149|    }
11362|    217|    if (i > run_start && i < len) {
  ------------------
  |  Branch (11362:9): [True: 217, False: 0]
  |  Branch (11362:26): [True: 169, False: 48]
  ------------------
11363|    169|      const __m128i w =
11364|    169|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16));
11365|    169|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11366|    169|      if (mask != 0) {
  ------------------
  |  Branch (11366:11): [True: 80, False: 89]
  ------------------
11367|     80|        const size_t hit =
11368|     80|            len - 16 +
11369|     80|            static_cast<size_t>(trailing_zeroes32(static_cast<uint32_t>(mask)));
11370|     80|        if (hit >= i) {
  ------------------
  |  Branch (11370:13): [True: 80, False: 0]
  ------------------
11371|    235|          for (size_t j = i; j < hit; ++j) {
  ------------------
  |  Branch (11371:30): [True: 155, False: 80]
  ------------------
11372|    155|            if (b[j] == '.') {
  ------------------
  |  Branch (11372:17): [True: 65, False: 90]
  ------------------
11373|     65|              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11374|     65|            }
11375|    155|          }
11376|     80|          i = hit;
11377|     80|          return;
11378|     80|        }
11379|     80|      }
11380|    599|      for (size_t j = i; j < len; ++j) {
  ------------------
  |  Branch (11380:26): [True: 510, False: 89]
  ------------------
11381|    510|        if (b[j] == '.') {
  ------------------
  |  Branch (11381:13): [True: 153, False: 357]
  ------------------
11382|    153|          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11383|    153|        }
11384|    510|      }
11385|     89|      i = len;
11386|     89|      return;
11387|    169|    }
11388|    217|  }
11389|       |#elif ADA_SSE2
11390|       |  for (; i + 16 <= len; i += 16) {
11391|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11392|       |    const int mask = sse2_path_stop(w);
11393|       |    if (mask != 0) {
11394|       |      const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11395|       |      note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11396|       |                          maybe_dot_segment);
11397|       |      i += static_cast<size_t>(hit_bit);
11398|       |      return;
11399|       |    }
11400|       |    note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11401|       |  }
11402|       |#elif ADA_NEON
11403|       |  if (i + 16 <= len) {
11404|       |    const uint8x16_t lo_tbl = vld1q_u8(k_path_nibbles.low);
11405|       |    const uint8x16_t hi_tbl = vld1q_u8(k_path_nibbles.high);
11406|       |    for (; i + 32 <= len; i += 32) {
11407|       |      const uint8x16_t w0 = vld1q_u8(b + i);
11408|       |      const uint64_t bits0 = neon_table_stop(w0, lo_tbl, hi_tbl);
11409|       |      if (bits0 != 0) {
11410|       |        const size_t hit_off =
11411|       |            static_cast<size_t>(trailing_zeroes64(bits0)) >> 2;
11412|       |        const uint64_t valid =
11413|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11414|       |        note_dots_in_window_neon(b, i, run_start, w0, valid, maybe_dot_segment);
11415|       |        i += hit_off;
11416|       |        return;
11417|       |      }
11418|       |      note_dots_in_window_neon(b, i, run_start, w0, ~uint64_t{0},
11419|       |                               maybe_dot_segment);
11420|       |      const uint8x16_t w1 = vld1q_u8(b + i + 16);
11421|       |      const uint64_t bits1 = neon_table_stop(w1, lo_tbl, hi_tbl);
11422|       |      if (bits1 != 0) {
11423|       |        const size_t hit_off =
11424|       |            static_cast<size_t>(trailing_zeroes64(bits1)) >> 2;
11425|       |        const uint64_t valid =
11426|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11427|       |        note_dots_in_window_neon(b, i + 16, run_start, w1, valid,
11428|       |                                 maybe_dot_segment);
11429|       |        i += 16 + hit_off;
11430|       |        return;
11431|       |      }
11432|       |      note_dots_in_window_neon(b, i + 16, run_start, w1, ~uint64_t{0},
11433|       |                               maybe_dot_segment);
11434|       |    }
11435|       |    for (; i + 16 <= len; i += 16) {
11436|       |      const uint8x16_t w = vld1q_u8(b + i);
11437|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11438|       |      if (bits != 0) {
11439|       |        const size_t hit_off =
11440|       |            static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11441|       |        const uint64_t valid =
11442|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11443|       |        note_dots_in_window_neon(b, i, run_start, w, valid, maybe_dot_segment);
11444|       |        i += hit_off;
11445|       |        return;
11446|       |      }
11447|       |      note_dots_in_window_neon(b, i, run_start, w, ~uint64_t{0},
11448|       |                               maybe_dot_segment);
11449|       |    }
11450|       |    if (i > run_start && i < len) {
11451|       |      const uint8x16_t w = vld1q_u8(b + len - 16);
11452|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11453|       |      if (bits != 0) {
11454|       |        const size_t hit =
11455|       |            len - 16 + (static_cast<size_t>(trailing_zeroes64(bits)) >> 2);
11456|       |        if (hit >= i) {
11457|       |          for (size_t j = i; j < hit; ++j) {
11458|       |            if (b[j] == '.') {
11459|       |              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11460|       |            }
11461|       |          }
11462|       |          i = hit;
11463|       |          return;
11464|       |        }
11465|       |      }
11466|       |      for (size_t j = i; j < len; ++j) {
11467|       |        if (b[j] == '.') {
11468|       |          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11469|       |        }
11470|       |      }
11471|       |      i = len;
11472|       |      return;
11473|       |    }
11474|       |  }
11475|       |#endif
11476|  1.80k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11476:10): [True: 1.60k, False: 198]
  ------------------
11477|  1.60k|    const uint8_t c = b[i];
11478|  1.60k|    const uint8_t cls = k_path[c];
11479|  1.60k|    if (cls != 0) {
  ------------------
  |  Branch (11479:9): [True: 306, False: 1.30k]
  ------------------
11480|    306|      return;
11481|    306|    }
11482|  1.30k|    if (c == '.') {
  ------------------
  |  Branch (11482:9): [True: 428, False: 872]
  ------------------
11483|    428|      note_possible_dot_segment(b, i, run_start, maybe_dot_segment);
11484|    428|    }
11485|  1.30k|  }
11486|    504|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_119note_dots_in_windowEPKhmmDv2_xiRb:
11276|    989|                                           bool& maybe_dot_segment) noexcept {
11277|    989|  if (maybe_dot_segment || valid_mask == 0) {
  ------------------
  |  Branch (11277:7): [True: 200, False: 789]
  |  Branch (11277:28): [True: 125, False: 664]
  ------------------
11278|    325|    return;
11279|    325|  }
11280|    664|  const int dots =
11281|    664|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('.'))) & valid_mask;
11282|    664|  if (dots == 0) {
  ------------------
  |  Branch (11282:7): [True: 205, False: 459]
  ------------------
11283|    205|    return;
11284|    205|  }
11285|    459|  const int slashes =
11286|    459|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) & valid_mask;
11287|    459|  if (((dots & 1) != 0 && (i == run_start || b[i - 1] == '/')) ||
  ------------------
  |  Branch (11287:8): [True: 161, False: 298]
  |  Branch (11287:28): [True: 99, False: 62]
  |  Branch (11287:46): [True: 9, False: 53]
  ------------------
11288|    351|      (dots & (slashes << 1)) != 0) {
  ------------------
  |  Branch (11288:7): [True: 140, False: 211]
  ------------------
11289|    248|    maybe_dot_segment = true;
11290|    248|  }
11291|    459|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_125note_possible_dot_segmentEPKhmmRb:
11263|    646|    bool& maybe_dot_segment) noexcept {
11264|    646|  if (pos == run_start || b[pos - 1] == '/') {
  ------------------
  |  Branch (11264:7): [True: 124, False: 522]
  |  Branch (11264:27): [True: 269, False: 253]
  ------------------
11265|    393|    maybe_dot_segment = true;
11266|    393|  }
11267|    646|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_114scan_query_runEPKhRmm:
11629|    228|                                    size_t len) noexcept {
11630|    228|  ADA_SCAN_STOP_RUN(k_query_nibbles, k_query, sse2_query_stop);
  ------------------
  |  |11492|    228|  do {                                                                       \
  |  |11493|    228|    const size_t scan_start = i;                                             \
  |  |11494|    228|    if (i + 16 <= len) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11494:9): [True: 93, False: 135]
  |  |  ------------------
  |  |11495|     93|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11496|     93|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11497|    121|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11497:14): [True: 66, False: 55]
  |  |  ------------------
  |  |11498|     66|        const __m128i w0 =                                                   \
  |  |11499|     66|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11500|     66|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11501|     66|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11501:13): [True: 24, False: 42]
  |  |  ------------------
  |  |11502|     24|          i += static_cast<size_t>(                                          \
  |  |11503|     24|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11504|     24|          return;                                                            \
  |  |11505|     24|        }                                                                    \
  |  |11506|     66|        const __m128i w1 =                                                   \
  |  |11507|     42|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11508|     42|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11509|     42|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11509:13): [True: 14, False: 28]
  |  |  ------------------
  |  |11510|     14|          i += 16 + static_cast<size_t>(                                     \
  |  |11511|     14|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11512|     14|          return;                                                            \
  |  |11513|     14|        }                                                                    \
  |  |11514|     42|      }                                                                      \
  |  |11515|     93|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11515:14): [True: 47, False: 41]
  |  |  ------------------
  |  |11516|     47|        const __m128i w =                                                    \
  |  |11517|     47|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11518|     47|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11519|     47|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11519:13): [True: 14, False: 33]
  |  |  ------------------
  |  |11520|     14|          i += static_cast<size_t>(                                          \
  |  |11521|     14|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11522|     14|          return;                                                            \
  |  |11523|     14|        }                                                                    \
  |  |11524|     47|      }                                                                      \
  |  |11525|     55|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11525:11): [True: 41, False: 0]
  |  |  |  Branch (11525:29): [True: 36, False: 5]
  |  |  ------------------
  |  |11526|     36|        const __m128i w =                                                    \
  |  |11527|     36|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11528|     36|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11529|     36|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11529:13): [True: 25, False: 11]
  |  |  ------------------
  |  |11530|     25|          const size_t hit = len - 16 +                                      \
  |  |11531|     25|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11532|     25|                                 static_cast<uint32_t>(mask)));              \
  |  |11533|     25|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11533:15): [True: 25, False: 0]
  |  |  ------------------
  |  |11534|     25|            i = hit;                                                         \
  |  |11535|     25|            return;                                                          \
  |  |11536|     25|          }                                                                  \
  |  |11537|     25|        }                                                                    \
  |  |11538|     36|        i = len;                                                             \
  |  |11539|     11|        return;                                                              \
  |  |11540|     36|      }                                                                      \
  |  |11541|     41|    }                                                                        \
  |  |11542|    489|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11542:12): [True: 408, False: 81]
  |  |  ------------------
  |  |11543|    408|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11543:11): [True: 59, False: 349]
  |  |  ------------------
  |  |11544|     59|        return;                                                              \
  |  |11545|     59|      }                                                                      \
  |  |11546|    408|    }                                                                        \
  |  |11547|    140|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11547:12): [Folded, False: 81]
  |  |  ------------------
  ------------------
11631|    228|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_113scan_hash_runEPKhRmm:
11634|    207|                                   size_t len) noexcept {
11635|    207|  ADA_SCAN_STOP_RUN(k_hash_nibbles, k_hash, sse2_hash_stop);
  ------------------
  |  |11492|    207|  do {                                                                       \
  |  |11493|    207|    const size_t scan_start = i;                                             \
  |  |11494|    207|    if (i + 16 <= len) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11494:9): [True: 89, False: 118]
  |  |  ------------------
  |  |11495|     89|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11496|     89|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11497|    110|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11497:14): [True: 64, False: 46]
  |  |  ------------------
  |  |11498|     64|        const __m128i w0 =                                                   \
  |  |11499|     64|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11500|     64|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11501|     64|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11501:13): [True: 20, False: 44]
  |  |  ------------------
  |  |11502|     20|          i += static_cast<size_t>(                                          \
  |  |11503|     20|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11504|     20|          return;                                                            \
  |  |11505|     20|        }                                                                    \
  |  |11506|     64|        const __m128i w1 =                                                   \
  |  |11507|     44|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11508|     44|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11509|     44|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11509:13): [True: 23, False: 21]
  |  |  ------------------
  |  |11510|     23|          i += 16 + static_cast<size_t>(                                     \
  |  |11511|     23|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11512|     23|          return;                                                            \
  |  |11513|     23|        }                                                                    \
  |  |11514|     44|      }                                                                      \
  |  |11515|     89|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11515:14): [True: 37, False: 33]
  |  |  ------------------
  |  |11516|     37|        const __m128i w =                                                    \
  |  |11517|     37|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11518|     37|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11519|     37|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11519:13): [True: 13, False: 24]
  |  |  ------------------
  |  |11520|     13|          i += static_cast<size_t>(                                          \
  |  |11521|     13|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11522|     13|          return;                                                            \
  |  |11523|     13|        }                                                                    \
  |  |11524|     37|      }                                                                      \
  |  |11525|     46|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11525:11): [True: 33, False: 0]
  |  |  |  Branch (11525:29): [True: 29, False: 4]
  |  |  ------------------
  |  |11526|     29|        const __m128i w =                                                    \
  |  |11527|     29|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11528|     29|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11529|     29|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11529:13): [True: 21, False: 8]
  |  |  ------------------
  |  |11530|     21|          const size_t hit = len - 16 +                                      \
  |  |11531|     21|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11532|     21|                                 static_cast<uint32_t>(mask)));              \
  |  |11533|     21|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11533:15): [True: 21, False: 0]
  |  |  ------------------
  |  |11534|     21|            i = hit;                                                         \
  |  |11535|     21|            return;                                                          \
  |  |11536|     21|          }                                                                  \
  |  |11537|     21|        }                                                                    \
  |  |11538|     29|        i = len;                                                             \
  |  |11539|      8|        return;                                                              \
  |  |11540|     29|      }                                                                      \
  |  |11541|     33|    }                                                                        \
  |  |11542|    576|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11542:12): [True: 470, False: 106]
  |  |  ------------------
  |  |11543|    470|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11543:11): [True: 16, False: 454]
  |  |  ------------------
  |  |11544|     16|        return;                                                              \
  |  |11545|     16|      }                                                                      \
  |  |11546|    470|    }                                                                        \
  |  |11547|    122|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11547:12): [Folded, False: 106]
  |  |  ------------------
  ------------------
11636|    207|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_120path_has_dot_segmentENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
11640|    310|bool path_has_dot_segment(std::string_view path) noexcept {
11641|    310|  if (path.empty()) {
  ------------------
  |  Branch (11641:7): [True: 0, False: 310]
  ------------------
11642|      0|    return false;
11643|      0|  }
11644|       |  // "." / ".." at the start, with or without a leading '/'.
11645|    310|  const size_t i = (path[0] == '/') ? 1 : 0;
  ------------------
  |  Branch (11645:20): [True: 310, False: 0]
  ------------------
11646|    310|  if (i < path.size() && path[i] == '.') {
  ------------------
  |  Branch (11646:7): [True: 310, False: 0]
  |  Branch (11646:26): [True: 133, False: 177]
  ------------------
11647|    133|    const size_t after = i + 1;
11648|    133|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (11648:9): [True: 1, False: 132]
  |  Branch (11648:33): [True: 29, False: 103]
  ------------------
11649|    103|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (11649:10): [True: 103, False: 0]
  |  Branch (11649:33): [True: 34, False: 69]
  ------------------
11650|     39|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (11650:11): [True: 1, False: 33]
  |  Branch (11650:39): [True: 8, False: 25]
  ------------------
11651|     39|      return true;
11652|     39|    }
11653|    133|  }
11654|    271|  static constexpr std::string_view slash_dot{"/.", 2};
11655|    271|  size_t p = i;
11656|    505|  while ((p = path.find(slash_dot, p)) != std::string_view::npos) {
  ------------------
  |  Branch (11656:10): [True: 363, False: 142]
  ------------------
11657|    363|    const size_t after = p + 2;
11658|    363|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (11658:9): [True: 4, False: 359]
  |  Branch (11658:33): [True: 42, False: 317]
  ------------------
11659|    317|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (11659:10): [True: 317, False: 0]
  |  Branch (11659:33): [True: 164, False: 153]
  ------------------
11660|    164|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (11660:11): [True: 23, False: 141]
  |  Branch (11660:39): [True: 60, False: 81]
  ------------------
11661|    129|      return true;
11662|    129|    }
11663|    234|    p = after;
11664|    234|  }
11665|    142|  return false;
11666|    271|}
serializers.cc:_ZN12_GLOBAL__N_132apply_shifted_non_scheme_offsetsERN3ada14url_componentsEj:
13637|  11.9k|    ada::url_components& components, uint32_t new_difference) {
13638|  11.9k|  components.username_end += new_difference;
13639|  11.9k|  components.host_start += new_difference;
13640|  11.9k|  components.host_end += new_difference;
13641|  11.9k|  components.pathname_start += new_difference;
13642|  11.9k|  if (components.search_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13642:7): [True: 0, False: 11.9k]
  ------------------
13643|      0|    components.search_start += new_difference;
13644|      0|  }
13645|  11.9k|  if (components.hash_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13645:7): [True: 0, False: 11.9k]
  ------------------
13646|      0|    components.hash_start += new_difference;
13647|      0|  }
13648|  11.9k|}
_ZN3ada14url_aggregator10parse_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14007|    899|ada_really_inline void url_aggregator::parse_path(std::string_view input) {
14008|    899|  ada_log("url_aggregator::parse_path ", input);
14009|    899|  ADA_ASSERT_TRUE(validate());
14010|    899|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14011|    899|  std::string tmp_buffer;
14012|    899|  std::string_view internal_input;
14013|    899|  if (unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (14013:7): [True: 0, False: 899]
  ------------------
14014|      0|    tmp_buffer = input;
14015|       |    // Optimization opportunity: Instead of copying and then pruning, we could
14016|       |    // just directly build the string from user_input.
14017|      0|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
14018|      0|    internal_input = tmp_buffer;
14019|    899|  } else {
14020|    899|    internal_input = input;
14021|    899|  }
14022|       |
14023|       |  // If url is special, then:
14024|    899|  if (is_special()) {
  ------------------
  |  Branch (14024:7): [True: 899, False: 0]
  ------------------
14025|    899|    if (internal_input.empty()) {
  ------------------
  |  Branch (14025:9): [True: 157, False: 742]
  ------------------
14026|    157|      update_base_pathname("/");
14027|    742|    } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) {
  ------------------
  |  Branch (14027:16): [True: 742, False: 0]
  |  Branch (14027:46): [True: 0, False: 0]
  ------------------
14028|    742|      consume_prepared_path(internal_input.substr(1));
14029|    742|    } else {
14030|      0|      consume_prepared_path(internal_input);
14031|      0|    }
14032|    899|  } else if (!internal_input.empty()) {
  ------------------
  |  Branch (14032:14): [True: 0, False: 0]
  ------------------
14033|      0|    if (internal_input[0] == '/') {
  ------------------
  |  Branch (14033:9): [True: 0, False: 0]
  ------------------
14034|      0|      consume_prepared_path(internal_input.substr(1));
14035|      0|    } else {
14036|      0|      consume_prepared_path(internal_input);
14037|      0|    }
14038|      0|  } else {
14039|       |    // Non-special URLs with an empty host can have their paths erased
14040|       |    // Path-only URLs cannot have their paths erased
14041|      0|    if (components.host_start == components.host_end && !has_authority()) {
  ------------------
  |  Branch (14041:9): [True: 0, False: 0]
  |  Branch (14041:57): [True: 0, False: 0]
  ------------------
14042|      0|      update_base_pathname("/");
14043|      0|    }
14044|      0|  }
14045|    899|  ADA_ASSERT_TRUE(validate());
14046|    899|}
_ZN3ada14url_aggregator10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14126|  11.8k|ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
14127|  11.8k|  ada_log("url_aggregator:parse_host \"", input, "\" [", input.size(),
14128|  11.8k|          " bytes]");
14129|  11.8k|  ADA_ASSERT_TRUE(validate());
14130|  11.8k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14131|  11.8k|  if (input.empty()) {
  ------------------
  |  Branch (14131:7): [True: 3, False: 11.8k]
  ------------------
14132|      3|    return is_valid = false;
14133|      3|  }  // technically unnecessary.
14134|       |  // If input starts with U+005B ([), then:
14135|  11.8k|  if (input[0] == '[') {
  ------------------
  |  Branch (14135:7): [True: 7.16k, False: 4.72k]
  ------------------
14136|       |    // If input does not end with U+005D (]), validation error, return failure.
14137|  7.16k|    if (input.back() != ']') {
  ------------------
  |  Branch (14137:9): [True: 71, False: 7.09k]
  ------------------
14138|     71|      return is_valid = false;
14139|     71|    }
14140|  7.09k|    ada_log("parse_host ipv6");
14141|       |
14142|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
14143|       |    // trailing U+005D (]) removed.
14144|  7.09k|    input.remove_prefix(1);
14145|  7.09k|    input.remove_suffix(1);
14146|  7.09k|    return parse_ipv6(input);
14147|  7.16k|  }
14148|       |
14149|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
14150|       |  // input.
14151|  4.72k|  if (!is_special()) {
  ------------------
  |  Branch (14151:7): [True: 0, False: 4.72k]
  ------------------
14152|      0|    return parse_opaque_host(input);
14153|      0|  }
14154|       |  // Let domain be the result of running UTF-8 decode without BOM on the
14155|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
14156|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
14157|       |  // which case we do not need to call the expensive 'to_ascii' if a few
14158|       |  // conditions are met: no '%' and no 'xn-' subsequence.
14159|       |
14160|       |  // Often, the input does not contain any forbidden code points, and no upper
14161|       |  // case ASCII letter, then we can just copy it to the buffer. We want to
14162|       |  // optimize for such a common case.
14163|       |
14164|       |  // Fast path: try to parse as pure decimal IPv4 first.
14165|  4.72k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
14166|  4.72k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (14166:7): [True: 291, False: 4.43k]
  ------------------
14167|    291|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (14167:9): [True: 291, False: 0]
  |  Branch (14167:27): [True: 2, False: 289]
  ------------------
14168|      2|      update_base_hostname(input.substr(0, input.size() - 1));
14169|    289|    } else {
14170|    289|      update_base_hostname(input);
14171|    289|    }
14172|    291|    host_type = IPV4;
14173|    291|    is_valid = true;
14174|    291|    ada_log("parse_host fast path decimal ipv4");
14175|    291|    ADA_ASSERT_TRUE(validate());
14176|    291|    return true;
14177|    291|  }
14178|  4.43k|  uint8_t is_forbidden_or_upper =
14179|  4.43k|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
14180|  4.43k|                                                             input.size());
14181|  4.43k|  static constexpr std::string_view xn_dash{"xn-", 3};
14182|  4.43k|  if ((is_forbidden_or_upper & 1) == 0) {
  ------------------
  |  Branch (14182:7): [True: 1.58k, False: 2.84k]
  ------------------
14183|  1.58k|    if ((is_forbidden_or_upper & 2) != 0) {
  ------------------
  |  Branch (14183:9): [True: 362, False: 1.22k]
  ------------------
14184|    362|      std::string lowered(input);
14185|    362|      unicode::to_lower_ascii(lowered.data(), lowered.size());
14186|    362|      if (lowered.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14186:11): [True: 269, False: 93]
  ------------------
14187|    324|          lowered.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14187:11): [True: 55, False: 38]
  ------------------
14188|    324|        update_base_hostname(lowered);
14189|    324|        if (checkers::is_ipv4(lowered)) {
  ------------------
  |  Branch (14189:13): [True: 171, False: 153]
  ------------------
14190|    171|          ada_log("parse_host fast path ipv4");
14191|    171|          return parse_ipv4(lowered, true);
14192|    171|        }
14193|    153|        ada_log("parse_host fast path ", get_hostname());
14194|    153|        is_valid = true;
14195|    153|        return true;
14196|    324|      }
14197|  1.22k|    } else if (input.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14197:16): [True: 1.12k, False: 98]
  ------------------
14198|  1.19k|               input.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14198:16): [True: 63, False: 35]
  ------------------
14199|  1.19k|      update_base_hostname(input);
14200|  1.19k|      if (checkers::is_ipv4(input)) {
  ------------------
  |  Branch (14200:11): [True: 964, False: 227]
  ------------------
14201|    964|        ada_log("parse_host fast path ipv4");
14202|    964|        return parse_ipv4(input, true);
14203|    964|      }
14204|    227|      ada_log("parse_host fast path ", get_hostname());
14205|    227|      is_valid = true;
14206|    227|      return true;
14207|  1.19k|    }
14208|  2.84k|  } else if (const size_t first_percent = input.find('%');
14209|  2.84k|             first_percent != std::string_view::npos) {
  ------------------
  |  Branch (14209:14): [True: 344, False: 2.49k]
  ------------------
14210|    344|    std::string decoded = unicode::percent_decode(input, first_percent);
14211|    344|    const uint8_t decoded_flags =
14212|    344|        unicode::contains_forbidden_domain_code_point_or_upper(decoded.data(),
14213|    344|                                                               decoded.size());
14214|    344|    if ((decoded_flags & 1) == 0) {
  ------------------
  |  Branch (14214:9): [True: 214, False: 130]
  ------------------
14215|    214|      if ((decoded_flags & 2) != 0) {
  ------------------
  |  Branch (14215:11): [True: 66, False: 148]
  ------------------
14216|     66|        unicode::to_lower_ascii(decoded.data(), decoded.size());
14217|     66|      }
14218|    214|      if (decoded.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14218:11): [True: 183, False: 31]
  ------------------
14219|    197|          decoded.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14219:11): [True: 14, False: 17]
  ------------------
14220|    197|        update_base_hostname(decoded);
14221|    197|        if (checkers::is_ipv4(decoded)) {
  ------------------
  |  Branch (14221:13): [True: 101, False: 96]
  ------------------
14222|    101|          return parse_ipv4(decoded, true);
14223|    101|        }
14224|     96|        is_valid = true;
14225|     96|        return true;
14226|    197|      }
14227|    214|    }
14228|    344|  }
14229|       |  // We have encountered at least one forbidden code point or the input contains
14230|       |  // 'xn-' (case insensitive), so we need to call 'to_ascii' to perform the full
14231|       |  // conversion.
14232|       |
14233|  2.71k|  ada_log("parse_host calling to_ascii");
14234|  2.71k|  std::optional<std::string> host = std::string(get_hostname());
14235|  2.71k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
14236|  2.71k|  if (!is_valid) {
  ------------------
  |  Branch (14236:7): [True: 1.48k, False: 1.23k]
  ------------------
14237|  1.48k|    ada_log("parse_host to_ascii returns false");
14238|  1.48k|    return is_valid = false;
14239|  1.48k|  }
14240|  1.23k|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
14241|  1.23k|          " bytes]");
14242|       |
14243|  1.23k|  if (std::ranges::any_of(host.value(),
  ------------------
  |  Branch (14243:7): [True: 0, False: 1.23k]
  ------------------
14244|  1.23k|                          ada::unicode::is_forbidden_domain_code_point)) {
14245|      0|    return is_valid = false;
14246|      0|  }
14247|       |
14248|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
14249|       |  // asciiDomain.
14250|  1.23k|  if (checkers::is_ipv4(host.value())) {
  ------------------
  |  Branch (14250:7): [True: 1.05k, False: 176]
  ------------------
14251|  1.05k|    ada_log("parse_host got ipv4 ", *host);
14252|  1.05k|    return parse_ipv4(host.value(), false);
14253|  1.05k|  }
14254|       |
14255|    176|  update_base_hostname(host.value());
14256|    176|  ADA_ASSERT_TRUE(validate());
14257|    176|  return true;
14258|  1.23k|}
_ZN3ada14url_aggregator21consume_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15077|  1.80k|inline void url_aggregator::consume_prepared_path(std::string_view input) {
15078|  1.80k|  ada_log("url_aggregator::consume_prepared_path ", input);
15079|       |  /***
15080|       |   * This is largely duplicated code from helpers::parse_prepared_path, which is
15081|       |   * unfortunate. This particular function is nearly identical, except that it
15082|       |   * is a method on url_aggregator. The idea is that the trivial path (which is
15083|       |   * very common) merely appends to the buffer. This is the same trivial path as
15084|       |   * with helpers::parse_prepared_path, except that we have the additional check
15085|       |   * for is_at_path(). Otherwise, we grab a copy of the current path and we
15086|       |   * modify it, and then insert it back into the buffer.
15087|       |   */
15088|  1.80k|  uint8_t accumulator = checkers::path_signature(input);
15089|       |  // Let us first detect a trivial case.
15090|       |  // If it is special, we check that we have no dot, no %,  no \ and no
15091|       |  // character needing percent encoding. Otherwise, we check that we have no %,
15092|       |  // no dot, and no character needing percent encoding.
15093|  1.80k|  constexpr uint8_t need_encoding = 1;
15094|  1.80k|  constexpr uint8_t backslash_char = 2;
15095|  1.80k|  constexpr uint8_t dot_char = 4;
15096|  1.80k|  constexpr uint8_t percent_char = 8;
15097|  1.80k|  bool special = type != ada::scheme::NOT_SPECIAL;
15098|  1.80k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (15098:39): [True: 0, False: 1.80k]
  ------------------
15099|      0|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (15099:39): [True: 0, False: 0]
  ------------------
15100|  1.80k|  bool trivial_path =
15101|  1.80k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (15101:7): [True: 687, False: 1.11k]
  |  Branch (15101:8): [True: 1.80k, False: 0]
  ------------------
15102|  1.80k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
15103|      0|                  0)) &&
15104|    687|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (15104:7): [True: 687, False: 0]
  ------------------
15105|  1.80k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (15105:7): [True: 485, False: 1.31k]
  |  Branch (15105:34): [True: 485, False: 0]
  ------------------
15106|       |    // '4' means that we have at least one dot, but nothing that requires
15107|       |    // percent encoding or decoding. The only part that is not trivial is
15108|       |    // that we may have single dots and double dots path segments.
15109|       |    // If we have such segments, then we either have a path that begins
15110|       |    // with '.' (easy to check), or we have the sequence './'.
15111|       |    // Note: input cannot be empty, it must at least contain one character ('.')
15112|       |    // Note: we know that '\' is not present.
15113|    485|    if (input[0] != '.') {
  ------------------
  |  Branch (15113:9): [True: 219, False: 266]
  ------------------
15114|    219|      size_t slashdot = 0;
15115|    219|      bool dot_is_file = true;
15116|    884|      for (;;) {
15117|    884|        slashdot = input.find("/.", slashdot);
15118|    884|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (15118:13): [True: 219, False: 665]
  ------------------
15119|    219|          break;
15120|    665|        } else {  // uncommon
15121|       |          // only three cases matter: /./, /.. or a final /
15122|    665|          slashdot += 2;
15123|    665|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (15123:28): [True: 6, False: 659]
  |  Branch (15123:56): [True: 348, False: 311]
  ------------------
15124|    311|                           input[slashdot] == '/');
  ------------------
  |  Branch (15124:28): [True: 170, False: 141]
  ------------------
15125|    665|        }
15126|    884|      }
15127|    219|      trivial_path = dot_is_file;
15128|    219|    }
15129|    485|  }
15130|  1.80k|  if (trivial_path && is_at_path()) {
  ------------------
  |  Branch (15130:7): [True: 729, False: 1.07k]
  |  Branch (15130:23): [True: 729, False: 0]
  ------------------
15131|    729|    ada_log("parse_path trivial");
15132|    729|    buffer += '/';
15133|    729|    buffer += input;
15134|    729|    return;
15135|    729|  }
15136|  1.07k|  std::string path = std::string(get_pathname());
15137|       |  // We are going to need to look a bit at the path, but let us see if we can
15138|       |  // ignore percent encoding *and* backslashes *and* percent characters.
15139|       |  // Except for the trivial case, this is likely to capture 99% of paths out
15140|       |  // there.
15141|  1.07k|  bool fast_path =
15142|  1.07k|      (special &&
  ------------------
  |  Branch (15142:8): [True: 1.07k, False: 0]
  ------------------
15143|  1.07k|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (15143:8): [True: 443, False: 631]
  ------------------
15144|    443|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (15144:7): [True: 443, False: 0]
  ------------------
15145|  1.07k|  if (fast_path) {
  ------------------
  |  Branch (15145:7): [True: 443, False: 631]
  ------------------
15146|    443|    ada_log("parse_prepared_path fast");
15147|       |    // Here we don't need to worry about \ or percent encoding.
15148|       |    // We also do not have a file protocol. We might have dots, however,
15149|       |    // but dots must as appear as '.', and they cannot be encoded because
15150|       |    // the symbol '%' is not present.
15151|    443|    size_t previous_location = 0;  // We start at 0.
15152|  2.71k|    do {
15153|  2.71k|      size_t new_location = input.find('/', previous_location);
15154|       |      // std::string_view path_view = input;
15155|       |      //  We process the last segment separately:
15156|  2.71k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (15156:11): [True: 443, False: 2.26k]
  ------------------
15157|    443|        std::string_view path_view = input.substr(previous_location);
15158|    443|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (15158:13): [True: 33, False: 410]
  ------------------
15159|       |          // e.g., if you receive ".." with an empty path, you go to "/".
15160|     33|          if (path.empty()) {
  ------------------
  |  Branch (15160:15): [True: 2, False: 31]
  ------------------
15161|      2|            path = '/';
15162|      2|            update_base_pathname(path);
15163|      2|            return;
15164|      2|          }
15165|       |          // Fast case where we have nothing to do:
15166|     31|          if (path.back() == '/') {
  ------------------
  |  Branch (15166:15): [True: 5, False: 26]
  ------------------
15167|      5|            update_base_pathname(path);
15168|      5|            return;
15169|      5|          }
15170|       |          // If you have the path "/joe/myfriend",
15171|       |          // then you delete 'myfriend'.
15172|     26|          path.resize(path.rfind('/') + 1);
15173|     26|          update_base_pathname(path);
15174|     26|          return;
15175|     31|        }
15176|    410|        path += '/';
15177|    410|        if (path_view != ".") {
  ------------------
  |  Branch (15177:13): [True: 402, False: 8]
  ------------------
15178|    402|          path.append(path_view);
15179|    402|        }
15180|    410|        update_base_pathname(path);
15181|    410|        return;
15182|  2.26k|      } else {
15183|       |        // This is a non-final segment.
15184|  2.26k|        std::string_view path_view =
15185|  2.26k|            input.substr(previous_location, new_location - previous_location);
15186|  2.26k|        previous_location = new_location + 1;
15187|  2.26k|        if (path_view == "..") {
  ------------------
  |  Branch (15187:13): [True: 404, False: 1.86k]
  ------------------
15188|    404|          size_t last_delimiter = path.rfind('/');
15189|    404|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (15189:15): [True: 184, False: 220]
  ------------------
15190|    184|            path.erase(last_delimiter);
15191|    184|          }
15192|  1.86k|        } else if (path_view != ".") {
  ------------------
  |  Branch (15192:20): [True: 1.54k, False: 318]
  ------------------
15193|  1.54k|          path += '/';
15194|  1.54k|          path.append(path_view);
15195|  1.54k|        }
15196|  2.26k|      }
15197|  2.71k|    } while (true);
  ------------------
  |  Branch (15197:14): [True: 2.26k, Folded]
  ------------------
15198|    631|  } else {
15199|    631|    ada_log("parse_path slow");
15200|       |    // we have reached the general case
15201|    631|    bool needs_percent_encoding = (accumulator & 1);
15202|    631|    std::string path_buffer_tmp;
15203|  4.15k|    do {
15204|  4.15k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (15204:26): [True: 4.15k, False: 0]
  |  Branch (15204:37): [True: 189, False: 3.96k]
  ------------------
15205|  4.15k|                            ? input.find_first_of("/\\")
15206|  4.15k|                            : input.find('/');
15207|  4.15k|      std::string_view path_view = input;
15208|  4.15k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (15208:11): [True: 3.52k, False: 631]
  ------------------
15209|  3.52k|        path_view.remove_suffix(path_view.size() - location);
15210|  3.52k|        input.remove_prefix(location + 1);
15211|  3.52k|      }
15212|       |      // path_buffer is either path_view or it might point at a percent encoded
15213|       |      // temporary string.
15214|  4.15k|      std::string_view path_buffer =
15215|  4.15k|          (needs_percent_encoding &&
  ------------------
  |  Branch (15215:12): [True: 3.49k, False: 660]
  ------------------
15216|  3.49k|           ada::unicode::percent_encode<false>(
  ------------------
  |  Branch (15216:12): [True: 1.11k, False: 2.38k]
  ------------------
15217|  3.49k|               path_view, character_sets::PATH_PERCENT_ENCODE, path_buffer_tmp))
15218|  4.15k|              ? path_buffer_tmp
15219|  4.15k|              : path_view;
15220|  4.15k|      if (unicode::is_double_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (15220:11): [True: 339, False: 3.81k]
  ------------------
15221|    339|        helpers::shorten_path(path, type);
15222|    339|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (15222:13): [True: 11, False: 328]
  ------------------
15223|     11|          path += '/';
15224|     11|        }
15225|  3.81k|      } else if (unicode::is_single_dot_path_segment(path_buffer) &&
  ------------------
  |  Branch (15225:18): [True: 286, False: 3.53k]
  ------------------
15226|    286|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (15226:18): [True: 18, False: 268]
  ------------------
15227|     18|        path += '/';
15228|     18|      }
15229|       |      // Otherwise, if path_buffer is not a single-dot path segment, then:
15230|  3.80k|      else if (!unicode::is_single_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (15230:16): [True: 3.53k, False: 268]
  ------------------
15231|       |        // If url's scheme is "file", url's path is empty, and path_buffer is a
15232|       |        // Windows drive letter, then replace the second code point in
15233|       |        // path_buffer with U+003A (:).
15234|  3.53k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (15234:13): [True: 0, False: 3.53k]
  |  Branch (15234:48): [True: 0, False: 0]
  ------------------
15235|      0|            checkers::is_windows_drive_letter(path_buffer)) {
  ------------------
  |  Branch (15235:13): [True: 0, False: 0]
  ------------------
15236|      0|          path += '/';
15237|      0|          path += path_buffer[0];
15238|      0|          path += ':';
15239|      0|          path_buffer.remove_prefix(2);
15240|      0|          path.append(path_buffer);
15241|  3.53k|        } else {
15242|       |          // Append path_buffer to url's path.
15243|  3.53k|          path += '/';
15244|  3.53k|          path.append(path_buffer);
15245|  3.53k|        }
15246|  3.53k|      }
15247|  4.15k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (15247:11): [True: 631, False: 3.52k]
  ------------------
15248|    631|        update_base_pathname(path);
15249|    631|        return;
15250|    631|      }
15251|  4.15k|    } while (true);
  ------------------
  |  Branch (15251:14): [True: 3.52k, Folded]
  ------------------
15252|    631|  }
15253|  1.07k|}
_ZN3ada8checkers7is_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   12|  9.04k|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.04k|  if (!last_label_may_be_a_number(view)) {
  ------------------
  |  Branch (14:7): [True: 773, False: 8.26k]
  ------------------
   15|    773|    return false;
   16|    773|  }
   17|       |  // If the address ends with a dot, we need to prune it (special case).
   18|  8.26k|  if (view.ends_with('.')) {
  ------------------
  |  Branch (18:7): [True: 148, False: 8.12k]
  ------------------
   19|    148|    view.remove_suffix(1);
   20|    148|  }
   21|       |  // From the last character, find the last dot.
   22|  8.26k|  size_t last_dot = view.rfind('.');
   23|  8.26k|  if (last_dot != std::string_view::npos) {
  ------------------
  |  Branch (23:7): [True: 7.32k, False: 941]
  ------------------
   24|       |    // We have at least one dot.
   25|  7.32k|    view.remove_prefix(last_dot + 1);
   26|  7.32k|  }
   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.26k|  if (std::ranges::all_of(view, ada::checkers::is_digit)) {
  ------------------
  |  Branch (30:7): [True: 7.68k, False: 589]
  ------------------
   31|  7.68k|    return true;
   32|  7.68k|  }
   33|       |  // It could be hex (0x), but not if there is a single character.
   34|    589|  if (view.size() == 1) {
  ------------------
  |  Branch (34:7): [True: 0, False: 589]
  ------------------
   35|      0|    return false;
   36|      0|  }
   37|       |  // It must start with 0x.
   38|    589|  if (!view.starts_with("0x")) {
  ------------------
  |  Branch (38:7): [True: 83, False: 506]
  ------------------
   39|     83|    return false;
   40|     83|  }
   41|       |  // We must allow "0x".
   42|    506|  if (view.size() == 2) {
  ------------------
  |  Branch (42:7): [True: 48, False: 458]
  ------------------
   43|     48|    return true;
   44|     48|  }
   45|       |  // We have 0x followed by some characters, we need to check that they are
   46|       |  // hexadecimals.
   47|    458|  view.remove_prefix(2);
   48|    458|  return std::ranges::all_of(view, ada::unicode::is_lowercase_hex);
   49|    506|}
_ZN3ada7unicode16is_lowercase_hexEc:
 7168|  5.81k|ada_really_inline constexpr bool is_lowercase_hex(const char c) noexcept {
 7169|  5.81k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7169:11): [True: 5.81k, False: 0]
  |  Branch (7169:23): [True: 2.95k, False: 2.86k]
  |  Branch (7169:37): [True: 2.85k, False: 4]
  |  Branch (7169:49): [True: 2.83k, False: 18]
  ------------------
 7170|  5.81k|}
_ZN3ada8checkers14path_signatureENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   75|  8.77k|    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.77k|  size_t i = 0;
   82|  8.77k|  uint8_t accumulator{};
   83|  25.8k|  for (; i + 7 < input.size(); i += 8) {
  ------------------
  |  Branch (83:10): [True: 17.0k, False: 8.77k]
  ------------------
   84|  17.0k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])] |
   85|  17.0k|                           path_signature_table[uint8_t(input[i + 1])] |
   86|  17.0k|                           path_signature_table[uint8_t(input[i + 2])] |
   87|  17.0k|                           path_signature_table[uint8_t(input[i + 3])] |
   88|  17.0k|                           path_signature_table[uint8_t(input[i + 4])] |
   89|  17.0k|                           path_signature_table[uint8_t(input[i + 5])] |
   90|  17.0k|                           path_signature_table[uint8_t(input[i + 6])] |
   91|  17.0k|                           path_signature_table[uint8_t(input[i + 7])]);
   92|  17.0k|  }
   93|  35.2k|  for (; i < input.size(); i++) {
  ------------------
  |  Branch (93:10): [True: 26.4k, False: 8.77k]
  ------------------
   94|  26.4k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])]);
   95|  26.4k|  }
   96|  8.77k|  return accumulator;
   97|  8.77k|}
_ZN3ada7unicode45contains_forbidden_domain_code_point_or_upperEPKcm:
 7049|  11.7k|                                              size_t length) noexcept {
 7050|  11.7k|  size_t i = 0;
 7051|  11.7k|  uint8_t accumulator{};
 7052|  61.5k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7052:10): [True: 49.8k, False: 11.7k]
  ------------------
 7053|  49.8k|    accumulator |=
 7054|  49.8k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7055|  49.8k|    accumulator |=
 7056|  49.8k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 1])];
 7057|  49.8k|    accumulator |=
 7058|  49.8k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 2])];
 7059|  49.8k|    accumulator |=
 7060|  49.8k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 3])];
 7061|  49.8k|  }
 7062|  27.5k|  for (; i < length; i++) {
  ------------------
  |  Branch (7062:10): [True: 15.8k, False: 11.7k]
  ------------------
 7063|  15.8k|    accumulator |=
 7064|  15.8k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7065|  15.8k|  }
 7066|  11.7k|  return accumulator;
 7067|  11.7k|}
_ZN3ada14url_aggregator23parse_scheme_with_colonILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
13655|  11.9k|    const std::string_view input_with_colon) {
13656|  11.9k|  ada_log("url_aggregator::parse_scheme_with_colon ", input_with_colon);
13657|  11.9k|  ADA_ASSERT_TRUE(validate());
13658|  11.9k|  ADA_ASSERT_TRUE(!helpers::overlaps(input_with_colon, buffer));
13659|  11.9k|  std::string_view input{input_with_colon};
13660|  11.9k|  input.remove_suffix(1);
13661|  11.9k|  auto parsed_type = ada::scheme::get_scheme_type(input);
13662|  11.9k|  const bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
13663|       |  /**
13664|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
13665|       |   *http, https), in which case, we can go really fast.
13666|       |   **/
13667|  11.9k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (13667:7): [True: 11.9k, False: 0]
  ------------------
13668|       |    if constexpr (has_state_override) {
13669|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
13670|       |      // then return.
13671|       |      if (is_special() != is_input_special) {
13672|       |        return false;
13673|       |      }
13674|       |
13675|       |      // If url includes credentials or has a non-null port, and buffer is
13676|       |      // "file", then return.
13677|       |      if ((has_credentials() || components.port != url_components::omitted) &&
13678|       |          parsed_type == ada::scheme::type::FILE) {
13679|       |        return false;
13680|       |      }
13681|       |
13682|       |      // If url's scheme is "file" and its host is an empty host, then return.
13683|       |      // An empty host is the empty string.
13684|       |      if (type == ada::scheme::type::FILE &&
13685|       |          components.host_start == components.host_end) {
13686|       |        return false;
13687|       |      }
13688|       |    }
13689|       |
13690|  11.9k|    type = parsed_type;
13691|  11.9k|    set_scheme_from_view_with_colon(input_with_colon);
13692|       |
13693|       |    if constexpr (has_state_override) {
13694|       |      // This is uncommon.
13695|       |      uint16_t urls_scheme_port = get_special_port();
13696|       |
13697|       |      if (urls_scheme_port) {
13698|       |        // If url's port is url's scheme's default port, then set url's port to
13699|       |        // null.
13700|       |        if (components.port == urls_scheme_port) {
13701|       |          clear_port();
13702|       |        }
13703|       |      }
13704|       |    }
13705|  11.9k|  } else {  // slow path
13706|      0|    std::string _buffer(input);
13707|       |    // Next function is only valid if the input is ASCII and returns false
13708|       |    // otherwise, but it seems that we always have ascii content so we do not
13709|       |    // need to check the return value.
13710|      0|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
13711|       |
13712|       |    if constexpr (has_state_override) {
13713|       |      // The state-override validation errors below ("return" in the WHATWG URL
13714|       |      // parser) leave the URL unchanged. The setter contract is
13715|       |      // "true on success, false if the scheme is invalid" -- the fast path
13716|       |      // above already returns false here, so the slow path must agree.
13717|       |
13718|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
13719|       |      // then return. If url's scheme is not a special scheme and buffer is a
13720|       |      // special scheme, then return.
13721|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
13722|       |        return false;
13723|       |      }
13724|       |
13725|       |      // If url includes credentials or has a non-null port, and buffer is
13726|       |      // "file", then return.
13727|       |      if ((has_credentials() || components.port != url_components::omitted) &&
13728|       |          _buffer == "file") {
13729|       |        return false;
13730|       |      }
13731|       |
13732|       |      // If url's scheme is "file" and its host is an empty host, then return.
13733|       |      // An empty host is the empty string.
13734|       |      if (type == ada::scheme::type::FILE &&
13735|       |          components.host_start == components.host_end) {
13736|       |        return false;
13737|       |      }
13738|       |    }
13739|       |
13740|      0|    set_scheme(_buffer);
13741|       |
13742|       |    if constexpr (has_state_override) {
13743|       |      // This is uncommon.
13744|       |      uint16_t urls_scheme_port = get_special_port();
13745|       |
13746|       |      if (urls_scheme_port) {
13747|       |        // If url's port is url's scheme's default port, then set url's port to
13748|       |        // null.
13749|       |        if (components.port == urls_scheme_port) {
13750|       |          clear_port();
13751|       |        }
13752|       |      }
13753|       |    }
13754|      0|  }
13755|  11.9k|  ADA_ASSERT_TRUE(validate());
13756|  11.9k|  return true;
13757|  11.9k|}
_ZN3ada14url_aggregator31set_scheme_from_view_with_colonENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
13781|  11.9k|    std::string_view new_scheme_with_colon) {
13782|  11.9k|  ada_log("url_aggregator::set_scheme_from_view_with_colon ",
13783|  11.9k|          new_scheme_with_colon);
13784|  11.9k|  ADA_ASSERT_TRUE(validate());
13785|  11.9k|  ADA_ASSERT_TRUE(!new_scheme_with_colon.empty() &&
13786|  11.9k|                  new_scheme_with_colon.back() == ':');
13787|       |  // next line could overflow but unsigned arithmetic has well-defined
13788|       |  // overflows.
13789|  11.9k|  uint32_t new_difference =
13790|  11.9k|      uint32_t(new_scheme_with_colon.size()) - components.protocol_end;
13791|       |
13792|  11.9k|  if (buffer.empty()) {
  ------------------
  |  Branch (13792:7): [True: 11.9k, False: 0]
  ------------------
13793|  11.9k|    buffer.append(new_scheme_with_colon);
13794|  11.9k|  } else {
13795|      0|    buffer.erase(0, components.protocol_end);
13796|      0|    buffer.insert(0, new_scheme_with_colon);
13797|      0|  }
13798|  11.9k|  components.protocol_end += new_difference;
13799|       |
13800|  11.9k|  apply_shifted_non_scheme_offsets(components, new_difference);
13801|  11.9k|  ADA_ASSERT_TRUE(validate());
13802|  11.9k|}

_ZN3ada37url_pattern_compile_component_optionsC2ENSt3__18optionalIcEES3_:
 5755|      6|      : delimiter(new_delimiter), prefix(new_prefix) {}
_ZN3ada14character_sets6bit_atEPKhh:
 1074|   257k|ada_really_inline constexpr bool bit_at(const uint8_t a[], const uint8_t i) {
 1075|   257k|  return !!(a[i >> 3] & (1 << (i & 7)));
 1076|   257k|}
_ZN2tl10unexpectedIN3ada6errorsEEC2EOS2_:
 2189|  21.5k|  constexpr explicit unexpected(E&& e) : m_val(std::move(e)) {}
_ZNR2tl10unexpectedIN3ada6errorsEE5valueEv:
 2203|  10.7k|  TL_EXPECTED_11_CONSTEXPR E& value() & { return m_val; }
_ZN3ada8url_baseD2Ev:
 1693|  15.4k|  virtual ~url_base() = default;
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IS3_TnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_OT_EE5valueEvE4typeELPv0ETnPNS7_IXsr3std14is_convertibleIS9_S3_EE5valueEvE4typeELSD_0EEEONS_10unexpectedIS8_EE:
 3675|  10.7k|      : impl_base(unexpect, std::move(e.value())),
 3676|  10.7k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 2661|  10.7k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada14url_aggregatorENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3279|  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_:
 3761|  2.35k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 3634|  2.35k|      : impl_base(in_place, std::forward<Args>(args)...),
 3635|  2.35k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 2649|  2.35k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada14url_aggregatorC2EOS0_:
 7774|  2.35k|  url_aggregator(url_aggregator&& u) noexcept = default;
_ZN3ada14url_aggregatorD2Ev:
 7777|  15.4k|  ~url_aggregator() override = default;
_ZN3ada6scheme15get_scheme_typeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6789|  11.9k|constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept {
 6790|  11.9k|  if (scheme.empty()) {
  ------------------
  |  Branch (6790:7): [True: 0, False: 11.9k]
  ------------------
 6791|      0|    return ada::scheme::NOT_SPECIAL;
 6792|      0|  }
 6793|  11.9k|  int hash_value = (2 * scheme.size() + (unsigned)(scheme[0])) & 7;
 6794|  11.9k|  const std::string_view target = details::is_special_list[hash_value];
 6795|  11.9k|  if (scheme.size() == target.size() &&
  ------------------
  |  Branch (6795:7): [True: 11.9k, False: 0]
  ------------------
 6796|  11.9k|      details::branchless_load5(scheme.data(), scheme.size()) ==
  ------------------
  |  Branch (6796:7): [True: 11.9k, False: 0]
  ------------------
 6797|  11.9k|          details::scheme_keys[hash_value]) {
 6798|  11.9k|    return ada::scheme::type(hash_value);
 6799|  11.9k|  } else {
 6800|      0|    return ada::scheme::NOT_SPECIAL;
 6801|      0|  }
 6802|  11.9k|}
_ZN3ada6scheme7details16branchless_load5EPKcm:
 6730|  11.9k|inline uint64_t branchless_load5(const char* p, size_t n) {
 6731|  11.9k|  uint64_t input = (uint8_t)p[0];
 6732|  11.9k|  input |= ((uint64_t)(uint8_t)p[n > 1] << 8) & (0 - (uint64_t)(n > 1));
 6733|  11.9k|  input |= ((uint64_t)(uint8_t)p[(n > 2) * 2] << 16) & (0 - (uint64_t)(n > 2));
 6734|  11.9k|  input |= ((uint64_t)(uint8_t)p[(n > 3) * 3] << 24) & (0 - (uint64_t)(n > 3));
 6735|  11.9k|  input |= ((uint64_t)(uint8_t)p[(n > 4) * 4] << 32) & (0 - (uint64_t)(n > 4));
 6736|  11.9k|  return input;
 6737|  11.9k|}
_ZN3ada14url_aggregatorC2Ev:
 7772|  13.1k|  url_aggregator() = default;
_ZN3ada14url_componentsC2Ev:
 4952|  13.1k|  url_components() = default;
_ZN3ada8checkers19try_parse_ipv4_fastENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1446|  14.0k|try_parse_ipv4_fast(std::string_view input) noexcept {
 1447|  14.0k|  const size_t len = input.size();
 1448|       |  // Shortest pure decimal: "0.0.0.0" (7). Longest + trailing dot: 16.
 1449|  14.0k|  if (len < 7 || len > 16) [[unlikely]] {
  ------------------
  |  Branch (1449:7): [True: 9.45k, False: 4.60k]
  |  Branch (1449:18): [True: 1.91k, False: 2.69k]
  ------------------
 1450|  11.3k|    return ipv4_fast_fail;
 1451|  11.3k|  }
 1452|  2.69k|  const char* data = input.data();
 1453|       |
 1454|       |#if defined(ADA_AVX512) && defined(__AVX512VBMI2__)
 1455|       |  return detail::try_parse_ipv4_avx512(data, len);
 1456|       |#else
 1457|  2.69k|  return detail::parse_ipv4_decimal_scalar(data, data + len);
 1458|  14.0k|#endif
 1459|  14.0k|}
_ZN3ada8checkers6detail25parse_ipv4_decimal_scalarEPKcS3_:
 1287|  2.69k|parse_ipv4_decimal_scalar(const char* p, const char* pend) noexcept {
 1288|  2.69k|  uint32_t ipv4 = 0;
 1289|  4.85k|  for (int i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1289:19): [True: 4.35k, False: 498]
  ------------------
 1290|  4.35k|    if (p == pend) [[unlikely]] {
  ------------------
  |  Branch (1290:9): [True: 4, False: 4.35k]
  ------------------
 1291|      4|      return ipv4_fast_fail;
 1292|      4|    }
 1293|  4.35k|    uint32_t val;
 1294|  4.35k|    char c = *p;
 1295|  4.35k|    if (c >= '0' && c <= '9') [[likely]] {
  ------------------
  |  Branch (1295:9): [True: 3.65k, False: 691]
  |  Branch (1295:21): [True: 2.68k, False: 973]
  ------------------
 1296|  2.68k|      val = static_cast<uint32_t>(c - '0');
 1297|  2.68k|      ++p;
 1298|  2.68k|    } else {
 1299|  1.66k|      return ipv4_fast_fail;
 1300|  1.66k|    }
 1301|  2.68k|    if (p < pend) {
  ------------------
  |  Branch (1301:9): [True: 2.49k, False: 187]
  ------------------
 1302|  2.49k|      c = *p;
 1303|  2.49k|      if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1303:11): [True: 1.50k, False: 999]
  |  Branch (1303:23): [True: 1.32k, False: 177]
  ------------------
 1304|  1.32k|        if (val == 0) [[unlikely]] {
  ------------------
  |  Branch (1304:13): [True: 91, False: 1.23k]
  ------------------
 1305|     91|          return ipv4_fast_fail;
 1306|     91|        }
 1307|  1.23k|        val = val * 10u + static_cast<uint32_t>(c - '0');
 1308|  1.23k|        ++p;
 1309|  1.23k|        if (p < pend) {
  ------------------
  |  Branch (1309:13): [True: 1.08k, False: 145]
  ------------------
 1310|  1.08k|          c = *p;
 1311|  1.08k|          if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1311:15): [True: 787, False: 300]
  |  Branch (1311:27): [True: 767, False: 20]
  ------------------
 1312|    767|            val = val * 10u + static_cast<uint32_t>(c - '0');
 1313|    767|            ++p;
 1314|    767|            if (val > 255u) [[unlikely]] {
  ------------------
  |  Branch (1314:17): [True: 149, False: 618]
  ------------------
 1315|    149|              return ipv4_fast_fail;
 1316|    149|            }
 1317|    767|          }
 1318|  1.08k|        }
 1319|  1.23k|      }
 1320|  2.49k|    }
 1321|  2.44k|    ipv4 = (ipv4 << 8) | val;
 1322|  2.44k|    if (i < 3) {
  ------------------
  |  Branch (1322:9): [True: 1.94k, False: 498]
  ------------------
 1323|  1.94k|      if (p == pend || *p != '.') [[unlikely]] {
  ------------------
  |  Branch (1323:11): [True: 25, False: 1.92k]
  |  Branch (1323:24): [True: 262, False: 1.66k]
  ------------------
 1324|    287|        return ipv4_fast_fail;
 1325|    287|      }
 1326|  1.66k|      ++p;
 1327|  1.66k|    }
 1328|  2.44k|  }
 1329|    498|  if (p != pend) {
  ------------------
  |  Branch (1329:7): [True: 60, False: 438]
  ------------------
 1330|     60|    if (p == pend - 1 && *p == '.') {
  ------------------
  |  Branch (1330:9): [True: 34, False: 26]
  |  Branch (1330:26): [True: 3, False: 31]
  ------------------
 1331|      3|      return ipv4;
 1332|      3|    }
 1333|     57|    return ipv4_fast_fail;
 1334|     60|  }
 1335|    438|  return ipv4;
 1336|    498|}
_ZNK3ada8url_base10is_specialEv:
 7272|  45.3k|    const noexcept {
 7273|  45.3k|  return type != ada::scheme::NOT_SPECIAL;
 7274|  45.3k|}
_ZN3ada8checkers8is_alphaEc:
 1267|  18.0k|constexpr bool is_alpha(char x) noexcept {
 1268|  18.0k|  return (to_lower(x) >= 'a') && (to_lower(x) <= 'z');
  ------------------
  |  Branch (1268:10): [True: 14.4k, False: 3.56k]
  |  Branch (1268:34): [True: 14.2k, False: 247]
  ------------------
 1269|  18.0k|}
_ZN3ada8checkers8to_lowerEc:
 1265|  32.4k|constexpr char to_lower(char x) noexcept { return (x | 0x20); }
_ZN3ada8checkers26last_label_may_be_a_numberENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1240|  10.8k|constexpr bool last_label_may_be_a_number(std::string_view view) noexcept {
 1241|  10.8k|  if (view.empty()) {
  ------------------
  |  Branch (1241:7): [True: 0, False: 10.8k]
  ------------------
 1242|      0|    return false;
 1243|      0|  }
 1244|  10.8k|  const char* start = view.data();
 1245|  10.8k|  const char* end = start + view.size();
 1246|  10.8k|  if (end[-1] == '.') {
  ------------------
  |  Branch (1246:7): [True: 414, False: 10.4k]
  ------------------
 1247|    414|    --end;
 1248|    414|    if (end == start) {
  ------------------
  |  Branch (1248:9): [True: 210, False: 204]
  ------------------
 1249|    210|      return false;
 1250|    210|    }
 1251|    414|  }
 1252|  10.6k|  if (!is_ipv4_number_char(end[-1])) {
  ------------------
  |  Branch (1252:7): [True: 1.22k, False: 9.39k]
  ------------------
 1253|  1.22k|    return false;
 1254|  1.22k|  }
 1255|  9.39k|  const char* label = end;
 1256|  34.9k|  while (label != start && is_ipv4_number_char(label[-1])) {
  ------------------
  |  Branch (1256:10): [True: 33.4k, False: 1.49k]
  |  Branch (1256:28): [True: 25.5k, False: 7.90k]
  ------------------
 1257|  25.5k|    --label;
 1258|  25.5k|  }
 1259|  9.39k|  if (label != start && label[-1] != '.') {
  ------------------
  |  Branch (1259:7): [True: 7.90k, False: 1.49k]
  |  Branch (1259:25): [True: 288, False: 7.61k]
  ------------------
 1260|    288|    return false;
 1261|    288|  }
 1262|  9.11k|  return label != end && is_digit(*label);
  ------------------
  |  Branch (1262:10): [True: 9.11k, False: 0]
  |  Branch (1262:26): [True: 8.54k, False: 568]
  ------------------
 1263|  9.39k|}
_ZN3ada8checkers19is_ipv4_number_charEc:
 1234|  44.0k|constexpr bool is_ipv4_number_char(char x) noexcept {
 1235|  44.0k|  const unsigned char c = static_cast<unsigned char>(x);
 1236|  44.0k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
  ------------------
  |  Branch (1236:11): [True: 35.9k, False: 8.10k]
  |  Branch (1236:23): [True: 26.5k, False: 9.37k]
  |  Branch (1236:37): [True: 8.74k, False: 8.73k]
  |  Branch (1236:49): [True: 5.45k, False: 3.28k]
  ------------------
 1237|  12.0k|         (c >= 'A' && c <= 'F') || c == 'x' || c == 'X';
  ------------------
  |  Branch (1237:11): [True: 3.82k, False: 8.20k]
  |  Branch (1237:23): [True: 236, False: 3.58k]
  |  Branch (1237:36): [True: 2.42k, False: 9.36k]
  |  Branch (1237:48): [True: 242, False: 9.12k]
  ------------------
 1238|  44.0k|}
_ZN3ada8checkers8is_digitEc:
 1232|  23.7k|constexpr bool is_digit(char x) noexcept { return (x >= '0') & (x <= '9'); }
_ZN3ada6scheme16get_special_portENS0_4typeE:
 6786|    299|constexpr uint16_t get_special_port(ada::scheme::type type) noexcept {
 6787|    299|  return details::special_ports[int(type)];
 6788|    299|}
_ZN3ada14url_aggregator20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8497|  1.29k|inline void url_aggregator::update_base_pathname(const std::string_view input) {
 8498|  1.29k|  ada_log("url_aggregator::update_base_pathname '", input, "' [", input.size(),
 8499|  1.29k|          " bytes] \n", to_diagram());
 8500|  1.29k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8501|  1.29k|  ADA_ASSERT_TRUE(validate());
 8502|       |
 8503|  1.29k|  const bool begins_with_dashdash = input.starts_with("//");
 8504|  1.29k|  if (!begins_with_dashdash && has_dash_dot()) {
  ------------------
  |  Branch (8504:7): [True: 1.12k, False: 173]
  |  Branch (8504:32): [True: 0, False: 1.12k]
  ------------------
 8505|       |    // We must delete the ./
 8506|      0|    delete_dash_dot();
 8507|      0|  }
 8508|       |
 8509|  1.29k|  if (begins_with_dashdash && !has_opaque_path && !has_authority() &&
  ------------------
  |  Branch (8509:7): [True: 173, False: 1.12k]
  |  Branch (8509:31): [True: 173, False: 0]
  |  Branch (8509:51): [True: 0, False: 173]
  ------------------
 8510|      0|      !has_dash_dot()) {
  ------------------
  |  Branch (8510:7): [True: 0, False: 0]
  ------------------
 8511|       |    // If url's host is null, url does not have an opaque path, url's path's
 8512|       |    // size is greater than 1, then append U+002F (/) followed by U+002E (.) to
 8513|       |    // output.
 8514|      0|    buffer.insert(components.pathname_start, "/.");
 8515|      0|    components.pathname_start += 2;
 8516|      0|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8516:9): [True: 0, False: 0]
  ------------------
 8517|      0|      components.search_start += 2;
 8518|      0|    }
 8519|      0|    if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8519:9): [True: 0, False: 0]
  ------------------
 8520|      0|      components.hash_start += 2;
 8521|      0|    }
 8522|      0|  }
 8523|       |
 8524|  1.29k|  uint32_t difference = replace_and_resize(
 8525|  1.29k|      components.pathname_start,
 8526|  1.29k|      components.pathname_start + get_pathname_length(), input);
 8527|  1.29k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8527:7): [True: 0, False: 1.29k]
  ------------------
 8528|      0|    components.search_start += difference;
 8529|      0|  }
 8530|  1.29k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8530:7): [True: 0, False: 1.29k]
  ------------------
 8531|      0|    components.hash_start += difference;
 8532|      0|  }
 8533|  1.29k|  ADA_ASSERT_TRUE(validate());
 8534|  1.29k|}
_ZN3ada14url_aggregator18replace_and_resizeEjjNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8339|  4.14k|    uint32_t start, uint32_t end, std::string_view input) {
 8340|  4.14k|  uint32_t current_length = end - start;
 8341|  4.14k|  uint32_t input_size = uint32_t(input.size());
 8342|  4.14k|  uint32_t new_difference = input_size - current_length;
 8343|       |
 8344|  4.14k|  if (current_length == 0) {
  ------------------
  |  Branch (8344:7): [True: 3.31k, False: 828]
  ------------------
 8345|  3.31k|    buffer.insert(start, input);
 8346|  3.31k|  } else if (input_size == current_length) {
  ------------------
  |  Branch (8346:14): [True: 24, False: 804]
  ------------------
 8347|     24|    if (input_size != 0) {
  ------------------
  |  Branch (8347:9): [True: 24, False: 0]
  ------------------
 8348|     24|      std::memmove(buffer.data() + start, input.data(), input_size);
 8349|     24|    }
 8350|    804|  } else if (input_size < current_length) {
  ------------------
  |  Branch (8350:14): [True: 34, False: 770]
  ------------------
 8351|     34|    buffer.erase(start, current_length - input_size);
 8352|     34|    buffer.replace(start, input_size, input);
 8353|    770|  } else {
 8354|    770|    buffer.replace(start, current_length, input.substr(0, current_length));
 8355|    770|    buffer.insert(start + current_length, input.substr(current_length));
 8356|    770|  }
 8357|       |
 8358|  4.14k|  return new_difference;
 8359|  4.14k|}
_ZNK3ada14url_aggregator19get_pathname_lengthEv:
 8390|  1.29k|url_aggregator::get_pathname_length() const noexcept {
 8391|  1.29k|  ada_log("url_aggregator::get_pathname_length");
 8392|  1.29k|  uint32_t ending_index = uint32_t(buffer.size());
 8393|  1.29k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8393:7): [True: 0, False: 1.29k]
  ------------------
 8394|      0|    ending_index = components.search_start;
 8395|  1.29k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8395:14): [True: 0, False: 1.29k]
  ------------------
 8396|      0|    ending_index = components.hash_start;
 8397|      0|  }
 8398|  1.29k|  return ending_index - components.pathname_start;
 8399|  1.29k|}
_ZNK3ada14url_aggregator12get_pathnameEv:
 9332|  1.07k|    ada_lifetime_bound {
 9333|  1.07k|  ada_log("url_aggregator::get_pathname pathname_start = ",
 9334|  1.07k|          components.pathname_start, " buffer.size() = ", buffer.size(),
 9335|  1.07k|          " components.search_start = ", components.search_start,
 9336|  1.07k|          " components.hash_start = ", components.hash_start);
 9337|  1.07k|  auto ending_index = uint32_t(buffer.size());
 9338|  1.07k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9338:7): [True: 0, False: 1.07k]
  ------------------
 9339|      0|    ending_index = components.search_start;
 9340|  1.07k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9340:14): [True: 0, False: 1.07k]
  ------------------
 9341|      0|    ending_index = components.hash_start;
 9342|      0|  }
 9343|  1.07k|  return helpers::substring(buffer, components.pathname_start, ending_index);
 9344|  1.07k|}
_ZN3ada14url_aggregator26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8315|    241|inline void url_aggregator::update_unencoded_base_hash(std::string_view input) {
 8316|    241|  ada_log("url_aggregator::update_unencoded_base_hash ", input, " [",
 8317|    241|          input.size(), " bytes], buffer is '", buffer, "' [", buffer.size(),
 8318|    241|          " bytes] components.hash_start = ", components.hash_start);
 8319|    241|  ADA_ASSERT_TRUE(validate());
 8320|    241|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8321|    241|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8321:7): [True: 0, False: 241]
  ------------------
 8322|      0|    buffer.resize(components.hash_start);
 8323|      0|  }
 8324|    241|  components.hash_start = uint32_t(buffer.size());
 8325|    241|  buffer += "#";
 8326|    241|  bool encoding_required = unicode::percent_encode<true>(
 8327|    241|      input, ada::character_sets::FRAGMENT_PERCENT_ENCODE, buffer);
 8328|       |  // When encoding_required is false, then buffer is left unchanged, and percent
 8329|       |  // encoding was not deemed required.
 8330|    241|  if (!encoding_required) {
  ------------------
  |  Branch (8330:7): [True: 132, False: 109]
  ------------------
 8331|    132|    buffer.append(input);
 8332|    132|  }
 8333|    241|  ada_log("url_aggregator::update_unencoded_base_hash final buffer is '",
 8334|    241|          buffer, "' [", buffer.size(), " bytes]");
 8335|    241|  ADA_ASSERT_TRUE(validate());
 8336|    241|}
_ZNK3ada8url_base19scheme_default_portEv:
 7281|     64|url_base::scheme_default_port() const noexcept {
 7282|     64|  return scheme::get_special_port(type);
 7283|     64|}
_ZN3ada8checkers23is_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1271|  6.96k|constexpr bool is_windows_drive_letter(std::string_view input) noexcept {
 1272|  6.96k|  return input.size() >= 2 &&
  ------------------
  |  Branch (1272:10): [True: 6.02k, False: 946]
  ------------------
 1273|  6.02k|         (is_alpha(input[0]) && ((input[1] == ':') || (input[1] == '|'))) &&
  ------------------
  |  Branch (1273:11): [True: 2.28k, False: 3.73k]
  |  Branch (1273:34): [True: 218, False: 2.06k]
  |  Branch (1273:55): [True: 3, False: 2.06k]
  ------------------
 1274|    221|         ((input.size() == 2) || (input[2] == '/' || input[2] == '\\' ||
  ------------------
  |  Branch (1274:11): [True: 2, False: 219]
  |  Branch (1274:35): [True: 51, False: 168]
  |  Branch (1274:54): [True: 1, False: 167]
  ------------------
 1275|    167|                                  input[2] == '?' || input[2] == '#'));
  ------------------
  |  Branch (1275:35): [True: 18, False: 149]
  |  Branch (1275:54): [True: 4, False: 145]
  ------------------
 1276|  6.96k|}
_ZN3ada8checkers34is_normalized_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1279|  6.96k|    std::string_view input) noexcept {
 1280|  6.96k|  return input.size() == 2 && (is_alpha(input[0]) && (input[1] == ':'));
  ------------------
  |  Branch (1280:10): [True: 104, False: 6.86k]
  |  Branch (1280:32): [True: 29, False: 75]
  |  Branch (1280:54): [True: 1, False: 28]
  ------------------
 1281|  6.96k|}
_ZN3ada7helpers14leading_zeroesEj:
 1978|  12.0k|inline int leading_zeroes(uint32_t input_num) noexcept {
 1979|       |#if ADA_REGULAR_VISUAL_STUDIO
 1980|       |  unsigned long leading_zero(0);
 1981|       |  unsigned long in(input_num);
 1982|       |  return _BitScanReverse(&leading_zero, in) ? int(31 - leading_zero) : 32;
 1983|       |#else
 1984|  12.0k|  return __builtin_clz(input_num);
 1985|  12.0k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 1986|  12.0k|}
_ZN3ada14url_aggregator7reserveEj:
 9005|  11.9k|constexpr void ada::url_aggregator::reserve(uint32_t capacity) {
 9006|  11.9k|  buffer.reserve(capacity);
 9007|  11.9k|}
_ZN3ada14url_aggregator20append_base_passwordENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8723|  1.46k|inline void url_aggregator::append_base_password(const std::string_view input) {
 8724|  1.46k|  ada_log("url_aggregator::append_base_password ", input, " ", to_string(),
 8725|  1.46k|          "\n", to_diagram());
 8726|  1.46k|  ADA_ASSERT_TRUE(validate());
 8727|  1.46k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8728|       |#if ADA_DEVELOPMENT_CHECKS
 8729|       |  // computing the expected password.
 8730|       |  std::string password_expected = std::string(get_password());
 8731|       |  password_expected.append(input);
 8732|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8733|  1.46k|  add_authority_slashes_if_needed();
 8734|       |
 8735|       |  // If input is empty, do nothing.
 8736|  1.46k|  if (input.empty()) {
  ------------------
  |  Branch (8736:7): [True: 621, False: 841]
  ------------------
 8737|    621|    return;
 8738|    621|  }
 8739|       |
 8740|    841|  uint32_t difference = uint32_t(input.size());
 8741|    841|  if (has_password()) {
  ------------------
  |  Branch (8741:7): [True: 768, False: 73]
  ------------------
 8742|    768|    buffer.insert(components.host_start, input);
 8743|    768|  } else {
 8744|     73|    difference++;  // Increment for ":"
 8745|     73|    buffer.insert(components.username_end, ":");
 8746|     73|    buffer.insert(components.username_end + 1, input);
 8747|     73|  }
 8748|    841|  components.host_start += difference;
 8749|       |
 8750|       |  // The following line is required to add "@" to hostname. When updating
 8751|       |  // password if hostname does not start with "@", it is "append_base_password"s
 8752|       |  // responsibility to set it.
 8753|    841|  if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (8753:7): [True: 51, False: 790]
  ------------------
 8754|     51|    buffer.insert(components.host_start, "@");
 8755|     51|    difference++;
 8756|     51|  }
 8757|       |
 8758|    841|  components.host_end += difference;
 8759|    841|  components.pathname_start += difference;
 8760|    841|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8760:7): [True: 0, False: 841]
  ------------------
 8761|      0|    components.search_start += difference;
 8762|      0|  }
 8763|    841|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8763:7): [True: 0, False: 841]
  ------------------
 8764|      0|    components.hash_start += difference;
 8765|      0|  }
 8766|       |#if ADA_DEVELOPMENT_CHECKS
 8767|       |  std::string password_after(get_password());
 8768|       |  ADA_ASSERT_EQUAL(
 8769|       |      password_expected, password_after,
 8770|       |      "append_base_password problem after inserting " + std::string(input));
 8771|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8772|    841|  ADA_ASSERT_TRUE(validate());
 8773|    841|}
_ZN3ada14url_aggregator31add_authority_slashes_if_neededEv:
 8979|  6.18k|inline void ada::url_aggregator::add_authority_slashes_if_needed() {
 8980|  6.18k|  ada_log("url_aggregator::add_authority_slashes_if_needed");
 8981|  6.18k|  ADA_ASSERT_TRUE(validate());
 8982|       |  // Protocol setter will insert `http:` to the URL. It is up to hostname setter
 8983|       |  // to insert
 8984|       |  // `//` initially to the buffer, since it depends on the hostname existence.
 8985|  6.18k|  if (has_authority()) {
  ------------------
  |  Branch (8985:7): [True: 3.94k, False: 2.23k]
  ------------------
 8986|  3.94k|    return;
 8987|  3.94k|  }
 8988|       |  // Performance: the common case is components.protocol_end == buffer.size()
 8989|       |  // Optimization opportunity: in many cases, the "//" is part of the input and
 8990|       |  // the insert could be fused with another insert.
 8991|  2.23k|  buffer.insert(components.protocol_end, "//");
 8992|  2.23k|  components.username_end += 2;
 8993|  2.23k|  components.host_start += 2;
 8994|  2.23k|  components.host_end += 2;
 8995|  2.23k|  components.pathname_start += 2;
 8996|  2.23k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8996:7): [True: 0, False: 2.23k]
  ------------------
 8997|      0|    components.search_start += 2;
 8998|      0|  }
 8999|  2.23k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8999:7): [True: 0, False: 2.23k]
  ------------------
 9000|      0|    components.hash_start += 2;
 9001|      0|  }
 9002|  2.23k|  ADA_ASSERT_TRUE(validate());
 9003|  2.23k|}
_ZN3ada14url_aggregator20append_base_usernameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8607|  1.87k|inline void url_aggregator::append_base_username(const std::string_view input) {
 8608|  1.87k|  ada_log("url_aggregator::append_base_username ", input);
 8609|  1.87k|  ADA_ASSERT_TRUE(validate());
 8610|  1.87k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8611|       |#if ADA_DEVELOPMENT_CHECKS
 8612|       |  // computing the expected password.
 8613|       |  std::string username_expected(get_username());
 8614|       |  username_expected.append(input);
 8615|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8616|  1.87k|  add_authority_slashes_if_needed();
 8617|       |
 8618|       |  // If input is empty, do nothing.
 8619|  1.87k|  if (input.empty()) {
  ------------------
  |  Branch (8619:7): [True: 807, False: 1.07k]
  ------------------
 8620|    807|    return;
 8621|    807|  }
 8622|       |
 8623|  1.07k|  uint32_t difference = uint32_t(input.size());
 8624|  1.07k|  buffer.insert(components.username_end, input);
 8625|  1.07k|  components.username_end += difference;
 8626|  1.07k|  components.host_start += difference;
 8627|       |
 8628|  1.07k|  if (buffer[components.host_start] != '@' &&
  ------------------
  |  Branch (8628:7): [True: 165, False: 907]
  ------------------
 8629|    165|      components.host_start != components.host_end) {
  ------------------
  |  Branch (8629:7): [True: 165, False: 0]
  ------------------
 8630|    165|    buffer.insert(components.host_start, "@");
 8631|    165|    difference++;
 8632|    165|  }
 8633|       |
 8634|  1.07k|  components.host_end += difference;
 8635|  1.07k|  components.pathname_start += difference;
 8636|  1.07k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8636:7): [True: 0, False: 1.07k]
  ------------------
 8637|      0|    components.search_start += difference;
 8638|      0|  }
 8639|  1.07k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8639:7): [True: 0, False: 1.07k]
  ------------------
 8640|      0|    components.hash_start += difference;
 8641|      0|  }
 8642|       |#if ADA_DEVELOPMENT_CHECKS
 8643|       |  std::string username_after(get_username());
 8644|       |  ADA_ASSERT_EQUAL(
 8645|       |      username_expected, username_after,
 8646|       |      "append_base_username problem after inserting " + std::string(input));
 8647|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8648|  1.07k|  ADA_ASSERT_TRUE(validate());
 8649|  1.07k|}
_ZN3ada14url_aggregator16update_base_portEj:
 8775|     37|inline void url_aggregator::update_base_port(uint32_t input) {
 8776|     37|  ada_log("url_aggregator::update_base_port");
 8777|     37|  ADA_ASSERT_TRUE(validate());
 8778|     37|  if (input == url_components::omitted) {
  ------------------
  |  Branch (8778:7): [True: 0, False: 37]
  ------------------
 8779|      0|    clear_port();
 8780|      0|    return;
 8781|      0|  }
 8782|       |  // calling std::to_string(input.value()) is unfortunate given that the port
 8783|       |  // value is probably already available as a string.
 8784|     37|  std::string value = helpers::concat(":", std::to_string(input));
 8785|     37|  uint32_t difference = uint32_t(value.size());
 8786|       |
 8787|     37|  if (components.port != url_components::omitted) {
  ------------------
  |  Branch (8787:7): [True: 0, False: 37]
  ------------------
 8788|      0|    difference -= components.pathname_start - components.host_end;
 8789|      0|    buffer.erase(components.host_end,
 8790|      0|                 components.pathname_start - components.host_end);
 8791|      0|  }
 8792|       |
 8793|     37|  buffer.insert(components.host_end, value);
 8794|     37|  components.pathname_start += difference;
 8795|     37|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8795:7): [True: 0, False: 37]
  ------------------
 8796|      0|    components.search_start += difference;
 8797|      0|  }
 8798|     37|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8798:7): [True: 0, False: 37]
  ------------------
 8799|      0|    components.hash_start += difference;
 8800|      0|  }
 8801|     37|  components.port = input;
 8802|     37|  ADA_ASSERT_TRUE(validate());
 8803|     37|}
_ZN3ada7helpers6concatIJPKcNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEESA_DpT_:
 1968|     37|std::string concat(Args... args) {
 1969|     37|  std::string answer;
 1970|     37|  inner_concat(answer, args...);
 1971|     37|  return answer;
 1972|     37|}
_ZN3ada7helpers12inner_concatIPKcJNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvRSA_T_DpT0_:
 1957|     37|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1958|     37|  buffer.append(t);
 1959|     37|  return inner_concat(buffer, args...);
 1960|     37|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJEEEvRS8_T_:
 1949|     37|inline void inner_concat(std::string& buffer, T t) {
 1950|     37|  buffer.append(t);
 1951|     37|}
_ZN3ada14url_aggregator18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8446|    596|    std::string_view input, const uint8_t query_percent_encode_set[]) {
 8447|    596|  ada_log("url_aggregator::update_base_search ", input,
 8448|    596|          " with encoding parameter ", to_string(), "\n", to_diagram());
 8449|    596|  ADA_ASSERT_TRUE(validate());
 8450|    596|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8451|       |
 8452|    596|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (8452:7): [True: 596, False: 0]
  ------------------
 8453|    596|    if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (8453:9): [True: 596, False: 0]
  ------------------
 8454|    596|      components.search_start = uint32_t(buffer.size());
 8455|    596|      buffer += "?";
 8456|    596|    } else {
 8457|      0|      buffer.resize(components.search_start + 1);
 8458|      0|    }
 8459|       |
 8460|    596|    bool encoding_required =
 8461|    596|        unicode::percent_encode<true>(input, query_percent_encode_set, buffer);
 8462|       |    // When encoding_required is false, then buffer is left unchanged, and
 8463|       |    // percent encoding was not deemed required.
 8464|    596|    if (!encoding_required) {
  ------------------
  |  Branch (8464:9): [True: 455, False: 141]
  ------------------
 8465|    455|      buffer.append(input);
 8466|    455|    }
 8467|    596|  } else {
 8468|      0|    const size_t idx =
 8469|      0|        ada::unicode::percent_encode_index(input, query_percent_encode_set);
 8470|      0|    std::string encoded;
 8471|      0|    std::string_view replacement = input;
 8472|      0|    if (idx != input.size()) {
  ------------------
  |  Branch (8472:9): [True: 0, False: 0]
  ------------------
 8473|      0|      encoded =
 8474|      0|          ada::unicode::percent_encode(input, query_percent_encode_set, idx);
 8475|      0|      replacement = encoded;
 8476|      0|    }
 8477|       |
 8478|      0|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8478:9): [True: 0, False: 0]
  ------------------
 8479|      0|      const uint32_t difference = replace_and_resize(
 8480|      0|          components.search_start + 1, components.hash_start, replacement);
 8481|      0|      components.hash_start += difference;
 8482|      0|    } else {
 8483|      0|      components.search_start = components.hash_start;
 8484|      0|      buffer.insert(components.search_start, replacement.size() + 1, '?');
 8485|      0|      if (!replacement.empty()) {
  ------------------
  |  Branch (8485:11): [True: 0, False: 0]
  ------------------
 8486|      0|        std::memmove(buffer.data() + components.search_start + 1,
 8487|      0|                     replacement.data(), replacement.size());
 8488|      0|      }
 8489|      0|      components.hash_start +=
 8490|      0|          uint32_t(replacement.size() + 1);  // Do not forget `?`
 8491|      0|    }
 8492|      0|  }
 8493|       |
 8494|    596|  ADA_ASSERT_TRUE(validate());
 8495|    596|}
_ZN3ada14url_aggregator20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8361|  2.84k|inline void url_aggregator::update_base_hostname(const std::string_view input) {
 8362|  2.84k|  ada_log("url_aggregator::update_base_hostname ", input, " [", input.size(),
 8363|  2.84k|          " bytes], buffer is '", buffer, "' [", buffer.size(), " bytes]");
 8364|  2.84k|  ADA_ASSERT_TRUE(validate());
 8365|  2.84k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8366|       |
 8367|       |  // This next line is required for when parsing a URL like `foo://`
 8368|  2.84k|  add_authority_slashes_if_needed();
 8369|       |
 8370|  2.84k|  bool has_credentials = components.protocol_end + 2 < components.host_start;
 8371|  2.84k|  uint32_t new_difference =
 8372|  2.84k|      replace_and_resize(components.host_start, components.host_end, input);
 8373|       |
 8374|  2.84k|  if (has_credentials) {
  ------------------
  |  Branch (8374:7): [True: 264, False: 2.58k]
  ------------------
 8375|    264|    buffer.insert(components.host_start, "@");
 8376|    264|    new_difference++;
 8377|    264|  }
 8378|  2.84k|  components.host_end += new_difference;
 8379|  2.84k|  components.pathname_start += new_difference;
 8380|  2.84k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8380:7): [True: 0, False: 2.84k]
  ------------------
 8381|      0|    components.search_start += new_difference;
 8382|      0|  }
 8383|  2.84k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8383:7): [True: 0, False: 2.84k]
  ------------------
 8384|      0|    components.hash_start += new_difference;
 8385|      0|  }
 8386|  2.84k|  ADA_ASSERT_TRUE(validate());
 8387|  2.84k|}
_ZN3ada14url_aggregator10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 9093|    546|url_aggregator::parse_port(std::string_view view, bool check_trailing_content) {
 9094|    546|  ada_log("url_aggregator::parse_port('", view, "') ", view.size());
 9095|    546|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (9095:7): [True: 543, False: 3]
  |  Branch (9095:24): [True: 1, False: 542]
  ------------------
 9096|      1|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 9097|      1|    is_valid = false;
 9098|      1|    return 0;
 9099|      1|  }
 9100|    545|  uint16_t parsed_port{};
 9101|    545|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 9102|    545|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (9102:7): [True: 21, False: 524]
  ------------------
 9103|     21|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 9104|     21|    is_valid = false;
 9105|     21|    return 0;
 9106|     21|  }
 9107|    524|  ada_log("parse_port: ", parsed_port);
 9108|    524|  const size_t consumed = size_t(r.ptr - view.data());
 9109|    524|  ada_log("parse_port: consumed ", consumed);
 9110|    524|  if (check_trailing_content) {
  ------------------
  |  Branch (9110:7): [True: 524, False: 0]
  ------------------
 9111|    524|    is_valid &=
 9112|    524|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (9112:10): [True: 12, False: 512]
  |  Branch (9112:37): [True: 40, False: 472]
  ------------------
 9113|    472|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (9113:10): [True: 12, False: 460]
  |  Branch (9113:36): [True: 460, False: 0]
  |  Branch (9113:52): [True: 0, False: 460]
  ------------------
 9114|    524|  }
 9115|    524|  ada_log("parse_port: is_valid = ", is_valid);
 9116|    524|  if (is_valid) {
  ------------------
  |  Branch (9116:7): [True: 64, False: 460]
  ------------------
 9117|     64|    ada_log("parse_port", r.ec == std::errc());
 9118|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 9119|     64|    auto default_port = scheme_default_port();
 9120|     64|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (9120:27): [True: 0, False: 64]
  |  Branch (9120:48): [True: 0, False: 0]
  ------------------
 9121|     64|                         (default_port != parsed_port);
  ------------------
  |  Branch (9121:26): [True: 63, False: 1]
  ------------------
 9122|     64|    if (r.ec == std::errc() && is_port_valid) {
  ------------------
  |  Branch (9122:9): [True: 38, False: 26]
  |  Branch (9122:32): [True: 37, False: 1]
  ------------------
 9123|     37|      update_base_port(parsed_port);
 9124|     37|    } else {
 9125|     27|      clear_port();
 9126|     27|    }
 9127|     64|  }
 9128|    524|  return consumed;
 9129|    545|}
_ZN3ada7unicode20percent_encode_indexENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8216|  6.96k|                                              const uint8_t character_set[]) {
 8217|  6.96k|  const char* data = input.data();
 8218|  6.96k|  const size_t size = input.size();
 8219|       |
 8220|       |  // Process 8 bytes at a time using unrolled loop
 8221|  6.96k|  size_t i = 0;
 8222|  7.38k|  for (; i + 8 <= size; i += 8) {
  ------------------
  |  Branch (8222:10): [True: 628, False: 6.76k]
  ------------------
 8223|    628|    unsigned char chunk[8];
 8224|    628|    std::memcpy(&chunk, data + i,
 8225|    628|                8);  // entices compiler to unconditionally process 8 characters
 8226|       |
 8227|       |    // Check 8 characters at once
 8228|  4.34k|    for (size_t j = 0; j < 8; j++) {
  ------------------
  |  Branch (8228:24): [True: 3.92k, False: 420]
  ------------------
 8229|  3.92k|      if (character_sets::bit_at(character_set, chunk[j])) {
  ------------------
  |  Branch (8229:11): [True: 208, False: 3.71k]
  ------------------
 8230|    208|        return i + j;
 8231|    208|      }
 8232|  3.92k|    }
 8233|    628|  }
 8234|       |
 8235|       |  // Handle remaining bytes
 8236|  7.19k|  for (; i < size; i++) {
  ------------------
  |  Branch (8236:10): [True: 580, False: 6.61k]
  ------------------
 8237|    580|    if (character_sets::bit_at(character_set, data[i])) {
  ------------------
  |  Branch (8237:9): [True: 151, False: 429]
  ------------------
 8238|    151|      return i;
 8239|    151|    }
 8240|    580|  }
 8241|       |
 8242|  6.61k|  return size;
 8243|  6.76k|}
_ZN3ada14url_aggregator10clear_portEv:
 8805|     27|inline void url_aggregator::clear_port() {
 8806|     27|  ada_log("url_aggregator::clear_port");
 8807|     27|  ADA_ASSERT_TRUE(validate());
 8808|     27|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (8808:7): [True: 27, False: 0]
  ------------------
 8809|     27|    return;
 8810|     27|  }
 8811|      0|  uint32_t length = components.pathname_start - components.host_end;
 8812|      0|  buffer.erase(components.host_end, length);
 8813|      0|  components.pathname_start -= length;
 8814|      0|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8814:7): [True: 0, False: 0]
  ------------------
 8815|      0|    components.search_start -= length;
 8816|      0|  }
 8817|      0|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8817:7): [True: 0, False: 0]
  ------------------
 8818|      0|    components.hash_start -= length;
 8819|      0|  }
 8820|      0|  components.port = url_components::omitted;
 8821|      0|  ADA_ASSERT_TRUE(validate());
 8822|      0|}
_ZNK3ada14url_aggregator13has_authorityEv:
 8970|  6.35k|    const noexcept {
 8971|  6.35k|  ada_log("url_aggregator::has_authority");
 8972|       |  // Performance: instead of doing this potentially expensive check, we could
 8973|       |  // have a boolean in the struct.
 8974|  6.35k|  return components.protocol_end + 2 <= components.host_start &&
  ------------------
  |  Branch (8974:10): [True: 4.12k, False: 2.23k]
  ------------------
 8975|  4.12k|         buffer[components.protocol_end] == '/' &&
  ------------------
  |  Branch (8975:10): [True: 4.12k, False: 0]
  ------------------
 8976|  4.12k|         buffer[components.protocol_end + 1] == '/';
  ------------------
  |  Branch (8976:10): [True: 4.12k, False: 0]
  ------------------
 8977|  6.35k|}
_ZNK3ada14url_aggregator12has_dash_dotEv:
 9050|  1.12k|[[nodiscard]] constexpr bool url_aggregator::has_dash_dot() const noexcept {
 9051|       |  // If url's host is null, url does not have an opaque path, url's path's size
 9052|       |  // is greater than 1, and url's path[0] is the empty string, then append
 9053|       |  // U+002F (/) followed by U+002E (.) to output.
 9054|  1.12k|  ada_log("url_aggregator::has_dash_dot");
 9055|       |#if ADA_DEVELOPMENT_CHECKS
 9056|       |  // If pathname_start and host_end are exactly two characters apart, then we
 9057|       |  // either have a one-digit port such as http://test.com:5?param=1 or else we
 9058|       |  // have a /.: sequence such as "non-spec:/.//". We test that this is the case.
 9059|       |  if (components.pathname_start == components.host_end + 2) {
 9060|       |    ADA_ASSERT_TRUE((buffer[components.host_end] == '/' &&
 9061|       |                     buffer[components.host_end + 1] == '.') ||
 9062|       |                    (buffer[components.host_end] == ':' &&
 9063|       |                     checkers::is_digit(buffer[components.host_end + 1])));
 9064|       |  }
 9065|       |  if (components.pathname_start == components.host_end + 2 &&
 9066|       |      buffer[components.host_end] == '/' &&
 9067|       |      buffer[components.host_end + 1] == '.') {
 9068|       |    ADA_ASSERT_TRUE(components.pathname_start + 1 < buffer.size());
 9069|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start] == '/');
 9070|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start + 1] == '/');
 9071|       |  }
 9072|       |#endif
 9073|       |  // Performance: it should be uncommon for components.pathname_start ==
 9074|       |  // components.host_end + 2 to be true. So we put this check first in the
 9075|       |  // sequence. Most times, we do not have an opaque path. Checking for '/.' is
 9076|       |  // more expensive, but should be uncommon.
 9077|  1.12k|  return components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9077:10): [True: 18, False: 1.10k]
  ------------------
 9078|     18|         !has_opaque_path && buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9078:10): [True: 18, False: 0]
  |  Branch (9078:30): [True: 0, False: 18]
  ------------------
 9079|      0|         buffer[components.host_end + 1] == '.';
  ------------------
  |  Branch (9079:10): [True: 0, False: 0]
  ------------------
 9080|  1.12k|}
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEcvbEv:
 4074|  13.1k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEptEv:
 4043|  2.63k|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4044|  2.63k|    TL_ASSERT(has_value());
  ------------------
  |  | 2096|  2.63k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4044:5): [True: 2.63k, False: 0]
  ------------------
 4045|  2.63k|    return valptr();
 4046|  2.63k|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE6valptrEv:
 3339|  2.63k|  T* valptr() { return std::addressof(this->m_val); }
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE9has_valueEv:
 4073|  2.63k|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EED2Ev:
 2671|  13.1k|  ~expected_storage_base() {
 2672|  13.1k|    if (m_has_val) {
  ------------------
  |  Branch (2672:9): [True: 2.35k, False: 10.7k]
  ------------------
 2673|  2.35k|      m_val.~T();
 2674|  2.35k|    }
 2675|  13.1k|  }
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEmm:
 1890|  4.09k|                                                       size_t pos2) {
 1891|       |#if ADA_DEVELOPMENT_CHECKS
 1892|       |  if (pos2 < pos1) {
 1893|       |    std::cerr << "Negative-length substring: [" << pos1 << " to " << pos2 << ")"
 1894|       |              << std::endl;
 1895|       |    abort();
 1896|       |  }
 1897|       |#endif
 1898|  4.09k|  return input.substr(pos1, pos2 - pos1);
 1899|  4.09k|}
_ZNK3ada14url_aggregator10is_at_pathEv:
 8402|    729|    const noexcept {
 8403|    729|  return buffer.size() == components.pathname_start;
 8404|    729|}
_ZNK3ada14url_aggregator12has_passwordEv:
 9019|    841|constexpr bool url_aggregator::has_password() const noexcept {
 9020|    841|  ada_log("url_aggregator::has_password");
 9021|       |  // This function does not care about the length of the password
 9022|    841|  return components.host_start > components.username_end &&
  ------------------
  |  Branch (9022:10): [True: 768, False: 73]
  ------------------
 9023|    768|         buffer[components.username_end] == ':';
  ------------------
  |  Branch (9023:10): [True: 768, False: 0]
  ------------------
 9024|    841|}
_ZNK3ada14url_aggregator8validateEv:
 9161|  2.35k|[[nodiscard]] constexpr bool url_aggregator::validate() const noexcept {
 9162|  2.35k|  if (!is_valid) {
  ------------------
  |  Branch (9162:7): [True: 0, False: 2.35k]
  ------------------
 9163|      0|    return true;
 9164|      0|  }
 9165|  2.35k|  if (!components.check_offset_consistency()) {
  ------------------
  |  Branch (9165:7): [True: 0, False: 2.35k]
  ------------------
 9166|      0|    ada_log("url_aggregator::validate inconsistent components \n",
 9167|      0|            to_diagram());
 9168|      0|    return false;
 9169|      0|  }
 9170|       |  // We have a credible components struct, but let us investivate more
 9171|       |  // carefully:
 9172|       |  /**
 9173|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 9174|       |   *       |     |    |          | ^^^^|       |   |
 9175|       |   *       |     |    |          | |   |       |   `----- hash_start
 9176|       |   *       |     |    |          | |   |       `--------- search_start
 9177|       |   *       |     |    |          | |   `----------------- pathname_start
 9178|       |   *       |     |    |          | `--------------------- port
 9179|       |   *       |     |    |          `----------------------- host_end
 9180|       |   *       |     |    `---------------------------------- host_start
 9181|       |   *       |     `--------------------------------------- username_end
 9182|       |   *       `--------------------------------------------- protocol_end
 9183|       |   */
 9184|  2.35k|  if (components.protocol_end == url_components::omitted) {
  ------------------
  |  Branch (9184:7): [True: 0, False: 2.35k]
  ------------------
 9185|      0|    ada_log("url_aggregator::validate omitted protocol_end \n", to_diagram());
 9186|      0|    return false;
 9187|      0|  }
 9188|  2.35k|  if (components.username_end == url_components::omitted) {
  ------------------
  |  Branch (9188:7): [True: 0, False: 2.35k]
  ------------------
 9189|      0|    ada_log("url_aggregator::validate omitted username_end \n", to_diagram());
 9190|      0|    return false;
 9191|      0|  }
 9192|  2.35k|  if (components.host_start == url_components::omitted) {
  ------------------
  |  Branch (9192:7): [True: 0, False: 2.35k]
  ------------------
 9193|      0|    ada_log("url_aggregator::validate omitted host_start \n", to_diagram());
 9194|      0|    return false;
 9195|      0|  }
 9196|  2.35k|  if (components.host_end == url_components::omitted) {
  ------------------
  |  Branch (9196:7): [True: 0, False: 2.35k]
  ------------------
 9197|      0|    ada_log("url_aggregator::validate omitted host_end \n", to_diagram());
 9198|      0|    return false;
 9199|      0|  }
 9200|  2.35k|  if (components.pathname_start == url_components::omitted) {
  ------------------
  |  Branch (9200:7): [True: 0, False: 2.35k]
  ------------------
 9201|      0|    ada_log("url_aggregator::validate omitted pathname_start \n", to_diagram());
 9202|      0|    return false;
 9203|      0|  }
 9204|       |
 9205|  2.35k|  if (components.protocol_end > buffer.size()) {
  ------------------
  |  Branch (9205:7): [True: 0, False: 2.35k]
  ------------------
 9206|      0|    ada_log("url_aggregator::validate protocol_end overflow \n", to_diagram());
 9207|      0|    return false;
 9208|      0|  }
 9209|  2.35k|  if (components.username_end > buffer.size()) {
  ------------------
  |  Branch (9209:7): [True: 0, False: 2.35k]
  ------------------
 9210|      0|    ada_log("url_aggregator::validate username_end overflow \n", to_diagram());
 9211|      0|    return false;
 9212|      0|  }
 9213|  2.35k|  if (components.host_start > buffer.size()) {
  ------------------
  |  Branch (9213:7): [True: 0, False: 2.35k]
  ------------------
 9214|      0|    ada_log("url_aggregator::validate host_start overflow \n", to_diagram());
 9215|      0|    return false;
 9216|      0|  }
 9217|  2.35k|  if (components.host_end > buffer.size()) {
  ------------------
  |  Branch (9217:7): [True: 0, False: 2.35k]
  ------------------
 9218|      0|    ada_log("url_aggregator::validate host_end overflow \n", to_diagram());
 9219|      0|    return false;
 9220|      0|  }
 9221|  2.35k|  if (components.pathname_start > buffer.size()) {
  ------------------
  |  Branch (9221:7): [True: 0, False: 2.35k]
  ------------------
 9222|      0|    ada_log("url_aggregator::validate pathname_start overflow \n",
 9223|      0|            to_diagram());
 9224|      0|    return false;
 9225|      0|  }
 9226|       |
 9227|  2.35k|  if (components.protocol_end > 0) {
  ------------------
  |  Branch (9227:7): [True: 2.35k, False: 0]
  ------------------
 9228|  2.35k|    if (buffer[components.protocol_end - 1] != ':') {
  ------------------
  |  Branch (9228:9): [True: 0, False: 2.35k]
  ------------------
 9229|      0|      ada_log(
 9230|      0|          "url_aggregator::validate missing : at the end of the protocol \n",
 9231|      0|          to_diagram());
 9232|      0|      return false;
 9233|      0|    }
 9234|  2.35k|  }
 9235|       |
 9236|  2.35k|  if (components.username_end != buffer.size() &&
  ------------------
  |  Branch (9236:7): [True: 2.35k, False: 0]
  ------------------
 9237|  2.35k|      components.username_end > components.protocol_end + 2) {
  ------------------
  |  Branch (9237:7): [True: 74, False: 2.27k]
  ------------------
 9238|     74|    if (buffer[components.username_end] != ':' &&
  ------------------
  |  Branch (9238:9): [True: 64, False: 10]
  ------------------
 9239|     64|        buffer[components.username_end] != '@') {
  ------------------
  |  Branch (9239:9): [True: 0, False: 64]
  ------------------
 9240|      0|      ada_log(
 9241|      0|          "url_aggregator::validate missing : or @ at the end of the username "
 9242|      0|          "\n",
 9243|      0|          to_diagram());
 9244|      0|      return false;
 9245|      0|    }
 9246|     74|  }
 9247|       |
 9248|  2.35k|  if (components.host_start != buffer.size()) {
  ------------------
  |  Branch (9248:7): [True: 2.35k, False: 0]
  ------------------
 9249|  2.35k|    if (components.host_start > components.username_end) {
  ------------------
  |  Branch (9249:9): [True: 23, False: 2.32k]
  ------------------
 9250|     23|      if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9250:11): [True: 0, False: 23]
  ------------------
 9251|      0|        ada_log(
 9252|      0|            "url_aggregator::validate missing @ at the end of the password \n",
 9253|      0|            to_diagram());
 9254|      0|        return false;
 9255|      0|      }
 9256|  2.32k|    } else if (components.host_start == components.username_end &&
  ------------------
  |  Branch (9256:16): [True: 2.32k, False: 0]
  ------------------
 9257|  2.32k|               components.host_end > components.host_start) {
  ------------------
  |  Branch (9257:16): [True: 2.32k, False: 0]
  ------------------
 9258|  2.32k|      if (components.host_start == components.protocol_end + 2) {
  ------------------
  |  Branch (9258:11): [True: 2.26k, False: 64]
  ------------------
 9259|  2.26k|        if (buffer[components.protocol_end] != '/' ||
  ------------------
  |  Branch (9259:13): [True: 0, False: 2.26k]
  ------------------
 9260|  2.26k|            buffer[components.protocol_end + 1] != '/') {
  ------------------
  |  Branch (9260:13): [True: 0, False: 2.26k]
  ------------------
 9261|      0|          ada_log(
 9262|      0|              "url_aggregator::validate missing // between protocol and host "
 9263|      0|              "\n",
 9264|      0|              to_diagram());
 9265|      0|          return false;
 9266|      0|        }
 9267|  2.26k|      } else {
 9268|     64|        if (components.host_start > components.protocol_end &&
  ------------------
  |  Branch (9268:13): [True: 64, False: 0]
  ------------------
 9269|     64|            buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9269:13): [True: 0, False: 64]
  ------------------
 9270|      0|          ada_log(
 9271|      0|              "url_aggregator::validate missing @ at the end of the username "
 9272|      0|              "\n",
 9273|      0|              to_diagram());
 9274|      0|          return false;
 9275|      0|        }
 9276|     64|      }
 9277|  2.32k|    } else {
 9278|      0|      if (components.host_end != components.host_start) {
  ------------------
  |  Branch (9278:11): [True: 0, False: 0]
  ------------------
 9279|      0|        ada_log("url_aggregator::validate expected omitted host \n",
 9280|      0|                to_diagram());
 9281|      0|        return false;
 9282|      0|      }
 9283|      0|    }
 9284|  2.35k|  }
 9285|  2.35k|  if (components.host_end != buffer.size() &&
  ------------------
  |  Branch (9285:7): [True: 2.35k, False: 0]
  ------------------
 9286|  2.35k|      components.pathname_start > components.host_end) {
  ------------------
  |  Branch (9286:7): [True: 134, False: 2.21k]
  ------------------
 9287|    134|    if (components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9287:9): [True: 29, False: 105]
  ------------------
 9288|     29|        buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9288:9): [True: 0, False: 29]
  ------------------
 9289|      0|        buffer[components.host_end + 1] == '.') {
  ------------------
  |  Branch (9289:9): [True: 0, False: 0]
  ------------------
 9290|      0|      if (components.pathname_start + 1 >= buffer.size() ||
  ------------------
  |  Branch (9290:11): [True: 0, False: 0]
  ------------------
 9291|      0|          buffer[components.pathname_start] != '/' ||
  ------------------
  |  Branch (9291:11): [True: 0, False: 0]
  ------------------
 9292|      0|          buffer[components.pathname_start + 1] != '/') {
  ------------------
  |  Branch (9292:11): [True: 0, False: 0]
  ------------------
 9293|      0|        ada_log(
 9294|      0|            "url_aggregator::validate expected the path to begin with // \n",
 9295|      0|            to_diagram());
 9296|      0|        return false;
 9297|      0|      }
 9298|    134|    } else if (buffer[components.host_end] != ':') {
  ------------------
  |  Branch (9298:16): [True: 0, False: 134]
  ------------------
 9299|      0|      ada_log("url_aggregator::validate missing : at the port \n",
 9300|      0|              to_diagram());
 9301|      0|      return false;
 9302|      0|    }
 9303|    134|  }
 9304|  2.35k|  if (components.pathname_start != buffer.size() &&
  ------------------
  |  Branch (9304:7): [True: 2.35k, False: 0]
  ------------------
 9305|  2.35k|      components.pathname_start < components.search_start &&
  ------------------
  |  Branch (9305:7): [True: 2.35k, False: 0]
  ------------------
 9306|  2.35k|      components.pathname_start < components.hash_start && !has_opaque_path) {
  ------------------
  |  Branch (9306:7): [True: 2.35k, False: 0]
  |  Branch (9306:60): [True: 2.35k, False: 0]
  ------------------
 9307|  2.35k|    if (buffer[components.pathname_start] != '/') {
  ------------------
  |  Branch (9307:9): [True: 0, False: 2.35k]
  ------------------
 9308|      0|      ada_log("url_aggregator::validate missing / at the path \n",
 9309|      0|              to_diagram());
 9310|      0|      return false;
 9311|      0|    }
 9312|  2.35k|  }
 9313|  2.35k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9313:7): [True: 673, False: 1.67k]
  ------------------
 9314|    673|    if (buffer[components.search_start] != '?') {
  ------------------
  |  Branch (9314:9): [True: 0, False: 673]
  ------------------
 9315|      0|      ada_log("url_aggregator::validate missing ? at the search \n",
 9316|      0|              to_diagram());
 9317|      0|      return false;
 9318|      0|    }
 9319|    673|  }
 9320|  2.35k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9320:7): [True: 333, False: 2.01k]
  ------------------
 9321|    333|    if (buffer[components.hash_start] != '#') {
  ------------------
  |  Branch (9321:9): [True: 0, False: 333]
  ------------------
 9322|      0|      ada_log("url_aggregator::validate missing # at the hash \n",
 9323|      0|              to_diagram());
 9324|      0|      return false;
 9325|      0|    }
 9326|    333|  }
 9327|       |
 9328|  2.35k|  return true;
 9329|  2.35k|}
_ZNK3ada14url_components24check_offset_consistencyEv:
 7655|  2.35k|    const noexcept {
 7656|       |  /**
 7657|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 7658|       |   *       |     |    |          | ^^^^|       |   |
 7659|       |   *       |     |    |          | |   |       |   `----- hash_start
 7660|       |   *       |     |    |          | |   |       `--------- search_start
 7661|       |   *       |     |    |          | |   `----------------- pathname_start
 7662|       |   *       |     |    |          | `--------------------- port
 7663|       |   *       |     |    |          `----------------------- host_end
 7664|       |   *       |     |    `---------------------------------- host_start
 7665|       |   *       |     `--------------------------------------- username_end
 7666|       |   *       `--------------------------------------------- protocol_end
 7667|       |   */
 7668|       |  // These conditions can be made more strict.
 7669|  2.35k|  if (protocol_end == url_components::omitted) {
  ------------------
  |  Branch (7669:7): [True: 0, False: 2.35k]
  ------------------
 7670|      0|    return false;
 7671|      0|  }
 7672|  2.35k|  uint32_t index = protocol_end;
 7673|       |
 7674|  2.35k|  if (username_end == url_components::omitted) {
  ------------------
  |  Branch (7674:7): [True: 0, False: 2.35k]
  ------------------
 7675|      0|    return false;
 7676|      0|  }
 7677|  2.35k|  if (username_end < index) {
  ------------------
  |  Branch (7677:7): [True: 0, False: 2.35k]
  ------------------
 7678|      0|    return false;
 7679|      0|  }
 7680|  2.35k|  index = username_end;
 7681|       |
 7682|  2.35k|  if (host_start == url_components::omitted) {
  ------------------
  |  Branch (7682:7): [True: 0, False: 2.35k]
  ------------------
 7683|      0|    return false;
 7684|      0|  }
 7685|  2.35k|  if (host_start < index) {
  ------------------
  |  Branch (7685:7): [True: 0, False: 2.35k]
  ------------------
 7686|      0|    return false;
 7687|      0|  }
 7688|  2.35k|  index = host_start;
 7689|       |
 7690|  2.35k|  if (port != url_components::omitted) {
  ------------------
  |  Branch (7690:7): [True: 134, False: 2.21k]
  ------------------
 7691|    134|    if (port > 0xffff) {
  ------------------
  |  Branch (7691:9): [True: 0, False: 134]
  ------------------
 7692|      0|      return false;
 7693|      0|    }
 7694|    134|    uint32_t port_length = helpers::fast_digit_count(port) + 1;
 7695|    134|    if (index + port_length < index) {
  ------------------
  |  Branch (7695:9): [True: 0, False: 134]
  ------------------
 7696|      0|      return false;
 7697|      0|    }
 7698|    134|    index += port_length;
 7699|    134|  }
 7700|       |
 7701|  2.35k|  if (pathname_start == url_components::omitted) {
  ------------------
  |  Branch (7701:7): [True: 0, False: 2.35k]
  ------------------
 7702|      0|    return false;
 7703|      0|  }
 7704|  2.35k|  if (pathname_start < index) {
  ------------------
  |  Branch (7704:7): [True: 0, False: 2.35k]
  ------------------
 7705|      0|    return false;
 7706|      0|  }
 7707|  2.35k|  index = pathname_start;
 7708|       |
 7709|  2.35k|  if (search_start != url_components::omitted) {
  ------------------
  |  Branch (7709:7): [True: 673, False: 1.67k]
  ------------------
 7710|    673|    if (search_start < index) {
  ------------------
  |  Branch (7710:9): [True: 0, False: 673]
  ------------------
 7711|      0|      return false;
 7712|      0|    }
 7713|    673|    index = search_start;
 7714|    673|  }
 7715|       |
 7716|  2.35k|  if (hash_start != url_components::omitted) {
  ------------------
  |  Branch (7716:7): [True: 333, False: 2.01k]
  ------------------
 7717|    333|    if (hash_start < index) {
  ------------------
  |  Branch (7717:9): [True: 0, False: 333]
  ------------------
 7718|      0|      return false;
 7719|      0|    }
 7720|    333|  }
 7721|       |
 7722|  2.35k|  return true;
 7723|  2.35k|}
_ZN3ada7helpers16fast_digit_countEj:
 1994|    134|inline int fast_digit_count(uint32_t x) noexcept {
 1995|    134|  auto int_log2 = [](uint32_t z) -> int {
 1996|    134|    return 31 - ada::helpers::leading_zeroes(z | 1);
 1997|    134|  };
 1998|       |  // Compiles to very few instructions. Note that the
 1999|       |  // table is static and thus effectively a constant.
 2000|       |  // We leave it inside the function because it is meaningless
 2001|       |  // outside of it (this comes at no performance cost).
 2002|    134|  const static uint64_t table[] = {
 2003|    134|      4294967296,  8589934582,  8589934582,  8589934582,  12884901788,
 2004|    134|      12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
 2005|    134|      21474826480, 21474826480, 21474826480, 21474826480, 25769703776,
 2006|    134|      25769703776, 25769703776, 30063771072, 30063771072, 30063771072,
 2007|    134|      34349738368, 34349738368, 34349738368, 34349738368, 38554705664,
 2008|    134|      38554705664, 38554705664, 41949672960, 41949672960, 41949672960,
 2009|    134|      42949672960, 42949672960};
 2010|    134|  return int((x + table[int_log2(x)]) >> 32);
 2011|    134|}
_ZZN3ada7helpers16fast_digit_countEjENKUljE_clEj:
 1995|    134|  auto int_log2 = [](uint32_t z) -> int {
 1996|    134|    return 31 - ada::helpers::leading_zeroes(z | 1);
 1997|    134|  };

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: 2.10k, False: 4.86k]
  ------------------
   46|  2.10k|    assert(compress < 8);
  ------------------
  |  Branch (46:5): [True: 2.10k, False: 0]
  ------------------
   47|  2.10k|    assert(compress + compress_length <= 8);
  ------------------
  |  Branch (47:5): [True: 2.10k, False: 0]
  ------------------
   48|  2.10k|  }
   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: 73, False: 6.89k]
  ------------------
   65|       |      // Serialize the parsed address and re-parse.
   66|     73|      std::string canonical = ada::serializers::ipv4(fast_result);
   67|     73|      uint64_t recheck = ada::checkers::try_parse_ipv4_fast(canonical);
   68|     73|      if (recheck != fast_result) {
  ------------------
  |  Branch (68:11): [True: 0, False: 73]
  ------------------
   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|     73|    }
   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.8k|    for (const uint8_t* charset : sets) {
  ------------------
  |  Branch (93:33): [True: 41.8k, False: 6.96k]
  ------------------
   94|       |      // Two-argument percent_encode: returns the encoded string.
   95|  41.8k|      std::string encoded = ada::unicode::percent_encode(source, charset);
   96|  41.8k|      volatile size_t enc_len = encoded.size();
   97|  41.8k|      (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.8k|      assert(encoded.size() >= source.size());
  ------------------
  |  Branch (101:7): [True: 41.8k, False: 0]
  ------------------
  102|       |
  103|       |      // Three-argument percent_encode: starts encoding from a given index.
  104|  41.8k|      size_t start_idx = fdp.ConsumeIntegralInRange<size_t>(0, source.size());
  105|  41.8k|      std::string encoded_from =
  106|  41.8k|          ada::unicode::percent_encode(source, charset, start_idx);
  107|  41.8k|      volatile size_t enf_len = encoded_from.size();
  108|  41.8k|      (void)enf_len;
  109|       |
  110|       |      // Template form: percent_encode<false> (replace).
  111|  41.8k|      {
  112|  41.8k|        std::string out;
  113|  41.8k|        bool changed =
  114|  41.8k|            ada::unicode::percent_encode<false>(source, charset, out);
  115|  41.8k|        volatile bool c = changed;
  116|  41.8k|        (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.8k|        if (changed) {
  ------------------
  |  Branch (119:13): [True: 2.09k, False: 39.7k]
  ------------------
  120|  2.09k|          assert(out.size() >= source.size());
  ------------------
  |  Branch (120:11): [True: 2.09k, False: 0]
  ------------------
  121|  2.09k|        }
  122|  41.8k|      }
  123|       |
  124|       |      // Template form: percent_encode<true> (append).
  125|  41.8k|      {
  126|  41.8k|        std::string out = "prefix_";
  127|  41.8k|        size_t prefix_len = out.size();
  128|  41.8k|        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.8k|        assert(out.size() >= prefix_len);
  ------------------
  |  Branch (131:9): [True: 41.8k, False: 0]
  ------------------
  132|  41.8k|      }
  133|  41.8k|    }
  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: 177, False: 6.79k]
  ------------------
  139|    177|        std::string decoded = ada::unicode::percent_decode(source, pct_pos);
  140|       |        // Decoded output can't be longer than the input.
  141|    177|        assert(decoded.size() <= source.size());
  ------------------
  |  Branch (141:9): [True: 177, False: 0]
  ------------------
  142|    177|        volatile size_t dec_len = decoded.size();
  143|    177|        (void)dec_len;
  144|    177|      }
  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: 420, False: 6.54k]
  ------------------
  154|    420|        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|    420|        if (source.find('%') == std::string::npos && decoded != source) {
  ------------------
  |  Branch (157:13): [True: 243, False: 177]
  |  Branch (157:54): [True: 0, False: 243]
  ------------------
  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.54k|      } else {
  165|       |        // No encoding was needed; the output should equal the input.
  166|  6.54k|        assert(encoded == source);
  ------------------
  |  Branch (166:9): [True: 6.54k, False: 0]
  ------------------
  167|  6.54k|      }
  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.09k, False: 873]
  ------------------
  194|  6.09k|      volatile bool is_v4 = ada::checkers::is_ipv4(util_input);
  195|  6.09k|      (void)is_v4;
  196|  6.09k|      if (is_v4) {
  ------------------
  |  Branch (196:11): [True: 5.87k, False: 226]
  ------------------
  197|  5.87k|        std::string ipv4_url = "http://" + util_input + "/";
  198|  5.87k|        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.87k|        if (parsed) {
  ------------------
  |  Branch (202:13): [True: 2.06k, False: 3.80k]
  ------------------
  203|  2.06k|          volatile bool v = parsed->validate();
  204|  2.06k|          (void)v;
  205|  2.06k|        }
  206|  5.87k|      }
  207|  6.09k|    }
  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: 285, False: 6.68k]
  ------------------
  266|    285|      std::string url_str = "http://" + ipv4_str + "/path?q=1";
  267|    285|      auto parsed = ada::parse<ada::url_aggregator>(url_str);
  268|    285|      if (parsed) {
  ------------------
  |  Branch (268:11): [True: 285, False: 0]
  ------------------
  269|    285|        volatile bool v = parsed->validate();
  270|    285|        (void)v;
  271|       |        // The URL's hostname must be the canonical dotted-decimal address.
  272|    285|        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|    285|        (void)host;
  277|    285|      }
  278|    285|    }
  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|}

