_ZN7httplib6detail18parse_range_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS1_6vectorINS1_4pairIllEENS5_ISC_EEEE:
 9384|    490|inline bool parse_range_header(const std::string &s, Ranges &ranges) try {
 9385|    490|#endif
 9386|    490|  auto is_valid = [](const std::string &str) {
 9387|    490|    return std::all_of(str.cbegin(), str.cend(), is_ascii_digit);
 9388|    490|  };
 9389|       |
 9390|    490|  if (s.size() > 7 && case_ignore::equal(s.substr(0, 6), "bytes=")) {
  ------------------
  |  Branch (9390:7): [True: 485, False: 5]
  |  Branch (9390:7): [True: 467, False: 23]
  |  Branch (9390:23): [True: 467, False: 18]
  ------------------
 9391|    467|    const auto pos = static_cast<size_t>(6);
 9392|    467|    const auto len = static_cast<size_t>(s.size() - 6);
 9393|    467|    auto all_valid_ranges = true;
 9394|    467|    split(&s[pos], &s[pos + len], ',', [&](const char *b, const char *e) {
 9395|    467|      if (!all_valid_ranges) { return; }
 9396|       |
 9397|    467|      const auto it = std::find(b, e, '-');
 9398|    467|      if (it == e) {
 9399|    467|        all_valid_ranges = false;
 9400|    467|        return;
 9401|    467|      }
 9402|       |
 9403|    467|      const auto lhs = std::string(b, it);
 9404|    467|      const auto rhs = std::string(it + 1, e);
 9405|    467|      if (!is_valid(lhs) || !is_valid(rhs)) {
 9406|    467|        all_valid_ranges = false;
 9407|    467|        return;
 9408|    467|      }
 9409|       |
 9410|    467|      ssize_t first = -1;
 9411|    467|      if (!lhs.empty()) {
 9412|       |        // Reject an overflowing first-byte-pos; treating it as absent (-1)
 9413|       |        // would turn the range into a suffix range.
 9414|    467|        auto res =
 9415|    467|            detail::from_chars(lhs.data(), lhs.data() + lhs.size(), first);
 9416|    467|        if (res.ec != std::errc{}) {
 9417|    467|          all_valid_ranges = false;
 9418|    467|          return;
 9419|    467|        }
 9420|    467|      }
 9421|       |
 9422|    467|      ssize_t last = -1;
 9423|    467|      if (!rhs.empty()) {
 9424|       |        // An overflowing last-byte-pos is past any content length, so keeping
 9425|       |        // -1 ("remainder", RFC 9110 14.1.2) is correct here.
 9426|    467|        ssize_t v;
 9427|    467|        auto res = detail::from_chars(rhs.data(), rhs.data() + rhs.size(), v);
 9428|    467|        if (res.ec == std::errc{}) { last = v; }
 9429|    467|      }
 9430|       |
 9431|    467|      if ((first == -1 && last == -1) ||
 9432|    467|          (first != -1 && last != -1 && first > last)) {
 9433|    467|        all_valid_ranges = false;
 9434|    467|        return;
 9435|    467|      }
 9436|       |
 9437|    467|      ranges.emplace_back(first, last);
 9438|    467|    });
 9439|    467|    return all_valid_ranges && !ranges.empty();
  ------------------
  |  Branch (9439:12): [True: 242, False: 225]
  |  Branch (9439:32): [True: 241, False: 1]
  ------------------
 9440|    467|  }
 9441|     23|  return false;
 9442|       |#ifdef CPPHTTPLIB_NO_EXCEPTIONS
 9443|       |}
 9444|       |#else
 9445|    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:
 6252|  1.88k|                  std::function<void(const char *, const char *)> fn) {
 6253|  1.88k|  return split(b, e, d, (std::numeric_limits<size_t>::max)(), std::move(fn));
 6254|  1.88k|}
_ZN7httplib6detail5splitEPKcS2_cmNSt3__18functionIFvS2_S2_EEE:
 6257|  1.88k|                  std::function<void(const char *, const char *)> fn) {
 6258|  1.88k|  size_t i = 0;
 6259|  1.88k|  size_t beg = 0;
 6260|  1.88k|  size_t count = 1;
 6261|       |
 6262|  44.7M|  while (e ? (b + i < e) : (b[i] != '\0')) {
  ------------------
  |  Branch (6262:10): [True: 44.7M, False: 0]
  |  Branch (6262:10): [True: 44.7M, False: 1.88k]
  ------------------
 6263|  44.7M|    if (b[i] == d && count < m) {
  ------------------
  |  Branch (6263:9): [True: 8.27M, False: 36.4M]
  |  Branch (6263:22): [True: 8.27M, False: 0]
  ------------------
 6264|  8.27M|      auto r = trim(b, e, beg, i);
 6265|  8.27M|      if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (6265:11): [True: 6.70M, False: 1.56M]
  ------------------
 6266|  8.27M|      beg = i + 1;
 6267|  8.27M|      count++;
 6268|  8.27M|    }
 6269|  44.7M|    i++;
 6270|  44.7M|  }
 6271|       |
 6272|  1.88k|  if (i) {
  ------------------
  |  Branch (6272:7): [True: 1.88k, False: 0]
  ------------------
 6273|  1.88k|    auto r = trim(b, e, beg, i);
 6274|  1.88k|    if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (6274:9): [True: 1.79k, False: 89]
  ------------------
 6275|  1.88k|  }
 6276|  1.88k|}
_ZN7httplib6detail4trimEPKcS2_mm:
 6192|  43.3M|                                      size_t right) {
 6193|  48.1M|  while (b + left < e && is_space_or_tab(b[left])) {
  ------------------
  |  Branch (6193:10): [True: 48.0M, False: 123k]
  |  Branch (6193:26): [True: 4.82M, False: 43.2M]
  ------------------
 6194|  4.82M|    left++;
 6195|  4.82M|  }
 6196|  48.2M|  while (right > 0 && is_space_or_tab(b[right - 1])) {
  ------------------
  |  Branch (6196:10): [True: 48.1M, False: 123k]
  |  Branch (6196:23): [True: 4.96M, False: 43.2M]
  ------------------
 6197|  4.96M|    right--;
 6198|  4.96M|  }
 6199|  43.3M|  return std::make_pair(left, right);
 6200|  43.3M|}
_ZN7httplib6detail15is_space_or_tabEc:
 6045|  96.2M|inline bool is_space_or_tab(char c) { return c == ' ' || c == '\t'; }
  ------------------
  |  Branch (6045:46): [True: 9.76M, False: 86.4M]
  |  Branch (6045:58): [True: 18.7k, False: 86.4M]
  ------------------
_ZZN7httplib6detail18parse_range_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS1_6vectorINS1_4pairIllEENS5_ISC_EEEEENKUlPKcSH_E_clESH_SH_:
 9394|  76.1k|    split(&s[pos], &s[pos + len], ',', [&](const char *b, const char *e) {
 9395|  76.1k|      if (!all_valid_ranges) { return; }
  ------------------
  |  Branch (9395:11): [True: 11.0k, False: 65.0k]
  ------------------
 9396|       |
 9397|  65.0k|      const auto it = std::find(b, e, '-');
 9398|  65.0k|      if (it == e) {
  ------------------
  |  Branch (9398:11): [True: 12, False: 65.0k]
  ------------------
 9399|     12|        all_valid_ranges = false;
 9400|     12|        return;
 9401|     12|      }
 9402|       |
 9403|  65.0k|      const auto lhs = std::string(b, it);
 9404|  65.0k|      const auto rhs = std::string(it + 1, e);
 9405|  65.0k|      if (!is_valid(lhs) || !is_valid(rhs)) {
  ------------------
  |  Branch (9405:11): [True: 4, False: 65.0k]
  |  Branch (9405:29): [True: 13, False: 65.0k]
  ------------------
 9406|     17|        all_valid_ranges = false;
 9407|     17|        return;
 9408|     17|      }
 9409|       |
 9410|  65.0k|      ssize_t first = -1;
 9411|  65.0k|      if (!lhs.empty()) {
  ------------------
  |  Branch (9411:11): [True: 64.4k, False: 608]
  ------------------
 9412|       |        // Reject an overflowing first-byte-pos; treating it as absent (-1)
 9413|       |        // would turn the range into a suffix range.
 9414|  64.4k|        auto res =
 9415|  64.4k|            detail::from_chars(lhs.data(), lhs.data() + lhs.size(), first);
 9416|  64.4k|        if (res.ec != std::errc{}) {
  ------------------
  |  Branch (9416:13): [True: 32, False: 64.4k]
  ------------------
 9417|     32|          all_valid_ranges = false;
 9418|     32|          return;
 9419|     32|        }
 9420|  64.4k|      }
 9421|       |
 9422|  65.0k|      ssize_t last = -1;
 9423|  65.0k|      if (!rhs.empty()) {
  ------------------
  |  Branch (9423:11): [True: 1.25k, False: 63.7k]
  ------------------
 9424|       |        // An overflowing last-byte-pos is past any content length, so keeping
 9425|       |        // -1 ("remainder", RFC 9110 14.1.2) is correct here.
 9426|  1.25k|        ssize_t v;
 9427|  1.25k|        auto res = detail::from_chars(rhs.data(), rhs.data() + rhs.size(), v);
 9428|  1.25k|        if (res.ec == std::errc{}) { last = v; }
  ------------------
  |  Branch (9428:13): [True: 1.00k, False: 249]
  ------------------
 9429|  1.25k|      }
 9430|       |
 9431|  65.0k|      if ((first == -1 && last == -1) ||
  ------------------
  |  Branch (9431:12): [True: 608, False: 64.4k]
  |  Branch (9431:27): [True: 57, False: 551]
  ------------------
 9432|  64.9k|          (first != -1 && last != -1 && first > last)) {
  ------------------
  |  Branch (9432:12): [True: 64.4k, False: 551]
  |  Branch (9432:27): [True: 455, False: 63.9k]
  |  Branch (9432:41): [True: 107, False: 348]
  ------------------
 9433|    164|        all_valid_ranges = false;
 9434|    164|        return;
 9435|    164|      }
 9436|       |
 9437|  64.8k|      ranges.emplace_back(first, last);
 9438|  64.8k|    });
_ZZN7httplib6detail18parse_range_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS1_6vectorINS1_4pairIllEENS5_ISC_EEEEENKUlS9_E_clES9_:
 9386|   130k|  auto is_valid = [](const std::string &str) {
 9387|   130k|    return std::all_of(str.cbegin(), str.cend(), is_ascii_digit);
 9388|   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|  T result = 0;
  775|   140k|  for (; p != last; ++p) {
  ------------------
  |  Branch (775:10): [True: 74.7k, False: 65.4k]
  ------------------
  776|  74.7k|    char c = *p;
  777|  74.7k|    int digit = -1;
  778|  74.7k|    if (is_ascii_digit(c)) {
  ------------------
  |  Branch (778:9): [True: 74.7k, False: 0]
  ------------------
  779|  74.7k|      digit = c - '0';
  780|  74.7k|    } else if ('a' <= c && c <= 'z') {
  ------------------
  |  Branch (780:16): [True: 0, False: 0]
  |  Branch (780:28): [True: 0, False: 0]
  ------------------
  781|      0|      digit = c - 'a' + 10;
  782|      0|    } else if ('A' <= c && c <= 'Z') {
  ------------------
  |  Branch (782:16): [True: 0, False: 0]
  |  Branch (782:28): [True: 0, False: 0]
  ------------------
  783|      0|      digit = c - 'A' + 10;
  784|      0|    } else {
  785|      0|      break;
  786|      0|    }
  787|       |
  788|  74.7k|    if (digit < 0 || digit >= base) { break; }
  ------------------
  |  Branch (788:9): [True: 0, False: 74.7k]
  |  Branch (788:22): [True: 0, False: 74.7k]
  ------------------
  789|  74.7k|    if (result > ((std::numeric_limits<T>::max)() - digit) / base) {
  ------------------
  |  Branch (789:9): [True: 281, False: 74.5k]
  ------------------
  790|    281|      return {p, std::errc::result_out_of_range};
  791|    281|    }
  792|  74.5k|    result = result * base + digit;
  793|  74.5k|  }
  794|       |
  795|  65.4k|  if (p == first || (negative && p == first + 1)) {
  ------------------
  |  Branch (795:7): [True: 0, False: 65.4k]
  |  Branch (795:22): [True: 0, False: 65.4k]
  |  Branch (795:34): [True: 0, False: 0]
  ------------------
  796|      0|    return {first, std::errc::invalid_argument};
  797|      0|  }
  798|       |
  799|  65.4k|  value = negative ? T(0) - result : result;
  ------------------
  |  Branch (799:11): [True: 0, False: 65.4k]
  ------------------
  800|  65.4k|  return {p, std::errc{}};
  801|  65.4k|}
_ZN7httplib6detail19parse_accept_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS1_6vectorIS7_NS5_IS7_EEEE:
 9465|  1.51k|                                std::vector<std::string> &content_types) {
 9466|       |  // Parameter values are not used here, so a quoted-string is dropped rather
 9467|       |  // than parsed: a ',' or ';' inside one must not be read as a delimiter.
 9468|  1.51k|  if (s.find('"') != std::string::npos) {
  ------------------
  |  Branch (9468:7): [True: 96, False: 1.42k]
  ------------------
 9469|     96|    return parse_accept_header(remove_quoted_strings(s), content_types);
 9470|     96|  }
 9471|       |
 9472|  1.42k|  content_types.clear();
 9473|       |
 9474|       |  // Empty string is considered valid (no preference)
 9475|  1.42k|  if (s.empty()) { return true; }
  ------------------
  |  Branch (9475:7): [True: 2, False: 1.41k]
  ------------------
 9476|       |
 9477|  1.41k|  struct AcceptEntry {
 9478|  1.41k|    std::string media_type;
 9479|  1.41k|    double quality;
 9480|  1.41k|    int order;
 9481|  1.41k|  };
 9482|       |
 9483|  1.41k|  std::vector<AcceptEntry> entries;
 9484|  1.41k|  int order = 0;
 9485|  1.41k|  bool has_invalid_entry = false;
 9486|       |
 9487|       |  // Split by comma and parse each entry. RFC 9110 Section 5.6.1.2: a recipient
 9488|       |  // has to parse and ignore empty list elements, so a leading, trailing or
 9489|       |  // doubled comma must not turn a legal Accept value into 400 Bad Request.
 9490|       |  // split() skips them, and the header length limit bounds how many a sender
 9491|       |  // can send, so ignoring all of them cannot be used as a denial-of-service
 9492|       |  // vector.
 9493|  1.41k|  split(s.data(), s.data() + s.size(), ',', [&](const char *b, const char *e) {
 9494|  1.41k|    std::string entry(b, e);
 9495|  1.41k|    entry = trim_copy(entry);
 9496|       |
 9497|  1.41k|    AcceptEntry accept_entry;
 9498|  1.41k|    accept_entry.order = order++;
 9499|       |
 9500|  1.41k|    if (!parse_quality(entry.data(), entry.data() + entry.size(),
 9501|  1.41k|                       accept_entry.media_type, accept_entry.quality)) {
 9502|  1.41k|      has_invalid_entry = true;
 9503|  1.41k|      return;
 9504|  1.41k|    }
 9505|       |
 9506|       |    // Remove additional parameters from media type
 9507|  1.41k|    accept_entry.media_type = extract_media_type(accept_entry.media_type);
 9508|       |
 9509|       |    // Basic validation of media type format
 9510|  1.41k|    if (accept_entry.media_type.empty()) {
 9511|  1.41k|      has_invalid_entry = true;
 9512|  1.41k|      return;
 9513|  1.41k|    }
 9514|       |
 9515|       |    // Check for basic media type format (should contain '/' or be '*')
 9516|  1.41k|    if (accept_entry.media_type != "*" &&
 9517|  1.41k|        accept_entry.media_type.find('/') == std::string::npos) {
 9518|  1.41k|      has_invalid_entry = true;
 9519|  1.41k|      return;
 9520|  1.41k|    }
 9521|       |
 9522|  1.41k|    entries.push_back(std::move(accept_entry));
 9523|  1.41k|  });
 9524|       |
 9525|       |  // Return false if any invalid entry was found
 9526|  1.41k|  if (has_invalid_entry) { return false; }
  ------------------
  |  Branch (9526:7): [True: 927, False: 492]
  ------------------
 9527|       |
 9528|       |  // Sort by quality (descending), then by original order (ascending)
 9529|    492|  std::sort(entries.begin(), entries.end(),
 9530|    492|            [](const AcceptEntry &a, const AcceptEntry &b) {
 9531|    492|              if (a.quality != b.quality) {
 9532|    492|                return a.quality > b.quality; // Higher quality first
 9533|    492|              }
 9534|    492|              return a.order < b.order; // Earlier order first for same quality
 9535|    492|            });
 9536|       |
 9537|       |  // Extract sorted media types
 9538|    492|  content_types.reserve(entries.size());
 9539|  80.4k|  for (auto &entry : entries) {
  ------------------
  |  Branch (9539:20): [True: 80.4k, False: 492]
  ------------------
 9540|  80.4k|    content_types.push_back(std::move(entry.media_type));
 9541|  80.4k|  }
 9542|       |
 9543|    492|  return true;
 9544|  1.41k|}
_ZN7httplib6detail21remove_quoted_stringsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 9449|     96|inline std::string remove_quoted_strings(const std::string &s) {
 9450|     96|  std::string out;
 9451|     96|  auto in_quotes = false;
 9452|  14.8M|  for (size_t i = 0; i < s.size(); i++) {
  ------------------
  |  Branch (9452:22): [True: 14.8M, False: 96]
  ------------------
 9453|  14.8M|    if (s[i] == '"') {
  ------------------
  |  Branch (9453:9): [True: 23.5k, False: 14.8M]
  ------------------
 9454|  23.5k|      in_quotes = !in_quotes;
 9455|  14.8M|    } else if (!in_quotes) {
  ------------------
  |  Branch (9455:16): [True: 8.59M, False: 6.27M]
  ------------------
 9456|  8.59M|      out += s[i];
 9457|  8.59M|    } else if (s[i] == '\\') {
  ------------------
  |  Branch (9457:16): [True: 1, False: 6.27M]
  ------------------
 9458|      1|      i++;
 9459|      1|    }
 9460|  14.8M|  }
 9461|     96|  return out;
 9462|     96|}
_ZZN7httplib6detail19parse_accept_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS1_6vectorIS7_NS5_IS7_EEEEENKUlPKcSF_E_clESF_SF_:
 9493|  6.62M|  split(s.data(), s.data() + s.size(), ',', [&](const char *b, const char *e) {
 9494|  6.62M|    std::string entry(b, e);
 9495|  6.62M|    entry = trim_copy(entry);
 9496|       |
 9497|  6.62M|    AcceptEntry accept_entry;
 9498|  6.62M|    accept_entry.order = order++;
 9499|       |
 9500|  6.62M|    if (!parse_quality(entry.data(), entry.data() + entry.size(),
  ------------------
  |  Branch (9500:9): [True: 10.1k, False: 6.61M]
  ------------------
 9501|  6.62M|                       accept_entry.media_type, accept_entry.quality)) {
 9502|  10.1k|      has_invalid_entry = true;
 9503|  10.1k|      return;
 9504|  10.1k|    }
 9505|       |
 9506|       |    // Remove additional parameters from media type
 9507|  6.61M|    accept_entry.media_type = extract_media_type(accept_entry.media_type);
 9508|       |
 9509|       |    // Basic validation of media type format
 9510|  6.61M|    if (accept_entry.media_type.empty()) {
  ------------------
  |  Branch (9510:9): [True: 0, False: 6.61M]
  ------------------
 9511|      0|      has_invalid_entry = true;
 9512|      0|      return;
 9513|      0|    }
 9514|       |
 9515|       |    // Check for basic media type format (should contain '/' or be '*')
 9516|  6.61M|    if (accept_entry.media_type != "*" &&
  ------------------
  |  Branch (9516:9): [True: 6.36M, False: 253k]
  ------------------
 9517|  6.36M|        accept_entry.media_type.find('/') == std::string::npos) {
  ------------------
  |  Branch (9517:9): [True: 1.43k, False: 6.36M]
  ------------------
 9518|  1.43k|      has_invalid_entry = true;
 9519|  1.43k|      return;
 9520|  1.43k|    }
 9521|       |
 9522|  6.61M|    entries.push_back(std::move(accept_entry));
 9523|  6.61M|  });
_ZN7httplib6detail9trim_copyERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 6202|  13.2M|inline std::string trim_copy(const std::string &s) {
 6203|  13.2M|  auto r = trim(s.data(), s.data() + s.size(), 0, s.size());
 6204|  13.2M|  return s.substr(r.first, r.second - r.first);
 6205|  13.2M|}
_ZN7httplib6detail13parse_qualityEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERd:
 7803|  6.62M|                          double &quality) {
 7804|  6.62M|  quality = 1.0;
 7805|  6.62M|  token.clear();
 7806|       |
 7807|       |  // Split on first ';': left = token name, right = parameters
 7808|  6.62M|  const char *params_b = nullptr;
 7809|  6.62M|  std::size_t params_len = 0;
 7810|       |
 7811|  6.62M|  divide(
 7812|  6.62M|      b, static_cast<std::size_t>(e - b), ';',
 7813|  6.62M|      [&](const char *lb, std::size_t llen, const char *rb, std::size_t rlen) {
 7814|  6.62M|        auto r = trim(lb, lb + llen, 0, llen);
 7815|  6.62M|        if (r.first < r.second) { token.assign(lb + r.first, lb + r.second); }
 7816|  6.62M|        params_b = rb;
 7817|  6.62M|        params_len = rlen;
 7818|  6.62M|      });
 7819|       |
 7820|  6.62M|  if (token.empty()) { return false; }
  ------------------
  |  Branch (7820:7): [True: 372, False: 6.62M]
  ------------------
 7821|  6.62M|  if (params_len == 0) { return true; }
  ------------------
  |  Branch (7821:7): [True: 6.55M, False: 76.9k]
  ------------------
 7822|       |
 7823|       |  // Scan parameters for q= (stops on first match)
 7824|  76.9k|  bool invalid = false;
 7825|  76.9k|  split_find(params_b, params_b + params_len, ';',
 7826|  76.9k|             (std::numeric_limits<size_t>::max)(),
 7827|  76.9k|             [&](const char *pb, const char *pe) -> bool {
 7828|       |               // Match exactly "q=" or "Q=" (not "query=" etc.)
 7829|  76.9k|               auto len = static_cast<size_t>(pe - pb);
 7830|  76.9k|               if (len < 2) { return false; }
 7831|  76.9k|               if ((pb[0] != 'q' && pb[0] != 'Q') || pb[1] != '=') {
 7832|  76.9k|                 return false;
 7833|  76.9k|               }
 7834|       |
 7835|       |               // Trim the value portion
 7836|  76.9k|               auto r = trim(pb, pe, 2, len);
 7837|  76.9k|               if (r.first >= r.second) {
 7838|  76.9k|                 invalid = true;
 7839|  76.9k|                 return true;
 7840|  76.9k|               }
 7841|       |
 7842|  76.9k|               double v = 0.0;
 7843|  76.9k|               auto res = from_chars(pb + r.first, pb + r.second, v);
 7844|  76.9k|               if (res.ec != std::errc{} || res.ptr != pb + r.second ||
 7845|  76.9k|                   v < 0.0 || v > 1.0) {
 7846|  76.9k|                 invalid = true;
 7847|  76.9k|                 return true;
 7848|  76.9k|               }
 7849|  76.9k|               quality = v;
 7850|  76.9k|               return true;
 7851|  76.9k|             });
 7852|       |
 7853|  76.9k|  return !invalid;
 7854|  6.62M|}
_ZN7httplib6detail6divideEPKcmcNSt3__18functionIFvS2_mS2_mEEE:
 6233|  6.75M|           fn) {
 6234|  6.75M|  const auto it = std::find(data, data + size, d);
 6235|  6.75M|  const auto found = static_cast<std::size_t>(it != data + size);
 6236|  6.75M|  const auto lhs_data = data;
 6237|  6.75M|  const auto lhs_size = static_cast<std::size_t>(it - data);
 6238|  6.75M|  const auto rhs_data = it + found;
 6239|  6.75M|  const auto rhs_size = size - lhs_size - found;
 6240|       |
 6241|  6.75M|  fn(lhs_data, lhs_size, rhs_data, rhs_size);
 6242|  6.75M|}
_ZZN7httplib6detail13parse_qualityEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERdENKUlS2_mS2_mE_clES2_mS2_m:
 7813|  6.62M|      [&](const char *lb, std::size_t llen, const char *rb, std::size_t rlen) {
 7814|  6.62M|        auto r = trim(lb, lb + llen, 0, llen);
 7815|  6.62M|        if (r.first < r.second) { token.assign(lb + r.first, lb + r.second); }
  ------------------
  |  Branch (7815:13): [True: 6.62M, False: 372]
  ------------------
 7816|  6.62M|        params_b = rb;
 7817|  6.62M|        params_len = rlen;
 7818|  6.62M|      });
_ZN7httplib6detail10split_findEPKcS2_cmNSt3__18functionIFbS2_S2_EEE:
 6332|  76.9k|                       std::function<bool(const char *, const char *)> fn) {
 6333|  76.9k|  size_t i = 0;
 6334|  76.9k|  size_t beg = 0;
 6335|  76.9k|  size_t count = 1;
 6336|       |
 6337|  19.8M|  while (e ? (b + i < e) : (b[i] != '\0')) {
  ------------------
  |  Branch (6337:10): [True: 19.8M, False: 0]
  |  Branch (6337:10): [True: 19.7M, False: 74.8k]
  ------------------
 6338|  19.7M|    if (b[i] == d && count < m) {
  ------------------
  |  Branch (6338:9): [True: 9.25M, False: 10.5M]
  |  Branch (6338:22): [True: 9.25M, False: 0]
  ------------------
 6339|  9.25M|      auto r = trim(b, e, beg, i);
 6340|  9.25M|      if (r.first < r.second) {
  ------------------
  |  Branch (6340:11): [True: 893k, False: 8.35M]
  ------------------
 6341|   893k|        auto found = fn(&b[r.first], &b[r.second]);
 6342|   893k|        if (found) { return true; }
  ------------------
  |  Branch (6342:13): [True: 2.11k, False: 891k]
  ------------------
 6343|   893k|      }
 6344|  9.25M|      beg = i + 1;
 6345|  9.25M|      count++;
 6346|  9.25M|    }
 6347|  19.7M|    i++;
 6348|  19.7M|  }
 6349|       |
 6350|  74.8k|  if (i) {
  ------------------
  |  Branch (6350:7): [True: 74.8k, False: 0]
  ------------------
 6351|  74.8k|    auto r = trim(b, e, beg, i);
 6352|  74.8k|    if (r.first < r.second) {
  ------------------
  |  Branch (6352:9): [True: 74.2k, False: 648]
  ------------------
 6353|  74.2k|      auto found = fn(&b[r.first], &b[r.second]);
 6354|  74.2k|      if (found) { return true; }
  ------------------
  |  Branch (6354:11): [True: 64.8k, False: 9.35k]
  ------------------
 6355|  74.2k|    }
 6356|  74.8k|  }
 6357|       |
 6358|  10.0k|  return false;
 6359|  74.8k|}
_ZZN7httplib6detail13parse_qualityEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERdENKUlS2_S2_E_clES2_S2_:
 7827|   967k|             [&](const char *pb, const char *pe) -> bool {
 7828|       |               // Match exactly "q=" or "Q=" (not "query=" etc.)
 7829|   967k|               auto len = static_cast<size_t>(pe - pb);
 7830|   967k|               if (len < 2) { return false; }
  ------------------
  |  Branch (7830:20): [True: 884k, False: 82.9k]
  ------------------
 7831|  82.9k|               if ((pb[0] != 'q' && pb[0] != 'Q') || pb[1] != '=') {
  ------------------
  |  Branch (7831:21): [True: 15.0k, False: 67.9k]
  |  Branch (7831:37): [True: 10.1k, False: 4.85k]
  |  Branch (7831:54): [True: 5.78k, False: 66.9k]
  ------------------
 7832|  15.9k|                 return false;
 7833|  15.9k|               }
 7834|       |
 7835|       |               // Trim the value portion
 7836|  66.9k|               auto r = trim(pb, pe, 2, len);
 7837|  66.9k|               if (r.first >= r.second) {
  ------------------
  |  Branch (7837:20): [True: 396, False: 66.5k]
  ------------------
 7838|    396|                 invalid = true;
 7839|    396|                 return true;
 7840|    396|               }
 7841|       |
 7842|  66.5k|               double v = 0.0;
 7843|  66.5k|               auto res = from_chars(pb + r.first, pb + r.second, v);
 7844|  66.5k|               if (res.ec != std::errc{} || res.ptr != pb + r.second ||
  ------------------
  |  Branch (7844:20): [True: 679, False: 65.9k]
  |  Branch (7844:45): [True: 8.32k, False: 57.5k]
  ------------------
 7845|  57.5k|                   v < 0.0 || v > 1.0) {
  ------------------
  |  Branch (7845:20): [True: 0, False: 57.5k]
  |  Branch (7845:31): [True: 399, False: 57.1k]
  ------------------
 7846|  9.40k|                 invalid = true;
 7847|  9.40k|                 return true;
 7848|  9.40k|               }
 7849|  57.1k|               quality = v;
 7850|  57.1k|               return true;
 7851|  66.5k|             });
_ZN7httplib6detail10from_charsEPKcS2_Rd:
  817|  66.5k|                                            double &value) {
  818|  66.5k|  value = 0.0;
  819|  66.5k|  const char *p = first;
  820|       |
  821|       |  // Each 1eN is exactly representable, so a single final division by the
  822|       |  // matching entry yields a correctly-rounded result.
  823|  66.5k|  static const double powers_of_ten[] = {
  824|  66.5k|      1e0,  1e1,  1e2,  1e3,  1e4,  1e5,  1e6,  1e7,  1e8, 1e9,
  825|  66.5k|      1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18};
  826|  66.5k|  const int max_frac_digits =
  827|  66.5k|      static_cast<int>(sizeof(powers_of_ten) / sizeof(powers_of_ten[0])) - 1;
  828|       |
  829|       |  // Accumulate digits into a 64-bit integer and remember how many were
  830|       |  // fractional. Two independent caps keep this bounded and safe:
  831|       |  //   * accumulation saturates before mantissa could overflow uint64_t, and
  832|       |  //   * frac_digits is capped at max_frac_digits so it is always a valid index
  833|       |  //     into powers_of_ten (without this an input like "0.000...0" would never
  834|       |  //     grow mantissa, so the saturation cap alone would not bound it).
  835|       |  // Both caps only drop digits far beyond the precision a q-value needs; any
  836|       |  // value they would change is well outside [0, 1] and rejected by the caller.
  837|  66.5k|  uint64_t mantissa = 0;
  838|  66.5k|  int frac_digits = 0;
  839|  66.5k|  bool seen_digit = false;
  840|       |
  841|  66.5k|  const uint64_t limit = ((std::numeric_limits<uint64_t>::max)() - 9) / 10;
  842|  66.5k|  auto accumulate = [&](char c) {
  843|  66.5k|    if (mantissa <= limit) {
  844|  66.5k|      mantissa = mantissa * 10 + static_cast<uint64_t>(c - '0');
  845|  66.5k|      return true;
  846|  66.5k|    }
  847|  66.5k|    return false;
  848|  66.5k|  };
  849|       |
  850|   136k|  for (; p != last && is_ascii_digit(*p); ++p) {
  ------------------
  |  Branch (850:10): [True: 80.2k, False: 56.6k]
  |  Branch (850:23): [True: 70.3k, False: 9.88k]
  ------------------
  851|  70.3k|    seen_digit = true;
  852|  70.3k|    accumulate(*p);
  853|  70.3k|  }
  854|       |
  855|  66.5k|  if (p != last && *p == '.') {
  ------------------
  |  Branch (855:7): [True: 9.88k, False: 56.6k]
  |  Branch (855:20): [True: 2.76k, False: 7.12k]
  ------------------
  856|  2.76k|    ++p;
  857|  6.39k|    for (; p != last && is_ascii_digit(*p); ++p) {
  ------------------
  |  Branch (857:12): [True: 5.28k, False: 1.11k]
  |  Branch (857:25): [True: 3.63k, False: 1.65k]
  ------------------
  858|  3.63k|      seen_digit = true;
  859|  3.63k|      if (frac_digits < max_frac_digits && accumulate(*p)) { ++frac_digits; }
  ------------------
  |  Branch (859:11): [True: 3.26k, False: 365]
  |  Branch (859:44): [True: 3.03k, False: 236]
  ------------------
  860|  3.63k|    }
  861|  2.76k|  }
  862|       |
  863|  66.5k|  if (!seen_digit) { return {first, std::errc::invalid_argument}; }
  ------------------
  |  Branch (863:7): [True: 679, False: 65.9k]
  ------------------
  864|       |
  865|  65.9k|  value = static_cast<double>(mantissa) / powers_of_ten[frac_digits];
  866|  65.9k|  return {p, std::errc{}};
  867|  66.5k|}
_ZZN7httplib6detail10from_charsEPKcS2_RdENKUlcE_clEc:
  842|  73.6k|  auto accumulate = [&](char c) {
  843|  73.6k|    if (mantissa <= limit) {
  ------------------
  |  Branch (843:9): [True: 72.8k, False: 736]
  ------------------
  844|  72.8k|      mantissa = mantissa * 10 + static_cast<uint64_t>(c - '0');
  845|  72.8k|      return true;
  846|  72.8k|    }
  847|    736|    return false;
  848|  73.6k|  };
_ZZN7httplib6detail19parse_accept_headerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS1_6vectorIS7_NS5_IS7_EEEEENKUlRKZNS0_19parse_accept_headerES9_SD_E11AcceptEntrySG_E_clESG_SG_:
 9530|  1.15M|            [](const AcceptEntry &a, const AcceptEntry &b) {
 9531|  1.15M|              if (a.quality != b.quality) {
  ------------------
  |  Branch (9531:19): [True: 4.91k, False: 1.14M]
  ------------------
 9532|  4.91k|                return a.quality > b.quality; // Higher quality first
 9533|  4.91k|              }
 9534|  1.14M|              return a.order < b.order; // Earlier order first for same quality
 9535|  1.15M|            });
_ZN7httplib6detail18extract_media_typeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEPNS1_3mapIS7_S7_NS1_4lessIS7_EENS5_INS1_4pairIS8_S7_EEEEEE:
 7748|  6.61M|                   std::map<std::string, std::string> *params = nullptr) {
 7749|       |  // Extract type/subtype from Content-Type value (RFC 2045)
 7750|       |  // e.g. "application/json; charset=utf-8" -> "application/json"
 7751|  6.61M|  auto media_type = content_type;
 7752|  6.61M|  auto semicolon_pos = media_type.find(';');
 7753|  6.61M|  if (semicolon_pos != std::string::npos) {
  ------------------
  |  Branch (7753:7): [True: 255, False: 6.61M]
  ------------------
 7754|    255|    auto param_str = media_type.substr(semicolon_pos + 1);
 7755|    255|    media_type = media_type.substr(0, semicolon_pos);
 7756|       |
 7757|    255|    if (params) {
  ------------------
  |  Branch (7757:9): [True: 237, False: 18]
  ------------------
 7758|       |      // Parse parameters: key=value pairs separated by ';'
 7759|    237|      split_unquoted(param_str.data(), param_str.data() + param_str.size(), ';',
 7760|    237|                     [&](const char *b, const char *e) {
 7761|    237|                       std::string key;
 7762|    237|                       std::string val;
 7763|    237|                       divide_param_pair(b, e, key, val);
 7764|       |                       // Parameter names are case-insensitive (RFC 9110
 7765|       |                       // §5.6.6)
 7766|    237|                       if (!key.empty()) {
 7767|    237|                         params->emplace(case_ignore::to_lower(trim_copy(key)),
 7768|    237|                                         unquote_param(val));
 7769|    237|                       }
 7770|    237|                     });
 7771|    237|    }
 7772|    255|  }
 7773|       |
 7774|       |  // Trim whitespace from media type
 7775|  6.61M|  return trim_copy(media_type);
 7776|  6.61M|}
_ZN7httplib6detail14split_unquotedEPKcS2_cNSt3__18functionIFvS2_S2_EEE:
 6311|    783|                           std::function<void(const char *, const char *)> fn) {
 6312|    783|  return split_unquoted(b, e, d, (std::numeric_limits<size_t>::max)(),
 6313|    783|                        std::move(fn));
 6314|    783|}
_ZN7httplib6detail14split_unquotedEPKcS2_cmNSt3__18functionIFvS2_S2_EEE:
 6282|    783|                           std::function<void(const char *, const char *)> fn) {
 6283|    783|  size_t i = 0;
 6284|    783|  size_t beg = 0;
 6285|    783|  size_t count = 1;
 6286|    783|  auto in_quotes = false;
 6287|       |
 6288|    783|  auto has = [&](size_t j) { return e ? (b + j < e) : (b[j] != '\0'); };
 6289|  34.4M|  while (has(i)) {
  ------------------
  |  Branch (6289:10): [True: 34.4M, False: 783]
  ------------------
 6290|  34.4M|    if (in_quotes && b[i] == '\\' && has(i + 1)) {
  ------------------
  |  Branch (6290:9): [True: 10.7M, False: 23.6M]
  |  Branch (6290:22): [True: 2.08k, False: 10.7M]
  |  Branch (6290:38): [True: 2.08k, False: 0]
  ------------------
 6291|       |      // A quoted-pair, whose second character does not end the string.
 6292|  2.08k|      i++;
 6293|  34.4M|    } else if (b[i] == '"') {
  ------------------
  |  Branch (6293:16): [True: 14.1k, False: 34.3M]
  ------------------
 6294|  14.1k|      in_quotes = !in_quotes;
 6295|  34.3M|    } else if (b[i] == d && !in_quotes && count < m) {
  ------------------
  |  Branch (6295:16): [True: 6.23M, False: 28.1M]
  |  Branch (6295:29): [True: 5.50M, False: 736k]
  |  Branch (6295:43): [True: 5.50M, False: 0]
  ------------------
 6296|  5.50M|      auto r = trim(b, e, beg, i);
 6297|  5.50M|      if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (6297:11): [True: 415k, False: 5.08M]
  ------------------
 6298|  5.50M|      beg = i + 1;
 6299|  5.50M|      count++;
 6300|  5.50M|    }
 6301|  34.4M|    i++;
 6302|  34.4M|  }
 6303|       |
 6304|    783|  if (i) {
  ------------------
  |  Branch (6304:7): [True: 776, False: 7]
  ------------------
 6305|    776|    auto r = trim(b, e, beg, i);
 6306|    776|    if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (6306:9): [True: 676, False: 100]
  ------------------
 6307|    776|  }
 6308|    783|}
_ZZN7httplib6detail14split_unquotedEPKcS2_cmNSt3__18functionIFvS2_S2_EEEENKUlmE_clEm:
 6288|  34.4M|  auto has = [&](size_t j) { return e ? (b + j < e) : (b[j] != '\0'); };
  ------------------
  |  Branch (6288: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_:
 7760|  35.9k|                     [&](const char *b, const char *e) {
 7761|  35.9k|                       std::string key;
 7762|  35.9k|                       std::string val;
 7763|  35.9k|                       divide_param_pair(b, e, key, val);
 7764|       |                       // Parameter names are case-insensitive (RFC 9110
 7765|       |                       // §5.6.6)
 7766|  35.9k|                       if (!key.empty()) {
  ------------------
  |  Branch (7766:28): [True: 35.3k, False: 584]
  ------------------
 7767|  35.3k|                         params->emplace(case_ignore::to_lower(trim_copy(key)),
 7768|  35.3k|                                         unquote_param(val));
 7769|  35.3k|                       }
 7770|  35.9k|                     });
_ZN7httplib6detail17divide_param_pairEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_:
 6320|   125k|                              std::string &val) {
 6321|   125k|  divide(
 6322|   125k|      b, static_cast<std::size_t>(e - b), '=',
 6323|   125k|      [&](const char *kb, std::size_t klen, const char *vb, std::size_t vlen) {
 6324|   125k|        const auto kr = trim(kb, kb + klen, 0, klen);
 6325|   125k|        key.assign(kb + kr.first, kb + kr.second);
 6326|   125k|        const auto vr = trim(vb, vb + vlen, 0, vlen);
 6327|   125k|        val.assign(vb + vr.first, vb + vr.second);
 6328|   125k|      });
 6329|   125k|}
_ZZN7httplib6detail17divide_param_pairEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_ENKUlS2_mS2_mE_clES2_mS2_m:
 6323|   125k|      [&](const char *kb, std::size_t klen, const char *vb, std::size_t vlen) {
 6324|   125k|        const auto kr = trim(kb, kb + klen, 0, klen);
 6325|   125k|        key.assign(kb + kr.first, kb + kr.second);
 6326|   125k|        const auto vr = trim(vb, vb + vlen, 0, vlen);
 6327|   125k|        val.assign(vb + vr.first, vb + vr.second);
 6328|   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:
 6217|   124k|inline std::string unquote_param(const std::string &s) {
 6218|   124k|  if (s.size() < 2 || s.front() != '"' || s.back() != '"') { return s; }
  ------------------
  |  Branch (6218:7): [True: 120k, False: 3.54k]
  |  Branch (6218:23): [True: 3.16k, False: 387]
  |  Branch (6218:43): [True: 200, False: 187]
  ------------------
 6219|    187|  std::string out;
 6220|    342|  for (size_t i = 1; i + 1 < s.size(); i++) {
  ------------------
  |  Branch (6220:22): [True: 155, False: 187]
  ------------------
 6221|    155|    if (s[i] == '\\' && i + 2 < s.size() &&
  ------------------
  |  Branch (6221:9): [True: 0, False: 155]
  |  Branch (6221:25): [True: 0, False: 0]
  ------------------
 6222|      0|        (s[i + 1] == '"' || s[i + 1] == '\\')) {
  ------------------
  |  Branch (6222:10): [True: 0, False: 0]
  |  Branch (6222:29): [True: 0, False: 0]
  ------------------
 6223|      0|      i++;
 6224|      0|    }
 6225|    155|    out += s[i];
 6226|    155|  }
 6227|    187|  return out;
 6228|   124k|}
_ZN7httplib6detail24parse_multipart_boundaryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERS7_:
 9350|    210|                                     std::string &boundary) {
 9351|    210|  std::map<std::string, std::string> params;
 9352|    210|  extract_media_type(content_type, &params);
 9353|    210|  auto it = params.find("boundary");
 9354|    210|  if (it == params.end()) { return false; }
  ------------------
  |  Branch (9354:7): [True: 185, False: 25]
  ------------------
 9355|     25|  boundary = it->second;
 9356|       |  // RFC 2046 5.1.1 caps a boundary at 70 characters. The parser scans the body
 9357|       |  // for "--" + boundary, so a body crafted to repeat that delimiter's leading
 9358|       |  // bytes costs a nearly full comparison at nearly every position: the
 9359|       |  // boundary's length multiplies the worst-case cost of scanning a body.
 9360|     25|  return !boundary.empty() && boundary.size() <= 70;
  ------------------
  |  Branch (9360:10): [True: 24, False: 1]
  |  Branch (9360:31): [True: 14, False: 10]
  ------------------
 9361|    210|}
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEEC2Ev:
 1249|    546|  insertion_ordered_multimap() = default;
_ZN7httplib6detail24parse_disposition_paramsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS0_26insertion_ordered_multimapIS7_NS1_8equal_toIS7_EEEE:
 9363|    546|inline void parse_disposition_params(const std::string &s, Params &params) {
 9364|    546|  std::set<std::string> cache;
 9365|    546|  split_unquoted(
 9366|    546|      s.data(), s.data() + s.size(), ';', [&](const char *b, const char *e) {
 9367|    546|        std::string kv(b, e);
 9368|    546|        if (cache.find(kv) != cache.end()) { return; }
 9369|    546|        cache.insert(kv);
 9370|       |
 9371|    546|        std::string key;
 9372|    546|        std::string val;
 9373|    546|        divide_param_pair(b, e, key, val);
 9374|       |
 9375|    546|        if (!key.empty()) {
 9376|    546|          params.emplace(trim_double_quotes_copy(key), unquote_param(val));
 9377|    546|        }
 9378|    546|      });
 9379|    546|}
_ZZN7httplib6detail24parse_disposition_paramsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS0_26insertion_ordered_multimapIS7_NS1_8equal_toIS7_EEEEENKUlPKcSG_E_clESG_SG_:
 9366|   380k|      s.data(), s.data() + s.size(), ';', [&](const char *b, const char *e) {
 9367|   380k|        std::string kv(b, e);
 9368|   380k|        if (cache.find(kv) != cache.end()) { return; }
  ------------------
  |  Branch (9368:13): [True: 290k, False: 89.5k]
  ------------------
 9369|  89.5k|        cache.insert(kv);
 9370|       |
 9371|  89.5k|        std::string key;
 9372|  89.5k|        std::string val;
 9373|  89.5k|        divide_param_pair(b, e, key, val);
 9374|       |
 9375|  89.5k|        if (!key.empty()) {
  ------------------
  |  Branch (9375:13): [True: 88.7k, False: 751]
  ------------------
 9376|  88.7k|          params.emplace(trim_double_quotes_copy(key), unquote_param(val));
 9377|  88.7k|        }
 9378|  89.5k|      });
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE7emplaceIJS8_S8_EEENSB_10iterator_tINS2_4pairIS8_S8_EEEEDpOT_:
 1278|  88.7k|  template <typename... Args> iterator emplace(Args &&...args) {
 1279|  88.7k|    entries_.emplace_back(std::forward<Args>(args)...);
 1280|  88.7k|    return make_iter(entries_.size() - 1, npos());
 1281|  88.7k|  }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE9make_iterEmm:
 1387|  88.7k|  iterator make_iter(size_type idx, size_type key_idx) {
 1388|  88.7k|    return iterator(entries_.data(), idx, entries_.size(), key_idx);
 1389|  88.7k|  }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE10iterator_tINS2_4pairIS8_S8_EEEC2EPSE_mmm:
 1233|  88.7k|        : data_(data), idx_(idx), size_(size), key_idx_(key_idx) {}
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE4nposEv:
 1153|  88.7k|  static size_type npos() { return static_cast<size_type>(-1); }
_ZN7httplib6detail23trim_double_quotes_copyERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 6207|  88.7k|inline std::string trim_double_quotes_copy(const std::string &s) {
 6208|  88.7k|  if (s.length() >= 2 && s.front() == '"' && s.back() == '"') {
  ------------------
  |  Branch (6208:7): [True: 77.1k, False: 11.6k]
  |  Branch (6208:26): [True: 417, False: 76.7k]
  |  Branch (6208:46): [True: 109, False: 308]
  ------------------
 6209|    109|    return s.substr(1, s.size() - 2);
 6210|    109|  }
 6211|  88.6k|  return s;
 6212|  88.7k|}
_ZN7httplib6detail15parse_http_dateERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 5418|      3|inline time_t parse_http_date(const std::string &date_str) {
 5419|      3|  struct tm tm_buf;
 5420|       |
 5421|       |  // Create a classic locale object once for all parsing attempts
 5422|      3|  const std::locale classic_locale = std::locale::classic();
 5423|       |
 5424|       |  // Try to parse using std::get_time (C++11, cross-platform)
 5425|      3|  auto try_parse = [&](const char *fmt) -> bool {
 5426|      3|    std::istringstream ss(date_str);
 5427|      3|    ss.imbue(classic_locale);
 5428|       |
 5429|      3|    memset(&tm_buf, 0, sizeof(tm_buf));
 5430|      3|    ss >> std::get_time(&tm_buf, fmt);
 5431|       |
 5432|      3|    return !ss.fail();
 5433|      3|  };
 5434|       |
 5435|       |  // RFC 9110 preferred format (HTTP-date): "Sun, 06 Nov 1994 08:49:37 GMT"
 5436|      3|  if (!try_parse("%a, %d %b %Y %H:%M:%S")) {
  ------------------
  |  Branch (5436:7): [True: 2, False: 1]
  ------------------
 5437|       |    // RFC 850 format: "Sunday, 06-Nov-94 08:49:37 GMT"
 5438|      2|    if (!try_parse("%A, %d-%b-%y %H:%M:%S")) {
  ------------------
  |  Branch (5438:9): [True: 2, False: 0]
  ------------------
 5439|       |      // asctime format: "Sun Nov  6 08:49:37 1994"
 5440|      2|      if (!try_parse("%a %b %d %H:%M:%S %Y")) {
  ------------------
  |  Branch (5440:11): [True: 2, False: 0]
  ------------------
 5441|      2|        return static_cast<time_t>(-1);
 5442|      2|      }
 5443|      2|    }
 5444|      2|  }
 5445|       |
 5446|       |#ifdef _WIN32
 5447|       |  return _mkgmtime(&tm_buf);
 5448|       |#elif defined _AIX
 5449|       |  return mktime(&tm_buf);
 5450|       |#else
 5451|      1|  return timegm(&tm_buf);
 5452|      3|#endif
 5453|      3|}
_ZZN7httplib6detail15parse_http_dateERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENKUlPKcE_clESB_:
 5425|      7|  auto try_parse = [&](const char *fmt) -> bool {
 5426|      7|    std::istringstream ss(date_str);
 5427|      7|    ss.imbue(classic_locale);
 5428|       |
 5429|      7|    memset(&tm_buf, 0, sizeof(tm_buf));
 5430|      7|    ss >> std::get_time(&tm_buf, fmt);
 5431|       |
 5432|      7|    return !ss.fail();
 5433|      7|  };
_ZN7httplib6detail25can_compress_content_typeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 7778|    659|inline bool can_compress_content_type(const std::string &content_type) {
 7779|       |  // Media types are case-insensitive (RFC 9110 §8.3.1)
 7780|    659|  auto mime_type = case_ignore::to_lower(extract_media_type(content_type));
 7781|       |
 7782|    659|  static const char *const compressible[] = {
 7783|    659|      "image/svg+xml",
 7784|    659|      "application/javascript",
 7785|    659|      "application/x-javascript",
 7786|    659|      "application/json",
 7787|    659|      "application/ld+json",
 7788|    659|      "application/xml",
 7789|    659|      "application/xhtml+xml",
 7790|    659|      "application/rss+xml",
 7791|    659|      "application/atom+xml",
 7792|    659|      "application/xslt+xml",
 7793|    659|      "application/protobuf",
 7794|    659|  };
 7795|       |
 7796|  7.24k|  for (auto type : compressible) {
  ------------------
  |  Branch (7796:18): [True: 7.24k, False: 659]
  ------------------
 7797|  7.24k|    if (mime_type == type) { return true; }
  ------------------
  |  Branch (7797:9): [True: 0, False: 7.24k]
  ------------------
 7798|  7.24k|  }
 7799|    659|  return mime_type != "text/event-stream" && !mime_type.rfind("text/", 0);
  ------------------
  |  Branch (7799:10): [True: 659, False: 0]
  |  Branch (7799:46): [True: 1, False: 658]
  ------------------
 7800|    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|}

