LLVMFuzzerTestOneInput:
  164|  2.53k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  165|  2.53k|  constexpr auto optionbytes = 4u;
  166|  2.53k|  static_assert(optionbytes % 2 == 0,
  167|  2.53k|                "optionbytes must be even to avoid misaligned char16 pointers");
  168|  2.53k|  if (size < optionbytes) {
  ------------------
  |  Branch (168:7): [True: 2, False: 2.53k]
  ------------------
  169|      2|    return 0;
  170|      2|  }
  171|       |
  172|  2.53k|  constexpr auto Ncases = 2u;
  173|  2.53k|  constexpr auto actionmask = std::bit_ceil(Ncases) - 1;
  174|  2.53k|  const auto action = data[0] & actionmask;
  175|       |
  176|  2.53k|  const auto opt = [](auto index) {
  177|  2.53k|    if (index >= options.size()) {
  178|  2.53k|      return options[0];
  179|  2.53k|    }
  180|  2.53k|    return options[index];
  181|  2.53k|  }(data[1] & (std::bit_ceil(options.size()) - 1));
  182|       |
  183|  2.53k|  const auto lco =
  184|  2.53k|      (opt == simdutf::base64_url || opt == simdutf::base64_default_no_padding)
  ------------------
  |  Branch (184:8): [True: 283, False: 2.25k]
  |  Branch (184:38): [True: 256, False: 1.99k]
  ------------------
  185|  2.53k|          ? simdutf::last_chunk_handling_options::loose
  186|  2.53k|          : [](auto index) {
  187|  1.99k|              if (index >= last_chunk.size()) {
  188|  1.99k|                return last_chunk[0];
  189|  1.99k|              }
  190|  1.99k|              return last_chunk[index];
  191|  1.99k|            }(data[2] & (std::bit_ceil(last_chunk.size()) - 1));
  192|       |
  193|       |  // data[3] reserved for future use / alignment.
  194|       |
  195|  2.53k|  data += optionbytes;
  196|  2.53k|  size -= optionbytes;
  197|       |
  198|  2.53k|  switch (action) {
  ------------------
  |  Branch (198:11): [True: 2.53k, False: 0]
  ------------------
  199|  1.26k|  case 0: {
  ------------------
  |  Branch (199:3): [True: 1.26k, False: 1.26k]
  ------------------
  200|  1.26k|    const std::span<const char> chardata{reinterpret_cast<const char*>(data),
  201|  1.26k|                                         size};
  202|  1.26k|    test_details(chardata, opt, lco);
  203|  1.26k|  } break;
  204|  1.26k|  case 1: {
  ------------------
  |  Branch (204:3): [True: 1.26k, False: 1.26k]
  ------------------
  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.53k|  }
  210|       |
  211|  2.53k|  return 0;
  212|  2.53k|}
base64_details.cpp:_ZZ22LLVMFuzzerTestOneInputENK3$_0clImEEDaT_:
  176|  2.53k|  const auto opt = [](auto index) {
  177|  2.53k|    if (index >= options.size()) {
  ------------------
  |  Branch (177:9): [True: 0, False: 2.53k]
  ------------------
  178|      0|      return options[0];
  179|      0|    }
  180|  2.53k|    return options[index];
  181|  2.53k|  }(data[1] & (std::bit_ceil(options.size()) - 1));
base64_details.cpp:_ZZ22LLVMFuzzerTestOneInputENK3$_1clImEEDaT_:
  186|  1.99k|          : [](auto index) {
  187|  1.99k|              if (index >= last_chunk.size()) {
  ------------------
  |  Branch (187:19): [True: 193, False: 1.80k]
  ------------------
  188|    193|                return last_chunk[0];
  189|    193|              }
  190|  1.80k|              return last_chunk[index];
  191|  1.99k|            }(data[2] & (std::bit_ceil(last_chunk.size()) - 1));
base64_details.cpp:_ZL12test_detailsIcEvNSt3__14spanIKT_Lm18446744073709551615EEEN7simdutf14base64_optionsENS5_27last_chunk_handling_optionsE:
   57|  1.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.80k|  for (auto impl : implementations) {
  ------------------
  |  Branch (66:18): [True: 3.80k, False: 1.26k]
  ------------------
   67|       |    // Use a fresh buffer for base64_to_binary_details.
   68|  3.80k|    const std::size_t maxbinary =
   69|  3.80k|        impl->maximal_binary_length_from_base64(input.data(), input.size());
   70|  3.80k|    std::vector<char> out_details(maxbinary);
   71|       |
   72|  3.80k|    const simdutf::full_result fr = impl->base64_to_binary_details(
   73|  3.80k|        input.data(), input.size(), out_details.data(), opt, lco);
   74|       |
   75|       |    // Bounds checks.
   76|  3.80k|    if (fr.input_count > input.size()) {
  ------------------
  |  Branch (76:9): [True: 0, False: 3.80k]
  ------------------
   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.80k|    if (fr.output_count > maxbinary) {
  ------------------
  |  Branch (82:9): [True: 0, False: 3.80k]
  ------------------
   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.80k|    std::vector<char> out_plain(maxbinary);
   92|  3.80k|    const simdutf::result r = impl->base64_to_binary(
   93|  3.80k|        input.data(), input.size(), out_plain.data(), opt, lco);
   94|  3.80k|    const simdutf::result r_from_fr = static_cast<simdutf::result>(fr);
   95|       |
   96|  3.80k|    if (r != r_from_fr) {
  ------------------
  |  Branch (96:9): [True: 0, False: 3.80k]
  ------------------
   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.80k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (107:9): [True: 2.24k, False: 1.56k]
  ------------------
  108|  2.24k|      if (fr.output_count != r.count) {
  ------------------
  |  Branch (108:11): [True: 0, False: 2.24k]
  ------------------
  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.24k|      const auto span_details =
  115|  2.24k|          std::span(out_details).subspan(0, fr.output_count);
  116|  2.24k|      const auto span_plain = std::span(out_plain).subspan(0, r.count);
  117|  2.24k|      if (!std::ranges::equal(span_details, span_plain)) {
  ------------------
  |  Branch (117:11): [True: 0, False: 2.24k]
  ------------------
  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.24k|    }
  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.80k|    comparable_full_result cfr;
  140|  3.80k|    cfr.error = fr.error;
  141|  3.80k|    cfr.padding_error = fr.padding_error;
  142|  3.80k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (142:9): [True: 2.24k, False: 1.56k]
  ------------------
  143|  2.24k|      cfr.output_count = fr.output_count;
  144|  2.24k|      cfr.output_hash = FNV1A_hash::as_str(
  145|  2.24k|          std::span(out_details).subspan(0, fr.output_count));
  146|  2.24k|    } else {
  147|  1.56k|      cfr.input_count = fr.input_count;
  148|  1.56k|    }
  149|  3.80k|    results.push_back(std::move(cfr));
  150|  3.80k|  }
  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_detailsIcEvNSt3__14spanIKT_Lm18446744073709551615EEEN7simdutf14base64_optionsENS5_27last_chunk_handling_optionsEENKUlRS3_RKT0_E_clI22comparable_full_resultSE_EEDaS8_SB_:
  153|  2.53k|  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.79k|  for (auto impl : implementations) {
  ------------------
  |  Branch (66:18): [True: 3.79k, False: 1.26k]
  ------------------
   67|       |    // Use a fresh buffer for base64_to_binary_details.
   68|  3.79k|    const std::size_t maxbinary =
   69|  3.79k|        impl->maximal_binary_length_from_base64(input.data(), input.size());
   70|  3.79k|    std::vector<char> out_details(maxbinary);
   71|       |
   72|  3.79k|    const simdutf::full_result fr = impl->base64_to_binary_details(
   73|  3.79k|        input.data(), input.size(), out_details.data(), opt, lco);
   74|       |
   75|       |    // Bounds checks.
   76|  3.79k|    if (fr.input_count > input.size()) {
  ------------------
  |  Branch (76:9): [True: 0, False: 3.79k]
  ------------------
   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.79k|    if (fr.output_count > maxbinary) {
  ------------------
  |  Branch (82:9): [True: 0, False: 3.79k]
  ------------------
   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.79k|    std::vector<char> out_plain(maxbinary);
   92|  3.79k|    const simdutf::result r = impl->base64_to_binary(
   93|  3.79k|        input.data(), input.size(), out_plain.data(), opt, lco);
   94|  3.79k|    const simdutf::result r_from_fr = static_cast<simdutf::result>(fr);
   95|       |
   96|  3.79k|    if (r != r_from_fr) {
  ------------------
  |  Branch (96:9): [True: 0, False: 3.79k]
  ------------------
   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.79k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (107:9): [True: 1.82k, False: 1.97k]
  ------------------
  108|  1.82k|      if (fr.output_count != r.count) {
  ------------------
  |  Branch (108:11): [True: 0, False: 1.82k]
  ------------------
  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.82k|      const auto span_details =
  115|  1.82k|          std::span(out_details).subspan(0, fr.output_count);
  116|  1.82k|      const auto span_plain = std::span(out_plain).subspan(0, r.count);
  117|  1.82k|      if (!std::ranges::equal(span_details, span_plain)) {
  ------------------
  |  Branch (117:11): [True: 0, False: 1.82k]
  ------------------
  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.82k|    }
  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.79k|    comparable_full_result cfr;
  140|  3.79k|    cfr.error = fr.error;
  141|  3.79k|    cfr.padding_error = fr.padding_error;
  142|  3.79k|    if (fr.error == simdutf::error_code::SUCCESS) {
  ------------------
  |  Branch (142:9): [True: 1.82k, False: 1.97k]
  ------------------
  143|  1.82k|      cfr.output_count = fr.output_count;
  144|  1.82k|      cfr.output_hash = FNV1A_hash::as_str(
  145|  1.82k|          std::span(out_details).subspan(0, fr.output_count));
  146|  1.97k|    } else {
  147|  1.97k|      cfr.input_count = fr.input_count;
  148|  1.97k|    }
  149|  3.79k|    results.push_back(std::move(cfr));
  150|  3.79k|  }
  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.53k|  auto neq = [](const auto& a, const auto& b) { return a != b; };

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

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

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

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

simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6413is_eight_byteIcEEbT_:
   19|  25.5M|template <class char_type> simdutf_constexpr23 bool is_eight_byte(char_type c) {
   20|  25.5M|  if constexpr (sizeof(char_type) == 1) {
   21|  25.5M|    return true;
   22|  25.5M|  }
   23|      0|  return uint8_t(c) == c;
   24|  25.5M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6413is_eight_byteIDsEEbT_:
   19|  4.66M|template <class char_type> simdutf_constexpr23 bool is_eight_byte(char_type c) {
   20|       |  if constexpr (sizeof(char_type) == 1) {
   21|       |    return true;
   22|       |  }
   23|  4.66M|  return uint8_t(c) == c;
   24|  4.66M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKcEEmT_m:
  654|  3.80k|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.80k|  size_t padding = 0;
  659|  3.80k|  if (length > 0) {
  ------------------
  |  Branch (659:7): [True: 3.79k, False: 12]
  ------------------
  660|  3.79k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (660:9): [True: 243, False: 3.55k]
  ------------------
  661|    243|      padding++;
  662|    243|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (662:11): [True: 237, False: 6]
  |  Branch (662:25): [True: 48, False: 189]
  ------------------
  663|     48|        padding++;
  664|     48|      }
  665|    243|    }
  666|  3.79k|  }
  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.80k|  size_t actual_length = length - padding;
  686|  3.80k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (686:7): [True: 3.25k, False: 555]
  ------------------
  687|  3.25k|    return actual_length / 4 * 3;
  688|  3.25k|  }
  689|       |  // if we have a valid input, then the remainder must be 2 or 3 adding one or
  690|       |  // two extra bytes.
  691|    555|  return actual_length / 4 * 3 + (actual_length % 4) - 1;
  692|  3.80k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKDsEEmT_m:
  654|  3.79k|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.79k|  size_t padding = 0;
  659|  3.79k|  if (length > 0) {
  ------------------
  |  Branch (659:7): [True: 3.78k, False: 15]
  ------------------
  660|  3.78k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (660:9): [True: 231, False: 3.55k]
  ------------------
  661|    231|      padding++;
  662|    231|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (662:11): [True: 225, False: 6]
  |  Branch (662:25): [True: 39, False: 186]
  ------------------
  663|     39|        padding++;
  664|     39|      }
  665|    231|    }
  666|  3.78k|  }
  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.79k|  size_t actual_length = length - padding;
  686|  3.79k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (686:7): [True: 3.35k, False: 441]
  ------------------
  687|  3.35k|    return actual_length / 4 * 3;
  688|  3.35k|  }
  689|       |  // if we have a valid input, then the remainder must be 2 or 3 adding one or
  690|       |  // two extra bytes.
  691|    441|  return actual_length / 4 * 3 + (actual_length % 4) - 1;
  692|  3.79k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIcEEbT_NS_14base64_optionsE:
   28|  58.4k|                                      simdutf::base64_options options) {
   29|  58.4k|  const uint8_t *to_base64 =
   30|  58.4k|      (options & base64_default_or_url)
  ------------------
  |  Branch (30:7): [True: 0, False: 58.4k]
  ------------------
   31|  58.4k|          ? tables::base64::to_base64_default_or_url_value
   32|  58.4k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (32:14): [True: 46.7k, False: 11.7k]
  ------------------
   33|  58.4k|                                    : tables::base64::to_base64_value);
   34|  58.4k|  const bool ignore_garbage =
   35|  58.4k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (35:7): [True: 0, False: 58.4k]
  ------------------
   36|  58.4k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (36:7): [True: 0, False: 58.4k]
  ------------------
   37|  58.4k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (37:7): [True: 0, False: 58.4k]
  ------------------
   38|  58.4k|  uint8_t code = to_base64[uint8_t(c)];
   39|  58.4k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (39:7): [True: 58.4k, False: 0]
  |  Branch (39:27): [True: 3.13k, False: 55.3k]
  ------------------
   40|  3.13k|    return false;
   41|  3.13k|  }
   42|  55.3k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (42:7): [True: 55.3k, False: 0]
  |  Branch (42:27): [True: 55.3k, False: 0]
  ------------------
   43|  55.3k|    return true;
   44|  55.3k|  }
   45|      0|  return ignore_garbage;
   46|  55.3k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIDsEEbT_NS_14base64_optionsE:
   28|  21.5k|                                      simdutf::base64_options options) {
   29|  21.5k|  const uint8_t *to_base64 =
   30|  21.5k|      (options & base64_default_or_url)
  ------------------
  |  Branch (30:7): [True: 0, False: 21.5k]
  ------------------
   31|  21.5k|          ? tables::base64::to_base64_default_or_url_value
   32|  21.5k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (32:14): [True: 10.8k, False: 10.6k]
  ------------------
   33|  21.5k|                                    : tables::base64::to_base64_value);
   34|  21.5k|  const bool ignore_garbage =
   35|  21.5k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (35:7): [True: 0, False: 21.5k]
  ------------------
   36|  21.5k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (36:7): [True: 0, False: 21.5k]
  ------------------
   37|  21.5k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (37:7): [True: 0, False: 21.5k]
  ------------------
   38|  21.5k|  uint8_t code = to_base64[uint8_t(c)];
   39|  21.5k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (39:7): [True: 21.5k, False: 0]
  |  Branch (39:27): [True: 3.55k, False: 17.9k]
  ------------------
   40|  3.55k|    return false;
   41|  3.55k|  }
   42|  17.9k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (42:7): [True: 17.9k, False: 0]
  |  Branch (42:27): [True: 17.9k, False: 0]
  ------------------
   43|  17.9k|    return true;
   44|  17.9k|  }
   45|      0|  return ignore_garbage;
   46|  17.9k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIcEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  100|  7.61k|                                           simdutf::base64_options options) {
  101|  7.61k|  const uint8_t *to_base64 =
  102|  7.61k|      (options & base64_default_or_url)
  ------------------
  |  Branch (102:7): [True: 0, False: 7.61k]
  ------------------
  103|  7.61k|          ? tables::base64::to_base64_default_or_url_value
  104|  7.61k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (104:14): [True: 3.69k, False: 3.92k]
  ------------------
  105|  7.61k|                                    : tables::base64::to_base64_value);
  106|  7.61k|  const bool ignore_garbage =
  107|  7.61k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (107:7): [True: 0, False: 7.61k]
  ------------------
  108|  7.61k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (108:7): [True: 0, False: 7.61k]
  ------------------
  109|  7.61k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (109:7): [True: 0, False: 7.61k]
  ------------------
  110|       |
  111|  7.61k|  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.61k|  size_t full_input_length = srclen;
  115|       |  // skip trailing spaces
  116|  9.04k|  while (!ignore_garbage && srclen > 0 &&
  ------------------
  |  Branch (116:10): [True: 9.04k, False: 0]
  |  Branch (116:29): [True: 8.98k, False: 66]
  ------------------
  117|  8.98k|         scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (117:10): [True: 8.98k, False: 0]
  ------------------
  118|  8.98k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (118:10): [True: 1.43k, False: 7.54k]
  ------------------
  119|  1.43k|    srclen--;
  120|  1.43k|  }
  121|  7.61k|  size_t equallocation =
  122|  7.61k|      srclen; // location of the first padding character if any
  123|  7.61k|  if (ignore_garbage) {
  ------------------
  |  Branch (123:7): [True: 0, False: 7.61k]
  ------------------
  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.61k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (135:7): [True: 7.61k, False: 0]
  |  Branch (135:26): [True: 7.54k, False: 66]
  |  Branch (135:40): [True: 486, False: 7.06k]
  ------------------
  136|       |    // This is the last '=' sign.
  137|    486|    equallocation = srclen - 1;
  138|    486|    srclen--;
  139|    486|    equalsigns = 1;
  140|       |    // skip trailing spaces
  141|  1.67k|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (141:12): [True: 1.62k, False: 48]
  |  Branch (141:26): [True: 1.62k, False: 0]
  ------------------
  142|  1.62k|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (142:12): [True: 1.18k, False: 438]
  ------------------
  143|  1.18k|      srclen--;
  144|  1.18k|    }
  145|    486|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (145:9): [True: 438, False: 48]
  |  Branch (145:23): [True: 102, False: 336]
  ------------------
  146|       |      // This is the second '=' sign.
  147|    102|      equallocation = srclen - 1;
  148|    102|      srclen--;
  149|    102|      equalsigns = 2;
  150|    102|    }
  151|    486|  }
  152|  7.61k|  return {equalsigns, equallocation, srclen, full_input_length};
  153|  7.61k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6417patch_tail_resultENS_11full_resultEmmmmNS_27last_chunk_handling_optionsE:
  394|  10.9k|                  last_chunk_handling_options last_chunk_options) {
  395|  10.9k|  r.input_count += previous_input;
  396|  10.9k|  r.output_count += previous_output;
  397|  10.9k|  if (r.padding_error) {
  ------------------
  |  Branch (397:7): [True: 240, False: 10.6k]
  ------------------
  398|    240|    r.input_count = equallocation;
  399|    240|  }
  400|       |
  401|  10.9k|  if (r.error == error_code::SUCCESS) {
  ------------------
  |  Branch (401:7): [True: 6.88k, False: 4.04k]
  ------------------
  402|  6.88k|    if (!is_partial(last_chunk_options)) {
  ------------------
  |  Branch (402:9): [True: 2.26k, False: 4.62k]
  ------------------
  403|       |      // A success when we are not in stop_before_partial mode.
  404|       |      // means that we have consumed the whole input buffer.
  405|  2.26k|      r.input_count = full_input_length;
  406|  4.62k|    } else if (r.output_count % 3 != 0) {
  ------------------
  |  Branch (406:16): [True: 24, False: 4.60k]
  ------------------
  407|     24|      r.input_count = full_input_length;
  408|     24|    }
  409|  6.88k|  }
  410|  10.9k|  return r;
  411|  10.9k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIDsEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  100|  7.59k|                                           simdutf::base64_options options) {
  101|  7.59k|  const uint8_t *to_base64 =
  102|  7.59k|      (options & base64_default_or_url)
  ------------------
  |  Branch (102:7): [True: 0, False: 7.59k]
  ------------------
  103|  7.59k|          ? tables::base64::to_base64_default_or_url_value
  104|  7.59k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (104:14): [True: 3.61k, False: 3.98k]
  ------------------
  105|  7.59k|                                    : tables::base64::to_base64_value);
  106|  7.59k|  const bool ignore_garbage =
  107|  7.59k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (107:7): [True: 0, False: 7.59k]
  ------------------
  108|  7.59k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (108:7): [True: 0, False: 7.59k]
  ------------------
  109|  7.59k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (109:7): [True: 0, False: 7.59k]
  ------------------
  110|       |
  111|  7.59k|  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.59k|  size_t full_input_length = srclen;
  115|       |  // skip trailing spaces
  116|  9.17k|  while (!ignore_garbage && srclen > 0 &&
  ------------------
  |  Branch (116:10): [True: 9.17k, False: 0]
  |  Branch (116:29): [True: 9.10k, False: 66]
  ------------------
  117|  9.10k|         scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (117:10): [True: 7.24k, False: 1.86k]
  ------------------
  118|  7.24k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (118:10): [True: 1.57k, False: 5.67k]
  ------------------
  119|  1.57k|    srclen--;
  120|  1.57k|  }
  121|  7.59k|  size_t equallocation =
  122|  7.59k|      srclen; // location of the first padding character if any
  123|  7.59k|  if (ignore_garbage) {
  ------------------
  |  Branch (123:7): [True: 0, False: 7.59k]
  ------------------
  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.59k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (135:7): [True: 7.59k, False: 0]
  |  Branch (135:26): [True: 7.53k, False: 66]
  |  Branch (135:40): [True: 462, False: 7.06k]
  ------------------
  136|       |    // This is the last '=' sign.
  137|    462|    equallocation = srclen - 1;
  138|    462|    srclen--;
  139|    462|    equalsigns = 1;
  140|       |    // skip trailing spaces
  141|  1.57k|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (141:12): [True: 1.52k, False: 54]
  |  Branch (141:26): [True: 1.40k, False: 120]
  ------------------
  142|  1.40k|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (142:12): [True: 1.11k, False: 288]
  ------------------
  143|  1.11k|      srclen--;
  144|  1.11k|    }
  145|    462|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (145:9): [True: 408, False: 54]
  |  Branch (145:23): [True: 84, False: 324]
  ------------------
  146|       |      // This is the second '=' sign.
  147|     84|      equallocation = srclen - 1;
  148|     84|      srclen--;
  149|     84|      equalsigns = 2;
  150|     84|    }
  151|    462|  }
  152|  7.59k|  return {equalsigns, equallocation, srclen, full_input_length};
  153|  7.59k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIcEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  727|  2.53k|    last_chunk_handling_options last_chunk_options) noexcept {
  728|  2.53k|  const bool ignore_garbage =
  729|  2.53k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (729:7): [True: 0, False: 2.53k]
  ------------------
  730|  2.53k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (730:7): [True: 0, False: 2.53k]
  ------------------
  731|  2.53k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (731:7): [True: 0, False: 2.53k]
  ------------------
  732|  2.53k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  733|  2.53k|  size_t equallocation = ri.equallocation;
  734|  2.53k|  size_t equalsigns = ri.equalsigns;
  735|  2.53k|  length = ri.srclen;
  736|  2.53k|  size_t full_input_length = ri.full_input_length;
  737|  2.53k|  if (length == 0) {
  ------------------
  |  Branch (737:7): [True: 40, False: 2.49k]
  ------------------
  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.49k|  full_result r = scalar::base64::base64_tail_decode(
  744|  2.49k|      output, input, length, equalsigns, options, last_chunk_options);
  745|  2.49k|  r = scalar::base64::patch_tail_result(r, 0, 0, equallocation,
  746|  2.49k|                                        full_input_length, last_chunk_options);
  747|  2.49k|  if (!is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (747:7): [True: 1.39k, False: 1.10k]
  |  Branch (747:42): [True: 646, False: 746]
  ------------------
  748|    646|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (748:7): [True: 10, False: 636]
  |  Branch (748:25): [True: 10, False: 0]
  ------------------
  749|       |    // additional checks
  750|     10|    if ((r.output_count % 3 == 0) ||
  ------------------
  |  Branch (750:9): [True: 0, False: 10]
  ------------------
  751|     10|        ((r.output_count % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (751:9): [True: 0, False: 10]
  ------------------
  752|      0|      return {INVALID_BASE64_CHARACTER, equallocation, r.output_count, true};
  753|      0|    }
  754|     10|  }
  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.49k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (759:7): [True: 1.10k, False: 1.39k]
  |  Branch (759:41): [True: 830, False: 276]
  ------------------
  760|    830|      r.input_count < full_input_length) {
  ------------------
  |  Branch (760:7): [True: 594, False: 236]
  ------------------
  761|       |    // First check if we can extend the input to the end of the stream
  762|  14.2k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (762:12): [True: 14.2k, False: 14]
  ------------------
  763|  14.2k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (763:12): [True: 13.6k, False: 580]
  ------------------
  764|  13.6k|      r.input_count++;
  765|  13.6k|    }
  766|       |    // If we are still not at the end of the stream, then we must backtrack
  767|       |    // to the last non-ignorable character.
  768|    594|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (768:9): [True: 580, False: 14]
  ------------------
  769|  13.9k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (769:14): [True: 13.8k, False: 116]
  ------------------
  770|  13.8k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (770:14): [True: 13.3k, False: 464]
  ------------------
  771|  13.3k|        r.input_count--;
  772|  13.3k|      }
  773|    580|    }
  774|    594|  }
  775|  2.49k|  return r;
  776|  2.49k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6418base64_tail_decodeIcEENS_11full_resultEPcPKT_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  371|  5.49k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  372|  5.49k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  373|  5.49k|                                        options, last_chunk_options);
  374|  5.49k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EcEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  164|  5.49k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  165|  5.49k|  char *dstend = dst + outlen;
  166|  5.49k|  (void)dstend;
  167|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  168|       |  // two branches (easily predicted):
  169|  5.49k|  const uint8_t *to_base64 =
  170|  5.49k|      (options & base64_default_or_url)
  ------------------
  |  Branch (170:7): [True: 0, False: 5.49k]
  ------------------
  171|  5.49k|          ? tables::base64::to_base64_default_or_url_value
  172|  5.49k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (172:14): [True: 2.63k, False: 2.85k]
  ------------------
  173|  5.49k|                                    : tables::base64::to_base64_value);
  174|  5.49k|  const uint32_t *d0 =
  175|  5.49k|      (options & base64_default_or_url)
  ------------------
  |  Branch (175:7): [True: 0, False: 5.49k]
  ------------------
  176|  5.49k|          ? tables::base64::base64_default_or_url::d0
  177|  5.49k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (177:14): [True: 2.63k, False: 2.85k]
  ------------------
  178|  5.49k|                                    : tables::base64::base64_default::d0);
  179|  5.49k|  const uint32_t *d1 =
  180|  5.49k|      (options & base64_default_or_url)
  ------------------
  |  Branch (180:7): [True: 0, False: 5.49k]
  ------------------
  181|  5.49k|          ? tables::base64::base64_default_or_url::d1
  182|  5.49k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (182:14): [True: 2.63k, False: 2.85k]
  ------------------
  183|  5.49k|                                    : tables::base64::base64_default::d1);
  184|  5.49k|  const uint32_t *d2 =
  185|  5.49k|      (options & base64_default_or_url)
  ------------------
  |  Branch (185:7): [True: 0, False: 5.49k]
  ------------------
  186|  5.49k|          ? tables::base64::base64_default_or_url::d2
  187|  5.49k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (187:14): [True: 2.63k, False: 2.85k]
  ------------------
  188|  5.49k|                                    : tables::base64::base64_default::d2);
  189|  5.49k|  const uint32_t *d3 =
  190|  5.49k|      (options & base64_default_or_url)
  ------------------
  |  Branch (190:7): [True: 0, False: 5.49k]
  ------------------
  191|  5.49k|          ? tables::base64::base64_default_or_url::d3
  192|  5.49k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (192:14): [True: 2.63k, False: 2.85k]
  ------------------
  193|  5.49k|                                    : tables::base64::base64_default::d3);
  194|  5.49k|  const bool ignore_garbage =
  195|  5.49k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (195:7): [True: 0, False: 5.49k]
  ------------------
  196|  5.49k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (196:7): [True: 0, False: 5.49k]
  ------------------
  197|  5.49k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (197:7): [True: 0, False: 5.49k]
  ------------------
  198|       |
  199|  5.49k|  const char_type *srcend = src + length;
  200|  5.49k|  const char_type *srcinit = src;
  201|  5.49k|  const char *dstinit = dst;
  202|       |
  203|  5.49k|  uint32_t x;
  204|  5.49k|  size_t idx;
  205|  5.49k|  uint8_t buffer[4];
  206|  92.1k|  while (true) {
  ------------------
  |  Branch (206:10): [True: 92.1k, Folded]
  ------------------
  207|  5.94M|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (207:12): [True: 5.94M, False: 3.42k]
  |  Branch (207:33): [True: 5.94M, False: 0]
  ------------------
  208|  5.94M|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (208:12): [True: 5.94M, False: 0]
  |  Branch (208:37): [True: 5.94M, False: 0]
  ------------------
  209|  5.94M|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (209:12): [True: 5.94M, False: 0]
  ------------------
  210|  5.94M|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (210:12): [True: 5.85M, False: 88.7k]
  ------------------
  211|  5.94M|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  212|  5.85M|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (212:11): [Folded, False: 5.85M]
  |  Branch (212:29): [True: 0, False: 0]
  ------------------
  213|      0|        return {OUTPUT_BUFFER_TOO_SMALL, size_t(src - srcinit),
  214|      0|                size_t(dst - dstinit)};
  215|      0|      }
  216|  5.85M|      *dst++ = static_cast<char>(x & 0xFF);
  217|  5.85M|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  218|  5.85M|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  219|  5.85M|      src += 4;
  220|  5.85M|    }
  221|  92.1k|    const char_type *srccur = src;
  222|  92.1k|    idx = 0;
  223|       |    // we need at least four characters.
  224|  92.1k|#ifdef __clang__
  225|       |    // If possible, we read four characters at a time. (It is an optimization.)
  226|  92.1k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (226:9): [True: 0, False: 92.1k]
  |  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|  92.1k|#endif
  248|  1.11M|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (248:12): [True: 1.02M, False: 86.6k]
  |  Branch (248:25): [True: 1.02M, False: 4.39k]
  ------------------
  249|  1.02M|      char_type c = *src;
  250|       |
  251|  1.02M|      uint8_t code = to_base64[uint8_t(c)];
  252|  1.02M|      buffer[idx] = uint8_t(code);
  253|  1.02M|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (253:11): [True: 1.02M, False: 0]
  |  Branch (253:31): [True: 354k, False: 667k]
  ------------------
  254|   354k|        idx++;
  255|   667k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (255:18): [True: 667k, False: 0]
  ------------------
  256|   667k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (256:19): [True: 1.09k, False: 666k]
  |  Branch (256:32): [True: 0, False: 666k]
  ------------------
  257|  1.09k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  258|  1.09k|                size_t(dst - dstinit)};
  259|   666k|      } else {
  260|       |        // We have a space or a newline or garbage. We ignore it.
  261|   666k|      }
  262|  1.02M|      src++;
  263|  1.02M|    }
  264|  91.0k|    if (idx != 4) {
  ------------------
  |  Branch (264:9): [True: 4.39k, False: 86.6k]
  ------------------
  265|  4.39k|      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.39k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (268:11): [True: 4.39k, False: 0]
  |  Branch (268:30): [True: 6, False: 4.38k]
  ------------------
  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.38k|      if (!ignore_garbage &&
  ------------------
  |  Branch (277:11): [True: 4.38k, False: 0]
  ------------------
  278|  4.38k|          last_chunk_options == last_chunk_handling_options::loose &&
  ------------------
  |  Branch (278:11): [True: 1.82k, False: 2.55k]
  ------------------
  279|  1.82k|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (279:11): [True: 1.09k, False: 736]
  |  Branch (279:25): [True: 18, False: 1.07k]
  ------------------
  280|     18|          ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (280:11): [True: 12, False: 6]
  ------------------
  281|     12|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  282|     12|                size_t(dst - dstinit), true};
  283|     12|      } 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.37k|        if (!ignore_garbage &&
  ------------------
  |  Branch (288:13): [True: 4.37k, False: 0]
  ------------------
  289|  4.37k|            last_chunk_options == last_chunk_handling_options::strict &&
  ------------------
  |  Branch (289:13): [True: 300, False: 4.07k]
  ------------------
  290|    300|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (290:13): [True: 138, False: 162]
  |  Branch (290:27): [True: 72, False: 66]
  ------------------
  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|  4.30k|          if ((last_chunk_options ==
  ------------------
  |  Branch (298:16): [True: 2.25k, False: 2.04k]
  ------------------
  299|  4.30k|                   last_chunk_handling_options::stop_before_partial &&
  300|  2.25k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (300:16): [True: 2.24k, False: 12]
  |  Branch (300:50): [True: 1.75k, False: 494]
  ------------------
  301|  1.75k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (301:17): [True: 810, False: 942]
  |  Branch (301:29): [True: 930, False: 12]
  ------------------
  302|  2.56k|              (last_chunk_options ==
  ------------------
  |  Branch (302:16): [True: 0, False: 2.56k]
  ------------------
  303|  2.56k|                   last_chunk_handling_options::only_full_chunks &&
  304|  1.74k|               (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.74k|            src = srccur;
  308|  1.74k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  309|  2.56k|          } else {
  310|  2.56k|            if (idx == 2) {
  ------------------
  |  Branch (310:17): [True: 594, False: 1.96k]
  ------------------
  311|    594|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  312|    594|                                (uint32_t(buffer[1]) << 2 * 6);
  313|    594|              if (!ignore_garbage &&
  ------------------
  |  Branch (313:19): [True: 594, False: 0]
  ------------------
  314|    594|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (314:19): [True: 42, False: 552]
  ------------------
  315|     42|                  (triple & 0xffff)) {
  ------------------
  |  Branch (315:19): [True: 30, False: 12]
  ------------------
  316|     30|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  317|     30|                        size_t(dst - dstinit)};
  318|     30|              }
  319|    564|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (319:19): [Folded, False: 564]
  |  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|    564|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  324|  1.96k|            } else if (idx == 3) {
  ------------------
  |  Branch (324:24): [True: 564, False: 1.40k]
  ------------------
  325|    564|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  326|    564|                                (uint32_t(buffer[1]) << 2 * 6) +
  327|    564|                                (uint32_t(buffer[2]) << 1 * 6);
  328|    564|              if (!ignore_garbage &&
  ------------------
  |  Branch (328:19): [True: 564, False: 0]
  ------------------
  329|    564|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (329:19): [True: 24, False: 540]
  ------------------
  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|    552|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (334:19): [Folded, False: 552]
  |  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|    552|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  339|    552|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  340|  1.40k|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (340:24): [True: 1.40k, False: 0]
  |  Branch (340:43): [True: 390, False: 1.01k]
  ------------------
  341|    390|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (341:25): [True: 378, False: 12]
  ------------------
  342|     12|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (342:26): [True: 12, False: 0]
  ------------------
  343|    390|                         padding_characters > 0))) {
  ------------------
  |  Branch (343:26): [True: 12, False: 0]
  ------------------
  344|    390|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  345|    390|                      size_t(dst - dstinit)};
  346|  1.01k|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (346:24): [True: 1.01k, False: 0]
  |  Branch (346:43): [True: 1.01k, False: 0]
  |  Branch (346:55): [True: 30, False: 984]
  ------------------
  347|     30|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  348|     30|                      size_t(dst - dstinit), true};
  349|     30|            }
  350|  2.10k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  351|  2.56k|          }
  352|  4.38k|    }
  353|  86.6k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (353:9): [Folded, False: 86.6k]
  |  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|  86.6k|    uint32_t triple =
  358|  86.6k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  359|  86.6k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  360|  86.6k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  361|  86.6k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  362|  86.6k|    *dst++ = static_cast<char>(triple & 0xFF);
  363|  86.6k|  }
  364|  5.49k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIDsEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  727|  2.53k|    last_chunk_handling_options last_chunk_options) noexcept {
  728|  2.53k|  const bool ignore_garbage =
  729|  2.53k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (729:7): [True: 0, False: 2.53k]
  ------------------
  730|  2.53k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (730:7): [True: 0, False: 2.53k]
  ------------------
  731|  2.53k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (731:7): [True: 0, False: 2.53k]
  ------------------
  732|  2.53k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  733|  2.53k|  size_t equallocation = ri.equallocation;
  734|  2.53k|  size_t equalsigns = ri.equalsigns;
  735|  2.53k|  length = ri.srclen;
  736|  2.53k|  size_t full_input_length = ri.full_input_length;
  737|  2.53k|  if (length == 0) {
  ------------------
  |  Branch (737:7): [True: 44, False: 2.48k]
  ------------------
  738|     44|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (738:9): [True: 44, False: 0]
  |  Branch (738:28): [True: 22, False: 22]
  ------------------
  739|     22|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
  740|     22|    }
  741|     22|    return {SUCCESS, full_input_length, 0};
  742|     44|  }
  743|  2.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: 916, False: 1.57k]
  |  Branch (747:42): [True: 270, False: 646]
  ------------------
  748|    270|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (748:7): [True: 6, False: 264]
  |  Branch (748:25): [True: 6, False: 0]
  ------------------
  749|       |    // additional checks
  750|      6|    if ((r.output_count % 3 == 0) ||
  ------------------
  |  Branch (750:9): [True: 0, False: 6]
  ------------------
  751|      6|        ((r.output_count % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (751:9): [True: 0, False: 6]
  ------------------
  752|      0|      return {INVALID_BASE64_CHARACTER, equallocation, r.output_count, true};
  753|      0|    }
  754|      6|  }
  755|       |  // When is_partial(last_chunk_options) is true, we must either end with
  756|       |  // the end of the stream (beyond whitespace) or right after a non-ignorable
  757|       |  // character or at the very beginning of the stream.
  758|       |  // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  759|  2.48k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (759:7): [True: 1.57k, False: 916]
  |  Branch (759:41): [True: 926, False: 646]
  ------------------
  760|    926|      r.input_count < full_input_length) {
  ------------------
  |  Branch (760:7): [True: 674, False: 252]
  ------------------
  761|       |    // First check if we can extend the input to the end of the stream
  762|  5.03k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (762:12): [True: 5.02k, False: 10]
  ------------------
  763|  5.02k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (763:12): [True: 4.36k, False: 664]
  ------------------
  764|  4.36k|      r.input_count++;
  765|  4.36k|    }
  766|       |    // If we are still not at the end of the stream, then we must backtrack
  767|       |    // to the last non-ignorable character.
  768|    674|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (768:9): [True: 664, False: 10]
  ------------------
  769|  4.74k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (769:14): [True: 4.59k, False: 144]
  ------------------
  770|  4.59k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (770:14): [True: 4.07k, False: 520]
  ------------------
  771|  4.07k|        r.input_count--;
  772|  4.07k|      }
  773|    664|    }
  774|    674|  }
  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.44k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  372|  5.44k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  373|  5.44k|                                        options, last_chunk_options);
  374|  5.44k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EDsEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  164|  5.44k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  165|  5.44k|  char *dstend = dst + outlen;
  166|  5.44k|  (void)dstend;
  167|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  168|       |  // two branches (easily predicted):
  169|  5.44k|  const uint8_t *to_base64 =
  170|  5.44k|      (options & base64_default_or_url)
  ------------------
  |  Branch (170:7): [True: 0, False: 5.44k]
  ------------------
  171|  5.44k|          ? tables::base64::to_base64_default_or_url_value
  172|  5.44k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (172:14): [True: 2.56k, False: 2.88k]
  ------------------
  173|  5.44k|                                    : tables::base64::to_base64_value);
  174|  5.44k|  const uint32_t *d0 =
  175|  5.44k|      (options & base64_default_or_url)
  ------------------
  |  Branch (175:7): [True: 0, False: 5.44k]
  ------------------
  176|  5.44k|          ? tables::base64::base64_default_or_url::d0
  177|  5.44k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (177:14): [True: 2.56k, False: 2.88k]
  ------------------
  178|  5.44k|                                    : tables::base64::base64_default::d0);
  179|  5.44k|  const uint32_t *d1 =
  180|  5.44k|      (options & base64_default_or_url)
  ------------------
  |  Branch (180:7): [True: 0, False: 5.44k]
  ------------------
  181|  5.44k|          ? tables::base64::base64_default_or_url::d1
  182|  5.44k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (182:14): [True: 2.56k, False: 2.88k]
  ------------------
  183|  5.44k|                                    : tables::base64::base64_default::d1);
  184|  5.44k|  const uint32_t *d2 =
  185|  5.44k|      (options & base64_default_or_url)
  ------------------
  |  Branch (185:7): [True: 0, False: 5.44k]
  ------------------
  186|  5.44k|          ? tables::base64::base64_default_or_url::d2
  187|  5.44k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (187:14): [True: 2.56k, False: 2.88k]
  ------------------
  188|  5.44k|                                    : tables::base64::base64_default::d2);
  189|  5.44k|  const uint32_t *d3 =
  190|  5.44k|      (options & base64_default_or_url)
  ------------------
  |  Branch (190:7): [True: 0, False: 5.44k]
  ------------------
  191|  5.44k|          ? tables::base64::base64_default_or_url::d3
  192|  5.44k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (192:14): [True: 2.56k, False: 2.88k]
  ------------------
  193|  5.44k|                                    : tables::base64::base64_default::d3);
  194|  5.44k|  const bool ignore_garbage =
  195|  5.44k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (195:7): [True: 0, False: 5.44k]
  ------------------
  196|  5.44k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (196:7): [True: 0, False: 5.44k]
  ------------------
  197|  5.44k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (197:7): [True: 0, False: 5.44k]
  ------------------
  198|       |
  199|  5.44k|  const char_type *srcend = src + length;
  200|  5.44k|  const char_type *srcinit = src;
  201|  5.44k|  const char *dstinit = dst;
  202|       |
  203|  5.44k|  uint32_t x;
  204|  5.44k|  size_t idx;
  205|  5.44k|  uint8_t buffer[4];
  206|  70.2k|  while (true) {
  ------------------
  |  Branch (206:10): [True: 70.2k, Folded]
  ------------------
  207|  1.01M|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (207:12): [True: 1.01M, False: 2.93k]
  |  Branch (207:33): [True: 1.01M, False: 328]
  ------------------
  208|  1.01M|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (208:12): [True: 1.01M, False: 192]
  |  Branch (208:37): [True: 1.01M, False: 216]
  ------------------
  209|  1.01M|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (209:12): [True: 1.01M, False: 248]
  ------------------
  210|  1.01M|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (210:12): [True: 949k, False: 66.3k]
  ------------------
  211|  1.01M|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  212|   949k|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (212:11): [Folded, False: 949k]
  |  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|   949k|      *dst++ = static_cast<char>(x & 0xFF);
  217|   949k|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  218|   949k|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  219|   949k|      src += 4;
  220|   949k|    }
  221|  70.2k|    const char_type *srccur = src;
  222|  70.2k|    idx = 0;
  223|       |    // we need at least four characters.
  224|  70.2k|#ifdef __clang__
  225|       |    // If possible, we read four characters at a time. (It is an optimization.)
  226|  70.2k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (226:9): [True: 0, False: 70.2k]
  |  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|  70.2k|#endif
  248|   473k|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (248:12): [True: 408k, False: 64.8k]
  |  Branch (248:25): [True: 404k, False: 3.39k]
  ------------------
  249|   404k|      char_type c = *src;
  250|       |
  251|   404k|      uint8_t code = to_base64[uint8_t(c)];
  252|   404k|      buffer[idx] = uint8_t(code);
  253|   404k|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (253:11): [True: 403k, False: 1.38k]
  |  Branch (253:31): [True: 266k, False: 137k]
  ------------------
  254|   266k|        idx++;
  255|   266k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (255:18): [True: 138k, False: 0]
  ------------------
  256|   138k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (256:19): [True: 1.38k, False: 137k]
  |  Branch (256:32): [True: 666, False: 136k]
  ------------------
  257|  2.04k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  258|  2.04k|                size_t(dst - dstinit)};
  259|   136k|      } else {
  260|       |        // We have a space or a newline or garbage. We ignore it.
  261|   136k|      }
  262|   402k|      src++;
  263|   402k|    }
  264|  68.2k|    if (idx != 4) {
  ------------------
  |  Branch (264:9): [True: 3.39k, False: 64.8k]
  ------------------
  265|  3.39k|      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.39k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (268:11): [True: 3.39k, False: 0]
  |  Branch (268:30): [True: 6, False: 3.39k]
  ------------------
  269|      6|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  270|      6|                size_t(dst - dstinit), true};
  271|      6|      }
  272|       |
  273|       |      // The idea here is that in loose mode,
  274|       |      // if there is padding at all, it must be used
  275|       |      // to form 4-wise chunk. However, in loose mode,
  276|       |      // we do accept no padding at all.
  277|  3.39k|      if (!ignore_garbage &&
  ------------------
  |  Branch (277:11): [True: 3.39k, False: 0]
  ------------------
  278|  3.39k|          last_chunk_options == last_chunk_handling_options::loose &&
  ------------------
  |  Branch (278:11): [True: 690, False: 2.70k]
  ------------------
  279|    690|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (279:11): [True: 402, False: 288]
  |  Branch (279:25): [True: 12, False: 390]
  ------------------
  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.38k|        if (!ignore_garbage &&
  ------------------
  |  Branch (288:13): [True: 3.38k, False: 0]
  ------------------
  289|  3.38k|            last_chunk_options == last_chunk_handling_options::strict &&
  ------------------
  |  Branch (289:13): [True: 264, False: 3.12k]
  ------------------
  290|    264|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (290:13): [True: 144, False: 120]
  |  Branch (290:27): [True: 90, False: 54]
  ------------------
  291|       |          // The partial chunk was at src - idx
  292|     90|          return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  293|     90|                  size_t(dst - dstinit), true};
  294|     90|        } 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.29k|          if ((last_chunk_options ==
  ------------------
  |  Branch (298:16): [True: 2.43k, False: 858]
  ------------------
  299|  3.29k|                   last_chunk_handling_options::stop_before_partial &&
  300|  2.43k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (300:16): [True: 2.42k, False: 12]
  |  Branch (300:50): [True: 2.02k, False: 396]
  ------------------
  301|  2.02k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (301:17): [True: 1.03k, False: 990]
  |  Branch (301:29): [True: 954, False: 36]
  ------------------
  302|  1.30k|              (last_chunk_options ==
  ------------------
  |  Branch (302:16): [True: 0, False: 1.30k]
  ------------------
  303|  1.30k|                   last_chunk_handling_options::only_full_chunks &&
  304|  1.99k|               (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.99k|            src = srccur;
  308|  1.99k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  309|  1.99k|          } else {
  310|  1.30k|            if (idx == 2) {
  ------------------
  |  Branch (310:17): [True: 270, False: 1.03k]
  ------------------
  311|    270|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  312|    270|                                (uint32_t(buffer[1]) << 2 * 6);
  313|    270|              if (!ignore_garbage &&
  ------------------
  |  Branch (313:19): [True: 270, False: 0]
  ------------------
  314|    270|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (314:19): [True: 36, False: 234]
  ------------------
  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|    240|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (319:19): [Folded, False: 240]
  |  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|    240|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  324|  1.03k|            } else if (idx == 3) {
  ------------------
  |  Branch (324:24): [True: 192, False: 840]
  ------------------
  325|    192|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  326|    192|                                (uint32_t(buffer[1]) << 2 * 6) +
  327|    192|                                (uint32_t(buffer[2]) << 1 * 6);
  328|    192|              if (!ignore_garbage &&
  ------------------
  |  Branch (328:19): [True: 192, False: 0]
  ------------------
  329|    192|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (329:19): [True: 18, False: 174]
  ------------------
  330|     18|                  (triple & 0xff)) {
  ------------------
  |  Branch (330:19): [True: 12, False: 6]
  ------------------
  331|     12|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  332|     12|                        size_t(dst - dstinit)};
  333|     12|              }
  334|    180|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (334:19): [Folded, False: 180]
  |  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|    180|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  339|    180|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  340|    840|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (340:24): [True: 840, False: 0]
  |  Branch (340:43): [True: 186, False: 654]
  ------------------
  341|    186|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (341:25): [True: 150, False: 36]
  ------------------
  342|     36|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (342:26): [True: 36, False: 0]
  ------------------
  343|    186|                         padding_characters > 0))) {
  ------------------
  |  Branch (343:26): [True: 36, False: 0]
  ------------------
  344|    186|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  345|    186|                      size_t(dst - dstinit)};
  346|    654|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (346:24): [True: 654, False: 0]
  |  Branch (346:43): [True: 654, False: 0]
  |  Branch (346:55): [True: 18, False: 636]
  ------------------
  347|     18|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  348|     18|                      size_t(dst - dstinit), true};
  349|     18|            }
  350|  1.05k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  351|  1.30k|          }
  352|  3.39k|    }
  353|  64.8k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (353:9): [Folded, False: 64.8k]
  |  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|  64.8k|    uint32_t triple =
  358|  64.8k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  359|  64.8k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  360|  64.8k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  361|  64.8k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  362|  64.8k|    *dst++ = static_cast<char>(triple & 0xFF);
  363|  64.8k|  }
  364|  5.44k|}

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

_ZNK7simdutf8fallback14implementation16base64_to_binaryEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  536|  1.26k|    last_chunk_handling_options last_chunk_options) const noexcept {
  537|  1.26k|  return simdutf::scalar::base64::base64_to_binary_details_impl(
  538|  1.26k|      input, length, output, options, last_chunk_options);
  539|  1.26k|}
_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.26k|    last_chunk_handling_options last_chunk_options) const noexcept {
  551|  1.26k|  return simdutf::scalar::base64::base64_to_binary_details_impl(
  552|  1.26k|      input, length, output, options, last_chunk_options);
  553|  1.26k|}
_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.23k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.23k|  const uint8_t *to_base64 =
   47|  1.23k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.23k]
  ------------------
   48|  1.23k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.23k, Folded]
  ------------------
   49|  1.23k|                                   : tables::base64::to_base64_value);
   50|  1.23k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.23k|  size_t equallocation = ri.equallocation;
   52|  1.23k|  size_t equalsigns = ri.equalsigns;
   53|  1.23k|  srclen = ri.srclen;
   54|  1.23k|  size_t full_input_length = ri.full_input_length;
   55|  1.23k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 20, False: 1.21k]
  ------------------
   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.21k|  char *end_of_safe_64byte_zone =
   62|  1.21k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 54, False: 1.15k]
  ------------------
   63|  1.21k|          ? nullptr
   64|  1.21k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 364, False: 792]
  ------------------
   65|  1.15k|                                        : dst);
   66|       |
   67|  1.21k|  const chartype *const srcinit = src;
   68|  1.21k|  const char *const dstinit = dst;
   69|  1.21k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.21k|  constexpr size_t block_size = 6;
   72|  1.21k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.21k|  char buffer[block_size * 64];
   74|  1.21k|  char *bufferptr = buffer;
   75|  1.21k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 958, False: 252]
  ------------------
   76|    958|    const chartype *const srcend64 = src + srclen - 64;
   77|   114k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 114k, False: 612]
  ------------------
   78|   114k|      block64 b(src);
   79|   114k|      src += 64;
   80|   114k|      uint64_t error = 0;
   81|   114k|      const uint64_t badcharmask =
   82|   114k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   114k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 114k, Folded]
  |  Branch (83:30): [True: 346, False: 113k]
  ------------------
   84|    346|        src -= 64;
   85|    346|        const size_t error_offset = trailing_zeroes(error);
   86|    346|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    346|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    346|      }
   89|   113k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 40.3k, False: 73.4k]
  ------------------
   90|  40.3k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  73.4k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 11.5k, False: 61.8k]
  ------------------
   92|  11.5k|        b.copy_block(bufferptr);
   93|  11.5k|        bufferptr += 64;
   94|  61.8k|      } else {
   95|  61.8k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 12, False: 61.8k]
  ------------------
   96|     12|          b.base64_decode_block_safe(dst);
   97|  61.8k|        } else {
   98|  61.8k|          b.base64_decode_block(dst);
   99|  61.8k|        }
  100|  61.8k|        dst += 48;
  101|  61.8k|      }
  102|   113k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 8.56k, False: 105k]
  ------------------
  103|  42.8k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 34.2k, False: 8.56k]
  ------------------
  104|  34.2k|          base64_decode_block(dst, buffer + i * 64);
  105|  34.2k|          dst += 48;
  106|  34.2k|        }
  107|  8.56k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 8.56k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  8.56k|        } else {
  110|  8.56k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  8.56k|        }
  112|  8.56k|        dst += 48;
  113|  8.56k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  8.56k|                    64); // 64 might be too much
  115|  8.56k|        bufferptr -= (block_size - 1) * 64;
  116|  8.56k|      }
  117|   113k|    }
  118|    958|  }
  119|       |
  120|    864|  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|    864|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    864|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 554, False: 310]
  |  Branch (124:26): [True: 68, False: 486]
  ------------------
  125|       |
  126|    896|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 848, False: 48]
  |  Branch (126:52): [True: 834, False: 14]
  ------------------
  127|    834|      uint8_t val = to_base64[uint8_t(*src)];
  128|    834|      *bufferptr = char(val);
  129|    834|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 834, Folded]
  ------------------
  130|    834|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 834]
  |  Branch (130:52): [True: 6, False: 828]
  ------------------
  131|      6|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      6|                size_t(dst - dstinit)};
  133|      6|      }
  134|    828|      bufferptr += (val <= 63);
  135|    828|      src++;
  136|    828|    }
  137|     68|  }
  138|       |
  139|  1.32k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 466, False: 858]
  ------------------
  140|    466|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 26, False: 440]
  ------------------
  141|     26|      base64_decode_block_safe(dst, buffer_start);
  142|    440|    } else {
  143|    440|      base64_decode_block(dst, buffer_start);
  144|    440|    }
  145|    466|    dst += 48;
  146|    466|  }
  147|    858|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 500, False: 358]
  ------------------
  148|  4.20k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.70k, False: 500]
  ------------------
  149|  3.70k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.70k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.70k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.70k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.70k|                        << 8;
  154|  3.70k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.70k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.70k|#endif
  157|  3.70k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.70k|      dst += 3;
  160|  3.70k|      buffer_start += 4;
  161|  3.70k|    }
  162|    500|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 118, False: 382]
  ------------------
  163|    118|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    118|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    118|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    118|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    118|                        << 8;
  168|    118|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    118|      triple = scalar::u32_swap_bytes(triple);
  170|    118|#endif
  171|    118|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    118|      dst += 3;
  174|    118|      buffer_start += 4;
  175|    118|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    500|    int leftover = int(bufferptr - buffer_start);
  179|  1.27k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 772, False: 500]
  ------------------
  180|    772|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 772, Folded]
  ------------------
  181|  6.17k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 5.40k, False: 772]
  ------------------
  182|  5.40k|          src--;
  183|  5.40k|        }
  184|    772|      } 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|    772|      src--;
  190|    772|      leftover--;
  191|    772|    }
  192|    500|  }
  193|    858|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 712, False: 146]
  ------------------
  194|    712|    full_result r = scalar::base64::base64_tail_decode(
  195|    712|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    712|    r = scalar::base64::patch_tail_result(
  197|    712|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    712|        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|    712|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 346, False: 366]
  |  Branch (203:43): [True: 336, False: 10]
  ------------------
  204|    336|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 292, False: 44]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    712|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 708, False: 4]
  ------------------
  207|    708|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 420, False: 288]
  ------------------
  208|    420|        r.input_count++;
  209|    420|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    292|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 288, False: 4]
  ------------------
  213|  11.3k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 11.2k, False: 64]
  ------------------
  214|  11.2k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 11.0k, False: 224]
  ------------------
  215|  11.0k|          r.input_count--;
  216|  11.0k|        }
  217|    288|      }
  218|    292|    }
  219|    712|    return r;
  220|    712|  }
  221|    146|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 146, Folded]
  |  Branch (221:26): [True: 0, False: 146]
  ------------------
  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|    146|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    146|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EcEENS_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: 48, False: 1.24k]
  ------------------
   63|  1.28k|          ? nullptr
   64|  1.28k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 392, False: 848]
  ------------------
   65|  1.24k|                                        : 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: 986, False: 302]
  ------------------
   76|    986|    const chartype *const srcend64 = src + srclen - 64;
   77|   268k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 267k, False: 634]
  ------------------
   78|   267k|      block64 b(src);
   79|   267k|      src += 64;
   80|   267k|      uint64_t error = 0;
   81|   267k|      const uint64_t badcharmask =
   82|   267k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   267k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 267k, Folded]
  |  Branch (83:30): [True: 352, False: 267k]
  ------------------
   84|    352|        src -= 64;
   85|    352|        const size_t error_offset = trailing_zeroes(error);
   86|    352|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    352|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    352|      }
   89|   267k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 34.9k, False: 232k]
  ------------------
   90|  34.9k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   232k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 150k, False: 81.2k]
  ------------------
   92|   150k|        b.copy_block(bufferptr);
   93|   150k|        bufferptr += 64;
   94|   150k|      } else {
   95|  81.2k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 81.2k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|  81.2k|        } else {
   98|  81.2k|          b.base64_decode_block(dst);
   99|  81.2k|        }
  100|  81.2k|        dst += 48;
  101|  81.2k|      }
  102|   267k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 36.6k, False: 230k]
  ------------------
  103|   183k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 146k, False: 36.6k]
  ------------------
  104|   146k|          base64_decode_block(dst, buffer + i * 64);
  105|   146k|          dst += 48;
  106|   146k|        }
  107|  36.6k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 36.6k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  36.6k|        } else {
  110|  36.6k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  36.6k|        }
  112|  36.6k|        dst += 48;
  113|  36.6k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  36.6k|                    64); // 64 might be too much
  115|  36.6k|        bufferptr -= (block_size - 1) * 64;
  116|  36.6k|      }
  117|   267k|    }
  118|    986|  }
  119|       |
  120|    936|  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|    936|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    936|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 580, False: 356]
  |  Branch (124:26): [True: 78, False: 502]
  ------------------
  125|       |
  126|    946|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 888, False: 58]
  |  Branch (126:52): [True: 872, False: 16]
  ------------------
  127|    872|      uint8_t val = to_base64[uint8_t(*src)];
  128|    872|      *bufferptr = char(val);
  129|    872|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 872, Folded]
  ------------------
  130|    872|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 872]
  |  Branch (130:52): [True: 4, False: 868]
  ------------------
  131|      4|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      4|                size_t(dst - dstinit)};
  133|      4|      }
  134|    868|      bufferptr += (val <= 63);
  135|    868|      src++;
  136|    868|    }
  137|     78|  }
  138|       |
  139|  1.42k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 488, False: 932]
  ------------------
  140|    488|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 34, False: 454]
  ------------------
  141|     34|      base64_decode_block_safe(dst, buffer_start);
  142|    454|    } else {
  143|    454|      base64_decode_block(dst, buffer_start);
  144|    454|    }
  145|    488|    dst += 48;
  146|    488|  }
  147|    932|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 518, False: 414]
  ------------------
  148|  4.34k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.82k, False: 518]
  ------------------
  149|  3.82k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.82k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.82k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.82k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.82k|                        << 8;
  154|  3.82k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.82k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.82k|#endif
  157|  3.82k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.82k|      dst += 3;
  160|  3.82k|      buffer_start += 4;
  161|  3.82k|    }
  162|    518|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 130, False: 388]
  ------------------
  163|    130|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    130|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    130|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    130|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    130|                        << 8;
  168|    130|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    130|      triple = scalar::u32_swap_bytes(triple);
  170|    130|#endif
  171|    130|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    130|      dst += 3;
  174|    130|      buffer_start += 4;
  175|    130|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    518|    int leftover = int(bufferptr - buffer_start);
  179|  1.27k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 760, False: 518]
  ------------------
  180|    760|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 760, Folded]
  ------------------
  181|  5.11k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.35k, False: 760]
  ------------------
  182|  4.35k|          src--;
  183|  4.35k|        }
  184|    760|      } 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|    760|      src--;
  190|    760|      leftover--;
  191|    760|    }
  192|    518|  }
  193|    932|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 784, False: 148]
  ------------------
  194|    784|    full_result r = scalar::base64::base64_tail_decode(
  195|    784|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    784|    r = scalar::base64::patch_tail_result(
  197|    784|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    784|        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|    784|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 386, False: 398]
  |  Branch (203:43): [True: 366, False: 20]
  ------------------
  204|    366|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 298, False: 68]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    668|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 662, False: 6]
  ------------------
  207|    662|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 370, False: 292]
  ------------------
  208|    370|        r.input_count++;
  209|    370|      }
  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|  2.61k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.56k, False: 52]
  ------------------
  214|  2.56k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.32k, False: 240]
  ------------------
  215|  2.32k|          r.input_count--;
  216|  2.32k|        }
  217|    292|      }
  218|    298|    }
  219|    784|    return r;
  220|    784|  }
  221|    148|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 148, Folded]
  |  Branch (221:26): [True: 0, False: 148]
  ------------------
  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|    148|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    148|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.20k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.20k|  const uint8_t *to_base64 =
   47|  1.20k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.20k]
  ------------------
   48|  1.20k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.20k, Folded]
  ------------------
   49|  1.20k|                                   : tables::base64::to_base64_value);
   50|  1.20k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.20k|  size_t equallocation = ri.equallocation;
   52|  1.20k|  size_t equalsigns = ri.equalsigns;
   53|  1.20k|  srclen = ri.srclen;
   54|  1.20k|  size_t full_input_length = ri.full_input_length;
   55|  1.20k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 18, False: 1.18k]
  ------------------
   56|     18|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 18, Folded]
  |  Branch (56:28): [True: 6, False: 12]
  ------------------
   57|      6|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      6|    }
   59|     12|    return {SUCCESS, full_input_length, 0};
   60|     18|  }
   61|  1.18k|  char *end_of_safe_64byte_zone =
   62|  1.18k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 72, False: 1.11k]
  ------------------
   63|  1.18k|          ? nullptr
   64|  1.18k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 322, False: 792]
  ------------------
   65|  1.11k|                                        : dst);
   66|       |
   67|  1.18k|  const chartype *const srcinit = src;
   68|  1.18k|  const char *const dstinit = dst;
   69|  1.18k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.18k|  constexpr size_t block_size = 6;
   72|  1.18k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.18k|  char buffer[block_size * 64];
   74|  1.18k|  char *bufferptr = buffer;
   75|  1.18k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 922, False: 264]
  ------------------
   76|    922|    const chartype *const srcend64 = src + srclen - 64;
   77|  21.2k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 20.6k, False: 594]
  ------------------
   78|  20.6k|      block64 b(src);
   79|  20.6k|      src += 64;
   80|  20.6k|      uint64_t error = 0;
   81|  20.6k|      const uint64_t badcharmask =
   82|  20.6k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  20.6k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 20.6k, Folded]
  |  Branch (83:30): [True: 328, False: 20.2k]
  ------------------
   84|    328|        src -= 64;
   85|    328|        const size_t error_offset = trailing_zeroes(error);
   86|    328|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    328|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    328|      }
   89|  20.2k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 17.1k, False: 3.13k]
  ------------------
   90|  17.1k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  17.1k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 2.74k, False: 390]
  ------------------
   92|  2.74k|        b.copy_block(bufferptr);
   93|  2.74k|        bufferptr += 64;
   94|  2.74k|      } else {
   95|    390|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 380]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|    380|        } else {
   98|    380|          b.base64_decode_block(dst);
   99|    380|        }
  100|    390|        dst += 48;
  101|    390|      }
  102|  20.2k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 3.71k, False: 16.5k]
  ------------------
  103|  18.5k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 14.8k, False: 3.71k]
  ------------------
  104|  14.8k|          base64_decode_block(dst, buffer + i * 64);
  105|  14.8k|          dst += 48;
  106|  14.8k|        }
  107|  3.71k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 3.71k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  3.71k|        } else {
  110|  3.71k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  3.71k|        }
  112|  3.71k|        dst += 48;
  113|  3.71k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  3.71k|                    64); // 64 might be too much
  115|  3.71k|        bufferptr -= (block_size - 1) * 64;
  116|  3.71k|      }
  117|  20.2k|    }
  118|    922|  }
  119|       |
  120|    858|  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|    858|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    858|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 546, False: 312]
  |  Branch (124:26): [True: 104, False: 442]
  ------------------
  125|       |
  126|    744|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 694, False: 50]
  |  Branch (126:52): [True: 680, False: 14]
  ------------------
  127|    680|      uint8_t val = to_base64[uint8_t(*src)];
  128|    680|      *bufferptr = char(val);
  129|    680|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 680, Folded]
  ------------------
  130|    680|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 22, False: 658]
  |  Branch (130:52): [True: 18, False: 640]
  ------------------
  131|     40|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     40|                size_t(dst - dstinit)};
  133|     40|      }
  134|    640|      bufferptr += (val <= 63);
  135|    640|      src++;
  136|    640|    }
  137|    104|  }
  138|       |
  139|  1.14k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 328, False: 818]
  ------------------
  140|    328|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 32, False: 296]
  ------------------
  141|     32|      base64_decode_block_safe(dst, buffer_start);
  142|    296|    } else {
  143|    296|      base64_decode_block(dst, buffer_start);
  144|    296|    }
  145|    328|    dst += 48;
  146|    328|  }
  147|    818|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 456, False: 362]
  ------------------
  148|  3.75k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.30k, False: 456]
  ------------------
  149|  3.30k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.30k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.30k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.30k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.30k|                        << 8;
  154|  3.30k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.30k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.30k|#endif
  157|  3.30k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.30k|      dst += 3;
  160|  3.30k|      buffer_start += 4;
  161|  3.30k|    }
  162|    456|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 104, False: 352]
  ------------------
  163|    104|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    104|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    104|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    104|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    104|                        << 8;
  168|    104|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    104|      triple = scalar::u32_swap_bytes(triple);
  170|    104|#endif
  171|    104|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    104|      dst += 3;
  174|    104|      buffer_start += 4;
  175|    104|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    456|    int leftover = int(bufferptr - buffer_start);
  179|  1.14k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 692, False: 456]
  ------------------
  180|    692|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 692, Folded]
  ------------------
  181|  7.64k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 6.95k, False: 692]
  ------------------
  182|  6.95k|          src--;
  183|  6.95k|        }
  184|    692|      } 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|    692|      src--;
  190|    692|      leftover--;
  191|    692|    }
  192|    456|  }
  193|    818|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 688, False: 130]
  ------------------
  194|    688|    full_result r = scalar::base64::base64_tail_decode(
  195|    688|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    688|    r = scalar::base64::patch_tail_result(
  197|    688|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    688|        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|    688|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 448, False: 240]
  |  Branch (203:43): [True: 356, False: 92]
  ------------------
  204|    356|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 332, False: 24]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    696|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 692, False: 4]
  ------------------
  207|    692|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 364, False: 328]
  ------------------
  208|    364|        r.input_count++;
  209|    364|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    332|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 328, False: 4]
  ------------------
  213|  2.39k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.32k, False: 68]
  ------------------
  214|  2.32k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.06k, False: 260]
  ------------------
  215|  2.06k|          r.input_count--;
  216|  2.06k|        }
  217|    328|      }
  218|    332|    }
  219|    688|    return r;
  220|    688|  }
  221|    130|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 130, Folded]
  |  Branch (221:26): [True: 0, False: 130]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    130|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    130|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.32k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.32k|  const uint8_t *to_base64 =
   47|  1.32k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.32k]
  ------------------
   48|  1.32k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.32k]
  ------------------
   49|  1.32k|                                   : tables::base64::to_base64_value);
   50|  1.32k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.32k|  size_t equallocation = ri.equallocation;
   52|  1.32k|  size_t equalsigns = ri.equalsigns;
   53|  1.32k|  srclen = ri.srclen;
   54|  1.32k|  size_t full_input_length = ri.full_input_length;
   55|  1.32k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 26, False: 1.30k]
  ------------------
   56|     26|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 26, Folded]
  |  Branch (56:28): [True: 16, False: 10]
  ------------------
   57|     16|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     16|    }
   59|     10|    return {SUCCESS, full_input_length, 0};
   60|     26|  }
   61|  1.30k|  char *end_of_safe_64byte_zone =
   62|  1.30k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 106, False: 1.19k]
  ------------------
   63|  1.30k|          ? nullptr
   64|  1.30k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 348, False: 848]
  ------------------
   65|  1.19k|                                        : dst);
   66|       |
   67|  1.30k|  const chartype *const srcinit = src;
   68|  1.30k|  const char *const dstinit = dst;
   69|  1.30k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.30k|  constexpr size_t block_size = 6;
   72|  1.30k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.30k|  char buffer[block_size * 64];
   74|  1.30k|  char *bufferptr = buffer;
   75|  1.30k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 962, False: 340]
  ------------------
   76|    962|    const chartype *const srcend64 = src + srclen - 64;
   77|  45.5k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 44.8k, False: 630]
  ------------------
   78|  44.8k|      block64 b(src);
   79|  44.8k|      src += 64;
   80|  44.8k|      uint64_t error = 0;
   81|  44.8k|      const uint64_t badcharmask =
   82|  44.8k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  44.8k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 44.8k, Folded]
  |  Branch (83:30): [True: 332, False: 44.5k]
  ------------------
   84|    332|        src -= 64;
   85|    332|        const size_t error_offset = trailing_zeroes(error);
   86|    332|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    332|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    332|      }
   89|  44.5k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 34.4k, False: 10.1k]
  ------------------
   90|  34.4k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  34.4k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 9.90k, False: 230]
  ------------------
   92|  9.90k|        b.copy_block(bufferptr);
   93|  9.90k|        bufferptr += 64;
   94|  9.90k|      } else {
   95|    230|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 4, False: 226]
  ------------------
   96|      4|          b.base64_decode_block_safe(dst);
   97|    226|        } else {
   98|    226|          b.base64_decode_block(dst);
   99|    226|        }
  100|    230|        dst += 48;
  101|    230|      }
  102|  44.5k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 8.49k, False: 36.0k]
  ------------------
  103|  42.4k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 33.9k, False: 8.49k]
  ------------------
  104|  33.9k|          base64_decode_block(dst, buffer + i * 64);
  105|  33.9k|          dst += 48;
  106|  33.9k|        }
  107|  8.49k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 8.49k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  8.49k|        } else {
  110|  8.49k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  8.49k|        }
  112|  8.49k|        dst += 48;
  113|  8.49k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  8.49k|                    64); // 64 might be too much
  115|  8.49k|        bufferptr -= (block_size - 1) * 64;
  116|  8.49k|      }
  117|  44.5k|    }
  118|    962|  }
  119|       |
  120|    970|  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|    970|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    970|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 598, False: 372]
  |  Branch (124:26): [True: 106, False: 492]
  ------------------
  125|       |
  126|    748|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 696, False: 52]
  |  Branch (126:52): [True: 682, False: 14]
  ------------------
  127|    682|      uint8_t val = to_base64[uint8_t(*src)];
  128|    682|      *bufferptr = char(val);
  129|    682|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 682, Folded]
  ------------------
  130|    682|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 20, False: 662]
  |  Branch (130:52): [True: 20, False: 642]
  ------------------
  131|     40|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     40|                size_t(dst - dstinit)};
  133|     40|      }
  134|    642|      bufferptr += (val <= 63);
  135|    642|      src++;
  136|    642|    }
  137|    106|  }
  138|       |
  139|  1.35k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 420, False: 930]
  ------------------
  140|    420|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 34, False: 386]
  ------------------
  141|     34|      base64_decode_block_safe(dst, buffer_start);
  142|    386|    } else {
  143|    386|      base64_decode_block(dst, buffer_start);
  144|    386|    }
  145|    420|    dst += 48;
  146|    420|  }
  147|    930|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 506, False: 424]
  ------------------
  148|  4.13k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.62k, False: 506]
  ------------------
  149|  3.62k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.62k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.62k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.62k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.62k|                        << 8;
  154|  3.62k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.62k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.62k|#endif
  157|  3.62k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.62k|      dst += 3;
  160|  3.62k|      buffer_start += 4;
  161|  3.62k|    }
  162|    506|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 134, False: 372]
  ------------------
  163|    134|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    134|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    134|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    134|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    134|                        << 8;
  168|    134|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    134|      triple = scalar::u32_swap_bytes(triple);
  170|    134|#endif
  171|    134|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    134|      dst += 3;
  174|    134|      buffer_start += 4;
  175|    134|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    506|    int leftover = int(bufferptr - buffer_start);
  179|  1.23k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 728, False: 506]
  ------------------
  180|    728|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 728, Folded]
  ------------------
  181|  5.66k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.93k, False: 728]
  ------------------
  182|  4.93k|          src--;
  183|  4.93k|        }
  184|    728|      } 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|    728|      src--;
  190|    728|      leftover--;
  191|    728|    }
  192|    506|  }
  193|    930|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 790, False: 140]
  ------------------
  194|    790|    full_result r = scalar::base64::base64_tail_decode(
  195|    790|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    790|    r = scalar::base64::patch_tail_result(
  197|    790|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    790|        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|    790|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 488, False: 302]
  |  Branch (203:43): [True: 378, False: 110]
  ------------------
  204|    378|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 342, False: 36]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    658|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 652, False: 6]
  ------------------
  207|    652|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 316, False: 336]
  ------------------
  208|    316|        r.input_count++;
  209|    316|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    342|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 336, False: 6]
  ------------------
  213|  2.34k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.27k, False: 76]
  ------------------
  214|  2.27k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.01k, False: 260]
  ------------------
  215|  2.01k|          r.input_count--;
  216|  2.01k|        }
  217|    336|      }
  218|    342|    }
  219|    790|    return r;
  220|    790|  }
  221|    140|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 140, Folded]
  |  Branch (221:26): [True: 0, False: 140]
  ------------------
  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|    140|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    140|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.23k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.23k|  const uint8_t *to_base64 =
   47|  1.23k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.23k]
  ------------------
   48|  1.23k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.23k, Folded]
  ------------------
   49|  1.23k|                                   : tables::base64::to_base64_value);
   50|  1.23k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.23k|  size_t equallocation = ri.equallocation;
   52|  1.23k|  size_t equalsigns = ri.equalsigns;
   53|  1.23k|  srclen = ri.srclen;
   54|  1.23k|  size_t full_input_length = ri.full_input_length;
   55|  1.23k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 20, False: 1.21k]
  ------------------
   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.21k|  char *end_of_safe_64byte_zone =
   62|  1.21k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 54, False: 1.15k]
  ------------------
   63|  1.21k|          ? nullptr
   64|  1.21k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 364, False: 792]
  ------------------
   65|  1.15k|                                        : dst);
   66|       |
   67|  1.21k|  const chartype *const srcinit = src;
   68|  1.21k|  const char *const dstinit = dst;
   69|  1.21k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.21k|  constexpr size_t block_size = 6;
   72|  1.21k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.21k|  char buffer[block_size * 64];
   74|  1.21k|  char *bufferptr = buffer;
   75|  1.21k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 958, False: 252]
  ------------------
   76|    958|    const chartype *const srcend64 = src + srclen - 64;
   77|   114k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 114k, False: 612]
  ------------------
   78|   114k|      block64 b(src);
   79|   114k|      src += 64;
   80|   114k|      uint64_t error = 0;
   81|   114k|      const uint64_t badcharmask =
   82|   114k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   114k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 114k, Folded]
  |  Branch (83:30): [True: 346, False: 113k]
  ------------------
   84|    346|        src -= 64;
   85|    346|        const size_t error_offset = trailing_zeroes(error);
   86|    346|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    346|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    346|      }
   89|   113k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 40.3k, False: 73.4k]
  ------------------
   90|  40.3k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  73.4k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 11.5k, False: 61.8k]
  ------------------
   92|  11.5k|        b.copy_block(bufferptr);
   93|  11.5k|        bufferptr += 64;
   94|  61.8k|      } else {
   95|  61.8k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 12, False: 61.8k]
  ------------------
   96|     12|          b.base64_decode_block_safe(dst);
   97|  61.8k|        } else {
   98|  61.8k|          b.base64_decode_block(dst);
   99|  61.8k|        }
  100|  61.8k|        dst += 48;
  101|  61.8k|      }
  102|   113k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 8.56k, False: 105k]
  ------------------
  103|  42.8k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 34.2k, False: 8.56k]
  ------------------
  104|  34.2k|          base64_decode_block(dst, buffer + i * 64);
  105|  34.2k|          dst += 48;
  106|  34.2k|        }
  107|  8.56k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 8.56k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  8.56k|        } else {
  110|  8.56k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  8.56k|        }
  112|  8.56k|        dst += 48;
  113|  8.56k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  8.56k|                    64); // 64 might be too much
  115|  8.56k|        bufferptr -= (block_size - 1) * 64;
  116|  8.56k|      }
  117|   113k|    }
  118|    958|  }
  119|       |
  120|    864|  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|    864|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    864|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 554, False: 310]
  |  Branch (124:26): [True: 68, False: 486]
  ------------------
  125|       |
  126|    896|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 848, False: 48]
  |  Branch (126:52): [True: 834, False: 14]
  ------------------
  127|    834|      uint8_t val = to_base64[uint8_t(*src)];
  128|    834|      *bufferptr = char(val);
  129|    834|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 834, Folded]
  ------------------
  130|    834|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 834]
  |  Branch (130:52): [True: 6, False: 828]
  ------------------
  131|      6|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      6|                size_t(dst - dstinit)};
  133|      6|      }
  134|    828|      bufferptr += (val <= 63);
  135|    828|      src++;
  136|    828|    }
  137|     68|  }
  138|       |
  139|  1.32k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 466, False: 858]
  ------------------
  140|    466|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 26, False: 440]
  ------------------
  141|     26|      base64_decode_block_safe(dst, buffer_start);
  142|    440|    } else {
  143|    440|      base64_decode_block(dst, buffer_start);
  144|    440|    }
  145|    466|    dst += 48;
  146|    466|  }
  147|    858|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 500, False: 358]
  ------------------
  148|  4.20k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.70k, False: 500]
  ------------------
  149|  3.70k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.70k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.70k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.70k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.70k|                        << 8;
  154|  3.70k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.70k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.70k|#endif
  157|  3.70k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.70k|      dst += 3;
  160|  3.70k|      buffer_start += 4;
  161|  3.70k|    }
  162|    500|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 118, False: 382]
  ------------------
  163|    118|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    118|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    118|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    118|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    118|                        << 8;
  168|    118|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    118|      triple = scalar::u32_swap_bytes(triple);
  170|    118|#endif
  171|    118|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    118|      dst += 3;
  174|    118|      buffer_start += 4;
  175|    118|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    500|    int leftover = int(bufferptr - buffer_start);
  179|  1.27k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 772, False: 500]
  ------------------
  180|    772|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 772, Folded]
  ------------------
  181|  6.17k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 5.40k, False: 772]
  ------------------
  182|  5.40k|          src--;
  183|  5.40k|        }
  184|    772|      } 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|    772|      src--;
  190|    772|      leftover--;
  191|    772|    }
  192|    500|  }
  193|    858|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 712, False: 146]
  ------------------
  194|    712|    full_result r = scalar::base64::base64_tail_decode(
  195|    712|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    712|    r = scalar::base64::patch_tail_result(
  197|    712|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    712|        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|    712|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 346, False: 366]
  |  Branch (203:43): [True: 336, False: 10]
  ------------------
  204|    336|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 292, False: 44]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    712|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 708, False: 4]
  ------------------
  207|    708|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 420, False: 288]
  ------------------
  208|    420|        r.input_count++;
  209|    420|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    292|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 288, False: 4]
  ------------------
  213|  11.3k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 11.2k, False: 64]
  ------------------
  214|  11.2k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 11.0k, False: 224]
  ------------------
  215|  11.0k|          r.input_count--;
  216|  11.0k|        }
  217|    288|      }
  218|    292|    }
  219|    712|    return r;
  220|    712|  }
  221|    146|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 146, Folded]
  |  Branch (221:26): [True: 0, False: 146]
  ------------------
  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|    146|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    146|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EcEENS_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: 48, False: 1.24k]
  ------------------
   63|  1.28k|          ? nullptr
   64|  1.28k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 392, False: 848]
  ------------------
   65|  1.24k|                                        : 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: 986, False: 302]
  ------------------
   76|    986|    const chartype *const srcend64 = src + srclen - 64;
   77|   268k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 267k, False: 634]
  ------------------
   78|   267k|      block64 b(src);
   79|   267k|      src += 64;
   80|   267k|      uint64_t error = 0;
   81|   267k|      const uint64_t badcharmask =
   82|   267k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   267k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 267k, Folded]
  |  Branch (83:30): [True: 352, False: 267k]
  ------------------
   84|    352|        src -= 64;
   85|    352|        const size_t error_offset = trailing_zeroes(error);
   86|    352|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    352|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    352|      }
   89|   267k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 34.9k, False: 232k]
  ------------------
   90|  34.9k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   232k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 150k, False: 81.2k]
  ------------------
   92|   150k|        b.copy_block(bufferptr);
   93|   150k|        bufferptr += 64;
   94|   150k|      } else {
   95|  81.2k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 81.2k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|  81.2k|        } else {
   98|  81.2k|          b.base64_decode_block(dst);
   99|  81.2k|        }
  100|  81.2k|        dst += 48;
  101|  81.2k|      }
  102|   267k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 36.6k, False: 230k]
  ------------------
  103|   183k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 146k, False: 36.6k]
  ------------------
  104|   146k|          base64_decode_block(dst, buffer + i * 64);
  105|   146k|          dst += 48;
  106|   146k|        }
  107|  36.6k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 36.6k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  36.6k|        } else {
  110|  36.6k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  36.6k|        }
  112|  36.6k|        dst += 48;
  113|  36.6k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  36.6k|                    64); // 64 might be too much
  115|  36.6k|        bufferptr -= (block_size - 1) * 64;
  116|  36.6k|      }
  117|   267k|    }
  118|    986|  }
  119|       |
  120|    936|  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|    936|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    936|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 580, False: 356]
  |  Branch (124:26): [True: 78, False: 502]
  ------------------
  125|       |
  126|    946|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 888, False: 58]
  |  Branch (126:52): [True: 872, False: 16]
  ------------------
  127|    872|      uint8_t val = to_base64[uint8_t(*src)];
  128|    872|      *bufferptr = char(val);
  129|    872|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 872, Folded]
  ------------------
  130|    872|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 872]
  |  Branch (130:52): [True: 4, False: 868]
  ------------------
  131|      4|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      4|                size_t(dst - dstinit)};
  133|      4|      }
  134|    868|      bufferptr += (val <= 63);
  135|    868|      src++;
  136|    868|    }
  137|     78|  }
  138|       |
  139|  1.42k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 488, False: 932]
  ------------------
  140|    488|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 34, False: 454]
  ------------------
  141|     34|      base64_decode_block_safe(dst, buffer_start);
  142|    454|    } else {
  143|    454|      base64_decode_block(dst, buffer_start);
  144|    454|    }
  145|    488|    dst += 48;
  146|    488|  }
  147|    932|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 518, False: 414]
  ------------------
  148|  4.34k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.82k, False: 518]
  ------------------
  149|  3.82k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.82k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.82k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.82k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.82k|                        << 8;
  154|  3.82k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.82k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.82k|#endif
  157|  3.82k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.82k|      dst += 3;
  160|  3.82k|      buffer_start += 4;
  161|  3.82k|    }
  162|    518|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 130, False: 388]
  ------------------
  163|    130|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    130|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    130|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    130|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    130|                        << 8;
  168|    130|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    130|      triple = scalar::u32_swap_bytes(triple);
  170|    130|#endif
  171|    130|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    130|      dst += 3;
  174|    130|      buffer_start += 4;
  175|    130|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    518|    int leftover = int(bufferptr - buffer_start);
  179|  1.27k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 760, False: 518]
  ------------------
  180|    760|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 760, Folded]
  ------------------
  181|  5.11k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.35k, False: 760]
  ------------------
  182|  4.35k|          src--;
  183|  4.35k|        }
  184|    760|      } 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|    760|      src--;
  190|    760|      leftover--;
  191|    760|    }
  192|    518|  }
  193|    932|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 784, False: 148]
  ------------------
  194|    784|    full_result r = scalar::base64::base64_tail_decode(
  195|    784|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    784|    r = scalar::base64::patch_tail_result(
  197|    784|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    784|        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|    784|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 386, False: 398]
  |  Branch (203:43): [True: 366, False: 20]
  ------------------
  204|    366|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 298, False: 68]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    668|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 662, False: 6]
  ------------------
  207|    662|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 370, False: 292]
  ------------------
  208|    370|        r.input_count++;
  209|    370|      }
  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|  2.61k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.56k, False: 52]
  ------------------
  214|  2.56k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.32k, False: 240]
  ------------------
  215|  2.32k|          r.input_count--;
  216|  2.32k|        }
  217|    292|      }
  218|    298|    }
  219|    784|    return r;
  220|    784|  }
  221|    148|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 148, Folded]
  |  Branch (221:26): [True: 0, False: 148]
  ------------------
  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|    148|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    148|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.20k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.20k|  const uint8_t *to_base64 =
   47|  1.20k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.20k]
  ------------------
   48|  1.20k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.20k, Folded]
  ------------------
   49|  1.20k|                                   : tables::base64::to_base64_value);
   50|  1.20k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.20k|  size_t equallocation = ri.equallocation;
   52|  1.20k|  size_t equalsigns = ri.equalsigns;
   53|  1.20k|  srclen = ri.srclen;
   54|  1.20k|  size_t full_input_length = ri.full_input_length;
   55|  1.20k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 18, False: 1.18k]
  ------------------
   56|     18|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 18, Folded]
  |  Branch (56:28): [True: 6, False: 12]
  ------------------
   57|      6|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      6|    }
   59|     12|    return {SUCCESS, full_input_length, 0};
   60|     18|  }
   61|  1.18k|  char *end_of_safe_64byte_zone =
   62|  1.18k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 72, False: 1.11k]
  ------------------
   63|  1.18k|          ? nullptr
   64|  1.18k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 322, False: 792]
  ------------------
   65|  1.11k|                                        : dst);
   66|       |
   67|  1.18k|  const chartype *const srcinit = src;
   68|  1.18k|  const char *const dstinit = dst;
   69|  1.18k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.18k|  constexpr size_t block_size = 6;
   72|  1.18k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.18k|  char buffer[block_size * 64];
   74|  1.18k|  char *bufferptr = buffer;
   75|  1.18k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 922, False: 264]
  ------------------
   76|    922|    const chartype *const srcend64 = src + srclen - 64;
   77|  21.2k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 20.6k, False: 594]
  ------------------
   78|  20.6k|      block64 b(src);
   79|  20.6k|      src += 64;
   80|  20.6k|      uint64_t error = 0;
   81|  20.6k|      const uint64_t badcharmask =
   82|  20.6k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  20.6k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 20.6k, Folded]
  |  Branch (83:30): [True: 328, False: 20.2k]
  ------------------
   84|    328|        src -= 64;
   85|    328|        const size_t error_offset = trailing_zeroes(error);
   86|    328|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    328|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    328|      }
   89|  20.2k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 17.1k, False: 3.13k]
  ------------------
   90|  17.1k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  17.1k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 2.74k, False: 390]
  ------------------
   92|  2.74k|        b.copy_block(bufferptr);
   93|  2.74k|        bufferptr += 64;
   94|  2.74k|      } else {
   95|    390|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 380]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|    380|        } else {
   98|    380|          b.base64_decode_block(dst);
   99|    380|        }
  100|    390|        dst += 48;
  101|    390|      }
  102|  20.2k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 3.71k, False: 16.5k]
  ------------------
  103|  18.5k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 14.8k, False: 3.71k]
  ------------------
  104|  14.8k|          base64_decode_block(dst, buffer + i * 64);
  105|  14.8k|          dst += 48;
  106|  14.8k|        }
  107|  3.71k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 3.71k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  3.71k|        } else {
  110|  3.71k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  3.71k|        }
  112|  3.71k|        dst += 48;
  113|  3.71k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  3.71k|                    64); // 64 might be too much
  115|  3.71k|        bufferptr -= (block_size - 1) * 64;
  116|  3.71k|      }
  117|  20.2k|    }
  118|    922|  }
  119|       |
  120|    858|  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|    858|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    858|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 546, False: 312]
  |  Branch (124:26): [True: 104, False: 442]
  ------------------
  125|       |
  126|    744|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 694, False: 50]
  |  Branch (126:52): [True: 680, False: 14]
  ------------------
  127|    680|      uint8_t val = to_base64[uint8_t(*src)];
  128|    680|      *bufferptr = char(val);
  129|    680|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 680, Folded]
  ------------------
  130|    680|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 22, False: 658]
  |  Branch (130:52): [True: 18, False: 640]
  ------------------
  131|     40|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     40|                size_t(dst - dstinit)};
  133|     40|      }
  134|    640|      bufferptr += (val <= 63);
  135|    640|      src++;
  136|    640|    }
  137|    104|  }
  138|       |
  139|  1.14k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 328, False: 818]
  ------------------
  140|    328|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 32, False: 296]
  ------------------
  141|     32|      base64_decode_block_safe(dst, buffer_start);
  142|    296|    } else {
  143|    296|      base64_decode_block(dst, buffer_start);
  144|    296|    }
  145|    328|    dst += 48;
  146|    328|  }
  147|    818|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 456, False: 362]
  ------------------
  148|  3.75k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.30k, False: 456]
  ------------------
  149|  3.30k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.30k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.30k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.30k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.30k|                        << 8;
  154|  3.30k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.30k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.30k|#endif
  157|  3.30k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.30k|      dst += 3;
  160|  3.30k|      buffer_start += 4;
  161|  3.30k|    }
  162|    456|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 104, False: 352]
  ------------------
  163|    104|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    104|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    104|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    104|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    104|                        << 8;
  168|    104|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    104|      triple = scalar::u32_swap_bytes(triple);
  170|    104|#endif
  171|    104|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    104|      dst += 3;
  174|    104|      buffer_start += 4;
  175|    104|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    456|    int leftover = int(bufferptr - buffer_start);
  179|  1.14k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 692, False: 456]
  ------------------
  180|    692|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 692, Folded]
  ------------------
  181|  7.64k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 6.95k, False: 692]
  ------------------
  182|  6.95k|          src--;
  183|  6.95k|        }
  184|    692|      } 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|    692|      src--;
  190|    692|      leftover--;
  191|    692|    }
  192|    456|  }
  193|    818|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 688, False: 130]
  ------------------
  194|    688|    full_result r = scalar::base64::base64_tail_decode(
  195|    688|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    688|    r = scalar::base64::patch_tail_result(
  197|    688|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    688|        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|    688|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 448, False: 240]
  |  Branch (203:43): [True: 356, False: 92]
  ------------------
  204|    356|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 332, False: 24]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    696|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 692, False: 4]
  ------------------
  207|    692|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 364, False: 328]
  ------------------
  208|    364|        r.input_count++;
  209|    364|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    332|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 328, False: 4]
  ------------------
  213|  2.39k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.32k, False: 68]
  ------------------
  214|  2.32k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.06k, False: 260]
  ------------------
  215|  2.06k|          r.input_count--;
  216|  2.06k|        }
  217|    328|      }
  218|    332|    }
  219|    688|    return r;
  220|    688|  }
  221|    130|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 130, Folded]
  |  Branch (221:26): [True: 0, False: 130]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    130|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    130|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.32k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.32k|  const uint8_t *to_base64 =
   47|  1.32k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.32k]
  ------------------
   48|  1.32k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.32k]
  ------------------
   49|  1.32k|                                   : tables::base64::to_base64_value);
   50|  1.32k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.32k|  size_t equallocation = ri.equallocation;
   52|  1.32k|  size_t equalsigns = ri.equalsigns;
   53|  1.32k|  srclen = ri.srclen;
   54|  1.32k|  size_t full_input_length = ri.full_input_length;
   55|  1.32k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 26, False: 1.30k]
  ------------------
   56|     26|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 26, Folded]
  |  Branch (56:28): [True: 16, False: 10]
  ------------------
   57|     16|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     16|    }
   59|     10|    return {SUCCESS, full_input_length, 0};
   60|     26|  }
   61|  1.30k|  char *end_of_safe_64byte_zone =
   62|  1.30k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 106, False: 1.19k]
  ------------------
   63|  1.30k|          ? nullptr
   64|  1.30k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 348, False: 848]
  ------------------
   65|  1.19k|                                        : dst);
   66|       |
   67|  1.30k|  const chartype *const srcinit = src;
   68|  1.30k|  const char *const dstinit = dst;
   69|  1.30k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.30k|  constexpr size_t block_size = 6;
   72|  1.30k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.30k|  char buffer[block_size * 64];
   74|  1.30k|  char *bufferptr = buffer;
   75|  1.30k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 962, False: 340]
  ------------------
   76|    962|    const chartype *const srcend64 = src + srclen - 64;
   77|  45.5k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 44.8k, False: 630]
  ------------------
   78|  44.8k|      block64 b(src);
   79|  44.8k|      src += 64;
   80|  44.8k|      uint64_t error = 0;
   81|  44.8k|      const uint64_t badcharmask =
   82|  44.8k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  44.8k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 44.8k, Folded]
  |  Branch (83:30): [True: 332, False: 44.5k]
  ------------------
   84|    332|        src -= 64;
   85|    332|        const size_t error_offset = trailing_zeroes(error);
   86|    332|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    332|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    332|      }
   89|  44.5k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 34.4k, False: 10.1k]
  ------------------
   90|  34.4k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  34.4k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 9.90k, False: 230]
  ------------------
   92|  9.90k|        b.copy_block(bufferptr);
   93|  9.90k|        bufferptr += 64;
   94|  9.90k|      } else {
   95|    230|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 4, False: 226]
  ------------------
   96|      4|          b.base64_decode_block_safe(dst);
   97|    226|        } else {
   98|    226|          b.base64_decode_block(dst);
   99|    226|        }
  100|    230|        dst += 48;
  101|    230|      }
  102|  44.5k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 8.49k, False: 36.0k]
  ------------------
  103|  42.4k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 33.9k, False: 8.49k]
  ------------------
  104|  33.9k|          base64_decode_block(dst, buffer + i * 64);
  105|  33.9k|          dst += 48;
  106|  33.9k|        }
  107|  8.49k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 8.49k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  8.49k|        } else {
  110|  8.49k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  8.49k|        }
  112|  8.49k|        dst += 48;
  113|  8.49k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  8.49k|                    64); // 64 might be too much
  115|  8.49k|        bufferptr -= (block_size - 1) * 64;
  116|  8.49k|      }
  117|  44.5k|    }
  118|    962|  }
  119|       |
  120|    970|  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|    970|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    970|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 598, False: 372]
  |  Branch (124:26): [True: 106, False: 492]
  ------------------
  125|       |
  126|    748|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 696, False: 52]
  |  Branch (126:52): [True: 682, False: 14]
  ------------------
  127|    682|      uint8_t val = to_base64[uint8_t(*src)];
  128|    682|      *bufferptr = char(val);
  129|    682|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 682, Folded]
  ------------------
  130|    682|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 20, False: 662]
  |  Branch (130:52): [True: 20, False: 642]
  ------------------
  131|     40|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     40|                size_t(dst - dstinit)};
  133|     40|      }
  134|    642|      bufferptr += (val <= 63);
  135|    642|      src++;
  136|    642|    }
  137|    106|  }
  138|       |
  139|  1.35k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 420, False: 930]
  ------------------
  140|    420|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 34, False: 386]
  ------------------
  141|     34|      base64_decode_block_safe(dst, buffer_start);
  142|    386|    } else {
  143|    386|      base64_decode_block(dst, buffer_start);
  144|    386|    }
  145|    420|    dst += 48;
  146|    420|  }
  147|    930|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 506, False: 424]
  ------------------
  148|  4.13k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.62k, False: 506]
  ------------------
  149|  3.62k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.62k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.62k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.62k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.62k|                        << 8;
  154|  3.62k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.62k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.62k|#endif
  157|  3.62k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.62k|      dst += 3;
  160|  3.62k|      buffer_start += 4;
  161|  3.62k|    }
  162|    506|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 134, False: 372]
  ------------------
  163|    134|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    134|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    134|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    134|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    134|                        << 8;
  168|    134|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    134|      triple = scalar::u32_swap_bytes(triple);
  170|    134|#endif
  171|    134|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    134|      dst += 3;
  174|    134|      buffer_start += 4;
  175|    134|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    506|    int leftover = int(bufferptr - buffer_start);
  179|  1.23k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 728, False: 506]
  ------------------
  180|    728|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 728, Folded]
  ------------------
  181|  5.66k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.93k, False: 728]
  ------------------
  182|  4.93k|          src--;
  183|  4.93k|        }
  184|    728|      } 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|    728|      src--;
  190|    728|      leftover--;
  191|    728|    }
  192|    506|  }
  193|    930|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 790, False: 140]
  ------------------
  194|    790|    full_result r = scalar::base64::base64_tail_decode(
  195|    790|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    790|    r = scalar::base64::patch_tail_result(
  197|    790|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    790|        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|    790|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 488, False: 302]
  |  Branch (203:43): [True: 378, False: 110]
  ------------------
  204|    378|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 342, False: 36]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    658|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 652, False: 6]
  ------------------
  207|    652|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 316, False: 336]
  ------------------
  208|    316|        r.input_count++;
  209|    316|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    342|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 336, False: 6]
  ------------------
  213|  2.34k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.27k, False: 76]
  ------------------
  214|  2.27k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.01k, False: 260]
  ------------------
  215|  2.01k|          r.input_count--;
  216|  2.01k|        }
  217|    336|      }
  218|    342|    }
  219|    790|    return r;
  220|    790|  }
  221|    140|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 140, Folded]
  |  Branch (221:26): [True: 0, False: 140]
  ------------------
  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|    140|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    140|}

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

_ZNK7simdutf7haswell14implementation16base64_to_binaryEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1297|  1.26k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1298|  1.26k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1298:7): [True: 0, False: 1.26k]
  ------------------
 1299|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1299:9): [True: 0, False: 0]
  ------------------
 1300|      0|      return base64::compress_decode_base64<false, true, true>(
 1301|      0|          output, input, length, options, last_chunk_options);
 1302|      0|    } else {
 1303|      0|      return base64::compress_decode_base64<false, false, true>(
 1304|      0|          output, input, length, options, last_chunk_options);
 1305|      0|    }
 1306|  1.26k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1306:14): [True: 615, False: 654]
  ------------------
 1307|    615|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1307:9): [True: 0, False: 615]
  ------------------
 1308|      0|      return base64::compress_decode_base64<true, true, false>(
 1309|      0|          output, input, length, options, last_chunk_options);
 1310|    615|    } else {
 1311|    615|      return base64::compress_decode_base64<true, false, false>(
 1312|    615|          output, input, length, options, last_chunk_options);
 1313|    615|    }
 1314|    654|  } else {
 1315|    654|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1315:9): [True: 0, False: 654]
  ------------------
 1316|      0|      return base64::compress_decode_base64<false, true, false>(
 1317|      0|          output, input, length, options, last_chunk_options);
 1318|    654|    } else {
 1319|    654|      return base64::compress_decode_base64<false, false, false>(
 1320|    654|          output, input, length, options, last_chunk_options);
 1321|    654|    }
 1322|    654|  }
 1323|  1.26k|}
_ZNK7simdutf7haswell14implementation24base64_to_binary_detailsEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1327|  1.26k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1328|  1.26k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1328:7): [True: 0, False: 1.26k]
  ------------------
 1329|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1329:9): [True: 0, False: 0]
  ------------------
 1330|      0|      return base64::compress_decode_base64<false, true, true>(
 1331|      0|          output, input, length, options, last_chunk_options);
 1332|      0|    } else {
 1333|      0|      return base64::compress_decode_base64<false, false, true>(
 1334|      0|          output, input, length, options, last_chunk_options);
 1335|      0|    }
 1336|  1.26k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1336:14): [True: 615, False: 654]
  ------------------
 1337|    615|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1337:9): [True: 0, False: 615]
  ------------------
 1338|      0|      return base64::compress_decode_base64<true, true, false>(
 1339|      0|          output, input, length, options, last_chunk_options);
 1340|    615|    } else {
 1341|    615|      return base64::compress_decode_base64<true, false, false>(
 1342|    615|          output, input, length, options, last_chunk_options);
 1343|    615|    }
 1344|    654|  } else {
 1345|    654|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1345:9): [True: 0, False: 654]
  ------------------
 1346|      0|      return base64::compress_decode_base64<false, true, false>(
 1347|      0|          output, input, length, options, last_chunk_options);
 1348|    654|    } else {
 1349|    654|      return base64::compress_decode_base64<false, false, false>(
 1350|    654|          output, input, length, options, last_chunk_options);
 1351|    654|    }
 1352|    654|  }
 1353|  1.26k|}
_ZNK7simdutf7haswell14implementation16base64_to_binaryEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1357|  1.26k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1358|  1.26k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1358:7): [True: 0, False: 1.26k]
  ------------------
 1359|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1359:9): [True: 0, False: 0]
  ------------------
 1360|      0|      return base64::compress_decode_base64<false, true, true>(
 1361|      0|          output, input, length, options, last_chunk_options);
 1362|      0|    } else {
 1363|      0|      return base64::compress_decode_base64<false, false, true>(
 1364|      0|          output, input, length, options, last_chunk_options);
 1365|      0|    }
 1366|  1.26k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1366:14): [True: 602, False: 664]
  ------------------
 1367|    602|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1367:9): [True: 0, False: 602]
  ------------------
 1368|      0|      return base64::compress_decode_base64<true, true, false>(
 1369|      0|          output, input, length, options, last_chunk_options);
 1370|    602|    } else {
 1371|    602|      return base64::compress_decode_base64<true, false, false>(
 1372|    602|          output, input, length, options, last_chunk_options);
 1373|    602|    }
 1374|    664|  } else {
 1375|    664|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1375:9): [True: 0, False: 664]
  ------------------
 1376|      0|      return base64::compress_decode_base64<false, true, false>(
 1377|      0|          output, input, length, options, last_chunk_options);
 1378|    664|    } else {
 1379|    664|      return base64::compress_decode_base64<false, false, false>(
 1380|    664|          output, input, length, options, last_chunk_options);
 1381|    664|    }
 1382|    664|  }
 1383|  1.26k|}
_ZNK7simdutf7haswell14implementation24base64_to_binary_detailsEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1387|  1.26k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1388|  1.26k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1388:7): [True: 0, False: 1.26k]
  ------------------
 1389|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1389:9): [True: 0, False: 0]
  ------------------
 1390|      0|      return base64::compress_decode_base64<false, true, true>(
 1391|      0|          output, input, length, options, last_chunk_options);
 1392|      0|    } else {
 1393|      0|      return base64::compress_decode_base64<false, false, true>(
 1394|      0|          output, input, length, options, last_chunk_options);
 1395|      0|    }
 1396|  1.26k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1396:14): [True: 602, False: 664]
  ------------------
 1397|    602|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1397:9): [True: 0, False: 602]
  ------------------
 1398|      0|      return base64::compress_decode_base64<true, true, false>(
 1399|      0|          output, input, length, options, last_chunk_options);
 1400|    602|    } else {
 1401|    602|      return base64::compress_decode_base64<true, false, false>(
 1402|    602|          output, input, length, options, last_chunk_options);
 1403|    602|    }
 1404|    664|  } else {
 1405|    664|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1405:9): [True: 0, False: 664]
  ------------------
 1406|      0|      return base64::compress_decode_base64<false, true, false>(
 1407|      0|          output, input, length, options, last_chunk_options);
 1408|    664|    } else {
 1409|    664|      return base64::compress_decode_base64<false, false, false>(
 1410|    664|          output, input, length, options, last_chunk_options);
 1411|    664|    }
 1412|    664|  }
 1413|  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.80k|    const char *input, size_t length) const noexcept {
  118|  3.80k|  return scalar::base64::maximal_binary_length_from_base64(input, length);
  119|  3.80k|}
_ZNK7simdutf14implementation33maximal_binary_length_from_base64EPKDsm:
  122|  3.79k|    const char16_t *input, size_t length) const noexcept {
  123|  3.79k|  return scalar::base64::maximal_binary_length_from_base64(input, length);
  124|  3.79k|}
_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|   139k|simdutf_really_inline long long int count_ones(uint64_t input_num) {
   15|       |  return _popcnt64(input_num);
   16|   139k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_115trailing_zeroesEm:
   20|  90.0k|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|  90.0k|  return __builtin_ctzll(input_num);
   25|  90.0k|  #endif // SIMDUTF_REGULAR_VISUAL_STUDIO
   26|  90.0k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_115is_power_of_twoImEEbT_:
   29|   126k|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|   152k|simdutf_really_inline long long int count_ones(uint64_t input_num) {
   15|       |  return _popcnt64(input_num);
   16|   152k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115trailing_zeroesEm:
   20|  90.0k|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|  90.0k|  return __builtin_ctzll(input_num);
   27|  90.0k|  #endif // SIMDUTF_REGULAR_VISUAL_STUDIO
   28|  90.0k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115is_power_of_twoImEEbT_:
   31|   126k|template <typename T> bool is_power_of_two(T x) { return (x & (x - 1)) == 0; }

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

_ZNK7simdutf8westmere14implementation16base64_to_binaryEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1328|  1.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: 615, False: 654]
  ------------------
 1338|    615|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1338:9): [True: 0, False: 615]
  ------------------
 1339|      0|      return base64::compress_decode_base64<true, true, false>(
 1340|      0|          output, input, length, options, last_chunk_options);
 1341|    615|    } else {
 1342|    615|      return base64::compress_decode_base64<true, false, false>(
 1343|    615|          output, input, length, options, last_chunk_options);
 1344|    615|    }
 1345|    654|  } else {
 1346|    654|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1346:9): [True: 0, False: 654]
  ------------------
 1347|      0|      return base64::compress_decode_base64<false, true, false>(
 1348|      0|          output, input, length, options, last_chunk_options);
 1349|    654|    } else {
 1350|    654|      return base64::compress_decode_base64<false, false, false>(
 1351|    654|          output, input, length, options, last_chunk_options);
 1352|    654|    }
 1353|    654|  }
 1354|  1.26k|}
_ZNK7simdutf8westmere14implementation24base64_to_binary_detailsEPKcmPcNS_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: 615, False: 654]
  ------------------
 1368|    615|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1368:9): [True: 0, False: 615]
  ------------------
 1369|      0|      return base64::compress_decode_base64<true, true, false>(
 1370|      0|          output, input, length, options, last_chunk_options);
 1371|    615|    } else {
 1372|    615|      return base64::compress_decode_base64<true, false, false>(
 1373|    615|          output, input, length, options, last_chunk_options);
 1374|    615|    }
 1375|    654|  } else {
 1376|    654|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1376:9): [True: 0, False: 654]
  ------------------
 1377|      0|      return base64::compress_decode_base64<false, true, false>(
 1378|      0|          output, input, length, options, last_chunk_options);
 1379|    654|    } else {
 1380|    654|      return base64::compress_decode_base64<false, false, false>(
 1381|    654|          output, input, length, options, last_chunk_options);
 1382|    654|    }
 1383|    654|  }
 1384|  1.26k|}
_ZNK7simdutf8westmere14implementation16base64_to_binaryEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1388|  1.26k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1389|  1.26k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1389:7): [True: 0, False: 1.26k]
  ------------------
 1390|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1390:9): [True: 0, False: 0]
  ------------------
 1391|      0|      return base64::compress_decode_base64<false, true, true>(
 1392|      0|          output, input, length, options, last_chunk_options);
 1393|      0|    } else {
 1394|      0|      return base64::compress_decode_base64<false, false, true>(
 1395|      0|          output, input, length, options, last_chunk_options);
 1396|      0|    }
 1397|  1.26k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1397:14): [True: 602, False: 664]
  ------------------
 1398|    602|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1398:9): [True: 0, False: 602]
  ------------------
 1399|      0|      return base64::compress_decode_base64<true, true, false>(
 1400|      0|          output, input, length, options, last_chunk_options);
 1401|    602|    } else {
 1402|    602|      return base64::compress_decode_base64<true, false, false>(
 1403|    602|          output, input, length, options, last_chunk_options);
 1404|    602|    }
 1405|    664|  } else {
 1406|    664|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1406:9): [True: 0, False: 664]
  ------------------
 1407|      0|      return base64::compress_decode_base64<false, true, false>(
 1408|      0|          output, input, length, options, last_chunk_options);
 1409|    664|    } else {
 1410|    664|      return base64::compress_decode_base64<false, false, false>(
 1411|    664|          output, input, length, options, last_chunk_options);
 1412|    664|    }
 1413|    664|  }
 1414|  1.26k|}
_ZNK7simdutf8westmere14implementation24base64_to_binary_detailsEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1418|  1.26k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1419|  1.26k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1419:7): [True: 0, False: 1.26k]
  ------------------
 1420|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1420:9): [True: 0, False: 0]
  ------------------
 1421|      0|      return base64::compress_decode_base64<false, true, true>(
 1422|      0|          output, input, length, options, last_chunk_options);
 1423|      0|    } else {
 1424|      0|      return base64::compress_decode_base64<false, false, true>(
 1425|      0|          output, input, length, options, last_chunk_options);
 1426|      0|    }
 1427|  1.26k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1427:14): [True: 602, False: 664]
  ------------------
 1428|    602|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1428:9): [True: 0, False: 602]
  ------------------
 1429|      0|      return base64::compress_decode_base64<true, true, false>(
 1430|      0|          output, input, length, options, last_chunk_options);
 1431|    602|    } else {
 1432|    602|      return base64::compress_decode_base64<true, false, false>(
 1433|    602|          output, input, length, options, last_chunk_options);
 1434|    602|    }
 1435|    664|  } else {
 1436|    664|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1436:9): [True: 0, False: 664]
  ------------------
 1437|      0|      return base64::compress_decode_base64<false, true, false>(
 1438|      0|          output, input, length, options, last_chunk_options);
 1439|    664|    } else {
 1440|    664|      return base64::compress_decode_base64<false, false, false>(
 1441|    664|          output, input, length, options, last_chunk_options);
 1442|    664|    }
 1443|    664|  }
 1444|  1.26k|}

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

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

