LLVMFuzzerTestOneInput:
  164|  2.45k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  165|  2.45k|  constexpr auto optionbytes = 4u;
  166|  2.45k|  static_assert(optionbytes % 2 == 0,
  167|  2.45k|                "optionbytes must be even to avoid misaligned char16 pointers");
  168|  2.45k|  if (size < optionbytes) {
  ------------------
  |  Branch (168:7): [True: 2, False: 2.45k]
  ------------------
  169|      2|    return 0;
  170|      2|  }
  171|       |
  172|  2.45k|  constexpr auto Ncases = 2u;
  173|  2.45k|  constexpr auto actionmask = std::bit_ceil(Ncases) - 1;
  174|  2.45k|  const auto action = data[0] & actionmask;
  175|       |
  176|  2.45k|  const auto opt = [](auto index) {
  177|  2.45k|    if (index >= options.size()) {
  178|  2.45k|      return options[0];
  179|  2.45k|    }
  180|  2.45k|    return options[index];
  181|  2.45k|  }(data[1] & (std::bit_ceil(options.size()) - 1));
  182|       |
  183|  2.45k|  const auto lco =
  184|  2.45k|      (opt == simdutf::base64_url || opt == simdutf::base64_default_no_padding)
  ------------------
  |  Branch (184:8): [True: 282, False: 2.17k]
  |  Branch (184:38): [True: 204, False: 1.97k]
  ------------------
  185|  2.45k|          ? simdutf::last_chunk_handling_options::loose
  186|  2.45k|          : [](auto index) {
  187|  1.97k|              if (index >= last_chunk.size()) {
  188|  1.97k|                return last_chunk[0];
  189|  1.97k|              }
  190|  1.97k|              return last_chunk[index];
  191|  1.97k|            }(data[2] & (std::bit_ceil(last_chunk.size()) - 1));
  192|       |
  193|       |  // data[3] reserved for future use / alignment.
  194|       |
  195|  2.45k|  data += optionbytes;
  196|  2.45k|  size -= optionbytes;
  197|       |
  198|  2.45k|  switch (action) {
  ------------------
  |  Branch (198:11): [True: 2.45k, False: 0]
  ------------------
  199|  1.23k|  case 0: {
  ------------------
  |  Branch (199:3): [True: 1.23k, False: 1.22k]
  ------------------
  200|  1.23k|    const std::span<const char> chardata{reinterpret_cast<const char*>(data),
  201|  1.23k|                                         size};
  202|  1.23k|    test_details(chardata, opt, lco);
  203|  1.23k|  } break;
  204|  1.22k|  case 1: {
  ------------------
  |  Branch (204:3): [True: 1.22k, False: 1.23k]
  ------------------
  205|  1.22k|    const std::span<const char16_t> chardata{
  206|  1.22k|        reinterpret_cast<const char16_t*>(data), size / sizeof(char16_t)};
  207|  1.22k|    test_details(chardata, opt, lco);
  208|  1.22k|  } break;
  209|  2.45k|  }
  210|       |
  211|  2.45k|  return 0;
  212|  2.45k|}
base64_details.cpp:_ZZ22LLVMFuzzerTestOneInputENK3$_0clImEEDaT_:
  176|  2.45k|  const auto opt = [](auto index) {
  177|  2.45k|    if (index >= options.size()) {
  ------------------
  |  Branch (177:9): [True: 0, False: 2.45k]
  ------------------
  178|      0|      return options[0];
  179|      0|    }
  180|  2.45k|    return options[index];
  181|  2.45k|  }(data[1] & (std::bit_ceil(options.size()) - 1));
base64_details.cpp:_ZZ22LLVMFuzzerTestOneInputENK3$_1clImEEDaT_:
  186|  1.97k|          : [](auto index) {
  187|  1.97k|              if (index >= last_chunk.size()) {
  ------------------
  |  Branch (187:19): [True: 175, False: 1.79k]
  ------------------
  188|    175|                return last_chunk[0];
  189|    175|              }
  190|  1.79k|              return last_chunk[index];
  191|  1.97k|            }(data[2] & (std::bit_ceil(last_chunk.size()) - 1));
base64_details.cpp:_ZL12test_detailsIcEvNSt3__14spanIKT_Lm18446744073709551615EEEN7simdutf14base64_optionsENS5_27last_chunk_handling_optionsE:
   57|  1.23k|                         simdutf::last_chunk_handling_options lco) {
   58|  1.23k|  const auto implementations = get_supported_implementations();
   59|  1.23k|  if (implementations.empty()) {
  ------------------
  |  Branch (59:7): [True: 0, False: 1.23k]
  ------------------
   60|      0|    return;
   61|      0|  }
   62|       |
   63|  1.23k|  std::vector<comparable_full_result> results;
   64|  1.23k|  results.reserve(implementations.size());
   65|       |
   66|  3.69k|  for (auto impl : implementations) {
  ------------------
  |  Branch (66:18): [True: 3.69k, False: 1.23k]
  ------------------
   67|       |    // Use a fresh buffer for base64_to_binary_details.
   68|  3.69k|    const std::size_t maxbinary =
   69|  3.69k|        impl->maximal_binary_length_from_base64(input.data(), input.size());
   70|  3.69k|    std::vector<char> out_details(maxbinary);
   71|       |
   72|  3.69k|    const simdutf::full_result fr = impl->base64_to_binary_details(
   73|  3.69k|        input.data(), input.size(), out_details.data(), opt, lco);
   74|       |
   75|       |    // Bounds checks.
   76|  3.69k|    if (fr.input_count > input.size()) {
  ------------------
  |  Branch (76:9): [True: 0, False: 3.69k]
  ------------------
   77|      0|      std::cerr << "base64_to_binary_details: input_count=" << fr.input_count
   78|      0|                << " > input.size()=" << input.size()
   79|      0|                << " impl=" << impl->name() << "\n";
   80|      0|      std::abort();
   81|      0|    }
   82|  3.69k|    if (fr.output_count > maxbinary) {
  ------------------
  |  Branch (82:9): [True: 0, False: 3.69k]
  ------------------
   83|      0|      std::cerr << "base64_to_binary_details: output_count=" << fr.output_count
   84|      0|                << " > maxbinary=" << maxbinary << " impl=" << impl->name()
   85|      0|                << "\n";
   86|      0|      std::abort();
   87|      0|    }
   88|       |
   89|       |    // Consistency check: full_result cast to result must equal
   90|       |    // base64_to_binary.
   91|  3.69k|    std::vector<char> out_plain(maxbinary);
   92|  3.69k|    const simdutf::result r = impl->base64_to_binary(
   93|  3.69k|        input.data(), input.size(), out_plain.data(), opt, lco);
   94|  3.69k|    const simdutf::result r_from_fr = static_cast<simdutf::result>(fr);
   95|       |
   96|  3.69k|    if (r != r_from_fr) {
  ------------------
  |  Branch (96:9): [True: 0, False: 3.69k]
  ------------------
   97|      0|      std::cerr << "base64_to_binary_details vs base64_to_binary inconsistency"
   98|      0|                << " impl=" << impl->name()
   99|      0|                << " base64_to_binary=[error=" << r.error
  100|      0|                << " count=" << r.count << "]"
  101|      0|                << " full_result cast=[error=" << r_from_fr.error
  102|      0|                << " count=" << r_from_fr.count << "]\n";
  103|      0|      std::abort();
  104|      0|    }
  105|       |
  106|       |    // On success, output bytes from both functions must match.
  107|  3.69k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (107:9): [True: 2.17k, False: 1.52k]
  ------------------
  108|  2.17k|      if (fr.output_count != r.count) {
  ------------------
  |  Branch (108:11): [True: 0, False: 2.17k]
  ------------------
  109|      0|        std::cerr << "base64_to_binary_details: SUCCESS but output_count="
  110|      0|                  << fr.output_count << " != r.count=" << r.count
  111|      0|                  << " impl=" << impl->name() << "\n";
  112|      0|        std::abort();
  113|      0|      }
  114|  2.17k|      const auto span_details =
  115|  2.17k|          std::span(out_details).subspan(0, fr.output_count);
  116|  2.17k|      const auto span_plain = std::span(out_plain).subspan(0, r.count);
  117|  2.17k|      if (!std::ranges::equal(span_details, span_plain)) {
  ------------------
  |  Branch (117:11): [True: 0, False: 2.17k]
  ------------------
  118|      0|        std::cerr << "base64_to_binary_details: output bytes differ from "
  119|      0|                     "base64_to_binary on SUCCESS"
  120|      0|                  << " impl=" << impl->name() << "\n";
  121|      0|        std::abort();
  122|      0|      }
  123|  2.17k|    }
  124|       |
  125|       |    // Store result for cross-implementation comparison.
  126|       |    //
  127|       |    // output_count on error is implementation-defined: SIMD implementations
  128|       |    // process input in different chunk widths and may write different numbers
  129|       |    // of output bytes before detecting an invalid character. Only compare
  130|       |    // output_count (and output_hash) when the conversion succeeds.
  131|       |    //
  132|       |    // input_count on success is also implementation-defined: with
  133|       |    // stop_before_partial and trailing ignored whitespace, some implementations
  134|       |    // include the trailing whitespace in input_count and others do not. The
  135|       |    // full_result::operator result() cast only uses output_count on success
  136|       |    // (input_count is not part of the base contract there). Only compare
  137|       |    // input_count when the conversion fails, where it carries the error
  138|       |    // position (which must be deterministic).
  139|  3.69k|    comparable_full_result cfr;
  140|  3.69k|    cfr.error = fr.error;
  141|  3.69k|    cfr.padding_error = fr.padding_error;
  142|  3.69k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (142:9): [True: 2.17k, False: 1.52k]
  ------------------
  143|  2.17k|      cfr.output_count = fr.output_count;
  144|  2.17k|      cfr.output_hash = FNV1A_hash::as_str(
  145|  2.17k|          std::span(out_details).subspan(0, fr.output_count));
  146|  2.17k|    } else {
  147|  1.52k|      cfr.input_count = fr.input_count;
  148|  1.52k|    }
  149|  3.69k|    results.push_back(std::move(cfr));
  150|  3.69k|  }
  151|       |
  152|       |  // All implementations must agree on the full_result.
  153|  1.23k|  auto neq = [](const auto& a, const auto& b) { return a != b; };
  154|  1.23k|  if (std::ranges::adjacent_find(results, neq) != results.end()) {
  ------------------
  |  Branch (154:7): [True: 0, False: 1.23k]
  ------------------
  155|      0|    std::cerr << "base64_to_binary_details: implementations disagree\n";
  156|      0|    for (std::size_t i = 0; i < implementations.size(); ++i) {
  ------------------
  |  Branch (156:29): [True: 0, False: 0]
  ------------------
  157|      0|      std::cerr << "  " << implementations[i]->name() << ": " << results[i]
  158|      0|                << "\n";
  159|      0|    }
  160|      0|    std::abort();
  161|      0|  }
  162|  1.23k|}
base64_details.cpp:_ZZL12test_detailsIcEvNSt3__14spanIKT_Lm18446744073709551615EEEN7simdutf14base64_optionsENS5_27last_chunk_handling_optionsEENKUlRS3_RKT0_E_clI22comparable_full_resultSE_EEDaS8_SB_:
  153|  2.46k|  auto neq = [](const auto& a, const auto& b) { return a != b; };
base64_details.cpp:_ZL12test_detailsIDsEvNSt3__14spanIKT_Lm18446744073709551615EEEN7simdutf14base64_optionsENS5_27last_chunk_handling_optionsE:
   57|  1.22k|                         simdutf::last_chunk_handling_options lco) {
   58|  1.22k|  const auto implementations = get_supported_implementations();
   59|  1.22k|  if (implementations.empty()) {
  ------------------
  |  Branch (59:7): [True: 0, False: 1.22k]
  ------------------
   60|      0|    return;
   61|      0|  }
   62|       |
   63|  1.22k|  std::vector<comparable_full_result> results;
   64|  1.22k|  results.reserve(implementations.size());
   65|       |
   66|  3.67k|  for (auto impl : implementations) {
  ------------------
  |  Branch (66:18): [True: 3.67k, False: 1.22k]
  ------------------
   67|       |    // Use a fresh buffer for base64_to_binary_details.
   68|  3.67k|    const std::size_t maxbinary =
   69|  3.67k|        impl->maximal_binary_length_from_base64(input.data(), input.size());
   70|  3.67k|    std::vector<char> out_details(maxbinary);
   71|       |
   72|  3.67k|    const simdutf::full_result fr = impl->base64_to_binary_details(
   73|  3.67k|        input.data(), input.size(), out_details.data(), opt, lco);
   74|       |
   75|       |    // Bounds checks.
   76|  3.67k|    if (fr.input_count > input.size()) {
  ------------------
  |  Branch (76:9): [True: 0, False: 3.67k]
  ------------------
   77|      0|      std::cerr << "base64_to_binary_details: input_count=" << fr.input_count
   78|      0|                << " > input.size()=" << input.size()
   79|      0|                << " impl=" << impl->name() << "\n";
   80|      0|      std::abort();
   81|      0|    }
   82|  3.67k|    if (fr.output_count > maxbinary) {
  ------------------
  |  Branch (82:9): [True: 0, False: 3.67k]
  ------------------
   83|      0|      std::cerr << "base64_to_binary_details: output_count=" << fr.output_count
   84|      0|                << " > maxbinary=" << maxbinary << " impl=" << impl->name()
   85|      0|                << "\n";
   86|      0|      std::abort();
   87|      0|    }
   88|       |
   89|       |    // Consistency check: full_result cast to result must equal
   90|       |    // base64_to_binary.
   91|  3.67k|    std::vector<char> out_plain(maxbinary);
   92|  3.67k|    const simdutf::result r = impl->base64_to_binary(
   93|  3.67k|        input.data(), input.size(), out_plain.data(), opt, lco);
   94|  3.67k|    const simdutf::result r_from_fr = static_cast<simdutf::result>(fr);
   95|       |
   96|  3.67k|    if (r != r_from_fr) {
  ------------------
  |  Branch (96:9): [True: 0, False: 3.67k]
  ------------------
   97|      0|      std::cerr << "base64_to_binary_details vs base64_to_binary inconsistency"
   98|      0|                << " impl=" << impl->name()
   99|      0|                << " base64_to_binary=[error=" << r.error
  100|      0|                << " count=" << r.count << "]"
  101|      0|                << " full_result cast=[error=" << r_from_fr.error
  102|      0|                << " count=" << r_from_fr.count << "]\n";
  103|      0|      std::abort();
  104|      0|    }
  105|       |
  106|       |    // On success, output bytes from both functions must match.
  107|  3.67k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (107:9): [True: 1.65k, False: 2.01k]
  ------------------
  108|  1.65k|      if (fr.output_count != r.count) {
  ------------------
  |  Branch (108:11): [True: 0, False: 1.65k]
  ------------------
  109|      0|        std::cerr << "base64_to_binary_details: SUCCESS but output_count="
  110|      0|                  << fr.output_count << " != r.count=" << r.count
  111|      0|                  << " impl=" << impl->name() << "\n";
  112|      0|        std::abort();
  113|      0|      }
  114|  1.65k|      const auto span_details =
  115|  1.65k|          std::span(out_details).subspan(0, fr.output_count);
  116|  1.65k|      const auto span_plain = std::span(out_plain).subspan(0, r.count);
  117|  1.65k|      if (!std::ranges::equal(span_details, span_plain)) {
  ------------------
  |  Branch (117:11): [True: 0, False: 1.65k]
  ------------------
  118|      0|        std::cerr << "base64_to_binary_details: output bytes differ from "
  119|      0|                     "base64_to_binary on SUCCESS"
  120|      0|                  << " impl=" << impl->name() << "\n";
  121|      0|        std::abort();
  122|      0|      }
  123|  1.65k|    }
  124|       |
  125|       |    // Store result for cross-implementation comparison.
  126|       |    //
  127|       |    // output_count on error is implementation-defined: SIMD implementations
  128|       |    // process input in different chunk widths and may write different numbers
  129|       |    // of output bytes before detecting an invalid character. Only compare
  130|       |    // output_count (and output_hash) when the conversion succeeds.
  131|       |    //
  132|       |    // input_count on success is also implementation-defined: with
  133|       |    // stop_before_partial and trailing ignored whitespace, some implementations
  134|       |    // include the trailing whitespace in input_count and others do not. The
  135|       |    // full_result::operator result() cast only uses output_count on success
  136|       |    // (input_count is not part of the base contract there). Only compare
  137|       |    // input_count when the conversion fails, where it carries the error
  138|       |    // position (which must be deterministic).
  139|  3.67k|    comparable_full_result cfr;
  140|  3.67k|    cfr.error = fr.error;
  141|  3.67k|    cfr.padding_error = fr.padding_error;
  142|  3.67k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (142:9): [True: 1.65k, False: 2.01k]
  ------------------
  143|  1.65k|      cfr.output_count = fr.output_count;
  144|  1.65k|      cfr.output_hash = FNV1A_hash::as_str(
  145|  1.65k|          std::span(out_details).subspan(0, fr.output_count));
  146|  2.01k|    } else {
  147|  2.01k|      cfr.input_count = fr.input_count;
  148|  2.01k|    }
  149|  3.67k|    results.push_back(std::move(cfr));
  150|  3.67k|  }
  151|       |
  152|       |  // All implementations must agree on the full_result.
  153|  1.22k|  auto neq = [](const auto& a, const auto& b) { return a != b; };
  154|  1.22k|  if (std::ranges::adjacent_find(results, neq) != results.end()) {
  ------------------
  |  Branch (154:7): [True: 0, False: 1.22k]
  ------------------
  155|      0|    std::cerr << "base64_to_binary_details: implementations disagree\n";
  156|      0|    for (std::size_t i = 0; i < implementations.size(); ++i) {
  ------------------
  |  Branch (156:29): [True: 0, False: 0]
  ------------------
  157|      0|      std::cerr << "  " << implementations[i]->name() << ": " << results[i]
  158|      0|                << "\n";
  159|      0|    }
  160|      0|    std::abort();
  161|      0|  }
  162|  1.22k|}
base64_details.cpp:_ZZL12test_detailsIDsEvNSt3__14spanIKT_Lm18446744073709551615EEEN7simdutf14base64_optionsENS5_27last_chunk_handling_optionsEENKUlRS3_RKT0_E_clI22comparable_full_resultSE_EEDaS8_SB_:
  153|  2.45k|  auto neq = [](const auto& a, const auto& b) { return a != b; };

_Z29get_supported_implementationsv:
   26|  2.45k|get_supported_implementations() {
   27|  2.45k|  static const auto impl = []() -> auto {
   28|  2.45k|    std::vector<const simdutf::implementation*> ret;
   29|  2.45k|    for (auto e : simdutf::get_available_implementations()) {
   30|  2.45k|      std::cerr << "implementation " << e->name() << " is available? "
   31|  2.45k|                << e->supported_by_runtime_system() << '\n';
   32|  2.45k|      if (e->supported_by_runtime_system()) {
   33|  2.45k|        ret.push_back(e);
   34|  2.45k|      }
   35|  2.45k|    }
   36|  2.45k|    return ret;
   37|  2.45k|  }();
   38|  2.45k|  return {impl.data(), impl.size()};
   39|  2.45k|}
_ZZ29get_supported_implementationsvENKUlvE_clEv:
   27|      1|  static const auto impl = []() -> auto {
   28|      1|    std::vector<const simdutf::implementation*> ret;
   29|      4|    for (auto e : simdutf::get_available_implementations()) {
  ------------------
  |  Branch (29:17): [True: 4, False: 1]
  ------------------
   30|      4|      std::cerr << "implementation " << e->name() << " is available? "
   31|      4|                << e->supported_by_runtime_system() << '\n';
   32|      4|      if (e->supported_by_runtime_system()) {
  ------------------
  |  Branch (32:11): [True: 3, False: 1]
  ------------------
   33|      3|        ret.push_back(e);
   34|      3|      }
   35|      4|    }
   36|      1|    return ret;
   37|      1|  }();
_ZneRKN7simdutf6resultES2_:
   42|  7.37k|inline bool operator!=(const simdutf::result& a, const simdutf::result& b) {
   43|  7.37k|  return a.count != b.count || a.error != b.error;
  ------------------
  |  Branch (43:10): [True: 0, False: 7.37k]
  |  Branch (43:32): [True: 0, False: 7.37k]
  ------------------
   44|  7.37k|}
_ZN10FNV1A_hash6as_strIJNSt3__14spanIcLm18446744073709551615EEEEEENS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEDpRKT_:
  100|  3.83k|  template <typename... Data> static std::string as_str(const Data&... data) {
  101|  3.83k|    static_assert(sizeof...(Data) > 0, "must hash with at least one argument");
  102|  3.83k|    std::uint64_t h;
  103|       |    if constexpr (sizeof...(Data) > 1) {
  104|       |      const std::array hashes{fnv1ahash_impl(data)...};
  105|       |      const auto s = std::span(hashes);
  106|       |      h = fnv1ahash_impl(s);
  107|  3.83k|    } else {
  108|  3.83k|      h = fnv1ahash_impl(data...);
  109|  3.83k|    }
  110|  3.83k|    constexpr std::size_t expected_chars = 16;
  111|  3.83k|    std::string ret(expected_chars, '0');
  112|  3.83k|    auto c = std::to_chars(ret.data(), ret.data() + ret.size(), h, 16);
  113|  3.83k|    assert(c.ec == std::errc{});
  ------------------
  |  Branch (113:5): [True: 3.83k, False: 0]
  ------------------
  114|  3.83k|    auto nwritten = c.ptr - ret.data();
  115|  3.83k|    assert(nwritten <= expected_chars);
  ------------------
  |  Branch (115:5): [True: 3.83k, False: 0]
  ------------------
  116|  3.83k|    std::rotate(ret.data(), c.ptr, ret.data() + expected_chars);
  117|  3.83k|    return ret;
  118|  3.83k|  }
_ZN10FNV1A_hash14fnv1ahash_implENSt3__14spanIKcLm18446744073709551615EEE:
   75|  3.83k|  static constexpr std::uint64_t fnv1ahash_impl(std::span<const char> bytes) {
   76|  3.83k|    auto hash = offset;
   77|       |
   78|  34.2M|    for (auto byte : bytes) {
  ------------------
  |  Branch (78:20): [True: 34.2M, False: 3.83k]
  ------------------
   79|  34.2M|      hash ^= static_cast<unsigned char>(byte);
   80|  34.2M|      hash *= prime;
   81|  34.2M|    }
   82|       |
   83|  3.83k|    return hash;
   84|  3.83k|  }

_ZN7simdutf11full_resultC2ENS_10error_codeEmm:
  111|  14.3k|      : error{err}, input_count{pos_in}, output_count{pos_out} {}
_ZN7simdutf11full_resultC2ENS_10error_codeEmmb:
  114|    402|      : error{err}, input_count{pos_in}, output_count{pos_out},
  115|    402|        padding_error{padding_err} {}

_ZN7simdutf10is_partialENS_27last_chunk_handling_optionsE:
 4147|  22.5k|is_partial(last_chunk_handling_options options) {
 4148|  22.5k|  return (options == stop_before_partial) || (options == only_full_chunks);
  ------------------
  |  Branch (4148:10): [True: 12.5k, False: 10.0k]
  |  Branch (4148:46): [True: 0, False: 10.0k]
  ------------------
 4149|  22.5k|}
_ZNK7simdutf14implementation4nameEv:
 5121|      4|  virtual std::string_view name() const noexcept { return _name; }
_ZNK7simdutf14implementation25required_instruction_setsEv:
 5172|      8|  virtual uint32_t required_instruction_sets() const {
 5173|      8|    return _required_instruction_sets;
 5174|      8|  }
_ZN7simdutf14implementationC2EPKcS2_j:
 7058|      4|      : _name(name), _description(description),
 7059|      4|        _required_instruction_sets(required_instruction_sets) {}
_ZN7simdutf8internal29available_implementation_listC2Ev:
 7090|      1|  simdutf_really_inline available_implementation_list() {}
_ZN7simdutf16base64_ignorableEcNS_14base64_optionsE:
 4873|  17.7k|base64_ignorable(char input, base64_options options = base64_default) noexcept {
 4874|  17.7k|  return scalar::base64::is_ignorable(input, options);
 4875|  17.7k|}
_ZN7simdutf16base64_ignorableEDsNS_14base64_optionsE:
 4878|  33.4k|                 base64_options options = base64_default) noexcept {
 4879|  33.4k|  return scalar::base64::is_ignorable(input, options);
 4880|  33.4k|}

simdutf.cpp:_ZN7simdutf8internalL30detect_supported_architecturesEv:
  236|      8|static inline uint32_t detect_supported_architectures() {
  237|      8|  uint32_t eax;
  238|      8|  uint32_t ebx = 0;
  239|      8|  uint32_t ecx = 0;
  240|      8|  uint32_t edx = 0;
  241|      8|  uint32_t host_isa = 0x0;
  242|       |
  243|       |  // EBX for EAX=0x1
  244|      8|  eax = 0x1;
  245|      8|  cpuid(&eax, &ebx, &ecx, &edx);
  246|       |
  247|      8|  if (ecx & cpuid_bit::sse42) {
  ------------------
  |  Branch (247:7): [True: 8, False: 0]
  ------------------
  248|      8|    host_isa |= instruction_set::SSE42;
  249|      8|  }
  250|       |
  251|      8|  if (ecx & cpuid_bit::pclmulqdq) {
  ------------------
  |  Branch (251:7): [True: 8, False: 0]
  ------------------
  252|      8|    host_isa |= instruction_set::PCLMULQDQ;
  253|      8|  }
  254|       |
  255|      8|  if ((ecx & cpuid_bit::osxsave) != cpuid_bit::osxsave) {
  ------------------
  |  Branch (255:7): [True: 0, False: 8]
  ------------------
  256|      0|    return host_isa;
  257|      0|  }
  258|       |
  259|       |  // xgetbv for checking if the OS saves registers
  260|      8|  uint64_t xcr0 = xgetbv();
  261|       |
  262|      8|  if ((xcr0 & cpuid_bit::xcr0_bit::avx256_saved) == 0) {
  ------------------
  |  Branch (262:7): [True: 0, False: 8]
  ------------------
  263|      0|    return host_isa;
  264|      0|  }
  265|       |  // ECX for EAX=0x7
  266|      8|  eax = 0x7;
  267|      8|  ecx = 0x0; // Sub-leaf = 0
  268|      8|  cpuid(&eax, &ebx, &ecx, &edx);
  269|      8|  if (ebx & cpuid_bit::ebx::avx2) {
  ------------------
  |  Branch (269:7): [True: 8, False: 0]
  ------------------
  270|      8|    host_isa |= instruction_set::AVX2;
  271|      8|  }
  272|      8|  if (ebx & cpuid_bit::ebx::bmi1) {
  ------------------
  |  Branch (272:7): [True: 8, False: 0]
  ------------------
  273|      8|    host_isa |= instruction_set::BMI1;
  274|      8|  }
  275|      8|  if (ebx & cpuid_bit::ebx::bmi2) {
  ------------------
  |  Branch (275:7): [True: 8, False: 0]
  ------------------
  276|      8|    host_isa |= instruction_set::BMI2;
  277|      8|  }
  278|      8|  if (!((xcr0 & cpuid_bit::xcr0_bit::avx512_saved) ==
  ------------------
  |  Branch (278:7): [True: 8, False: 0]
  ------------------
  279|      8|        cpuid_bit::xcr0_bit::avx512_saved)) {
  280|      8|    return host_isa;
  281|      8|  }
  282|      0|  if (ebx & cpuid_bit::ebx::avx512f) {
  ------------------
  |  Branch (282:7): [True: 0, False: 0]
  ------------------
  283|      0|    host_isa |= instruction_set::AVX512F;
  284|      0|  }
  285|      0|  if (ebx & cpuid_bit::ebx::avx512bw) {
  ------------------
  |  Branch (285:7): [True: 0, False: 0]
  ------------------
  286|      0|    host_isa |= instruction_set::AVX512BW;
  287|      0|  }
  288|      0|  if (ebx & cpuid_bit::ebx::avx512cd) {
  ------------------
  |  Branch (288:7): [True: 0, False: 0]
  ------------------
  289|      0|    host_isa |= instruction_set::AVX512CD;
  290|      0|  }
  291|      0|  if (ebx & cpuid_bit::ebx::avx512dq) {
  ------------------
  |  Branch (291:7): [True: 0, False: 0]
  ------------------
  292|      0|    host_isa |= instruction_set::AVX512DQ;
  293|      0|  }
  294|      0|  if (ebx & cpuid_bit::ebx::avx512vl) {
  ------------------
  |  Branch (294:7): [True: 0, False: 0]
  ------------------
  295|      0|    host_isa |= instruction_set::AVX512VL;
  296|      0|  }
  297|      0|  if (ecx & cpuid_bit::ecx::avx512vbmi2) {
  ------------------
  |  Branch (297:7): [True: 0, False: 0]
  ------------------
  298|      0|    host_isa |= instruction_set::AVX512VBMI2;
  299|      0|  }
  300|      0|  if (ecx & cpuid_bit::ecx::avx512vpopcnt) {
  ------------------
  |  Branch (300:7): [True: 0, False: 0]
  ------------------
  301|      0|    host_isa |= instruction_set::AVX512VPOPCNTDQ;
  302|      0|  }
  303|      0|  return host_isa;
  304|      8|}
simdutf.cpp:_ZN7simdutf8internalL5cpuidEPjS1_S1_S1_:
  202|     16|                         uint32_t *edx) {
  203|       |  #if defined(_MSC_VER)
  204|       |  int cpu_info[4];
  205|       |  __cpuidex(cpu_info, *eax, *ecx);
  206|       |  *eax = cpu_info[0];
  207|       |  *ebx = cpu_info[1];
  208|       |  *ecx = cpu_info[2];
  209|       |  *edx = cpu_info[3];
  210|       |  #elif (defined(HAVE_GCC_GET_CPUID) && defined(USE_GCC_GET_CPUID)) ||         \
  211|       |      defined(__FILC__)
  212|       |  uint32_t level = *eax;
  213|       |  __get_cpuid(level, eax, ebx, ecx, edx);
  214|       |  #else
  215|     16|  uint32_t a = *eax, b, c = *ecx, d;
  216|     16|  asm volatile("cpuid\n\t" : "+a"(a), "=b"(b), "+c"(c), "=d"(d));
  217|     16|  *eax = a;
  218|     16|  *ebx = b;
  219|     16|  *ecx = c;
  220|     16|  *edx = d;
  221|     16|  #endif
  222|     16|}
simdutf.cpp:_ZN7simdutf8internalL6xgetbvEv:
  224|      8|static inline uint64_t xgetbv() {
  225|       |  #if defined(_MSC_VER)
  226|       |  return _xgetbv(0);
  227|       |  #elif defined(__FILC__)
  228|       |  return zxgetbv();
  229|       |  #else
  230|      8|  uint32_t xcr0_lo, xcr0_hi;
  231|      8|  asm volatile("xgetbv\n\t" : "=a"(xcr0_lo), "=d"(xcr0_hi) : "c"(0));
  232|      8|  return xcr0_lo | ((uint64_t)xcr0_hi << 32);
  233|      8|  #endif
  234|      8|}

simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6413is_eight_byteIcEEbT_:
   19|  30.1M|template <class char_type> simdutf_constexpr23 bool is_eight_byte(char_type c) {
   20|  30.1M|  if constexpr (sizeof(char_type) == 1) {
   21|  30.1M|    return true;
   22|  30.1M|  }
   23|      0|  return uint8_t(c) == c;
   24|  30.1M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6413is_eight_byteIDsEEbT_:
   19|  6.76M|template <class char_type> simdutf_constexpr23 bool is_eight_byte(char_type c) {
   20|       |  if constexpr (sizeof(char_type) == 1) {
   21|       |    return true;
   22|       |  }
   23|  6.76M|  return uint8_t(c) == c;
   24|  6.76M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKcEEmT_m:
  654|  3.69k|maximal_binary_length_from_base64(InputPtr input, size_t length) noexcept {
  655|       |  // We process the padding characters ('=') at the end to make sure
  656|       |  // that we return an exact result when the input has no ignorable characters
  657|       |  // (e.g., spaces).
  658|  3.69k|  size_t padding = 0;
  659|  3.69k|  if (length > 0) {
  ------------------
  |  Branch (659:7): [True: 3.67k, False: 18]
  ------------------
  660|  3.67k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (660:9): [True: 222, False: 3.45k]
  ------------------
  661|    222|      padding++;
  662|    222|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (662:11): [True: 216, False: 6]
  |  Branch (662:25): [True: 30, False: 186]
  ------------------
  663|     30|        padding++;
  664|     30|      }
  665|    222|    }
  666|  3.67k|  }
  667|       |  // The input is not otherwise processed for ignorable characters or
  668|       |  // validation, so that the function runs in constant time (very fast). In
  669|       |  // practice, base64 inputs without ignorable characters are common and the
  670|       |  // common case are line separated inputs with relatively long lines (e.g., 76
  671|       |  // characters) which leads this function to a slight (1%) overestimation of
  672|       |  // the output size.
  673|       |  //
  674|       |  // Of course, some inputs might contain an arbitrary number of spaces or
  675|       |  // newlines, which would make this function return a very pessimistic output
  676|       |  // size but systems that produce base64 outputs typically do not do that and
  677|       |  // if they do, they do not care much about minimizing memory usage.
  678|       |  //
  679|       |  // In specialized applications, users may know that their input is line
  680|       |  // separated, which can be checked very quickly by by iterating (e.g., over 76
  681|       |  // character chunks, looking for the linefeed characters only). We could
  682|       |  // provide a specialized function for that, but it is not clear that the added
  683|       |  // complexity is worth it for us.
  684|       |  //
  685|  3.69k|  size_t actual_length = length - padding;
  686|  3.69k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (686:7): [True: 3.14k, False: 552]
  ------------------
  687|  3.14k|    return actual_length / 4 * 3;
  688|  3.14k|  }
  689|       |  // if we have a valid input, then the remainder must be 2 or 3 adding one or
  690|       |  // two extra bytes.
  691|    552|  return actual_length / 4 * 3 + (actual_length % 4) - 1;
  692|  3.69k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKDsEEmT_m:
  654|  3.67k|maximal_binary_length_from_base64(InputPtr input, size_t length) noexcept {
  655|       |  // We process the padding characters ('=') at the end to make sure
  656|       |  // that we return an exact result when the input has no ignorable characters
  657|       |  // (e.g., spaces).
  658|  3.67k|  size_t padding = 0;
  659|  3.67k|  if (length > 0) {
  ------------------
  |  Branch (659:7): [True: 3.66k, False: 12]
  ------------------
  660|  3.66k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (660:9): [True: 285, False: 3.37k]
  ------------------
  661|    285|      padding++;
  662|    285|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (662:11): [True: 279, False: 6]
  |  Branch (662:25): [True: 36, False: 243]
  ------------------
  663|     36|        padding++;
  664|     36|      }
  665|    285|    }
  666|  3.66k|  }
  667|       |  // The input is not otherwise processed for ignorable characters or
  668|       |  // validation, so that the function runs in constant time (very fast). In
  669|       |  // practice, base64 inputs without ignorable characters are common and the
  670|       |  // common case are line separated inputs with relatively long lines (e.g., 76
  671|       |  // characters) which leads this function to a slight (1%) overestimation of
  672|       |  // the output size.
  673|       |  //
  674|       |  // Of course, some inputs might contain an arbitrary number of spaces or
  675|       |  // newlines, which would make this function return a very pessimistic output
  676|       |  // size but systems that produce base64 outputs typically do not do that and
  677|       |  // if they do, they do not care much about minimizing memory usage.
  678|       |  //
  679|       |  // In specialized applications, users may know that their input is line
  680|       |  // separated, which can be checked very quickly by by iterating (e.g., over 76
  681|       |  // character chunks, looking for the linefeed characters only). We could
  682|       |  // provide a specialized function for that, but it is not clear that the added
  683|       |  // complexity is worth it for us.
  684|       |  //
  685|  3.67k|  size_t actual_length = length - padding;
  686|  3.67k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (686:7): [True: 3.12k, False: 555]
  ------------------
  687|  3.12k|    return actual_length / 4 * 3;
  688|  3.12k|  }
  689|       |  // if we have a valid input, then the remainder must be 2 or 3 adding one or
  690|       |  // two extra bytes.
  691|    555|  return actual_length / 4 * 3 + (actual_length % 4) - 1;
  692|  3.67k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIcEEbT_NS_14base64_optionsE:
   28|  17.7k|                                      simdutf::base64_options options) {
   29|  17.7k|  const uint8_t *to_base64 =
   30|  17.7k|      (options & base64_default_or_url)
  ------------------
  |  Branch (30:7): [True: 0, False: 17.7k]
  ------------------
   31|  17.7k|          ? tables::base64::to_base64_default_or_url_value
   32|  17.7k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (32:14): [True: 8.23k, False: 9.50k]
  ------------------
   33|  17.7k|                                    : tables::base64::to_base64_value);
   34|  17.7k|  const bool ignore_garbage =
   35|  17.7k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (35:7): [True: 0, False: 17.7k]
  ------------------
   36|  17.7k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (36:7): [True: 0, False: 17.7k]
  ------------------
   37|  17.7k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (37:7): [True: 0, False: 17.7k]
  ------------------
   38|  17.7k|  uint8_t code = to_base64[uint8_t(c)];
   39|  17.7k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (39:7): [True: 17.7k, False: 0]
  |  Branch (39:27): [True: 2.91k, False: 14.8k]
  ------------------
   40|  2.91k|    return false;
   41|  2.91k|  }
   42|  14.8k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (42:7): [True: 14.8k, False: 0]
  |  Branch (42:27): [True: 14.8k, False: 0]
  ------------------
   43|  14.8k|    return true;
   44|  14.8k|  }
   45|      0|  return ignore_garbage;
   46|  14.8k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIDsEEbT_NS_14base64_optionsE:
   28|  33.4k|                                      simdutf::base64_options options) {
   29|  33.4k|  const uint8_t *to_base64 =
   30|  33.4k|      (options & base64_default_or_url)
  ------------------
  |  Branch (30:7): [True: 0, False: 33.4k]
  ------------------
   31|  33.4k|          ? tables::base64::to_base64_default_or_url_value
   32|  33.4k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (32:14): [True: 14.7k, False: 18.7k]
  ------------------
   33|  33.4k|                                    : tables::base64::to_base64_value);
   34|  33.4k|  const bool ignore_garbage =
   35|  33.4k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (35:7): [True: 0, False: 33.4k]
  ------------------
   36|  33.4k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (36:7): [True: 0, False: 33.4k]
  ------------------
   37|  33.4k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (37:7): [True: 0, False: 33.4k]
  ------------------
   38|  33.4k|  uint8_t code = to_base64[uint8_t(c)];
   39|  33.4k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (39:7): [True: 33.4k, False: 0]
  |  Branch (39:27): [True: 3.18k, False: 30.3k]
  ------------------
   40|  3.18k|    return false;
   41|  3.18k|  }
   42|  30.3k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (42:7): [True: 30.3k, False: 0]
  |  Branch (42:27): [True: 30.3k, False: 0]
  ------------------
   43|  30.3k|    return true;
   44|  30.3k|  }
   45|      0|  return ignore_garbage;
   46|  30.3k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIcEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  100|  7.39k|                                           simdutf::base64_options options) {
  101|  7.39k|  const uint8_t *to_base64 =
  102|  7.39k|      (options & base64_default_or_url)
  ------------------
  |  Branch (102:7): [True: 0, False: 7.39k]
  ------------------
  103|  7.39k|          ? tables::base64::to_base64_default_or_url_value
  104|  7.39k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (104:14): [True: 3.65k, False: 3.73k]
  ------------------
  105|  7.39k|                                    : tables::base64::to_base64_value);
  106|  7.39k|  const bool ignore_garbage =
  107|  7.39k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (107:7): [True: 0, False: 7.39k]
  ------------------
  108|  7.39k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (108:7): [True: 0, False: 7.39k]
  ------------------
  109|  7.39k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (109:7): [True: 0, False: 7.39k]
  ------------------
  110|       |
  111|  7.39k|  size_t equalsigns = 0;
  112|       |  // We intentionally include trailing spaces in the full input length.
  113|       |  // See https://github.com/simdutf/simdutf/issues/824
  114|  7.39k|  size_t full_input_length = srclen;
  115|       |  // skip trailing spaces
  116|  9.62k|  while (!ignore_garbage && srclen > 0 &&
  ------------------
  |  Branch (116:10): [True: 9.62k, False: 0]
  |  Branch (116:29): [True: 9.55k, False: 72]
  ------------------
  117|  9.55k|         scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (117:10): [True: 9.55k, False: 0]
  ------------------
  118|  9.55k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (118:10): [True: 2.23k, False: 7.32k]
  ------------------
  119|  2.23k|    srclen--;
  120|  2.23k|  }
  121|  7.39k|  size_t equallocation =
  122|  7.39k|      srclen; // location of the first padding character if any
  123|  7.39k|  if (ignore_garbage) {
  ------------------
  |  Branch (123:7): [True: 0, False: 7.39k]
  ------------------
  124|       |    // Technically, we don't need to find the first padding character, we can
  125|       |    // just change our algorithms, but it adds substantial complexity.
  126|      0|    auto it = simdutf::find(src, src + srclen, '=');
  127|      0|    if (it != src + srclen) {
  ------------------
  |  Branch (127:9): [True: 0, False: 0]
  ------------------
  128|      0|      equallocation = it - src;
  129|      0|      equalsigns = 1;
  130|      0|      srclen = equallocation;
  131|      0|      full_input_length = equallocation + 1;
  132|      0|    }
  133|      0|    return {equalsigns, equallocation, srclen, full_input_length};
  134|      0|  }
  135|  7.39k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (135:7): [True: 7.39k, False: 0]
  |  Branch (135:26): [True: 7.32k, False: 72]
  |  Branch (135:40): [True: 444, False: 6.87k]
  ------------------
  136|       |    // This is the last '=' sign.
  137|    444|    equallocation = srclen - 1;
  138|    444|    srclen--;
  139|    444|    equalsigns = 1;
  140|       |    // skip trailing spaces
  141|  1.53k|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (141:12): [True: 1.48k, False: 48]
  |  Branch (141:26): [True: 1.48k, False: 0]
  ------------------
  142|  1.48k|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (142:12): [True: 1.08k, False: 396]
  ------------------
  143|  1.08k|      srclen--;
  144|  1.08k|    }
  145|    444|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (145:9): [True: 396, False: 48]
  |  Branch (145:23): [True: 60, False: 336]
  ------------------
  146|       |      // This is the second '=' sign.
  147|     60|      equallocation = srclen - 1;
  148|     60|      srclen--;
  149|     60|      equalsigns = 2;
  150|     60|    }
  151|    444|  }
  152|  7.39k|  return {equalsigns, equallocation, srclen, full_input_length};
  153|  7.39k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6417patch_tail_resultENS_11full_resultEmmmmNS_27last_chunk_handling_optionsE:
  394|  10.6k|                  last_chunk_handling_options last_chunk_options) {
  395|  10.6k|  r.input_count += previous_input;
  396|  10.6k|  r.output_count += previous_output;
  397|  10.6k|  if (r.padding_error) {
  ------------------
  |  Branch (397:7): [True: 294, False: 10.3k]
  ------------------
  398|    294|    r.input_count = equallocation;
  399|    294|  }
  400|       |
  401|  10.6k|  if (r.error == error_code::SUCCESS) {
  ------------------
  |  Branch (401:7): [True: 6.45k, False: 4.16k]
  ------------------
  402|  6.45k|    if (!is_partial(last_chunk_options)) {
  ------------------
  |  Branch (402:9): [True: 2.15k, False: 4.30k]
  ------------------
  403|       |      // A success when we are not in stop_before_partial mode.
  404|       |      // means that we have consumed the whole input buffer.
  405|  2.15k|      r.input_count = full_input_length;
  406|  4.30k|    } else if (r.output_count % 3 != 0) {
  ------------------
  |  Branch (406:16): [True: 30, False: 4.27k]
  ------------------
  407|     30|      r.input_count = full_input_length;
  408|     30|    }
  409|  6.45k|  }
  410|  10.6k|  return r;
  411|  10.6k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIDsEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  100|  7.35k|                                           simdutf::base64_options options) {
  101|  7.35k|  const uint8_t *to_base64 =
  102|  7.35k|      (options & base64_default_or_url)
  ------------------
  |  Branch (102:7): [True: 0, False: 7.35k]
  ------------------
  103|  7.35k|          ? tables::base64::to_base64_default_or_url_value
  104|  7.35k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (104:14): [True: 3.58k, False: 3.76k]
  ------------------
  105|  7.35k|                                    : tables::base64::to_base64_value);
  106|  7.35k|  const bool ignore_garbage =
  107|  7.35k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (107:7): [True: 0, False: 7.35k]
  ------------------
  108|  7.35k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (108:7): [True: 0, False: 7.35k]
  ------------------
  109|  7.35k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (109:7): [True: 0, False: 7.35k]
  ------------------
  110|       |
  111|  7.35k|  size_t equalsigns = 0;
  112|       |  // We intentionally include trailing spaces in the full input length.
  113|       |  // See https://github.com/simdutf/simdutf/issues/824
  114|  7.35k|  size_t full_input_length = srclen;
  115|       |  // skip trailing spaces
  116|  8.83k|  while (!ignore_garbage && srclen > 0 &&
  ------------------
  |  Branch (116:10): [True: 8.83k, False: 0]
  |  Branch (116:29): [True: 8.77k, False: 60]
  ------------------
  117|  8.77k|         scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (117:10): [True: 6.95k, False: 1.81k]
  ------------------
  118|  6.95k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (118:10): [True: 1.48k, False: 5.47k]
  ------------------
  119|  1.48k|    srclen--;
  120|  1.48k|  }
  121|  7.35k|  size_t equallocation =
  122|  7.35k|      srclen; // location of the first padding character if any
  123|  7.35k|  if (ignore_garbage) {
  ------------------
  |  Branch (123:7): [True: 0, False: 7.35k]
  ------------------
  124|       |    // Technically, we don't need to find the first padding character, we can
  125|       |    // just change our algorithms, but it adds substantial complexity.
  126|      0|    auto it = simdutf::find(src, src + srclen, '=');
  127|      0|    if (it != src + srclen) {
  ------------------
  |  Branch (127:9): [True: 0, False: 0]
  ------------------
  128|      0|      equallocation = it - src;
  129|      0|      equalsigns = 1;
  130|      0|      srclen = equallocation;
  131|      0|      full_input_length = equallocation + 1;
  132|      0|    }
  133|      0|    return {equalsigns, equallocation, srclen, full_input_length};
  134|      0|  }
  135|  7.35k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (135:7): [True: 7.35k, False: 0]
  |  Branch (135:26): [True: 7.29k, False: 60]
  |  Branch (135:40): [True: 570, False: 6.72k]
  ------------------
  136|       |    // This is the last '=' sign.
  137|    570|    equallocation = srclen - 1;
  138|    570|    srclen--;
  139|    570|    equalsigns = 1;
  140|       |    // skip trailing spaces
  141|  1.39k|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (141:12): [True: 1.34k, False: 48]
  |  Branch (141:26): [True: 1.12k, False: 216]
  ------------------
  142|  1.12k|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (142:12): [True: 822, False: 306]
  ------------------
  143|    822|      srclen--;
  144|    822|    }
  145|    570|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (145:9): [True: 522, False: 48]
  |  Branch (145:23): [True: 72, False: 450]
  ------------------
  146|       |      // This is the second '=' sign.
  147|     72|      equallocation = srclen - 1;
  148|     72|      srclen--;
  149|     72|      equalsigns = 2;
  150|     72|    }
  151|    570|  }
  152|  7.35k|  return {equalsigns, equallocation, srclen, full_input_length};
  153|  7.35k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIcEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  727|  2.46k|    last_chunk_handling_options last_chunk_options) noexcept {
  728|  2.46k|  const bool ignore_garbage =
  729|  2.46k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (729:7): [True: 0, False: 2.46k]
  ------------------
  730|  2.46k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (730:7): [True: 0, False: 2.46k]
  ------------------
  731|  2.46k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (731:7): [True: 0, False: 2.46k]
  ------------------
  732|  2.46k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  733|  2.46k|  size_t equallocation = ri.equallocation;
  734|  2.46k|  size_t equalsigns = ri.equalsigns;
  735|  2.46k|  length = ri.srclen;
  736|  2.46k|  size_t full_input_length = ri.full_input_length;
  737|  2.46k|  if (length == 0) {
  ------------------
  |  Branch (737:7): [True: 42, False: 2.42k]
  ------------------
  738|     42|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (738:9): [True: 42, False: 0]
  |  Branch (738:28): [True: 18, False: 24]
  ------------------
  739|     18|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
  740|     18|    }
  741|     24|    return {SUCCESS, full_input_length, 0};
  742|     42|  }
  743|  2.42k|  full_result r = scalar::base64::base64_tail_decode(
  744|  2.42k|      output, input, length, equalsigns, options, last_chunk_options);
  745|  2.42k|  r = scalar::base64::patch_tail_result(r, 0, 0, equallocation,
  746|  2.42k|                                        full_input_length, last_chunk_options);
  747|  2.42k|  if (!is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (747:7): [True: 1.39k, False: 1.03k]
  |  Branch (747:42): [True: 674, False: 718]
  ------------------
  748|    674|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (748:7): [True: 6, False: 668]
  |  Branch (748:25): [True: 6, False: 0]
  ------------------
  749|       |    // additional checks
  750|      6|    if ((r.output_count % 3 == 0) ||
  ------------------
  |  Branch (750:9): [True: 0, False: 6]
  ------------------
  751|      6|        ((r.output_count % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (751:9): [True: 0, False: 6]
  ------------------
  752|      0|      return {INVALID_BASE64_CHARACTER, equallocation, r.output_count, true};
  753|      0|    }
  754|      6|  }
  755|       |  // When is_partial(last_chunk_options) is true, we must either end with
  756|       |  // the end of the stream (beyond whitespace) or right after a non-ignorable
  757|       |  // character or at the very beginning of the stream.
  758|       |  // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  759|  2.42k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (759:7): [True: 1.03k, False: 1.39k]
  |  Branch (759:41): [True: 750, False: 280]
  ------------------
  760|    750|      r.input_count < full_input_length) {
  ------------------
  |  Branch (760:7): [True: 554, False: 196]
  ------------------
  761|       |    // First check if we can extend the input to the end of the stream
  762|  4.11k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (762:12): [True: 4.09k, False: 14]
  ------------------
  763|  4.09k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (763:12): [True: 3.55k, False: 540]
  ------------------
  764|  3.55k|      r.input_count++;
  765|  3.55k|    }
  766|       |    // If we are still not at the end of the stream, then we must backtrack
  767|       |    // to the last non-ignorable character.
  768|    554|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (768:9): [True: 540, False: 14]
  ------------------
  769|  3.54k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (769:14): [True: 3.43k, False: 108]
  ------------------
  770|  3.43k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (770:14): [True: 3.00k, False: 432]
  ------------------
  771|  3.00k|        r.input_count--;
  772|  3.00k|      }
  773|    540|    }
  774|    554|  }
  775|  2.42k|  return r;
  776|  2.42k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6418base64_tail_decodeIcEENS_11full_resultEPcPKT_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  371|  5.32k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  372|  5.32k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  373|  5.32k|                                        options, last_chunk_options);
  374|  5.32k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EcEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  164|  5.32k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  165|  5.32k|  char *dstend = dst + outlen;
  166|  5.32k|  (void)dstend;
  167|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  168|       |  // two branches (easily predicted):
  169|  5.32k|  const uint8_t *to_base64 =
  170|  5.32k|      (options & base64_default_or_url)
  ------------------
  |  Branch (170:7): [True: 0, False: 5.32k]
  ------------------
  171|  5.32k|          ? tables::base64::to_base64_default_or_url_value
  172|  5.32k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (172:14): [True: 2.62k, False: 2.70k]
  ------------------
  173|  5.32k|                                    : tables::base64::to_base64_value);
  174|  5.32k|  const uint32_t *d0 =
  175|  5.32k|      (options & base64_default_or_url)
  ------------------
  |  Branch (175:7): [True: 0, False: 5.32k]
  ------------------
  176|  5.32k|          ? tables::base64::base64_default_or_url::d0
  177|  5.32k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (177:14): [True: 2.62k, False: 2.70k]
  ------------------
  178|  5.32k|                                    : tables::base64::base64_default::d0);
  179|  5.32k|  const uint32_t *d1 =
  180|  5.32k|      (options & base64_default_or_url)
  ------------------
  |  Branch (180:7): [True: 0, False: 5.32k]
  ------------------
  181|  5.32k|          ? tables::base64::base64_default_or_url::d1
  182|  5.32k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (182:14): [True: 2.62k, False: 2.70k]
  ------------------
  183|  5.32k|                                    : tables::base64::base64_default::d1);
  184|  5.32k|  const uint32_t *d2 =
  185|  5.32k|      (options & base64_default_or_url)
  ------------------
  |  Branch (185:7): [True: 0, False: 5.32k]
  ------------------
  186|  5.32k|          ? tables::base64::base64_default_or_url::d2
  187|  5.32k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (187:14): [True: 2.62k, False: 2.70k]
  ------------------
  188|  5.32k|                                    : tables::base64::base64_default::d2);
  189|  5.32k|  const uint32_t *d3 =
  190|  5.32k|      (options & base64_default_or_url)
  ------------------
  |  Branch (190:7): [True: 0, False: 5.32k]
  ------------------
  191|  5.32k|          ? tables::base64::base64_default_or_url::d3
  192|  5.32k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (192:14): [True: 2.62k, False: 2.70k]
  ------------------
  193|  5.32k|                                    : tables::base64::base64_default::d3);
  194|  5.32k|  const bool ignore_garbage =
  195|  5.32k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (195:7): [True: 0, False: 5.32k]
  ------------------
  196|  5.32k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (196:7): [True: 0, False: 5.32k]
  ------------------
  197|  5.32k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (197:7): [True: 0, False: 5.32k]
  ------------------
  198|       |
  199|  5.32k|  const char_type *srcend = src + length;
  200|  5.32k|  const char_type *srcinit = src;
  201|  5.32k|  const char *dstinit = dst;
  202|       |
  203|  5.32k|  uint32_t x;
  204|  5.32k|  size_t idx;
  205|  5.32k|  uint8_t buffer[4];
  206|   122k|  while (true) {
  ------------------
  |  Branch (206:10): [True: 122k, Folded]
  ------------------
  207|  7.20M|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (207:12): [True: 7.20M, False: 3.40k]
  |  Branch (207:33): [True: 7.20M, False: 0]
  ------------------
  208|  7.20M|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (208:12): [True: 7.20M, False: 0]
  |  Branch (208:37): [True: 7.20M, False: 0]
  ------------------
  209|  7.20M|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (209:12): [True: 7.20M, False: 0]
  ------------------
  210|  7.20M|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (210:12): [True: 7.08M, False: 119k]
  ------------------
  211|  7.20M|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  212|  7.08M|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (212:11): [Folded, False: 7.08M]
  |  Branch (212:29): [True: 0, False: 0]
  ------------------
  213|      0|        return {OUTPUT_BUFFER_TOO_SMALL, size_t(src - srcinit),
  214|      0|                size_t(dst - dstinit)};
  215|      0|      }
  216|  7.08M|      *dst++ = static_cast<char>(x & 0xFF);
  217|  7.08M|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  218|  7.08M|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  219|  7.08M|      src += 4;
  220|  7.08M|    }
  221|   122k|    const char_type *srccur = src;
  222|   122k|    idx = 0;
  223|       |    // we need at least four characters.
  224|   122k|#ifdef __clang__
  225|       |    // If possible, we read four characters at a time. (It is an optimization.)
  226|   122k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (226:9): [True: 0, False: 122k]
  |  Branch (226:27): [True: 0, False: 0]
  ------------------
  227|      0|      char_type c0 = src[0];
  228|      0|      char_type c1 = src[1];
  229|      0|      char_type c2 = src[2];
  230|      0|      char_type c3 = src[3];
  231|       |
  232|      0|      uint8_t code0 = to_base64[uint8_t(c0)];
  233|      0|      uint8_t code1 = to_base64[uint8_t(c1)];
  234|      0|      uint8_t code2 = to_base64[uint8_t(c2)];
  235|      0|      uint8_t code3 = to_base64[uint8_t(c3)];
  236|       |
  237|      0|      buffer[idx] = code0;
  238|      0|      idx += (is_eight_byte(c0) && code0 <= 63);
  ------------------
  |  Branch (238:15): [True: 0, False: 0]
  |  Branch (238:36): [True: 0, False: 0]
  ------------------
  239|      0|      buffer[idx] = code1;
  240|      0|      idx += (is_eight_byte(c1) && code1 <= 63);
  ------------------
  |  Branch (240:15): [True: 0, False: 0]
  |  Branch (240:36): [True: 0, False: 0]
  ------------------
  241|      0|      buffer[idx] = code2;
  242|      0|      idx += (is_eight_byte(c2) && code2 <= 63);
  ------------------
  |  Branch (242:15): [True: 0, False: 0]
  |  Branch (242:36): [True: 0, False: 0]
  ------------------
  243|      0|      buffer[idx] = code3;
  244|      0|      idx += (is_eight_byte(c3) && code3 <= 63);
  ------------------
  |  Branch (244:15): [True: 0, False: 0]
  |  Branch (244:36): [True: 0, False: 0]
  ------------------
  245|      0|      src += 4;
  246|      0|    }
  247|   122k|#endif
  248|  1.00M|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (248:12): [True: 882k, False: 117k]
  |  Branch (248:25): [True: 878k, False: 4.19k]
  ------------------
  249|   878k|      char_type c = *src;
  250|       |
  251|   878k|      uint8_t code = to_base64[uint8_t(c)];
  252|   878k|      buffer[idx] = uint8_t(code);
  253|   878k|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (253:11): [True: 878k, False: 0]
  |  Branch (253:31): [True: 477k, False: 400k]
  ------------------
  254|   477k|        idx++;
  255|   477k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (255:18): [True: 400k, False: 0]
  ------------------
  256|   400k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (256:19): [True: 1.12k, False: 399k]
  |  Branch (256:32): [True: 0, False: 399k]
  ------------------
  257|  1.12k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  258|  1.12k|                size_t(dst - dstinit)};
  259|   399k|      } else {
  260|       |        // We have a space or a newline or garbage. We ignore it.
  261|   399k|      }
  262|   877k|      src++;
  263|   877k|    }
  264|   121k|    if (idx != 4) {
  ------------------
  |  Branch (264:9): [True: 4.19k, False: 117k]
  ------------------
  265|  4.19k|      simdutf_log_assert(idx < 4, "idx should be less than 4");
  266|       |      // We never should have that the number of base64 characters + the
  267|       |      // number of padding characters is more than 4.
  268|  4.19k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (268:11): [True: 4.19k, False: 0]
  |  Branch (268:30): [True: 6, False: 4.19k]
  ------------------
  269|      6|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  270|      6|                size_t(dst - dstinit), true};
  271|      6|      }
  272|       |
  273|       |      // The idea here is that in loose mode,
  274|       |      // if there is padding at all, it must be used
  275|       |      // to form 4-wise chunk. However, in loose mode,
  276|       |      // we do accept no padding at all.
  277|  4.19k|      if (!ignore_garbage &&
  ------------------
  |  Branch (277:11): [True: 4.19k, False: 0]
  ------------------
  278|  4.19k|          last_chunk_options == last_chunk_handling_options::loose &&
  ------------------
  |  Branch (278:11): [True: 1.82k, False: 2.36k]
  ------------------
  279|  1.82k|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (279:11): [True: 1.01k, False: 814]
  |  Branch (279:25): [True: 12, False: 1.00k]
  ------------------
  280|     12|          ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (280:11): [True: 6, False: 6]
  ------------------
  281|      6|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  282|      6|                size_t(dst - dstinit), true};
  283|      6|      } else
  284|       |
  285|       |        // The idea here is that in strict mode, we do not want to accept
  286|       |        // incomplete base64 chunks. So if the chunk was otherwise valid, we
  287|       |        // return BASE64_INPUT_REMAINDER.
  288|  4.18k|        if (!ignore_garbage &&
  ------------------
  |  Branch (288:13): [True: 4.18k, False: 0]
  ------------------
  289|  4.18k|            last_chunk_options == last_chunk_handling_options::strict &&
  ------------------
  |  Branch (289:13): [True: 260, False: 3.92k]
  ------------------
  290|    260|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (290:13): [True: 144, False: 116]
  |  Branch (290:27): [True: 102, False: 42]
  ------------------
  291|       |          // The partial chunk was at src - idx
  292|    102|          return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  293|    102|                  size_t(dst - dstinit), true};
  294|    102|        } else
  295|       |          // If there is a partial chunk with insufficient padding, with
  296|       |          // stop_before_partial, we need to just ignore it. In "only full"
  297|       |          // mode, skip the minute there are padding characters.
  298|  4.08k|          if ((last_chunk_options ==
  ------------------
  |  Branch (298:16): [True: 2.10k, False: 1.98k]
  ------------------
  299|  4.08k|                   last_chunk_handling_options::stop_before_partial &&
  300|  2.10k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (300:16): [True: 2.08k, False: 18]
  |  Branch (300:50): [True: 1.65k, False: 428]
  ------------------
  301|  1.65k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (301:17): [True: 720, False: 936]
  |  Branch (301:29): [True: 900, False: 36]
  ------------------
  302|  2.46k|              (last_chunk_options ==
  ------------------
  |  Branch (302:16): [True: 0, False: 2.46k]
  ------------------
  303|  2.46k|                   last_chunk_handling_options::only_full_chunks &&
  304|  1.62k|               (idx >= 2 || padding_characters == 0))) {
  ------------------
  |  Branch (304:17): [True: 0, False: 0]
  |  Branch (304:29): [True: 0, False: 0]
  ------------------
  305|       |            // partial means that we are *not* going to consume the read
  306|       |            // characters. We need to rewind the src pointer.
  307|  1.62k|            src = srccur;
  308|  1.62k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  309|  2.46k|          } else {
  310|  2.46k|            if (idx == 2) {
  ------------------
  |  Branch (310:17): [True: 558, False: 1.90k]
  ------------------
  311|    558|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  312|    558|                                (uint32_t(buffer[1]) << 2 * 6);
  313|    558|              if (!ignore_garbage &&
  ------------------
  |  Branch (313:19): [True: 558, False: 0]
  ------------------
  314|    558|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (314:19): [True: 24, False: 534]
  ------------------
  315|     24|                  (triple & 0xffff)) {
  ------------------
  |  Branch (315:19): [True: 18, False: 6]
  ------------------
  316|     18|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  317|     18|                        size_t(dst - dstinit)};
  318|     18|              }
  319|    540|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (319:19): [Folded, False: 540]
  |  Branch (319:37): [True: 0, False: 0]
  ------------------
  320|      0|                return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  321|      0|                        size_t(dst - dstinit)};
  322|      0|              }
  323|    540|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  324|  1.90k|            } else if (idx == 3) {
  ------------------
  |  Branch (324:24): [True: 510, False: 1.39k]
  ------------------
  325|    510|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  326|    510|                                (uint32_t(buffer[1]) << 2 * 6) +
  327|    510|                                (uint32_t(buffer[2]) << 1 * 6);
  328|    510|              if (!ignore_garbage &&
  ------------------
  |  Branch (328:19): [True: 510, False: 0]
  ------------------
  329|    510|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (329:19): [True: 18, False: 492]
  ------------------
  330|     18|                  (triple & 0xff)) {
  ------------------
  |  Branch (330:19): [True: 12, False: 6]
  ------------------
  331|     12|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  332|     12|                        size_t(dst - dstinit)};
  333|     12|              }
  334|    498|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (334:19): [Folded, False: 498]
  |  Branch (334:37): [True: 0, False: 0]
  ------------------
  335|      0|                return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  336|      0|                        size_t(dst - dstinit)};
  337|      0|              }
  338|    498|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  339|    498|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  340|  1.39k|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (340:24): [True: 1.39k, False: 0]
  |  Branch (340:43): [True: 354, False: 1.04k]
  ------------------
  341|    354|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (341:25): [True: 318, False: 36]
  ------------------
  342|     36|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (342:26): [True: 36, False: 0]
  ------------------
  343|    354|                         padding_characters > 0))) {
  ------------------
  |  Branch (343:26): [True: 36, False: 0]
  ------------------
  344|    354|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  345|    354|                      size_t(dst - dstinit)};
  346|  1.04k|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (346:24): [True: 1.04k, False: 0]
  |  Branch (346:43): [True: 1.04k, False: 0]
  |  Branch (346:55): [True: 18, False: 1.02k]
  ------------------
  347|     18|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  348|     18|                      size_t(dst - dstinit), true};
  349|     18|            }
  350|  2.06k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  351|  2.46k|          }
  352|  4.19k|    }
  353|   117k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (353:9): [Folded, False: 117k]
  |  Branch (353:27): [True: 0, False: 0]
  ------------------
  354|      0|      return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  355|      0|              size_t(dst - dstinit)};
  356|      0|    }
  357|   117k|    uint32_t triple =
  358|   117k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  359|   117k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  360|   117k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  361|   117k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  362|   117k|    *dst++ = static_cast<char>(triple & 0xFF);
  363|   117k|  }
  364|  5.32k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIDsEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  727|  2.45k|    last_chunk_handling_options last_chunk_options) noexcept {
  728|  2.45k|  const bool ignore_garbage =
  729|  2.45k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (729:7): [True: 0, False: 2.45k]
  ------------------
  730|  2.45k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (730:7): [True: 0, False: 2.45k]
  ------------------
  731|  2.45k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (731:7): [True: 0, False: 2.45k]
  ------------------
  732|  2.45k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  733|  2.45k|  size_t equallocation = ri.equallocation;
  734|  2.45k|  size_t equalsigns = ri.equalsigns;
  735|  2.45k|  length = ri.srclen;
  736|  2.45k|  size_t full_input_length = ri.full_input_length;
  737|  2.45k|  if (length == 0) {
  ------------------
  |  Branch (737:7): [True: 38, False: 2.41k]
  ------------------
  738|     38|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (738:9): [True: 38, False: 0]
  |  Branch (738:28): [True: 18, False: 20]
  ------------------
  739|     18|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
  740|     18|    }
  741|     20|    return {SUCCESS, full_input_length, 0};
  742|     38|  }
  743|  2.41k|  full_result r = scalar::base64::base64_tail_decode(
  744|  2.41k|      output, input, length, equalsigns, options, last_chunk_options);
  745|  2.41k|  r = scalar::base64::patch_tail_result(r, 0, 0, equallocation,
  746|  2.41k|                                        full_input_length, last_chunk_options);
  747|  2.41k|  if (!is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (747:7): [True: 936, False: 1.47k]
  |  Branch (747:42): [True: 226, False: 710]
  ------------------
  748|    226|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (748:7): [True: 8, False: 218]
  |  Branch (748:25): [True: 8, False: 0]
  ------------------
  749|       |    // additional checks
  750|      8|    if ((r.output_count % 3 == 0) ||
  ------------------
  |  Branch (750:9): [True: 0, False: 8]
  ------------------
  751|      8|        ((r.output_count % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (751:9): [True: 0, False: 8]
  ------------------
  752|      0|      return {INVALID_BASE64_CHARACTER, equallocation, r.output_count, true};
  753|      0|    }
  754|      8|  }
  755|       |  // When is_partial(last_chunk_options) is true, we must either end with
  756|       |  // the end of the stream (beyond whitespace) or right after a non-ignorable
  757|       |  // character or at the very beginning of the stream.
  758|       |  // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  759|  2.41k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (759:7): [True: 1.47k, False: 936]
  |  Branch (759:41): [True: 860, False: 616]
  ------------------
  760|    860|      r.input_count < full_input_length) {
  ------------------
  |  Branch (760:7): [True: 612, False: 248]
  ------------------
  761|       |    // First check if we can extend the input to the end of the stream
  762|  7.88k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (762:12): [True: 7.87k, False: 10]
  ------------------
  763|  7.87k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (763:12): [True: 7.27k, False: 602]
  ------------------
  764|  7.27k|      r.input_count++;
  765|  7.27k|    }
  766|       |    // If we are still not at the end of the stream, then we must backtrack
  767|       |    // to the last non-ignorable character.
  768|    612|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (768:9): [True: 602, False: 10]
  ------------------
  769|  7.61k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (769:14): [True: 7.47k, False: 142]
  ------------------
  770|  7.47k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (770:14): [True: 7.01k, False: 460]
  ------------------
  771|  7.01k|        r.input_count--;
  772|  7.01k|      }
  773|    602|    }
  774|    612|  }
  775|  2.41k|  return r;
  776|  2.41k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6418base64_tail_decodeIDsEENS_11full_resultEPcPKT_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  371|  5.30k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  372|  5.30k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  373|  5.30k|                                        options, last_chunk_options);
  374|  5.30k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EDsEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  164|  5.30k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  165|  5.30k|  char *dstend = dst + outlen;
  166|  5.30k|  (void)dstend;
  167|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  168|       |  // two branches (easily predicted):
  169|  5.30k|  const uint8_t *to_base64 =
  170|  5.30k|      (options & base64_default_or_url)
  ------------------
  |  Branch (170:7): [True: 0, False: 5.30k]
  ------------------
  171|  5.30k|          ? tables::base64::to_base64_default_or_url_value
  172|  5.30k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (172:14): [True: 2.58k, False: 2.71k]
  ------------------
  173|  5.30k|                                    : tables::base64::to_base64_value);
  174|  5.30k|  const uint32_t *d0 =
  175|  5.30k|      (options & base64_default_or_url)
  ------------------
  |  Branch (175:7): [True: 0, False: 5.30k]
  ------------------
  176|  5.30k|          ? tables::base64::base64_default_or_url::d0
  177|  5.30k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (177:14): [True: 2.58k, False: 2.71k]
  ------------------
  178|  5.30k|                                    : tables::base64::base64_default::d0);
  179|  5.30k|  const uint32_t *d1 =
  180|  5.30k|      (options & base64_default_or_url)
  ------------------
  |  Branch (180:7): [True: 0, False: 5.30k]
  ------------------
  181|  5.30k|          ? tables::base64::base64_default_or_url::d1
  182|  5.30k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (182:14): [True: 2.58k, False: 2.71k]
  ------------------
  183|  5.30k|                                    : tables::base64::base64_default::d1);
  184|  5.30k|  const uint32_t *d2 =
  185|  5.30k|      (options & base64_default_or_url)
  ------------------
  |  Branch (185:7): [True: 0, False: 5.30k]
  ------------------
  186|  5.30k|          ? tables::base64::base64_default_or_url::d2
  187|  5.30k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (187:14): [True: 2.58k, False: 2.71k]
  ------------------
  188|  5.30k|                                    : tables::base64::base64_default::d2);
  189|  5.30k|  const uint32_t *d3 =
  190|  5.30k|      (options & base64_default_or_url)
  ------------------
  |  Branch (190:7): [True: 0, False: 5.30k]
  ------------------
  191|  5.30k|          ? tables::base64::base64_default_or_url::d3
  192|  5.30k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (192:14): [True: 2.58k, False: 2.71k]
  ------------------
  193|  5.30k|                                    : tables::base64::base64_default::d3);
  194|  5.30k|  const bool ignore_garbage =
  195|  5.30k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (195:7): [True: 0, False: 5.30k]
  ------------------
  196|  5.30k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (196:7): [True: 0, False: 5.30k]
  ------------------
  197|  5.30k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (197:7): [True: 0, False: 5.30k]
  ------------------
  198|       |
  199|  5.30k|  const char_type *srcend = src + length;
  200|  5.30k|  const char_type *srcinit = src;
  201|  5.30k|  const char *dstinit = dst;
  202|       |
  203|  5.30k|  uint32_t x;
  204|  5.30k|  size_t idx;
  205|  5.30k|  uint8_t buffer[4];
  206|  97.5k|  while (true) {
  ------------------
  |  Branch (206:10): [True: 97.5k, Folded]
  ------------------
  207|  1.48M|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (207:12): [True: 1.48M, False: 2.87k]
  |  Branch (207:33): [True: 1.48M, False: 310]
  ------------------
  208|  1.48M|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (208:12): [True: 1.48M, False: 196]
  |  Branch (208:37): [True: 1.48M, False: 234]
  ------------------
  209|  1.48M|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (209:12): [True: 1.48M, False: 270]
  ------------------
  210|  1.48M|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (210:12): [True: 1.38M, False: 93.6k]
  ------------------
  211|  1.48M|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  212|  1.38M|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (212:11): [Folded, False: 1.38M]
  |  Branch (212:29): [True: 0, False: 0]
  ------------------
  213|      0|        return {OUTPUT_BUFFER_TOO_SMALL, size_t(src - srcinit),
  214|      0|                size_t(dst - dstinit)};
  215|      0|      }
  216|  1.38M|      *dst++ = static_cast<char>(x & 0xFF);
  217|  1.38M|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  218|  1.38M|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  219|  1.38M|      src += 4;
  220|  1.38M|    }
  221|  97.5k|    const char_type *srccur = src;
  222|  97.5k|    idx = 0;
  223|       |    // we need at least four characters.
  224|  97.5k|#ifdef __clang__
  225|       |    // If possible, we read four characters at a time. (It is an optimization.)
  226|  97.5k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (226:9): [True: 0, False: 97.5k]
  |  Branch (226:27): [True: 0, False: 0]
  ------------------
  227|      0|      char_type c0 = src[0];
  228|      0|      char_type c1 = src[1];
  229|      0|      char_type c2 = src[2];
  230|      0|      char_type c3 = src[3];
  231|       |
  232|      0|      uint8_t code0 = to_base64[uint8_t(c0)];
  233|      0|      uint8_t code1 = to_base64[uint8_t(c1)];
  234|      0|      uint8_t code2 = to_base64[uint8_t(c2)];
  235|      0|      uint8_t code3 = to_base64[uint8_t(c3)];
  236|       |
  237|      0|      buffer[idx] = code0;
  238|      0|      idx += (is_eight_byte(c0) && code0 <= 63);
  ------------------
  |  Branch (238:15): [True: 0, False: 0]
  |  Branch (238:36): [True: 0, False: 0]
  ------------------
  239|      0|      buffer[idx] = code1;
  240|      0|      idx += (is_eight_byte(c1) && code1 <= 63);
  ------------------
  |  Branch (240:15): [True: 0, False: 0]
  |  Branch (240:36): [True: 0, False: 0]
  ------------------
  241|      0|      buffer[idx] = code2;
  242|      0|      idx += (is_eight_byte(c2) && code2 <= 63);
  ------------------
  |  Branch (242:15): [True: 0, False: 0]
  |  Branch (242:36): [True: 0, False: 0]
  ------------------
  243|      0|      buffer[idx] = code3;
  244|      0|      idx += (is_eight_byte(c3) && code3 <= 63);
  ------------------
  |  Branch (244:15): [True: 0, False: 0]
  |  Branch (244:36): [True: 0, False: 0]
  ------------------
  245|      0|      src += 4;
  246|      0|    }
  247|  97.5k|#endif
  248|   663k|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (248:12): [True: 571k, False: 92.2k]
  |  Branch (248:25): [True: 568k, False: 3.24k]
  ------------------
  249|   568k|      char_type c = *src;
  250|       |
  251|   568k|      uint8_t code = to_base64[uint8_t(c)];
  252|   568k|      buffer[idx] = uint8_t(code);
  253|   568k|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (253:11): [True: 566k, False: 1.40k]
  |  Branch (253:31): [True: 375k, False: 191k]
  ------------------
  254|   375k|        idx++;
  255|   375k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (255:18): [True: 192k, False: 0]
  ------------------
  256|   192k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (256:19): [True: 1.39k, False: 191k]
  |  Branch (256:32): [True: 666, False: 190k]
  ------------------
  257|  2.06k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  258|  2.06k|                size_t(dst - dstinit)};
  259|   190k|      } else {
  260|       |        // We have a space or a newline or garbage. We ignore it.
  261|   190k|      }
  262|   566k|      src++;
  263|   566k|    }
  264|  95.4k|    if (idx != 4) {
  ------------------
  |  Branch (264:9): [True: 3.24k, False: 92.2k]
  ------------------
  265|  3.24k|      simdutf_log_assert(idx < 4, "idx should be less than 4");
  266|       |      // We never should have that the number of base64 characters + the
  267|       |      // number of padding characters is more than 4.
  268|  3.24k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (268:11): [True: 3.24k, False: 0]
  |  Branch (268:30): [True: 6, False: 3.23k]
  ------------------
  269|      6|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  270|      6|                size_t(dst - dstinit), true};
  271|      6|      }
  272|       |
  273|       |      // The idea here is that in loose mode,
  274|       |      // if there is padding at all, it must be used
  275|       |      // to form 4-wise chunk. However, in loose mode,
  276|       |      // we do accept no padding at all.
  277|  3.23k|      if (!ignore_garbage &&
  ------------------
  |  Branch (277:11): [True: 3.23k, False: 0]
  ------------------
  278|  3.23k|          last_chunk_options == last_chunk_handling_options::loose &&
  ------------------
  |  Branch (278:11): [True: 610, False: 2.62k]
  ------------------
  279|    610|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (279:11): [True: 354, False: 256]
  |  Branch (279:25): [True: 12, False: 342]
  ------------------
  280|     12|          ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (280:11): [True: 6, False: 6]
  ------------------
  281|      6|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  282|      6|                size_t(dst - dstinit), true};
  283|      6|      } else
  284|       |
  285|       |        // The idea here is that in strict mode, we do not want to accept
  286|       |        // incomplete base64 chunks. So if the chunk was otherwise valid, we
  287|       |        // return BASE64_INPUT_REMAINDER.
  288|  3.22k|        if (!ignore_garbage &&
  ------------------
  |  Branch (288:13): [True: 3.22k, False: 0]
  ------------------
  289|  3.22k|            last_chunk_options == last_chunk_handling_options::strict &&
  ------------------
  |  Branch (289:13): [True: 346, False: 2.88k]
  ------------------
  290|    346|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (290:13): [True: 186, False: 160]
  |  Branch (290:27): [True: 132, False: 54]
  ------------------
  291|       |          // The partial chunk was at src - idx
  292|    132|          return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  293|    132|                  size_t(dst - dstinit), true};
  294|    132|        } else
  295|       |          // If there is a partial chunk with insufficient padding, with
  296|       |          // stop_before_partial, we need to just ignore it. In "only full"
  297|       |          // mode, skip the minute there are padding characters.
  298|  3.09k|          if ((last_chunk_options ==
  ------------------
  |  Branch (298:16): [True: 2.27k, False: 818]
  ------------------
  299|  3.09k|                   last_chunk_handling_options::stop_before_partial &&
  300|  2.27k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (300:16): [True: 2.26k, False: 12]
  |  Branch (300:50): [True: 1.83k, False: 436]
  ------------------
  301|  1.83k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (301:17): [True: 912, False: 918]
  |  Branch (301:29): [True: 894, False: 24]
  ------------------
  302|  1.29k|              (last_chunk_options ==
  ------------------
  |  Branch (302:16): [True: 0, False: 1.29k]
  ------------------
  303|  1.29k|                   last_chunk_handling_options::only_full_chunks &&
  304|  1.80k|               (idx >= 2 || padding_characters == 0))) {
  ------------------
  |  Branch (304:17): [True: 0, False: 0]
  |  Branch (304:29): [True: 0, False: 0]
  ------------------
  305|       |            // partial means that we are *not* going to consume the read
  306|       |            // characters. We need to rewind the src pointer.
  307|  1.80k|            src = srccur;
  308|  1.80k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  309|  1.80k|          } else {
  310|  1.29k|            if (idx == 2) {
  ------------------
  |  Branch (310:17): [True: 240, False: 1.05k]
  ------------------
  311|    240|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  312|    240|                                (uint32_t(buffer[1]) << 2 * 6);
  313|    240|              if (!ignore_garbage &&
  ------------------
  |  Branch (313:19): [True: 240, False: 0]
  ------------------
  314|    240|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (314:19): [True: 36, False: 204]
  ------------------
  315|     36|                  (triple & 0xffff)) {
  ------------------
  |  Branch (315:19): [True: 24, False: 12]
  ------------------
  316|     24|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  317|     24|                        size_t(dst - dstinit)};
  318|     24|              }
  319|    216|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (319:19): [Folded, False: 216]
  |  Branch (319:37): [True: 0, False: 0]
  ------------------
  320|      0|                return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  321|      0|                        size_t(dst - dstinit)};
  322|      0|              }
  323|    216|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  324|  1.05k|            } else if (idx == 3) {
  ------------------
  |  Branch (324:24): [True: 174, False: 876]
  ------------------
  325|    174|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  326|    174|                                (uint32_t(buffer[1]) << 2 * 6) +
  327|    174|                                (uint32_t(buffer[2]) << 1 * 6);
  328|    174|              if (!ignore_garbage &&
  ------------------
  |  Branch (328:19): [True: 174, False: 0]
  ------------------
  329|    174|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (329:19): [True: 18, False: 156]
  ------------------
  330|     18|                  (triple & 0xff)) {
  ------------------
  |  Branch (330:19): [True: 12, False: 6]
  ------------------
  331|     12|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  332|     12|                        size_t(dst - dstinit)};
  333|     12|              }
  334|    162|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (334:19): [Folded, False: 162]
  |  Branch (334:37): [True: 0, False: 0]
  ------------------
  335|      0|                return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  336|      0|                        size_t(dst - dstinit)};
  337|      0|              }
  338|    162|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  339|    162|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  340|    876|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (340:24): [True: 876, False: 0]
  |  Branch (340:43): [True: 264, False: 612]
  ------------------
  341|    264|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (341:25): [True: 240, False: 24]
  ------------------
  342|     24|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (342:26): [True: 24, False: 0]
  ------------------
  343|    264|                         padding_characters > 0))) {
  ------------------
  |  Branch (343:26): [True: 24, False: 0]
  ------------------
  344|    264|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  345|    264|                      size_t(dst - dstinit)};
  346|    612|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (346:24): [True: 612, False: 0]
  |  Branch (346:43): [True: 612, False: 0]
  |  Branch (346:55): [True: 18, False: 594]
  ------------------
  347|     18|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  348|     18|                      size_t(dst - dstinit), true};
  349|     18|            }
  350|    972|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  351|  1.29k|          }
  352|  3.23k|    }
  353|  92.2k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (353:9): [Folded, False: 92.2k]
  |  Branch (353:27): [True: 0, False: 0]
  ------------------
  354|      0|      return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  355|      0|              size_t(dst - dstinit)};
  356|      0|    }
  357|  92.2k|    uint32_t triple =
  358|  92.2k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  359|  92.2k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  360|  92.2k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  361|  92.2k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  362|  92.2k|    *dst++ = static_cast<char>(triple & 0xFF);
  363|  92.2k|  }
  364|  5.30k|}

_ZN7simdutf6scalar14u32_swap_bytesEj:
   13|  27.6k|u32_swap_bytes(const uint32_t word) {
   14|  27.6k|  return ((word >> 24) & 0xff) |      // move byte 3 to byte 0
   15|  27.6k|         ((word << 8) & 0xff0000) |   // move byte 1 to byte 2
   16|  27.6k|         ((word >> 8) & 0xff00) |     // move byte 2 to byte 1
   17|  27.6k|         ((word << 24) & 0xff000000); // byte 0 to byte 3
   18|  27.6k|}

_ZNK7simdutf8fallback14implementation16base64_to_binaryEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  536|  1.23k|    last_chunk_handling_options last_chunk_options) const noexcept {
  537|  1.23k|  return simdutf::scalar::base64::base64_to_binary_details_impl(
  538|  1.23k|      input, length, output, options, last_chunk_options);
  539|  1.23k|}
_ZNK7simdutf8fallback14implementation16base64_to_binaryEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  543|  1.22k|    last_chunk_handling_options last_chunk_options) const noexcept {
  544|  1.22k|  return simdutf::scalar::base64::base64_to_binary_details_impl(
  545|  1.22k|      input, length, output, options, last_chunk_options);
  546|  1.22k|}
_ZNK7simdutf8fallback14implementation24base64_to_binary_detailsEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  550|  1.23k|    last_chunk_handling_options last_chunk_options) const noexcept {
  551|  1.23k|  return simdutf::scalar::base64::base64_to_binary_details_impl(
  552|  1.23k|      input, length, output, options, last_chunk_options);
  553|  1.23k|}
_ZNK7simdutf8fallback14implementation24base64_to_binary_detailsEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  557|  1.22k|    last_chunk_handling_options last_chunk_options) const noexcept {
  558|  1.22k|  return simdutf::scalar::base64::base64_to_binary_details_impl(
  559|  1.22k|      input, length, output, options, last_chunk_options);
  560|  1.22k|}

simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.21k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.21k|  const uint8_t *to_base64 =
   47|  1.21k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.21k]
  ------------------
   48|  1.21k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.21k, Folded]
  ------------------
   49|  1.21k|                                   : tables::base64::to_base64_value);
   50|  1.21k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.21k|  size_t equallocation = ri.equallocation;
   52|  1.21k|  size_t equalsigns = ri.equalsigns;
   53|  1.21k|  srclen = ri.srclen;
   54|  1.21k|  size_t full_input_length = ri.full_input_length;
   55|  1.21k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 12, False: 1.20k]
  ------------------
   56|     12|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 12, Folded]
  |  Branch (56:28): [True: 6, False: 6]
  ------------------
   57|      6|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      6|    }
   59|      6|    return {SUCCESS, full_input_length, 0};
   60|     12|  }
   61|  1.20k|  char *end_of_safe_64byte_zone =
   62|  1.20k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 40, False: 1.16k]
  ------------------
   63|  1.20k|          ? nullptr
   64|  1.20k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 400, False: 766]
  ------------------
   65|  1.16k|                                        : dst);
   66|       |
   67|  1.20k|  const chartype *const srcinit = src;
   68|  1.20k|  const char *const dstinit = dst;
   69|  1.20k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.20k|  constexpr size_t block_size = 6;
   72|  1.20k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.20k|  char buffer[block_size * 64];
   74|  1.20k|  char *bufferptr = buffer;
   75|  1.20k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 960, False: 246]
  ------------------
   76|    960|    const chartype *const srcend64 = src + srclen - 64;
   77|  91.2k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 90.6k, False: 610]
  ------------------
   78|  90.6k|      block64 b(src);
   79|  90.6k|      src += 64;
   80|  90.6k|      uint64_t error = 0;
   81|  90.6k|      const uint64_t badcharmask =
   82|  90.6k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  90.6k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 90.6k, Folded]
  |  Branch (83:30): [True: 350, False: 90.3k]
  ------------------
   84|    350|        src -= 64;
   85|    350|        const size_t error_offset = trailing_zeroes(error);
   86|    350|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    350|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    350|      }
   89|  90.3k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 29.9k, False: 60.3k]
  ------------------
   90|  29.9k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  60.3k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 18.3k, False: 41.9k]
  ------------------
   92|  18.3k|        b.copy_block(bufferptr);
   93|  18.3k|        bufferptr += 64;
   94|  41.9k|      } else {
   95|  41.9k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 8, False: 41.9k]
  ------------------
   96|      8|          b.base64_decode_block_safe(dst);
   97|  41.9k|        } else {
   98|  41.9k|          b.base64_decode_block(dst);
   99|  41.9k|        }
  100|  41.9k|        dst += 48;
  101|  41.9k|      }
  102|  90.3k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 9.10k, False: 81.2k]
  ------------------
  103|  45.5k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 36.4k, False: 9.10k]
  ------------------
  104|  36.4k|          base64_decode_block(dst, buffer + i * 64);
  105|  36.4k|          dst += 48;
  106|  36.4k|        }
  107|  9.10k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 9.10k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  9.10k|        } else {
  110|  9.10k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  9.10k|        }
  112|  9.10k|        dst += 48;
  113|  9.10k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  9.10k|                    64); // 64 might be too much
  115|  9.10k|        bufferptr -= (block_size - 1) * 64;
  116|  9.10k|      }
  117|  90.3k|    }
  118|    960|  }
  119|       |
  120|    856|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    856|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    856|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 550, False: 306]
  |  Branch (124:26): [True: 90, False: 460]
  ------------------
  125|       |
  126|  1.19k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.12k, False: 72]
  |  Branch (126:52): [True: 1.11k, False: 12]
  ------------------
  127|  1.11k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.11k|      *bufferptr = char(val);
  129|  1.11k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.11k, Folded]
  ------------------
  130|  1.11k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.11k]
  |  Branch (130:52): [True: 6, False: 1.10k]
  ------------------
  131|      6|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      6|                size_t(dst - dstinit)};
  133|      6|      }
  134|  1.10k|      bufferptr += (val <= 63);
  135|  1.10k|      src++;
  136|  1.10k|    }
  137|     90|  }
  138|       |
  139|  1.32k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 472, False: 850]
  ------------------
  140|    472|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 34, False: 438]
  ------------------
  141|     34|      base64_decode_block_safe(dst, buffer_start);
  142|    438|    } else {
  143|    438|      base64_decode_block(dst, buffer_start);
  144|    438|    }
  145|    472|    dst += 48;
  146|    472|  }
  147|    850|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 472, False: 378]
  ------------------
  148|  3.85k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.37k, False: 472]
  ------------------
  149|  3.37k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.37k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.37k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.37k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.37k|                        << 8;
  154|  3.37k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.37k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.37k|#endif
  157|  3.37k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.37k|      dst += 3;
  160|  3.37k|      buffer_start += 4;
  161|  3.37k|    }
  162|    472|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 122, False: 350]
  ------------------
  163|    122|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    122|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    122|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    122|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    122|                        << 8;
  168|    122|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    122|      triple = scalar::u32_swap_bytes(triple);
  170|    122|#endif
  171|    122|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    122|      dst += 3;
  174|    122|      buffer_start += 4;
  175|    122|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    472|    int leftover = int(bufferptr - buffer_start);
  179|  1.19k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 720, False: 472]
  ------------------
  180|    720|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 720, Folded]
  ------------------
  181|  5.17k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.45k, False: 720]
  ------------------
  182|  4.45k|          src--;
  183|  4.45k|        }
  184|    720|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    720|      src--;
  190|    720|      leftover--;
  191|    720|    }
  192|    472|  }
  193|    850|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 708, False: 142]
  ------------------
  194|    708|    full_result r = scalar::base64::base64_tail_decode(
  195|    708|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    708|    r = scalar::base64::patch_tail_result(
  197|    708|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    708|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    708|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 318, False: 390]
  |  Branch (203:43): [True: 290, False: 28]
  ------------------
  204|    290|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 258, False: 32]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    638|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 634, False: 4]
  ------------------
  207|    634|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 380, False: 254]
  ------------------
  208|    380|        r.input_count++;
  209|    380|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    258|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 254, False: 4]
  ------------------
  213|  1.75k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.69k, False: 56]
  ------------------
  214|  1.69k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.49k, False: 198]
  ------------------
  215|  1.49k|          r.input_count--;
  216|  1.49k|        }
  217|    254|      }
  218|    258|    }
  219|    708|    return r;
  220|    708|  }
  221|    142|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 142, Folded]
  |  Branch (221:26): [True: 0, False: 142]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    142|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    142|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.24k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.24k|  const uint8_t *to_base64 =
   47|  1.24k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.24k]
  ------------------
   48|  1.24k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.24k]
  ------------------
   49|  1.24k|                                   : tables::base64::to_base64_value);
   50|  1.24k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.24k|  size_t equallocation = ri.equallocation;
   52|  1.24k|  size_t equalsigns = ri.equalsigns;
   53|  1.24k|  srclen = ri.srclen;
   54|  1.24k|  size_t full_input_length = ri.full_input_length;
   55|  1.24k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 30, False: 1.21k]
  ------------------
   56|     30|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 30, Folded]
  |  Branch (56:28): [True: 12, False: 18]
  ------------------
   57|     12|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     12|    }
   59|     18|    return {SUCCESS, full_input_length, 0};
   60|     30|  }
   61|  1.21k|  char *end_of_safe_64byte_zone =
   62|  1.21k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 50, False: 1.16k]
  ------------------
   63|  1.21k|          ? nullptr
   64|  1.21k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 382, False: 784]
  ------------------
   65|  1.16k|                                        : dst);
   66|       |
   67|  1.21k|  const chartype *const srcinit = src;
   68|  1.21k|  const char *const dstinit = dst;
   69|  1.21k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.21k|  constexpr size_t block_size = 6;
   72|  1.21k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.21k|  char buffer[block_size * 64];
   74|  1.21k|  char *bufferptr = buffer;
   75|  1.21k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 934, False: 282]
  ------------------
   76|    934|    const chartype *const srcend64 = src + srclen - 64;
   77|   366k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 365k, False: 622]
  ------------------
   78|   365k|      block64 b(src);
   79|   365k|      src += 64;
   80|   365k|      uint64_t error = 0;
   81|   365k|      const uint64_t badcharmask =
   82|   365k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   365k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 365k, Folded]
  |  Branch (83:30): [True: 312, False: 365k]
  ------------------
   84|    312|        src -= 64;
   85|    312|        const size_t error_offset = trailing_zeroes(error);
   86|    312|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    312|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    312|      }
   89|   365k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 63.9k, False: 301k]
  ------------------
   90|  63.9k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   301k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 228k, False: 73.1k]
  ------------------
   92|   228k|        b.copy_block(bufferptr);
   93|   228k|        bufferptr += 64;
   94|   228k|      } else {
   95|  73.1k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 73.1k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|  73.1k|        } else {
   98|  73.1k|          b.base64_decode_block(dst);
   99|  73.1k|        }
  100|  73.1k|        dst += 48;
  101|  73.1k|      }
  102|   365k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 57.4k, False: 307k]
  ------------------
  103|   287k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 229k, False: 57.4k]
  ------------------
  104|   229k|          base64_decode_block(dst, buffer + i * 64);
  105|   229k|          dst += 48;
  106|   229k|        }
  107|  57.4k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 57.4k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  57.4k|        } else {
  110|  57.4k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  57.4k|        }
  112|  57.4k|        dst += 48;
  113|  57.4k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  57.4k|                    64); // 64 might be too much
  115|  57.4k|        bufferptr -= (block_size - 1) * 64;
  116|  57.4k|      }
  117|   365k|    }
  118|    934|  }
  119|       |
  120|    904|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    904|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    904|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 572, False: 332]
  |  Branch (124:26): [True: 100, False: 472]
  ------------------
  125|       |
  126|  1.45k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.38k, False: 74]
  |  Branch (126:52): [True: 1.36k, False: 18]
  ------------------
  127|  1.36k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.36k|      *bufferptr = char(val);
  129|  1.36k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.36k, Folded]
  ------------------
  130|  1.36k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.36k]
  |  Branch (130:52): [True: 8, False: 1.35k]
  ------------------
  131|      8|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      8|                size_t(dst - dstinit)};
  133|      8|      }
  134|  1.35k|      bufferptr += (val <= 63);
  135|  1.35k|      src++;
  136|  1.35k|    }
  137|    100|  }
  138|       |
  139|  1.36k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 466, False: 896]
  ------------------
  140|    466|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 36, False: 430]
  ------------------
  141|     36|      base64_decode_block_safe(dst, buffer_start);
  142|    430|    } else {
  143|    430|      base64_decode_block(dst, buffer_start);
  144|    430|    }
  145|    466|    dst += 48;
  146|    466|  }
  147|    896|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 490, False: 406]
  ------------------
  148|  4.16k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.67k, False: 490]
  ------------------
  149|  3.67k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.67k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.67k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.67k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.67k|                        << 8;
  154|  3.67k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.67k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.67k|#endif
  157|  3.67k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.67k|      dst += 3;
  160|  3.67k|      buffer_start += 4;
  161|  3.67k|    }
  162|    490|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 122, False: 368]
  ------------------
  163|    122|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    122|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    122|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    122|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    122|                        << 8;
  168|    122|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    122|      triple = scalar::u32_swap_bytes(triple);
  170|    122|#endif
  171|    122|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    122|      dst += 3;
  174|    122|      buffer_start += 4;
  175|    122|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    490|    int leftover = int(bufferptr - buffer_start);
  179|  1.20k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 716, False: 490]
  ------------------
  180|    716|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 716, Folded]
  ------------------
  181|  6.24k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 5.52k, False: 716]
  ------------------
  182|  5.52k|          src--;
  183|  5.52k|        }
  184|    716|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    716|      src--;
  190|    716|      leftover--;
  191|    716|    }
  192|    490|  }
  193|    896|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 742, False: 154]
  ------------------
  194|    742|    full_result r = scalar::base64::base64_tail_decode(
  195|    742|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    742|    r = scalar::base64::patch_tail_result(
  197|    742|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    742|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    742|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 384, False: 358]
  |  Branch (203:43): [True: 362, False: 22]
  ------------------
  204|    362|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 296, False: 66]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|  1.04k|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 1.03k, False: 10]
  ------------------
  207|  1.03k|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 750, False: 286]
  ------------------
  208|    750|        r.input_count++;
  209|    750|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    296|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 286, False: 10]
  ------------------
  213|  1.79k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.73k, False: 52]
  ------------------
  214|  1.73k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.50k, False: 234]
  ------------------
  215|  1.50k|          r.input_count--;
  216|  1.50k|        }
  217|    286|      }
  218|    296|    }
  219|    742|    return r;
  220|    742|  }
  221|    154|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 154, Folded]
  |  Branch (221:26): [True: 0, False: 154]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    154|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    154|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.19k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.19k|  const uint8_t *to_base64 =
   47|  1.19k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.19k]
  ------------------
   48|  1.19k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.19k, Folded]
  ------------------
   49|  1.19k|                                   : tables::base64::to_base64_value);
   50|  1.19k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.19k|  size_t equallocation = ri.equallocation;
   52|  1.19k|  size_t equalsigns = ri.equalsigns;
   53|  1.19k|  srclen = ri.srclen;
   54|  1.19k|  size_t full_input_length = ri.full_input_length;
   55|  1.19k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 18, False: 1.17k]
  ------------------
   56|     18|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 18, Folded]
  |  Branch (56:28): [True: 6, False: 12]
  ------------------
   57|      6|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      6|    }
   59|     12|    return {SUCCESS, full_input_length, 0};
   60|     18|  }
   61|  1.17k|  char *end_of_safe_64byte_zone =
   62|  1.17k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 74, False: 1.10k]
  ------------------
   63|  1.17k|          ? nullptr
   64|  1.17k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 352, False: 752]
  ------------------
   65|  1.10k|                                        : dst);
   66|       |
   67|  1.17k|  const chartype *const srcinit = src;
   68|  1.17k|  const char *const dstinit = dst;
   69|  1.17k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.17k|  constexpr size_t block_size = 6;
   72|  1.17k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.17k|  char buffer[block_size * 64];
   74|  1.17k|  char *bufferptr = buffer;
   75|  1.17k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 886, False: 292]
  ------------------
   76|    886|    const chartype *const srcend64 = src + srclen - 64;
   77|  25.3k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 24.7k, False: 580]
  ------------------
   78|  24.7k|      block64 b(src);
   79|  24.7k|      src += 64;
   80|  24.7k|      uint64_t error = 0;
   81|  24.7k|      const uint64_t badcharmask =
   82|  24.7k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  24.7k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 24.7k, Folded]
  |  Branch (83:30): [True: 306, False: 24.4k]
  ------------------
   84|    306|        src -= 64;
   85|    306|        const size_t error_offset = trailing_zeroes(error);
   86|    306|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    306|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    306|      }
   89|  24.4k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 19.8k, False: 4.63k]
  ------------------
   90|  19.8k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  19.8k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 4.15k, False: 482]
  ------------------
   92|  4.15k|        b.copy_block(bufferptr);
   93|  4.15k|        bufferptr += 64;
   94|  4.15k|      } else {
   95|    482|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 12, False: 470]
  ------------------
   96|     12|          b.base64_decode_block_safe(dst);
   97|    470|        } else {
   98|    470|          b.base64_decode_block(dst);
   99|    470|        }
  100|    482|        dst += 48;
  101|    482|      }
  102|  24.4k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 4.44k, False: 19.9k]
  ------------------
  103|  22.2k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 17.7k, False: 4.44k]
  ------------------
  104|  17.7k|          base64_decode_block(dst, buffer + i * 64);
  105|  17.7k|          dst += 48;
  106|  17.7k|        }
  107|  4.44k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 4.44k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  4.44k|        } else {
  110|  4.44k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  4.44k|        }
  112|  4.44k|        dst += 48;
  113|  4.44k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  4.44k|                    64); // 64 might be too much
  115|  4.44k|        bufferptr -= (block_size - 1) * 64;
  116|  4.44k|      }
  117|  24.4k|    }
  118|    886|  }
  119|       |
  120|    872|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    872|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    872|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 530, False: 342]
  |  Branch (124:26): [True: 122, False: 408]
  ------------------
  125|       |
  126|  1.10k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.04k, False: 56]
  |  Branch (126:52): [True: 1.02k, False: 20]
  ------------------
  127|  1.02k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.02k|      *bufferptr = char(val);
  129|  1.02k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.02k, Folded]
  ------------------
  130|  1.02k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 30, False: 996]
  |  Branch (130:52): [True: 16, False: 980]
  ------------------
  131|     46|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     46|                size_t(dst - dstinit)};
  133|     46|      }
  134|    980|      bufferptr += (val <= 63);
  135|    980|      src++;
  136|    980|    }
  137|    122|  }
  138|       |
  139|  1.17k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 344, False: 826]
  ------------------
  140|    344|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 32, False: 312]
  ------------------
  141|     32|      base64_decode_block_safe(dst, buffer_start);
  142|    312|    } else {
  143|    312|      base64_decode_block(dst, buffer_start);
  144|    312|    }
  145|    344|    dst += 48;
  146|    344|  }
  147|    826|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 428, False: 398]
  ------------------
  148|  3.50k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.07k, False: 428]
  ------------------
  149|  3.07k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.07k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.07k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.07k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.07k|                        << 8;
  154|  3.07k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.07k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.07k|#endif
  157|  3.07k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.07k|      dst += 3;
  160|  3.07k|      buffer_start += 4;
  161|  3.07k|    }
  162|    428|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 110, False: 318]
  ------------------
  163|    110|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    110|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    110|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    110|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    110|                        << 8;
  168|    110|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    110|      triple = scalar::u32_swap_bytes(triple);
  170|    110|#endif
  171|    110|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    110|      dst += 3;
  174|    110|      buffer_start += 4;
  175|    110|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    428|    int leftover = int(bufferptr - buffer_start);
  179|  1.07k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 644, False: 428]
  ------------------
  180|    644|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 644, Folded]
  ------------------
  181|  7.68k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 7.03k, False: 644]
  ------------------
  182|  7.03k|          src--;
  183|  7.03k|        }
  184|    644|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    644|      src--;
  190|    644|      leftover--;
  191|    644|    }
  192|    428|  }
  193|    826|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 704, False: 122]
  ------------------
  194|    704|    full_result r = scalar::base64::base64_tail_decode(
  195|    704|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    704|    r = scalar::base64::patch_tail_result(
  197|    704|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    704|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    704|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 450, False: 254]
  |  Branch (203:43): [True: 368, False: 82]
  ------------------
  204|    368|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 326, False: 42]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    920|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 916, False: 4]
  ------------------
  207|    916|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 594, False: 322]
  ------------------
  208|    594|        r.input_count++;
  209|    594|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    326|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 322, False: 4]
  ------------------
  213|  3.26k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 3.17k, False: 82]
  ------------------
  214|  3.17k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.93k, False: 240]
  ------------------
  215|  2.93k|          r.input_count--;
  216|  2.93k|        }
  217|    322|      }
  218|    326|    }
  219|    704|    return r;
  220|    704|  }
  221|    122|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 122, Folded]
  |  Branch (221:26): [True: 0, False: 122]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    122|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    122|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.25k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.25k|  const uint8_t *to_base64 =
   47|  1.25k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.25k]
  ------------------
   48|  1.25k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.25k]
  ------------------
   49|  1.25k|                                   : tables::base64::to_base64_value);
   50|  1.25k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.25k|  size_t equallocation = ri.equallocation;
   52|  1.25k|  size_t equalsigns = ri.equalsigns;
   53|  1.25k|  srclen = ri.srclen;
   54|  1.25k|  size_t full_input_length = ri.full_input_length;
   55|  1.25k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 20, False: 1.23k]
  ------------------
   56|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 20, Folded]
  |  Branch (56:28): [True: 12, False: 8]
  ------------------
   57|     12|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     12|    }
   59|      8|    return {SUCCESS, full_input_length, 0};
   60|     20|  }
   61|  1.23k|  char *end_of_safe_64byte_zone =
   62|  1.23k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 100, False: 1.13k]
  ------------------
   63|  1.23k|          ? nullptr
   64|  1.23k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 360, False: 774]
  ------------------
   65|  1.13k|                                        : dst);
   66|       |
   67|  1.23k|  const chartype *const srcinit = src;
   68|  1.23k|  const char *const dstinit = dst;
   69|  1.23k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.23k|  constexpr size_t block_size = 6;
   72|  1.23k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.23k|  char buffer[block_size * 64];
   74|  1.23k|  char *bufferptr = buffer;
   75|  1.23k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 912, False: 322]
  ------------------
   76|    912|    const chartype *const srcend64 = src + srclen - 64;
   77|  71.2k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 70.6k, False: 576]
  ------------------
   78|  70.6k|      block64 b(src);
   79|  70.6k|      src += 64;
   80|  70.6k|      uint64_t error = 0;
   81|  70.6k|      const uint64_t badcharmask =
   82|  70.6k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  70.6k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 70.6k, Folded]
  |  Branch (83:30): [True: 336, False: 70.3k]
  ------------------
   84|    336|        src -= 64;
   85|    336|        const size_t error_offset = trailing_zeroes(error);
   86|    336|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    336|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    336|      }
   89|  70.3k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 55.7k, False: 14.5k]
  ------------------
   90|  55.7k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  55.7k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 14.2k, False: 296]
  ------------------
   92|  14.2k|        b.copy_block(bufferptr);
   93|  14.2k|        bufferptr += 64;
   94|  14.2k|      } else {
   95|    296|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 2, False: 294]
  ------------------
   96|      2|          b.base64_decode_block_safe(dst);
   97|    294|        } else {
   98|    294|          b.base64_decode_block(dst);
   99|    294|        }
  100|    296|        dst += 48;
  101|    296|      }
  102|  70.3k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 13.5k, False: 56.7k]
  ------------------
  103|  67.7k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 54.2k, False: 13.5k]
  ------------------
  104|  54.2k|          base64_decode_block(dst, buffer + i * 64);
  105|  54.2k|          dst += 48;
  106|  54.2k|        }
  107|  13.5k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 13.5k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  13.5k|        } else {
  110|  13.5k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  13.5k|        }
  112|  13.5k|        dst += 48;
  113|  13.5k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  13.5k|                    64); // 64 might be too much
  115|  13.5k|        bufferptr -= (block_size - 1) * 64;
  116|  13.5k|      }
  117|  70.3k|    }
  118|    912|  }
  119|       |
  120|    898|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    898|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    898|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 552, False: 346]
  |  Branch (124:26): [True: 112, False: 440]
  ------------------
  125|       |
  126|  1.07k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.01k, False: 60]
  |  Branch (126:52): [True: 996, False: 14]
  ------------------
  127|    996|      uint8_t val = to_base64[uint8_t(*src)];
  128|    996|      *bufferptr = char(val);
  129|    996|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 996, Folded]
  ------------------
  130|    996|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 20, False: 976]
  |  Branch (130:52): [True: 18, False: 958]
  ------------------
  131|     38|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     38|                size_t(dst - dstinit)};
  133|     38|      }
  134|    958|      bufferptr += (val <= 63);
  135|    958|      src++;
  136|    958|    }
  137|    112|  }
  138|       |
  139|  1.28k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 426, False: 860]
  ------------------
  140|    426|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 28, False: 398]
  ------------------
  141|     28|      base64_decode_block_safe(dst, buffer_start);
  142|    398|    } else {
  143|    398|      base64_decode_block(dst, buffer_start);
  144|    398|    }
  145|    426|    dst += 48;
  146|    426|  }
  147|    860|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 454, False: 406]
  ------------------
  148|  3.68k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.22k, False: 454]
  ------------------
  149|  3.22k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.22k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.22k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.22k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.22k|                        << 8;
  154|  3.22k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.22k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.22k|#endif
  157|  3.22k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.22k|      dst += 3;
  160|  3.22k|      buffer_start += 4;
  161|  3.22k|    }
  162|    454|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 132, False: 322]
  ------------------
  163|    132|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    132|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    132|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    132|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    132|                        << 8;
  168|    132|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    132|      triple = scalar::u32_swap_bytes(triple);
  170|    132|#endif
  171|    132|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    132|      dst += 3;
  174|    132|      buffer_start += 4;
  175|    132|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    454|    int leftover = int(bufferptr - buffer_start);
  179|  1.10k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 646, False: 454]
  ------------------
  180|    646|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 646, Folded]
  ------------------
  181|  4.77k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.12k, False: 646]
  ------------------
  182|  4.12k|          src--;
  183|  4.12k|        }
  184|    646|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    646|      src--;
  190|    646|      leftover--;
  191|    646|    }
  192|    454|  }
  193|    860|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 742, False: 118]
  ------------------
  194|    742|    full_result r = scalar::base64::base64_tail_decode(
  195|    742|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    742|    r = scalar::base64::patch_tail_result(
  197|    742|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    742|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    742|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 404, False: 338]
  |  Branch (203:43): [True: 326, False: 78]
  ------------------
  204|    326|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 286, False: 40]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    694|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 688, False: 6]
  ------------------
  207|    688|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 408, False: 280]
  ------------------
  208|    408|        r.input_count++;
  209|    408|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    286|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 280, False: 6]
  ------------------
  213|  4.35k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 4.29k, False: 60]
  ------------------
  214|  4.29k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 4.07k, False: 220]
  ------------------
  215|  4.07k|          r.input_count--;
  216|  4.07k|        }
  217|    280|      }
  218|    286|    }
  219|    742|    return r;
  220|    742|  }
  221|    118|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 118, Folded]
  |  Branch (221:26): [True: 0, False: 118]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    118|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    118|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.21k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.21k|  const uint8_t *to_base64 =
   47|  1.21k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.21k]
  ------------------
   48|  1.21k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.21k, Folded]
  ------------------
   49|  1.21k|                                   : tables::base64::to_base64_value);
   50|  1.21k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.21k|  size_t equallocation = ri.equallocation;
   52|  1.21k|  size_t equalsigns = ri.equalsigns;
   53|  1.21k|  srclen = ri.srclen;
   54|  1.21k|  size_t full_input_length = ri.full_input_length;
   55|  1.21k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 12, False: 1.20k]
  ------------------
   56|     12|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 12, Folded]
  |  Branch (56:28): [True: 6, False: 6]
  ------------------
   57|      6|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      6|    }
   59|      6|    return {SUCCESS, full_input_length, 0};
   60|     12|  }
   61|  1.20k|  char *end_of_safe_64byte_zone =
   62|  1.20k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 40, False: 1.16k]
  ------------------
   63|  1.20k|          ? nullptr
   64|  1.20k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 400, False: 766]
  ------------------
   65|  1.16k|                                        : dst);
   66|       |
   67|  1.20k|  const chartype *const srcinit = src;
   68|  1.20k|  const char *const dstinit = dst;
   69|  1.20k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.20k|  constexpr size_t block_size = 6;
   72|  1.20k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.20k|  char buffer[block_size * 64];
   74|  1.20k|  char *bufferptr = buffer;
   75|  1.20k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 960, False: 246]
  ------------------
   76|    960|    const chartype *const srcend64 = src + srclen - 64;
   77|  91.2k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 90.6k, False: 610]
  ------------------
   78|  90.6k|      block64 b(src);
   79|  90.6k|      src += 64;
   80|  90.6k|      uint64_t error = 0;
   81|  90.6k|      const uint64_t badcharmask =
   82|  90.6k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  90.6k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 90.6k, Folded]
  |  Branch (83:30): [True: 350, False: 90.3k]
  ------------------
   84|    350|        src -= 64;
   85|    350|        const size_t error_offset = trailing_zeroes(error);
   86|    350|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    350|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    350|      }
   89|  90.3k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 29.9k, False: 60.3k]
  ------------------
   90|  29.9k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  60.3k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 18.3k, False: 41.9k]
  ------------------
   92|  18.3k|        b.copy_block(bufferptr);
   93|  18.3k|        bufferptr += 64;
   94|  41.9k|      } else {
   95|  41.9k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 8, False: 41.9k]
  ------------------
   96|      8|          b.base64_decode_block_safe(dst);
   97|  41.9k|        } else {
   98|  41.9k|          b.base64_decode_block(dst);
   99|  41.9k|        }
  100|  41.9k|        dst += 48;
  101|  41.9k|      }
  102|  90.3k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 9.10k, False: 81.2k]
  ------------------
  103|  45.5k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 36.4k, False: 9.10k]
  ------------------
  104|  36.4k|          base64_decode_block(dst, buffer + i * 64);
  105|  36.4k|          dst += 48;
  106|  36.4k|        }
  107|  9.10k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 9.10k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  9.10k|        } else {
  110|  9.10k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  9.10k|        }
  112|  9.10k|        dst += 48;
  113|  9.10k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  9.10k|                    64); // 64 might be too much
  115|  9.10k|        bufferptr -= (block_size - 1) * 64;
  116|  9.10k|      }
  117|  90.3k|    }
  118|    960|  }
  119|       |
  120|    856|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    856|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    856|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 550, False: 306]
  |  Branch (124:26): [True: 90, False: 460]
  ------------------
  125|       |
  126|  1.19k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.12k, False: 72]
  |  Branch (126:52): [True: 1.11k, False: 12]
  ------------------
  127|  1.11k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.11k|      *bufferptr = char(val);
  129|  1.11k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.11k, Folded]
  ------------------
  130|  1.11k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.11k]
  |  Branch (130:52): [True: 6, False: 1.10k]
  ------------------
  131|      6|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      6|                size_t(dst - dstinit)};
  133|      6|      }
  134|  1.10k|      bufferptr += (val <= 63);
  135|  1.10k|      src++;
  136|  1.10k|    }
  137|     90|  }
  138|       |
  139|  1.32k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 472, False: 850]
  ------------------
  140|    472|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 34, False: 438]
  ------------------
  141|     34|      base64_decode_block_safe(dst, buffer_start);
  142|    438|    } else {
  143|    438|      base64_decode_block(dst, buffer_start);
  144|    438|    }
  145|    472|    dst += 48;
  146|    472|  }
  147|    850|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 472, False: 378]
  ------------------
  148|  3.85k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.37k, False: 472]
  ------------------
  149|  3.37k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.37k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.37k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.37k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.37k|                        << 8;
  154|  3.37k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.37k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.37k|#endif
  157|  3.37k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.37k|      dst += 3;
  160|  3.37k|      buffer_start += 4;
  161|  3.37k|    }
  162|    472|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 122, False: 350]
  ------------------
  163|    122|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    122|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    122|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    122|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    122|                        << 8;
  168|    122|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    122|      triple = scalar::u32_swap_bytes(triple);
  170|    122|#endif
  171|    122|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    122|      dst += 3;
  174|    122|      buffer_start += 4;
  175|    122|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    472|    int leftover = int(bufferptr - buffer_start);
  179|  1.19k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 720, False: 472]
  ------------------
  180|    720|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 720, Folded]
  ------------------
  181|  5.17k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.45k, False: 720]
  ------------------
  182|  4.45k|          src--;
  183|  4.45k|        }
  184|    720|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    720|      src--;
  190|    720|      leftover--;
  191|    720|    }
  192|    472|  }
  193|    850|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 708, False: 142]
  ------------------
  194|    708|    full_result r = scalar::base64::base64_tail_decode(
  195|    708|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    708|    r = scalar::base64::patch_tail_result(
  197|    708|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    708|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    708|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 318, False: 390]
  |  Branch (203:43): [True: 290, False: 28]
  ------------------
  204|    290|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 258, False: 32]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    638|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 634, False: 4]
  ------------------
  207|    634|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 380, False: 254]
  ------------------
  208|    380|        r.input_count++;
  209|    380|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    258|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 254, False: 4]
  ------------------
  213|  1.75k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.69k, False: 56]
  ------------------
  214|  1.69k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.49k, False: 198]
  ------------------
  215|  1.49k|          r.input_count--;
  216|  1.49k|        }
  217|    254|      }
  218|    258|    }
  219|    708|    return r;
  220|    708|  }
  221|    142|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 142, Folded]
  |  Branch (221:26): [True: 0, False: 142]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    142|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    142|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.24k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.24k|  const uint8_t *to_base64 =
   47|  1.24k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.24k]
  ------------------
   48|  1.24k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.24k]
  ------------------
   49|  1.24k|                                   : tables::base64::to_base64_value);
   50|  1.24k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.24k|  size_t equallocation = ri.equallocation;
   52|  1.24k|  size_t equalsigns = ri.equalsigns;
   53|  1.24k|  srclen = ri.srclen;
   54|  1.24k|  size_t full_input_length = ri.full_input_length;
   55|  1.24k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 30, False: 1.21k]
  ------------------
   56|     30|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 30, Folded]
  |  Branch (56:28): [True: 12, False: 18]
  ------------------
   57|     12|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     12|    }
   59|     18|    return {SUCCESS, full_input_length, 0};
   60|     30|  }
   61|  1.21k|  char *end_of_safe_64byte_zone =
   62|  1.21k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 50, False: 1.16k]
  ------------------
   63|  1.21k|          ? nullptr
   64|  1.21k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 382, False: 784]
  ------------------
   65|  1.16k|                                        : dst);
   66|       |
   67|  1.21k|  const chartype *const srcinit = src;
   68|  1.21k|  const char *const dstinit = dst;
   69|  1.21k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.21k|  constexpr size_t block_size = 6;
   72|  1.21k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.21k|  char buffer[block_size * 64];
   74|  1.21k|  char *bufferptr = buffer;
   75|  1.21k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 934, False: 282]
  ------------------
   76|    934|    const chartype *const srcend64 = src + srclen - 64;
   77|   366k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 365k, False: 622]
  ------------------
   78|   365k|      block64 b(src);
   79|   365k|      src += 64;
   80|   365k|      uint64_t error = 0;
   81|   365k|      const uint64_t badcharmask =
   82|   365k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   365k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 365k, Folded]
  |  Branch (83:30): [True: 312, False: 365k]
  ------------------
   84|    312|        src -= 64;
   85|    312|        const size_t error_offset = trailing_zeroes(error);
   86|    312|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    312|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    312|      }
   89|   365k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 63.9k, False: 301k]
  ------------------
   90|  63.9k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   301k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 228k, False: 73.1k]
  ------------------
   92|   228k|        b.copy_block(bufferptr);
   93|   228k|        bufferptr += 64;
   94|   228k|      } else {
   95|  73.1k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 73.1k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|  73.1k|        } else {
   98|  73.1k|          b.base64_decode_block(dst);
   99|  73.1k|        }
  100|  73.1k|        dst += 48;
  101|  73.1k|      }
  102|   365k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 57.4k, False: 307k]
  ------------------
  103|   287k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 229k, False: 57.4k]
  ------------------
  104|   229k|          base64_decode_block(dst, buffer + i * 64);
  105|   229k|          dst += 48;
  106|   229k|        }
  107|  57.4k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 57.4k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  57.4k|        } else {
  110|  57.4k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  57.4k|        }
  112|  57.4k|        dst += 48;
  113|  57.4k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  57.4k|                    64); // 64 might be too much
  115|  57.4k|        bufferptr -= (block_size - 1) * 64;
  116|  57.4k|      }
  117|   365k|    }
  118|    934|  }
  119|       |
  120|    904|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    904|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    904|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 572, False: 332]
  |  Branch (124:26): [True: 100, False: 472]
  ------------------
  125|       |
  126|  1.45k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.38k, False: 74]
  |  Branch (126:52): [True: 1.36k, False: 18]
  ------------------
  127|  1.36k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.36k|      *bufferptr = char(val);
  129|  1.36k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.36k, Folded]
  ------------------
  130|  1.36k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.36k]
  |  Branch (130:52): [True: 8, False: 1.35k]
  ------------------
  131|      8|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      8|                size_t(dst - dstinit)};
  133|      8|      }
  134|  1.35k|      bufferptr += (val <= 63);
  135|  1.35k|      src++;
  136|  1.35k|    }
  137|    100|  }
  138|       |
  139|  1.36k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 466, False: 896]
  ------------------
  140|    466|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 36, False: 430]
  ------------------
  141|     36|      base64_decode_block_safe(dst, buffer_start);
  142|    430|    } else {
  143|    430|      base64_decode_block(dst, buffer_start);
  144|    430|    }
  145|    466|    dst += 48;
  146|    466|  }
  147|    896|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 490, False: 406]
  ------------------
  148|  4.16k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.67k, False: 490]
  ------------------
  149|  3.67k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.67k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.67k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.67k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.67k|                        << 8;
  154|  3.67k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.67k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.67k|#endif
  157|  3.67k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.67k|      dst += 3;
  160|  3.67k|      buffer_start += 4;
  161|  3.67k|    }
  162|    490|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 122, False: 368]
  ------------------
  163|    122|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    122|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    122|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    122|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    122|                        << 8;
  168|    122|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    122|      triple = scalar::u32_swap_bytes(triple);
  170|    122|#endif
  171|    122|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    122|      dst += 3;
  174|    122|      buffer_start += 4;
  175|    122|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    490|    int leftover = int(bufferptr - buffer_start);
  179|  1.20k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 716, False: 490]
  ------------------
  180|    716|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 716, Folded]
  ------------------
  181|  6.24k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 5.52k, False: 716]
  ------------------
  182|  5.52k|          src--;
  183|  5.52k|        }
  184|    716|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    716|      src--;
  190|    716|      leftover--;
  191|    716|    }
  192|    490|  }
  193|    896|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 742, False: 154]
  ------------------
  194|    742|    full_result r = scalar::base64::base64_tail_decode(
  195|    742|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    742|    r = scalar::base64::patch_tail_result(
  197|    742|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    742|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    742|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 384, False: 358]
  |  Branch (203:43): [True: 362, False: 22]
  ------------------
  204|    362|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 296, False: 66]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|  1.04k|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 1.03k, False: 10]
  ------------------
  207|  1.03k|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 750, False: 286]
  ------------------
  208|    750|        r.input_count++;
  209|    750|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    296|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 286, False: 10]
  ------------------
  213|  1.79k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.73k, False: 52]
  ------------------
  214|  1.73k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.50k, False: 234]
  ------------------
  215|  1.50k|          r.input_count--;
  216|  1.50k|        }
  217|    286|      }
  218|    296|    }
  219|    742|    return r;
  220|    742|  }
  221|    154|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 154, Folded]
  |  Branch (221:26): [True: 0, False: 154]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    154|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    154|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.19k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.19k|  const uint8_t *to_base64 =
   47|  1.19k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.19k]
  ------------------
   48|  1.19k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.19k, Folded]
  ------------------
   49|  1.19k|                                   : tables::base64::to_base64_value);
   50|  1.19k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.19k|  size_t equallocation = ri.equallocation;
   52|  1.19k|  size_t equalsigns = ri.equalsigns;
   53|  1.19k|  srclen = ri.srclen;
   54|  1.19k|  size_t full_input_length = ri.full_input_length;
   55|  1.19k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 18, False: 1.17k]
  ------------------
   56|     18|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 18, Folded]
  |  Branch (56:28): [True: 6, False: 12]
  ------------------
   57|      6|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      6|    }
   59|     12|    return {SUCCESS, full_input_length, 0};
   60|     18|  }
   61|  1.17k|  char *end_of_safe_64byte_zone =
   62|  1.17k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 74, False: 1.10k]
  ------------------
   63|  1.17k|          ? nullptr
   64|  1.17k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 352, False: 752]
  ------------------
   65|  1.10k|                                        : dst);
   66|       |
   67|  1.17k|  const chartype *const srcinit = src;
   68|  1.17k|  const char *const dstinit = dst;
   69|  1.17k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.17k|  constexpr size_t block_size = 6;
   72|  1.17k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.17k|  char buffer[block_size * 64];
   74|  1.17k|  char *bufferptr = buffer;
   75|  1.17k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 886, False: 292]
  ------------------
   76|    886|    const chartype *const srcend64 = src + srclen - 64;
   77|  25.3k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 24.7k, False: 580]
  ------------------
   78|  24.7k|      block64 b(src);
   79|  24.7k|      src += 64;
   80|  24.7k|      uint64_t error = 0;
   81|  24.7k|      const uint64_t badcharmask =
   82|  24.7k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  24.7k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 24.7k, Folded]
  |  Branch (83:30): [True: 306, False: 24.4k]
  ------------------
   84|    306|        src -= 64;
   85|    306|        const size_t error_offset = trailing_zeroes(error);
   86|    306|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    306|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    306|      }
   89|  24.4k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 19.8k, False: 4.63k]
  ------------------
   90|  19.8k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  19.8k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 4.15k, False: 482]
  ------------------
   92|  4.15k|        b.copy_block(bufferptr);
   93|  4.15k|        bufferptr += 64;
   94|  4.15k|      } else {
   95|    482|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 12, False: 470]
  ------------------
   96|     12|          b.base64_decode_block_safe(dst);
   97|    470|        } else {
   98|    470|          b.base64_decode_block(dst);
   99|    470|        }
  100|    482|        dst += 48;
  101|    482|      }
  102|  24.4k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 4.44k, False: 19.9k]
  ------------------
  103|  22.2k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 17.7k, False: 4.44k]
  ------------------
  104|  17.7k|          base64_decode_block(dst, buffer + i * 64);
  105|  17.7k|          dst += 48;
  106|  17.7k|        }
  107|  4.44k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 4.44k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  4.44k|        } else {
  110|  4.44k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  4.44k|        }
  112|  4.44k|        dst += 48;
  113|  4.44k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  4.44k|                    64); // 64 might be too much
  115|  4.44k|        bufferptr -= (block_size - 1) * 64;
  116|  4.44k|      }
  117|  24.4k|    }
  118|    886|  }
  119|       |
  120|    872|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    872|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    872|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 530, False: 342]
  |  Branch (124:26): [True: 122, False: 408]
  ------------------
  125|       |
  126|  1.10k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.04k, False: 56]
  |  Branch (126:52): [True: 1.02k, False: 20]
  ------------------
  127|  1.02k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.02k|      *bufferptr = char(val);
  129|  1.02k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.02k, Folded]
  ------------------
  130|  1.02k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 30, False: 996]
  |  Branch (130:52): [True: 16, False: 980]
  ------------------
  131|     46|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     46|                size_t(dst - dstinit)};
  133|     46|      }
  134|    980|      bufferptr += (val <= 63);
  135|    980|      src++;
  136|    980|    }
  137|    122|  }
  138|       |
  139|  1.17k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 344, False: 826]
  ------------------
  140|    344|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 32, False: 312]
  ------------------
  141|     32|      base64_decode_block_safe(dst, buffer_start);
  142|    312|    } else {
  143|    312|      base64_decode_block(dst, buffer_start);
  144|    312|    }
  145|    344|    dst += 48;
  146|    344|  }
  147|    826|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 428, False: 398]
  ------------------
  148|  3.50k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.07k, False: 428]
  ------------------
  149|  3.07k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.07k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.07k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.07k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.07k|                        << 8;
  154|  3.07k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.07k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.07k|#endif
  157|  3.07k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.07k|      dst += 3;
  160|  3.07k|      buffer_start += 4;
  161|  3.07k|    }
  162|    428|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 110, False: 318]
  ------------------
  163|    110|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    110|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    110|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    110|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    110|                        << 8;
  168|    110|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    110|      triple = scalar::u32_swap_bytes(triple);
  170|    110|#endif
  171|    110|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    110|      dst += 3;
  174|    110|      buffer_start += 4;
  175|    110|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    428|    int leftover = int(bufferptr - buffer_start);
  179|  1.07k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 644, False: 428]
  ------------------
  180|    644|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 644, Folded]
  ------------------
  181|  7.68k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 7.03k, False: 644]
  ------------------
  182|  7.03k|          src--;
  183|  7.03k|        }
  184|    644|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    644|      src--;
  190|    644|      leftover--;
  191|    644|    }
  192|    428|  }
  193|    826|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 704, False: 122]
  ------------------
  194|    704|    full_result r = scalar::base64::base64_tail_decode(
  195|    704|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    704|    r = scalar::base64::patch_tail_result(
  197|    704|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    704|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    704|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 450, False: 254]
  |  Branch (203:43): [True: 368, False: 82]
  ------------------
  204|    368|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 326, False: 42]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    920|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 916, False: 4]
  ------------------
  207|    916|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 594, False: 322]
  ------------------
  208|    594|        r.input_count++;
  209|    594|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    326|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 322, False: 4]
  ------------------
  213|  3.26k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 3.17k, False: 82]
  ------------------
  214|  3.17k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.93k, False: 240]
  ------------------
  215|  2.93k|          r.input_count--;
  216|  2.93k|        }
  217|    322|      }
  218|    326|    }
  219|    704|    return r;
  220|    704|  }
  221|    122|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 122, Folded]
  |  Branch (221:26): [True: 0, False: 122]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    122|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    122|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.25k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.25k|  const uint8_t *to_base64 =
   47|  1.25k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.25k]
  ------------------
   48|  1.25k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.25k]
  ------------------
   49|  1.25k|                                   : tables::base64::to_base64_value);
   50|  1.25k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.25k|  size_t equallocation = ri.equallocation;
   52|  1.25k|  size_t equalsigns = ri.equalsigns;
   53|  1.25k|  srclen = ri.srclen;
   54|  1.25k|  size_t full_input_length = ri.full_input_length;
   55|  1.25k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 20, False: 1.23k]
  ------------------
   56|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 20, Folded]
  |  Branch (56:28): [True: 12, False: 8]
  ------------------
   57|     12|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     12|    }
   59|      8|    return {SUCCESS, full_input_length, 0};
   60|     20|  }
   61|  1.23k|  char *end_of_safe_64byte_zone =
   62|  1.23k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 100, False: 1.13k]
  ------------------
   63|  1.23k|          ? nullptr
   64|  1.23k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 360, False: 774]
  ------------------
   65|  1.13k|                                        : dst);
   66|       |
   67|  1.23k|  const chartype *const srcinit = src;
   68|  1.23k|  const char *const dstinit = dst;
   69|  1.23k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.23k|  constexpr size_t block_size = 6;
   72|  1.23k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.23k|  char buffer[block_size * 64];
   74|  1.23k|  char *bufferptr = buffer;
   75|  1.23k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 912, False: 322]
  ------------------
   76|    912|    const chartype *const srcend64 = src + srclen - 64;
   77|  71.2k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 70.6k, False: 576]
  ------------------
   78|  70.6k|      block64 b(src);
   79|  70.6k|      src += 64;
   80|  70.6k|      uint64_t error = 0;
   81|  70.6k|      const uint64_t badcharmask =
   82|  70.6k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  70.6k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 70.6k, Folded]
  |  Branch (83:30): [True: 336, False: 70.3k]
  ------------------
   84|    336|        src -= 64;
   85|    336|        const size_t error_offset = trailing_zeroes(error);
   86|    336|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    336|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    336|      }
   89|  70.3k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 55.7k, False: 14.5k]
  ------------------
   90|  55.7k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  55.7k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 14.2k, False: 296]
  ------------------
   92|  14.2k|        b.copy_block(bufferptr);
   93|  14.2k|        bufferptr += 64;
   94|  14.2k|      } else {
   95|    296|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 2, False: 294]
  ------------------
   96|      2|          b.base64_decode_block_safe(dst);
   97|    294|        } else {
   98|    294|          b.base64_decode_block(dst);
   99|    294|        }
  100|    296|        dst += 48;
  101|    296|      }
  102|  70.3k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 13.5k, False: 56.7k]
  ------------------
  103|  67.7k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 54.2k, False: 13.5k]
  ------------------
  104|  54.2k|          base64_decode_block(dst, buffer + i * 64);
  105|  54.2k|          dst += 48;
  106|  54.2k|        }
  107|  13.5k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 13.5k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  13.5k|        } else {
  110|  13.5k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  13.5k|        }
  112|  13.5k|        dst += 48;
  113|  13.5k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  13.5k|                    64); // 64 might be too much
  115|  13.5k|        bufferptr -= (block_size - 1) * 64;
  116|  13.5k|      }
  117|  70.3k|    }
  118|    912|  }
  119|       |
  120|    898|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    898|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    898|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 552, False: 346]
  |  Branch (124:26): [True: 112, False: 440]
  ------------------
  125|       |
  126|  1.07k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.01k, False: 60]
  |  Branch (126:52): [True: 996, False: 14]
  ------------------
  127|    996|      uint8_t val = to_base64[uint8_t(*src)];
  128|    996|      *bufferptr = char(val);
  129|    996|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 996, Folded]
  ------------------
  130|    996|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 20, False: 976]
  |  Branch (130:52): [True: 18, False: 958]
  ------------------
  131|     38|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     38|                size_t(dst - dstinit)};
  133|     38|      }
  134|    958|      bufferptr += (val <= 63);
  135|    958|      src++;
  136|    958|    }
  137|    112|  }
  138|       |
  139|  1.28k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 426, False: 860]
  ------------------
  140|    426|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 28, False: 398]
  ------------------
  141|     28|      base64_decode_block_safe(dst, buffer_start);
  142|    398|    } else {
  143|    398|      base64_decode_block(dst, buffer_start);
  144|    398|    }
  145|    426|    dst += 48;
  146|    426|  }
  147|    860|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 454, False: 406]
  ------------------
  148|  3.68k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.22k, False: 454]
  ------------------
  149|  3.22k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.22k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.22k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.22k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.22k|                        << 8;
  154|  3.22k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.22k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.22k|#endif
  157|  3.22k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.22k|      dst += 3;
  160|  3.22k|      buffer_start += 4;
  161|  3.22k|    }
  162|    454|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 132, False: 322]
  ------------------
  163|    132|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    132|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    132|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    132|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    132|                        << 8;
  168|    132|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    132|      triple = scalar::u32_swap_bytes(triple);
  170|    132|#endif
  171|    132|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    132|      dst += 3;
  174|    132|      buffer_start += 4;
  175|    132|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    454|    int leftover = int(bufferptr - buffer_start);
  179|  1.10k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 646, False: 454]
  ------------------
  180|    646|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 646, Folded]
  ------------------
  181|  4.77k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.12k, False: 646]
  ------------------
  182|  4.12k|          src--;
  183|  4.12k|        }
  184|    646|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    646|      src--;
  190|    646|      leftover--;
  191|    646|    }
  192|    454|  }
  193|    860|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 742, False: 118]
  ------------------
  194|    742|    full_result r = scalar::base64::base64_tail_decode(
  195|    742|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    742|    r = scalar::base64::patch_tail_result(
  197|    742|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    742|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    742|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 404, False: 338]
  |  Branch (203:43): [True: 326, False: 78]
  ------------------
  204|    326|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 286, False: 40]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    694|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 688, False: 6]
  ------------------
  207|    688|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 408, False: 280]
  ------------------
  208|    408|        r.input_count++;
  209|    408|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    286|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 280, False: 6]
  ------------------
  213|  4.35k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 4.29k, False: 60]
  ------------------
  214|  4.29k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 4.07k, False: 220]
  ------------------
  215|  4.07k|          r.input_count--;
  216|  4.07k|        }
  217|    280|      }
  218|    286|    }
  219|    742|    return r;
  220|    742|  }
  221|    118|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 118, Folded]
  |  Branch (221:26): [True: 0, False: 118]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    118|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    118|}

simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block64C2EPKc:
  450|   456k|  simdutf_really_inline block64(const char *src) {
  451|   456k|    chunks[0] = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src));
  452|   456k|    chunks[1] = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 32));
  453|   456k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414compress_blockEmPc:
  630|   169k|  simdutf_really_inline uint64_t compress_block(uint64_t mask, char *output) {
  631|   169k|    if (is_power_of_two(mask)) {
  ------------------
  |  Branch (631:9): [True: 125k, False: 43.7k]
  ------------------
  632|   125k|      return compress_block_single(mask, output);
  633|   125k|    }
  634|       |
  635|  43.7k|    uint64_t nmask = ~mask;
  636|  43.7k|    compress(chunks[0], uint32_t(mask), output);
  637|  43.7k|    compress(chunks[1], uint32_t(mask >> 32),
  638|  43.7k|             output + count_ones(nmask & 0xFFFFFFFF));
  639|  43.7k|    return count_ones(nmask);
  640|   169k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6421compress_block_singleEmPc:
  643|   125k|                                                     char *output) {
  644|   125k|    const size_t pos64 = trailing_zeroes(mask);
  645|   125k|    const int8_t pos = pos64 & 0xf;
  646|   125k|    switch (pos64 >> 4) {
  ------------------
  |  Branch (646:13): [True: 125k, False: 0]
  ------------------
  647|  31.0k|    case 0b00: {
  ------------------
  |  Branch (647:5): [True: 31.0k, False: 94.8k]
  ------------------
  648|  31.0k|      const __m128i lane0 = _mm256_extracti128_si256(chunks[0], 0);
  649|  31.0k|      const __m128i lane1 = _mm256_extracti128_si256(chunks[0], 1);
  650|       |
  651|  31.0k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  652|  31.0k|      const __m128i v1 =
  653|  31.0k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  654|  31.0k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  655|  31.0k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  656|  31.0k|      const __m128i compressed = _mm_shuffle_epi8(lane0, sh);
  657|       |
  658|  31.0k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), compressed);
  659|  31.0k|      _mm_storeu_si128((__m128i *)(output + 1 * 16 - 1), lane1);
  660|  31.0k|      _mm256_storeu_si256((__m256i *)(output + 2 * 16 - 1), chunks[1]);
  661|  31.0k|    } break;
  662|  30.6k|    case 0b01: {
  ------------------
  |  Branch (662:5): [True: 30.6k, False: 95.1k]
  ------------------
  663|  30.6k|      const __m128i lane0 = _mm256_extracti128_si256(chunks[0], 0);
  664|  30.6k|      const __m128i lane1 = _mm256_extracti128_si256(chunks[0], 1);
  665|  30.6k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), lane0);
  666|       |
  667|  30.6k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  668|  30.6k|      const __m128i v1 =
  669|  30.6k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  670|  30.6k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  671|  30.6k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  672|  30.6k|      const __m128i compressed = _mm_shuffle_epi8(lane1, sh);
  673|       |
  674|  30.6k|      _mm_storeu_si128((__m128i *)(output + 1 * 16), compressed);
  675|  30.6k|      _mm256_storeu_si256((__m256i *)(output + 2 * 16 - 1), chunks[1]);
  676|  30.6k|    } break;
  677|  32.6k|    case 0b10: {
  ------------------
  |  Branch (677:5): [True: 32.6k, False: 93.2k]
  ------------------
  678|  32.6k|      const __m128i lane2 = _mm256_extracti128_si256(chunks[1], 0);
  679|  32.6k|      const __m128i lane3 = _mm256_extracti128_si256(chunks[1], 1);
  680|       |
  681|  32.6k|      _mm256_storeu_si256((__m256i *)(output + 0 * 16), chunks[0]);
  682|       |
  683|  32.6k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  684|  32.6k|      const __m128i v1 =
  685|  32.6k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  686|  32.6k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  687|  32.6k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  688|  32.6k|      const __m128i compressed = _mm_shuffle_epi8(lane2, sh);
  689|       |
  690|  32.6k|      _mm_storeu_si128((__m128i *)(output + 2 * 16), compressed);
  691|  32.6k|      _mm_storeu_si128((__m128i *)(output + 3 * 16 - 1), lane3);
  692|  32.6k|    } break;
  693|  31.5k|    case 0b11: {
  ------------------
  |  Branch (693:5): [True: 31.5k, False: 94.3k]
  ------------------
  694|  31.5k|      const __m128i lane2 = _mm256_extracti128_si256(chunks[1], 0);
  695|  31.5k|      const __m128i lane3 = _mm256_extracti128_si256(chunks[1], 1);
  696|       |
  697|  31.5k|      _mm256_storeu_si256((__m256i *)(output + 0 * 16), chunks[0]);
  698|  31.5k|      _mm_storeu_si128((__m128i *)(output + 2 * 16), lane2);
  699|       |
  700|  31.5k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  701|  31.5k|      const __m128i v1 =
  702|  31.5k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  703|  31.5k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  704|  31.5k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  705|  31.5k|      const __m128i compressed = _mm_shuffle_epi8(lane3, sh);
  706|       |
  707|  31.5k|      _mm_storeu_si128((__m128i *)(output + 3 * 16), compressed);
  708|  31.5k|    } break;
  709|   125k|    }
  710|       |
  711|   125k|    return 63;
  712|   125k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_18compressIvEEvDv4_xjPc:
  398|  87.4k|simdutf_really_inline void compress(__m256i data, uint32_t mask, char *output) {
  399|  87.4k|  if (mask == 0) {
  ------------------
  |  Branch (399:7): [True: 19.9k, False: 67.4k]
  ------------------
  400|  19.9k|    _mm256_storeu_si256(reinterpret_cast<__m256i *>(output), data);
  401|  19.9k|    return;
  402|  19.9k|  }
  403|  67.4k|  compress(_mm256_castsi256_si128(data), uint16_t(mask), output);
  404|       |  compress(_mm256_extracti128_si256(data, 1), uint16_t(mask >> 16),
  405|  67.4k|           output + count_ones(~mask & 0xFFFF));
  406|  67.4k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_18compressEDv2_xtPc:
  361|   134k|static inline void compress(__m128i data, uint16_t mask, char *output) {
  362|   134k|  if (mask == 0) {
  ------------------
  |  Branch (362:7): [True: 46.4k, False: 88.4k]
  ------------------
  363|  46.4k|    _mm_storeu_si128(reinterpret_cast<__m128i *>(output), data);
  364|  46.4k|    return;
  365|  46.4k|  }
  366|       |  // this particular implementation was inspired by work done by @animetosho
  367|       |  // we do it in two steps, first 8 bytes and then second 8 bytes
  368|  88.4k|  uint8_t mask1 = uint8_t(mask);      // least significant 8 bits
  369|  88.4k|  uint8_t mask2 = uint8_t(mask >> 8); // most significant 8 bits
  370|       |  // next line just loads the 64-bit values thintable_epi8[mask1] and
  371|       |  // thintable_epi8[mask2] into a 128-bit register, using only
  372|       |  // two instructions on most compilers.
  373|       |
  374|  88.4k|  __m128i shufmask = _mm_set_epi64x(tables::base64::thintable_epi8[mask2],
  375|  88.4k|                                    tables::base64::thintable_epi8[mask1]);
  376|       |  // we increment by 0x08 the second half of the mask
  377|  88.4k|  shufmask =
  378|  88.4k|      _mm_add_epi8(shufmask, _mm_set_epi32(0x08080808, 0x08080808, 0, 0));
  379|       |  // this is the version "nearly pruned"
  380|  88.4k|  __m128i pruned = _mm_shuffle_epi8(data, shufmask);
  381|       |  // we still need to put the two halves together.
  382|       |  // we compute the popcount of the first half:
  383|  88.4k|  int pop1 = tables::base64::BitsSetTable256mul2[mask1];
  384|       |  // then load the corresponding mask, what it does is to write
  385|       |  // only the first pop1 bytes from the first 8 bytes, and then
  386|       |  // it fills in with the bytes from the second 8 bytes + some filling
  387|       |  // at the end.
  388|  88.4k|  __m128i compactmask = _mm_loadu_si128(reinterpret_cast<const __m128i *>(
  389|  88.4k|      tables::base64::pshufb_combine_table + pop1 * 8));
  390|  88.4k|  __m128i answer = _mm_shuffle_epi8(pruned, compactmask);
  391|       |
  392|  88.4k|  _mm_storeu_si128(reinterpret_cast<__m128i *>(output), answer);
  393|  88.4k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6410copy_blockEPc:
  475|   264k|  simdutf_really_inline void copy_block(char *output) {
  476|   264k|    _mm256_storeu_si256(reinterpret_cast<__m256i *>(output), chunks[0]);
  477|   264k|    _mm256_storeu_si256(reinterpret_cast<__m256i *>(output + 32), chunks[1]);
  478|   264k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6424base64_decode_block_safeEPc:
  486|     32|  simdutf_really_inline void base64_decode_block_safe(char *out) {
  487|     32|    base64_decode(out, chunks[0]);
  488|     32|    alignas(32) char buffer[32]; // We enforce safety with a buffer.
  489|     32|    base64_decode(buffer, chunks[1]);
  490|     32|    std::memcpy(out + 24, buffer, 24);
  491|     32|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_113base64_decodeIvEEvPcDv4_x:
  409|  1.08M|simdutf_really_inline void base64_decode(char *out, __m256i str) {
  410|       |  // credit: aqrit
  411|  1.08M|  const __m256i pack_shuffle =
  412|  1.08M|      _mm256_setr_epi8(2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1,
  413|  1.08M|                       2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1);
  414|  1.08M|  const __m256i t0 = _mm256_maddubs_epi16(str, _mm256_set1_epi32(0x01400140));
  415|  1.08M|  const __m256i t1 = _mm256_madd_epi16(t0, _mm256_set1_epi32(0x00011000));
  416|  1.08M|  const __m256i t2 = _mm256_shuffle_epi8(t1, pack_shuffle);
  417|       |
  418|       |  // Store the output:
  419|  1.08M|  _mm_storeu_si128((__m128i *)out, _mm256_castsi256_si128(t2));
  420|       |  _mm_storeu_si128((__m128i *)(out + 12), _mm256_extracti128_si256(t2, 1));
  421|  1.08M|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6419base64_decode_blockEPc:
  481|   115k|  simdutf_really_inline void base64_decode_block(char *out) {
  482|   115k|    base64_decode(out, chunks[0]);
  483|   115k|    base64_decode(out + 24, chunks[1]);
  484|   115k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_119base64_decode_blockIvEEvPcPKc:
  424|   424k|simdutf_really_inline void base64_decode_block(char *out, const char *src) {
  425|   424k|  base64_decode(out,
  426|   424k|                _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src)));
  427|   424k|  base64_decode(out + 24, _mm256_loadu_si256(
  428|   424k|                              reinterpret_cast<const __m256i *>(src + 32)));
  429|   424k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_124base64_decode_block_safeIvEEvPcPKc:
  433|    130|                                                    const char *src) {
  434|    130|  base64_decode(out,
  435|    130|                _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src)));
  436|    130|  alignas(32) char buffer[32]; // We enforce safety with a buffer.
  437|    130|  base64_decode(
  438|    130|      buffer, _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 32)));
  439|    130|  std::memcpy(out + 24, buffer, 24);
  440|    130|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb1ELb0ELb0EEEmPm:
  494|   115k|  simdutf_really_inline uint64_t to_base64_mask(uint64_t *error) {
  495|   115k|    uint32_t err0 = 0;
  496|   115k|    uint32_t err1 = 0;
  497|   115k|    uint64_t m0 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  498|   115k|        &chunks[0], &err0);
  499|   115k|    uint64_t m1 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  500|   115k|        &chunks[1], &err1);
  501|   115k|    if (!ignore_garbage) {
  ------------------
  |  Branch (501:9): [True: 115k, Folded]
  ------------------
  502|   115k|      *error = err0 | ((uint64_t)err1 << 32);
  503|   115k|    }
  504|   115k|    return m0 | (m1 << 32);
  505|   115k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb1ELb0ELb0EEEjPDv4_xPj:
  508|   230k|  simdutf_really_inline uint32_t to_base64_mask(__m256i *src, uint32_t *error) {
  509|   230k|    const __m256i ascii_space_tbl =
  510|   230k|        _mm256_setr_epi8(0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0xa,
  511|   230k|                         0x0, 0xc, 0xd, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0,
  512|   230k|                         0x0, 0x0, 0x0, 0x9, 0xa, 0x0, 0xc, 0xd, 0x0, 0x0);
  513|       |    // credit: aqrit
  514|   230k|    __m256i delta_asso;
  515|   230k|    if (default_or_url) {
  ------------------
  |  Branch (515:9): [Folded, False: 230k]
  ------------------
  516|      0|      delta_asso = _mm256_setr_epi8(
  517|      0|          0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
  518|      0|          0x00, 0x00, 0x11, 0x00, 0x16, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  519|      0|          0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x16);
  520|   230k|    } else if (base64_url) {
  ------------------
  |  Branch (520:16): [True: 230k, Folded]
  ------------------
  521|   230k|      delta_asso = _mm256_setr_epi8(0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0,
  522|   230k|                                    0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0xF, 0x1, 0x1,
  523|   230k|                                    0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0,
  524|   230k|                                    0x0, 0x0, 0xF, 0x0, 0xF);
  525|   230k|    } else {
  526|      0|      delta_asso = _mm256_setr_epi8(
  527|      0|          0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
  528|      0|          0x00, 0x00, 0x0F, 0x00, 0x0F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  529|      0|          0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x0F);
  530|      0|    }
  531|       |
  532|   230k|    __m256i delta_values;
  533|   230k|    if (default_or_url) {
  ------------------
  |  Branch (533:9): [Folded, False: 230k]
  ------------------
  534|      0|      delta_values = _mm256_setr_epi8(
  535|      0|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0x13),
  536|      0|          uint8_t(0x04), uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  537|      0|          uint8_t(0xB9), uint8_t(0x00), uint8_t(0xFF), uint8_t(0x11),
  538|      0|          uint8_t(0xFF), uint8_t(0xBF), uint8_t(0x10), uint8_t(0xB9),
  539|      0|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0x13),
  540|      0|          uint8_t(0x04), uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  541|      0|          uint8_t(0xB9), uint8_t(0x00), uint8_t(0xFF), uint8_t(0x11),
  542|      0|          uint8_t(0xFF), uint8_t(0xBF), uint8_t(0x10), uint8_t(0xB9));
  543|   230k|    } else if (base64_url) {
  ------------------
  |  Branch (543:16): [True: 230k, Folded]
  ------------------
  544|   230k|      delta_values = _mm256_setr_epi8(
  545|   230k|          0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  546|   230k|          uint8_t(0xB9), 0x0, 0x11, uint8_t(0xC3), uint8_t(0xBF), uint8_t(0xE0),
  547|   230k|          uint8_t(0xB9), uint8_t(0xB9), 0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF),
  548|   230k|          uint8_t(0xBF), uint8_t(0xB9), uint8_t(0xB9), 0x0, 0x11, uint8_t(0xC3),
  549|   230k|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0xB9));
  550|   230k|    } else {
  551|      0|      delta_values = _mm256_setr_epi8(
  552|      0|          int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13), int8_t(0x04),
  553|      0|          int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9), int8_t(0x00),
  554|      0|          int8_t(0x10), int8_t(0xC3), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9),
  555|      0|          int8_t(0xB9), int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13),
  556|      0|          int8_t(0x04), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9),
  557|      0|          int8_t(0x00), int8_t(0x10), int8_t(0xC3), int8_t(0xBF), int8_t(0xBF),
  558|      0|          int8_t(0xB9), int8_t(0xB9));
  559|      0|    }
  560|       |
  561|   230k|    __m256i check_asso;
  562|   230k|    if (default_or_url) {
  ------------------
  |  Branch (562:9): [Folded, False: 230k]
  ------------------
  563|      0|      check_asso = _mm256_setr_epi8(
  564|      0|          0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
  565|      0|          0x07, 0x0B, 0x0E, 0x0B, 0x06, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01,
  566|      0|          0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x0B, 0x0E, 0x0B, 0x06);
  567|   230k|    } else if (base64_url) {
  ------------------
  |  Branch (567:16): [True: 230k, Folded]
  ------------------
  568|   230k|      check_asso = _mm256_setr_epi8(0xD, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
  569|   230k|                                    0x1, 0x3, 0x7, 0xB, 0xE, 0xB, 0x6, 0xD, 0x1,
  570|   230k|                                    0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3,
  571|   230k|                                    0x7, 0xB, 0xE, 0xB, 0x6);
  572|   230k|    } else {
  573|      0|      check_asso = _mm256_setr_epi8(
  574|      0|          0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
  575|      0|          0x07, 0x0B, 0x0B, 0x0B, 0x0F, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01,
  576|      0|          0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x0B, 0x0B, 0x0B, 0x0F);
  577|      0|    }
  578|   230k|    __m256i check_values;
  579|   230k|    if (default_or_url) {
  ------------------
  |  Branch (579:9): [Folded, False: 230k]
  ------------------
  580|      0|      check_values = _mm256_setr_epi8(
  581|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  582|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xD5), uint8_t(0xA6),
  583|      0|          uint8_t(0xB5), uint8_t(0xA1), uint8_t(0x00), uint8_t(0x80),
  584|      0|          uint8_t(0x00), uint8_t(0x80), uint8_t(0x00), uint8_t(0x80),
  585|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  586|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xD5), uint8_t(0xA6),
  587|      0|          uint8_t(0xB5), uint8_t(0xA1), uint8_t(0x00), uint8_t(0x80),
  588|      0|          uint8_t(0x00), uint8_t(0x80), uint8_t(0x00), uint8_t(0x80));
  589|   230k|    } else if (base64_url) {
  ------------------
  |  Branch (589:16): [True: 230k, Folded]
  ------------------
  590|   230k|      check_values = _mm256_setr_epi8(
  591|   230k|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  592|   230k|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xB6), uint8_t(0xA6),
  593|   230k|          uint8_t(0xB5), uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0, uint8_t(0x80),
  594|   230k|          0x0, uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  595|   230k|          uint8_t(0x80), uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xB6),
  596|   230k|          uint8_t(0xA6), uint8_t(0xB5), uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0,
  597|   230k|          uint8_t(0x80), 0x0, uint8_t(0x80));
  598|   230k|    } else {
  599|      0|      check_values = _mm256_setr_epi8(
  600|      0|          int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0xCF),
  601|      0|          int8_t(0xBF), int8_t(0xD5), int8_t(0xA6), int8_t(0xB5), int8_t(0x86),
  602|      0|          int8_t(0xD1), int8_t(0x80), int8_t(0xB1), int8_t(0x80), int8_t(0x91),
  603|      0|          int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80),
  604|      0|          int8_t(0xCF), int8_t(0xBF), int8_t(0xD5), int8_t(0xA6), int8_t(0xB5),
  605|      0|          int8_t(0x86), int8_t(0xD1), int8_t(0x80), int8_t(0xB1), int8_t(0x80),
  606|      0|          int8_t(0x91), int8_t(0x80));
  607|      0|    }
  608|   230k|    const __m256i shifted = _mm256_srli_epi32(*src, 3);
  609|   230k|    __m256i delta_hash =
  610|   230k|        _mm256_avg_epu8(_mm256_shuffle_epi8(delta_asso, *src), shifted);
  611|   230k|    if (default_or_url) {
  ------------------
  |  Branch (611:9): [Folded, False: 230k]
  ------------------
  612|      0|      delta_hash = _mm256_and_si256(delta_hash, _mm256_set1_epi8(0xf));
  613|      0|    }
  614|   230k|    const __m256i check_hash =
  615|   230k|        _mm256_avg_epu8(_mm256_shuffle_epi8(check_asso, *src), shifted);
  616|   230k|    const __m256i out =
  617|   230k|        _mm256_adds_epi8(_mm256_shuffle_epi8(delta_values, delta_hash), *src);
  618|   230k|    const __m256i chk =
  619|   230k|        _mm256_adds_epi8(_mm256_shuffle_epi8(check_values, check_hash), *src);
  620|   230k|    const int mask = _mm256_movemask_epi8(chk);
  621|   230k|    if (!ignore_garbage && mask) {
  ------------------
  |  Branch (621:9): [True: 230k, Folded]
  |  Branch (621:28): [True: 60.0k, False: 170k]
  ------------------
  622|  60.0k|      __m256i ascii_space =
  623|  60.0k|          _mm256_cmpeq_epi8(_mm256_shuffle_epi8(ascii_space_tbl, *src), *src);
  624|  60.0k|      *error = (mask ^ _mm256_movemask_epi8(ascii_space));
  625|  60.0k|    }
  626|   230k|    *src = out;
  627|   230k|    return (uint32_t)mask;
  628|   230k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb0ELb0ELb0EEEmPm:
  494|   436k|  simdutf_really_inline uint64_t to_base64_mask(uint64_t *error) {
  495|   436k|    uint32_t err0 = 0;
  496|   436k|    uint32_t err1 = 0;
  497|   436k|    uint64_t m0 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  498|   436k|        &chunks[0], &err0);
  499|   436k|    uint64_t m1 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  500|   436k|        &chunks[1], &err1);
  501|   436k|    if (!ignore_garbage) {
  ------------------
  |  Branch (501:9): [True: 436k, Folded]
  ------------------
  502|   436k|      *error = err0 | ((uint64_t)err1 << 32);
  503|   436k|    }
  504|   436k|    return m0 | (m1 << 32);
  505|   436k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb0ELb0ELb0EEEjPDv4_xPj:
  508|   872k|  simdutf_really_inline uint32_t to_base64_mask(__m256i *src, uint32_t *error) {
  509|   872k|    const __m256i ascii_space_tbl =
  510|   872k|        _mm256_setr_epi8(0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0xa,
  511|   872k|                         0x0, 0xc, 0xd, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0,
  512|   872k|                         0x0, 0x0, 0x0, 0x9, 0xa, 0x0, 0xc, 0xd, 0x0, 0x0);
  513|       |    // credit: aqrit
  514|   872k|    __m256i delta_asso;
  515|   872k|    if (default_or_url) {
  ------------------
  |  Branch (515:9): [Folded, False: 872k]
  ------------------
  516|      0|      delta_asso = _mm256_setr_epi8(
  517|      0|          0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
  518|      0|          0x00, 0x00, 0x11, 0x00, 0x16, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  519|      0|          0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x16);
  520|   872k|    } else if (base64_url) {
  ------------------
  |  Branch (520:16): [Folded, False: 872k]
  ------------------
  521|      0|      delta_asso = _mm256_setr_epi8(0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0,
  522|      0|                                    0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0xF, 0x1, 0x1,
  523|      0|                                    0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0,
  524|      0|                                    0x0, 0x0, 0xF, 0x0, 0xF);
  525|   872k|    } else {
  526|   872k|      delta_asso = _mm256_setr_epi8(
  527|   872k|          0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
  528|   872k|          0x00, 0x00, 0x0F, 0x00, 0x0F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  529|   872k|          0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x0F);
  530|   872k|    }
  531|       |
  532|   872k|    __m256i delta_values;
  533|   872k|    if (default_or_url) {
  ------------------
  |  Branch (533:9): [Folded, False: 872k]
  ------------------
  534|      0|      delta_values = _mm256_setr_epi8(
  535|      0|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0x13),
  536|      0|          uint8_t(0x04), uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  537|      0|          uint8_t(0xB9), uint8_t(0x00), uint8_t(0xFF), uint8_t(0x11),
  538|      0|          uint8_t(0xFF), uint8_t(0xBF), uint8_t(0x10), uint8_t(0xB9),
  539|      0|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0x13),
  540|      0|          uint8_t(0x04), uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  541|      0|          uint8_t(0xB9), uint8_t(0x00), uint8_t(0xFF), uint8_t(0x11),
  542|      0|          uint8_t(0xFF), uint8_t(0xBF), uint8_t(0x10), uint8_t(0xB9));
  543|   872k|    } else if (base64_url) {
  ------------------
  |  Branch (543:16): [Folded, False: 872k]
  ------------------
  544|      0|      delta_values = _mm256_setr_epi8(
  545|      0|          0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  546|      0|          uint8_t(0xB9), 0x0, 0x11, uint8_t(0xC3), uint8_t(0xBF), uint8_t(0xE0),
  547|      0|          uint8_t(0xB9), uint8_t(0xB9), 0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF),
  548|      0|          uint8_t(0xBF), uint8_t(0xB9), uint8_t(0xB9), 0x0, 0x11, uint8_t(0xC3),
  549|      0|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0xB9));
  550|   872k|    } else {
  551|   872k|      delta_values = _mm256_setr_epi8(
  552|   872k|          int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13), int8_t(0x04),
  553|   872k|          int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9), int8_t(0x00),
  554|   872k|          int8_t(0x10), int8_t(0xC3), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9),
  555|   872k|          int8_t(0xB9), int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13),
  556|   872k|          int8_t(0x04), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9),
  557|   872k|          int8_t(0x00), int8_t(0x10), int8_t(0xC3), int8_t(0xBF), int8_t(0xBF),
  558|   872k|          int8_t(0xB9), int8_t(0xB9));
  559|   872k|    }
  560|       |
  561|   872k|    __m256i check_asso;
  562|   872k|    if (default_or_url) {
  ------------------
  |  Branch (562:9): [Folded, False: 872k]
  ------------------
  563|      0|      check_asso = _mm256_setr_epi8(
  564|      0|          0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
  565|      0|          0x07, 0x0B, 0x0E, 0x0B, 0x06, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01,
  566|      0|          0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x0B, 0x0E, 0x0B, 0x06);
  567|   872k|    } else if (base64_url) {
  ------------------
  |  Branch (567:16): [Folded, False: 872k]
  ------------------
  568|      0|      check_asso = _mm256_setr_epi8(0xD, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
  569|      0|                                    0x1, 0x3, 0x7, 0xB, 0xE, 0xB, 0x6, 0xD, 0x1,
  570|      0|                                    0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3,
  571|      0|                                    0x7, 0xB, 0xE, 0xB, 0x6);
  572|   872k|    } else {
  573|   872k|      check_asso = _mm256_setr_epi8(
  574|   872k|          0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
  575|   872k|          0x07, 0x0B, 0x0B, 0x0B, 0x0F, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01,
  576|   872k|          0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x0B, 0x0B, 0x0B, 0x0F);
  577|   872k|    }
  578|   872k|    __m256i check_values;
  579|   872k|    if (default_or_url) {
  ------------------
  |  Branch (579:9): [Folded, False: 872k]
  ------------------
  580|      0|      check_values = _mm256_setr_epi8(
  581|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  582|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xD5), uint8_t(0xA6),
  583|      0|          uint8_t(0xB5), uint8_t(0xA1), uint8_t(0x00), uint8_t(0x80),
  584|      0|          uint8_t(0x00), uint8_t(0x80), uint8_t(0x00), uint8_t(0x80),
  585|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  586|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xD5), uint8_t(0xA6),
  587|      0|          uint8_t(0xB5), uint8_t(0xA1), uint8_t(0x00), uint8_t(0x80),
  588|      0|          uint8_t(0x00), uint8_t(0x80), uint8_t(0x00), uint8_t(0x80));
  589|   872k|    } else if (base64_url) {
  ------------------
  |  Branch (589:16): [Folded, False: 872k]
  ------------------
  590|      0|      check_values = _mm256_setr_epi8(
  591|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  592|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xB6), uint8_t(0xA6),
  593|      0|          uint8_t(0xB5), uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0, uint8_t(0x80),
  594|      0|          0x0, uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  595|      0|          uint8_t(0x80), uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xB6),
  596|      0|          uint8_t(0xA6), uint8_t(0xB5), uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0,
  597|      0|          uint8_t(0x80), 0x0, uint8_t(0x80));
  598|   872k|    } else {
  599|   872k|      check_values = _mm256_setr_epi8(
  600|   872k|          int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0xCF),
  601|   872k|          int8_t(0xBF), int8_t(0xD5), int8_t(0xA6), int8_t(0xB5), int8_t(0x86),
  602|   872k|          int8_t(0xD1), int8_t(0x80), int8_t(0xB1), int8_t(0x80), int8_t(0x91),
  603|   872k|          int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80),
  604|   872k|          int8_t(0xCF), int8_t(0xBF), int8_t(0xD5), int8_t(0xA6), int8_t(0xB5),
  605|   872k|          int8_t(0x86), int8_t(0xD1), int8_t(0x80), int8_t(0xB1), int8_t(0x80),
  606|   872k|          int8_t(0x91), int8_t(0x80));
  607|   872k|    }
  608|   872k|    const __m256i shifted = _mm256_srli_epi32(*src, 3);
  609|   872k|    __m256i delta_hash =
  610|   872k|        _mm256_avg_epu8(_mm256_shuffle_epi8(delta_asso, *src), shifted);
  611|   872k|    if (default_or_url) {
  ------------------
  |  Branch (611:9): [Folded, False: 872k]
  ------------------
  612|      0|      delta_hash = _mm256_and_si256(delta_hash, _mm256_set1_epi8(0xf));
  613|      0|    }
  614|   872k|    const __m256i check_hash =
  615|   872k|        _mm256_avg_epu8(_mm256_shuffle_epi8(check_asso, *src), shifted);
  616|   872k|    const __m256i out =
  617|   872k|        _mm256_adds_epi8(_mm256_shuffle_epi8(delta_values, delta_hash), *src);
  618|   872k|    const __m256i chk =
  619|   872k|        _mm256_adds_epi8(_mm256_shuffle_epi8(check_values, check_hash), *src);
  620|   872k|    const int mask = _mm256_movemask_epi8(chk);
  621|   872k|    if (!ignore_garbage && mask) {
  ------------------
  |  Branch (621:9): [True: 872k, Folded]
  |  Branch (621:28): [True: 135k, False: 736k]
  ------------------
  622|   135k|      __m256i ascii_space =
  623|   135k|          _mm256_cmpeq_epi8(_mm256_shuffle_epi8(ascii_space_tbl, *src), *src);
  624|   135k|      *error = (mask ^ _mm256_movemask_epi8(ascii_space));
  625|   135k|    }
  626|   872k|    *src = out;
  627|   872k|    return (uint32_t)mask;
  628|   872k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block64C2EPKDs:
  457|  95.4k|  simdutf_really_inline block64(const char16_t *src) {
  458|  95.4k|    const auto m1 = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src));
  459|  95.4k|    const auto m2 =
  460|  95.4k|        _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 16));
  461|  95.4k|    const auto m3 =
  462|  95.4k|        _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 32));
  463|  95.4k|    const auto m4 =
  464|  95.4k|        _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 48));
  465|       |
  466|  95.4k|    const auto m1p = _mm256_permute2x128_si256(m1, m2, 0x20);
  467|  95.4k|    const auto m2p = _mm256_permute2x128_si256(m1, m2, 0x31);
  468|  95.4k|    const auto m3p = _mm256_permute2x128_si256(m3, m4, 0x20);
  469|  95.4k|    const auto m4p = _mm256_permute2x128_si256(m3, m4, 0x31);
  470|       |
  471|  95.4k|    chunks[0] = _mm256_packus_epi16(m1p, m2p);
  472|  95.4k|    chunks[1] = _mm256_packus_epi16(m3p, m4p);
  473|  95.4k|  }

_ZNK7simdutf7haswell14implementation16base64_to_binaryEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1268|  1.23k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1269|  1.23k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1269:7): [True: 0, False: 1.23k]
  ------------------
 1270|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1270:9): [True: 0, False: 0]
  ------------------
 1271|      0|      return base64::compress_decode_base64<false, true, true>(
 1272|      0|          output, input, length, options, last_chunk_options);
 1273|      0|    } else {
 1274|      0|      return base64::compress_decode_base64<false, false, true>(
 1275|      0|          output, input, length, options, last_chunk_options);
 1276|      0|    }
 1277|  1.23k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1277:14): [True: 609, False: 623]
  ------------------
 1278|    609|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1278:9): [True: 0, False: 609]
  ------------------
 1279|      0|      return base64::compress_decode_base64<true, true, false>(
 1280|      0|          output, input, length, options, last_chunk_options);
 1281|    609|    } else {
 1282|    609|      return base64::compress_decode_base64<true, false, false>(
 1283|    609|          output, input, length, options, last_chunk_options);
 1284|    609|    }
 1285|    623|  } else {
 1286|    623|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1286:9): [True: 0, False: 623]
  ------------------
 1287|      0|      return base64::compress_decode_base64<false, true, false>(
 1288|      0|          output, input, length, options, last_chunk_options);
 1289|    623|    } else {
 1290|    623|      return base64::compress_decode_base64<false, false, false>(
 1291|    623|          output, input, length, options, last_chunk_options);
 1292|    623|    }
 1293|    623|  }
 1294|  1.23k|}
_ZNK7simdutf7haswell14implementation24base64_to_binary_detailsEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1298|  1.23k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1299|  1.23k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1299:7): [True: 0, False: 1.23k]
  ------------------
 1300|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1300:9): [True: 0, False: 0]
  ------------------
 1301|      0|      return base64::compress_decode_base64<false, true, true>(
 1302|      0|          output, input, length, options, last_chunk_options);
 1303|      0|    } else {
 1304|      0|      return base64::compress_decode_base64<false, false, true>(
 1305|      0|          output, input, length, options, last_chunk_options);
 1306|      0|    }
 1307|  1.23k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1307:14): [True: 609, False: 623]
  ------------------
 1308|    609|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1308:9): [True: 0, False: 609]
  ------------------
 1309|      0|      return base64::compress_decode_base64<true, true, false>(
 1310|      0|          output, input, length, options, last_chunk_options);
 1311|    609|    } else {
 1312|    609|      return base64::compress_decode_base64<true, false, false>(
 1313|    609|          output, input, length, options, last_chunk_options);
 1314|    609|    }
 1315|    623|  } else {
 1316|    623|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1316:9): [True: 0, False: 623]
  ------------------
 1317|      0|      return base64::compress_decode_base64<false, true, false>(
 1318|      0|          output, input, length, options, last_chunk_options);
 1319|    623|    } else {
 1320|    623|      return base64::compress_decode_base64<false, false, false>(
 1321|    623|          output, input, length, options, last_chunk_options);
 1322|    623|    }
 1323|    623|  }
 1324|  1.23k|}
_ZNK7simdutf7haswell14implementation16base64_to_binaryEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1328|  1.22k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1329|  1.22k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1329:7): [True: 0, False: 1.22k]
  ------------------
 1330|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1330:9): [True: 0, False: 0]
  ------------------
 1331|      0|      return base64::compress_decode_base64<false, true, true>(
 1332|      0|          output, input, length, options, last_chunk_options);
 1333|      0|    } else {
 1334|      0|      return base64::compress_decode_base64<false, false, true>(
 1335|      0|          output, input, length, options, last_chunk_options);
 1336|      0|    }
 1337|  1.22k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1337:14): [True: 598, False: 627]
  ------------------
 1338|    598|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1338:9): [True: 0, False: 598]
  ------------------
 1339|      0|      return base64::compress_decode_base64<true, true, false>(
 1340|      0|          output, input, length, options, last_chunk_options);
 1341|    598|    } else {
 1342|    598|      return base64::compress_decode_base64<true, false, false>(
 1343|    598|          output, input, length, options, last_chunk_options);
 1344|    598|    }
 1345|    627|  } else {
 1346|    627|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1346:9): [True: 0, False: 627]
  ------------------
 1347|      0|      return base64::compress_decode_base64<false, true, false>(
 1348|      0|          output, input, length, options, last_chunk_options);
 1349|    627|    } else {
 1350|    627|      return base64::compress_decode_base64<false, false, false>(
 1351|    627|          output, input, length, options, last_chunk_options);
 1352|    627|    }
 1353|    627|  }
 1354|  1.22k|}
_ZNK7simdutf7haswell14implementation24base64_to_binary_detailsEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1358|  1.22k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1359|  1.22k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1359:7): [True: 0, False: 1.22k]
  ------------------
 1360|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1360:9): [True: 0, False: 0]
  ------------------
 1361|      0|      return base64::compress_decode_base64<false, true, true>(
 1362|      0|          output, input, length, options, last_chunk_options);
 1363|      0|    } else {
 1364|      0|      return base64::compress_decode_base64<false, false, true>(
 1365|      0|          output, input, length, options, last_chunk_options);
 1366|      0|    }
 1367|  1.22k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1367:14): [True: 598, False: 627]
  ------------------
 1368|    598|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1368:9): [True: 0, False: 598]
  ------------------
 1369|      0|      return base64::compress_decode_base64<true, true, false>(
 1370|      0|          output, input, length, options, last_chunk_options);
 1371|    598|    } else {
 1372|    598|      return base64::compress_decode_base64<true, false, false>(
 1373|    598|          output, input, length, options, last_chunk_options);
 1374|    598|    }
 1375|    627|  } else {
 1376|    627|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1376:9): [True: 0, False: 627]
  ------------------
 1377|      0|      return base64::compress_decode_base64<false, true, false>(
 1378|      0|          output, input, length, options, last_chunk_options);
 1379|    627|    } else {
 1380|    627|      return base64::compress_decode_base64<false, false, false>(
 1381|    627|          output, input, length, options, last_chunk_options);
 1382|    627|    }
 1383|    627|  }
 1384|  1.22k|}

_ZNK7simdutf14implementation27supported_by_runtime_systemEv:
   64|      8|bool implementation::supported_by_runtime_system() const {
   65|      8|  uint32_t required_instruction_sets = this->required_instruction_sets();
   66|      8|  uint32_t supported_instruction_sets =
   67|      8|      internal::detect_supported_architectures();
   68|      8|  return ((supported_instruction_sets & required_instruction_sets) ==
   69|      8|          required_instruction_sets);
   70|      8|}
_ZNK7simdutf14implementation33maximal_binary_length_from_base64EPKcm:
  117|  3.69k|    const char *input, size_t length) const noexcept {
  118|  3.69k|  return scalar::base64::maximal_binary_length_from_base64(input, length);
  119|  3.69k|}
_ZNK7simdutf14implementation33maximal_binary_length_from_base64EPKDsm:
  122|  3.67k|    const char16_t *input, size_t length) const noexcept {
  123|  3.67k|  return scalar::base64::maximal_binary_length_from_base64(input, length);
  124|  3.67k|}
_ZNK7simdutf8internal29available_implementation_list5beginEv:
 1503|      1|available_implementation_list::begin() const noexcept {
 1504|      1|  return internal::get_available_implementation_pointers().begin();
 1505|      1|}
_ZNK7simdutf8internal29available_implementation_list3endEv:
 1507|      1|available_implementation_list::end() const noexcept {
 1508|      1|  return internal::get_available_implementation_pointers().end();
 1509|      1|}
_ZN7simdutf29get_available_implementationsEv:
 1558|      1|get_available_implementations() {
 1559|      1|#if !SIMDUTF_USE_STATIC_INITIALIZATION
 1560|      1|  static const internal::available_implementation_list
 1561|      1|      available_implementations_instance{};
 1562|      1|#endif
 1563|      1|  return available_implementations_instance;
 1564|      1|}
simdutf.cpp:_ZN7simdutf8internalL37get_available_implementation_pointersEv:
  933|      2|get_available_implementation_pointers() {
  934|      2|#if !SIMDUTF_USE_STATIC_INITIALIZATION
  935|      2|  static const std::initializer_list<const implementation *>
  936|      2|      available_implementation_pointers{
  937|      2|  #if SIMDUTF_IMPLEMENTATION_ICELAKE
  938|      2|          get_icelake_singleton(),
  939|      2|  #endif
  940|      2|  #if SIMDUTF_IMPLEMENTATION_HASWELL
  941|      2|          get_haswell_singleton(),
  942|      2|  #endif
  943|      2|  #if SIMDUTF_IMPLEMENTATION_WESTMERE
  944|      2|          get_westmere_singleton(),
  945|      2|  #endif
  946|       |  #if SIMDUTF_IMPLEMENTATION_ARM64
  947|       |          get_arm64_singleton(),
  948|       |  #endif
  949|       |  #if SIMDUTF_IMPLEMENTATION_PPC64
  950|       |          get_ppc64_singleton(),
  951|       |  #endif
  952|       |  #if SIMDUTF_IMPLEMENTATION_RVV
  953|       |          get_rvv_singleton(),
  954|       |  #endif
  955|       |  #if SIMDUTF_IMPLEMENTATION_LASX
  956|       |          get_lasx_singleton(),
  957|       |  #endif
  958|       |  #if SIMDUTF_IMPLEMENTATION_LSX
  959|       |          get_lsx_singleton(),
  960|       |  #endif
  961|      2|  #if SIMDUTF_IMPLEMENTATION_FALLBACK
  962|      2|          get_fallback_singleton(),
  963|      2|  #endif
  964|      2|      };
  965|      2|#endif
  966|      2|  return available_implementation_pointers;
  967|      2|}
simdutf.cpp:_ZN7simdutf8internalL21get_icelake_singletonEv:
  157|      1|static const icelake::implementation *get_icelake_singleton() {
  158|      1|  #if !SIMDUTF_USE_STATIC_INITIALIZATION
  159|      1|  static const icelake::implementation icelake_singleton{};
  160|      1|  #endif
  161|      1|  return &icelake_singleton;
  162|      1|}
simdutf.cpp:_ZN7simdutf8internalL21get_haswell_singletonEv:
  168|      1|static const haswell::implementation *get_haswell_singleton() {
  169|      1|  #if !SIMDUTF_USE_STATIC_INITIALIZATION
  170|      1|  static const haswell::implementation haswell_singleton{};
  171|      1|  #endif
  172|      1|  return &haswell_singleton;
  173|      1|}
simdutf.cpp:_ZN7simdutf8internalL22get_westmere_singletonEv:
  179|      1|static const westmere::implementation *get_westmere_singleton() {
  180|      1|  #if !SIMDUTF_USE_STATIC_INITIALIZATION
  181|      1|  static const westmere::implementation westmere_singleton{};
  182|      1|  #endif
  183|      1|  return &westmere_singleton;
  184|      1|}
simdutf.cpp:_ZN7simdutf8internalL22get_fallback_singletonEv:
  245|      1|static const fallback::implementation *get_fallback_singleton() {
  246|      1|  #if !SIMDUTF_USE_STATIC_INITIALIZATION
  247|      1|  static const fallback::implementation fallback_singleton{};
  248|      1|  #endif
  249|      1|  return &fallback_singleton;
  250|      1|}

_ZN7simdutf8fallback14implementationC2Ev:
   16|      1|      : simdutf::implementation("fallback", "Generic fallback implementation",
   17|      1|                                0) {}

simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_110count_onesEm:
   14|   154k|simdutf_really_inline long long int count_ones(uint64_t input_num) {
   15|       |  return _popcnt64(input_num);
   16|   154k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_115trailing_zeroesEm:
   20|   127k|simdutf_really_inline int trailing_zeroes(uint64_t input_num) {
   21|       |  #if SIMDUTF_REGULAR_VISUAL_STUDIO
   22|       |  return (int)_tzcnt_u64(input_num);
   23|       |  #else  // SIMDUTF_REGULAR_VISUAL_STUDIO
   24|   127k|  return __builtin_ctzll(input_num);
   25|   127k|  #endif // SIMDUTF_REGULAR_VISUAL_STUDIO
   26|   127k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_115is_power_of_twoImEEbT_:
   29|   169k|template <typename T> bool is_power_of_two(T x) { return (x & (x - 1)) == 0; }

_ZN7simdutf7haswell14implementationC2Ev:
   16|      1|      : simdutf::implementation("haswell", "Intel/AMD AVX2",
   17|      1|                                internal::instruction_set::AVX2 |
   18|      1|                                    internal::instruction_set::BMI1 |
   19|      1|                                    internal::instruction_set::BMI2) {}

_ZN7simdutf7icelake14implementationC2Ev:
   16|      1|      : simdutf::implementation(
   17|      1|            "icelake",
   18|      1|            "Intel AVX512 (AVX-512BW, AVX-512CD, AVX-512VL, AVX-512VBMI2 "
   19|      1|            "extensions)",
   20|      1|            internal::instruction_set::AVX2 | internal::instruction_set::BMI1 |
   21|      1|                internal::instruction_set::BMI2 |
   22|      1|                internal::instruction_set::AVX512BW |
   23|      1|                internal::instruction_set::AVX512CD |
   24|      1|                internal::instruction_set::AVX512VL |
   25|      1|                internal::instruction_set::AVX512VBMI2 |
   26|      1|                internal::instruction_set::AVX512VPOPCNTDQ) {}

simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_110count_onesEm:
   14|   174k|simdutf_really_inline long long int count_ones(uint64_t input_num) {
   15|       |  return _popcnt64(input_num);
   16|   174k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115trailing_zeroesEm:
   20|   127k|simdutf_really_inline int trailing_zeroes(uint64_t input_num) {
   21|       |  #if SIMDUTF_REGULAR_VISUAL_STUDIO
   22|       |  unsigned long ret;
   23|       |  _BitScanForward64(&ret, input_num);
   24|       |  return (int)ret;
   25|       |  #else  // SIMDUTF_REGULAR_VISUAL_STUDIO
   26|   127k|  return __builtin_ctzll(input_num);
   27|   127k|  #endif // SIMDUTF_REGULAR_VISUAL_STUDIO
   28|   127k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115is_power_of_twoImEEbT_:
   31|   169k|template <typename T> bool is_power_of_two(T x) { return (x & (x - 1)) == 0; }

_ZN7simdutf8westmere14implementationC2Ev:
   18|      1|      : simdutf::implementation("westmere", "Intel/AMD SSE4.2",
   19|      1|                                internal::instruction_set::SSE42) {}

_ZNK7simdutf8westmere14implementation16base64_to_binaryEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1299|  1.23k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1300|  1.23k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1300:7): [True: 0, False: 1.23k]
  ------------------
 1301|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1301:9): [True: 0, False: 0]
  ------------------
 1302|      0|      return base64::compress_decode_base64<false, true, true>(
 1303|      0|          output, input, length, options, last_chunk_options);
 1304|      0|    } else {
 1305|      0|      return base64::compress_decode_base64<false, false, true>(
 1306|      0|          output, input, length, options, last_chunk_options);
 1307|      0|    }
 1308|  1.23k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1308:14): [True: 609, False: 623]
  ------------------
 1309|    609|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1309:9): [True: 0, False: 609]
  ------------------
 1310|      0|      return base64::compress_decode_base64<true, true, false>(
 1311|      0|          output, input, length, options, last_chunk_options);
 1312|    609|    } else {
 1313|    609|      return base64::compress_decode_base64<true, false, false>(
 1314|    609|          output, input, length, options, last_chunk_options);
 1315|    609|    }
 1316|    623|  } else {
 1317|    623|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1317:9): [True: 0, False: 623]
  ------------------
 1318|      0|      return base64::compress_decode_base64<false, true, false>(
 1319|      0|          output, input, length, options, last_chunk_options);
 1320|    623|    } else {
 1321|    623|      return base64::compress_decode_base64<false, false, false>(
 1322|    623|          output, input, length, options, last_chunk_options);
 1323|    623|    }
 1324|    623|  }
 1325|  1.23k|}
_ZNK7simdutf8westmere14implementation24base64_to_binary_detailsEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1329|  1.23k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1330|  1.23k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1330:7): [True: 0, False: 1.23k]
  ------------------
 1331|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1331:9): [True: 0, False: 0]
  ------------------
 1332|      0|      return base64::compress_decode_base64<false, true, true>(
 1333|      0|          output, input, length, options, last_chunk_options);
 1334|      0|    } else {
 1335|      0|      return base64::compress_decode_base64<false, false, true>(
 1336|      0|          output, input, length, options, last_chunk_options);
 1337|      0|    }
 1338|  1.23k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1338:14): [True: 609, False: 623]
  ------------------
 1339|    609|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1339:9): [True: 0, False: 609]
  ------------------
 1340|      0|      return base64::compress_decode_base64<true, true, false>(
 1341|      0|          output, input, length, options, last_chunk_options);
 1342|    609|    } else {
 1343|    609|      return base64::compress_decode_base64<true, false, false>(
 1344|    609|          output, input, length, options, last_chunk_options);
 1345|    609|    }
 1346|    623|  } else {
 1347|    623|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1347:9): [True: 0, False: 623]
  ------------------
 1348|      0|      return base64::compress_decode_base64<false, true, false>(
 1349|      0|          output, input, length, options, last_chunk_options);
 1350|    623|    } else {
 1351|    623|      return base64::compress_decode_base64<false, false, false>(
 1352|    623|          output, input, length, options, last_chunk_options);
 1353|    623|    }
 1354|    623|  }
 1355|  1.23k|}
_ZNK7simdutf8westmere14implementation16base64_to_binaryEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1359|  1.22k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1360|  1.22k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1360:7): [True: 0, False: 1.22k]
  ------------------
 1361|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1361:9): [True: 0, False: 0]
  ------------------
 1362|      0|      return base64::compress_decode_base64<false, true, true>(
 1363|      0|          output, input, length, options, last_chunk_options);
 1364|      0|    } else {
 1365|      0|      return base64::compress_decode_base64<false, false, true>(
 1366|      0|          output, input, length, options, last_chunk_options);
 1367|      0|    }
 1368|  1.22k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1368:14): [True: 598, False: 627]
  ------------------
 1369|    598|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1369:9): [True: 0, False: 598]
  ------------------
 1370|      0|      return base64::compress_decode_base64<true, true, false>(
 1371|      0|          output, input, length, options, last_chunk_options);
 1372|    598|    } else {
 1373|    598|      return base64::compress_decode_base64<true, false, false>(
 1374|    598|          output, input, length, options, last_chunk_options);
 1375|    598|    }
 1376|    627|  } else {
 1377|    627|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1377:9): [True: 0, False: 627]
  ------------------
 1378|      0|      return base64::compress_decode_base64<false, true, false>(
 1379|      0|          output, input, length, options, last_chunk_options);
 1380|    627|    } else {
 1381|    627|      return base64::compress_decode_base64<false, false, false>(
 1382|    627|          output, input, length, options, last_chunk_options);
 1383|    627|    }
 1384|    627|  }
 1385|  1.22k|}
_ZNK7simdutf8westmere14implementation24base64_to_binary_detailsEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1389|  1.22k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1390|  1.22k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1390:7): [True: 0, False: 1.22k]
  ------------------
 1391|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1391:9): [True: 0, False: 0]
  ------------------
 1392|      0|      return base64::compress_decode_base64<false, true, true>(
 1393|      0|          output, input, length, options, last_chunk_options);
 1394|      0|    } else {
 1395|      0|      return base64::compress_decode_base64<false, false, true>(
 1396|      0|          output, input, length, options, last_chunk_options);
 1397|      0|    }
 1398|  1.22k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1398:14): [True: 598, False: 627]
  ------------------
 1399|    598|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1399:9): [True: 0, False: 598]
  ------------------
 1400|      0|      return base64::compress_decode_base64<true, true, false>(
 1401|      0|          output, input, length, options, last_chunk_options);
 1402|    598|    } else {
 1403|    598|      return base64::compress_decode_base64<true, false, false>(
 1404|    598|          output, input, length, options, last_chunk_options);
 1405|    598|    }
 1406|    627|  } else {
 1407|    627|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1407:9): [True: 0, False: 627]
  ------------------
 1408|      0|      return base64::compress_decode_base64<false, true, false>(
 1409|      0|          output, input, length, options, last_chunk_options);
 1410|    627|    } else {
 1411|    627|      return base64::compress_decode_base64<false, false, false>(
 1412|    627|          output, input, length, options, last_chunk_options);
 1413|    627|    }
 1414|    627|  }
 1415|  1.22k|}

simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block64C2EPKc:
  408|   456k|  simdutf_really_inline block64(const char *src) {
  409|   456k|    chunks[0] = _mm_loadu_si128(reinterpret_cast<const __m128i *>(src));
  410|   456k|    chunks[1] = _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 16));
  411|   456k|    chunks[2] = _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 32));
  412|   456k|    chunks[3] = _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 48));
  413|   456k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6414compress_blockEmPc:
  449|   169k|  simdutf_really_inline uint64_t compress_block(uint64_t mask, char *output) {
  450|   169k|    if (is_power_of_two(mask)) {
  ------------------
  |  Branch (450:9): [True: 125k, False: 43.7k]
  ------------------
  451|   125k|      return compress_block_single(mask, output);
  452|   125k|    }
  453|       |
  454|  43.7k|    uint64_t nmask = ~mask;
  455|  43.7k|    compress(chunks[0], uint16_t(mask), output);
  456|  43.7k|    compress(chunks[1], uint16_t(mask >> 16),
  457|  43.7k|             output + count_ones(nmask & 0xFFFF));
  458|  43.7k|    compress(chunks[2], uint16_t(mask >> 32),
  459|  43.7k|             output + count_ones(nmask & 0xFFFFFFFF));
  460|  43.7k|    compress(chunks[3], uint16_t(mask >> 48),
  461|  43.7k|             output + count_ones(nmask & 0xFFFFFFFFFFFFULL));
  462|  43.7k|    return count_ones(nmask);
  463|   169k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6421compress_block_singleEmPc:
  467|   125k|                                                     char *output) {
  468|   125k|    const size_t pos64 = trailing_zeroes(mask);
  469|   125k|    const int8_t pos = pos64 & 0xf;
  470|   125k|    switch (pos64 >> 4) {
  ------------------
  |  Branch (470:13): [True: 125k, False: 0]
  ------------------
  471|  31.0k|    case 0b00: {
  ------------------
  |  Branch (471:5): [True: 31.0k, False: 94.8k]
  ------------------
  472|  31.0k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  473|  31.0k|      const __m128i v1 =
  474|  31.0k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  475|  31.0k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  476|  31.0k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  477|  31.0k|      const __m128i compressed = _mm_shuffle_epi8(chunks[0], sh);
  478|       |
  479|  31.0k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), compressed);
  480|  31.0k|      _mm_storeu_si128((__m128i *)(output + 1 * 16 - 1), chunks[1]);
  481|  31.0k|      _mm_storeu_si128((__m128i *)(output + 2 * 16 - 1), chunks[2]);
  482|  31.0k|      _mm_storeu_si128((__m128i *)(output + 3 * 16 - 1), chunks[3]);
  483|  31.0k|    } break;
  484|  30.6k|    case 0b01: {
  ------------------
  |  Branch (484:5): [True: 30.6k, False: 95.1k]
  ------------------
  485|  30.6k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), chunks[0]);
  486|       |
  487|  30.6k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  488|  30.6k|      const __m128i v1 =
  489|  30.6k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  490|  30.6k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  491|  30.6k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  492|  30.6k|      const __m128i compressed = _mm_shuffle_epi8(chunks[1], sh);
  493|       |
  494|  30.6k|      _mm_storeu_si128((__m128i *)(output + 1 * 16), compressed);
  495|  30.6k|      _mm_storeu_si128((__m128i *)(output + 2 * 16 - 1), chunks[2]);
  496|  30.6k|      _mm_storeu_si128((__m128i *)(output + 3 * 16 - 1), chunks[3]);
  497|  30.6k|    } break;
  498|  32.6k|    case 0b10: {
  ------------------
  |  Branch (498:5): [True: 32.6k, False: 93.2k]
  ------------------
  499|  32.6k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), chunks[0]);
  500|  32.6k|      _mm_storeu_si128((__m128i *)(output + 1 * 16), chunks[1]);
  501|       |
  502|  32.6k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  503|  32.6k|      const __m128i v1 =
  504|  32.6k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  505|  32.6k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  506|  32.6k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  507|  32.6k|      const __m128i compressed = _mm_shuffle_epi8(chunks[2], sh);
  508|       |
  509|  32.6k|      _mm_storeu_si128((__m128i *)(output + 2 * 16), compressed);
  510|  32.6k|      _mm_storeu_si128((__m128i *)(output + 3 * 16 - 1), chunks[3]);
  511|  32.6k|    } break;
  512|  31.5k|    case 0b11: {
  ------------------
  |  Branch (512:5): [True: 31.5k, False: 94.3k]
  ------------------
  513|  31.5k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), chunks[0]);
  514|  31.5k|      _mm_storeu_si128((__m128i *)(output + 1 * 16), chunks[1]);
  515|  31.5k|      _mm_storeu_si128((__m128i *)(output + 2 * 16), chunks[2]);
  516|       |
  517|  31.5k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  518|  31.5k|      const __m128i v1 =
  519|  31.5k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  520|  31.5k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  521|  31.5k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  522|  31.5k|      const __m128i compressed = _mm_shuffle_epi8(chunks[3], sh);
  523|       |
  524|  31.5k|      _mm_storeu_si128((__m128i *)(output + 3 * 16), compressed);
  525|  31.5k|    } break;
  526|   125k|    }
  527|       |
  528|   125k|    return 63;
  529|   125k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_18compressEDv2_xtPc:
  329|   174k|                                           char *output) {
  330|   174k|  if (mask == 0) {
  ------------------
  |  Branch (330:7): [True: 86.4k, False: 88.4k]
  ------------------
  331|  86.4k|    _mm_storeu_si128(reinterpret_cast<__m128i *>(output), data);
  332|  86.4k|    return;
  333|  86.4k|  }
  334|       |
  335|       |  // this particular implementation was inspired by work done by @animetosho
  336|       |  // we do it in two steps, first 8 bytes and then second 8 bytes
  337|  88.4k|  uint8_t mask1 = uint8_t(mask);      // least significant 8 bits
  338|  88.4k|  uint8_t mask2 = uint8_t(mask >> 8); // most significant 8 bits
  339|       |  // next line just loads the 64-bit values thintable_epi8[mask1] and
  340|       |  // thintable_epi8[mask2] into a 128-bit register, using only
  341|       |  // two instructions on most compilers.
  342|       |
  343|  88.4k|  __m128i shufmask = _mm_set_epi64x(tables::base64::thintable_epi8[mask2],
  344|  88.4k|                                    tables::base64::thintable_epi8[mask1]);
  345|       |  // we increment by 0x08 the second half of the mask
  346|  88.4k|  shufmask =
  347|  88.4k|      _mm_add_epi8(shufmask, _mm_set_epi32(0x08080808, 0x08080808, 0, 0));
  348|       |  // this is the version "nearly pruned"
  349|  88.4k|  __m128i pruned = _mm_shuffle_epi8(data, shufmask);
  350|       |  // we still need to put the two halves together.
  351|       |  // we compute the popcount of the first half:
  352|  88.4k|  int pop1 = tables::base64::BitsSetTable256mul2[mask1];
  353|       |  // then load the corresponding mask, what it does is to write
  354|       |  // only the first pop1 bytes from the first 8 bytes, and then
  355|       |  // it fills in with the bytes from the second 8 bytes + some filling
  356|       |  // at the end.
  357|  88.4k|  __m128i compactmask = _mm_loadu_si128(reinterpret_cast<const __m128i *>(
  358|  88.4k|      tables::base64::pshufb_combine_table + pop1 * 8));
  359|  88.4k|  __m128i answer = _mm_shuffle_epi8(pruned, compactmask);
  360|  88.4k|  _mm_storeu_si128(reinterpret_cast<__m128i *>(output), answer);
  361|  88.4k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6410copy_blockEPc:
  441|   264k|  simdutf_really_inline void copy_block(char *output) {
  442|   264k|    _mm_storeu_si128(reinterpret_cast<__m128i *>(output), chunks[0]);
  443|   264k|    _mm_storeu_si128(reinterpret_cast<__m128i *>(output + 16), chunks[1]);
  444|   264k|    _mm_storeu_si128(reinterpret_cast<__m128i *>(output + 32), chunks[2]);
  445|   264k|    _mm_storeu_si128(reinterpret_cast<__m128i *>(output + 48), chunks[3]);
  446|   264k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6424base64_decode_block_safeEPc:
  659|     32|  simdutf_really_inline void base64_decode_block_safe(char *out) {
  660|     32|    base64_decode(out, chunks[0]);
  661|     32|    base64_decode(out + 12, chunks[1]);
  662|     32|    base64_decode(out + 24, chunks[2]);
  663|     32|    char buffer[16];
  664|     32|    base64_decode(buffer, chunks[3]);
  665|     32|    std::memcpy(out + 36, buffer, 12);
  666|     32|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_113base64_decodeEPcDv2_x:
  363|  2.16M|static simdutf_really_inline void base64_decode(char *out, __m128i str) {
  364|       |  // credit: aqrit
  365|       |
  366|  2.16M|  const __m128i pack_shuffle =
  367|  2.16M|      _mm_setr_epi8(2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1);
  368|       |
  369|  2.16M|  const __m128i t0 = _mm_maddubs_epi16(str, _mm_set1_epi32(0x01400140));
  370|  2.16M|  const __m128i t1 = _mm_madd_epi16(t0, _mm_set1_epi32(0x00011000));
  371|  2.16M|  const __m128i t2 = _mm_shuffle_epi8(t1, pack_shuffle);
  372|       |  // Store the output:
  373|       |  // this writes 16 bytes, but we only need 12.
  374|  2.16M|  _mm_storeu_si128((__m128i *)out, t2);
  375|  2.16M|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6419base64_decode_blockEPc:
  651|   115k|  simdutf_really_inline void base64_decode_block(char *out) {
  652|   115k|    base64_decode(out, chunks[0]);
  653|   115k|    base64_decode(out + 12, chunks[1]);
  654|   115k|    base64_decode(out + 24, chunks[2]);
  655|   115k|    base64_decode(out + 36, chunks[3]);
  656|   115k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_119base64_decode_blockEPcPKc:
  378|   424k|static inline void base64_decode_block(char *out, const char *src) {
  379|   424k|  base64_decode(out, _mm_loadu_si128(reinterpret_cast<const __m128i *>(src)));
  380|   424k|  base64_decode(out + 12,
  381|   424k|                _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 16)));
  382|   424k|  base64_decode(out + 24,
  383|   424k|                _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 32)));
  384|   424k|  base64_decode(out + 36,
  385|   424k|                _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 48)));
  386|   424k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_124base64_decode_block_safeEPcPKc:
  388|    130|static inline void base64_decode_block_safe(char *out, const char *src) {
  389|    130|  base64_decode(out, _mm_loadu_si128(reinterpret_cast<const __m128i *>(src)));
  390|    130|  base64_decode(out + 12,
  391|    130|                _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 16)));
  392|    130|  base64_decode(out + 24,
  393|    130|                _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 32)));
  394|    130|  char buffer[16];
  395|    130|  base64_decode(buffer,
  396|    130|                _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 48)));
  397|    130|  std::memcpy(out + 36, buffer, 12);
  398|    130|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6414to_base64_maskILb1ELb0ELb0EEEmPm:
  533|   115k|  simdutf_really_inline uint64_t to_base64_mask(uint64_t *error) {
  534|   115k|    uint32_t err0 = 0;
  535|   115k|    uint32_t err1 = 0;
  536|   115k|    uint32_t err2 = 0;
  537|   115k|    uint32_t err3 = 0;
  538|   115k|    uint64_t m0 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  539|   115k|        &chunks[0], &err0);
  540|   115k|    uint64_t m1 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  541|   115k|        &chunks[1], &err1);
  542|   115k|    uint64_t m2 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  543|   115k|        &chunks[2], &err2);
  544|   115k|    uint64_t m3 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  545|   115k|        &chunks[3], &err3);
  546|   115k|    if (!ignore_garbage) {
  ------------------
  |  Branch (546:9): [True: 115k, Folded]
  ------------------
  547|   115k|      *error = (err0) | ((uint64_t)err1 << 16) | ((uint64_t)err2 << 32) |
  548|   115k|               ((uint64_t)err3 << 48);
  549|   115k|    }
  550|   115k|    return m0 | (m1 << 16) | (m2 << 32) | (m3 << 48);
  551|   115k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6414to_base64_maskILb1ELb0ELb0EEEtPDv2_xPj:
  555|   461k|  simdutf_really_inline uint16_t to_base64_mask(__m128i *src, uint32_t *error) {
  556|   461k|    const __m128i ascii_space_tbl =
  557|   461k|        _mm_setr_epi8(0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0xa,
  558|   461k|                      0x0, 0xc, 0xd, 0x0, 0x0);
  559|       |    // credit: aqrit
  560|   461k|    __m128i delta_asso;
  561|   461k|    if (default_or_url) {
  ------------------
  |  Branch (561:9): [Folded, False: 461k]
  ------------------
  562|      0|      delta_asso =
  563|      0|          _mm_setr_epi8(0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
  564|      0|                        0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x16);
  565|   461k|    } else if (base64_url) {
  ------------------
  |  Branch (565:16): [True: 461k, Folded]
  ------------------
  566|   461k|      delta_asso = _mm_setr_epi8(0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0,
  567|   461k|                                 0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0xF);
  568|   461k|    } else {
  569|      0|      delta_asso =
  570|      0|          _mm_setr_epi8(0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
  571|      0|                        0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x0F);
  572|      0|    }
  573|   461k|    __m128i delta_values;
  574|   461k|    if (default_or_url) {
  ------------------
  |  Branch (574:9): [Folded, False: 461k]
  ------------------
  575|      0|      delta_values = _mm_setr_epi8(
  576|      0|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0x13),
  577|      0|          uint8_t(0x04), uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  578|      0|          uint8_t(0xB9), uint8_t(0x00), uint8_t(0xFF), uint8_t(0x11),
  579|      0|          uint8_t(0xFF), uint8_t(0xBF), uint8_t(0x10), uint8_t(0xB9));
  580|       |
  581|   461k|    } else if (base64_url) {
  ------------------
  |  Branch (581:16): [True: 461k, Folded]
  ------------------
  582|   461k|      delta_values = _mm_setr_epi8(0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF),
  583|   461k|                                   uint8_t(0xBF), uint8_t(0xB9), uint8_t(0xB9),
  584|   461k|                                   0x0, 0x11, uint8_t(0xC3), uint8_t(0xBF),
  585|   461k|                                   uint8_t(0xE0), uint8_t(0xB9), uint8_t(0xB9));
  586|   461k|    } else {
  587|      0|      delta_values =
  588|      0|          _mm_setr_epi8(int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13),
  589|      0|                        int8_t(0x04), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9),
  590|      0|                        int8_t(0xB9), int8_t(0x00), int8_t(0x10), int8_t(0xC3),
  591|      0|                        int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9));
  592|      0|    }
  593|   461k|    __m128i check_asso;
  594|   461k|    if (default_or_url) {
  ------------------
  |  Branch (594:9): [Folded, False: 461k]
  ------------------
  595|      0|      check_asso =
  596|      0|          _mm_setr_epi8(0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  597|      0|                        0x01, 0x03, 0x07, 0x0B, 0x0E, 0x0B, 0x06);
  598|   461k|    } else if (base64_url) {
  ------------------
  |  Branch (598:16): [True: 461k, Folded]
  ------------------
  599|   461k|      check_asso = _mm_setr_epi8(0xD, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
  600|   461k|                                 0x1, 0x3, 0x7, 0xB, 0xE, 0xB, 0x6);
  601|   461k|    } else {
  602|      0|      check_asso =
  603|      0|          _mm_setr_epi8(0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  604|      0|                        0x01, 0x03, 0x07, 0x0B, 0x0B, 0x0B, 0x0F);
  605|      0|    }
  606|   461k|    __m128i check_values;
  607|   461k|    if (default_or_url) {
  ------------------
  |  Branch (607:9): [Folded, False: 461k]
  ------------------
  608|      0|      check_values = _mm_setr_epi8(
  609|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  610|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xD5), uint8_t(0xA6),
  611|      0|          uint8_t(0xB5), uint8_t(0xA1), uint8_t(0x00), uint8_t(0x80),
  612|      0|          uint8_t(0x00), uint8_t(0x80), uint8_t(0x00), uint8_t(0x80));
  613|   461k|    } else if (base64_url) {
  ------------------
  |  Branch (613:16): [True: 461k, Folded]
  ------------------
  614|   461k|      check_values = _mm_setr_epi8(uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  615|   461k|                                   uint8_t(0x80), uint8_t(0xCF), uint8_t(0xBF),
  616|   461k|                                   uint8_t(0xB6), uint8_t(0xA6), uint8_t(0xB5),
  617|   461k|                                   uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0,
  618|   461k|                                   uint8_t(0x80), 0x0, uint8_t(0x80));
  619|   461k|    } else {
  620|      0|      check_values =
  621|      0|          _mm_setr_epi8(int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80),
  622|      0|                        int8_t(0xCF), int8_t(0xBF), int8_t(0xD5), int8_t(0xA6),
  623|      0|                        int8_t(0xB5), int8_t(0x86), int8_t(0xD1), int8_t(0x80),
  624|      0|                        int8_t(0xB1), int8_t(0x80), int8_t(0x91), int8_t(0x80));
  625|      0|    }
  626|   461k|    const __m128i shifted = _mm_srli_epi32(*src, 3);
  627|       |
  628|   461k|    __m128i delta_hash =
  629|   461k|        _mm_avg_epu8(_mm_shuffle_epi8(delta_asso, *src), shifted);
  630|   461k|    if (default_or_url) {
  ------------------
  |  Branch (630:9): [Folded, False: 461k]
  ------------------
  631|      0|      delta_hash = _mm_and_si128(delta_hash, _mm_set1_epi8(0xf));
  632|      0|    }
  633|   461k|    const __m128i check_hash =
  634|   461k|        _mm_avg_epu8(_mm_shuffle_epi8(check_asso, *src), shifted);
  635|       |
  636|   461k|    const __m128i out =
  637|   461k|        _mm_adds_epi8(_mm_shuffle_epi8(delta_values, delta_hash), *src);
  638|   461k|    const __m128i chk =
  639|   461k|        _mm_adds_epi8(_mm_shuffle_epi8(check_values, check_hash), *src);
  640|   461k|    const int mask = _mm_movemask_epi8(chk);
  641|   461k|    if (!ignore_garbage && mask) {
  ------------------
  |  Branch (641:9): [True: 461k, Folded]
  |  Branch (641:28): [True: 68.1k, False: 393k]
  ------------------
  642|  68.1k|      __m128i ascii_space =
  643|  68.1k|          _mm_cmpeq_epi8(_mm_shuffle_epi8(ascii_space_tbl, *src), *src);
  644|  68.1k|      *error = (mask ^ _mm_movemask_epi8(ascii_space));
  645|  68.1k|    }
  646|   461k|    *src = out;
  647|   461k|    return (uint16_t)mask;
  648|   461k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6414to_base64_maskILb0ELb0ELb0EEEmPm:
  533|   436k|  simdutf_really_inline uint64_t to_base64_mask(uint64_t *error) {
  534|   436k|    uint32_t err0 = 0;
  535|   436k|    uint32_t err1 = 0;
  536|   436k|    uint32_t err2 = 0;
  537|   436k|    uint32_t err3 = 0;
  538|   436k|    uint64_t m0 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  539|   436k|        &chunks[0], &err0);
  540|   436k|    uint64_t m1 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  541|   436k|        &chunks[1], &err1);
  542|   436k|    uint64_t m2 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  543|   436k|        &chunks[2], &err2);
  544|   436k|    uint64_t m3 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  545|   436k|        &chunks[3], &err3);
  546|   436k|    if (!ignore_garbage) {
  ------------------
  |  Branch (546:9): [True: 436k, Folded]
  ------------------
  547|   436k|      *error = (err0) | ((uint64_t)err1 << 16) | ((uint64_t)err2 << 32) |
  548|   436k|               ((uint64_t)err3 << 48);
  549|   436k|    }
  550|   436k|    return m0 | (m1 << 16) | (m2 << 32) | (m3 << 48);
  551|   436k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6414to_base64_maskILb0ELb0ELb0EEEtPDv2_xPj:
  555|  1.74M|  simdutf_really_inline uint16_t to_base64_mask(__m128i *src, uint32_t *error) {
  556|  1.74M|    const __m128i ascii_space_tbl =
  557|  1.74M|        _mm_setr_epi8(0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0xa,
  558|  1.74M|                      0x0, 0xc, 0xd, 0x0, 0x0);
  559|       |    // credit: aqrit
  560|  1.74M|    __m128i delta_asso;
  561|  1.74M|    if (default_or_url) {
  ------------------
  |  Branch (561:9): [Folded, False: 1.74M]
  ------------------
  562|      0|      delta_asso =
  563|      0|          _mm_setr_epi8(0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
  564|      0|                        0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x16);
  565|  1.74M|    } else if (base64_url) {
  ------------------
  |  Branch (565:16): [Folded, False: 1.74M]
  ------------------
  566|      0|      delta_asso = _mm_setr_epi8(0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0,
  567|      0|                                 0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0xF);
  568|  1.74M|    } else {
  569|  1.74M|      delta_asso =
  570|  1.74M|          _mm_setr_epi8(0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
  571|  1.74M|                        0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x0F);
  572|  1.74M|    }
  573|  1.74M|    __m128i delta_values;
  574|  1.74M|    if (default_or_url) {
  ------------------
  |  Branch (574:9): [Folded, False: 1.74M]
  ------------------
  575|      0|      delta_values = _mm_setr_epi8(
  576|      0|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0x13),
  577|      0|          uint8_t(0x04), uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  578|      0|          uint8_t(0xB9), uint8_t(0x00), uint8_t(0xFF), uint8_t(0x11),
  579|      0|          uint8_t(0xFF), uint8_t(0xBF), uint8_t(0x10), uint8_t(0xB9));
  580|       |
  581|  1.74M|    } else if (base64_url) {
  ------------------
  |  Branch (581:16): [Folded, False: 1.74M]
  ------------------
  582|      0|      delta_values = _mm_setr_epi8(0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF),
  583|      0|                                   uint8_t(0xBF), uint8_t(0xB9), uint8_t(0xB9),
  584|      0|                                   0x0, 0x11, uint8_t(0xC3), uint8_t(0xBF),
  585|      0|                                   uint8_t(0xE0), uint8_t(0xB9), uint8_t(0xB9));
  586|  1.74M|    } else {
  587|  1.74M|      delta_values =
  588|  1.74M|          _mm_setr_epi8(int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13),
  589|  1.74M|                        int8_t(0x04), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9),
  590|  1.74M|                        int8_t(0xB9), int8_t(0x00), int8_t(0x10), int8_t(0xC3),
  591|  1.74M|                        int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9));
  592|  1.74M|    }
  593|  1.74M|    __m128i check_asso;
  594|  1.74M|    if (default_or_url) {
  ------------------
  |  Branch (594:9): [Folded, False: 1.74M]
  ------------------
  595|      0|      check_asso =
  596|      0|          _mm_setr_epi8(0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  597|      0|                        0x01, 0x03, 0x07, 0x0B, 0x0E, 0x0B, 0x06);
  598|  1.74M|    } else if (base64_url) {
  ------------------
  |  Branch (598:16): [Folded, False: 1.74M]
  ------------------
  599|      0|      check_asso = _mm_setr_epi8(0xD, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
  600|      0|                                 0x1, 0x3, 0x7, 0xB, 0xE, 0xB, 0x6);
  601|  1.74M|    } else {
  602|  1.74M|      check_asso =
  603|  1.74M|          _mm_setr_epi8(0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  604|  1.74M|                        0x01, 0x03, 0x07, 0x0B, 0x0B, 0x0B, 0x0F);
  605|  1.74M|    }
  606|  1.74M|    __m128i check_values;
  607|  1.74M|    if (default_or_url) {
  ------------------
  |  Branch (607:9): [Folded, False: 1.74M]
  ------------------
  608|      0|      check_values = _mm_setr_epi8(
  609|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  610|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xD5), uint8_t(0xA6),
  611|      0|          uint8_t(0xB5), uint8_t(0xA1), uint8_t(0x00), uint8_t(0x80),
  612|      0|          uint8_t(0x00), uint8_t(0x80), uint8_t(0x00), uint8_t(0x80));
  613|  1.74M|    } else if (base64_url) {
  ------------------
  |  Branch (613:16): [Folded, False: 1.74M]
  ------------------
  614|      0|      check_values = _mm_setr_epi8(uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  615|      0|                                   uint8_t(0x80), uint8_t(0xCF), uint8_t(0xBF),
  616|      0|                                   uint8_t(0xB6), uint8_t(0xA6), uint8_t(0xB5),
  617|      0|                                   uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0,
  618|      0|                                   uint8_t(0x80), 0x0, uint8_t(0x80));
  619|  1.74M|    } else {
  620|  1.74M|      check_values =
  621|  1.74M|          _mm_setr_epi8(int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80),
  622|  1.74M|                        int8_t(0xCF), int8_t(0xBF), int8_t(0xD5), int8_t(0xA6),
  623|  1.74M|                        int8_t(0xB5), int8_t(0x86), int8_t(0xD1), int8_t(0x80),
  624|  1.74M|                        int8_t(0xB1), int8_t(0x80), int8_t(0x91), int8_t(0x80));
  625|  1.74M|    }
  626|  1.74M|    const __m128i shifted = _mm_srli_epi32(*src, 3);
  627|       |
  628|  1.74M|    __m128i delta_hash =
  629|  1.74M|        _mm_avg_epu8(_mm_shuffle_epi8(delta_asso, *src), shifted);
  630|  1.74M|    if (default_or_url) {
  ------------------
  |  Branch (630:9): [Folded, False: 1.74M]
  ------------------
  631|      0|      delta_hash = _mm_and_si128(delta_hash, _mm_set1_epi8(0xf));
  632|      0|    }
  633|  1.74M|    const __m128i check_hash =
  634|  1.74M|        _mm_avg_epu8(_mm_shuffle_epi8(check_asso, *src), shifted);
  635|       |
  636|  1.74M|    const __m128i out =
  637|  1.74M|        _mm_adds_epi8(_mm_shuffle_epi8(delta_values, delta_hash), *src);
  638|  1.74M|    const __m128i chk =
  639|  1.74M|        _mm_adds_epi8(_mm_shuffle_epi8(check_values, check_hash), *src);
  640|  1.74M|    const int mask = _mm_movemask_epi8(chk);
  641|  1.74M|    if (!ignore_garbage && mask) {
  ------------------
  |  Branch (641:9): [True: 1.74M, Folded]
  |  Branch (641:28): [True: 150k, False: 1.59M]
  ------------------
  642|   150k|      __m128i ascii_space =
  643|   150k|          _mm_cmpeq_epi8(_mm_shuffle_epi8(ascii_space_tbl, *src), *src);
  644|   150k|      *error = (mask ^ _mm_movemask_epi8(ascii_space));
  645|   150k|    }
  646|  1.74M|    *src = out;
  647|  1.74M|    return (uint16_t)mask;
  648|  1.74M|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block64C2EPKDs:
  419|  95.4k|  simdutf_really_inline block64(const char16_t *src) {
  420|  95.4k|    const auto m1 = _mm_loadu_si128(reinterpret_cast<const __m128i *>(src));
  421|  95.4k|    const auto m2 = _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 8));
  422|  95.4k|    const auto m3 =
  423|  95.4k|        _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 16));
  424|  95.4k|    const auto m4 =
  425|  95.4k|        _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 24));
  426|  95.4k|    const auto m5 =
  427|  95.4k|        _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 32));
  428|  95.4k|    const auto m6 =
  429|  95.4k|        _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 40));
  430|  95.4k|    const auto m7 =
  431|  95.4k|        _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 48));
  432|  95.4k|    const auto m8 =
  433|  95.4k|        _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 56));
  434|  95.4k|    chunks[0] = _mm_packus_epi16(m1, m2);
  435|  95.4k|    chunks[1] = _mm_packus_epi16(m3, m4);
  436|  95.4k|    chunks[2] = _mm_packus_epi16(m5, m6);
  437|  95.4k|    chunks[3] = _mm_packus_epi16(m7, m8);
  438|  95.4k|  }

_ZNK7simdutf11full_resultcvNS_6resultEEv:
  117|  14.7k|  simdutf_really_inline simdutf_constexpr23 operator result() const noexcept {
  118|  14.7k|    if (error == error_code::SUCCESS) {
  ------------------
  |  Branch (118:9): [True: 7.66k, False: 7.08k]
  ------------------
  119|  7.66k|      return result{error, output_count};
  120|  7.66k|    } else {
  121|  7.08k|      return result{error, input_count};
  122|  7.08k|    }
  123|  14.7k|  }
_ZN7simdutf6resultC2ENS_10error_codeEm:
   87|  14.7k|      : error{err}, count{pos} {}

