LLVMFuzzerTestOneInput:
  164|  2.49k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  165|  2.49k|  constexpr auto optionbytes = 4u;
  166|  2.49k|  static_assert(optionbytes % 2 == 0,
  167|  2.49k|                "optionbytes must be even to avoid misaligned char16 pointers");
  168|  2.49k|  if (size < optionbytes) {
  ------------------
  |  Branch (168:7): [True: 2, False: 2.49k]
  ------------------
  169|      2|    return 0;
  170|      2|  }
  171|       |
  172|  2.49k|  constexpr auto Ncases = 2u;
  173|  2.49k|  constexpr auto actionmask = std::bit_ceil(Ncases) - 1;
  174|  2.49k|  const auto action = data[0] & actionmask;
  175|       |
  176|  2.49k|  const auto opt = [](auto index) {
  177|  2.49k|    if (index >= options.size()) {
  178|  2.49k|      return options[0];
  179|  2.49k|    }
  180|  2.49k|    return options[index];
  181|  2.49k|  }(data[1] & (std::bit_ceil(options.size()) - 1));
  182|       |
  183|  2.49k|  const auto lco =
  184|  2.49k|      (opt == simdutf::base64_url || opt == simdutf::base64_default_no_padding)
  ------------------
  |  Branch (184:8): [True: 253, False: 2.24k]
  |  Branch (184:38): [True: 244, False: 1.99k]
  ------------------
  185|  2.49k|          ? simdutf::last_chunk_handling_options::loose
  186|  2.49k|          : [](auto index) {
  187|  1.99k|              if (index >= last_chunk.size()) {
  188|  1.99k|                return last_chunk[0];
  189|  1.99k|              }
  190|  1.99k|              return last_chunk[index];
  191|  1.99k|            }(data[2] & (std::bit_ceil(last_chunk.size()) - 1));
  192|       |
  193|       |  // data[3] reserved for future use / alignment.
  194|       |
  195|  2.49k|  data += optionbytes;
  196|  2.49k|  size -= optionbytes;
  197|       |
  198|  2.49k|  switch (action) {
  ------------------
  |  Branch (198:11): [True: 2.49k, False: 0]
  ------------------
  199|  1.25k|  case 0: {
  ------------------
  |  Branch (199:3): [True: 1.25k, False: 1.23k]
  ------------------
  200|  1.25k|    const std::span<const char> chardata{reinterpret_cast<const char*>(data),
  201|  1.25k|                                         size};
  202|  1.25k|    test_details(chardata, opt, lco);
  203|  1.25k|  } break;
  204|  1.23k|  case 1: {
  ------------------
  |  Branch (204:3): [True: 1.23k, False: 1.25k]
  ------------------
  205|  1.23k|    const std::span<const char16_t> chardata{
  206|  1.23k|        reinterpret_cast<const char16_t*>(data), size / sizeof(char16_t)};
  207|  1.23k|    test_details(chardata, opt, lco);
  208|  1.23k|  } break;
  209|  2.49k|  }
  210|       |
  211|  2.49k|  return 0;
  212|  2.49k|}
base64_details.cpp:_ZZ22LLVMFuzzerTestOneInputENK3$_0clImEEDaT_:
  176|  2.49k|  const auto opt = [](auto index) {
  177|  2.49k|    if (index >= options.size()) {
  ------------------
  |  Branch (177:9): [True: 0, False: 2.49k]
  ------------------
  178|      0|      return options[0];
  179|      0|    }
  180|  2.49k|    return options[index];
  181|  2.49k|  }(data[1] & (std::bit_ceil(options.size()) - 1));
base64_details.cpp:_ZZ22LLVMFuzzerTestOneInputENK3$_1clImEEDaT_:
  186|  1.99k|          : [](auto index) {
  187|  1.99k|              if (index >= last_chunk.size()) {
  ------------------
  |  Branch (187:19): [True: 184, False: 1.81k]
  ------------------
  188|    184|                return last_chunk[0];
  189|    184|              }
  190|  1.81k|              return last_chunk[index];
  191|  1.99k|            }(data[2] & (std::bit_ceil(last_chunk.size()) - 1));
base64_details.cpp:_ZL12test_detailsIcEvNSt3__14spanIKT_Lm18446744073709551615EEEN7simdutf14base64_optionsENS5_27last_chunk_handling_optionsE:
   57|  1.25k|                         simdutf::last_chunk_handling_options lco) {
   58|  1.25k|  const auto implementations = get_supported_implementations();
   59|  1.25k|  if (implementations.empty()) {
  ------------------
  |  Branch (59:7): [True: 0, False: 1.25k]
  ------------------
   60|      0|    return;
   61|      0|  }
   62|       |
   63|  1.25k|  std::vector<comparable_full_result> results;
   64|  1.25k|  results.reserve(implementations.size());
   65|       |
   66|  3.76k|  for (auto impl : implementations) {
  ------------------
  |  Branch (66:18): [True: 3.76k, False: 1.25k]
  ------------------
   67|       |    // Use a fresh buffer for base64_to_binary_details.
   68|  3.76k|    const std::size_t maxbinary =
   69|  3.76k|        impl->maximal_binary_length_from_base64(input.data(), input.size());
   70|  3.76k|    std::vector<char> out_details(maxbinary);
   71|       |
   72|  3.76k|    const simdutf::full_result fr = impl->base64_to_binary_details(
   73|  3.76k|        input.data(), input.size(), out_details.data(), opt, lco);
   74|       |
   75|       |    // Bounds checks.
   76|  3.76k|    if (fr.input_count > input.size()) {
  ------------------
  |  Branch (76:9): [True: 0, False: 3.76k]
  ------------------
   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.76k|    if (fr.output_count > maxbinary) {
  ------------------
  |  Branch (82:9): [True: 0, False: 3.76k]
  ------------------
   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.76k|    std::vector<char> out_plain(maxbinary);
   92|  3.76k|    const simdutf::result r = impl->base64_to_binary(
   93|  3.76k|        input.data(), input.size(), out_plain.data(), opt, lco);
   94|  3.76k|    const simdutf::result r_from_fr = static_cast<simdutf::result>(fr);
   95|       |
   96|  3.76k|    if (r != r_from_fr) {
  ------------------
  |  Branch (96:9): [True: 0, False: 3.76k]
  ------------------
   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.76k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (107:9): [True: 2.16k, False: 1.59k]
  ------------------
  108|  2.16k|      if (fr.output_count != r.count) {
  ------------------
  |  Branch (108:11): [True: 0, False: 2.16k]
  ------------------
  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.16k|      const auto span_details =
  115|  2.16k|          std::span(out_details).subspan(0, fr.output_count);
  116|  2.16k|      const auto span_plain = std::span(out_plain).subspan(0, r.count);
  117|  2.16k|      if (!std::ranges::equal(span_details, span_plain)) {
  ------------------
  |  Branch (117:11): [True: 0, False: 2.16k]
  ------------------
  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.16k|    }
  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.76k|    comparable_full_result cfr;
  140|  3.76k|    cfr.error = fr.error;
  141|  3.76k|    cfr.padding_error = fr.padding_error;
  142|  3.76k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (142:9): [True: 2.16k, False: 1.59k]
  ------------------
  143|  2.16k|      cfr.output_count = fr.output_count;
  144|  2.16k|      cfr.output_hash = FNV1A_hash::as_str(
  145|  2.16k|          std::span(out_details).subspan(0, fr.output_count));
  146|  2.16k|    } else {
  147|  1.59k|      cfr.input_count = fr.input_count;
  148|  1.59k|    }
  149|  3.76k|    results.push_back(std::move(cfr));
  150|  3.76k|  }
  151|       |
  152|       |  // All implementations must agree on the full_result.
  153|  1.25k|  auto neq = [](const auto& a, const auto& b) { return a != b; };
  154|  1.25k|  if (std::ranges::adjacent_find(results, neq) != results.end()) {
  ------------------
  |  Branch (154:7): [True: 0, False: 1.25k]
  ------------------
  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.25k|}
base64_details.cpp:_ZZL12test_detailsIcEvNSt3__14spanIKT_Lm18446744073709551615EEEN7simdutf14base64_optionsENS5_27last_chunk_handling_optionsEENKUlRS3_RKT0_E_clI22comparable_full_resultSE_EEDaS8_SB_:
  153|  2.50k|  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.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.71k|  for (auto impl : implementations) {
  ------------------
  |  Branch (66:18): [True: 3.71k, False: 1.23k]
  ------------------
   67|       |    // Use a fresh buffer for base64_to_binary_details.
   68|  3.71k|    const std::size_t maxbinary =
   69|  3.71k|        impl->maximal_binary_length_from_base64(input.data(), input.size());
   70|  3.71k|    std::vector<char> out_details(maxbinary);
   71|       |
   72|  3.71k|    const simdutf::full_result fr = impl->base64_to_binary_details(
   73|  3.71k|        input.data(), input.size(), out_details.data(), opt, lco);
   74|       |
   75|       |    // Bounds checks.
   76|  3.71k|    if (fr.input_count > input.size()) {
  ------------------
  |  Branch (76:9): [True: 0, False: 3.71k]
  ------------------
   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.71k|    if (fr.output_count > maxbinary) {
  ------------------
  |  Branch (82:9): [True: 0, False: 3.71k]
  ------------------
   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.71k|    std::vector<char> out_plain(maxbinary);
   92|  3.71k|    const simdutf::result r = impl->base64_to_binary(
   93|  3.71k|        input.data(), input.size(), out_plain.data(), opt, lco);
   94|  3.71k|    const simdutf::result r_from_fr = static_cast<simdutf::result>(fr);
   95|       |
   96|  3.71k|    if (r != r_from_fr) {
  ------------------
  |  Branch (96:9): [True: 0, False: 3.71k]
  ------------------
   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.71k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (107:9): [True: 1.71k, False: 2.00k]
  ------------------
  108|  1.71k|      if (fr.output_count != r.count) {
  ------------------
  |  Branch (108:11): [True: 0, False: 1.71k]
  ------------------
  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.71k|      const auto span_details =
  115|  1.71k|          std::span(out_details).subspan(0, fr.output_count);
  116|  1.71k|      const auto span_plain = std::span(out_plain).subspan(0, r.count);
  117|  1.71k|      if (!std::ranges::equal(span_details, span_plain)) {
  ------------------
  |  Branch (117:11): [True: 0, False: 1.71k]
  ------------------
  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.71k|    }
  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.71k|    comparable_full_result cfr;
  140|  3.71k|    cfr.error = fr.error;
  141|  3.71k|    cfr.padding_error = fr.padding_error;
  142|  3.71k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (142:9): [True: 1.71k, False: 2.00k]
  ------------------
  143|  1.71k|      cfr.output_count = fr.output_count;
  144|  1.71k|      cfr.output_hash = FNV1A_hash::as_str(
  145|  1.71k|          std::span(out_details).subspan(0, fr.output_count));
  146|  2.00k|    } else {
  147|  2.00k|      cfr.input_count = fr.input_count;
  148|  2.00k|    }
  149|  3.71k|    results.push_back(std::move(cfr));
  150|  3.71k|  }
  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_detailsIDsEvNSt3__14spanIKT_Lm18446744073709551615EEEN7simdutf14base64_optionsENS5_27last_chunk_handling_optionsEENKUlRS3_RKT0_E_clI22comparable_full_resultSE_EEDaS8_SB_:
  153|  2.47k|  auto neq = [](const auto& a, const auto& b) { return a != b; };

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

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

_ZN7simdutf10is_partialENS_27last_chunk_handling_optionsE:
 4136|  22.9k|is_partial(last_chunk_handling_options options) {
 4137|  22.9k|  return (options == stop_before_partial) || (options == only_full_chunks);
  ------------------
  |  Branch (4137:10): [True: 12.8k, False: 10.0k]
  |  Branch (4137:46): [True: 0, False: 10.0k]
  ------------------
 4138|  22.9k|}
_ZNK7simdutf14implementation4nameEv:
 5106|      4|  virtual std::string_view name() const noexcept { return _name; }
_ZNK7simdutf14implementation25required_instruction_setsEv:
 5157|      8|  virtual uint32_t required_instruction_sets() const {
 5158|      8|    return _required_instruction_sets;
 5159|      8|  }
_ZN7simdutf14implementationC2EPKcS2_j:
 7043|      4|      : _name(name), _description(description),
 7044|      4|        _required_instruction_sets(required_instruction_sets) {}
_ZN7simdutf8internal29available_implementation_listC2Ev:
 7075|      1|  simdutf_really_inline available_implementation_list() {}
_ZN7simdutf16base64_ignorableEcNS_14base64_optionsE:
 4862|  19.5k|base64_ignorable(char input, base64_options options = base64_default) noexcept {
 4863|  19.5k|  return scalar::base64::is_ignorable(input, options);
 4864|  19.5k|}
_ZN7simdutf16base64_ignorableEDsNS_14base64_optionsE:
 4867|  15.6k|                 base64_options options = base64_default) noexcept {
 4868|  15.6k|  return scalar::base64::is_ignorable(input, options);
 4869|  15.6k|}

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|  25.5M|template <class char_type> simdutf_constexpr23 bool is_eight_byte(char_type c) {
   20|  25.5M|  if constexpr (sizeof(char_type) == 1) {
   21|  25.5M|    return true;
   22|  25.5M|  }
   23|      0|  return uint8_t(c) == c;
   24|  25.5M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6413is_eight_byteIDsEEbT_:
   19|  4.97M|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|  4.97M|  return uint8_t(c) == c;
   24|  4.97M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKcEEmT_m:
  654|  3.76k|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.76k|  size_t padding = 0;
  659|  3.76k|  if (length > 0) {
  ------------------
  |  Branch (659:7): [True: 3.74k, False: 15]
  ------------------
  660|  3.74k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (660:9): [True: 237, False: 3.51k]
  ------------------
  661|    237|      padding++;
  662|    237|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (662:11): [True: 231, False: 6]
  |  Branch (662:25): [True: 60, False: 171]
  ------------------
  663|     60|        padding++;
  664|     60|      }
  665|    237|    }
  666|  3.74k|  }
  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.76k|  size_t actual_length = length - padding;
  686|  3.76k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (686:7): [True: 3.18k, False: 582]
  ------------------
  687|  3.18k|    return actual_length / 4 * 3;
  688|  3.18k|  }
  689|       |  // if we have a valid input, then the remainder must be 2 or 3 adding one or
  690|       |  // two extra bytes.
  691|    582|  return actual_length / 4 * 3 + (actual_length % 4) - 1;
  692|  3.76k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKDsEEmT_m:
  654|  3.71k|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.71k|  size_t padding = 0;
  659|  3.71k|  if (length > 0) {
  ------------------
  |  Branch (659:7): [True: 3.70k, False: 12]
  ------------------
  660|  3.70k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (660:9): [True: 240, False: 3.46k]
  ------------------
  661|    240|      padding++;
  662|    240|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (662:11): [True: 234, False: 6]
  |  Branch (662:25): [True: 33, False: 201]
  ------------------
  663|     33|        padding++;
  664|     33|      }
  665|    240|    }
  666|  3.70k|  }
  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.71k|  size_t actual_length = length - padding;
  686|  3.71k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (686:7): [True: 3.24k, False: 474]
  ------------------
  687|  3.24k|    return actual_length / 4 * 3;
  688|  3.24k|  }
  689|       |  // if we have a valid input, then the remainder must be 2 or 3 adding one or
  690|       |  // two extra bytes.
  691|    474|  return actual_length / 4 * 3 + (actual_length % 4) - 1;
  692|  3.71k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIcEEbT_NS_14base64_optionsE:
   28|  19.5k|                                      simdutf::base64_options options) {
   29|  19.5k|  const uint8_t *to_base64 =
   30|  19.5k|      (options & base64_default_or_url)
  ------------------
  |  Branch (30:7): [True: 0, False: 19.5k]
  ------------------
   31|  19.5k|          ? tables::base64::to_base64_default_or_url_value
   32|  19.5k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (32:14): [True: 11.2k, False: 8.27k]
  ------------------
   33|  19.5k|                                    : tables::base64::to_base64_value);
   34|  19.5k|  const bool ignore_garbage =
   35|  19.5k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (35:7): [True: 0, False: 19.5k]
  ------------------
   36|  19.5k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (36:7): [True: 0, False: 19.5k]
  ------------------
   37|  19.5k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (37:7): [True: 0, False: 19.5k]
  ------------------
   38|  19.5k|  uint8_t code = to_base64[uint8_t(c)];
   39|  19.5k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (39:7): [True: 19.5k, False: 0]
  |  Branch (39:27): [True: 3.05k, False: 16.4k]
  ------------------
   40|  3.05k|    return false;
   41|  3.05k|  }
   42|  16.4k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (42:7): [True: 16.4k, False: 0]
  |  Branch (42:27): [True: 16.4k, False: 0]
  ------------------
   43|  16.4k|    return true;
   44|  16.4k|  }
   45|      0|  return ignore_garbage;
   46|  16.4k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIDsEEbT_NS_14base64_optionsE:
   28|  15.6k|                                      simdutf::base64_options options) {
   29|  15.6k|  const uint8_t *to_base64 =
   30|  15.6k|      (options & base64_default_or_url)
  ------------------
  |  Branch (30:7): [True: 0, False: 15.6k]
  ------------------
   31|  15.6k|          ? tables::base64::to_base64_default_or_url_value
   32|  15.6k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (32:14): [True: 8.39k, False: 7.24k]
  ------------------
   33|  15.6k|                                    : tables::base64::to_base64_value);
   34|  15.6k|  const bool ignore_garbage =
   35|  15.6k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (35:7): [True: 0, False: 15.6k]
  ------------------
   36|  15.6k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (36:7): [True: 0, False: 15.6k]
  ------------------
   37|  15.6k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (37:7): [True: 0, False: 15.6k]
  ------------------
   38|  15.6k|  uint8_t code = to_base64[uint8_t(c)];
   39|  15.6k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (39:7): [True: 15.6k, False: 0]
  |  Branch (39:27): [True: 3.10k, False: 12.5k]
  ------------------
   40|  3.10k|    return false;
   41|  3.10k|  }
   42|  12.5k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (42:7): [True: 12.5k, False: 0]
  |  Branch (42:27): [True: 12.5k, False: 0]
  ------------------
   43|  12.5k|    return true;
   44|  12.5k|  }
   45|      0|  return ignore_garbage;
   46|  12.5k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIcEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  100|  7.52k|                                           simdutf::base64_options options) {
  101|  7.52k|  const uint8_t *to_base64 =
  102|  7.52k|      (options & base64_default_or_url)
  ------------------
  |  Branch (102:7): [True: 0, False: 7.52k]
  ------------------
  103|  7.52k|          ? tables::base64::to_base64_default_or_url_value
  104|  7.52k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (104:14): [True: 3.55k, False: 3.96k]
  ------------------
  105|  7.52k|                                    : tables::base64::to_base64_value);
  106|  7.52k|  const bool ignore_garbage =
  107|  7.52k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (107:7): [True: 0, False: 7.52k]
  ------------------
  108|  7.52k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (108:7): [True: 0, False: 7.52k]
  ------------------
  109|  7.52k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (109:7): [True: 0, False: 7.52k]
  ------------------
  110|       |
  111|  7.52k|  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.52k|  size_t full_input_length = srclen;
  115|       |  // skip trailing spaces
  116|  8.88k|  while (!ignore_garbage && srclen > 0 &&
  ------------------
  |  Branch (116:10): [True: 8.88k, False: 0]
  |  Branch (116:29): [True: 8.81k, False: 66]
  ------------------
  117|  8.81k|         scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (117:10): [True: 8.81k, False: 0]
  ------------------
  118|  8.81k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (118:10): [True: 1.35k, False: 7.45k]
  ------------------
  119|  1.35k|    srclen--;
  120|  1.35k|  }
  121|  7.52k|  size_t equallocation =
  122|  7.52k|      srclen; // location of the first padding character if any
  123|  7.52k|  if (ignore_garbage) {
  ------------------
  |  Branch (123:7): [True: 0, False: 7.52k]
  ------------------
  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.52k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (135:7): [True: 7.52k, False: 0]
  |  Branch (135:26): [True: 7.45k, False: 66]
  |  Branch (135:40): [True: 480, False: 6.97k]
  ------------------
  136|       |    // This is the last '=' sign.
  137|    480|    equallocation = srclen - 1;
  138|    480|    srclen--;
  139|    480|    equalsigns = 1;
  140|       |    // skip trailing spaces
  141|  1.30k|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (141:12): [True: 1.24k, False: 60]
  |  Branch (141:26): [True: 1.24k, False: 0]
  ------------------
  142|  1.24k|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (142:12): [True: 822, False: 420]
  ------------------
  143|    822|      srclen--;
  144|    822|    }
  145|    480|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (145:9): [True: 420, False: 60]
  |  Branch (145:23): [True: 126, False: 294]
  ------------------
  146|       |      // This is the second '=' sign.
  147|    126|      equallocation = srclen - 1;
  148|    126|      srclen--;
  149|    126|      equalsigns = 2;
  150|    126|    }
  151|    480|  }
  152|  7.52k|  return {equalsigns, equallocation, srclen, full_input_length};
  153|  7.52k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6417patch_tail_resultENS_11full_resultEmmmmNS_27last_chunk_handling_optionsE:
  394|  10.7k|                  last_chunk_handling_options last_chunk_options) {
  395|  10.7k|  r.input_count += previous_input;
  396|  10.7k|  r.output_count += previous_output;
  397|  10.7k|  if (r.padding_error) {
  ------------------
  |  Branch (397:7): [True: 246, False: 10.5k]
  ------------------
  398|    246|    r.input_count = equallocation;
  399|    246|  }
  400|       |
  401|  10.7k|  if (r.error == error_code::SUCCESS) {
  ------------------
  |  Branch (401:7): [True: 6.53k, False: 4.21k]
  ------------------
  402|  6.53k|    if (!is_partial(last_chunk_options)) {
  ------------------
  |  Branch (402:9): [True: 2.19k, False: 4.33k]
  ------------------
  403|       |      // A success when we are not in stop_before_partial mode.
  404|       |      // means that we have consumed the whole input buffer.
  405|  2.19k|      r.input_count = full_input_length;
  406|  4.33k|    } else if (r.output_count % 3 != 0) {
  ------------------
  |  Branch (406:16): [True: 24, False: 4.31k]
  ------------------
  407|     24|      r.input_count = full_input_length;
  408|     24|    }
  409|  6.53k|  }
  410|  10.7k|  return r;
  411|  10.7k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIDsEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  100|  7.43k|                                           simdutf::base64_options options) {
  101|  7.43k|  const uint8_t *to_base64 =
  102|  7.43k|      (options & base64_default_or_url)
  ------------------
  |  Branch (102:7): [True: 0, False: 7.43k]
  ------------------
  103|  7.43k|          ? tables::base64::to_base64_default_or_url_value
  104|  7.43k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (104:14): [True: 3.52k, False: 3.90k]
  ------------------
  105|  7.43k|                                    : tables::base64::to_base64_value);
  106|  7.43k|  const bool ignore_garbage =
  107|  7.43k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (107:7): [True: 0, False: 7.43k]
  ------------------
  108|  7.43k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (108:7): [True: 0, False: 7.43k]
  ------------------
  109|  7.43k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (109:7): [True: 0, False: 7.43k]
  ------------------
  110|       |
  111|  7.43k|  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.43k|  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.99k, False: 1.78k]
  ------------------
  118|  6.99k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (118:10): [True: 1.40k, False: 5.58k]
  ------------------
  119|  1.40k|    srclen--;
  120|  1.40k|  }
  121|  7.43k|  size_t equallocation =
  122|  7.43k|      srclen; // location of the first padding character if any
  123|  7.43k|  if (ignore_garbage) {
  ------------------
  |  Branch (123:7): [True: 0, False: 7.43k]
  ------------------
  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.43k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (135:7): [True: 7.43k, False: 0]
  |  Branch (135:26): [True: 7.37k, False: 60]
  |  Branch (135:40): [True: 480, False: 6.89k]
  ------------------
  136|       |    // This is the last '=' sign.
  137|    480|    equallocation = srclen - 1;
  138|    480|    srclen--;
  139|    480|    equalsigns = 1;
  140|       |    // skip trailing spaces
  141|  1.48k|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (141:12): [True: 1.42k, False: 60]
  |  Branch (141:26): [True: 1.29k, False: 132]
  ------------------
  142|  1.29k|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (142:12): [True: 1.00k, False: 288]
  ------------------
  143|  1.00k|      srclen--;
  144|  1.00k|    }
  145|    480|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (145:9): [True: 420, False: 60]
  |  Branch (145:23): [True: 72, False: 348]
  ------------------
  146|       |      // This is the second '=' sign.
  147|     72|      equallocation = srclen - 1;
  148|     72|      srclen--;
  149|     72|      equalsigns = 2;
  150|     72|    }
  151|    480|  }
  152|  7.43k|  return {equalsigns, equallocation, srclen, full_input_length};
  153|  7.43k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIcEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  727|  2.50k|    last_chunk_handling_options last_chunk_options) noexcept {
  728|  2.50k|  const bool ignore_garbage =
  729|  2.50k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (729:7): [True: 0, False: 2.50k]
  ------------------
  730|  2.50k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (730:7): [True: 0, False: 2.50k]
  ------------------
  731|  2.50k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (731:7): [True: 0, False: 2.50k]
  ------------------
  732|  2.50k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  733|  2.50k|  size_t equallocation = ri.equallocation;
  734|  2.50k|  size_t equalsigns = ri.equalsigns;
  735|  2.50k|  length = ri.srclen;
  736|  2.50k|  size_t full_input_length = ri.full_input_length;
  737|  2.50k|  if (length == 0) {
  ------------------
  |  Branch (737:7): [True: 44, False: 2.46k]
  ------------------
  738|     44|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (738:9): [True: 44, False: 0]
  |  Branch (738:28): [True: 22, False: 22]
  ------------------
  739|     22|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
  740|     22|    }
  741|     22|    return {SUCCESS, full_input_length, 0};
  742|     44|  }
  743|  2.46k|  full_result r = scalar::base64::base64_tail_decode(
  744|  2.46k|      output, input, length, equalsigns, options, last_chunk_options);
  745|  2.46k|  r = scalar::base64::patch_tail_result(r, 0, 0, equallocation,
  746|  2.46k|                                        full_input_length, last_chunk_options);
  747|  2.46k|  if (!is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (747:7): [True: 1.28k, False: 1.18k]
  |  Branch (747:42): [True: 594, False: 690]
  ------------------
  748|    594|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (748:7): [True: 8, False: 586]
  |  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.46k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (759:7): [True: 1.18k, False: 1.28k]
  |  Branch (759:41): [True: 828, False: 352]
  ------------------
  760|    828|      r.input_count < full_input_length) {
  ------------------
  |  Branch (760:7): [True: 584, False: 244]
  ------------------
  761|       |    // First check if we can extend the input to the end of the stream
  762|  4.52k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (762:12): [True: 4.50k, False: 16]
  ------------------
  763|  4.50k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (763:12): [True: 3.93k, False: 568]
  ------------------
  764|  3.93k|      r.input_count++;
  765|  3.93k|    }
  766|       |    // If we are still not at the end of the stream, then we must backtrack
  767|       |    // to the last non-ignorable character.
  768|    584|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (768:9): [True: 568, False: 16]
  ------------------
  769|  4.23k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (769:14): [True: 4.12k, False: 118]
  ------------------
  770|  4.12k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (770:14): [True: 3.67k, False: 450]
  ------------------
  771|  3.67k|        r.input_count--;
  772|  3.67k|      }
  773|    568|    }
  774|    584|  }
  775|  2.46k|  return r;
  776|  2.46k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6418base64_tail_decodeIcEENS_11full_resultEPcPKT_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  371|  5.38k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  372|  5.38k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  373|  5.38k|                                        options, last_chunk_options);
  374|  5.38k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EcEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  164|  5.38k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  165|  5.38k|  char *dstend = dst + outlen;
  166|  5.38k|  (void)dstend;
  167|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  168|       |  // two branches (easily predicted):
  169|  5.38k|  const uint8_t *to_base64 =
  170|  5.38k|      (options & base64_default_or_url)
  ------------------
  |  Branch (170:7): [True: 0, False: 5.38k]
  ------------------
  171|  5.38k|          ? tables::base64::to_base64_default_or_url_value
  172|  5.38k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (172:14): [True: 2.55k, False: 2.82k]
  ------------------
  173|  5.38k|                                    : tables::base64::to_base64_value);
  174|  5.38k|  const uint32_t *d0 =
  175|  5.38k|      (options & base64_default_or_url)
  ------------------
  |  Branch (175:7): [True: 0, False: 5.38k]
  ------------------
  176|  5.38k|          ? tables::base64::base64_default_or_url::d0
  177|  5.38k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (177:14): [True: 2.55k, False: 2.82k]
  ------------------
  178|  5.38k|                                    : tables::base64::base64_default::d0);
  179|  5.38k|  const uint32_t *d1 =
  180|  5.38k|      (options & base64_default_or_url)
  ------------------
  |  Branch (180:7): [True: 0, False: 5.38k]
  ------------------
  181|  5.38k|          ? tables::base64::base64_default_or_url::d1
  182|  5.38k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (182:14): [True: 2.55k, False: 2.82k]
  ------------------
  183|  5.38k|                                    : tables::base64::base64_default::d1);
  184|  5.38k|  const uint32_t *d2 =
  185|  5.38k|      (options & base64_default_or_url)
  ------------------
  |  Branch (185:7): [True: 0, False: 5.38k]
  ------------------
  186|  5.38k|          ? tables::base64::base64_default_or_url::d2
  187|  5.38k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (187:14): [True: 2.55k, False: 2.82k]
  ------------------
  188|  5.38k|                                    : tables::base64::base64_default::d2);
  189|  5.38k|  const uint32_t *d3 =
  190|  5.38k|      (options & base64_default_or_url)
  ------------------
  |  Branch (190:7): [True: 0, False: 5.38k]
  ------------------
  191|  5.38k|          ? tables::base64::base64_default_or_url::d3
  192|  5.38k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (192:14): [True: 2.55k, False: 2.82k]
  ------------------
  193|  5.38k|                                    : tables::base64::base64_default::d3);
  194|  5.38k|  const bool ignore_garbage =
  195|  5.38k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (195:7): [True: 0, False: 5.38k]
  ------------------
  196|  5.38k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (196:7): [True: 0, False: 5.38k]
  ------------------
  197|  5.38k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (197:7): [True: 0, False: 5.38k]
  ------------------
  198|       |
  199|  5.38k|  const char_type *srcend = src + length;
  200|  5.38k|  const char_type *srcinit = src;
  201|  5.38k|  const char *dstinit = dst;
  202|       |
  203|  5.38k|  uint32_t x;
  204|  5.38k|  size_t idx;
  205|  5.38k|  uint8_t buffer[4];
  206|  94.4k|  while (true) {
  ------------------
  |  Branch (206:10): [True: 94.4k, Folded]
  ------------------
  207|  5.93M|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (207:12): [True: 5.93M, False: 3.43k]
  |  Branch (207:33): [True: 5.93M, False: 0]
  ------------------
  208|  5.93M|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (208:12): [True: 5.93M, False: 0]
  |  Branch (208:37): [True: 5.93M, False: 0]
  ------------------
  209|  5.93M|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (209:12): [True: 5.93M, False: 0]
  ------------------
  210|  5.93M|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (210:12): [True: 5.84M, False: 90.9k]
  ------------------
  211|  5.93M|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  212|  5.84M|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (212:11): [Folded, False: 5.84M]
  |  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|  5.84M|      *dst++ = static_cast<char>(x & 0xFF);
  217|  5.84M|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  218|  5.84M|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  219|  5.84M|      src += 4;
  220|  5.84M|    }
  221|  94.4k|    const char_type *srccur = src;
  222|  94.4k|    idx = 0;
  223|       |    // we need at least four characters.
  224|  94.4k|#ifdef __clang__
  225|       |    // If possible, we read four characters at a time. (It is an optimization.)
  226|  94.4k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (226:9): [True: 0, False: 94.4k]
  |  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|  94.4k|#endif
  248|  1.16M|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (248:12): [True: 1.07M, False: 89.0k]
  |  Branch (248:25): [True: 1.07M, False: 4.27k]
  ------------------
  249|  1.07M|      char_type c = *src;
  250|       |
  251|  1.07M|      uint8_t code = to_base64[uint8_t(c)];
  252|  1.07M|      buffer[idx] = uint8_t(code);
  253|  1.07M|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (253:11): [True: 1.07M, False: 0]
  |  Branch (253:31): [True: 363k, False: 710k]
  ------------------
  254|   363k|        idx++;
  255|   710k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (255:18): [True: 710k, False: 0]
  ------------------
  256|   710k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (256:19): [True: 1.10k, False: 709k]
  |  Branch (256:32): [True: 0, False: 709k]
  ------------------
  257|  1.10k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  258|  1.10k|                size_t(dst - dstinit)};
  259|   709k|      } else {
  260|       |        // We have a space or a newline or garbage. We ignore it.
  261|   709k|      }
  262|  1.07M|      src++;
  263|  1.07M|    }
  264|  93.3k|    if (idx != 4) {
  ------------------
  |  Branch (264:9): [True: 4.27k, False: 89.0k]
  ------------------
  265|  4.27k|      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.27k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (268:11): [True: 4.27k, False: 0]
  |  Branch (268:30): [True: 6, False: 4.26k]
  ------------------
  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.26k|      if (!ignore_garbage &&
  ------------------
  |  Branch (277:11): [True: 4.26k, False: 0]
  ------------------
  278|  4.26k|          last_chunk_options == last_chunk_handling_options::loose &&
  ------------------
  |  Branch (278:11): [True: 1.70k, False: 2.56k]
  ------------------
  279|  1.70k|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (279:11): [True: 960, False: 744]
  |  Branch (279:25): [True: 12, False: 948]
  ------------------
  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.26k|        if (!ignore_garbage &&
  ------------------
  |  Branch (288:13): [True: 4.26k, False: 0]
  ------------------
  289|  4.26k|            last_chunk_options == last_chunk_handling_options::strict &&
  ------------------
  |  Branch (289:13): [True: 318, False: 3.94k]
  ------------------
  290|    318|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (290:13): [True: 180, False: 138]
  |  Branch (290:27): [True: 108, False: 72]
  ------------------
  291|       |          // The partial chunk was at src - idx
  292|    108|          return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  293|    108|                  size_t(dst - dstinit), true};
  294|    108|        } 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.15k|          if ((last_chunk_options ==
  ------------------
  |  Branch (298:16): [True: 2.24k, False: 1.90k]
  ------------------
  299|  4.15k|                   last_chunk_handling_options::stop_before_partial &&
  300|  2.24k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (300:16): [True: 2.23k, False: 12]
  |  Branch (300:50): [True: 1.72k, False: 504]
  ------------------
  301|  1.72k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (301:17): [True: 780, False: 948]
  |  Branch (301:29): [True: 924, False: 24]
  ------------------
  302|  2.44k|              (last_chunk_options ==
  ------------------
  |  Branch (302:16): [True: 0, False: 2.44k]
  ------------------
  303|  2.44k|                   last_chunk_handling_options::only_full_chunks &&
  304|  1.70k|               (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.70k|            src = srccur;
  308|  1.70k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  309|  2.44k|          } else {
  310|  2.44k|            if (idx == 2) {
  ------------------
  |  Branch (310:17): [True: 552, False: 1.89k]
  ------------------
  311|    552|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  312|    552|                                (uint32_t(buffer[1]) << 2 * 6);
  313|    552|              if (!ignore_garbage &&
  ------------------
  |  Branch (313:19): [True: 552, False: 0]
  ------------------
  314|    552|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (314:19): [True: 42, False: 510]
  ------------------
  315|     42|                  (triple & 0xffff)) {
  ------------------
  |  Branch (315:19): [True: 30, False: 12]
  ------------------
  316|     30|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  317|     30|                        size_t(dst - dstinit)};
  318|     30|              }
  319|    522|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (319:19): [Folded, False: 522]
  |  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|    522|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  324|  1.89k|            } else if (idx == 3) {
  ------------------
  |  Branch (324:24): [True: 486, False: 1.41k]
  ------------------
  325|    486|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  326|    486|                                (uint32_t(buffer[1]) << 2 * 6) +
  327|    486|                                (uint32_t(buffer[2]) << 1 * 6);
  328|    486|              if (!ignore_garbage &&
  ------------------
  |  Branch (328:19): [True: 486, False: 0]
  ------------------
  329|    486|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (329:19): [True: 30, False: 456]
  ------------------
  330|     30|                  (triple & 0xff)) {
  ------------------
  |  Branch (330:19): [True: 24, False: 6]
  ------------------
  331|     24|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  332|     24|                        size_t(dst - dstinit)};
  333|     24|              }
  334|    462|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (334:19): [Folded, False: 462]
  |  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|    462|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  339|    462|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  340|  1.41k|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (340:24): [True: 1.41k, False: 0]
  |  Branch (340:43): [True: 402, False: 1.00k]
  ------------------
  341|    402|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (341:25): [True: 378, False: 24]
  ------------------
  342|     24|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (342:26): [True: 24, False: 0]
  ------------------
  343|    402|                         padding_characters > 0))) {
  ------------------
  |  Branch (343:26): [True: 24, False: 0]
  ------------------
  344|    402|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  345|    402|                      size_t(dst - dstinit)};
  346|  1.00k|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (346:24): [True: 1.00k, False: 0]
  |  Branch (346:43): [True: 1.00k, False: 0]
  |  Branch (346:55): [True: 18, False: 990]
  ------------------
  347|     18|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  348|     18|                      size_t(dst - dstinit), true};
  349|     18|            }
  350|  1.97k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  351|  2.44k|          }
  352|  4.26k|    }
  353|  89.0k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (353:9): [Folded, False: 89.0k]
  |  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|  89.0k|    uint32_t triple =
  358|  89.0k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  359|  89.0k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  360|  89.0k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  361|  89.0k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  362|  89.0k|    *dst++ = static_cast<char>(triple & 0xFF);
  363|  89.0k|  }
  364|  5.38k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIDsEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  727|  2.47k|    last_chunk_handling_options last_chunk_options) noexcept {
  728|  2.47k|  const bool ignore_garbage =
  729|  2.47k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (729:7): [True: 0, False: 2.47k]
  ------------------
  730|  2.47k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (730:7): [True: 0, False: 2.47k]
  ------------------
  731|  2.47k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (731:7): [True: 0, False: 2.47k]
  ------------------
  732|  2.47k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  733|  2.47k|  size_t equallocation = ri.equallocation;
  734|  2.47k|  size_t equalsigns = ri.equalsigns;
  735|  2.47k|  length = ri.srclen;
  736|  2.47k|  size_t full_input_length = ri.full_input_length;
  737|  2.47k|  if (length == 0) {
  ------------------
  |  Branch (737:7): [True: 44, False: 2.43k]
  ------------------
  738|     44|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (738:9): [True: 44, False: 0]
  |  Branch (738:28): [True: 24, False: 20]
  ------------------
  739|     24|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
  740|     24|    }
  741|     20|    return {SUCCESS, full_input_length, 0};
  742|     44|  }
  743|  2.43k|  full_result r = scalar::base64::base64_tail_decode(
  744|  2.43k|      output, input, length, equalsigns, options, last_chunk_options);
  745|  2.43k|  r = scalar::base64::patch_tail_result(r, 0, 0, equallocation,
  746|  2.43k|                                        full_input_length, last_chunk_options);
  747|  2.43k|  if (!is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (747:7): [True: 1.02k, False: 1.40k]
  |  Branch (747:42): [True: 308, False: 718]
  ------------------
  748|    308|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (748:7): [True: 8, False: 300]
  |  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.43k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (759:7): [True: 1.40k, False: 1.02k]
  |  Branch (759:41): [True: 814, False: 594]
  ------------------
  760|    814|      r.input_count < full_input_length) {
  ------------------
  |  Branch (760:7): [True: 600, False: 214]
  ------------------
  761|       |    // First check if we can extend the input to the end of the stream
  762|  3.56k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (762:12): [True: 3.55k, False: 12]
  ------------------
  763|  3.55k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (763:12): [True: 2.96k, False: 588]
  ------------------
  764|  2.96k|      r.input_count++;
  765|  2.96k|    }
  766|       |    // If we are still not at the end of the stream, then we must backtrack
  767|       |    // to the last non-ignorable character.
  768|    600|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (768:9): [True: 588, False: 12]
  ------------------
  769|  3.29k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (769:14): [True: 3.15k, False: 140]
  ------------------
  770|  3.15k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (770:14): [True: 2.70k, False: 448]
  ------------------
  771|  2.70k|        r.input_count--;
  772|  2.70k|      }
  773|    588|    }
  774|    600|  }
  775|  2.43k|  return r;
  776|  2.43k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6418base64_tail_decodeIDsEENS_11full_resultEPcPKT_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  371|  5.37k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  372|  5.37k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  373|  5.37k|                                        options, last_chunk_options);
  374|  5.37k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EDsEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  164|  5.37k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  165|  5.37k|  char *dstend = dst + outlen;
  166|  5.37k|  (void)dstend;
  167|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  168|       |  // two branches (easily predicted):
  169|  5.37k|  const uint8_t *to_base64 =
  170|  5.37k|      (options & base64_default_or_url)
  ------------------
  |  Branch (170:7): [True: 0, False: 5.37k]
  ------------------
  171|  5.37k|          ? tables::base64::to_base64_default_or_url_value
  172|  5.37k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (172:14): [True: 2.53k, False: 2.83k]
  ------------------
  173|  5.37k|                                    : tables::base64::to_base64_value);
  174|  5.37k|  const uint32_t *d0 =
  175|  5.37k|      (options & base64_default_or_url)
  ------------------
  |  Branch (175:7): [True: 0, False: 5.37k]
  ------------------
  176|  5.37k|          ? tables::base64::base64_default_or_url::d0
  177|  5.37k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (177:14): [True: 2.53k, False: 2.83k]
  ------------------
  178|  5.37k|                                    : tables::base64::base64_default::d0);
  179|  5.37k|  const uint32_t *d1 =
  180|  5.37k|      (options & base64_default_or_url)
  ------------------
  |  Branch (180:7): [True: 0, False: 5.37k]
  ------------------
  181|  5.37k|          ? tables::base64::base64_default_or_url::d1
  182|  5.37k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (182:14): [True: 2.53k, False: 2.83k]
  ------------------
  183|  5.37k|                                    : tables::base64::base64_default::d1);
  184|  5.37k|  const uint32_t *d2 =
  185|  5.37k|      (options & base64_default_or_url)
  ------------------
  |  Branch (185:7): [True: 0, False: 5.37k]
  ------------------
  186|  5.37k|          ? tables::base64::base64_default_or_url::d2
  187|  5.37k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (187:14): [True: 2.53k, False: 2.83k]
  ------------------
  188|  5.37k|                                    : tables::base64::base64_default::d2);
  189|  5.37k|  const uint32_t *d3 =
  190|  5.37k|      (options & base64_default_or_url)
  ------------------
  |  Branch (190:7): [True: 0, False: 5.37k]
  ------------------
  191|  5.37k|          ? tables::base64::base64_default_or_url::d3
  192|  5.37k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (192:14): [True: 2.53k, False: 2.83k]
  ------------------
  193|  5.37k|                                    : tables::base64::base64_default::d3);
  194|  5.37k|  const bool ignore_garbage =
  195|  5.37k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (195:7): [True: 0, False: 5.37k]
  ------------------
  196|  5.37k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (196:7): [True: 0, False: 5.37k]
  ------------------
  197|  5.37k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (197:7): [True: 0, False: 5.37k]
  ------------------
  198|       |
  199|  5.37k|  const char_type *srcend = src + length;
  200|  5.37k|  const char_type *srcinit = src;
  201|  5.37k|  const char *dstinit = dst;
  202|       |
  203|  5.37k|  uint32_t x;
  204|  5.37k|  size_t idx;
  205|  5.37k|  uint8_t buffer[4];
  206|  77.5k|  while (true) {
  ------------------
  |  Branch (206:10): [True: 77.5k, Folded]
  ------------------
  207|  1.08M|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (207:12): [True: 1.08M, False: 2.87k]
  |  Branch (207:33): [True: 1.08M, False: 302]
  ------------------
  208|  1.08M|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (208:12): [True: 1.08M, False: 250]
  |  Branch (208:37): [True: 1.08M, False: 204]
  ------------------
  209|  1.08M|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (209:12): [True: 1.08M, False: 240]
  ------------------
  210|  1.08M|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (210:12): [True: 1.00M, False: 73.6k]
  ------------------
  211|  1.08M|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  212|  1.00M|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (212:11): [Folded, False: 1.00M]
  |  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.00M|      *dst++ = static_cast<char>(x & 0xFF);
  217|  1.00M|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  218|  1.00M|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  219|  1.00M|      src += 4;
  220|  1.00M|    }
  221|  77.5k|    const char_type *srccur = src;
  222|  77.5k|    idx = 0;
  223|       |    // we need at least four characters.
  224|  77.5k|#ifdef __clang__
  225|       |    // If possible, we read four characters at a time. (It is an optimization.)
  226|  77.5k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (226:9): [True: 0, False: 77.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|  77.5k|#endif
  248|   523k|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (248:12): [True: 451k, False: 72.1k]
  |  Branch (248:25): [True: 448k, False: 3.27k]
  ------------------
  249|   448k|      char_type c = *src;
  250|       |
  251|   448k|      uint8_t code = to_base64[uint8_t(c)];
  252|   448k|      buffer[idx] = uint8_t(code);
  253|   448k|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (253:11): [True: 446k, False: 1.39k]
  |  Branch (253:31): [True: 295k, False: 151k]
  ------------------
  254|   295k|        idx++;
  255|   295k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (255:18): [True: 152k, False: 0]
  ------------------
  256|   152k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (256:19): [True: 1.40k, False: 151k]
  |  Branch (256:32): [True: 684, False: 150k]
  ------------------
  257|  2.09k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  258|  2.09k|                size_t(dst - dstinit)};
  259|   150k|      } else {
  260|       |        // We have a space or a newline or garbage. We ignore it.
  261|   150k|      }
  262|   446k|      src++;
  263|   446k|    }
  264|  75.4k|    if (idx != 4) {
  ------------------
  |  Branch (264:9): [True: 3.27k, False: 72.1k]
  ------------------
  265|  3.27k|      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.27k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (268:11): [True: 3.27k, False: 0]
  |  Branch (268:30): [True: 6, False: 3.27k]
  ------------------
  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.27k|      if (!ignore_garbage &&
  ------------------
  |  Branch (277:11): [True: 3.27k, False: 0]
  ------------------
  278|  3.27k|          last_chunk_options == last_chunk_handling_options::loose &&
  ------------------
  |  Branch (278:11): [True: 802, False: 2.47k]
  ------------------
  279|    802|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (279:11): [True: 432, False: 370]
  |  Branch (279:25): [True: 12, False: 420]
  ------------------
  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.26k|        if (!ignore_garbage &&
  ------------------
  |  Branch (288:13): [True: 3.26k, False: 0]
  ------------------
  289|  3.26k|            last_chunk_options == last_chunk_handling_options::strict &&
  ------------------
  |  Branch (289:13): [True: 286, False: 2.98k]
  ------------------
  290|    286|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (290:13): [True: 108, False: 178]
  |  Branch (290:27): [True: 66, False: 42]
  ------------------
  291|       |          // The partial chunk was at src - idx
  292|     66|          return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  293|     66|                  size_t(dst - dstinit), true};
  294|     66|        } 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.20k|          if ((last_chunk_options ==
  ------------------
  |  Branch (298:16): [True: 2.18k, False: 1.01k]
  ------------------
  299|  3.20k|                   last_chunk_handling_options::stop_before_partial &&
  300|  2.18k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (300:16): [True: 2.17k, False: 12]
  |  Branch (300:50): [True: 1.81k, False: 360]
  ------------------
  301|  1.81k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (301:17): [True: 1.00k, False: 804]
  |  Branch (301:29): [True: 756, False: 48]
  ------------------
  302|  1.43k|              (last_chunk_options ==
  ------------------
  |  Branch (302:16): [True: 0, False: 1.43k]
  ------------------
  303|  1.43k|                   last_chunk_handling_options::only_full_chunks &&
  304|  1.76k|               (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.76k|            src = srccur;
  308|  1.76k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  309|  1.76k|          } else {
  310|  1.43k|            if (idx == 2) {
  ------------------
  |  Branch (310:17): [True: 282, False: 1.15k]
  ------------------
  311|    282|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  312|    282|                                (uint32_t(buffer[1]) << 2 * 6);
  313|    282|              if (!ignore_garbage &&
  ------------------
  |  Branch (313:19): [True: 282, False: 0]
  ------------------
  314|    282|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (314:19): [True: 24, False: 258]
  ------------------
  315|     24|                  (triple & 0xffff)) {
  ------------------
  |  Branch (315:19): [True: 12, False: 12]
  ------------------
  316|     12|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  317|     12|                        size_t(dst - dstinit)};
  318|     12|              }
  319|    270|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (319:19): [Folded, False: 270]
  |  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|    270|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  324|  1.15k|            } else if (idx == 3) {
  ------------------
  |  Branch (324:24): [True: 198, False: 956]
  ------------------
  325|    198|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  326|    198|                                (uint32_t(buffer[1]) << 2 * 6) +
  327|    198|                                (uint32_t(buffer[2]) << 1 * 6);
  328|    198|              if (!ignore_garbage &&
  ------------------
  |  Branch (328:19): [True: 198, False: 0]
  ------------------
  329|    198|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (329:19): [True: 18, False: 180]
  ------------------
  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|    186|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (334:19): [Folded, False: 186]
  |  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|    186|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  339|    186|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  340|    956|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (340:24): [True: 956, False: 0]
  |  Branch (340:43): [True: 288, False: 668]
  ------------------
  341|    288|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (341:25): [True: 240, False: 48]
  ------------------
  342|     48|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (342:26): [True: 48, False: 0]
  ------------------
  343|    288|                         padding_characters > 0))) {
  ------------------
  |  Branch (343:26): [True: 48, False: 0]
  ------------------
  344|    288|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  345|    288|                      size_t(dst - dstinit)};
  346|    668|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (346:24): [True: 668, False: 0]
  |  Branch (346:43): [True: 668, False: 0]
  |  Branch (346:55): [True: 30, False: 638]
  ------------------
  347|     30|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  348|     30|                      size_t(dst - dstinit), true};
  349|     30|            }
  350|  1.09k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  351|  1.43k|          }
  352|  3.27k|    }
  353|  72.1k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (353:9): [Folded, False: 72.1k]
  |  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|  72.1k|    uint32_t triple =
  358|  72.1k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  359|  72.1k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  360|  72.1k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  361|  72.1k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  362|  72.1k|    *dst++ = static_cast<char>(triple & 0xFF);
  363|  72.1k|  }
  364|  5.37k|}

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

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

simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.18k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.18k|  const uint8_t *to_base64 =
   47|  1.18k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.18k]
  ------------------
   48|  1.18k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.18k, Folded]
  ------------------
   49|  1.18k|                                   : tables::base64::to_base64_value);
   50|  1.18k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.18k|  size_t equallocation = ri.equallocation;
   52|  1.18k|  size_t equalsigns = ri.equalsigns;
   53|  1.18k|  srclen = ri.srclen;
   54|  1.18k|  size_t full_input_length = ri.full_input_length;
   55|  1.18k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 20, False: 1.16k]
  ------------------
   56|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 20, Folded]
  |  Branch (56:28): [True: 10, False: 10]
  ------------------
   57|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     10|    }
   59|     10|    return {SUCCESS, full_input_length, 0};
   60|     20|  }
   61|  1.16k|  char *end_of_safe_64byte_zone =
   62|  1.16k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 46, False: 1.12k]
  ------------------
   63|  1.16k|          ? nullptr
   64|  1.16k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 376, False: 744]
  ------------------
   65|  1.12k|                                        : dst);
   66|       |
   67|  1.16k|  const chartype *const srcinit = src;
   68|  1.16k|  const char *const dstinit = dst;
   69|  1.16k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.16k|  constexpr size_t block_size = 6;
   72|  1.16k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.16k|  char buffer[block_size * 64];
   74|  1.16k|  char *bufferptr = buffer;
   75|  1.16k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 924, False: 242]
  ------------------
   76|    924|    const chartype *const srcend64 = src + srclen - 64;
   77|  96.0k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 95.4k, False: 600]
  ------------------
   78|  95.4k|      block64 b(src);
   79|  95.4k|      src += 64;
   80|  95.4k|      uint64_t error = 0;
   81|  95.4k|      const uint64_t badcharmask =
   82|  95.4k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  95.4k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 95.4k, Folded]
  |  Branch (83:30): [True: 324, False: 95.0k]
  ------------------
   84|    324|        src -= 64;
   85|    324|        const size_t error_offset = trailing_zeroes(error);
   86|    324|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    324|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    324|      }
   89|  95.0k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 38.9k, False: 56.0k]
  ------------------
   90|  38.9k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  56.0k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 13.5k, False: 42.4k]
  ------------------
   92|  13.5k|        b.copy_block(bufferptr);
   93|  13.5k|        bufferptr += 64;
   94|  42.4k|      } else {
   95|  42.4k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 6, False: 42.4k]
  ------------------
   96|      6|          b.base64_decode_block_safe(dst);
   97|  42.4k|        } else {
   98|  42.4k|          b.base64_decode_block(dst);
   99|  42.4k|        }
  100|  42.4k|        dst += 48;
  101|  42.4k|      }
  102|  95.0k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 8.66k, False: 86.4k]
  ------------------
  103|  43.3k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 34.6k, False: 8.66k]
  ------------------
  104|  34.6k|          base64_decode_block(dst, buffer + i * 64);
  105|  34.6k|          dst += 48;
  106|  34.6k|        }
  107|  8.66k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 8.66k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  8.66k|        } else {
  110|  8.66k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  8.66k|        }
  112|  8.66k|        dst += 48;
  113|  8.66k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  8.66k|                    64); // 64 might be too much
  115|  8.66k|        bufferptr -= (block_size - 1) * 64;
  116|  8.66k|      }
  117|  95.0k|    }
  118|    924|  }
  119|       |
  120|    842|  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|    842|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    842|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 544, False: 298]
  |  Branch (124:26): [True: 76, False: 468]
  ------------------
  125|       |
  126|  1.00k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 952, False: 48]
  |  Branch (126:52): [True: 930, False: 22]
  ------------------
  127|    930|      uint8_t val = to_base64[uint8_t(*src)];
  128|    930|      *bufferptr = char(val);
  129|    930|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 930, Folded]
  ------------------
  130|    930|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 930]
  |  Branch (130:52): [True: 6, False: 924]
  ------------------
  131|      6|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      6|                size_t(dst - dstinit)};
  133|      6|      }
  134|    924|      bufferptr += (val <= 63);
  135|    924|      src++;
  136|    924|    }
  137|     76|  }
  138|       |
  139|  1.31k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 482, False: 836]
  ------------------
  140|    482|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 28, False: 454]
  ------------------
  141|     28|      base64_decode_block_safe(dst, buffer_start);
  142|    454|    } else {
  143|    454|      base64_decode_block(dst, buffer_start);
  144|    454|    }
  145|    482|    dst += 48;
  146|    482|  }
  147|    836|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 490, False: 346]
  ------------------
  148|  4.24k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.75k, False: 490]
  ------------------
  149|  3.75k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.75k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.75k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.75k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.75k|                        << 8;
  154|  3.75k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.75k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.75k|#endif
  157|  3.75k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.75k|      dst += 3;
  160|  3.75k|      buffer_start += 4;
  161|  3.75k|    }
  162|    490|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 128, False: 362]
  ------------------
  163|    128|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    128|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    128|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    128|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    128|                        << 8;
  168|    128|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    128|      triple = scalar::u32_swap_bytes(triple);
  170|    128|#endif
  171|    128|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    128|      dst += 3;
  174|    128|      buffer_start += 4;
  175|    128|    }
  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.22k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 730, False: 490]
  ------------------
  180|    730|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 730, Folded]
  ------------------
  181|  5.43k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.70k, False: 730]
  ------------------
  182|  4.70k|          src--;
  183|  4.70k|        }
  184|    730|      } 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|    730|      src--;
  190|    730|      leftover--;
  191|    730|    }
  192|    490|  }
  193|    836|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 694, False: 142]
  ------------------
  194|    694|    full_result r = scalar::base64::base64_tail_decode(
  195|    694|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    694|    r = scalar::base64::patch_tail_result(
  197|    694|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    694|        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|    694|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 372, False: 322]
  |  Branch (203:43): [True: 344, False: 28]
  ------------------
  204|    344|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 296, False: 48]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    598|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 594, False: 4]
  ------------------
  207|    594|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 302, False: 292]
  ------------------
  208|    302|        r.input_count++;
  209|    302|      }
  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: 292, False: 4]
  ------------------
  213|  2.51k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.46k, False: 54]
  ------------------
  214|  2.46k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.22k, False: 238]
  ------------------
  215|  2.22k|          r.input_count--;
  216|  2.22k|        }
  217|    292|      }
  218|    296|    }
  219|    694|    return r;
  220|    694|  }
  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.32k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.32k|  const uint8_t *to_base64 =
   47|  1.32k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.32k]
  ------------------
   48|  1.32k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.32k]
  ------------------
   49|  1.32k|                                   : tables::base64::to_base64_value);
   50|  1.32k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.32k|  size_t equallocation = ri.equallocation;
   52|  1.32k|  size_t equalsigns = ri.equalsigns;
   53|  1.32k|  srclen = ri.srclen;
   54|  1.32k|  size_t full_input_length = ri.full_input_length;
   55|  1.32k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 24, False: 1.29k]
  ------------------
   56|     24|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 24, Folded]
  |  Branch (56:28): [True: 12, False: 12]
  ------------------
   57|     12|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     12|    }
   59|     12|    return {SUCCESS, full_input_length, 0};
   60|     24|  }
   61|  1.29k|  char *end_of_safe_64byte_zone =
   62|  1.29k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 58, False: 1.24k]
  ------------------
   63|  1.29k|          ? nullptr
   64|  1.29k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 424, False: 816]
  ------------------
   65|  1.24k|                                        : dst);
   66|       |
   67|  1.29k|  const chartype *const srcinit = src;
   68|  1.29k|  const char *const dstinit = dst;
   69|  1.29k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.29k|  constexpr size_t block_size = 6;
   72|  1.29k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.29k|  char buffer[block_size * 64];
   74|  1.29k|  char *bufferptr = buffer;
   75|  1.29k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 998, False: 300]
  ------------------
   76|    998|    const chartype *const srcend64 = src + srclen - 64;
   77|   286k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 286k, False: 624]
  ------------------
   78|   286k|      block64 b(src);
   79|   286k|      src += 64;
   80|   286k|      uint64_t error = 0;
   81|   286k|      const uint64_t badcharmask =
   82|   286k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   286k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 286k, Folded]
  |  Branch (83:30): [True: 374, False: 285k]
  ------------------
   84|    374|        src -= 64;
   85|    374|        const size_t error_offset = trailing_zeroes(error);
   86|    374|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    374|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    374|      }
   89|   285k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 37.0k, False: 248k]
  ------------------
   90|  37.0k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   248k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 119k, False: 129k]
  ------------------
   92|   119k|        b.copy_block(bufferptr);
   93|   119k|        bufferptr += 64;
   94|   129k|      } else {
   95|   129k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 129k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|   129k|        } else {
   98|   129k|          b.base64_decode_block(dst);
   99|   129k|        }
  100|   129k|        dst += 48;
  101|   129k|      }
  102|   285k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 30.6k, False: 255k]
  ------------------
  103|   153k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 122k, False: 30.6k]
  ------------------
  104|   122k|          base64_decode_block(dst, buffer + i * 64);
  105|   122k|          dst += 48;
  106|   122k|        }
  107|  30.6k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 30.6k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  30.6k|        } else {
  110|  30.6k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  30.6k|        }
  112|  30.6k|        dst += 48;
  113|  30.6k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  30.6k|                    64); // 64 might be too much
  115|  30.6k|        bufferptr -= (block_size - 1) * 64;
  116|  30.6k|      }
  117|   285k|    }
  118|    998|  }
  119|       |
  120|    924|  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|    924|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    924|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 572, False: 352]
  |  Branch (124:26): [True: 90, False: 482]
  ------------------
  125|       |
  126|  1.47k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.40k, False: 64]
  |  Branch (126:52): [True: 1.39k, False: 18]
  ------------------
  127|  1.39k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.39k|      *bufferptr = char(val);
  129|  1.39k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.39k, Folded]
  ------------------
  130|  1.39k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.39k]
  |  Branch (130:52): [True: 8, False: 1.38k]
  ------------------
  131|      8|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      8|                size_t(dst - dstinit)};
  133|      8|      }
  134|  1.38k|      bufferptr += (val <= 63);
  135|  1.38k|      src++;
  136|  1.38k|    }
  137|     90|  }
  138|       |
  139|  1.40k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 490, False: 916]
  ------------------
  140|    490|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 34, False: 456]
  ------------------
  141|     34|      base64_decode_block_safe(dst, buffer_start);
  142|    456|    } else {
  143|    456|      base64_decode_block(dst, buffer_start);
  144|    456|    }
  145|    490|    dst += 48;
  146|    490|  }
  147|    916|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 500, False: 416]
  ------------------
  148|  4.13k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.63k, False: 500]
  ------------------
  149|  3.63k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.63k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.63k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.63k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.63k|                        << 8;
  154|  3.63k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.63k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.63k|#endif
  157|  3.63k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.63k|      dst += 3;
  160|  3.63k|      buffer_start += 4;
  161|  3.63k|    }
  162|    500|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 132, False: 368]
  ------------------
  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|    500|    int leftover = int(bufferptr - buffer_start);
  179|  1.20k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 708, False: 500]
  ------------------
  180|    708|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 708, Folded]
  ------------------
  181|  5.39k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.68k, False: 708]
  ------------------
  182|  4.68k|          src--;
  183|  4.68k|        }
  184|    708|      } 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|    708|      src--;
  190|    708|      leftover--;
  191|    708|    }
  192|    500|  }
  193|    916|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 764, False: 152]
  ------------------
  194|    764|    full_result r = scalar::base64::base64_tail_decode(
  195|    764|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    764|    r = scalar::base64::patch_tail_result(
  197|    764|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    764|        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|    764|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 372, False: 392]
  |  Branch (203:43): [True: 346, False: 26]
  ------------------
  204|    346|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 284, False: 62]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    732|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 724, False: 8]
  ------------------
  207|    724|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 448, False: 276]
  ------------------
  208|    448|        r.input_count++;
  209|    448|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    284|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 276, False: 8]
  ------------------
  213|  1.72k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.65k, False: 64]
  ------------------
  214|  1.65k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.44k, False: 212]
  ------------------
  215|  1.44k|          r.input_count--;
  216|  1.44k|        }
  217|    276|      }
  218|    284|    }
  219|    764|    return r;
  220|    764|  }
  221|    152|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 152, Folded]
  |  Branch (221:26): [True: 0, False: 152]
  ------------------
  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|    152|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    152|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.17k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.17k|  const uint8_t *to_base64 =
   47|  1.17k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.17k]
  ------------------
   48|  1.17k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.17k, Folded]
  ------------------
   49|  1.17k|                                   : tables::base64::to_base64_value);
   50|  1.17k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.17k|  size_t equallocation = ri.equallocation;
   52|  1.17k|  size_t equalsigns = ri.equalsigns;
   53|  1.17k|  srclen = ri.srclen;
   54|  1.17k|  size_t full_input_length = ri.full_input_length;
   55|  1.17k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 20, False: 1.15k]
  ------------------
   56|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 20, Folded]
  |  Branch (56:28): [True: 8, False: 12]
  ------------------
   57|      8|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      8|    }
   59|     12|    return {SUCCESS, full_input_length, 0};
   60|     20|  }
   61|  1.15k|  char *end_of_safe_64byte_zone =
   62|  1.15k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 88, False: 1.06k]
  ------------------
   63|  1.15k|          ? nullptr
   64|  1.15k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 318, False: 750]
  ------------------
   65|  1.06k|                                        : dst);
   66|       |
   67|  1.15k|  const chartype *const srcinit = src;
   68|  1.15k|  const char *const dstinit = dst;
   69|  1.15k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.15k|  constexpr size_t block_size = 6;
   72|  1.15k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.15k|  char buffer[block_size * 64];
   74|  1.15k|  char *bufferptr = buffer;
   75|  1.15k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 880, False: 276]
  ------------------
   76|    880|    const chartype *const srcend64 = src + srclen - 64;
   77|  26.6k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 26.0k, False: 586]
  ------------------
   78|  26.0k|      block64 b(src);
   79|  26.0k|      src += 64;
   80|  26.0k|      uint64_t error = 0;
   81|  26.0k|      const uint64_t badcharmask =
   82|  26.0k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  26.0k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 26.0k, Folded]
  |  Branch (83:30): [True: 294, False: 25.7k]
  ------------------
   84|    294|        src -= 64;
   85|    294|        const size_t error_offset = trailing_zeroes(error);
   86|    294|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    294|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    294|      }
   89|  25.7k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 21.5k, False: 4.20k]
  ------------------
   90|  21.5k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  21.5k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 3.85k, False: 346]
  ------------------
   92|  3.85k|        b.copy_block(bufferptr);
   93|  3.85k|        bufferptr += 64;
   94|  3.85k|      } else {
   95|    346|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 8, False: 338]
  ------------------
   96|      8|          b.base64_decode_block_safe(dst);
   97|    338|        } else {
   98|    338|          b.base64_decode_block(dst);
   99|    338|        }
  100|    346|        dst += 48;
  101|    346|      }
  102|  25.7k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 4.79k, False: 20.9k]
  ------------------
  103|  23.9k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 19.1k, False: 4.79k]
  ------------------
  104|  19.1k|          base64_decode_block(dst, buffer + i * 64);
  105|  19.1k|          dst += 48;
  106|  19.1k|        }
  107|  4.79k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 4.79k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  4.79k|        } else {
  110|  4.79k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  4.79k|        }
  112|  4.79k|        dst += 48;
  113|  4.79k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  4.79k|                    64); // 64 might be too much
  115|  4.79k|        bufferptr -= (block_size - 1) * 64;
  116|  4.79k|      }
  117|  25.7k|    }
  118|    880|  }
  119|       |
  120|    862|  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|    862|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    862|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 550, False: 312]
  |  Branch (124:26): [True: 106, False: 444]
  ------------------
  125|       |
  126|    682|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 630, False: 52]
  |  Branch (126:52): [True: 618, False: 12]
  ------------------
  127|    618|      uint8_t val = to_base64[uint8_t(*src)];
  128|    618|      *bufferptr = char(val);
  129|    618|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 618, Folded]
  ------------------
  130|    618|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 24, False: 594]
  |  Branch (130:52): [True: 18, False: 576]
  ------------------
  131|     42|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     42|                size_t(dst - dstinit)};
  133|     42|      }
  134|    576|      bufferptr += (val <= 63);
  135|    576|      src++;
  136|    576|    }
  137|    106|  }
  138|       |
  139|  1.18k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 364, False: 820]
  ------------------
  140|    364|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 30, False: 334]
  ------------------
  141|     30|      base64_decode_block_safe(dst, buffer_start);
  142|    334|    } else {
  143|    334|      base64_decode_block(dst, buffer_start);
  144|    334|    }
  145|    364|    dst += 48;
  146|    364|  }
  147|    820|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 456, False: 364]
  ------------------
  148|  3.65k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.19k, False: 456]
  ------------------
  149|  3.19k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.19k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.19k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.19k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.19k|                        << 8;
  154|  3.19k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.19k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.19k|#endif
  157|  3.19k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.19k|      dst += 3;
  160|  3.19k|      buffer_start += 4;
  161|  3.19k|    }
  162|    456|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 116, False: 340]
  ------------------
  163|    116|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    116|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    116|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    116|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    116|                        << 8;
  168|    116|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    116|      triple = scalar::u32_swap_bytes(triple);
  170|    116|#endif
  171|    116|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    116|      dst += 3;
  174|    116|      buffer_start += 4;
  175|    116|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    456|    int leftover = int(bufferptr - buffer_start);
  179|  1.13k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 676, False: 456]
  ------------------
  180|    676|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 676, Folded]
  ------------------
  181|  6.88k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 6.20k, False: 676]
  ------------------
  182|  6.20k|          src--;
  183|  6.20k|        }
  184|    676|      } 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|    676|      src--;
  190|    676|      leftover--;
  191|    676|    }
  192|    456|  }
  193|    820|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 690, False: 130]
  ------------------
  194|    690|    full_result r = scalar::base64::base64_tail_decode(
  195|    690|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    690|    r = scalar::base64::patch_tail_result(
  197|    690|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    690|        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|    690|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 424, False: 266]
  |  Branch (203:43): [True: 340, False: 84]
  ------------------
  204|    340|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 312, False: 28]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    652|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 646, False: 6]
  ------------------
  207|    646|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 340, False: 306]
  ------------------
  208|    340|        r.input_count++;
  209|    340|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    312|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 306, False: 6]
  ------------------
  213|  1.80k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.72k, False: 78]
  ------------------
  214|  1.72k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.49k, False: 228]
  ------------------
  215|  1.49k|          r.input_count--;
  216|  1.49k|        }
  217|    306|      }
  218|    312|    }
  219|    690|    return r;
  220|    690|  }
  221|    130|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 130, Folded]
  |  Branch (221:26): [True: 0, False: 130]
  ------------------
  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|    130|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    130|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.30k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.30k|  const uint8_t *to_base64 =
   47|  1.30k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.30k]
  ------------------
   48|  1.30k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.30k]
  ------------------
   49|  1.30k|                                   : tables::base64::to_base64_value);
   50|  1.30k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.30k|  size_t equallocation = ri.equallocation;
   52|  1.30k|  size_t equalsigns = ri.equalsigns;
   53|  1.30k|  srclen = ri.srclen;
   54|  1.30k|  size_t full_input_length = ri.full_input_length;
   55|  1.30k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 24, False: 1.27k]
  ------------------
   56|     24|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 24, Folded]
  |  Branch (56:28): [True: 16, False: 8]
  ------------------
   57|     16|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     16|    }
   59|      8|    return {SUCCESS, full_input_length, 0};
   60|     24|  }
   61|  1.27k|  char *end_of_safe_64byte_zone =
   62|  1.27k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 98, False: 1.18k]
  ------------------
   63|  1.27k|          ? nullptr
   64|  1.27k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 368, False: 812]
  ------------------
   65|  1.18k|                                        : dst);
   66|       |
   67|  1.27k|  const chartype *const srcinit = src;
   68|  1.27k|  const char *const dstinit = dst;
   69|  1.27k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.27k|  constexpr size_t block_size = 6;
   72|  1.27k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.27k|  char buffer[block_size * 64];
   74|  1.27k|  char *bufferptr = buffer;
   75|  1.27k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 958, False: 320]
  ------------------
   76|    958|    const chartype *const srcend64 = src + srclen - 64;
   77|  44.4k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 43.8k, False: 638]
  ------------------
   78|  43.8k|      block64 b(src);
   79|  43.8k|      src += 64;
   80|  43.8k|      uint64_t error = 0;
   81|  43.8k|      const uint64_t badcharmask =
   82|  43.8k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  43.8k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 43.8k, Folded]
  |  Branch (83:30): [True: 320, False: 43.5k]
  ------------------
   84|    320|        src -= 64;
   85|    320|        const size_t error_offset = trailing_zeroes(error);
   86|    320|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    320|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    320|      }
   89|  43.5k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 33.7k, False: 9.70k]
  ------------------
   90|  33.7k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  33.7k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 9.44k, False: 264]
  ------------------
   92|  9.44k|        b.copy_block(bufferptr);
   93|  9.44k|        bufferptr += 64;
   94|  9.44k|      } else {
   95|    264|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 4, False: 260]
  ------------------
   96|      4|          b.base64_decode_block_safe(dst);
   97|    260|        } else {
   98|    260|          b.base64_decode_block(dst);
   99|    260|        }
  100|    264|        dst += 48;
  101|    264|      }
  102|  43.5k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 8.25k, False: 35.2k]
  ------------------
  103|  41.2k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 33.0k, False: 8.25k]
  ------------------
  104|  33.0k|          base64_decode_block(dst, buffer + i * 64);
  105|  33.0k|          dst += 48;
  106|  33.0k|        }
  107|  8.25k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 8.25k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  8.25k|        } else {
  110|  8.25k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  8.25k|        }
  112|  8.25k|        dst += 48;
  113|  8.25k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  8.25k|                    64); // 64 might be too much
  115|  8.25k|        bufferptr -= (block_size - 1) * 64;
  116|  8.25k|      }
  117|  43.5k|    }
  118|    958|  }
  119|       |
  120|    958|  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|    958|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    958|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 596, False: 362]
  |  Branch (124:26): [True: 122, False: 474]
  ------------------
  125|       |
  126|  1.07k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.01k, False: 54]
  |  Branch (126:52): [True: 1.00k, False: 12]
  ------------------
  127|  1.00k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.00k|      *bufferptr = char(val);
  129|  1.00k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.00k, Folded]
  ------------------
  130|  1.00k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 32, False: 972]
  |  Branch (130:52): [True: 24, False: 948]
  ------------------
  131|     56|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     56|                size_t(dst - dstinit)};
  133|     56|      }
  134|    948|      bufferptr += (val <= 63);
  135|    948|      src++;
  136|    948|    }
  137|    122|  }
  138|       |
  139|  1.32k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 418, False: 902]
  ------------------
  140|    418|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 30, False: 388]
  ------------------
  141|     30|      base64_decode_block_safe(dst, buffer_start);
  142|    388|    } else {
  143|    388|      base64_decode_block(dst, buffer_start);
  144|    388|    }
  145|    418|    dst += 48;
  146|    418|  }
  147|    902|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 486, False: 416]
  ------------------
  148|  3.89k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.40k, False: 486]
  ------------------
  149|  3.40k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.40k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.40k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.40k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.40k|                        << 8;
  154|  3.40k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.40k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.40k|#endif
  157|  3.40k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.40k|      dst += 3;
  160|  3.40k|      buffer_start += 4;
  161|  3.40k|    }
  162|    486|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 112, False: 374]
  ------------------
  163|    112|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    112|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    112|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    112|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    112|                        << 8;
  168|    112|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    112|      triple = scalar::u32_swap_bytes(triple);
  170|    112|#endif
  171|    112|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    112|      dst += 3;
  174|    112|      buffer_start += 4;
  175|    112|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    486|    int leftover = int(bufferptr - buffer_start);
  179|  1.22k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 734, False: 486]
  ------------------
  180|    734|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 734, Folded]
  ------------------
  181|  5.95k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 5.22k, False: 734]
  ------------------
  182|  5.22k|          src--;
  183|  5.22k|        }
  184|    734|      } 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|    734|      src--;
  190|    734|      leftover--;
  191|    734|    }
  192|    486|  }
  193|    902|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 778, False: 124]
  ------------------
  194|    778|    full_result r = scalar::base64::base64_tail_decode(
  195|    778|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    778|    r = scalar::base64::patch_tail_result(
  197|    778|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    778|        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|    778|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 432, False: 346]
  |  Branch (203:43): [True: 318, False: 114]
  ------------------
  204|    318|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 288, False: 30]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    670|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 664, False: 6]
  ------------------
  207|    664|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 382, False: 282]
  ------------------
  208|    382|        r.input_count++;
  209|    382|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    288|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 282, False: 6]
  ------------------
  213|  1.49k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.43k, False: 62]
  ------------------
  214|  1.43k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.21k, False: 220]
  ------------------
  215|  1.21k|          r.input_count--;
  216|  1.21k|        }
  217|    282|      }
  218|    288|    }
  219|    778|    return r;
  220|    778|  }
  221|    124|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 124, Folded]
  |  Branch (221:26): [True: 0, False: 124]
  ------------------
  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|    124|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    124|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.18k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.18k|  const uint8_t *to_base64 =
   47|  1.18k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.18k]
  ------------------
   48|  1.18k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.18k, Folded]
  ------------------
   49|  1.18k|                                   : tables::base64::to_base64_value);
   50|  1.18k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.18k|  size_t equallocation = ri.equallocation;
   52|  1.18k|  size_t equalsigns = ri.equalsigns;
   53|  1.18k|  srclen = ri.srclen;
   54|  1.18k|  size_t full_input_length = ri.full_input_length;
   55|  1.18k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 20, False: 1.16k]
  ------------------
   56|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 20, Folded]
  |  Branch (56:28): [True: 10, False: 10]
  ------------------
   57|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     10|    }
   59|     10|    return {SUCCESS, full_input_length, 0};
   60|     20|  }
   61|  1.16k|  char *end_of_safe_64byte_zone =
   62|  1.16k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 46, False: 1.12k]
  ------------------
   63|  1.16k|          ? nullptr
   64|  1.16k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 376, False: 744]
  ------------------
   65|  1.12k|                                        : dst);
   66|       |
   67|  1.16k|  const chartype *const srcinit = src;
   68|  1.16k|  const char *const dstinit = dst;
   69|  1.16k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.16k|  constexpr size_t block_size = 6;
   72|  1.16k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.16k|  char buffer[block_size * 64];
   74|  1.16k|  char *bufferptr = buffer;
   75|  1.16k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 924, False: 242]
  ------------------
   76|    924|    const chartype *const srcend64 = src + srclen - 64;
   77|  96.0k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 95.4k, False: 600]
  ------------------
   78|  95.4k|      block64 b(src);
   79|  95.4k|      src += 64;
   80|  95.4k|      uint64_t error = 0;
   81|  95.4k|      const uint64_t badcharmask =
   82|  95.4k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  95.4k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 95.4k, Folded]
  |  Branch (83:30): [True: 324, False: 95.0k]
  ------------------
   84|    324|        src -= 64;
   85|    324|        const size_t error_offset = trailing_zeroes(error);
   86|    324|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    324|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    324|      }
   89|  95.0k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 38.9k, False: 56.0k]
  ------------------
   90|  38.9k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  56.0k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 13.5k, False: 42.4k]
  ------------------
   92|  13.5k|        b.copy_block(bufferptr);
   93|  13.5k|        bufferptr += 64;
   94|  42.4k|      } else {
   95|  42.4k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 6, False: 42.4k]
  ------------------
   96|      6|          b.base64_decode_block_safe(dst);
   97|  42.4k|        } else {
   98|  42.4k|          b.base64_decode_block(dst);
   99|  42.4k|        }
  100|  42.4k|        dst += 48;
  101|  42.4k|      }
  102|  95.0k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 8.66k, False: 86.4k]
  ------------------
  103|  43.3k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 34.6k, False: 8.66k]
  ------------------
  104|  34.6k|          base64_decode_block(dst, buffer + i * 64);
  105|  34.6k|          dst += 48;
  106|  34.6k|        }
  107|  8.66k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 8.66k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  8.66k|        } else {
  110|  8.66k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  8.66k|        }
  112|  8.66k|        dst += 48;
  113|  8.66k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  8.66k|                    64); // 64 might be too much
  115|  8.66k|        bufferptr -= (block_size - 1) * 64;
  116|  8.66k|      }
  117|  95.0k|    }
  118|    924|  }
  119|       |
  120|    842|  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|    842|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    842|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 544, False: 298]
  |  Branch (124:26): [True: 76, False: 468]
  ------------------
  125|       |
  126|  1.00k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 952, False: 48]
  |  Branch (126:52): [True: 930, False: 22]
  ------------------
  127|    930|      uint8_t val = to_base64[uint8_t(*src)];
  128|    930|      *bufferptr = char(val);
  129|    930|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 930, Folded]
  ------------------
  130|    930|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 930]
  |  Branch (130:52): [True: 6, False: 924]
  ------------------
  131|      6|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      6|                size_t(dst - dstinit)};
  133|      6|      }
  134|    924|      bufferptr += (val <= 63);
  135|    924|      src++;
  136|    924|    }
  137|     76|  }
  138|       |
  139|  1.31k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 482, False: 836]
  ------------------
  140|    482|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 28, False: 454]
  ------------------
  141|     28|      base64_decode_block_safe(dst, buffer_start);
  142|    454|    } else {
  143|    454|      base64_decode_block(dst, buffer_start);
  144|    454|    }
  145|    482|    dst += 48;
  146|    482|  }
  147|    836|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 490, False: 346]
  ------------------
  148|  4.24k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.75k, False: 490]
  ------------------
  149|  3.75k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.75k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.75k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.75k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.75k|                        << 8;
  154|  3.75k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.75k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.75k|#endif
  157|  3.75k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.75k|      dst += 3;
  160|  3.75k|      buffer_start += 4;
  161|  3.75k|    }
  162|    490|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 128, False: 362]
  ------------------
  163|    128|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    128|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    128|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    128|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    128|                        << 8;
  168|    128|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    128|      triple = scalar::u32_swap_bytes(triple);
  170|    128|#endif
  171|    128|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    128|      dst += 3;
  174|    128|      buffer_start += 4;
  175|    128|    }
  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.22k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 730, False: 490]
  ------------------
  180|    730|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 730, Folded]
  ------------------
  181|  5.43k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.70k, False: 730]
  ------------------
  182|  4.70k|          src--;
  183|  4.70k|        }
  184|    730|      } 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|    730|      src--;
  190|    730|      leftover--;
  191|    730|    }
  192|    490|  }
  193|    836|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 694, False: 142]
  ------------------
  194|    694|    full_result r = scalar::base64::base64_tail_decode(
  195|    694|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    694|    r = scalar::base64::patch_tail_result(
  197|    694|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    694|        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|    694|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 372, False: 322]
  |  Branch (203:43): [True: 344, False: 28]
  ------------------
  204|    344|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 296, False: 48]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    598|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 594, False: 4]
  ------------------
  207|    594|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 302, False: 292]
  ------------------
  208|    302|        r.input_count++;
  209|    302|      }
  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: 292, False: 4]
  ------------------
  213|  2.51k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.46k, False: 54]
  ------------------
  214|  2.46k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.22k, False: 238]
  ------------------
  215|  2.22k|          r.input_count--;
  216|  2.22k|        }
  217|    292|      }
  218|    296|    }
  219|    694|    return r;
  220|    694|  }
  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.32k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.32k|  const uint8_t *to_base64 =
   47|  1.32k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.32k]
  ------------------
   48|  1.32k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.32k]
  ------------------
   49|  1.32k|                                   : tables::base64::to_base64_value);
   50|  1.32k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.32k|  size_t equallocation = ri.equallocation;
   52|  1.32k|  size_t equalsigns = ri.equalsigns;
   53|  1.32k|  srclen = ri.srclen;
   54|  1.32k|  size_t full_input_length = ri.full_input_length;
   55|  1.32k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 24, False: 1.29k]
  ------------------
   56|     24|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 24, Folded]
  |  Branch (56:28): [True: 12, False: 12]
  ------------------
   57|     12|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     12|    }
   59|     12|    return {SUCCESS, full_input_length, 0};
   60|     24|  }
   61|  1.29k|  char *end_of_safe_64byte_zone =
   62|  1.29k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 58, False: 1.24k]
  ------------------
   63|  1.29k|          ? nullptr
   64|  1.29k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 424, False: 816]
  ------------------
   65|  1.24k|                                        : dst);
   66|       |
   67|  1.29k|  const chartype *const srcinit = src;
   68|  1.29k|  const char *const dstinit = dst;
   69|  1.29k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.29k|  constexpr size_t block_size = 6;
   72|  1.29k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.29k|  char buffer[block_size * 64];
   74|  1.29k|  char *bufferptr = buffer;
   75|  1.29k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 998, False: 300]
  ------------------
   76|    998|    const chartype *const srcend64 = src + srclen - 64;
   77|   286k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 286k, False: 624]
  ------------------
   78|   286k|      block64 b(src);
   79|   286k|      src += 64;
   80|   286k|      uint64_t error = 0;
   81|   286k|      const uint64_t badcharmask =
   82|   286k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   286k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 286k, Folded]
  |  Branch (83:30): [True: 374, False: 285k]
  ------------------
   84|    374|        src -= 64;
   85|    374|        const size_t error_offset = trailing_zeroes(error);
   86|    374|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    374|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    374|      }
   89|   285k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 37.0k, False: 248k]
  ------------------
   90|  37.0k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   248k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 119k, False: 129k]
  ------------------
   92|   119k|        b.copy_block(bufferptr);
   93|   119k|        bufferptr += 64;
   94|   129k|      } else {
   95|   129k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 129k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|   129k|        } else {
   98|   129k|          b.base64_decode_block(dst);
   99|   129k|        }
  100|   129k|        dst += 48;
  101|   129k|      }
  102|   285k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 30.6k, False: 255k]
  ------------------
  103|   153k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 122k, False: 30.6k]
  ------------------
  104|   122k|          base64_decode_block(dst, buffer + i * 64);
  105|   122k|          dst += 48;
  106|   122k|        }
  107|  30.6k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 30.6k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  30.6k|        } else {
  110|  30.6k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  30.6k|        }
  112|  30.6k|        dst += 48;
  113|  30.6k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  30.6k|                    64); // 64 might be too much
  115|  30.6k|        bufferptr -= (block_size - 1) * 64;
  116|  30.6k|      }
  117|   285k|    }
  118|    998|  }
  119|       |
  120|    924|  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|    924|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    924|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 572, False: 352]
  |  Branch (124:26): [True: 90, False: 482]
  ------------------
  125|       |
  126|  1.47k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.40k, False: 64]
  |  Branch (126:52): [True: 1.39k, False: 18]
  ------------------
  127|  1.39k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.39k|      *bufferptr = char(val);
  129|  1.39k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.39k, Folded]
  ------------------
  130|  1.39k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.39k]
  |  Branch (130:52): [True: 8, False: 1.38k]
  ------------------
  131|      8|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      8|                size_t(dst - dstinit)};
  133|      8|      }
  134|  1.38k|      bufferptr += (val <= 63);
  135|  1.38k|      src++;
  136|  1.38k|    }
  137|     90|  }
  138|       |
  139|  1.40k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 490, False: 916]
  ------------------
  140|    490|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 34, False: 456]
  ------------------
  141|     34|      base64_decode_block_safe(dst, buffer_start);
  142|    456|    } else {
  143|    456|      base64_decode_block(dst, buffer_start);
  144|    456|    }
  145|    490|    dst += 48;
  146|    490|  }
  147|    916|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 500, False: 416]
  ------------------
  148|  4.13k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.63k, False: 500]
  ------------------
  149|  3.63k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.63k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.63k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.63k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.63k|                        << 8;
  154|  3.63k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.63k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.63k|#endif
  157|  3.63k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.63k|      dst += 3;
  160|  3.63k|      buffer_start += 4;
  161|  3.63k|    }
  162|    500|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 132, False: 368]
  ------------------
  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|    500|    int leftover = int(bufferptr - buffer_start);
  179|  1.20k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 708, False: 500]
  ------------------
  180|    708|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 708, Folded]
  ------------------
  181|  5.39k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.68k, False: 708]
  ------------------
  182|  4.68k|          src--;
  183|  4.68k|        }
  184|    708|      } 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|    708|      src--;
  190|    708|      leftover--;
  191|    708|    }
  192|    500|  }
  193|    916|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 764, False: 152]
  ------------------
  194|    764|    full_result r = scalar::base64::base64_tail_decode(
  195|    764|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    764|    r = scalar::base64::patch_tail_result(
  197|    764|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    764|        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|    764|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 372, False: 392]
  |  Branch (203:43): [True: 346, False: 26]
  ------------------
  204|    346|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 284, False: 62]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    732|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 724, False: 8]
  ------------------
  207|    724|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 448, False: 276]
  ------------------
  208|    448|        r.input_count++;
  209|    448|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    284|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 276, False: 8]
  ------------------
  213|  1.72k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.65k, False: 64]
  ------------------
  214|  1.65k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.44k, False: 212]
  ------------------
  215|  1.44k|          r.input_count--;
  216|  1.44k|        }
  217|    276|      }
  218|    284|    }
  219|    764|    return r;
  220|    764|  }
  221|    152|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 152, Folded]
  |  Branch (221:26): [True: 0, False: 152]
  ------------------
  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|    152|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    152|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.17k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.17k|  const uint8_t *to_base64 =
   47|  1.17k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.17k]
  ------------------
   48|  1.17k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.17k, Folded]
  ------------------
   49|  1.17k|                                   : tables::base64::to_base64_value);
   50|  1.17k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.17k|  size_t equallocation = ri.equallocation;
   52|  1.17k|  size_t equalsigns = ri.equalsigns;
   53|  1.17k|  srclen = ri.srclen;
   54|  1.17k|  size_t full_input_length = ri.full_input_length;
   55|  1.17k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 20, False: 1.15k]
  ------------------
   56|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 20, Folded]
  |  Branch (56:28): [True: 8, False: 12]
  ------------------
   57|      8|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      8|    }
   59|     12|    return {SUCCESS, full_input_length, 0};
   60|     20|  }
   61|  1.15k|  char *end_of_safe_64byte_zone =
   62|  1.15k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 88, False: 1.06k]
  ------------------
   63|  1.15k|          ? nullptr
   64|  1.15k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 318, False: 750]
  ------------------
   65|  1.06k|                                        : dst);
   66|       |
   67|  1.15k|  const chartype *const srcinit = src;
   68|  1.15k|  const char *const dstinit = dst;
   69|  1.15k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.15k|  constexpr size_t block_size = 6;
   72|  1.15k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.15k|  char buffer[block_size * 64];
   74|  1.15k|  char *bufferptr = buffer;
   75|  1.15k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 880, False: 276]
  ------------------
   76|    880|    const chartype *const srcend64 = src + srclen - 64;
   77|  26.6k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 26.0k, False: 586]
  ------------------
   78|  26.0k|      block64 b(src);
   79|  26.0k|      src += 64;
   80|  26.0k|      uint64_t error = 0;
   81|  26.0k|      const uint64_t badcharmask =
   82|  26.0k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  26.0k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 26.0k, Folded]
  |  Branch (83:30): [True: 294, False: 25.7k]
  ------------------
   84|    294|        src -= 64;
   85|    294|        const size_t error_offset = trailing_zeroes(error);
   86|    294|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    294|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    294|      }
   89|  25.7k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 21.5k, False: 4.20k]
  ------------------
   90|  21.5k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  21.5k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 3.85k, False: 346]
  ------------------
   92|  3.85k|        b.copy_block(bufferptr);
   93|  3.85k|        bufferptr += 64;
   94|  3.85k|      } else {
   95|    346|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 8, False: 338]
  ------------------
   96|      8|          b.base64_decode_block_safe(dst);
   97|    338|        } else {
   98|    338|          b.base64_decode_block(dst);
   99|    338|        }
  100|    346|        dst += 48;
  101|    346|      }
  102|  25.7k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 4.79k, False: 20.9k]
  ------------------
  103|  23.9k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 19.1k, False: 4.79k]
  ------------------
  104|  19.1k|          base64_decode_block(dst, buffer + i * 64);
  105|  19.1k|          dst += 48;
  106|  19.1k|        }
  107|  4.79k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 4.79k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  4.79k|        } else {
  110|  4.79k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  4.79k|        }
  112|  4.79k|        dst += 48;
  113|  4.79k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  4.79k|                    64); // 64 might be too much
  115|  4.79k|        bufferptr -= (block_size - 1) * 64;
  116|  4.79k|      }
  117|  25.7k|    }
  118|    880|  }
  119|       |
  120|    862|  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|    862|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    862|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 550, False: 312]
  |  Branch (124:26): [True: 106, False: 444]
  ------------------
  125|       |
  126|    682|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 630, False: 52]
  |  Branch (126:52): [True: 618, False: 12]
  ------------------
  127|    618|      uint8_t val = to_base64[uint8_t(*src)];
  128|    618|      *bufferptr = char(val);
  129|    618|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 618, Folded]
  ------------------
  130|    618|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 24, False: 594]
  |  Branch (130:52): [True: 18, False: 576]
  ------------------
  131|     42|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     42|                size_t(dst - dstinit)};
  133|     42|      }
  134|    576|      bufferptr += (val <= 63);
  135|    576|      src++;
  136|    576|    }
  137|    106|  }
  138|       |
  139|  1.18k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 364, False: 820]
  ------------------
  140|    364|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 30, False: 334]
  ------------------
  141|     30|      base64_decode_block_safe(dst, buffer_start);
  142|    334|    } else {
  143|    334|      base64_decode_block(dst, buffer_start);
  144|    334|    }
  145|    364|    dst += 48;
  146|    364|  }
  147|    820|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 456, False: 364]
  ------------------
  148|  3.65k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.19k, False: 456]
  ------------------
  149|  3.19k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.19k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.19k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.19k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.19k|                        << 8;
  154|  3.19k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.19k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.19k|#endif
  157|  3.19k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.19k|      dst += 3;
  160|  3.19k|      buffer_start += 4;
  161|  3.19k|    }
  162|    456|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 116, False: 340]
  ------------------
  163|    116|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    116|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    116|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    116|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    116|                        << 8;
  168|    116|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    116|      triple = scalar::u32_swap_bytes(triple);
  170|    116|#endif
  171|    116|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    116|      dst += 3;
  174|    116|      buffer_start += 4;
  175|    116|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    456|    int leftover = int(bufferptr - buffer_start);
  179|  1.13k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 676, False: 456]
  ------------------
  180|    676|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 676, Folded]
  ------------------
  181|  6.88k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 6.20k, False: 676]
  ------------------
  182|  6.20k|          src--;
  183|  6.20k|        }
  184|    676|      } 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|    676|      src--;
  190|    676|      leftover--;
  191|    676|    }
  192|    456|  }
  193|    820|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 690, False: 130]
  ------------------
  194|    690|    full_result r = scalar::base64::base64_tail_decode(
  195|    690|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    690|    r = scalar::base64::patch_tail_result(
  197|    690|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    690|        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|    690|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 424, False: 266]
  |  Branch (203:43): [True: 340, False: 84]
  ------------------
  204|    340|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 312, False: 28]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    652|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 646, False: 6]
  ------------------
  207|    646|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 340, False: 306]
  ------------------
  208|    340|        r.input_count++;
  209|    340|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    312|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 306, False: 6]
  ------------------
  213|  1.80k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.72k, False: 78]
  ------------------
  214|  1.72k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.49k, False: 228]
  ------------------
  215|  1.49k|          r.input_count--;
  216|  1.49k|        }
  217|    306|      }
  218|    312|    }
  219|    690|    return r;
  220|    690|  }
  221|    130|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 130, Folded]
  |  Branch (221:26): [True: 0, False: 130]
  ------------------
  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|    130|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    130|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.30k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.30k|  const uint8_t *to_base64 =
   47|  1.30k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.30k]
  ------------------
   48|  1.30k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.30k]
  ------------------
   49|  1.30k|                                   : tables::base64::to_base64_value);
   50|  1.30k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.30k|  size_t equallocation = ri.equallocation;
   52|  1.30k|  size_t equalsigns = ri.equalsigns;
   53|  1.30k|  srclen = ri.srclen;
   54|  1.30k|  size_t full_input_length = ri.full_input_length;
   55|  1.30k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 24, False: 1.27k]
  ------------------
   56|     24|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 24, Folded]
  |  Branch (56:28): [True: 16, False: 8]
  ------------------
   57|     16|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     16|    }
   59|      8|    return {SUCCESS, full_input_length, 0};
   60|     24|  }
   61|  1.27k|  char *end_of_safe_64byte_zone =
   62|  1.27k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 98, False: 1.18k]
  ------------------
   63|  1.27k|          ? nullptr
   64|  1.27k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 368, False: 812]
  ------------------
   65|  1.18k|                                        : dst);
   66|       |
   67|  1.27k|  const chartype *const srcinit = src;
   68|  1.27k|  const char *const dstinit = dst;
   69|  1.27k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.27k|  constexpr size_t block_size = 6;
   72|  1.27k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.27k|  char buffer[block_size * 64];
   74|  1.27k|  char *bufferptr = buffer;
   75|  1.27k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 958, False: 320]
  ------------------
   76|    958|    const chartype *const srcend64 = src + srclen - 64;
   77|  44.4k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 43.8k, False: 638]
  ------------------
   78|  43.8k|      block64 b(src);
   79|  43.8k|      src += 64;
   80|  43.8k|      uint64_t error = 0;
   81|  43.8k|      const uint64_t badcharmask =
   82|  43.8k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  43.8k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 43.8k, Folded]
  |  Branch (83:30): [True: 320, False: 43.5k]
  ------------------
   84|    320|        src -= 64;
   85|    320|        const size_t error_offset = trailing_zeroes(error);
   86|    320|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    320|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    320|      }
   89|  43.5k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 33.7k, False: 9.70k]
  ------------------
   90|  33.7k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  33.7k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 9.44k, False: 264]
  ------------------
   92|  9.44k|        b.copy_block(bufferptr);
   93|  9.44k|        bufferptr += 64;
   94|  9.44k|      } else {
   95|    264|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 4, False: 260]
  ------------------
   96|      4|          b.base64_decode_block_safe(dst);
   97|    260|        } else {
   98|    260|          b.base64_decode_block(dst);
   99|    260|        }
  100|    264|        dst += 48;
  101|    264|      }
  102|  43.5k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 8.25k, False: 35.2k]
  ------------------
  103|  41.2k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 33.0k, False: 8.25k]
  ------------------
  104|  33.0k|          base64_decode_block(dst, buffer + i * 64);
  105|  33.0k|          dst += 48;
  106|  33.0k|        }
  107|  8.25k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 8.25k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  8.25k|        } else {
  110|  8.25k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  8.25k|        }
  112|  8.25k|        dst += 48;
  113|  8.25k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  8.25k|                    64); // 64 might be too much
  115|  8.25k|        bufferptr -= (block_size - 1) * 64;
  116|  8.25k|      }
  117|  43.5k|    }
  118|    958|  }
  119|       |
  120|    958|  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|    958|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    958|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 596, False: 362]
  |  Branch (124:26): [True: 122, False: 474]
  ------------------
  125|       |
  126|  1.07k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.01k, False: 54]
  |  Branch (126:52): [True: 1.00k, False: 12]
  ------------------
  127|  1.00k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.00k|      *bufferptr = char(val);
  129|  1.00k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.00k, Folded]
  ------------------
  130|  1.00k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 32, False: 972]
  |  Branch (130:52): [True: 24, False: 948]
  ------------------
  131|     56|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     56|                size_t(dst - dstinit)};
  133|     56|      }
  134|    948|      bufferptr += (val <= 63);
  135|    948|      src++;
  136|    948|    }
  137|    122|  }
  138|       |
  139|  1.32k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 418, False: 902]
  ------------------
  140|    418|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 30, False: 388]
  ------------------
  141|     30|      base64_decode_block_safe(dst, buffer_start);
  142|    388|    } else {
  143|    388|      base64_decode_block(dst, buffer_start);
  144|    388|    }
  145|    418|    dst += 48;
  146|    418|  }
  147|    902|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 486, False: 416]
  ------------------
  148|  3.89k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.40k, False: 486]
  ------------------
  149|  3.40k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.40k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.40k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.40k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.40k|                        << 8;
  154|  3.40k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.40k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.40k|#endif
  157|  3.40k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.40k|      dst += 3;
  160|  3.40k|      buffer_start += 4;
  161|  3.40k|    }
  162|    486|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 112, False: 374]
  ------------------
  163|    112|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    112|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    112|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    112|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    112|                        << 8;
  168|    112|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    112|      triple = scalar::u32_swap_bytes(triple);
  170|    112|#endif
  171|    112|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    112|      dst += 3;
  174|    112|      buffer_start += 4;
  175|    112|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    486|    int leftover = int(bufferptr - buffer_start);
  179|  1.22k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 734, False: 486]
  ------------------
  180|    734|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 734, Folded]
  ------------------
  181|  5.95k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 5.22k, False: 734]
  ------------------
  182|  5.22k|          src--;
  183|  5.22k|        }
  184|    734|      } 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|    734|      src--;
  190|    734|      leftover--;
  191|    734|    }
  192|    486|  }
  193|    902|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 778, False: 124]
  ------------------
  194|    778|    full_result r = scalar::base64::base64_tail_decode(
  195|    778|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    778|    r = scalar::base64::patch_tail_result(
  197|    778|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    778|        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|    778|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 432, False: 346]
  |  Branch (203:43): [True: 318, False: 114]
  ------------------
  204|    318|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 288, False: 30]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    670|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 664, False: 6]
  ------------------
  207|    664|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 382, False: 282]
  ------------------
  208|    382|        r.input_count++;
  209|    382|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    288|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 282, False: 6]
  ------------------
  213|  1.49k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.43k, False: 62]
  ------------------
  214|  1.43k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.21k, False: 220]
  ------------------
  215|  1.21k|          r.input_count--;
  216|  1.21k|        }
  217|    282|      }
  218|    288|    }
  219|    778|    return r;
  220|    778|  }
  221|    124|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 124, Folded]
  |  Branch (221:26): [True: 0, False: 124]
  ------------------
  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|    124|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    124|}

simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block64C2EPKc:
  450|   381k|  simdutf_really_inline block64(const char *src) {
  451|   381k|    chunks[0] = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src));
  452|   381k|    chunks[1] = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 32));
  453|   381k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414compress_blockEmPc:
  630|   131k|  simdutf_really_inline uint64_t compress_block(uint64_t mask, char *output) {
  631|   131k|    if (is_power_of_two(mask)) {
  ------------------
  |  Branch (631:9): [True: 86.9k, False: 44.4k]
  ------------------
  632|  86.9k|      return compress_block_single(mask, output);
  633|  86.9k|    }
  634|       |
  635|  44.4k|    uint64_t nmask = ~mask;
  636|  44.4k|    compress(chunks[0], uint32_t(mask), output);
  637|  44.4k|    compress(chunks[1], uint32_t(mask >> 32),
  638|  44.4k|             output + count_ones(nmask & 0xFFFFFFFF));
  639|  44.4k|    return count_ones(nmask);
  640|   131k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6421compress_block_singleEmPc:
  643|  86.9k|                                                     char *output) {
  644|  86.9k|    const size_t pos64 = trailing_zeroes(mask);
  645|  86.9k|    const int8_t pos = pos64 & 0xf;
  646|  86.9k|    switch (pos64 >> 4) {
  ------------------
  |  Branch (646:13): [True: 86.9k, False: 0]
  ------------------
  647|  20.7k|    case 0b00: {
  ------------------
  |  Branch (647:5): [True: 20.7k, False: 66.2k]
  ------------------
  648|  20.7k|      const __m128i lane0 = _mm256_extracti128_si256(chunks[0], 0);
  649|  20.7k|      const __m128i lane1 = _mm256_extracti128_si256(chunks[0], 1);
  650|       |
  651|  20.7k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  652|  20.7k|      const __m128i v1 =
  653|  20.7k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  654|  20.7k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  655|  20.7k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  656|  20.7k|      const __m128i compressed = _mm_shuffle_epi8(lane0, sh);
  657|       |
  658|  20.7k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), compressed);
  659|  20.7k|      _mm_storeu_si128((__m128i *)(output + 1 * 16 - 1), lane1);
  660|  20.7k|      _mm256_storeu_si256((__m256i *)(output + 2 * 16 - 1), chunks[1]);
  661|  20.7k|    } break;
  662|  22.4k|    case 0b01: {
  ------------------
  |  Branch (662:5): [True: 22.4k, False: 64.5k]
  ------------------
  663|  22.4k|      const __m128i lane0 = _mm256_extracti128_si256(chunks[0], 0);
  664|  22.4k|      const __m128i lane1 = _mm256_extracti128_si256(chunks[0], 1);
  665|  22.4k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), lane0);
  666|       |
  667|  22.4k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  668|  22.4k|      const __m128i v1 =
  669|  22.4k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  670|  22.4k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  671|  22.4k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  672|  22.4k|      const __m128i compressed = _mm_shuffle_epi8(lane1, sh);
  673|       |
  674|  22.4k|      _mm_storeu_si128((__m128i *)(output + 1 * 16), compressed);
  675|  22.4k|      _mm256_storeu_si256((__m256i *)(output + 2 * 16 - 1), chunks[1]);
  676|  22.4k|    } break;
  677|  23.0k|    case 0b10: {
  ------------------
  |  Branch (677:5): [True: 23.0k, False: 63.9k]
  ------------------
  678|  23.0k|      const __m128i lane2 = _mm256_extracti128_si256(chunks[1], 0);
  679|  23.0k|      const __m128i lane3 = _mm256_extracti128_si256(chunks[1], 1);
  680|       |
  681|  23.0k|      _mm256_storeu_si256((__m256i *)(output + 0 * 16), chunks[0]);
  682|       |
  683|  23.0k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  684|  23.0k|      const __m128i v1 =
  685|  23.0k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  686|  23.0k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  687|  23.0k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  688|  23.0k|      const __m128i compressed = _mm_shuffle_epi8(lane2, sh);
  689|       |
  690|  23.0k|      _mm_storeu_si128((__m128i *)(output + 2 * 16), compressed);
  691|  23.0k|      _mm_storeu_si128((__m128i *)(output + 3 * 16 - 1), lane3);
  692|  23.0k|    } break;
  693|  20.8k|    case 0b11: {
  ------------------
  |  Branch (693:5): [True: 20.8k, False: 66.1k]
  ------------------
  694|  20.8k|      const __m128i lane2 = _mm256_extracti128_si256(chunks[1], 0);
  695|  20.8k|      const __m128i lane3 = _mm256_extracti128_si256(chunks[1], 1);
  696|       |
  697|  20.8k|      _mm256_storeu_si256((__m256i *)(output + 0 * 16), chunks[0]);
  698|  20.8k|      _mm_storeu_si128((__m128i *)(output + 2 * 16), lane2);
  699|       |
  700|  20.8k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  701|  20.8k|      const __m128i v1 =
  702|  20.8k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  703|  20.8k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  704|  20.8k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  705|  20.8k|      const __m128i compressed = _mm_shuffle_epi8(lane3, sh);
  706|       |
  707|  20.8k|      _mm_storeu_si128((__m128i *)(output + 3 * 16), compressed);
  708|  20.8k|    } break;
  709|  86.9k|    }
  710|       |
  711|  86.9k|    return 63;
  712|  86.9k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_18compressIvEEvDv4_xjPc:
  398|  88.8k|simdutf_really_inline void compress(__m256i data, uint32_t mask, char *output) {
  399|  88.8k|  if (mask == 0) {
  ------------------
  |  Branch (399:7): [True: 16.6k, False: 72.2k]
  ------------------
  400|  16.6k|    _mm256_storeu_si256(reinterpret_cast<__m256i *>(output), data);
  401|  16.6k|    return;
  402|  16.6k|  }
  403|  72.2k|  compress(_mm256_castsi256_si128(data), uint16_t(mask), output);
  404|       |  compress(_mm256_extracti128_si256(data, 1), uint16_t(mask >> 16),
  405|  72.2k|           output + count_ones(~mask & 0xFFFF));
  406|  72.2k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_18compressEDv2_xtPc:
  361|   144k|static inline void compress(__m128i data, uint16_t mask, char *output) {
  362|   144k|  if (mask == 0) {
  ------------------
  |  Branch (362:7): [True: 43.2k, False: 101k]
  ------------------
  363|  43.2k|    _mm_storeu_si128(reinterpret_cast<__m128i *>(output), data);
  364|  43.2k|    return;
  365|  43.2k|  }
  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|   101k|  uint8_t mask1 = uint8_t(mask);      // least significant 8 bits
  369|   101k|  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|   101k|  __m128i shufmask = _mm_set_epi64x(tables::base64::thintable_epi8[mask2],
  375|   101k|                                    tables::base64::thintable_epi8[mask1]);
  376|       |  // we increment by 0x08 the second half of the mask
  377|   101k|  shufmask =
  378|   101k|      _mm_add_epi8(shufmask, _mm_set_epi32(0x08080808, 0x08080808, 0, 0));
  379|       |  // this is the version "nearly pruned"
  380|   101k|  __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|   101k|  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|   101k|  __m128i compactmask = _mm_loadu_si128(reinterpret_cast<const __m128i *>(
  389|   101k|      tables::base64::pshufb_combine_table + pop1 * 8));
  390|   101k|  __m128i answer = _mm_shuffle_epi8(pruned, compactmask);
  391|       |
  392|   101k|  _mm_storeu_si128(reinterpret_cast<__m128i *>(output), answer);
  393|   101k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6410copy_blockEPc:
  475|   146k|  simdutf_really_inline void copy_block(char *output) {
  476|   146k|    _mm256_storeu_si256(reinterpret_cast<__m256i *>(output), chunks[0]);
  477|   146k|    _mm256_storeu_si256(reinterpret_cast<__m256i *>(output + 32), chunks[1]);
  478|   146k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6424base64_decode_block_safeEPc:
  486|     28|  simdutf_really_inline void base64_decode_block_safe(char *out) {
  487|     28|    base64_decode(out, chunks[0]);
  488|     28|    alignas(32) char buffer[32]; // We enforce safety with a buffer.
  489|     28|    base64_decode(buffer, chunks[1]);
  490|     28|    std::memcpy(out + 24, buffer, 24);
  491|     28|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_113base64_decodeIvEEvPcDv4_x:
  409|   872k|simdutf_really_inline void base64_decode(char *out, __m256i str) {
  410|       |  // credit: aqrit
  411|   872k|  const __m256i pack_shuffle =
  412|   872k|      _mm256_setr_epi8(2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1,
  413|   872k|                       2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1);
  414|   872k|  const __m256i t0 = _mm256_maddubs_epi16(str, _mm256_set1_epi32(0x01400140));
  415|   872k|  const __m256i t1 = _mm256_madd_epi16(t0, _mm256_set1_epi32(0x00011000));
  416|   872k|  const __m256i t2 = _mm256_shuffle_epi8(t1, pack_shuffle);
  417|       |
  418|       |  // Store the output:
  419|   872k|  _mm_storeu_si128((__m128i *)out, _mm256_castsi256_si128(t2));
  420|       |  _mm_storeu_si128((__m128i *)(out + 12), _mm256_extracti128_si256(t2, 1));
  421|   872k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6419base64_decode_blockEPc:
  481|   172k|  simdutf_really_inline void base64_decode_block(char *out) {
  482|   172k|    base64_decode(out, chunks[0]);
  483|   172k|    base64_decode(out + 24, chunks[1]);
  484|   172k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_119base64_decode_blockIvEEvPcPKc:
  424|   263k|simdutf_really_inline void base64_decode_block(char *out, const char *src) {
  425|   263k|  base64_decode(out,
  426|   263k|                _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src)));
  427|   263k|  base64_decode(out + 24, _mm256_loadu_si256(
  428|   263k|                              reinterpret_cast<const __m256i *>(src + 32)));
  429|   263k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_124base64_decode_block_safeIvEEvPcPKc:
  433|    122|                                                    const char *src) {
  434|    122|  base64_decode(out,
  435|    122|                _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src)));
  436|    122|  alignas(32) char buffer[32]; // We enforce safety with a buffer.
  437|    122|  base64_decode(
  438|    122|      buffer, _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 32)));
  439|    122|  std::memcpy(out + 24, buffer, 24);
  440|    122|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb1ELb0ELb0EEEmPm:
  494|   121k|  simdutf_really_inline uint64_t to_base64_mask(uint64_t *error) {
  495|   121k|    uint32_t err0 = 0;
  496|   121k|    uint32_t err1 = 0;
  497|   121k|    uint64_t m0 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  498|   121k|        &chunks[0], &err0);
  499|   121k|    uint64_t m1 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  500|   121k|        &chunks[1], &err1);
  501|   121k|    if (!ignore_garbage) {
  ------------------
  |  Branch (501:9): [True: 121k, Folded]
  ------------------
  502|   121k|      *error = err0 | ((uint64_t)err1 << 32);
  503|   121k|    }
  504|   121k|    return m0 | (m1 << 32);
  505|   121k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb1ELb0ELb0EEEjPDv4_xPj:
  508|   242k|  simdutf_really_inline uint32_t to_base64_mask(__m256i *src, uint32_t *error) {
  509|   242k|    const __m256i ascii_space_tbl =
  510|   242k|        _mm256_setr_epi8(0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0xa,
  511|   242k|                         0x0, 0xc, 0xd, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0,
  512|   242k|                         0x0, 0x0, 0x0, 0x9, 0xa, 0x0, 0xc, 0xd, 0x0, 0x0);
  513|       |    // credit: aqrit
  514|   242k|    __m256i delta_asso;
  515|   242k|    if (default_or_url) {
  ------------------
  |  Branch (515:9): [Folded, False: 242k]
  ------------------
  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|   242k|    } else if (base64_url) {
  ------------------
  |  Branch (520:16): [True: 242k, Folded]
  ------------------
  521|   242k|      delta_asso = _mm256_setr_epi8(0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0,
  522|   242k|                                    0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0xF, 0x1, 0x1,
  523|   242k|                                    0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0,
  524|   242k|                                    0x0, 0x0, 0xF, 0x0, 0xF);
  525|   242k|    } 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|   242k|    __m256i delta_values;
  533|   242k|    if (default_or_url) {
  ------------------
  |  Branch (533:9): [Folded, False: 242k]
  ------------------
  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|   242k|    } else if (base64_url) {
  ------------------
  |  Branch (543:16): [True: 242k, Folded]
  ------------------
  544|   242k|      delta_values = _mm256_setr_epi8(
  545|   242k|          0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  546|   242k|          uint8_t(0xB9), 0x0, 0x11, uint8_t(0xC3), uint8_t(0xBF), uint8_t(0xE0),
  547|   242k|          uint8_t(0xB9), uint8_t(0xB9), 0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF),
  548|   242k|          uint8_t(0xBF), uint8_t(0xB9), uint8_t(0xB9), 0x0, 0x11, uint8_t(0xC3),
  549|   242k|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0xB9));
  550|   242k|    } 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|   242k|    __m256i check_asso;
  562|   242k|    if (default_or_url) {
  ------------------
  |  Branch (562:9): [Folded, False: 242k]
  ------------------
  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|   242k|    } else if (base64_url) {
  ------------------
  |  Branch (567:16): [True: 242k, Folded]
  ------------------
  568|   242k|      check_asso = _mm256_setr_epi8(0xD, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
  569|   242k|                                    0x1, 0x3, 0x7, 0xB, 0xE, 0xB, 0x6, 0xD, 0x1,
  570|   242k|                                    0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3,
  571|   242k|                                    0x7, 0xB, 0xE, 0xB, 0x6);
  572|   242k|    } 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|   242k|    __m256i check_values;
  579|   242k|    if (default_or_url) {
  ------------------
  |  Branch (579:9): [Folded, False: 242k]
  ------------------
  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|   242k|    } else if (base64_url) {
  ------------------
  |  Branch (589:16): [True: 242k, Folded]
  ------------------
  590|   242k|      check_values = _mm256_setr_epi8(
  591|   242k|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  592|   242k|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xB6), uint8_t(0xA6),
  593|   242k|          uint8_t(0xB5), uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0, uint8_t(0x80),
  594|   242k|          0x0, uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  595|   242k|          uint8_t(0x80), uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xB6),
  596|   242k|          uint8_t(0xA6), uint8_t(0xB5), uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0,
  597|   242k|          uint8_t(0x80), 0x0, uint8_t(0x80));
  598|   242k|    } 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|   242k|    const __m256i shifted = _mm256_srli_epi32(*src, 3);
  609|   242k|    __m256i delta_hash =
  610|   242k|        _mm256_avg_epu8(_mm256_shuffle_epi8(delta_asso, *src), shifted);
  611|   242k|    if (default_or_url) {
  ------------------
  |  Branch (611:9): [Folded, False: 242k]
  ------------------
  612|      0|      delta_hash = _mm256_and_si256(delta_hash, _mm256_set1_epi8(0xf));
  613|      0|    }
  614|   242k|    const __m256i check_hash =
  615|   242k|        _mm256_avg_epu8(_mm256_shuffle_epi8(check_asso, *src), shifted);
  616|   242k|    const __m256i out =
  617|   242k|        _mm256_adds_epi8(_mm256_shuffle_epi8(delta_values, delta_hash), *src);
  618|   242k|    const __m256i chk =
  619|   242k|        _mm256_adds_epi8(_mm256_shuffle_epi8(check_values, check_hash), *src);
  620|   242k|    const int mask = _mm256_movemask_epi8(chk);
  621|   242k|    if (!ignore_garbage && mask) {
  ------------------
  |  Branch (621:9): [True: 242k, Folded]
  |  Branch (621:28): [True: 77.0k, False: 165k]
  ------------------
  622|  77.0k|      __m256i ascii_space =
  623|  77.0k|          _mm256_cmpeq_epi8(_mm256_shuffle_epi8(ascii_space_tbl, *src), *src);
  624|  77.0k|      *error = (mask ^ _mm256_movemask_epi8(ascii_space));
  625|  77.0k|    }
  626|   242k|    *src = out;
  627|   242k|    return (uint32_t)mask;
  628|   242k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb0ELb0ELb0EEEmPm:
  494|   330k|  simdutf_really_inline uint64_t to_base64_mask(uint64_t *error) {
  495|   330k|    uint32_t err0 = 0;
  496|   330k|    uint32_t err1 = 0;
  497|   330k|    uint64_t m0 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  498|   330k|        &chunks[0], &err0);
  499|   330k|    uint64_t m1 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  500|   330k|        &chunks[1], &err1);
  501|   330k|    if (!ignore_garbage) {
  ------------------
  |  Branch (501:9): [True: 330k, Folded]
  ------------------
  502|   330k|      *error = err0 | ((uint64_t)err1 << 32);
  503|   330k|    }
  504|   330k|    return m0 | (m1 << 32);
  505|   330k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb0ELb0ELb0EEEjPDv4_xPj:
  508|   660k|  simdutf_really_inline uint32_t to_base64_mask(__m256i *src, uint32_t *error) {
  509|   660k|    const __m256i ascii_space_tbl =
  510|   660k|        _mm256_setr_epi8(0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0xa,
  511|   660k|                         0x0, 0xc, 0xd, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0,
  512|   660k|                         0x0, 0x0, 0x0, 0x9, 0xa, 0x0, 0xc, 0xd, 0x0, 0x0);
  513|       |    // credit: aqrit
  514|   660k|    __m256i delta_asso;
  515|   660k|    if (default_or_url) {
  ------------------
  |  Branch (515:9): [Folded, False: 660k]
  ------------------
  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|   660k|    } else if (base64_url) {
  ------------------
  |  Branch (520:16): [Folded, False: 660k]
  ------------------
  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|   660k|    } else {
  526|   660k|      delta_asso = _mm256_setr_epi8(
  527|   660k|          0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
  528|   660k|          0x00, 0x00, 0x0F, 0x00, 0x0F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  529|   660k|          0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x0F);
  530|   660k|    }
  531|       |
  532|   660k|    __m256i delta_values;
  533|   660k|    if (default_or_url) {
  ------------------
  |  Branch (533:9): [Folded, False: 660k]
  ------------------
  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|   660k|    } else if (base64_url) {
  ------------------
  |  Branch (543:16): [Folded, False: 660k]
  ------------------
  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|   660k|    } else {
  551|   660k|      delta_values = _mm256_setr_epi8(
  552|   660k|          int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13), int8_t(0x04),
  553|   660k|          int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9), int8_t(0x00),
  554|   660k|          int8_t(0x10), int8_t(0xC3), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9),
  555|   660k|          int8_t(0xB9), int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13),
  556|   660k|          int8_t(0x04), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9),
  557|   660k|          int8_t(0x00), int8_t(0x10), int8_t(0xC3), int8_t(0xBF), int8_t(0xBF),
  558|   660k|          int8_t(0xB9), int8_t(0xB9));
  559|   660k|    }
  560|       |
  561|   660k|    __m256i check_asso;
  562|   660k|    if (default_or_url) {
  ------------------
  |  Branch (562:9): [Folded, False: 660k]
  ------------------
  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|   660k|    } else if (base64_url) {
  ------------------
  |  Branch (567:16): [Folded, False: 660k]
  ------------------
  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|   660k|    } else {
  573|   660k|      check_asso = _mm256_setr_epi8(
  574|   660k|          0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
  575|   660k|          0x07, 0x0B, 0x0B, 0x0B, 0x0F, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01,
  576|   660k|          0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x0B, 0x0B, 0x0B, 0x0F);
  577|   660k|    }
  578|   660k|    __m256i check_values;
  579|   660k|    if (default_or_url) {
  ------------------
  |  Branch (579:9): [Folded, False: 660k]
  ------------------
  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|   660k|    } else if (base64_url) {
  ------------------
  |  Branch (589:16): [Folded, False: 660k]
  ------------------
  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|   660k|    } else {
  599|   660k|      check_values = _mm256_setr_epi8(
  600|   660k|          int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0xCF),
  601|   660k|          int8_t(0xBF), int8_t(0xD5), int8_t(0xA6), int8_t(0xB5), int8_t(0x86),
  602|   660k|          int8_t(0xD1), int8_t(0x80), int8_t(0xB1), int8_t(0x80), int8_t(0x91),
  603|   660k|          int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80),
  604|   660k|          int8_t(0xCF), int8_t(0xBF), int8_t(0xD5), int8_t(0xA6), int8_t(0xB5),
  605|   660k|          int8_t(0x86), int8_t(0xD1), int8_t(0x80), int8_t(0xB1), int8_t(0x80),
  606|   660k|          int8_t(0x91), int8_t(0x80));
  607|   660k|    }
  608|   660k|    const __m256i shifted = _mm256_srli_epi32(*src, 3);
  609|   660k|    __m256i delta_hash =
  610|   660k|        _mm256_avg_epu8(_mm256_shuffle_epi8(delta_asso, *src), shifted);
  611|   660k|    if (default_or_url) {
  ------------------
  |  Branch (611:9): [Folded, False: 660k]
  ------------------
  612|      0|      delta_hash = _mm256_and_si256(delta_hash, _mm256_set1_epi8(0xf));
  613|      0|    }
  614|   660k|    const __m256i check_hash =
  615|   660k|        _mm256_avg_epu8(_mm256_shuffle_epi8(check_asso, *src), shifted);
  616|   660k|    const __m256i out =
  617|   660k|        _mm256_adds_epi8(_mm256_shuffle_epi8(delta_values, delta_hash), *src);
  618|   660k|    const __m256i chk =
  619|   660k|        _mm256_adds_epi8(_mm256_shuffle_epi8(check_values, check_hash), *src);
  620|   660k|    const int mask = _mm256_movemask_epi8(chk);
  621|   660k|    if (!ignore_garbage && mask) {
  ------------------
  |  Branch (621:9): [True: 660k, Folded]
  |  Branch (621:28): [True: 84.6k, False: 575k]
  ------------------
  622|  84.6k|      __m256i ascii_space =
  623|  84.6k|          _mm256_cmpeq_epi8(_mm256_shuffle_epi8(ascii_space_tbl, *src), *src);
  624|  84.6k|      *error = (mask ^ _mm256_movemask_epi8(ascii_space));
  625|  84.6k|    }
  626|   660k|    *src = out;
  627|   660k|    return (uint32_t)mask;
  628|   660k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block64C2EPKDs:
  457|  69.8k|  simdutf_really_inline block64(const char16_t *src) {
  458|  69.8k|    const auto m1 = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src));
  459|  69.8k|    const auto m2 =
  460|  69.8k|        _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 16));
  461|  69.8k|    const auto m3 =
  462|  69.8k|        _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 32));
  463|  69.8k|    const auto m4 =
  464|  69.8k|        _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 48));
  465|       |
  466|  69.8k|    const auto m1p = _mm256_permute2x128_si256(m1, m2, 0x20);
  467|  69.8k|    const auto m2p = _mm256_permute2x128_si256(m1, m2, 0x31);
  468|  69.8k|    const auto m3p = _mm256_permute2x128_si256(m3, m4, 0x20);
  469|  69.8k|    const auto m4p = _mm256_permute2x128_si256(m3, m4, 0x31);
  470|       |
  471|  69.8k|    chunks[0] = _mm256_packus_epi16(m1p, m2p);
  472|  69.8k|    chunks[1] = _mm256_packus_epi16(m3p, m4p);
  473|  69.8k|  }

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

_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.76k|    const char *input, size_t length) const noexcept {
  118|  3.76k|  return scalar::base64::maximal_binary_length_from_base64(input, length);
  119|  3.76k|}
_ZNK7simdutf14implementation33maximal_binary_length_from_base64EPKDsm:
  122|  3.71k|    const char16_t *input, size_t length) const noexcept {
  123|  3.71k|  return scalar::base64::maximal_binary_length_from_base64(input, length);
  124|  3.71k|}
_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|   161k|simdutf_really_inline long long int count_ones(uint64_t input_num) {
   15|       |  return _popcnt64(input_num);
   16|   161k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_115trailing_zeroesEm:
   20|  88.2k|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|  88.2k|  return __builtin_ctzll(input_num);
   25|  88.2k|  #endif // SIMDUTF_REGULAR_VISUAL_STUDIO
   26|  88.2k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_115is_power_of_twoImEEbT_:
   29|   131k|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|   177k|simdutf_really_inline long long int count_ones(uint64_t input_num) {
   15|       |  return _popcnt64(input_num);
   16|   177k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115trailing_zeroesEm:
   20|  88.2k|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|  88.2k|  return __builtin_ctzll(input_num);
   27|  88.2k|  #endif // SIMDUTF_REGULAR_VISUAL_STUDIO
   28|  88.2k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115is_power_of_twoImEEbT_:
   31|   131k|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:
 1328|  1.25k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1329|  1.25k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1329:7): [True: 0, False: 1.25k]
  ------------------
 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.25k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1337:14): [True: 593, False: 661]
  ------------------
 1338|    593|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1338:9): [True: 0, False: 593]
  ------------------
 1339|      0|      return base64::compress_decode_base64<true, true, false>(
 1340|      0|          output, input, length, options, last_chunk_options);
 1341|    593|    } else {
 1342|    593|      return base64::compress_decode_base64<true, false, false>(
 1343|    593|          output, input, length, options, last_chunk_options);
 1344|    593|    }
 1345|    661|  } else {
 1346|    661|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1346:9): [True: 0, False: 661]
  ------------------
 1347|      0|      return base64::compress_decode_base64<false, true, false>(
 1348|      0|          output, input, length, options, last_chunk_options);
 1349|    661|    } else {
 1350|    661|      return base64::compress_decode_base64<false, false, false>(
 1351|    661|          output, input, length, options, last_chunk_options);
 1352|    661|    }
 1353|    661|  }
 1354|  1.25k|}
_ZNK7simdutf8westmere14implementation24base64_to_binary_detailsEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1358|  1.25k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1359|  1.25k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1359:7): [True: 0, False: 1.25k]
  ------------------
 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.25k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1367:14): [True: 593, False: 661]
  ------------------
 1368|    593|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1368:9): [True: 0, False: 593]
  ------------------
 1369|      0|      return base64::compress_decode_base64<true, true, false>(
 1370|      0|          output, input, length, options, last_chunk_options);
 1371|    593|    } else {
 1372|    593|      return base64::compress_decode_base64<true, false, false>(
 1373|    593|          output, input, length, options, last_chunk_options);
 1374|    593|    }
 1375|    661|  } else {
 1376|    661|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1376:9): [True: 0, False: 661]
  ------------------
 1377|      0|      return base64::compress_decode_base64<false, true, false>(
 1378|      0|          output, input, length, options, last_chunk_options);
 1379|    661|    } else {
 1380|    661|      return base64::compress_decode_base64<false, false, false>(
 1381|    661|          output, input, length, options, last_chunk_options);
 1382|    661|    }
 1383|    661|  }
 1384|  1.25k|}
_ZNK7simdutf8westmere14implementation16base64_to_binaryEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1388|  1.23k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1389|  1.23k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1389:7): [True: 0, False: 1.23k]
  ------------------
 1390|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1390:9): [True: 0, False: 0]
  ------------------
 1391|      0|      return base64::compress_decode_base64<false, true, true>(
 1392|      0|          output, input, length, options, last_chunk_options);
 1393|      0|    } else {
 1394|      0|      return base64::compress_decode_base64<false, false, true>(
 1395|      0|          output, input, length, options, last_chunk_options);
 1396|      0|    }
 1397|  1.23k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1397:14): [True: 588, False: 651]
  ------------------
 1398|    588|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1398:9): [True: 0, False: 588]
  ------------------
 1399|      0|      return base64::compress_decode_base64<true, true, false>(
 1400|      0|          output, input, length, options, last_chunk_options);
 1401|    588|    } else {
 1402|    588|      return base64::compress_decode_base64<true, false, false>(
 1403|    588|          output, input, length, options, last_chunk_options);
 1404|    588|    }
 1405|    651|  } else {
 1406|    651|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1406:9): [True: 0, False: 651]
  ------------------
 1407|      0|      return base64::compress_decode_base64<false, true, false>(
 1408|      0|          output, input, length, options, last_chunk_options);
 1409|    651|    } else {
 1410|    651|      return base64::compress_decode_base64<false, false, false>(
 1411|    651|          output, input, length, options, last_chunk_options);
 1412|    651|    }
 1413|    651|  }
 1414|  1.23k|}
_ZNK7simdutf8westmere14implementation24base64_to_binary_detailsEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1418|  1.23k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1419|  1.23k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1419:7): [True: 0, False: 1.23k]
  ------------------
 1420|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1420:9): [True: 0, False: 0]
  ------------------
 1421|      0|      return base64::compress_decode_base64<false, true, true>(
 1422|      0|          output, input, length, options, last_chunk_options);
 1423|      0|    } else {
 1424|      0|      return base64::compress_decode_base64<false, false, true>(
 1425|      0|          output, input, length, options, last_chunk_options);
 1426|      0|    }
 1427|  1.23k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1427:14): [True: 588, False: 651]
  ------------------
 1428|    588|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1428:9): [True: 0, False: 588]
  ------------------
 1429|      0|      return base64::compress_decode_base64<true, true, false>(
 1430|      0|          output, input, length, options, last_chunk_options);
 1431|    588|    } else {
 1432|    588|      return base64::compress_decode_base64<true, false, false>(
 1433|    588|          output, input, length, options, last_chunk_options);
 1434|    588|    }
 1435|    651|  } else {
 1436|    651|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1436:9): [True: 0, False: 651]
  ------------------
 1437|      0|      return base64::compress_decode_base64<false, true, false>(
 1438|      0|          output, input, length, options, last_chunk_options);
 1439|    651|    } else {
 1440|    651|      return base64::compress_decode_base64<false, false, false>(
 1441|    651|          output, input, length, options, last_chunk_options);
 1442|    651|    }
 1443|    651|  }
 1444|  1.23k|}

simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block64C2EPKc:
  408|   381k|  simdutf_really_inline block64(const char *src) {
  409|   381k|    chunks[0] = _mm_loadu_si128(reinterpret_cast<const __m128i *>(src));
  410|   381k|    chunks[1] = _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 16));
  411|   381k|    chunks[2] = _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 32));
  412|   381k|    chunks[3] = _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 48));
  413|   381k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6414compress_blockEmPc:
  449|   131k|  simdutf_really_inline uint64_t compress_block(uint64_t mask, char *output) {
  450|   131k|    if (is_power_of_two(mask)) {
  ------------------
  |  Branch (450:9): [True: 86.9k, False: 44.4k]
  ------------------
  451|  86.9k|      return compress_block_single(mask, output);
  452|  86.9k|    }
  453|       |
  454|  44.4k|    uint64_t nmask = ~mask;
  455|  44.4k|    compress(chunks[0], uint16_t(mask), output);
  456|  44.4k|    compress(chunks[1], uint16_t(mask >> 16),
  457|  44.4k|             output + count_ones(nmask & 0xFFFF));
  458|  44.4k|    compress(chunks[2], uint16_t(mask >> 32),
  459|  44.4k|             output + count_ones(nmask & 0xFFFFFFFF));
  460|  44.4k|    compress(chunks[3], uint16_t(mask >> 48),
  461|  44.4k|             output + count_ones(nmask & 0xFFFFFFFFFFFFULL));
  462|  44.4k|    return count_ones(nmask);
  463|   131k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6421compress_block_singleEmPc:
  467|  86.9k|                                                     char *output) {
  468|  86.9k|    const size_t pos64 = trailing_zeroes(mask);
  469|  86.9k|    const int8_t pos = pos64 & 0xf;
  470|  86.9k|    switch (pos64 >> 4) {
  ------------------
  |  Branch (470:13): [True: 86.9k, False: 0]
  ------------------
  471|  20.7k|    case 0b00: {
  ------------------
  |  Branch (471:5): [True: 20.7k, False: 66.2k]
  ------------------
  472|  20.7k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  473|  20.7k|      const __m128i v1 =
  474|  20.7k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  475|  20.7k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  476|  20.7k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  477|  20.7k|      const __m128i compressed = _mm_shuffle_epi8(chunks[0], sh);
  478|       |
  479|  20.7k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), compressed);
  480|  20.7k|      _mm_storeu_si128((__m128i *)(output + 1 * 16 - 1), chunks[1]);
  481|  20.7k|      _mm_storeu_si128((__m128i *)(output + 2 * 16 - 1), chunks[2]);
  482|  20.7k|      _mm_storeu_si128((__m128i *)(output + 3 * 16 - 1), chunks[3]);
  483|  20.7k|    } break;
  484|  22.4k|    case 0b01: {
  ------------------
  |  Branch (484:5): [True: 22.4k, False: 64.5k]
  ------------------
  485|  22.4k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), chunks[0]);
  486|       |
  487|  22.4k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  488|  22.4k|      const __m128i v1 =
  489|  22.4k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  490|  22.4k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  491|  22.4k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  492|  22.4k|      const __m128i compressed = _mm_shuffle_epi8(chunks[1], sh);
  493|       |
  494|  22.4k|      _mm_storeu_si128((__m128i *)(output + 1 * 16), compressed);
  495|  22.4k|      _mm_storeu_si128((__m128i *)(output + 2 * 16 - 1), chunks[2]);
  496|  22.4k|      _mm_storeu_si128((__m128i *)(output + 3 * 16 - 1), chunks[3]);
  497|  22.4k|    } break;
  498|  23.0k|    case 0b10: {
  ------------------
  |  Branch (498:5): [True: 23.0k, False: 63.9k]
  ------------------
  499|  23.0k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), chunks[0]);
  500|  23.0k|      _mm_storeu_si128((__m128i *)(output + 1 * 16), chunks[1]);
  501|       |
  502|  23.0k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  503|  23.0k|      const __m128i v1 =
  504|  23.0k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  505|  23.0k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  506|  23.0k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  507|  23.0k|      const __m128i compressed = _mm_shuffle_epi8(chunks[2], sh);
  508|       |
  509|  23.0k|      _mm_storeu_si128((__m128i *)(output + 2 * 16), compressed);
  510|  23.0k|      _mm_storeu_si128((__m128i *)(output + 3 * 16 - 1), chunks[3]);
  511|  23.0k|    } break;
  512|  20.8k|    case 0b11: {
  ------------------
  |  Branch (512:5): [True: 20.8k, False: 66.1k]
  ------------------
  513|  20.8k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), chunks[0]);
  514|  20.8k|      _mm_storeu_si128((__m128i *)(output + 1 * 16), chunks[1]);
  515|  20.8k|      _mm_storeu_si128((__m128i *)(output + 2 * 16), chunks[2]);
  516|       |
  517|  20.8k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  518|  20.8k|      const __m128i v1 =
  519|  20.8k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  520|  20.8k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  521|  20.8k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  522|  20.8k|      const __m128i compressed = _mm_shuffle_epi8(chunks[3], sh);
  523|       |
  524|  20.8k|      _mm_storeu_si128((__m128i *)(output + 3 * 16), compressed);
  525|  20.8k|    } break;
  526|  86.9k|    }
  527|       |
  528|  86.9k|    return 63;
  529|  86.9k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_18compressEDv2_xtPc:
  329|   177k|                                           char *output) {
  330|   177k|  if (mask == 0) {
  ------------------
  |  Branch (330:7): [True: 76.4k, False: 101k]
  ------------------
  331|  76.4k|    _mm_storeu_si128(reinterpret_cast<__m128i *>(output), data);
  332|  76.4k|    return;
  333|  76.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|   101k|  uint8_t mask1 = uint8_t(mask);      // least significant 8 bits
  338|   101k|  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|   101k|  __m128i shufmask = _mm_set_epi64x(tables::base64::thintable_epi8[mask2],
  344|   101k|                                    tables::base64::thintable_epi8[mask1]);
  345|       |  // we increment by 0x08 the second half of the mask
  346|   101k|  shufmask =
  347|   101k|      _mm_add_epi8(shufmask, _mm_set_epi32(0x08080808, 0x08080808, 0, 0));
  348|       |  // this is the version "nearly pruned"
  349|   101k|  __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|   101k|  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|   101k|  __m128i compactmask = _mm_loadu_si128(reinterpret_cast<const __m128i *>(
  358|   101k|      tables::base64::pshufb_combine_table + pop1 * 8));
  359|   101k|  __m128i answer = _mm_shuffle_epi8(pruned, compactmask);
  360|   101k|  _mm_storeu_si128(reinterpret_cast<__m128i *>(output), answer);
  361|   101k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6410copy_blockEPc:
  441|   146k|  simdutf_really_inline void copy_block(char *output) {
  442|   146k|    _mm_storeu_si128(reinterpret_cast<__m128i *>(output), chunks[0]);
  443|   146k|    _mm_storeu_si128(reinterpret_cast<__m128i *>(output + 16), chunks[1]);
  444|   146k|    _mm_storeu_si128(reinterpret_cast<__m128i *>(output + 32), chunks[2]);
  445|   146k|    _mm_storeu_si128(reinterpret_cast<__m128i *>(output + 48), chunks[3]);
  446|   146k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6424base64_decode_block_safeEPc:
  659|     28|  simdutf_really_inline void base64_decode_block_safe(char *out) {
  660|     28|    base64_decode(out, chunks[0]);
  661|     28|    base64_decode(out + 12, chunks[1]);
  662|     28|    base64_decode(out + 24, chunks[2]);
  663|     28|    char buffer[16];
  664|     28|    base64_decode(buffer, chunks[3]);
  665|     28|    std::memcpy(out + 36, buffer, 12);
  666|     28|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_113base64_decodeEPcDv2_x:
  363|  1.74M|static simdutf_really_inline void base64_decode(char *out, __m128i str) {
  364|       |  // credit: aqrit
  365|       |
  366|  1.74M|  const __m128i pack_shuffle =
  367|  1.74M|      _mm_setr_epi8(2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1);
  368|       |
  369|  1.74M|  const __m128i t0 = _mm_maddubs_epi16(str, _mm_set1_epi32(0x01400140));
  370|  1.74M|  const __m128i t1 = _mm_madd_epi16(t0, _mm_set1_epi32(0x00011000));
  371|  1.74M|  const __m128i t2 = _mm_shuffle_epi8(t1, pack_shuffle);
  372|       |  // Store the output:
  373|       |  // this writes 16 bytes, but we only need 12.
  374|  1.74M|  _mm_storeu_si128((__m128i *)out, t2);
  375|  1.74M|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6419base64_decode_blockEPc:
  651|   172k|  simdutf_really_inline void base64_decode_block(char *out) {
  652|   172k|    base64_decode(out, chunks[0]);
  653|   172k|    base64_decode(out + 12, chunks[1]);
  654|   172k|    base64_decode(out + 24, chunks[2]);
  655|   172k|    base64_decode(out + 36, chunks[3]);
  656|   172k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_119base64_decode_blockEPcPKc:
  378|   263k|static inline void base64_decode_block(char *out, const char *src) {
  379|   263k|  base64_decode(out, _mm_loadu_si128(reinterpret_cast<const __m128i *>(src)));
  380|   263k|  base64_decode(out + 12,
  381|   263k|                _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 16)));
  382|   263k|  base64_decode(out + 24,
  383|   263k|                _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 32)));
  384|   263k|  base64_decode(out + 36,
  385|   263k|                _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 48)));
  386|   263k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_124base64_decode_block_safeEPcPKc:
  388|    122|static inline void base64_decode_block_safe(char *out, const char *src) {
  389|    122|  base64_decode(out, _mm_loadu_si128(reinterpret_cast<const __m128i *>(src)));
  390|    122|  base64_decode(out + 12,
  391|    122|                _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 16)));
  392|    122|  base64_decode(out + 24,
  393|    122|                _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 32)));
  394|    122|  char buffer[16];
  395|    122|  base64_decode(buffer,
  396|    122|                _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 48)));
  397|    122|  std::memcpy(out + 36, buffer, 12);
  398|    122|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6414to_base64_maskILb1ELb0ELb0EEEmPm:
  533|   121k|  simdutf_really_inline uint64_t to_base64_mask(uint64_t *error) {
  534|   121k|    uint32_t err0 = 0;
  535|   121k|    uint32_t err1 = 0;
  536|   121k|    uint32_t err2 = 0;
  537|   121k|    uint32_t err3 = 0;
  538|   121k|    uint64_t m0 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  539|   121k|        &chunks[0], &err0);
  540|   121k|    uint64_t m1 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  541|   121k|        &chunks[1], &err1);
  542|   121k|    uint64_t m2 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  543|   121k|        &chunks[2], &err2);
  544|   121k|    uint64_t m3 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  545|   121k|        &chunks[3], &err3);
  546|   121k|    if (!ignore_garbage) {
  ------------------
  |  Branch (546:9): [True: 121k, Folded]
  ------------------
  547|   121k|      *error = (err0) | ((uint64_t)err1 << 16) | ((uint64_t)err2 << 32) |
  548|   121k|               ((uint64_t)err3 << 48);
  549|   121k|    }
  550|   121k|    return m0 | (m1 << 16) | (m2 << 32) | (m3 << 48);
  551|   121k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6414to_base64_maskILb1ELb0ELb0EEEtPDv2_xPj:
  555|   485k|  simdutf_really_inline uint16_t to_base64_mask(__m128i *src, uint32_t *error) {
  556|   485k|    const __m128i ascii_space_tbl =
  557|   485k|        _mm_setr_epi8(0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0xa,
  558|   485k|                      0x0, 0xc, 0xd, 0x0, 0x0);
  559|       |    // credit: aqrit
  560|   485k|    __m128i delta_asso;
  561|   485k|    if (default_or_url) {
  ------------------
  |  Branch (561:9): [Folded, False: 485k]
  ------------------
  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|   485k|    } else if (base64_url) {
  ------------------
  |  Branch (565:16): [True: 485k, Folded]
  ------------------
  566|   485k|      delta_asso = _mm_setr_epi8(0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0,
  567|   485k|                                 0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0xF);
  568|   485k|    } 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|   485k|    __m128i delta_values;
  574|   485k|    if (default_or_url) {
  ------------------
  |  Branch (574:9): [Folded, False: 485k]
  ------------------
  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|   485k|    } else if (base64_url) {
  ------------------
  |  Branch (581:16): [True: 485k, Folded]
  ------------------
  582|   485k|      delta_values = _mm_setr_epi8(0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF),
  583|   485k|                                   uint8_t(0xBF), uint8_t(0xB9), uint8_t(0xB9),
  584|   485k|                                   0x0, 0x11, uint8_t(0xC3), uint8_t(0xBF),
  585|   485k|                                   uint8_t(0xE0), uint8_t(0xB9), uint8_t(0xB9));
  586|   485k|    } 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|   485k|    __m128i check_asso;
  594|   485k|    if (default_or_url) {
  ------------------
  |  Branch (594:9): [Folded, False: 485k]
  ------------------
  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|   485k|    } else if (base64_url) {
  ------------------
  |  Branch (598:16): [True: 485k, Folded]
  ------------------
  599|   485k|      check_asso = _mm_setr_epi8(0xD, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
  600|   485k|                                 0x1, 0x3, 0x7, 0xB, 0xE, 0xB, 0x6);
  601|   485k|    } 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|   485k|    __m128i check_values;
  607|   485k|    if (default_or_url) {
  ------------------
  |  Branch (607:9): [Folded, False: 485k]
  ------------------
  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|   485k|    } else if (base64_url) {
  ------------------
  |  Branch (613:16): [True: 485k, Folded]
  ------------------
  614|   485k|      check_values = _mm_setr_epi8(uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  615|   485k|                                   uint8_t(0x80), uint8_t(0xCF), uint8_t(0xBF),
  616|   485k|                                   uint8_t(0xB6), uint8_t(0xA6), uint8_t(0xB5),
  617|   485k|                                   uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0,
  618|   485k|                                   uint8_t(0x80), 0x0, uint8_t(0x80));
  619|   485k|    } 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|   485k|    const __m128i shifted = _mm_srli_epi32(*src, 3);
  627|       |
  628|   485k|    __m128i delta_hash =
  629|   485k|        _mm_avg_epu8(_mm_shuffle_epi8(delta_asso, *src), shifted);
  630|   485k|    if (default_or_url) {
  ------------------
  |  Branch (630:9): [Folded, False: 485k]
  ------------------
  631|      0|      delta_hash = _mm_and_si128(delta_hash, _mm_set1_epi8(0xf));
  632|      0|    }
  633|   485k|    const __m128i check_hash =
  634|   485k|        _mm_avg_epu8(_mm_shuffle_epi8(check_asso, *src), shifted);
  635|       |
  636|   485k|    const __m128i out =
  637|   485k|        _mm_adds_epi8(_mm_shuffle_epi8(delta_values, delta_hash), *src);
  638|   485k|    const __m128i chk =
  639|   485k|        _mm_adds_epi8(_mm_shuffle_epi8(check_values, check_hash), *src);
  640|   485k|    const int mask = _mm_movemask_epi8(chk);
  641|   485k|    if (!ignore_garbage && mask) {
  ------------------
  |  Branch (641:9): [True: 485k, Folded]
  |  Branch (641:28): [True: 97.5k, False: 388k]
  ------------------
  642|  97.5k|      __m128i ascii_space =
  643|  97.5k|          _mm_cmpeq_epi8(_mm_shuffle_epi8(ascii_space_tbl, *src), *src);
  644|  97.5k|      *error = (mask ^ _mm_movemask_epi8(ascii_space));
  645|  97.5k|    }
  646|   485k|    *src = out;
  647|   485k|    return (uint16_t)mask;
  648|   485k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6414to_base64_maskILb0ELb0ELb0EEEmPm:
  533|   330k|  simdutf_really_inline uint64_t to_base64_mask(uint64_t *error) {
  534|   330k|    uint32_t err0 = 0;
  535|   330k|    uint32_t err1 = 0;
  536|   330k|    uint32_t err2 = 0;
  537|   330k|    uint32_t err3 = 0;
  538|   330k|    uint64_t m0 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  539|   330k|        &chunks[0], &err0);
  540|   330k|    uint64_t m1 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  541|   330k|        &chunks[1], &err1);
  542|   330k|    uint64_t m2 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  543|   330k|        &chunks[2], &err2);
  544|   330k|    uint64_t m3 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  545|   330k|        &chunks[3], &err3);
  546|   330k|    if (!ignore_garbage) {
  ------------------
  |  Branch (546:9): [True: 330k, Folded]
  ------------------
  547|   330k|      *error = (err0) | ((uint64_t)err1 << 16) | ((uint64_t)err2 << 32) |
  548|   330k|               ((uint64_t)err3 << 48);
  549|   330k|    }
  550|   330k|    return m0 | (m1 << 16) | (m2 << 32) | (m3 << 48);
  551|   330k|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block6414to_base64_maskILb0ELb0ELb0EEEtPDv2_xPj:
  555|  1.32M|  simdutf_really_inline uint16_t to_base64_mask(__m128i *src, uint32_t *error) {
  556|  1.32M|    const __m128i ascii_space_tbl =
  557|  1.32M|        _mm_setr_epi8(0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0xa,
  558|  1.32M|                      0x0, 0xc, 0xd, 0x0, 0x0);
  559|       |    // credit: aqrit
  560|  1.32M|    __m128i delta_asso;
  561|  1.32M|    if (default_or_url) {
  ------------------
  |  Branch (561:9): [Folded, False: 1.32M]
  ------------------
  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.32M|    } else if (base64_url) {
  ------------------
  |  Branch (565:16): [Folded, False: 1.32M]
  ------------------
  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.32M|    } else {
  569|  1.32M|      delta_asso =
  570|  1.32M|          _mm_setr_epi8(0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
  571|  1.32M|                        0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x0F);
  572|  1.32M|    }
  573|  1.32M|    __m128i delta_values;
  574|  1.32M|    if (default_or_url) {
  ------------------
  |  Branch (574:9): [Folded, False: 1.32M]
  ------------------
  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.32M|    } else if (base64_url) {
  ------------------
  |  Branch (581:16): [Folded, False: 1.32M]
  ------------------
  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.32M|    } else {
  587|  1.32M|      delta_values =
  588|  1.32M|          _mm_setr_epi8(int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13),
  589|  1.32M|                        int8_t(0x04), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9),
  590|  1.32M|                        int8_t(0xB9), int8_t(0x00), int8_t(0x10), int8_t(0xC3),
  591|  1.32M|                        int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9));
  592|  1.32M|    }
  593|  1.32M|    __m128i check_asso;
  594|  1.32M|    if (default_or_url) {
  ------------------
  |  Branch (594:9): [Folded, False: 1.32M]
  ------------------
  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.32M|    } else if (base64_url) {
  ------------------
  |  Branch (598:16): [Folded, False: 1.32M]
  ------------------
  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.32M|    } else {
  602|  1.32M|      check_asso =
  603|  1.32M|          _mm_setr_epi8(0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  604|  1.32M|                        0x01, 0x03, 0x07, 0x0B, 0x0B, 0x0B, 0x0F);
  605|  1.32M|    }
  606|  1.32M|    __m128i check_values;
  607|  1.32M|    if (default_or_url) {
  ------------------
  |  Branch (607:9): [Folded, False: 1.32M]
  ------------------
  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.32M|    } else if (base64_url) {
  ------------------
  |  Branch (613:16): [Folded, False: 1.32M]
  ------------------
  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.32M|    } else {
  620|  1.32M|      check_values =
  621|  1.32M|          _mm_setr_epi8(int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80),
  622|  1.32M|                        int8_t(0xCF), int8_t(0xBF), int8_t(0xD5), int8_t(0xA6),
  623|  1.32M|                        int8_t(0xB5), int8_t(0x86), int8_t(0xD1), int8_t(0x80),
  624|  1.32M|                        int8_t(0xB1), int8_t(0x80), int8_t(0x91), int8_t(0x80));
  625|  1.32M|    }
  626|  1.32M|    const __m128i shifted = _mm_srli_epi32(*src, 3);
  627|       |
  628|  1.32M|    __m128i delta_hash =
  629|  1.32M|        _mm_avg_epu8(_mm_shuffle_epi8(delta_asso, *src), shifted);
  630|  1.32M|    if (default_or_url) {
  ------------------
  |  Branch (630:9): [Folded, False: 1.32M]
  ------------------
  631|      0|      delta_hash = _mm_and_si128(delta_hash, _mm_set1_epi8(0xf));
  632|      0|    }
  633|  1.32M|    const __m128i check_hash =
  634|  1.32M|        _mm_avg_epu8(_mm_shuffle_epi8(check_asso, *src), shifted);
  635|       |
  636|  1.32M|    const __m128i out =
  637|  1.32M|        _mm_adds_epi8(_mm_shuffle_epi8(delta_values, delta_hash), *src);
  638|  1.32M|    const __m128i chk =
  639|  1.32M|        _mm_adds_epi8(_mm_shuffle_epi8(check_values, check_hash), *src);
  640|  1.32M|    const int mask = _mm_movemask_epi8(chk);
  641|  1.32M|    if (!ignore_garbage && mask) {
  ------------------
  |  Branch (641:9): [True: 1.32M, Folded]
  |  Branch (641:28): [True: 95.3k, False: 1.22M]
  ------------------
  642|  95.3k|      __m128i ascii_space =
  643|  95.3k|          _mm_cmpeq_epi8(_mm_shuffle_epi8(ascii_space_tbl, *src), *src);
  644|  95.3k|      *error = (mask ^ _mm_movemask_epi8(ascii_space));
  645|  95.3k|    }
  646|  1.32M|    *src = out;
  647|  1.32M|    return (uint16_t)mask;
  648|  1.32M|  }
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_17block64C2EPKDs:
  419|  69.8k|  simdutf_really_inline block64(const char16_t *src) {
  420|  69.8k|    const auto m1 = _mm_loadu_si128(reinterpret_cast<const __m128i *>(src));
  421|  69.8k|    const auto m2 = _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 8));
  422|  69.8k|    const auto m3 =
  423|  69.8k|        _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 16));
  424|  69.8k|    const auto m4 =
  425|  69.8k|        _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 24));
  426|  69.8k|    const auto m5 =
  427|  69.8k|        _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 32));
  428|  69.8k|    const auto m6 =
  429|  69.8k|        _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 40));
  430|  69.8k|    const auto m7 =
  431|  69.8k|        _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 48));
  432|  69.8k|    const auto m8 =
  433|  69.8k|        _mm_loadu_si128(reinterpret_cast<const __m128i *>(src + 56));
  434|  69.8k|    chunks[0] = _mm_packus_epi16(m1, m2);
  435|  69.8k|    chunks[1] = _mm_packus_epi16(m3, m4);
  436|  69.8k|    chunks[2] = _mm_packus_epi16(m5, m6);
  437|  69.8k|    chunks[3] = _mm_packus_epi16(m7, m8);
  438|  69.8k|  }

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

