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: 267, False: 1.97k]
  ------------------
  185|  2.49k|          ? simdutf::last_chunk_handling_options::loose
  186|  2.49k|          : [](auto index) {
  187|  1.97k|              if (index >= last_chunk.size()) {
  188|  1.97k|                return last_chunk[0];
  189|  1.97k|              }
  190|  1.97k|              return last_chunk[index];
  191|  1.97k|            }(data[2] & (std::bit_ceil(last_chunk.size()) - 1));
  192|       |
  193|       |  // data[3] reserved for future use / alignment.
  194|       |
  195|  2.49k|  data += optionbytes;
  196|  2.49k|  size -= optionbytes;
  197|       |
  198|  2.49k|  switch (action) {
  ------------------
  |  Branch (198:11): [True: 2.49k, False: 0]
  ------------------
  199|  1.23k|  case 0: {
  ------------------
  |  Branch (199:3): [True: 1.23k, False: 1.26k]
  ------------------
  200|  1.23k|    const std::span<const char> chardata{reinterpret_cast<const char*>(data),
  201|  1.23k|                                         size};
  202|  1.23k|    test_details(chardata, opt, lco);
  203|  1.23k|  } break;
  204|  1.26k|  case 1: {
  ------------------
  |  Branch (204:3): [True: 1.26k, False: 1.23k]
  ------------------
  205|  1.26k|    const std::span<const char16_t> chardata{
  206|  1.26k|        reinterpret_cast<const char16_t*>(data), size / sizeof(char16_t)};
  207|  1.26k|    test_details(chardata, opt, lco);
  208|  1.26k|  } 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.97k|          : [](auto index) {
  187|  1.97k|              if (index >= last_chunk.size()) {
  ------------------
  |  Branch (187:19): [True: 185, False: 1.78k]
  ------------------
  188|    185|                return last_chunk[0];
  189|    185|              }
  190|  1.78k|              return last_chunk[index];
  191|  1.97k|            }(data[2] & (std::bit_ceil(last_chunk.size()) - 1));
base64_details.cpp:_ZL12test_detailsIcEvNSt3__14spanIKT_Lm18446744073709551615EEEN7simdutf14base64_optionsENS5_27last_chunk_handling_optionsE:
   57|  1.23k|                         simdutf::last_chunk_handling_options lco) {
   58|  1.23k|  const auto implementations = get_supported_implementations();
   59|  1.23k|  if (implementations.empty()) {
  ------------------
  |  Branch (59:7): [True: 0, False: 1.23k]
  ------------------
   60|      0|    return;
   61|      0|  }
   62|       |
   63|  1.23k|  std::vector<comparable_full_result> results;
   64|  1.23k|  results.reserve(implementations.size());
   65|       |
   66|  3.69k|  for (auto impl : implementations) {
  ------------------
  |  Branch (66:18): [True: 3.69k, False: 1.23k]
  ------------------
   67|       |    // Use a fresh buffer for base64_to_binary_details.
   68|  3.69k|    const std::size_t maxbinary =
   69|  3.69k|        impl->maximal_binary_length_from_base64(input.data(), input.size());
   70|  3.69k|    std::vector<char> out_details(maxbinary);
   71|       |
   72|  3.69k|    const simdutf::full_result fr = impl->base64_to_binary_details(
   73|  3.69k|        input.data(), input.size(), out_details.data(), opt, lco);
   74|       |
   75|       |    // Bounds checks.
   76|  3.69k|    if (fr.input_count > input.size()) {
  ------------------
  |  Branch (76:9): [True: 0, False: 3.69k]
  ------------------
   77|      0|      std::cerr << "base64_to_binary_details: input_count=" << fr.input_count
   78|      0|                << " > input.size()=" << input.size()
   79|      0|                << " impl=" << impl->name() << "\n";
   80|      0|      std::abort();
   81|      0|    }
   82|  3.69k|    if (fr.output_count > maxbinary) {
  ------------------
  |  Branch (82:9): [True: 0, False: 3.69k]
  ------------------
   83|      0|      std::cerr << "base64_to_binary_details: output_count=" << fr.output_count
   84|      0|                << " > maxbinary=" << maxbinary << " impl=" << impl->name()
   85|      0|                << "\n";
   86|      0|      std::abort();
   87|      0|    }
   88|       |
   89|       |    // Consistency check: full_result cast to result must equal
   90|       |    // base64_to_binary.
   91|  3.69k|    std::vector<char> out_plain(maxbinary);
   92|  3.69k|    const simdutf::result r = impl->base64_to_binary(
   93|  3.69k|        input.data(), input.size(), out_plain.data(), opt, lco);
   94|  3.69k|    const simdutf::result r_from_fr = static_cast<simdutf::result>(fr);
   95|       |
   96|  3.69k|    if (r != r_from_fr) {
  ------------------
  |  Branch (96:9): [True: 0, False: 3.69k]
  ------------------
   97|      0|      std::cerr << "base64_to_binary_details vs base64_to_binary inconsistency"
   98|      0|                << " impl=" << impl->name()
   99|      0|                << " base64_to_binary=[error=" << r.error
  100|      0|                << " count=" << r.count << "]"
  101|      0|                << " full_result cast=[error=" << r_from_fr.error
  102|      0|                << " count=" << r_from_fr.count << "]\n";
  103|      0|      std::abort();
  104|      0|    }
  105|       |
  106|       |    // On success, output bytes from both functions must match.
  107|  3.69k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (107:9): [True: 2.10k, False: 1.58k]
  ------------------
  108|  2.10k|      if (fr.output_count != r.count) {
  ------------------
  |  Branch (108:11): [True: 0, False: 2.10k]
  ------------------
  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.10k|      const auto span_details =
  115|  2.10k|          std::span(out_details).subspan(0, fr.output_count);
  116|  2.10k|      const auto span_plain = std::span(out_plain).subspan(0, r.count);
  117|  2.10k|      if (!std::ranges::equal(span_details, span_plain)) {
  ------------------
  |  Branch (117:11): [True: 0, False: 2.10k]
  ------------------
  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.10k|    }
  124|       |
  125|       |    // Store result for cross-implementation comparison.
  126|       |    //
  127|       |    // output_count on error is implementation-defined: SIMD implementations
  128|       |    // process input in different chunk widths and may write different numbers
  129|       |    // of output bytes before detecting an invalid character. Only compare
  130|       |    // output_count (and output_hash) when the conversion succeeds.
  131|       |    //
  132|       |    // input_count on success is also implementation-defined: with
  133|       |    // stop_before_partial and trailing ignored whitespace, some implementations
  134|       |    // include the trailing whitespace in input_count and others do not. The
  135|       |    // full_result::operator result() cast only uses output_count on success
  136|       |    // (input_count is not part of the base contract there). Only compare
  137|       |    // input_count when the conversion fails, where it carries the error
  138|       |    // position (which must be deterministic).
  139|  3.69k|    comparable_full_result cfr;
  140|  3.69k|    cfr.error = fr.error;
  141|  3.69k|    cfr.padding_error = fr.padding_error;
  142|  3.69k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (142:9): [True: 2.10k, False: 1.58k]
  ------------------
  143|  2.10k|      cfr.output_count = fr.output_count;
  144|  2.10k|      cfr.output_hash = FNV1A_hash::as_str(
  145|  2.10k|          std::span(out_details).subspan(0, fr.output_count));
  146|  2.10k|    } else {
  147|  1.58k|      cfr.input_count = fr.input_count;
  148|  1.58k|    }
  149|  3.69k|    results.push_back(std::move(cfr));
  150|  3.69k|  }
  151|       |
  152|       |  // All implementations must agree on the full_result.
  153|  1.23k|  auto neq = [](const auto& a, const auto& b) { return a != b; };
  154|  1.23k|  if (std::ranges::adjacent_find(results, neq) != results.end()) {
  ------------------
  |  Branch (154:7): [True: 0, False: 1.23k]
  ------------------
  155|      0|    std::cerr << "base64_to_binary_details: implementations disagree\n";
  156|      0|    for (std::size_t i = 0; i < implementations.size(); ++i) {
  ------------------
  |  Branch (156:29): [True: 0, False: 0]
  ------------------
  157|      0|      std::cerr << "  " << implementations[i]->name() << ": " << results[i]
  158|      0|                << "\n";
  159|      0|    }
  160|      0|    std::abort();
  161|      0|  }
  162|  1.23k|}
base64_details.cpp:_ZZL12test_detailsIcEvNSt3__14spanIKT_Lm18446744073709551615EEEN7simdutf14base64_optionsENS5_27last_chunk_handling_optionsEENKUlRS3_RKT0_E_clI22comparable_full_resultSE_EEDaS8_SB_:
  153|  2.46k|  auto neq = [](const auto& a, const auto& b) { return a != b; };
base64_details.cpp:_ZL12test_detailsIDsEvNSt3__14spanIKT_Lm18446744073709551615EEEN7simdutf14base64_optionsENS5_27last_chunk_handling_optionsE:
   57|  1.26k|                         simdutf::last_chunk_handling_options lco) {
   58|  1.26k|  const auto implementations = get_supported_implementations();
   59|  1.26k|  if (implementations.empty()) {
  ------------------
  |  Branch (59:7): [True: 0, False: 1.26k]
  ------------------
   60|      0|    return;
   61|      0|  }
   62|       |
   63|  1.26k|  std::vector<comparable_full_result> results;
   64|  1.26k|  results.reserve(implementations.size());
   65|       |
   66|  3.78k|  for (auto impl : implementations) {
  ------------------
  |  Branch (66:18): [True: 3.78k, False: 1.26k]
  ------------------
   67|       |    // Use a fresh buffer for base64_to_binary_details.
   68|  3.78k|    const std::size_t maxbinary =
   69|  3.78k|        impl->maximal_binary_length_from_base64(input.data(), input.size());
   70|  3.78k|    std::vector<char> out_details(maxbinary);
   71|       |
   72|  3.78k|    const simdutf::full_result fr = impl->base64_to_binary_details(
   73|  3.78k|        input.data(), input.size(), out_details.data(), opt, lco);
   74|       |
   75|       |    // Bounds checks.
   76|  3.78k|    if (fr.input_count > input.size()) {
  ------------------
  |  Branch (76:9): [True: 0, False: 3.78k]
  ------------------
   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.78k|    if (fr.output_count > maxbinary) {
  ------------------
  |  Branch (82:9): [True: 0, False: 3.78k]
  ------------------
   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.78k|    std::vector<char> out_plain(maxbinary);
   92|  3.78k|    const simdutf::result r = impl->base64_to_binary(
   93|  3.78k|        input.data(), input.size(), out_plain.data(), opt, lco);
   94|  3.78k|    const simdutf::result r_from_fr = static_cast<simdutf::result>(fr);
   95|       |
   96|  3.78k|    if (r != r_from_fr) {
  ------------------
  |  Branch (96:9): [True: 0, False: 3.78k]
  ------------------
   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.78k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (107:9): [True: 1.68k, False: 2.10k]
  ------------------
  108|  1.68k|      if (fr.output_count != r.count) {
  ------------------
  |  Branch (108:11): [True: 0, False: 1.68k]
  ------------------
  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.68k|      const auto span_details =
  115|  1.68k|          std::span(out_details).subspan(0, fr.output_count);
  116|  1.68k|      const auto span_plain = std::span(out_plain).subspan(0, r.count);
  117|  1.68k|      if (!std::ranges::equal(span_details, span_plain)) {
  ------------------
  |  Branch (117:11): [True: 0, False: 1.68k]
  ------------------
  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.68k|    }
  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.78k|    comparable_full_result cfr;
  140|  3.78k|    cfr.error = fr.error;
  141|  3.78k|    cfr.padding_error = fr.padding_error;
  142|  3.78k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (142:9): [True: 1.68k, False: 2.10k]
  ------------------
  143|  1.68k|      cfr.output_count = fr.output_count;
  144|  1.68k|      cfr.output_hash = FNV1A_hash::as_str(
  145|  1.68k|          std::span(out_details).subspan(0, fr.output_count));
  146|  2.10k|    } else {
  147|  2.10k|      cfr.input_count = fr.input_count;
  148|  2.10k|    }
  149|  3.78k|    results.push_back(std::move(cfr));
  150|  3.78k|  }
  151|       |
  152|       |  // All implementations must agree on the full_result.
  153|  1.26k|  auto neq = [](const auto& a, const auto& b) { return a != b; };
  154|  1.26k|  if (std::ranges::adjacent_find(results, neq) != results.end()) {
  ------------------
  |  Branch (154:7): [True: 0, False: 1.26k]
  ------------------
  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.26k|}
base64_details.cpp:_ZZL12test_detailsIDsEvNSt3__14spanIKT_Lm18446744073709551615EEEN7simdutf14base64_optionsENS5_27last_chunk_handling_optionsEENKUlRS3_RKT0_E_clI22comparable_full_resultSE_EEDaS8_SB_:
  153|  2.52k|  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.78k|  template <typename... Data> static std::string as_str(const Data&... data) {
  101|  3.78k|    static_assert(sizeof...(Data) > 0, "must hash with at least one argument");
  102|  3.78k|    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.78k|    } else {
  108|  3.78k|      h = fnv1ahash_impl(data...);
  109|  3.78k|    }
  110|  3.78k|    constexpr std::size_t expected_chars = 16;
  111|  3.78k|    std::string ret(expected_chars, '0');
  112|  3.78k|    auto c = std::to_chars(ret.data(), ret.data() + ret.size(), h, 16);
  113|  3.78k|    assert(c.ec == std::errc{});
  ------------------
  |  Branch (113:5): [True: 3.78k, False: 0]
  ------------------
  114|  3.78k|    auto nwritten = c.ptr - ret.data();
  115|  3.78k|    assert(nwritten <= expected_chars);
  ------------------
  |  Branch (115:5): [True: 3.78k, False: 0]
  ------------------
  116|  3.78k|    std::rotate(ret.data(), c.ptr, ret.data() + expected_chars);
  117|  3.78k|    return ret;
  118|  3.78k|  }
_ZN10FNV1A_hash14fnv1ahash_implENSt3__14spanIKcLm18446744073709551615EEE:
   75|  3.78k|  static constexpr std::uint64_t fnv1ahash_impl(std::span<const char> bytes) {
   76|  3.78k|    auto hash = offset;
   77|       |
   78|  30.7M|    for (auto byte : bytes) {
  ------------------
  |  Branch (78:20): [True: 30.7M, False: 3.78k]
  ------------------
   79|  30.7M|      hash ^= static_cast<unsigned char>(byte);
   80|  30.7M|      hash *= prime;
   81|  30.7M|    }
   82|       |
   83|  3.78k|    return hash;
   84|  3.78k|  }

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

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

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|  27.0M|template <class char_type> simdutf_constexpr23 bool is_eight_byte(char_type c) {
   20|  27.0M|  if constexpr (sizeof(char_type) == 1) {
   21|  27.0M|    return true;
   22|  27.0M|  }
   23|      0|  return uint8_t(c) == c;
   24|  27.0M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6413is_eight_byteIDsEEbT_:
   19|  6.59M|template <class char_type> simdutf_constexpr23 bool is_eight_byte(char_type c) {
   20|       |  if constexpr (sizeof(char_type) == 1) {
   21|       |    return true;
   22|       |  }
   23|  6.59M|  return uint8_t(c) == c;
   24|  6.59M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKcEEmT_m:
  654|  3.69k|maximal_binary_length_from_base64(InputPtr input, size_t length) noexcept {
  655|       |  // We process the padding characters ('=') at the end to make sure
  656|       |  // that we return an exact result when the input has no ignorable characters
  657|       |  // (e.g., spaces).
  658|  3.69k|  size_t padding = 0;
  659|  3.69k|  if (length > 0) {
  ------------------
  |  Branch (659:7): [True: 3.68k, False: 12]
  ------------------
  660|  3.68k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (660:9): [True: 213, False: 3.47k]
  ------------------
  661|    213|      padding++;
  662|    213|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (662:11): [True: 207, False: 6]
  |  Branch (662:25): [True: 27, False: 180]
  ------------------
  663|     27|        padding++;
  664|     27|      }
  665|    213|    }
  666|  3.68k|  }
  667|       |  // The input is not otherwise processed for ignorable characters or
  668|       |  // validation, so that the function runs in constant time (very fast). In
  669|       |  // practice, base64 inputs without ignorable characters are common and the
  670|       |  // common case are line separated inputs with relatively long lines (e.g., 76
  671|       |  // characters) which leads this function to a slight (1%) overestimation of
  672|       |  // the output size.
  673|       |  //
  674|       |  // Of course, some inputs might contain an arbitrary number of spaces or
  675|       |  // newlines, which would make this function return a very pessimistic output
  676|       |  // size but systems that produce base64 outputs typically do not do that and
  677|       |  // if they do, they do not care much about minimizing memory usage.
  678|       |  //
  679|       |  // In specialized applications, users may know that their input is line
  680|       |  // separated, which can be checked very quickly by by iterating (e.g., over 76
  681|       |  // character chunks, looking for the linefeed characters only). We could
  682|       |  // provide a specialized function for that, but it is not clear that the added
  683|       |  // complexity is worth it for us.
  684|       |  //
  685|  3.69k|  size_t actual_length = length - padding;
  686|  3.69k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (686:7): [True: 3.12k, False: 570]
  ------------------
  687|  3.12k|    return actual_length / 4 * 3;
  688|  3.12k|  }
  689|       |  // if we have a valid input, then the remainder must be 2 or 3 adding one or
  690|       |  // two extra bytes.
  691|    570|  return actual_length / 4 * 3 + (actual_length % 4) - 1;
  692|  3.69k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKDsEEmT_m:
  654|  3.78k|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.78k|  size_t padding = 0;
  659|  3.78k|  if (length > 0) {
  ------------------
  |  Branch (659:7): [True: 3.76k, False: 15]
  ------------------
  660|  3.76k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (660:9): [True: 294, False: 3.47k]
  ------------------
  661|    294|      padding++;
  662|    294|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (662:11): [True: 288, False: 6]
  |  Branch (662:25): [True: 36, False: 252]
  ------------------
  663|     36|        padding++;
  664|     36|      }
  665|    294|    }
  666|  3.76k|  }
  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.78k|  size_t actual_length = length - padding;
  686|  3.78k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (686:7): [True: 3.24k, False: 537]
  ------------------
  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|    537|  return actual_length / 4 * 3 + (actual_length % 4) - 1;
  692|  3.78k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIcEEbT_NS_14base64_optionsE:
   28|  18.5k|                                      simdutf::base64_options options) {
   29|  18.5k|  const uint8_t *to_base64 =
   30|  18.5k|      (options & base64_default_or_url)
  ------------------
  |  Branch (30:7): [True: 0, False: 18.5k]
  ------------------
   31|  18.5k|          ? tables::base64::to_base64_default_or_url_value
   32|  18.5k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (32:14): [True: 9.49k, False: 9.00k]
  ------------------
   33|  18.5k|                                    : tables::base64::to_base64_value);
   34|  18.5k|  const bool ignore_garbage =
   35|  18.5k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (35:7): [True: 0, False: 18.5k]
  ------------------
   36|  18.5k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (36:7): [True: 0, False: 18.5k]
  ------------------
   37|  18.5k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (37:7): [True: 0, False: 18.5k]
  ------------------
   38|  18.5k|  uint8_t code = to_base64[uint8_t(c)];
   39|  18.5k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (39:7): [True: 18.5k, False: 0]
  |  Branch (39:27): [True: 2.74k, False: 15.7k]
  ------------------
   40|  2.74k|    return false;
   41|  2.74k|  }
   42|  15.7k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (42:7): [True: 15.7k, False: 0]
  |  Branch (42:27): [True: 15.7k, False: 0]
  ------------------
   43|  15.7k|    return true;
   44|  15.7k|  }
   45|      0|  return ignore_garbage;
   46|  15.7k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIDsEEbT_NS_14base64_optionsE:
   28|  36.8k|                                      simdutf::base64_options options) {
   29|  36.8k|  const uint8_t *to_base64 =
   30|  36.8k|      (options & base64_default_or_url)
  ------------------
  |  Branch (30:7): [True: 0, False: 36.8k]
  ------------------
   31|  36.8k|          ? tables::base64::to_base64_default_or_url_value
   32|  36.8k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (32:14): [True: 16.2k, False: 20.6k]
  ------------------
   33|  36.8k|                                    : tables::base64::to_base64_value);
   34|  36.8k|  const bool ignore_garbage =
   35|  36.8k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (35:7): [True: 0, False: 36.8k]
  ------------------
   36|  36.8k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (36:7): [True: 0, False: 36.8k]
  ------------------
   37|  36.8k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (37:7): [True: 0, False: 36.8k]
  ------------------
   38|  36.8k|  uint8_t code = to_base64[uint8_t(c)];
   39|  36.8k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (39:7): [True: 36.8k, False: 0]
  |  Branch (39:27): [True: 3.23k, False: 33.6k]
  ------------------
   40|  3.23k|    return false;
   41|  3.23k|  }
   42|  33.6k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (42:7): [True: 33.6k, False: 0]
  |  Branch (42:27): [True: 33.6k, False: 0]
  ------------------
   43|  33.6k|    return true;
   44|  33.6k|  }
   45|      0|  return ignore_garbage;
   46|  33.6k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIcEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  100|  7.39k|                                           simdutf::base64_options options) {
  101|  7.39k|  const uint8_t *to_base64 =
  102|  7.39k|      (options & base64_default_or_url)
  ------------------
  |  Branch (102:7): [True: 0, False: 7.39k]
  ------------------
  103|  7.39k|          ? tables::base64::to_base64_default_or_url_value
  104|  7.39k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (104:14): [True: 3.54k, False: 3.85k]
  ------------------
  105|  7.39k|                                    : tables::base64::to_base64_value);
  106|  7.39k|  const bool ignore_garbage =
  107|  7.39k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (107:7): [True: 0, False: 7.39k]
  ------------------
  108|  7.39k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (108:7): [True: 0, False: 7.39k]
  ------------------
  109|  7.39k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (109:7): [True: 0, False: 7.39k]
  ------------------
  110|       |
  111|  7.39k|  size_t equalsigns = 0;
  112|       |  // We intentionally include trailing spaces in the full input length.
  113|       |  // See https://github.com/simdutf/simdutf/issues/824
  114|  7.39k|  size_t full_input_length = srclen;
  115|       |  // skip trailing spaces
  116|  9.30k|  while (!ignore_garbage && srclen > 0 &&
  ------------------
  |  Branch (116:10): [True: 9.30k, False: 0]
  |  Branch (116:29): [True: 9.24k, False: 66]
  ------------------
  117|  9.24k|         scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (117:10): [True: 9.24k, False: 0]
  ------------------
  118|  9.24k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (118:10): [True: 1.91k, False: 7.32k]
  ------------------
  119|  1.91k|    srclen--;
  120|  1.91k|  }
  121|  7.39k|  size_t equallocation =
  122|  7.39k|      srclen; // location of the first padding character if any
  123|  7.39k|  if (ignore_garbage) {
  ------------------
  |  Branch (123:7): [True: 0, False: 7.39k]
  ------------------
  124|       |    // Technically, we don't need to find the first padding character, we can
  125|       |    // just change our algorithms, but it adds substantial complexity.
  126|      0|    auto it = simdutf::find(src, src + srclen, '=');
  127|      0|    if (it != src + srclen) {
  ------------------
  |  Branch (127:9): [True: 0, False: 0]
  ------------------
  128|      0|      equallocation = it - src;
  129|      0|      equalsigns = 1;
  130|      0|      srclen = equallocation;
  131|      0|      full_input_length = equallocation + 1;
  132|      0|    }
  133|      0|    return {equalsigns, equallocation, srclen, full_input_length};
  134|      0|  }
  135|  7.39k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (135:7): [True: 7.39k, False: 0]
  |  Branch (135:26): [True: 7.32k, False: 66]
  |  Branch (135:40): [True: 432, False: 6.89k]
  ------------------
  136|       |    // This is the last '=' sign.
  137|    432|    equallocation = srclen - 1;
  138|    432|    srclen--;
  139|    432|    equalsigns = 1;
  140|       |    // skip trailing spaces
  141|  1.63k|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (141:12): [True: 1.59k, False: 48]
  |  Branch (141:26): [True: 1.59k, False: 0]
  ------------------
  142|  1.59k|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (142:12): [True: 1.20k, False: 384]
  ------------------
  143|  1.20k|      srclen--;
  144|  1.20k|    }
  145|    432|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (145:9): [True: 384, False: 48]
  |  Branch (145:23): [True: 66, False: 318]
  ------------------
  146|       |      // This is the second '=' sign.
  147|     66|      equallocation = srclen - 1;
  148|     66|      srclen--;
  149|     66|      equalsigns = 2;
  150|     66|    }
  151|    432|  }
  152|  7.39k|  return {equalsigns, equallocation, srclen, full_input_length};
  153|  7.39k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6417patch_tail_resultENS_11full_resultEmmmmNS_27last_chunk_handling_optionsE:
  394|  10.6k|                  last_chunk_handling_options last_chunk_options) {
  395|  10.6k|  r.input_count += previous_input;
  396|  10.6k|  r.output_count += previous_output;
  397|  10.6k|  if (r.padding_error) {
  ------------------
  |  Branch (397:7): [True: 258, False: 10.3k]
  ------------------
  398|    258|    r.input_count = equallocation;
  399|    258|  }
  400|       |
  401|  10.6k|  if (r.error == error_code::SUCCESS) {
  ------------------
  |  Branch (401:7): [True: 6.42k, False: 4.23k]
  ------------------
  402|  6.42k|    if (!is_partial(last_chunk_options)) {
  ------------------
  |  Branch (402:9): [True: 2.11k, False: 4.30k]
  ------------------
  403|       |      // A success when we are not in stop_before_partial mode.
  404|       |      // means that we have consumed the whole input buffer.
  405|  2.11k|      r.input_count = full_input_length;
  406|  4.30k|    } else if (r.output_count % 3 != 0) {
  ------------------
  |  Branch (406:16): [True: 24, False: 4.28k]
  ------------------
  407|     24|      r.input_count = full_input_length;
  408|     24|    }
  409|  6.42k|  }
  410|  10.6k|  return r;
  411|  10.6k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIDsEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  100|  7.56k|                                           simdutf::base64_options options) {
  101|  7.56k|  const uint8_t *to_base64 =
  102|  7.56k|      (options & base64_default_or_url)
  ------------------
  |  Branch (102:7): [True: 0, False: 7.56k]
  ------------------
  103|  7.56k|          ? tables::base64::to_base64_default_or_url_value
  104|  7.56k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (104:14): [True: 3.66k, False: 3.90k]
  ------------------
  105|  7.56k|                                    : tables::base64::to_base64_value);
  106|  7.56k|  const bool ignore_garbage =
  107|  7.56k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (107:7): [True: 0, False: 7.56k]
  ------------------
  108|  7.56k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (108:7): [True: 0, False: 7.56k]
  ------------------
  109|  7.56k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (109:7): [True: 0, False: 7.56k]
  ------------------
  110|       |
  111|  7.56k|  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.56k|  size_t full_input_length = srclen;
  115|       |  // skip trailing spaces
  116|  8.98k|  while (!ignore_garbage && srclen > 0 &&
  ------------------
  |  Branch (116:10): [True: 8.98k, False: 0]
  |  Branch (116:29): [True: 8.91k, False: 66]
  ------------------
  117|  8.91k|         scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (117:10): [True: 7.05k, False: 1.86k]
  ------------------
  118|  7.05k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (118:10): [True: 1.41k, False: 5.63k]
  ------------------
  119|  1.41k|    srclen--;
  120|  1.41k|  }
  121|  7.56k|  size_t equallocation =
  122|  7.56k|      srclen; // location of the first padding character if any
  123|  7.56k|  if (ignore_garbage) {
  ------------------
  |  Branch (123:7): [True: 0, False: 7.56k]
  ------------------
  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.56k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (135:7): [True: 7.56k, False: 0]
  |  Branch (135:26): [True: 7.50k, False: 66]
  |  Branch (135:40): [True: 588, False: 6.91k]
  ------------------
  136|       |    // This is the last '=' sign.
  137|    588|    equallocation = srclen - 1;
  138|    588|    srclen--;
  139|    588|    equalsigns = 1;
  140|       |    // skip trailing spaces
  141|  1.42k|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (141:12): [True: 1.37k, False: 48]
  |  Branch (141:26): [True: 1.13k, False: 240]
  ------------------
  142|  1.13k|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (142:12): [True: 834, False: 300]
  ------------------
  143|    834|      srclen--;
  144|    834|    }
  145|    588|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (145:9): [True: 540, False: 48]
  |  Branch (145:23): [True: 72, False: 468]
  ------------------
  146|       |      // This is the second '=' sign.
  147|     72|      equallocation = srclen - 1;
  148|     72|      srclen--;
  149|     72|      equalsigns = 2;
  150|     72|    }
  151|    588|  }
  152|  7.56k|  return {equalsigns, equallocation, srclen, full_input_length};
  153|  7.56k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIcEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  727|  2.46k|    last_chunk_handling_options last_chunk_options) noexcept {
  728|  2.46k|  const bool ignore_garbage =
  729|  2.46k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (729:7): [True: 0, False: 2.46k]
  ------------------
  730|  2.46k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (730:7): [True: 0, False: 2.46k]
  ------------------
  731|  2.46k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (731:7): [True: 0, False: 2.46k]
  ------------------
  732|  2.46k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  733|  2.46k|  size_t equallocation = ri.equallocation;
  734|  2.46k|  size_t equalsigns = ri.equalsigns;
  735|  2.46k|  length = ri.srclen;
  736|  2.46k|  size_t full_input_length = ri.full_input_length;
  737|  2.46k|  if (length == 0) {
  ------------------
  |  Branch (737:7): [True: 42, False: 2.42k]
  ------------------
  738|     42|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (738:9): [True: 42, False: 0]
  |  Branch (738:28): [True: 20, False: 22]
  ------------------
  739|     20|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
  740|     20|    }
  741|     22|    return {SUCCESS, full_input_length, 0};
  742|     42|  }
  743|  2.42k|  full_result r = scalar::base64::base64_tail_decode(
  744|  2.42k|      output, input, length, equalsigns, options, last_chunk_options);
  745|  2.42k|  r = scalar::base64::patch_tail_result(r, 0, 0, equallocation,
  746|  2.42k|                                        full_input_length, last_chunk_options);
  747|  2.42k|  if (!is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (747:7): [True: 1.42k, False: 996]
  |  Branch (747:42): [True: 644, False: 782]
  ------------------
  748|    644|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (748:7): [True: 12, False: 632]
  |  Branch (748:25): [True: 12, False: 0]
  ------------------
  749|       |    // additional checks
  750|     12|    if ((r.output_count % 3 == 0) ||
  ------------------
  |  Branch (750:9): [True: 0, False: 12]
  ------------------
  751|     12|        ((r.output_count % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (751:9): [True: 0, False: 12]
  ------------------
  752|      0|      return {INVALID_BASE64_CHARACTER, equallocation, r.output_count, true};
  753|      0|    }
  754|     12|  }
  755|       |  // When is_partial(last_chunk_options) is true, we must either end with
  756|       |  // the end of the stream (beyond whitespace) or right after a non-ignorable
  757|       |  // character or at the very beginning of the stream.
  758|       |  // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  759|  2.42k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (759:7): [True: 996, False: 1.42k]
  |  Branch (759:41): [True: 740, False: 256]
  ------------------
  760|    740|      r.input_count < full_input_length) {
  ------------------
  |  Branch (760:7): [True: 528, False: 212]
  ------------------
  761|       |    // First check if we can extend the input to the end of the stream
  762|  4.18k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (762:12): [True: 4.17k, False: 12]
  ------------------
  763|  4.17k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (763:12): [True: 3.65k, False: 516]
  ------------------
  764|  3.65k|      r.input_count++;
  765|  3.65k|    }
  766|       |    // If we are still not at the end of the stream, then we must backtrack
  767|       |    // to the last non-ignorable character.
  768|    528|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (768:9): [True: 516, False: 12]
  ------------------
  769|  3.84k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (769:14): [True: 3.73k, False: 116]
  ------------------
  770|  3.73k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (770:14): [True: 3.33k, False: 400]
  ------------------
  771|  3.33k|        r.input_count--;
  772|  3.33k|      }
  773|    516|    }
  774|    528|  }
  775|  2.42k|  return r;
  776|  2.42k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6418base64_tail_decodeIcEENS_11full_resultEPcPKT_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  371|  5.23k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  372|  5.23k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  373|  5.23k|                                        options, last_chunk_options);
  374|  5.23k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EcEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  164|  5.23k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  165|  5.23k|  char *dstend = dst + outlen;
  166|  5.23k|  (void)dstend;
  167|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  168|       |  // two branches (easily predicted):
  169|  5.23k|  const uint8_t *to_base64 =
  170|  5.23k|      (options & base64_default_or_url)
  ------------------
  |  Branch (170:7): [True: 0, False: 5.23k]
  ------------------
  171|  5.23k|          ? tables::base64::to_base64_default_or_url_value
  172|  5.23k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (172:14): [True: 2.52k, False: 2.71k]
  ------------------
  173|  5.23k|                                    : tables::base64::to_base64_value);
  174|  5.23k|  const uint32_t *d0 =
  175|  5.23k|      (options & base64_default_or_url)
  ------------------
  |  Branch (175:7): [True: 0, False: 5.23k]
  ------------------
  176|  5.23k|          ? tables::base64::base64_default_or_url::d0
  177|  5.23k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (177:14): [True: 2.52k, False: 2.71k]
  ------------------
  178|  5.23k|                                    : tables::base64::base64_default::d0);
  179|  5.23k|  const uint32_t *d1 =
  180|  5.23k|      (options & base64_default_or_url)
  ------------------
  |  Branch (180:7): [True: 0, False: 5.23k]
  ------------------
  181|  5.23k|          ? tables::base64::base64_default_or_url::d1
  182|  5.23k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (182:14): [True: 2.52k, False: 2.71k]
  ------------------
  183|  5.23k|                                    : tables::base64::base64_default::d1);
  184|  5.23k|  const uint32_t *d2 =
  185|  5.23k|      (options & base64_default_or_url)
  ------------------
  |  Branch (185:7): [True: 0, False: 5.23k]
  ------------------
  186|  5.23k|          ? tables::base64::base64_default_or_url::d2
  187|  5.23k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (187:14): [True: 2.52k, False: 2.71k]
  ------------------
  188|  5.23k|                                    : tables::base64::base64_default::d2);
  189|  5.23k|  const uint32_t *d3 =
  190|  5.23k|      (options & base64_default_or_url)
  ------------------
  |  Branch (190:7): [True: 0, False: 5.23k]
  ------------------
  191|  5.23k|          ? tables::base64::base64_default_or_url::d3
  192|  5.23k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (192:14): [True: 2.52k, False: 2.71k]
  ------------------
  193|  5.23k|                                    : tables::base64::base64_default::d3);
  194|  5.23k|  const bool ignore_garbage =
  195|  5.23k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (195:7): [True: 0, False: 5.23k]
  ------------------
  196|  5.23k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (196:7): [True: 0, False: 5.23k]
  ------------------
  197|  5.23k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (197:7): [True: 0, False: 5.23k]
  ------------------
  198|       |
  199|  5.23k|  const char_type *srcend = src + length;
  200|  5.23k|  const char_type *srcinit = src;
  201|  5.23k|  const char *dstinit = dst;
  202|       |
  203|  5.23k|  uint32_t x;
  204|  5.23k|  size_t idx;
  205|  5.23k|  uint8_t buffer[4];
  206|   125k|  while (true) {
  ------------------
  |  Branch (206:10): [True: 125k, Folded]
  ------------------
  207|  6.45M|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (207:12): [True: 6.45M, False: 3.33k]
  |  Branch (207:33): [True: 6.45M, False: 0]
  ------------------
  208|  6.45M|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (208:12): [True: 6.45M, False: 0]
  |  Branch (208:37): [True: 6.45M, False: 0]
  ------------------
  209|  6.45M|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (209:12): [True: 6.45M, False: 0]
  ------------------
  210|  6.45M|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (210:12): [True: 6.33M, False: 122k]
  ------------------
  211|  6.45M|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  212|  6.33M|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (212:11): [Folded, False: 6.33M]
  |  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|  6.33M|      *dst++ = static_cast<char>(x & 0xFF);
  217|  6.33M|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  218|  6.33M|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  219|  6.33M|      src += 4;
  220|  6.33M|    }
  221|   125k|    const char_type *srccur = src;
  222|   125k|    idx = 0;
  223|       |    // we need at least four characters.
  224|   125k|#ifdef __clang__
  225|       |    // If possible, we read four characters at a time. (It is an optimization.)
  226|   125k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (226:9): [True: 0, False: 125k]
  |  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|   125k|#endif
  248|   973k|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (248:12): [True: 852k, False: 120k]
  |  Branch (248:25): [True: 848k, False: 4.05k]
  ------------------
  249|   848k|      char_type c = *src;
  250|       |
  251|   848k|      uint8_t code = to_base64[uint8_t(c)];
  252|   848k|      buffer[idx] = uint8_t(code);
  253|   848k|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (253:11): [True: 848k, False: 0]
  |  Branch (253:31): [True: 488k, False: 359k]
  ------------------
  254|   488k|        idx++;
  255|   488k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (255:18): [True: 359k, False: 0]
  ------------------
  256|   359k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (256:19): [True: 1.18k, False: 358k]
  |  Branch (256:32): [True: 0, False: 358k]
  ------------------
  257|  1.18k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  258|  1.18k|                size_t(dst - dstinit)};
  259|   358k|      } else {
  260|       |        // We have a space or a newline or garbage. We ignore it.
  261|   358k|      }
  262|   847k|      src++;
  263|   847k|    }
  264|   124k|    if (idx != 4) {
  ------------------
  |  Branch (264:9): [True: 4.05k, False: 120k]
  ------------------
  265|  4.05k|      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.05k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (268:11): [True: 4.05k, False: 0]
  |  Branch (268:30): [True: 6, False: 4.04k]
  ------------------
  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.04k|      if (!ignore_garbage &&
  ------------------
  |  Branch (277:11): [True: 4.04k, False: 0]
  ------------------
  278|  4.04k|          last_chunk_options == last_chunk_handling_options::loose &&
  ------------------
  |  Branch (278:11): [True: 1.68k, False: 2.36k]
  ------------------
  279|  1.68k|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (279:11): [True: 984, False: 704]
  |  Branch (279:25): [True: 24, False: 960]
  ------------------
  280|     24|          ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (280:11): [True: 6, False: 18]
  ------------------
  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.04k|        if (!ignore_garbage &&
  ------------------
  |  Branch (288:13): [True: 4.04k, False: 0]
  ------------------
  289|  4.04k|            last_chunk_options == last_chunk_handling_options::strict &&
  ------------------
  |  Branch (289:13): [True: 316, False: 3.72k]
  ------------------
  290|    316|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (290:13): [True: 120, False: 196]
  |  Branch (290:27): [True: 72, False: 48]
  ------------------
  291|       |          // The partial chunk was at src - idx
  292|     72|          return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  293|     72|                  size_t(dst - dstinit), true};
  294|     72|        } 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.97k|          if ((last_chunk_options ==
  ------------------
  |  Branch (298:16): [True: 2.04k, False: 1.92k]
  ------------------
  299|  3.97k|                   last_chunk_handling_options::stop_before_partial &&
  300|  2.04k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (300:16): [True: 2.03k, False: 12]
  |  Branch (300:50): [True: 1.56k, False: 472]
  ------------------
  301|  1.56k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (301:17): [True: 690, False: 870]
  |  Branch (301:29): [True: 858, False: 12]
  ------------------
  302|  2.42k|              (last_chunk_options ==
  ------------------
  |  Branch (302:16): [True: 0, False: 2.42k]
  ------------------
  303|  2.42k|                   last_chunk_handling_options::only_full_chunks &&
  304|  1.54k|               (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.54k|            src = srccur;
  308|  1.54k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  309|  2.42k|          } else {
  310|  2.42k|            if (idx == 2) {
  ------------------
  |  Branch (310:17): [True: 558, False: 1.86k]
  ------------------
  311|    558|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  312|    558|                                (uint32_t(buffer[1]) << 2 * 6);
  313|    558|              if (!ignore_garbage &&
  ------------------
  |  Branch (313:19): [True: 558, False: 0]
  ------------------
  314|    558|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (314:19): [True: 24, False: 534]
  ------------------
  315|     24|                  (triple & 0xffff)) {
  ------------------
  |  Branch (315:19): [True: 18, False: 6]
  ------------------
  316|     18|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  317|     18|                        size_t(dst - dstinit)};
  318|     18|              }
  319|    540|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (319:19): [Folded, False: 540]
  |  Branch (319:37): [True: 0, False: 0]
  ------------------
  320|      0|                return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  321|      0|                        size_t(dst - dstinit)};
  322|      0|              }
  323|    540|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  324|  1.86k|            } else if (idx == 3) {
  ------------------
  |  Branch (324:24): [True: 480, False: 1.38k]
  ------------------
  325|    480|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  326|    480|                                (uint32_t(buffer[1]) << 2 * 6) +
  327|    480|                                (uint32_t(buffer[2]) << 1 * 6);
  328|    480|              if (!ignore_garbage &&
  ------------------
  |  Branch (328:19): [True: 480, False: 0]
  ------------------
  329|    480|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (329:19): [True: 24, False: 456]
  ------------------
  330|     24|                  (triple & 0xff)) {
  ------------------
  |  Branch (330:19): [True: 12, False: 12]
  ------------------
  331|     12|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  332|     12|                        size_t(dst - dstinit)};
  333|     12|              }
  334|    468|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (334:19): [Folded, False: 468]
  |  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|    468|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  339|    468|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  340|  1.38k|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (340:24): [True: 1.38k, False: 0]
  |  Branch (340:43): [True: 342, False: 1.04k]
  ------------------
  341|    342|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (341:25): [True: 330, False: 12]
  ------------------
  342|     12|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (342:26): [True: 12, False: 0]
  ------------------
  343|    342|                         padding_characters > 0))) {
  ------------------
  |  Branch (343:26): [True: 12, False: 0]
  ------------------
  344|    342|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  345|    342|                      size_t(dst - dstinit)};
  346|  1.04k|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (346:24): [True: 1.04k, False: 0]
  |  Branch (346:43): [True: 1.04k, False: 0]
  |  Branch (346:55): [True: 18, False: 1.02k]
  ------------------
  347|     18|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  348|     18|                      size_t(dst - dstinit), true};
  349|     18|            }
  350|  2.03k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  351|  2.42k|          }
  352|  4.04k|    }
  353|   120k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (353:9): [Folded, False: 120k]
  |  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|   120k|    uint32_t triple =
  358|   120k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  359|   120k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  360|   120k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  361|   120k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  362|   120k|    *dst++ = static_cast<char>(triple & 0xFF);
  363|   120k|  }
  364|  5.23k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIDsEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  727|  2.52k|    last_chunk_handling_options last_chunk_options) noexcept {
  728|  2.52k|  const bool ignore_garbage =
  729|  2.52k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (729:7): [True: 0, False: 2.52k]
  ------------------
  730|  2.52k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (730:7): [True: 0, False: 2.52k]
  ------------------
  731|  2.52k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (731:7): [True: 0, False: 2.52k]
  ------------------
  732|  2.52k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  733|  2.52k|  size_t equallocation = ri.equallocation;
  734|  2.52k|  size_t equalsigns = ri.equalsigns;
  735|  2.52k|  length = ri.srclen;
  736|  2.52k|  size_t full_input_length = ri.full_input_length;
  737|  2.52k|  if (length == 0) {
  ------------------
  |  Branch (737:7): [True: 40, False: 2.48k]
  ------------------
  738|     40|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (738:9): [True: 40, False: 0]
  |  Branch (738:28): [True: 18, False: 22]
  ------------------
  739|     18|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
  740|     18|    }
  741|     22|    return {SUCCESS, full_input_length, 0};
  742|     40|  }
  743|  2.48k|  full_result r = scalar::base64::base64_tail_decode(
  744|  2.48k|      output, input, length, equalsigns, options, last_chunk_options);
  745|  2.48k|  r = scalar::base64::patch_tail_result(r, 0, 0, equallocation,
  746|  2.48k|                                        full_input_length, last_chunk_options);
  747|  2.48k|  if (!is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (747:7): [True: 1.00k, False: 1.47k]
  |  Branch (747:42): [True: 230, False: 776]
  ------------------
  748|    230|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (748:7): [True: 8, False: 222]
  |  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.48k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (759:7): [True: 1.47k, False: 1.00k]
  |  Branch (759:41): [True: 868, False: 608]
  ------------------
  760|    868|      r.input_count < full_input_length) {
  ------------------
  |  Branch (760:7): [True: 622, False: 246]
  ------------------
  761|       |    // First check if we can extend the input to the end of the stream
  762|  8.79k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (762:12): [True: 8.78k, False: 10]
  ------------------
  763|  8.78k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (763:12): [True: 8.17k, False: 612]
  ------------------
  764|  8.17k|      r.input_count++;
  765|  8.17k|    }
  766|       |    // If we are still not at the end of the stream, then we must backtrack
  767|       |    // to the last non-ignorable character.
  768|    622|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (768:9): [True: 612, False: 10]
  ------------------
  769|  8.50k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (769:14): [True: 8.36k, False: 146]
  ------------------
  770|  8.36k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (770:14): [True: 7.89k, False: 466]
  ------------------
  771|  7.89k|        r.input_count--;
  772|  7.89k|      }
  773|    612|    }
  774|    622|  }
  775|  2.48k|  return r;
  776|  2.48k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6418base64_tail_decodeIDsEENS_11full_resultEPcPKT_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  371|  5.41k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  372|  5.41k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  373|  5.41k|                                        options, last_chunk_options);
  374|  5.41k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EDsEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  164|  5.41k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  165|  5.41k|  char *dstend = dst + outlen;
  166|  5.41k|  (void)dstend;
  167|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  168|       |  // two branches (easily predicted):
  169|  5.41k|  const uint8_t *to_base64 =
  170|  5.41k|      (options & base64_default_or_url)
  ------------------
  |  Branch (170:7): [True: 0, False: 5.41k]
  ------------------
  171|  5.41k|          ? tables::base64::to_base64_default_or_url_value
  172|  5.41k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (172:14): [True: 2.58k, False: 2.83k]
  ------------------
  173|  5.41k|                                    : tables::base64::to_base64_value);
  174|  5.41k|  const uint32_t *d0 =
  175|  5.41k|      (options & base64_default_or_url)
  ------------------
  |  Branch (175:7): [True: 0, False: 5.41k]
  ------------------
  176|  5.41k|          ? tables::base64::base64_default_or_url::d0
  177|  5.41k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (177:14): [True: 2.58k, False: 2.83k]
  ------------------
  178|  5.41k|                                    : tables::base64::base64_default::d0);
  179|  5.41k|  const uint32_t *d1 =
  180|  5.41k|      (options & base64_default_or_url)
  ------------------
  |  Branch (180:7): [True: 0, False: 5.41k]
  ------------------
  181|  5.41k|          ? tables::base64::base64_default_or_url::d1
  182|  5.41k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (182:14): [True: 2.58k, False: 2.83k]
  ------------------
  183|  5.41k|                                    : tables::base64::base64_default::d1);
  184|  5.41k|  const uint32_t *d2 =
  185|  5.41k|      (options & base64_default_or_url)
  ------------------
  |  Branch (185:7): [True: 0, False: 5.41k]
  ------------------
  186|  5.41k|          ? tables::base64::base64_default_or_url::d2
  187|  5.41k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (187:14): [True: 2.58k, False: 2.83k]
  ------------------
  188|  5.41k|                                    : tables::base64::base64_default::d2);
  189|  5.41k|  const uint32_t *d3 =
  190|  5.41k|      (options & base64_default_or_url)
  ------------------
  |  Branch (190:7): [True: 0, False: 5.41k]
  ------------------
  191|  5.41k|          ? tables::base64::base64_default_or_url::d3
  192|  5.41k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (192:14): [True: 2.58k, False: 2.83k]
  ------------------
  193|  5.41k|                                    : tables::base64::base64_default::d3);
  194|  5.41k|  const bool ignore_garbage =
  195|  5.41k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (195:7): [True: 0, False: 5.41k]
  ------------------
  196|  5.41k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (196:7): [True: 0, False: 5.41k]
  ------------------
  197|  5.41k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (197:7): [True: 0, False: 5.41k]
  ------------------
  198|       |
  199|  5.41k|  const char_type *srcend = src + length;
  200|  5.41k|  const char_type *srcinit = src;
  201|  5.41k|  const char *dstinit = dst;
  202|       |
  203|  5.41k|  uint32_t x;
  204|  5.41k|  size_t idx;
  205|  5.41k|  uint8_t buffer[4];
  206|  96.4k|  while (true) {
  ------------------
  |  Branch (206:10): [True: 96.4k, Folded]
  ------------------
  207|  1.44M|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (207:12): [True: 1.44M, False: 2.95k]
  |  Branch (207:33): [True: 1.44M, False: 352]
  ------------------
  208|  1.44M|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (208:12): [True: 1.44M, False: 204]
  |  Branch (208:37): [True: 1.44M, False: 230]
  ------------------
  209|  1.44M|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (209:12): [True: 1.44M, False: 280]
  ------------------
  210|  1.44M|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (210:12): [True: 1.34M, False: 92.4k]
  ------------------
  211|  1.44M|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  212|  1.34M|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (212:11): [Folded, False: 1.34M]
  |  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.34M|      *dst++ = static_cast<char>(x & 0xFF);
  217|  1.34M|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  218|  1.34M|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  219|  1.34M|      src += 4;
  220|  1.34M|    }
  221|  96.4k|    const char_type *srccur = src;
  222|  96.4k|    idx = 0;
  223|       |    // we need at least four characters.
  224|  96.4k|#ifdef __clang__
  225|       |    // If possible, we read four characters at a time. (It is an optimization.)
  226|  96.4k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (226:9): [True: 0, False: 96.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|  96.4k|#endif
  248|   653k|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (248:12): [True: 562k, False: 91.0k]
  |  Branch (248:25): [True: 559k, False: 3.28k]
  ------------------
  249|   559k|      char_type c = *src;
  250|       |
  251|   559k|      uint8_t code = to_base64[uint8_t(c)];
  252|   559k|      buffer[idx] = uint8_t(code);
  253|   559k|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (253:11): [True: 558k, False: 1.43k]
  |  Branch (253:31): [True: 370k, False: 187k]
  ------------------
  254|   370k|        idx++;
  255|   370k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (255:18): [True: 188k, False: 0]
  ------------------
  256|   188k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (256:19): [True: 1.38k, False: 187k]
  |  Branch (256:32): [True: 748, False: 186k]
  ------------------
  257|  2.12k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  258|  2.12k|                size_t(dst - dstinit)};
  259|   186k|      } else {
  260|       |        // We have a space or a newline or garbage. We ignore it.
  261|   186k|      }
  262|   557k|      src++;
  263|   557k|    }
  264|  94.3k|    if (idx != 4) {
  ------------------
  |  Branch (264:9): [True: 3.28k, False: 91.0k]
  ------------------
  265|  3.28k|      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.28k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (268:11): [True: 3.28k, False: 0]
  |  Branch (268:30): [True: 12, False: 3.27k]
  ------------------
  269|     12|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  270|     12|                size_t(dst - dstinit), true};
  271|     12|      }
  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: 624, False: 2.65k]
  ------------------
  279|    624|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (279:11): [True: 354, False: 270]
  |  Branch (279:25): [True: 12, False: 342]
  ------------------
  280|     12|          ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (280:11): [True: 6, False: 6]
  ------------------
  281|      6|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  282|      6|                size_t(dst - dstinit), true};
  283|      6|      } else
  284|       |
  285|       |        // The idea here is that in strict mode, we do not want to accept
  286|       |        // incomplete base64 chunks. So if the chunk was otherwise valid, we
  287|       |        // return BASE64_INPUT_REMAINDER.
  288|  3.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: 330, False: 2.93k]
  ------------------
  290|    330|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (290:13): [True: 186, False: 144]
  |  Branch (290:27): [True: 120, False: 66]
  ------------------
  291|       |          // The partial chunk was at src - idx
  292|    120|          return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  293|    120|                  size_t(dst - dstinit), true};
  294|    120|        } 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.14k|          if ((last_chunk_options ==
  ------------------
  |  Branch (298:16): [True: 2.32k, False: 828]
  ------------------
  299|  3.14k|                   last_chunk_handling_options::stop_before_partial &&
  300|  2.32k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (300:16): [True: 2.30k, False: 12]
  |  Branch (300:50): [True: 1.86k, False: 442]
  ------------------
  301|  1.86k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (301:17): [True: 888, False: 978]
  |  Branch (301:29): [True: 948, False: 30]
  ------------------
  302|  1.31k|              (last_chunk_options ==
  ------------------
  |  Branch (302:16): [True: 0, False: 1.31k]
  ------------------
  303|  1.31k|                   last_chunk_handling_options::only_full_chunks &&
  304|  1.83k|               (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.83k|            src = srccur;
  308|  1.83k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  309|  1.83k|          } else {
  310|  1.31k|            if (idx == 2) {
  ------------------
  |  Branch (310:17): [True: 240, False: 1.07k]
  ------------------
  311|    240|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  312|    240|                                (uint32_t(buffer[1]) << 2 * 6);
  313|    240|              if (!ignore_garbage &&
  ------------------
  |  Branch (313:19): [True: 240, False: 0]
  ------------------
  314|    240|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (314:19): [True: 36, False: 204]
  ------------------
  315|     36|                  (triple & 0xffff)) {
  ------------------
  |  Branch (315:19): [True: 30, False: 6]
  ------------------
  316|     30|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  317|     30|                        size_t(dst - dstinit)};
  318|     30|              }
  319|    210|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (319:19): [Folded, False: 210]
  |  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|    210|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  324|  1.07k|            } else if (idx == 3) {
  ------------------
  |  Branch (324:24): [True: 186, False: 886]
  ------------------
  325|    186|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  326|    186|                                (uint32_t(buffer[1]) << 2 * 6) +
  327|    186|                                (uint32_t(buffer[2]) << 1 * 6);
  328|    186|              if (!ignore_garbage &&
  ------------------
  |  Branch (328:19): [True: 186, False: 0]
  ------------------
  329|    186|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (329:19): [True: 30, False: 156]
  ------------------
  330|     30|                  (triple & 0xff)) {
  ------------------
  |  Branch (330:19): [True: 18, False: 12]
  ------------------
  331|     18|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  332|     18|                        size_t(dst - dstinit)};
  333|     18|              }
  334|    168|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (334:19): [Folded, False: 168]
  |  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|    168|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  339|    168|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  340|    886|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (340:24): [True: 886, False: 0]
  |  Branch (340:43): [True: 240, False: 646]
  ------------------
  341|    240|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (341:25): [True: 210, False: 30]
  ------------------
  342|     30|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (342:26): [True: 30, False: 0]
  ------------------
  343|    240|                         padding_characters > 0))) {
  ------------------
  |  Branch (343:26): [True: 30, False: 0]
  ------------------
  344|    240|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  345|    240|                      size_t(dst - dstinit)};
  346|    646|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (346:24): [True: 646, False: 0]
  |  Branch (346:43): [True: 646, False: 0]
  |  Branch (346:55): [True: 18, False: 628]
  ------------------
  347|     18|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  348|     18|                      size_t(dst - dstinit), true};
  349|     18|            }
  350|  1.00k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  351|  1.31k|          }
  352|  3.27k|    }
  353|  91.0k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (353:9): [Folded, False: 91.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|  91.0k|    uint32_t triple =
  358|  91.0k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  359|  91.0k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  360|  91.0k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  361|  91.0k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  362|  91.0k|    *dst++ = static_cast<char>(triple & 0xFF);
  363|  91.0k|  }
  364|  5.41k|}

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

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

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: 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.16k|  char *end_of_safe_64byte_zone =
   62|  1.16k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 38, 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: 366, False: 756]
  ------------------
   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: 920, False: 240]
  ------------------
   76|    920|    const chartype *const srcend64 = src + srclen - 64;
   77|   110k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 110k, False: 576]
  ------------------
   78|   110k|      block64 b(src);
   79|   110k|      src += 64;
   80|   110k|      uint64_t error = 0;
   81|   110k|      const uint64_t badcharmask =
   82|   110k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   110k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 110k, Folded]
  |  Branch (83:30): [True: 344, False: 109k]
  ------------------
   84|    344|        src -= 64;
   85|    344|        const size_t error_offset = trailing_zeroes(error);
   86|    344|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    344|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    344|      }
   89|   109k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 44.4k, False: 65.2k]
  ------------------
   90|  44.4k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  65.2k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 21.7k, False: 43.5k]
  ------------------
   92|  21.7k|        b.copy_block(bufferptr);
   93|  21.7k|        bufferptr += 64;
   94|  43.5k|      } else {
   95|  43.5k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 43.5k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|  43.5k|        } else {
   98|  43.5k|          b.base64_decode_block(dst);
   99|  43.5k|        }
  100|  43.5k|        dst += 48;
  101|  43.5k|      }
  102|   109k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 12.6k, False: 97.0k]
  ------------------
  103|  63.3k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 50.6k, False: 12.6k]
  ------------------
  104|  50.6k|          base64_decode_block(dst, buffer + i * 64);
  105|  50.6k|          dst += 48;
  106|  50.6k|        }
  107|  12.6k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 12.6k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  12.6k|        } else {
  110|  12.6k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  12.6k|        }
  112|  12.6k|        dst += 48;
  113|  12.6k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  12.6k|                    64); // 64 might be too much
  115|  12.6k|        bufferptr -= (block_size - 1) * 64;
  116|  12.6k|      }
  117|   109k|    }
  118|    920|  }
  119|       |
  120|    816|  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|    816|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    816|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 520, False: 296]
  |  Branch (124:26): [True: 82, False: 438]
  ------------------
  125|       |
  126|  1.37k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.31k, False: 52]
  |  Branch (126:52): [True: 1.29k, False: 22]
  ------------------
  127|  1.29k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.29k|      *bufferptr = char(val);
  129|  1.29k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.29k, Folded]
  ------------------
  130|  1.29k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.29k]
  |  Branch (130:52): [True: 8, False: 1.28k]
  ------------------
  131|      8|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      8|                size_t(dst - dstinit)};
  133|      8|      }
  134|  1.28k|      bufferptr += (val <= 63);
  135|  1.28k|      src++;
  136|  1.28k|    }
  137|     82|  }
  138|       |
  139|  1.18k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 378, False: 808]
  ------------------
  140|    378|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 26, False: 352]
  ------------------
  141|     26|      base64_decode_block_safe(dst, buffer_start);
  142|    352|    } else {
  143|    352|      base64_decode_block(dst, buffer_start);
  144|    352|    }
  145|    378|    dst += 48;
  146|    378|  }
  147|    808|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 460, False: 348]
  ------------------
  148|  3.90k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.44k, False: 460]
  ------------------
  149|  3.44k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.44k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.44k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.44k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.44k|                        << 8;
  154|  3.44k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.44k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.44k|#endif
  157|  3.44k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.44k|      dst += 3;
  160|  3.44k|      buffer_start += 4;
  161|  3.44k|    }
  162|    460|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 114, False: 346]
  ------------------
  163|    114|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    114|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    114|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    114|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    114|                        << 8;
  168|    114|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    114|      triple = scalar::u32_swap_bytes(triple);
  170|    114|#endif
  171|    114|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    114|      dst += 3;
  174|    114|      buffer_start += 4;
  175|    114|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    460|    int leftover = int(bufferptr - buffer_start);
  179|  1.16k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 708, False: 460]
  ------------------
  180|    708|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 708, Folded]
  ------------------
  181|  4.86k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.15k, False: 708]
  ------------------
  182|  4.15k|          src--;
  183|  4.15k|        }
  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|    460|  }
  193|    808|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 680, False: 128]
  ------------------
  194|    680|    full_result r = scalar::base64::base64_tail_decode(
  195|    680|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    680|    r = scalar::base64::patch_tail_result(
  197|    680|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    680|        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|    680|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 342, False: 338]
  |  Branch (203:43): [True: 310, False: 32]
  ------------------
  204|    310|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 260, False: 50]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    740|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 736, False: 4]
  ------------------
  207|    736|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 480, False: 256]
  ------------------
  208|    480|        r.input_count++;
  209|    480|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    260|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 256, False: 4]
  ------------------
  213|  2.01k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.96k, False: 56]
  ------------------
  214|  1.96k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.76k, False: 200]
  ------------------
  215|  1.76k|          r.input_count--;
  216|  1.76k|        }
  217|    256|      }
  218|    260|    }
  219|    680|    return r;
  220|    680|  }
  221|    128|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 128, Folded]
  |  Branch (221:26): [True: 0, False: 128]
  ------------------
  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|    128|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    128|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.28k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.28k|  const uint8_t *to_base64 =
   47|  1.28k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.28k]
  ------------------
   48|  1.28k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.28k]
  ------------------
   49|  1.28k|                                   : tables::base64::to_base64_value);
   50|  1.28k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.28k|  size_t equallocation = ri.equallocation;
   52|  1.28k|  size_t equalsigns = ri.equalsigns;
   53|  1.28k|  srclen = ri.srclen;
   54|  1.28k|  size_t full_input_length = ri.full_input_length;
   55|  1.28k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 22, False: 1.26k]
  ------------------
   56|     22|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 22, Folded]
  |  Branch (56:28): [True: 12, False: 10]
  ------------------
   57|     12|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     12|    }
   59|     10|    return {SUCCESS, full_input_length, 0};
   60|     22|  }
   61|  1.26k|  char *end_of_safe_64byte_zone =
   62|  1.26k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 52, False: 1.21k]
  ------------------
   63|  1.26k|          ? nullptr
   64|  1.26k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 404, False: 806]
  ------------------
   65|  1.21k|                                        : dst);
   66|       |
   67|  1.26k|  const chartype *const srcinit = src;
   68|  1.26k|  const char *const dstinit = dst;
   69|  1.26k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.26k|  constexpr size_t block_size = 6;
   72|  1.26k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.26k|  char buffer[block_size * 64];
   74|  1.26k|  char *bufferptr = buffer;
   75|  1.26k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 978, False: 284]
  ------------------
   76|    978|    const chartype *const srcend64 = src + srclen - 64;
   77|   299k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 298k, False: 618]
  ------------------
   78|   298k|      block64 b(src);
   79|   298k|      src += 64;
   80|   298k|      uint64_t error = 0;
   81|   298k|      const uint64_t badcharmask =
   82|   298k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   298k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 298k, Folded]
  |  Branch (83:30): [True: 360, False: 298k]
  ------------------
   84|    360|        src -= 64;
   85|    360|        const size_t error_offset = trailing_zeroes(error);
   86|    360|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    360|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    360|      }
   89|   298k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 52.7k, False: 245k]
  ------------------
   90|  52.7k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   245k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 162k, False: 83.2k]
  ------------------
   92|   162k|        b.copy_block(bufferptr);
   93|   162k|        bufferptr += 64;
   94|   162k|      } else {
   95|  83.2k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 83.2k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|  83.2k|        } else {
   98|  83.2k|          b.base64_decode_block(dst);
   99|  83.2k|        }
  100|  83.2k|        dst += 48;
  101|  83.2k|      }
  102|   298k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 42.2k, False: 256k]
  ------------------
  103|   211k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 168k, False: 42.2k]
  ------------------
  104|   168k|          base64_decode_block(dst, buffer + i * 64);
  105|   168k|          dst += 48;
  106|   168k|        }
  107|  42.2k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 42.2k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  42.2k|        } else {
  110|  42.2k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  42.2k|        }
  112|  42.2k|        dst += 48;
  113|  42.2k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  42.2k|                    64); // 64 might be too much
  115|  42.2k|        bufferptr -= (block_size - 1) * 64;
  116|  42.2k|      }
  117|   298k|    }
  118|    978|  }
  119|       |
  120|    902|  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|    902|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    902|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 572, False: 330]
  |  Branch (124:26): [True: 112, False: 460]
  ------------------
  125|       |
  126|  1.82k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.74k, False: 80]
  |  Branch (126:52): [True: 1.72k, False: 16]
  ------------------
  127|  1.72k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.72k|      *bufferptr = char(val);
  129|  1.72k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.72k, Folded]
  ------------------
  130|  1.72k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.72k]
  |  Branch (130:52): [True: 16, False: 1.71k]
  ------------------
  131|     16|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     16|                size_t(dst - dstinit)};
  133|     16|      }
  134|  1.71k|      bufferptr += (val <= 63);
  135|  1.71k|      src++;
  136|  1.71k|    }
  137|    112|  }
  138|       |
  139|  1.36k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 474, False: 886]
  ------------------
  140|    474|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 38, False: 436]
  ------------------
  141|     38|      base64_decode_block_safe(dst, buffer_start);
  142|    436|    } else {
  143|    436|      base64_decode_block(dst, buffer_start);
  144|    436|    }
  145|    474|    dst += 48;
  146|    474|  }
  147|    886|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 476, False: 410]
  ------------------
  148|  4.14k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.67k, False: 476]
  ------------------
  149|  3.67k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.67k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.67k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.67k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.67k|                        << 8;
  154|  3.67k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.67k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.67k|#endif
  157|  3.67k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.67k|      dst += 3;
  160|  3.67k|      buffer_start += 4;
  161|  3.67k|    }
  162|    476|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 126, False: 350]
  ------------------
  163|    126|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    126|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    126|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    126|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    126|                        << 8;
  168|    126|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    126|      triple = scalar::u32_swap_bytes(triple);
  170|    126|#endif
  171|    126|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    126|      dst += 3;
  174|    126|      buffer_start += 4;
  175|    126|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    476|    int leftover = int(bufferptr - buffer_start);
  179|  1.17k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 702, False: 476]
  ------------------
  180|    702|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 702, Folded]
  ------------------
  181|  4.71k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.00k, False: 702]
  ------------------
  182|  4.00k|          src--;
  183|  4.00k|        }
  184|    702|      } 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|    702|      src--;
  190|    702|      leftover--;
  191|    702|    }
  192|    476|  }
  193|    886|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 728, False: 158]
  ------------------
  194|    728|    full_result r = scalar::base64::base64_tail_decode(
  195|    728|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    728|    r = scalar::base64::patch_tail_result(
  197|    728|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    728|        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|    728|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 348, False: 380]
  |  Branch (203:43): [True: 330, False: 18]
  ------------------
  204|    330|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 268, False: 62]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    844|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 836, False: 8]
  ------------------
  207|    836|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 576, False: 260]
  ------------------
  208|    576|        r.input_count++;
  209|    576|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    268|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 260, False: 8]
  ------------------
  213|  1.83k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.77k, False: 60]
  ------------------
  214|  1.77k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.57k, False: 200]
  ------------------
  215|  1.57k|          r.input_count--;
  216|  1.57k|        }
  217|    260|      }
  218|    268|    }
  219|    728|    return r;
  220|    728|  }
  221|    158|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 158, Folded]
  |  Branch (221:26): [True: 0, False: 158]
  ------------------
  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|    158|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    158|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.22k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.22k|  const uint8_t *to_base64 =
   47|  1.22k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.22k]
  ------------------
   48|  1.22k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.22k, Folded]
  ------------------
   49|  1.22k|                                   : tables::base64::to_base64_value);
   50|  1.22k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.22k|  size_t equallocation = ri.equallocation;
   52|  1.22k|  size_t equalsigns = ri.equalsigns;
   53|  1.22k|  srclen = ri.srclen;
   54|  1.22k|  size_t full_input_length = ri.full_input_length;
   55|  1.22k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 20, False: 1.20k]
  ------------------
   56|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 20, Folded]
  |  Branch (56:28): [True: 12, False: 8]
  ------------------
   57|     12|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     12|    }
   59|      8|    return {SUCCESS, full_input_length, 0};
   60|     20|  }
   61|  1.20k|  char *end_of_safe_64byte_zone =
   62|  1.20k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 80, False: 1.12k]
  ------------------
   63|  1.20k|          ? nullptr
   64|  1.20k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 338, False: 782]
  ------------------
   65|  1.12k|                                        : dst);
   66|       |
   67|  1.20k|  const chartype *const srcinit = src;
   68|  1.20k|  const char *const dstinit = dst;
   69|  1.20k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.20k|  constexpr size_t block_size = 6;
   72|  1.20k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.20k|  char buffer[block_size * 64];
   74|  1.20k|  char *bufferptr = buffer;
   75|  1.20k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 928, False: 272]
  ------------------
   76|    928|    const chartype *const srcend64 = src + srclen - 64;
   77|  24.3k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 23.7k, False: 580]
  ------------------
   78|  23.7k|      block64 b(src);
   79|  23.7k|      src += 64;
   80|  23.7k|      uint64_t error = 0;
   81|  23.7k|      const uint64_t badcharmask =
   82|  23.7k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  23.7k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 23.7k, Folded]
  |  Branch (83:30): [True: 348, False: 23.4k]
  ------------------
   84|    348|        src -= 64;
   85|    348|        const size_t error_offset = trailing_zeroes(error);
   86|    348|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    348|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    348|      }
   89|  23.4k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 19.4k, False: 4.04k]
  ------------------
   90|  19.4k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  19.4k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 3.58k, False: 460]
  ------------------
   92|  3.58k|        b.copy_block(bufferptr);
   93|  3.58k|        bufferptr += 64;
   94|  3.58k|      } else {
   95|    460|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 450]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|    450|        } else {
   98|    450|          b.base64_decode_block(dst);
   99|    450|        }
  100|    460|        dst += 48;
  101|    460|      }
  102|  23.4k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 4.28k, False: 19.1k]
  ------------------
  103|  21.4k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 17.1k, False: 4.28k]
  ------------------
  104|  17.1k|          base64_decode_block(dst, buffer + i * 64);
  105|  17.1k|          dst += 48;
  106|  17.1k|        }
  107|  4.28k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 4.28k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  4.28k|        } else {
  110|  4.28k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  4.28k|        }
  112|  4.28k|        dst += 48;
  113|  4.28k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  4.28k|                    64); // 64 might be too much
  115|  4.28k|        bufferptr -= (block_size - 1) * 64;
  116|  4.28k|      }
  117|  23.4k|    }
  118|    928|  }
  119|       |
  120|    852|  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|    852|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    852|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 534, False: 318]
  |  Branch (124:26): [True: 114, False: 420]
  ------------------
  125|       |
  126|  1.02k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 974, False: 54]
  |  Branch (126:52): [True: 956, False: 18]
  ------------------
  127|    956|      uint8_t val = to_base64[uint8_t(*src)];
  128|    956|      *bufferptr = char(val);
  129|    956|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 956, Folded]
  ------------------
  130|    956|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 26, False: 930]
  |  Branch (130:52): [True: 16, False: 914]
  ------------------
  131|     42|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     42|                size_t(dst - dstinit)};
  133|     42|      }
  134|    914|      bufferptr += (val <= 63);
  135|    914|      src++;
  136|    914|    }
  137|    114|  }
  138|       |
  139|  1.12k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 314, False: 810]
  ------------------
  140|    314|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 24, False: 290]
  ------------------
  141|     24|      base64_decode_block_safe(dst, buffer_start);
  142|    290|    } else {
  143|    290|      base64_decode_block(dst, buffer_start);
  144|    290|    }
  145|    314|    dst += 48;
  146|    314|  }
  147|    810|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 438, False: 372]
  ------------------
  148|  3.50k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.06k, False: 438]
  ------------------
  149|  3.06k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.06k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.06k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.06k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.06k|                        << 8;
  154|  3.06k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.06k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.06k|#endif
  157|  3.06k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.06k|      dst += 3;
  160|  3.06k|      buffer_start += 4;
  161|  3.06k|    }
  162|    438|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 114, False: 324]
  ------------------
  163|    114|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    114|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    114|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    114|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    114|                        << 8;
  168|    114|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    114|      triple = scalar::u32_swap_bytes(triple);
  170|    114|#endif
  171|    114|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    114|      dst += 3;
  174|    114|      buffer_start += 4;
  175|    114|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    438|    int leftover = int(bufferptr - buffer_start);
  179|  1.09k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 658, False: 438]
  ------------------
  180|    658|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 658, Folded]
  ------------------
  181|  9.27k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 8.61k, False: 658]
  ------------------
  182|  8.61k|          src--;
  183|  8.61k|        }
  184|    658|      } 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|    658|      src--;
  190|    658|      leftover--;
  191|    658|    }
  192|    438|  }
  193|    810|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 692, False: 118]
  ------------------
  194|    692|    full_result r = scalar::base64::base64_tail_decode(
  195|    692|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    692|    r = scalar::base64::patch_tail_result(
  197|    692|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    692|        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|    692|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 448, False: 244]
  |  Branch (203:43): [True: 370, False: 78]
  ------------------
  204|    370|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 324, False: 46]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    836|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 832, False: 4]
  ------------------
  207|    832|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 512, False: 320]
  ------------------
  208|    512|        r.input_count++;
  209|    512|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    324|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 320, False: 4]
  ------------------
  213|  3.66k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 3.58k, False: 78]
  ------------------
  214|  3.58k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 3.34k, False: 242]
  ------------------
  215|  3.34k|          r.input_count--;
  216|  3.34k|        }
  217|    320|      }
  218|    324|    }
  219|    692|    return r;
  220|    692|  }
  221|    118|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 118, Folded]
  |  Branch (221:26): [True: 0, False: 118]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    118|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    118|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_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: 20, False: 1.28k]
  ------------------
   56|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 20, Folded]
  |  Branch (56:28): [True: 6, False: 14]
  ------------------
   57|      6|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      6|    }
   59|     14|    return {SUCCESS, full_input_length, 0};
   60|     20|  }
   61|  1.28k|  char *end_of_safe_64byte_zone =
   62|  1.28k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 122, False: 1.16k]
  ------------------
   63|  1.28k|          ? nullptr
   64|  1.28k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 356, False: 804]
  ------------------
   65|  1.16k|                                        : dst);
   66|       |
   67|  1.28k|  const chartype *const srcinit = src;
   68|  1.28k|  const char *const dstinit = dst;
   69|  1.28k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.28k|  constexpr size_t block_size = 6;
   72|  1.28k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.28k|  char buffer[block_size * 64];
   74|  1.28k|  char *bufferptr = buffer;
   75|  1.28k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 922, False: 360]
  ------------------
   76|    922|    const chartype *const srcend64 = src + srclen - 64;
   77|  69.5k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 69.0k, False: 572]
  ------------------
   78|  69.0k|      block64 b(src);
   79|  69.0k|      src += 64;
   80|  69.0k|      uint64_t error = 0;
   81|  69.0k|      const uint64_t badcharmask =
   82|  69.0k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  69.0k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 69.0k, Folded]
  |  Branch (83:30): [True: 350, False: 68.6k]
  ------------------
   84|    350|        src -= 64;
   85|    350|        const size_t error_offset = trailing_zeroes(error);
   86|    350|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    350|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    350|      }
   89|  68.6k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 54.5k, False: 14.1k]
  ------------------
   90|  54.5k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  54.5k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 13.8k, False: 288]
  ------------------
   92|  13.8k|        b.copy_block(bufferptr);
   93|  13.8k|        bufferptr += 64;
   94|  13.8k|      } else {
   95|    288|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 2, False: 286]
  ------------------
   96|      2|          b.base64_decode_block_safe(dst);
   97|    286|        } else {
   98|    286|          b.base64_decode_block(dst);
   99|    286|        }
  100|    288|        dst += 48;
  101|    288|      }
  102|  68.6k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 13.2k, False: 55.4k]
  ------------------
  103|  66.1k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 52.9k, False: 13.2k]
  ------------------
  104|  52.9k|          base64_decode_block(dst, buffer + i * 64);
  105|  52.9k|          dst += 48;
  106|  52.9k|        }
  107|  13.2k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 13.2k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  13.2k|        } else {
  110|  13.2k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  13.2k|        }
  112|  13.2k|        dst += 48;
  113|  13.2k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  13.2k|                    64); // 64 might be too much
  115|  13.2k|        bufferptr -= (block_size - 1) * 64;
  116|  13.2k|      }
  117|  68.6k|    }
  118|    922|  }
  119|       |
  120|    932|  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|    932|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    932|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 550, False: 382]
  |  Branch (124:26): [True: 118, False: 432]
  ------------------
  125|       |
  126|  1.02k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 970, False: 58]
  |  Branch (126:52): [True: 960, False: 10]
  ------------------
  127|    960|      uint8_t val = to_base64[uint8_t(*src)];
  128|    960|      *bufferptr = char(val);
  129|    960|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 960, Folded]
  ------------------
  130|    960|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 24, False: 936]
  |  Branch (130:52): [True: 26, False: 910]
  ------------------
  131|     50|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     50|                size_t(dst - dstinit)};
  133|     50|      }
  134|    910|      bufferptr += (val <= 63);
  135|    910|      src++;
  136|    910|    }
  137|    118|  }
  138|       |
  139|  1.26k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 384, False: 882]
  ------------------
  140|    384|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 24, False: 360]
  ------------------
  141|     24|      base64_decode_block_safe(dst, buffer_start);
  142|    360|    } else {
  143|    360|      base64_decode_block(dst, buffer_start);
  144|    360|    }
  145|    384|    dst += 48;
  146|    384|  }
  147|    882|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 442, False: 440]
  ------------------
  148|  3.52k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.07k, False: 442]
  ------------------
  149|  3.07k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.07k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.07k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.07k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.07k|                        << 8;
  154|  3.07k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.07k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.07k|#endif
  157|  3.07k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.07k|      dst += 3;
  160|  3.07k|      buffer_start += 4;
  161|  3.07k|    }
  162|    442|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 114, False: 328]
  ------------------
  163|    114|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    114|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    114|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    114|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    114|                        << 8;
  168|    114|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    114|      triple = scalar::u32_swap_bytes(triple);
  170|    114|#endif
  171|    114|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    114|      dst += 3;
  174|    114|      buffer_start += 4;
  175|    114|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    442|    int leftover = int(bufferptr - buffer_start);
  179|  1.08k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 640, False: 442]
  ------------------
  180|    640|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 640, Folded]
  ------------------
  181|  5.35k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.71k, False: 640]
  ------------------
  182|  4.71k|          src--;
  183|  4.71k|        }
  184|    640|      } 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|    640|      src--;
  190|    640|      leftover--;
  191|    640|    }
  192|    442|  }
  193|    882|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 774, False: 108]
  ------------------
  194|    774|    full_result r = scalar::base64::base64_tail_decode(
  195|    774|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    774|    r = scalar::base64::patch_tail_result(
  197|    774|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    774|        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|    774|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 414, False: 360]
  |  Branch (203:43): [True: 338, False: 76]
  ------------------
  204|    338|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 298, False: 40]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    688|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 682, False: 6]
  ------------------
  207|    682|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 390, False: 292]
  ------------------
  208|    390|        r.input_count++;
  209|    390|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    298|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 292, False: 6]
  ------------------
  213|  4.84k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 4.77k, False: 68]
  ------------------
  214|  4.77k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 4.55k, False: 224]
  ------------------
  215|  4.55k|          r.input_count--;
  216|  4.55k|        }
  217|    292|      }
  218|    298|    }
  219|    774|    return r;
  220|    774|  }
  221|    108|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 108, Folded]
  |  Branch (221:26): [True: 0, False: 108]
  ------------------
  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|    108|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    108|}
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: 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.16k|  char *end_of_safe_64byte_zone =
   62|  1.16k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 38, 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: 366, False: 756]
  ------------------
   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: 920, False: 240]
  ------------------
   76|    920|    const chartype *const srcend64 = src + srclen - 64;
   77|   110k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 110k, False: 576]
  ------------------
   78|   110k|      block64 b(src);
   79|   110k|      src += 64;
   80|   110k|      uint64_t error = 0;
   81|   110k|      const uint64_t badcharmask =
   82|   110k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   110k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 110k, Folded]
  |  Branch (83:30): [True: 344, False: 109k]
  ------------------
   84|    344|        src -= 64;
   85|    344|        const size_t error_offset = trailing_zeroes(error);
   86|    344|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    344|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    344|      }
   89|   109k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 44.4k, False: 65.2k]
  ------------------
   90|  44.4k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  65.2k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 21.7k, False: 43.5k]
  ------------------
   92|  21.7k|        b.copy_block(bufferptr);
   93|  21.7k|        bufferptr += 64;
   94|  43.5k|      } else {
   95|  43.5k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 43.5k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|  43.5k|        } else {
   98|  43.5k|          b.base64_decode_block(dst);
   99|  43.5k|        }
  100|  43.5k|        dst += 48;
  101|  43.5k|      }
  102|   109k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 12.6k, False: 97.0k]
  ------------------
  103|  63.3k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 50.6k, False: 12.6k]
  ------------------
  104|  50.6k|          base64_decode_block(dst, buffer + i * 64);
  105|  50.6k|          dst += 48;
  106|  50.6k|        }
  107|  12.6k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 12.6k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  12.6k|        } else {
  110|  12.6k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  12.6k|        }
  112|  12.6k|        dst += 48;
  113|  12.6k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  12.6k|                    64); // 64 might be too much
  115|  12.6k|        bufferptr -= (block_size - 1) * 64;
  116|  12.6k|      }
  117|   109k|    }
  118|    920|  }
  119|       |
  120|    816|  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|    816|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    816|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 520, False: 296]
  |  Branch (124:26): [True: 82, False: 438]
  ------------------
  125|       |
  126|  1.37k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.31k, False: 52]
  |  Branch (126:52): [True: 1.29k, False: 22]
  ------------------
  127|  1.29k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.29k|      *bufferptr = char(val);
  129|  1.29k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.29k, Folded]
  ------------------
  130|  1.29k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.29k]
  |  Branch (130:52): [True: 8, False: 1.28k]
  ------------------
  131|      8|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      8|                size_t(dst - dstinit)};
  133|      8|      }
  134|  1.28k|      bufferptr += (val <= 63);
  135|  1.28k|      src++;
  136|  1.28k|    }
  137|     82|  }
  138|       |
  139|  1.18k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 378, False: 808]
  ------------------
  140|    378|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 26, False: 352]
  ------------------
  141|     26|      base64_decode_block_safe(dst, buffer_start);
  142|    352|    } else {
  143|    352|      base64_decode_block(dst, buffer_start);
  144|    352|    }
  145|    378|    dst += 48;
  146|    378|  }
  147|    808|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 460, False: 348]
  ------------------
  148|  3.90k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.44k, False: 460]
  ------------------
  149|  3.44k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.44k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.44k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.44k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.44k|                        << 8;
  154|  3.44k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.44k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.44k|#endif
  157|  3.44k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.44k|      dst += 3;
  160|  3.44k|      buffer_start += 4;
  161|  3.44k|    }
  162|    460|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 114, False: 346]
  ------------------
  163|    114|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    114|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    114|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    114|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    114|                        << 8;
  168|    114|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    114|      triple = scalar::u32_swap_bytes(triple);
  170|    114|#endif
  171|    114|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    114|      dst += 3;
  174|    114|      buffer_start += 4;
  175|    114|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    460|    int leftover = int(bufferptr - buffer_start);
  179|  1.16k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 708, False: 460]
  ------------------
  180|    708|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 708, Folded]
  ------------------
  181|  4.86k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.15k, False: 708]
  ------------------
  182|  4.15k|          src--;
  183|  4.15k|        }
  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|    460|  }
  193|    808|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 680, False: 128]
  ------------------
  194|    680|    full_result r = scalar::base64::base64_tail_decode(
  195|    680|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    680|    r = scalar::base64::patch_tail_result(
  197|    680|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    680|        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|    680|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 342, False: 338]
  |  Branch (203:43): [True: 310, False: 32]
  ------------------
  204|    310|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 260, False: 50]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    740|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 736, False: 4]
  ------------------
  207|    736|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 480, False: 256]
  ------------------
  208|    480|        r.input_count++;
  209|    480|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    260|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 256, False: 4]
  ------------------
  213|  2.01k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.96k, False: 56]
  ------------------
  214|  1.96k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.76k, False: 200]
  ------------------
  215|  1.76k|          r.input_count--;
  216|  1.76k|        }
  217|    256|      }
  218|    260|    }
  219|    680|    return r;
  220|    680|  }
  221|    128|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 128, Folded]
  |  Branch (221:26): [True: 0, False: 128]
  ------------------
  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|    128|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    128|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.28k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.28k|  const uint8_t *to_base64 =
   47|  1.28k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.28k]
  ------------------
   48|  1.28k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.28k]
  ------------------
   49|  1.28k|                                   : tables::base64::to_base64_value);
   50|  1.28k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.28k|  size_t equallocation = ri.equallocation;
   52|  1.28k|  size_t equalsigns = ri.equalsigns;
   53|  1.28k|  srclen = ri.srclen;
   54|  1.28k|  size_t full_input_length = ri.full_input_length;
   55|  1.28k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 22, False: 1.26k]
  ------------------
   56|     22|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 22, Folded]
  |  Branch (56:28): [True: 12, False: 10]
  ------------------
   57|     12|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     12|    }
   59|     10|    return {SUCCESS, full_input_length, 0};
   60|     22|  }
   61|  1.26k|  char *end_of_safe_64byte_zone =
   62|  1.26k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 52, False: 1.21k]
  ------------------
   63|  1.26k|          ? nullptr
   64|  1.26k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 404, False: 806]
  ------------------
   65|  1.21k|                                        : dst);
   66|       |
   67|  1.26k|  const chartype *const srcinit = src;
   68|  1.26k|  const char *const dstinit = dst;
   69|  1.26k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.26k|  constexpr size_t block_size = 6;
   72|  1.26k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.26k|  char buffer[block_size * 64];
   74|  1.26k|  char *bufferptr = buffer;
   75|  1.26k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 978, False: 284]
  ------------------
   76|    978|    const chartype *const srcend64 = src + srclen - 64;
   77|   299k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 298k, False: 618]
  ------------------
   78|   298k|      block64 b(src);
   79|   298k|      src += 64;
   80|   298k|      uint64_t error = 0;
   81|   298k|      const uint64_t badcharmask =
   82|   298k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   298k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 298k, Folded]
  |  Branch (83:30): [True: 360, False: 298k]
  ------------------
   84|    360|        src -= 64;
   85|    360|        const size_t error_offset = trailing_zeroes(error);
   86|    360|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    360|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    360|      }
   89|   298k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 52.7k, False: 245k]
  ------------------
   90|  52.7k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   245k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 162k, False: 83.2k]
  ------------------
   92|   162k|        b.copy_block(bufferptr);
   93|   162k|        bufferptr += 64;
   94|   162k|      } else {
   95|  83.2k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 83.2k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|  83.2k|        } else {
   98|  83.2k|          b.base64_decode_block(dst);
   99|  83.2k|        }
  100|  83.2k|        dst += 48;
  101|  83.2k|      }
  102|   298k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 42.2k, False: 256k]
  ------------------
  103|   211k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 168k, False: 42.2k]
  ------------------
  104|   168k|          base64_decode_block(dst, buffer + i * 64);
  105|   168k|          dst += 48;
  106|   168k|        }
  107|  42.2k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 42.2k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  42.2k|        } else {
  110|  42.2k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  42.2k|        }
  112|  42.2k|        dst += 48;
  113|  42.2k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  42.2k|                    64); // 64 might be too much
  115|  42.2k|        bufferptr -= (block_size - 1) * 64;
  116|  42.2k|      }
  117|   298k|    }
  118|    978|  }
  119|       |
  120|    902|  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|    902|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    902|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 572, False: 330]
  |  Branch (124:26): [True: 112, False: 460]
  ------------------
  125|       |
  126|  1.82k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.74k, False: 80]
  |  Branch (126:52): [True: 1.72k, False: 16]
  ------------------
  127|  1.72k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.72k|      *bufferptr = char(val);
  129|  1.72k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.72k, Folded]
  ------------------
  130|  1.72k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.72k]
  |  Branch (130:52): [True: 16, False: 1.71k]
  ------------------
  131|     16|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     16|                size_t(dst - dstinit)};
  133|     16|      }
  134|  1.71k|      bufferptr += (val <= 63);
  135|  1.71k|      src++;
  136|  1.71k|    }
  137|    112|  }
  138|       |
  139|  1.36k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 474, False: 886]
  ------------------
  140|    474|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 38, False: 436]
  ------------------
  141|     38|      base64_decode_block_safe(dst, buffer_start);
  142|    436|    } else {
  143|    436|      base64_decode_block(dst, buffer_start);
  144|    436|    }
  145|    474|    dst += 48;
  146|    474|  }
  147|    886|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 476, False: 410]
  ------------------
  148|  4.14k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.67k, False: 476]
  ------------------
  149|  3.67k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.67k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.67k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.67k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.67k|                        << 8;
  154|  3.67k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.67k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.67k|#endif
  157|  3.67k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.67k|      dst += 3;
  160|  3.67k|      buffer_start += 4;
  161|  3.67k|    }
  162|    476|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 126, False: 350]
  ------------------
  163|    126|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    126|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    126|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    126|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    126|                        << 8;
  168|    126|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    126|      triple = scalar::u32_swap_bytes(triple);
  170|    126|#endif
  171|    126|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    126|      dst += 3;
  174|    126|      buffer_start += 4;
  175|    126|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    476|    int leftover = int(bufferptr - buffer_start);
  179|  1.17k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 702, False: 476]
  ------------------
  180|    702|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 702, Folded]
  ------------------
  181|  4.71k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.00k, False: 702]
  ------------------
  182|  4.00k|          src--;
  183|  4.00k|        }
  184|    702|      } 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|    702|      src--;
  190|    702|      leftover--;
  191|    702|    }
  192|    476|  }
  193|    886|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 728, False: 158]
  ------------------
  194|    728|    full_result r = scalar::base64::base64_tail_decode(
  195|    728|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    728|    r = scalar::base64::patch_tail_result(
  197|    728|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    728|        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|    728|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 348, False: 380]
  |  Branch (203:43): [True: 330, False: 18]
  ------------------
  204|    330|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 268, False: 62]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    844|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 836, False: 8]
  ------------------
  207|    836|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 576, False: 260]
  ------------------
  208|    576|        r.input_count++;
  209|    576|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    268|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 260, False: 8]
  ------------------
  213|  1.83k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.77k, False: 60]
  ------------------
  214|  1.77k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.57k, False: 200]
  ------------------
  215|  1.57k|          r.input_count--;
  216|  1.57k|        }
  217|    260|      }
  218|    268|    }
  219|    728|    return r;
  220|    728|  }
  221|    158|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 158, Folded]
  |  Branch (221:26): [True: 0, False: 158]
  ------------------
  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|    158|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    158|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.22k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.22k|  const uint8_t *to_base64 =
   47|  1.22k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.22k]
  ------------------
   48|  1.22k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.22k, Folded]
  ------------------
   49|  1.22k|                                   : tables::base64::to_base64_value);
   50|  1.22k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.22k|  size_t equallocation = ri.equallocation;
   52|  1.22k|  size_t equalsigns = ri.equalsigns;
   53|  1.22k|  srclen = ri.srclen;
   54|  1.22k|  size_t full_input_length = ri.full_input_length;
   55|  1.22k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 20, False: 1.20k]
  ------------------
   56|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 20, Folded]
  |  Branch (56:28): [True: 12, False: 8]
  ------------------
   57|     12|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     12|    }
   59|      8|    return {SUCCESS, full_input_length, 0};
   60|     20|  }
   61|  1.20k|  char *end_of_safe_64byte_zone =
   62|  1.20k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 80, False: 1.12k]
  ------------------
   63|  1.20k|          ? nullptr
   64|  1.20k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 338, False: 782]
  ------------------
   65|  1.12k|                                        : dst);
   66|       |
   67|  1.20k|  const chartype *const srcinit = src;
   68|  1.20k|  const char *const dstinit = dst;
   69|  1.20k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.20k|  constexpr size_t block_size = 6;
   72|  1.20k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.20k|  char buffer[block_size * 64];
   74|  1.20k|  char *bufferptr = buffer;
   75|  1.20k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 928, False: 272]
  ------------------
   76|    928|    const chartype *const srcend64 = src + srclen - 64;
   77|  24.3k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 23.7k, False: 580]
  ------------------
   78|  23.7k|      block64 b(src);
   79|  23.7k|      src += 64;
   80|  23.7k|      uint64_t error = 0;
   81|  23.7k|      const uint64_t badcharmask =
   82|  23.7k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  23.7k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 23.7k, Folded]
  |  Branch (83:30): [True: 348, False: 23.4k]
  ------------------
   84|    348|        src -= 64;
   85|    348|        const size_t error_offset = trailing_zeroes(error);
   86|    348|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    348|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    348|      }
   89|  23.4k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 19.4k, False: 4.04k]
  ------------------
   90|  19.4k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  19.4k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 3.58k, False: 460]
  ------------------
   92|  3.58k|        b.copy_block(bufferptr);
   93|  3.58k|        bufferptr += 64;
   94|  3.58k|      } else {
   95|    460|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 450]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|    450|        } else {
   98|    450|          b.base64_decode_block(dst);
   99|    450|        }
  100|    460|        dst += 48;
  101|    460|      }
  102|  23.4k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 4.28k, False: 19.1k]
  ------------------
  103|  21.4k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 17.1k, False: 4.28k]
  ------------------
  104|  17.1k|          base64_decode_block(dst, buffer + i * 64);
  105|  17.1k|          dst += 48;
  106|  17.1k|        }
  107|  4.28k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 4.28k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  4.28k|        } else {
  110|  4.28k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  4.28k|        }
  112|  4.28k|        dst += 48;
  113|  4.28k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  4.28k|                    64); // 64 might be too much
  115|  4.28k|        bufferptr -= (block_size - 1) * 64;
  116|  4.28k|      }
  117|  23.4k|    }
  118|    928|  }
  119|       |
  120|    852|  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|    852|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    852|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 534, False: 318]
  |  Branch (124:26): [True: 114, False: 420]
  ------------------
  125|       |
  126|  1.02k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 974, False: 54]
  |  Branch (126:52): [True: 956, False: 18]
  ------------------
  127|    956|      uint8_t val = to_base64[uint8_t(*src)];
  128|    956|      *bufferptr = char(val);
  129|    956|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 956, Folded]
  ------------------
  130|    956|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 26, False: 930]
  |  Branch (130:52): [True: 16, False: 914]
  ------------------
  131|     42|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     42|                size_t(dst - dstinit)};
  133|     42|      }
  134|    914|      bufferptr += (val <= 63);
  135|    914|      src++;
  136|    914|    }
  137|    114|  }
  138|       |
  139|  1.12k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 314, False: 810]
  ------------------
  140|    314|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 24, False: 290]
  ------------------
  141|     24|      base64_decode_block_safe(dst, buffer_start);
  142|    290|    } else {
  143|    290|      base64_decode_block(dst, buffer_start);
  144|    290|    }
  145|    314|    dst += 48;
  146|    314|  }
  147|    810|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 438, False: 372]
  ------------------
  148|  3.50k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.06k, False: 438]
  ------------------
  149|  3.06k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.06k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.06k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.06k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.06k|                        << 8;
  154|  3.06k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.06k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.06k|#endif
  157|  3.06k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.06k|      dst += 3;
  160|  3.06k|      buffer_start += 4;
  161|  3.06k|    }
  162|    438|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 114, False: 324]
  ------------------
  163|    114|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    114|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    114|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    114|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    114|                        << 8;
  168|    114|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    114|      triple = scalar::u32_swap_bytes(triple);
  170|    114|#endif
  171|    114|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    114|      dst += 3;
  174|    114|      buffer_start += 4;
  175|    114|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    438|    int leftover = int(bufferptr - buffer_start);
  179|  1.09k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 658, False: 438]
  ------------------
  180|    658|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 658, Folded]
  ------------------
  181|  9.27k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 8.61k, False: 658]
  ------------------
  182|  8.61k|          src--;
  183|  8.61k|        }
  184|    658|      } 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|    658|      src--;
  190|    658|      leftover--;
  191|    658|    }
  192|    438|  }
  193|    810|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 692, False: 118]
  ------------------
  194|    692|    full_result r = scalar::base64::base64_tail_decode(
  195|    692|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    692|    r = scalar::base64::patch_tail_result(
  197|    692|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    692|        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|    692|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 448, False: 244]
  |  Branch (203:43): [True: 370, False: 78]
  ------------------
  204|    370|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 324, False: 46]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    836|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 832, False: 4]
  ------------------
  207|    832|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 512, False: 320]
  ------------------
  208|    512|        r.input_count++;
  209|    512|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    324|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 320, False: 4]
  ------------------
  213|  3.66k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 3.58k, False: 78]
  ------------------
  214|  3.58k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 3.34k, False: 242]
  ------------------
  215|  3.34k|          r.input_count--;
  216|  3.34k|        }
  217|    320|      }
  218|    324|    }
  219|    692|    return r;
  220|    692|  }
  221|    118|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 118, Folded]
  |  Branch (221:26): [True: 0, False: 118]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    118|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    118|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_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: 20, False: 1.28k]
  ------------------
   56|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 20, Folded]
  |  Branch (56:28): [True: 6, False: 14]
  ------------------
   57|      6|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      6|    }
   59|     14|    return {SUCCESS, full_input_length, 0};
   60|     20|  }
   61|  1.28k|  char *end_of_safe_64byte_zone =
   62|  1.28k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 122, False: 1.16k]
  ------------------
   63|  1.28k|          ? nullptr
   64|  1.28k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 356, False: 804]
  ------------------
   65|  1.16k|                                        : dst);
   66|       |
   67|  1.28k|  const chartype *const srcinit = src;
   68|  1.28k|  const char *const dstinit = dst;
   69|  1.28k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.28k|  constexpr size_t block_size = 6;
   72|  1.28k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.28k|  char buffer[block_size * 64];
   74|  1.28k|  char *bufferptr = buffer;
   75|  1.28k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 922, False: 360]
  ------------------
   76|    922|    const chartype *const srcend64 = src + srclen - 64;
   77|  69.5k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 69.0k, False: 572]
  ------------------
   78|  69.0k|      block64 b(src);
   79|  69.0k|      src += 64;
   80|  69.0k|      uint64_t error = 0;
   81|  69.0k|      const uint64_t badcharmask =
   82|  69.0k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  69.0k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 69.0k, Folded]
  |  Branch (83:30): [True: 350, False: 68.6k]
  ------------------
   84|    350|        src -= 64;
   85|    350|        const size_t error_offset = trailing_zeroes(error);
   86|    350|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    350|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    350|      }
   89|  68.6k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 54.5k, False: 14.1k]
  ------------------
   90|  54.5k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  54.5k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 13.8k, False: 288]
  ------------------
   92|  13.8k|        b.copy_block(bufferptr);
   93|  13.8k|        bufferptr += 64;
   94|  13.8k|      } else {
   95|    288|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 2, False: 286]
  ------------------
   96|      2|          b.base64_decode_block_safe(dst);
   97|    286|        } else {
   98|    286|          b.base64_decode_block(dst);
   99|    286|        }
  100|    288|        dst += 48;
  101|    288|      }
  102|  68.6k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 13.2k, False: 55.4k]
  ------------------
  103|  66.1k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 52.9k, False: 13.2k]
  ------------------
  104|  52.9k|          base64_decode_block(dst, buffer + i * 64);
  105|  52.9k|          dst += 48;
  106|  52.9k|        }
  107|  13.2k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 13.2k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  13.2k|        } else {
  110|  13.2k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  13.2k|        }
  112|  13.2k|        dst += 48;
  113|  13.2k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  13.2k|                    64); // 64 might be too much
  115|  13.2k|        bufferptr -= (block_size - 1) * 64;
  116|  13.2k|      }
  117|  68.6k|    }
  118|    922|  }
  119|       |
  120|    932|  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|    932|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    932|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 550, False: 382]
  |  Branch (124:26): [True: 118, False: 432]
  ------------------
  125|       |
  126|  1.02k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 970, False: 58]
  |  Branch (126:52): [True: 960, False: 10]
  ------------------
  127|    960|      uint8_t val = to_base64[uint8_t(*src)];
  128|    960|      *bufferptr = char(val);
  129|    960|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 960, Folded]
  ------------------
  130|    960|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 24, False: 936]
  |  Branch (130:52): [True: 26, False: 910]
  ------------------
  131|     50|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     50|                size_t(dst - dstinit)};
  133|     50|      }
  134|    910|      bufferptr += (val <= 63);
  135|    910|      src++;
  136|    910|    }
  137|    118|  }
  138|       |
  139|  1.26k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 384, False: 882]
  ------------------
  140|    384|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 24, False: 360]
  ------------------
  141|     24|      base64_decode_block_safe(dst, buffer_start);
  142|    360|    } else {
  143|    360|      base64_decode_block(dst, buffer_start);
  144|    360|    }
  145|    384|    dst += 48;
  146|    384|  }
  147|    882|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 442, False: 440]
  ------------------
  148|  3.52k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.07k, False: 442]
  ------------------
  149|  3.07k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.07k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.07k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.07k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.07k|                        << 8;
  154|  3.07k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.07k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.07k|#endif
  157|  3.07k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.07k|      dst += 3;
  160|  3.07k|      buffer_start += 4;
  161|  3.07k|    }
  162|    442|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 114, False: 328]
  ------------------
  163|    114|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    114|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    114|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    114|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    114|                        << 8;
  168|    114|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    114|      triple = scalar::u32_swap_bytes(triple);
  170|    114|#endif
  171|    114|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    114|      dst += 3;
  174|    114|      buffer_start += 4;
  175|    114|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    442|    int leftover = int(bufferptr - buffer_start);
  179|  1.08k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 640, False: 442]
  ------------------
  180|    640|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 640, Folded]
  ------------------
  181|  5.35k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.71k, False: 640]
  ------------------
  182|  4.71k|          src--;
  183|  4.71k|        }
  184|    640|      } 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|    640|      src--;
  190|    640|      leftover--;
  191|    640|    }
  192|    442|  }
  193|    882|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 774, False: 108]
  ------------------
  194|    774|    full_result r = scalar::base64::base64_tail_decode(
  195|    774|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    774|    r = scalar::base64::patch_tail_result(
  197|    774|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    774|        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|    774|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 414, False: 360]
  |  Branch (203:43): [True: 338, False: 76]
  ------------------
  204|    338|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 298, False: 40]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    688|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 682, False: 6]
  ------------------
  207|    682|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 390, False: 292]
  ------------------
  208|    390|        r.input_count++;
  209|    390|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    298|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 292, False: 6]
  ------------------
  213|  4.84k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 4.77k, False: 68]
  ------------------
  214|  4.77k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 4.55k, False: 224]
  ------------------
  215|  4.55k|          r.input_count--;
  216|  4.55k|        }
  217|    292|      }
  218|    298|    }
  219|    774|    return r;
  220|    774|  }
  221|    108|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 108, Folded]
  |  Branch (221:26): [True: 0, False: 108]
  ------------------
  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|    108|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    108|}

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

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

_ZNK7simdutf14implementation27supported_by_runtime_systemEv:
   64|      8|bool implementation::supported_by_runtime_system() const {
   65|      8|  uint32_t required_instruction_sets = this->required_instruction_sets();
   66|      8|  uint32_t supported_instruction_sets =
   67|      8|      internal::detect_supported_architectures();
   68|      8|  return ((supported_instruction_sets & required_instruction_sets) ==
   69|      8|          required_instruction_sets);
   70|      8|}
_ZNK7simdutf14implementation33maximal_binary_length_from_base64EPKcm:
  117|  3.69k|    const char *input, size_t length) const noexcept {
  118|  3.69k|  return scalar::base64::maximal_binary_length_from_base64(input, length);
  119|  3.69k|}
_ZNK7simdutf14implementation33maximal_binary_length_from_base64EPKDsm:
  122|  3.78k|    const char16_t *input, size_t length) const noexcept {
  123|  3.78k|  return scalar::base64::maximal_binary_length_from_base64(input, length);
  124|  3.78k|}
_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|   151k|simdutf_really_inline long long int count_ones(uint64_t input_num) {
   15|       |  return _popcnt64(input_num);
   16|   151k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_115trailing_zeroesEm:
   20|   129k|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|   129k|  return __builtin_ctzll(input_num);
   25|   129k|  #endif // SIMDUTF_REGULAR_VISUAL_STUDIO
   26|   129k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_115is_power_of_twoImEEbT_:
   29|   171k|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|   170k|simdutf_really_inline long long int count_ones(uint64_t input_num) {
   15|       |  return _popcnt64(input_num);
   16|   170k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115trailing_zeroesEm:
   20|   129k|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|   129k|  return __builtin_ctzll(input_num);
   27|   129k|  #endif // SIMDUTF_REGULAR_VISUAL_STUDIO
   28|   129k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115is_power_of_twoImEEbT_:
   31|   171k|template <typename T> bool is_power_of_two(T x) { return (x & (x - 1)) == 0; }

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

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

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

