_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEEC2Ev:
 1251|    628|  insertion_ordered_multimap() = default;
_ZN7httplib6detail16parse_query_textEPKcmRNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS4_8equal_toISA_EEEE:
 9316|    628|                             Params &params) {
 9317|    628|  std::set<std::string> cache;
 9318|    628|  split(data, data + size, '&', [&](const char *b, const char *e) {
 9319|    628|    std::string kv(b, e);
 9320|    628|    if (cache.find(kv) != cache.end()) { return; }
 9321|    628|    cache.insert(std::move(kv));
 9322|       |
 9323|    628|    std::string key;
 9324|    628|    std::string val;
 9325|    628|    divide_query_pair(b, e, key, val);
 9326|       |
 9327|    628|    if (!key.empty()) {
 9328|    628|      params.emplace(decode_query_component(key), decode_query_component(val));
 9329|    628|    }
 9330|    628|  });
 9331|    628|}
_ZN7httplib6detail5splitEPKcS2_cNSt3__18functionIFvS2_S2_EEE:
 6303|    922|                  std::function<void(const char *, const char *)> fn) {
 6304|    922|  return split(b, e, d, (std::numeric_limits<size_t>::max)(), std::move(fn));
 6305|    922|}
_ZN7httplib6detail5splitEPKcS2_cmNSt3__18functionIFvS2_S2_EEE:
 6308|    922|                  std::function<void(const char *, const char *)> fn) {
 6309|    922|  size_t i = 0;
 6310|    922|  size_t beg = 0;
 6311|    922|  size_t count = 1;
 6312|       |
 6313|  39.5M|  while (e ? (b + i < e) : (b[i] != '\0')) {
  ------------------
  |  Branch (6313:10): [True: 39.5M, False: 0]
  |  Branch (6313:10): [True: 39.5M, False: 922]
  ------------------
 6314|  39.5M|    if (b[i] == d && count < m) {
  ------------------
  |  Branch (6314:9): [True: 4.54M, False: 34.9M]
  |  Branch (6314:22): [True: 4.54M, False: 0]
  ------------------
 6315|  4.54M|      auto r = trim(b, e, beg, i);
 6316|  4.54M|      if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (6316:11): [True: 243k, False: 4.30M]
  ------------------
 6317|  4.54M|      beg = i + 1;
 6318|  4.54M|      count++;
 6319|  4.54M|    }
 6320|  39.5M|    i++;
 6321|  39.5M|  }
 6322|       |
 6323|    922|  if (i) {
  ------------------
  |  Branch (6323:7): [True: 922, False: 0]
  ------------------
 6324|    922|    auto r = trim(b, e, beg, i);
 6325|    922|    if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (6325:9): [True: 816, False: 106]
  ------------------
 6326|    922|  }
 6327|    922|}
_ZN7httplib6detail4trimEPKcS2_mm:
 6243|  4.54M|                                      size_t right) {
 6244|  5.98M|  while (b + left < e && is_space_or_tab(b[left])) {
  ------------------
  |  Branch (6244:10): [True: 5.98M, False: 106]
  |  Branch (6244:26): [True: 1.43M, False: 4.54M]
  ------------------
 6245|  1.43M|    left++;
 6246|  1.43M|  }
 6247|  5.98M|  while (right > 0 && is_space_or_tab(b[right - 1])) {
  ------------------
  |  Branch (6247:10): [True: 5.98M, False: 66]
  |  Branch (6247:23): [True: 1.43M, False: 4.54M]
  ------------------
 6248|  1.43M|    right--;
 6249|  1.43M|  }
 6250|  4.54M|  return std::make_pair(left, right);
 6251|  4.54M|}
_ZN7httplib6detail15is_space_or_tabEc:
 6096|  11.9M|inline bool is_space_or_tab(char c) { return c == ' ' || c == '\t'; }
  ------------------
  |  Branch (6096:46): [True: 2.85M, False: 9.11M]
  |  Branch (6096: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_:
 9318|   225k|  split(data, data + size, '&', [&](const char *b, const char *e) {
 9319|   225k|    std::string kv(b, e);
 9320|   225k|    if (cache.find(kv) != cache.end()) { return; }
  ------------------
  |  Branch (9320:9): [True: 115k, False: 109k]
  ------------------
 9321|   109k|    cache.insert(std::move(kv));
 9322|       |
 9323|   109k|    std::string key;
 9324|   109k|    std::string val;
 9325|   109k|    divide_query_pair(b, e, key, val);
 9326|       |
 9327|   109k|    if (!key.empty()) {
  ------------------
  |  Branch (9327:9): [True: 109k, False: 564]
  ------------------
 9328|   109k|      params.emplace(decode_query_component(key), decode_query_component(val));
 9329|   109k|    }
 9330|   109k|  });
_ZN7httplib6detail17divide_query_pairEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_:
 9306|   128k|                              std::string &val) {
 9307|   128k|  divide(b, static_cast<std::size_t>(e - b), '=',
 9308|   128k|         [&](const char *lhs_data, std::size_t lhs_size, const char *rhs_data,
 9309|   128k|             std::size_t rhs_size) {
 9310|   128k|           key.assign(lhs_data, lhs_size);
 9311|   128k|           val.assign(rhs_data, rhs_size);
 9312|   128k|         });
 9313|   128k|}
_ZN7httplib6detail6divideEPKcmcNSt3__18functionIFvS2_mS2_mEEE:
 6284|   128k|           fn) {
 6285|   128k|  const auto it = std::find(data, data + size, d);
 6286|   128k|  const auto found = static_cast<std::size_t>(it != data + size);
 6287|   128k|  const auto lhs_data = data;
 6288|   128k|  const auto lhs_size = static_cast<std::size_t>(it - data);
 6289|   128k|  const auto rhs_data = it + found;
 6290|   128k|  const auto rhs_size = size - lhs_size - found;
 6291|       |
 6292|   128k|  fn(lhs_data, lhs_size, rhs_data, rhs_size);
 6293|   128k|}
_ZZN7httplib6detail17divide_query_pairEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_ENKUlS2_mS2_mE_clES2_mS2_m:
 9309|   128k|             std::size_t rhs_size) {
 9310|   128k|           key.assign(lhs_data, lhs_size);
 9311|   128k|           val.assign(rhs_data, rhs_size);
 9312|   128k|         });
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE7emplaceIJS8_S8_EEENSB_10iterator_tINS2_4pairIS8_S8_EEEEDpOT_:
 1280|   109k|  template <typename... Args> iterator emplace(Args &&...args) {
 1281|   109k|    entries_.emplace_back(std::forward<Args>(args)...);
 1282|   109k|    return make_iter(entries_.size() - 1, npos());
 1283|   109k|  }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE9make_iterEmm:
 1389|   109k|  iterator make_iter(size_type idx, size_type key_idx) {
 1390|   109k|    return iterator(entries_.data(), idx, entries_.size(), key_idx);
 1391|   109k|  }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE10iterator_tINS2_4pairIS8_S8_EEEC2EPSE_mmm:
 1235|   109k|        : data_(data), idx_(idx), size_(size), key_idx_(key_idx) {}
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE4nposEv:
 1155|   109k|  static size_type npos() { return static_cast<size_type>(-1); }
_ZN7httplib22decode_query_componentERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEb:
11887|   253k|                                          bool plus_as_space) {
11888|   253k|  std::string result;
11889|   253k|  result.reserve(component.size());
11890|       |
11891|  37.4M|  for (size_t i = 0; i < component.size(); i++) {
  ------------------
  |  Branch (11891:22): [True: 37.1M, False: 253k]
  ------------------
11892|  37.1M|    if (component[i] == '%' && i + 2 < component.size()) {
  ------------------
  |  Branch (11892:9): [True: 830k, False: 36.3M]
  |  Branch (11892:32): [True: 827k, False: 2.70k]
  ------------------
11893|   827k|      auto val = 0;
11894|   827k|      if (detail::from_hex_to_i(component, i + 1, 2, val)) {
  ------------------
  |  Branch (11894:11): [True: 266k, False: 561k]
  ------------------
11895|   266k|        result += static_cast<char>(val);
11896|   266k|        i += 2;
11897|   561k|      } else {
11898|   561k|        result += component[i];
11899|   561k|      }
11900|  36.3M|    } else if (component[i] == '+' && plus_as_space) {
  ------------------
  |  Branch (11900:16): [True: 5.96k, False: 36.3M]
  |  Branch (11900:39): [True: 5.44k, False: 528]
  ------------------
11901|  5.44k|      result += ' '; // + becomes space in form-urlencoded
11902|  36.3M|    } else {
11903|  36.3M|      result += component[i];
11904|  36.3M|    }
11905|  37.1M|  }
11906|   253k|  return result;
11907|   253k|}
_ZN7httplib6detail13from_hex_to_iERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEmmRi:
 5398|   998k|                          int &val) {
 5399|   998k|  if (i >= s.size()) { return false; }
  ------------------
  |  Branch (5399:7): [True: 12, False: 998k]
  ------------------
 5400|       |
 5401|   998k|  val = 0;
 5402|  1.70M|  for (; cnt; i++, cnt--) {
  ------------------
  |  Branch (5402:10): [True: 1.38M, False: 322k]
  ------------------
 5403|  1.38M|    if (!s[i]) { return false; }
  ------------------
  |  Branch (5403:9): [True: 3.04k, False: 1.37M]
  ------------------
 5404|  1.37M|    auto v = 0;
 5405|  1.37M|    if (is_hex(s[i], v)) {
  ------------------
  |  Branch (5405:9): [True: 706k, False: 672k]
  ------------------
 5406|   706k|      val = val * 16 + v;
 5407|   706k|    } else {
 5408|   672k|      return false;
 5409|   672k|    }
 5410|  1.37M|  }
 5411|   322k|  return true;
 5412|   998k|}
_ZN7httplib6detail6is_hexEcRi:
 5383|  1.37M|inline bool is_hex(char c, int &v) {
 5384|  1.37M|  if (is_ascii_digit(c)) {
  ------------------
  |  Branch (5384:7): [True: 14.2k, False: 1.36M]
  ------------------
 5385|  14.2k|    v = c - '0';
 5386|  14.2k|    return true;
 5387|  1.36M|  } else if ('A' <= c && c <= 'F') {
  ------------------
  |  Branch (5387:14): [True: 944k, False: 420k]
  |  Branch (5387:26): [True: 72.8k, False: 871k]
  ------------------
 5388|  72.8k|    v = c - 'A' + 10;
 5389|  72.8k|    return true;
 5390|  1.29M|  } else if ('a' <= c && c <= 'f') {
  ------------------
  |  Branch (5390:14): [True: 870k, False: 421k]
  |  Branch (5390:26): [True: 619k, False: 250k]
  ------------------
 5391|   619k|    v = c - 'a' + 10;
 5392|   619k|    return true;
 5393|   619k|  }
 5394|   672k|  return false;
 5395|  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:
11791|    250|inline std::string decode_path_component(const std::string &component) {
11792|    250|  std::string result;
11793|    250|  result.reserve(component.size());
11794|       |
11795|  4.90M|  for (size_t i = 0; i < component.size(); i++) {
  ------------------
  |  Branch (11795:22): [True: 4.90M, False: 250]
  ------------------
11796|  4.90M|    if (component[i] == '%' && i + 1 < component.size()) {
  ------------------
  |  Branch (11796:9): [True: 170k, False: 4.73M]
  |  Branch (11796:32): [True: 170k, False: 10]
  ------------------
11797|   170k|      if (component[i + 1] == 'u') {
  ------------------
  |  Branch (11797:11): [True: 3.92k, False: 166k]
  ------------------
11798|       |        // Unicode %uXXXX encoding
11799|  3.92k|        auto val = 0;
11800|       |        // 4 digits Unicode codes: val is 0x0000-0xFFFF (from 4 hex digits),
11801|       |        // so to_utf8 writes at most 3 bytes. buff[4] is safe.
11802|  3.92k|        char buff[4];
11803|  3.92k|        size_t len = 0;
11804|  3.92k|        if (detail::from_hex_to_i(component, i + 2, 4, val) &&
  ------------------
  |  Branch (11804:13): [True: 2.46k, False: 1.45k]
  ------------------
11805|  2.46k|            (len = detail::to_utf8(val, buff)) > 0) {
  ------------------
  |  Branch (11805:13): [True: 2.10k, False: 359]
  ------------------
11806|  2.10k|          result.append(buff, len);
11807|  2.10k|          i += 5; // 'u0000'
11808|  2.10k|        } else {
11809|       |          // Not 4 hex digits, or a surrogate, which is no character: the
11810|       |          // escape is kept as it is rather than joining its neighbours
11811|  1.81k|          result += component[i];
11812|  1.81k|        }
11813|   166k|      } else {
11814|       |        // Standard %XX encoding
11815|   166k|        auto val = 0;
11816|   166k|        if (detail::from_hex_to_i(component, i + 1, 2, val)) {
  ------------------
  |  Branch (11816:13): [True: 54.4k, False: 112k]
  ------------------
11817|       |          // 2 digits hex codes
11818|  54.4k|          result += static_cast<char>(val);
11819|  54.4k|          i += 2; // 'XX'
11820|   112k|        } else {
11821|   112k|          result += component[i];
11822|   112k|        }
11823|   166k|      }
11824|  4.73M|    } else {
11825|  4.73M|      result += component[i];
11826|  4.73M|    }
11827|  4.90M|  }
11828|    250|  return result;
11829|    250|}
_ZN7httplib6detail7to_utf8EiPc:
 5517|  2.46k|inline size_t to_utf8(int code, char *buff) {
 5518|  2.46k|  if (code < 0x0080) {
  ------------------
  |  Branch (5518:7): [True: 695, False: 1.76k]
  ------------------
 5519|    695|    buff[0] = static_cast<char>(code & 0x7F);
 5520|    695|    return 1;
 5521|  1.76k|  } else if (code < 0x0800) {
  ------------------
  |  Branch (5521:14): [True: 432, False: 1.33k]
  ------------------
 5522|    432|    buff[0] = static_cast<char>(0xC0 | ((code >> 6) & 0x1F));
 5523|    432|    buff[1] = static_cast<char>(0x80 | (code & 0x3F));
 5524|    432|    return 2;
 5525|  1.33k|  } else if (code < 0xD800) {
  ------------------
  |  Branch (5525:14): [True: 714, False: 622]
  ------------------
 5526|    714|    buff[0] = static_cast<char>(0xE0 | ((code >> 12) & 0xF));
 5527|    714|    buff[1] = static_cast<char>(0x80 | ((code >> 6) & 0x3F));
 5528|    714|    buff[2] = static_cast<char>(0x80 | (code & 0x3F));
 5529|    714|    return 3;
 5530|    714|  } else if (code < 0xE000) { // D800 - DFFF is invalid...
  ------------------
  |  Branch (5530:14): [True: 359, False: 263]
  ------------------
 5531|    359|    return 0;
 5532|    359|  } else if (code < 0x10000) {
  ------------------
  |  Branch (5532:14): [True: 263, False: 0]
  ------------------
 5533|    263|    buff[0] = static_cast<char>(0xE0 | ((code >> 12) & 0xF));
 5534|    263|    buff[1] = static_cast<char>(0x80 | ((code >> 6) & 0x3F));
 5535|    263|    buff[2] = static_cast<char>(0x80 | (code & 0x3F));
 5536|    263|    return 3;
 5537|    263|  } else if (code < 0x110000) {
  ------------------
  |  Branch (5537:14): [True: 0, False: 0]
  ------------------
 5538|      0|    buff[0] = static_cast<char>(0xF0 | ((code >> 18) & 0x7));
 5539|      0|    buff[1] = static_cast<char>(0x80 | ((code >> 12) & 0x3F));
 5540|      0|    buff[2] = static_cast<char>(0x80 | ((code >> 6) & 0x3F));
 5541|      0|    buff[3] = static_cast<char>(0x80 | (code & 0x3F));
 5542|      0|    return 4;
 5543|      0|  }
 5544|       |
 5545|       |  // NOTREACHED
 5546|      0|  return 0;
 5547|  2.46k|}
_ZN7httplib22encode_query_componentERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEb:
11832|  19.4k|                                          bool space_as_plus) {
11833|  19.4k|  std::string result;
11834|  19.4k|  result.reserve(component.size() * 3);
11835|       |
11836|  5.95M|  for (size_t i = 0; i < component.size(); i++) {
  ------------------
  |  Branch (11836:22): [True: 5.93M, False: 19.4k]
  ------------------
11837|  5.93M|    auto c = static_cast<unsigned char>(component[i]);
11838|       |
11839|       |    // Unreserved characters per RFC 3986
11840|  5.93M|    if (detail::is_ascii_alnum(static_cast<char>(c)) || c == '-' || c == '.' ||
  ------------------
  |  Branch (11840:9): [True: 1.08M, False: 4.85M]
  |  Branch (11840:57): [True: 1.49k, False: 4.84M]
  |  Branch (11840:69): [True: 7.37k, False: 4.84M]
  ------------------
11841|  4.84M|        c == '_' || c == '~') {
  ------------------
  |  Branch (11841:9): [True: 1.19k, False: 4.84M]
  |  Branch (11841:21): [True: 930, False: 4.83M]
  ------------------
11842|  1.10M|      result += static_cast<char>(c);
11843|  1.10M|    }
11844|       |    // Space handling
11845|  4.83M|    else if (c == ' ') {
  ------------------
  |  Branch (11845:14): [True: 2.32k, False: 4.83M]
  ------------------
11846|  2.32k|      if (space_as_plus) {
  ------------------
  |  Branch (11846:11): [True: 2.32k, False: 0]
  ------------------
11847|  2.32k|        result += '+';
11848|  2.32k|      } else {
11849|      0|        result += "%20";
11850|      0|      }
11851|  2.32k|    }
11852|       |    // Plus sign handling
11853|  4.83M|    else if (c == '+') {
  ------------------
  |  Branch (11853:14): [True: 528, False: 4.83M]
  ------------------
11854|    528|      if (space_as_plus) {
  ------------------
  |  Branch (11854:11): [True: 528, False: 0]
  ------------------
11855|    528|        result += "%2B";
11856|    528|      } else {
11857|      0|        result += static_cast<char>(c);
11858|      0|      }
11859|    528|    }
11860|       |    // Query-safe sub-delimiters (excluding & and = which are query delimiters)
11861|  4.83M|    else if (c == '!' || c == '$' || c == '\'' || c == '(' || c == ')' ||
  ------------------
  |  Branch (11861:14): [True: 1.45k, False: 4.83M]
  |  Branch (11861:26): [True: 814, False: 4.83M]
  |  Branch (11861:38): [True: 1.09k, False: 4.83M]
  |  Branch (11861:51): [True: 864, False: 4.83M]
  |  Branch (11861:63): [True: 1.40k, False: 4.83M]
  ------------------
11862|  4.83M|             c == '*' || c == ',' || c == ';') {
  ------------------
  |  Branch (11862:14): [True: 1.46k, False: 4.82M]
  |  Branch (11862:26): [True: 2.32k, False: 4.82M]
  |  Branch (11862:38): [True: 1.10k, False: 4.82M]
  ------------------
11863|  10.5k|      result += static_cast<char>(c);
11864|  10.5k|    }
11865|       |    // Colon and @ are allowed in query
11866|  4.82M|    else if (c == ':' || c == '@') {
  ------------------
  |  Branch (11866:14): [True: 1.02k, False: 4.82M]
  |  Branch (11866:26): [True: 524k, False: 4.30M]
  ------------------
11867|   525k|      result += static_cast<char>(c);
11868|   525k|    }
11869|       |    // Forward slash is allowed in query values
11870|  4.30M|    else if (c == '/') {
  ------------------
  |  Branch (11870:14): [True: 5.24k, False: 4.29M]
  ------------------
11871|  5.24k|      result += static_cast<char>(c);
11872|  5.24k|    }
11873|       |    // Question mark is allowed in query values (after first ?)
11874|  4.29M|    else if (c == '?') {
  ------------------
  |  Branch (11874:14): [True: 818, False: 4.29M]
  ------------------
11875|    818|      result += static_cast<char>(c);
11876|  4.29M|    } else {
11877|  4.29M|      result += '%';
11878|  4.29M|      char hex[3];
11879|  4.29M|      snprintf(hex, sizeof(hex), "%02X", c);
11880|  4.29M|      result.append(hex, 2);
11881|  4.29M|    }
11882|  5.93M|  }
11883|  19.4k|  return result;
11884|  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:
 9344|    294|inline std::string normalize_query_string(const std::string &query) {
 9345|    294|  std::string result;
 9346|    294|  split(query.data(), query.data() + query.size(), '&',
 9347|    294|        [&](const char *b, const char *e) {
 9348|    294|          std::string key;
 9349|    294|          std::string val;
 9350|    294|          divide_query_pair(b, e, key, val);
 9351|       |
 9352|    294|          if (!key.empty()) {
 9353|    294|            auto dec_key = decode_query_component(key);
 9354|    294|            auto dec_val = decode_query_component(val);
 9355|       |
 9356|    294|            if (!result.empty()) { result += '&'; }
 9357|    294|            result += encode_query_component(dec_key);
 9358|    294|            if (!val.empty() || std::find(b, e, '=') != e) {
 9359|    294|              result += '=';
 9360|    294|              result += encode_query_component(dec_val);
 9361|    294|            }
 9362|    294|          }
 9363|    294|        });
 9364|    294|  return result;
 9365|    294|}
_ZZN7httplib6detail22normalize_query_stringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENKUlPKcSB_E_clESB_SB_:
 9347|  18.3k|        [&](const char *b, const char *e) {
 9348|  18.3k|          std::string key;
 9349|  18.3k|          std::string val;
 9350|  18.3k|          divide_query_pair(b, e, key, val);
 9351|       |
 9352|  18.3k|          if (!key.empty()) {
  ------------------
  |  Branch (9352:15): [True: 17.4k, False: 863]
  ------------------
 9353|  17.4k|            auto dec_key = decode_query_component(key);
 9354|  17.4k|            auto dec_val = decode_query_component(val);
 9355|       |
 9356|  17.4k|            if (!result.empty()) { result += '&'; }
  ------------------
  |  Branch (9356:17): [True: 17.2k, False: 255]
  ------------------
 9357|  17.4k|            result += encode_query_component(dec_key);
 9358|  17.4k|            if (!val.empty() || std::find(b, e, '=') != e) {
  ------------------
  |  Branch (9358:17): [True: 972, False: 16.4k]
  |  Branch (9358:17): [True: 1.92k, False: 15.5k]
  |  Branch (9358:33): [True: 952, False: 15.5k]
  ------------------
 9359|  1.92k|              result += '=';
 9360|  1.92k|              result += encode_query_component(dec_val);
 9361|  1.92k|            }
 9362|  17.4k|          }
 9363|  18.3k|        });
_ZN7httplib6detail13is_valid_pathERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 5958|    211|inline bool is_valid_path(const std::string &path) {
 5959|    211|  size_t level = 0;
 5960|    211|  size_t i = 0;
 5961|       |
 5962|       |  // Skip slash
 5963|   292k|  while (i < path.size() && path[i] == '/') {
  ------------------
  |  Branch (5963:10): [True: 292k, False: 10]
  |  Branch (5963:29): [True: 292k, False: 201]
  ------------------
 5964|   292k|    i++;
 5965|   292k|  }
 5966|       |
 5967|  1.21M|  while (i < path.size()) {
  ------------------
  |  Branch (5967:10): [True: 1.21M, False: 200]
  ------------------
 5968|       |    // Read component
 5969|  1.21M|    auto beg = i;
 5970|  4.14M|    while (i < path.size() && path[i] != '/') {
  ------------------
  |  Branch (5970:12): [True: 4.14M, False: 170]
  |  Branch (5970:31): [True: 2.92M, False: 1.21M]
  ------------------
 5971|  2.92M|      if (path[i] == '\0') {
  ------------------
  |  Branch (5971:11): [True: 7, False: 2.92M]
  ------------------
 5972|      7|        return false;
 5973|  2.92M|      } else if (path[i] == '\\') {
  ------------------
  |  Branch (5973:18): [True: 2, False: 2.92M]
  ------------------
 5974|      2|        return false;
 5975|      2|      }
 5976|  2.92M|      i++;
 5977|  2.92M|    }
 5978|       |
 5979|  1.21M|    auto len = i - beg;
 5980|  1.21M|    assert(len > 0);
  ------------------
  |  Branch (5980:5): [True: 1.21M, False: 0]
  ------------------
 5981|       |
 5982|  1.21M|    if (!path.compare(beg, len, ".")) {
  ------------------
  |  Branch (5982:9): [True: 6.52k, False: 1.21M]
  ------------------
 5983|  6.52k|      ;
 5984|  1.21M|    } else if (!path.compare(beg, len, "..")) {
  ------------------
  |  Branch (5984:16): [True: 62.0k, False: 1.15M]
  ------------------
 5985|  62.0k|      if (level == 0) { return false; }
  ------------------
  |  Branch (5985:11): [True: 2, False: 62.0k]
  ------------------
 5986|  62.0k|      level--;
 5987|  1.15M|    } else {
 5988|  1.15M|      level++;
 5989|  1.15M|    }
 5990|       |
 5991|       |    // Skip slash
 5992|  2.62M|    while (i < path.size() && path[i] == '/') {
  ------------------
  |  Branch (5992:12): [True: 2.62M, False: 190]
  |  Branch (5992:31): [True: 1.40M, False: 1.21M]
  ------------------
 5993|  1.40M|      i++;
 5994|  1.40M|    }
 5995|  1.21M|  }
 5996|       |
 5997|    200|  return true;
 5998|    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|}

