_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEEC2Ev:
 1249|    628|  insertion_ordered_multimap() = default;
_ZN7httplib6detail16parse_query_textEPKcmRNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS4_8equal_toISA_EEEE:
 9249|    628|                             Params &params) {
 9250|    628|  std::set<std::string> cache;
 9251|    628|  split(data, data + size, '&', [&](const char *b, const char *e) {
 9252|    628|    std::string kv(b, e);
 9253|    628|    if (cache.find(kv) != cache.end()) { return; }
 9254|    628|    cache.insert(std::move(kv));
 9255|       |
 9256|    628|    std::string key;
 9257|    628|    std::string val;
 9258|    628|    divide_query_pair(b, e, key, val);
 9259|       |
 9260|    628|    if (!key.empty()) {
 9261|    628|      params.emplace(decode_query_component(key), decode_query_component(val));
 9262|    628|    }
 9263|    628|  });
 9264|    628|}
_ZN7httplib6detail5splitEPKcS2_cNSt3__18functionIFvS2_S2_EEE:
 6252|    922|                  std::function<void(const char *, const char *)> fn) {
 6253|    922|  return split(b, e, d, (std::numeric_limits<size_t>::max)(), std::move(fn));
 6254|    922|}
_ZN7httplib6detail5splitEPKcS2_cmNSt3__18functionIFvS2_S2_EEE:
 6257|    922|                  std::function<void(const char *, const char *)> fn) {
 6258|    922|  size_t i = 0;
 6259|    922|  size_t beg = 0;
 6260|    922|  size_t count = 1;
 6261|       |
 6262|  39.5M|  while (e ? (b + i < e) : (b[i] != '\0')) {
  ------------------
  |  Branch (6262:10): [True: 39.5M, False: 0]
  |  Branch (6262:10): [True: 39.5M, False: 922]
  ------------------
 6263|  39.5M|    if (b[i] == d && count < m) {
  ------------------
  |  Branch (6263:9): [True: 4.54M, False: 34.9M]
  |  Branch (6263:22): [True: 4.54M, False: 0]
  ------------------
 6264|  4.54M|      auto r = trim(b, e, beg, i);
 6265|  4.54M|      if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (6265:11): [True: 243k, False: 4.30M]
  ------------------
 6266|  4.54M|      beg = i + 1;
 6267|  4.54M|      count++;
 6268|  4.54M|    }
 6269|  39.5M|    i++;
 6270|  39.5M|  }
 6271|       |
 6272|    922|  if (i) {
  ------------------
  |  Branch (6272:7): [True: 922, False: 0]
  ------------------
 6273|    922|    auto r = trim(b, e, beg, i);
 6274|    922|    if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (6274:9): [True: 816, False: 106]
  ------------------
 6275|    922|  }
 6276|    922|}
_ZN7httplib6detail4trimEPKcS2_mm:
 6192|  4.54M|                                      size_t right) {
 6193|  5.98M|  while (b + left < e && is_space_or_tab(b[left])) {
  ------------------
  |  Branch (6193:10): [True: 5.98M, False: 106]
  |  Branch (6193:26): [True: 1.43M, False: 4.54M]
  ------------------
 6194|  1.43M|    left++;
 6195|  1.43M|  }
 6196|  5.98M|  while (right > 0 && is_space_or_tab(b[right - 1])) {
  ------------------
  |  Branch (6196:10): [True: 5.98M, False: 66]
  |  Branch (6196:23): [True: 1.43M, False: 4.54M]
  ------------------
 6197|  1.43M|    right--;
 6198|  1.43M|  }
 6199|  4.54M|  return std::make_pair(left, right);
 6200|  4.54M|}
_ZN7httplib6detail15is_space_or_tabEc:
 6045|  11.9M|inline bool is_space_or_tab(char c) { return c == ' ' || c == '\t'; }
  ------------------
  |  Branch (6045:46): [True: 2.85M, False: 9.11M]
  |  Branch (6045:58): [True: 21.3k, False: 9.08M]
  ------------------
_ZZN7httplib6detail16parse_query_textEPKcmRNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS4_8equal_toISA_EEEEENKUlS2_S2_E_clES2_S2_:
 9251|   225k|  split(data, data + size, '&', [&](const char *b, const char *e) {
 9252|   225k|    std::string kv(b, e);
 9253|   225k|    if (cache.find(kv) != cache.end()) { return; }
  ------------------
  |  Branch (9253:9): [True: 115k, False: 109k]
  ------------------
 9254|   109k|    cache.insert(std::move(kv));
 9255|       |
 9256|   109k|    std::string key;
 9257|   109k|    std::string val;
 9258|   109k|    divide_query_pair(b, e, key, val);
 9259|       |
 9260|   109k|    if (!key.empty()) {
  ------------------
  |  Branch (9260:9): [True: 109k, False: 564]
  ------------------
 9261|   109k|      params.emplace(decode_query_component(key), decode_query_component(val));
 9262|   109k|    }
 9263|   109k|  });
_ZN7httplib6detail17divide_query_pairEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_:
 9239|   128k|                              std::string &val) {
 9240|   128k|  divide(b, static_cast<std::size_t>(e - b), '=',
 9241|   128k|         [&](const char *lhs_data, std::size_t lhs_size, const char *rhs_data,
 9242|   128k|             std::size_t rhs_size) {
 9243|   128k|           key.assign(lhs_data, lhs_size);
 9244|   128k|           val.assign(rhs_data, rhs_size);
 9245|   128k|         });
 9246|   128k|}
_ZN7httplib6detail6divideEPKcmcNSt3__18functionIFvS2_mS2_mEEE:
 6233|   128k|           fn) {
 6234|   128k|  const auto it = std::find(data, data + size, d);
 6235|   128k|  const auto found = static_cast<std::size_t>(it != data + size);
 6236|   128k|  const auto lhs_data = data;
 6237|   128k|  const auto lhs_size = static_cast<std::size_t>(it - data);
 6238|   128k|  const auto rhs_data = it + found;
 6239|   128k|  const auto rhs_size = size - lhs_size - found;
 6240|       |
 6241|   128k|  fn(lhs_data, lhs_size, rhs_data, rhs_size);
 6242|   128k|}
_ZZN7httplib6detail17divide_query_pairEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_ENKUlS2_mS2_mE_clES2_mS2_m:
 9242|   128k|             std::size_t rhs_size) {
 9243|   128k|           key.assign(lhs_data, lhs_size);
 9244|   128k|           val.assign(rhs_data, rhs_size);
 9245|   128k|         });
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE7emplaceIJS8_S8_EEENSB_10iterator_tINS2_4pairIS8_S8_EEEEDpOT_:
 1278|   109k|  template <typename... Args> iterator emplace(Args &&...args) {
 1279|   109k|    entries_.emplace_back(std::forward<Args>(args)...);
 1280|   109k|    return make_iter(entries_.size() - 1, npos());
 1281|   109k|  }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE9make_iterEmm:
 1387|   109k|  iterator make_iter(size_type idx, size_type key_idx) {
 1388|   109k|    return iterator(entries_.data(), idx, entries_.size(), key_idx);
 1389|   109k|  }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE10iterator_tINS2_4pairIS8_S8_EEEC2EPSE_mmm:
 1233|   109k|        : data_(data), idx_(idx), size_(size), key_idx_(key_idx) {}
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE4nposEv:
 1153|   109k|  static size_type npos() { return static_cast<size_type>(-1); }
_ZN7httplib22decode_query_componentERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEb:
11810|   253k|                                          bool plus_as_space) {
11811|   253k|  std::string result;
11812|   253k|  result.reserve(component.size());
11813|       |
11814|  37.4M|  for (size_t i = 0; i < component.size(); i++) {
  ------------------
  |  Branch (11814:22): [True: 37.1M, False: 253k]
  ------------------
11815|  37.1M|    if (component[i] == '%' && i + 2 < component.size()) {
  ------------------
  |  Branch (11815:9): [True: 830k, False: 36.3M]
  |  Branch (11815:32): [True: 827k, False: 2.70k]
  ------------------
11816|   827k|      auto val = 0;
11817|   827k|      if (detail::from_hex_to_i(component, i + 1, 2, val)) {
  ------------------
  |  Branch (11817:11): [True: 266k, False: 561k]
  ------------------
11818|   266k|        result += static_cast<char>(val);
11819|   266k|        i += 2;
11820|   561k|      } else {
11821|   561k|        result += component[i];
11822|   561k|      }
11823|  36.3M|    } else if (component[i] == '+' && plus_as_space) {
  ------------------
  |  Branch (11823:16): [True: 5.96k, False: 36.3M]
  |  Branch (11823:39): [True: 5.44k, False: 528]
  ------------------
11824|  5.44k|      result += ' '; // + becomes space in form-urlencoded
11825|  36.3M|    } else {
11826|  36.3M|      result += component[i];
11827|  36.3M|    }
11828|  37.1M|  }
11829|   253k|  return result;
11830|   253k|}
_ZN7httplib6detail13from_hex_to_iERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEmmRi:
 5353|   998k|                          int &val) {
 5354|   998k|  if (i >= s.size()) { return false; }
  ------------------
  |  Branch (5354:7): [True: 12, False: 998k]
  ------------------
 5355|       |
 5356|   998k|  val = 0;
 5357|  1.70M|  for (; cnt; i++, cnt--) {
  ------------------
  |  Branch (5357:10): [True: 1.38M, False: 322k]
  ------------------
 5358|  1.38M|    if (!s[i]) { return false; }
  ------------------
  |  Branch (5358:9): [True: 3.04k, False: 1.37M]
  ------------------
 5359|  1.37M|    auto v = 0;
 5360|  1.37M|    if (is_hex(s[i], v)) {
  ------------------
  |  Branch (5360:9): [True: 706k, False: 672k]
  ------------------
 5361|   706k|      val = val * 16 + v;
 5362|   706k|    } else {
 5363|   672k|      return false;
 5364|   672k|    }
 5365|  1.37M|  }
 5366|   322k|  return true;
 5367|   998k|}
_ZN7httplib6detail6is_hexEcRi:
 5338|  1.37M|inline bool is_hex(char c, int &v) {
 5339|  1.37M|  if (is_ascii_digit(c)) {
  ------------------
  |  Branch (5339:7): [True: 14.2k, False: 1.36M]
  ------------------
 5340|  14.2k|    v = c - '0';
 5341|  14.2k|    return true;
 5342|  1.36M|  } else if ('A' <= c && c <= 'F') {
  ------------------
  |  Branch (5342:14): [True: 944k, False: 420k]
  |  Branch (5342:26): [True: 72.8k, False: 871k]
  ------------------
 5343|  72.8k|    v = c - 'A' + 10;
 5344|  72.8k|    return true;
 5345|  1.29M|  } else if ('a' <= c && c <= 'f') {
  ------------------
  |  Branch (5345:14): [True: 870k, False: 421k]
  |  Branch (5345:26): [True: 619k, False: 250k]
  ------------------
 5346|   619k|    v = c - 'a' + 10;
 5347|   619k|    return true;
 5348|   619k|  }
 5349|   672k|  return false;
 5350|  1.37M|}
_ZN7httplib6detail14is_ascii_digitEc:
  642|  7.31M|inline bool is_ascii_digit(char c) { return '0' <= c && c <= '9'; }
  ------------------
  |  Branch (642:45): [True: 2.59M, False: 4.71M]
  |  Branch (642:57): [True: 1.07M, False: 1.52M]
  ------------------
_ZN7httplib21decode_path_componentERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
11714|    250|inline std::string decode_path_component(const std::string &component) {
11715|    250|  std::string result;
11716|    250|  result.reserve(component.size());
11717|       |
11718|  4.90M|  for (size_t i = 0; i < component.size(); i++) {
  ------------------
  |  Branch (11718:22): [True: 4.90M, False: 250]
  ------------------
11719|  4.90M|    if (component[i] == '%' && i + 1 < component.size()) {
  ------------------
  |  Branch (11719:9): [True: 170k, False: 4.73M]
  |  Branch (11719:32): [True: 170k, False: 10]
  ------------------
11720|   170k|      if (component[i + 1] == 'u') {
  ------------------
  |  Branch (11720:11): [True: 3.92k, False: 166k]
  ------------------
11721|       |        // Unicode %uXXXX encoding
11722|  3.92k|        auto val = 0;
11723|       |        // 4 digits Unicode codes: val is 0x0000-0xFFFF (from 4 hex digits),
11724|       |        // so to_utf8 writes at most 3 bytes. buff[4] is safe.
11725|  3.92k|        char buff[4];
11726|  3.92k|        size_t len = 0;
11727|  3.92k|        if (detail::from_hex_to_i(component, i + 2, 4, val) &&
  ------------------
  |  Branch (11727:13): [True: 2.46k, False: 1.45k]
  ------------------
11728|  2.46k|            (len = detail::to_utf8(val, buff)) > 0) {
  ------------------
  |  Branch (11728:13): [True: 2.10k, False: 359]
  ------------------
11729|  2.10k|          result.append(buff, len);
11730|  2.10k|          i += 5; // 'u0000'
11731|  2.10k|        } else {
11732|       |          // Not 4 hex digits, or a surrogate, which is no character: the
11733|       |          // escape is kept as it is rather than joining its neighbours
11734|  1.81k|          result += component[i];
11735|  1.81k|        }
11736|   166k|      } else {
11737|       |        // Standard %XX encoding
11738|   166k|        auto val = 0;
11739|   166k|        if (detail::from_hex_to_i(component, i + 1, 2, val)) {
  ------------------
  |  Branch (11739:13): [True: 54.4k, False: 112k]
  ------------------
11740|       |          // 2 digits hex codes
11741|  54.4k|          result += static_cast<char>(val);
11742|  54.4k|          i += 2; // 'XX'
11743|   112k|        } else {
11744|   112k|          result += component[i];
11745|   112k|        }
11746|   166k|      }
11747|  4.73M|    } else {
11748|  4.73M|      result += component[i];
11749|  4.73M|    }
11750|  4.90M|  }
11751|    250|  return result;
11752|    250|}
_ZN7httplib6detail7to_utf8EiPc:
 5466|  2.46k|inline size_t to_utf8(int code, char *buff) {
 5467|  2.46k|  if (code < 0x0080) {
  ------------------
  |  Branch (5467:7): [True: 695, False: 1.76k]
  ------------------
 5468|    695|    buff[0] = static_cast<char>(code & 0x7F);
 5469|    695|    return 1;
 5470|  1.76k|  } else if (code < 0x0800) {
  ------------------
  |  Branch (5470:14): [True: 432, False: 1.33k]
  ------------------
 5471|    432|    buff[0] = static_cast<char>(0xC0 | ((code >> 6) & 0x1F));
 5472|    432|    buff[1] = static_cast<char>(0x80 | (code & 0x3F));
 5473|    432|    return 2;
 5474|  1.33k|  } else if (code < 0xD800) {
  ------------------
  |  Branch (5474:14): [True: 714, False: 622]
  ------------------
 5475|    714|    buff[0] = static_cast<char>(0xE0 | ((code >> 12) & 0xF));
 5476|    714|    buff[1] = static_cast<char>(0x80 | ((code >> 6) & 0x3F));
 5477|    714|    buff[2] = static_cast<char>(0x80 | (code & 0x3F));
 5478|    714|    return 3;
 5479|    714|  } else if (code < 0xE000) { // D800 - DFFF is invalid...
  ------------------
  |  Branch (5479:14): [True: 359, False: 263]
  ------------------
 5480|    359|    return 0;
 5481|    359|  } else if (code < 0x10000) {
  ------------------
  |  Branch (5481:14): [True: 263, False: 0]
  ------------------
 5482|    263|    buff[0] = static_cast<char>(0xE0 | ((code >> 12) & 0xF));
 5483|    263|    buff[1] = static_cast<char>(0x80 | ((code >> 6) & 0x3F));
 5484|    263|    buff[2] = static_cast<char>(0x80 | (code & 0x3F));
 5485|    263|    return 3;
 5486|    263|  } else if (code < 0x110000) {
  ------------------
  |  Branch (5486:14): [True: 0, False: 0]
  ------------------
 5487|      0|    buff[0] = static_cast<char>(0xF0 | ((code >> 18) & 0x7));
 5488|      0|    buff[1] = static_cast<char>(0x80 | ((code >> 12) & 0x3F));
 5489|      0|    buff[2] = static_cast<char>(0x80 | ((code >> 6) & 0x3F));
 5490|      0|    buff[3] = static_cast<char>(0x80 | (code & 0x3F));
 5491|      0|    return 4;
 5492|      0|  }
 5493|       |
 5494|       |  // NOTREACHED
 5495|      0|  return 0;
 5496|  2.46k|}
_ZN7httplib22encode_query_componentERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEb:
11755|  19.4k|                                          bool space_as_plus) {
11756|  19.4k|  std::string result;
11757|  19.4k|  result.reserve(component.size() * 3);
11758|       |
11759|  5.95M|  for (size_t i = 0; i < component.size(); i++) {
  ------------------
  |  Branch (11759:22): [True: 5.93M, False: 19.4k]
  ------------------
11760|  5.93M|    auto c = static_cast<unsigned char>(component[i]);
11761|       |
11762|       |    // Unreserved characters per RFC 3986
11763|  5.93M|    if (detail::is_ascii_alnum(static_cast<char>(c)) || c == '-' || c == '.' ||
  ------------------
  |  Branch (11763:9): [True: 1.08M, False: 4.85M]
  |  Branch (11763:57): [True: 1.49k, False: 4.84M]
  |  Branch (11763:69): [True: 7.37k, False: 4.84M]
  ------------------
11764|  4.84M|        c == '_' || c == '~') {
  ------------------
  |  Branch (11764:9): [True: 1.19k, False: 4.84M]
  |  Branch (11764:21): [True: 930, False: 4.83M]
  ------------------
11765|  1.10M|      result += static_cast<char>(c);
11766|  1.10M|    }
11767|       |    // Space handling
11768|  4.83M|    else if (c == ' ') {
  ------------------
  |  Branch (11768:14): [True: 2.32k, False: 4.83M]
  ------------------
11769|  2.32k|      if (space_as_plus) {
  ------------------
  |  Branch (11769:11): [True: 2.32k, False: 0]
  ------------------
11770|  2.32k|        result += '+';
11771|  2.32k|      } else {
11772|      0|        result += "%20";
11773|      0|      }
11774|  2.32k|    }
11775|       |    // Plus sign handling
11776|  4.83M|    else if (c == '+') {
  ------------------
  |  Branch (11776:14): [True: 528, False: 4.83M]
  ------------------
11777|    528|      if (space_as_plus) {
  ------------------
  |  Branch (11777:11): [True: 528, False: 0]
  ------------------
11778|    528|        result += "%2B";
11779|    528|      } else {
11780|      0|        result += static_cast<char>(c);
11781|      0|      }
11782|    528|    }
11783|       |    // Query-safe sub-delimiters (excluding & and = which are query delimiters)
11784|  4.83M|    else if (c == '!' || c == '$' || c == '\'' || c == '(' || c == ')' ||
  ------------------
  |  Branch (11784:14): [True: 1.45k, False: 4.83M]
  |  Branch (11784:26): [True: 814, False: 4.83M]
  |  Branch (11784:38): [True: 1.09k, False: 4.83M]
  |  Branch (11784:51): [True: 864, False: 4.83M]
  |  Branch (11784:63): [True: 1.40k, False: 4.83M]
  ------------------
11785|  4.83M|             c == '*' || c == ',' || c == ';') {
  ------------------
  |  Branch (11785:14): [True: 1.46k, False: 4.82M]
  |  Branch (11785:26): [True: 2.32k, False: 4.82M]
  |  Branch (11785:38): [True: 1.10k, False: 4.82M]
  ------------------
11786|  10.5k|      result += static_cast<char>(c);
11787|  10.5k|    }
11788|       |    // Colon and @ are allowed in query
11789|  4.82M|    else if (c == ':' || c == '@') {
  ------------------
  |  Branch (11789:14): [True: 1.02k, False: 4.82M]
  |  Branch (11789:26): [True: 524k, False: 4.30M]
  ------------------
11790|   525k|      result += static_cast<char>(c);
11791|   525k|    }
11792|       |    // Forward slash is allowed in query values
11793|  4.30M|    else if (c == '/') {
  ------------------
  |  Branch (11793:14): [True: 5.24k, False: 4.29M]
  ------------------
11794|  5.24k|      result += static_cast<char>(c);
11795|  5.24k|    }
11796|       |    // Question mark is allowed in query values (after first ?)
11797|  4.29M|    else if (c == '?') {
  ------------------
  |  Branch (11797:14): [True: 818, False: 4.29M]
  ------------------
11798|    818|      result += static_cast<char>(c);
11799|  4.29M|    } else {
11800|  4.29M|      result += '%';
11801|  4.29M|      char hex[3];
11802|  4.29M|      snprintf(hex, sizeof(hex), "%02X", c);
11803|  4.29M|      result.append(hex, 2);
11804|  4.29M|    }
11805|  5.93M|  }
11806|  19.4k|  return result;
11807|  19.4k|}
_ZN7httplib6detail14is_ascii_alnumEc:
  648|  5.93M|inline bool is_ascii_alnum(char c) {
  649|  5.93M|  return is_ascii_digit(c) || is_ascii_alpha(c);
  ------------------
  |  Branch (649:10): [True: 1.05M, False: 4.88M]
  |  Branch (649:31): [True: 31.9k, False: 4.85M]
  ------------------
  650|  5.93M|}
_ZN7httplib6detail14is_ascii_alphaEc:
  644|  4.88M|inline bool is_ascii_alpha(char c) {
  645|  4.88M|  return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
  ------------------
  |  Branch (645:11): [True: 26.5k, False: 4.85M]
  |  Branch (645:23): [True: 20.0k, False: 6.54k]
  |  Branch (645:37): [True: 22.1k, False: 4.83M]
  |  Branch (645:49): [True: 11.9k, False: 10.1k]
  ------------------
  646|  4.88M|}
_ZN7httplib6detail22normalize_query_stringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 9277|    294|inline std::string normalize_query_string(const std::string &query) {
 9278|    294|  std::string result;
 9279|    294|  split(query.data(), query.data() + query.size(), '&',
 9280|    294|        [&](const char *b, const char *e) {
 9281|    294|          std::string key;
 9282|    294|          std::string val;
 9283|    294|          divide_query_pair(b, e, key, val);
 9284|       |
 9285|    294|          if (!key.empty()) {
 9286|    294|            auto dec_key = decode_query_component(key);
 9287|    294|            auto dec_val = decode_query_component(val);
 9288|       |
 9289|    294|            if (!result.empty()) { result += '&'; }
 9290|    294|            result += encode_query_component(dec_key);
 9291|    294|            if (!val.empty() || std::find(b, e, '=') != e) {
 9292|    294|              result += '=';
 9293|    294|              result += encode_query_component(dec_val);
 9294|    294|            }
 9295|    294|          }
 9296|    294|        });
 9297|    294|  return result;
 9298|    294|}
_ZZN7httplib6detail22normalize_query_stringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENKUlPKcSB_E_clESB_SB_:
 9280|  18.3k|        [&](const char *b, const char *e) {
 9281|  18.3k|          std::string key;
 9282|  18.3k|          std::string val;
 9283|  18.3k|          divide_query_pair(b, e, key, val);
 9284|       |
 9285|  18.3k|          if (!key.empty()) {
  ------------------
  |  Branch (9285:15): [True: 17.4k, False: 863]
  ------------------
 9286|  17.4k|            auto dec_key = decode_query_component(key);
 9287|  17.4k|            auto dec_val = decode_query_component(val);
 9288|       |
 9289|  17.4k|            if (!result.empty()) { result += '&'; }
  ------------------
  |  Branch (9289:17): [True: 17.2k, False: 255]
  ------------------
 9290|  17.4k|            result += encode_query_component(dec_key);
 9291|  17.4k|            if (!val.empty() || std::find(b, e, '=') != e) {
  ------------------
  |  Branch (9291:17): [True: 972, False: 16.4k]
  |  Branch (9291:17): [True: 1.92k, False: 15.5k]
  |  Branch (9291:33): [True: 952, False: 15.5k]
  ------------------
 9292|  1.92k|              result += '=';
 9293|  1.92k|              result += encode_query_component(dec_val);
 9294|  1.92k|            }
 9295|  17.4k|          }
 9296|  18.3k|        });
_ZN7httplib6detail13is_valid_pathERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 5907|    211|inline bool is_valid_path(const std::string &path) {
 5908|    211|  size_t level = 0;
 5909|    211|  size_t i = 0;
 5910|       |
 5911|       |  // Skip slash
 5912|   292k|  while (i < path.size() && path[i] == '/') {
  ------------------
  |  Branch (5912:10): [True: 292k, False: 10]
  |  Branch (5912:29): [True: 292k, False: 201]
  ------------------
 5913|   292k|    i++;
 5914|   292k|  }
 5915|       |
 5916|  1.21M|  while (i < path.size()) {
  ------------------
  |  Branch (5916:10): [True: 1.21M, False: 200]
  ------------------
 5917|       |    // Read component
 5918|  1.21M|    auto beg = i;
 5919|  4.14M|    while (i < path.size() && path[i] != '/') {
  ------------------
  |  Branch (5919:12): [True: 4.14M, False: 170]
  |  Branch (5919:31): [True: 2.92M, False: 1.21M]
  ------------------
 5920|  2.92M|      if (path[i] == '\0') {
  ------------------
  |  Branch (5920:11): [True: 7, False: 2.92M]
  ------------------
 5921|      7|        return false;
 5922|  2.92M|      } else if (path[i] == '\\') {
  ------------------
  |  Branch (5922:18): [True: 2, False: 2.92M]
  ------------------
 5923|      2|        return false;
 5924|      2|      }
 5925|  2.92M|      i++;
 5926|  2.92M|    }
 5927|       |
 5928|  1.21M|    auto len = i - beg;
 5929|  1.21M|    assert(len > 0);
  ------------------
  |  Branch (5929:5): [True: 1.21M, False: 0]
  ------------------
 5930|       |
 5931|  1.21M|    if (!path.compare(beg, len, ".")) {
  ------------------
  |  Branch (5931:9): [True: 6.52k, False: 1.21M]
  ------------------
 5932|  6.52k|      ;
 5933|  1.21M|    } else if (!path.compare(beg, len, "..")) {
  ------------------
  |  Branch (5933:16): [True: 62.0k, False: 1.15M]
  ------------------
 5934|  62.0k|      if (level == 0) { return false; }
  ------------------
  |  Branch (5934:11): [True: 2, False: 62.0k]
  ------------------
 5935|  62.0k|      level--;
 5936|  1.15M|    } else {
 5937|  1.15M|      level++;
 5938|  1.15M|    }
 5939|       |
 5940|       |    // Skip slash
 5941|  2.62M|    while (i < path.size() && path[i] == '/') {
  ------------------
  |  Branch (5941:12): [True: 2.62M, False: 190]
  |  Branch (5941:31): [True: 1.40M, False: 1.21M]
  ------------------
 5942|  1.40M|      i++;
 5943|  1.40M|    }
 5944|  1.21M|  }
 5945|       |
 5946|    200|  return true;
 5947|    211|}

LLVMFuzzerTestOneInput:
    7|  1.56k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
    8|  1.56k|  if (size < 2) return 0;
  ------------------
  |  Branch (8:7): [True: 1, False: 1.56k]
  ------------------
    9|       |
   10|       |  // Use first byte to select which parsing function to exercise
   11|  1.56k|  uint8_t selector = data[0];
   12|  1.56k|  const char *payload = reinterpret_cast<const char *>(data + 1);
   13|  1.56k|  size_t payload_size = size - 1;
   14|  1.56k|  std::string input(payload, payload_size);
   15|       |
   16|  1.56k|  switch (selector % 6) {
  ------------------
  |  Branch (16:11): [True: 1.56k, False: 0]
  ------------------
   17|    628|  case 0: {
  ------------------
  |  Branch (17:3): [True: 628, False: 936]
  ------------------
   18|       |    // parse_query_text
   19|    628|    httplib::Params params;
   20|    628|    httplib::detail::parse_query_text(payload, payload_size, params);
   21|    628|    break;
   22|      0|  }
   23|     75|  case 1: {
  ------------------
  |  Branch (23:3): [True: 75, False: 1.48k]
  ------------------
   24|       |    // decode_query_component
   25|     75|    httplib::decode_query_component(input, true);
   26|     75|    httplib::decode_query_component(input, false);
   27|     75|    break;
   28|      0|  }
   29|    250|  case 2: {
  ------------------
  |  Branch (29:3): [True: 250, False: 1.31k]
  ------------------
   30|       |    // decode_path_component
   31|    250|    httplib::decode_path_component(input);
   32|    250|    break;
   33|      0|  }
   34|    106|  case 3: {
  ------------------
  |  Branch (34:3): [True: 106, False: 1.45k]
  ------------------
   35|       |    // encode_query_component
   36|    106|    httplib::encode_query_component(input);
   37|    106|    break;
   38|      0|  }
   39|    294|  case 4: {
  ------------------
  |  Branch (39:3): [True: 294, False: 1.27k]
  ------------------
   40|       |    // normalize_query_string
   41|    294|    httplib::detail::normalize_query_string(input);
   42|    294|    break;
   43|      0|  }
   44|    211|  case 5: {
  ------------------
  |  Branch (44:3): [True: 211, False: 1.35k]
  ------------------
   45|       |    // is_valid_path
   46|    211|    httplib::detail::is_valid_path(input);
   47|    211|    break;
   48|      0|  }
   49|  1.56k|  }
   50|       |
   51|  1.56k|  return 0;
   52|  1.56k|}

