_ZN3ada4idna13utf8_to_utf32EPKcmPDi:
  160|  2.66k|size_t utf8_to_utf32(const char* buf, size_t len, char32_t* utf32_output) {
  161|  2.66k|  const uint8_t* data = reinterpret_cast<const uint8_t*>(buf);
  162|  2.66k|  size_t pos = 0;
  163|  2.66k|  const char32_t* start{utf32_output};
  164|  29.0k|  while (pos < len) {
  ------------------
  |  Branch (164:10): [True: 26.5k, False: 2.49k]
  ------------------
  165|       |    // try to convert the next block of 16 ASCII bytes
  166|  26.5k|    if (pos + 16 <= len) {  // if it is safe to read 16 more
  ------------------
  |  Branch (166:9): [True: 10.0k, False: 16.4k]
  ------------------
  167|       |                            // bytes, check that they are ascii
  168|  10.0k|      uint64_t v1;
  169|  10.0k|      std::memcpy(&v1, data + pos, sizeof(uint64_t));
  170|  10.0k|      uint64_t v2;
  171|  10.0k|      std::memcpy(&v2, data + pos + sizeof(uint64_t), sizeof(uint64_t));
  172|  10.0k|      uint64_t v{v1 | v2};
  173|  10.0k|      if ((v & 0x8080808080808080) == 0) {
  ------------------
  |  Branch (173:11): [True: 870, False: 9.22k]
  ------------------
  174|    870|        size_t final_pos = pos + 16;
  175|  14.7k|        while (pos < final_pos) {
  ------------------
  |  Branch (175:16): [True: 13.9k, False: 870]
  ------------------
  176|  13.9k|          *utf32_output++ = char32_t(buf[pos]);
  177|  13.9k|          pos++;
  178|  13.9k|        }
  179|    870|        continue;
  180|    870|      }
  181|  10.0k|    }
  182|  25.6k|    uint8_t leading_byte = data[pos];  // leading byte
  183|  25.6k|    if (leading_byte < 0b10000000) {
  ------------------
  |  Branch (183:9): [True: 16.1k, False: 9.53k]
  ------------------
  184|       |      // converting one ASCII byte !!!
  185|  16.1k|      *utf32_output++ = char32_t(leading_byte);
  186|  16.1k|      pos++;
  187|  16.1k|    } else if ((leading_byte & 0b11100000) == 0b11000000) {
  ------------------
  |  Branch (187:16): [True: 2.89k, False: 6.64k]
  ------------------
  188|       |      // We have a two-byte UTF-8
  189|  2.89k|      if (pos + 1 >= len) {
  ------------------
  |  Branch (189:11): [True: 4, False: 2.88k]
  ------------------
  190|      4|        return 0;
  191|      4|      }  // minimal bound checking
  192|  2.88k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (192:11): [True: 40, False: 2.84k]
  ------------------
  193|     40|        return 0;
  194|     40|      }
  195|       |      // range check
  196|  2.84k|      uint32_t code_point =
  197|  2.84k|          (leading_byte & 0b00011111) << 6 | (data[pos + 1] & 0b00111111);
  198|  2.84k|      if (code_point < 0x80 || 0x7ff < code_point) {
  ------------------
  |  Branch (198:11): [True: 2, False: 2.84k]
  |  Branch (198:32): [True: 0, False: 2.84k]
  ------------------
  199|      2|        return 0;
  200|      2|      }
  201|  2.84k|      *utf32_output++ = char32_t(code_point);
  202|  2.84k|      pos += 2;
  203|  6.64k|    } else if ((leading_byte & 0b11110000) == 0b11100000) {
  ------------------
  |  Branch (203:16): [True: 6.10k, False: 533]
  ------------------
  204|       |      // We have a three-byte UTF-8
  205|  6.10k|      if (pos + 2 >= len) {
  ------------------
  |  Branch (205:11): [True: 3, False: 6.10k]
  ------------------
  206|      3|        return 0;
  207|      3|      }  // minimal bound checking
  208|       |
  209|  6.10k|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (209:11): [True: 16, False: 6.08k]
  ------------------
  210|     16|        return 0;
  211|     16|      }
  212|  6.08k|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (212:11): [True: 2, False: 6.08k]
  ------------------
  213|      2|        return 0;
  214|      2|      }
  215|       |      // range check
  216|  6.08k|      uint32_t code_point = (leading_byte & 0b00001111) << 12 |
  217|  6.08k|                            (data[pos + 1] & 0b00111111) << 6 |
  218|  6.08k|                            (data[pos + 2] & 0b00111111);
  219|  6.08k|      if (code_point < 0x800 || 0xffff < code_point ||
  ------------------
  |  Branch (219:11): [True: 2, False: 6.08k]
  |  Branch (219:33): [True: 0, False: 6.08k]
  ------------------
  220|  6.08k|          (0xd7ff < code_point && code_point < 0xe000)) {
  ------------------
  |  Branch (220:12): [True: 1.72k, False: 4.36k]
  |  Branch (220:35): [True: 1, False: 1.72k]
  ------------------
  221|      3|        return 0;
  222|      3|      }
  223|  6.08k|      *utf32_output++ = char32_t(code_point);
  224|  6.08k|      pos += 3;
  225|  6.08k|    } else if ((leading_byte & 0b11111000) == 0b11110000) {  // 0b11110000
  ------------------
  |  Branch (225:16): [True: 461, False: 72]
  ------------------
  226|       |      // we have a 4-byte UTF-8 word.
  227|    461|      if (pos + 3 >= len) {
  ------------------
  |  Branch (227:11): [True: 9, False: 452]
  ------------------
  228|      9|        return 0;
  229|      9|      }  // minimal bound checking
  230|    452|      if ((data[pos + 1] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (230:11): [True: 7, False: 445]
  ------------------
  231|      7|        return 0;
  232|      7|      }
  233|    445|      if ((data[pos + 2] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (233:11): [True: 3, False: 442]
  ------------------
  234|      3|        return 0;
  235|      3|      }
  236|    442|      if ((data[pos + 3] & 0b11000000) != 0b10000000) {
  ------------------
  |  Branch (236:11): [True: 3, False: 439]
  ------------------
  237|      3|        return 0;
  238|      3|      }
  239|       |
  240|       |      // range check
  241|    439|      uint32_t code_point = (leading_byte & 0b00000111) << 18 |
  242|    439|                            (data[pos + 1] & 0b00111111) << 12 |
  243|    439|                            (data[pos + 2] & 0b00111111) << 6 |
  244|    439|                            (data[pos + 3] & 0b00111111);
  245|    439|      if (code_point <= 0xffff || 0x10ffff < code_point) {
  ------------------
  |  Branch (245:11): [True: 6, False: 433]
  |  Branch (245:35): [True: 2, False: 431]
  ------------------
  246|      8|        return 0;
  247|      8|      }
  248|    431|      *utf32_output++ = char32_t(code_point);
  249|    431|      pos += 4;
  250|    431|    } else {
  251|     72|      return 0;
  252|     72|    }
  253|  25.6k|  }
  254|  2.49k|  return utf32_output - start;
  255|  2.66k|}
_ZN3ada4idna22utf32_length_from_utf8EPKcm:
  270|  2.67k|size_t utf32_length_from_utf8(const char* buf, size_t len) {
  271|  2.67k|  const int8_t* p = reinterpret_cast<const int8_t*>(buf);
  272|  2.67k|  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.67k|    return c > -65;
  276|  2.67k|  });
  277|  2.67k|}
_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|    167|void ascii_map(char* input, size_t length) {
 5127|    167|  auto broadcast = [](uint8_t v) -> uint64_t {
 5128|    167|    return 0x101010101010101ull * v;
 5129|    167|  };
 5130|    167|  uint64_t broadcast_80 = broadcast(0x80);
 5131|    167|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 5132|    167|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 5133|    167|  size_t i = 0;
 5134|       |
 5135|    530|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (5135:10): [True: 363, False: 167]
  ------------------
 5136|    363|    uint64_t word{};
 5137|    363|    std::memcpy(&word, input + i, sizeof(word));
 5138|    363|    word ^=
 5139|    363|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5140|    363|    std::memcpy(input + i, &word, sizeof(word));
 5141|    363|  }
 5142|    167|  if (i < length) {
  ------------------
  |  Branch (5142:7): [True: 126, False: 41]
  ------------------
 5143|    126|    uint64_t word{};
 5144|    126|    std::memcpy(&word, input + i, length - i);
 5145|    126|    word ^=
 5146|    126|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 5147|    126|    std::memcpy(input + i, &word, length - i);
 5148|    126|  }
 5149|    167|}
_ZN3ada4idna3mapENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEERNS1_12basic_stringIDiS4_NS1_9allocatorIDiEEEE:
 5153|  3.53k|bool map(std::u32string_view input, std::u32string& out) {
 5154|       |  //  [Map](https://www.unicode.org/reports/tr46/#ProcessingStepMap).
 5155|  3.53k|  out.clear();
 5156|  3.53k|  if (!ensure_tables()) {
  ------------------
  |  Branch (5156:7): [True: 0, False: 3.53k]
  ------------------
 5157|      0|    return false;
 5158|      0|  }
 5159|       |
 5160|       |  // Pass 1: validate and compute exact output length.
 5161|  3.53k|  size_t out_size = 0;
 5162|  45.9k|  for (char32_t x : input) {
  ------------------
  |  Branch (5162:19): [True: 45.9k, False: 3.33k]
  ------------------
 5163|  45.9k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5164|  45.9k|    if (status == IDNA_DISALLOWED) {
  ------------------
  |  Branch (5164:9): [True: 203, False: 45.7k]
  ------------------
 5165|    203|      return false;
 5166|    203|    }
 5167|  45.7k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5167:9): [True: 35.3k, False: 10.4k]
  ------------------
 5168|  35.3k|      ++out_size;
 5169|  35.3k|      continue;
 5170|  35.3k|    }
 5171|  10.4k|    if (static_cast<size_t>(status) >= idna_utf8_mappings_size) {
  ------------------
  |  Branch (5171:9): [True: 0, False: 10.4k]
  ------------------
 5172|      0|      return false;
 5173|      0|    }
 5174|  10.4k|    out_size += utf8_count_codepoints(idna_utf8_mappings + status);
 5175|  10.4k|  }
 5176|       |
 5177|       |  // Pass 2: write into a single allocation.
 5178|  3.33k|  out.resize(out_size);
 5179|  3.33k|  size_t w = 0;
 5180|  45.5k|  for (char32_t x : input) {
  ------------------
  |  Branch (5180:19): [True: 45.5k, False: 3.33k]
  ------------------
 5181|  45.5k|    uint16_t status = idna_lookup(static_cast<uint32_t>(x));
 5182|  45.5k|    if (status == IDNA_VALID) {
  ------------------
  |  Branch (5182:9): [True: 35.1k, False: 10.3k]
  ------------------
 5183|  35.1k|      out[w++] = x;
 5184|  35.1k|      continue;
 5185|  35.1k|    }
 5186|       |    // IGNORED or mapped (status already validated in pass 1).
 5187|  10.3k|    const uint8_t* ptr = idna_utf8_mappings + status;
 5188|  62.6k|    while (*ptr != 0) {
  ------------------
  |  Branch (5188:12): [True: 52.3k, False: 10.3k]
  ------------------
 5189|  52.3k|      out[w++] = utf8_next(ptr);
 5190|  52.3k|    }
 5191|  10.3k|  }
 5192|  3.33k|  return true;
 5193|  3.53k|}
_ZN3ada4idna28compute_decomposition_lengthENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5286|    921|    const std::u32string_view input) noexcept {
 5287|    921|  bool decomposition_needed{false};
 5288|    921|  size_t additional_elements{0};
 5289|  15.8k|  for (char32_t current_character : input) {
  ------------------
  |  Branch (5289:35): [True: 15.8k, False: 921]
  ------------------
 5290|  15.8k|    size_t decomposition_length{0};
 5291|       |
 5292|  15.8k|    if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5292:9): [True: 1.57k, False: 14.3k]
  ------------------
 5293|  1.57k|        current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5293:9): [True: 810, False: 765]
  ------------------
 5294|       |      // Full NFD-style Hangul decomp for the decompose() step.
 5295|    810|      decomposition_length = 2;
 5296|    810|      if ((current_character - hangul_sbase) % hangul_tcount) {
  ------------------
  |  Branch (5296:11): [True: 557, False: 253]
  ------------------
 5297|    557|        decomposition_length = 3;
 5298|    557|      }
 5299|  15.0k|    } else if (current_character < 0x110000) {
  ------------------
  |  Branch (5299:16): [True: 15.0k, False: 0]
  ------------------
 5300|  15.0k|      const uint8_t di = decomposition_index[current_character >> 8];
 5301|  15.0k|      const uint16_t* const decomposition =
 5302|  15.0k|          decomposition_block_row(di) + (current_character % 256);
 5303|  15.0k|      decomposition_length = (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5304|  15.0k|      if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5304:11): [True: 1.23k, False: 13.8k]
  |  Branch (5304:41): [True: 0, False: 1.23k]
  ------------------
 5305|      0|        decomposition_length = 0;
 5306|      0|      }
 5307|  15.0k|    }
 5308|  15.8k|    if (decomposition_length != 0) {
  ------------------
  |  Branch (5308:9): [True: 2.04k, False: 13.8k]
  ------------------
 5309|  2.04k|      decomposition_needed = true;
 5310|  2.04k|      additional_elements += decomposition_length - 1;
 5311|  2.04k|    }
 5312|  15.8k|  }
 5313|    921|  return {decomposition_needed, additional_elements};
 5314|    921|}
_ZN3ada4idna9decomposeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEEm:
 5316|    594|void decompose(std::u32string& input, size_t additional_elements) {
 5317|    594|  input.resize(input.size() + additional_elements);
 5318|    594|  for (size_t descending_idx = input.size(),
 5319|    594|              input_count = descending_idx - additional_elements;
 5320|  10.6k|       input_count--;) {
  ------------------
  |  Branch (5320:8): [True: 10.0k, False: 594]
  ------------------
 5321|  10.0k|    if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5321:9): [True: 1.20k, False: 8.86k]
  ------------------
 5322|  1.20k|        input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5322:9): [True: 810, False: 394]
  ------------------
 5323|       |      // Hangul decomposition.
 5324|    810|      char32_t s_index = input[input_count] - hangul_sbase;
 5325|    810|      if (s_index % hangul_tcount != 0) {
  ------------------
  |  Branch (5325:11): [True: 557, False: 253]
  ------------------
 5326|    557|        input[--descending_idx] = hangul_tbase + s_index % hangul_tcount;
 5327|    557|      }
 5328|    810|      input[--descending_idx] =
 5329|    810|          hangul_vbase + (s_index % hangul_ncount) / hangul_tcount;
 5330|    810|      input[--descending_idx] = hangul_lbase + s_index / hangul_ncount;
 5331|  9.25k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5331:16): [True: 9.25k, False: 0]
  ------------------
 5332|  9.25k|      const uint16_t* decomposition =
 5333|  9.25k|          decomposition_block_row(
 5334|  9.25k|              decomposition_index[input[input_count] >> 8]) +
 5335|  9.25k|          (input[input_count] % 256);
 5336|  9.25k|      uint16_t decomposition_length =
 5337|  9.25k|          (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5338|  9.25k|      if (decomposition_length > 0 && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5338:11): [True: 1.23k, False: 8.02k]
  |  Branch (5338:39): [True: 0, False: 1.23k]
  ------------------
 5339|      0|        decomposition_length = 0;
 5340|      0|      }
 5341|  9.25k|      if (decomposition_length > 0) {
  ------------------
  |  Branch (5341:11): [True: 1.23k, False: 8.02k]
  ------------------
 5342|  1.23k|        const size_t base = static_cast<size_t>(decomposition[0] >> 2);
 5343|  1.23k|        if (base + decomposition_length > decomposition_data_size) {
  ------------------
  |  Branch (5343:13): [True: 0, False: 1.23k]
  ------------------
 5344|      0|          input[--descending_idx] = input[input_count];
 5345|  1.23k|        } else {
 5346|  4.22k|          while (decomposition_length-- > 0) {
  ------------------
  |  Branch (5346:18): [True: 2.98k, False: 1.23k]
  ------------------
 5347|  2.98k|            input[--descending_idx] =
 5348|  2.98k|                decomposition_data[base + decomposition_length];
 5349|  2.98k|          }
 5350|  1.23k|        }
 5351|  8.02k|      } else {
 5352|  8.02k|        input[--descending_idx] = input[input_count];
 5353|  8.02k|      }
 5354|  9.25k|    } else {
 5355|      0|      input[--descending_idx] = input[input_count];
 5356|      0|    }
 5357|  10.0k|  }
 5358|    594|}
_ZN3ada4idna7get_cccEDi:
 5360|   275k|uint8_t get_ccc(char32_t c) noexcept {
 5361|   275k|  if (c >= 0x110000) {
  ------------------
  |  Branch (5361:7): [True: 0, False: 275k]
  ------------------
 5362|      0|    return 0;
 5363|      0|  }
 5364|   275k|  return ccc_block_row(ccc_index[c >> 8])[c % 256];
 5365|   275k|}
_ZN3ada4idna10sort_marksERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5367|    921|void sort_marks(std::u32string& input) {
 5368|  18.9k|  for (size_t idx = 1; idx < input.size(); idx++) {
  ------------------
  |  Branch (5368:24): [True: 18.0k, False: 921]
  ------------------
 5369|  18.0k|    uint8_t ccc = get_ccc(input[idx]);
 5370|  18.0k|    if (ccc == 0) {
  ------------------
  |  Branch (5370:9): [True: 14.3k, False: 3.72k]
  ------------------
 5371|  14.3k|      continue;
 5372|  14.3k|    }
 5373|  3.72k|    auto current_character = input[idx];
 5374|  3.72k|    size_t back_idx = idx;
 5375|  14.3k|    while (back_idx != 0 && get_ccc(input[back_idx - 1]) > ccc) {
  ------------------
  |  Branch (5375:12): [True: 14.2k, False: 86]
  |  Branch (5375:29): [True: 10.6k, False: 3.63k]
  ------------------
 5376|  10.6k|      input[back_idx] = input[back_idx - 1];
 5377|  10.6k|      back_idx--;
 5378|  10.6k|    }
 5379|  3.72k|    input[back_idx] = current_character;
 5380|  3.72k|  }
 5381|    921|}
_ZN3ada4idna13decompose_nfcERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5383|    921|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|    921|  auto [decomposition_needed, additional_elements] =
 5389|    921|      compute_decomposition_length(input);
 5390|    921|  if (decomposition_needed) {
  ------------------
  |  Branch (5390:7): [True: 594, False: 327]
  ------------------
 5391|    594|    decompose(input, additional_elements);
 5392|    594|  }
 5393|    921|  sort_marks(input);
 5394|    921|}
_ZN3ada4idna14is_already_nfcENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5477|  3.79k|bool is_already_nfc(std::u32string_view input) noexcept {
 5478|  3.79k|  if (input.empty()) {
  ------------------
  |  Branch (5478:7): [True: 0, False: 3.79k]
  ------------------
 5479|      0|    return true;
 5480|      0|  }
 5481|  3.79k|  if (!tables_are_ready() && !ensure_tables()) {
  ------------------
  |  Branch (5481:7): [True: 0, False: 3.79k]
  |  Branch (5481:30): [True: 0, False: 0]
  ------------------
 5482|      0|    return false;
 5483|      0|  }
 5484|       |  // 1) Singleton decompositions are never NFC (e.g. U+212B ANGSTROM SIGN).
 5485|       |  //    Multi-code-point decomps are primary composites that are NFC as-is.
 5486|  85.0k|  for (char32_t c : input) {
  ------------------
  |  Branch (5486:19): [True: 85.0k, False: 3.79k]
  ------------------
 5487|  85.0k|    if (canonical_decomp_length(c) == 1) {
  ------------------
  |  Branch (5487:9): [True: 0, False: 85.0k]
  ------------------
 5488|      0|      return false;
 5489|      0|    }
 5490|  85.0k|  }
 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.79k|  uint8_t prev_ccc = 0;
 5495|  81.4k|  for (char32_t c : input) {
  ------------------
  |  Branch (5495:19): [True: 81.4k, False: 2.73k]
  ------------------
 5496|  81.4k|    uint8_t ccc = get_ccc(c);
 5497|  81.4k|    if (ccc != 0 && prev_ccc > ccc) {
  ------------------
  |  Branch (5497:9): [True: 3.62k, False: 77.8k]
  |  Branch (5497:21): [True: 1.05k, False: 2.56k]
  ------------------
 5498|  1.05k|      return false;
 5499|  1.05k|    }
 5500|  80.4k|    prev_ccc = trailing_ccc(c);
 5501|  80.4k|  }
 5502|       |  // 3) No pairwise composition would apply (including Hangul L+V / LV+T).
 5503|  2.73k|  return !would_compose(input);
 5504|  3.79k|}
_ZN3ada4idna7composeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5506|    921|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|    921|  size_t input_count{0};
 5512|    921|  size_t composition_count{0};
 5513|  14.8k|  for (; input_count < input.size(); input_count++, composition_count++) {
  ------------------
  |  Branch (5513:10): [True: 13.8k, False: 921]
  ------------------
 5514|  13.8k|    input[composition_count] = input[input_count];
 5515|  13.8k|    if (input[input_count] >= hangul_lbase &&
  ------------------
  |  Branch (5515:9): [True: 2.67k, False: 11.2k]
  ------------------
 5516|  2.67k|        input[input_count] < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5516:9): [True: 1.19k, False: 1.47k]
  ------------------
 5517|  1.19k|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5517:11): [True: 1.16k, False: 23]
  ------------------
 5518|  1.16k|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5518:11): [True: 969, False: 200]
  ------------------
 5519|    969|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5519:11): [True: 863, False: 106]
  ------------------
 5520|    863|        input[composition_count] =
 5521|    863|            hangul_sbase +
 5522|    863|            ((input[input_count] - hangul_lbase) * hangul_vcount +
 5523|    863|             input[input_count + 1] - hangul_vbase) *
 5524|    863|                hangul_tcount;
 5525|    863|        input_count++;
 5526|    863|        if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5526:13): [True: 836, False: 27]
  ------------------
 5527|    836|            input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5527:13): [True: 645, False: 191]
  ------------------
 5528|    645|            input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5528:13): [True: 557, False: 88]
  ------------------
 5529|    557|          input[composition_count] += input[++input_count] - hangul_tbase;
 5530|    557|        }
 5531|    863|      }
 5532|  12.6k|    } else if (input[input_count] >= hangul_sbase &&
  ------------------
  |  Branch (5532:16): [True: 682, False: 12.0k]
  ------------------
 5533|    682|               input[input_count] < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5533:16): [True: 0, False: 682]
  ------------------
 5534|      0|      if ((input[input_count] - hangul_sbase) % hangul_tcount &&
  ------------------
  |  Branch (5534:11): [True: 0, False: 0]
  ------------------
 5535|      0|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5535:11): [True: 0, False: 0]
  ------------------
 5536|      0|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5536:11): [True: 0, False: 0]
  ------------------
 5537|      0|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5537:11): [True: 0, False: 0]
  ------------------
 5538|      0|        input[composition_count] += input[++input_count] - hangul_tbase;
 5539|      0|      }
 5540|  12.6k|    } else if (input[input_count] < 0x110000) {
  ------------------
  |  Branch (5540:16): [True: 12.6k, False: 0]
  ------------------
 5541|  12.6k|      const uint16_t* composition =
 5542|  12.6k|          composition_block_row(composition_index[input[input_count] >> 8]) +
 5543|  12.6k|          (input[input_count] % 256);
 5544|  12.6k|      size_t initial_composition_count = composition_count;
 5545|  16.3k|      for (int32_t previous_ccc = -1; input_count + 1 < input.size();
  ------------------
  |  Branch (5545:39): [True: 15.5k, False: 863]
  ------------------
 5546|  15.5k|           input_count++) {
 5547|  15.5k|        uint8_t ccc = get_ccc(input[input_count + 1]);
 5548|       |
 5549|  15.5k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5549:13): [True: 5.99k, False: 9.52k]
  |  Branch (5549:49): [True: 5.60k, False: 397]
  ------------------
 5550|  5.60k|          int left = composition[0];
 5551|  5.60k|          int right = composition[1];
 5552|  5.60k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5552:15): [True: 0, False: 5.60k]
  |  Branch (5552:27): [True: 0, False: 5.60k]
  ------------------
 5553|  5.60k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5553:15): [True: 0, False: 5.60k]
  ------------------
 5554|      0|            break;
 5555|      0|          }
 5556|  13.9k|          while (left + 2 < right) {
  ------------------
  |  Branch (5556:18): [True: 8.39k, False: 5.60k]
  ------------------
 5557|  8.39k|            int middle = left + (((right - left) >> 1) & ~1);
 5558|  8.39k|            if (composition_data[static_cast<size_t>(middle)] <=
  ------------------
  |  Branch (5558:17): [True: 3.08k, False: 5.31k]
  ------------------
 5559|  8.39k|                input[input_count + 1]) {
 5560|  3.08k|              left = middle;
 5561|  3.08k|            }
 5562|  8.39k|            if (composition_data[static_cast<size_t>(middle)] >=
  ------------------
  |  Branch (5562:17): [True: 7.01k, False: 1.37k]
  ------------------
 5563|  8.39k|                input[input_count + 1]) {
 5564|  7.01k|              right = middle;
 5565|  7.01k|            }
 5566|  8.39k|          }
 5567|  5.60k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5567:15): [True: 5.60k, False: 0]
  ------------------
 5568|  5.60k|              composition_data[static_cast<size_t>(left)] ==
  ------------------
  |  Branch (5568:15): [True: 2.03k, False: 3.56k]
  ------------------
 5569|  5.60k|                  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.60k|        }
 5578|       |
 5579|  13.4k|        if (ccc == 0) {
  ------------------
  |  Branch (5579:13): [True: 11.8k, False: 1.64k]
  ------------------
 5580|  11.8k|          break;
 5581|  11.8k|        }
 5582|  1.64k|        previous_ccc = ccc;
 5583|  1.64k|        input[++composition_count] = input[input_count + 1];
 5584|  1.64k|      }
 5585|  12.6k|    }
 5586|  13.8k|  }
 5587|       |
 5588|    921|  if (composition_count < input_count) {
  ------------------
  |  Branch (5588:7): [True: 833, False: 88]
  ------------------
 5589|    833|    input.resize(composition_count);
 5590|    833|  }
 5591|    921|}
_ZN3ada4idna9normalizeERNSt3__112basic_stringIDiNS1_11char_traitsIDiEENS1_9allocatorIDiEEEE:
 5593|    921|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|    921|  if (!ensure_tables() || decomposition_index == nullptr ||
  ------------------
  |  Branch (5598:7): [True: 0, False: 921]
  |  Branch (5598:27): [True: 0, False: 921]
  ------------------
 5599|    921|      composition_index == nullptr) {
  ------------------
  |  Branch (5599:7): [True: 0, False: 921]
  ------------------
 5600|      0|    return false;
 5601|      0|  }
 5602|    921|  if (is_already_nfc(input)) {
  ------------------
  |  Branch (5602:7): [True: 0, False: 921]
  ------------------
 5603|      0|    return true;
 5604|      0|  }
 5605|    921|  decompose_nfc(input);
 5606|    921|  compose(input);
 5607|    921|  return true;
 5608|    921|}
_ZN3ada4idna17punycode_to_utf32ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIDiNS3_IDiEENS1_9allocatorIDiEEEE:
 5668|  1.17k|bool punycode_to_utf32(std::string_view input, std::u32string &out) {
 5669|  1.17k|  int32_t written_out{0};
 5670|  1.17k|  out.reserve(out.size() + input.size());
 5671|  1.17k|  uint32_t n = initial_n;
 5672|  1.17k|  int32_t i = 0;
 5673|  1.17k|  int32_t bias = initial_bias;
 5674|       |  // grab ascii content
 5675|  1.17k|  size_t end_of_ascii = input.find_last_of('-');
 5676|  1.17k|  if (end_of_ascii != std::string_view::npos) {
  ------------------
  |  Branch (5676:7): [True: 221, False: 954]
  ------------------
 5677|  1.44k|    for (uint8_t c : input.substr(0, end_of_ascii)) {
  ------------------
  |  Branch (5677:20): [True: 1.44k, False: 221]
  ------------------
 5678|  1.44k|      if (c >= 0x80) {
  ------------------
  |  Branch (5678:11): [True: 0, False: 1.44k]
  ------------------
 5679|      0|        return false;
 5680|      0|      }
 5681|  1.44k|      out.push_back(c);
 5682|  1.44k|      written_out++;
 5683|  1.44k|    }
 5684|    221|    input.remove_prefix(end_of_ascii + 1);
 5685|    221|  }
 5686|  9.44k|  while (!input.empty()) {
  ------------------
  |  Branch (5686:10): [True: 8.34k, False: 1.09k]
  ------------------
 5687|  8.34k|    int32_t oldi = i;
 5688|  8.34k|    int32_t w = 1;
 5689|  12.9k|    for (int32_t k = base;; k += base) {
 5690|  12.9k|      if (input.empty()) {
  ------------------
  |  Branch (5690:11): [True: 39, False: 12.9k]
  ------------------
 5691|     39|        return false;
 5692|     39|      }
 5693|  12.9k|      uint8_t code_point = input.front();
 5694|  12.9k|      input.remove_prefix(1);
 5695|  12.9k|      int32_t digit = char_to_digit_value(code_point);
 5696|  12.9k|      if (digit < 0) {
  ------------------
  |  Branch (5696:11): [True: 11, False: 12.8k]
  ------------------
 5697|     11|        return false;
 5698|     11|      }
 5699|  12.8k|      if (digit > (0x7fffffff - i) / w) {
  ------------------
  |  Branch (5699:11): [True: 6, False: 12.8k]
  ------------------
 5700|      6|        return false;
 5701|      6|      }
 5702|  12.8k|      i = i + digit * w;
 5703|  12.8k|      int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5703:19): [True: 2.94k, False: 9.93k]
  |  Branch (5703:38): [True: 9.34k, False: 593]
  ------------------
 5704|  12.8k|      if (digit < t) {
  ------------------
  |  Branch (5704:11): [True: 8.29k, False: 4.59k]
  ------------------
 5705|  8.29k|        break;
 5706|  8.29k|      }
 5707|  4.59k|      if (w > 0x7fffffff / (base - t)) {
  ------------------
  |  Branch (5707:11): [True: 0, False: 4.59k]
  ------------------
 5708|      0|        return false;
 5709|      0|      }
 5710|  4.59k|      w = w * (base - t);
 5711|  4.59k|    }
 5712|  8.29k|    bias = adapt(i - oldi, written_out + 1, oldi == 0);
 5713|  8.29k|    if (i / (written_out + 1) > int32_t(0x7fffffff - n)) {
  ------------------
  |  Branch (5713:9): [True: 27, False: 8.26k]
  ------------------
 5714|     27|      return false;
 5715|     27|    }
 5716|  8.26k|    n = n + i / (written_out + 1);
 5717|  8.26k|    i = i % (written_out + 1);
 5718|  8.26k|    if (n < 0x80) {
  ------------------
  |  Branch (5718:9): [True: 0, False: 8.26k]
  ------------------
 5719|      0|      return false;
 5720|      0|    }
 5721|  8.26k|    out.insert(out.begin() + i, n);
 5722|  8.26k|    written_out++;
 5723|  8.26k|    ++i;
 5724|  8.26k|  }
 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: 434, False: 658]
  |  Branch (5727:26): [True: 134, False: 300]
  |  Branch (5727:44): [True: 87, False: 47]
  |  Branch (5727:62): [True: 45, False: 42]
  ------------------
 5728|     45|      out[3] == U'-') {
  ------------------
  |  Branch (5728:7): [True: 1, False: 44]
  ------------------
 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|  3.16k|bool utf32_to_punycode(std::u32string_view input, std::string &out) {
 5813|  3.16k|  out.reserve(input.size() + out.size());
 5814|  3.16k|  uint32_t n = initial_n;
 5815|  3.16k|  int32_t d = 0;
 5816|  3.16k|  int32_t bias = initial_bias;
 5817|  3.16k|  size_t h = 0;
 5818|       |  // first push the ascii content
 5819|  24.8k|  for (uint32_t c : input) {
  ------------------
  |  Branch (5819:19): [True: 24.8k, False: 3.16k]
  ------------------
 5820|  24.8k|    if (c < 0x80) {
  ------------------
  |  Branch (5820:9): [True: 3.39k, False: 21.4k]
  ------------------
 5821|  3.39k|      ++h;
 5822|  3.39k|      out.push_back(char(c));
 5823|  3.39k|    }
 5824|  24.8k|    if (c > 0x10ffff || (c >= 0xd800 && c < 0xe000)) {
  ------------------
  |  Branch (5824:9): [True: 0, False: 24.8k]
  |  Branch (5824:26): [True: 477, False: 24.3k]
  |  Branch (5824:41): [True: 0, False: 477]
  ------------------
 5825|      0|      return false;
 5826|      0|    }
 5827|  24.8k|  }
 5828|  3.16k|  size_t b = h;
 5829|  3.16k|  if (b > 0) {
  ------------------
  |  Branch (5829:7): [True: 627, False: 2.53k]
  ------------------
 5830|    627|    out.push_back('-');
 5831|    627|  }
 5832|  15.0k|  while (h < input.size()) {
  ------------------
  |  Branch (5832:10): [True: 11.9k, False: 3.16k]
  ------------------
 5833|  11.9k|    uint32_t m = 0x10FFFF;
 5834|   202k|    for (auto code_point : input) {
  ------------------
  |  Branch (5834:26): [True: 202k, False: 11.9k]
  ------------------
 5835|   202k|      if (code_point >= n && code_point < m) m = code_point;
  ------------------
  |  Branch (5835:11): [True: 89.7k, False: 112k]
  |  Branch (5835:30): [True: 19.0k, False: 70.7k]
  ------------------
 5836|   202k|    }
 5837|       |
 5838|  11.9k|    if ((m - n) > (0x7fffffff - d) / (h + 1)) {
  ------------------
  |  Branch (5838:9): [True: 0, False: 11.9k]
  ------------------
 5839|      0|      return false;
 5840|      0|    }
 5841|  11.9k|    d = d + int32_t((m - n) * (h + 1));
 5842|  11.9k|    n = m;
 5843|   202k|    for (auto c : input) {
  ------------------
  |  Branch (5843:17): [True: 202k, False: 11.9k]
  ------------------
 5844|   202k|      if (c < n) {
  ------------------
  |  Branch (5844:11): [True: 112k, False: 89.7k]
  ------------------
 5845|   112k|        if (d == 0x7fffffff) {
  ------------------
  |  Branch (5845:13): [True: 0, False: 112k]
  ------------------
 5846|      0|          return false;
 5847|      0|        }
 5848|   112k|        ++d;
 5849|   112k|      }
 5850|   202k|      if (c == n) {
  ------------------
  |  Branch (5850:11): [True: 21.4k, False: 180k]
  ------------------
 5851|  21.4k|        int32_t q = d;
 5852|  38.4k|        for (int32_t k = base;; k += base) {
 5853|  38.4k|          int32_t t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
  ------------------
  |  Branch (5853:23): [True: 7.36k, False: 31.0k]
  |  Branch (5853:42): [True: 24.7k, False: 6.25k]
  ------------------
 5854|       |
 5855|  38.4k|          if (q < t) {
  ------------------
  |  Branch (5855:15): [True: 21.4k, False: 16.9k]
  ------------------
 5856|  21.4k|            break;
 5857|  21.4k|          }
 5858|  16.9k|          out.push_back(digit_to_char(t + ((q - t) % (base - t))));
 5859|  16.9k|          q = (q - t) / (base - t);
 5860|  16.9k|        }
 5861|  21.4k|        out.push_back(digit_to_char(q));
 5862|  21.4k|        bias = adapt(d, int32_t(h + 1), h == b);
 5863|  21.4k|        d = 0;
 5864|  21.4k|        ++h;
 5865|  21.4k|      }
 5866|   202k|    }
 5867|  11.9k|    ++d;
 5868|  11.9k|    ++n;
 5869|  11.9k|  }
 5870|  3.16k|  return true;
 5871|  3.16k|}
_ZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5955|  4.49k|bool is_label_valid(const std::u32string_view label) {
 5956|  4.49k|  if (label.empty()) {
  ------------------
  |  Branch (5956:7): [True: 0, False: 4.49k]
  ------------------
 5957|      0|    return true;
 5958|      0|  }
 5959|  4.49k|  if (!ensure_tables() || combining_ranges == nullptr || dir_start == nullptr ||
  ------------------
  |  Branch (5959:7): [True: 0, False: 4.49k]
  |  Branch (5959:27): [True: 0, False: 4.49k]
  |  Branch (5959:58): [True: 0, False: 4.49k]
  ------------------
 5960|  4.49k|      dir_final == nullptr || dir_value == nullptr) {
  ------------------
  |  Branch (5960:7): [True: 0, False: 4.49k]
  |  Branch (5960:31): [True: 0, False: 4.49k]
  ------------------
 5961|      0|    return false;
 5962|      0|  }
 5963|       |
 5964|       |  ///////////////
 5965|       |  // We have a normalization step which ensures that we are in NFC.
 5966|       |  // If we receive punycode, we normalize and check that the normalized
 5967|       |  // version matches the original.
 5968|       |  // --------------------------------------
 5969|       |  // The label must be in Unicode Normalization Form NFC.
 5970|       |
 5971|       |  // Current URL standard indicatest that CheckHyphens is set to false.
 5972|       |  // ---------------------------------------
 5973|       |  // If CheckHyphens, the label must not contain a U+002D HYPHEN-MINUS character
 5974|       |  // in both the third and fourth positions. If CheckHyphens, the label must
 5975|       |  // neither begin nor end with a U+002D HYPHEN-MINUS character.
 5976|       |
 5977|       |  // This is not necessary because we segment the
 5978|       |  // labels by '.'.
 5979|       |  // ---------------------------------------
 5980|       |  // The label must not contain a U+002E ( . ) FULL STOP.
 5981|       |  // if (label.find('.') != std::string_view::npos) return false;
 5982|       |
 5983|       |  // The label must not begin with a combining mark.
 5984|       |  // Range membership via lower_bound on range end.
 5985|  4.49k|  const std::span<const uint32_t[2]> comb_span{combining_ranges,
 5986|  4.49k|                                               combining_range_count};
 5987|  4.49k|  const auto comb_it = std::ranges::lower_bound(
 5988|  4.49k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
 5989|  4.49k|  if (comb_it != comb_span.end() && label.front() >= (*comb_it)[0]) {
  ------------------
  |  Branch (5989:7): [True: 4.49k, False: 0]
  |  Branch (5989:7): [True: 89, False: 4.40k]
  |  Branch (5989:37): [True: 89, False: 4.40k]
  ------------------
 5990|     89|    return false;
 5991|     89|  }
 5992|       |  // We verify this next step as part of the mapping:
 5993|       |  // ---------------------------------------------
 5994|       |  // Each code point in the label must only have certain status values
 5995|       |  // according to Section 5, IDNA Mapping Table:
 5996|       |  // - For Transitional Processing, each value must be valid.
 5997|       |  // - For Nontransitional Processing, each value must be either valid or
 5998|       |  // deviation.
 5999|       |
 6000|       |  // If CheckJoiners, the label must satisfy the ContextJ rules from Appendix
 6001|       |  // A, in The Unicode Code Points and Internationalized Domain Names for
 6002|       |  // Applications (IDNA) [IDNA2008].
 6003|  4.40k|  constexpr static uint32_t virama[] = {
 6004|  4.40k|      0x094D,  0x09CD,  0x0A4D,  0x0ACD,  0x0B4D,  0x0BCD,  0x0C4D,  0x0CCD,
 6005|  4.40k|      0x0D3B,  0x0D3C,  0x0D4D,  0x0DCA,  0x0E3A,  0x0EBA,  0x0F84,  0x1039,
 6006|  4.40k|      0x103A,  0x1714,  0x1734,  0x17D2,  0x1A60,  0x1B44,  0x1BAA,  0x1BAB,
 6007|  4.40k|      0x1BF2,  0x1BF3,  0x2D7F,  0xA806,  0xA82C,  0xA8C4,  0xA953,  0xA9C0,
 6008|  4.40k|      0xAAF6,  0xABED,  0x10A3F, 0x11046, 0x1107F, 0x110B9, 0x11133, 0x11134,
 6009|  4.40k|      0x111C0, 0x11235, 0x112EA, 0x1134D, 0x11442, 0x114C2, 0x115BF, 0x1163F,
 6010|  4.40k|      0x116B6, 0x1172B, 0x11839, 0x1193D, 0x1193E, 0x119E0, 0x11A34, 0x11A47,
 6011|  4.40k|      0x11A99, 0x11C3F, 0x11D44, 0x11D45, 0x11D97};
 6012|  4.40k|  constexpr static uint32_t R[] = {
 6013|  4.40k|      0x622, 0x623, 0x624, 0x625, 0x627, 0x629, 0x62f, 0x630, 0x631,
 6014|  4.40k|      0x632, 0x648, 0x671, 0x672, 0x673, 0x675, 0x676, 0x677, 0x688,
 6015|  4.40k|      0x689, 0x68a, 0x68b, 0x68c, 0x68d, 0x68e, 0x68f, 0x690, 0x691,
 6016|  4.40k|      0x692, 0x693, 0x694, 0x695, 0x696, 0x697, 0x698, 0x699, 0x6c0,
 6017|  4.40k|      0x6c3, 0x6c4, 0x6c5, 0x6c6, 0x6c7, 0x6c8, 0x6c9, 0x6ca, 0x6cb,
 6018|  4.40k|      0x6cd, 0x6cf, 0x6d2, 0x6d3, 0x6d5, 0x6ee, 0x6ef, 0x710, 0x715,
 6019|  4.40k|      0x716, 0x717, 0x718, 0x719, 0x71e, 0x728, 0x72a, 0x72c, 0x72f,
 6020|  4.40k|      0x74d, 0x759, 0x75a, 0x75b, 0x854, 0x8aa, 0x8ab, 0x8ac};
 6021|  4.40k|  constexpr static uint32_t L[] = {0xa872};
 6022|  4.40k|  constexpr static uint32_t D[] = {
 6023|  4.40k|      0x620,  0x626,  0x628,  0x62a,  0x62b,  0x62c,  0x62d,  0x62e,  0x633,
 6024|  4.40k|      0x634,  0x635,  0x636,  0x637,  0x638,  0x639,  0x63a,  0x63b,  0x63c,
 6025|  4.40k|      0x63d,  0x63e,  0x63f,  0x641,  0x642,  0x643,  0x644,  0x645,  0x646,
 6026|  4.40k|      0x647,  0x649,  0x64a,  0x66e,  0x66f,  0x678,  0x679,  0x67a,  0x67b,
 6027|  4.40k|      0x67c,  0x67d,  0x67e,  0x67f,  0x680,  0x681,  0x682,  0x683,  0x684,
 6028|  4.40k|      0x685,  0x686,  0x687,  0x69a,  0x69b,  0x69c,  0x69d,  0x69e,  0x69f,
 6029|  4.40k|      0x6a0,  0x6a1,  0x6a2,  0x6a3,  0x6a4,  0x6a5,  0x6a6,  0x6a7,  0x6a8,
 6030|  4.40k|      0x6a9,  0x6aa,  0x6ab,  0x6ac,  0x6ad,  0x6ae,  0x6af,  0x6b0,  0x6b1,
 6031|  4.40k|      0x6b2,  0x6b3,  0x6b4,  0x6b5,  0x6b6,  0x6b7,  0x6b8,  0x6b9,  0x6ba,
 6032|  4.40k|      0x6bb,  0x6bc,  0x6bd,  0x6be,  0x6bf,  0x6c1,  0x6c2,  0x6cc,  0x6ce,
 6033|  4.40k|      0x6d0,  0x6d1,  0x6fa,  0x6fb,  0x6fc,  0x6ff,  0x712,  0x713,  0x714,
 6034|  4.40k|      0x71a,  0x71b,  0x71c,  0x71d,  0x71f,  0x720,  0x721,  0x722,  0x723,
 6035|  4.40k|      0x724,  0x725,  0x726,  0x727,  0x729,  0x72b,  0x72d,  0x72e,  0x74e,
 6036|  4.40k|      0x74f,  0x750,  0x751,  0x752,  0x753,  0x754,  0x755,  0x756,  0x757,
 6037|  4.40k|      0x758,  0x75c,  0x75d,  0x75e,  0x75f,  0x760,  0x761,  0x762,  0x763,
 6038|  4.40k|      0x764,  0x765,  0x766,  0x850,  0x851,  0x852,  0x853,  0x855,  0x8a0,
 6039|  4.40k|      0x8a2,  0x8a3,  0x8a4,  0x8a5,  0x8a6,  0x8a7,  0x8a8,  0x8a9,  0x1807,
 6040|  4.40k|      0x1820, 0x1821, 0x1822, 0x1823, 0x1824, 0x1825, 0x1826, 0x1827, 0x1828,
 6041|  4.40k|      0x1829, 0x182a, 0x182b, 0x182c, 0x182d, 0x182e, 0x182f, 0x1830, 0x1831,
 6042|  4.40k|      0x1832, 0x1833, 0x1834, 0x1835, 0x1836, 0x1837, 0x1838, 0x1839, 0x183a,
 6043|  4.40k|      0x183b, 0x183c, 0x183d, 0x183e, 0x183f, 0x1840, 0x1841, 0x1842, 0x1843,
 6044|  4.40k|      0x1844, 0x1845, 0x1846, 0x1847, 0x1848, 0x1849, 0x184a, 0x184b, 0x184c,
 6045|  4.40k|      0x184d, 0x184e, 0x184f, 0x1850, 0x1851, 0x1852, 0x1853, 0x1854, 0x1855,
 6046|  4.40k|      0x1856, 0x1857, 0x1858, 0x1859, 0x185a, 0x185b, 0x185c, 0x185d, 0x185e,
 6047|  4.40k|      0x185f, 0x1860, 0x1861, 0x1862, 0x1863, 0x1864, 0x1865, 0x1866, 0x1867,
 6048|  4.40k|      0x1868, 0x1869, 0x186a, 0x186b, 0x186c, 0x186d, 0x186e, 0x186f, 0x1870,
 6049|  4.40k|      0x1871, 0x1872, 0x1873, 0x1874, 0x1875, 0x1876, 0x1877, 0x1887, 0x1888,
 6050|  4.40k|      0x1889, 0x188a, 0x188b, 0x188c, 0x188d, 0x188e, 0x188f, 0x1890, 0x1891,
 6051|  4.40k|      0x1892, 0x1893, 0x1894, 0x1895, 0x1896, 0x1897, 0x1898, 0x1899, 0x189a,
 6052|  4.40k|      0x189b, 0x189c, 0x189d, 0x189e, 0x189f, 0x18a0, 0x18a1, 0x18a2, 0x18a3,
 6053|  4.40k|      0x18a4, 0x18a5, 0x18a6, 0x18a7, 0x18a8, 0x18aa, 0xa840, 0xa841, 0xa842,
 6054|  4.40k|      0xa843, 0xa844, 0xa845, 0xa846, 0xa847, 0xa848, 0xa849, 0xa84a, 0xa84b,
 6055|  4.40k|      0xa84c, 0xa84d, 0xa84e, 0xa84f, 0xa850, 0xa851, 0xa852, 0xa853, 0xa854,
 6056|  4.40k|      0xa855, 0xa856, 0xa857, 0xa858, 0xa859, 0xa85a, 0xa85b, 0xa85c, 0xa85d,
 6057|  4.40k|      0xa85e, 0xa85f, 0xa860, 0xa861, 0xa862, 0xa863, 0xa864, 0xa865, 0xa866,
 6058|  4.40k|      0xa867, 0xa868, 0xa869, 0xa86a, 0xa86b, 0xa86c, 0xa86d, 0xa86e, 0xa86f,
 6059|  4.40k|      0xa870, 0xa871};
 6060|       |
 6061|  46.2k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (6061:22): [True: 42.2k, False: 3.94k]
  ------------------
 6062|  42.2k|    uint32_t c = label[i];
 6063|  42.2k|    if (c == 0x200c) {
  ------------------
  |  Branch (6063:9): [True: 369, False: 41.9k]
  ------------------
 6064|    369|      if (i > 0) {
  ------------------
  |  Branch (6064:11): [True: 367, False: 2]
  ------------------
 6065|    367|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6065:13): [True: 19, False: 348]
  ------------------
 6066|     19|          return true;
 6067|     19|        }
 6068|    367|      }
 6069|    350|      if ((i == 0) || (i + 1 >= label.size())) {
  ------------------
  |  Branch (6069:11): [True: 2, False: 348]
  |  Branch (6069:23): [True: 33, False: 315]
  ------------------
 6070|     35|        return false;
 6071|     35|      }
 6072|       |      // we go backward looking for L or D
 6073|    315|      auto is_l_or_d = [](uint32_t code) {
 6074|    315|        return std::ranges::binary_search(L, code) ||
 6075|    315|               std::ranges::binary_search(D, code);
 6076|    315|      };
 6077|    315|      auto is_r_or_d = [](uint32_t code) {
 6078|    315|        return std::ranges::binary_search(R, code) ||
 6079|    315|               std::ranges::binary_search(D, code);
 6080|    315|      };
 6081|    315|      std::u32string_view before = label.substr(0, i);
 6082|    315|      std::u32string_view after = label.substr(i + 1);
 6083|    315|      return (std::find_if(before.begin(), before.end(), is_l_or_d) !=
  ------------------
  |  Branch (6083:14): [True: 262, False: 53]
  ------------------
 6084|    315|              before.end()) &&
 6085|    262|             (std::find_if(after.begin(), after.end(), is_r_or_d) !=
  ------------------
  |  Branch (6085:14): [True: 178, False: 84]
  ------------------
 6086|    262|              after.end());
 6087|  41.9k|    } else if (c == 0x200d) {
  ------------------
  |  Branch (6087:16): [True: 98, False: 41.8k]
  ------------------
 6088|     98|      if (i > 0) {
  ------------------
  |  Branch (6088:11): [True: 96, False: 2]
  ------------------
 6089|     96|        if (std::ranges::binary_search(virama, label[i - 1])) {
  ------------------
  |  Branch (6089:13): [True: 60, False: 36]
  ------------------
 6090|     60|          return true;
 6091|     60|        }
 6092|     96|      }
 6093|     38|      return false;
 6094|     98|    }
 6095|  42.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|  3.94k|  size_t last_non_nsm_char = find_last_not_of_nsm(label);
 6128|  3.94k|  if (last_non_nsm_char == std::u32string_view::npos) {
  ------------------
  |  Branch (6128:7): [True: 0, False: 3.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|  3.94k|  if (is_rtl_label(label)) {
  ------------------
  |  Branch (6135:7): [True: 919, False: 3.02k]
  ------------------
 6136|       |    // The first character must be a character with Bidi property L, R,
 6137|       |    // or AL. If it has the R or AL property, it is an RTL label; if it
 6138|       |    // has the L property, it is an LTR label.
 6139|       |
 6140|    919|    if (find_direction(label[0]) == direction::L) {
  ------------------
  |  Branch (6140:9): [True: 132, False: 787]
  ------------------
 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.31k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6145:26): [True: 1.31k, False: 0]
  ------------------
 6146|  1.31k|        const direction d = find_direction(label[i]);
 6147|  1.31k|        if (!(d == direction::L || d == direction::EN || d == direction::ES ||
  ------------------
  |  Branch (6147:15): [True: 577, False: 742]
  |  Branch (6147:36): [True: 79, False: 663]
  |  Branch (6147:58): [True: 76, False: 587]
  ------------------
 6148|    587|              d == direction::CS || d == direction::ET || d == direction::ON ||
  ------------------
  |  Branch (6148:15): [True: 72, False: 515]
  |  Branch (6148:37): [True: 67, False: 448]
  |  Branch (6148:59): [True: 82, False: 366]
  ------------------
 6149|    366|              d == direction::BN || d == direction::NSM)) {
  ------------------
  |  Branch (6149:15): [True: 156, False: 210]
  |  Branch (6149:37): [True: 78, False: 132]
  ------------------
 6150|    132|          return false;
 6151|    132|        }
 6152|  1.31k|      }
 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|    787|    } 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|    787|      const direction first_dir = find_direction(label[0]);
 6167|    787|      if (first_dir != direction::R && first_dir != direction::AL) {
  ------------------
  |  Branch (6167:11): [True: 501, False: 286]
  |  Branch (6167:40): [True: 40, False: 461]
  ------------------
 6168|     40|        return false;
 6169|     40|      }
 6170|       |
 6171|    747|      bool has_an = false;
 6172|    747|      bool has_en = false;
 6173|  3.76k|      for (size_t i = 0; i <= last_non_nsm_char; i++) {
  ------------------
  |  Branch (6173:26): [True: 3.12k, False: 636]
  ------------------
 6174|  3.12k|        const direction d = find_direction(label[i]);
 6175|       |
 6176|       |        // In an RTL label, if an EN is present, no AN may be present, and vice
 6177|       |        // versa.
 6178|  3.12k|        if ((d == direction::EN && ((has_en = true) && has_an)) ||
  ------------------
  |  Branch (6178:14): [True: 195, False: 2.93k]
  |  Branch (6178:37): [True: 195, False: 0]
  |  Branch (6178:56): [True: 1, False: 194]
  ------------------
 6179|  3.12k|            (d == direction::AN && ((has_an = true) && has_en))) {
  ------------------
  |  Branch (6179:14): [True: 109, False: 3.01k]
  |  Branch (6179:37): [True: 109, False: 0]
  |  Branch (6179:56): [True: 1, False: 108]
  ------------------
 6180|      2|          return false;
 6181|      2|        }
 6182|       |
 6183|  3.12k|        if (!(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6183:15): [True: 497, False: 2.62k]
  |  Branch (6183:36): [True: 1.67k, False: 949]
  |  Branch (6183:58): [True: 108, False: 841]
  ------------------
 6184|    841|              d == direction::EN || d == direction::ES || d == direction::CS ||
  ------------------
  |  Branch (6184:15): [True: 194, False: 647]
  |  Branch (6184:37): [True: 74, False: 573]
  |  Branch (6184:59): [True: 69, False: 504]
  ------------------
 6185|    504|              d == direction::ET || d == direction::ON || d == direction::BN ||
  ------------------
  |  Branch (6185:15): [True: 84, False: 420]
  |  Branch (6185:37): [True: 86, False: 334]
  |  Branch (6185:59): [True: 180, False: 154]
  ------------------
 6186|    154|              d == direction::NSM)) {
  ------------------
  |  Branch (6186:15): [True: 95, False: 59]
  ------------------
 6187|     59|          return false;
 6188|     59|        }
 6189|       |
 6190|  3.06k|        if (i == last_non_nsm_char &&
  ------------------
  |  Branch (6190:13): [True: 686, False: 2.37k]
  ------------------
 6191|    686|            !(d == direction::R || d == direction::AL || d == direction::AN ||
  ------------------
  |  Branch (6191:15): [True: 234, False: 452]
  |  Branch (6191:36): [True: 299, False: 153]
  |  Branch (6191:58): [True: 41, False: 112]
  ------------------
 6192|    112|              d == direction::EN)) {
  ------------------
  |  Branch (6192:15): [True: 62, False: 50]
  ------------------
 6193|     50|          return false;
 6194|     50|        }
 6195|  3.06k|      }
 6196|       |
 6197|    636|      return true;
 6198|    747|    }
 6199|    919|  }
 6200|       |
 6201|  3.02k|  return true;
 6202|  3.94k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6359|  2.84k|[[nodiscard]] bool to_ascii(std::string_view ut8_string, std::string& out) {
 6360|  2.84k|  out.clear();
 6361|  2.84k|  if (ut8_string.size() > max_domain_input_bytes) {
  ------------------
  |  Branch (6361:7): [True: 0, False: 2.84k]
  ------------------
 6362|      0|    return false;
 6363|      0|  }
 6364|  2.84k|  if (is_ascii(ut8_string)) {
  ------------------
  |  Branch (6364:7): [True: 167, False: 2.67k]
  ------------------
 6365|    167|    from_ascii_to_ascii(ut8_string, out);
 6366|    167|    return true;
 6367|    167|  }
 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.67k|  size_t utf32_length =
 6380|  2.67k|      ada::idna::utf32_length_from_utf8(ut8_string.data(), ut8_string.size());
 6381|  2.67k|  if (utf32_length == 0 && !ut8_string.empty()) {
  ------------------
  |  Branch (6381:7): [True: 6, False: 2.66k]
  |  Branch (6381:28): [True: 6, False: 0]
  ------------------
 6382|      6|    return false;
 6383|      6|  }
 6384|  2.66k|  std::u32string working(utf32_length, U'\0');
 6385|  2.66k|  size_t actual_utf32_length = ada::idna::utf8_to_utf32(
 6386|  2.66k|      ut8_string.data(), ut8_string.size(), working.data());
 6387|  2.66k|#endif
 6388|  2.66k|  if (actual_utf32_length == 0 || actual_utf32_length != utf32_length) {
  ------------------
  |  Branch (6388:7): [True: 172, False: 2.49k]
  |  Branch (6388:35): [True: 0, False: 2.49k]
  ------------------
 6389|    172|    return false;
 6390|    172|  }
 6391|  2.49k|  working.resize(actual_utf32_length);
 6392|       |
 6393|       |  // Map into a second buffer with exact sizing (no growth reallocs).
 6394|  2.49k|  std::u32string mapped;
 6395|  2.49k|  if (!ada::idna::map(working, mapped)) {
  ------------------
  |  Branch (6395:7): [True: 35, False: 2.46k]
  ------------------
 6396|     35|    return false;
 6397|     35|  }
 6398|       |  // Drop UTF-32 input; reuse `working` as scratch for ACE validation below.
 6399|  2.46k|  working.clear();
 6400|       |
 6401|       |  // Skip NFC when already normalized (ASCII is a fast subset of this check).
 6402|  2.46k|  if (!is_ascii(mapped) && !is_already_nfc(mapped)) {
  ------------------
  |  Branch (6402:7): [True: 2.04k, False: 420]
  |  Branch (6402:28): [True: 476, False: 1.56k]
  ------------------
 6403|    476|    if (!normalize(mapped)) {
  ------------------
  |  Branch (6403:9): [True: 0, False: 476]
  ------------------
 6404|      0|      return false;
 6405|      0|    }
 6406|    476|  }
 6407|       |
 6408|       |  // Estimate ASCII output size (punycode may expand non-ASCII labels).
 6409|  2.46k|  out.reserve(mapped.size() + 8);
 6410|       |
 6411|       |  // Walk labels with a single pointer scan (no repeated string::find).
 6412|  2.46k|  const char32_t* p = mapped.data();
 6413|  2.46k|  const char32_t* const end = p + mapped.size();
 6414|  2.46k|  std::u32string post_map;
 6415|       |
 6416|  8.08k|  while (p < end) {
  ------------------
  |  Branch (6416:10): [True: 6.62k, False: 1.45k]
  ------------------
 6417|  6.62k|    const char32_t* label_begin = p;
 6418|  72.6k|    while (p < end && *p != U'.') {
  ------------------
  |  Branch (6418:12): [True: 71.1k, False: 1.44k]
  |  Branch (6418:23): [True: 65.9k, False: 5.18k]
  ------------------
 6419|  65.9k|      ++p;
 6420|  65.9k|    }
 6421|  6.62k|    const size_t label_size = static_cast<size_t>(p - label_begin);
 6422|  6.62k|    std::u32string_view label_view(label_begin, label_size);
 6423|  6.62k|    const bool is_last_label = (p == end);
 6424|  6.62k|    if (p < end) {
  ------------------
  |  Branch (6424:9): [True: 5.18k, False: 1.44k]
  ------------------
 6425|  5.18k|      ++p;  // skip dot
 6426|  5.18k|    }
 6427|       |
 6428|  6.62k|    if (label_size == 0) {
  ------------------
  |  Branch (6428:9): [True: 166, False: 6.46k]
  ------------------
 6429|       |      // empty label
 6430|  6.46k|    } else if (is_ace_prefix(label_view)) {
  ------------------
  |  Branch (6430:16): [True: 1.18k, False: 5.27k]
  ------------------
 6431|  19.3k|      for (char32_t c : label_view) {
  ------------------
  |  Branch (6431:23): [True: 19.3k, False: 1.17k]
  ------------------
 6432|  19.3k|        if (c >= 0x80) {
  ------------------
  |  Branch (6432:13): [True: 13, False: 19.3k]
  ------------------
 6433|     13|          out.clear();
 6434|     13|          return false;
 6435|     13|        }
 6436|  19.3k|      }
 6437|  1.17k|      append_ascii_label(out, label_view);
 6438|  1.17k|      std::string_view puny_segment_ascii(
 6439|  1.17k|          out.data() + (out.size() - label_size) + 4, label_size - 4);
 6440|  1.17k|      working.clear();
 6441|  1.17k|      if (!ada::idna::punycode_to_utf32(puny_segment_ascii, working)) {
  ------------------
  |  Branch (6441:11): [True: 84, False: 1.09k]
  ------------------
 6442|     84|        out.clear();
 6443|     84|        return false;
 6444|     84|      }
 6445|  1.09k|      if (is_ascii(working)) {
  ------------------
  |  Branch (6445:11): [True: 50, False: 1.04k]
  ------------------
 6446|     50|        out.clear();
 6447|     50|        return false;
 6448|     50|      }
 6449|  1.04k|      if (!ada::idna::map(working, post_map) || working != post_map) {
  ------------------
  |  Branch (6449:11): [True: 168, False: 873]
  |  Branch (6449:49): [True: 41, False: 832]
  ------------------
 6450|    209|        out.clear();
 6451|    209|        return false;
 6452|    209|      }
 6453|       |      // Mapping must be stable; NFC must not change the mapped form either.
 6454|    832|      if (!is_ascii(post_map) && !is_already_nfc(post_map)) {
  ------------------
  |  Branch (6454:11): [True: 832, False: 0]
  |  Branch (6454:34): [True: 445, False: 387]
  ------------------
 6455|    445|        if (!normalize(post_map) || post_map != working) {
  ------------------
  |  Branch (6455:13): [True: 0, False: 445]
  |  Branch (6455:37): [True: 66, False: 379]
  ------------------
 6456|     66|          out.clear();
 6457|     66|          return false;
 6458|     66|        }
 6459|    445|      }
 6460|    766|      if (post_map.empty() || !is_label_valid(post_map)) {
  ------------------
  |  Branch (6460:11): [True: 0, False: 766]
  |  Branch (6460:31): [True: 18, False: 748]
  ------------------
 6461|     18|        out.clear();
 6462|     18|        return false;
 6463|     18|      }
 6464|  5.27k|    } else if (is_ascii(label_view)) {
  ------------------
  |  Branch (6464:16): [True: 1.54k, False: 3.73k]
  ------------------
 6465|  1.54k|      append_ascii_label(out, label_view);
 6466|  3.73k|    } else {
 6467|  3.73k|      if (!is_label_valid(label_view)) {
  ------------------
  |  Branch (6467:11): [True: 564, False: 3.16k]
  ------------------
 6468|    564|        out.clear();
 6469|    564|        return false;
 6470|    564|      }
 6471|  3.16k|      out.append("xn--");
 6472|  3.16k|      if (!ada::idna::utf32_to_punycode(label_view, out)) {
  ------------------
  |  Branch (6472:11): [True: 0, False: 3.16k]
  ------------------
 6473|      0|        out.clear();
 6474|      0|        return false;
 6475|      0|      }
 6476|  3.16k|    }
 6477|  5.62k|    if (!is_last_label) {
  ------------------
  |  Branch (6477:9): [True: 4.19k, False: 1.42k]
  ------------------
 6478|  4.19k|      out.push_back('.');
 6479|  4.19k|    }
 6480|  5.62k|  }
 6481|  1.45k|  return true;
 6482|  2.46k|}
_ZN3ada4idna8to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6484|  2.84k|std::string to_ascii(std::string_view ut8_string) {
 6485|  2.84k|  std::string out;
 6486|  2.84k|  if (!to_ascii(ut8_string, out)) {
  ------------------
  |  Branch (6486:7): [True: 1.21k, False: 1.62k]
  ------------------
 6487|  1.21k|    return {};
 6488|  1.21k|  }
 6489|  1.62k|  return out;
 6490|  2.84k|}
_ZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7355|  43.6k|                    std::string& out) {
 7356|  43.6k|  ada_log("percent_encode ", input, " to output string while ",
 7357|  43.6k|          append ? "appending" : "overwriting");
 7358|  43.6k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7359|  43.6k|    return character_sets::bit_at(character_set, c);
 7360|  43.6k|  });
 7361|  43.6k|  ada_log("percent_encode done checking, moved to ",
 7362|  43.6k|          std::distance(input.begin(), pointer));
 7363|       |
 7364|       |  // Optimization: Don't iterate if percent encode is not required
 7365|  43.6k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7365:7): [True: 41.2k, False: 2.39k]
  ------------------
 7366|  41.2k|    ada_log("percent_encode encoding not needed.");
 7367|  41.2k|    return false;
 7368|  41.2k|  }
 7369|       |  if constexpr (!append) {
 7370|       |    out.clear();
 7371|       |  }
 7372|  2.39k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7373|  2.39k|          " bytes");
 7374|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7375|  2.39k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7376|  2.39k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7377|  2.39k|          " bytes");
 7378|  57.9k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7378:10): [True: 55.5k, False: 2.39k]
  ------------------
 7379|  55.5k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7379:9): [True: 27.5k, False: 28.0k]
  ------------------
 7380|  27.5k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7381|  28.0k|    } else {
 7382|  28.0k|      out += *pointer;
 7383|  28.0k|    }
 7384|  55.5k|  }
 7385|  2.39k|  return true;
 7386|  43.6k|}
_ZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEE:
 7355|  46.5k|                    std::string& out) {
 7356|  46.5k|  ada_log("percent_encode ", input, " to output string while ",
 7357|  46.5k|          append ? "appending" : "overwriting");
 7358|  46.5k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7359|  46.5k|    return character_sets::bit_at(character_set, c);
 7360|  46.5k|  });
 7361|  46.5k|  ada_log("percent_encode done checking, moved to ",
 7362|  46.5k|          std::distance(input.begin(), pointer));
 7363|       |
 7364|       |  // Optimization: Don't iterate if percent encode is not required
 7365|  46.5k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7365:7): [True: 43.1k, False: 3.39k]
  ------------------
 7366|  43.1k|    ada_log("percent_encode encoding not needed.");
 7367|  43.1k|    return false;
 7368|  43.1k|  }
 7369|  3.39k|  if constexpr (!append) {
 7370|  3.39k|    out.clear();
 7371|  3.39k|  }
 7372|  3.39k|  ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
 7373|  3.39k|          " bytes");
 7374|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7375|  3.39k|  out.append(input.data(), std::distance(input.begin(), pointer));
 7376|  3.39k|  ada_log("percent_encode processing ", std::distance(pointer, input.end()),
 7377|  3.39k|          " bytes");
 7378|  64.0k|  for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7378:10): [True: 60.6k, False: 3.39k]
  ------------------
 7379|  60.6k|    if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7379:9): [True: 33.0k, False: 27.6k]
  ------------------
 7380|  33.0k|      out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7381|  33.0k|    } else {
 7382|  27.6k|      out += *pointer;
 7383|  27.6k|    }
 7384|  60.6k|  }
 7385|  3.39k|  return true;
 7386|  46.5k|}
_ZN3ada7unicode14percent_decodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 7186|  1.07k|std::string percent_decode(const std::string_view input, size_t first_percent) {
 7187|       |  // next line is for safety only, we expect users to avoid calling
 7188|       |  // percent_decode when first_percent is outside the range.
 7189|  1.07k|  if (first_percent == std::string_view::npos) {
  ------------------
  |  Branch (7189:7): [True: 0, False: 1.07k]
  ------------------
 7190|      0|    return std::string(input);
 7191|      0|  }
 7192|       |
 7193|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7194|  1.07k|  const char* const src = input.data();
 7195|  1.07k|  const char* const end = src + input.size();
 7196|       |
 7197|       |  // Decoding never grows the string, so a single pre-sized buffer written via
 7198|       |  // bulk memcpy of the plain runs (then shrunk to the final length) avoids the
 7199|       |  // byte-at-a-time appends of the naive version.
 7200|  1.07k|  std::string out(input.size(), '\0');
 7201|  1.07k|  char* d = out.data();
 7202|  1.07k|  char* const d0 = d;
 7203|       |
 7204|  1.07k|  std::memcpy(d, src, first_percent);
 7205|  1.07k|  d += first_percent;
 7206|       |
 7207|  1.07k|  const char* p = src + first_percent;
 7208|  5.96k|  while (p < end) {
  ------------------
  |  Branch (7208:10): [True: 4.89k, False: 1.07k]
  ------------------
 7209|  4.89k|    if (*p == '%') {
  ------------------
  |  Branch (7209:9): [True: 3.04k, False: 1.84k]
  ------------------
 7210|       |      // Decode runs of valid %XX tightly (common for nested/encoded URLs).
 7211|  8.30k|      while (p + 2 < end && *p == '%') {
  ------------------
  |  Branch (7211:14): [True: 7.70k, False: 600]
  |  Branch (7211:29): [True: 6.87k, False: 830]
  ------------------
 7212|  6.87k|        if (!is_ascii_hex_digit(p[1]) || !is_ascii_hex_digit(p[2])) {
  ------------------
  |  Branch (7212:13): [True: 972, False: 5.90k]
  |  Branch (7212:42): [True: 642, False: 5.26k]
  ------------------
 7213|  1.61k|          break;
 7214|  1.61k|        }
 7215|  5.26k|        *d++ = static_cast<char>(convert_hex_to_binary(p[1]) * 16 +
 7216|  5.26k|                                 convert_hex_to_binary(p[2]));
 7217|  5.26k|        p += 3;
 7218|  5.26k|      }
 7219|  3.04k|      if (p < end && *p == '%') {
  ------------------
  |  Branch (7219:11): [True: 2.71k, False: 333]
  |  Branch (7219:22): [True: 1.76k, False: 947]
  ------------------
 7220|       |        // Not a valid escape (too few chars left or bad hex): copy '%'
 7221|       |        // literally and keep scanning after it.
 7222|  1.76k|        *d++ = *p++;
 7223|  1.76k|      }
 7224|  3.04k|    } else {
 7225|  1.84k|      const char* q = static_cast<const char*>(
 7226|  1.84k|          std::memchr(p, '%', static_cast<size_t>(end - p)));
 7227|  1.84k|      const char* run_end = q ? q : end;
  ------------------
  |  Branch (7227:29): [True: 1.19k, False: 648]
  ------------------
 7228|  1.84k|      const size_t n = static_cast<size_t>(run_end - p);
 7229|  1.84k|      std::memcpy(d, p, n);
 7230|  1.84k|      d += n;
 7231|  1.84k|      p = run_end;
 7232|  1.84k|    }
 7233|  4.89k|  }
 7234|       |
 7235|  1.07k|  out.resize(static_cast<size_t>(d - d0));
 7236|  1.07k|  return out;
 7237|  1.07k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 7325|  51.7k|                           const uint8_t character_set[]) {
 7326|  51.7k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7327|  51.7k|    return character_sets::bit_at(character_set, c);
 7328|  51.7k|  });
 7329|       |  // Optimization: Don't iterate if percent encode is not required
 7330|  51.7k|  if (pointer == input.end()) {
  ------------------
  |  Branch (7330:7): [True: 48.8k, False: 2.86k]
  ------------------
 7331|  48.8k|    return std::string(input);
 7332|  48.8k|  }
 7333|       |
 7334|  2.86k|  std::string result;
 7335|  2.86k|  result.reserve(input.length());  // in the worst case, percent encoding might
 7336|       |                                   // produce 3 characters.
 7337|  2.86k|  result.append(input.substr(0, std::distance(input.begin(), pointer)));
 7338|  2.86k|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7338:7): [True: 572, False: 2.29k]
  ------------------
 7339|    572|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7340|    572|                          result);
 7341|  2.29k|  } else {
 7342|  28.2k|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7342:12): [True: 25.9k, False: 2.29k]
  ------------------
 7343|  25.9k|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7343:11): [True: 14.2k, False: 11.6k]
  ------------------
 7344|  14.2k|        result.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7345|  14.2k|      } else {
 7346|  11.6k|        result += *pointer;
 7347|  11.6k|      }
 7348|  25.9k|    }
 7349|  2.29k|  }
 7350|  2.86k|  return result;
 7351|  51.7k|}
_ZN3ada7unicode8to_asciiERNSt3__18optionalINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS1_17basic_string_viewIcS5_EEm:
 7396|  2.84k|              size_t first_percent) {
 7397|  2.84k|  std::string percent_decoded_buffer;
 7398|  2.84k|  std::string_view input = plain;
 7399|  2.84k|  if (first_percent != std::string_view::npos) {
  ------------------
  |  Branch (7399:7): [True: 120, False: 2.72k]
  ------------------
 7400|    120|    percent_decoded_buffer = unicode::percent_decode(plain, first_percent);
 7401|    120|    input = percent_decoded_buffer;
 7402|    120|  }
 7403|       |  // input is a non-empty UTF-8 string, must be percent decoded
 7404|  2.84k|  std::string idna_ascii = ada::idna::to_ascii(input);
 7405|  2.84k|  if (idna_ascii.empty() || contains_forbidden_domain_code_point(
  ------------------
  |  Branch (7405:7): [True: 1.21k, False: 1.62k]
  |  Branch (7405:29): [True: 247, False: 1.37k]
  ------------------
 7406|  1.62k|                                idna_ascii.data(), idna_ascii.size())) {
 7407|  1.46k|    return false;
 7408|  1.46k|  }
 7409|  1.37k|  out = std::move(idna_ascii);
 7410|  1.37k|  return true;
 7411|  2.84k|}
_ZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhm:
 7414|  42.7k|                           const uint8_t character_set[], size_t index) {
 7415|  42.7k|  std::string out;
 7416|       |  // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
 7417|  42.7k|  out.append(input.data(), index);
 7418|  42.7k|  auto pointer = input.begin() + index;
 7419|  42.7k|  if (static_cast<size_t>(input.end() - pointer) >= 48) {
  ------------------
  |  Branch (7419:7): [True: 856, False: 41.9k]
  ------------------
 7420|    856|    percent_encode_suffix(&*pointer, input.data() + input.size(), character_set,
 7421|    856|                          out);
 7422|  41.9k|  } else {
 7423|  60.3k|    for (; pointer != input.end(); pointer++) {
  ------------------
  |  Branch (7423:12): [True: 18.3k, False: 41.9k]
  ------------------
 7424|  18.3k|      if (character_sets::bit_at(character_set, *pointer)) {
  ------------------
  |  Branch (7424:11): [True: 7.10k, False: 11.2k]
  ------------------
 7425|  7.10k|        out.append(character_sets::hex + uint8_t(*pointer) * 4, 3);
 7426|  11.2k|      } else {
 7427|  11.2k|        out += *pointer;
 7428|  11.2k|      }
 7429|  18.3k|    }
 7430|  41.9k|  }
 7431|  42.7k|  return out;
 7432|  42.7k|}
_ZN3ada7unicode21percent_encode_suffixEPKcS2_PKhRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
 7726|  1.42k|                           const uint8_t character_set[], std::string& out) {
 7727|  1.42k|#if ADA_UNICODE_SSSE3 || ADA_NEON || ADA_RVV
 7728|  1.42k|  if (static_cast<size_t>(end - p) >= kPercentEncodeSimdMin) {
  ------------------
  |  Branch (7728:7): [True: 1.42k, False: 0]
  ------------------
 7729|  1.42k|    percent_encode_to_wide(p, end, character_set, out);
 7730|  1.42k|    return;
 7731|  1.42k|  }
 7732|      0|#endif
 7733|      0|  percent_encode_to_scalar(p, end, character_set, out);
 7734|      0|}
_ZN3ada11serializers36find_longest_sequence_of_ipv6_piecesERKNSt3__15arrayItLm8EEERmS6_:
 7799|  14.2k|    size_t& compress_length) noexcept {
 7800|  14.2k|  compress = 0;
 7801|  14.2k|  compress_length = 0;
 7802|  14.2k|  size_t i = 0;
 7803|   122k|  while (i < 8) {
  ------------------
  |  Branch (7803:10): [True: 107k, False: 14.2k]
  ------------------
 7804|   107k|    if (address[i] != 0) {
  ------------------
  |  Branch (7804:9): [True: 103k, False: 4.69k]
  ------------------
 7805|   103k|      ++i;
 7806|   103k|      continue;
 7807|   103k|    }
 7808|  4.69k|    size_t next = i + 1;
 7809|  11.0k|    while (next < 8 && address[next] == 0) {
  ------------------
  |  Branch (7809:12): [True: 10.1k, False: 821]
  |  Branch (7809:24): [True: 6.31k, False: 3.87k]
  ------------------
 7810|  6.31k|      ++next;
 7811|  6.31k|    }
 7812|  4.69k|    const size_t count = next - i;
 7813|  4.69k|    if (count > compress_length) {
  ------------------
  |  Branch (7813:9): [True: 4.25k, False: 435]
  ------------------
 7814|  4.25k|      compress_length = count;
 7815|  4.25k|      compress = i;
 7816|  4.25k|    }
 7817|  4.69k|    i = next;
 7818|  4.69k|  }
 7819|  14.2k|}
_ZN3ada11serializers4ipv6ERKNSt3__15arrayItLm8EEE:
 7821|  7.15k|std::string ipv6(const std::array<uint16_t, 8>& address) {
 7822|  7.15k|  size_t compress = 0;
 7823|  7.15k|  size_t compress_length = 0;
 7824|  7.15k|  find_longest_sequence_of_ipv6_pieces(address, compress, compress_length);
 7825|       |
 7826|       |  // Skip compression when the longest zero run is a single piece.
 7827|  7.15k|  if (compress_length <= 1) {
  ------------------
  |  Branch (7827:7): [True: 6.10k, False: 1.05k]
  ------------------
 7828|  6.10k|    compress = compress_length = 8;
 7829|  6.10k|  }
 7830|       |
 7831|       |  // Max: '[' + 8*4 hex + 7 ':' + ']' = 41
 7832|  7.15k|  std::string output(4 * 8 + 7 + 2, '\0');
 7833|  7.15k|  char* point = output.data();
 7834|  7.15k|  *point++ = '[';
 7835|  7.15k|  size_t piece_index = 0;
 7836|  53.3k|  while (true) {
  ------------------
  |  Branch (7836:10): [True: 53.3k, Folded]
  ------------------
 7837|  53.3k|    if (piece_index == compress) {
  ------------------
  |  Branch (7837:9): [True: 1.05k, False: 52.3k]
  ------------------
 7838|  1.05k|      *point++ = ':';
 7839|       |      // If we skip a value initially, we need to write '::'.
 7840|  1.05k|      if (piece_index == 0) {
  ------------------
  |  Branch (7840:11): [True: 430, False: 620]
  ------------------
 7841|    430|        *point++ = ':';
 7842|    430|      }
 7843|  1.05k|      piece_index += compress_length;
 7844|  1.05k|      if (piece_index == 8) {
  ------------------
  |  Branch (7844:11): [True: 348, False: 702]
  ------------------
 7845|    348|        break;
 7846|    348|      }
 7847|  1.05k|    }
 7848|  53.0k|    point = write_hex_u16(point, address[piece_index]);
 7849|  53.0k|    ++piece_index;
 7850|  53.0k|    if (piece_index == 8) {
  ------------------
  |  Branch (7850:9): [True: 6.80k, False: 46.2k]
  ------------------
 7851|  6.80k|      break;
 7852|  6.80k|    }
 7853|  46.2k|    *point++ = ':';
 7854|  46.2k|  }
 7855|  7.15k|  *point++ = ']';
 7856|  7.15k|  output.resize(static_cast<size_t>(point - output.data()));
 7857|  7.15k|  return output;
 7858|  7.15k|}
_ZN3ada11serializers4ipv4Em:
 7860|  7.92k|std::string ipv4(const uint64_t address) {
 7861|  7.92k|  std::string output(15, '\0');
 7862|  7.92k|  char* point = output.data();
 7863|  7.92k|  point = write_u8(point, static_cast<uint8_t>(address >> 24));
 7864|  7.92k|  *point++ = '.';
 7865|  7.92k|  point = write_u8(point, static_cast<uint8_t>(address >> 16));
 7866|  7.92k|  *point++ = '.';
 7867|  7.92k|  point = write_u8(point, static_cast<uint8_t>(address >> 8));
 7868|  7.92k|  *point++ = '.';
 7869|  7.92k|  point = write_u8(point, static_cast<uint8_t>(address));
 7870|  7.92k|  output.resize(static_cast<size_t>(point - output.data()));
 7871|  7.92k|  return output;
 7872|  7.92k|}
_ZN3ada5parseINS_14url_aggregatorEEEN2tl8expectedIT_NS_6errorsEEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEPKS4_:
 8274|  13.4k|    std::string_view input, const result_type* base_url) {
 8275|  13.4k|  result_type u = ada::parser::parse_url_impl<result_type>(input, base_url);
 8276|  13.4k|  if (!u.is_valid) {
  ------------------
  |  Branch (8276:7): [True: 10.9k, False: 2.45k]
  ------------------
 8277|  10.9k|    return tl::unexpected(errors::type_error);
 8278|  10.9k|  }
 8279|  2.45k|  return u;
 8280|  13.4k|}
_ZN3ada20get_max_input_lengthEv:
 7895|  13.4k|uint32_t get_max_input_length() {
 7896|  13.4k|  return max_input_length_.load(std::memory_order_relaxed);
 7897|  13.4k|}
_ZN3ada7helpers18trim_c0_whitespaceERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9254|  12.2k|void trim_c0_whitespace(std::string_view& input) noexcept {
 9255|  12.2k|  while (!input.empty() &&
  ------------------
  |  Branch (9255:10): [True: 12.2k, False: 0]
  ------------------
 9256|  12.2k|         ada::unicode::is_c0_control_or_space(input.front())) {
  ------------------
  |  Branch (9256:10): [True: 0, False: 12.2k]
  ------------------
 9257|      0|    input.remove_prefix(1);
 9258|      0|  }
 9259|  12.2k|  while (!input.empty() && ada::unicode::is_c0_control_or_space(input.back())) {
  ------------------
  |  Branch (9259:10): [True: 12.2k, False: 0]
  |  Branch (9259:28): [True: 0, False: 12.2k]
  ------------------
 9260|      0|    input.remove_suffix(1);
 9261|      0|  }
 9262|  12.2k|}
_ZN3ada7helpers8overlapsENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERKNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 9429|      3|bool overlaps(std::string_view input1, const std::string& input2) noexcept {
 9430|      3|  ada_log("helpers::overlaps check if string_view '", input1, "' [",
 9431|      3|          input1.size(), " bytes] is part of string '", input2, "' [",
 9432|      3|          input2.size(), " bytes]");
 9433|      3|  return !input1.empty() && !input2.empty() && input1.data() >= input2.data() &&
  ------------------
  |  Branch (9433:10): [True: 3, False: 0]
  |  Branch (9433:29): [True: 3, False: 0]
  |  Branch (9433:48): [True: 3, False: 0]
  ------------------
 9434|      3|         input1.data() < input2.data() + input2.size();
  ------------------
  |  Branch (9434:10): [True: 0, False: 3]
  ------------------
 9435|      3|}
_ZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_:
11957|  4.65k|                                                result_type& out) {
11958|  4.65k|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11959|  4.65k|  constexpr bool is_aggregator =
11960|  4.65k|      std::is_same_v<result_type, ada::url_aggregator>;
11961|  4.65k|  static_assert(is_ada_url || is_aggregator);
11962|       |
11963|  4.65k|  const size_t len = input.size();
11964|       |  // Shortest accepted form is "ws://x" (6).
11965|  4.65k|  if (len < 6) [[unlikely]] {
  ------------------
  |  Branch (11965:7): [True: 0, False: 4.65k]
  ------------------
11966|      0|    return false;
11967|      0|  }
11968|  4.65k|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
11969|       |
11970|  4.65k|  size_t pos = 0;
11971|  4.65k|  ada::scheme::type scheme_type = ada::scheme::type::NOT_SPECIAL;
11972|  4.65k|  uint32_t protocol_end = 0;
11973|  4.65k|#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \
11974|  4.65k|    defined(_M_X64) || defined(_M_IX86) || defined(_M_AMD64)
11975|       |  // One 8-byte load + integer compare is a single cmp/jcc on x86-64.
11976|       |  // Masked compares cover the shorter special schemes without extra loads.
11977|  4.65k|  if (len >= 8) {
  ------------------
  |  Branch (11977:7): [True: 4.65k, False: 0]
  ------------------
11978|  4.65k|    uint64_t first8 = 0;
11979|  4.65k|    std::memcpy(&first8, b, 8);
11980|  4.65k|    if (first8 == 0x2f2f3a7370747468ull) {  // "https://"
  ------------------
  |  Branch (11980:9): [True: 0, False: 4.65k]
  ------------------
11981|      0|      pos = 8;
11982|      0|      scheme_type = ada::scheme::type::HTTPS;
11983|      0|      protocol_end = 6;
11984|  4.65k|    } else if ((first8 & 0x00ffffffffffffffull) ==
  ------------------
  |  Branch (11984:16): [True: 4.65k, False: 0]
  ------------------
11985|  4.65k|               0x002f2f3a70747468ull) {  // "http://"
11986|  4.65k|      pos = 7;
11987|  4.65k|      scheme_type = ada::scheme::type::HTTP;
11988|  4.65k|      protocol_end = 5;
11989|  4.65k|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (11989:16): [True: 0, False: 0]
  ------------------
11990|      0|               0x00002f2f3a737377ull) {  // "wss://"
11991|      0|      pos = 6;
11992|      0|      scheme_type = ada::scheme::type::WSS;
11993|      0|      protocol_end = 4;
11994|      0|    } else if ((first8 & 0x0000ffffffffffffull) ==
  ------------------
  |  Branch (11994:16): [True: 0, False: 0]
  ------------------
11995|      0|               0x00002f2f3a707466ull) {  // "ftp://"
11996|      0|      pos = 6;
11997|      0|      scheme_type = ada::scheme::type::FTP;
11998|      0|      protocol_end = 4;
11999|      0|    } else if ((first8 & 0x000000ffffffffffull) ==
  ------------------
  |  Branch (11999:16): [True: 0, False: 0]
  ------------------
12000|      0|               0x0000002f2f3a7377ull) {  // "ws://"
12001|      0|      pos = 5;
12002|      0|      scheme_type = ada::scheme::type::WS;
12003|      0|      protocol_end = 3;
12004|      0|    } else {
12005|      0|      return false;
12006|      0|    }
12007|  4.65k|  } else if (b[0] == 'w' && b[1] == 's') {
  ------------------
  |  Branch (12007:14): [True: 0, False: 0]
  |  Branch (12007:29): [True: 0, False: 0]
  ------------------
12008|      0|    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
  ------------------
  |  Branch (12008:9): [True: 0, False: 0]
  |  Branch (12008:24): [True: 0, False: 0]
  |  Branch (12008:39): [True: 0, False: 0]
  ------------------
12009|      0|      pos = 5;
12010|      0|      scheme_type = ada::scheme::type::WS;
12011|      0|      protocol_end = 3;
12012|      0|    } else if (b[2] == 's' && b[3] == ':' && b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12012:16): [True: 0, False: 0]
  |  Branch (12012:31): [True: 0, False: 0]
  |  Branch (12012:46): [True: 0, False: 0]
  |  Branch (12012:61): [True: 0, False: 0]
  ------------------
12013|      0|      pos = 6;
12014|      0|      scheme_type = ada::scheme::type::WSS;
12015|      0|      protocol_end = 4;
12016|      0|    } else {
12017|      0|      return false;
12018|      0|    }
12019|      0|  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
  ------------------
  |  Branch (12019:14): [True: 0, False: 0]
  |  Branch (12019:29): [True: 0, False: 0]
  |  Branch (12019:44): [True: 0, False: 0]
  |  Branch (12019:59): [True: 0, False: 0]
  ------------------
12020|      0|             b[4] == '/' && b[5] == '/') {
  ------------------
  |  Branch (12020:14): [True: 0, False: 0]
  |  Branch (12020:29): [True: 0, False: 0]
  ------------------
12021|      0|    pos = 6;
12022|      0|    scheme_type = ada::scheme::type::FTP;
12023|      0|    protocol_end = 4;
12024|      0|  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
  ------------------
  |  Branch (12024:14): [True: 0, False: 0]
  |  Branch (12024:26): [True: 0, False: 0]
  |  Branch (12024:41): [True: 0, False: 0]
  |  Branch (12024:56): [True: 0, False: 0]
  ------------------
12025|      0|             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
  ------------------
  |  Branch (12025:14): [True: 0, False: 0]
  |  Branch (12025:29): [True: 0, False: 0]
  |  Branch (12025:44): [True: 0, False: 0]
  |  Branch (12025:59): [True: 0, False: 0]
  ------------------
12026|      0|    pos = 7;
12027|      0|    scheme_type = ada::scheme::type::HTTP;
12028|      0|    protocol_end = 5;
12029|      0|  } else {
12030|      0|    return false;
12031|      0|  }
12032|       |#else
12033|       |  // Big-endian / uncommon arches: byte-wise special-scheme match.
12034|       |  if (len >= 8 && b[0] == 'h' && b[1] == 't' && b[2] == 't' && b[3] == 'p' &&
12035|       |      b[4] == 's' && b[5] == ':' && b[6] == '/' && b[7] == '/') {
12036|       |    pos = 8;
12037|       |    scheme_type = ada::scheme::type::HTTPS;
12038|       |    protocol_end = 6;
12039|       |  } else if (len >= 7 && b[0] == 'h' && b[1] == 't' && b[2] == 't' &&
12040|       |             b[3] == 'p' && b[4] == ':' && b[5] == '/' && b[6] == '/') {
12041|       |    pos = 7;
12042|       |    scheme_type = ada::scheme::type::HTTP;
12043|       |    protocol_end = 5;
12044|       |  } else if (b[0] == 'w' && b[1] == 's') {
12045|       |    if (b[2] == ':' && b[3] == '/' && b[4] == '/') {
12046|       |      pos = 5;
12047|       |      scheme_type = ada::scheme::type::WS;
12048|       |      protocol_end = 3;
12049|       |    } else if (len >= 6 && b[2] == 's' && b[3] == ':' && b[4] == '/' &&
12050|       |               b[5] == '/') {
12051|       |      pos = 6;
12052|       |      scheme_type = ada::scheme::type::WSS;
12053|       |      protocol_end = 4;
12054|       |    } else {
12055|       |      return false;
12056|       |    }
12057|       |  } else if (b[0] == 'f' && b[1] == 't' && b[2] == 'p' && b[3] == ':' &&
12058|       |             b[4] == '/' && b[5] == '/') {
12059|       |    pos = 6;
12060|       |    scheme_type = ada::scheme::type::FTP;
12061|       |    protocol_end = 4;
12062|       |  } else {
12063|       |    return false;
12064|       |  }
12065|       |#endif
12066|  4.65k|  if (pos < len && (b[pos] == '/' || b[pos] == '\\')) [[unlikely]] {
  ------------------
  |  Branch (12066:7): [True: 4.65k, False: 0]
  |  Branch (12066:21): [True: 19, False: 4.63k]
  |  Branch (12066:38): [True: 6, False: 4.63k]
  ------------------
12067|     25|    return false;
12068|     25|  }
12069|       |
12070|       |  // Digit-led hosts are IPv4/numeric; '[' is IPv6. Skip before scanning.
12071|  4.63k|  if (pos < len && ((b[pos] >= '0' && b[pos] <= '9') || b[pos] == '[')) {
  ------------------
  |  Branch (12071:7): [True: 4.63k, False: 0]
  |  Branch (12071:22): [True: 3.80k, False: 827]
  |  Branch (12071:39): [True: 0, False: 3.80k]
  |  Branch (12071:57): [True: 0, False: 4.63k]
  ------------------
12072|      0|    return false;
12073|      0|  }
12074|       |
12075|  4.63k|  const size_t host_start = pos;
12076|  4.63k|  bool has_upper = false;
12077|  4.63k|  bool has_x = false;
12078|  4.63k|  size_t host_end = pos;
12079|  4.63k|  if (!scan_plain_host(b, pos, len, host_end, has_upper, has_x)) {
  ------------------
  |  Branch (12079:7): [True: 2.88k, False: 1.74k]
  ------------------
12080|  2.88k|    return false;
12081|  2.88k|  }
12082|  1.74k|  if (host_start == host_end) [[unlikely]] {
  ------------------
  |  Branch (12082:7): [True: 11, False: 1.73k]
  ------------------
12083|     11|    return false;
12084|     11|  }
12085|  1.73k|  const size_t host_len = host_end - host_start;
12086|  1.73k|  if (host_len > 253) [[unlikely]] {
  ------------------
  |  Branch (12086:7): [True: 0, False: 1.73k]
  ------------------
12087|      0|    return false;
12088|      0|  }
12089|  1.73k|  {
12090|  1.73k|    std::string_view hv(input.data() + host_start, host_len);
12091|  1.73k|    char host_buf[256];
12092|  1.73k|    if (has_upper) [[unlikely]] {
  ------------------
  |  Branch (12092:9): [True: 476, False: 1.25k]
  ------------------
12093|    476|      std::memcpy(host_buf, input.data() + host_start, host_len);
12094|    476|      unicode::to_lower_ascii(host_buf, host_len);
12095|    476|      hv = std::string_view(host_buf, host_len);
12096|    476|    }
12097|  1.73k|    if (ada::checkers::last_label_may_be_a_number(hv)) [[unlikely]] {
  ------------------
  |  Branch (12097:9): [True: 272, False: 1.46k]
  ------------------
12098|    272|      return false;
12099|    272|    }
12100|       |    // Punycode is "xn--...". The host scan already notes a lowercase 'x';
12101|       |    // uppercase 'X' is covered by has_upper after the in-place lower.
12102|  1.46k|    static constexpr std::string_view xn{"xn-", 3};
12103|  1.46k|    if ((has_x || has_upper) && hv.find(xn) != std::string_view::npos)
  ------------------
  |  Branch (12103:10): [True: 212, False: 1.25k]
  |  Branch (12103:19): [True: 257, False: 994]
  |  Branch (12103:33): [True: 19, False: 450]
  ------------------
12104|     19|        [[unlikely]] {
12105|     19|      return false;
12106|     19|    }
12107|  1.46k|  }
12108|       |
12109|  1.44k|  if (host_end < len && b[host_end] == ':') [[unlikely]] {
  ------------------
  |  Branch (12109:7): [True: 1.44k, False: 0]
  |  Branch (12109:25): [True: 394, False: 1.05k]
  ------------------
12110|    394|    return finish_simple_absolute_with_port(input, out, scheme_type,
12111|    394|                                            protocol_end, host_start, host_end,
12112|    394|                                            host_len, has_upper);
12113|    394|  }
12114|       |
12115|  1.05k|  size_t i = host_end;
12116|  1.05k|  size_t path_start = host_end;
12117|  1.05k|  size_t path_end = host_end;
12118|  1.05k|  size_t query_start = std::string_view::npos;
12119|  1.05k|  size_t hash_start = std::string_view::npos;
12120|  1.05k|  bool has_path = false;
12121|  1.05k|  bool maybe_dot_segment = false;
12122|  1.05k|  bool rest_simple = true;
12123|       |
12124|  1.05k|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (12124:7): [True: 1.05k, False: 0]
  |  Branch (12124:18): [True: 842, False: 208]
  ------------------
12125|    842|    has_path = true;
12126|    842|    path_start = i;
12127|    842|    ++i;
12128|    842|    scan_path_run(b, i, len, maybe_dot_segment);
12129|    842|    if (i < len) {
  ------------------
  |  Branch (12129:9): [True: 624, False: 218]
  ------------------
12130|    624|      const uint8_t cls = k_path[b[i]];
12131|    624|      if (cls == 1) {
  ------------------
  |  Branch (12131:11): [True: 79, False: 545]
  ------------------
12132|     79|        path_end = i;
12133|     79|        if (b[i] == '?') {
  ------------------
  |  Branch (12133:13): [True: 41, False: 38]
  ------------------
12134|     41|          query_start = i;
12135|     41|          ++i;
12136|     41|          goto scan_query;
12137|     41|        }
12138|     38|        hash_start = i;
12139|     38|        ++i;
12140|     38|        goto scan_hash;
12141|     79|      }
12142|    545|      rest_simple = false;
12143|  12.1k|      for (; i < len; ++i) {
  ------------------
  |  Branch (12143:14): [True: 11.6k, False: 471]
  ------------------
12144|  11.6k|        if (b[i] == '?') {
  ------------------
  |  Branch (12144:13): [True: 55, False: 11.6k]
  ------------------
12145|     55|          path_end = i;
12146|     55|          query_start = i;
12147|     55|          ++i;
12148|     55|          goto scan_query_boundary;
12149|     55|        }
12150|  11.6k|        if (b[i] == '#') {
  ------------------
  |  Branch (12150:13): [True: 19, False: 11.5k]
  ------------------
12151|     19|          path_end = i;
12152|     19|          hash_start = i;
12153|     19|          ++i;
12154|     19|          goto after_rest;
12155|     19|        }
12156|  11.6k|      }
12157|    471|      path_end = i;
12158|    471|      goto after_rest;
12159|    545|    }
12160|    218|    path_end = i;
12161|    218|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (12161:14): [True: 208, False: 0]
  |  Branch (12161:25): [True: 104, False: 104]
  ------------------
12162|    104|    query_start = i;
12163|    104|    ++i;
12164|    104|    goto scan_query;
12165|    104|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (12165:14): [True: 104, False: 0]
  |  Branch (12165:25): [True: 104, False: 0]
  ------------------
12166|    104|    hash_start = i;
12167|    104|    ++i;
12168|    104|    goto scan_hash;
12169|    104|  }
12170|    218|  goto after_rest;
12171|       |
12172|    218|scan_query:
12173|    145|  scan_query_run(b, i, len);
12174|    145|  if (i < len) {
  ------------------
  |  Branch (12174:7): [True: 84, False: 61]
  ------------------
12175|     84|    if (b[i] == '#') {
  ------------------
  |  Branch (12175:9): [True: 9, False: 75]
  ------------------
12176|      9|      hash_start = i;
12177|      9|      ++i;
12178|      9|      goto scan_hash;
12179|      9|    }
12180|     75|    rest_simple = false;
12181|     75|    goto scan_query_boundary;
12182|     84|  }
12183|     61|  goto after_rest;
12184|       |
12185|    130|scan_query_boundary:
12186|  1.46k|  for (; i < len; ++i) {
  ------------------
  |  Branch (12186:10): [True: 1.35k, False: 112]
  ------------------
12187|  1.35k|    if (b[i] == '#') {
  ------------------
  |  Branch (12187:9): [True: 18, False: 1.33k]
  ------------------
12188|     18|      hash_start = i;
12189|     18|      ++i;
12190|     18|      goto after_rest;
12191|     18|    }
12192|  1.35k|  }
12193|    112|  goto after_rest;
12194|       |
12195|    151|scan_hash:
12196|    151|  scan_hash_run(b, i, len);
12197|    151|  if (i < len) {
  ------------------
  |  Branch (12197:7): [True: 81, False: 70]
  ------------------
12198|     81|    rest_simple = false;
12199|     81|  }
12200|       |
12201|  1.05k|after_rest:
12202|  1.05k|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (12202:7): [True: 349, False: 701]
  |  Branch (12202:22): [True: 242, False: 107]
  ------------------
12203|    242|    const std::string_view path_body(input.data() + path_start,
12204|    242|                                     path_end - path_start);
12205|    242|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (12205:9): [True: 142, False: 100]
  ------------------
12206|    142|      rest_simple = false;
12207|    142|    }
12208|    242|  }
12209|       |
12210|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
12211|       |  // trailing C0 control or space; this fast path does neither. A query or
12212|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
12213|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
12214|       |  // inputs back to the slow path.
12215|  1.05k|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (12215:7): [True: 843, False: 207]
  |  Branch (12215:24): [True: 0, False: 843]
  ------------------
12216|    843|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (12216:24): [True: 55, False: 788]
  ------------------
12217|     55|    return false;
12218|     55|  }
12219|       |
12220|    995|  out.type = scheme_type;
12221|    995|  out.is_valid = true;
12222|    995|  out.has_opaque_path = false;
12223|    995|  out.host_type = DEFAULT;
12224|       |
12225|    995|  if (!rest_simple) {
  ------------------
  |  Branch (12225:7): [True: 788, False: 207]
  ------------------
12226|       |    // Host is a plain domain. Finish path/query/hash with
12227|       |    // the regular helpers
12228|       |    // so percent-encoding and dot segments do not re-parse the authority.
12229|    788|    const std::string_view path_view =
12230|    788|        has_path
  ------------------
  |  Branch (12230:9): [True: 671, False: 117]
  ------------------
12231|    788|            ? std::string_view(input.data() + path_start, path_end - path_start)
12232|    788|            : std::string_view{};
12233|    788|    auto apply_query_and_hash = [&]() {
12234|    788|      if (query_start != std::string_view::npos) {
12235|    788|        const size_t q_end =
12236|    788|            (hash_start != std::string_view::npos) ? hash_start : len;
12237|    788|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12238|    788|                                                q_end - query_start - 1),
12239|    788|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12240|    788|      }
12241|    788|      if (hash_start != std::string_view::npos) {
12242|    788|        out.update_unencoded_base_hash(std::string_view(
12243|    788|            input.data() + hash_start + 1, len - hash_start - 1));
12244|    788|      }
12245|    788|    };
12246|    788|    if constexpr (is_aggregator) {
12247|    788|      out.buffer.assign(input.substr(0, host_end));
12248|    788|      if (has_upper) {
  ------------------
  |  Branch (12248:11): [True: 103, False: 685]
  ------------------
12249|    103|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12250|    103|      }
12251|    788|      out.components.protocol_end = protocol_end;
12252|    788|      out.components.username_end = protocol_end + 2;
12253|    788|      out.components.host_start = protocol_end + 2;
12254|    788|      out.components.host_end = static_cast<uint32_t>(host_end);
12255|    788|      out.components.port = url_components::omitted;
12256|    788|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12257|    788|      out.components.search_start = url_components::omitted;
12258|    788|      out.components.hash_start = url_components::omitted;
12259|    788|      out.parse_path(path_view);
12260|    788|      apply_query_and_hash();
12261|       |    } else {
12262|       |      std::string host_str(input.substr(host_start, host_len));
12263|       |      if (has_upper) {
12264|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
12265|       |      }
12266|       |      out.host = std::move(host_str);
12267|       |      out.parse_path(path_view);
12268|       |      apply_query_and_hash();
12269|       |    }
12270|    788|    return true;
12271|    788|  }
12272|       |
12273|    207|  const bool need_slash = !has_path;
12274|    207|  if constexpr (is_aggregator) {
12275|    207|    if (!need_slash) {
  ------------------
  |  Branch (12275:9): [True: 145, False: 62]
  ------------------
12276|       |      // assign copies once. resize()+memcpy would value-init then overwrite.
12277|    145|      out.buffer.assign(input);
12278|    145|      if (has_upper) {
  ------------------
  |  Branch (12278:11): [True: 29, False: 116]
  ------------------
12279|     29|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12280|     29|      }
12281|    145|      out.components.protocol_end = protocol_end;
12282|    145|      out.components.username_end = protocol_end + 2;
12283|    145|      out.components.host_start = protocol_end + 2;
12284|    145|      out.components.host_end = static_cast<uint32_t>(host_end);
12285|    145|      out.components.port = url_components::omitted;
12286|    145|      out.components.pathname_start = static_cast<uint32_t>(path_start);
12287|    145|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12287:37): [True: 16, False: 129]
  ------------------
12288|    145|                                        ? static_cast<uint32_t>(query_start)
12289|    145|                                        : url_components::omitted;
12290|    145|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12290:35): [True: 15, False: 130]
  ------------------
12291|    145|                                      ? static_cast<uint32_t>(hash_start)
12292|    145|                                      : url_components::omitted;
12293|    145|    } else {
12294|     62|      out.buffer.clear();
12295|     62|      out.buffer.reserve(len + 1);
12296|     62|      out.buffer.append(input.substr(0, host_end));
12297|     62|      out.buffer.push_back('/');
12298|     62|      if (host_end < len) {
  ------------------
  |  Branch (12298:11): [True: 62, False: 0]
  ------------------
12299|     62|        out.buffer.append(input.substr(host_end));
12300|     62|      }
12301|     62|      if (has_upper) {
  ------------------
  |  Branch (12301:11): [True: 21, False: 41]
  ------------------
12302|     21|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
12303|     21|      }
12304|     62|      out.components.protocol_end = protocol_end;
12305|     62|      out.components.username_end = protocol_end + 2;
12306|     62|      out.components.host_start = protocol_end + 2;
12307|     62|      out.components.host_end = static_cast<uint32_t>(host_end);
12308|     62|      out.components.port = url_components::omitted;
12309|     62|      out.components.pathname_start = static_cast<uint32_t>(host_end);
12310|     62|      out.components.search_start = (query_start != std::string_view::npos)
  ------------------
  |  Branch (12310:37): [True: 31, False: 31]
  ------------------
12311|     62|                                        ? static_cast<uint32_t>(query_start + 1)
12312|     62|                                        : url_components::omitted;
12313|     62|      out.components.hash_start = (hash_start != std::string_view::npos)
  ------------------
  |  Branch (12313:35): [True: 34, False: 28]
  ------------------
12314|     62|                                      ? static_cast<uint32_t>(hash_start + 1)
12315|     62|                                      : url_components::omitted;
12316|     62|    }
12317|       |  } else {
12318|       |    std::string host_str(input.substr(host_start, host_len));
12319|       |    if (has_upper) {
12320|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
12321|       |    }
12322|       |    out.host = std::move(host_str);
12323|       |    if (need_slash) {
12324|       |      out.path = "/";
12325|       |    } else {
12326|       |      out.path.assign(input.data() + path_start, path_end - path_start);
12327|       |    }
12328|       |    if (query_start != std::string_view::npos) {
12329|       |      const size_t q_end =
12330|       |          (hash_start != std::string_view::npos) ? hash_start : len;
12331|       |      out.query.emplace(input.data() + query_start + 1,
12332|       |                        q_end - query_start - 1);
12333|       |    }
12334|       |    if (hash_start != std::string_view::npos) {
12335|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
12336|       |    }
12337|       |  }
12338|    207|  return true;
12339|    995|}
_ZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmb:
11685|    394|    bool has_upper) {
11686|    394|  constexpr bool is_ada_url = std::is_same_v<result_type, ada::url>;
11687|    394|  constexpr bool is_aggregator =
11688|    394|      std::is_same_v<result_type, ada::url_aggregator>;
11689|    394|  static_assert(is_ada_url || is_aggregator);
11690|       |
11691|    394|  const size_t len = input.size();
11692|    394|  const auto* b = reinterpret_cast<const uint8_t*>(input.data());
11693|    394|  size_t p = host_end + 1;
11694|    394|  uint32_t port_value = 0;
11695|    394|  bool any_digit = false;
11696|    876|  while (p < len && b[p] >= '0' && b[p] <= '9') {
  ------------------
  |  Branch (11696:10): [True: 876, False: 0]
  |  Branch (11696:21): [True: 554, False: 322]
  |  Branch (11696:36): [True: 494, False: 60]
  ------------------
11697|    494|    any_digit = true;
11698|    494|    port_value = port_value * 10 + static_cast<uint32_t>(b[p] - '0');
11699|    494|    if (port_value > 65535) [[unlikely]] {
  ------------------
  |  Branch (11699:9): [True: 12, False: 482]
  ------------------
11700|     12|      return false;
11701|     12|    }
11702|    482|    ++p;
11703|    482|  }
11704|    382|  if (p < len && b[p] != '/' && b[p] != '?' && b[p] != '#') [[unlikely]] {
  ------------------
  |  Branch (11704:7): [True: 382, False: 0]
  |  Branch (11704:18): [True: 261, False: 121]
  |  Branch (11704:33): [True: 222, False: 39]
  |  Branch (11704:48): [True: 174, False: 48]
  ------------------
11705|    174|    return false;
11706|    174|  }
11707|    208|  uint32_t parsed_port = url_components::omitted;
11708|    208|  const uint16_t default_port = ada::scheme::get_special_port(scheme_type);
11709|    208|  if (any_digit && port_value != default_port) {
  ------------------
  |  Branch (11709:7): [True: 89, False: 119]
  |  Branch (11709:20): [True: 88, False: 1]
  ------------------
11710|     88|    parsed_port = port_value;
11711|     88|  }
11712|    208|  const size_t authority_end = p;
11713|       |
11714|    208|  size_t i = authority_end;
11715|    208|  size_t path_start = host_end;
11716|    208|  size_t path_end = host_end;
11717|    208|  size_t query_start = std::string_view::npos;
11718|    208|  size_t hash_start = std::string_view::npos;
11719|    208|  bool has_path = false;
11720|    208|  bool maybe_dot_segment = false;
11721|    208|  bool rest_simple = true;
11722|       |
11723|    208|  if (i < len && b[i] == '/') {
  ------------------
  |  Branch (11723:7): [True: 208, False: 0]
  |  Branch (11723:18): [True: 121, False: 87]
  ------------------
11724|    121|    has_path = true;
11725|    121|    path_start = i;
11726|    121|    ++i;
11727|    121|    scan_path_run(b, i, len, maybe_dot_segment);
11728|    121|    if (i < len) {
  ------------------
  |  Branch (11728:9): [True: 88, False: 33]
  ------------------
11729|     88|      const uint8_t cls = k_path[b[i]];
11730|     88|      if (cls == 1) {
  ------------------
  |  Branch (11730:11): [True: 12, False: 76]
  ------------------
11731|     12|        path_end = i;
11732|     12|        if (b[i] == '?') {
  ------------------
  |  Branch (11732:13): [True: 7, False: 5]
  ------------------
11733|      7|          query_start = i;
11734|      7|          ++i;
11735|      7|          goto scan_query;
11736|      7|        }
11737|      5|        hash_start = i;
11738|      5|        ++i;
11739|      5|        goto scan_hash;
11740|     12|      }
11741|     76|      rest_simple = false;
11742|    903|      for (; i < len; ++i) {
  ------------------
  |  Branch (11742:14): [True: 841, False: 62]
  ------------------
11743|    841|        if (b[i] == '?') {
  ------------------
  |  Branch (11743:13): [True: 11, False: 830]
  ------------------
11744|     11|          path_end = i;
11745|     11|          query_start = i;
11746|     11|          ++i;
11747|     11|          goto scan_query_boundary;
11748|     11|        }
11749|    830|        if (b[i] == '#') {
  ------------------
  |  Branch (11749:13): [True: 3, False: 827]
  ------------------
11750|      3|          path_end = i;
11751|      3|          hash_start = i;
11752|      3|          ++i;
11753|      3|          goto after_rest;
11754|      3|        }
11755|    830|      }
11756|     62|      path_end = i;
11757|     62|      goto after_rest;
11758|     76|    }
11759|     33|    path_end = i;
11760|     87|  } else if (i < len && b[i] == '?') {
  ------------------
  |  Branch (11760:14): [True: 87, False: 0]
  |  Branch (11760:25): [True: 39, False: 48]
  ------------------
11761|     39|    query_start = i;
11762|     39|    ++i;
11763|     39|    goto scan_query;
11764|     48|  } else if (i < len && b[i] == '#') {
  ------------------
  |  Branch (11764:14): [True: 48, False: 0]
  |  Branch (11764:25): [True: 48, False: 0]
  ------------------
11765|     48|    hash_start = i;
11766|     48|    ++i;
11767|     48|    goto scan_hash;
11768|     48|  }
11769|     33|  goto after_rest;
11770|       |
11771|     46|scan_query:
11772|     46|  scan_query_run(b, i, len);
11773|     46|  if (i < len) {
  ------------------
  |  Branch (11773:7): [True: 25, False: 21]
  ------------------
11774|     25|    if (b[i] == '#') {
  ------------------
  |  Branch (11774:9): [True: 6, False: 19]
  ------------------
11775|      6|      hash_start = i;
11776|      6|      ++i;
11777|      6|      goto scan_hash;
11778|      6|    }
11779|     19|    rest_simple = false;
11780|     19|    goto scan_query_boundary;
11781|     25|  }
11782|     21|  goto after_rest;
11783|       |
11784|     30|scan_query_boundary:
11785|    262|  for (; i < len; ++i) {
  ------------------
  |  Branch (11785:10): [True: 239, False: 23]
  ------------------
11786|    239|    if (b[i] == '#') {
  ------------------
  |  Branch (11786:9): [True: 7, False: 232]
  ------------------
11787|      7|      hash_start = i;
11788|      7|      ++i;
11789|      7|      goto after_rest;
11790|      7|    }
11791|    239|  }
11792|     23|  goto after_rest;
11793|       |
11794|     59|scan_hash:
11795|     59|  scan_hash_run(b, i, len);
11796|     59|  if (i < len) {
  ------------------
  |  Branch (11796:7): [True: 11, False: 48]
  ------------------
11797|     11|    rest_simple = false;
11798|     11|  }
11799|       |
11800|    208|after_rest:
11801|    208|  if (rest_simple && maybe_dot_segment) {
  ------------------
  |  Branch (11801:7): [True: 102, False: 106]
  |  Branch (11801:22): [True: 27, False: 75]
  ------------------
11802|     27|    const std::string_view path_body(input.data() + path_start,
11803|     27|                                     path_end - path_start);
11804|     27|    if (path_has_dot_segment(path_body)) {
  ------------------
  |  Branch (11804:9): [True: 3, False: 24]
  ------------------
11805|      3|      rest_simple = false;
11806|      3|    }
11807|     27|  }
11808|       |
11809|       |  // The slow path removes ASCII tab/newline anywhere in the input and trims a
11810|       |  // trailing C0 control or space; this fast path does neither. A query or
11811|       |  // fragment reaching the helpers below would keep those bytes percent-encoded
11812|       |  // ("?a\nb" -> "?a%0Ab", "#f " -> "#f%20") instead of stripped, so hand such
11813|       |  // inputs back to the slow path.
11814|    208|  if (!rest_simple && (unicode::is_c0_control_or_space(input.back()) ||
  ------------------
  |  Branch (11814:7): [True: 109, False: 99]
  |  Branch (11814:24): [True: 0, False: 109]
  ------------------
11815|    109|                       unicode::has_tabs_or_newline(input))) {
  ------------------
  |  Branch (11815:24): [True: 19, False: 90]
  ------------------
11816|     19|    return false;
11817|     19|  }
11818|       |
11819|    189|  out.type = scheme_type;
11820|    189|  out.is_valid = true;
11821|    189|  out.has_opaque_path = false;
11822|    189|  out.host_type = DEFAULT;
11823|       |
11824|    189|  const uint32_t port_bytes = (parsed_port != url_components::omitted)
  ------------------
  |  Branch (11824:31): [True: 87, False: 102]
  ------------------
11825|    189|                                  ? (1 + port_decimal_digit_count(parsed_port))
11826|    189|                                  : 0;
11827|       |
11828|    189|  if (!rest_simple) {
  ------------------
  |  Branch (11828:7): [True: 90, False: 99]
  ------------------
11829|     90|    const std::string_view path_view =
11830|     90|        has_path
  ------------------
  |  Branch (11830:9): [True: 70, False: 20]
  ------------------
11831|     90|            ? std::string_view(input.data() + path_start, path_end - path_start)
11832|     90|            : std::string_view{};
11833|     90|    auto apply_query_and_hash = [&]() {
11834|     90|      if (query_start != std::string_view::npos) {
11835|     90|        const size_t q_end =
11836|     90|            (hash_start != std::string_view::npos) ? hash_start : len;
11837|     90|        out.update_base_search(std::string_view(input.data() + query_start + 1,
11838|     90|                                                q_end - query_start - 1),
11839|     90|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
11840|     90|      }
11841|     90|      if (hash_start != std::string_view::npos) {
11842|     90|        out.update_unencoded_base_hash(std::string_view(
11843|     90|            input.data() + hash_start + 1, len - hash_start - 1));
11844|     90|      }
11845|     90|    };
11846|     90|    if constexpr (is_aggregator) {
11847|     90|      out.buffer.assign(input.substr(0, host_end));
11848|     90|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (11848:11): [True: 21, False: 69]
  ------------------
11849|     21|        append_canonical_port(out.buffer, parsed_port);
11850|     21|      }
11851|     90|      if (has_upper) {
  ------------------
  |  Branch (11851:11): [True: 29, False: 61]
  ------------------
11852|     29|        unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
11853|     29|      }
11854|     90|      out.components.protocol_end = protocol_end;
11855|     90|      out.components.username_end = protocol_end + 2;
11856|     90|      out.components.host_start = protocol_end + 2;
11857|     90|      out.components.host_end = static_cast<uint32_t>(host_end);
11858|     90|      out.components.port = parsed_port;
11859|     90|      out.components.pathname_start = static_cast<uint32_t>(out.buffer.size());
11860|     90|      out.components.search_start = url_components::omitted;
11861|     90|      out.components.hash_start = url_components::omitted;
11862|     90|      out.parse_path(path_view);
11863|     90|      apply_query_and_hash();
11864|       |    } else {
11865|       |      std::string host_str(input.substr(host_start, host_len));
11866|       |      if (has_upper) {
11867|       |        unicode::to_lower_ascii(host_str.data(), host_str.size());
11868|       |      }
11869|       |      out.host = std::move(host_str);
11870|       |      if (parsed_port != url_components::omitted) {
11871|       |        out.port = static_cast<uint16_t>(parsed_port);
11872|       |      }
11873|       |      out.parse_path(path_view);
11874|       |      apply_query_and_hash();
11875|       |    }
11876|     90|    return true;
11877|     90|  }
11878|       |
11879|     99|  const bool insert_slash = !has_path;
11880|     99|  if constexpr (is_aggregator) {
11881|     99|    const size_t out_len =
11882|     99|        host_end + port_bytes + (insert_slash ? 1 : 0) + (len - authority_end);
  ------------------
  |  Branch (11882:34): [True: 62, False: 37]
  ------------------
11883|     99|    const bool omit_port_bytes = parsed_port == url_components::omitted;
11884|     99|    if (out_len == len && !insert_slash && !omit_port_bytes) {
  ------------------
  |  Branch (11884:9): [True: 21, False: 78]
  |  Branch (11884:27): [True: 12, False: 9]
  |  Branch (11884:44): [True: 12, False: 0]
  ------------------
11885|     12|      out.buffer.assign(input);
11886|     87|    } else {
11887|     87|      out.buffer.clear();
11888|     87|      out.buffer.reserve(out_len);
11889|     87|      out.buffer.append(input.substr(0, host_end));
11890|     87|      if (parsed_port != url_components::omitted) {
  ------------------
  |  Branch (11890:11): [True: 54, False: 33]
  ------------------
11891|     54|        append_canonical_port(out.buffer, parsed_port);
11892|     54|      }
11893|     87|      if (insert_slash) {
  ------------------
  |  Branch (11893:11): [True: 62, False: 25]
  ------------------
11894|     62|        out.buffer.push_back('/');
11895|     62|      }
11896|     87|      if (authority_end < len) {
  ------------------
  |  Branch (11896:11): [True: 87, False: 0]
  ------------------
11897|     87|        out.buffer.append(input.substr(authority_end));
11898|     87|      }
11899|     87|    }
11900|     99|    if (has_upper) {
  ------------------
  |  Branch (11900:9): [True: 24, False: 75]
  ------------------
11901|     24|      unicode::to_lower_ascii(out.buffer.data() + host_start, host_len);
11902|     24|    }
11903|     99|    const uint32_t pathname_start =
11904|     99|        static_cast<uint32_t>(host_end) + port_bytes;
11905|     99|    const int32_t tail_delta = static_cast<int32_t>(pathname_start) +
11906|     99|                               (insert_slash ? 1 : 0) -
  ------------------
  |  Branch (11906:33): [True: 62, False: 37]
  ------------------
11907|     99|                               static_cast<int32_t>(authority_end);
11908|     99|    out.components.protocol_end = protocol_end;
11909|     99|    out.components.username_end = protocol_end + 2;
11910|     99|    out.components.host_start = protocol_end + 2;
11911|     99|    out.components.host_end = static_cast<uint32_t>(host_end);
11912|     99|    out.components.port = parsed_port;
11913|     99|    out.components.pathname_start = pathname_start;
11914|     99|    out.components.search_start =
11915|     99|        (query_start != std::string_view::npos)
  ------------------
  |  Branch (11915:9): [True: 26, False: 73]
  ------------------
11916|     99|            ? static_cast<uint32_t>(static_cast<int32_t>(query_start) +
11917|     26|                                    tail_delta)
11918|     99|            : url_components::omitted;
11919|     99|    out.components.hash_start =
11920|     99|        (hash_start != std::string_view::npos)
  ------------------
  |  Branch (11920:9): [True: 48, False: 51]
  ------------------
11921|     99|            ? static_cast<uint32_t>(static_cast<int32_t>(hash_start) +
11922|     48|                                    tail_delta)
11923|     99|            : url_components::omitted;
11924|       |  } else {
11925|       |    std::string host_str(input.substr(host_start, host_len));
11926|       |    if (has_upper) {
11927|       |      unicode::to_lower_ascii(host_str.data(), host_str.size());
11928|       |    }
11929|       |    out.host = std::move(host_str);
11930|       |    if (parsed_port != url_components::omitted) {
11931|       |      out.port = static_cast<uint16_t>(parsed_port);
11932|       |    }
11933|       |    if (insert_slash) {
11934|       |      out.path = "/";
11935|       |    } else {
11936|       |      out.path.assign(input.data() + path_start, path_end - path_start);
11937|       |    }
11938|       |    if (query_start != std::string_view::npos) {
11939|       |      const size_t q_end =
11940|       |          (hash_start != std::string_view::npos) ? hash_start : len;
11941|       |      out.query.emplace(input.data() + query_start + 1,
11942|       |                        q_end - query_start - 1);
11943|       |    }
11944|       |    if (hash_start != std::string_view::npos) {
11945|       |      out.hash.emplace(input.data() + hash_start + 1, len - hash_start - 1);
11946|       |    }
11947|       |  }
11948|     99|  return true;
11949|    189|}
_ZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_:
12528|  13.4k|                           const result_type* base_url) {
12529|       |  // We can specialize the implementation per type.
12530|       |  // Important: result_type_is_ada_url is evaluated at *compile time*. This
12531|       |  // means that doing if constexpr(result_type_is_ada_url) { something } else {
12532|       |  // something else } is free (at runtime). This means that ada::url_aggregator
12533|       |  // and ada::url **do not have to support the exact same API**.
12534|  13.4k|  constexpr bool result_type_is_ada_url = std::is_same_v<url, result_type>;
12535|  13.4k|  constexpr bool result_type_is_ada_url_aggregator =
12536|  13.4k|      std::is_same_v<url_aggregator, result_type>;
12537|  13.4k|  static_assert(result_type_is_ada_url ||
12538|  13.4k|                result_type_is_ada_url_aggregator);  // We don't support
12539|       |                                                     // anything else for now.
12540|       |
12541|  13.4k|  ada_log("ada::parser::parse_url('", user_input, "' [", user_input.size(),
12542|  13.4k|          " bytes],", (base_url != nullptr ? base_url->to_string() : "null"),
12543|  13.4k|          ")");
12544|       |
12545|  13.4k|  result_type url{};
12546|       |
12547|  13.4k|  const uint32_t max_input_length = ada::get_max_input_length();
12548|       |
12549|       |  // Normalization (percent-encoding, IDNA) can push the serialized URL past
12550|       |  // max_input_length even when the input fit under it. The check at the end of
12551|       |  // the state machine covers URLs that run to completion, but several states
12552|       |  // return early after appending a query or fragment, so run the same check on
12553|       |  // those exits too. Without this, a query- or fragment-terminated URL such as
12554|       |  // file://x/?<...> or https://user@x/?<...> is accepted while the equivalent
12555|       |  // https://x/?<...> that takes the absolute fast path is rejected.
12556|  13.4k|  const auto enforce_max_input_length = [&]() {
12557|  13.4k|    if constexpr (store_values) {
12558|  13.4k|      if (url.is_valid) {
12559|  13.4k|        if constexpr (result_type_is_ada_url_aggregator) {
12560|  13.4k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
12561|  13.4k|            url.is_valid = false;
12562|  13.4k|          }
12563|  13.4k|        } else {
12564|  13.4k|          if (url.get_href_size() > max_input_length) [[unlikely]] {
12565|  13.4k|            url.is_valid = false;
12566|  13.4k|          }
12567|  13.4k|        }
12568|  13.4k|      }
12569|  13.4k|    }
12570|  13.4k|  };
12571|       |
12572|       |  // We refuse to parse URL strings that exceed the maximum input length.
12573|       |  // By default, this is 4GB but can be configured via
12574|       |  // ada::set_max_input_length().
12575|  13.4k|  if (user_input.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12575:7): [True: 0, False: 13.4k]
  ------------------
12576|      0|    url.is_valid = false;
12577|      0|  }
12578|       |  // Going forward, user_input.size() is in [0,
12579|       |  // std::numeric_limits<uint32_t>::max). If we are provided with an invalid
12580|       |  // base, or the optional_url was invalid, we must return.
12581|  13.4k|  if (base_url != nullptr) {
  ------------------
  |  Branch (12581:7): [True: 0, False: 13.4k]
  ------------------
12582|      0|    url.is_valid &= base_url->is_valid;
12583|      0|  }
12584|  13.4k|  if (!url.is_valid) {
  ------------------
  |  Branch (12584:7): [True: 0, False: 13.4k]
  ------------------
12585|      0|    return url;
12586|      0|  }
12587|       |
12588|       |  // Simple absolute / relative fast paths (before tabs/newline scan).
12589|  13.4k|  if constexpr (store_values) {
12590|  13.4k|    bool hit_fast_path = false;
12591|  13.4k|    if (base_url == nullptr) {
  ------------------
  |  Branch (12591:9): [True: 13.4k, False: 0]
  ------------------
12592|       |      // IPv4/IPv6 and userinfo miss the fast path. Skip the never_inline
12593|       |      // call so those URLs (including SetHref) do not pay for a miss.
12594|  13.4k|      const auto* p = reinterpret_cast<const uint8_t*>(user_input.data());
12595|  13.4k|      const size_t n = user_input.size();
12596|  13.4k|      size_t host_start = 0;
12597|  13.4k|      if (n >= 8 && p[4] == ':' && p[5] == '/' && p[6] == '/') {
  ------------------
  |  Branch (12597:11): [True: 13.4k, False: 0]
  |  Branch (12597:21): [True: 13.4k, False: 0]
  |  Branch (12597:36): [True: 13.4k, False: 0]
  |  Branch (12597:51): [True: 13.4k, False: 0]
  ------------------
12598|  13.4k|        host_start = 7;
12599|  13.4k|      } else if (n >= 9 && p[5] == ':' && p[6] == '/' && p[7] == '/') {
  ------------------
  |  Branch (12599:18): [True: 0, False: 0]
  |  Branch (12599:28): [True: 0, False: 0]
  |  Branch (12599:43): [True: 0, False: 0]
  |  Branch (12599:58): [True: 0, False: 0]
  ------------------
12600|      0|        host_start = 8;
12601|      0|      }
12602|  13.4k|      const uint8_t host_first = host_start != 0 ? p[host_start] : 0;
  ------------------
  |  Branch (12602:34): [True: 13.4k, False: 0]
  ------------------
12603|  13.4k|      const bool skip_ip =
12604|  13.4k|          host_first == '[' || (host_first >= '0' && host_first <= '9');
  ------------------
  |  Branch (12604:11): [True: 7.31k, False: 6.12k]
  |  Branch (12604:33): [True: 5.25k, False: 867]
  |  Branch (12604:54): [True: 1.29k, False: 3.96k]
  ------------------
12605|  13.4k|      const bool skip_userinfo =
12606|  13.4k|          host_start != 0 && authority_has_at(p, host_start, n);
  ------------------
  |  Branch (12606:11): [True: 13.4k, False: 0]
  |  Branch (12606:30): [True: 186, False: 13.2k]
  ------------------
12607|  13.4k|      hit_fast_path = !skip_ip && !skip_userinfo &&
  ------------------
  |  Branch (12607:23): [True: 4.82k, False: 8.61k]
  |  Branch (12607:35): [True: 4.65k, False: 171]
  ------------------
12608|  4.65k|                      try_parse_simple_absolute(user_input, url);
  ------------------
  |  Branch (12608:23): [True: 1.18k, False: 3.47k]
  ------------------
12609|  13.4k|    } else {
12610|      0|      hit_fast_path = try_parse_simple_relative(user_input, *base_url, url);
12611|      0|    }
12612|  13.4k|    if (hit_fast_path) {
  ------------------
  |  Branch (12612:9): [True: 1.18k, False: 12.2k]
  ------------------
12613|  1.18k|      if constexpr (result_type_is_ada_url_aggregator) {
12614|  1.18k|        if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12614:13): [True: 0, False: 1.18k]
  ------------------
12615|      0|          url.is_valid = false;
12616|      0|        }
12617|       |      } else {
12618|       |        // For a small absolute input, even worst-case normalization cannot
12619|       |        // exceed the limit: percent encoding expands at most 3x and IDNA at
12620|       |        // most 4.5x. Avoid traversing every stored component on the common
12621|       |        // default-limit path.
12622|       |        if ((base_url != nullptr ||
12623|       |             user_input.size() > static_cast<size_t>(max_input_length) / 5) &&
12624|       |            url.get_href_size() > max_input_length) [[unlikely]] {
12625|       |          url.is_valid = false;
12626|       |        }
12627|       |      }
12628|  1.18k|      return url;
12629|  1.18k|    }
12630|  13.4k|  }
12631|       |
12632|  12.2k|  state state = state::SCHEME_START;
12633|       |
12634|  13.4k|  std::string tmp_buffer;
12635|  13.4k|  std::string_view url_data;
12636|  13.4k|  if (unicode::has_tabs_or_newline(user_input)) [[unlikely]] {
  ------------------
  |  Branch (12636:7): [True: 143, False: 13.3k]
  ------------------
12637|    143|    tmp_buffer = user_input;
12638|       |    // Optimization opportunity: Instead of copying and then pruning, we could
12639|       |    // just directly build the string from user_input.
12640|    143|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
12641|    143|    url_data = tmp_buffer;
12642|  13.3k|  } else [[likely]] {
12643|  13.3k|    url_data = user_input;
12644|  13.3k|  }
12645|       |
12646|       |  // Leading and trailing control characters are uncommon and easy to deal with
12647|       |  // (no performance concern).
12648|  13.4k|  helpers::trim_c0_whitespace(url_data);
12649|       |
12650|  13.4k|  if constexpr (result_type_is_ada_url_aggregator && store_values) {
12651|       |    // Most of the time, we just need user_input.size().
12652|       |    // In some instances, we may need a bit more.
12653|       |    ///////////////////////////
12654|       |    // This is *very* important. This line should *not* be removed
12655|       |    // hastily. There are principled reasons why reserve is important
12656|       |    // for performance. If you have a benchmark with small inputs,
12657|       |    // it may not matter, but in other instances, it could.
12658|       |    ////
12659|       |    // This rounds up to the next power of two.
12660|       |    // We know that user_input.size() is in [0,
12661|       |    // std::numeric_limits<uint32_t>::max).
12662|  13.4k|    uint32_t reserve_capacity =
12663|  13.4k|        (0xFFFFFFFF >>
12664|  13.4k|         helpers::leading_zeroes(uint32_t(1 | user_input.size()))) +
12665|  13.4k|        1;
12666|  13.4k|    url.reserve(reserve_capacity);
12667|  13.4k|  }
12668|       |
12669|       |  // Optimization opportunity. Most websites do not have fragment.
12670|  13.4k|  std::optional<std::string_view> fragment = helpers::prune_hash(url_data);
12671|       |  // We add it last so that an implementation like ada::url_aggregator
12672|       |  // can append it last to its internal buffer, thus improving performance.
12673|       |
12674|       |  // Here url_data no longer has its fragment.
12675|       |  // We are going to access the data from url_data (it is immutable).
12676|       |  // At any given time, we are pointing at byte 'input_position' in url_data.
12677|       |  // The input_position variable should range from 0 to input_size.
12678|       |  // It is illegal to access url_data at input_size.
12679|  13.4k|  size_t input_position = 0;
12680|  13.4k|  const size_t input_size = url_data.size();
12681|       |  // Keep running the following state machine by switching on state.
12682|       |  // If after a run pointer points to the EOF code point, go to the next step.
12683|       |  // Otherwise, increase pointer by 1 and continue with the state machine.
12684|       |  // We never decrement input_position.
12685|  66.5k|  while (input_position <= input_size) {
  ------------------
  |  Branch (12685:10): [True: 64.6k, False: 1.88k]
  ------------------
12686|  64.6k|    ada_log("In parsing at ", input_position, " out of ", input_size,
12687|  64.6k|            " in state ", ada::to_string(state));
12688|  64.6k|    switch (state) {
12689|  12.2k|      case state::SCHEME_START: {
  ------------------
  |  Branch (12689:7): [True: 12.2k, False: 52.4k]
  ------------------
12690|  12.2k|        ada_log("SCHEME_START ", helpers::substring(url_data, input_position));
12691|       |        // If c is an ASCII alpha, append c, lowercased, to buffer, and set
12692|       |        // state to scheme state.
12693|  12.2k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12693:13): [True: 12.2k, False: 0]
  ------------------
12694|  12.2k|            checkers::is_alpha(url_data[input_position])) {
  ------------------
  |  Branch (12694:13): [True: 12.2k, False: 0]
  ------------------
12695|  12.2k|          state = state::SCHEME;
12696|  12.2k|          input_position++;
12697|  12.2k|        } else {
12698|       |          // Otherwise, if state override is not given, set state to no scheme
12699|       |          // state and decrease pointer by 1.
12700|      0|          state = state::NO_SCHEME;
12701|      0|        }
12702|  12.2k|        break;
12703|      0|      }
12704|  12.2k|      case state::SCHEME: {
  ------------------
  |  Branch (12704:7): [True: 12.2k, False: 52.4k]
  ------------------
12705|  12.2k|        ada_log("SCHEME ", helpers::substring(url_data, input_position));
12706|       |        // If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.),
12707|       |        // append c, lowercased, to buffer.
12708|  49.0k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (12708:16): [True: 49.0k, False: 0]
  ------------------
12709|  49.0k|               (unicode::is_alnum_plus(url_data[input_position]))) {
  ------------------
  |  Branch (12709:16): [True: 36.7k, False: 12.2k]
  ------------------
12710|  36.7k|          input_position++;
12711|  36.7k|        }
12712|       |        // Otherwise, if c is U+003A (:), then:
12713|  12.2k|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12713:13): [True: 12.2k, False: 0]
  ------------------
12714|  12.2k|            (url_data[input_position] == ':')) {
  ------------------
  |  Branch (12714:13): [True: 12.2k, False: 0]
  ------------------
12715|  12.2k|          ada_log("SCHEME the scheme should be ",
12716|  12.2k|                  url_data.substr(0, input_position));
12717|       |          if constexpr (result_type_is_ada_url) {
12718|       |            if (!url.parse_scheme(url_data.substr(0, input_position))) {
12719|       |              return url;
12720|       |            }
12721|  12.2k|          } else {
12722|       |            // we pass the colon along instead of painfully adding it back.
12723|  12.2k|            if (!url.parse_scheme_with_colon(
  ------------------
  |  Branch (12723:17): [True: 0, False: 12.2k]
  ------------------
12724|  12.2k|                    url_data.substr(0, input_position + 1))) {
12725|      0|              return url;
12726|      0|            }
12727|  12.2k|          }
12728|  12.2k|          ada_log("SCHEME the scheme is ", url.get_protocol());
12729|       |
12730|       |          // If url's scheme is "file", then:
12731|       |          // NOLINTNEXTLINE(bugprone-branch-clone)
12732|  12.2k|          if (url.type == scheme::type::FILE) {
  ------------------
  |  Branch (12732:15): [True: 0, False: 12.2k]
  ------------------
12733|       |            // Set state to file state.
12734|      0|            state = state::FILE;
12735|      0|          }
12736|       |          // Otherwise, if url is special, base is non-null, and base's scheme
12737|       |          // is url's scheme: Note: Doing base_url->scheme is unsafe if base_url
12738|       |          // != nullptr is false.
12739|  12.2k|          else if (url.is_special() && base_url != nullptr &&
  ------------------
  |  Branch (12739:20): [True: 12.2k, False: 0]
  |  Branch (12739:40): [True: 0, False: 12.2k]
  ------------------
12740|      0|                   base_url->type == url.type) {
  ------------------
  |  Branch (12740:20): [True: 0, False: 0]
  ------------------
12741|       |            // Set state to special relative or authority state.
12742|      0|            state = state::SPECIAL_RELATIVE_OR_AUTHORITY;
12743|      0|          }
12744|       |          // Otherwise, if url is special, set state to special authority
12745|       |          // slashes state.
12746|  12.2k|          else if (url.is_special()) {
  ------------------
  |  Branch (12746:20): [True: 12.2k, False: 0]
  ------------------
12747|  12.2k|            state = state::SPECIAL_AUTHORITY_SLASHES;
12748|  12.2k|          }
12749|       |          // Otherwise, if remaining starts with an U+002F (/), set state to
12750|       |          // path or authority state and increase pointer by 1.
12751|      0|          else if (input_position + 1 < input_size &&
  ------------------
  |  Branch (12751:20): [True: 0, False: 0]
  ------------------
12752|      0|                   url_data[input_position + 1] == '/') {
  ------------------
  |  Branch (12752:20): [True: 0, False: 0]
  ------------------
12753|      0|            state = state::PATH_OR_AUTHORITY;
12754|      0|            input_position++;
12755|      0|          }
12756|       |          // Otherwise, set url's path to the empty string and set state to
12757|       |          // opaque path state.
12758|      0|          else {
12759|      0|            state = state::OPAQUE_PATH;
12760|      0|          }
12761|  12.2k|        }
12762|       |        // Otherwise, if state override is not given, set buffer to the empty
12763|       |        // string, state to no scheme state, and start over (from the first code
12764|       |        // point in input).
12765|      0|        else {
12766|      0|          state = state::NO_SCHEME;
12767|      0|          input_position = 0;
12768|      0|          break;
12769|      0|        }
12770|  12.2k|        input_position++;
12771|  12.2k|        break;
12772|  12.2k|      }
12773|      0|      case state::NO_SCHEME: {
  ------------------
  |  Branch (12773:7): [True: 0, False: 64.6k]
  ------------------
12774|      0|        ada_log("NO_SCHEME ", helpers::substring(url_data, input_position));
12775|       |        // The fragment was pruned from url_data before the state machine ran,
12776|       |        // so 'c is U+0023 (#)' holds exactly when a fragment was found and
12777|       |        // nothing else remains in front of it.
12778|      0|        const bool c_is_hash =
12779|      0|            fragment.has_value() && input_position == input_size;
  ------------------
  |  Branch (12779:13): [True: 0, False: 0]
  |  Branch (12779:37): [True: 0, False: 0]
  ------------------
12780|       |        // If base is null, or base has an opaque path and c is not U+0023 (#),
12781|       |        // validation error, return failure.
12782|      0|        if (base_url == nullptr || (base_url->has_opaque_path && !c_is_hash)) {
  ------------------
  |  Branch (12782:13): [True: 0, False: 0]
  |  Branch (12782:37): [True: 0, False: 0]
  |  Branch (12782:66): [True: 0, False: 0]
  ------------------
12783|      0|          ada_log("NO_SCHEME validation error");
12784|      0|          url.is_valid = false;
12785|      0|          return url;
12786|      0|        }
12787|       |        // Otherwise, if base has an opaque path and c is U+0023 (#),
12788|       |        // set url's scheme to base's scheme, url's path to base's path, url's
12789|       |        // query to base's query, and set state to fragment state.
12790|      0|        else if (base_url->has_opaque_path && c_is_hash) {
  ------------------
  |  Branch (12790:18): [True: 0, False: 0]
  |  Branch (12790:47): [True: 0, False: 0]
  ------------------
12791|      0|          ada_log("NO_SCHEME opaque base with fragment");
12792|      0|          url.copy_scheme(*base_url);
12793|      0|          url.has_opaque_path = base_url->has_opaque_path;
12794|       |
12795|       |          if constexpr (result_type_is_ada_url) {
12796|       |            url.path = base_url->path;
12797|       |            url.query = base_url->query;
12798|      0|          } else {
12799|      0|            url.update_base_pathname(base_url->get_pathname());
12800|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (12800:17): [True: 0, False: 0]
  ------------------
12801|       |              // get_search() returns "" for an empty query string (URL ends
12802|       |              // with '?'). update_base_search("") would incorrectly clear the
12803|       |              // query, so pass "?" to preserve the empty query distinction.
12804|      0|              auto s = base_url->get_search();
12805|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (12805:38): [True: 0, False: 0]
  ------------------
12806|      0|            }
12807|      0|          }
12808|      0|          url.update_unencoded_base_hash(*fragment);
12809|      0|          enforce_max_input_length();
12810|      0|          return url;
12811|      0|        }
12812|       |        // Otherwise, if base's scheme is not "file", set state to relative
12813|       |        // state and decrease pointer by 1.
12814|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
12815|      0|        else if (base_url->type != scheme::type::FILE) {
  ------------------
  |  Branch (12815:18): [True: 0, False: 0]
  ------------------
12816|      0|          ada_log("NO_SCHEME non-file relative path");
12817|      0|          state = state::RELATIVE_SCHEME;
12818|      0|        }
12819|       |        // Otherwise, set state to file state and decrease pointer by 1.
12820|      0|        else {
12821|      0|          ada_log("NO_SCHEME file base type");
12822|      0|          state = state::FILE;
12823|      0|        }
12824|      0|        break;
12825|      0|      }
12826|  12.2k|      case state::AUTHORITY: {
  ------------------
  |  Branch (12826:7): [True: 12.2k, False: 52.4k]
  ------------------
12827|  12.2k|        ada_log("AUTHORITY ", helpers::substring(url_data, input_position));
12828|       |        // most URLs have no @. Having no @ tells us that we don't have to worry
12829|       |        // about AUTHORITY. Of course, we could have @ and still not have to
12830|       |        // worry about AUTHORITY.
12831|       |        // TODO: Instead of just collecting a bool, collect the location of the
12832|       |        // '@' and do something useful with it.
12833|       |        // TODO: We could do various processing early on, using a single pass
12834|       |        // over the string to collect information about it, e.g., telling us
12835|       |        // whether there is a @ and if so, where (or how many).
12836|       |
12837|       |        // Check if url data contains an @.
12838|  12.2k|        if (url_data.find('@', input_position) == std::string_view::npos) {
  ------------------
  |  Branch (12838:13): [True: 11.9k, False: 266]
  ------------------
12839|  11.9k|          state = state::HOST;
12840|  11.9k|          break;
12841|  11.9k|        }
12842|    266|        bool at_sign_seen{false};
12843|    266|        bool password_token_seen{false};
12844|       |        /**
12845|       |         * We expect something of the sort...
12846|       |         * https://user:pass@example.com:1234/foo/bar?baz#quux
12847|       |         * --------^
12848|       |         */
12849|  1.97k|        do {
12850|  1.97k|          std::string_view view = url_data.substr(input_position);
12851|       |          // The delimiters are @, /, ? \\.
12852|  1.97k|          size_t location =
12853|  1.97k|              url.is_special() ? helpers::find_authority_delimiter_special(view)
  ------------------
  |  Branch (12853:15): [True: 1.97k, False: 0]
  ------------------
12854|  1.97k|                               : helpers::find_authority_delimiter(view);
12855|  1.97k|          std::string_view authority_view = view.substr(0, location);
12856|  1.97k|          size_t end_of_authority = input_position + authority_view.size();
12857|       |          // If c is U+0040 (@), then:
12858|  1.97k|          if ((end_of_authority != input_size) &&
  ------------------
  |  Branch (12858:15): [True: 1.94k, False: 25]
  ------------------
12859|  1.94k|              (url_data[end_of_authority] == '@')) {
  ------------------
  |  Branch (12859:15): [True: 1.70k, False: 241]
  ------------------
12860|       |            // If atSignSeen is true, then prepend "%40" to buffer.
12861|  1.70k|            if (at_sign_seen) {
  ------------------
  |  Branch (12861:17): [True: 1.45k, False: 246]
  ------------------
12862|  1.45k|              if (password_token_seen) {
  ------------------
  |  Branch (12862:19): [True: 447, False: 1.01k]
  ------------------
12863|       |                if constexpr (result_type_is_ada_url) {
12864|       |                  url.password += "%40";
12865|    447|                } else {
12866|    447|                  url.append_base_password("%40");
12867|    447|                }
12868|  1.01k|              } else {
12869|       |                if constexpr (result_type_is_ada_url) {
12870|       |                  url.username += "%40";
12871|  1.01k|                } else {
12872|  1.01k|                  url.append_base_username("%40");
12873|  1.01k|                }
12874|  1.01k|              }
12875|  1.45k|            }
12876|       |
12877|  1.70k|            at_sign_seen = true;
12878|       |
12879|  1.70k|            if (!password_token_seen) {
  ------------------
  |  Branch (12879:17): [True: 1.25k, False: 447]
  ------------------
12880|  1.25k|              size_t password_token_location = authority_view.find(':');
12881|  1.25k|              password_token_seen =
12882|  1.25k|                  password_token_location != std::string_view::npos;
12883|       |
12884|  1.25k|              if constexpr (store_values) {
12885|  1.25k|                if (!password_token_seen) {
  ------------------
  |  Branch (12885:21): [True: 1.17k, False: 80]
  ------------------
12886|       |                  if constexpr (result_type_is_ada_url) {
12887|       |                    url.username += unicode::percent_encode(
12888|       |                        authority_view,
12889|       |                        character_sets::USERINFO_PERCENT_ENCODE);
12890|  1.17k|                  } else {
12891|  1.17k|                    url.append_base_username(unicode::percent_encode(
12892|  1.17k|                        authority_view,
12893|  1.17k|                        character_sets::USERINFO_PERCENT_ENCODE));
12894|  1.17k|                  }
12895|  1.17k|                } else {
12896|       |                  if constexpr (result_type_is_ada_url) {
12897|       |                    url.username += unicode::percent_encode(
12898|       |                        authority_view.substr(0, password_token_location),
12899|       |                        character_sets::USERINFO_PERCENT_ENCODE);
12900|       |                    url.password += unicode::percent_encode(
12901|       |                        authority_view.substr(password_token_location + 1),
12902|       |                        character_sets::USERINFO_PERCENT_ENCODE);
12903|     80|                  } else {
12904|     80|                    url.append_base_username(unicode::percent_encode(
12905|     80|                        authority_view.substr(0, password_token_location),
12906|     80|                        character_sets::USERINFO_PERCENT_ENCODE));
12907|     80|                    url.append_base_password(unicode::percent_encode(
12908|     80|                        authority_view.substr(password_token_location + 1),
12909|     80|                        character_sets::USERINFO_PERCENT_ENCODE));
12910|     80|                  }
12911|     80|                }
12912|  1.25k|              }
12913|  1.25k|            } else if constexpr (store_values) {
12914|       |              if constexpr (result_type_is_ada_url) {
12915|       |                url.password += unicode::percent_encode(
12916|       |                    authority_view, character_sets::USERINFO_PERCENT_ENCODE);
12917|    447|              } else {
12918|    447|                url.append_base_password(unicode::percent_encode(
12919|    447|                    authority_view, character_sets::USERINFO_PERCENT_ENCODE));
12920|    447|              }
12921|    447|            }
12922|  1.70k|          }
12923|       |          // Otherwise, if one of the following is true:
12924|       |          // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
12925|       |          // - url is special and c is U+005C (\)
12926|    266|          else if (end_of_authority == input_size ||
  ------------------
  |  Branch (12926:20): [True: 25, False: 241]
  ------------------
12927|    241|                   url_data[end_of_authority] == '/' ||
  ------------------
  |  Branch (12927:20): [True: 219, False: 22]
  ------------------
12928|     22|                   url_data[end_of_authority] == '?' ||
  ------------------
  |  Branch (12928:20): [True: 21, False: 1]
  ------------------
12929|    266|                   (url.is_special() && url_data[end_of_authority] == '\\')) {
  ------------------
  |  Branch (12929:21): [True: 1, False: 0]
  |  Branch (12929:41): [True: 1, False: 0]
  ------------------
12930|       |            // If atSignSeen is true and authority_view is the empty string,
12931|       |            // validation error, return failure.
12932|    266|            if (at_sign_seen && authority_view.empty()) {
  ------------------
  |  Branch (12932:17): [True: 246, False: 20]
  |  Branch (12932:33): [True: 3, False: 243]
  ------------------
12933|      3|              url.is_valid = false;
12934|      3|              return url;
12935|      3|            }
12936|    263|            state = state::HOST;
12937|    263|            break;
12938|    266|          }
12939|  1.70k|          if (end_of_authority == input_size) {
  ------------------
  |  Branch (12939:15): [True: 0, False: 1.70k]
  ------------------
12940|      0|            if constexpr (store_values) {
12941|      0|              if (fragment.has_value()) {
  ------------------
  |  Branch (12941:19): [True: 0, False: 0]
  ------------------
12942|      0|                url.update_unencoded_base_hash(*fragment);
12943|      0|              }
12944|      0|            }
12945|      0|            enforce_max_input_length();
12946|      0|            return url;
12947|      0|          }
12948|  1.70k|          input_position = end_of_authority + 1;
12949|  1.70k|        } while (true);
  ------------------
  |  Branch (12949:18): [True: 1.70k, Folded]
  ------------------
12950|       |
12951|    263|        break;
12952|    266|      }
12953|    263|      case state::SPECIAL_RELATIVE_OR_AUTHORITY: {
  ------------------
  |  Branch (12953:7): [True: 0, False: 64.6k]
  ------------------
12954|      0|        ada_log("SPECIAL_RELATIVE_OR_AUTHORITY ",
12955|      0|                helpers::substring(url_data, input_position));
12956|       |
12957|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
12958|       |        // then set state to special authority ignore slashes state and increase
12959|       |        // pointer by 1.
12960|      0|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (12960:13): [True: 0, False: 0]
  ------------------
12961|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
12962|      0|          input_position += 2;
12963|      0|        } else {
12964|       |          // Otherwise, validation error, set state to relative state and
12965|       |          // decrease pointer by 1.
12966|      0|          state = state::RELATIVE_SCHEME;
12967|      0|        }
12968|       |
12969|      0|        break;
12970|    266|      }
12971|      0|      case state::PATH_OR_AUTHORITY: {
  ------------------
  |  Branch (12971:7): [True: 0, False: 64.6k]
  ------------------
12972|      0|        ada_log("PATH_OR_AUTHORITY ",
12973|      0|                helpers::substring(url_data, input_position));
12974|       |
12975|       |        // If c is U+002F (/), then set state to authority state.
12976|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12976:13): [True: 0, False: 0]
  ------------------
12977|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (12977:13): [True: 0, False: 0]
  ------------------
12978|      0|          state = state::AUTHORITY;
12979|      0|          input_position++;
12980|      0|        } else {
12981|       |          // Otherwise, set state to path state, and decrease pointer by 1.
12982|      0|          state = state::PATH;
12983|      0|        }
12984|       |
12985|      0|        break;
12986|    266|      }
12987|      0|      case state::RELATIVE_SCHEME: {
  ------------------
  |  Branch (12987:7): [True: 0, False: 64.6k]
  ------------------
12988|      0|        ada_log("RELATIVE_SCHEME ",
12989|      0|                helpers::substring(url_data, input_position));
12990|       |
12991|       |        // Set url's scheme to base's scheme.
12992|      0|        url.copy_scheme(*base_url);
12993|       |
12994|       |        // If c is U+002F (/), then set state to relative slash state.
12995|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (12995:13): [True: 0, False: 0]
  ------------------
12996|       |            // NOLINTNEXTLINE(bugprone-branch-clone)
12997|      0|            (url_data[input_position] == '/')) {
  ------------------
  |  Branch (12997:13): [True: 0, False: 0]
  ------------------
12998|      0|          ada_log(
12999|      0|              "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
13000|      0|              "slash state");
13001|      0|          state = state::RELATIVE_SLASH;
13002|      0|        } else if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13002:20): [True: 0, False: 0]
  |  Branch (13002:40): [True: 0, False: 0]
  ------------------
13003|      0|                   (url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13003:20): [True: 0, False: 0]
  ------------------
13004|       |          // Otherwise, if url is special and c is U+005C (\), validation error,
13005|       |          // set state to relative slash state.
13006|      0|          ada_log(
13007|      0|              "RELATIVE_SCHEME  if url is special and c is U+005C, validation "
13008|      0|              "error, set state to relative slash state");
13009|      0|          state = state::RELATIVE_SLASH;
13010|      0|        } else {
13011|      0|          ada_log("RELATIVE_SCHEME otherwise");
13012|       |          // Set url's username to base's username, url's password to base's
13013|       |          // password, url's host to base's host, url's port to base's port,
13014|       |          // url's path to a clone of base's path, and url's query to base's
13015|       |          // query.
13016|       |          if constexpr (result_type_is_ada_url) {
13017|       |            url.username = base_url->username;
13018|       |            url.password = base_url->password;
13019|       |            url.host = base_url->host;
13020|       |            url.port = base_url->port;
13021|       |            // cloning the base path includes cloning the has_opaque_path flag
13022|       |            url.has_opaque_path = base_url->has_opaque_path;
13023|       |            url.path = base_url->path;
13024|       |            url.query = base_url->query;
13025|      0|          } else {
13026|      0|            url.update_base_authority(base_url->get_href(),
13027|      0|                                      base_url->get_components());
13028|      0|            url.update_host_to_base_host(base_url->get_hostname());
13029|      0|            url.update_base_port(base_url->retrieve_base_port());
13030|       |            // cloning the base path includes cloning the has_opaque_path flag
13031|      0|            url.has_opaque_path = base_url->has_opaque_path;
13032|      0|            url.update_base_pathname(base_url->get_pathname());
13033|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13033:17): [True: 0, False: 0]
  ------------------
13034|       |              // get_search() returns "" for an empty query string (URL ends
13035|       |              // with '?'). update_base_search("") would incorrectly clear the
13036|       |              // query, so pass "?" to preserve the empty query distinction.
13037|      0|              auto s = base_url->get_search();
13038|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13038:38): [True: 0, False: 0]
  ------------------
13039|      0|            }
13040|      0|          }
13041|       |
13042|      0|          url.has_opaque_path = base_url->has_opaque_path;
13043|       |
13044|       |          // If c is U+003F (?), then set url's query to the empty string, and
13045|       |          // state to query state.
13046|      0|          if ((input_position != input_size) &&
  ------------------
  |  Branch (13046:15): [True: 0, False: 0]
  ------------------
13047|      0|              (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13047:15): [True: 0, False: 0]
  ------------------
13048|      0|            state = state::QUERY;
13049|      0|          }
13050|       |          // Otherwise, if c is not the EOF code point:
13051|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13051:20): [True: 0, False: 0]
  ------------------
13052|       |            // Set url's query to null.
13053|      0|            url.clear_search();
13054|       |            if constexpr (result_type_is_ada_url) {
13055|       |              // Shorten url's path.
13056|       |              helpers::shorten_path(url.path, url.type);
13057|      0|            } else {
13058|      0|              std::string_view path = url.get_pathname();
13059|      0|              if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13059:19): [True: 0, False: 0]
  ------------------
13060|      0|                url.update_base_pathname(std::move(std::string(path)));
13061|      0|              }
13062|      0|            }
13063|       |            // Set state to path state and decrease pointer by 1.
13064|      0|            state = state::PATH;
13065|      0|            break;
13066|      0|          }
13067|      0|        }
13068|      0|        input_position++;
13069|      0|        break;
13070|      0|      }
13071|      0|      case state::RELATIVE_SLASH: {
  ------------------
  |  Branch (13071:7): [True: 0, False: 64.6k]
  ------------------
13072|      0|        ada_log("RELATIVE_SLASH ",
13073|      0|                helpers::substring(url_data, input_position));
13074|       |
13075|       |        // If url is special and c is U+002F (/) or U+005C (\), then:
13076|       |        // NOLINTNEXTLINE(bugprone-branch-clone)
13077|      0|        if (url.is_special() && (input_position != input_size) &&
  ------------------
  |  Branch (13077:13): [True: 0, False: 0]
  |  Branch (13077:33): [True: 0, False: 0]
  ------------------
13078|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13078:14): [True: 0, False: 0]
  ------------------
13079|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13079:14): [True: 0, False: 0]
  ------------------
13080|       |          // Set state to special authority ignore slashes state.
13081|      0|          state = state::SPECIAL_AUTHORITY_IGNORE_SLASHES;
13082|      0|        }
13083|       |        // Otherwise, if c is U+002F (/), then set state to authority state.
13084|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13084:18): [True: 0, False: 0]
  ------------------
13085|      0|                 (url_data[input_position] == '/')) {
  ------------------
  |  Branch (13085:18): [True: 0, False: 0]
  ------------------
13086|      0|          state = state::AUTHORITY;
13087|      0|        }
13088|       |        // Otherwise, set
13089|       |        // - url's username to base's username,
13090|       |        // - url's password to base's password,
13091|       |        // - url's host to base's host,
13092|       |        // - url's port to base's port,
13093|       |        // - state to path state, and then, decrease pointer by 1.
13094|      0|        else {
13095|       |          if constexpr (result_type_is_ada_url) {
13096|       |            url.username = base_url->username;
13097|       |            url.password = base_url->password;
13098|       |            url.host = base_url->host;
13099|       |            url.port = base_url->port;
13100|      0|          } else {
13101|      0|            url.update_base_authority(base_url->get_href(),
13102|      0|                                      base_url->get_components());
13103|      0|            url.update_host_to_base_host(base_url->get_hostname());
13104|      0|            url.update_base_port(base_url->retrieve_base_port());
13105|      0|          }
13106|      0|          state = state::PATH;
13107|      0|          break;
13108|      0|        }
13109|       |
13110|      0|        input_position++;
13111|      0|        break;
13112|      0|      }
13113|  12.2k|      case state::SPECIAL_AUTHORITY_SLASHES: {
  ------------------
  |  Branch (13113:7): [True: 12.2k, False: 52.4k]
  ------------------
13114|  12.2k|        ada_log("SPECIAL_AUTHORITY_SLASHES ",
13115|  12.2k|                helpers::substring(url_data, input_position));
13116|       |
13117|       |        // If c is U+002F (/) and remaining starts with U+002F (/),
13118|       |        // then set state to special authority ignore slashes state and increase
13119|       |        // pointer by 1.
13120|  12.2k|        if (url_data.substr(input_position, 2) == "//") {
  ------------------
  |  Branch (13120:13): [True: 12.2k, False: 0]
  ------------------
13121|  12.2k|          input_position += 2;
13122|  12.2k|        }
13123|       |
13124|  12.2k|        [[fallthrough]];
13125|  12.2k|      }
13126|  12.2k|      case state::SPECIAL_AUTHORITY_IGNORE_SLASHES: {
  ------------------
  |  Branch (13126:7): [True: 0, False: 64.6k]
  ------------------
13127|  12.2k|        ada_log("SPECIAL_AUTHORITY_IGNORE_SLASHES ",
13128|  12.2k|                helpers::substring(url_data, input_position));
13129|       |
13130|       |        // If c is neither U+002F (/) nor U+005C (\), then set state to
13131|       |        // authority state and decrease pointer by 1.
13132|  12.5k|        while ((input_position != input_size) &&
  ------------------
  |  Branch (13132:16): [True: 12.5k, False: 1]
  ------------------
13133|  12.5k|               ((url_data[input_position] == '/') ||
  ------------------
  |  Branch (13133:17): [True: 78, False: 12.4k]
  ------------------
13134|  12.4k|                (url_data[input_position] == '\\'))) {
  ------------------
  |  Branch (13134:17): [True: 174, False: 12.2k]
  ------------------
13135|    252|          input_position++;
13136|    252|        }
13137|  12.2k|        state = state::AUTHORITY;
13138|       |
13139|  12.2k|        break;
13140|  12.2k|      }
13141|    469|      case state::QUERY: {
  ------------------
  |  Branch (13141:7): [True: 469, False: 64.2k]
  ------------------
13142|    469|        ada_log("QUERY ", helpers::substring(url_data, input_position));
13143|    469|        if constexpr (store_values) {
13144|       |          // Let queryPercentEncodeSet be the special-query percent-encode set
13145|       |          // if url is special; otherwise the query percent-encode set.
13146|    469|          const uint8_t* query_percent_encode_set =
13147|    469|              url.is_special() ? character_sets::SPECIAL_QUERY_PERCENT_ENCODE
  ------------------
  |  Branch (13147:15): [True: 469, False: 0]
  ------------------
13148|    469|                               : character_sets::QUERY_PERCENT_ENCODE;
13149|       |
13150|       |          // Percent-encode after encoding, with encoding, buffer, and
13151|       |          // queryPercentEncodeSet, and append the result to url's query.
13152|    469|          url.update_base_search(url_data.substr(input_position),
13153|    469|                                 query_percent_encode_set);
13154|    469|          ada_log("QUERY update_base_search completed ");
13155|    469|          if (fragment.has_value()) {
  ------------------
  |  Branch (13155:15): [True: 8, False: 461]
  ------------------
13156|      8|            url.update_unencoded_base_hash(*fragment);
13157|      8|          }
13158|    469|        }
13159|    469|        enforce_max_input_length();
13160|    469|        return url;
13161|  12.2k|      }
13162|  12.2k|      case state::HOST: {
  ------------------
  |  Branch (13162:7): [True: 12.2k, False: 52.4k]
  ------------------
13163|  12.2k|        ada_log("HOST ", helpers::substring(url_data, input_position));
13164|       |
13165|  12.2k|        std::string_view host_view = url_data.substr(input_position);
13166|  12.2k|        auto [location, found_colon] =
13167|  12.2k|            helpers::get_host_delimiter_location(url.is_special(), host_view);
13168|  12.2k|        input_position = (location != std::string_view::npos)
  ------------------
  |  Branch (13168:26): [True: 12.2k, False: 0]
  ------------------
13169|  12.2k|                             ? input_position + location
13170|  12.2k|                             : input_size;
13171|       |        // Otherwise, if c is U+003A (:) and insideBrackets is false, then:
13172|       |        // Note: the 'found_colon' value is true if and only if a colon was
13173|       |        // encountered while not inside brackets.
13174|  12.2k|        if (found_colon) {
  ------------------
  |  Branch (13174:13): [True: 738, False: 11.5k]
  ------------------
13175|       |          // If buffer is the empty string, validation error, return failure.
13176|       |          // Let host be the result of host parsing buffer with url is not
13177|       |          // special.
13178|    738|          ada_log("HOST parsing ", host_view);
13179|    738|          if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13179:15): [True: 169, False: 569]
  ------------------
13180|    169|            return url;
13181|    169|          }
13182|    569|          ada_log("HOST parsing results in ", url.get_hostname());
13183|       |          // Set url's host to host, buffer to the empty string, and state to
13184|       |          // port state.
13185|    569|          state = state::PORT;
13186|    569|          input_position++;
13187|    569|        }
13188|       |        // Otherwise, if one of the following is true:
13189|       |        // - c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
13190|       |        // - url is special and c is U+005C (\)
13191|       |        // The get_host_delimiter_location function either brings us to
13192|       |        // the colon outside of the bracket, or to one of those characters.
13193|  11.5k|        else {
13194|       |          // If url is special and host_view is the empty string, validation
13195|       |          // error, return failure.
13196|  11.5k|          if (host_view.empty() && url.is_special()) {
  ------------------
  |  Branch (13196:15): [True: 4, False: 11.5k]
  |  Branch (13196:36): [True: 4, False: 0]
  ------------------
13197|      4|            url.is_valid = false;
13198|      4|            return url;
13199|      4|          }
13200|  11.5k|          ada_log("HOST parsing ", host_view, " href=", url.get_href());
13201|       |          // Let host be the result of host parsing host_view with url is not
13202|       |          // special.
13203|  11.5k|          if (host_view.empty()) {
  ------------------
  |  Branch (13203:15): [True: 0, False: 11.5k]
  ------------------
13204|      0|            url.update_base_hostname("");
13205|  11.5k|          } else if (!url.parse_host(host_view)) {
  ------------------
  |  Branch (13205:22): [True: 10.3k, False: 1.20k]
  ------------------
13206|  10.3k|            return url;
13207|  10.3k|          }
13208|  1.20k|          ada_log("HOST parsing results in ", url.get_hostname(),
13209|  1.20k|                  " href=", url.get_href());
13210|       |
13211|       |          // Set url's host to host, and state to path start state.
13212|  1.20k|          state = state::PATH_START;
13213|  1.20k|        }
13214|       |
13215|  1.77k|        break;
13216|  12.2k|      }
13217|  1.77k|      case state::OPAQUE_PATH: {
  ------------------
  |  Branch (13217:7): [True: 0, False: 64.6k]
  ------------------
13218|      0|        ada_log("OPAQUE_PATH ", helpers::substring(url_data, input_position));
13219|       |        // Opaque path, query, and fragment are structurally always valid:
13220|       |        // the parser would just percent-encode whatever is there. When we
13221|       |        // are not storing values (can_parse), we can return immediately.
13222|       |        // We must set has_opaque_path = true before returning so that when
13223|       |        // this URL is used as an internal base inside can_parse, NO_SCHEME
13224|       |        // correctly rejects relative inputs against an opaque-path base
13225|       |        // (e.g. can_parse("", &"W:") must return false).
13226|       |        if constexpr (!store_values) {
13227|       |          url.has_opaque_path = true;
13228|       |          return url;
13229|       |        }
13230|      0|        std::string_view view = url_data.substr(input_position);
13231|       |        // If c is U+003F (?), then set url's query to the empty string and
13232|       |        // state to query state.
13233|      0|        size_t location = view.find('?');
13234|      0|        if (location != std::string_view::npos) {
  ------------------
  |  Branch (13234:13): [True: 0, False: 0]
  ------------------
13235|      0|          view.remove_suffix(view.size() - location);
13236|      0|          state = state::QUERY;
13237|      0|          input_position += location + 1;
13238|      0|        } else {
13239|      0|          input_position = input_size + 1;
13240|      0|        }
13241|      0|        url.has_opaque_path = true;
13242|       |
13243|       |        // This is a really unlikely scenario in real world. We should not seek
13244|       |        // to optimize it.
13245|      0|        if (view.ends_with(' ')) {
  ------------------
  |  Branch (13245:13): [True: 0, False: 0]
  ------------------
13246|      0|          std::string modified_view =
13247|      0|              std::string(view.substr(0, view.size() - 1)) + "%20";
13248|      0|          url.update_base_pathname(unicode::percent_encode(
13249|      0|              modified_view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13250|      0|        } else {
13251|      0|          url.update_base_pathname(unicode::percent_encode(
13252|      0|              view, character_sets::C0_CONTROL_PERCENT_ENCODE));
13253|      0|        }
13254|      0|        break;
13255|  12.2k|      }
13256|    569|      case state::PORT: {
  ------------------
  |  Branch (13256:7): [True: 569, False: 64.1k]
  ------------------
13257|    569|        ada_log("PORT ", helpers::substring(url_data, input_position));
13258|    569|        std::string_view port_view = url_data.substr(input_position);
13259|    569|        input_position += url.parse_port(port_view, true);
13260|    569|        if (!url.is_valid) {
  ------------------
  |  Branch (13260:13): [True: 500, False: 69]
  ------------------
13261|    500|          return url;
13262|    500|        }
13263|     69|        state = state::PATH_START;
13264|     69|        [[fallthrough]];
13265|     69|      }
13266|  1.27k|      case state::PATH_START: {
  ------------------
  |  Branch (13266:7): [True: 1.20k, False: 63.4k]
  ------------------
13267|  1.27k|        ada_log("PATH_START ", helpers::substring(url_data, input_position));
13268|       |        // Path, query, and fragment are structurally always valid: the
13269|       |        // parser would just percent-encode whatever is there. When we are
13270|       |        // not storing values (can_parse), we can return immediately since
13271|       |        // no subsequent state can invalidate the URL.
13272|       |        if constexpr (!store_values) {
13273|       |          return url;
13274|       |        }
13275|       |
13276|       |        // If url is special, then:
13277|  1.27k|        if (url.is_special()) {
  ------------------
  |  Branch (13277:13): [True: 1.27k, False: 0]
  ------------------
13278|       |          // Set state to path state.
13279|  1.27k|          state = state::PATH;
13280|       |
13281|       |          // Optimization: Avoiding going into PATH state improves the
13282|       |          // performance of urls ending with /.
13283|  1.27k|          if (input_position == input_size) {
  ------------------
  |  Branch (13283:15): [True: 107, False: 1.16k]
  ------------------
13284|    107|            if constexpr (store_values) {
13285|    107|              url.update_base_pathname("/");
13286|    107|              if (fragment.has_value()) {
  ------------------
  |  Branch (13286:19): [True: 107, False: 0]
  ------------------
13287|    107|                url.update_unencoded_base_hash(*fragment);
13288|    107|              }
13289|    107|            }
13290|    107|            enforce_max_input_length();
13291|    107|            return url;
13292|    107|          }
13293|       |          // If c is neither U+002F (/) nor U+005C (\), then decrease pointer
13294|       |          // by 1. We know that (input_position == input_size) is impossible
13295|       |          // here, because of the previous if-check.
13296|  1.16k|          if ((url_data[input_position] != '/') &&
  ------------------
  |  Branch (13296:15): [True: 108, False: 1.05k]
  ------------------
13297|    108|              (url_data[input_position] != '\\')) {
  ------------------
  |  Branch (13297:15): [True: 107, False: 1]
  ------------------
13298|    107|            break;
13299|    107|          }
13300|  1.16k|        }
13301|       |        // Otherwise, if state override is not given and c is U+003F (?),
13302|       |        // set url's query to the empty string and state to query state.
13303|      0|        else if ((input_position != input_size) &&
  ------------------
  |  Branch (13303:18): [True: 0, False: 0]
  ------------------
13304|      0|                 (url_data[input_position] == '?')) {
  ------------------
  |  Branch (13304:18): [True: 0, False: 0]
  ------------------
13305|      0|          state = state::QUERY;
13306|      0|        }
13307|       |        // Otherwise, if c is not the EOF code point:
13308|      0|        else if (input_position != input_size) {
  ------------------
  |  Branch (13308:18): [True: 0, False: 0]
  ------------------
13309|       |          // Set state to path state.
13310|      0|          state = state::PATH;
13311|       |
13312|       |          // If c is not U+002F (/), then decrease pointer by 1.
13313|      0|          if (url_data[input_position] != '/') {
  ------------------
  |  Branch (13313:15): [True: 0, False: 0]
  ------------------
13314|      0|            break;
13315|      0|          }
13316|      0|        }
13317|       |
13318|  1.05k|        input_position++;
13319|  1.05k|        break;
13320|  1.27k|      }
13321|  1.16k|      case state::PATH: {
  ------------------
  |  Branch (13321:7): [True: 1.16k, False: 63.5k]
  ------------------
13322|  1.16k|        ada_log("PATH ", helpers::substring(url_data, input_position));
13323|       |        // Path, query, and fragment are structurally always valid: the
13324|       |        // parser would just percent-encode whatever is there. When we are
13325|       |        // not storing values (can_parse), we can return immediately since
13326|       |        // no subsequent state can invalidate the URL.
13327|       |        if constexpr (!store_values) {
13328|       |          return url;
13329|       |        }
13330|  1.16k|        std::string_view view = url_data.substr(input_position);
13331|       |
13332|       |        // Most time, we do not need percent encoding.
13333|       |        // Furthermore, we can immediately locate the '?'.
13334|  1.16k|        size_t locofquestionmark = view.find('?');
13335|  1.16k|        if (locofquestionmark != std::string_view::npos) {
  ------------------
  |  Branch (13335:13): [True: 469, False: 696]
  ------------------
13336|    469|          state = state::QUERY;
13337|    469|          view.remove_suffix(view.size() - locofquestionmark);
13338|    469|          input_position += locofquestionmark + 1;
13339|    696|        } else {
13340|    696|          input_position = input_size + 1;
13341|    696|        }
13342|  1.16k|        if constexpr (store_values) {
13343|       |          if constexpr (result_type_is_ada_url) {
13344|       |            helpers::parse_prepared_path(view, url.type, url.path);
13345|  1.16k|          } else {
13346|  1.16k|            url.consume_prepared_path(view);
13347|  1.16k|            ADA_ASSERT_TRUE(url.validate());
13348|  1.16k|          }
13349|  1.16k|        }
13350|  1.16k|        break;
13351|  1.27k|      }
13352|      0|      case state::FILE_SLASH: {
  ------------------
  |  Branch (13352:7): [True: 0, False: 64.6k]
  ------------------
13353|      0|        ada_log("FILE_SLASH ", helpers::substring(url_data, input_position));
13354|       |
13355|       |        // If c is U+002F (/) or U+005C (\), then:
13356|      0|        if ((input_position != input_size) &&
  ------------------
  |  Branch (13356:13): [True: 0, False: 0]
  ------------------
13357|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13357:14): [True: 0, False: 0]
  ------------------
13358|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13358:14): [True: 0, False: 0]
  ------------------
13359|      0|          ada_log("FILE_SLASH c is U+002F or U+005C");
13360|       |          // Set state to file host state.
13361|      0|          state = state::FILE_HOST;
13362|      0|          input_position++;
13363|      0|        } else {
13364|      0|          ada_log("FILE_SLASH otherwise");
13365|       |          // If base is non-null and base's scheme is "file", then:
13366|       |          // Note: it is unsafe to do base_url->scheme unless you know that
13367|       |          // base_url_has_value() is true.
13368|      0|          if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13368:15): [True: 0, False: 0]
  |  Branch (13368:38): [True: 0, False: 0]
  ------------------
13369|       |            // Set url's host to base's host.
13370|       |            if constexpr (result_type_is_ada_url) {
13371|       |              url.host = base_url->host;
13372|      0|            } else {
13373|      0|              url.update_host_to_base_host(base_url->get_host());
13374|      0|            }
13375|       |            // If the code point substring from pointer to the end of input does
13376|       |            // not start with a Windows drive letter and base's path[0] is a
13377|       |            // normalized Windows drive letter, then append base's path[0] to
13378|       |            // url's path.
13379|      0|            if (!base_url->get_pathname().empty()) {
  ------------------
  |  Branch (13379:17): [True: 0, False: 0]
  ------------------
13380|      0|              if (!checkers::is_windows_drive_letter(
  ------------------
  |  Branch (13380:19): [True: 0, False: 0]
  ------------------
13381|      0|                      url_data.substr(input_position))) {
13382|      0|                std::string_view first_base_url_path =
13383|      0|                    base_url->get_pathname().substr(1);
13384|      0|                size_t loc = first_base_url_path.find('/');
13385|      0|                if (loc != std::string_view::npos) {
  ------------------
  |  Branch (13385:21): [True: 0, False: 0]
  ------------------
13386|      0|                  helpers::resize(first_base_url_path, loc);
13387|      0|                }
13388|      0|                if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (13388:21): [True: 0, False: 0]
  ------------------
13389|      0|                        first_base_url_path)) {
13390|       |                  if constexpr (result_type_is_ada_url) {
13391|       |                    url.path += '/';
13392|       |                    url.path += first_base_url_path;
13393|      0|                  } else {
13394|      0|                    url.append_base_pathname(
13395|      0|                        helpers::concat("/", first_base_url_path));
13396|      0|                  }
13397|      0|                }
13398|      0|              }
13399|      0|            }
13400|      0|          }
13401|       |
13402|       |          // Set state to path state, and decrease pointer by 1.
13403|      0|          state = state::PATH;
13404|      0|        }
13405|       |
13406|      0|        break;
13407|  1.27k|      }
13408|      0|      case state::FILE_HOST: {
  ------------------
  |  Branch (13408:7): [True: 0, False: 64.6k]
  ------------------
13409|      0|        ada_log("FILE_HOST ", helpers::substring(url_data, input_position));
13410|      0|        std::string_view view = url_data.substr(input_position);
13411|       |
13412|      0|        size_t location = view.find_first_of("/\\?");
13413|      0|        std::string_view file_host_buffer = view.substr(
13414|      0|            0, (location != std::string_view::npos) ? location : view.size());
  ------------------
  |  Branch (13414:16): [True: 0, False: 0]
  ------------------
13415|       |
13416|      0|        if (checkers::is_windows_drive_letter(file_host_buffer)) {
  ------------------
  |  Branch (13416:13): [True: 0, False: 0]
  ------------------
13417|      0|          state = state::PATH;
13418|      0|        } else if (file_host_buffer.empty()) {
  ------------------
  |  Branch (13418:20): [True: 0, False: 0]
  ------------------
13419|       |          // Set url's host to the empty string.
13420|       |          if constexpr (result_type_is_ada_url) {
13421|       |            url.host = "";
13422|      0|          } else {
13423|      0|            url.update_base_hostname("");
13424|      0|          }
13425|       |          // Set state to path start state.
13426|      0|          state = state::PATH_START;
13427|      0|        } else {
13428|      0|          size_t consumed_bytes = file_host_buffer.size();
13429|      0|          input_position += consumed_bytes;
13430|       |          // Let host be the result of host parsing buffer with url is not
13431|       |          // special.
13432|      0|          if (!url.parse_host(file_host_buffer)) {
  ------------------
  |  Branch (13432:15): [True: 0, False: 0]
  ------------------
13433|      0|            return url;
13434|      0|          }
13435|       |
13436|       |          if constexpr (result_type_is_ada_url) {
13437|       |            // If host is "localhost", then set host to the empty string.
13438|       |            if (url.host.has_value() && url.host.value() == "localhost") {
13439|       |              url.host = "";
13440|       |            }
13441|      0|          } else {
13442|      0|            if (url.get_hostname() == "localhost") {
  ------------------
  |  Branch (13442:17): [True: 0, False: 0]
  ------------------
13443|      0|              url.update_base_hostname("");
13444|      0|            }
13445|      0|          }
13446|       |
13447|       |          // Set buffer to the empty string and state to path start state.
13448|      0|          state = state::PATH_START;
13449|      0|        }
13450|       |
13451|      0|        break;
13452|      0|      }
13453|      0|      case state::FILE: {
  ------------------
  |  Branch (13453:7): [True: 0, False: 64.6k]
  ------------------
13454|      0|        ada_log("FILE ", helpers::substring(url_data, input_position));
13455|      0|        std::string_view file_view = url_data.substr(input_position);
13456|       |
13457|      0|        url.set_protocol_as_file();
13458|       |        if constexpr (result_type_is_ada_url) {
13459|       |          // Set url's host to the empty string.
13460|       |          url.host = "";
13461|      0|        } else {
13462|      0|          url.update_base_hostname("");
13463|      0|        }
13464|       |        // If c is U+002F (/) or U+005C (\), then:
13465|      0|        if (input_position != input_size &&
  ------------------
  |  Branch (13465:13): [True: 0, False: 0]
  ------------------
13466|      0|            (url_data[input_position] == '/' ||
  ------------------
  |  Branch (13466:14): [True: 0, False: 0]
  ------------------
13467|      0|             url_data[input_position] == '\\')) {
  ------------------
  |  Branch (13467:14): [True: 0, False: 0]
  ------------------
13468|      0|          ada_log("FILE c is U+002F or U+005C");
13469|       |          // Set state to file slash state.
13470|      0|          state = state::FILE_SLASH;
13471|      0|        }
13472|       |        // Otherwise, if base is non-null and base's scheme is "file":
13473|      0|        else if (base_url != nullptr && base_url->type == scheme::type::FILE) {
  ------------------
  |  Branch (13473:18): [True: 0, False: 0]
  |  Branch (13473:41): [True: 0, False: 0]
  ------------------
13474|       |          // Set url's host to base's host, url's path to a clone of base's
13475|       |          // path, and url's query to base's query.
13476|      0|          ada_log("FILE base non-null");
13477|       |          if constexpr (result_type_is_ada_url) {
13478|       |            url.host = base_url->host;
13479|       |            url.path = base_url->path;
13480|       |            url.query = base_url->query;
13481|      0|          } else {
13482|      0|            url.update_host_to_base_host(base_url->get_hostname());
13483|      0|            url.update_base_pathname(base_url->get_pathname());
13484|      0|            if (base_url->has_search()) {
  ------------------
  |  Branch (13484:17): [True: 0, False: 0]
  ------------------
13485|       |              // get_search() returns "" for an empty query string (URL ends
13486|       |              // with '?'). update_base_search("") would incorrectly clear the
13487|       |              // query, so pass "?" to preserve the empty query distinction.
13488|      0|              auto s = base_url->get_search();
13489|      0|              url.update_base_search(s.empty() ? std::string_view("?") : s);
  ------------------
  |  Branch (13489:38): [True: 0, False: 0]
  ------------------
13490|      0|            }
13491|      0|          }
13492|      0|          url.has_opaque_path = base_url->has_opaque_path;
13493|       |
13494|       |          // If c is U+003F (?), then set url's query to the empty string and
13495|       |          // state to query state.
13496|      0|          if (input_position != input_size && url_data[input_position] == '?') {
  ------------------
  |  Branch (13496:15): [True: 0, False: 0]
  |  Branch (13496:47): [True: 0, False: 0]
  ------------------
13497|      0|            state = state::QUERY;
13498|      0|          }
13499|       |          // Otherwise, if c is not the EOF code point:
13500|      0|          else if (input_position != input_size) {
  ------------------
  |  Branch (13500:20): [True: 0, False: 0]
  ------------------
13501|       |            // Set url's query to null.
13502|      0|            url.clear_search();
13503|       |            // If the code point substring from pointer to the end of input does
13504|       |            // not start with a Windows drive letter, then shorten url's path.
13505|      0|            if (!checkers::is_windows_drive_letter(file_view)) {
  ------------------
  |  Branch (13505:17): [True: 0, False: 0]
  ------------------
13506|       |              if constexpr (result_type_is_ada_url) {
13507|       |                helpers::shorten_path(url.path, url.type);
13508|      0|              } else {
13509|      0|                std::string_view path = url.get_pathname();
13510|      0|                if (helpers::shorten_path(path, url.type)) {
  ------------------
  |  Branch (13510:21): [True: 0, False: 0]
  ------------------
13511|      0|                  url.update_base_pathname(std::move(std::string(path)));
13512|      0|                }
13513|      0|              }
13514|      0|            }
13515|       |            // Otherwise:
13516|      0|            else {
13517|       |              // Set url's path to an empty list.
13518|      0|              url.clear_pathname();
13519|      0|              url.has_opaque_path = true;
13520|      0|            }
13521|       |
13522|       |            // Set state to path state and decrease pointer by 1.
13523|      0|            state = state::PATH;
13524|      0|            break;
13525|      0|          }
13526|      0|        }
13527|       |        // Otherwise, set state to path state, and decrease pointer by 1.
13528|      0|        else {
13529|      0|          ada_log("FILE go to path");
13530|      0|          state = state::PATH;
13531|      0|          break;
13532|      0|        }
13533|       |
13534|      0|        input_position++;
13535|      0|        break;
13536|      0|      }
13537|      0|      default:
  ------------------
  |  Branch (13537:7): [True: 0, False: 64.6k]
  ------------------
13538|      0|        unreachable();
13539|  64.6k|    }
13540|  64.6k|  }
13541|  1.88k|  if constexpr (store_values) {
13542|  1.88k|    if (fragment.has_value()) {
  ------------------
  |  Branch (13542:9): [True: 9, False: 1.87k]
  ------------------
13543|      9|      url.update_unencoded_base_hash(*fragment);
13544|      9|    }
13545|  1.88k|  }
13546|  1.88k|  enforce_max_input_length();
13547|  1.88k|  return url;
13548|  13.4k|}
_ZNK3ada14url_aggregator12get_hostnameEv:
14516|  3.18k|    ada_lifetime_bound {
14517|  3.18k|  ada_log("url_aggregator::get_hostname");
14518|       |  // Technically, we should check if there is a hostname, but
14519|       |  // the code below works even if there isn't.
14520|       |  // if(!has_hostname()) { return ""; }
14521|  3.18k|  size_t start = components.host_start;
14522|       |  // So host_start is not where the host begins.
14523|  3.18k|  if (components.host_end > components.host_start &&
  ------------------
  |  Branch (14523:7): [True: 349, False: 2.83k]
  ------------------
14524|    349|      buffer[components.host_start] == '@') {
  ------------------
  |  Branch (14524:7): [True: 27, False: 322]
  ------------------
14525|     27|    start++;
14526|     27|  }
14527|  3.18k|  return helpers::substring(buffer, start, components.host_end);
14528|  3.18k|}
_ZN3ada14url_aggregator10parse_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
14661|  2.43k|bool url_aggregator::parse_ipv4(std::string_view input, bool in_place) {
14662|  2.43k|  ada_log("parse_ipv4 ", input, " [", input.size(),
14663|  2.43k|          " bytes], overlaps with buffer: ",
14664|  2.43k|          helpers::overlaps(input, buffer) ? "yes" : "no");
14665|  2.43k|  ADA_ASSERT_TRUE(validate());
14666|  2.43k|  if (input.empty()) {
  ------------------
  |  Branch (14666:7): [True: 0, False: 2.43k]
  ------------------
14667|      0|    return is_valid = false;
14668|      0|  }
14669|  2.43k|  const bool trailing_dot = (input.back() == '.');
14670|  2.43k|  if (trailing_dot) {
  ------------------
  |  Branch (14670:7): [True: 41, False: 2.38k]
  ------------------
14671|     41|    input.remove_suffix(1);
14672|     41|    if (input.empty()) {
  ------------------
  |  Branch (14672:9): [True: 0, False: 41]
  ------------------
14673|      0|      return is_valid = false;
14674|      0|    }
14675|     41|  }
14676|       |
14677|  2.43k|  const uint64_t fast = checkers::try_parse_ipv4_fast(input);
14678|  2.43k|  if (fast < checkers::ipv4_fast_fail) [[likely]] {
  ------------------
  |  Branch (14678:7): [True: 4, False: 2.42k]
  ------------------
14679|       |    // Pure decimal: keep the buffer when it already holds the address.
14680|       |    // Otherwise write the (trailing-dot-stripped) input.
14681|      4|    if (!(in_place && !trailing_dot)) {
  ------------------
  |  Branch (14681:11): [True: 3, False: 1]
  |  Branch (14681:23): [True: 1, False: 2]
  ------------------
14682|      3|      if (helpers::overlaps(input, buffer)) {
  ------------------
  |  Branch (14682:11): [True: 0, False: 3]
  ------------------
14683|      0|        update_base_hostname(std::string(input));
14684|      3|      } else {
14685|      3|        update_base_hostname(input);
14686|      3|      }
14687|      3|    }
14688|      4|    host_type = IPV4;
14689|      4|    ADA_ASSERT_TRUE(validate());
14690|      4|    return true;
14691|      4|  }
14692|       |
14693|  2.42k|  const char* p = input.data();
14694|  2.42k|  const char* end = p + input.size();
14695|  2.42k|  uint64_t ipv4 = 0;
14696|  2.42k|  int digit_count = 0;
14697|  2.42k|  int pure_decimal_count = 0;
14698|       |
14699|  2.65k|  for (; digit_count < 4 && p < end; ++digit_count) {
  ------------------
  |  Branch (14699:10): [True: 2.65k, False: 4]
  |  Branch (14699:29): [True: 2.65k, False: 0]
  ------------------
14700|  2.65k|    uint64_t segment = 0;
14701|  2.65k|    bool pure = false;
14702|  2.65k|    if (!detail::parse_ipv4_number(p, end, segment, pure)) {
  ------------------
  |  Branch (14702:9): [True: 1.67k, False: 979]
  ------------------
14703|  1.67k|      return is_valid = false;
14704|  1.67k|    }
14705|    979|    if (pure) {
  ------------------
  |  Branch (14705:9): [True: 743, False: 236]
  ------------------
14706|    743|      ++pure_decimal_count;
14707|    743|    }
14708|    979|    if (p >= end) {
  ------------------
  |  Branch (14708:9): [True: 720, False: 259]
  ------------------
14709|    720|      const unsigned shift = static_cast<unsigned>(32 - digit_count * 8);
14710|    720|      if (segment >= (uint64_t{1} << shift)) {
  ------------------
  |  Branch (14710:11): [True: 10, False: 710]
  ------------------
14711|     10|        return is_valid = false;
14712|     10|      }
14713|    710|      ipv4 = (ipv4 << shift) | segment;
14714|    710|      goto ipv4_done;
14715|    720|    }
14716|    259|    if (segment > 255 || *p != '.') {
  ------------------
  |  Branch (14716:9): [True: 30, False: 229]
  |  Branch (14716:26): [True: 0, False: 229]
  ------------------
14717|     30|      return is_valid = false;
14718|     30|    }
14719|    229|    ipv4 = (ipv4 << 8) | segment;
14720|    229|    ++p;
14721|    229|  }
14722|      4|  if (digit_count != 4 || p != end) {
  ------------------
  |  Branch (14722:7): [True: 0, False: 4]
  |  Branch (14722:27): [True: 4, False: 0]
  ------------------
14723|      4|    return is_valid = false;
14724|      4|  }
14725|    710|ipv4_done:
14726|    710|  ada_log("url_aggregator::parse_ipv4 completed ", get_href(),
14727|    710|          " host: ", get_host());
14728|    710|  if (in_place && pure_decimal_count == 4 && !trailing_dot) {
  ------------------
  |  Branch (14728:7): [True: 687, False: 23]
  |  Branch (14728:19): [True: 0, False: 687]
  |  Branch (14728:46): [True: 0, False: 0]
  ------------------
14729|      0|    ada_log(
14730|      0|        "url_aggregator::parse_ipv4 completed and was already correct in the "
14731|      0|        "buffer");
14732|    710|  } else {
14733|    710|    update_base_hostname(ada::serializers::ipv4(ipv4));
14734|    710|  }
14735|    710|  host_type = IPV4;
14736|    710|  ADA_ASSERT_TRUE(validate());
14737|    710|  return true;
14738|      4|}
_ZN3ada14url_aggregator10parse_ipv6ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14740|  7.25k|bool url_aggregator::parse_ipv6(std::string_view input) {
14741|  7.25k|  ada_log("parse_ipv6 ", input, " [", input.size(), " bytes]");
14742|  7.25k|  ADA_ASSERT_TRUE(validate());
14743|  7.25k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14744|  7.25k|  if (input.empty() || input.size() > 45) [[unlikely]] {
  ------------------
  |  Branch (14744:7): [True: 4, False: 7.25k]
  |  Branch (14744:24): [True: 1, False: 7.25k]
  ------------------
14745|      5|    return is_valid = false;
14746|      5|  }
14747|  7.25k|  std::array<uint16_t, 8> address{};
14748|       |#if defined(ADA_AVX512_IPV6)
14749|       |  if (bool simd_valid; detail::try_parse_ipv6_avx512(input.data(), input.size(),
14750|       |                                                     address, simd_valid)) {
14751|       |    if (!simd_valid) [[unlikely]] {
14752|       |      return is_valid = false;
14753|       |    }
14754|       |    const std::string serialized = ada::serializers::ipv6(address);
14755|       |    if (get_hostname() != serialized) {
14756|       |      update_base_hostname(serialized);
14757|       |    }
14758|       |    host_type = IPV6;
14759|       |    return true;
14760|       |  }
14761|       |  address = {};
14762|       |#endif
14763|  7.25k|  const char* pointer = input.data();
14764|  7.25k|  const char* const end = pointer + input.size();
14765|  7.25k|  int piece_index = 0;
14766|  7.25k|  int compress = -1;
14767|       |
14768|  7.25k|  if (*pointer == ':') {
  ------------------
  |  Branch (14768:7): [True: 11, False: 7.23k]
  ------------------
14769|     11|    if (input.size() == 1 || pointer[1] != ':') [[unlikely]] {
  ------------------
  |  Branch (14769:9): [True: 1, False: 10]
  |  Branch (14769:30): [True: 1, False: 9]
  ------------------
14770|      2|      return is_valid = false;
14771|      2|    }
14772|      9|    pointer += 2;
14773|      9|    compress = ++piece_index;
14774|      9|  }
14775|       |
14776|  7.43k|  while (pointer != end) {
  ------------------
  |  Branch (14776:10): [True: 7.39k, False: 34]
  ------------------
14777|  7.39k|    if (piece_index == 8) [[unlikely]] {
  ------------------
  |  Branch (14777:9): [True: 2, False: 7.39k]
  ------------------
14778|      2|      return is_valid = false;
14779|      2|    }
14780|  7.39k|    if (*pointer == ':') {
  ------------------
  |  Branch (14780:9): [True: 14, False: 7.38k]
  ------------------
14781|     14|      if (compress != -1) [[unlikely]] {
  ------------------
  |  Branch (14781:11): [True: 1, False: 13]
  ------------------
14782|      1|        return is_valid = false;
14783|      1|      }
14784|     13|      ++pointer;
14785|     13|      compress = ++piece_index;
14786|     13|      continue;
14787|     14|    }
14788|       |
14789|  7.38k|    uint16_t value = 0;
14790|  7.38k|    const int length = detail::parse_hex_piece(pointer, end, value);
14791|       |
14792|  7.38k|    if (pointer != end && *pointer == '.') {
  ------------------
  |  Branch (14792:9): [True: 7.35k, False: 26]
  |  Branch (14792:27): [True: 60, False: 7.29k]
  ------------------
14793|     60|      if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (14793:11): [True: 1, False: 59]
  ------------------
14794|      1|        return is_valid = false;
14795|      1|      }
14796|     59|      pointer -= length;
14797|     59|      if (piece_index > 6) [[unlikely]] {
  ------------------
  |  Branch (14797:11): [True: 1, False: 58]
  ------------------
14798|      1|        return is_valid = false;
14799|      1|      }
14800|       |
14801|     58|      int numbers_seen = 0;
14802|    161|      while (pointer != end) {
  ------------------
  |  Branch (14802:14): [True: 151, False: 10]
  ------------------
14803|    151|        int ipv4_piece = -1;
14804|    151|        if (numbers_seen > 0) {
  ------------------
  |  Branch (14804:13): [True: 93, False: 58]
  ------------------
14805|     93|          if (*pointer == '.' && numbers_seen < 4) {
  ------------------
  |  Branch (14805:15): [True: 71, False: 22]
  |  Branch (14805:34): [True: 70, False: 1]
  ------------------
14806|     70|            ++pointer;
14807|     70|          } else {
14808|     23|            return is_valid = false;
14809|     23|          }
14810|     93|        }
14811|    128|        if (pointer == end || *pointer < '0' || *pointer > '9') [[unlikely]] {
  ------------------
  |  Branch (14811:13): [True: 15, False: 113]
  |  Branch (14811:31): [True: 4, False: 109]
  |  Branch (14811:49): [True: 3, False: 106]
  ------------------
14812|     22|          return is_valid = false;
14813|     22|        }
14814|    106|        ipv4_piece = *pointer - '0';
14815|    106|        ++pointer;
14816|    106|        if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (14816:13): [True: 102, False: 4]
  |  Branch (14816:31): [True: 44, False: 58]
  |  Branch (14816:50): [True: 38, False: 6]
  ------------------
14817|     38|          if (ipv4_piece == 0) [[unlikely]] {
  ------------------
  |  Branch (14817:15): [True: 1, False: 37]
  ------------------
14818|      1|            return is_valid = false;
14819|      1|          }
14820|     37|          ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
14821|     37|          ++pointer;
14822|     37|          if (pointer != end && *pointer >= '0' && *pointer <= '9') {
  ------------------
  |  Branch (14822:15): [True: 34, False: 3]
  |  Branch (14822:33): [True: 21, False: 13]
  |  Branch (14822:52): [True: 18, False: 3]
  ------------------
14823|     18|            ipv4_piece = ipv4_piece * 10 + (*pointer - '0');
14824|     18|            ++pointer;
14825|     18|            if (ipv4_piece > 255) [[unlikely]] {
  ------------------
  |  Branch (14825:17): [True: 2, False: 16]
  ------------------
14826|      2|              return is_valid = false;
14827|      2|            }
14828|     18|          }
14829|     37|        }
14830|    103|        address[static_cast<size_t>(piece_index)] = static_cast<uint16_t>(
14831|    103|            address[static_cast<size_t>(piece_index)] * 0x100 +
14832|    103|            static_cast<uint16_t>(ipv4_piece));
14833|    103|        ++numbers_seen;
14834|    103|        if (numbers_seen == 2 || numbers_seen == 4) {
  ------------------
  |  Branch (14834:13): [True: 29, False: 74]
  |  Branch (14834:34): [True: 8, False: 66]
  ------------------
14835|     37|          ++piece_index;
14836|     37|        }
14837|    103|      }
14838|     10|      if (numbers_seen != 4) [[unlikely]] {
  ------------------
  |  Branch (14838:11): [True: 5, False: 5]
  ------------------
14839|      5|        return is_valid = false;
14840|      5|      }
14841|      5|      break;
14842|     10|    }
14843|       |
14844|  7.32k|    if (length == 0) [[unlikely]] {
  ------------------
  |  Branch (14844:9): [True: 7.13k, False: 183]
  ------------------
14845|  7.13k|      return is_valid = false;
14846|  7.13k|    }
14847|       |
14848|    183|    if (pointer != end && *pointer == ':') {
  ------------------
  |  Branch (14848:9): [True: 157, False: 26]
  |  Branch (14848:27): [True: 150, False: 7]
  ------------------
14849|    150|      ++pointer;
14850|    150|      if (pointer == end) [[unlikely]] {
  ------------------
  |  Branch (14850:11): [True: 7, False: 143]
  ------------------
14851|      7|        return is_valid = false;
14852|      7|      }
14853|    150|    } else if (pointer != end) [[unlikely]] {
  ------------------
  |  Branch (14853:16): [True: 7, False: 26]
  ------------------
14854|      7|      return is_valid = false;
14855|      7|    }
14856|       |
14857|    169|    address[static_cast<size_t>(piece_index)] = value;
14858|    169|    ++piece_index;
14859|    169|  }
14860|       |
14861|     39|  if (compress != -1) {
  ------------------
  |  Branch (14861:7): [True: 19, False: 20]
  ------------------
14862|     19|    const int right = piece_index - compress;
14863|     19|    if (right > 0) {
  ------------------
  |  Branch (14863:9): [True: 11, False: 8]
  ------------------
14864|     11|      const size_t dest = static_cast<size_t>(8 - right);
14865|     11|      const size_t src = static_cast<size_t>(compress);
14866|     11|      if (dest != src) {
  ------------------
  |  Branch (14866:11): [True: 9, False: 2]
  ------------------
14867|     33|        for (size_t i = static_cast<size_t>(right); i-- > 0;) {
  ------------------
  |  Branch (14867:53): [True: 24, False: 9]
  ------------------
14868|     24|          address[dest + i] = address[src + i];
14869|     24|          address[src + i] = 0;
14870|     24|        }
14871|      9|      }
14872|     11|    }
14873|     20|  } else if (piece_index != 8) [[unlikely]] {
  ------------------
  |  Branch (14873:14): [True: 18, False: 2]
  ------------------
14874|     18|    return is_valid = false;
14875|     18|  }
14876|       |
14877|       |  // Serialize once; skip rewrite when hostname is already canonical.
14878|     21|  const std::string serialized = ada::serializers::ipv6(address);
14879|     21|  const std::string_view current = get_hostname();
14880|     21|  if (current.size() == serialized.size() &&
  ------------------
  |  Branch (14880:7): [True: 0, False: 21]
  ------------------
14881|      0|      std::memcmp(current.data(), serialized.data(), serialized.size()) == 0) {
  ------------------
  |  Branch (14881:7): [True: 0, False: 0]
  ------------------
14882|      0|    ada_log("parse_ipv6 in-place canonical match");
14883|     21|  } else {
14884|     21|    update_base_hostname(serialized);
14885|     21|  }
14886|     21|  ada_log("parse_ipv6 ", get_hostname());
14887|     21|  ADA_ASSERT_TRUE(validate());
14888|     21|  host_type = IPV6;
14889|     21|  return true;
14890|     39|}
serializers.cc:_ZZN3ada4idna22utf32_length_from_utf8EPKcmENK3$_0clEa:
  272|  57.6k|  return std::count_if(p, std::next(p, len), [](int8_t c) {
  273|       |    // -65 is 0b10111111, anything larger in two-complement's
  274|       |    // should start a new code point.
  275|  57.6k|    return c > -65;
  276|  57.6k|  });
_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|    501|  auto broadcast = [](uint8_t v) -> uint64_t {
 5128|    501|    return 0x101010101010101ull * v;
 5129|    501|  };
_ZN3ada4idna13ensure_tablesEv:
 4878|  8.95k|[[nodiscard]] inline bool ensure_tables() noexcept {
 4879|  8.95k|  uint8_t state = tables_init_state.load(std::memory_order_acquire);
 4880|  8.95k|  if (state == kTablesReady) {
  ------------------
  |  Branch (4880:7): [True: 8.95k, False: 1]
  ------------------
 4881|  8.95k|    return true;
 4882|  8.95k|  }
 4883|      1|  if (state == kTablesFailed) {
  ------------------
  |  Branch (4883:7): [True: 0, False: 1]
  ------------------
 4884|      0|    return false;
 4885|      0|  }
 4886|       |
 4887|      1|  uint8_t expected = kTablesUninit;
 4888|      1|  if (tables_init_state.compare_exchange_strong(expected, kTablesInProgress,
  ------------------
  |  Branch (4888:7): [True: 1, False: 0]
  ------------------
 4889|      1|                                                std::memory_order_acq_rel,
 4890|      1|                                                std::memory_order_acquire)) {
 4891|      1|    uint8_t* buffer = new (std::nothrow) uint8_t[table_blob::uncompressed_size];
 4892|      1|    if (buffer == nullptr) {
  ------------------
  |  Branch (4892:9): [True: 0, False: 1]
  ------------------
 4893|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 4894|      0|      return false;
 4895|      0|    }
 4896|       |
 4897|      1|    const size_t n = deflate::inflate_raw(table_blob::compressed,
 4898|      1|                                          table_blob::compressed_size, buffer,
 4899|      1|                                          table_blob::uncompressed_size);
 4900|      1|    if (n != table_blob::uncompressed_size ||
  ------------------
  |  Branch (4900:9): [True: 0, False: 1]
  ------------------
 4901|      1|        crc32_ieee(buffer, n) != table_blob::uncompressed_crc32) {
  ------------------
  |  Branch (4901:9): [True: 0, False: 1]
  ------------------
 4902|      0|      delete[] buffer;
 4903|      0|      tables_init_state.store(kTablesFailed, std::memory_order_release);
 4904|      0|      return false;
 4905|      0|    }
 4906|       |
 4907|       |    // LE payload verified; convert multi-byte fields for big-endian hosts.
 4908|      1|    detail::convert_table_blob_to_host_endian(buffer);
 4909|       |
 4910|      1|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 4911|      1|      return buffer + off;
 4912|      1|    };
 4913|       |
 4914|       |    // Publish all non-atomic pointers before READY. Waiters synchronize via
 4915|       |    // acquire on tables_init_state and then observe these writes.
 4916|      1|    idna_stage1 =
 4917|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage1));
 4918|      1|    idna_stage2 =
 4919|      1|        reinterpret_cast<const uint16_t*>(at(table_blob::off_idna_stage2));
 4920|      1|    idna_bool_blocks =
 4921|      1|        reinterpret_cast<const uint64_t*>(at(table_blob::off_idna_bool_blocks));
 4922|      1|    idna_utf8_mappings = at(table_blob::off_idna_utf8_mappings);
 4923|       |
 4924|      1|    decomposition_index = at(table_blob::off_decomposition_index);
 4925|      1|    decomposition_block_flat = reinterpret_cast<const uint16_t*>(
 4926|      1|        at(table_blob::off_decomposition_block));
 4927|      1|    decomposition_data = reinterpret_cast<const char32_t*>(
 4928|      1|        at(table_blob::off_decomposition_data));
 4929|      1|    ccc_index = at(table_blob::off_ccc_index);
 4930|      1|    ccc_block_flat = at(table_blob::off_ccc_block);
 4931|      1|    composition_index = at(table_blob::off_composition_index);
 4932|      1|    composition_block_flat = reinterpret_cast<const uint16_t*>(
 4933|      1|        at(table_blob::off_composition_block));
 4934|      1|    composition_data =
 4935|      1|        reinterpret_cast<const char32_t*>(at(table_blob::off_composition_data));
 4936|       |
 4937|      1|    id_continue =
 4938|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_continue_flat));
 4939|      1|    id_start =
 4940|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_id_start_flat));
 4941|       |
 4942|      1|    dir_start =
 4943|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_start));
 4944|      1|    dir_final =
 4945|      1|        reinterpret_cast<const uint32_t*>(at(table_blob::off_dir_final));
 4946|      1|    dir_value = at(table_blob::off_dir_value);
 4947|      1|    combining_ranges =
 4948|      1|        reinterpret_cast<range_pair_ptr>(at(table_blob::off_combining_flat));
 4949|       |
 4950|      1|    tables_buffer = buffer;
 4951|      1|    tables_init_state.store(kTablesReady, std::memory_order_release);
 4952|      1|    return true;
 4953|      1|  }
 4954|       |
 4955|       |  // Another thread owns init (or finished between our loads).
 4956|      0|  for (uint64_t spins = 0; spins < kTablesSpinLimit; ++spins) {
  ------------------
  |  Branch (4956:28): [True: 0, False: 0]
  ------------------
 4957|      0|    state = tables_init_state.load(std::memory_order_acquire);
 4958|      0|    if (state == kTablesReady) {
  ------------------
  |  Branch (4958:9): [True: 0, False: 0]
  ------------------
 4959|      0|      return true;
 4960|      0|    }
 4961|      0|    if (state == kTablesFailed) {
  ------------------
  |  Branch (4961:9): [True: 0, False: 0]
  ------------------
 4962|      0|      return false;
 4963|      0|    }
 4964|      0|#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
 4965|      0|    defined(_M_IX86)
 4966|      0|#if defined(__GNUC__) || defined(__clang__)
 4967|      0|    __builtin_ia32_pause();
 4968|      0|#endif
 4969|       |#elif defined(__aarch64__) || defined(_M_ARM64)
 4970|       |#if defined(__GNUC__) || defined(__clang__)
 4971|       |    asm volatile("yield" ::: "memory");
 4972|       |#endif
 4973|       |#endif
 4974|      0|  }
 4975|       |  // Timed out waiting for a peer - treat as failure rather than hang.
 4976|      0|  return false;
 4977|      0|}
_ZN3ada4idna7deflate11inflate_rawEPKhmPhm:
  528|      1|                          size_t dst_cap) {
  529|      1|  BitReader br(src, src_len);
  530|      1|  size_t out = 0;
  531|      4|  for (;;) {
  532|      4|    uint32_t bfinal = br.get(1);
  533|      4|    uint32_t btype = br.get(2);
  534|      4|    if (bfinal == UINT32_MAX || btype == UINT32_MAX) return 0;
  ------------------
  |  Branch (534:9): [True: 0, False: 4]
  |  Branch (534:33): [True: 0, False: 4]
  ------------------
  535|      4|    if (btype == 0) {
  ------------------
  |  Branch (535:9): [True: 0, False: 4]
  ------------------
  536|       |      // stored
  537|      0|      br.align_byte();
  538|      0|      if (!br.ensure(16)) return 0;
  ------------------
  |  Branch (538:11): [True: 0, False: 0]
  ------------------
  539|       |      // read 16+16 from bit buffer awkwardly - use byte path
  540|       |      // Align: bits is multiple of 8
  541|       |      // Get len from remaining bits then bytes
  542|      0|      uint32_t len = br.get(16);
  543|      0|      uint32_t nlen = br.get(16);
  544|      0|      if (len == UINT32_MAX || nlen == UINT32_MAX) return 0;
  ------------------
  |  Branch (544:11): [True: 0, False: 0]
  |  Branch (544:32): [True: 0, False: 0]
  ------------------
  545|      0|      if ((len ^ 0xFFFF) != nlen) return 0;
  ------------------
  |  Branch (545:11): [True: 0, False: 0]
  ------------------
  546|       |      // After get, may have bits in acc from previous - for stored, should be
  547|       |      // byte aligned Copy len bytes from p
  548|      0|      if (br.bits != 0) {
  ------------------
  |  Branch (548:11): [True: 0, False: 0]
  ------------------
  549|       |        // leftover bits should be 0 if aligned
  550|      0|      }
  551|      0|      if (size_t(br.end - br.p) < len) return 0;
  ------------------
  |  Branch (551:11): [True: 0, False: 0]
  ------------------
  552|      0|      if (out + len > dst_cap) return 0;
  ------------------
  |  Branch (552:11): [True: 0, False: 0]
  ------------------
  553|      0|      std::memcpy(dst + out, br.p, len);
  554|      0|      br.p += len;
  555|      0|      out += len;
  556|      4|    } else if (btype == 1 || btype == 2) {
  ------------------
  |  Branch (556:16): [True: 0, False: 4]
  |  Branch (556:30): [True: 4, False: 0]
  ------------------
  557|      4|      Huff lit, dist;
  558|      4|      if (btype == 1) {
  ------------------
  |  Branch (558:11): [True: 0, False: 4]
  ------------------
  559|       |        // use fixed via functions
  560|      4|      } else {
  561|       |        // dynamic
  562|      4|        uint32_t hlit = br.get(5);
  563|      4|        if (hlit == UINT32_MAX) return 0;
  ------------------
  |  Branch (563:13): [True: 0, False: 4]
  ------------------
  564|      4|        hlit += 257;
  565|      4|        uint32_t hdist = br.get(5);
  566|      4|        if (hdist == UINT32_MAX) return 0;
  ------------------
  |  Branch (566:13): [True: 0, False: 4]
  ------------------
  567|      4|        hdist += 1;
  568|      4|        uint32_t hclen = br.get(4);
  569|      4|        if (hclen == UINT32_MAX) return 0;
  ------------------
  |  Branch (569:13): [True: 0, False: 4]
  ------------------
  570|      4|        hclen += 4;
  571|      4|        static const int order[19] = {16, 17, 18, 0, 8,  7, 9,  6, 10, 5,
  572|      4|                                      11, 4,  12, 3, 13, 2, 14, 1, 15};
  573|      4|        uint8_t clen[19]{};
  574|     69|        for (uint32_t i = 0; i < hclen; i++) {
  ------------------
  |  Branch (574:30): [True: 65, False: 4]
  ------------------
  575|     65|          uint32_t v = br.get(3);
  576|     65|          if (v == UINT32_MAX) return 0;
  ------------------
  |  Branch (576:15): [True: 0, False: 65]
  ------------------
  577|     65|          clen[order[i]] = uint8_t(v);
  578|     65|        }
  579|      4|        Huff cl;
  580|      4|        if (!cl.build(clen, 19)) return 0;
  ------------------
  |  Branch (580:13): [True: 0, False: 4]
  ------------------
  581|      4|        uint8_t lens[288 + 32]{};
  582|      4|        uint32_t n = hlit + hdist;
  583|  1.09k|        for (uint32_t i = 0; i < n;) {
  ------------------
  |  Branch (583:30): [True: 1.08k, False: 4]
  ------------------
  584|  1.08k|          int sym = cl.decode(br);
  585|  1.08k|          if (sym < 0) return 0;
  ------------------
  |  Branch (585:15): [True: 0, False: 1.08k]
  ------------------
  586|  1.08k|          if (sym < 16) {
  ------------------
  |  Branch (586:15): [True: 1.03k, False: 49]
  ------------------
  587|  1.03k|            lens[i++] = uint8_t(sym);
  588|  1.03k|          } else if (sym == 16) {
  ------------------
  |  Branch (588:22): [True: 49, False: 0]
  ------------------
  589|     49|            uint32_t rep = br.get(2);
  590|     49|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (590:17): [True: 0, False: 49]
  ------------------
  591|     49|            rep += 3;
  592|     49|            if (i == 0) return 0;
  ------------------
  |  Branch (592:17): [True: 0, False: 49]
  ------------------
  593|     49|            uint8_t v = lens[i - 1];
  594|    263|            while (rep--) lens[i++] = v;
  ------------------
  |  Branch (594:20): [True: 214, False: 49]
  ------------------
  595|     49|          } else if (sym == 17) {
  ------------------
  |  Branch (595:22): [True: 0, False: 0]
  ------------------
  596|      0|            uint32_t rep = br.get(3);
  597|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (597:17): [True: 0, False: 0]
  ------------------
  598|      0|            rep += 3;
  599|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (599:20): [True: 0, False: 0]
  ------------------
  600|      0|          } else if (sym == 18) {
  ------------------
  |  Branch (600:22): [True: 0, False: 0]
  ------------------
  601|      0|            uint32_t rep = br.get(7);
  602|      0|            if (rep == UINT32_MAX) return 0;
  ------------------
  |  Branch (602:17): [True: 0, False: 0]
  ------------------
  603|      0|            rep += 11;
  604|      0|            while (rep--) lens[i++] = 0;
  ------------------
  |  Branch (604:20): [True: 0, False: 0]
  ------------------
  605|      0|          } else
  606|      0|            return 0;
  607|  1.08k|        }
  608|      4|        if (!lit.build(lens, int(hlit))) return 0;
  ------------------
  |  Branch (608:13): [True: 0, False: 4]
  ------------------
  609|      4|        if (!dist.build(lens + hlit, int(hdist))) return 0;
  ------------------
  |  Branch (609:13): [True: 0, False: 4]
  ------------------
  610|      4|      }
  611|  52.2k|      for (;;) {
  612|  52.2k|        int sym;
  613|  52.2k|        if (btype == 1)
  ------------------
  |  Branch (613:13): [True: 0, False: 52.2k]
  ------------------
  614|      0|          sym = fixed_litlen(br);
  615|  52.2k|        else
  616|  52.2k|          sym = lit.decode(br);
  617|  52.2k|        if (sym < 0) return 0;
  ------------------
  |  Branch (617:13): [True: 0, False: 52.2k]
  ------------------
  618|  52.2k|        if (sym < 256) {
  ------------------
  |  Branch (618:13): [True: 37.2k, False: 14.9k]
  ------------------
  619|  37.2k|          if (out >= dst_cap) return 0;
  ------------------
  |  Branch (619:15): [True: 0, False: 37.2k]
  ------------------
  620|  37.2k|          dst[out++] = uint8_t(sym);
  621|  37.2k|        } else if (sym == 256) {
  ------------------
  |  Branch (621:20): [True: 4, False: 14.9k]
  ------------------
  622|      4|          break;
  623|  14.9k|        } else {
  624|  14.9k|          int len_code = sym - 257;
  625|  14.9k|          if (len_code < 0 || len_code > 28) return 0;
  ------------------
  |  Branch (625:15): [True: 0, False: 14.9k]
  |  Branch (625:31): [True: 0, False: 14.9k]
  ------------------
  626|  14.9k|          uint32_t extra = br.get(len_extra[len_code]);
  627|  14.9k|          if (len_extra[len_code] && extra == UINT32_MAX) return 0;
  ------------------
  |  Branch (627:15): [True: 2.03k, False: 12.9k]
  |  Branch (627:38): [True: 0, False: 2.03k]
  ------------------
  628|  14.9k|          uint32_t length =
  629|  14.9k|              len_base[len_code] + (len_extra[len_code] ? extra : 0);
  ------------------
  |  Branch (629:37): [True: 2.03k, False: 12.9k]
  ------------------
  630|  14.9k|          int dsym;
  631|  14.9k|          if (btype == 1)
  ------------------
  |  Branch (631:15): [True: 0, False: 14.9k]
  ------------------
  632|      0|            dsym = fixed_dist(br);
  633|  14.9k|          else
  634|  14.9k|            dsym = dist.decode(br);
  635|  14.9k|          if (dsym < 0 || dsym > 29) return 0;
  ------------------
  |  Branch (635:15): [True: 0, False: 14.9k]
  |  Branch (635:27): [True: 0, False: 14.9k]
  ------------------
  636|  14.9k|          uint32_t dextra = br.get(dist_extra[dsym]);
  637|  14.9k|          if (dist_extra[dsym] && dextra == UINT32_MAX) return 0;
  ------------------
  |  Branch (637:15): [True: 9.97k, False: 5.01k]
  |  Branch (637:35): [True: 0, False: 9.97k]
  ------------------
  638|  14.9k|          uint32_t distance = dist_base[dsym] + (dist_extra[dsym] ? dextra : 0);
  ------------------
  |  Branch (638:50): [True: 9.97k, False: 5.01k]
  ------------------
  639|  14.9k|          if (distance > out || out + length > dst_cap) return 0;
  ------------------
  |  Branch (639:15): [True: 0, False: 14.9k]
  |  Branch (639:33): [True: 0, False: 14.9k]
  ------------------
  640|   202k|          for (uint32_t k = 0; k < length; k++) {
  ------------------
  |  Branch (640:32): [True: 187k, False: 14.9k]
  ------------------
  641|   187k|            dst[out] = dst[out - distance];
  642|   187k|            out++;
  643|   187k|          }
  644|  14.9k|        }
  645|  52.2k|      }
  646|      4|    } else {
  647|      0|      return 0;  // reserved
  648|      0|    }
  649|      4|    if (bfinal) break;
  ------------------
  |  Branch (649:9): [True: 1, False: 3]
  ------------------
  650|      4|  }
  651|      1|  return out;
  652|      1|}
_ZN3ada4idna7deflate9BitReaderC2EPKhm:
  390|      1|      : p(data), end(data + len) {}
_ZNK3ada4idna7deflate4Huff6decodeERNS1_9BitReaderE:
  464|  68.3k|  int decode(BitReader& br) const {
  465|  68.3k|    if (max_bits == 0) return -1;
  ------------------
  |  Branch (465:9): [True: 0, False: 68.3k]
  ------------------
  466|  68.3k|    int code = 0;
  467|   427k|    for (int len = 1; len <= max_bits; len++) {
  ------------------
  |  Branch (467:23): [True: 427k, False: 0]
  ------------------
  468|   427k|      uint32_t b = br.get(1);
  469|   427k|      if (b == UINT32_MAX) return -1;
  ------------------
  |  Branch (469:11): [True: 0, False: 427k]
  ------------------
  470|   427k|      code = (code << 1) | int(b);
  471|   427k|      int first = first_code[len];
  472|   427k|      int cnt = counts[len];
  473|   427k|      if (cnt && code - first < cnt) {
  ------------------
  |  Branch (473:11): [True: 263k, False: 164k]
  |  Branch (473:18): [True: 68.3k, False: 195k]
  ------------------
  474|  68.3k|        return symbols[base_idx[len] + (code - first)];
  475|  68.3k|      }
  476|   427k|    }
  477|      0|    return -1;
  478|  68.3k|  }
_ZN3ada4idna10crc32_ieeeEPKhm:
 4861|      1|                                         size_t len) noexcept {
 4862|      1|  uint32_t c = 0xFFFFFFFFu;
 4863|   224k|  for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (4863:22): [True: 224k, False: 1]
  ------------------
 4864|   224k|    c ^= data[i];
 4865|  2.02M|    for (int k = 0; k < 8; ++k) {
  ------------------
  |  Branch (4865:21): [True: 1.79M, False: 224k]
  ------------------
 4866|  1.79M|      const uint32_t mask = 0u - (c & 1u);
 4867|  1.79M|      c = (c >> 1) ^ (0xEDB88320u & mask);
 4868|  1.79M|    }
 4869|   224k|  }
 4870|      1|  return ~c;
 4871|      1|}
_ZN3ada4idna6detail33convert_table_blob_to_host_endianEPh:
 4684|      1|inline void convert_table_blob_to_host_endian(uint8_t* buffer) noexcept {
 4685|      1|  if constexpr (std::endian::native == std::endian::little) {
 4686|      1|    (void)buffer;
 4687|      1|    return;
 4688|      1|  }
 4689|      0|  auto u16 = [&](size_t off, size_t count) {
 4690|      1|    bswap_inplace(reinterpret_cast<uint16_t*>(buffer + off), count);
 4691|      1|  };
 4692|      1|  auto u32 = [&](size_t off, size_t count) {
 4693|      1|    bswap_inplace(reinterpret_cast<uint32_t*>(buffer + off), count);
 4694|      1|  };
 4695|      1|  auto u64 = [&](size_t off, size_t count) {
 4696|      1|    bswap_inplace(reinterpret_cast<uint64_t*>(buffer + off), count);
 4697|      1|  };
 4698|       |
 4699|      1|  u16(table_blob::off_idna_stage1, table_blob::count_idna_stage1);
 4700|      1|  u16(table_blob::off_idna_stage2, table_blob::count_idna_stage2);
 4701|      1|  u64(table_blob::off_idna_bool_blocks, table_blob::count_idna_bool_blocks);
 4702|      1|  u16(table_blob::off_decomposition_block,
 4703|      1|      table_blob::count_decomposition_block);
 4704|      1|  u32(table_blob::off_decomposition_data, table_blob::count_decomposition_data);
 4705|      1|  u16(table_blob::off_composition_block, table_blob::count_composition_block);
 4706|      1|  u32(table_blob::off_composition_data, table_blob::count_composition_data);
 4707|      1|  u32(table_blob::off_id_continue_flat, table_blob::count_id_continue_flat);
 4708|      1|  u32(table_blob::off_id_start_flat, table_blob::count_id_start_flat);
 4709|      1|  u32(table_blob::off_dir_start, table_blob::count_dir_start);
 4710|      1|  u32(table_blob::off_dir_final, table_blob::count_dir_final);
 4711|      1|  u32(table_blob::off_combining_flat, table_blob::count_combining_flat);
 4712|      1|}
_ZZN3ada4idna13ensure_tablesEvENKUlmE_clEm:
 4910|     18|    auto at = [&](size_t off) noexcept -> const uint8_t* {
 4911|     18|      return buffer + off;
 4912|     18|    };
serializers.cc:_ZN3ada4idnaL11idna_lookupEj:
 5065|  91.4k|static uint16_t idna_lookup(uint32_t cp) noexcept {
 5066|  91.4k|  if (cp < IDNA_LOW_RANGE_END) {
  ------------------
  |  Branch (5066:7): [True: 90.6k, False: 831]
  ------------------
 5067|  90.6k|    uint16_t ref = idna_stage1[cp >> IDNA_BLOCK_BITS];
 5068|  90.6k|    if (ref & IDNA_BOOL_FLAG) {
  ------------------
  |  Branch (5068:9): [True: 45.5k, False: 45.0k]
  ------------------
 5069|  45.5k|      uint32_t bit_idx =
 5070|  45.5k|          static_cast<uint32_t>(ref & ~IDNA_BOOL_FLAG) * IDNA_BLOCK_SIZE +
 5071|  45.5k|          (cp & IDNA_BLOCK_MASK);
 5072|  45.5k|      bool is_valid = (idna_bool_blocks[bit_idx >> 6] >> (bit_idx & 63u)) & 1u;
 5073|  45.5k|      return is_valid ? IDNA_VALID : IDNA_DISALLOWED;
  ------------------
  |  Branch (5073:14): [True: 45.5k, False: 8]
  ------------------
 5074|  45.5k|    }
 5075|  45.0k|    return idna_stage2[ref + (cp & IDNA_BLOCK_MASK)];
 5076|  90.6k|  }
 5077|       |
 5078|    831|  if (cp >= IDNA_HIGH_IGNORED_START && cp < IDNA_HIGH_IGNORED_END) {
  ------------------
  |  Branch (5078:7): [True: 793, False: 38]
  |  Branch (5078:40): [True: 667, False: 126]
  ------------------
 5079|    667|    return IDNA_IGNORED;
 5080|    667|  }
 5081|       |
 5082|    164|  return IDNA_DISALLOWED;
 5083|    831|}
serializers.cc:_ZN3ada4idnaL21utf8_count_codepointsEPKh:
 5108|  10.4k|static size_t utf8_count_codepoints(const uint8_t* ptr) noexcept {
 5109|  10.4k|  size_t n = 0;
 5110|  62.8k|  while (*ptr != 0) {
  ------------------
  |  Branch (5110:10): [True: 52.4k, False: 10.4k]
  ------------------
 5111|  52.4k|    ++n;
 5112|  52.4k|    if (*ptr < 0x80u) {
  ------------------
  |  Branch (5112:9): [True: 13.6k, False: 38.7k]
  ------------------
 5113|  13.6k|      ++ptr;
 5114|  38.7k|    } else if (*ptr < 0xE0u) {
  ------------------
  |  Branch (5114:16): [True: 27.1k, False: 11.6k]
  ------------------
 5115|  27.1k|      ptr += 2;
 5116|  27.1k|    } else if (*ptr < 0xF0u) {
  ------------------
  |  Branch (5116:16): [True: 11.1k, False: 486]
  ------------------
 5117|  11.1k|      ptr += 3;
 5118|  11.1k|    } else {
 5119|    486|      ptr += 4;
 5120|    486|    }
 5121|  52.4k|  }
 5122|  10.4k|  return n;
 5123|  10.4k|}
serializers.cc:_ZN3ada4idnaL9utf8_nextERPKh:
 5086|  52.3k|static char32_t utf8_next(const uint8_t*& ptr) noexcept {
 5087|  52.3k|  uint8_t b0 = *ptr++;
 5088|  52.3k|  if (b0 < 0x80u) return static_cast<char32_t>(b0);
  ------------------
  |  Branch (5088:7): [True: 13.5k, False: 38.7k]
  ------------------
 5089|  38.7k|  if (b0 < 0xE0u) {
  ------------------
  |  Branch (5089:7): [True: 27.1k, False: 11.5k]
  ------------------
 5090|  27.1k|    uint32_t cp = (b0 & 0x1Fu) << 6;
 5091|  27.1k|    cp |= (*ptr++ & 0x3Fu);
 5092|  27.1k|    return static_cast<char32_t>(cp);
 5093|  27.1k|  }
 5094|  11.5k|  if (b0 < 0xF0u) {
  ------------------
  |  Branch (5094:7): [True: 11.1k, False: 482]
  ------------------
 5095|  11.1k|    uint32_t cp = (b0 & 0x0Fu) << 12;
 5096|  11.1k|    cp |= ((*ptr++ & 0x3Fu) << 6);
 5097|  11.1k|    cp |= (*ptr++ & 0x3Fu);
 5098|  11.1k|    return static_cast<char32_t>(cp);
 5099|  11.1k|  }
 5100|    482|  uint32_t cp = (b0 & 0x07u) << 18;
 5101|    482|  cp |= ((*ptr++ & 0x3Fu) << 12);
 5102|    482|  cp |= ((*ptr++ & 0x3Fu) << 6);
 5103|    482|  cp |= (*ptr++ & 0x3Fu);
 5104|    482|  return static_cast<char32_t>(cp);
 5105|  11.5k|}
_ZN3ada4idna23decomposition_block_rowEh:
 4982|   188k|inline const uint16_t* decomposition_block_row(uint8_t bi) noexcept {
 4983|   188k|  if (bi >= kDecompBlockRows) {
  ------------------
  |  Branch (4983:7): [True: 0, False: 188k]
  ------------------
 4984|      0|    bi = 0;
 4985|      0|  }
 4986|   188k|  return decomposition_block_flat + static_cast<size_t>(bi) * kDecompBlockCols;
 4987|   188k|}
_ZN3ada4idna13ccc_block_rowEh:
 4989|   275k|inline const uint8_t* ccc_block_row(uint8_t bi) noexcept {
 4990|   275k|  if (bi >= kCccBlockRows) {
  ------------------
  |  Branch (4990:7): [True: 0, False: 275k]
  ------------------
 4991|      0|    bi = 0;
 4992|      0|  }
 4993|   275k|  return ccc_block_flat + static_cast<size_t>(bi) * kCccBlockCols;
 4994|   275k|}
_ZN3ada4idna16tables_are_readyEv:
 4873|  3.79k|[[nodiscard]] inline bool tables_are_ready() noexcept {
 4874|  3.79k|  return tables_init_state.load(std::memory_order_acquire) == kTablesReady;
 4875|  3.79k|}
serializers.cc:_ZN3ada4idnaL23canonical_decomp_lengthEDi:
 5265|   165k|static size_t canonical_decomp_length(char32_t current_character) noexcept {
 5266|   165k|  if (current_character >= hangul_sbase &&
  ------------------
  |  Branch (5266:7): [True: 7.86k, False: 157k]
  ------------------
 5267|  7.86k|      current_character < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5267:7): [True: 3.61k, False: 4.25k]
  ------------------
 5268|       |    // Hangul precomposed syllables are NFC.
 5269|  3.61k|    return 0;
 5270|  3.61k|  }
 5271|   161k|  if (current_character >= 0x110000) {
  ------------------
  |  Branch (5271:7): [True: 0, False: 161k]
  ------------------
 5272|      0|    return 0;
 5273|      0|  }
 5274|   161k|  const uint8_t di = decomposition_index[current_character >> 8];
 5275|   161k|  const uint16_t* const decomposition =
 5276|   161k|      decomposition_block_row(di) + (current_character % 256);
 5277|   161k|  size_t decomposition_length =
 5278|   161k|      (decomposition[1] >> 2) - (decomposition[0] >> 2);
 5279|   161k|  if ((decomposition_length > 0) && (decomposition[0] & 1)) {
  ------------------
  |  Branch (5279:7): [True: 5.74k, False: 156k]
  |  Branch (5279:37): [True: 0, False: 5.74k]
  ------------------
 5280|      0|    decomposition_length = 0;  // compatibility-only: ignored for NFC
 5281|      0|  }
 5282|   161k|  return decomposition_length;
 5283|   161k|}
serializers.cc:_ZN3ada4idnaL12trailing_cccEDi:
 5466|  80.4k|static uint8_t trailing_ccc(char32_t c) noexcept {
 5467|  80.4k|  const size_t length = canonical_decomp_length(c);
 5468|  80.4k|  if (length == 0) {
  ------------------
  |  Branch (5468:7): [True: 77.6k, False: 2.73k]
  ------------------
 5469|  77.6k|    return get_ccc(c);
 5470|  77.6k|  }
 5471|  2.73k|  const uint16_t* const decomposition =
 5472|  2.73k|      decomposition_block_row(decomposition_index[c >> 8]) + (c % 256);
 5473|  2.73k|  const size_t base = decomposition[0] >> 2;
 5474|  2.73k|  return get_ccc(decomposition_data[base + length - 1]);
 5475|  80.4k|}
serializers.cc:_ZN3ada4idnaL13would_composeENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5397|  2.73k|static bool would_compose(std::u32string_view input) noexcept {
 5398|  70.2k|  for (size_t input_count = 0; input_count < input.size();) {
  ------------------
  |  Branch (5398:32): [True: 68.3k, False: 1.95k]
  ------------------
 5399|  68.3k|    const char32_t current = input[input_count];
 5400|  68.3k|    if (current >= hangul_lbase && current < hangul_lbase + hangul_lcount) {
  ------------------
  |  Branch (5400:9): [True: 15.0k, False: 53.2k]
  |  Branch (5400:36): [True: 544, False: 14.5k]
  ------------------
 5401|    544|      if (input_count + 1 < input.size() &&
  ------------------
  |  Branch (5401:11): [True: 523, False: 21]
  ------------------
 5402|    523|          input[input_count + 1] >= hangul_vbase &&
  ------------------
  |  Branch (5402:11): [True: 264, False: 259]
  ------------------
 5403|    264|          input[input_count + 1] < hangul_vbase + hangul_vcount) {
  ------------------
  |  Branch (5403:11): [True: 100, False: 164]
  ------------------
 5404|    100|        return true;
 5405|    100|      }
 5406|    444|      ++input_count;
 5407|    444|      continue;
 5408|    544|    }
 5409|  67.7k|    if (current >= hangul_sbase && current < hangul_sbase + hangul_scount) {
  ------------------
  |  Branch (5409:9): [True: 2.50k, False: 65.2k]
  |  Branch (5409:36): [True: 1.37k, False: 1.12k]
  ------------------
 5410|  1.37k|      if ((current - hangul_sbase) % hangul_tcount &&
  ------------------
  |  Branch (5410:11): [True: 1.00k, False: 370]
  ------------------
 5411|  1.00k|          input_count + 1 < input.size() &&
  ------------------
  |  Branch (5411:11): [True: 984, False: 23]
  ------------------
 5412|    984|          input[input_count + 1] > hangul_tbase &&
  ------------------
  |  Branch (5412:11): [True: 808, False: 176]
  ------------------
 5413|    808|          input[input_count + 1] < hangul_tbase + hangul_tcount) {
  ------------------
  |  Branch (5413:11): [True: 134, False: 674]
  ------------------
 5414|    134|        return true;
 5415|    134|      }
 5416|  1.24k|      ++input_count;
 5417|  1.24k|      continue;
 5418|  1.37k|    }
 5419|  66.4k|    if (current < 0x110000) {
  ------------------
  |  Branch (5419:9): [True: 66.4k, False: 0]
  ------------------
 5420|  66.4k|      const uint16_t* composition =
 5421|  66.4k|          composition_block_row(composition_index[current >> 8]) +
 5422|  66.4k|          (current % 256);
 5423|  66.4k|      int32_t previous_ccc = -1;
 5424|  66.4k|      size_t j = input_count;
 5425|  67.5k|      for (; j + 1 < input.size(); ++j) {
  ------------------
  |  Branch (5425:14): [True: 65.6k, False: 1.90k]
  ------------------
 5426|  65.6k|        uint8_t ccc = get_ccc(input[j + 1]);
 5427|  65.6k|        if (composition[1] != composition[0] && previous_ccc < ccc) {
  ------------------
  |  Branch (5427:13): [True: 17.3k, False: 48.3k]
  |  Branch (5427:49): [True: 16.9k, False: 421]
  ------------------
 5428|  16.9k|          int left = composition[0];
 5429|  16.9k|          int right = composition[1];
 5430|  16.9k|          if (left < 0 || right < left ||
  ------------------
  |  Branch (5430:15): [True: 0, False: 16.9k]
  |  Branch (5430:27): [True: 0, False: 16.9k]
  ------------------
 5431|  16.9k|              static_cast<size_t>(right) > composition_data_size) {
  ------------------
  |  Branch (5431:15): [True: 0, False: 16.9k]
  ------------------
 5432|      0|            break;
 5433|      0|          }
 5434|  40.0k|          while (left + 2 < right) {
  ------------------
  |  Branch (5434:18): [True: 23.1k, False: 16.9k]
  ------------------
 5435|  23.1k|            int middle = left + (((right - left) >> 1) & ~1);
 5436|  23.1k|            if (composition_data[static_cast<size_t>(middle)] <= input[j + 1]) {
  ------------------
  |  Branch (5436:17): [True: 1.92k, False: 21.2k]
  ------------------
 5437|  1.92k|              left = middle;
 5438|  1.92k|            }
 5439|  23.1k|            if (composition_data[static_cast<size_t>(middle)] >= input[j + 1]) {
  ------------------
  |  Branch (5439:17): [True: 21.6k, False: 1.45k]
  ------------------
 5440|  21.6k|              right = middle;
 5441|  21.6k|            }
 5442|  23.1k|          }
 5443|  16.9k|          if (static_cast<size_t>(left + 1) < composition_data_size &&
  ------------------
  |  Branch (5443:15): [True: 16.9k, False: 0]
  ------------------
 5444|  16.9k|              composition_data[static_cast<size_t>(left)] == input[j + 1]) {
  ------------------
  |  Branch (5444:15): [True: 550, False: 16.3k]
  ------------------
 5445|    550|            return true;
 5446|    550|          }
 5447|  16.9k|        }
 5448|  65.1k|        if (ccc == 0) {
  ------------------
  |  Branch (5448:13): [True: 63.9k, False: 1.14k]
  ------------------
 5449|  63.9k|          break;
 5450|  63.9k|        }
 5451|  1.14k|        previous_ccc = ccc;
 5452|  1.14k|      }
 5453|  65.8k|      input_count = j + 1;
 5454|  65.8k|      continue;
 5455|  66.4k|    }
 5456|      0|    ++input_count;
 5457|      0|  }
 5458|  1.95k|  return false;
 5459|  2.73k|}
_ZN3ada4idna21composition_block_rowEh:
 4996|  81.1k|inline const uint16_t* composition_block_row(uint8_t bi) noexcept {
 4997|  81.1k|  if (bi >= kCompBlockRows) {
  ------------------
  |  Branch (4997:7): [True: 0, False: 81.1k]
  ------------------
 4998|      0|    bi = 0;
 4999|      0|  }
 5000|  81.1k|  return composition_block_flat + static_cast<size_t>(bi) * kCompBlockCols;
 5001|  81.1k|}
serializers.cc:_ZN3ada4idnaL19char_to_digit_valueEc:
 5643|  12.9k|static constexpr int32_t char_to_digit_value(char value) {
 5644|  12.9k|  if (value >= 'a' && value <= 'z') return value - 'a';
  ------------------
  |  Branch (5644:7): [True: 10.4k, False: 2.42k]
  |  Branch (5644:23): [True: 10.4k, False: 1]
  ------------------
 5645|  2.42k|  if (value >= '0' && value <= '9') return value - '0' + 26;
  ------------------
  |  Branch (5645:7): [True: 2.42k, False: 5]
  |  Branch (5645:23): [True: 2.41k, False: 6]
  ------------------
 5646|     11|  return -1;
 5647|  2.42k|}
serializers.cc:_ZN3ada4idnaL5adaptEiib:
 5653|  29.7k|static constexpr int32_t adapt(int32_t d, int32_t n, bool firsttime) {
 5654|  29.7k|  if (firsttime) {
  ------------------
  |  Branch (5654:7): [True: 4.26k, False: 25.4k]
  ------------------
 5655|  4.26k|    d = d / damp;
 5656|  25.4k|  } else {
 5657|  25.4k|    d = d / 2;
 5658|  25.4k|  }
 5659|  29.7k|  d += d / n;
 5660|  29.7k|  int32_t k = 0;
 5661|  33.2k|  while (d > ((base - tmin) * tmax) / 2) {
  ------------------
  |  Branch (5661:10): [True: 3.49k, False: 29.7k]
  ------------------
 5662|  3.49k|    d /= base - tmin;
 5663|  3.49k|    k += base;
 5664|  3.49k|  }
 5665|  29.7k|  return k + (((base - tmin + 1) * d) / (d + skew));
 5666|  29.7k|}
serializers.cc:_ZN3ada4idnaL13digit_to_charEi:
 5649|  38.4k|static constexpr char digit_to_char(int32_t digit) {
 5650|  38.4k|  return digit < 26 ? char(digit + 97) : char(digit + 22);
  ------------------
  |  Branch (5650:10): [True: 31.4k, False: 6.98k]
  ------------------
 5651|  38.4k|}
serializers.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_0clIA2_jEEDaRKT_:
 5988|  37.8k|      comb_span, label.front(), {}, [](const auto& range) { return range[1]; });
serializers.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_1clEj:
 6073|    759|      auto is_l_or_d = [](uint32_t code) {
 6074|    759|        return std::ranges::binary_search(L, code) ||
  ------------------
  |  Branch (6074:16): [True: 29, False: 730]
  ------------------
 6075|    730|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6075:16): [True: 233, False: 497]
  ------------------
 6076|    759|      };
serializers.cc:_ZZN3ada4idna14is_label_validENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEEENK3$_2clEj:
 6077|  1.21k|      auto is_r_or_d = [](uint32_t code) {
 6078|  1.21k|        return std::ranges::binary_search(R, code) ||
  ------------------
  |  Branch (6078:16): [True: 118, False: 1.10k]
  ------------------
 6079|  1.10k|               std::ranges::binary_search(D, code);
  ------------------
  |  Branch (6079:16): [True: 60, False: 1.04k]
  ------------------
 6080|  1.21k|      };
serializers.cc:_ZN3ada4idnaL20find_last_not_of_nsmENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5935|  3.94k|    const std::u32string_view label) noexcept {
 5936|  4.77k|  for (int i = static_cast<int>(label.size() - 1); i >= 0; i--)
  ------------------
  |  Branch (5936:52): [True: 4.77k, False: 0]
  ------------------
 5937|  4.77k|    if (find_direction(label[i]) != direction::NSM) return i;
  ------------------
  |  Branch (5937:9): [True: 3.94k, False: 837]
  ------------------
 5938|       |
 5939|      0|  return std::u32string_view::npos;
 5940|  3.94k|}
serializers.cc:_ZN3ada4idnaL12is_rtl_labelENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 5944|  3.94k|inline static bool is_rtl_label(const std::u32string_view label) noexcept {
 5945|  3.94k|  const size_t mask =
 5946|  3.94k|      (1u << direction::R) | (1u << direction::AL) | (1u << direction::AN);
 5947|       |
 5948|  3.94k|  size_t directions = 0;
 5949|  37.5k|  for (size_t i = 0; i < label.size(); i++) {
  ------------------
  |  Branch (5949:22): [True: 33.5k, False: 3.94k]
  ------------------
 5950|  33.5k|    directions |= 1u << find_direction(label[i]);
 5951|  33.5k|  }
 5952|  3.94k|  return (directions & mask) != 0;
 5953|  3.94k|}
serializers.cc:_ZN3ada4idnaL14find_directionEj:
 5916|  44.5k|inline static direction find_direction(uint32_t code_point) noexcept {
 5917|       |  // Binary search on dir_final (sorted upper bounds).
 5918|  44.5k|  size_t lo = 0, hi = dir_table_count;
 5919|   511k|  while (lo < hi) {
  ------------------
  |  Branch (5919:10): [True: 467k, False: 44.5k]
  ------------------
 5920|   467k|    size_t mid = lo + (hi - lo) / 2;
 5921|   467k|    if (dir_final[mid] < code_point) {
  ------------------
  |  Branch (5921:9): [True: 214k, False: 253k]
  ------------------
 5922|   214k|      lo = mid + 1;
 5923|   253k|    } else {
 5924|   253k|      hi = mid;
 5925|   253k|    }
 5926|   467k|  }
 5927|  44.5k|  if (lo == dir_table_count) {
  ------------------
  |  Branch (5927:7): [True: 0, False: 44.5k]
  ------------------
 5928|      0|    return direction::NONE;
 5929|      0|  }
 5930|  44.5k|  return code_point >= dir_start[lo] ? static_cast<direction>(dir_value[lo])
  ------------------
  |  Branch (5930:10): [True: 43.8k, False: 653]
  ------------------
 5931|  44.5k|                                     : direction::NONE;
 5932|  44.5k|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6301|  2.84k|bool constexpr is_ascii(std::string_view view) {
 6302|  20.9k|  for (uint8_t c : view) {
  ------------------
  |  Branch (6302:18): [True: 20.9k, False: 167]
  ------------------
 6303|  20.9k|    if (c >= 0x80) {
  ------------------
  |  Branch (6303:9): [True: 2.67k, False: 18.2k]
  ------------------
 6304|  2.67k|      return false;
 6305|  2.67k|    }
 6306|  20.9k|  }
 6307|    167|  return true;
 6308|  2.84k|}
serializers.cc:_ZN3ada4idnaL19from_ascii_to_asciiENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEERNS1_12basic_stringIcS4_NS1_9allocatorIcEEEE:
 6338|    167|static void from_ascii_to_ascii(std::string_view ut8_string, std::string& out) {
 6339|    167|  out.assign(ut8_string);
 6340|    167|  ascii_map(out.data(), out.size());
 6341|    167|}
_ZN3ada4idna8is_asciiENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6292|  9.65k|bool constexpr is_ascii(std::u32string_view view) {
 6293|  34.8k|  for (uint32_t c : view) {
  ------------------
  |  Branch (6293:19): [True: 34.8k, False: 2.01k]
  ------------------
 6294|  34.8k|    if (c >= 0x80) {
  ------------------
  |  Branch (6294:9): [True: 7.64k, False: 27.2k]
  ------------------
 6295|  7.64k|      return false;
 6296|  7.64k|    }
 6297|  34.8k|  }
 6298|  2.01k|  return true;
 6299|  9.65k|}
serializers.cc:_ZN3ada4idnaL13is_ace_prefixENSt3__117basic_string_viewIDiNS1_11char_traitsIDiEEEE:
 6354|  6.46k|static bool is_ace_prefix(std::u32string_view label) noexcept {
 6355|  6.46k|  return label.size() >= 4 && label[0] == U'x' && label[1] == U'n' &&
  ------------------
  |  Branch (6355:10): [True: 3.35k, False: 3.10k]
  |  Branch (6355:31): [True: 1.33k, False: 2.01k]
  |  Branch (6355:51): [True: 1.26k, False: 70]
  ------------------
 6356|  1.26k|         label[2] == U'-' && label[3] == U'-';
  ------------------
  |  Branch (6356:10): [True: 1.22k, False: 46]
  |  Branch (6356:30): [True: 1.18k, False: 35]
  ------------------
 6357|  6.46k|}
serializers.cc:_ZN3ada4idnaL18append_ascii_labelERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_17basic_string_viewIDiNS3_IDiEEEE:
 6344|  2.71k|static void append_ascii_label(std::string& out, std::u32string_view label) {
 6345|  2.71k|  const size_t old = out.size();
 6346|  2.71k|  out.resize(old + label.size());
 6347|  2.71k|  char* dest = out.data() + old;
 6348|  22.6k|  for (char32_t c : label) {
  ------------------
  |  Branch (6348:19): [True: 22.6k, False: 2.71k]
  ------------------
 6349|  22.6k|    *dest++ = static_cast<char>(c);
 6350|  22.6k|  }
 6351|  2.71k|}
_ZZN3ada7unicode14percent_encodeILb1EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7358|  32.7k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7359|  32.7k|    return character_sets::bit_at(character_set, c);
 7360|  32.7k|  });
_ZZN3ada7unicode14percent_encodeILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKhRNS2_12basic_stringIcS5_NS2_9allocatorIcEEEEENKUlcE_clEc:
 7358|  34.3k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7359|  34.3k|    return character_sets::bit_at(character_set, c);
 7360|  34.3k|  });
_ZN3ada7unicode18is_ascii_hex_digitEc:
 7092|  12.7k|ada_really_inline constexpr bool is_ascii_hex_digit(const char c) noexcept {
 7093|  12.7k|  return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') ||
  ------------------
  |  Branch (7093:11): [True: 11.3k, False: 1.48k]
  |  Branch (7093:23): [True: 5.72k, False: 5.57k]
  |  Branch (7093:37): [True: 5.55k, False: 1.50k]
  |  Branch (7093:49): [True: 3.88k, False: 1.67k]
  ------------------
 7094|  3.18k|         (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7094:11): [True: 1.63k, False: 1.54k]
  |  Branch (7094:23): [True: 1.56k, False: 65]
  ------------------
 7095|  12.7k|}
_ZN3ada7unicode21convert_hex_to_binaryEc:
 7182|  10.5k|unsigned constexpr convert_hex_to_binary(const char c) noexcept {
 7183|  10.5k|  return hex_to_binary_table[c - '0'];
 7184|  10.5k|}
serializers.cc:_ZZN3ada7unicode14percent_encodeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKhENK3$_0clEc:
 7326|  34.0k|  auto pointer = std::ranges::find_if(input, [character_set](const char c) {
 7327|  34.0k|    return character_sets::bit_at(character_set, c);
 7328|  34.0k|  });
_ZN3ada7unicode36contains_forbidden_domain_code_pointEPKcm:
 7019|  8.75k|    const char* input, size_t length) noexcept {
 7020|  8.75k|  size_t i = 0;
 7021|  8.75k|  uint8_t accumulator{};
 7022|  57.0k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7022:10): [True: 48.3k, False: 8.75k]
  ------------------
 7023|  48.3k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7024|  48.3k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 1])];
 7025|  48.3k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 2])];
 7026|  48.3k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i + 3])];
 7027|  48.3k|  }
 7028|  20.1k|  for (; i < length; i++) {
  ------------------
  |  Branch (7028:10): [True: 11.4k, False: 8.75k]
  ------------------
 7029|  11.4k|    accumulator |= is_forbidden_domain_code_point_table[uint8_t(input[i])];
 7030|  11.4k|  }
 7031|  8.75k|  return accumulator;
 7032|  8.75k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_122percent_encode_to_wideEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7708|  1.42k|                            const uint8_t character_set[], std::string& out) {
 7709|       |  // Worst case every byte becomes %XX. Avoids realloc while walking windows.
 7710|  1.42k|  out.reserve(out.size() + static_cast<size_t>(end - p) * 3);
 7711|  1.42k|#if ADA_UNICODE_SSSE3
 7712|  1.42k|  const ssse3_percent_tables tables = load_ssse3_percent_tables(character_set);
 7713|  1.42k|  percent_encode_to_ssse3(p, end, character_set, tables, out);
 7714|       |#elif ADA_NEON
 7715|       |  percent_encode_to_neon(p, end, character_set,
 7716|       |                         load_neon_percent_table(character_set), out);
 7717|       |#elif ADA_RVV
 7718|       |  percent_encode_to_rvv(p, end, character_set, out);
 7719|       |#endif
 7720|  1.42k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_125load_ssse3_percent_tablesEPKh:
 7535|  1.42k|load_ssse3_percent_tables(const uint8_t character_set[]) noexcept {
 7536|  1.42k|  ssse3_percent_tables t{};
 7537|  1.42k|  t.cs_lo = _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set));
 7538|  1.42k|  t.cs_hi =
 7539|  1.42k|      _mm_loadu_si128(reinterpret_cast<const __m128i*>(character_set + 16));
 7540|       |  // 1 << (0..7), duplicated so pshufb(index & 7) works for every lane.
 7541|  1.42k|  t.pow2 =
 7542|  1.42k|      _mm_setr_epi8(1, 2, 4, 8, 16, 32, 64, -128, 1, 2, 4, 8, 16, 32, 64, -128);
 7543|  1.42k|  t.mask_0f = _mm_set1_epi8(0x0F);
 7544|  1.42k|  t.mask_07 = _mm_set1_epi8(0x07);
 7545|  1.42k|  t.zero = _mm_setzero_si128();
 7546|  1.42k|  return t;
 7547|  1.42k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_123percent_encode_to_ssse3EPKcS3_PKhRKNS1_20ssse3_percent_tablesERNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEE:
 7566|  1.42k|    const ssse3_percent_tables& tables, std::string& out) {
 7567|       |  // Pair 16-byte windows so a fully clean 32-byte run is one append.
 7568|  3.76k|  while (p + 32 <= end) {
  ------------------
  |  Branch (7568:10): [True: 2.34k, False: 1.42k]
  ------------------
 7569|  2.34k|    const __m128i word0 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7570|  2.34k|    const __m128i word1 =
 7571|  2.34k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + 16));
 7572|  2.34k|    const int mask0 = ssse3_percent_mask(word0, tables);
 7573|  2.34k|    const int mask1 = ssse3_percent_mask(word1, tables);
 7574|  2.34k|    if ((mask0 | mask1) == 0) {
  ------------------
  |  Branch (7574:9): [True: 494, False: 1.84k]
  ------------------
 7575|    494|      out.append(p, 32);
 7576|  1.84k|    } else {
 7577|  1.84k|      if (mask0 == 0) {
  ------------------
  |  Branch (7577:11): [True: 177, False: 1.66k]
  ------------------
 7578|    177|        out.append(p, 16);
 7579|  1.66k|      } else {
 7580|  1.66k|        encode_mask_window(p, static_cast<uint32_t>(mask0), 16, out);
 7581|  1.66k|      }
 7582|  1.84k|      if (mask1 == 0) {
  ------------------
  |  Branch (7582:11): [True: 390, False: 1.45k]
  ------------------
 7583|    390|        out.append(p + 16, 16);
 7584|  1.45k|      } else {
 7585|  1.45k|        encode_mask_window(p + 16, static_cast<uint32_t>(mask1), 16, out);
 7586|  1.45k|      }
 7587|  1.84k|    }
 7588|  2.34k|    p += 32;
 7589|  2.34k|  }
 7590|  1.42k|  if (p + 16 <= end) {
  ------------------
  |  Branch (7590:7): [True: 1.00k, False: 421]
  ------------------
 7591|  1.00k|    const __m128i word = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
 7592|  1.00k|    const int mask = ssse3_percent_mask(word, tables);
 7593|  1.00k|    if (mask == 0) {
  ------------------
  |  Branch (7593:9): [True: 324, False: 683]
  ------------------
 7594|    324|      out.append(p, 16);
 7595|    683|    } else {
 7596|    683|      encode_mask_window(p, static_cast<uint32_t>(mask), 16, out);
 7597|    683|    }
 7598|  1.00k|    p += 16;
 7599|  1.00k|  }
 7600|  1.42k|  percent_encode_to_scalar(p, end, character_set, out);
 7601|  1.42k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_118ssse3_percent_maskEDv2_xRKNS1_20ssse3_percent_tablesE:
 7550|  5.68k|    __m128i word, const ssse3_percent_tables& tables) noexcept {
 7551|  5.68k|  const __m128i idx = _mm_and_si128(_mm_srli_epi16(word, 3), tables.mask_0f);
 7552|  5.68k|  const __m128i lo = _mm_shuffle_epi8(tables.cs_lo, idx);
 7553|  5.68k|  const __m128i hi = _mm_shuffle_epi8(tables.cs_hi, idx);
 7554|       |  // Bytes 0x80-0xFF are signed-negative; select the high half of the bitmap.
 7555|  5.68k|  const __m128i high_byte = _mm_cmpgt_epi8(tables.zero, word);
 7556|  5.68k|  const __m128i cs_byte = _mm_or_si128(_mm_and_si128(hi, high_byte),
 7557|  5.68k|                                       _mm_andnot_si128(high_byte, lo));
 7558|  5.68k|  const __m128i bits =
 7559|  5.68k|      _mm_shuffle_epi8(tables.pow2, _mm_and_si128(word, tables.mask_07));
 7560|  5.68k|  const __m128i hits = _mm_and_si128(cs_byte, bits);
 7561|  5.68k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hits, tables.zero)) ^ 0xFFFF;
 7562|  5.68k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_118encode_mask_windowEPKcjmRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
 7490|  3.80k|                                          size_t width, std::string& out) {
 7491|  3.80k|  uint64_t bits = mask;
 7492|  3.80k|  size_t off = 0;
 7493|  39.4k|  while (bits != 0) {
  ------------------
  |  Branch (7493:10): [True: 35.6k, False: 3.80k]
  ------------------
 7494|  35.6k|    const int zero_run = trailing_zeroes32(static_cast<uint32_t>(bits));
 7495|  35.6k|    if (zero_run != 0) {
  ------------------
  |  Branch (7495:9): [True: 3.94k, False: 31.6k]
  ------------------
 7496|  3.94k|      out.append(p + off, static_cast<size_t>(zero_run));
 7497|  3.94k|    }
 7498|  35.6k|    off += static_cast<size_t>(zero_run);
 7499|  35.6k|    out.append(character_sets::hex + uint8_t(p[off]) * 4, 3);
 7500|  35.6k|    ++off;
 7501|  35.6k|    bits >>= static_cast<unsigned>(zero_run + 1);
 7502|  35.6k|  }
 7503|  3.80k|  if (off < width) {
  ------------------
  |  Branch (7503:7): [True: 1.70k, False: 2.10k]
  ------------------
 7504|  1.70k|    out.append(p + off, width - off);
 7505|  1.70k|  }
 7506|  3.80k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_117trailing_zeroes32Ej:
 7478|  35.6k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
 7479|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 7480|       |  unsigned long ret;
 7481|       |  _BitScanForward(&ret, input_num);
 7482|       |  return static_cast<int>(ret);
 7483|       |#else
 7484|  35.6k|  return __builtin_ctz(input_num);
 7485|  35.6k|#endif
 7486|  35.6k|}
serializers.cc:_ZN3ada7unicode12_GLOBAL__N_124percent_encode_to_scalarEPKcS3_PKhRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
 7511|  1.42k|                                                std::string& out) {
 7512|  4.71k|  for (; p != end; ++p) {
  ------------------
  |  Branch (7512:10): [True: 3.29k, False: 1.42k]
  ------------------
 7513|  3.29k|    if (character_sets::bit_at(character_set, *p)) {
  ------------------
  |  Branch (7513:9): [True: 1.48k, False: 1.81k]
  ------------------
 7514|  1.48k|      out.append(character_sets::hex + uint8_t(*p) * 4, 3);
 7515|  1.81k|    } else {
 7516|  1.81k|      out += *p;
 7517|  1.81k|    }
 7518|  3.29k|  }
 7519|  1.42k|}
serializers.cc:_ZN3ada11serializers12_GLOBAL__N_113write_hex_u16EPct:
 7775|  53.0k|ada_really_inline char* write_hex_u16(char* p, uint16_t v) noexcept {
 7776|  53.0k|  static constexpr char kHex[] = "0123456789abcdef";
 7777|  53.0k|  if (v >= 0x1000) {
  ------------------
  |  Branch (7777:7): [True: 47.5k, False: 5.45k]
  ------------------
 7778|  47.5k|    *p++ = kHex[(v >> 12) & 0xf];
 7779|  47.5k|    *p++ = kHex[(v >> 8) & 0xf];
 7780|  47.5k|    *p++ = kHex[(v >> 4) & 0xf];
 7781|  47.5k|    *p++ = kHex[v & 0xf];
 7782|  47.5k|  } else if (v >= 0x100) {
  ------------------
  |  Branch (7782:14): [True: 1.47k, False: 3.98k]
  ------------------
 7783|  1.47k|    *p++ = kHex[(v >> 8) & 0xf];
 7784|  1.47k|    *p++ = kHex[(v >> 4) & 0xf];
 7785|  1.47k|    *p++ = kHex[v & 0xf];
 7786|  3.98k|  } else if (v >= 0x10) {
  ------------------
  |  Branch (7786:14): [True: 2.10k, False: 1.87k]
  ------------------
 7787|  2.10k|    *p++ = kHex[(v >> 4) & 0xf];
 7788|  2.10k|    *p++ = kHex[v & 0xf];
 7789|  2.10k|  } else {
 7790|  1.87k|    *p++ = kHex[v & 0xf];
 7791|  1.87k|  }
 7792|  53.0k|  return p;
 7793|  53.0k|}
serializers.cc:_ZN3ada11serializers12_GLOBAL__N_18write_u8EPch:
 7761|  31.6k|ada_really_inline char* write_u8(char* p, uint8_t v) noexcept {
 7762|  31.6k|  if (v < 10) {
  ------------------
  |  Branch (7762:7): [True: 7.08k, False: 24.6k]
  ------------------
 7763|  7.08k|    *p++ = static_cast<char>('0' + v);
 7764|  24.6k|  } else if (v < 100) {
  ------------------
  |  Branch (7764:14): [True: 14.0k, False: 10.5k]
  ------------------
 7765|  14.0k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v) * 2], 2);
 7766|  14.0k|    p += 2;
 7767|  14.0k|  } else {
 7768|  10.5k|    *p++ = static_cast<char>('0' + v / 100);
 7769|  10.5k|    std::memcpy(p, &digit_pairs[static_cast<size_t>(v % 100) * 2], 2);
 7770|  10.5k|    p += 2;
 7771|  10.5k|  }
 7772|  31.6k|  return p;
 7773|  31.6k|}
_ZN3ada7unicode19has_tabs_or_newlineENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6868|  21.2k|    std::string_view user_input) noexcept {
 6869|       |  // first check for short strings in which case we do it naively.
 6870|  21.2k|  if (user_input.size() < 16) {  // slow path
  ------------------
  |  Branch (6870:7): [True: 6.90k, False: 14.3k]
  ------------------
 6871|  6.90k|    return std::ranges::any_of(user_input, is_tabs_or_newline);
 6872|  6.90k|  }
 6873|       |  // fast path for long strings (expected to be common)
 6874|  14.3k|  size_t i = 0;
 6875|  14.3k|  const __m128i mask1 = _mm_set1_epi8('\r');
 6876|  14.3k|  const __m128i mask2 = _mm_set1_epi8('\n');
 6877|  14.3k|  const __m128i mask3 = _mm_set1_epi8('\t');
 6878|       |  // If we supported SSSE3, we could use the algorithm that we use for NEON.
 6879|  14.3k|  __m128i running{0};
 6880|  49.1k|  for (; i + 15 < user_input.size(); i += 16) {
  ------------------
  |  Branch (6880:10): [True: 34.7k, False: 14.3k]
  ------------------
 6881|  34.7k|    __m128i word = _mm_loadu_si128((const __m128i*)(user_input.data() + i));
 6882|  34.7k|    running = _mm_or_si128(
 6883|  34.7k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 6884|  34.7k|                                           _mm_cmpeq_epi8(word, mask2))),
 6885|  34.7k|        _mm_cmpeq_epi8(word, mask3));
 6886|  34.7k|  }
 6887|  14.3k|  if (i < user_input.size()) {
  ------------------
  |  Branch (6887:7): [True: 13.3k, False: 1.00k]
  ------------------
 6888|  13.3k|    __m128i word = _mm_loadu_si128(
 6889|  13.3k|        (const __m128i*)(user_input.data() + user_input.length() - 16));
 6890|  13.3k|    running = _mm_or_si128(
 6891|  13.3k|        _mm_or_si128(running, _mm_or_si128(_mm_cmpeq_epi8(word, mask1),
 6892|  13.3k|                                           _mm_cmpeq_epi8(word, mask2))),
 6893|  13.3k|        _mm_cmpeq_epi8(word, mask3));
 6894|  13.3k|  }
 6895|  14.3k|  return _mm_movemask_epi8(running) != 0;
 6896|  21.2k|}
_ZN3ada7unicode18is_tabs_or_newlineEc:
 6753|  53.5k|constexpr bool is_tabs_or_newline(char c) noexcept {
 6754|  53.5k|  return c == '\r' || c == '\n' || c == '\t';
  ------------------
  |  Branch (6754:10): [True: 41, False: 53.5k]
  |  Branch (6754:23): [True: 53, False: 53.4k]
  |  Branch (6754:36): [True: 55, False: 53.4k]
  ------------------
 6755|  53.5k|}
_ZN3ada7helpers27remove_ascii_tab_or_newlineERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 8564|    143|ada_really_inline void remove_ascii_tab_or_newline(std::string& input) {
 8565|       |  // if this ever becomes a performance issue, we could use an approach similar
 8566|       |  // to has_tabs_or_newline
 8567|    143|  std::erase_if(input, ada::unicode::is_ascii_tab_or_newline);
 8568|    143|}
_ZN3ada7unicode23is_ascii_tab_or_newlineEc:
 7113|  4.51k|    const char c) noexcept {
 7114|  4.51k|  return c == '\t' || c == '\n' || c == '\r';
  ------------------
  |  Branch (7114:10): [True: 281, False: 4.23k]
  |  Branch (7114:23): [True: 318, False: 3.91k]
  |  Branch (7114:36): [True: 154, False: 3.76k]
  ------------------
 7115|  4.51k|}
_ZN3ada7unicode22is_c0_control_or_spaceEc:
 7108|  25.4k|ada_really_inline constexpr bool is_c0_control_or_space(const char c) noexcept {
 7109|  25.4k|  return (unsigned char)c <= ' ';
 7110|  25.4k|}
_ZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7121|  4.33k|    std::string_view input) noexcept {
 7122|       |  // This will catch most cases:
 7123|       |  // The length must be 2,4 or 6.
 7124|       |  // We divide by two and require
 7125|       |  // that the result be between 1 and 3 inclusively.
 7126|  4.33k|  uint64_t half_length = uint64_t(input.size()) / 2;
 7127|  4.33k|  if (half_length - 1 > 2) {
  ------------------
  |  Branch (7127:7): [True: 2.42k, False: 1.90k]
  ------------------
 7128|  2.42k|    return false;
 7129|  2.42k|  }
 7130|       |  // We have a string of length 2, 4 or 6.
 7131|       |  // We now check the first character:
 7132|  1.90k|  if ((input[0] != '.') && (input[0] != '%')) {
  ------------------
  |  Branch (7132:7): [True: 933, False: 975]
  |  Branch (7132:28): [True: 206, False: 727]
  ------------------
 7133|    206|    return false;
 7134|    206|  }
 7135|       |  // We are unlikely the get beyond this point.
 7136|  1.70k|  int hash_value = (input.size() + (unsigned)(input[0])) & 3;
 7137|  1.70k|  const std::string_view target = table_is_double_dot_path_segment[hash_value];
 7138|  1.70k|  if (target.size() != input.size()) {
  ------------------
  |  Branch (7138:7): [True: 680, False: 1.02k]
  ------------------
 7139|    680|    return false;
 7140|    680|  }
 7141|       |  // We almost never get here.
 7142|       |  // Optimizing the rest is relatively unimportant.
 7143|  1.02k|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7144|  1.02k|    uint16_t A, B;
 7145|  1.02k|    memcpy(&A, a.data(), sizeof(A));
 7146|  1.02k|    memcpy(&B, b.data(), sizeof(B));
 7147|  1.02k|    return A == B;
 7148|  1.02k|  };
 7149|  1.02k|  if (!prefix_equal_unsafe(input, target)) {
  ------------------
  |  Branch (7149:7): [True: 314, False: 708]
  ------------------
 7150|    314|    return false;
 7151|    314|  }
 7152|  1.00k|  for (size_t i = 2; i < input.size(); i++) {
  ------------------
  |  Branch (7152:22): [True: 546, False: 463]
  ------------------
 7153|    546|    char c = input[i];
 7154|    546|    if ((uint8_t((c | 0x20) - 0x61) <= 25 ? (c | 0x20) : c) != target[i]) {
  ------------------
  |  Branch (7154:9): [True: 245, False: 301]
  |  Branch (7154:10): [True: 165, False: 381]
  ------------------
 7155|    245|      return false;
 7156|    245|    }
 7157|    546|  }
 7158|    463|  return true;
 7159|       |  // The above code might be a bit better than the code below. Compilers
 7160|       |  // are not stupid and may use the fact that these strings have length 2,4 and
 7161|       |  // 6 and other tricks.
 7162|       |  // return input == ".." ||
 7163|       |  //  input == ".%2e" || input == ".%2E" ||
 7164|       |  //  input == "%2e." || input == "%2E." ||
 7165|       |  //  input == "%2e%2e" || input == "%2E%2E" || input == "%2E%2e" || input ==
 7166|       |  //  "%2e%2E";
 7167|    708|}
_ZZN3ada7unicode26is_double_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEENKUlS5_S5_E_clES5_S5_:
 7143|  1.02k|  auto prefix_equal_unsafe = [](std::string_view a, std::string_view b) {
 7144|  1.02k|    uint16_t A, B;
 7145|  1.02k|    memcpy(&A, a.data(), sizeof(A));
 7146|  1.02k|    memcpy(&B, b.data(), sizeof(B));
 7147|  1.02k|    return A == B;
 7148|  1.02k|  };
_ZN3ada7unicode26is_single_dot_path_segmentENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 7170|  7.72k|    std::string_view input) noexcept {
 7171|  7.72k|  return input == "." || input == "%2e" || input == "%2E";
  ------------------
  |  Branch (7171:10): [True: 345, False: 7.37k]
  |  Branch (7171:26): [True: 93, False: 7.28k]
  |  Branch (7171:44): [True: 16, False: 7.26k]
  ------------------
 7172|  7.72k|}
_ZN3ada6detail17parse_ipv4_numberERPKcS2_RmRb:
 9550|  2.65k|                              bool& is_pure_decimal) noexcept {
 9551|  2.65k|  is_pure_decimal = false;
 9552|  2.65k|  if (p >= end) [[unlikely]] {
  ------------------
  |  Branch (9552:7): [True: 0, False: 2.65k]
  ------------------
 9553|      0|    return false;
 9554|      0|  }
 9555|  2.65k|  if (end - p >= 2 && p[0] == '0' && ((p[1] | 0x20) == 'x')) {
  ------------------
  |  Branch (9555:7): [True: 2.23k, False: 420]
  |  Branch (9555:23): [True: 389, False: 1.84k]
  |  Branch (9555:38): [True: 210, False: 179]
  ------------------
 9556|    210|    p += 2;
 9557|    210|    if (p == end || *p == '.') {
  ------------------
  |  Branch (9557:9): [True: 7, False: 203]
  |  Branch (9557:21): [True: 11, False: 192]
  ------------------
 9558|     18|      value = 0;
 9559|     18|      return true;
 9560|     18|    }
 9561|    192|    uint64_t v = 0;
 9562|    192|    int digits = 0;
 9563|  1.28k|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9563:12): [True: 1.17k, False: 112]
  |  Branch (9563:23): [True: 1.14k, False: 25]
  ------------------
 9564|  1.14k|      const uint8_t nib = hex_nibble[static_cast<unsigned char>(*p)];
 9565|  1.14k|      if (nib == 0xff) [[unlikely]] {
  ------------------
  |  Branch (9565:11): [True: 5, False: 1.14k]
  ------------------
 9566|      5|        return false;
 9567|      5|      }
 9568|  1.14k|      if (v > (0xFFFFFFFFULL >> 4)) [[unlikely]] {
  ------------------
  |  Branch (9568:11): [True: 50, False: 1.09k]
  ------------------
 9569|     50|        return false;
 9570|     50|      }
 9571|  1.09k|      v = (v << 4) | nib;
 9572|  1.09k|      ++p;
 9573|  1.09k|      ++digits;
 9574|  1.09k|    }
 9575|    137|    if (digits == 0) [[unlikely]] {
  ------------------
  |  Branch (9575:9): [True: 0, False: 137]
  ------------------
 9576|      0|      return false;
 9577|      0|    }
 9578|    137|    value = v;
 9579|    137|    return true;
 9580|    137|  }
 9581|  2.44k|  if (end - p >= 2 && p[0] == '0' && p[1] >= '0' && p[1] <= '9') {
  ------------------
  |  Branch (9581:7): [True: 2.02k, False: 420]
  |  Branch (9581:23): [True: 179, False: 1.84k]
  |  Branch (9581:38): [True: 109, False: 70]
  |  Branch (9581:53): [True: 97, False: 12]
  ------------------
 9582|     97|    ++p;
 9583|     97|    uint64_t v = 0;
 9584|    929|    while (p < end && *p != '.') {
  ------------------
  |  Branch (9584:12): [True: 868, False: 61]
  |  Branch (9584:23): [True: 848, False: 20]
  ------------------
 9585|    848|      const char c = *p;
 9586|    848|      if (c < '0' || c > '7') [[unlikely]] {
  ------------------
  |  Branch (9586:11): [True: 4, False: 844]
  |  Branch (9586:22): [True: 6, False: 838]
  ------------------
 9587|     10|        return false;
 9588|     10|      }
 9589|    838|      if (v > (0xFFFFFFFFULL >> 3)) [[unlikely]] {
  ------------------
  |  Branch (9589:11): [True: 6, False: 832]
  ------------------
 9590|      6|        return false;
 9591|      6|      }
 9592|    832|      v = (v << 3) | static_cast<uint64_t>(c - '0');
 9593|    832|      ++p;
 9594|    832|    }
 9595|     81|    value = v;
 9596|     81|    return true;
 9597|     97|  }
 9598|  2.34k|  if (*p < '0' || *p > '9') [[unlikely]] {
  ------------------
  |  Branch (9598:7): [True: 286, False: 2.05k]
  |  Branch (9598:19): [True: 1.26k, False: 796]
  ------------------
 9599|  1.54k|    return false;
 9600|  1.54k|  }
 9601|    796|  is_pure_decimal = true;
 9602|    796|  uint64_t v = static_cast<uint64_t>(*p - '0');
 9603|    796|  ++p;
 9604|  1.73k|  while (p < end && *p != '.') {
  ------------------
  |  Branch (9604:10): [True: 1.19k, False: 540]
  |  Branch (9604:21): [True: 988, False: 203]
  ------------------
 9605|    988|    const char c = *p;
 9606|    988|    if (c < '0' || c > '9') [[unlikely]] {
  ------------------
  |  Branch (9606:9): [True: 9, False: 979]
  |  Branch (9606:20): [True: 24, False: 955]
  ------------------
 9607|     33|      return false;
 9608|     33|    }
 9609|    955|    if (v > 429496729ULL) [[unlikely]] {
  ------------------
  |  Branch (9609:9): [True: 17, False: 938]
  ------------------
 9610|     17|      return false;
 9611|     17|    }
 9612|    938|    v = v * 10u + static_cast<uint64_t>(c - '0');
 9613|    938|    if (v > 0xFFFFFFFFULL) [[unlikely]] {
  ------------------
  |  Branch (9613:9): [True: 3, False: 935]
  ------------------
 9614|      3|      return false;
 9615|      3|    }
 9616|    935|    ++p;
 9617|    935|  }
 9618|    743|  value = v;
 9619|    743|  return true;
 9620|    796|}
_ZN3ada6detail15parse_hex_pieceERPKcS2_Rt:
 9624|  7.38k|                           uint16_t& value) noexcept {
 9625|  7.38k|  if (pointer == end) {
  ------------------
  |  Branch (9625:7): [True: 0, False: 7.38k]
  ------------------
 9626|      0|    return 0;
 9627|      0|  }
 9628|  7.38k|  const uint8_t n0 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9629|  7.38k|  if (n0 == 0xff) {
  ------------------
  |  Branch (9629:7): [True: 7.13k, False: 242]
  ------------------
 9630|  7.13k|    return 0;
 9631|  7.13k|  }
 9632|    242|  uint32_t v = n0;
 9633|    242|  ++pointer;
 9634|    242|  int length = 1;
 9635|    242|  if (pointer != end) {
  ------------------
  |  Branch (9635:7): [True: 228, False: 14]
  ------------------
 9636|    228|    const uint8_t n1 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9637|    228|    if (n1 != 0xff) {
  ------------------
  |  Branch (9637:9): [True: 94, False: 134]
  ------------------
 9638|     94|      v = (v << 4) | n1;
 9639|     94|      ++pointer;
 9640|     94|      ++length;
 9641|     94|      if (pointer != end) {
  ------------------
  |  Branch (9641:11): [True: 92, False: 2]
  ------------------
 9642|     92|        const uint8_t n2 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9643|     92|        if (n2 != 0xff) {
  ------------------
  |  Branch (9643:13): [True: 58, False: 34]
  ------------------
 9644|     58|          v = (v << 4) | n2;
 9645|     58|          ++pointer;
 9646|     58|          ++length;
 9647|     58|          if (pointer != end) {
  ------------------
  |  Branch (9647:15): [True: 53, False: 5]
  ------------------
 9648|     53|            const uint8_t n3 = hex_nibble[static_cast<unsigned char>(*pointer)];
 9649|     53|            if (n3 != 0xff) {
  ------------------
  |  Branch (9649:17): [True: 22, False: 31]
  ------------------
 9650|     22|              v = (v << 4) | n3;
 9651|     22|              ++pointer;
 9652|     22|              ++length;
 9653|     22|            }
 9654|     53|          }
 9655|     58|        }
 9656|     92|      }
 9657|     94|    }
 9658|    228|  }
 9659|    242|  value = static_cast<uint16_t>(v);
 9660|    242|  return length;
 9661|  7.38k|}
_ZN3ada8checkers17verify_dns_lengthENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  100|  7.13k|    std::string_view input) noexcept {
  101|  7.13k|  if (input.empty()) return false;
  ------------------
  |  Branch (101:7): [True: 912, False: 6.21k]
  ------------------
  102|  6.21k|  if (input.back() == '.') {
  ------------------
  |  Branch (102:7): [True: 109, False: 6.11k]
  ------------------
  103|    109|    if (input.size() > 254) return false;
  ------------------
  |  Branch (103:9): [True: 0, False: 109]
  ------------------
  104|  6.11k|  } else if (input.size() > 253)
  ------------------
  |  Branch (104:14): [True: 0, False: 6.11k]
  ------------------
  105|      0|    return false;
  106|       |
  107|  6.21k|  size_t start = 0;
  108|  21.1k|  while (start < input.size()) {
  ------------------
  |  Branch (108:10): [True: 15.8k, False: 5.27k]
  ------------------
  109|  15.8k|    auto dot_location = input.find('.', start);
  110|       |    // If not found, it's likely the end of the domain
  111|  15.8k|    if (dot_location == std::string_view::npos) dot_location = input.size();
  ------------------
  |  Branch (111:9): [True: 5.22k, False: 10.6k]
  ------------------
  112|       |
  113|  15.8k|    auto label_size = dot_location - start;
  114|  15.8k|    if (label_size > 63 || label_size == 0) return false;
  ------------------
  |  Branch (114:9): [True: 239, False: 15.6k]
  |  Branch (114:28): [True: 702, False: 14.9k]
  ------------------
  115|       |
  116|  14.9k|    start = dot_location + 1;
  117|  14.9k|  }
  118|       |
  119|  5.27k|  return true;
  120|  6.21k|}
_ZN3ada7unicode13is_alnum_plusEc:
 7085|  49.0k|ada_really_inline constexpr bool is_alnum_plus(const char c) noexcept {
 7086|  49.0k|  return is_alnum_plus_table[uint8_t(c)];
 7087|       |  // A table is almost surely much faster than the
 7088|       |  // following under most compilers: return
 7089|       |  // return (std::isalnum(c) || c == '+' || c == '-' || c == '.');
 7090|  49.0k|}
_ZN3ada7unicode14to_lower_asciiEPcm:
 6761|  8.25k|constexpr bool to_lower_ascii(char* input, size_t length) noexcept {
 6762|  8.25k|  uint64_t broadcast_80 = broadcast(0x80);
 6763|  8.25k|  uint64_t broadcast_Ap = broadcast(128 - 'A');
 6764|  8.25k|  uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
 6765|  8.25k|  uint64_t non_ascii = 0;
 6766|  8.25k|  size_t i = 0;
 6767|       |
 6768|  24.0k|  for (; i + 7 < length; i += 8) {
  ------------------
  |  Branch (6768:10): [True: 15.7k, False: 8.25k]
  ------------------
 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.25k|  if (i < length) {
  ------------------
  |  Branch (6776:7): [True: 6.26k, False: 1.99k]
  ------------------
 6777|  6.26k|    uint64_t word{};
 6778|  6.26k|    memcpy(&word, input + i, length - i);
 6779|  6.26k|    non_ascii |= (word & broadcast_80);
 6780|  6.26k|    word ^=
 6781|  6.26k|        (((word + broadcast_Ap) ^ (word + broadcast_Zp)) & broadcast_80) >> 2;
 6782|  6.26k|    memcpy(input + i, &word, length - i);
 6783|  6.26k|  }
 6784|  8.25k|  return non_ascii == 0;
 6785|  8.25k|}
_ZN3ada7unicode9broadcastEh:
 6757|  24.7k|constexpr uint64_t broadcast(uint8_t v) noexcept {
 6758|  24.7k|  return 0x101010101010101ull * v;
 6759|  24.7k|}
_ZZN3ada6parser25try_parse_simple_absoluteINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_ENKUlvE_clEv:
12233|    788|    auto apply_query_and_hash = [&]() {
12234|    788|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (12234:11): [True: 131, False: 657]
  ------------------
12235|    131|        const size_t q_end =
12236|    131|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (12236:13): [True: 18, False: 113]
  ------------------
12237|    131|        out.update_base_search(std::string_view(input.data() + query_start + 1,
12238|    131|                                                q_end - query_start - 1),
12239|    131|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
12240|    131|      }
12241|    788|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (12241:11): [True: 124, False: 664]
  ------------------
12242|    124|        out.update_unencoded_base_hash(std::string_view(
12243|    124|            input.data() + hash_start + 1, len - hash_start - 1));
12244|    124|      }
12245|    788|    };
_ZZN3ada6parser32finish_simple_absolute_with_portINS_14url_aggregatorEEEbNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEERT_NS_6scheme4typeEjmmmbENKUlvE_clEv:
11833|     90|    auto apply_query_and_hash = [&]() {
11834|     90|      if (query_start != std::string_view::npos) {
  ------------------
  |  Branch (11834:11): [True: 28, False: 62]
  ------------------
11835|     28|        const size_t q_end =
11836|     28|            (hash_start != std::string_view::npos) ? hash_start : len;
  ------------------
  |  Branch (11836:13): [True: 8, False: 20]
  ------------------
11837|     28|        out.update_base_search(std::string_view(input.data() + query_start + 1,
11838|     28|                                                q_end - query_start - 1),
11839|     28|                               character_sets::SPECIAL_QUERY_PERCENT_ENCODE);
11840|     28|      }
11841|     90|      if (hash_start != std::string_view::npos) {
  ------------------
  |  Branch (11841:11): [True: 18, False: 72]
  ------------------
11842|     18|        out.update_unencoded_base_hash(std::string_view(
11843|     18|            input.data() + hash_start + 1, len - hash_start - 1));
11844|     18|      }
11845|     90|    };
_ZN3ada7helpers10prune_hashERNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8504|  12.2k|    std::string_view& input) noexcept {
 8505|       |  // compiles down to 20--30 instructions including a class to memchr (C
 8506|       |  // function). this function should be quite fast.
 8507|  12.2k|  size_t location_of_first = input.find('#');
 8508|  12.2k|  if (location_of_first == std::string_view::npos) {
  ------------------
  |  Branch (8508:7): [True: 12.0k, False: 162]
  ------------------
 8509|  12.0k|    return std::nullopt;
 8510|  12.0k|  }
 8511|    162|  std::string_view hash = input;
 8512|    162|  hash.remove_prefix(location_of_first + 1);
 8513|    162|  input.remove_suffix(input.size() - location_of_first);
 8514|    162|  return hash;
 8515|  12.2k|}
_ZN3ada7helpers32find_authority_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9462|  1.97k|find_authority_delimiter_special(std::string_view view) noexcept {
 9463|       |  // performance note: we might be able to gain further performance
 9464|       |  // with SIMD intrinsics.
 9465|  8.50k|  for (auto pos = view.begin(); pos != view.end(); ++pos) {
  ------------------
  |  Branch (9465:33): [True: 8.48k, False: 25]
  ------------------
 9466|  8.48k|    if (authority_delimiter_special[(uint8_t)*pos]) {
  ------------------
  |  Branch (9466:9): [True: 1.94k, False: 6.53k]
  ------------------
 9467|  1.94k|      return pos - view.begin();
 9468|  1.94k|    }
 9469|  8.48k|  }
 9470|     25|  return size_t(view.size());
 9471|  1.97k|}
_ZN3ada7helpers12shorten_pathERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_6scheme4typeE:
 8517|    463|ada_really_inline bool shorten_path(std::string& path, ada::scheme::type type) {
 8518|       |  // Let path be url's path.
 8519|       |  // If url's scheme is "file", path's size is 1, and path[0] is a normalized
 8520|       |  // Windows drive letter, then return.
 8521|    463|  if (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (8521:7): [True: 0, False: 463]
  ------------------
 8522|      0|      path.find('/', 1) == std::string_view::npos && !path.empty()) {
  ------------------
  |  Branch (8522:7): [True: 0, False: 0]
  |  Branch (8522:54): [True: 0, False: 0]
  ------------------
 8523|      0|    if (checkers::is_normalized_windows_drive_letter(
  ------------------
  |  Branch (8523:9): [True: 0, False: 0]
  ------------------
 8524|      0|            helpers::substring(path, 1))) {
 8525|      0|      return false;
 8526|      0|    }
 8527|      0|  }
 8528|       |
 8529|       |  // Remove path's last item, if any.
 8530|    463|  size_t last_delimiter = path.rfind('/');
 8531|    463|  if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (8531:7): [True: 199, False: 264]
  ------------------
 8532|    199|    path.erase(last_delimiter);
 8533|    199|    return true;
 8534|    199|  }
 8535|       |
 8536|    264|  return false;
 8537|    463|}
_ZN3ada7helpers27get_host_delimiter_locationEbRNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 9175|  12.2k|    const bool is_special, std::string_view& view) noexcept {
 9176|       |  /**
 9177|       |   * The spec at https://url.spec.whatwg.org/#hostname-state expects us to
 9178|       |   * compute a variable called insideBrackets but this variable is only used
 9179|       |   * once, to check whether a ':' character was found outside brackets. Exact
 9180|       |   * text: "Otherwise, if c is U+003A (:) and insideBrackets is false, then:".
 9181|       |   * It is conceptually simpler and arguably more efficient to just return a
 9182|       |   * Boolean indicating whether ':' was found outside brackets.
 9183|       |   */
 9184|  12.2k|  const size_t view_size = view.size();
 9185|  12.2k|  size_t location = 0;
 9186|  12.2k|  bool found_colon = false;
 9187|       |  /**
 9188|       |   * Performance analysis:
 9189|       |   *
 9190|       |   * We are basically seeking the end of the hostname which can be indicated
 9191|       |   * by the end of the view, or by one of the characters ':', '/', '?', '\\'
 9192|       |   * (where '\\' is only applicable for special URLs). However, these must
 9193|       |   * appear outside a bracket range. E.g., if you have [something?]fd: then the
 9194|       |   * '?' does not count.
 9195|       |   *
 9196|       |   * So we can skip ahead to the next delimiter, as long as we include '[' in
 9197|       |   * the set of delimiters, and that we handle it first.
 9198|       |   *
 9199|       |   * So the trick is to have a fast function that locates the next delimiter.
 9200|       |   * Unless we find '[', then it only needs to be called once! Ideally, such a
 9201|       |   * function would be provided by the C++ standard library, but it seems that
 9202|       |   * find_first_of is not very fast, so we are forced to roll our own.
 9203|       |   *
 9204|       |   * We do not break into two loops for speed, but for clarity.
 9205|       |   */
 9206|  12.2k|  if (is_special) {
  ------------------
  |  Branch (9206:7): [True: 12.2k, False: 0]
  ------------------
 9207|       |    // We move to the next delimiter.
 9208|  12.2k|    location = find_next_host_delimiter_special(view, location);
 9209|       |    // Unless we find '[' then we are going only going to have to call
 9210|       |    // find_next_host_delimiter_special once.
 9211|  19.7k|    for (; location < view_size;
  ------------------
  |  Branch (9211:12): [True: 19.5k, False: 114]
  ------------------
 9212|  19.5k|         location = find_next_host_delimiter_special(view, location)) {
 9213|  19.5k|      if (view[location] == '[') {
  ------------------
  |  Branch (9213:11): [True: 7.62k, False: 11.9k]
  ------------------
 9214|  7.62k|        location = view.find(']', location);
 9215|  7.62k|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9215:13): [True: 176, False: 7.44k]
  ------------------
 9216|       |          // performance: view.find might get translated to a memchr, which
 9217|       |          // has no notion of std::string_view::npos, so the code does not
 9218|       |          // reflect the assembly.
 9219|    176|          location = view_size;
 9220|    176|          break;
 9221|    176|        }
 9222|  11.9k|      } else {
 9223|  11.9k|        found_colon = view[location] == ':';
 9224|  11.9k|        break;
 9225|  11.9k|      }
 9226|  19.5k|    }
 9227|  12.2k|  } else {
 9228|       |    // We move to the next delimiter.
 9229|      0|    location = find_next_host_delimiter(view, location);
 9230|       |    // Unless we find '[' then we are going only going to have to call
 9231|       |    // find_next_host_delimiter_special once.
 9232|      0|    for (; location < view_size;
  ------------------
  |  Branch (9232:12): [True: 0, False: 0]
  ------------------
 9233|      0|         location = find_next_host_delimiter(view, location)) {
 9234|      0|      if (view[location] == '[') {
  ------------------
  |  Branch (9234:11): [True: 0, False: 0]
  ------------------
 9235|      0|        location = view.find(']', location);
 9236|      0|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (9236:13): [True: 0, False: 0]
  ------------------
 9237|       |          // performance: view.find might get translated to a memchr, which
 9238|       |          // has no notion of std::string_view::npos, so the code does not
 9239|       |          // reflect the assembly.
 9240|      0|          location = view_size;
 9241|      0|          break;
 9242|      0|        }
 9243|      0|      } else {
 9244|      0|        found_colon = view[location] == ':';
 9245|      0|        break;
 9246|      0|      }
 9247|      0|    }
 9248|      0|  }
 9249|       |  // performance: remove_suffix may translate into a single instruction.
 9250|  12.2k|  view.remove_suffix(view_size - location);
 9251|  12.2k|  return {location, found_colon};
 9252|  12.2k|}
_ZN3ada7helpers32find_next_host_delimiter_specialENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEm:
 8765|  19.7k|    std::string_view view, size_t location) noexcept {
 8766|       |  // first check for short strings in which case we do it naively.
 8767|  19.7k|  if (view.size() - location < 16) {  // slow path
  ------------------
  |  Branch (8767:7): [True: 10.7k, False: 8.98k]
  ------------------
 8768|  42.4k|    for (size_t i = location; i < view.size(); i++) {
  ------------------
  |  Branch (8768:31): [True: 42.3k, False: 86]
  ------------------
 8769|  42.3k|      if (view[i] == ':' || view[i] == '/' || view[i] == '\\' ||
  ------------------
  |  Branch (8769:11): [True: 574, False: 41.8k]
  |  Branch (8769:29): [True: 9.50k, False: 32.3k]
  |  Branch (8769:47): [True: 1, False: 32.3k]
  ------------------
 8770|  32.3k|          view[i] == '?' || view[i] == '[') {
  ------------------
  |  Branch (8770:11): [True: 71, False: 32.2k]
  |  Branch (8770:29): [True: 476, False: 31.7k]
  ------------------
 8771|  10.6k|        return i;
 8772|  10.6k|      }
 8773|  42.3k|    }
 8774|     86|    return size_t(view.size());
 8775|  10.7k|  }
 8776|       |  // fast path for long strings (expected to be common)
 8777|  8.98k|  size_t i = location;
 8778|  8.98k|  const __m128i mask1 = _mm_set1_epi8(':');
 8779|  8.98k|  const __m128i mask2 = _mm_set1_epi8('/');
 8780|  8.98k|  const __m128i mask3 = _mm_set1_epi8('\\');
 8781|  8.98k|  const __m128i mask4 = _mm_set1_epi8('?');
 8782|  8.98k|  const __m128i mask5 = _mm_set1_epi8('[');
 8783|       |
 8784|  11.8k|  for (; i + 15 < view.size(); i += 16) {
  ------------------
  |  Branch (8784:10): [True: 10.7k, False: 1.17k]
  ------------------
 8785|  10.7k|    __m128i word = _mm_loadu_si128((const __m128i*)(view.data() + i));
 8786|  10.7k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8787|  10.7k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8788|  10.7k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 8789|  10.7k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8790|  10.7k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8791|  10.7k|    __m128i m = _mm_or_si128(
 8792|  10.7k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 8793|  10.7k|    int mask = _mm_movemask_epi8(m);
 8794|  10.7k|    if (mask != 0) {
  ------------------
  |  Branch (8794:9): [True: 7.80k, False: 2.90k]
  ------------------
 8795|  7.80k|      return i + trailing_zeroes(mask);
 8796|  7.80k|    }
 8797|  10.7k|  }
 8798|  1.17k|  if (i < view.size()) {
  ------------------
  |  Branch (8798:7): [True: 1.17k, False: 4]
  ------------------
 8799|  1.17k|    __m128i word =
 8800|  1.17k|        _mm_loadu_si128((const __m128i*)(view.data() + view.length() - 16));
 8801|  1.17k|    __m128i m1 = _mm_cmpeq_epi8(word, mask1);
 8802|  1.17k|    __m128i m2 = _mm_cmpeq_epi8(word, mask2);
 8803|  1.17k|    __m128i m3 = _mm_cmpeq_epi8(word, mask3);
 8804|  1.17k|    __m128i m4 = _mm_cmpeq_epi8(word, mask4);
 8805|  1.17k|    __m128i m5 = _mm_cmpeq_epi8(word, mask5);
 8806|  1.17k|    __m128i m = _mm_or_si128(
 8807|  1.17k|        _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
 8808|  1.17k|    int mask = _mm_movemask_epi8(m);
 8809|  1.17k|    if (mask != 0) {
  ------------------
  |  Branch (8809:9): [True: 1.15k, False: 24]
  ------------------
 8810|  1.15k|      return view.length() - 16 + trailing_zeroes(mask);
 8811|  1.15k|    }
 8812|  1.17k|  }
 8813|     28|  return size_t(view.length());
 8814|  1.17k|}
_ZN3ada7helpers15trailing_zeroesEj:
 8585|  8.96k|ada_really_inline int trailing_zeroes(uint32_t input_num) noexcept {
 8586|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
 8587|       |  unsigned long ret;
 8588|       |  // Search the mask data from least significant bit (LSB)
 8589|       |  // to the most significant bit (MSB) for a set bit (1).
 8590|       |  _BitScanForward(&ret, input_num);
 8591|       |  return (int)ret;
 8592|       |#else   // ADA_REGULAR_VISUAL_STUDIO
 8593|  8.96k|  return __builtin_ctzl(input_num);
 8594|  8.96k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 8595|  8.96k|}
_ZN3ada7unicode30is_forbidden_domain_code_pointEc:
 7014|  53.7k|    const char c) noexcept {
 7015|  53.7k|  return is_forbidden_domain_code_point_table[uint8_t(c)];
 7016|  53.7k|}
_ZZN3ada6parser14parse_url_implINS_14url_aggregatorELb1EEET_NSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEPKS3_ENKUlvE_clEv:
12556|  1.27k|  const auto enforce_max_input_length = [&]() {
12557|  1.27k|    if constexpr (store_values) {
12558|  1.27k|      if (url.is_valid) {
  ------------------
  |  Branch (12558:11): [True: 1.27k, False: 0]
  ------------------
12559|  1.27k|        if constexpr (result_type_is_ada_url_aggregator) {
12560|  1.27k|          if (url.buffer.size() > max_input_length) [[unlikely]] {
  ------------------
  |  Branch (12560:15): [True: 0, False: 1.27k]
  ------------------
12561|      0|            url.is_valid = false;
12562|      0|          }
12563|       |        } else {
12564|       |          if (url.get_href_size() > max_input_length) [[unlikely]] {
12565|       |            url.is_valid = false;
12566|       |          }
12567|       |        }
12568|  1.27k|      }
12569|  1.27k|    }
12570|  1.27k|  };
serializers.cc:_ZN3ada6parser12_GLOBAL__N_124port_decimal_digit_countEj:
10886|     87|ada_really_inline uint32_t port_decimal_digit_count(uint32_t port) noexcept {
10887|     87|  uint32_t digits = 1;
10888|    283|  while (port >= 10) {
  ------------------
  |  Branch (10888:10): [True: 196, False: 87]
  ------------------
10889|    196|    port /= 10;
10890|    196|    ++digits;
10891|    196|  }
10892|     87|  return digits;
10893|     87|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_121append_canonical_portERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEj:
10896|     75|                                             uint32_t port) {
10897|     75|  buffer += ':';
10898|     75|  char port_buf[5];
10899|     75|  auto [ptr, ec] = std::to_chars(port_buf, port_buf + 5, port);
10900|     75|  (void)ec;
10901|     75|  buffer.append(port_buf, static_cast<size_t>(ptr - port_buf));
10902|     75|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_116authority_has_atEPKhmm:
11044|  13.4k|                                        size_t n) noexcept {
11045|  13.4k|  const size_t rem = n - host_start;
11046|  13.4k|  if (rem == 0) {
  ------------------
  |  Branch (11046:7): [True: 0, False: 13.4k]
  ------------------
11047|      0|    return false;
11048|      0|  }
11049|       |#if ADA_NEON
11050|       |  if (rem >= 16) {
11051|       |    const uint8x16_t w = vld1q_u8(p + host_start);
11052|       |    const uint64_t at = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('@')));
11053|       |    if (at == 0) {
11054|       |      return false;
11055|       |    }
11056|       |    const uint64_t delim = neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('/'))) |
11057|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('?'))) |
11058|       |                           neon_nibble_bits(vceqq_u8(w, vdupq_n_u8('#')));
11059|       |    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
11060|       |  }
11061|       |#elif ADA_SSE2
11062|  13.4k|  if (rem >= 16) {
  ------------------
  |  Branch (11062:7): [True: 9.72k, False: 3.71k]
  ------------------
11063|  9.72k|    const __m128i w =
11064|  9.72k|        _mm_loadu_si128(reinterpret_cast<const __m128i*>(p + host_start));
11065|  9.72k|    const uint16_t at = static_cast<uint16_t>(
11066|  9.72k|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('@'))));
11067|  9.72k|    if (at == 0) {
  ------------------
  |  Branch (11067:9): [True: 9.60k, False: 120]
  ------------------
11068|  9.60k|      return false;
11069|  9.60k|    }
11070|    120|    const uint16_t delim = static_cast<uint16_t>(
11071|    120|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) |
11072|    120|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('?'))) |
11073|    120|        _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('#'))));
11074|    120|    return delim == 0 || std::countr_zero(at) < std::countr_zero(delim);
  ------------------
  |  Branch (11074:12): [True: 83, False: 37]
  |  Branch (11074:26): [True: 6, False: 31]
  ------------------
11075|  9.72k|  }
11076|  3.71k|#endif
11077|  3.71k|  const size_t lim = host_start + rem;
11078|  26.0k|  for (size_t i = host_start; i < lim; ++i) {
  ------------------
  |  Branch (11078:31): [True: 26.0k, False: 0]
  ------------------
11079|  26.0k|    const uint8_t c = p[i];
11080|  26.0k|    if (c == '@') {
  ------------------
  |  Branch (11080:9): [True: 97, False: 25.9k]
  ------------------
11081|     97|      return true;
11082|     97|    }
11083|  25.9k|    if (c == '/' || c == '?' || c == '#') {
  ------------------
  |  Branch (11083:9): [True: 3.35k, False: 22.6k]
  |  Branch (11083:21): [True: 136, False: 22.4k]
  |  Branch (11083:33): [True: 127, False: 22.3k]
  ------------------
11084|  3.61k|      return false;
11085|  3.61k|    }
11086|  25.9k|  }
11087|      0|  return false;
11088|  3.71k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_:
11095|  4.63k|                                     bool& has_x) noexcept {
11096|  4.63k|  has_upper = false;
11097|  4.63k|  has_x = false;
11098|  4.63k|  size_t i = start;
11099|  4.63k|#if ADA_PARSER_SSSE3
11100|  4.63k|  if (len - start >= 16) {
  ------------------
  |  Branch (11100:7): [True: 2.11k, False: 2.51k]
  ------------------
11101|  2.11k|    const __m128i lo_tbl = nibble_load(k_host_nibbles.low);
11102|  2.11k|    const __m128i hi_tbl = nibble_load(k_host_nibbles.high);
11103|  2.11k|    const __m128i x_splat = _mm_set1_epi8('x');
11104|  2.11k|    auto visit = [&](size_t at) noexcept -> bool {
11105|  2.11k|      const __m128i w =
11106|  2.11k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11107|  2.11k|      const int up = sse2_uppercase(w);
11108|  2.11k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11109|  2.11k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11110|  2.11k|      if (mask == 0) {
11111|  2.11k|        if (up != 0) {
11112|  2.11k|          has_upper = true;
11113|  2.11k|        }
11114|  2.11k|        if (xs != 0) {
11115|  2.11k|          has_x = true;
11116|  2.11k|        }
11117|  2.11k|        return false;
11118|  2.11k|      }
11119|  2.11k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11120|  2.11k|      const int valid = (1 << hit) - 1;
11121|  2.11k|      if ((up & valid) != 0) {
11122|  2.11k|        has_upper = true;
11123|  2.11k|      }
11124|  2.11k|      if ((xs & valid) != 0) {
11125|  2.11k|        has_x = true;
11126|  2.11k|      }
11127|  2.11k|      end = at + static_cast<size_t>(hit);
11128|  2.11k|      return true;
11129|  2.11k|    };
11130|  2.42k|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11130:12): [True: 1.29k, False: 1.13k]
  ------------------
11131|  1.29k|      if (visit(i) || visit(i + 16)) {
  ------------------
  |  Branch (11131:11): [True: 873, False: 417]
  |  Branch (11131:23): [True: 109, False: 308]
  ------------------
11132|    982|        return k_host_class[b[end]] == 1;
11133|    982|      }
11134|  1.29k|    }
11135|  1.34k|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11135:12): [True: 1.02k, False: 325]
  ------------------
11136|  1.02k|      if (visit(i)) {
  ------------------
  |  Branch (11136:11): [True: 806, False: 214]
  ------------------
11137|    806|        return k_host_class[b[end]] == 1;
11138|    806|      }
11139|  1.02k|    }
11140|       |    // Overlapping tail only after a full 16-byte step so the window cannot
11141|       |    // start before `start` (a prior '/' would otherwise look like a host stop).
11142|    325|    if (i > start && i < len) {
  ------------------
  |  Branch (11142:9): [True: 325, False: 0]
  |  Branch (11142:22): [True: 325, False: 0]
  ------------------
11143|    325|      if (visit(len - 16) && end >= i) {
  ------------------
  |  Branch (11143:11): [True: 325, False: 0]
  |  Branch (11143:30): [True: 325, False: 0]
  ------------------
11144|    325|        return k_host_class[b[end]] == 1;
11145|    325|      }
11146|      0|      end = len;
11147|      0|      return true;
11148|    325|    }
11149|    325|  }
11150|       |#elif ADA_SSE2
11151|       |  const __m128i x_splat = _mm_set1_epi8('x');
11152|       |  for (; i + 32 <= len; i += 32) {
11153|       |    for (size_t off = 0; off < 32; off += 16) {
11154|       |      const __m128i w =
11155|       |          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + off));
11156|       |      const int up = sse2_uppercase(w);
11157|       |      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11158|       |      const int mask = sse2_host_stop(w);
11159|       |      if (mask != 0) {
11160|       |        const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11161|       |        const int valid = (1 << hit) - 1;
11162|       |        if ((up & valid) != 0) {
11163|       |          has_upper = true;
11164|       |        }
11165|       |        if ((xs & valid) != 0) {
11166|       |          has_x = true;
11167|       |        }
11168|       |        end = i + off + static_cast<size_t>(hit);
11169|       |        return k_host_class[b[end]] == 1;
11170|       |      }
11171|       |      if (up != 0) {
11172|       |        has_upper = true;
11173|       |      }
11174|       |      if (xs != 0) {
11175|       |        has_x = true;
11176|       |      }
11177|       |    }
11178|       |  }
11179|       |  for (; i + 16 <= len; i += 16) {
11180|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11181|       |    const int up = sse2_uppercase(w);
11182|       |    const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11183|       |    const int mask = sse2_host_stop(w);
11184|       |    if (mask != 0) {
11185|       |      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11186|       |      const int valid = (1 << hit) - 1;
11187|       |      if ((up & valid) != 0) {
11188|       |        has_upper = true;
11189|       |      }
11190|       |      if ((xs & valid) != 0) {
11191|       |        has_x = true;
11192|       |      }
11193|       |      end = i + static_cast<size_t>(hit);
11194|       |      return k_host_class[b[end]] == 1;
11195|       |    }
11196|       |    if (up != 0) {
11197|       |      has_upper = true;
11198|       |    }
11199|       |    if (xs != 0) {
11200|       |      has_x = true;
11201|       |    }
11202|       |  }
11203|       |#elif ADA_NEON
11204|       |  if (len - start >= 16) {
11205|       |    const uint8x16_t lo_tbl = vld1q_u8(k_host_nibbles.low);
11206|       |    const uint8x16_t hi_tbl = vld1q_u8(k_host_nibbles.high);
11207|       |    const uint8x16_t x_splat = vdupq_n_u8('x');
11208|       |    auto visit = [&](size_t at) noexcept -> bool {
11209|       |      const uint8x16_t w = vld1q_u8(b + at);
11210|       |      const uint64_t up = neon_uppercase(w);
11211|       |      const uint64_t xs = neon_nibble_bits(vceqq_u8(w, x_splat));
11212|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11213|       |      if (bits == 0) {
11214|       |        if (up != 0) {
11215|       |          has_upper = true;
11216|       |        }
11217|       |        if (xs != 0) {
11218|       |          has_x = true;
11219|       |        }
11220|       |        return false;
11221|       |      }
11222|       |      const size_t hit = static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11223|       |      const uint64_t valid = (hit == 0) ? 0 : (uint64_t{1} << (hit * 4)) - 1;
11224|       |      if ((up & valid) != 0) {
11225|       |        has_upper = true;
11226|       |      }
11227|       |      if ((xs & valid) != 0) {
11228|       |        has_x = true;
11229|       |      }
11230|       |      end = at + hit;
11231|       |      return true;
11232|       |    };
11233|       |    for (; i + 32 <= len; i += 32) {
11234|       |      if (visit(i) || visit(i + 16)) {
11235|       |        return k_host_class[b[end]] == 1;
11236|       |      }
11237|       |    }
11238|       |    for (; i + 16 <= len; i += 16) {
11239|       |      if (visit(i)) {
11240|       |        return k_host_class[b[end]] == 1;
11241|       |      }
11242|       |    }
11243|       |    if (i > start && i < len) {
11244|       |      if (visit(len - 16) && end >= i) {
11245|       |        return k_host_class[b[end]] == 1;
11246|       |      }
11247|       |      end = len;
11248|       |      return true;
11249|       |    }
11250|       |  }
11251|       |#endif
11252|  5.51k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11252:10): [True: 5.51k, False: 0]
  ------------------
11253|  5.51k|    const uint8_t c = b[i];
11254|  5.51k|    const uint8_t cls = k_host_class[c];
11255|  5.51k|    if (cls == 1) {
  ------------------
  |  Branch (11255:9): [True: 839, False: 4.67k]
  ------------------
11256|    839|      end = i;
11257|    839|      return true;
11258|    839|    }
11259|  4.67k|    if (cls == 2) {
  ------------------
  |  Branch (11259:9): [True: 1.68k, False: 2.99k]
  ------------------
11260|  1.68k|      return false;
11261|  1.68k|    }
11262|  2.99k|    if (c >= 'A' && c <= 'Z') {
  ------------------
  |  Branch (11262:9): [True: 1.74k, False: 1.24k]
  |  Branch (11262:21): [True: 431, False: 1.31k]
  ------------------
11263|    431|      has_upper = true;
11264|  2.56k|    } else if (c == 'x') {
  ------------------
  |  Branch (11264:16): [True: 446, False: 2.11k]
  ------------------
11265|    446|      has_x = true;
11266|    446|    }
11267|  2.99k|  }
11268|      0|  end = len;
11269|      0|  return true;
11270|  2.51k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_111nibble_loadEPKh:
10925|  5.58k|ADA_PARSER_SIMD __m128i nibble_load(const uint8_t* t) noexcept {
10926|  5.58k|  return _mm_load_si128(reinterpret_cast<const __m128i*>(t));
10927|  5.58k|}
serializers.cc:_ZZN3ada6parser12_GLOBAL__N_115scan_plain_hostEPKhmmRmRbS5_ENK3$_0clEm:
11104|  3.05k|    auto visit = [&](size_t at) noexcept -> bool {
11105|  3.05k|      const __m128i w =
11106|  3.05k|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + at));
11107|  3.05k|      const int up = sse2_uppercase(w);
11108|  3.05k|      const int xs = _mm_movemask_epi8(_mm_cmpeq_epi8(w, x_splat));
11109|  3.05k|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11110|  3.05k|      if (mask == 0) {
  ------------------
  |  Branch (11110:11): [True: 939, False: 2.11k]
  ------------------
11111|    939|        if (up != 0) {
  ------------------
  |  Branch (11111:13): [True: 532, False: 407]
  ------------------
11112|    532|          has_upper = true;
11113|    532|        }
11114|    939|        if (xs != 0) {
  ------------------
  |  Branch (11114:13): [True: 543, False: 396]
  ------------------
11115|    543|          has_x = true;
11116|    543|        }
11117|    939|        return false;
11118|    939|      }
11119|  2.11k|      const int hit = trailing_zeroes32(static_cast<uint32_t>(mask));
11120|  2.11k|      const int valid = (1 << hit) - 1;
11121|  2.11k|      if ((up & valid) != 0) {
  ------------------
  |  Branch (11121:11): [True: 481, False: 1.63k]
  ------------------
11122|    481|        has_upper = true;
11123|    481|      }
11124|  2.11k|      if ((xs & valid) != 0) {
  ------------------
  |  Branch (11124:11): [True: 520, False: 1.59k]
  ------------------
11125|    520|        has_x = true;
11126|    520|      }
11127|  2.11k|      end = at + static_cast<size_t>(hit);
11128|  2.11k|      return true;
11129|  3.05k|    };
serializers.cc:_ZN3ada6parser12_GLOBAL__N_114sse2_uppercaseEDv2_x:
11012|  3.05k|ada_really_inline int sse2_uppercase(__m128i w) noexcept {
11013|  3.05k|  return _mm_movemask_epi8(_mm_and_si128(
11014|  3.05k|      _mm_cmpgt_epi8(w, _mm_set1_epi8(static_cast<char>('A' - 1))),
11015|  3.05k|      _mm_cmplt_epi8(w, _mm_set1_epi8(static_cast<char>('Z' + 1)))));
11016|  3.05k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_117ssse3_nibble_maskEDv2_xS2_S2_:
10932|  4.37k|                                      __m128i hi_tbl) noexcept {
10933|  4.37k|  const __m128i nibble = _mm_set1_epi8(0x0F);
10934|  4.37k|  const __m128i lo = _mm_and_si128(w, nibble);
10935|  4.37k|  const __m128i hi = _mm_and_si128(_mm_srli_epi16(w, 4), nibble);
10936|  4.37k|  const __m128i hit =
10937|  4.37k|      _mm_and_si128(_mm_shuffle_epi8(lo_tbl, lo), _mm_shuffle_epi8(hi_tbl, hi));
10938|  4.37k|  return _mm_movemask_epi8(_mm_cmpeq_epi8(hit, _mm_setzero_si128())) ^ 0xFFFF;
10939|  4.37k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_117trailing_zeroes32Ej:
10904|  2.64k|ada_really_inline int trailing_zeroes32(uint32_t input_num) noexcept {
10905|       |#ifdef ADA_REGULAR_VISUAL_STUDIO
10906|       |  unsigned long ret;
10907|       |  _BitScanForward(&ret, input_num);
10908|       |  return static_cast<int>(ret);
10909|       |#else
10910|  2.64k|  return __builtin_ctz(input_num);
10911|  2.64k|#endif
10912|  2.64k|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_113scan_path_runEPKhRmmRb:
11330|    963|                                   bool& maybe_dot_segment) noexcept {
11331|    963|  const size_t run_start = i;
11332|    963|#if ADA_PARSER_SSSE3
11333|    963|  if (i + 16 <= len) {
  ------------------
  |  Branch (11333:7): [True: 518, False: 445]
  ------------------
11334|    518|    const __m128i lo_tbl = nibble_load(k_path_nibbles.low);
11335|    518|    const __m128i hi_tbl = nibble_load(k_path_nibbles.high);
11336|    695|    for (; i + 32 <= len; i += 32) {
  ------------------
  |  Branch (11336:12): [True: 391, False: 304]
  ------------------
11337|    391|      const __m128i w0 =
11338|    391|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11339|    391|      const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);
11340|    391|      if (m0 != 0) {
  ------------------
  |  Branch (11340:11): [True: 158, False: 233]
  ------------------
11341|    158|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m0));
11342|    158|        note_dots_in_window(b, i, run_start, w0, (1 << hit_bit) - 1,
11343|    158|                            maybe_dot_segment);
11344|    158|        i += static_cast<size_t>(hit_bit);
11345|    158|        return;
11346|    158|      }
11347|    233|      note_dots_in_window(b, i, run_start, w0, 0xFFFF, maybe_dot_segment);
11348|    233|      const __m128i w1 =
11349|    233|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));
11350|    233|      const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);
11351|    233|      if (m1 != 0) {
  ------------------
  |  Branch (11351:11): [True: 56, False: 177]
  ------------------
11352|     56|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(m1));
11353|     56|        note_dots_in_window(b, i + 16, run_start, w1, (1 << hit_bit) - 1,
11354|     56|                            maybe_dot_segment);
11355|     56|        i += 16 + static_cast<size_t>(hit_bit);
11356|     56|        return;
11357|     56|      }
11358|    177|      note_dots_in_window(b, i + 16, run_start, w1, 0xFFFF, maybe_dot_segment);
11359|    177|    }
11360|    435|    for (; i + 16 <= len; i += 16) {
  ------------------
  |  Branch (11360:12): [True: 249, False: 186]
  ------------------
11361|    249|      const __m128i w =
11362|    249|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11363|    249|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11364|    249|      if (mask != 0) {
  ------------------
  |  Branch (11364:11): [True: 118, False: 131]
  ------------------
11365|    118|        const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11366|    118|        note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11367|    118|                            maybe_dot_segment);
11368|    118|        i += static_cast<size_t>(hit_bit);
11369|    118|        return;
11370|    118|      }
11371|    131|      note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11372|    131|    }
11373|    186|    if (i > run_start && i < len) {
  ------------------
  |  Branch (11373:9): [True: 186, False: 0]
  |  Branch (11373:26): [True: 139, False: 47]
  ------------------
11374|    139|      const __m128i w =
11375|    139|          _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16));
11376|    139|      const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);
11377|    139|      if (mask != 0) {
  ------------------
  |  Branch (11377:11): [True: 66, False: 73]
  ------------------
11378|     66|        const size_t hit =
11379|     66|            len - 16 +
11380|     66|            static_cast<size_t>(trailing_zeroes32(static_cast<uint32_t>(mask)));
11381|     66|        if (hit >= i) {
  ------------------
  |  Branch (11381:13): [True: 66, False: 0]
  ------------------
11382|    240|          for (size_t j = i; j < hit; ++j) {
  ------------------
  |  Branch (11382:30): [True: 174, False: 66]
  ------------------
11383|    174|            if (b[j] == '.') {
  ------------------
  |  Branch (11383:17): [True: 72, False: 102]
  ------------------
11384|     72|              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11385|     72|            }
11386|    174|          }
11387|     66|          i = hit;
11388|     66|          return;
11389|     66|        }
11390|     66|      }
11391|    477|      for (size_t j = i; j < len; ++j) {
  ------------------
  |  Branch (11391:26): [True: 404, False: 73]
  ------------------
11392|    404|        if (b[j] == '.') {
  ------------------
  |  Branch (11392:13): [True: 127, False: 277]
  ------------------
11393|    127|          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11394|    127|        }
11395|    404|      }
11396|     73|      i = len;
11397|     73|      return;
11398|    139|    }
11399|    186|  }
11400|       |#elif ADA_SSE2
11401|       |  for (; i + 16 <= len; i += 16) {
11402|       |    const __m128i w = _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));
11403|       |    const int mask = sse2_path_stop(w);
11404|       |    if (mask != 0) {
11405|       |      const int hit_bit = trailing_zeroes32(static_cast<uint32_t>(mask));
11406|       |      note_dots_in_window(b, i, run_start, w, (1 << hit_bit) - 1,
11407|       |                          maybe_dot_segment);
11408|       |      i += static_cast<size_t>(hit_bit);
11409|       |      return;
11410|       |    }
11411|       |    note_dots_in_window(b, i, run_start, w, 0xFFFF, maybe_dot_segment);
11412|       |  }
11413|       |#elif ADA_NEON
11414|       |  if (i + 16 <= len) {
11415|       |    const uint8x16_t lo_tbl = vld1q_u8(k_path_nibbles.low);
11416|       |    const uint8x16_t hi_tbl = vld1q_u8(k_path_nibbles.high);
11417|       |    for (; i + 32 <= len; i += 32) {
11418|       |      const uint8x16_t w0 = vld1q_u8(b + i);
11419|       |      const uint64_t bits0 = neon_table_stop(w0, lo_tbl, hi_tbl);
11420|       |      if (bits0 != 0) {
11421|       |        const size_t hit_off =
11422|       |            static_cast<size_t>(trailing_zeroes64(bits0)) >> 2;
11423|       |        const uint64_t valid =
11424|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11425|       |        note_dots_in_window_neon(b, i, run_start, w0, valid, maybe_dot_segment);
11426|       |        i += hit_off;
11427|       |        return;
11428|       |      }
11429|       |      note_dots_in_window_neon(b, i, run_start, w0, ~uint64_t{0},
11430|       |                               maybe_dot_segment);
11431|       |      const uint8x16_t w1 = vld1q_u8(b + i + 16);
11432|       |      const uint64_t bits1 = neon_table_stop(w1, lo_tbl, hi_tbl);
11433|       |      if (bits1 != 0) {
11434|       |        const size_t hit_off =
11435|       |            static_cast<size_t>(trailing_zeroes64(bits1)) >> 2;
11436|       |        const uint64_t valid =
11437|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11438|       |        note_dots_in_window_neon(b, i + 16, run_start, w1, valid,
11439|       |                                 maybe_dot_segment);
11440|       |        i += 16 + hit_off;
11441|       |        return;
11442|       |      }
11443|       |      note_dots_in_window_neon(b, i + 16, run_start, w1, ~uint64_t{0},
11444|       |                               maybe_dot_segment);
11445|       |    }
11446|       |    for (; i + 16 <= len; i += 16) {
11447|       |      const uint8x16_t w = vld1q_u8(b + i);
11448|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11449|       |      if (bits != 0) {
11450|       |        const size_t hit_off =
11451|       |            static_cast<size_t>(trailing_zeroes64(bits)) >> 2;
11452|       |        const uint64_t valid =
11453|       |            (hit_off == 0) ? 0 : (uint64_t{1} << (hit_off * 4)) - 1;
11454|       |        note_dots_in_window_neon(b, i, run_start, w, valid, maybe_dot_segment);
11455|       |        i += hit_off;
11456|       |        return;
11457|       |      }
11458|       |      note_dots_in_window_neon(b, i, run_start, w, ~uint64_t{0},
11459|       |                               maybe_dot_segment);
11460|       |    }
11461|       |    if (i > run_start && i < len) {
11462|       |      const uint8x16_t w = vld1q_u8(b + len - 16);
11463|       |      const uint64_t bits = neon_table_stop(w, lo_tbl, hi_tbl);
11464|       |      if (bits != 0) {
11465|       |        const size_t hit =
11466|       |            len - 16 + (static_cast<size_t>(trailing_zeroes64(bits)) >> 2);
11467|       |        if (hit >= i) {
11468|       |          for (size_t j = i; j < hit; ++j) {
11469|       |            if (b[j] == '.') {
11470|       |              note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11471|       |            }
11472|       |          }
11473|       |          i = hit;
11474|       |          return;
11475|       |        }
11476|       |      }
11477|       |      for (size_t j = i; j < len; ++j) {
11478|       |        if (b[j] == '.') {
11479|       |          note_possible_dot_segment(b, j, run_start, maybe_dot_segment);
11480|       |        }
11481|       |      }
11482|       |      i = len;
11483|       |      return;
11484|       |    }
11485|       |  }
11486|       |#endif
11487|  1.59k|  for (; i < len; ++i) {
  ------------------
  |  Branch (11487:10): [True: 1.41k, False: 178]
  ------------------
11488|  1.41k|    const uint8_t c = b[i];
11489|  1.41k|    const uint8_t cls = k_path[c];
11490|  1.41k|    if (cls != 0) {
  ------------------
  |  Branch (11490:9): [True: 314, False: 1.10k]
  ------------------
11491|    314|      return;
11492|    314|    }
11493|  1.10k|    if (c == '.') {
  ------------------
  |  Branch (11493:9): [True: 381, False: 721]
  ------------------
11494|    381|      note_possible_dot_segment(b, i, run_start, maybe_dot_segment);
11495|    381|    }
11496|  1.10k|  }
11497|    492|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_119note_dots_in_windowEPKhmmDv2_xiRb:
11287|    873|                                           bool& maybe_dot_segment) noexcept {
11288|    873|  if (maybe_dot_segment || valid_mask == 0) {
  ------------------
  |  Branch (11288:7): [True: 149, False: 724]
  |  Branch (11288:28): [True: 132, False: 592]
  ------------------
11289|    281|    return;
11290|    281|  }
11291|    592|  const int dots =
11292|    592|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('.'))) & valid_mask;
11293|    592|  if (dots == 0) {
  ------------------
  |  Branch (11293:7): [True: 181, False: 411]
  ------------------
11294|    181|    return;
11295|    181|  }
11296|    411|  const int slashes =
11297|    411|      _mm_movemask_epi8(_mm_cmpeq_epi8(w, _mm_set1_epi8('/'))) & valid_mask;
11298|    411|  if (((dots & 1) != 0 && (i == run_start || b[i - 1] == '/')) ||
  ------------------
  |  Branch (11298:8): [True: 180, False: 231]
  |  Branch (11298:28): [True: 108, False: 72]
  |  Branch (11298:46): [True: 11, False: 61]
  ------------------
11299|    292|      (dots & (slashes << 1)) != 0) {
  ------------------
  |  Branch (11299:7): [True: 117, False: 175]
  ------------------
11300|    236|    maybe_dot_segment = true;
11301|    236|  }
11302|    411|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_125note_possible_dot_segmentEPKhmmRb:
11274|    580|    bool& maybe_dot_segment) noexcept {
11275|    580|  if (pos == run_start || b[pos - 1] == '/') {
  ------------------
  |  Branch (11275:7): [True: 109, False: 471]
  |  Branch (11275:27): [True: 231, False: 240]
  ------------------
11276|    340|    maybe_dot_segment = true;
11277|    340|  }
11278|    580|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_114scan_query_runEPKhRmm:
11640|    191|                                    size_t len) noexcept {
11641|    191|  ADA_SCAN_STOP_RUN(k_query_nibbles, k_query, sse2_query_stop);
  ------------------
  |  |11503|    191|  do {                                                                       \
  |  |11504|    191|    const size_t scan_start = i;                                             \
  |  |11505|    191|    if (i + 16 <= len) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11505:9): [True: 67, False: 124]
  |  |  ------------------
  |  |11506|     67|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11507|     67|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11508|     90|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11508:14): [True: 55, False: 35]
  |  |  ------------------
  |  |11509|     55|        const __m128i w0 =                                                   \
  |  |11510|     55|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11511|     55|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11512|     55|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11512:13): [True: 20, False: 35]
  |  |  ------------------
  |  |11513|     20|          i += static_cast<size_t>(                                          \
  |  |11514|     20|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11515|     20|          return;                                                            \
  |  |11516|     20|        }                                                                    \
  |  |11517|     55|        const __m128i w1 =                                                   \
  |  |11518|     35|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11519|     35|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11520|     35|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11520:13): [True: 12, False: 23]
  |  |  ------------------
  |  |11521|     12|          i += 16 + static_cast<size_t>(                                     \
  |  |11522|     12|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11523|     12|          return;                                                            \
  |  |11524|     12|        }                                                                    \
  |  |11525|     35|      }                                                                      \
  |  |11526|     67|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11526:14): [True: 32, False: 21]
  |  |  ------------------
  |  |11527|     32|        const __m128i w =                                                    \
  |  |11528|     32|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11529|     32|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11530|     32|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11530:13): [True: 14, False: 18]
  |  |  ------------------
  |  |11531|     14|          i += static_cast<size_t>(                                          \
  |  |11532|     14|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11533|     14|          return;                                                            \
  |  |11534|     14|        }                                                                    \
  |  |11535|     32|      }                                                                      \
  |  |11536|     35|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11536:11): [True: 21, False: 0]
  |  |  |  Branch (11536:29): [True: 17, False: 4]
  |  |  ------------------
  |  |11537|     17|        const __m128i w =                                                    \
  |  |11538|     17|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11539|     17|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11540|     17|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11540:13): [True: 11, False: 6]
  |  |  ------------------
  |  |11541|     11|          const size_t hit = len - 16 +                                      \
  |  |11542|     11|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11543|     11|                                 static_cast<uint32_t>(mask)));              \
  |  |11544|     11|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11544:15): [True: 11, False: 0]
  |  |  ------------------
  |  |11545|     11|            i = hit;                                                         \
  |  |11546|     11|            return;                                                          \
  |  |11547|     11|          }                                                                  \
  |  |11548|     11|        }                                                                    \
  |  |11549|     17|        i = len;                                                             \
  |  |11550|      6|        return;                                                              \
  |  |11551|     17|      }                                                                      \
  |  |11552|     21|    }                                                                        \
  |  |11553|    439|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11553:12): [True: 363, False: 76]
  |  |  ------------------
  |  |11554|    363|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11554:11): [True: 52, False: 311]
  |  |  ------------------
  |  |11555|     52|        return;                                                              \
  |  |11556|     52|      }                                                                      \
  |  |11557|    363|    }                                                                        \
  |  |11558|    128|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11558:12): [Folded, False: 76]
  |  |  ------------------
  ------------------
11642|    191|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_113scan_hash_runEPKhRmm:
11645|    210|                                   size_t len) noexcept {
11646|    210|  ADA_SCAN_STOP_RUN(k_hash_nibbles, k_hash, sse2_hash_stop);
  ------------------
  |  |11503|    210|  do {                                                                       \
  |  |11504|    210|    const size_t scan_start = i;                                             \
  |  |11505|    210|    if (i + 16 <= len) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11505:9): [True: 92, False: 118]
  |  |  ------------------
  |  |11506|     92|      const __m128i lo_tbl = nibble_load((nibbles).low);                     \
  |  |11507|     92|      const __m128i hi_tbl = nibble_load((nibbles).high);                    \
  |  |11508|    111|      for (; i + 32 <= len; i += 32) {                                       \
  |  |  ------------------
  |  |  |  Branch (11508:14): [True: 63, False: 48]
  |  |  ------------------
  |  |11509|     63|        const __m128i w0 =                                                   \
  |  |11510|     63|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11511|     63|        const int m0 = ssse3_nibble_mask(w0, lo_tbl, hi_tbl);                \
  |  |11512|     63|        if (m0 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11512:13): [True: 26, False: 37]
  |  |  ------------------
  |  |11513|     26|          i += static_cast<size_t>(                                          \
  |  |11514|     26|              trailing_zeroes32(static_cast<uint32_t>(m0)));                 \
  |  |11515|     26|          return;                                                            \
  |  |11516|     26|        }                                                                    \
  |  |11517|     63|        const __m128i w1 =                                                   \
  |  |11518|     37|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i + 16));   \
  |  |11519|     37|        const int m1 = ssse3_nibble_mask(w1, lo_tbl, hi_tbl);                \
  |  |11520|     37|        if (m1 != 0) {                                                       \
  |  |  ------------------
  |  |  |  Branch (11520:13): [True: 18, False: 19]
  |  |  ------------------
  |  |11521|     18|          i += 16 + static_cast<size_t>(                                     \
  |  |11522|     18|                        trailing_zeroes32(static_cast<uint32_t>(m1)));       \
  |  |11523|     18|          return;                                                            \
  |  |11524|     18|        }                                                                    \
  |  |11525|     37|      }                                                                      \
  |  |11526|     92|      for (; i + 16 <= len; i += 16) {                                       \
  |  |  ------------------
  |  |  |  Branch (11526:14): [True: 39, False: 39]
  |  |  ------------------
  |  |11527|     39|        const __m128i w =                                                    \
  |  |11528|     39|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + i));        \
  |  |11529|     39|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11530|     39|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11530:13): [True: 9, False: 30]
  |  |  ------------------
  |  |11531|      9|          i += static_cast<size_t>(                                          \
  |  |11532|      9|              trailing_zeroes32(static_cast<uint32_t>(mask)));               \
  |  |11533|      9|          return;                                                            \
  |  |11534|      9|        }                                                                    \
  |  |11535|     39|      }                                                                      \
  |  |11536|     48|      if (i > scan_start && i < len) {                                       \
  |  |  ------------------
  |  |  |  Branch (11536:11): [True: 39, False: 0]
  |  |  |  Branch (11536:29): [True: 35, False: 4]
  |  |  ------------------
  |  |11537|     35|        const __m128i w =                                                    \
  |  |11538|     35|            _mm_loadu_si128(reinterpret_cast<const __m128i*>(b + len - 16)); \
  |  |11539|     35|        const int mask = ssse3_nibble_mask(w, lo_tbl, hi_tbl);               \
  |  |11540|     35|        if (mask != 0) {                                                     \
  |  |  ------------------
  |  |  |  Branch (11540:13): [True: 19, False: 16]
  |  |  ------------------
  |  |11541|     19|          const size_t hit = len - 16 +                                      \
  |  |11542|     19|                             static_cast<size_t>(trailing_zeroes32(          \
  |  |11543|     19|                                 static_cast<uint32_t>(mask)));              \
  |  |11544|     19|          if (hit >= i) {                                                    \
  |  |  ------------------
  |  |  |  Branch (11544:15): [True: 19, False: 0]
  |  |  ------------------
  |  |11545|     19|            i = hit;                                                         \
  |  |11546|     19|            return;                                                          \
  |  |11547|     19|          }                                                                  \
  |  |11548|     19|        }                                                                    \
  |  |11549|     35|        i = len;                                                             \
  |  |11550|     16|        return;                                                              \
  |  |11551|     35|      }                                                                      \
  |  |11552|     39|    }                                                                        \
  |  |11553|    524|    for (; i < len; ++i) {                                                   \
  |  |  ------------------
  |  |  |  Branch (11553:12): [True: 422, False: 102]
  |  |  ------------------
  |  |11554|    422|      if ((cls)[b[i]] != 0) {                                                \
  |  |  ------------------
  |  |  |  Branch (11554:11): [True: 20, False: 402]
  |  |  ------------------
  |  |11555|     20|        return;                                                              \
  |  |11556|     20|      }                                                                      \
  |  |11557|    422|    }                                                                        \
  |  |11558|    122|  } while (0)
  |  |  ------------------
  |  |  |  Branch (11558:12): [Folded, False: 102]
  |  |  ------------------
  ------------------
11647|    210|}
serializers.cc:_ZN3ada6parser12_GLOBAL__N_120path_has_dot_segmentENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
11651|    269|bool path_has_dot_segment(std::string_view path) noexcept {
11652|    269|  if (path.empty()) {
  ------------------
  |  Branch (11652:7): [True: 0, False: 269]
  ------------------
11653|      0|    return false;
11654|      0|  }
11655|       |  // "." / ".." at the start, with or without a leading '/'.
11656|    269|  const size_t i = (path[0] == '/') ? 1 : 0;
  ------------------
  |  Branch (11656:20): [True: 269, False: 0]
  ------------------
11657|    269|  if (i < path.size() && path[i] == '.') {
  ------------------
  |  Branch (11657:7): [True: 269, False: 0]
  |  Branch (11657:26): [True: 125, False: 144]
  ------------------
11658|    125|    const size_t after = i + 1;
11659|    125|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (11659:9): [True: 1, False: 124]
  |  Branch (11659:33): [True: 25, False: 99]
  ------------------
11660|     99|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (11660:10): [True: 99, False: 0]
  |  Branch (11660:33): [True: 46, False: 53]
  ------------------
11661|     46|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (11661:11): [True: 2, False: 44]
  |  Branch (11661:39): [True: 15, False: 29]
  ------------------
11662|     43|      return true;
11663|     43|    }
11664|    125|  }
11665|    226|  static constexpr std::string_view slash_dot{"/.", 2};
11666|    226|  size_t p = i;
11667|    409|  while ((p = path.find(slash_dot, p)) != std::string_view::npos) {
  ------------------
  |  Branch (11667:10): [True: 285, False: 124]
  ------------------
11668|    285|    const size_t after = p + 2;
11669|    285|    if (after == path.size() || path[after] == '/' ||
  ------------------
  |  Branch (11669:9): [True: 2, False: 283]
  |  Branch (11669:33): [True: 28, False: 255]
  ------------------
11670|    255|        (after < path.size() && path[after] == '.' &&
  ------------------
  |  Branch (11670:10): [True: 255, False: 0]
  |  Branch (11670:33): [True: 130, False: 125]
  ------------------
11671|    130|         (after + 1 == path.size() || path[after + 1] == '/'))) {
  ------------------
  |  Branch (11671:11): [True: 16, False: 114]
  |  Branch (11671:39): [True: 56, False: 58]
  ------------------
11672|    102|      return true;
11673|    102|    }
11674|    183|    p = after;
11675|    183|  }
11676|    124|  return false;
11677|    226|}
serializers.cc:_ZN12_GLOBAL__N_132apply_shifted_non_scheme_offsetsERN3ada14url_componentsEj:
13648|  12.2k|    ada::url_components& components, uint32_t new_difference) {
13649|  12.2k|  components.username_end += new_difference;
13650|  12.2k|  components.host_start += new_difference;
13651|  12.2k|  components.host_end += new_difference;
13652|  12.2k|  components.pathname_start += new_difference;
13653|  12.2k|  if (components.search_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13653:7): [True: 0, False: 12.2k]
  ------------------
13654|      0|    components.search_start += new_difference;
13655|      0|  }
13656|  12.2k|  if (components.hash_start != ada::url_components::omitted) {
  ------------------
  |  Branch (13656:7): [True: 0, False: 12.2k]
  ------------------
13657|      0|    components.hash_start += new_difference;
13658|      0|  }
13659|  12.2k|}
_ZN3ada14url_aggregator10parse_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14018|    878|ada_really_inline void url_aggregator::parse_path(std::string_view input) {
14019|    878|  ada_log("url_aggregator::parse_path ", input);
14020|    878|  ADA_ASSERT_TRUE(validate());
14021|    878|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14022|    878|  std::string tmp_buffer;
14023|    878|  std::string_view internal_input;
14024|    878|  if (unicode::has_tabs_or_newline(input)) {
  ------------------
  |  Branch (14024:7): [True: 0, False: 878]
  ------------------
14025|      0|    tmp_buffer = input;
14026|       |    // Optimization opportunity: Instead of copying and then pruning, we could
14027|       |    // just directly build the string from user_input.
14028|      0|    helpers::remove_ascii_tab_or_newline(tmp_buffer);
14029|      0|    internal_input = tmp_buffer;
14030|    878|  } else {
14031|    878|    internal_input = input;
14032|    878|  }
14033|       |
14034|       |  // If url is special, then:
14035|    878|  if (is_special()) {
  ------------------
  |  Branch (14035:7): [True: 878, False: 0]
  ------------------
14036|    878|    if (internal_input.empty()) {
  ------------------
  |  Branch (14036:9): [True: 137, False: 741]
  ------------------
14037|    137|      update_base_pathname("/");
14038|    741|    } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) {
  ------------------
  |  Branch (14038:16): [True: 741, False: 0]
  |  Branch (14038:46): [True: 0, False: 0]
  ------------------
14039|    741|      consume_prepared_path(internal_input.substr(1));
14040|    741|    } else {
14041|      0|      consume_prepared_path(internal_input);
14042|      0|    }
14043|    878|  } else if (!internal_input.empty()) {
  ------------------
  |  Branch (14043:14): [True: 0, False: 0]
  ------------------
14044|      0|    if (internal_input[0] == '/') {
  ------------------
  |  Branch (14044:9): [True: 0, False: 0]
  ------------------
14045|      0|      consume_prepared_path(internal_input.substr(1));
14046|      0|    } else {
14047|      0|      consume_prepared_path(internal_input);
14048|      0|    }
14049|      0|  } else {
14050|       |    // Non-special URLs with an empty host can have their paths erased
14051|       |    // Path-only URLs cannot have their paths erased
14052|      0|    if (components.host_start == components.host_end && !has_authority()) {
  ------------------
  |  Branch (14052:9): [True: 0, False: 0]
  |  Branch (14052:57): [True: 0, False: 0]
  ------------------
14053|      0|      update_base_pathname("/");
14054|      0|    }
14055|      0|  }
14056|    878|  ADA_ASSERT_TRUE(validate());
14057|    878|}
_ZN3ada14url_aggregator10parse_hostENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
14137|  12.2k|ada_really_inline bool url_aggregator::parse_host(std::string_view input) {
14138|  12.2k|  ada_log("url_aggregator:parse_host \"", input, "\" [", input.size(),
14139|  12.2k|          " bytes]");
14140|  12.2k|  ADA_ASSERT_TRUE(validate());
14141|  12.2k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
14142|  12.2k|  if (input.empty()) {
  ------------------
  |  Branch (14142:7): [True: 1, False: 12.2k]
  ------------------
14143|      1|    return is_valid = false;
14144|      1|  }  // technically unnecessary.
14145|       |  // If input starts with U+005B ([), then:
14146|  12.2k|  if (input[0] == '[') {
  ------------------
  |  Branch (14146:7): [True: 7.31k, False: 4.93k]
  ------------------
14147|       |    // If input does not end with U+005D (]), validation error, return failure.
14148|  7.31k|    if (input.back() != ']') {
  ------------------
  |  Branch (14148:9): [True: 63, False: 7.25k]
  ------------------
14149|     63|      return is_valid = false;
14150|     63|    }
14151|  7.25k|    ada_log("parse_host ipv6");
14152|       |
14153|       |    // Return the result of IPv6 parsing input with its leading U+005B ([) and
14154|       |    // trailing U+005D (]) removed.
14155|  7.25k|    input.remove_prefix(1);
14156|  7.25k|    input.remove_suffix(1);
14157|  7.25k|    return parse_ipv6(input);
14158|  7.31k|  }
14159|       |
14160|       |  // If isNotSpecial is true, then return the result of opaque-host parsing
14161|       |  // input.
14162|  4.93k|  if (!is_special()) {
  ------------------
  |  Branch (14162:7): [True: 0, False: 4.93k]
  ------------------
14163|      0|    return parse_opaque_host(input);
14164|      0|  }
14165|       |  // Let domain be the result of running UTF-8 decode without BOM on the
14166|       |  // percent-decoding of input. Let asciiDomain be the result of running domain
14167|       |  // to ASCII with domain and false. The most common case is an ASCII input, in
14168|       |  // which case we do not need to call the expensive 'to_ascii' if a few
14169|       |  // conditions are met: no '%' and no 'xn-' subsequence.
14170|       |
14171|       |  // Often, the input does not contain any forbidden code points, and no upper
14172|       |  // case ASCII letter, then we can just copy it to the buffer. We want to
14173|       |  // optimize for such a common case.
14174|       |
14175|       |  // Fast path: try to parse as pure decimal IPv4 first.
14176|  4.93k|  const uint64_t fast_result = checkers::try_parse_ipv4_fast(input);
14177|  4.93k|  if (fast_result < checkers::ipv4_fast_fail) {
  ------------------
  |  Branch (14177:7): [True: 330, False: 4.60k]
  ------------------
14178|    330|    if (!input.empty() && input.back() == '.') {
  ------------------
  |  Branch (14178:9): [True: 330, False: 0]
  |  Branch (14178:27): [True: 3, False: 327]
  ------------------
14179|      3|      update_base_hostname(input.substr(0, input.size() - 1));
14180|    327|    } else {
14181|    327|      update_base_hostname(input);
14182|    327|    }
14183|    330|    host_type = IPV4;
14184|    330|    is_valid = true;
14185|    330|    ada_log("parse_host fast path decimal ipv4");
14186|    330|    ADA_ASSERT_TRUE(validate());
14187|    330|    return true;
14188|    330|  }
14189|  4.60k|  uint8_t is_forbidden_or_upper =
14190|  4.60k|      unicode::contains_forbidden_domain_code_point_or_upper(input.data(),
14191|  4.60k|                                                             input.size());
14192|  4.60k|  static constexpr std::string_view xn_dash{"xn-", 3};
14193|  4.60k|  if ((is_forbidden_or_upper & 1) == 0) {
  ------------------
  |  Branch (14193:7): [True: 1.62k, False: 2.98k]
  ------------------
14194|  1.62k|    if ((is_forbidden_or_upper & 2) != 0) {
  ------------------
  |  Branch (14194:9): [True: 359, False: 1.26k]
  ------------------
14195|    359|      std::string lowered(input);
14196|    359|      unicode::to_lower_ascii(lowered.data(), lowered.size());
14197|    359|      if (lowered.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14197:11): [True: 269, False: 90]
  ------------------
14198|    332|          lowered.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14198:11): [True: 63, False: 27]
  ------------------
14199|    332|        update_base_hostname(lowered);
14200|    332|        if (checkers::is_ipv4(lowered)) {
  ------------------
  |  Branch (14200:13): [True: 182, False: 150]
  ------------------
14201|    182|          ada_log("parse_host fast path ipv4");
14202|    182|          return parse_ipv4(lowered, true);
14203|    182|        }
14204|    150|        ada_log("parse_host fast path ", get_hostname());
14205|    150|        is_valid = true;
14206|    150|        return true;
14207|    332|      }
14208|  1.26k|    } else if (input.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14208:16): [True: 1.18k, False: 83]
  ------------------
14209|  1.23k|               input.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14209:16): [True: 55, False: 28]
  ------------------
14210|  1.23k|      update_base_hostname(input);
14211|  1.23k|      if (checkers::is_ipv4(input)) {
  ------------------
  |  Branch (14211:11): [True: 1.01k, False: 222]
  ------------------
14212|  1.01k|        ada_log("parse_host fast path ipv4");
14213|  1.01k|        return parse_ipv4(input, true);
14214|  1.01k|      }
14215|    222|      ada_log("parse_host fast path ", get_hostname());
14216|    222|      is_valid = true;
14217|    222|      return true;
14218|  1.23k|    }
14219|  2.98k|  } else if (const size_t first_percent = input.find('%');
14220|  2.98k|             first_percent != std::string_view::npos) {
  ------------------
  |  Branch (14220:14): [True: 316, False: 2.66k]
  ------------------
14221|    316|    std::string decoded = unicode::percent_decode(input, first_percent);
14222|    316|    const uint8_t decoded_flags =
14223|    316|        unicode::contains_forbidden_domain_code_point_or_upper(decoded.data(),
14224|    316|                                                               decoded.size());
14225|    316|    if ((decoded_flags & 1) == 0) {
  ------------------
  |  Branch (14225:9): [True: 215, False: 101]
  ------------------
14226|    215|      if ((decoded_flags & 2) != 0) {
  ------------------
  |  Branch (14226:11): [True: 85, False: 130]
  ------------------
14227|     85|        unicode::to_lower_ascii(decoded.data(), decoded.size());
14228|     85|      }
14229|    215|      if (decoded.find('-') == std::string_view::npos ||
  ------------------
  |  Branch (14229:11): [True: 185, False: 30]
  ------------------
14230|    196|          decoded.find(xn_dash) == std::string_view::npos) {
  ------------------
  |  Branch (14230:11): [True: 11, False: 19]
  ------------------
14231|    196|        update_base_hostname(decoded);
14232|    196|        if (checkers::is_ipv4(decoded)) {
  ------------------
  |  Branch (14232:13): [True: 97, False: 99]
  ------------------
14233|     97|          return parse_ipv4(decoded, true);
14234|     97|        }
14235|     99|        is_valid = true;
14236|     99|        return true;
14237|    196|      }
14238|    215|    }
14239|    316|  }
14240|       |  // We have encountered at least one forbidden code point or the input contains
14241|       |  // 'xn-' (case insensitive), so we need to call 'to_ascii' to perform the full
14242|       |  // conversion.
14243|       |
14244|  2.84k|  ada_log("parse_host calling to_ascii");
14245|  2.84k|  std::optional<std::string> host = std::string(get_hostname());
14246|  2.84k|  is_valid = ada::unicode::to_ascii(host, input, input.find('%'));
14247|  2.84k|  if (!is_valid) {
  ------------------
  |  Branch (14247:7): [True: 1.46k, False: 1.37k]
  ------------------
14248|  1.46k|    ada_log("parse_host to_ascii returns false");
14249|  1.46k|    return is_valid = false;
14250|  1.46k|  }
14251|  1.37k|  ada_log("parse_host to_ascii succeeded ", *host, " [", host->size(),
14252|  1.37k|          " bytes]");
14253|       |
14254|  1.37k|  if (std::ranges::any_of(host.value(),
  ------------------
  |  Branch (14254:7): [True: 0, False: 1.37k]
  ------------------
14255|  1.37k|                          ada::unicode::is_forbidden_domain_code_point)) {
14256|      0|    return is_valid = false;
14257|      0|  }
14258|       |
14259|       |  // If asciiDomain ends in a number, then return the result of IPv4 parsing
14260|       |  // asciiDomain.
14261|  1.37k|  if (checkers::is_ipv4(host.value())) {
  ------------------
  |  Branch (14261:7): [True: 1.13k, False: 236]
  ------------------
14262|  1.13k|    ada_log("parse_host got ipv4 ", *host);
14263|  1.13k|    return parse_ipv4(host.value(), false);
14264|  1.13k|  }
14265|       |
14266|    236|  update_base_hostname(host.value());
14267|    236|  ADA_ASSERT_TRUE(validate());
14268|    236|  return true;
14269|  1.37k|}
_ZN3ada14url_aggregator21consume_prepared_pathENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
15088|  1.90k|inline void url_aggregator::consume_prepared_path(std::string_view input) {
15089|  1.90k|  ada_log("url_aggregator::consume_prepared_path ", input);
15090|       |  /***
15091|       |   * This is largely duplicated code from helpers::parse_prepared_path, which is
15092|       |   * unfortunate. This particular function is nearly identical, except that it
15093|       |   * is a method on url_aggregator. The idea is that the trivial path (which is
15094|       |   * very common) merely appends to the buffer. This is the same trivial path as
15095|       |   * with helpers::parse_prepared_path, except that we have the additional check
15096|       |   * for is_at_path(). Otherwise, we grab a copy of the current path and we
15097|       |   * modify it, and then insert it back into the buffer.
15098|       |   */
15099|  1.90k|  uint8_t accumulator = checkers::path_signature(input);
15100|       |  // Let us first detect a trivial case.
15101|       |  // If it is special, we check that we have no dot, no %,  no \ and no
15102|       |  // character needing percent encoding. Otherwise, we check that we have no %,
15103|       |  // no dot, and no character needing percent encoding.
15104|  1.90k|  constexpr uint8_t need_encoding = 1;
15105|  1.90k|  constexpr uint8_t backslash_char = 2;
15106|  1.90k|  constexpr uint8_t dot_char = 4;
15107|  1.90k|  constexpr uint8_t percent_char = 8;
15108|  1.90k|  bool special = type != ada::scheme::NOT_SPECIAL;
15109|  1.90k|  bool may_need_slow_file_handling = (type == ada::scheme::type::FILE &&
  ------------------
  |  Branch (15109:39): [True: 0, False: 1.90k]
  ------------------
15110|      0|                                      checkers::is_windows_drive_letter(input));
  ------------------
  |  Branch (15110:39): [True: 0, False: 0]
  ------------------
15111|  1.90k|  bool trivial_path =
15112|  1.90k|      (special ? (accumulator == 0)
  ------------------
  |  Branch (15112:7): [True: 745, False: 1.16k]
  |  Branch (15112:8): [True: 1.90k, False: 0]
  ------------------
15113|  1.90k|               : ((accumulator & (need_encoding | dot_char | percent_char)) ==
15114|      0|                  0)) &&
15115|    745|      (!may_need_slow_file_handling);
  ------------------
  |  Branch (15115:7): [True: 745, False: 0]
  ------------------
15116|  1.90k|  if (accumulator == dot_char && !may_need_slow_file_handling) {
  ------------------
  |  Branch (15116:7): [True: 493, False: 1.41k]
  |  Branch (15116:34): [True: 493, False: 0]
  ------------------
15117|       |    // '4' means that we have at least one dot, but nothing that requires
15118|       |    // percent encoding or decoding. The only part that is not trivial is
15119|       |    // that we may have single dots and double dots path segments.
15120|       |    // If we have such segments, then we either have a path that begins
15121|       |    // with '.' (easy to check), or we have the sequence './'.
15122|       |    // Note: input cannot be empty, it must at least contain one character ('.')
15123|       |    // Note: we know that '\' is not present.
15124|    493|    if (input[0] != '.') {
  ------------------
  |  Branch (15124:9): [True: 194, False: 299]
  ------------------
15125|    194|      size_t slashdot = 0;
15126|    194|      bool dot_is_file = true;
15127|    748|      for (;;) {
15128|    748|        slashdot = input.find("/.", slashdot);
15129|    748|        if (slashdot == std::string_view::npos) {  // common case
  ------------------
  |  Branch (15129:13): [True: 194, False: 554]
  ------------------
15130|    194|          break;
15131|    554|        } else {  // uncommon
15132|       |          // only three cases matter: /./, /.. or a final /
15133|    554|          slashdot += 2;
15134|    554|          dot_is_file &= !(slashdot == input.size() || input[slashdot] == '.' ||
  ------------------
  |  Branch (15134:28): [True: 4, False: 550]
  |  Branch (15134:56): [True: 321, False: 229]
  ------------------
15135|    229|                           input[slashdot] == '/');
  ------------------
  |  Branch (15135:28): [True: 116, False: 113]
  ------------------
15136|    554|        }
15137|    748|      }
15138|    194|      trivial_path = dot_is_file;
15139|    194|    }
15140|    493|  }
15141|  1.90k|  if (trivial_path && is_at_path()) {
  ------------------
  |  Branch (15141:7): [True: 780, False: 1.12k]
  |  Branch (15141:23): [True: 780, False: 0]
  ------------------
15142|    780|    ada_log("parse_path trivial");
15143|    780|    buffer += '/';
15144|    780|    buffer += input;
15145|    780|    return;
15146|    780|  }
15147|  1.12k|  std::string path = std::string(get_pathname());
15148|       |  // We are going to need to look a bit at the path, but let us see if we can
15149|       |  // ignore percent encoding *and* backslashes *and* percent characters.
15150|       |  // Except for the trivial case, this is likely to capture 99% of paths out
15151|       |  // there.
15152|  1.12k|  bool fast_path =
15153|  1.12k|      (special &&
  ------------------
  |  Branch (15153:8): [True: 1.12k, False: 0]
  ------------------
15154|  1.12k|       (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
  ------------------
  |  Branch (15154:8): [True: 458, False: 668]
  ------------------
15155|    458|      (type != ada::scheme::type::FILE);
  ------------------
  |  Branch (15155:7): [True: 458, False: 0]
  ------------------
15156|  1.12k|  if (fast_path) {
  ------------------
  |  Branch (15156:7): [True: 458, False: 668]
  ------------------
15157|    458|    ada_log("parse_prepared_path fast");
15158|       |    // Here we don't need to worry about \ or percent encoding.
15159|       |    // We also do not have a file protocol. We might have dots, however,
15160|       |    // but dots must as appear as '.', and they cannot be encoded because
15161|       |    // the symbol '%' is not present.
15162|    458|    size_t previous_location = 0;  // We start at 0.
15163|  2.55k|    do {
15164|  2.55k|      size_t new_location = input.find('/', previous_location);
15165|       |      // std::string_view path_view = input;
15166|       |      //  We process the last segment separately:
15167|  2.55k|      if (new_location == std::string_view::npos) {
  ------------------
  |  Branch (15167:11): [True: 458, False: 2.09k]
  ------------------
15168|    458|        std::string_view path_view = input.substr(previous_location);
15169|    458|        if (path_view == "..") {  // The path ends with ..
  ------------------
  |  Branch (15169:13): [True: 23, False: 435]
  ------------------
15170|       |          // e.g., if you receive ".." with an empty path, you go to "/".
15171|     23|          if (path.empty()) {
  ------------------
  |  Branch (15171:15): [True: 4, False: 19]
  ------------------
15172|      4|            path = '/';
15173|      4|            update_base_pathname(path);
15174|      4|            return;
15175|      4|          }
15176|       |          // Fast case where we have nothing to do:
15177|     19|          if (path.back() == '/') {
  ------------------
  |  Branch (15177:15): [True: 3, False: 16]
  ------------------
15178|      3|            update_base_pathname(path);
15179|      3|            return;
15180|      3|          }
15181|       |          // If you have the path "/joe/myfriend",
15182|       |          // then you delete 'myfriend'.
15183|     16|          path.resize(path.rfind('/') + 1);
15184|     16|          update_base_pathname(path);
15185|     16|          return;
15186|     19|        }
15187|    435|        path += '/';
15188|    435|        if (path_view != ".") {
  ------------------
  |  Branch (15188:13): [True: 429, False: 6]
  ------------------
15189|    429|          path.append(path_view);
15190|    429|        }
15191|    435|        update_base_pathname(path);
15192|    435|        return;
15193|  2.09k|      } else {
15194|       |        // This is a non-final segment.
15195|  2.09k|        std::string_view path_view =
15196|  2.09k|            input.substr(previous_location, new_location - previous_location);
15197|  2.09k|        previous_location = new_location + 1;
15198|  2.09k|        if (path_view == "..") {
  ------------------
  |  Branch (15198:13): [True: 354, False: 1.74k]
  ------------------
15199|    354|          size_t last_delimiter = path.rfind('/');
15200|    354|          if (last_delimiter != std::string::npos) {
  ------------------
  |  Branch (15200:15): [True: 184, False: 170]
  ------------------
15201|    184|            path.erase(last_delimiter);
15202|    184|          }
15203|  1.74k|        } else if (path_view != ".") {
  ------------------
  |  Branch (15203:20): [True: 1.52k, False: 224]
  ------------------
15204|  1.52k|          path += '/';
15205|  1.52k|          path.append(path_view);
15206|  1.52k|        }
15207|  2.09k|      }
15208|  2.55k|    } while (true);
  ------------------
  |  Branch (15208:14): [True: 2.09k, Folded]
  ------------------
15209|    668|  } else {
15210|    668|    ada_log("parse_path slow");
15211|       |    // we have reached the general case
15212|    668|    bool needs_percent_encoding = (accumulator & 1);
15213|    668|    std::string path_buffer_tmp;
15214|  4.33k|    do {
15215|  4.33k|      size_t location = (special && (accumulator & 2))
  ------------------
  |  Branch (15215:26): [True: 4.33k, False: 0]
  |  Branch (15215:37): [True: 131, False: 4.20k]
  ------------------
15216|  4.33k|                            ? input.find_first_of("/\\")
15217|  4.33k|                            : input.find('/');
15218|  4.33k|      std::string_view path_view = input;
15219|  4.33k|      if (location != std::string_view::npos) {
  ------------------
  |  Branch (15219:11): [True: 3.66k, False: 668]
  ------------------
15220|  3.66k|        path_view.remove_suffix(path_view.size() - location);
15221|  3.66k|        input.remove_prefix(location + 1);
15222|  3.66k|      }
15223|       |      // path_buffer is either path_view or it might point at a percent encoded
15224|       |      // temporary string.
15225|  4.33k|      std::string_view path_buffer =
15226|  4.33k|          (needs_percent_encoding &&
  ------------------
  |  Branch (15226:12): [True: 3.79k, False: 542]
  ------------------
15227|  3.79k|           ada::unicode::percent_encode<false>(
  ------------------
  |  Branch (15227:12): [True: 1.22k, False: 2.56k]
  ------------------
15228|  3.79k|               path_view, character_sets::PATH_PERCENT_ENCODE, path_buffer_tmp))
15229|  4.33k|              ? path_buffer_tmp
15230|  4.33k|              : path_view;
15231|  4.33k|      if (unicode::is_double_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (15231:11): [True: 463, False: 3.87k]
  ------------------
15232|    463|        helpers::shorten_path(path, type);
15233|    463|        if (location == std::string_view::npos) {
  ------------------
  |  Branch (15233:13): [True: 20, False: 443]
  ------------------
15234|     20|          path += '/';
15235|     20|        }
15236|  3.87k|      } else if (unicode::is_single_dot_path_segment(path_buffer) &&
  ------------------
  |  Branch (15236:18): [True: 238, False: 3.63k]
  ------------------
15237|    238|                 (location == std::string_view::npos)) {
  ------------------
  |  Branch (15237:18): [True: 22, False: 216]
  ------------------
15238|     22|        path += '/';
15239|     22|      }
15240|       |      // Otherwise, if path_buffer is not a single-dot path segment, then:
15241|  3.84k|      else if (!unicode::is_single_dot_path_segment(path_buffer)) {
  ------------------
  |  Branch (15241:16): [True: 3.63k, False: 216]
  ------------------
15242|       |        // If url's scheme is "file", url's path is empty, and path_buffer is a
15243|       |        // Windows drive letter, then replace the second code point in
15244|       |        // path_buffer with U+003A (:).
15245|  3.63k|        if (type == ada::scheme::type::FILE && path.empty() &&
  ------------------
  |  Branch (15245:13): [True: 0, False: 3.63k]
  |  Branch (15245:48): [True: 0, False: 0]
  ------------------
15246|      0|            checkers::is_windows_drive_letter(path_buffer)) {
  ------------------
  |  Branch (15246:13): [True: 0, False: 0]
  ------------------
15247|      0|          path += '/';
15248|      0|          path += path_buffer[0];
15249|      0|          path += ':';
15250|      0|          path_buffer.remove_prefix(2);
15251|      0|          path.append(path_buffer);
15252|  3.63k|        } else {
15253|       |          // Append path_buffer to url's path.
15254|  3.63k|          path += '/';
15255|  3.63k|          path.append(path_buffer);
15256|  3.63k|        }
15257|  3.63k|      }
15258|  4.33k|      if (location == std::string_view::npos) {
  ------------------
  |  Branch (15258:11): [True: 668, False: 3.66k]
  ------------------
15259|    668|        update_base_pathname(path);
15260|    668|        return;
15261|    668|      }
15262|  4.33k|    } while (true);
  ------------------
  |  Branch (15262:14): [True: 3.66k, Folded]
  ------------------
15263|    668|  }
15264|  1.12k|}
_ZN3ada8checkers7is_ipv4ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   12|  9.35k|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.35k|  if (!last_label_may_be_a_number(view)) {
  ------------------
  |  Branch (14:7): [True: 817, False: 8.53k]
  ------------------
   15|    817|    return false;
   16|    817|  }
   17|       |  // If the address ends with a dot, we need to prune it (special case).
   18|  8.53k|  if (view.ends_with('.')) {
  ------------------
  |  Branch (18:7): [True: 141, False: 8.39k]
  ------------------
   19|    141|    view.remove_suffix(1);
   20|    141|  }
   21|       |  // From the last character, find the last dot.
   22|  8.53k|  size_t last_dot = view.rfind('.');
   23|  8.53k|  if (last_dot != std::string_view::npos) {
  ------------------
  |  Branch (23:7): [True: 7.52k, False: 1.01k]
  ------------------
   24|       |    // We have at least one dot.
   25|  7.52k|    view.remove_prefix(last_dot + 1);
   26|  7.52k|  }
   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.53k|  if (std::ranges::all_of(view, ada::checkers::is_digit)) {
  ------------------
  |  Branch (30:7): [True: 7.93k, False: 601]
  ------------------
   31|  7.93k|    return true;
   32|  7.93k|  }
   33|       |  // It could be hex (0x), but not if there is a single character.
   34|    601|  if (view.size() == 1) {
  ------------------
  |  Branch (34:7): [True: 0, False: 601]
  ------------------
   35|      0|    return false;
   36|      0|  }
   37|       |  // It must start with 0x.
   38|    601|  if (!view.starts_with("0x")) {
  ------------------
  |  Branch (38:7): [True: 95, False: 506]
  ------------------
   39|     95|    return false;
   40|     95|  }
   41|       |  // We must allow "0x".
   42|    506|  if (view.size() == 2) {
  ------------------
  |  Branch (42:7): [True: 41, False: 465]
  ------------------
   43|     41|    return true;
   44|     41|  }
   45|       |  // We have 0x followed by some characters, we need to check that they are
   46|       |  // hexadecimals.
   47|    465|  view.remove_prefix(2);
   48|    465|  return std::ranges::all_of(view, ada::unicode::is_lowercase_hex);
   49|    506|}
_ZN3ada7unicode16is_lowercase_hexEc:
 7174|  5.47k|ada_really_inline constexpr bool is_lowercase_hex(const char c) noexcept {
 7175|  5.47k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
  ------------------
  |  Branch (7175:11): [True: 5.47k, False: 0]
  |  Branch (7175:23): [True: 3.09k, False: 2.38k]
  |  Branch (7175:37): [True: 2.38k, False: 3]
  |  Branch (7175:49): [True: 2.35k, False: 21]
  ------------------
 7176|  5.47k|}
_ZN3ada8checkers14path_signatureENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   75|  9.03k|    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|  9.03k|  size_t i = 0;
   82|  9.03k|  uint8_t accumulator{};
   83|  25.9k|  for (; i + 7 < input.size(); i += 8) {
  ------------------
  |  Branch (83:10): [True: 16.9k, False: 9.03k]
  ------------------
   84|  16.9k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])] |
   85|  16.9k|                           path_signature_table[uint8_t(input[i + 1])] |
   86|  16.9k|                           path_signature_table[uint8_t(input[i + 2])] |
   87|  16.9k|                           path_signature_table[uint8_t(input[i + 3])] |
   88|  16.9k|                           path_signature_table[uint8_t(input[i + 4])] |
   89|  16.9k|                           path_signature_table[uint8_t(input[i + 5])] |
   90|  16.9k|                           path_signature_table[uint8_t(input[i + 6])] |
   91|  16.9k|                           path_signature_table[uint8_t(input[i + 7])]);
   92|  16.9k|  }
   93|  35.8k|  for (; i < input.size(); i++) {
  ------------------
  |  Branch (93:10): [True: 26.8k, False: 9.03k]
  ------------------
   94|  26.8k|    accumulator |= uint8_t(path_signature_table[uint8_t(input[i])]);
   95|  26.8k|  }
   96|  9.03k|  return accumulator;
   97|  9.03k|}
_ZN3ada7unicode45contains_forbidden_domain_code_point_or_upperEPKcm:
 7055|  12.0k|                                              size_t length) noexcept {
 7056|  12.0k|  size_t i = 0;
 7057|  12.0k|  uint8_t accumulator{};
 7058|  61.7k|  for (; i + 4 <= length; i += 4) {
  ------------------
  |  Branch (7058:10): [True: 49.6k, False: 12.0k]
  ------------------
 7059|  49.6k|    accumulator |=
 7060|  49.6k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7061|  49.6k|    accumulator |=
 7062|  49.6k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 1])];
 7063|  49.6k|    accumulator |=
 7064|  49.6k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 2])];
 7065|  49.6k|    accumulator |=
 7066|  49.6k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i + 3])];
 7067|  49.6k|  }
 7068|  28.0k|  for (; i < length; i++) {
  ------------------
  |  Branch (7068:10): [True: 15.9k, False: 12.0k]
  ------------------
 7069|  15.9k|    accumulator |=
 7070|  15.9k|        is_forbidden_domain_code_point_table_or_upper[uint8_t(input[i])];
 7071|  15.9k|  }
 7072|  12.0k|  return accumulator;
 7073|  12.0k|}
_ZN3ada14url_aggregator23parse_scheme_with_colonILb0EEEbNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
13666|  12.2k|    const std::string_view input_with_colon) {
13667|  12.2k|  ada_log("url_aggregator::parse_scheme_with_colon ", input_with_colon);
13668|  12.2k|  ADA_ASSERT_TRUE(validate());
13669|  12.2k|  ADA_ASSERT_TRUE(!helpers::overlaps(input_with_colon, buffer));
13670|  12.2k|  std::string_view input{input_with_colon};
13671|  12.2k|  input.remove_suffix(1);
13672|  12.2k|  auto parsed_type = ada::scheme::get_scheme_type(input);
13673|  12.2k|  const bool is_input_special = (parsed_type != ada::scheme::NOT_SPECIAL);
13674|       |  /**
13675|       |   * In the common case, we will immediately recognize a special scheme (e.g.,
13676|       |   *http, https), in which case, we can go really fast.
13677|       |   **/
13678|  12.2k|  if (is_input_special) {  // fast path!!!
  ------------------
  |  Branch (13678:7): [True: 12.2k, False: 0]
  ------------------
13679|       |    if constexpr (has_state_override) {
13680|       |      // If url's scheme is not a special scheme and buffer is a special scheme,
13681|       |      // then return.
13682|       |      if (is_special() != is_input_special) {
13683|       |        return false;
13684|       |      }
13685|       |
13686|       |      // If url includes credentials or has a non-null port, and buffer is
13687|       |      // "file", then return.
13688|       |      if ((has_credentials() || components.port != url_components::omitted) &&
13689|       |          parsed_type == ada::scheme::type::FILE) {
13690|       |        return false;
13691|       |      }
13692|       |
13693|       |      // If url's scheme is "file" and its host is an empty host, then return.
13694|       |      // An empty host is the empty string.
13695|       |      if (type == ada::scheme::type::FILE &&
13696|       |          components.host_start == components.host_end) {
13697|       |        return false;
13698|       |      }
13699|       |    }
13700|       |
13701|  12.2k|    type = parsed_type;
13702|  12.2k|    set_scheme_from_view_with_colon(input_with_colon);
13703|       |
13704|       |    if constexpr (has_state_override) {
13705|       |      // This is uncommon.
13706|       |      uint16_t urls_scheme_port = get_special_port();
13707|       |
13708|       |      if (urls_scheme_port) {
13709|       |        // If url's port is url's scheme's default port, then set url's port to
13710|       |        // null.
13711|       |        if (components.port == urls_scheme_port) {
13712|       |          clear_port();
13713|       |        }
13714|       |      }
13715|       |    }
13716|  12.2k|  } else {  // slow path
13717|      0|    std::string _buffer(input);
13718|       |    // Next function is only valid if the input is ASCII and returns false
13719|       |    // otherwise, but it seems that we always have ascii content so we do not
13720|       |    // need to check the return value.
13721|      0|    unicode::to_lower_ascii(_buffer.data(), _buffer.size());
13722|       |
13723|       |    if constexpr (has_state_override) {
13724|       |      // The state-override validation errors below ("return" in the WHATWG URL
13725|       |      // parser) leave the URL unchanged. The setter contract is
13726|       |      // "true on success, false if the scheme is invalid" -- the fast path
13727|       |      // above already returns false here, so the slow path must agree.
13728|       |
13729|       |      // If url's scheme is a special scheme and buffer is not a special scheme,
13730|       |      // then return. If url's scheme is not a special scheme and buffer is a
13731|       |      // special scheme, then return.
13732|       |      if (is_special() != ada::scheme::is_special(_buffer)) {
13733|       |        return false;
13734|       |      }
13735|       |
13736|       |      // If url includes credentials or has a non-null port, and buffer is
13737|       |      // "file", then return.
13738|       |      if ((has_credentials() || components.port != url_components::omitted) &&
13739|       |          _buffer == "file") {
13740|       |        return false;
13741|       |      }
13742|       |
13743|       |      // If url's scheme is "file" and its host is an empty host, then return.
13744|       |      // An empty host is the empty string.
13745|       |      if (type == ada::scheme::type::FILE &&
13746|       |          components.host_start == components.host_end) {
13747|       |        return false;
13748|       |      }
13749|       |    }
13750|       |
13751|      0|    set_scheme(_buffer);
13752|       |
13753|       |    if constexpr (has_state_override) {
13754|       |      // This is uncommon.
13755|       |      uint16_t urls_scheme_port = get_special_port();
13756|       |
13757|       |      if (urls_scheme_port) {
13758|       |        // If url's port is url's scheme's default port, then set url's port to
13759|       |        // null.
13760|       |        if (components.port == urls_scheme_port) {
13761|       |          clear_port();
13762|       |        }
13763|       |      }
13764|       |    }
13765|      0|  }
13766|  12.2k|  ADA_ASSERT_TRUE(validate());
13767|  12.2k|  return true;
13768|  12.2k|}
_ZN3ada14url_aggregator31set_scheme_from_view_with_colonENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
13792|  12.2k|    std::string_view new_scheme_with_colon) {
13793|  12.2k|  ada_log("url_aggregator::set_scheme_from_view_with_colon ",
13794|  12.2k|          new_scheme_with_colon);
13795|  12.2k|  ADA_ASSERT_TRUE(validate());
13796|  12.2k|  ADA_ASSERT_TRUE(!new_scheme_with_colon.empty() &&
13797|  12.2k|                  new_scheme_with_colon.back() == ':');
13798|       |  // next line could overflow but unsigned arithmetic has well-defined
13799|       |  // overflows.
13800|  12.2k|  uint32_t new_difference =
13801|  12.2k|      uint32_t(new_scheme_with_colon.size()) - components.protocol_end;
13802|       |
13803|  12.2k|  if (buffer.empty()) {
  ------------------
  |  Branch (13803:7): [True: 12.2k, False: 0]
  ------------------
13804|  12.2k|    buffer.append(new_scheme_with_colon);
13805|  12.2k|  } else {
13806|      0|    buffer.erase(0, components.protocol_end);
13807|      0|    buffer.insert(0, new_scheme_with_colon);
13808|      0|  }
13809|  12.2k|  components.protocol_end += new_difference;
13810|       |
13811|  12.2k|  apply_shifted_non_scheme_offsets(components, new_difference);
13812|  12.2k|  ADA_ASSERT_TRUE(validate());
13813|  12.2k|}

_ZN3ada37url_pattern_compile_component_optionsC2ENSt3__18optionalIcEES3_:
 5809|      6|      : delimiter(new_delimiter), prefix(new_prefix) {}
_ZN3ada14character_sets6bit_atEPKhh:
 1081|   269k|ada_really_inline constexpr bool bit_at(const uint8_t a[], const uint8_t i) {
 1082|   269k|  return !!(a[i >> 3] & (1 << (i & 7)));
 1083|   269k|}
_ZN2tl10unexpectedIN3ada6errorsEEC2EOS2_:
 2196|  21.9k|  constexpr explicit unexpected(E&& e) : m_val(std::move(e)) {}
_ZNR2tl10unexpectedIN3ada6errorsEE5valueEv:
 2210|  10.9k|  TL_EXPECTED_11_CONSTEXPR E& value() & { return m_val; }
_ZN3ada8url_baseD2Ev:
 1700|  15.8k|  virtual ~url_base() = default;
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IS3_TnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_OT_EE5valueEvE4typeELPv0ETnPNS7_IXsr3std14is_convertibleIS9_S3_EE5valueEvE4typeELSD_0EEEONS_10unexpectedIS8_EE:
 3682|  10.9k|      : impl_base(unexpect, std::move(e.value())),
 3683|  10.9k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS4_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS4_DpOT_EE5valueEvE4typeELPv0EEENS_10unexpect_tESB_:
 2668|  10.9k|      : m_unexpect(std::forward<Args>(args)...), m_has_val(false) {}
_ZN2tl6detail26expected_default_ctor_baseIN3ada14url_aggregatorENS2_6errorsELb1EEC2ENS0_23default_constructor_tagE:
 3286|  13.4k|  constexpr explicit expected_default_ctor_base(default_constructor_tag) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IS2_TnPNSt3__19enable_ifIXsr3std14is_convertibleIOT_S2_EE5valueEvE4typeELPv0ETnPNS7_IXaaaaaasr3std16is_constructibleIS2_S9_EE5valuentsr3std7is_sameINS6_5decayIS8_E4typeENS_10in_place_tEEE5valuentsr3std7is_sameIS4_SG_EE5valuentsr3std7is_sameINS_10unexpectedIS3_EESG_EE5valueEvE4typeELSD_0EEES9_:
 3768|  2.45k|      : expected(in_place, std::forward<U>(v)) {}
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEC2IJS2_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS2_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESA_:
 3641|  2.45k|      : impl_base(in_place, std::forward<Args>(args)...),
 3642|  2.45k|        ctor_base(detail::default_constructor_tag{}) {}
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EEC2IJS3_ETnPNSt3__19enable_ifIXsr3std16is_constructibleIS3_DpOT_EE5valueEvE4typeELPv0EEENS_10in_place_tESB_:
 2656|  2.45k|      : m_val(std::forward<Args>(args)...), m_has_val(true) {}
_ZN3ada14url_aggregatorC2EOS0_:
 7831|  2.45k|  url_aggregator(url_aggregator&& u) noexcept = default;
_ZN3ada14url_aggregatorD2Ev:
 7834|  15.8k|  ~url_aggregator() override = default;
_ZN3ada6scheme15get_scheme_typeENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 6846|  12.2k|constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept {
 6847|  12.2k|  if (scheme.empty()) {
  ------------------
  |  Branch (6847:7): [True: 0, False: 12.2k]
  ------------------
 6848|      0|    return ada::scheme::NOT_SPECIAL;
 6849|      0|  }
 6850|  12.2k|  int hash_value = (2 * scheme.size() + (unsigned)(scheme[0])) & 7;
 6851|  12.2k|  const std::string_view target = details::is_special_list[hash_value];
 6852|  12.2k|  if (scheme.size() == target.size() &&
  ------------------
  |  Branch (6852:7): [True: 12.2k, False: 0]
  ------------------
 6853|  12.2k|      details::branchless_load5(scheme.data(), scheme.size()) ==
  ------------------
  |  Branch (6853:7): [True: 12.2k, False: 0]
  ------------------
 6854|  12.2k|          details::scheme_keys[hash_value]) {
 6855|  12.2k|    return ada::scheme::type(hash_value);
 6856|  12.2k|  } else {
 6857|      0|    return ada::scheme::NOT_SPECIAL;
 6858|      0|  }
 6859|  12.2k|}
_ZN3ada6scheme7details16branchless_load5EPKcm:
 6787|  12.2k|inline uint64_t branchless_load5(const char* p, size_t n) {
 6788|  12.2k|  uint64_t input = (uint8_t)p[0];
 6789|  12.2k|  input |= ((uint64_t)(uint8_t)p[n > 1] << 8) & (0 - (uint64_t)(n > 1));
 6790|  12.2k|  input |= ((uint64_t)(uint8_t)p[(n > 2) * 2] << 16) & (0 - (uint64_t)(n > 2));
 6791|  12.2k|  input |= ((uint64_t)(uint8_t)p[(n > 3) * 3] << 24) & (0 - (uint64_t)(n > 3));
 6792|  12.2k|  input |= ((uint64_t)(uint8_t)p[(n > 4) * 4] << 32) & (0 - (uint64_t)(n > 4));
 6793|  12.2k|  return input;
 6794|  12.2k|}
_ZN3ada14url_aggregatorC2Ev:
 7829|  13.4k|  url_aggregator() = default;
_ZN3ada14url_componentsC2Ev:
 4960|  13.4k|  url_components() = default;
_ZN3ada8checkers19try_parse_ipv4_fastENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1453|  14.5k|try_parse_ipv4_fast(std::string_view input) noexcept {
 1454|  14.5k|  const size_t len = input.size();
 1455|       |  // Shortest pure decimal: "0.0.0.0" (7). Longest + trailing dot: 16.
 1456|  14.5k|  if (len < 7 || len > 16) [[unlikely]] {
  ------------------
  |  Branch (1456:7): [True: 9.82k, False: 4.75k]
  |  Branch (1456:18): [True: 1.93k, False: 2.81k]
  ------------------
 1457|  11.7k|    return ipv4_fast_fail;
 1458|  11.7k|  }
 1459|  2.81k|  const char* data = input.data();
 1460|       |
 1461|       |#if defined(ADA_AVX512) && defined(__AVX512VBMI2__)
 1462|       |  return detail::try_parse_ipv4_avx512(data, len);
 1463|       |#else
 1464|  2.81k|  return detail::parse_ipv4_decimal_scalar(data, data + len);
 1465|  14.5k|#endif
 1466|  14.5k|}
_ZN3ada8checkers6detail25parse_ipv4_decimal_scalarEPKcS3_:
 1294|  2.81k|parse_ipv4_decimal_scalar(const char* p, const char* pend) noexcept {
 1295|  2.81k|  uint32_t ipv4 = 0;
 1296|  5.15k|  for (int i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1296:19): [True: 4.61k, False: 546]
  ------------------
 1297|  4.61k|    if (p == pend) [[unlikely]] {
  ------------------
  |  Branch (1297:9): [True: 2, False: 4.60k]
  ------------------
 1298|      2|      return ipv4_fast_fail;
 1299|      2|    }
 1300|  4.60k|    uint32_t val;
 1301|  4.60k|    char c = *p;
 1302|  4.60k|    if (c >= '0' && c <= '9') [[likely]] {
  ------------------
  |  Branch (1302:9): [True: 3.88k, False: 720]
  |  Branch (1302:21): [True: 2.83k, False: 1.05k]
  ------------------
 1303|  2.83k|      val = static_cast<uint32_t>(c - '0');
 1304|  2.83k|      ++p;
 1305|  2.83k|    } else {
 1306|  1.77k|      return ipv4_fast_fail;
 1307|  1.77k|    }
 1308|  2.83k|    if (p < pend) {
  ------------------
  |  Branch (1308:9): [True: 2.60k, False: 231]
  ------------------
 1309|  2.60k|      c = *p;
 1310|  2.60k|      if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1310:11): [True: 1.55k, False: 1.05k]
  |  Branch (1310:23): [True: 1.37k, False: 179]
  ------------------
 1311|  1.37k|        if (val == 0) [[unlikely]] {
  ------------------
  |  Branch (1311:13): [True: 74, False: 1.30k]
  ------------------
 1312|     74|          return ipv4_fast_fail;
 1313|     74|        }
 1314|  1.30k|        val = val * 10u + static_cast<uint32_t>(c - '0');
 1315|  1.30k|        ++p;
 1316|  1.30k|        if (p < pend) {
  ------------------
  |  Branch (1316:13): [True: 1.13k, False: 167]
  ------------------
 1317|  1.13k|          c = *p;
 1318|  1.13k|          if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (1318:15): [True: 795, False: 342]
  |  Branch (1318:27): [True: 782, False: 13]
  ------------------
 1319|    782|            val = val * 10u + static_cast<uint32_t>(c - '0');
 1320|    782|            ++p;
 1321|    782|            if (val > 255u) [[unlikely]] {
  ------------------
  |  Branch (1321:17): [True: 139, False: 643]
  ------------------
 1322|    139|              return ipv4_fast_fail;
 1323|    139|            }
 1324|    782|          }
 1325|  1.13k|        }
 1326|  1.30k|      }
 1327|  2.60k|    }
 1328|  2.62k|    ipv4 = (ipv4 << 8) | val;
 1329|  2.62k|    if (i < 3) {
  ------------------
  |  Branch (1329:9): [True: 2.08k, False: 546]
  ------------------
 1330|  2.08k|      if (p == pend || *p != '.') [[unlikely]] {
  ------------------
  |  Branch (1330:11): [True: 31, False: 2.04k]
  |  Branch (1330:24): [True: 251, False: 1.79k]
  ------------------
 1331|    282|        return ipv4_fast_fail;
 1332|    282|      }
 1333|  1.79k|      ++p;
 1334|  1.79k|    }
 1335|  2.62k|  }
 1336|    546|  if (p != pend) {
  ------------------
  |  Branch (1336:7): [True: 55, False: 491]
  ------------------
 1337|     55|    if (p == pend - 1 && *p == '.') {
  ------------------
  |  Branch (1337:9): [True: 30, False: 25]
  |  Branch (1337:26): [True: 5, False: 25]
  ------------------
 1338|      5|      return ipv4;
 1339|      5|    }
 1340|     50|    return ipv4_fast_fail;
 1341|     55|  }
 1342|    491|  return ipv4;
 1343|    546|}
_ZNK3ada8url_base10is_specialEv:
 7329|  46.7k|    const noexcept {
 7330|  46.7k|  return type != ada::scheme::NOT_SPECIAL;
 7331|  46.7k|}
_ZN3ada8checkers8is_alphaEc:
 1274|  18.5k|constexpr bool is_alpha(char x) noexcept {
 1275|  18.5k|  return (to_lower(x) >= 'a') && (to_lower(x) <= 'z');
  ------------------
  |  Branch (1275:10): [True: 14.7k, False: 3.71k]
  |  Branch (1275:34): [True: 14.5k, False: 244]
  ------------------
 1276|  18.5k|}
_ZN3ada8checkers8to_lowerEc:
 1272|  33.3k|constexpr char to_lower(char x) noexcept { return (x | 0x20); }
_ZN3ada8checkers26last_label_may_be_a_numberENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1247|  11.0k|constexpr bool last_label_may_be_a_number(std::string_view view) noexcept {
 1248|  11.0k|  if (view.empty()) {
  ------------------
  |  Branch (1248:7): [True: 0, False: 11.0k]
  ------------------
 1249|      0|    return false;
 1250|      0|  }
 1251|  11.0k|  const char* start = view.data();
 1252|  11.0k|  const char* end = start + view.size();
 1253|  11.0k|  if (end[-1] == '.') {
  ------------------
  |  Branch (1253:7): [True: 458, False: 10.6k]
  ------------------
 1254|    458|    --end;
 1255|    458|    if (end == start) {
  ------------------
  |  Branch (1255:9): [True: 270, False: 188]
  ------------------
 1256|    270|      return false;
 1257|    270|    }
 1258|    458|  }
 1259|  10.8k|  if (!is_ipv4_number_char(end[-1])) {
  ------------------
  |  Branch (1259:7): [True: 1.15k, False: 9.66k]
  ------------------
 1260|  1.15k|    return false;
 1261|  1.15k|  }
 1262|  9.66k|  const char* label = end;
 1263|  35.9k|  while (label != start && is_ipv4_number_char(label[-1])) {
  ------------------
  |  Branch (1263:10): [True: 34.4k, False: 1.54k]
  |  Branch (1263:28): [True: 26.3k, False: 8.11k]
  ------------------
 1264|  26.3k|    --label;
 1265|  26.3k|  }
 1266|  9.66k|  if (label != start && label[-1] != '.') {
  ------------------
  |  Branch (1266:7): [True: 8.11k, False: 1.54k]
  |  Branch (1266:25): [True: 311, False: 7.80k]
  ------------------
 1267|    311|    return false;
 1268|    311|  }
 1269|  9.35k|  return label != end && is_digit(*label);
  ------------------
  |  Branch (1269:10): [True: 9.35k, False: 0]
  |  Branch (1269:26): [True: 8.81k, False: 546]
  ------------------
 1270|  9.66k|}
_ZN3ada8checkers19is_ipv4_number_charEc:
 1241|  45.2k|constexpr bool is_ipv4_number_char(char x) noexcept {
 1242|  45.2k|  const unsigned char c = static_cast<unsigned char>(x);
 1243|  45.2k|  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
  ------------------
  |  Branch (1243:11): [True: 37.0k, False: 8.16k]
  |  Branch (1243:23): [True: 27.8k, False: 9.27k]
  |  Branch (1243:37): [True: 8.60k, False: 8.83k]
  |  Branch (1243:49): [True: 5.20k, False: 3.39k]
  ------------------
 1244|  12.2k|         (c >= 'A' && c <= 'F') || c == 'x' || c == 'X';
  ------------------
  |  Branch (1244:11): [True: 3.95k, False: 8.27k]
  |  Branch (1244:23): [True: 237, False: 3.71k]
  |  Branch (1244:36): [True: 2.47k, False: 9.52k]
  |  Branch (1244:48): [True: 248, False: 9.27k]
  ------------------
 1245|  45.2k|}
_ZN3ada8checkers8is_digitEc:
 1239|  24.7k|constexpr bool is_digit(char x) noexcept { return (x >= '0') & (x <= '9'); }
_ZN3ada6scheme16get_special_portENS0_4typeE:
 6843|    277|constexpr uint16_t get_special_port(ada::scheme::type type) noexcept {
 6844|    277|  return details::special_ports[int(type)];
 6845|    277|}
_ZN3ada14url_aggregator20update_base_pathnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8554|  1.37k|inline void url_aggregator::update_base_pathname(const std::string_view input) {
 8555|  1.37k|  ada_log("url_aggregator::update_base_pathname '", input, "' [", input.size(),
 8556|  1.37k|          " bytes] \n", to_diagram());
 8557|  1.37k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8558|  1.37k|  ADA_ASSERT_TRUE(validate());
 8559|       |
 8560|  1.37k|  const bool begins_with_dashdash = input.starts_with("//");
 8561|  1.37k|  if (!begins_with_dashdash && has_dash_dot()) {
  ------------------
  |  Branch (8561:7): [True: 1.19k, False: 178]
  |  Branch (8561:32): [True: 0, False: 1.19k]
  ------------------
 8562|       |    // We must delete the ./
 8563|      0|    delete_dash_dot();
 8564|      0|  }
 8565|       |
 8566|  1.37k|  if (begins_with_dashdash && !has_opaque_path && !has_authority() &&
  ------------------
  |  Branch (8566:7): [True: 178, False: 1.19k]
  |  Branch (8566:31): [True: 178, False: 0]
  |  Branch (8566:51): [True: 0, False: 178]
  ------------------
 8567|      0|      !has_dash_dot()) {
  ------------------
  |  Branch (8567:7): [True: 0, False: 0]
  ------------------
 8568|       |    // If url's host is null, url does not have an opaque path, url's path's
 8569|       |    // size is greater than 1, then append U+002F (/) followed by U+002E (.) to
 8570|       |    // output.
 8571|      0|    buffer.insert(components.pathname_start, "/.");
 8572|      0|    components.pathname_start += 2;
 8573|      0|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8573:9): [True: 0, False: 0]
  ------------------
 8574|      0|      components.search_start += 2;
 8575|      0|    }
 8576|      0|    if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8576:9): [True: 0, False: 0]
  ------------------
 8577|      0|      components.hash_start += 2;
 8578|      0|    }
 8579|      0|  }
 8580|       |
 8581|  1.37k|  uint32_t difference = replace_and_resize(
 8582|  1.37k|      components.pathname_start,
 8583|  1.37k|      components.pathname_start + get_pathname_length(), input);
 8584|  1.37k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8584:7): [True: 0, False: 1.37k]
  ------------------
 8585|      0|    components.search_start += difference;
 8586|      0|  }
 8587|  1.37k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8587:7): [True: 0, False: 1.37k]
  ------------------
 8588|      0|    components.hash_start += difference;
 8589|      0|  }
 8590|  1.37k|  ADA_ASSERT_TRUE(validate());
 8591|  1.37k|}
_ZN3ada14url_aggregator18replace_and_resizeEjjNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8396|  4.43k|    uint32_t start, uint32_t end, std::string_view input) {
 8397|  4.43k|  uint32_t current_length = end - start;
 8398|  4.43k|  uint32_t input_size = uint32_t(input.size());
 8399|  4.43k|  uint32_t new_difference = input_size - current_length;
 8400|       |
 8401|  4.43k|  if (current_length == 0) {
  ------------------
  |  Branch (8401:7): [True: 3.53k, False: 903]
  ------------------
 8402|  3.53k|    buffer.insert(start, input);
 8403|  3.53k|  } else if (input_size == current_length) {
  ------------------
  |  Branch (8403:14): [True: 30, False: 873]
  ------------------
 8404|     30|    if (input_size != 0) {
  ------------------
  |  Branch (8404:9): [True: 30, False: 0]
  ------------------
 8405|     30|      std::memmove(buffer.data() + start, input.data(), input_size);
 8406|     30|    }
 8407|    873|  } else if (input_size < current_length) {
  ------------------
  |  Branch (8407:14): [True: 43, False: 830]
  ------------------
 8408|     43|    buffer.erase(start, current_length - input_size);
 8409|     43|    buffer.replace(start, input_size, input);
 8410|    830|  } else {
 8411|    830|    buffer.replace(start, current_length, input.substr(0, current_length));
 8412|    830|    buffer.insert(start + current_length, input.substr(current_length));
 8413|    830|  }
 8414|       |
 8415|  4.43k|  return new_difference;
 8416|  4.43k|}
_ZNK3ada14url_aggregator19get_pathname_lengthEv:
 8447|  1.37k|url_aggregator::get_pathname_length() const noexcept {
 8448|  1.37k|  ada_log("url_aggregator::get_pathname_length");
 8449|  1.37k|  uint32_t ending_index = uint32_t(buffer.size());
 8450|  1.37k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8450:7): [True: 0, False: 1.37k]
  ------------------
 8451|      0|    ending_index = components.search_start;
 8452|  1.37k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8452:14): [True: 0, False: 1.37k]
  ------------------
 8453|      0|    ending_index = components.hash_start;
 8454|      0|  }
 8455|  1.37k|  return ending_index - components.pathname_start;
 8456|  1.37k|}
_ZNK3ada14url_aggregator12get_pathnameEv:
 9389|  1.12k|    ada_lifetime_bound {
 9390|  1.12k|  ada_log("url_aggregator::get_pathname pathname_start = ",
 9391|  1.12k|          components.pathname_start, " buffer.size() = ", buffer.size(),
 9392|  1.12k|          " components.search_start = ", components.search_start,
 9393|  1.12k|          " components.hash_start = ", components.hash_start);
 9394|  1.12k|  auto ending_index = uint32_t(buffer.size());
 9395|  1.12k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9395:7): [True: 0, False: 1.12k]
  ------------------
 9396|      0|    ending_index = components.search_start;
 9397|  1.12k|  } else if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9397:14): [True: 0, False: 1.12k]
  ------------------
 9398|      0|    ending_index = components.hash_start;
 9399|      0|  }
 9400|  1.12k|  return helpers::substring(buffer, components.pathname_start, ending_index);
 9401|  1.12k|}
_ZN3ada14url_aggregator26update_unencoded_base_hashENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8372|    266|inline void url_aggregator::update_unencoded_base_hash(std::string_view input) {
 8373|    266|  ada_log("url_aggregator::update_unencoded_base_hash ", input, " [",
 8374|    266|          input.size(), " bytes], buffer is '", buffer, "' [", buffer.size(),
 8375|    266|          " bytes] components.hash_start = ", components.hash_start);
 8376|    266|  ADA_ASSERT_TRUE(validate());
 8377|    266|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8378|    266|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8378:7): [True: 0, False: 266]
  ------------------
 8379|      0|    buffer.resize(components.hash_start);
 8380|      0|  }
 8381|    266|  components.hash_start = uint32_t(buffer.size());
 8382|    266|  buffer += "#";
 8383|    266|  bool encoding_required = unicode::percent_encode<true>(
 8384|    266|      input, ada::character_sets::FRAGMENT_PERCENT_ENCODE, buffer);
 8385|       |  // When encoding_required is false, then buffer is left unchanged, and percent
 8386|       |  // encoding was not deemed required.
 8387|    266|  if (!encoding_required) {
  ------------------
  |  Branch (8387:7): [True: 158, False: 108]
  ------------------
 8388|    158|    buffer.append(input);
 8389|    158|  }
 8390|    266|  ada_log("url_aggregator::update_unencoded_base_hash final buffer is '",
 8391|    266|          buffer, "' [", buffer.size(), " bytes]");
 8392|    266|  ADA_ASSERT_TRUE(validate());
 8393|    266|}
_ZNK3ada8url_base19scheme_default_portEv:
 7338|     69|url_base::scheme_default_port() const noexcept {
 7339|     69|  return scheme::get_special_port(type);
 7340|     69|}
_ZN3ada8checkers23is_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1278|  7.13k|constexpr bool is_windows_drive_letter(std::string_view input) noexcept {
 1279|  7.13k|  return input.size() >= 2 &&
  ------------------
  |  Branch (1279:10): [True: 6.14k, False: 988]
  ------------------
 1280|  6.14k|         (is_alpha(input[0]) && ((input[1] == ':') || (input[1] == '|'))) &&
  ------------------
  |  Branch (1280:11): [True: 2.26k, False: 3.88k]
  |  Branch (1280:34): [True: 222, False: 2.04k]
  |  Branch (1280:55): [True: 1, False: 2.03k]
  ------------------
 1281|    223|         ((input.size() == 2) || (input[2] == '/' || input[2] == '\\' ||
  ------------------
  |  Branch (1281:11): [True: 2, False: 221]
  |  Branch (1281:35): [True: 56, False: 165]
  |  Branch (1281:54): [True: 1, False: 164]
  ------------------
 1282|    164|                                  input[2] == '?' || input[2] == '#'));
  ------------------
  |  Branch (1282:35): [True: 13, False: 151]
  |  Branch (1282:54): [True: 3, False: 148]
  ------------------
 1283|  7.13k|}
_ZN3ada8checkers34is_normalized_windows_drive_letterENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1286|  7.13k|    std::string_view input) noexcept {
 1287|  7.13k|  return input.size() == 2 && (is_alpha(input[0]) && (input[1] == ':'));
  ------------------
  |  Branch (1287:10): [True: 105, False: 7.02k]
  |  Branch (1287:32): [True: 30, False: 75]
  |  Branch (1287:54): [True: 1, False: 29]
  ------------------
 1288|  7.13k|}
_ZN3ada7helpers14leading_zeroesEj:
 1985|  12.3k|inline int leading_zeroes(uint32_t input_num) noexcept {
 1986|       |#if ADA_REGULAR_VISUAL_STUDIO
 1987|       |  unsigned long leading_zero(0);
 1988|       |  unsigned long in(input_num);
 1989|       |  return _BitScanReverse(&leading_zero, in) ? int(31 - leading_zero) : 32;
 1990|       |#else
 1991|  12.3k|  return __builtin_clz(input_num);
 1992|  12.3k|#endif  // ADA_REGULAR_VISUAL_STUDIO
 1993|  12.3k|}
_ZN3ada14url_aggregator7reserveEj:
 9062|  12.2k|constexpr void ada::url_aggregator::reserve(uint32_t capacity) {
 9063|  12.2k|  buffer.reserve(capacity);
 9064|  12.2k|}
_ZN3ada14url_aggregator20append_base_passwordENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8780|    974|inline void url_aggregator::append_base_password(const std::string_view input) {
 8781|    974|  ada_log("url_aggregator::append_base_password ", input, " ", to_string(),
 8782|    974|          "\n", to_diagram());
 8783|    974|  ADA_ASSERT_TRUE(validate());
 8784|    974|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8785|       |#if ADA_DEVELOPMENT_CHECKS
 8786|       |  // computing the expected password.
 8787|       |  std::string password_expected = std::string(get_password());
 8788|       |  password_expected.append(input);
 8789|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8790|    974|  add_authority_slashes_if_needed();
 8791|       |
 8792|       |  // If input is empty, do nothing.
 8793|    974|  if (input.empty()) {
  ------------------
  |  Branch (8793:7): [True: 417, False: 557]
  ------------------
 8794|    417|    return;
 8795|    417|  }
 8796|       |
 8797|    557|  uint32_t difference = uint32_t(input.size());
 8798|    557|  if (has_password()) {
  ------------------
  |  Branch (8798:7): [True: 486, False: 71]
  ------------------
 8799|    486|    buffer.insert(components.host_start, input);
 8800|    486|  } else {
 8801|     71|    difference++;  // Increment for ":"
 8802|     71|    buffer.insert(components.username_end, ":");
 8803|     71|    buffer.insert(components.username_end + 1, input);
 8804|     71|  }
 8805|    557|  components.host_start += difference;
 8806|       |
 8807|       |  // The following line is required to add "@" to hostname. When updating
 8808|       |  // password if hostname does not start with "@", it is "append_base_password"s
 8809|       |  // responsibility to set it.
 8810|    557|  if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (8810:7): [True: 39, False: 518]
  ------------------
 8811|     39|    buffer.insert(components.host_start, "@");
 8812|     39|    difference++;
 8813|     39|  }
 8814|       |
 8815|    557|  components.host_end += difference;
 8816|    557|  components.pathname_start += difference;
 8817|    557|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8817:7): [True: 0, False: 557]
  ------------------
 8818|      0|    components.search_start += difference;
 8819|      0|  }
 8820|    557|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8820:7): [True: 0, False: 557]
  ------------------
 8821|      0|    components.hash_start += difference;
 8822|      0|  }
 8823|       |#if ADA_DEVELOPMENT_CHECKS
 8824|       |  std::string password_after(get_password());
 8825|       |  ADA_ASSERT_EQUAL(
 8826|       |      password_expected, password_after,
 8827|       |      "append_base_password problem after inserting " + std::string(input));
 8828|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8829|    557|  ADA_ASSERT_TRUE(validate());
 8830|    557|}
_ZN3ada14url_aggregator31add_authority_slashes_if_neededEv:
 9036|  6.30k|inline void ada::url_aggregator::add_authority_slashes_if_needed() {
 9037|  6.30k|  ada_log("url_aggregator::add_authority_slashes_if_needed");
 9038|  6.30k|  ADA_ASSERT_TRUE(validate());
 9039|       |  // Protocol setter will insert `http:` to the URL. It is up to hostname setter
 9040|       |  // to insert
 9041|       |  // `//` initially to the buffer, since it depends on the hostname existence.
 9042|  6.30k|  if (has_authority()) {
  ------------------
  |  Branch (9042:7): [True: 3.91k, False: 2.39k]
  ------------------
 9043|  3.91k|    return;
 9044|  3.91k|  }
 9045|       |  // Performance: the common case is components.protocol_end == buffer.size()
 9046|       |  // Optimization opportunity: in many cases, the "//" is part of the input and
 9047|       |  // the insert could be fused with another insert.
 9048|  2.39k|  buffer.insert(components.protocol_end, "//");
 9049|  2.39k|  components.username_end += 2;
 9050|  2.39k|  components.host_start += 2;
 9051|  2.39k|  components.host_end += 2;
 9052|  2.39k|  components.pathname_start += 2;
 9053|  2.39k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9053:7): [True: 0, False: 2.39k]
  ------------------
 9054|      0|    components.search_start += 2;
 9055|      0|  }
 9056|  2.39k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9056:7): [True: 0, False: 2.39k]
  ------------------
 9057|      0|    components.hash_start += 2;
 9058|      0|  }
 9059|  2.39k|  ADA_ASSERT_TRUE(validate());
 9060|  2.39k|}
_ZN3ada14url_aggregator20append_base_usernameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8664|  2.27k|inline void url_aggregator::append_base_username(const std::string_view input) {
 8665|  2.27k|  ada_log("url_aggregator::append_base_username ", input);
 8666|  2.27k|  ADA_ASSERT_TRUE(validate());
 8667|  2.27k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8668|       |#if ADA_DEVELOPMENT_CHECKS
 8669|       |  // computing the expected password.
 8670|       |  std::string username_expected(get_username());
 8671|       |  username_expected.append(input);
 8672|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8673|  2.27k|  add_authority_slashes_if_needed();
 8674|       |
 8675|       |  // If input is empty, do nothing.
 8676|  2.27k|  if (input.empty()) {
  ------------------
  |  Branch (8676:7): [True: 967, False: 1.30k]
  ------------------
 8677|    967|    return;
 8678|    967|  }
 8679|       |
 8680|  1.30k|  uint32_t difference = uint32_t(input.size());
 8681|  1.30k|  buffer.insert(components.username_end, input);
 8682|  1.30k|  components.username_end += difference;
 8683|  1.30k|  components.host_start += difference;
 8684|       |
 8685|  1.30k|  if (buffer[components.host_start] != '@' &&
  ------------------
  |  Branch (8685:7): [True: 185, False: 1.11k]
  ------------------
 8686|    185|      components.host_start != components.host_end) {
  ------------------
  |  Branch (8686:7): [True: 185, False: 0]
  ------------------
 8687|    185|    buffer.insert(components.host_start, "@");
 8688|    185|    difference++;
 8689|    185|  }
 8690|       |
 8691|  1.30k|  components.host_end += difference;
 8692|  1.30k|  components.pathname_start += difference;
 8693|  1.30k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8693:7): [True: 0, False: 1.30k]
  ------------------
 8694|      0|    components.search_start += difference;
 8695|      0|  }
 8696|  1.30k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8696:7): [True: 0, False: 1.30k]
  ------------------
 8697|      0|    components.hash_start += difference;
 8698|      0|  }
 8699|       |#if ADA_DEVELOPMENT_CHECKS
 8700|       |  std::string username_after(get_username());
 8701|       |  ADA_ASSERT_EQUAL(
 8702|       |      username_expected, username_after,
 8703|       |      "append_base_username problem after inserting " + std::string(input));
 8704|       |#endif  // ADA_DEVELOPMENT_CHECKS
 8705|  1.30k|  ADA_ASSERT_TRUE(validate());
 8706|  1.30k|}
_ZN3ada14url_aggregator16update_base_portEj:
 8832|     46|inline void url_aggregator::update_base_port(uint32_t input) {
 8833|     46|  ada_log("url_aggregator::update_base_port");
 8834|     46|  ADA_ASSERT_TRUE(validate());
 8835|     46|  if (input == url_components::omitted) {
  ------------------
  |  Branch (8835:7): [True: 0, False: 46]
  ------------------
 8836|      0|    clear_port();
 8837|      0|    return;
 8838|      0|  }
 8839|       |  // calling std::to_string(input.value()) is unfortunate given that the port
 8840|       |  // value is probably already available as a string.
 8841|     46|  std::string value = helpers::concat(":", std::to_string(input));
 8842|     46|  uint32_t difference = uint32_t(value.size());
 8843|       |
 8844|     46|  if (components.port != url_components::omitted) {
  ------------------
  |  Branch (8844:7): [True: 0, False: 46]
  ------------------
 8845|      0|    difference -= components.pathname_start - components.host_end;
 8846|      0|    buffer.erase(components.host_end,
 8847|      0|                 components.pathname_start - components.host_end);
 8848|      0|  }
 8849|       |
 8850|     46|  buffer.insert(components.host_end, value);
 8851|     46|  components.pathname_start += difference;
 8852|     46|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8852:7): [True: 0, False: 46]
  ------------------
 8853|      0|    components.search_start += difference;
 8854|      0|  }
 8855|     46|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8855:7): [True: 0, False: 46]
  ------------------
 8856|      0|    components.hash_start += difference;
 8857|      0|  }
 8858|     46|  components.port = input;
 8859|     46|  ADA_ASSERT_TRUE(validate());
 8860|     46|}
_ZN3ada7helpers6concatIJPKcNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEESA_DpT_:
 1975|     46|std::string concat(Args... args) {
 1976|     46|  std::string answer;
 1977|     46|  inner_concat(answer, args...);
 1978|     46|  return answer;
 1979|     46|}
_ZN3ada7helpers12inner_concatIPKcJNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvRSA_T_DpT0_:
 1964|     46|inline void inner_concat(std::string& buffer, T t, Args... args) {
 1965|     46|  buffer.append(t);
 1966|     46|  return inner_concat(buffer, args...);
 1967|     46|}
_ZN3ada7helpers12inner_concatINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEJEEEvRS8_T_:
 1956|     46|inline void inner_concat(std::string& buffer, T t) {
 1957|     46|  buffer.append(t);
 1958|     46|}
_ZN3ada14url_aggregator18update_base_searchENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8503|    628|    std::string_view input, const uint8_t query_percent_encode_set[]) {
 8504|    628|  ada_log("url_aggregator::update_base_search ", input,
 8505|    628|          " with encoding parameter ", to_string(), "\n", to_diagram());
 8506|    628|  ADA_ASSERT_TRUE(validate());
 8507|    628|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8508|       |
 8509|    628|  if (components.hash_start == url_components::omitted) {
  ------------------
  |  Branch (8509:7): [True: 628, False: 0]
  ------------------
 8510|    628|    if (components.search_start == url_components::omitted) {
  ------------------
  |  Branch (8510:9): [True: 628, False: 0]
  ------------------
 8511|    628|      components.search_start = uint32_t(buffer.size());
 8512|    628|      buffer += "?";
 8513|    628|    } else {
 8514|      0|      buffer.resize(components.search_start + 1);
 8515|      0|    }
 8516|       |
 8517|    628|    bool encoding_required =
 8518|    628|        unicode::percent_encode<true>(input, query_percent_encode_set, buffer);
 8519|       |    // When encoding_required is false, then buffer is left unchanged, and
 8520|       |    // percent encoding was not deemed required.
 8521|    628|    if (!encoding_required) {
  ------------------
  |  Branch (8521:9): [True: 518, False: 110]
  ------------------
 8522|    518|      buffer.append(input);
 8523|    518|    }
 8524|    628|  } else {
 8525|      0|    const size_t idx =
 8526|      0|        ada::unicode::percent_encode_index(input, query_percent_encode_set);
 8527|      0|    std::string encoded;
 8528|      0|    std::string_view replacement = input;
 8529|      0|    if (idx != input.size()) {
  ------------------
  |  Branch (8529:9): [True: 0, False: 0]
  ------------------
 8530|      0|      encoded =
 8531|      0|          ada::unicode::percent_encode(input, query_percent_encode_set, idx);
 8532|      0|      replacement = encoded;
 8533|      0|    }
 8534|       |
 8535|      0|    if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8535:9): [True: 0, False: 0]
  ------------------
 8536|      0|      const uint32_t difference = replace_and_resize(
 8537|      0|          components.search_start + 1, components.hash_start, replacement);
 8538|      0|      components.hash_start += difference;
 8539|      0|    } else {
 8540|      0|      components.search_start = components.hash_start;
 8541|      0|      buffer.insert(components.search_start, replacement.size() + 1, '?');
 8542|      0|      if (!replacement.empty()) {
  ------------------
  |  Branch (8542:11): [True: 0, False: 0]
  ------------------
 8543|      0|        std::memmove(buffer.data() + components.search_start + 1,
 8544|      0|                     replacement.data(), replacement.size());
 8545|      0|      }
 8546|      0|      components.hash_start +=
 8547|      0|          uint32_t(replacement.size() + 1);  // Do not forget `?`
 8548|      0|    }
 8549|      0|  }
 8550|       |
 8551|    628|  ADA_ASSERT_TRUE(validate());
 8552|    628|}
_ZN3ada14url_aggregator20update_base_hostnameENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 8418|  3.06k|inline void url_aggregator::update_base_hostname(const std::string_view input) {
 8419|  3.06k|  ada_log("url_aggregator::update_base_hostname ", input, " [", input.size(),
 8420|  3.06k|          " bytes], buffer is '", buffer, "' [", buffer.size(), " bytes]");
 8421|  3.06k|  ADA_ASSERT_TRUE(validate());
 8422|  3.06k|  ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
 8423|       |
 8424|       |  // This next line is required for when parsing a URL like `foo://`
 8425|  3.06k|  add_authority_slashes_if_needed();
 8426|       |
 8427|  3.06k|  bool has_credentials = components.protocol_end + 2 < components.host_start;
 8428|  3.06k|  uint32_t new_difference =
 8429|  3.06k|      replace_and_resize(components.host_start, components.host_end, input);
 8430|       |
 8431|  3.06k|  if (has_credentials) {
  ------------------
  |  Branch (8431:7): [True: 284, False: 2.77k]
  ------------------
 8432|    284|    buffer.insert(components.host_start, "@");
 8433|    284|    new_difference++;
 8434|    284|  }
 8435|  3.06k|  components.host_end += new_difference;
 8436|  3.06k|  components.pathname_start += new_difference;
 8437|  3.06k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8437:7): [True: 0, False: 3.06k]
  ------------------
 8438|      0|    components.search_start += new_difference;
 8439|      0|  }
 8440|  3.06k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8440:7): [True: 0, False: 3.06k]
  ------------------
 8441|      0|    components.hash_start += new_difference;
 8442|      0|  }
 8443|  3.06k|  ADA_ASSERT_TRUE(validate());
 8444|  3.06k|}
_ZN3ada14url_aggregator10parse_portENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEb:
 9150|    569|url_aggregator::parse_port(std::string_view view, bool check_trailing_content) {
 9151|    569|  ada_log("url_aggregator::parse_port('", view, "') ", view.size());
 9152|    569|  if (!view.empty() && view[0] == '-') {
  ------------------
  |  Branch (9152:7): [True: 566, False: 3]
  |  Branch (9152:24): [True: 1, False: 565]
  ------------------
 9153|      1|    ada_log("parse_port: view[0] == '0' && view.size() > 1");
 9154|      1|    is_valid = false;
 9155|      1|    return 0;
 9156|      1|  }
 9157|    568|  uint16_t parsed_port{};
 9158|    568|  auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
 9159|    568|  if (r.ec == std::errc::result_out_of_range) {
  ------------------
  |  Branch (9159:7): [True: 19, False: 549]
  ------------------
 9160|     19|    ada_log("parse_port: r.ec == std::errc::result_out_of_range");
 9161|     19|    is_valid = false;
 9162|     19|    return 0;
 9163|     19|  }
 9164|    549|  ada_log("parse_port: ", parsed_port);
 9165|    549|  const size_t consumed = size_t(r.ptr - view.data());
 9166|    549|  ada_log("parse_port: consumed ", consumed);
 9167|    549|  if (check_trailing_content) {
  ------------------
  |  Branch (9167:7): [True: 549, False: 0]
  ------------------
 9168|    549|    is_valid &=
 9169|    549|        (consumed == view.size() || view[consumed] == '/' ||
  ------------------
  |  Branch (9169:10): [True: 16, False: 533]
  |  Branch (9169:37): [True: 42, False: 491]
  ------------------
 9170|    491|         view[consumed] == '?' || (is_special() && view[consumed] == '\\'));
  ------------------
  |  Branch (9170:10): [True: 11, False: 480]
  |  Branch (9170:36): [True: 480, False: 0]
  |  Branch (9170:52): [True: 0, False: 480]
  ------------------
 9171|    549|  }
 9172|    549|  ada_log("parse_port: is_valid = ", is_valid);
 9173|    549|  if (is_valid) {
  ------------------
  |  Branch (9173:7): [True: 69, False: 480]
  ------------------
 9174|     69|    ada_log("parse_port", r.ec == std::errc());
 9175|       |    // scheme_default_port can return 0, and we should allow 0 as a base port.
 9176|     69|    auto default_port = scheme_default_port();
 9177|     69|    bool is_port_valid = (default_port == 0 && parsed_port == 0) ||
  ------------------
  |  Branch (9177:27): [True: 0, False: 69]
  |  Branch (9177:48): [True: 0, False: 0]
  ------------------
 9178|     69|                         (default_port != parsed_port);
  ------------------
  |  Branch (9178:26): [True: 68, False: 1]
  ------------------
 9179|     69|    if (r.ec == std::errc() && is_port_valid) {
  ------------------
  |  Branch (9179:9): [True: 47, False: 22]
  |  Branch (9179:32): [True: 46, False: 1]
  ------------------
 9180|     46|      update_base_port(parsed_port);
 9181|     46|    } else {
 9182|     23|      clear_port();
 9183|     23|    }
 9184|     69|  }
 9185|    549|  return consumed;
 9186|    568|}
_ZN3ada7unicode20percent_encode_indexENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPKh:
 8273|  7.13k|                                              const uint8_t character_set[]) {
 8274|  7.13k|  const char* data = input.data();
 8275|  7.13k|  const size_t size = input.size();
 8276|       |
 8277|       |  // Process 8 bytes at a time using unrolled loop
 8278|  7.13k|  size_t i = 0;
 8279|  7.57k|  for (; i + 8 <= size; i += 8) {
  ------------------
  |  Branch (8279:10): [True: 669, False: 6.91k]
  ------------------
 8280|    669|    unsigned char chunk[8];
 8281|    669|    std::memcpy(&chunk, data + i,
 8282|    669|                8);  // entices compiler to unconditionally process 8 characters
 8283|       |
 8284|       |    // Check 8 characters at once
 8285|  4.59k|    for (size_t j = 0; j < 8; j++) {
  ------------------
  |  Branch (8285:24): [True: 4.14k, False: 448]
  ------------------
 8286|  4.14k|      if (character_sets::bit_at(character_set, chunk[j])) {
  ------------------
  |  Branch (8286:11): [True: 221, False: 3.92k]
  ------------------
 8287|    221|        return i + j;
 8288|    221|      }
 8289|  4.14k|    }
 8290|    669|  }
 8291|       |
 8292|       |  // Handle remaining bytes
 8293|  7.33k|  for (; i < size; i++) {
  ------------------
  |  Branch (8293:10): [True: 578, False: 6.75k]
  ------------------
 8294|    578|    if (character_sets::bit_at(character_set, data[i])) {
  ------------------
  |  Branch (8294:9): [True: 157, False: 421]
  ------------------
 8295|    157|      return i;
 8296|    157|    }
 8297|    578|  }
 8298|       |
 8299|  6.75k|  return size;
 8300|  6.91k|}
_ZN3ada14url_aggregator10clear_portEv:
 8862|     23|inline void url_aggregator::clear_port() {
 8863|     23|  ada_log("url_aggregator::clear_port");
 8864|     23|  ADA_ASSERT_TRUE(validate());
 8865|     23|  if (components.port == url_components::omitted) {
  ------------------
  |  Branch (8865:7): [True: 23, False: 0]
  ------------------
 8866|     23|    return;
 8867|     23|  }
 8868|      0|  uint32_t length = components.pathname_start - components.host_end;
 8869|      0|  buffer.erase(components.host_end, length);
 8870|      0|  components.pathname_start -= length;
 8871|      0|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (8871:7): [True: 0, False: 0]
  ------------------
 8872|      0|    components.search_start -= length;
 8873|      0|  }
 8874|      0|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (8874:7): [True: 0, False: 0]
  ------------------
 8875|      0|    components.hash_start -= length;
 8876|      0|  }
 8877|      0|  components.port = url_components::omitted;
 8878|      0|  ADA_ASSERT_TRUE(validate());
 8879|      0|}
_ZNK3ada14url_aggregator13has_authorityEv:
 9027|  6.48k|    const noexcept {
 9028|  6.48k|  ada_log("url_aggregator::has_authority");
 9029|       |  // Performance: instead of doing this potentially expensive check, we could
 9030|       |  // have a boolean in the struct.
 9031|  6.48k|  return components.protocol_end + 2 <= components.host_start &&
  ------------------
  |  Branch (9031:10): [True: 4.09k, False: 2.39k]
  ------------------
 9032|  4.09k|         buffer[components.protocol_end] == '/' &&
  ------------------
  |  Branch (9032:10): [True: 4.09k, False: 0]
  ------------------
 9033|  4.09k|         buffer[components.protocol_end + 1] == '/';
  ------------------
  |  Branch (9033:10): [True: 4.09k, False: 0]
  ------------------
 9034|  6.48k|}
_ZNK3ada14url_aggregator12has_dash_dotEv:
 9107|  1.19k|[[nodiscard]] constexpr bool url_aggregator::has_dash_dot() const noexcept {
 9108|       |  // If url's host is null, url does not have an opaque path, url's path's size
 9109|       |  // is greater than 1, and url's path[0] is the empty string, then append
 9110|       |  // U+002F (/) followed by U+002E (.) to output.
 9111|  1.19k|  ada_log("url_aggregator::has_dash_dot");
 9112|       |#if ADA_DEVELOPMENT_CHECKS
 9113|       |  // If pathname_start and host_end are exactly two characters apart, then we
 9114|       |  // either have a one-digit port such as http://test.com:5?param=1 or else we
 9115|       |  // have a /.: sequence such as "non-spec:/.//". We test that this is the case.
 9116|       |  if (components.pathname_start == components.host_end + 2) {
 9117|       |    ADA_ASSERT_TRUE((buffer[components.host_end] == '/' &&
 9118|       |                     buffer[components.host_end + 1] == '.') ||
 9119|       |                    (buffer[components.host_end] == ':' &&
 9120|       |                     checkers::is_digit(buffer[components.host_end + 1])));
 9121|       |  }
 9122|       |  if (components.pathname_start == components.host_end + 2 &&
 9123|       |      buffer[components.host_end] == '/' &&
 9124|       |      buffer[components.host_end + 1] == '.') {
 9125|       |    ADA_ASSERT_TRUE(components.pathname_start + 1 < buffer.size());
 9126|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start] == '/');
 9127|       |    ADA_ASSERT_TRUE(buffer[components.pathname_start + 1] == '/');
 9128|       |  }
 9129|       |#endif
 9130|       |  // Performance: it should be uncommon for components.pathname_start ==
 9131|       |  // components.host_end + 2 to be true. So we put this check first in the
 9132|       |  // sequence. Most times, we do not have an opaque path. Checking for '/.' is
 9133|       |  // more expensive, but should be uncommon.
 9134|  1.19k|  return components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9134:10): [True: 19, False: 1.17k]
  ------------------
 9135|     19|         !has_opaque_path && buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9135:10): [True: 19, False: 0]
  |  Branch (9135:30): [True: 0, False: 19]
  ------------------
 9136|      0|         buffer[components.host_end + 1] == '.';
  ------------------
  |  Branch (9136:10): [True: 0, False: 0]
  ------------------
 9137|  1.19k|}
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEcvbEv:
 4081|  13.4k|  constexpr explicit operator bool() const noexcept { return this->m_has_val; }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEEptEv:
 4050|  2.77k|  TL_EXPECTED_11_CONSTEXPR T* operator->() {
 4051|  2.77k|    TL_ASSERT(has_value());
  ------------------
  |  | 2103|  2.77k|#define TL_ASSERT(x) assert(x)
  ------------------
  |  Branch (4051:5): [True: 2.77k, False: 0]
  ------------------
 4052|  2.77k|    return valptr();
 4053|  2.77k|  }
_ZN2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE6valptrEv:
 3346|  2.77k|  T* valptr() { return std::addressof(this->m_val); }
_ZNK2tl8expectedIN3ada14url_aggregatorENS1_6errorsEE9has_valueEv:
 4080|  2.77k|  constexpr bool has_value() const noexcept { return this->m_has_val; }
_ZN2tl6detail21expected_storage_baseIN3ada14url_aggregatorENS2_6errorsELb0ELb1EED2Ev:
 2678|  13.4k|  ~expected_storage_base() {
 2679|  13.4k|    if (m_has_val) {
  ------------------
  |  Branch (2679:9): [True: 2.45k, False: 10.9k]
  ------------------
 2680|  2.45k|      m_val.~T();
 2681|  2.45k|    }
 2682|  13.4k|  }
_ZN3ada7helpers9substringENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEmm:
 1897|  4.30k|                                                       size_t pos2) {
 1898|       |#if ADA_DEVELOPMENT_CHECKS
 1899|       |  if (pos2 < pos1) {
 1900|       |    std::cerr << "Negative-length substring: [" << pos1 << " to " << pos2 << ")"
 1901|       |              << std::endl;
 1902|       |    abort();
 1903|       |  }
 1904|       |#endif
 1905|  4.30k|  return input.substr(pos1, pos2 - pos1);
 1906|  4.30k|}
_ZNK3ada14url_aggregator10is_at_pathEv:
 8459|    780|    const noexcept {
 8460|    780|  return buffer.size() == components.pathname_start;
 8461|    780|}
_ZNK3ada14url_aggregator12has_passwordEv:
 9076|    557|constexpr bool url_aggregator::has_password() const noexcept {
 9077|    557|  ada_log("url_aggregator::has_password");
 9078|       |  // This function does not care about the length of the password
 9079|    557|  return components.host_start > components.username_end &&
  ------------------
  |  Branch (9079:10): [True: 486, False: 71]
  ------------------
 9080|    486|         buffer[components.username_end] == ':';
  ------------------
  |  Branch (9080:10): [True: 486, False: 0]
  ------------------
 9081|    557|}
_ZNK3ada14url_aggregator8validateEv:
 9218|  2.45k|[[nodiscard]] constexpr bool url_aggregator::validate() const noexcept {
 9219|  2.45k|  if (!is_valid) {
  ------------------
  |  Branch (9219:7): [True: 0, False: 2.45k]
  ------------------
 9220|      0|    return true;
 9221|      0|  }
 9222|  2.45k|  if (!components.check_offset_consistency()) {
  ------------------
  |  Branch (9222:7): [True: 0, False: 2.45k]
  ------------------
 9223|      0|    ada_log("url_aggregator::validate inconsistent components \n",
 9224|      0|            to_diagram());
 9225|      0|    return false;
 9226|      0|  }
 9227|       |  // We have a credible components struct, but let us investivate more
 9228|       |  // carefully:
 9229|       |  /**
 9230|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 9231|       |   *       |     |    |          | ^^^^|       |   |
 9232|       |   *       |     |    |          | |   |       |   `----- hash_start
 9233|       |   *       |     |    |          | |   |       `--------- search_start
 9234|       |   *       |     |    |          | |   `----------------- pathname_start
 9235|       |   *       |     |    |          | `--------------------- port
 9236|       |   *       |     |    |          `----------------------- host_end
 9237|       |   *       |     |    `---------------------------------- host_start
 9238|       |   *       |     `--------------------------------------- username_end
 9239|       |   *       `--------------------------------------------- protocol_end
 9240|       |   */
 9241|  2.45k|  if (components.protocol_end == url_components::omitted) {
  ------------------
  |  Branch (9241:7): [True: 0, False: 2.45k]
  ------------------
 9242|      0|    ada_log("url_aggregator::validate omitted protocol_end \n", to_diagram());
 9243|      0|    return false;
 9244|      0|  }
 9245|  2.45k|  if (components.username_end == url_components::omitted) {
  ------------------
  |  Branch (9245:7): [True: 0, False: 2.45k]
  ------------------
 9246|      0|    ada_log("url_aggregator::validate omitted username_end \n", to_diagram());
 9247|      0|    return false;
 9248|      0|  }
 9249|  2.45k|  if (components.host_start == url_components::omitted) {
  ------------------
  |  Branch (9249:7): [True: 0, False: 2.45k]
  ------------------
 9250|      0|    ada_log("url_aggregator::validate omitted host_start \n", to_diagram());
 9251|      0|    return false;
 9252|      0|  }
 9253|  2.45k|  if (components.host_end == url_components::omitted) {
  ------------------
  |  Branch (9253:7): [True: 0, False: 2.45k]
  ------------------
 9254|      0|    ada_log("url_aggregator::validate omitted host_end \n", to_diagram());
 9255|      0|    return false;
 9256|      0|  }
 9257|  2.45k|  if (components.pathname_start == url_components::omitted) {
  ------------------
  |  Branch (9257:7): [True: 0, False: 2.45k]
  ------------------
 9258|      0|    ada_log("url_aggregator::validate omitted pathname_start \n", to_diagram());
 9259|      0|    return false;
 9260|      0|  }
 9261|       |
 9262|  2.45k|  if (components.protocol_end > buffer.size()) {
  ------------------
  |  Branch (9262:7): [True: 0, False: 2.45k]
  ------------------
 9263|      0|    ada_log("url_aggregator::validate protocol_end overflow \n", to_diagram());
 9264|      0|    return false;
 9265|      0|  }
 9266|  2.45k|  if (components.username_end > buffer.size()) {
  ------------------
  |  Branch (9266:7): [True: 0, False: 2.45k]
  ------------------
 9267|      0|    ada_log("url_aggregator::validate username_end overflow \n", to_diagram());
 9268|      0|    return false;
 9269|      0|  }
 9270|  2.45k|  if (components.host_start > buffer.size()) {
  ------------------
  |  Branch (9270:7): [True: 0, False: 2.45k]
  ------------------
 9271|      0|    ada_log("url_aggregator::validate host_start overflow \n", to_diagram());
 9272|      0|    return false;
 9273|      0|  }
 9274|  2.45k|  if (components.host_end > buffer.size()) {
  ------------------
  |  Branch (9274:7): [True: 0, False: 2.45k]
  ------------------
 9275|      0|    ada_log("url_aggregator::validate host_end overflow \n", to_diagram());
 9276|      0|    return false;
 9277|      0|  }
 9278|  2.45k|  if (components.pathname_start > buffer.size()) {
  ------------------
  |  Branch (9278:7): [True: 0, False: 2.45k]
  ------------------
 9279|      0|    ada_log("url_aggregator::validate pathname_start overflow \n",
 9280|      0|            to_diagram());
 9281|      0|    return false;
 9282|      0|  }
 9283|       |
 9284|  2.45k|  if (components.protocol_end > 0) {
  ------------------
  |  Branch (9284:7): [True: 2.45k, False: 0]
  ------------------
 9285|  2.45k|    if (buffer[components.protocol_end - 1] != ':') {
  ------------------
  |  Branch (9285:9): [True: 0, False: 2.45k]
  ------------------
 9286|      0|      ada_log(
 9287|      0|          "url_aggregator::validate missing : at the end of the protocol \n",
 9288|      0|          to_diagram());
 9289|      0|      return false;
 9290|      0|    }
 9291|  2.45k|  }
 9292|       |
 9293|  2.45k|  if (components.username_end != buffer.size() &&
  ------------------
  |  Branch (9293:7): [True: 2.45k, False: 0]
  ------------------
 9294|  2.45k|      components.username_end > components.protocol_end + 2) {
  ------------------
  |  Branch (9294:7): [True: 85, False: 2.37k]
  ------------------
 9295|     85|    if (buffer[components.username_end] != ':' &&
  ------------------
  |  Branch (9295:9): [True: 73, False: 12]
  ------------------
 9296|     73|        buffer[components.username_end] != '@') {
  ------------------
  |  Branch (9296:9): [True: 0, False: 73]
  ------------------
 9297|      0|      ada_log(
 9298|      0|          "url_aggregator::validate missing : or @ at the end of the username "
 9299|      0|          "\n",
 9300|      0|          to_diagram());
 9301|      0|      return false;
 9302|      0|    }
 9303|     85|  }
 9304|       |
 9305|  2.45k|  if (components.host_start != buffer.size()) {
  ------------------
  |  Branch (9305:7): [True: 2.45k, False: 0]
  ------------------
 9306|  2.45k|    if (components.host_start > components.username_end) {
  ------------------
  |  Branch (9306:9): [True: 21, False: 2.43k]
  ------------------
 9307|     21|      if (buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9307:11): [True: 0, False: 21]
  ------------------
 9308|      0|        ada_log(
 9309|      0|            "url_aggregator::validate missing @ at the end of the password \n",
 9310|      0|            to_diagram());
 9311|      0|        return false;
 9312|      0|      }
 9313|  2.43k|    } else if (components.host_start == components.username_end &&
  ------------------
  |  Branch (9313:16): [True: 2.43k, False: 0]
  ------------------
 9314|  2.43k|               components.host_end > components.host_start) {
  ------------------
  |  Branch (9314:16): [True: 2.43k, False: 0]
  ------------------
 9315|  2.43k|      if (components.host_start == components.protocol_end + 2) {
  ------------------
  |  Branch (9315:11): [True: 2.36k, False: 73]
  ------------------
 9316|  2.36k|        if (buffer[components.protocol_end] != '/' ||
  ------------------
  |  Branch (9316:13): [True: 0, False: 2.36k]
  ------------------
 9317|  2.36k|            buffer[components.protocol_end + 1] != '/') {
  ------------------
  |  Branch (9317:13): [True: 0, False: 2.36k]
  ------------------
 9318|      0|          ada_log(
 9319|      0|              "url_aggregator::validate missing // between protocol and host "
 9320|      0|              "\n",
 9321|      0|              to_diagram());
 9322|      0|          return false;
 9323|      0|        }
 9324|  2.36k|      } else {
 9325|     73|        if (components.host_start > components.protocol_end &&
  ------------------
  |  Branch (9325:13): [True: 73, False: 0]
  ------------------
 9326|     73|            buffer[components.host_start] != '@') {
  ------------------
  |  Branch (9326:13): [True: 0, False: 73]
  ------------------
 9327|      0|          ada_log(
 9328|      0|              "url_aggregator::validate missing @ at the end of the username "
 9329|      0|              "\n",
 9330|      0|              to_diagram());
 9331|      0|          return false;
 9332|      0|        }
 9333|     73|      }
 9334|  2.43k|    } else {
 9335|      0|      if (components.host_end != components.host_start) {
  ------------------
  |  Branch (9335:11): [True: 0, False: 0]
  ------------------
 9336|      0|        ada_log("url_aggregator::validate expected omitted host \n",
 9337|      0|                to_diagram());
 9338|      0|        return false;
 9339|      0|      }
 9340|      0|    }
 9341|  2.45k|  }
 9342|  2.45k|  if (components.host_end != buffer.size() &&
  ------------------
  |  Branch (9342:7): [True: 2.45k, False: 0]
  ------------------
 9343|  2.45k|      components.pathname_start > components.host_end) {
  ------------------
  |  Branch (9343:7): [True: 133, False: 2.32k]
  ------------------
 9344|    133|    if (components.pathname_start == components.host_end + 2 &&
  ------------------
  |  Branch (9344:9): [True: 25, False: 108]
  ------------------
 9345|     25|        buffer[components.host_end] == '/' &&
  ------------------
  |  Branch (9345:9): [True: 0, False: 25]
  ------------------
 9346|      0|        buffer[components.host_end + 1] == '.') {
  ------------------
  |  Branch (9346:9): [True: 0, False: 0]
  ------------------
 9347|      0|      if (components.pathname_start + 1 >= buffer.size() ||
  ------------------
  |  Branch (9347:11): [True: 0, False: 0]
  ------------------
 9348|      0|          buffer[components.pathname_start] != '/' ||
  ------------------
  |  Branch (9348:11): [True: 0, False: 0]
  ------------------
 9349|      0|          buffer[components.pathname_start + 1] != '/') {
  ------------------
  |  Branch (9349:11): [True: 0, False: 0]
  ------------------
 9350|      0|        ada_log(
 9351|      0|            "url_aggregator::validate expected the path to begin with // \n",
 9352|      0|            to_diagram());
 9353|      0|        return false;
 9354|      0|      }
 9355|    133|    } else if (buffer[components.host_end] != ':') {
  ------------------
  |  Branch (9355:16): [True: 0, False: 133]
  ------------------
 9356|      0|      ada_log("url_aggregator::validate missing : at the port \n",
 9357|      0|              to_diagram());
 9358|      0|      return false;
 9359|      0|    }
 9360|    133|  }
 9361|  2.45k|  if (components.pathname_start != buffer.size() &&
  ------------------
  |  Branch (9361:7): [True: 2.45k, False: 0]
  ------------------
 9362|  2.45k|      components.pathname_start < components.search_start &&
  ------------------
  |  Branch (9362:7): [True: 2.45k, False: 0]
  ------------------
 9363|  2.45k|      components.pathname_start < components.hash_start && !has_opaque_path) {
  ------------------
  |  Branch (9363:7): [True: 2.45k, False: 0]
  |  Branch (9363:60): [True: 2.45k, False: 0]
  ------------------
 9364|  2.45k|    if (buffer[components.pathname_start] != '/') {
  ------------------
  |  Branch (9364:9): [True: 0, False: 2.45k]
  ------------------
 9365|      0|      ada_log("url_aggregator::validate missing / at the path \n",
 9366|      0|              to_diagram());
 9367|      0|      return false;
 9368|      0|    }
 9369|  2.45k|  }
 9370|  2.45k|  if (components.search_start != url_components::omitted) {
  ------------------
  |  Branch (9370:7): [True: 701, False: 1.75k]
  ------------------
 9371|    701|    if (buffer[components.search_start] != '?') {
  ------------------
  |  Branch (9371:9): [True: 0, False: 701]
  ------------------
 9372|      0|      ada_log("url_aggregator::validate missing ? at the search \n",
 9373|      0|              to_diagram());
 9374|      0|      return false;
 9375|      0|    }
 9376|    701|  }
 9377|  2.45k|  if (components.hash_start != url_components::omitted) {
  ------------------
  |  Branch (9377:7): [True: 363, False: 2.09k]
  ------------------
 9378|    363|    if (buffer[components.hash_start] != '#') {
  ------------------
  |  Branch (9378:9): [True: 0, False: 363]
  ------------------
 9379|      0|      ada_log("url_aggregator::validate missing # at the hash \n",
 9380|      0|              to_diagram());
 9381|      0|      return false;
 9382|      0|    }
 9383|    363|  }
 9384|       |
 9385|  2.45k|  return true;
 9386|  2.45k|}
_ZNK3ada14url_components24check_offset_consistencyEv:
 7712|  2.45k|    const noexcept {
 7713|       |  /**
 7714|       |   * https://user:pass@example.com:1234/foo/bar?baz#quux
 7715|       |   *       |     |    |          | ^^^^|       |   |
 7716|       |   *       |     |    |          | |   |       |   `----- hash_start
 7717|       |   *       |     |    |          | |   |       `--------- search_start
 7718|       |   *       |     |    |          | |   `----------------- pathname_start
 7719|       |   *       |     |    |          | `--------------------- port
 7720|       |   *       |     |    |          `----------------------- host_end
 7721|       |   *       |     |    `---------------------------------- host_start
 7722|       |   *       |     `--------------------------------------- username_end
 7723|       |   *       `--------------------------------------------- protocol_end
 7724|       |   */
 7725|       |  // These conditions can be made more strict.
 7726|  2.45k|  if (protocol_end == url_components::omitted) {
  ------------------
  |  Branch (7726:7): [True: 0, False: 2.45k]
  ------------------
 7727|      0|    return false;
 7728|      0|  }
 7729|  2.45k|  uint32_t index = protocol_end;
 7730|       |
 7731|  2.45k|  if (username_end == url_components::omitted) {
  ------------------
  |  Branch (7731:7): [True: 0, False: 2.45k]
  ------------------
 7732|      0|    return false;
 7733|      0|  }
 7734|  2.45k|  if (username_end < index) {
  ------------------
  |  Branch (7734:7): [True: 0, False: 2.45k]
  ------------------
 7735|      0|    return false;
 7736|      0|  }
 7737|  2.45k|  index = username_end;
 7738|       |
 7739|  2.45k|  if (host_start == url_components::omitted) {
  ------------------
  |  Branch (7739:7): [True: 0, False: 2.45k]
  ------------------
 7740|      0|    return false;
 7741|      0|  }
 7742|  2.45k|  if (host_start < index) {
  ------------------
  |  Branch (7742:7): [True: 0, False: 2.45k]
  ------------------
 7743|      0|    return false;
 7744|      0|  }
 7745|  2.45k|  index = host_start;
 7746|       |
 7747|  2.45k|  if (port != url_components::omitted) {
  ------------------
  |  Branch (7747:7): [True: 133, False: 2.32k]
  ------------------
 7748|    133|    if (port > 0xffff) {
  ------------------
  |  Branch (7748:9): [True: 0, False: 133]
  ------------------
 7749|      0|      return false;
 7750|      0|    }
 7751|    133|    uint32_t port_length = helpers::fast_digit_count(port) + 1;
 7752|    133|    if (index + port_length < index) {
  ------------------
  |  Branch (7752:9): [True: 0, False: 133]
  ------------------
 7753|      0|      return false;
 7754|      0|    }
 7755|    133|    index += port_length;
 7756|    133|  }
 7757|       |
 7758|  2.45k|  if (pathname_start == url_components::omitted) {
  ------------------
  |  Branch (7758:7): [True: 0, False: 2.45k]
  ------------------
 7759|      0|    return false;
 7760|      0|  }
 7761|  2.45k|  if (pathname_start < index) {
  ------------------
  |  Branch (7761:7): [True: 0, False: 2.45k]
  ------------------
 7762|      0|    return false;
 7763|      0|  }
 7764|  2.45k|  index = pathname_start;
 7765|       |
 7766|  2.45k|  if (search_start != url_components::omitted) {
  ------------------
  |  Branch (7766:7): [True: 701, False: 1.75k]
  ------------------
 7767|    701|    if (search_start < index) {
  ------------------
  |  Branch (7767:9): [True: 0, False: 701]
  ------------------
 7768|      0|      return false;
 7769|      0|    }
 7770|    701|    index = search_start;
 7771|    701|  }
 7772|       |
 7773|  2.45k|  if (hash_start != url_components::omitted) {
  ------------------
  |  Branch (7773:7): [True: 363, False: 2.09k]
  ------------------
 7774|    363|    if (hash_start < index) {
  ------------------
  |  Branch (7774:9): [True: 0, False: 363]
  ------------------
 7775|      0|      return false;
 7776|      0|    }
 7777|    363|  }
 7778|       |
 7779|  2.45k|  return true;
 7780|  2.45k|}
_ZN3ada7helpers16fast_digit_countEj:
 2001|    133|inline int fast_digit_count(uint32_t x) noexcept {
 2002|    133|  auto int_log2 = [](uint32_t z) -> int {
 2003|    133|    return 31 - ada::helpers::leading_zeroes(z | 1);
 2004|    133|  };
 2005|       |  // Compiles to very few instructions. Note that the
 2006|       |  // table is static and thus effectively a constant.
 2007|       |  // We leave it inside the function because it is meaningless
 2008|       |  // outside of it (this comes at no performance cost).
 2009|    133|  const static uint64_t table[] = {
 2010|    133|      4294967296,  8589934582,  8589934582,  8589934582,  12884901788,
 2011|    133|      12884901788, 12884901788, 17179868184, 17179868184, 17179868184,
 2012|    133|      21474826480, 21474826480, 21474826480, 21474826480, 25769703776,
 2013|    133|      25769703776, 25769703776, 30063771072, 30063771072, 30063771072,
 2014|    133|      34349738368, 34349738368, 34349738368, 34349738368, 38554705664,
 2015|    133|      38554705664, 38554705664, 41949672960, 41949672960, 41949672960,
 2016|    133|      42949672960, 42949672960};
 2017|    133|  return int((x + table[int_log2(x)]) >> 32);
 2018|    133|}
_ZZN3ada7helpers16fast_digit_countEjENKUljE_clEj:
 2002|    133|  auto int_log2 = [](uint32_t z) -> int {
 2003|    133|    return 31 - ada::helpers::leading_zeroes(z | 1);
 2004|    133|  };

LLVMFuzzerTestOneInput:
   21|  7.13k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   22|  7.13k|  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|  7.13k|  uint64_t ipv4_addr = fdp.ConsumeIntegral<uint64_t>();
   28|  7.13k|  std::string ipv4_str = ada::serializers::ipv4(ipv4_addr);
   29|  7.13k|  volatile size_t ipv4_len = ipv4_str.size();
   30|  7.13k|  (void)ipv4_len;
   31|       |
   32|       |  // ===== IPv6 Serialization =====
   33|  7.13k|  std::array<uint16_t, 8> ipv6_addr{};
   34|  57.0k|  for (auto& piece : ipv6_addr) {
  ------------------
  |  Branch (34:20): [True: 57.0k, False: 7.13k]
  ------------------
   35|  57.0k|    piece = fdp.ConsumeIntegral<uint16_t>();
   36|  57.0k|  }
   37|       |
   38|       |  // find_longest_sequence_of_ipv6_pieces: basic invariants must hold.
   39|  7.13k|  size_t compress = 0, compress_length = 0;
   40|  7.13k|  ada::serializers::find_longest_sequence_of_ipv6_pieces(ipv6_addr, compress,
   41|  7.13k|                                                         compress_length);
   42|       |  // The longest run cannot exceed 8 pieces.
   43|  7.13k|  assert(compress_length <= 8);
  ------------------
  |  Branch (43:3): [True: 7.13k, False: 0]
  ------------------
   44|       |  // If a run was found (length > 0) its start index must be in-bounds.
   45|  7.13k|  if (compress_length > 0) {
  ------------------
  |  Branch (45:7): [True: 2.02k, False: 5.10k]
  ------------------
   46|  2.02k|    assert(compress < 8);
  ------------------
  |  Branch (46:5): [True: 2.02k, False: 0]
  ------------------
   47|  2.02k|    assert(compress + compress_length <= 8);
  ------------------
  |  Branch (47:5): [True: 2.02k, False: 0]
  ------------------
   48|  2.02k|  }
   49|       |
   50|  7.13k|  std::string ipv6_str = ada::serializers::ipv6(ipv6_addr);
   51|  7.13k|  volatile size_t ipv6_len = ipv6_str.size();
   52|  7.13k|  (void)ipv6_len;
   53|       |
   54|       |  // Serialized IPv6 must always be a non-empty string.
   55|  7.13k|  assert(!ipv6_str.empty());
  ------------------
  |  Branch (55:3): [True: 7.13k, 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|  7.13k|  {
   62|  7.13k|    std::string ip_candidate = fdp.ConsumeRandomLengthString(32);
   63|  7.13k|    uint64_t fast_result = ada::checkers::try_parse_ipv4_fast(ip_candidate);
   64|  7.13k|    if (fast_result <= 0xFFFFFFFF) {
  ------------------
  |  Branch (64:9): [True: 81, False: 7.05k]
  ------------------
   65|       |      // Serialize the parsed address and re-parse.
   66|     81|      std::string canonical = ada::serializers::ipv4(fast_result);
   67|     81|      uint64_t recheck = ada::checkers::try_parse_ipv4_fast(canonical);
   68|     81|      if (recheck != fast_result) {
  ------------------
  |  Branch (68:11): [True: 0, False: 81]
  ------------------
   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|     81|    }
   77|  7.13k|  }
   78|       |
   79|       |  // ===== Percent Encode / Decode =====
   80|  7.13k|  {
   81|  7.13k|    std::string source = fdp.ConsumeRandomLengthString(128);
   82|       |
   83|       |    // Exercise all six standard character sets used by the URL parser.
   84|  7.13k|    const uint8_t* sets[] = {
   85|  7.13k|        ada::character_sets::C0_CONTROL_PERCENT_ENCODE,
   86|  7.13k|        ada::character_sets::PATH_PERCENT_ENCODE,
   87|  7.13k|        ada::character_sets::QUERY_PERCENT_ENCODE,
   88|  7.13k|        ada::character_sets::FRAGMENT_PERCENT_ENCODE,
   89|  7.13k|        ada::character_sets::USERINFO_PERCENT_ENCODE,
   90|  7.13k|        ada::character_sets::SPECIAL_QUERY_PERCENT_ENCODE,
   91|  7.13k|    };
   92|       |
   93|  42.7k|    for (const uint8_t* charset : sets) {
  ------------------
  |  Branch (93:33): [True: 42.7k, False: 7.13k]
  ------------------
   94|       |      // Two-argument percent_encode: returns the encoded string.
   95|  42.7k|      std::string encoded = ada::unicode::percent_encode(source, charset);
   96|  42.7k|      volatile size_t enc_len = encoded.size();
   97|  42.7k|      (void)enc_len;
   98|       |
   99|       |      // Encoded output must be at least as long as the input (each byte
  100|       |      // either stays the same or expands to %XX – three bytes).
  101|  42.7k|      assert(encoded.size() >= source.size());
  ------------------
  |  Branch (101:7): [True: 42.7k, False: 0]
  ------------------
  102|       |
  103|       |      // Three-argument percent_encode: starts encoding from a given index.
  104|  42.7k|      size_t start_idx = fdp.ConsumeIntegralInRange<size_t>(0, source.size());
  105|  42.7k|      std::string encoded_from =
  106|  42.7k|          ada::unicode::percent_encode(source, charset, start_idx);
  107|  42.7k|      volatile size_t enf_len = encoded_from.size();
  108|  42.7k|      (void)enf_len;
  109|       |
  110|       |      // Template form: percent_encode<false> (replace).
  111|  42.7k|      {
  112|  42.7k|        std::string out;
  113|  42.7k|        bool changed =
  114|  42.7k|            ada::unicode::percent_encode<false>(source, charset, out);
  115|  42.7k|        volatile bool c = changed;
  116|  42.7k|        (void)c;
  117|       |        // When encoding was needed 'out' holds the encoded string; when not,
  118|       |        // 'out' is unchanged (empty). If changed, 'out' must not be shorter.
  119|  42.7k|        if (changed) {
  ------------------
  |  Branch (119:13): [True: 2.17k, False: 40.6k]
  ------------------
  120|  2.17k|          assert(out.size() >= source.size());
  ------------------
  |  Branch (120:11): [True: 2.17k, False: 0]
  ------------------
  121|  2.17k|        }
  122|  42.7k|      }
  123|       |
  124|       |      // Template form: percent_encode<true> (append).
  125|  42.7k|      {
  126|  42.7k|        std::string out = "prefix_";
  127|  42.7k|        size_t prefix_len = out.size();
  128|  42.7k|        ada::unicode::percent_encode<true>(source, charset, out);
  129|       |        // Append mode: 'out' must grow by at least source.size() bytes if
  130|       |        // encoding was needed, or stay unchanged if it wasn't.
  131|  42.7k|        assert(out.size() >= prefix_len);
  ------------------
  |  Branch (131:9): [True: 42.7k, False: 0]
  ------------------
  132|  42.7k|      }
  133|  42.7k|    }
  134|       |
  135|       |    // Percent decode: feed raw fuzz input (may contain invalid sequences).
  136|  7.13k|    {
  137|  7.13k|      size_t pct_pos = source.find('%');
  138|  7.13k|      if (pct_pos != std::string::npos) {
  ------------------
  |  Branch (138:11): [True: 199, False: 6.93k]
  ------------------
  139|    199|        std::string decoded = ada::unicode::percent_decode(source, pct_pos);
  140|       |        // Decoded output can't be longer than the input.
  141|    199|        assert(decoded.size() <= source.size());
  ------------------
  |  Branch (141:9): [True: 199, False: 0]
  ------------------
  142|    199|        volatile size_t dec_len = decoded.size();
  143|    199|        (void)dec_len;
  144|    199|      }
  145|  7.13k|    }
  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|  7.13k|    {
  150|  7.13k|      std::string encoded = ada::unicode::percent_encode(
  151|  7.13k|          source, ada::character_sets::PATH_PERCENT_ENCODE);
  152|  7.13k|      size_t pct_pos = encoded.find('%');
  153|  7.13k|      if (pct_pos != std::string::npos) {
  ------------------
  |  Branch (153:11): [True: 442, False: 6.68k]
  ------------------
  154|    442|        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|    442|        if (source.find('%') == std::string::npos && decoded != source) {
  ------------------
  |  Branch (157:13): [True: 243, False: 199]
  |  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.68k|      } else {
  165|       |        // No encoding was needed; the output should equal the input.
  166|  6.68k|        assert(encoded == source);
  ------------------
  |  Branch (166:9): [True: 6.68k, False: 0]
  ------------------
  167|  6.68k|      }
  168|  7.13k|    }
  169|       |
  170|       |    // percent_encode_index: the returned index must be within [0, size].
  171|  7.13k|    {
  172|  7.13k|      size_t idx = ada::unicode::percent_encode_index(
  173|  7.13k|          source, ada::character_sets::PATH_PERCENT_ENCODE);
  174|  7.13k|      assert(idx <= source.size());
  ------------------
  |  Branch (174:7): [True: 7.13k, False: 0]
  ------------------
  175|  7.13k|    }
  176|  7.13k|  }
  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|  7.13k|  {
  183|  7.13k|    std::string util_input = fdp.ConsumeRandomLengthString(128);
  184|       |
  185|       |    // has_tabs_or_newline: any string is valid input.
  186|  7.13k|    volatile bool has_tn = ada::unicode::has_tabs_or_newline(util_input);
  187|  7.13k|    (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|  7.13k|    if (!util_input.empty()) {
  ------------------
  |  Branch (193:9): [True: 6.21k, False: 912]
  ------------------
  194|  6.21k|      volatile bool is_v4 = ada::checkers::is_ipv4(util_input);
  195|  6.21k|      (void)is_v4;
  196|  6.21k|      if (is_v4) {
  ------------------
  |  Branch (196:11): [True: 5.99k, False: 229]
  ------------------
  197|  5.99k|        std::string ipv4_url = "http://" + util_input + "/";
  198|  5.99k|        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.99k|        if (parsed) {
  ------------------
  |  Branch (202:13): [True: 2.13k, False: 3.85k]
  ------------------
  203|  2.13k|          volatile bool v = parsed->validate();
  204|  2.13k|          (void)v;
  205|  2.13k|        }
  206|  5.99k|      }
  207|  6.21k|    }
  208|       |
  209|       |    // path_signature: returns a bitmask; must not crash.
  210|  7.13k|    volatile uint8_t sig = ada::checkers::path_signature(util_input);
  211|  7.13k|    (void)sig;
  212|       |
  213|       |    // is_windows_drive_letter: must not crash on short or long inputs.
  214|  7.13k|    volatile bool is_wdl = ada::checkers::is_windows_drive_letter(util_input);
  215|  7.13k|    (void)is_wdl;
  216|       |
  217|       |    // is_normalized_windows_drive_letter
  218|  7.13k|    volatile bool is_nwdl =
  219|  7.13k|        ada::checkers::is_normalized_windows_drive_letter(util_input);
  220|  7.13k|    (void)is_nwdl;
  221|       |
  222|       |    // Consistency: a normalised Windows drive letter is a subset of
  223|       |    // Windows drive letters.
  224|  7.13k|    if (is_nwdl && !is_wdl) {
  ------------------
  |  Branch (224:9): [True: 1, False: 7.13k]
  |  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|  7.13k|    {
  234|  7.13k|      std::string lower_copy = util_input;
  235|  7.13k|      volatile bool all_ascii =
  236|  7.13k|          ada::unicode::to_lower_ascii(lower_copy.data(), lower_copy.size());
  237|  7.13k|      (void)all_ascii;
  238|       |      // The result should be at most as long as the input.
  239|  7.13k|      assert(lower_copy.size() == util_input.size());
  ------------------
  |  Branch (239:7): [True: 7.13k, False: 0]
  ------------------
  240|  7.13k|    }
  241|       |
  242|       |    // contains_forbidden_domain_code_point: must not crash.
  243|  7.13k|    volatile bool has_forbidden =
  244|  7.13k|        ada::unicode::contains_forbidden_domain_code_point(util_input.data(),
  245|  7.13k|                                                           util_input.size());
  246|  7.13k|    (void)has_forbidden;
  247|       |
  248|       |    // contains_forbidden_domain_code_point_or_upper: must not crash.
  249|  7.13k|    volatile uint8_t forbidden_or_upper =
  250|  7.13k|        ada::unicode::contains_forbidden_domain_code_point_or_upper(
  251|  7.13k|            util_input.data(), util_input.size());
  252|  7.13k|    (void)forbidden_or_upper;
  253|       |
  254|       |    // verify_dns_length: must not crash; also check consistency with
  255|       |    // to_ascii output.
  256|  7.13k|    volatile bool dns_ok = ada::checkers::verify_dns_length(util_input);
  257|  7.13k|    (void)dns_ok;
  258|  7.13k|  }
  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|  7.13k|    if (ipv4_addr <= 0xFFFFFFFF) {
  ------------------
  |  Branch (265:9): [True: 322, False: 6.80k]
  ------------------
  266|    322|      std::string url_str = "http://" + ipv4_str + "/path?q=1";
  267|    322|      auto parsed = ada::parse<ada::url_aggregator>(url_str);
  268|    322|      if (parsed) {
  ------------------
  |  Branch (268:11): [True: 322, False: 0]
  ------------------
  269|    322|        volatile bool v = parsed->validate();
  270|    322|        (void)v;
  271|       |        // The URL's hostname must be the canonical dotted-decimal address.
  272|    322|        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|    322|        (void)host;
  277|    322|      }
  278|    322|    }
  279|       |
  280|       |    // IPv6: wrap in brackets.
  281|  7.13k|    std::string ipv6_url_str = "http://[" + ipv6_str + "]/path";
  282|  7.13k|    auto parsed_ipv6 = ada::parse<ada::url_aggregator>(ipv6_url_str);
  283|  7.13k|    if (parsed_ipv6) {
  ------------------
  |  Branch (283:9): [True: 0, False: 7.13k]
  ------------------
  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|  7.13k|  }
  300|       |
  301|  7.13k|  return 0;
  302|  7.13k|}

