_ZN7httplib6detail18parse_range_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS1_6vectorINS1_4pairIllEENS5_ISC_EEEE:
 9451|    490|inline bool parse_range_header(const std::string &s, Ranges &ranges) try {
 9452|    490|#endif
 9453|    490|  auto is_valid = [](const std::string &str) {
 9454|    490|    return std::all_of(str.cbegin(), str.cend(), is_ascii_digit);
 9455|    490|  };
 9456|       |
 9457|    490|  if (s.size() > 7 && case_ignore::equal(s.substr(0, 6), "bytes=")) {
  ------------------
  |  Branch (9457:7): [True: 485, False: 5]
  |  Branch (9457:7): [True: 467, False: 23]
  |  Branch (9457:23): [True: 467, False: 18]
  ------------------
 9458|    467|    const auto pos = static_cast<size_t>(6);
 9459|    467|    const auto len = static_cast<size_t>(s.size() - 6);
 9460|    467|    auto all_valid_ranges = true;
 9461|    467|    split(&s[pos], &s[pos + len], ',', [&](const char *b, const char *e) {
 9462|    467|      if (!all_valid_ranges) { return; }
 9463|       |
 9464|    467|      const auto it = std::find(b, e, '-');
 9465|    467|      if (it == e) {
 9466|    467|        all_valid_ranges = false;
 9467|    467|        return;
 9468|    467|      }
 9469|       |
 9470|    467|      const auto lhs = std::string(b, it);
 9471|    467|      const auto rhs = std::string(it + 1, e);
 9472|    467|      if (!is_valid(lhs) || !is_valid(rhs)) {
 9473|    467|        all_valid_ranges = false;
 9474|    467|        return;
 9475|    467|      }
 9476|       |
 9477|    467|      ssize_t first = -1;
 9478|    467|      if (!lhs.empty()) {
 9479|       |        // Reject an overflowing first-byte-pos; treating it as absent (-1)
 9480|       |        // would turn the range into a suffix range.
 9481|    467|        auto res =
 9482|    467|            detail::from_chars(lhs.data(), lhs.data() + lhs.size(), first);
 9483|    467|        if (res.ec != std::errc{}) {
 9484|    467|          all_valid_ranges = false;
 9485|    467|          return;
 9486|    467|        }
 9487|    467|      }
 9488|       |
 9489|    467|      ssize_t last = -1;
 9490|    467|      if (!rhs.empty()) {
 9491|       |        // An overflowing last-byte-pos is past any content length, so keeping
 9492|       |        // -1 ("remainder", RFC 9110 14.1.2) is correct here.
 9493|    467|        ssize_t v;
 9494|    467|        auto res = detail::from_chars(rhs.data(), rhs.data() + rhs.size(), v);
 9495|    467|        if (res.ec == std::errc{}) { last = v; }
 9496|    467|      }
 9497|       |
 9498|    467|      if ((first == -1 && last == -1) ||
 9499|    467|          (first != -1 && last != -1 && first > last)) {
 9500|    467|        all_valid_ranges = false;
 9501|    467|        return;
 9502|    467|      }
 9503|       |
 9504|    467|      ranges.emplace_back(first, last);
 9505|    467|    });
 9506|    467|    return all_valid_ranges && !ranges.empty();
  ------------------
  |  Branch (9506:12): [True: 242, False: 225]
  |  Branch (9506:32): [True: 241, False: 1]
  ------------------
 9507|    467|  }
 9508|     23|  return false;
 9509|       |#ifdef CPPHTTPLIB_NO_EXCEPTIONS
 9510|       |}
 9511|       |#else
 9512|    490|} catch (...) { return false; }
_ZN7httplib6detail11case_ignore5equalILm7EEEbRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERAT__Kc:
  695|    485|inline bool equal(const std::string &a, const char (&b)[N]) {
  696|    485|  return a.size() == N - 1 &&
  ------------------
  |  Branch (696:10): [True: 485, False: 0]
  ------------------
  697|    485|         std::equal(a.begin(), a.end(), b, [](char ca, char cb) {
  ------------------
  |  Branch (697:10): [True: 467, False: 18]
  ------------------
  698|    485|           return to_lower(ca) == to_lower(cb);
  699|    485|         });
  700|    485|}
_ZZN7httplib6detail11case_ignore5equalILm7EEEbRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERAT__KcENKUlccE_clEcc:
  697|  2.87k|         std::equal(a.begin(), a.end(), b, [](char ca, char cb) {
  698|  2.87k|           return to_lower(ca) == to_lower(cb);
  699|  2.87k|         });
_ZN7httplib6detail11case_ignore8to_lowerEi:
  654|  6.92M|inline unsigned char to_lower(int c) {
  655|  6.92M|  const static unsigned char table[256] = {
  656|  6.92M|      0,   1,   2,   3,   4,   5,   6,   7,   8,   9,   10,  11,  12,  13,  14,
  657|  6.92M|      15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
  658|  6.92M|      30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
  659|  6.92M|      45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
  660|  6.92M|      60,  61,  62,  63,  64,  97,  98,  99,  100, 101, 102, 103, 104, 105, 106,
  661|  6.92M|      107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
  662|  6.92M|      122, 91,  92,  93,  94,  95,  96,  97,  98,  99,  100, 101, 102, 103, 104,
  663|  6.92M|      105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
  664|  6.92M|      120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
  665|  6.92M|      135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
  666|  6.92M|      150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
  667|  6.92M|      165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
  668|  6.92M|      180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 224, 225, 226,
  669|  6.92M|      227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,
  670|  6.92M|      242, 243, 244, 245, 246, 215, 248, 249, 250, 251, 252, 253, 254, 223, 224,
  671|  6.92M|      225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  672|  6.92M|      240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
  673|  6.92M|      255,
  674|  6.92M|  };
  675|  6.92M|  return table[(unsigned char)(char)c];
  676|  6.92M|}
_ZN7httplib6detail5splitEPKcS2_cNSt3__18functionIFvS2_S2_EEE:
 6303|  1.88k|                  std::function<void(const char *, const char *)> fn) {
 6304|  1.88k|  return split(b, e, d, (std::numeric_limits<size_t>::max)(), std::move(fn));
 6305|  1.88k|}
_ZN7httplib6detail5splitEPKcS2_cmNSt3__18functionIFvS2_S2_EEE:
 6308|  1.88k|                  std::function<void(const char *, const char *)> fn) {
 6309|  1.88k|  size_t i = 0;
 6310|  1.88k|  size_t beg = 0;
 6311|  1.88k|  size_t count = 1;
 6312|       |
 6313|  44.7M|  while (e ? (b + i < e) : (b[i] != '\0')) {
  ------------------
  |  Branch (6313:10): [True: 44.7M, False: 0]
  |  Branch (6313:10): [True: 44.7M, False: 1.88k]
  ------------------
 6314|  44.7M|    if (b[i] == d && count < m) {
  ------------------
  |  Branch (6314:9): [True: 8.27M, False: 36.4M]
  |  Branch (6314:22): [True: 8.27M, False: 0]
  ------------------
 6315|  8.27M|      auto r = trim(b, e, beg, i);
 6316|  8.27M|      if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (6316:11): [True: 6.70M, False: 1.56M]
  ------------------
 6317|  8.27M|      beg = i + 1;
 6318|  8.27M|      count++;
 6319|  8.27M|    }
 6320|  44.7M|    i++;
 6321|  44.7M|  }
 6322|       |
 6323|  1.88k|  if (i) {
  ------------------
  |  Branch (6323:7): [True: 1.88k, False: 0]
  ------------------
 6324|  1.88k|    auto r = trim(b, e, beg, i);
 6325|  1.88k|    if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (6325:9): [True: 1.79k, False: 89]
  ------------------
 6326|  1.88k|  }
 6327|  1.88k|}
_ZN7httplib6detail4trimEPKcS2_mm:
 6243|  43.3M|                                      size_t right) {
 6244|  48.1M|  while (b + left < e && is_space_or_tab(b[left])) {
  ------------------
  |  Branch (6244:10): [True: 48.0M, False: 123k]
  |  Branch (6244:26): [True: 4.82M, False: 43.2M]
  ------------------
 6245|  4.82M|    left++;
 6246|  4.82M|  }
 6247|  48.2M|  while (right > 0 && is_space_or_tab(b[right - 1])) {
  ------------------
  |  Branch (6247:10): [True: 48.1M, False: 123k]
  |  Branch (6247:23): [True: 4.96M, False: 43.2M]
  ------------------
 6248|  4.96M|    right--;
 6249|  4.96M|  }
 6250|  43.3M|  return std::make_pair(left, right);
 6251|  43.3M|}
_ZN7httplib6detail15is_space_or_tabEc:
 6096|  96.2M|inline bool is_space_or_tab(char c) { return c == ' ' || c == '\t'; }
  ------------------
  |  Branch (6096:46): [True: 9.76M, False: 86.4M]
  |  Branch (6096:58): [True: 18.7k, False: 86.4M]
  ------------------
_ZZN7httplib6detail18parse_range_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS1_6vectorINS1_4pairIllEENS5_ISC_EEEEENKUlPKcSH_E_clESH_SH_:
 9461|  76.1k|    split(&s[pos], &s[pos + len], ',', [&](const char *b, const char *e) {
 9462|  76.1k|      if (!all_valid_ranges) { return; }
  ------------------
  |  Branch (9462:11): [True: 11.0k, False: 65.0k]
  ------------------
 9463|       |
 9464|  65.0k|      const auto it = std::find(b, e, '-');
 9465|  65.0k|      if (it == e) {
  ------------------
  |  Branch (9465:11): [True: 12, False: 65.0k]
  ------------------
 9466|     12|        all_valid_ranges = false;
 9467|     12|        return;
 9468|     12|      }
 9469|       |
 9470|  65.0k|      const auto lhs = std::string(b, it);
 9471|  65.0k|      const auto rhs = std::string(it + 1, e);
 9472|  65.0k|      if (!is_valid(lhs) || !is_valid(rhs)) {
  ------------------
  |  Branch (9472:11): [True: 4, False: 65.0k]
  |  Branch (9472:29): [True: 13, False: 65.0k]
  ------------------
 9473|     17|        all_valid_ranges = false;
 9474|     17|        return;
 9475|     17|      }
 9476|       |
 9477|  65.0k|      ssize_t first = -1;
 9478|  65.0k|      if (!lhs.empty()) {
  ------------------
  |  Branch (9478:11): [True: 64.4k, False: 608]
  ------------------
 9479|       |        // Reject an overflowing first-byte-pos; treating it as absent (-1)
 9480|       |        // would turn the range into a suffix range.
 9481|  64.4k|        auto res =
 9482|  64.4k|            detail::from_chars(lhs.data(), lhs.data() + lhs.size(), first);
 9483|  64.4k|        if (res.ec != std::errc{}) {
  ------------------
  |  Branch (9483:13): [True: 32, False: 64.4k]
  ------------------
 9484|     32|          all_valid_ranges = false;
 9485|     32|          return;
 9486|     32|        }
 9487|  64.4k|      }
 9488|       |
 9489|  65.0k|      ssize_t last = -1;
 9490|  65.0k|      if (!rhs.empty()) {
  ------------------
  |  Branch (9490:11): [True: 1.25k, False: 63.7k]
  ------------------
 9491|       |        // An overflowing last-byte-pos is past any content length, so keeping
 9492|       |        // -1 ("remainder", RFC 9110 14.1.2) is correct here.
 9493|  1.25k|        ssize_t v;
 9494|  1.25k|        auto res = detail::from_chars(rhs.data(), rhs.data() + rhs.size(), v);
 9495|  1.25k|        if (res.ec == std::errc{}) { last = v; }
  ------------------
  |  Branch (9495:13): [True: 1.00k, False: 249]
  ------------------
 9496|  1.25k|      }
 9497|       |
 9498|  65.0k|      if ((first == -1 && last == -1) ||
  ------------------
  |  Branch (9498:12): [True: 608, False: 64.4k]
  |  Branch (9498:27): [True: 57, False: 551]
  ------------------
 9499|  64.9k|          (first != -1 && last != -1 && first > last)) {
  ------------------
  |  Branch (9499:12): [True: 64.4k, False: 551]
  |  Branch (9499:27): [True: 455, False: 63.9k]
  |  Branch (9499:41): [True: 107, False: 348]
  ------------------
 9500|    164|        all_valid_ranges = false;
 9501|    164|        return;
 9502|    164|      }
 9503|       |
 9504|  64.8k|      ranges.emplace_back(first, last);
 9505|  64.8k|    });
_ZZN7httplib6detail18parse_range_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS1_6vectorINS1_4pairIllEENS5_ISC_EEEEENKUlS9_E_clES9_:
 9453|   130k|  auto is_valid = [](const std::string &str) {
 9454|   130k|    return std::all_of(str.cbegin(), str.cend(), is_ascii_digit);
 9455|   130k|  };
_ZN7httplib6detail14is_ascii_digitEc:
  642|   235k|inline bool is_ascii_digit(char c) { return '0' <= c && c <= '9'; }
  ------------------
  |  Branch (642:45): [True: 225k, False: 9.79k]
  |  Branch (642:57): [True: 223k, False: 1.75k]
  ------------------
_ZN7httplib6detail10from_charsIlEENS0_17from_chars_resultIT_EEPKcS6_RS3_i:
  763|  65.6k|                                       T &value, int base = 10) {
  764|  65.6k|  value = 0;
  765|  65.6k|  const char *p = first;
  766|  65.6k|  bool negative = false;
  767|       |
  768|  65.6k|  if (p != last && *p == '-') {
  ------------------
  |  Branch (768:7): [True: 65.6k, False: 0]
  |  Branch (768:20): [True: 0, False: 65.6k]
  ------------------
  769|      0|    negative = true;
  770|      0|    ++p;
  771|      0|  }
  772|  65.6k|  if (p == last) { return {first, std::errc::invalid_argument}; }
  ------------------
  |  Branch (772:7): [True: 0, False: 65.6k]
  ------------------
  773|       |
  774|  65.6k|  auto radix = static_cast<T>(base);
  775|  65.6k|  T result = 0;
  776|   140k|  for (; p != last; ++p) {
  ------------------
  |  Branch (776:10): [True: 74.7k, False: 65.4k]
  ------------------
  777|  74.7k|    char c = *p;
  778|  74.7k|    int digit = -1;
  779|  74.7k|    if (is_ascii_digit(c)) {
  ------------------
  |  Branch (779:9): [True: 74.7k, False: 0]
  ------------------
  780|  74.7k|      digit = c - '0';
  781|  74.7k|    } else if ('a' <= c && c <= 'z') {
  ------------------
  |  Branch (781:16): [True: 0, False: 0]
  |  Branch (781:28): [True: 0, False: 0]
  ------------------
  782|      0|      digit = c - 'a' + 10;
  783|      0|    } else if ('A' <= c && c <= 'Z') {
  ------------------
  |  Branch (783:16): [True: 0, False: 0]
  |  Branch (783:28): [True: 0, False: 0]
  ------------------
  784|      0|      digit = c - 'A' + 10;
  785|      0|    } else {
  786|      0|      break;
  787|      0|    }
  788|       |
  789|  74.7k|    if (digit < 0 || digit >= base) { break; }
  ------------------
  |  Branch (789:9): [True: 0, False: 74.7k]
  |  Branch (789:22): [True: 0, False: 74.7k]
  ------------------
  790|  74.7k|    auto d = static_cast<T>(digit);
  791|  74.7k|    if (result > ((std::numeric_limits<T>::max)() - d) / radix) {
  ------------------
  |  Branch (791:9): [True: 281, False: 74.5k]
  ------------------
  792|    281|      return {p, std::errc::result_out_of_range};
  793|    281|    }
  794|  74.5k|    result = result * radix + d;
  795|  74.5k|  }
  796|       |
  797|  65.4k|  if (p == first || (negative && p == first + 1)) {
  ------------------
  |  Branch (797:7): [True: 0, False: 65.4k]
  |  Branch (797:22): [True: 0, False: 65.4k]
  |  Branch (797:34): [True: 0, False: 0]
  ------------------
  798|      0|    return {first, std::errc::invalid_argument};
  799|      0|  }
  800|       |
  801|  65.4k|  value = negative ? T(0) - result : result;
  ------------------
  |  Branch (801:11): [True: 0, False: 65.4k]
  ------------------
  802|  65.4k|  return {p, std::errc{}};
  803|  65.4k|}
_ZN7httplib6detail19parse_accept_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS1_6vectorIS7_NS5_IS7_EEEE:
 9532|  1.51k|                                std::vector<std::string> &content_types) {
 9533|       |  // Parameter values are not used here, so a quoted-string is dropped rather
 9534|       |  // than parsed: a ',' or ';' inside one must not be read as a delimiter.
 9535|  1.51k|  if (s.find('"') != std::string::npos) {
  ------------------
  |  Branch (9535:7): [True: 96, False: 1.42k]
  ------------------
 9536|     96|    return parse_accept_header(remove_quoted_strings(s), content_types);
 9537|     96|  }
 9538|       |
 9539|  1.42k|  content_types.clear();
 9540|       |
 9541|       |  // Empty string is considered valid (no preference)
 9542|  1.42k|  if (s.empty()) { return true; }
  ------------------
  |  Branch (9542:7): [True: 2, False: 1.41k]
  ------------------
 9543|       |
 9544|  1.41k|  struct AcceptEntry {
 9545|  1.41k|    std::string media_type;
 9546|  1.41k|    double quality;
 9547|  1.41k|    int order;
 9548|  1.41k|  };
 9549|       |
 9550|  1.41k|  std::vector<AcceptEntry> entries;
 9551|  1.41k|  int order = 0;
 9552|  1.41k|  bool has_invalid_entry = false;
 9553|       |
 9554|       |  // Split by comma and parse each entry. RFC 9110 Section 5.6.1.2: a recipient
 9555|       |  // has to parse and ignore empty list elements, so a leading, trailing or
 9556|       |  // doubled comma must not turn a legal Accept value into 400 Bad Request.
 9557|       |  // split() skips them, and the header length limit bounds how many a sender
 9558|       |  // can send, so ignoring all of them cannot be used as a denial-of-service
 9559|       |  // vector.
 9560|  1.41k|  split(s.data(), s.data() + s.size(), ',', [&](const char *b, const char *e) {
 9561|  1.41k|    std::string entry(b, e);
 9562|  1.41k|    entry = trim_copy(entry);
 9563|       |
 9564|  1.41k|    AcceptEntry accept_entry;
 9565|  1.41k|    accept_entry.order = order++;
 9566|       |
 9567|  1.41k|    if (!parse_quality(entry.data(), entry.data() + entry.size(),
 9568|  1.41k|                       accept_entry.media_type, accept_entry.quality)) {
 9569|  1.41k|      has_invalid_entry = true;
 9570|  1.41k|      return;
 9571|  1.41k|    }
 9572|       |
 9573|       |    // Remove additional parameters from media type
 9574|  1.41k|    accept_entry.media_type = extract_media_type(accept_entry.media_type);
 9575|       |
 9576|       |    // Basic validation of media type format
 9577|  1.41k|    if (accept_entry.media_type.empty()) {
 9578|  1.41k|      has_invalid_entry = true;
 9579|  1.41k|      return;
 9580|  1.41k|    }
 9581|       |
 9582|       |    // Check for basic media type format (should contain '/' or be '*')
 9583|  1.41k|    if (accept_entry.media_type != "*" &&
 9584|  1.41k|        accept_entry.media_type.find('/') == std::string::npos) {
 9585|  1.41k|      has_invalid_entry = true;
 9586|  1.41k|      return;
 9587|  1.41k|    }
 9588|       |
 9589|  1.41k|    entries.push_back(std::move(accept_entry));
 9590|  1.41k|  });
 9591|       |
 9592|       |  // Return false if any invalid entry was found
 9593|  1.41k|  if (has_invalid_entry) { return false; }
  ------------------
  |  Branch (9593:7): [True: 927, False: 492]
  ------------------
 9594|       |
 9595|       |  // Sort by quality (descending), then by original order (ascending)
 9596|    492|  std::sort(entries.begin(), entries.end(),
 9597|    492|            [](const AcceptEntry &a, const AcceptEntry &b) {
 9598|    492|              if (a.quality != b.quality) {
 9599|    492|                return a.quality > b.quality; // Higher quality first
 9600|    492|              }
 9601|    492|              return a.order < b.order; // Earlier order first for same quality
 9602|    492|            });
 9603|       |
 9604|       |  // Extract sorted media types
 9605|    492|  content_types.reserve(entries.size());
 9606|  80.4k|  for (auto &entry : entries) {
  ------------------
  |  Branch (9606:20): [True: 80.4k, False: 492]
  ------------------
 9607|  80.4k|    content_types.push_back(std::move(entry.media_type));
 9608|  80.4k|  }
 9609|       |
 9610|    492|  return true;
 9611|  1.41k|}
_ZN7httplib6detail21remove_quoted_stringsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 9516|     96|inline std::string remove_quoted_strings(const std::string &s) {
 9517|     96|  std::string out;
 9518|     96|  auto in_quotes = false;
 9519|  14.8M|  for (size_t i = 0; i < s.size(); i++) {
  ------------------
  |  Branch (9519:22): [True: 14.8M, False: 96]
  ------------------
 9520|  14.8M|    if (s[i] == '"') {
  ------------------
  |  Branch (9520:9): [True: 23.5k, False: 14.8M]
  ------------------
 9521|  23.5k|      in_quotes = !in_quotes;
 9522|  14.8M|    } else if (!in_quotes) {
  ------------------
  |  Branch (9522:16): [True: 8.59M, False: 6.27M]
  ------------------
 9523|  8.59M|      out += s[i];
 9524|  8.59M|    } else if (s[i] == '\\') {
  ------------------
  |  Branch (9524:16): [True: 1, False: 6.27M]
  ------------------
 9525|      1|      i++;
 9526|      1|    }
 9527|  14.8M|  }
 9528|     96|  return out;
 9529|     96|}
_ZZN7httplib6detail19parse_accept_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS1_6vectorIS7_NS5_IS7_EEEEENKUlPKcSF_E_clESF_SF_:
 9560|  6.62M|  split(s.data(), s.data() + s.size(), ',', [&](const char *b, const char *e) {
 9561|  6.62M|    std::string entry(b, e);
 9562|  6.62M|    entry = trim_copy(entry);
 9563|       |
 9564|  6.62M|    AcceptEntry accept_entry;
 9565|  6.62M|    accept_entry.order = order++;
 9566|       |
 9567|  6.62M|    if (!parse_quality(entry.data(), entry.data() + entry.size(),
  ------------------
  |  Branch (9567:9): [True: 10.1k, False: 6.61M]
  ------------------
 9568|  6.62M|                       accept_entry.media_type, accept_entry.quality)) {
 9569|  10.1k|      has_invalid_entry = true;
 9570|  10.1k|      return;
 9571|  10.1k|    }
 9572|       |
 9573|       |    // Remove additional parameters from media type
 9574|  6.61M|    accept_entry.media_type = extract_media_type(accept_entry.media_type);
 9575|       |
 9576|       |    // Basic validation of media type format
 9577|  6.61M|    if (accept_entry.media_type.empty()) {
  ------------------
  |  Branch (9577:9): [True: 0, False: 6.61M]
  ------------------
 9578|      0|      has_invalid_entry = true;
 9579|      0|      return;
 9580|      0|    }
 9581|       |
 9582|       |    // Check for basic media type format (should contain '/' or be '*')
 9583|  6.61M|    if (accept_entry.media_type != "*" &&
  ------------------
  |  Branch (9583:9): [True: 6.36M, False: 253k]
  ------------------
 9584|  6.36M|        accept_entry.media_type.find('/') == std::string::npos) {
  ------------------
  |  Branch (9584:9): [True: 1.43k, False: 6.36M]
  ------------------
 9585|  1.43k|      has_invalid_entry = true;
 9586|  1.43k|      return;
 9587|  1.43k|    }
 9588|       |
 9589|  6.61M|    entries.push_back(std::move(accept_entry));
 9590|  6.61M|  });
_ZN7httplib6detail9trim_copyERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 6253|  13.2M|inline std::string trim_copy(const std::string &s) {
 6254|  13.2M|  auto r = trim(s.data(), s.data() + s.size(), 0, s.size());
 6255|  13.2M|  return s.substr(r.first, r.second - r.first);
 6256|  13.2M|}
_ZN7httplib6detail13parse_qualityEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERd:
 7871|  6.62M|                          double &quality) {
 7872|  6.62M|  quality = 1.0;
 7873|  6.62M|  token.clear();
 7874|       |
 7875|       |  // Split on first ';': left = token name, right = parameters
 7876|  6.62M|  const char *params_b = nullptr;
 7877|  6.62M|  std::size_t params_len = 0;
 7878|       |
 7879|  6.62M|  divide(
 7880|  6.62M|      b, static_cast<std::size_t>(e - b), ';',
 7881|  6.62M|      [&](const char *lb, std::size_t llen, const char *rb, std::size_t rlen) {
 7882|  6.62M|        auto r = trim(lb, lb + llen, 0, llen);
 7883|  6.62M|        if (r.first < r.second) { token.assign(lb + r.first, lb + r.second); }
 7884|  6.62M|        params_b = rb;
 7885|  6.62M|        params_len = rlen;
 7886|  6.62M|      });
 7887|       |
 7888|  6.62M|  if (token.empty()) { return false; }
  ------------------
  |  Branch (7888:7): [True: 372, False: 6.62M]
  ------------------
 7889|  6.62M|  if (params_len == 0) { return true; }
  ------------------
  |  Branch (7889:7): [True: 6.55M, False: 76.9k]
  ------------------
 7890|       |
 7891|       |  // Scan parameters for q= (stops on first match)
 7892|  76.9k|  bool invalid = false;
 7893|  76.9k|  split_find(params_b, params_b + params_len, ';',
 7894|  76.9k|             (std::numeric_limits<size_t>::max)(),
 7895|  76.9k|             [&](const char *pb, const char *pe) -> bool {
 7896|       |               // Match exactly "q=" or "Q=" (not "query=" etc.)
 7897|  76.9k|               auto len = static_cast<size_t>(pe - pb);
 7898|  76.9k|               if (len < 2) { return false; }
 7899|  76.9k|               if ((pb[0] != 'q' && pb[0] != 'Q') || pb[1] != '=') {
 7900|  76.9k|                 return false;
 7901|  76.9k|               }
 7902|       |
 7903|       |               // Trim the value portion
 7904|  76.9k|               auto r = trim(pb, pe, 2, len);
 7905|  76.9k|               if (r.first >= r.second) {
 7906|  76.9k|                 invalid = true;
 7907|  76.9k|                 return true;
 7908|  76.9k|               }
 7909|       |
 7910|  76.9k|               double v = 0.0;
 7911|  76.9k|               auto res = from_chars(pb + r.first, pb + r.second, v);
 7912|  76.9k|               if (res.ec != std::errc{} || res.ptr != pb + r.second ||
 7913|  76.9k|                   v < 0.0 || v > 1.0) {
 7914|  76.9k|                 invalid = true;
 7915|  76.9k|                 return true;
 7916|  76.9k|               }
 7917|  76.9k|               quality = v;
 7918|  76.9k|               return true;
 7919|  76.9k|             });
 7920|       |
 7921|  76.9k|  return !invalid;
 7922|  6.62M|}
_ZN7httplib6detail6divideEPKcmcNSt3__18functionIFvS2_mS2_mEEE:
 6284|  6.75M|           fn) {
 6285|  6.75M|  const auto it = std::find(data, data + size, d);
 6286|  6.75M|  const auto found = static_cast<std::size_t>(it != data + size);
 6287|  6.75M|  const auto lhs_data = data;
 6288|  6.75M|  const auto lhs_size = static_cast<std::size_t>(it - data);
 6289|  6.75M|  const auto rhs_data = it + found;
 6290|  6.75M|  const auto rhs_size = size - lhs_size - found;
 6291|       |
 6292|  6.75M|  fn(lhs_data, lhs_size, rhs_data, rhs_size);
 6293|  6.75M|}
_ZZN7httplib6detail13parse_qualityEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERdENKUlS2_mS2_mE_clES2_mS2_m:
 7881|  6.62M|      [&](const char *lb, std::size_t llen, const char *rb, std::size_t rlen) {
 7882|  6.62M|        auto r = trim(lb, lb + llen, 0, llen);
 7883|  6.62M|        if (r.first < r.second) { token.assign(lb + r.first, lb + r.second); }
  ------------------
  |  Branch (7883:13): [True: 6.62M, False: 372]
  ------------------
 7884|  6.62M|        params_b = rb;
 7885|  6.62M|        params_len = rlen;
 7886|  6.62M|      });
_ZN7httplib6detail10split_findEPKcS2_cmNSt3__18functionIFbS2_S2_EEE:
 6383|  76.9k|                       std::function<bool(const char *, const char *)> fn) {
 6384|  76.9k|  size_t i = 0;
 6385|  76.9k|  size_t beg = 0;
 6386|  76.9k|  size_t count = 1;
 6387|       |
 6388|  19.8M|  while (e ? (b + i < e) : (b[i] != '\0')) {
  ------------------
  |  Branch (6388:10): [True: 19.8M, False: 0]
  |  Branch (6388:10): [True: 19.7M, False: 74.8k]
  ------------------
 6389|  19.7M|    if (b[i] == d && count < m) {
  ------------------
  |  Branch (6389:9): [True: 9.25M, False: 10.5M]
  |  Branch (6389:22): [True: 9.25M, False: 0]
  ------------------
 6390|  9.25M|      auto r = trim(b, e, beg, i);
 6391|  9.25M|      if (r.first < r.second) {
  ------------------
  |  Branch (6391:11): [True: 893k, False: 8.35M]
  ------------------
 6392|   893k|        auto found = fn(&b[r.first], &b[r.second]);
 6393|   893k|        if (found) { return true; }
  ------------------
  |  Branch (6393:13): [True: 2.11k, False: 891k]
  ------------------
 6394|   893k|      }
 6395|  9.25M|      beg = i + 1;
 6396|  9.25M|      count++;
 6397|  9.25M|    }
 6398|  19.7M|    i++;
 6399|  19.7M|  }
 6400|       |
 6401|  74.8k|  if (i) {
  ------------------
  |  Branch (6401:7): [True: 74.8k, False: 0]
  ------------------
 6402|  74.8k|    auto r = trim(b, e, beg, i);
 6403|  74.8k|    if (r.first < r.second) {
  ------------------
  |  Branch (6403:9): [True: 74.2k, False: 648]
  ------------------
 6404|  74.2k|      auto found = fn(&b[r.first], &b[r.second]);
 6405|  74.2k|      if (found) { return true; }
  ------------------
  |  Branch (6405:11): [True: 64.8k, False: 9.35k]
  ------------------
 6406|  74.2k|    }
 6407|  74.8k|  }
 6408|       |
 6409|  10.0k|  return false;
 6410|  74.8k|}
_ZZN7httplib6detail13parse_qualityEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERdENKUlS2_S2_E_clES2_S2_:
 7895|   967k|             [&](const char *pb, const char *pe) -> bool {
 7896|       |               // Match exactly "q=" or "Q=" (not "query=" etc.)
 7897|   967k|               auto len = static_cast<size_t>(pe - pb);
 7898|   967k|               if (len < 2) { return false; }
  ------------------
  |  Branch (7898:20): [True: 884k, False: 82.9k]
  ------------------
 7899|  82.9k|               if ((pb[0] != 'q' && pb[0] != 'Q') || pb[1] != '=') {
  ------------------
  |  Branch (7899:21): [True: 15.0k, False: 67.9k]
  |  Branch (7899:37): [True: 10.1k, False: 4.85k]
  |  Branch (7899:54): [True: 5.78k, False: 66.9k]
  ------------------
 7900|  15.9k|                 return false;
 7901|  15.9k|               }
 7902|       |
 7903|       |               // Trim the value portion
 7904|  66.9k|               auto r = trim(pb, pe, 2, len);
 7905|  66.9k|               if (r.first >= r.second) {
  ------------------
  |  Branch (7905:20): [True: 396, False: 66.5k]
  ------------------
 7906|    396|                 invalid = true;
 7907|    396|                 return true;
 7908|    396|               }
 7909|       |
 7910|  66.5k|               double v = 0.0;
 7911|  66.5k|               auto res = from_chars(pb + r.first, pb + r.second, v);
 7912|  66.5k|               if (res.ec != std::errc{} || res.ptr != pb + r.second ||
  ------------------
  |  Branch (7912:20): [True: 679, False: 65.9k]
  |  Branch (7912:45): [True: 8.32k, False: 57.5k]
  ------------------
 7913|  57.5k|                   v < 0.0 || v > 1.0) {
  ------------------
  |  Branch (7913:20): [True: 0, False: 57.5k]
  |  Branch (7913:31): [True: 399, False: 57.1k]
  ------------------
 7914|  9.40k|                 invalid = true;
 7915|  9.40k|                 return true;
 7916|  9.40k|               }
 7917|  57.1k|               quality = v;
 7918|  57.1k|               return true;
 7919|  66.5k|             });
_ZN7httplib6detail10from_charsEPKcS2_Rd:
  819|  66.5k|                                            double &value) {
  820|  66.5k|  value = 0.0;
  821|  66.5k|  const char *p = first;
  822|       |
  823|       |  // Each 1eN is exactly representable, so a single final division by the
  824|       |  // matching entry yields a correctly-rounded result.
  825|  66.5k|  static const double powers_of_ten[] = {
  826|  66.5k|      1e0,  1e1,  1e2,  1e3,  1e4,  1e5,  1e6,  1e7,  1e8, 1e9,
  827|  66.5k|      1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18};
  828|  66.5k|  const int max_frac_digits =
  829|  66.5k|      static_cast<int>(sizeof(powers_of_ten) / sizeof(powers_of_ten[0])) - 1;
  830|       |
  831|       |  // Accumulate digits into a 64-bit integer and remember how many were
  832|       |  // fractional. Two independent caps keep this bounded and safe:
  833|       |  //   * accumulation saturates before mantissa could overflow uint64_t, and
  834|       |  //   * frac_digits is capped at max_frac_digits so it is always a valid index
  835|       |  //     into powers_of_ten (without this an input like "0.000...0" would never
  836|       |  //     grow mantissa, so the saturation cap alone would not bound it).
  837|       |  // Both caps only drop digits far beyond the precision a q-value needs; any
  838|       |  // value they would change is well outside [0, 1] and rejected by the caller.
  839|  66.5k|  uint64_t mantissa = 0;
  840|  66.5k|  int frac_digits = 0;
  841|  66.5k|  bool seen_digit = false;
  842|       |
  843|  66.5k|  const uint64_t limit = ((std::numeric_limits<uint64_t>::max)() - 9) / 10;
  844|  66.5k|  auto accumulate = [&](char c) {
  845|  66.5k|    if (mantissa <= limit) {
  846|  66.5k|      mantissa = mantissa * 10 + static_cast<uint64_t>(c - '0');
  847|  66.5k|      return true;
  848|  66.5k|    }
  849|  66.5k|    return false;
  850|  66.5k|  };
  851|       |
  852|   136k|  for (; p != last && is_ascii_digit(*p); ++p) {
  ------------------
  |  Branch (852:10): [True: 80.2k, False: 56.6k]
  |  Branch (852:23): [True: 70.3k, False: 9.88k]
  ------------------
  853|  70.3k|    seen_digit = true;
  854|  70.3k|    accumulate(*p);
  855|  70.3k|  }
  856|       |
  857|  66.5k|  if (p != last && *p == '.') {
  ------------------
  |  Branch (857:7): [True: 9.88k, False: 56.6k]
  |  Branch (857:20): [True: 2.76k, False: 7.12k]
  ------------------
  858|  2.76k|    ++p;
  859|  6.39k|    for (; p != last && is_ascii_digit(*p); ++p) {
  ------------------
  |  Branch (859:12): [True: 5.28k, False: 1.11k]
  |  Branch (859:25): [True: 3.63k, False: 1.65k]
  ------------------
  860|  3.63k|      seen_digit = true;
  861|  3.63k|      if (frac_digits < max_frac_digits && accumulate(*p)) { ++frac_digits; }
  ------------------
  |  Branch (861:11): [True: 3.26k, False: 365]
  |  Branch (861:44): [True: 3.03k, False: 236]
  ------------------
  862|  3.63k|    }
  863|  2.76k|  }
  864|       |
  865|  66.5k|  if (!seen_digit) { return {first, std::errc::invalid_argument}; }
  ------------------
  |  Branch (865:7): [True: 679, False: 65.9k]
  ------------------
  866|       |
  867|  65.9k|  value = static_cast<double>(mantissa) / powers_of_ten[frac_digits];
  868|  65.9k|  return {p, std::errc{}};
  869|  66.5k|}
_ZZN7httplib6detail10from_charsEPKcS2_RdENKUlcE_clEc:
  844|  73.6k|  auto accumulate = [&](char c) {
  845|  73.6k|    if (mantissa <= limit) {
  ------------------
  |  Branch (845:9): [True: 72.8k, False: 736]
  ------------------
  846|  72.8k|      mantissa = mantissa * 10 + static_cast<uint64_t>(c - '0');
  847|  72.8k|      return true;
  848|  72.8k|    }
  849|    736|    return false;
  850|  73.6k|  };
_ZZN7httplib6detail19parse_accept_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS1_6vectorIS7_NS5_IS7_EEEEENKUlRKZNS0_19parse_accept_headerES9_SD_E11AcceptEntrySG_E_clESG_SG_:
 9597|  1.15M|            [](const AcceptEntry &a, const AcceptEntry &b) {
 9598|  1.15M|              if (a.quality != b.quality) {
  ------------------
  |  Branch (9598:19): [True: 4.91k, False: 1.14M]
  ------------------
 9599|  4.91k|                return a.quality > b.quality; // Higher quality first
 9600|  4.91k|              }
 9601|  1.14M|              return a.order < b.order; // Earlier order first for same quality
 9602|  1.15M|            });
_ZN7httplib6detail18extract_media_typeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEPNS1_3mapIS7_S7_NS1_4lessIS7_EENS5_INS1_4pairIS8_S7_EEEEEE:
 7816|  6.61M|                   std::map<std::string, std::string> *params = nullptr) {
 7817|       |  // Extract type/subtype from Content-Type value (RFC 2045)
 7818|       |  // e.g. "application/json; charset=utf-8" -> "application/json"
 7819|  6.61M|  auto media_type = content_type;
 7820|  6.61M|  auto semicolon_pos = media_type.find(';');
 7821|  6.61M|  if (semicolon_pos != std::string::npos) {
  ------------------
  |  Branch (7821:7): [True: 255, False: 6.61M]
  ------------------
 7822|    255|    auto param_str = media_type.substr(semicolon_pos + 1);
 7823|    255|    media_type = media_type.substr(0, semicolon_pos);
 7824|       |
 7825|    255|    if (params) {
  ------------------
  |  Branch (7825:9): [True: 237, False: 18]
  ------------------
 7826|       |      // Parse parameters: key=value pairs separated by ';'
 7827|    237|      split_unquoted(param_str.data(), param_str.data() + param_str.size(), ';',
 7828|    237|                     [&](const char *b, const char *e) {
 7829|    237|                       std::string key;
 7830|    237|                       std::string val;
 7831|    237|                       divide_param_pair(b, e, key, val);
 7832|       |                       // Parameter names are case-insensitive (RFC 9110
 7833|       |                       // §5.6.6)
 7834|    237|                       if (!key.empty()) {
 7835|    237|                         params->emplace(case_ignore::to_lower(trim_copy(key)),
 7836|    237|                                         unquote_param(val));
 7837|    237|                       }
 7838|    237|                     });
 7839|    237|    }
 7840|    255|  }
 7841|       |
 7842|       |  // Trim whitespace from media type
 7843|  6.61M|  return trim_copy(media_type);
 7844|  6.61M|}
_ZN7httplib6detail14split_unquotedEPKcS2_cNSt3__18functionIFvS2_S2_EEE:
 6362|    783|                           std::function<void(const char *, const char *)> fn) {
 6363|    783|  return split_unquoted(b, e, d, (std::numeric_limits<size_t>::max)(),
 6364|    783|                        std::move(fn));
 6365|    783|}
_ZN7httplib6detail14split_unquotedEPKcS2_cmNSt3__18functionIFvS2_S2_EEE:
 6333|    783|                           std::function<void(const char *, const char *)> fn) {
 6334|    783|  size_t i = 0;
 6335|    783|  size_t beg = 0;
 6336|    783|  size_t count = 1;
 6337|    783|  auto in_quotes = false;
 6338|       |
 6339|    783|  auto has = [&](size_t j) { return e ? (b + j < e) : (b[j] != '\0'); };
 6340|  34.4M|  while (has(i)) {
  ------------------
  |  Branch (6340:10): [True: 34.4M, False: 783]
  ------------------
 6341|  34.4M|    if (in_quotes && b[i] == '\\' && has(i + 1)) {
  ------------------
  |  Branch (6341:9): [True: 10.7M, False: 23.6M]
  |  Branch (6341:22): [True: 2.08k, False: 10.7M]
  |  Branch (6341:38): [True: 2.08k, False: 0]
  ------------------
 6342|       |      // A quoted-pair, whose second character does not end the string.
 6343|  2.08k|      i++;
 6344|  34.4M|    } else if (b[i] == '"') {
  ------------------
  |  Branch (6344:16): [True: 14.1k, False: 34.3M]
  ------------------
 6345|  14.1k|      in_quotes = !in_quotes;
 6346|  34.3M|    } else if (b[i] == d && !in_quotes && count < m) {
  ------------------
  |  Branch (6346:16): [True: 6.23M, False: 28.1M]
  |  Branch (6346:29): [True: 5.50M, False: 736k]
  |  Branch (6346:43): [True: 5.50M, False: 0]
  ------------------
 6347|  5.50M|      auto r = trim(b, e, beg, i);
 6348|  5.50M|      if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (6348:11): [True: 415k, False: 5.08M]
  ------------------
 6349|  5.50M|      beg = i + 1;
 6350|  5.50M|      count++;
 6351|  5.50M|    }
 6352|  34.4M|    i++;
 6353|  34.4M|  }
 6354|       |
 6355|    783|  if (i) {
  ------------------
  |  Branch (6355:7): [True: 776, False: 7]
  ------------------
 6356|    776|    auto r = trim(b, e, beg, i);
 6357|    776|    if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (6357:9): [True: 676, False: 100]
  ------------------
 6358|    776|  }
 6359|    783|}
_ZZN7httplib6detail14split_unquotedEPKcS2_cmNSt3__18functionIFvS2_S2_EEEENKUlmE_clEm:
 6339|  34.4M|  auto has = [&](size_t j) { return e ? (b + j < e) : (b[j] != '\0'); };
  ------------------
  |  Branch (6339:37): [True: 34.4M, False: 0]
  ------------------
_ZZN7httplib6detail18extract_media_typeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEPNS1_3mapIS7_S7_NS1_4lessIS7_EENS5_INS1_4pairIS8_S7_EEEEEEENKUlPKcSJ_E_clESJ_SJ_:
 7828|  35.9k|                     [&](const char *b, const char *e) {
 7829|  35.9k|                       std::string key;
 7830|  35.9k|                       std::string val;
 7831|  35.9k|                       divide_param_pair(b, e, key, val);
 7832|       |                       // Parameter names are case-insensitive (RFC 9110
 7833|       |                       // §5.6.6)
 7834|  35.9k|                       if (!key.empty()) {
  ------------------
  |  Branch (7834:28): [True: 35.3k, False: 584]
  ------------------
 7835|  35.3k|                         params->emplace(case_ignore::to_lower(trim_copy(key)),
 7836|  35.3k|                                         unquote_param(val));
 7837|  35.3k|                       }
 7838|  35.9k|                     });
_ZN7httplib6detail17divide_param_pairEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_:
 6371|   125k|                              std::string &val) {
 6372|   125k|  divide(
 6373|   125k|      b, static_cast<std::size_t>(e - b), '=',
 6374|   125k|      [&](const char *kb, std::size_t klen, const char *vb, std::size_t vlen) {
 6375|   125k|        const auto kr = trim(kb, kb + klen, 0, klen);
 6376|   125k|        key.assign(kb + kr.first, kb + kr.second);
 6377|   125k|        const auto vr = trim(vb, vb + vlen, 0, vlen);
 6378|   125k|        val.assign(vb + vr.first, vb + vr.second);
 6379|   125k|      });
 6380|   125k|}
_ZZN7httplib6detail17divide_param_pairEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_ENKUlS2_mS2_mE_clES2_mS2_m:
 6374|   125k|      [&](const char *kb, std::size_t klen, const char *vb, std::size_t vlen) {
 6375|   125k|        const auto kr = trim(kb, kb + klen, 0, klen);
 6376|   125k|        key.assign(kb + kr.first, kb + kr.second);
 6377|   125k|        const auto vr = trim(vb, vb + vlen, 0, vlen);
 6378|   125k|        val.assign(vb + vr.first, vb + vr.second);
 6379|   125k|      });
_ZN7httplib6detail11case_ignore8to_lowerERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  678|  36.0k|inline std::string to_lower(const std::string &s) {
  679|  36.0k|  std::string result = s;
  680|  36.0k|  std::transform(
  681|  36.0k|      result.begin(), result.end(), result.begin(),
  682|  36.0k|      [](unsigned char c) { return static_cast<char>(to_lower(c)); });
  683|  36.0k|  return result;
  684|  36.0k|}
_ZZN7httplib6detail11case_ignore8to_lowerERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEENKUlhE_clEh:
  682|  6.92M|      [](unsigned char c) { return static_cast<char>(to_lower(c)); });
_ZN7httplib6detail13unquote_paramERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 6268|   124k|inline std::string unquote_param(const std::string &s) {
 6269|   124k|  if (s.size() < 2 || s.front() != '"' || s.back() != '"') { return s; }
  ------------------
  |  Branch (6269:7): [True: 120k, False: 3.54k]
  |  Branch (6269:23): [True: 3.16k, False: 387]
  |  Branch (6269:43): [True: 200, False: 187]
  ------------------
 6270|    187|  std::string out;
 6271|    342|  for (size_t i = 1; i + 1 < s.size(); i++) {
  ------------------
  |  Branch (6271:22): [True: 155, False: 187]
  ------------------
 6272|    155|    if (s[i] == '\\' && i + 2 < s.size() &&
  ------------------
  |  Branch (6272:9): [True: 0, False: 155]
  |  Branch (6272:25): [True: 0, False: 0]
  ------------------
 6273|      0|        (s[i + 1] == '"' || s[i + 1] == '\\')) {
  ------------------
  |  Branch (6273:10): [True: 0, False: 0]
  |  Branch (6273:29): [True: 0, False: 0]
  ------------------
 6274|      0|      i++;
 6275|      0|    }
 6276|    155|    out += s[i];
 6277|    155|  }
 6278|    187|  return out;
 6279|   124k|}
_ZN7httplib6detail24parse_multipart_boundaryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERS7_:
 9417|    210|                                     std::string &boundary) {
 9418|    210|  std::map<std::string, std::string> params;
 9419|    210|  extract_media_type(content_type, &params);
 9420|    210|  auto it = params.find("boundary");
 9421|    210|  if (it == params.end()) { return false; }
  ------------------
  |  Branch (9421:7): [True: 185, False: 25]
  ------------------
 9422|     25|  boundary = it->second;
 9423|       |  // RFC 2046 5.1.1 caps a boundary at 70 characters. The parser scans the body
 9424|       |  // for "--" + boundary, so a body crafted to repeat that delimiter's leading
 9425|       |  // bytes costs a nearly full comparison at nearly every position: the
 9426|       |  // boundary's length multiplies the worst-case cost of scanning a body.
 9427|     25|  return !boundary.empty() && boundary.size() <= 70;
  ------------------
  |  Branch (9427:10): [True: 24, False: 1]
  |  Branch (9427:31): [True: 14, False: 10]
  ------------------
 9428|    210|}
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEEC2Ev:
 1251|    546|  insertion_ordered_multimap() = default;
_ZN7httplib6detail24parse_disposition_paramsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS0_26insertion_ordered_multimapIS7_NS1_8equal_toIS7_EEEE:
 9430|    546|inline void parse_disposition_params(const std::string &s, Params &params) {
 9431|    546|  std::set<std::string> cache;
 9432|    546|  split_unquoted(
 9433|    546|      s.data(), s.data() + s.size(), ';', [&](const char *b, const char *e) {
 9434|    546|        std::string kv(b, e);
 9435|    546|        if (cache.find(kv) != cache.end()) { return; }
 9436|    546|        cache.insert(kv);
 9437|       |
 9438|    546|        std::string key;
 9439|    546|        std::string val;
 9440|    546|        divide_param_pair(b, e, key, val);
 9441|       |
 9442|    546|        if (!key.empty()) {
 9443|    546|          params.emplace(trim_double_quotes_copy(key), unquote_param(val));
 9444|    546|        }
 9445|    546|      });
 9446|    546|}
_ZZN7httplib6detail24parse_disposition_paramsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS0_26insertion_ordered_multimapIS7_NS1_8equal_toIS7_EEEEENKUlPKcSG_E_clESG_SG_:
 9433|   380k|      s.data(), s.data() + s.size(), ';', [&](const char *b, const char *e) {
 9434|   380k|        std::string kv(b, e);
 9435|   380k|        if (cache.find(kv) != cache.end()) { return; }
  ------------------
  |  Branch (9435:13): [True: 290k, False: 89.5k]
  ------------------
 9436|  89.5k|        cache.insert(kv);
 9437|       |
 9438|  89.5k|        std::string key;
 9439|  89.5k|        std::string val;
 9440|  89.5k|        divide_param_pair(b, e, key, val);
 9441|       |
 9442|  89.5k|        if (!key.empty()) {
  ------------------
  |  Branch (9442:13): [True: 88.7k, False: 751]
  ------------------
 9443|  88.7k|          params.emplace(trim_double_quotes_copy(key), unquote_param(val));
 9444|  88.7k|        }
 9445|  89.5k|      });
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE7emplaceIJS8_S8_EEENSB_10iterator_tINS2_4pairIS8_S8_EEEEDpOT_:
 1280|  88.7k|  template <typename... Args> iterator emplace(Args &&...args) {
 1281|  88.7k|    entries_.emplace_back(std::forward<Args>(args)...);
 1282|  88.7k|    return make_iter(entries_.size() - 1, npos());
 1283|  88.7k|  }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE9make_iterEmm:
 1389|  88.7k|  iterator make_iter(size_type idx, size_type key_idx) {
 1390|  88.7k|    return iterator(entries_.data(), idx, entries_.size(), key_idx);
 1391|  88.7k|  }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE10iterator_tINS2_4pairIS8_S8_EEEC2EPSE_mmm:
 1235|  88.7k|        : data_(data), idx_(idx), size_(size), key_idx_(key_idx) {}
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE4nposEv:
 1155|  88.7k|  static size_type npos() { return static_cast<size_type>(-1); }
_ZN7httplib6detail23trim_double_quotes_copyERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 6258|  88.7k|inline std::string trim_double_quotes_copy(const std::string &s) {
 6259|  88.7k|  if (s.length() >= 2 && s.front() == '"' && s.back() == '"') {
  ------------------
  |  Branch (6259:7): [True: 77.1k, False: 11.6k]
  |  Branch (6259:26): [True: 417, False: 76.7k]
  |  Branch (6259:46): [True: 109, False: 308]
  ------------------
 6260|    109|    return s.substr(1, s.size() - 2);
 6261|    109|  }
 6262|  88.6k|  return s;
 6263|  88.7k|}
_ZN7httplib6detail15parse_http_dateERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 5469|      3|inline time_t parse_http_date(const std::string &date_str) {
 5470|      3|  struct tm tm_buf;
 5471|       |
 5472|       |  // Create a classic locale object once for all parsing attempts
 5473|      3|  const std::locale classic_locale = std::locale::classic();
 5474|       |
 5475|       |  // Try to parse using std::get_time (C++11, cross-platform)
 5476|      3|  auto try_parse = [&](const char *fmt) -> bool {
 5477|      3|    std::istringstream ss(date_str);
 5478|      3|    ss.imbue(classic_locale);
 5479|       |
 5480|      3|    memset(&tm_buf, 0, sizeof(tm_buf));
 5481|      3|    ss >> std::get_time(&tm_buf, fmt);
 5482|       |
 5483|      3|    return !ss.fail();
 5484|      3|  };
 5485|       |
 5486|       |  // RFC 9110 preferred format (HTTP-date): "Sun, 06 Nov 1994 08:49:37 GMT"
 5487|      3|  if (!try_parse("%a, %d %b %Y %H:%M:%S")) {
  ------------------
  |  Branch (5487:7): [True: 2, False: 1]
  ------------------
 5488|       |    // RFC 850 format: "Sunday, 06-Nov-94 08:49:37 GMT"
 5489|      2|    if (!try_parse("%A, %d-%b-%y %H:%M:%S")) {
  ------------------
  |  Branch (5489:9): [True: 2, False: 0]
  ------------------
 5490|       |      // asctime format: "Sun Nov  6 08:49:37 1994"
 5491|      2|      if (!try_parse("%a %b %d %H:%M:%S %Y")) {
  ------------------
  |  Branch (5491:11): [True: 2, False: 0]
  ------------------
 5492|      2|        return static_cast<time_t>(-1);
 5493|      2|      }
 5494|      2|    }
 5495|      2|  }
 5496|       |
 5497|       |#ifdef _WIN32
 5498|       |  return _mkgmtime(&tm_buf);
 5499|       |#elif defined _AIX
 5500|       |  return mktime(&tm_buf);
 5501|       |#else
 5502|      1|  return timegm(&tm_buf);
 5503|      3|#endif
 5504|      3|}
_ZZN7httplib6detail15parse_http_dateERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENKUlPKcE_clESB_:
 5476|      7|  auto try_parse = [&](const char *fmt) -> bool {
 5477|      7|    std::istringstream ss(date_str);
 5478|      7|    ss.imbue(classic_locale);
 5479|       |
 5480|      7|    memset(&tm_buf, 0, sizeof(tm_buf));
 5481|      7|    ss >> std::get_time(&tm_buf, fmt);
 5482|       |
 5483|      7|    return !ss.fail();
 5484|      7|  };
_ZN7httplib6detail25can_compress_content_typeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7846|    659|inline bool can_compress_content_type(const std::string &content_type) {
 7847|       |  // Media types are case-insensitive (RFC 9110 §8.3.1)
 7848|    659|  auto mime_type = case_ignore::to_lower(extract_media_type(content_type));
 7849|       |
 7850|    659|  static const char *const compressible[] = {
 7851|    659|      "image/svg+xml",
 7852|    659|      "application/javascript",
 7853|    659|      "application/x-javascript",
 7854|    659|      "application/json",
 7855|    659|      "application/ld+json",
 7856|    659|      "application/xml",
 7857|    659|      "application/xhtml+xml",
 7858|    659|      "application/rss+xml",
 7859|    659|      "application/atom+xml",
 7860|    659|      "application/xslt+xml",
 7861|    659|      "application/protobuf",
 7862|    659|  };
 7863|       |
 7864|  7.24k|  for (auto type : compressible) {
  ------------------
  |  Branch (7864:18): [True: 7.24k, False: 659]
  ------------------
 7865|  7.24k|    if (mime_type == type) { return true; }
  ------------------
  |  Branch (7865:9): [True: 0, False: 7.24k]
  ------------------
 7866|  7.24k|  }
 7867|    659|  return mime_type != "text/event-stream" && !mime_type.rfind("text/", 0);
  ------------------
  |  Branch (7867:10): [True: 659, False: 0]
  |  Branch (7867:46): [True: 1, False: 658]
  ------------------
 7868|    659|}

LLVMFuzzerTestOneInput:
    7|  3.36k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
    8|  3.36k|  if (size < 2) return 0;
  ------------------
  |  Branch (8:7): [True: 1, False: 3.36k]
  ------------------
    9|       |
   10|  3.36k|  uint8_t selector = data[0];
   11|  3.36k|  const char *payload = reinterpret_cast<const char *>(data + 1);
   12|  3.36k|  size_t payload_size = size - 1;
   13|  3.36k|  std::string input(payload, payload_size);
   14|       |
   15|  3.36k|  switch (selector % 7) {
  ------------------
  |  Branch (15:11): [True: 3.36k, False: 0]
  ------------------
   16|    490|  case 0: {
  ------------------
  |  Branch (16:3): [True: 490, False: 2.87k]
  ------------------
   17|       |    // parse_range_header
   18|    490|    httplib::Ranges ranges;
   19|    490|    httplib::detail::parse_range_header(input, ranges);
   20|    490|    break;
   21|      0|  }
   22|  1.42k|  case 1: {
  ------------------
  |  Branch (22:3): [True: 1.42k, False: 1.94k]
  ------------------
   23|       |    // parse_accept_header
   24|  1.42k|    std::vector<std::string> content_types;
   25|  1.42k|    httplib::detail::parse_accept_header(input, content_types);
   26|  1.42k|    break;
   27|      0|  }
   28|     39|  case 2: {
  ------------------
  |  Branch (28:3): [True: 39, False: 3.32k]
  ------------------
   29|       |    // extract_media_type with params
   30|     39|    std::map<std::string, std::string> params;
   31|     39|    httplib::detail::extract_media_type(input, &params);
   32|     39|    break;
   33|      0|  }
   34|    210|  case 3: {
  ------------------
  |  Branch (34:3): [True: 210, False: 3.15k]
  ------------------
   35|       |    // parse_multipart_boundary
   36|    210|    std::string boundary;
   37|    210|    httplib::detail::parse_multipart_boundary(input, boundary);
   38|    210|    break;
   39|      0|  }
   40|    546|  case 4: {
  ------------------
  |  Branch (40:3): [True: 546, False: 2.82k]
  ------------------
   41|       |    // parse_disposition_params
   42|    546|    httplib::Params params;
   43|    546|    httplib::detail::parse_disposition_params(input, params);
   44|    546|    break;
   45|      0|  }
   46|      3|  case 5: {
  ------------------
  |  Branch (46:3): [True: 3, False: 3.36k]
  ------------------
   47|       |    // parse_http_date
   48|      3|    httplib::detail::parse_http_date(input);
   49|      3|    break;
   50|      0|  }
   51|    659|  case 6: {
  ------------------
  |  Branch (51:3): [True: 659, False: 2.70k]
  ------------------
   52|       |    // can_compress_content_type
   53|    659|    httplib::detail::can_compress_content_type(input);
   54|    659|    break;
   55|      0|  }
   56|  3.36k|  }
   57|       |
   58|  3.36k|  return 0;
   59|  3.36k|}

