_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEEC2Ev:
 1132|    621|  insertion_ordered_multimap() = default;
_ZN7httplib6detail16parse_query_textEPKcmRNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS4_8equal_toISA_EEEE:
 8806|    621|                             Params &params) {
 8807|    621|  std::set<std::string> cache;
 8808|    621|  split(data, data + size, '&', [&](const char *b, const char *e) {
 8809|    621|    std::string kv(b, e);
 8810|    621|    if (cache.find(kv) != cache.end()) { return; }
 8811|    621|    cache.insert(std::move(kv));
 8812|       |
 8813|    621|    std::string key;
 8814|    621|    std::string val;
 8815|    621|    divide_query_pair(b, e, key, val);
 8816|       |
 8817|    621|    if (!key.empty()) {
 8818|    621|      params.emplace(decode_query_component(key), decode_query_component(val));
 8819|    621|    }
 8820|    621|  });
 8821|    621|}
_ZN7httplib6detail5splitEPKcS2_cNSt3__18functionIFvS2_S2_EEE:
 5901|    929|                  std::function<void(const char *, const char *)> fn) {
 5902|    929|  return split(b, e, d, (std::numeric_limits<size_t>::max)(), std::move(fn));
 5903|    929|}
_ZN7httplib6detail5splitEPKcS2_cmNSt3__18functionIFvS2_S2_EEE:
 5906|    929|                  std::function<void(const char *, const char *)> fn) {
 5907|    929|  size_t i = 0;
 5908|    929|  size_t beg = 0;
 5909|    929|  size_t count = 1;
 5910|       |
 5911|  43.9M|  while (e ? (b + i < e) : (b[i] != '\0')) {
  ------------------
  |  Branch (5911:10): [True: 43.9M, False: 0]
  |  Branch (5911:10): [True: 43.9M, False: 929]
  ------------------
 5912|  43.9M|    if (b[i] == d && count < m) {
  ------------------
  |  Branch (5912:9): [True: 6.01M, False: 37.8M]
  |  Branch (5912:22): [True: 6.01M, False: 0]
  ------------------
 5913|  6.01M|      auto r = trim(b, e, beg, i);
 5914|  6.01M|      if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (5914:11): [True: 323k, False: 5.69M]
  ------------------
 5915|  6.01M|      beg = i + 1;
 5916|  6.01M|      count++;
 5917|  6.01M|    }
 5918|  43.9M|    i++;
 5919|  43.9M|  }
 5920|       |
 5921|    929|  if (i) {
  ------------------
  |  Branch (5921:7): [True: 929, False: 0]
  ------------------
 5922|    929|    auto r = trim(b, e, beg, i);
 5923|    929|    if (r.first < r.second) { fn(&b[r.first], &b[r.second]); }
  ------------------
  |  Branch (5923:9): [True: 826, False: 103]
  ------------------
 5924|    929|  }
 5925|    929|}
_ZN7httplib6detail4trimEPKcS2_mm:
 5857|  6.01M|                                      size_t right) {
 5858|  8.10M|  while (b + left < e && is_space_or_tab(b[left])) {
  ------------------
  |  Branch (5858:10): [True: 8.10M, False: 103]
  |  Branch (5858:26): [True: 2.08M, False: 6.01M]
  ------------------
 5859|  2.08M|    left++;
 5860|  2.08M|  }
 5861|  8.10M|  while (right > 0 && is_space_or_tab(b[right - 1])) {
  ------------------
  |  Branch (5861:10): [True: 8.10M, False: 56]
  |  Branch (5861:23): [True: 2.08M, False: 6.01M]
  ------------------
 5862|  2.08M|    right--;
 5863|  2.08M|  }
 5864|  6.01M|  return std::make_pair(left, right);
 5865|  6.01M|}
_ZN7httplib6detail15is_space_or_tabEc:
 5720|  16.2M|inline bool is_space_or_tab(char c) { return c == ' ' || c == '\t'; }
  ------------------
  |  Branch (5720:46): [True: 4.14M, False: 12.0M]
  |  Branch (5720:58): [True: 25.4k, False: 12.0M]
  ------------------
_ZZN7httplib6detail16parse_query_textEPKcmRNS0_26insertion_ordered_multimapINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS4_8equal_toISA_EEEEENKUlS2_S2_E_clES2_S2_:
 8808|   302k|  split(data, data + size, '&', [&](const char *b, const char *e) {
 8809|   302k|    std::string kv(b, e);
 8810|   302k|    if (cache.find(kv) != cache.end()) { return; }
  ------------------
  |  Branch (8810:9): [True: 179k, False: 122k]
  ------------------
 8811|   122k|    cache.insert(std::move(kv));
 8812|       |
 8813|   122k|    std::string key;
 8814|   122k|    std::string val;
 8815|   122k|    divide_query_pair(b, e, key, val);
 8816|       |
 8817|   122k|    if (!key.empty()) {
  ------------------
  |  Branch (8817:9): [True: 122k, False: 528]
  ------------------
 8818|   122k|      params.emplace(decode_query_component(key), decode_query_component(val));
 8819|   122k|    }
 8820|   122k|  });
_ZN7httplib6detail17divide_query_pairEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_:
 8796|   144k|                              std::string &val) {
 8797|   144k|  divide(b, static_cast<std::size_t>(e - b), '=',
 8798|   144k|         [&](const char *lhs_data, std::size_t lhs_size, const char *rhs_data,
 8799|   144k|             std::size_t rhs_size) {
 8800|   144k|           key.assign(lhs_data, lhs_size);
 8801|   144k|           val.assign(rhs_data, rhs_size);
 8802|   144k|         });
 8803|   144k|}
_ZN7httplib6detail6divideEPKcmcNSt3__18functionIFvS2_mS2_mEEE:
 5882|   144k|           fn) {
 5883|   144k|  const auto it = std::find(data, data + size, d);
 5884|   144k|  const auto found = static_cast<std::size_t>(it != data + size);
 5885|   144k|  const auto lhs_data = data;
 5886|   144k|  const auto lhs_size = static_cast<std::size_t>(it - data);
 5887|   144k|  const auto rhs_data = it + found;
 5888|   144k|  const auto rhs_size = size - lhs_size - found;
 5889|       |
 5890|   144k|  fn(lhs_data, lhs_size, rhs_data, rhs_size);
 5891|   144k|}
_ZZN7httplib6detail17divide_query_pairEPKcS2_RNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_ENKUlS2_mS2_mE_clES2_mS2_m:
 8799|   144k|             std::size_t rhs_size) {
 8800|   144k|           key.assign(lhs_data, lhs_size);
 8801|   144k|           val.assign(rhs_data, rhs_size);
 8802|   144k|         });
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE7emplaceIJS8_S8_EEENSB_10iterator_tINS2_4pairIS8_S8_EEEEDpOT_:
 1161|   122k|  template <typename... Args> iterator emplace(Args &&...args) {
 1162|   122k|    entries_.emplace_back(std::forward<Args>(args)...);
 1163|   122k|    return make_iter(entries_.size() - 1, npos());
 1164|   122k|  }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE9make_iterEmm:
 1270|   122k|  iterator make_iter(size_type idx, size_type key_idx) {
 1271|   122k|    return iterator(entries_.data(), idx, entries_.size(), key_idx);
 1272|   122k|  }
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE10iterator_tINS2_4pairIS8_S8_EEEC2EPSE_mmm:
 1116|   122k|        : data_(data), idx_(idx), size_(size), key_idx_(key_idx) {}
_ZN7httplib6detail26insertion_ordered_multimapINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_8equal_toIS8_EEE4nposEv:
 1035|   122k|  static size_type npos() { return static_cast<size_type>(-1); }
_ZN7httplib22decode_query_componentERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEb:
11196|   286k|                                          bool plus_as_space) {
11197|   286k|  std::string result;
11198|   286k|  result.reserve(component.size());
11199|       |
11200|  37.3M|  for (size_t i = 0; i < component.size(); i++) {
  ------------------
  |  Branch (11200:22): [True: 37.0M, False: 286k]
  ------------------
11201|  37.0M|    if (component[i] == '%' && i + 2 < component.size()) {
  ------------------
  |  Branch (11201:9): [True: 836k, False: 36.2M]
  |  Branch (11201:32): [True: 833k, False: 3.12k]
  ------------------
11202|   833k|      auto val = 0;
11203|   833k|      if (detail::from_hex_to_i(component, i + 1, 2, val)) {
  ------------------
  |  Branch (11203:11): [True: 266k, False: 566k]
  ------------------
11204|   266k|        result += static_cast<char>(val);
11205|   266k|        i += 2;
11206|   566k|      } else {
11207|   566k|        result += component[i];
11208|   566k|      }
11209|  36.2M|    } else if (component[i] == '+' && plus_as_space) {
  ------------------
  |  Branch (11209:16): [True: 17.2k, False: 36.2M]
  |  Branch (11209:39): [True: 16.5k, False: 666]
  ------------------
11210|  16.5k|      result += ' '; // + becomes space in form-urlencoded
11211|  36.2M|    } else {
11212|  36.2M|      result += component[i];
11213|  36.2M|    }
11214|  37.0M|  }
11215|   286k|  return result;
11216|   286k|}
_ZN7httplib6detail13from_hex_to_iERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEmmRi:
 5088|  1.00M|                          int &val) {
 5089|  1.00M|  if (i >= s.size()) { return false; }
  ------------------
  |  Branch (5089:7): [True: 10, False: 1.00M]
  ------------------
 5090|       |
 5091|  1.00M|  val = 0;
 5092|  1.71M|  for (; cnt; i++, cnt--) {
  ------------------
  |  Branch (5092:10): [True: 1.39M, False: 325k]
  ------------------
 5093|  1.39M|    if (!s[i]) { return false; }
  ------------------
  |  Branch (5093:9): [True: 2.21k, False: 1.39M]
  ------------------
 5094|  1.39M|    auto v = 0;
 5095|  1.39M|    if (is_hex(s[i], v)) {
  ------------------
  |  Branch (5095:9): [True: 717k, False: 674k]
  ------------------
 5096|   717k|      val = val * 16 + v;
 5097|   717k|    } else {
 5098|   674k|      return false;
 5099|   674k|    }
 5100|  1.39M|  }
 5101|   325k|  return true;
 5102|  1.00M|}
_ZN7httplib6detail6is_hexEcRi:
 5073|  1.39M|inline bool is_hex(char c, int &v) {
 5074|  1.39M|  if (is_ascii_digit(c)) {
  ------------------
  |  Branch (5074:7): [True: 15.2k, False: 1.37M]
  ------------------
 5075|  15.2k|    v = c - '0';
 5076|  15.2k|    return true;
 5077|  1.37M|  } else if ('A' <= c && c <= 'F') {
  ------------------
  |  Branch (5077:14): [True: 968k, False: 408k]
  |  Branch (5077:26): [True: 82.7k, False: 885k]
  ------------------
 5078|  82.7k|    v = c - 'A' + 10;
 5079|  82.7k|    return true;
 5080|  1.29M|  } else if ('a' <= c && c <= 'f') {
  ------------------
  |  Branch (5080:14): [True: 883k, False: 409k]
  |  Branch (5080:26): [True: 619k, False: 264k]
  ------------------
 5081|   619k|    v = c - 'a' + 10;
 5082|   619k|    return true;
 5083|   619k|  }
 5084|   674k|  return false;
 5085|  1.39M|}
_ZN7httplib6detail14is_ascii_digitEc:
  584|  7.56M|inline bool is_ascii_digit(char c) { return '0' <= c && c <= '9'; }
  ------------------
  |  Branch (584:45): [True: 2.55M, False: 5.01M]
  |  Branch (584:57): [True: 1.14M, False: 1.40M]
  ------------------
_ZN7httplib21decode_path_componentERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
11103|    214|inline std::string decode_path_component(const std::string &component) {
11104|    214|  std::string result;
11105|    214|  result.reserve(component.size());
11106|       |
11107|  4.88M|  for (size_t i = 0; i < component.size(); i++) {
  ------------------
  |  Branch (11107:22): [True: 4.88M, False: 214]
  ------------------
11108|  4.88M|    if (component[i] == '%' && i + 1 < component.size()) {
  ------------------
  |  Branch (11108:9): [True: 169k, False: 4.71M]
  |  Branch (11108:32): [True: 169k, False: 8]
  ------------------
11109|   169k|      if (component[i + 1] == 'u') {
  ------------------
  |  Branch (11109:11): [True: 6.41k, False: 162k]
  ------------------
11110|       |        // Unicode %uXXXX encoding
11111|  6.41k|        auto val = 0;
11112|  6.41k|        if (detail::from_hex_to_i(component, i + 2, 4, val)) {
  ------------------
  |  Branch (11112:13): [True: 5.00k, False: 1.41k]
  ------------------
11113|       |          // 4 digits Unicode codes: val is 0x0000-0xFFFF (from 4 hex digits),
11114|       |          // so to_utf8 writes at most 3 bytes. buff[4] is safe.
11115|  5.00k|          char buff[4];
11116|  5.00k|          size_t len = detail::to_utf8(val, buff);
11117|  5.00k|          if (len > 0) { result.append(buff, len); }
  ------------------
  |  Branch (11117:15): [True: 2.00k, False: 2.99k]
  ------------------
11118|  5.00k|          i += 5; // 'u0000'
11119|  5.00k|        } else {
11120|  1.41k|          result += component[i];
11121|  1.41k|        }
11122|   162k|      } else {
11123|       |        // Standard %XX encoding
11124|   162k|        auto val = 0;
11125|   162k|        if (detail::from_hex_to_i(component, i + 1, 2, val)) {
  ------------------
  |  Branch (11125:13): [True: 54.0k, False: 108k]
  ------------------
11126|       |          // 2 digits hex codes
11127|  54.0k|          result += static_cast<char>(val);
11128|  54.0k|          i += 2; // 'XX'
11129|   108k|        } else {
11130|   108k|          result += component[i];
11131|   108k|        }
11132|   162k|      }
11133|  4.71M|    } else {
11134|  4.71M|      result += component[i];
11135|  4.71M|    }
11136|  4.88M|  }
11137|    214|  return result;
11138|    214|}
_ZN7httplib6detail7to_utf8EiPc:
 5201|  5.00k|inline size_t to_utf8(int code, char *buff) {
 5202|  5.00k|  if (code < 0x0080) {
  ------------------
  |  Branch (5202:7): [True: 554, False: 4.44k]
  ------------------
 5203|    554|    buff[0] = static_cast<char>(code & 0x7F);
 5204|    554|    return 1;
 5205|  4.44k|  } else if (code < 0x0800) {
  ------------------
  |  Branch (5205:14): [True: 435, False: 4.01k]
  ------------------
 5206|    435|    buff[0] = static_cast<char>(0xC0 | ((code >> 6) & 0x1F));
 5207|    435|    buff[1] = static_cast<char>(0x80 | (code & 0x3F));
 5208|    435|    return 2;
 5209|  4.01k|  } else if (code < 0xD800) {
  ------------------
  |  Branch (5209:14): [True: 725, False: 3.28k]
  ------------------
 5210|    725|    buff[0] = static_cast<char>(0xE0 | ((code >> 12) & 0xF));
 5211|    725|    buff[1] = static_cast<char>(0x80 | ((code >> 6) & 0x3F));
 5212|    725|    buff[2] = static_cast<char>(0x80 | (code & 0x3F));
 5213|    725|    return 3;
 5214|  3.28k|  } else if (code < 0xE000) { // D800 - DFFF is invalid...
  ------------------
  |  Branch (5214:14): [True: 2.99k, False: 294]
  ------------------
 5215|  2.99k|    return 0;
 5216|  2.99k|  } else if (code < 0x10000) {
  ------------------
  |  Branch (5216:14): [True: 294, False: 0]
  ------------------
 5217|    294|    buff[0] = static_cast<char>(0xE0 | ((code >> 12) & 0xF));
 5218|    294|    buff[1] = static_cast<char>(0x80 | ((code >> 6) & 0x3F));
 5219|    294|    buff[2] = static_cast<char>(0x80 | (code & 0x3F));
 5220|    294|    return 3;
 5221|    294|  } else if (code < 0x110000) {
  ------------------
  |  Branch (5221:14): [True: 0, False: 0]
  ------------------
 5222|      0|    buff[0] = static_cast<char>(0xF0 | ((code >> 18) & 0x7));
 5223|      0|    buff[1] = static_cast<char>(0x80 | ((code >> 12) & 0x3F));
 5224|      0|    buff[2] = static_cast<char>(0x80 | ((code >> 6) & 0x3F));
 5225|      0|    buff[3] = static_cast<char>(0x80 | (code & 0x3F));
 5226|      0|    return 4;
 5227|      0|  }
 5228|       |
 5229|       |  // NOTREACHED
 5230|      0|  return 0;
 5231|  5.00k|}
_ZN7httplib22encode_query_componentERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEb:
11141|  22.7k|                                          bool space_as_plus) {
11142|  22.7k|  std::string result;
11143|  22.7k|  result.reserve(component.size() * 3);
11144|       |
11145|  6.19M|  for (size_t i = 0; i < component.size(); i++) {
  ------------------
  |  Branch (11145:22): [True: 6.17M, False: 22.7k]
  ------------------
11146|  6.17M|    auto c = static_cast<unsigned char>(component[i]);
11147|       |
11148|       |    // Unreserved characters per RFC 3986
11149|  6.17M|    if (detail::is_ascii_alnum(static_cast<char>(c)) || c == '-' || c == '.' ||
  ------------------
  |  Branch (11149:9): [True: 1.45M, False: 4.72M]
  |  Branch (11149:57): [True: 6.14k, False: 4.71M]
  |  Branch (11149:69): [True: 11.4k, False: 4.70M]
  ------------------
11150|  4.70M|        c == '_' || c == '~') {
  ------------------
  |  Branch (11150:9): [True: 5.05k, False: 4.70M]
  |  Branch (11150:21): [True: 5.19k, False: 4.69M]
  ------------------
11151|  1.47M|      result += static_cast<char>(c);
11152|  1.47M|    }
11153|       |    // Space handling
11154|  4.69M|    else if (c == ' ') {
  ------------------
  |  Branch (11154:14): [True: 78.1k, False: 4.61M]
  ------------------
11155|  78.1k|      if (space_as_plus) {
  ------------------
  |  Branch (11155:11): [True: 78.1k, False: 0]
  ------------------
11156|  78.1k|        result += '+';
11157|  78.1k|      } else {
11158|      0|        result += "%20";
11159|      0|      }
11160|  78.1k|    }
11161|       |    // Plus sign handling
11162|  4.61M|    else if (c == '+') {
  ------------------
  |  Branch (11162:14): [True: 4.22k, False: 4.61M]
  ------------------
11163|  4.22k|      if (space_as_plus) {
  ------------------
  |  Branch (11163:11): [True: 4.22k, False: 0]
  ------------------
11164|  4.22k|        result += "%2B";
11165|  4.22k|      } else {
11166|      0|        result += static_cast<char>(c);
11167|      0|      }
11168|  4.22k|    }
11169|       |    // Query-safe sub-delimiters (excluding & and = which are query delimiters)
11170|  4.61M|    else if (c == '!' || c == '$' || c == '\'' || c == '(' || c == ')' ||
  ------------------
  |  Branch (11170:14): [True: 5.12k, False: 4.61M]
  |  Branch (11170:26): [True: 4.67k, False: 4.60M]
  |  Branch (11170:38): [True: 5.03k, False: 4.60M]
  |  Branch (11170:51): [True: 4.90k, False: 4.59M]
  |  Branch (11170:63): [True: 5.30k, False: 4.59M]
  ------------------
11171|  4.59M|             c == '*' || c == ',' || c == ';') {
  ------------------
  |  Branch (11171:14): [True: 5.52k, False: 4.58M]
  |  Branch (11171:26): [True: 6.08k, False: 4.57M]
  |  Branch (11171:38): [True: 5.11k, False: 4.57M]
  ------------------
11172|  41.7k|      result += static_cast<char>(c);
11173|  41.7k|    }
11174|       |    // Colon and @ are allowed in query
11175|  4.57M|    else if (c == ':' || c == '@') {
  ------------------
  |  Branch (11175:14): [True: 5.06k, False: 4.56M]
  |  Branch (11175:26): [True: 5.22k, False: 4.56M]
  ------------------
11176|  10.2k|      result += static_cast<char>(c);
11177|  10.2k|    }
11178|       |    // Forward slash is allowed in query values
11179|  4.56M|    else if (c == '/') {
  ------------------
  |  Branch (11179:14): [True: 35.7k, False: 4.52M]
  ------------------
11180|  35.7k|      result += static_cast<char>(c);
11181|  35.7k|    }
11182|       |    // Question mark is allowed in query values (after first ?)
11183|  4.52M|    else if (c == '?') {
  ------------------
  |  Branch (11183:14): [True: 4.84k, False: 4.52M]
  ------------------
11184|  4.84k|      result += static_cast<char>(c);
11185|  4.52M|    } else {
11186|  4.52M|      result += '%';
11187|  4.52M|      char hex[3];
11188|  4.52M|      snprintf(hex, sizeof(hex), "%02X", c);
11189|  4.52M|      result.append(hex, 2);
11190|  4.52M|    }
11191|  6.17M|  }
11192|  22.7k|  return result;
11193|  22.7k|}
_ZN7httplib6detail14is_ascii_alnumEc:
  590|  6.17M|inline bool is_ascii_alnum(char c) {
  591|  6.17M|  return is_ascii_digit(c) || is_ascii_alpha(c);
  ------------------
  |  Branch (591:10): [True: 1.12M, False: 5.04M]
  |  Branch (591:31): [True: 322k, False: 4.72M]
  ------------------
  592|  6.17M|}
_ZN7httplib6detail14is_ascii_alphaEc:
  586|  5.04M|inline bool is_ascii_alpha(char c) {
  587|  5.04M|  return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
  ------------------
  |  Branch (587:11): [True: 231k, False: 4.81M]
  |  Branch (587:23): [True: 204k, False: 27.5k]
  |  Branch (587:37): [True: 186k, False: 4.65M]
  |  Branch (587:49): [True: 118k, False: 68.1k]
  ------------------
  588|  5.04M|}
_ZN7httplib6detail22normalize_query_stringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 8834|    308|inline std::string normalize_query_string(const std::string &query) {
 8835|    308|  std::string result;
 8836|    308|  split(query.data(), query.data() + query.size(), '&',
 8837|    308|        [&](const char *b, const char *e) {
 8838|    308|          std::string key;
 8839|    308|          std::string val;
 8840|    308|          divide_query_pair(b, e, key, val);
 8841|       |
 8842|    308|          if (!key.empty()) {
 8843|    308|            auto dec_key = decode_query_component(key);
 8844|    308|            auto dec_val = decode_query_component(val);
 8845|       |
 8846|    308|            if (!result.empty()) { result += '&'; }
 8847|    308|            result += encode_query_component(dec_key);
 8848|    308|            if (!val.empty() || std::find(b, e, '=') != e) {
 8849|    308|              result += '=';
 8850|    308|              result += encode_query_component(dec_val);
 8851|    308|            }
 8852|    308|          }
 8853|    308|        });
 8854|    308|  return result;
 8855|    308|}
_ZZN7httplib6detail22normalize_query_stringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENKUlPKcSB_E_clESB_SB_:
 8837|  21.9k|        [&](const char *b, const char *e) {
 8838|  21.9k|          std::string key;
 8839|  21.9k|          std::string val;
 8840|  21.9k|          divide_query_pair(b, e, key, val);
 8841|       |
 8842|  21.9k|          if (!key.empty()) {
  ------------------
  |  Branch (8842:15): [True: 20.6k, False: 1.26k]
  ------------------
 8843|  20.6k|            auto dec_key = decode_query_component(key);
 8844|  20.6k|            auto dec_val = decode_query_component(val);
 8845|       |
 8846|  20.6k|            if (!result.empty()) { result += '&'; }
  ------------------
  |  Branch (8846:17): [True: 20.4k, False: 268]
  ------------------
 8847|  20.6k|            result += encode_query_component(dec_key);
 8848|  20.6k|            if (!val.empty() || std::find(b, e, '=') != e) {
  ------------------
  |  Branch (8848:17): [True: 1.00k, False: 19.6k]
  |  Branch (8848:17): [True: 1.99k, False: 18.6k]
  |  Branch (8848:33): [True: 988, False: 18.6k]
  ------------------
 8849|  1.99k|              result += '=';
 8850|  1.99k|              result += encode_query_component(dec_val);
 8851|  1.99k|            }
 8852|  20.6k|          }
 8853|  21.9k|        });
_ZN7httplib6detail13is_valid_pathERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 5586|    222|inline bool is_valid_path(const std::string &path) {
 5587|    222|  size_t level = 0;
 5588|    222|  size_t i = 0;
 5589|       |
 5590|       |  // Skip slash
 5591|   553k|  while (i < path.size() && path[i] == '/') {
  ------------------
  |  Branch (5591:10): [True: 553k, False: 11]
  |  Branch (5591:29): [True: 553k, False: 211]
  ------------------
 5592|   553k|    i++;
 5593|   553k|  }
 5594|       |
 5595|   858k|  while (i < path.size()) {
  ------------------
  |  Branch (5595:10): [True: 858k, False: 206]
  ------------------
 5596|       |    // Read component
 5597|   858k|    auto beg = i;
 5598|  3.40M|    while (i < path.size() && path[i] != '/') {
  ------------------
  |  Branch (5598:12): [True: 3.40M, False: 176]
  |  Branch (5598:31): [True: 2.54M, False: 858k]
  ------------------
 5599|  2.54M|      if (path[i] == '\0') {
  ------------------
  |  Branch (5599:11): [True: 12, False: 2.54M]
  ------------------
 5600|     12|        return false;
 5601|  2.54M|      } else if (path[i] == '\\') {
  ------------------
  |  Branch (5601:18): [True: 3, False: 2.54M]
  ------------------
 5602|      3|        return false;
 5603|      3|      }
 5604|  2.54M|      i++;
 5605|  2.54M|    }
 5606|       |
 5607|   858k|    auto len = i - beg;
 5608|   858k|    assert(len > 0);
  ------------------
  |  Branch (5608:5): [True: 858k, False: 0]
  ------------------
 5609|       |
 5610|   858k|    if (!path.compare(beg, len, ".")) {
  ------------------
  |  Branch (5610:9): [True: 6.89k, False: 851k]
  ------------------
 5611|  6.89k|      ;
 5612|   851k|    } else if (!path.compare(beg, len, "..")) {
  ------------------
  |  Branch (5612:16): [True: 40.5k, False: 810k]
  ------------------
 5613|  40.5k|      if (level == 0) { return false; }
  ------------------
  |  Branch (5613:11): [True: 1, False: 40.5k]
  ------------------
 5614|  40.5k|      level--;
 5615|   810k|    } else {
 5616|   810k|      level++;
 5617|   810k|    }
 5618|       |
 5619|       |    // Skip slash
 5620|  1.90M|    while (i < path.size() && path[i] == '/') {
  ------------------
  |  Branch (5620:12): [True: 1.90M, False: 195]
  |  Branch (5620:31): [True: 1.05M, False: 858k]
  ------------------
 5621|  1.05M|      i++;
 5622|  1.05M|    }
 5623|   858k|  }
 5624|       |
 5625|    206|  return true;
 5626|    222|}

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

