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

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

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

_ZN7simdutf10is_partialENS_27last_chunk_handling_optionsE:
 4645|  28.7k|is_partial(last_chunk_handling_options options) {
 4646|  28.7k|  return (options == stop_before_partial) || (options == only_full_chunks);
  ------------------
  |  Branch (4646:10): [True: 14.9k, False: 13.8k]
  |  Branch (4646:46): [True: 0, False: 13.8k]
  ------------------
 4647|  28.7k|}
_ZNK7simdutf14implementation4nameEv:
 5654|      4|  virtual std::string_view name() const noexcept { return _name; }
_ZNK7simdutf14implementation25required_instruction_setsEv:
 5705|      8|  virtual uint32_t required_instruction_sets() const {
 5706|      8|    return _required_instruction_sets;
 5707|      8|  }
_ZN7simdutf14implementationC2EPKcS2_j:
 7619|      4|      : _name(name), _description(description),
 7620|      4|        _required_instruction_sets(required_instruction_sets) {}
_ZN7simdutf8internal29available_implementation_listC2Ev:
 7651|      1|  simdutf_really_inline available_implementation_list() {}
_ZN7simdutf16base64_ignorableEcNS_14base64_optionsE:
 5406|  18.6k|base64_ignorable(char input, base64_options options = base64_default) noexcept {
 5407|  18.6k|  return scalar::base64::is_ignorable(input, options);
 5408|  18.6k|}
_ZN7simdutf16base64_ignorableEDsNS_14base64_optionsE:
 5411|  20.8k|                 base64_options options = base64_default) noexcept {
 5412|  20.8k|  return scalar::base64::is_ignorable(input, options);
 5413|  20.8k|}

simdutf.cpp:_ZN7simdutf8internalL30detect_supported_architecturesEv:
  301|      8|static inline uint32_t detect_supported_architectures() {
  302|      8|  uint32_t eax;
  303|      8|  uint32_t ebx = 0;
  304|      8|  uint32_t ecx = 0;
  305|      8|  uint32_t edx = 0;
  306|      8|  uint32_t host_isa = 0x0;
  307|       |
  308|       |  // EBX for EAX=0x1
  309|      8|  eax = 0x1;
  310|      8|  cpuid(&eax, &ebx, &ecx, &edx);
  311|       |
  312|      8|  if (ecx & cpuid_bit::sse42) {
  ------------------
  |  Branch (312:7): [True: 8, False: 0]
  ------------------
  313|      8|    host_isa |= instruction_set::SSE42;
  314|      8|  }
  315|       |
  316|      8|  if (ecx & cpuid_bit::pclmulqdq) {
  ------------------
  |  Branch (316:7): [True: 8, False: 0]
  ------------------
  317|      8|    host_isa |= instruction_set::PCLMULQDQ;
  318|      8|  }
  319|       |
  320|      8|  if ((ecx & cpuid_bit::osxsave) != cpuid_bit::osxsave) {
  ------------------
  |  Branch (320:7): [True: 0, False: 8]
  ------------------
  321|      0|    return host_isa;
  322|      0|  }
  323|       |
  324|       |  // xgetbv for checking if the OS saves registers
  325|      8|  uint64_t xcr0 = xgetbv();
  326|       |
  327|      8|  if ((xcr0 & cpuid_bit::xcr0_bit::avx256_saved) == 0) {
  ------------------
  |  Branch (327:7): [True: 0, False: 8]
  ------------------
  328|      0|    return host_isa;
  329|      0|  }
  330|       |  // ECX for EAX=0x7
  331|      8|  eax = 0x7;
  332|      8|  ecx = 0x0; // Sub-leaf = 0
  333|      8|  cpuid(&eax, &ebx, &ecx, &edx);
  334|      8|  if (ebx & cpuid_bit::ebx::avx2) {
  ------------------
  |  Branch (334:7): [True: 8, False: 0]
  ------------------
  335|      8|    host_isa |= instruction_set::AVX2;
  336|      8|  }
  337|      8|  if (ebx & cpuid_bit::ebx::bmi1) {
  ------------------
  |  Branch (337:7): [True: 8, False: 0]
  ------------------
  338|      8|    host_isa |= instruction_set::BMI1;
  339|      8|  }
  340|      8|  if (ebx & cpuid_bit::ebx::bmi2) {
  ------------------
  |  Branch (340:7): [True: 8, False: 0]
  ------------------
  341|      8|    host_isa |= instruction_set::BMI2;
  342|      8|  }
  343|      8|  if (!((xcr0 & cpuid_bit::xcr0_bit::avx512_saved) ==
  ------------------
  |  Branch (343:7): [True: 8, False: 0]
  ------------------
  344|      8|        cpuid_bit::xcr0_bit::avx512_saved)) {
  345|      8|    return host_isa;
  346|      8|  }
  347|      0|  if (ebx & cpuid_bit::ebx::avx512f) {
  ------------------
  |  Branch (347:7): [True: 0, False: 0]
  ------------------
  348|      0|    host_isa |= instruction_set::AVX512F;
  349|      0|  }
  350|      0|  if (ebx & cpuid_bit::ebx::avx512bw) {
  ------------------
  |  Branch (350:7): [True: 0, False: 0]
  ------------------
  351|      0|    host_isa |= instruction_set::AVX512BW;
  352|      0|  }
  353|      0|  if (ebx & cpuid_bit::ebx::avx512cd) {
  ------------------
  |  Branch (353:7): [True: 0, False: 0]
  ------------------
  354|      0|    host_isa |= instruction_set::AVX512CD;
  355|      0|  }
  356|      0|  if (ebx & cpuid_bit::ebx::avx512dq) {
  ------------------
  |  Branch (356:7): [True: 0, False: 0]
  ------------------
  357|      0|    host_isa |= instruction_set::AVX512DQ;
  358|      0|  }
  359|      0|  if (ebx & cpuid_bit::ebx::avx512vl) {
  ------------------
  |  Branch (359:7): [True: 0, False: 0]
  ------------------
  360|      0|    host_isa |= instruction_set::AVX512VL;
  361|      0|  }
  362|      0|  if (ecx & cpuid_bit::ecx::avx512vbmi2) {
  ------------------
  |  Branch (362:7): [True: 0, False: 0]
  ------------------
  363|      0|    host_isa |= instruction_set::AVX512VBMI2;
  364|      0|  }
  365|      0|  if (ecx & cpuid_bit::ecx::avx512vpopcnt) {
  ------------------
  |  Branch (365:7): [True: 0, False: 0]
  ------------------
  366|      0|    host_isa |= instruction_set::AVX512VPOPCNTDQ;
  367|      0|  }
  368|      0|  return host_isa;
  369|      8|}
simdutf.cpp:_ZN7simdutf8internalL5cpuidEPjS1_S1_S1_:
  267|     16|                         uint32_t *edx) {
  268|       |  #if defined(_MSC_VER)
  269|       |  int cpu_info[4];
  270|       |  __cpuidex(cpu_info, *eax, *ecx);
  271|       |  *eax = cpu_info[0];
  272|       |  *ebx = cpu_info[1];
  273|       |  *ecx = cpu_info[2];
  274|       |  *edx = cpu_info[3];
  275|       |  #elif (defined(HAVE_GCC_GET_CPUID) && defined(USE_GCC_GET_CPUID)) ||         \
  276|       |      defined(__FILC__)
  277|       |  uint32_t level = *eax;
  278|       |  __get_cpuid(level, eax, ebx, ecx, edx);
  279|       |  #else
  280|     16|  uint32_t a = *eax, b, c = *ecx, d;
  281|     16|  asm volatile("cpuid\n\t" : "+a"(a), "=b"(b), "+c"(c), "=d"(d));
  282|     16|  *eax = a;
  283|     16|  *ebx = b;
  284|     16|  *ecx = c;
  285|     16|  *edx = d;
  286|     16|  #endif
  287|     16|}
simdutf.cpp:_ZN7simdutf8internalL6xgetbvEv:
  289|      8|static inline uint64_t xgetbv() {
  290|       |  #if defined(_MSC_VER)
  291|       |  return _xgetbv(0);
  292|       |  #elif defined(__FILC__)
  293|       |  return zxgetbv();
  294|       |  #else
  295|      8|  uint32_t xcr0_lo, xcr0_hi;
  296|      8|  asm volatile("xgetbv\n\t" : "=a"(xcr0_lo), "=d"(xcr0_hi) : "c"(0));
  297|      8|  return xcr0_lo | ((uint64_t)xcr0_hi << 32);
  298|      8|  #endif
  299|      8|}

simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6413is_eight_byteIcEEbT_:
   33|  23.5M|template <class char_type> simdutf_constexpr23 bool is_eight_byte(char_type c) {
   34|  23.5M|  if constexpr (sizeof(char_type) == 1) {
   35|  23.5M|    return true;
   36|  23.5M|  }
   37|      0|  return uint8_t(c) == c;
   38|  23.5M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6413is_eight_byteIDsEEbT_:
   33|  8.68M|template <class char_type> simdutf_constexpr23 bool is_eight_byte(char_type c) {
   34|       |  if constexpr (sizeof(char_type) == 1) {
   35|       |    return true;
   36|       |  }
   37|  8.68M|  return uint8_t(c) == c;
   38|  8.68M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKcEEmT_m:
  834|  5.80k|maximal_binary_length_from_base64(InputPtr input, size_t length) noexcept {
  835|       |  // We process the padding characters ('=') at the end to make sure
  836|       |  // that we return an exact result when the input has no ignorable characters
  837|       |  // (e.g., spaces).
  838|  5.80k|  size_t padding = 0;
  839|  5.80k|  if (length > 0) {
  ------------------
  |  Branch (839:7): [True: 5.79k, False: 12]
  ------------------
  840|  5.79k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (840:9): [True: 216, False: 5.58k]
  ------------------
  841|    216|      padding++;
  842|    216|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (842:11): [True: 210, False: 6]
  |  Branch (842:25): [True: 42, False: 168]
  ------------------
  843|     42|        padding++;
  844|     42|      }
  845|    216|    }
  846|  5.79k|  }
  847|       |  // The input is not otherwise processed for ignorable characters or
  848|       |  // validation, so that the function runs in constant time (very fast). In
  849|       |  // practice, base64 inputs without ignorable characters are common and the
  850|       |  // common case are line separated inputs with relatively long lines (e.g., 76
  851|       |  // characters) which leads this function to a slight (1%) overestimation of
  852|       |  // the output size.
  853|       |  //
  854|       |  // Of course, some inputs might contain an arbitrary number of spaces or
  855|       |  // newlines, which would make this function return a very pessimistic output
  856|       |  // size but systems that produce base64 outputs typically do not do that and
  857|       |  // if they do, they do not care much about minimizing memory usage.
  858|       |  //
  859|       |  // In specialized applications, users may know that their input is line
  860|       |  // separated, which can be checked very quickly by by iterating (e.g., over 76
  861|       |  // character chunks, looking for the linefeed characters only). We could
  862|       |  // provide a specialized function for that, but it is not clear that the added
  863|       |  // complexity is worth it for us.
  864|       |  //
  865|  5.80k|  size_t actual_length = length - padding;
  866|  5.80k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (866:7): [True: 5.23k, False: 570]
  ------------------
  867|  5.23k|    return actual_length / 4 * 3;
  868|  5.23k|  }
  869|       |  // if we have a valid input, then the remainder must be 2 or 3 adding one or
  870|       |  // two extra bytes.
  871|    570|  return actual_length / 4 * 3 + (actual_length % 4) - 1;
  872|  5.80k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKDsEEmT_m:
  834|  5.80k|maximal_binary_length_from_base64(InputPtr input, size_t length) noexcept {
  835|       |  // We process the padding characters ('=') at the end to make sure
  836|       |  // that we return an exact result when the input has no ignorable characters
  837|       |  // (e.g., spaces).
  838|  5.80k|  size_t padding = 0;
  839|  5.80k|  if (length > 0) {
  ------------------
  |  Branch (839:7): [True: 5.79k, False: 12]
  ------------------
  840|  5.79k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (840:9): [True: 189, False: 5.60k]
  ------------------
  841|    189|      padding++;
  842|    189|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (842:11): [True: 183, False: 6]
  |  Branch (842:25): [True: 33, False: 150]
  ------------------
  843|     33|        padding++;
  844|     33|      }
  845|    189|    }
  846|  5.79k|  }
  847|       |  // The input is not otherwise processed for ignorable characters or
  848|       |  // validation, so that the function runs in constant time (very fast). In
  849|       |  // practice, base64 inputs without ignorable characters are common and the
  850|       |  // common case are line separated inputs with relatively long lines (e.g., 76
  851|       |  // characters) which leads this function to a slight (1%) overestimation of
  852|       |  // the output size.
  853|       |  //
  854|       |  // Of course, some inputs might contain an arbitrary number of spaces or
  855|       |  // newlines, which would make this function return a very pessimistic output
  856|       |  // size but systems that produce base64 outputs typically do not do that and
  857|       |  // if they do, they do not care much about minimizing memory usage.
  858|       |  //
  859|       |  // In specialized applications, users may know that their input is line
  860|       |  // separated, which can be checked very quickly by by iterating (e.g., over 76
  861|       |  // character chunks, looking for the linefeed characters only). We could
  862|       |  // provide a specialized function for that, but it is not clear that the added
  863|       |  // complexity is worth it for us.
  864|       |  //
  865|  5.80k|  size_t actual_length = length - padding;
  866|  5.80k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (866:7): [True: 5.36k, False: 438]
  ------------------
  867|  5.36k|    return actual_length / 4 * 3;
  868|  5.36k|  }
  869|       |  // if we have a valid input, then the remainder must be 2 or 3 adding one or
  870|       |  // two extra bytes.
  871|    438|  return actual_length / 4 * 3 + (actual_length % 4) - 1;
  872|  5.80k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIcEEbT_NS_14base64_optionsE:
   42|  18.6k|                                      simdutf::base64_options options) {
   43|  18.6k|  const uint8_t *to_base64 =
   44|  18.6k|      (options & base64_default_or_url)
  ------------------
  |  Branch (44:7): [True: 0, False: 18.6k]
  ------------------
   45|  18.6k|          ? tables::base64::to_base64_default_or_url_value
   46|  18.6k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (46:14): [True: 9.55k, False: 9.04k]
  ------------------
   47|  18.6k|                                    : tables::base64::to_base64_value);
   48|  18.6k|  const bool ignore_garbage =
   49|  18.6k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (49:7): [True: 0, False: 18.6k]
  ------------------
   50|  18.6k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (50:7): [True: 0, False: 18.6k]
  ------------------
   51|  18.6k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (51:7): [True: 0, False: 18.6k]
  ------------------
   52|  18.6k|  uint8_t code = to_base64[uint8_t(c)];
   53|  18.6k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (53:7): [True: 18.6k, False: 0]
  |  Branch (53:27): [True: 2.92k, False: 15.6k]
  ------------------
   54|  2.92k|    return false;
   55|  2.92k|  }
   56|  15.6k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (56:7): [True: 15.6k, False: 0]
  |  Branch (56:27): [True: 15.6k, False: 0]
  ------------------
   57|  15.6k|    return true;
   58|  15.6k|  }
   59|      0|  return ignore_garbage;
   60|  15.6k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIDsEEbT_NS_14base64_optionsE:
   42|  20.8k|                                      simdutf::base64_options options) {
   43|  20.8k|  const uint8_t *to_base64 =
   44|  20.8k|      (options & base64_default_or_url)
  ------------------
  |  Branch (44:7): [True: 0, False: 20.8k]
  ------------------
   45|  20.8k|          ? tables::base64::to_base64_default_or_url_value
   46|  20.8k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (46:14): [True: 9.88k, False: 10.9k]
  ------------------
   47|  20.8k|                                    : tables::base64::to_base64_value);
   48|  20.8k|  const bool ignore_garbage =
   49|  20.8k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (49:7): [True: 0, False: 20.8k]
  ------------------
   50|  20.8k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (50:7): [True: 0, False: 20.8k]
  ------------------
   51|  20.8k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (51:7): [True: 0, False: 20.8k]
  ------------------
   52|  20.8k|  uint8_t code = to_base64[uint8_t(c)];
   53|  20.8k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (53:7): [True: 20.8k, False: 0]
  |  Branch (53:27): [True: 2.97k, False: 17.8k]
  ------------------
   54|  2.97k|    return false;
   55|  2.97k|  }
   56|  17.8k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (56:7): [True: 17.8k, False: 0]
  |  Branch (56:27): [True: 17.8k, False: 0]
  ------------------
   57|  17.8k|    return true;
   58|  17.8k|  }
   59|      0|  return ignore_garbage;
   60|  17.8k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIcEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  114|  11.6k|                                           simdutf::base64_options options) {
  115|  11.6k|  const uint8_t *to_base64 =
  116|  11.6k|      (options & base64_default_or_url)
  ------------------
  |  Branch (116:7): [True: 0, False: 11.6k]
  ------------------
  117|  11.6k|          ? tables::base64::to_base64_default_or_url_value
  118|  11.6k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (118:14): [True: 5.67k, False: 5.94k]
  ------------------
  119|  11.6k|                                    : tables::base64::to_base64_value);
  120|  11.6k|  const bool ignore_garbage =
  121|  11.6k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (121:7): [True: 0, False: 11.6k]
  ------------------
  122|  11.6k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (122:7): [True: 0, False: 11.6k]
  ------------------
  123|  11.6k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (123:7): [True: 0, False: 11.6k]
  ------------------
  124|       |
  125|  11.6k|  size_t equalsigns = 0;
  126|       |  // We intentionally include trailing spaces in the full input length.
  127|       |  // See https://github.com/simdutf/simdutf/issues/824
  128|  11.6k|  size_t full_input_length = srclen;
  129|       |  // skip trailing spaces
  130|  12.9k|  while (!ignore_garbage && srclen > 0 &&
  ------------------
  |  Branch (130:10): [True: 12.9k, False: 0]
  |  Branch (130:29): [True: 12.8k, False: 60]
  ------------------
  131|  12.8k|         scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (131:10): [True: 12.8k, False: 0]
  ------------------
  132|  12.8k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (132:10): [True: 1.29k, False: 11.5k]
  ------------------
  133|  1.29k|    srclen--;
  134|  1.29k|  }
  135|  11.6k|  size_t equallocation =
  136|  11.6k|      srclen; // location of the first padding character if any
  137|  11.6k|  if (ignore_garbage) {
  ------------------
  |  Branch (137:7): [True: 0, False: 11.6k]
  ------------------
  138|       |    // Technically, we don't need to find the first padding character, we can
  139|       |    // just change our algorithms, but it adds substantial complexity.
  140|      0|    auto it = simdutf::find(src, src + srclen, '=');
  141|      0|    if (it != src + srclen) {
  ------------------
  |  Branch (141:9): [True: 0, False: 0]
  ------------------
  142|      0|      equallocation = it - src;
  143|      0|      equalsigns = 1;
  144|      0|      srclen = equallocation;
  145|      0|      full_input_length = equallocation + 1;
  146|      0|    }
  147|      0|    return {equalsigns, equallocation, srclen, full_input_length};
  148|      0|  }
  149|  11.6k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (149:7): [True: 11.6k, False: 0]
  |  Branch (149:26): [True: 11.5k, False: 60]
  |  Branch (149:40): [True: 432, False: 11.1k]
  ------------------
  150|       |    // This is the last '=' sign.
  151|    432|    equallocation = srclen - 1;
  152|    432|    srclen--;
  153|    432|    equalsigns = 1;
  154|       |    // skip trailing spaces
  155|    996|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (155:12): [True: 948, False: 48]
  |  Branch (155:26): [True: 948, False: 0]
  ------------------
  156|    948|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (156:12): [True: 564, False: 384]
  ------------------
  157|    564|      srclen--;
  158|    564|    }
  159|    432|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (159:9): [True: 384, False: 48]
  |  Branch (159:23): [True: 84, False: 300]
  ------------------
  160|       |      // This is the second '=' sign.
  161|     84|      equallocation = srclen - 1;
  162|     84|      srclen--;
  163|     84|      equalsigns = 2;
  164|     84|    }
  165|    432|  }
  166|  11.6k|  return {equalsigns, equallocation, srclen, full_input_length};
  167|  11.6k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6417patch_tail_resultENS_11full_resultEmmmmNS_27last_chunk_handling_optionsE:
  457|  13.9k|                  last_chunk_handling_options last_chunk_options) {
  458|  13.9k|  r.input_count += previous_input;
  459|  13.9k|  r.output_count += previous_output;
  460|  13.9k|  if (r.padding_error) {
  ------------------
  |  Branch (460:7): [True: 360, False: 13.5k]
  ------------------
  461|    360|    r.input_count = equallocation;
  462|    360|  }
  463|       |
  464|  13.9k|  if (r.error == error_code::SUCCESS) {
  ------------------
  |  Branch (464:7): [True: 6.60k, False: 7.31k]
  ------------------
  465|  6.60k|    if (!is_partial(last_chunk_options)) {
  ------------------
  |  Branch (465:9): [True: 2.28k, False: 4.32k]
  ------------------
  466|       |      // A success when we are not in stop_before_partial mode.
  467|       |      // means that we have consumed the whole input buffer.
  468|  2.28k|      r.input_count = full_input_length;
  469|  4.32k|    } else if (r.output_count % 3 != 0) {
  ------------------
  |  Branch (469:16): [True: 24, False: 4.30k]
  ------------------
  470|     24|      r.input_count = full_input_length;
  471|     24|    }
  472|  6.60k|  }
  473|  13.9k|  return r;
  474|  13.9k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIDsEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  114|  11.6k|                                           simdutf::base64_options options) {
  115|  11.6k|  const uint8_t *to_base64 =
  116|  11.6k|      (options & base64_default_or_url)
  ------------------
  |  Branch (116:7): [True: 0, False: 11.6k]
  ------------------
  117|  11.6k|          ? tables::base64::to_base64_default_or_url_value
  118|  11.6k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (118:14): [True: 5.76k, False: 5.83k]
  ------------------
  119|  11.6k|                                    : tables::base64::to_base64_value);
  120|  11.6k|  const bool ignore_garbage =
  121|  11.6k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (121:7): [True: 0, False: 11.6k]
  ------------------
  122|  11.6k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (122:7): [True: 0, False: 11.6k]
  ------------------
  123|  11.6k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (123:7): [True: 0, False: 11.6k]
  ------------------
  124|       |
  125|  11.6k|  size_t equalsigns = 0;
  126|       |  // We intentionally include trailing spaces in the full input length.
  127|       |  // See https://github.com/simdutf/simdutf/issues/824
  128|  11.6k|  size_t full_input_length = srclen;
  129|       |  // skip trailing spaces
  130|  14.8k|  while (!ignore_garbage && srclen > 0 &&
  ------------------
  |  Branch (130:10): [True: 14.8k, False: 0]
  |  Branch (130:29): [True: 14.7k, False: 60]
  ------------------
  131|  14.7k|         scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (131:10): [True: 10.5k, False: 4.18k]
  ------------------
  132|  10.5k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (132:10): [True: 3.22k, False: 7.36k]
  ------------------
  133|  3.22k|    srclen--;
  134|  3.22k|  }
  135|  11.6k|  size_t equallocation =
  136|  11.6k|      srclen; // location of the first padding character if any
  137|  11.6k|  if (ignore_garbage) {
  ------------------
  |  Branch (137:7): [True: 0, False: 11.6k]
  ------------------
  138|       |    // Technically, we don't need to find the first padding character, we can
  139|       |    // just change our algorithms, but it adds substantial complexity.
  140|      0|    auto it = simdutf::find(src, src + srclen, '=');
  141|      0|    if (it != src + srclen) {
  ------------------
  |  Branch (141:9): [True: 0, False: 0]
  ------------------
  142|      0|      equallocation = it - src;
  143|      0|      equalsigns = 1;
  144|      0|      srclen = equallocation;
  145|      0|      full_input_length = equallocation + 1;
  146|      0|    }
  147|      0|    return {equalsigns, equallocation, srclen, full_input_length};
  148|      0|  }
  149|  11.6k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (149:7): [True: 11.6k, False: 0]
  |  Branch (149:26): [True: 11.5k, False: 60]
  |  Branch (149:40): [True: 378, False: 11.1k]
  ------------------
  150|       |    // This is the last '=' sign.
  151|    378|    equallocation = srclen - 1;
  152|    378|    srclen--;
  153|    378|    equalsigns = 1;
  154|       |    // skip trailing spaces
  155|    852|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (155:12): [True: 804, False: 48]
  |  Branch (155:26): [True: 726, False: 78]
  ------------------
  156|    726|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (156:12): [True: 474, False: 252]
  ------------------
  157|    474|      srclen--;
  158|    474|    }
  159|    378|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (159:9): [True: 330, False: 48]
  |  Branch (159:23): [True: 72, False: 258]
  ------------------
  160|       |      // This is the second '=' sign.
  161|     72|      equallocation = srclen - 1;
  162|     72|      srclen--;
  163|     72|      equalsigns = 2;
  164|     72|    }
  165|    378|  }
  166|  11.6k|  return {equalsigns, equallocation, srclen, full_input_length};
  167|  11.6k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIcEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  907|  3.87k|    last_chunk_handling_options last_chunk_options) noexcept {
  908|  3.87k|  const bool ignore_garbage =
  909|  3.87k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (909:7): [True: 0, False: 3.87k]
  ------------------
  910|  3.87k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (910:7): [True: 0, False: 3.87k]
  ------------------
  911|  3.87k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (911:7): [True: 0, False: 3.87k]
  ------------------
  912|  3.87k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  913|  3.87k|  size_t equallocation = ri.equallocation;
  914|  3.87k|  size_t equalsigns = ri.equalsigns;
  915|  3.87k|  length = ri.srclen;
  916|  3.87k|  size_t full_input_length = ri.full_input_length;
  917|  3.87k|  if (length == 0) {
  ------------------
  |  Branch (917:7): [True: 38, False: 3.83k]
  ------------------
  918|     38|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (918:9): [True: 38, False: 0]
  |  Branch (918:28): [True: 18, False: 20]
  ------------------
  919|     18|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
  920|     18|    }
  921|     20|    return {SUCCESS, full_input_length, 0};
  922|     38|  }
  923|  3.83k|  full_result r = scalar::base64::base64_tail_decode(
  924|  3.83k|      output, input, length, equalsigns, options, last_chunk_options);
  925|  3.83k|  r = scalar::base64::patch_tail_result(r, 0, 0, equallocation,
  926|  3.83k|                                        full_input_length, last_chunk_options);
  927|  3.83k|  if (!is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (927:7): [True: 2.08k, False: 1.74k]
  |  Branch (927:42): [True: 594, False: 1.49k]
  ------------------
  928|    594|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (928:7): [True: 6, False: 588]
  |  Branch (928:25): [True: 6, False: 0]
  ------------------
  929|       |    // additional checks
  930|      6|    if ((r.output_count % 3 == 0) ||
  ------------------
  |  Branch (930:9): [True: 0, False: 6]
  ------------------
  931|      6|        ((r.output_count % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (931:9): [True: 0, False: 6]
  ------------------
  932|      0|      return {INVALID_BASE64_CHARACTER, equallocation, r.output_count, true};
  933|      0|    }
  934|      6|  }
  935|       |  // When is_partial(last_chunk_options) is true, we must either end with
  936|       |  // the end of the stream (beyond whitespace) or right after a non-ignorable
  937|       |  // character or at the very beginning of the stream.
  938|       |  // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  939|  3.83k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (939:7): [True: 1.74k, False: 2.08k]
  |  Branch (939:41): [True: 826, False: 922]
  ------------------
  940|    826|      r.input_count < full_input_length) {
  ------------------
  |  Branch (940:7): [True: 556, False: 270]
  ------------------
  941|       |    // First check if we can extend the input to the end of the stream
  942|  4.24k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (942:12): [True: 4.23k, False: 14]
  ------------------
  943|  4.23k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (943:12): [True: 3.68k, False: 542]
  ------------------
  944|  3.68k|      r.input_count++;
  945|  3.68k|    }
  946|       |    // If we are still not at the end of the stream, then we must backtrack
  947|       |    // to the last non-ignorable character.
  948|    556|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (948:9): [True: 542, False: 14]
  ------------------
  949|  3.96k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (949:14): [True: 3.85k, False: 110]
  ------------------
  950|  3.85k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (950:14): [True: 3.42k, False: 432]
  ------------------
  951|  3.42k|        r.input_count--;
  952|  3.42k|      }
  953|    542|    }
  954|    556|  }
  955|  3.83k|  return r;
  956|  3.83k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6418base64_tail_decodeIcEENS_11full_resultEPcPKT_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  434|  6.74k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  435|  6.74k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  436|  6.74k|                                        options, last_chunk_options);
  437|  6.74k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EcEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  178|  6.74k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  179|  6.74k|  char *dstend = dst + outlen;
  180|  6.74k|  (void)dstend;
  181|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  182|       |  // two branches (easily predicted):
  183|  6.74k|  const uint8_t *to_base64 =
  184|  6.74k|      (options & base64_default_or_url)
  ------------------
  |  Branch (184:7): [True: 0, False: 6.74k]
  ------------------
  185|  6.74k|          ? tables::base64::to_base64_default_or_url_value
  186|  6.74k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (186:14): [True: 3.25k, False: 3.49k]
  ------------------
  187|  6.74k|                                    : tables::base64::to_base64_value);
  188|  6.74k|  const uint32_t *d0 =
  189|  6.74k|      (options & base64_default_or_url)
  ------------------
  |  Branch (189:7): [True: 0, False: 6.74k]
  ------------------
  190|  6.74k|          ? tables::base64::base64_default_or_url::d0
  191|  6.74k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (191:14): [True: 3.25k, False: 3.49k]
  ------------------
  192|  6.74k|                                    : tables::base64::base64_default::d0);
  193|  6.74k|  const uint32_t *d1 =
  194|  6.74k|      (options & base64_default_or_url)
  ------------------
  |  Branch (194:7): [True: 0, False: 6.74k]
  ------------------
  195|  6.74k|          ? tables::base64::base64_default_or_url::d1
  196|  6.74k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (196:14): [True: 3.25k, False: 3.49k]
  ------------------
  197|  6.74k|                                    : tables::base64::base64_default::d1);
  198|  6.74k|  const uint32_t *d2 =
  199|  6.74k|      (options & base64_default_or_url)
  ------------------
  |  Branch (199:7): [True: 0, False: 6.74k]
  ------------------
  200|  6.74k|          ? tables::base64::base64_default_or_url::d2
  201|  6.74k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (201:14): [True: 3.25k, False: 3.49k]
  ------------------
  202|  6.74k|                                    : tables::base64::base64_default::d2);
  203|  6.74k|  const uint32_t *d3 =
  204|  6.74k|      (options & base64_default_or_url)
  ------------------
  |  Branch (204:7): [True: 0, False: 6.74k]
  ------------------
  205|  6.74k|          ? tables::base64::base64_default_or_url::d3
  206|  6.74k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (206:14): [True: 3.25k, False: 3.49k]
  ------------------
  207|  6.74k|                                    : tables::base64::base64_default::d3);
  208|  6.74k|  const bool ignore_garbage =
  209|  6.74k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (209:7): [True: 0, False: 6.74k]
  ------------------
  210|  6.74k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (210:7): [True: 0, False: 6.74k]
  ------------------
  211|  6.74k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (211:7): [True: 0, False: 6.74k]
  ------------------
  212|       |
  213|  6.74k|  const char_type *srcend = src + length;
  214|  6.74k|  const char_type *srcinit = src;
  215|  6.74k|  const char *dstinit = dst;
  216|       |
  217|  6.74k|  uint32_t x;
  218|  6.74k|  size_t idx;
  219|  6.74k|  uint8_t buffer[4];
  220|   133k|  while (true) {
  ------------------
  |  Branch (220:10): [True: 133k, Folded]
  ------------------
  221|  1.77M|    while (srcend - src >= 12 && (!check_capacity || dstend - dst >= 9) &&
  ------------------
  |  Branch (221:12): [True: 1.77M, False: 3.96k]
  |  Branch (221:35): [True: 1.77M, Folded]
  |  Branch (221:54): [True: 0, False: 0]
  ------------------
  222|  1.77M|           is_eight_byte(src[0]) && is_eight_byte(src[1]) &&
  ------------------
  |  Branch (222:12): [True: 1.77M, False: 0]
  |  Branch (222:37): [True: 1.77M, False: 0]
  ------------------
  223|  1.77M|           is_eight_byte(src[2]) && is_eight_byte(src[3]) &&
  ------------------
  |  Branch (223:12): [True: 1.77M, False: 0]
  |  Branch (223:37): [True: 1.77M, False: 0]
  ------------------
  224|  1.77M|           is_eight_byte(src[4]) && is_eight_byte(src[5]) &&
  ------------------
  |  Branch (224:12): [True: 1.77M, False: 0]
  |  Branch (224:37): [True: 1.77M, False: 0]
  ------------------
  225|  1.77M|           is_eight_byte(src[6]) && is_eight_byte(src[7]) &&
  ------------------
  |  Branch (225:12): [True: 1.77M, False: 0]
  |  Branch (225:37): [True: 1.77M, False: 0]
  ------------------
  226|  1.77M|           is_eight_byte(src[8]) && is_eight_byte(src[9]) &&
  ------------------
  |  Branch (226:12): [True: 1.77M, False: 0]
  |  Branch (226:37): [True: 1.77M, False: 0]
  ------------------
  227|  1.77M|           is_eight_byte(src[10]) && is_eight_byte(src[11])) {
  ------------------
  |  Branch (227:12): [True: 1.77M, False: 0]
  |  Branch (227:38): [True: 1.77M, False: 0]
  ------------------
  228|  1.77M|      const uint32_t x0 = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  229|  1.77M|                          d2[uint8_t(src[2])] | d3[uint8_t(src[3])];
  230|  1.77M|      const uint32_t x1 = d0[uint8_t(src[4])] | d1[uint8_t(src[5])] |
  231|  1.77M|                          d2[uint8_t(src[6])] | d3[uint8_t(src[7])];
  232|  1.77M|      const uint32_t x2 = d0[uint8_t(src[8])] | d1[uint8_t(src[9])] |
  233|  1.77M|                          d2[uint8_t(src[10])] | d3[uint8_t(src[11])];
  234|  1.77M|      if ((x0 | x1 | x2) >= 0x01FFFFFF) {
  ------------------
  |  Branch (234:11): [True: 129k, False: 1.64M]
  ------------------
  235|   129k|        break;
  236|   129k|      }
  237|       |#if SIMDUTF_IS_BIG_ENDIAN
  238|       |      dst[0] = static_cast<char>(x0);
  239|       |      dst[1] = static_cast<char>(x0 >> 8);
  240|       |      dst[2] = static_cast<char>(x0 >> 16);
  241|       |      dst[3] = static_cast<char>(x1);
  242|       |      dst[4] = static_cast<char>(x1 >> 8);
  243|       |      dst[5] = static_cast<char>(x1 >> 16);
  244|       |      dst[6] = static_cast<char>(x2);
  245|       |      dst[7] = static_cast<char>(x2 >> 8);
  246|       |      dst[8] = static_cast<char>(x2 >> 16);
  247|       |#else
  248|  1.64M|      const uint64_t word =
  249|  1.64M|          uint64_t(x0) | (uint64_t(x1) << 24) | (uint64_t(x2) << 48);
  250|       |  #if SIMDUTF_CPLUSPLUS23
  251|       |      if (std::is_constant_evaluated()) {
  252|       |        dst[0] = static_cast<char>(x0);
  253|       |        dst[1] = static_cast<char>(x0 >> 8);
  254|       |        dst[2] = static_cast<char>(x0 >> 16);
  255|       |        dst[3] = static_cast<char>(x1);
  256|       |        dst[4] = static_cast<char>(x1 >> 8);
  257|       |        dst[5] = static_cast<char>(x1 >> 16);
  258|       |        dst[6] = static_cast<char>(x2);
  259|       |        dst[7] = static_cast<char>(x2 >> 8);
  260|       |      } else
  261|       |  #endif
  262|  1.64M|      {
  263|  1.64M|        std::memcpy(dst, &word, sizeof(word));
  264|  1.64M|      }
  265|  1.64M|      dst[8] = static_cast<char>(x2 >> 16);
  266|  1.64M|#endif
  267|  1.64M|      src += 12;
  268|  1.64M|      dst += 9;
  269|  1.64M|    }
  270|   233k|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (270:12): [True: 229k, False: 3.47k]
  |  Branch (270:33): [True: 229k, False: 0]
  ------------------
  271|   229k|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (271:12): [True: 229k, False: 0]
  |  Branch (271:37): [True: 229k, False: 0]
  ------------------
  272|   229k|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (272:12): [True: 229k, False: 0]
  ------------------
  273|   229k|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (273:12): [True: 99.2k, False: 130k]
  ------------------
  274|   229k|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  275|  99.2k|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (275:11): [Folded, False: 99.2k]
  |  Branch (275:29): [True: 0, False: 0]
  ------------------
  276|      0|        return {OUTPUT_BUFFER_TOO_SMALL, size_t(src - srcinit),
  277|      0|                size_t(dst - dstinit)};
  278|      0|      }
  279|  99.2k|      *dst++ = static_cast<char>(x & 0xFF);
  280|  99.2k|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  281|  99.2k|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  282|  99.2k|      src += 4;
  283|  99.2k|    }
  284|   133k|    const char_type *srccur = src;
  285|   133k|    idx = 0;
  286|       |    // we need at least four characters.
  287|   133k|#ifdef __clang__
  288|       |    // If possible, we read four characters at a time. (It is an optimization.)
  289|   133k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (289:9): [True: 0, False: 133k]
  |  Branch (289:27): [True: 0, False: 0]
  ------------------
  290|      0|      char_type c0 = src[0];
  291|      0|      char_type c1 = src[1];
  292|      0|      char_type c2 = src[2];
  293|      0|      char_type c3 = src[3];
  294|       |
  295|      0|      uint8_t code0 = to_base64[uint8_t(c0)];
  296|      0|      uint8_t code1 = to_base64[uint8_t(c1)];
  297|      0|      uint8_t code2 = to_base64[uint8_t(c2)];
  298|      0|      uint8_t code3 = to_base64[uint8_t(c3)];
  299|       |
  300|      0|      buffer[idx] = code0;
  301|      0|      idx += (is_eight_byte(c0) && code0 <= 63);
  ------------------
  |  Branch (301:15): [True: 0, False: 0]
  |  Branch (301:36): [True: 0, False: 0]
  ------------------
  302|      0|      buffer[idx] = code1;
  303|      0|      idx += (is_eight_byte(c1) && code1 <= 63);
  ------------------
  |  Branch (303:15): [True: 0, False: 0]
  |  Branch (303:36): [True: 0, False: 0]
  ------------------
  304|      0|      buffer[idx] = code2;
  305|      0|      idx += (is_eight_byte(c2) && code2 <= 63);
  ------------------
  |  Branch (305:15): [True: 0, False: 0]
  |  Branch (305:36): [True: 0, False: 0]
  ------------------
  306|      0|      buffer[idx] = code3;
  307|      0|      idx += (is_eight_byte(c3) && code3 <= 63);
  ------------------
  |  Branch (307:15): [True: 0, False: 0]
  |  Branch (307:36): [True: 0, False: 0]
  ------------------
  308|      0|      src += 4;
  309|      0|    }
  310|   133k|#endif
  311|  1.04M|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (311:12): [True: 919k, False: 127k]
  |  Branch (311:25): [True: 914k, False: 4.21k]
  ------------------
  312|   914k|      char_type c = *src;
  313|       |
  314|   914k|      uint8_t code = to_base64[uint8_t(c)];
  315|   914k|      buffer[idx] = uint8_t(code);
  316|   914k|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (316:11): [True: 914k, False: 0]
  |  Branch (316:31): [True: 517k, False: 397k]
  ------------------
  317|   517k|        idx++;
  318|   517k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (318:18): [True: 397k, False: 0]
  ------------------
  319|   397k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (319:19): [True: 2.53k, False: 394k]
  |  Branch (319:32): [True: 0, False: 394k]
  ------------------
  320|  2.53k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  321|  2.53k|                size_t(dst - dstinit)};
  322|   394k|      } else {
  323|       |        // We have a space or a newline or garbage. We ignore it.
  324|   394k|      }
  325|   912k|      src++;
  326|   912k|    }
  327|   131k|    if (idx != 4) {
  ------------------
  |  Branch (327:9): [True: 4.21k, False: 127k]
  ------------------
  328|  4.21k|      simdutf_log_assert(idx < 4, "idx should be less than 4");
  329|       |      // We never should have that the number of base64 characters + the
  330|       |      // number of padding characters is more than 4.
  331|  4.21k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (331:11): [True: 4.21k, False: 0]
  |  Branch (331:30): [True: 6, False: 4.20k]
  ------------------
  332|      6|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  333|      6|                size_t(dst - dstinit), true};
  334|      6|      }
  335|       |
  336|       |      // The idea here is that in loose mode,
  337|       |      // if there is padding at all, it must be used
  338|       |      // to form 4-wise chunk. However, in loose mode,
  339|       |      // we do accept no padding at all.
  340|  4.20k|      if (!ignore_garbage &&
  ------------------
  |  Branch (340:11): [True: 4.20k, False: 0]
  ------------------
  341|  4.20k|          last_chunk_options == last_chunk_handling_options::loose &&
  ------------------
  |  Branch (341:11): [True: 1.68k, False: 2.52k]
  ------------------
  342|  1.68k|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (342:11): [True: 894, False: 792]
  |  Branch (342:25): [True: 12, False: 882]
  ------------------
  343|     12|          ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (343:11): [True: 6, False: 6]
  ------------------
  344|      6|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  345|      6|                size_t(dst - dstinit), true};
  346|      6|      } else
  347|       |
  348|       |        // The idea here is that in strict mode, we do not want to accept
  349|       |        // incomplete base64 chunks. So if the chunk was otherwise valid, we
  350|       |        // return BASE64_INPUT_REMAINDER.
  351|  4.20k|        if (!ignore_garbage &&
  ------------------
  |  Branch (351:13): [True: 4.20k, False: 0]
  ------------------
  352|  4.20k|            last_chunk_options == last_chunk_handling_options::strict &&
  ------------------
  |  Branch (352:13): [True: 310, False: 3.89k]
  ------------------
  353|    310|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (353:13): [True: 180, False: 130]
  |  Branch (353:27): [True: 138, False: 42]
  ------------------
  354|       |          // The partial chunk was at src - idx
  355|    138|          return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  356|    138|                  size_t(dst - dstinit), true};
  357|    138|        } else
  358|       |          // If there is a partial chunk with insufficient padding, with
  359|       |          // stop_before_partial, we need to just ignore it. In "only full"
  360|       |          // mode, skip the minute there are padding characters.
  361|  4.06k|          if ((last_chunk_options ==
  ------------------
  |  Branch (361:16): [True: 2.21k, False: 1.85k]
  ------------------
  362|  4.06k|                   last_chunk_handling_options::stop_before_partial &&
  363|  2.21k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (363:16): [True: 2.20k, False: 12]
  |  Branch (363:50): [True: 1.65k, False: 544]
  ------------------
  364|  1.65k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (364:17): [True: 744, False: 912]
  |  Branch (364:29): [True: 882, False: 30]
  ------------------
  365|  2.43k|              (last_chunk_options ==
  ------------------
  |  Branch (365:16): [True: 0, False: 2.43k]
  ------------------
  366|  2.43k|                   last_chunk_handling_options::only_full_chunks &&
  367|  1.62k|               (idx >= 2 || padding_characters == 0))) {
  ------------------
  |  Branch (367:17): [True: 0, False: 0]
  |  Branch (367:29): [True: 0, False: 0]
  ------------------
  368|       |            // partial means that we are *not* going to consume the read
  369|       |            // characters. We need to rewind the src pointer.
  370|  1.62k|            src = srccur;
  371|  1.62k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  372|  2.43k|          } else {
  373|  2.43k|            if (idx == 2) {
  ------------------
  |  Branch (373:17): [True: 528, False: 1.91k]
  ------------------
  374|    528|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  375|    528|                                (uint32_t(buffer[1]) << 2 * 6);
  376|    528|              if (!ignore_garbage &&
  ------------------
  |  Branch (376:19): [True: 528, False: 0]
  ------------------
  377|    528|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (377:19): [True: 18, False: 510]
  ------------------
  378|     18|                  (triple & 0xffff)) {
  ------------------
  |  Branch (378:19): [True: 12, False: 6]
  ------------------
  379|     12|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  380|     12|                        size_t(dst - dstinit)};
  381|     12|              }
  382|    516|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (382:19): [Folded, False: 516]
  |  Branch (382:37): [True: 0, False: 0]
  ------------------
  383|      0|                return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  384|      0|                        size_t(dst - dstinit)};
  385|      0|              }
  386|    516|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  387|  1.91k|            } else if (idx == 3) {
  ------------------
  |  Branch (387:24): [True: 414, False: 1.49k]
  ------------------
  388|    414|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  389|    414|                                (uint32_t(buffer[1]) << 2 * 6) +
  390|    414|                                (uint32_t(buffer[2]) << 1 * 6);
  391|    414|              if (!ignore_garbage &&
  ------------------
  |  Branch (391:19): [True: 414, False: 0]
  ------------------
  392|    414|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (392:19): [True: 24, False: 390]
  ------------------
  393|     24|                  (triple & 0xff)) {
  ------------------
  |  Branch (393:19): [True: 18, False: 6]
  ------------------
  394|     18|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  395|     18|                        size_t(dst - dstinit)};
  396|     18|              }
  397|    396|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (397:19): [Folded, False: 396]
  |  Branch (397:37): [True: 0, False: 0]
  ------------------
  398|      0|                return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  399|      0|                        size_t(dst - dstinit)};
  400|      0|              }
  401|    396|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  402|    396|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  403|  1.49k|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (403:24): [True: 1.49k, False: 0]
  |  Branch (403:43): [True: 336, False: 1.16k]
  ------------------
  404|    336|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (404:25): [True: 306, False: 30]
  ------------------
  405|     30|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (405:26): [True: 30, False: 0]
  ------------------
  406|    336|                         padding_characters > 0))) {
  ------------------
  |  Branch (406:26): [True: 30, False: 0]
  ------------------
  407|    336|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  408|    336|                      size_t(dst - dstinit)};
  409|  1.16k|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (409:24): [True: 1.16k, False: 0]
  |  Branch (409:43): [True: 1.16k, False: 0]
  |  Branch (409:55): [True: 30, False: 1.13k]
  ------------------
  410|     30|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  411|     30|                      size_t(dst - dstinit), true};
  412|     30|            }
  413|  2.04k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  414|  2.43k|          }
  415|  4.20k|    }
  416|   127k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (416:9): [Folded, False: 127k]
  |  Branch (416:27): [True: 0, False: 0]
  ------------------
  417|      0|      return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  418|      0|              size_t(dst - dstinit)};
  419|      0|    }
  420|   127k|    uint32_t triple =
  421|   127k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  422|   127k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  423|   127k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  424|   127k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  425|   127k|    *dst++ = static_cast<char>(triple & 0xFF);
  426|   127k|  }
  427|  6.74k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIDsEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  907|  3.86k|    last_chunk_handling_options last_chunk_options) noexcept {
  908|  3.86k|  const bool ignore_garbage =
  909|  3.86k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (909:7): [True: 0, False: 3.86k]
  ------------------
  910|  3.86k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (910:7): [True: 0, False: 3.86k]
  ------------------
  911|  3.86k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (911:7): [True: 0, False: 3.86k]
  ------------------
  912|  3.86k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  913|  3.86k|  size_t equallocation = ri.equallocation;
  914|  3.86k|  size_t equalsigns = ri.equalsigns;
  915|  3.86k|  length = ri.srclen;
  916|  3.86k|  size_t full_input_length = ri.full_input_length;
  917|  3.86k|  if (length == 0) {
  ------------------
  |  Branch (917:7): [True: 40, False: 3.82k]
  ------------------
  918|     40|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (918:9): [True: 40, False: 0]
  |  Branch (918:28): [True: 20, False: 20]
  ------------------
  919|     20|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
  920|     20|    }
  921|     20|    return {SUCCESS, full_input_length, 0};
  922|     40|  }
  923|  3.82k|  full_result r = scalar::base64::base64_tail_decode(
  924|  3.82k|      output, input, length, equalsigns, options, last_chunk_options);
  925|  3.82k|  r = scalar::base64::patch_tail_result(r, 0, 0, equallocation,
  926|  3.82k|                                        full_input_length, last_chunk_options);
  927|  3.82k|  if (!is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (927:7): [True: 1.97k, False: 1.85k]
  |  Branch (927:42): [True: 336, False: 1.64k]
  ------------------
  928|    336|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (928:7): [True: 6, False: 330]
  |  Branch (928:25): [True: 6, False: 0]
  ------------------
  929|       |    // additional checks
  930|      6|    if ((r.output_count % 3 == 0) ||
  ------------------
  |  Branch (930:9): [True: 0, False: 6]
  ------------------
  931|      6|        ((r.output_count % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (931:9): [True: 0, False: 6]
  ------------------
  932|      0|      return {INVALID_BASE64_CHARACTER, equallocation, r.output_count, true};
  933|      0|    }
  934|      6|  }
  935|       |  // When is_partial(last_chunk_options) is true, we must either end with
  936|       |  // the end of the stream (beyond whitespace) or right after a non-ignorable
  937|       |  // character or at the very beginning of the stream.
  938|       |  // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  939|  3.82k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (939:7): [True: 1.85k, False: 1.97k]
  |  Branch (939:41): [True: 842, False: 1.00k]
  ------------------
  940|    842|      r.input_count < full_input_length) {
  ------------------
  |  Branch (940:7): [True: 584, False: 258]
  ------------------
  941|       |    // First check if we can extend the input to the end of the stream
  942|  4.99k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (942:12): [True: 4.98k, False: 12]
  ------------------
  943|  4.98k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (943:12): [True: 4.40k, False: 572]
  ------------------
  944|  4.40k|      r.input_count++;
  945|  4.40k|    }
  946|       |    // If we are still not at the end of the stream, then we must backtrack
  947|       |    // to the last non-ignorable character.
  948|    584|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (948:9): [True: 572, False: 12]
  ------------------
  949|  4.25k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (949:14): [True: 4.10k, False: 152]
  ------------------
  950|  4.10k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (950:14): [True: 3.68k, False: 420]
  ------------------
  951|  3.68k|        r.input_count--;
  952|  3.68k|      }
  953|    572|    }
  954|    584|  }
  955|  3.82k|  return r;
  956|  3.82k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6418base64_tail_decodeIDsEENS_11full_resultEPcPKT_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  434|  7.17k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  435|  7.17k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  436|  7.17k|                                        options, last_chunk_options);
  437|  7.17k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EDsEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  178|  7.17k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  179|  7.17k|  char *dstend = dst + outlen;
  180|  7.17k|  (void)dstend;
  181|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  182|       |  // two branches (easily predicted):
  183|  7.17k|  const uint8_t *to_base64 =
  184|  7.17k|      (options & base64_default_or_url)
  ------------------
  |  Branch (184:7): [True: 0, False: 7.17k]
  ------------------
  185|  7.17k|          ? tables::base64::to_base64_default_or_url_value
  186|  7.17k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (186:14): [True: 3.57k, False: 3.59k]
  ------------------
  187|  7.17k|                                    : tables::base64::to_base64_value);
  188|  7.17k|  const uint32_t *d0 =
  189|  7.17k|      (options & base64_default_or_url)
  ------------------
  |  Branch (189:7): [True: 0, False: 7.17k]
  ------------------
  190|  7.17k|          ? tables::base64::base64_default_or_url::d0
  191|  7.17k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (191:14): [True: 3.57k, False: 3.59k]
  ------------------
  192|  7.17k|                                    : tables::base64::base64_default::d0);
  193|  7.17k|  const uint32_t *d1 =
  194|  7.17k|      (options & base64_default_or_url)
  ------------------
  |  Branch (194:7): [True: 0, False: 7.17k]
  ------------------
  195|  7.17k|          ? tables::base64::base64_default_or_url::d1
  196|  7.17k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (196:14): [True: 3.57k, False: 3.59k]
  ------------------
  197|  7.17k|                                    : tables::base64::base64_default::d1);
  198|  7.17k|  const uint32_t *d2 =
  199|  7.17k|      (options & base64_default_or_url)
  ------------------
  |  Branch (199:7): [True: 0, False: 7.17k]
  ------------------
  200|  7.17k|          ? tables::base64::base64_default_or_url::d2
  201|  7.17k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (201:14): [True: 3.57k, False: 3.59k]
  ------------------
  202|  7.17k|                                    : tables::base64::base64_default::d2);
  203|  7.17k|  const uint32_t *d3 =
  204|  7.17k|      (options & base64_default_or_url)
  ------------------
  |  Branch (204:7): [True: 0, False: 7.17k]
  ------------------
  205|  7.17k|          ? tables::base64::base64_default_or_url::d3
  206|  7.17k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (206:14): [True: 3.57k, False: 3.59k]
  ------------------
  207|  7.17k|                                    : tables::base64::base64_default::d3);
  208|  7.17k|  const bool ignore_garbage =
  209|  7.17k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (209:7): [True: 0, False: 7.17k]
  ------------------
  210|  7.17k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (210:7): [True: 0, False: 7.17k]
  ------------------
  211|  7.17k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (211:7): [True: 0, False: 7.17k]
  ------------------
  212|       |
  213|  7.17k|  const char_type *srcend = src + length;
  214|  7.17k|  const char_type *srcinit = src;
  215|  7.17k|  const char *dstinit = dst;
  216|       |
  217|  7.17k|  uint32_t x;
  218|  7.17k|  size_t idx;
  219|  7.17k|  uint8_t buffer[4];
  220|   104k|  while (true) {
  ------------------
  |  Branch (220:10): [True: 104k, Folded]
  ------------------
  221|   589k|    while (srcend - src >= 12 && (!check_capacity || dstend - dst >= 9) &&
  ------------------
  |  Branch (221:12): [True: 585k, False: 3.76k]
  |  Branch (221:35): [True: 585k, Folded]
  |  Branch (221:54): [True: 0, False: 0]
  ------------------
  222|   585k|           is_eight_byte(src[0]) && is_eight_byte(src[1]) &&
  ------------------
  |  Branch (222:12): [True: 585k, False: 256]
  |  Branch (222:37): [True: 584k, False: 182]
  ------------------
  223|   584k|           is_eight_byte(src[2]) && is_eight_byte(src[3]) &&
  ------------------
  |  Branch (223:12): [True: 584k, False: 178]
  |  Branch (223:37): [True: 584k, False: 148]
  ------------------
  224|   584k|           is_eight_byte(src[4]) && is_eight_byte(src[5]) &&
  ------------------
  |  Branch (224:12): [True: 584k, False: 180]
  |  Branch (224:37): [True: 584k, False: 160]
  ------------------
  225|   584k|           is_eight_byte(src[6]) && is_eight_byte(src[7]) &&
  ------------------
  |  Branch (225:12): [True: 584k, False: 140]
  |  Branch (225:37): [True: 584k, False: 160]
  ------------------
  226|   584k|           is_eight_byte(src[8]) && is_eight_byte(src[9]) &&
  ------------------
  |  Branch (226:12): [True: 583k, False: 194]
  |  Branch (226:37): [True: 583k, False: 160]
  ------------------
  227|   583k|           is_eight_byte(src[10]) && is_eight_byte(src[11])) {
  ------------------
  |  Branch (227:12): [True: 583k, False: 166]
  |  Branch (227:38): [True: 583k, False: 178]
  ------------------
  228|   583k|      const uint32_t x0 = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  229|   583k|                          d2[uint8_t(src[2])] | d3[uint8_t(src[3])];
  230|   583k|      const uint32_t x1 = d0[uint8_t(src[4])] | d1[uint8_t(src[5])] |
  231|   583k|                          d2[uint8_t(src[6])] | d3[uint8_t(src[7])];
  232|   583k|      const uint32_t x2 = d0[uint8_t(src[8])] | d1[uint8_t(src[9])] |
  233|   583k|                          d2[uint8_t(src[10])] | d3[uint8_t(src[11])];
  234|   583k|      if ((x0 | x1 | x2) >= 0x01FFFFFF) {
  ------------------
  |  Branch (234:11): [True: 98.2k, False: 485k]
  ------------------
  235|  98.2k|        break;
  236|  98.2k|      }
  237|       |#if SIMDUTF_IS_BIG_ENDIAN
  238|       |      dst[0] = static_cast<char>(x0);
  239|       |      dst[1] = static_cast<char>(x0 >> 8);
  240|       |      dst[2] = static_cast<char>(x0 >> 16);
  241|       |      dst[3] = static_cast<char>(x1);
  242|       |      dst[4] = static_cast<char>(x1 >> 8);
  243|       |      dst[5] = static_cast<char>(x1 >> 16);
  244|       |      dst[6] = static_cast<char>(x2);
  245|       |      dst[7] = static_cast<char>(x2 >> 8);
  246|       |      dst[8] = static_cast<char>(x2 >> 16);
  247|       |#else
  248|   485k|      const uint64_t word =
  249|   485k|          uint64_t(x0) | (uint64_t(x1) << 24) | (uint64_t(x2) << 48);
  250|       |  #if SIMDUTF_CPLUSPLUS23
  251|       |      if (std::is_constant_evaluated()) {
  252|       |        dst[0] = static_cast<char>(x0);
  253|       |        dst[1] = static_cast<char>(x0 >> 8);
  254|       |        dst[2] = static_cast<char>(x0 >> 16);
  255|       |        dst[3] = static_cast<char>(x1);
  256|       |        dst[4] = static_cast<char>(x1 >> 8);
  257|       |        dst[5] = static_cast<char>(x1 >> 16);
  258|       |        dst[6] = static_cast<char>(x2);
  259|       |        dst[7] = static_cast<char>(x2 >> 8);
  260|       |      } else
  261|       |  #endif
  262|   485k|      {
  263|   485k|        std::memcpy(dst, &word, sizeof(word));
  264|   485k|      }
  265|   485k|      dst[8] = static_cast<char>(x2 >> 16);
  266|   485k|#endif
  267|   485k|      src += 12;
  268|   485k|      dst += 9;
  269|   485k|    }
  270|   194k|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (270:12): [True: 191k, False: 2.87k]
  |  Branch (270:33): [True: 191k, False: 480]
  ------------------
  271|   191k|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (271:12): [True: 190k, False: 426]
  |  Branch (271:37): [True: 190k, False: 456]
  ------------------
  272|   190k|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (272:12): [True: 189k, False: 452]
  ------------------
  273|   189k|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (273:12): [True: 90.5k, False: 99.3k]
  ------------------
  274|   189k|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  275|  90.5k|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (275:11): [Folded, False: 90.5k]
  |  Branch (275:29): [True: 0, False: 0]
  ------------------
  276|      0|        return {OUTPUT_BUFFER_TOO_SMALL, size_t(src - srcinit),
  277|      0|                size_t(dst - dstinit)};
  278|      0|      }
  279|  90.5k|      *dst++ = static_cast<char>(x & 0xFF);
  280|  90.5k|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  281|  90.5k|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  282|  90.5k|      src += 4;
  283|  90.5k|    }
  284|   104k|    const char_type *srccur = src;
  285|   104k|    idx = 0;
  286|       |    // we need at least four characters.
  287|   104k|#ifdef __clang__
  288|       |    // If possible, we read four characters at a time. (It is an optimization.)
  289|   104k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (289:9): [True: 0, False: 104k]
  |  Branch (289:27): [True: 0, False: 0]
  ------------------
  290|      0|      char_type c0 = src[0];
  291|      0|      char_type c1 = src[1];
  292|      0|      char_type c2 = src[2];
  293|      0|      char_type c3 = src[3];
  294|       |
  295|      0|      uint8_t code0 = to_base64[uint8_t(c0)];
  296|      0|      uint8_t code1 = to_base64[uint8_t(c1)];
  297|      0|      uint8_t code2 = to_base64[uint8_t(c2)];
  298|      0|      uint8_t code3 = to_base64[uint8_t(c3)];
  299|       |
  300|      0|      buffer[idx] = code0;
  301|      0|      idx += (is_eight_byte(c0) && code0 <= 63);
  ------------------
  |  Branch (301:15): [True: 0, False: 0]
  |  Branch (301:36): [True: 0, False: 0]
  ------------------
  302|      0|      buffer[idx] = code1;
  303|      0|      idx += (is_eight_byte(c1) && code1 <= 63);
  ------------------
  |  Branch (303:15): [True: 0, False: 0]
  |  Branch (303:36): [True: 0, False: 0]
  ------------------
  304|      0|      buffer[idx] = code2;
  305|      0|      idx += (is_eight_byte(c2) && code2 <= 63);
  ------------------
  |  Branch (305:15): [True: 0, False: 0]
  |  Branch (305:36): [True: 0, False: 0]
  ------------------
  306|      0|      buffer[idx] = code3;
  307|      0|      idx += (is_eight_byte(c3) && code3 <= 63);
  ------------------
  |  Branch (307:15): [True: 0, False: 0]
  |  Branch (307:36): [True: 0, False: 0]
  ------------------
  308|      0|      src += 4;
  309|      0|    }
  310|   104k|#endif
  311|   725k|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (311:12): [True: 628k, False: 96.8k]
  |  Branch (311:25): [True: 625k, False: 3.32k]
  ------------------
  312|   625k|      char_type c = *src;
  313|       |
  314|   625k|      uint8_t code = to_base64[uint8_t(c)];
  315|   625k|      buffer[idx] = uint8_t(code);
  316|   625k|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (316:11): [True: 622k, False: 2.42k]
  |  Branch (316:31): [True: 396k, False: 226k]
  ------------------
  317|   396k|        idx++;
  318|   396k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (318:18): [True: 228k, False: 0]
  ------------------
  319|   228k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (319:19): [True: 2.61k, False: 226k]
  |  Branch (319:32): [True: 1.23k, False: 225k]
  ------------------
  320|  3.84k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  321|  3.84k|                size_t(dst - dstinit)};
  322|   225k|      } else {
  323|       |        // We have a space or a newline or garbage. We ignore it.
  324|   225k|      }
  325|   621k|      src++;
  326|   621k|    }
  327|   100k|    if (idx != 4) {
  ------------------
  |  Branch (327:9): [True: 3.32k, False: 96.8k]
  ------------------
  328|  3.32k|      simdutf_log_assert(idx < 4, "idx should be less than 4");
  329|       |      // We never should have that the number of base64 characters + the
  330|       |      // number of padding characters is more than 4.
  331|  3.32k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (331:11): [True: 3.32k, False: 0]
  |  Branch (331:30): [True: 6, False: 3.32k]
  ------------------
  332|      6|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  333|      6|                size_t(dst - dstinit), true};
  334|      6|      }
  335|       |
  336|       |      // The idea here is that in loose mode,
  337|       |      // if there is padding at all, it must be used
  338|       |      // to form 4-wise chunk. However, in loose mode,
  339|       |      // we do accept no padding at all.
  340|  3.32k|      if (!ignore_garbage &&
  ------------------
  |  Branch (340:11): [True: 3.32k, False: 0]
  ------------------
  341|  3.32k|          last_chunk_options == last_chunk_handling_options::loose &&
  ------------------
  |  Branch (341:11): [True: 808, False: 2.51k]
  ------------------
  342|    808|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (342:11): [True: 402, False: 406]
  |  Branch (342:25): [True: 12, False: 390]
  ------------------
  343|     12|          ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (343:11): [True: 6, False: 6]
  ------------------
  344|      6|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  345|      6|                size_t(dst - dstinit), true};
  346|      6|      } else
  347|       |
  348|       |        // The idea here is that in strict mode, we do not want to accept
  349|       |        // incomplete base64 chunks. So if the chunk was otherwise valid, we
  350|       |        // return BASE64_INPUT_REMAINDER.
  351|  3.31k|        if (!ignore_garbage &&
  ------------------
  |  Branch (351:13): [True: 3.31k, False: 0]
  ------------------
  352|  3.31k|            last_chunk_options == last_chunk_handling_options::strict &&
  ------------------
  |  Branch (352:13): [True: 306, False: 3.01k]
  ------------------
  353|    306|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (353:13): [True: 186, False: 120]
  |  Branch (353:27): [True: 144, False: 42]
  ------------------
  354|       |          // The partial chunk was at src - idx
  355|    144|          return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  356|    144|                  size_t(dst - dstinit), true};
  357|    144|        } else
  358|       |          // If there is a partial chunk with insufficient padding, with
  359|       |          // stop_before_partial, we need to just ignore it. In "only full"
  360|       |          // mode, skip the minute there are padding characters.
  361|  3.17k|          if ((last_chunk_options ==
  ------------------
  |  Branch (361:16): [True: 2.20k, False: 964]
  ------------------
  362|  3.17k|                   last_chunk_handling_options::stop_before_partial &&
  363|  2.20k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (363:16): [True: 2.19k, False: 12]
  |  Branch (363:50): [True: 1.76k, False: 432]
  ------------------
  364|  1.76k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (364:17): [True: 852, False: 912]
  |  Branch (364:29): [True: 864, False: 48]
  ------------------
  365|  1.45k|              (last_chunk_options ==
  ------------------
  |  Branch (365:16): [True: 0, False: 1.45k]
  ------------------
  366|  1.45k|                   last_chunk_handling_options::only_full_chunks &&
  367|  1.71k|               (idx >= 2 || padding_characters == 0))) {
  ------------------
  |  Branch (367:17): [True: 0, False: 0]
  |  Branch (367:29): [True: 0, False: 0]
  ------------------
  368|       |            // partial means that we are *not* going to consume the read
  369|       |            // characters. We need to rewind the src pointer.
  370|  1.71k|            src = srccur;
  371|  1.71k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  372|  1.71k|          } else {
  373|  1.45k|            if (idx == 2) {
  ------------------
  |  Branch (373:17): [True: 234, False: 1.22k]
  ------------------
  374|    234|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  375|    234|                                (uint32_t(buffer[1]) << 2 * 6);
  376|    234|              if (!ignore_garbage &&
  ------------------
  |  Branch (376:19): [True: 234, False: 0]
  ------------------
  377|    234|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (377:19): [True: 30, False: 204]
  ------------------
  378|     30|                  (triple & 0xffff)) {
  ------------------
  |  Branch (378:19): [True: 24, False: 6]
  ------------------
  379|     24|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  380|     24|                        size_t(dst - dstinit)};
  381|     24|              }
  382|    210|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (382:19): [Folded, False: 210]
  |  Branch (382:37): [True: 0, False: 0]
  ------------------
  383|      0|                return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  384|      0|                        size_t(dst - dstinit)};
  385|      0|              }
  386|    210|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  387|  1.22k|            } else if (idx == 3) {
  ------------------
  |  Branch (387:24): [True: 216, False: 1.00k]
  ------------------
  388|    216|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  389|    216|                                (uint32_t(buffer[1]) << 2 * 6) +
  390|    216|                                (uint32_t(buffer[2]) << 1 * 6);
  391|    216|              if (!ignore_garbage &&
  ------------------
  |  Branch (391:19): [True: 216, False: 0]
  ------------------
  392|    216|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (392:19): [True: 12, False: 204]
  ------------------
  393|     12|                  (triple & 0xff)) {
  ------------------
  |  Branch (393:19): [True: 6, False: 6]
  ------------------
  394|      6|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  395|      6|                        size_t(dst - dstinit)};
  396|      6|              }
  397|    210|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (397:19): [Folded, False: 210]
  |  Branch (397:37): [True: 0, False: 0]
  ------------------
  398|      0|                return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  399|      0|                        size_t(dst - dstinit)};
  400|      0|              }
  401|    210|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  402|    210|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  403|  1.00k|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (403:24): [True: 1.00k, False: 0]
  |  Branch (403:43): [True: 180, False: 826]
  ------------------
  404|    180|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (404:25): [True: 132, False: 48]
  ------------------
  405|     48|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (405:26): [True: 48, False: 0]
  ------------------
  406|    180|                         padding_characters > 0))) {
  ------------------
  |  Branch (406:26): [True: 48, False: 0]
  ------------------
  407|    180|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  408|    180|                      size_t(dst - dstinit)};
  409|    826|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (409:24): [True: 826, False: 0]
  |  Branch (409:43): [True: 826, False: 0]
  |  Branch (409:55): [True: 24, False: 802]
  ------------------
  410|     24|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  411|     24|                      size_t(dst - dstinit), true};
  412|     24|            }
  413|  1.22k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  414|  1.45k|          }
  415|  3.32k|    }
  416|  96.8k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (416:9): [Folded, False: 96.8k]
  |  Branch (416:27): [True: 0, False: 0]
  ------------------
  417|      0|      return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  418|      0|              size_t(dst - dstinit)};
  419|      0|    }
  420|  96.8k|    uint32_t triple =
  421|  96.8k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  422|  96.8k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  423|  96.8k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  424|  96.8k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  425|  96.8k|    *dst++ = static_cast<char>(triple & 0xFF);
  426|  96.8k|  }
  427|  7.17k|}

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

_ZNK7simdutf8fallback14implementation16base64_to_binaryEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  541|  1.93k|    last_chunk_handling_options last_chunk_options) const noexcept {
  542|  1.93k|  return simdutf::scalar::base64::base64_to_binary_details_impl(
  543|  1.93k|      input, length, output, options, last_chunk_options);
  544|  1.93k|}
_ZNK7simdutf8fallback14implementation16base64_to_binaryEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  548|  1.93k|    last_chunk_handling_options last_chunk_options) const noexcept {
  549|  1.93k|  return simdutf::scalar::base64::base64_to_binary_details_impl(
  550|  1.93k|      input, length, output, options, last_chunk_options);
  551|  1.93k|}
_ZNK7simdutf8fallback14implementation24base64_to_binary_detailsEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  555|  1.93k|    last_chunk_handling_options last_chunk_options) const noexcept {
  556|  1.93k|  return simdutf::scalar::base64::base64_to_binary_details_impl(
  557|  1.93k|      input, length, output, options, last_chunk_options);
  558|  1.93k|}
_ZNK7simdutf8fallback14implementation24base64_to_binary_detailsEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  562|  1.93k|    last_chunk_handling_options last_chunk_options) const noexcept {
  563|  1.93k|  return simdutf::scalar::base64::base64_to_binary_details_impl(
  564|  1.93k|      input, length, output, options, last_chunk_options);
  565|  1.93k|}

simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.89k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.89k|  const uint8_t *to_base64 =
   47|  1.89k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.89k]
  ------------------
   48|  1.89k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.89k, Folded]
  ------------------
   49|  1.89k|                                   : tables::base64::to_base64_value);
   50|  1.89k|  auto ri =
   51|  1.89k|      ignore_garbage
  ------------------
  |  Branch (51:7): [Folded, False: 1.89k]
  ------------------
   52|  1.89k|          ? simdutf::scalar::base64::reduced_input{0, srclen, srclen, srclen}
   53|  1.89k|          : simdutf::scalar::base64::find_end(src, srclen, options);
   54|  1.89k|  size_t equallocation = ri.equallocation;
   55|  1.89k|  size_t equalsigns = ri.equalsigns;
   56|  1.89k|  srclen = ri.srclen;
   57|  1.89k|  size_t full_input_length = ri.full_input_length;
   58|  1.89k|  if (srclen == 0) {
  ------------------
  |  Branch (58:7): [True: 18, False: 1.87k]
  ------------------
   59|     18|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (59:9): [True: 18, Folded]
  |  Branch (59:28): [True: 8, False: 10]
  ------------------
   60|      8|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   61|      8|    }
   62|     10|    return {SUCCESS, full_input_length, 0};
   63|     18|  }
   64|  1.87k|  const chartype *const srcinit = src;
   65|  1.87k|  const char *const dstinit = dst;
   66|  1.87k|  const chartype *srcend = src + srclen;
   67|       |
   68|  1.87k|  constexpr size_t block_size = 6;
   69|  1.87k|  static_assert(block_size >= 2, "block_size must be at least two");
   70|  1.87k|  simdutf_indeterminate char buffer[block_size * 64];
  ------------------
  |  |  194|  1.87k|    #define simdutf_indeterminate __attribute__((uninitialized))
  ------------------
   71|  1.87k|  char *bufferptr = buffer;
   72|       |  // A wide block store writes 4 bytes past its 48. That is safe when the next
   73|       |  // store starts 48 bytes later. Pairs of clean blocks wide-store the first
   74|       |  // and end the second on byte 48. Anything shorter, or a block that is not
   75|       |  // clean, uses the exact store. The pair attempt is only worth it on a long
   76|       |  // input: a short one often fails the first block and then repeats that work.
   77|  1.87k|  if (srclen >= 512) {
  ------------------
  |  Branch (77:7): [True: 956, False: 918]
  ------------------
   78|    956|    const chartype *const srcend128 = src + srclen - 128;
   79|  22.1k|    while (bufferptr == buffer && src <= srcend128) {
  ------------------
  |  Branch (79:12): [True: 22.1k, False: 0]
  |  Branch (79:35): [True: 22.1k, False: 14]
  ------------------
   80|  22.1k|      block64 b0(src);
   81|  22.1k|      uint64_t e0 = 0;
   82|  22.1k|      const uint64_t m0 =
   83|  22.1k|          b0.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e0);
   84|  22.1k|      if ((!ignore_garbage && e0) || m0 != 0) {
  ------------------
  |  Branch (84:12): [True: 22.1k, Folded]
  |  Branch (84:31): [True: 232, False: 21.8k]
  |  Branch (84:38): [True: 304, False: 21.5k]
  ------------------
   85|    536|        break;
   86|    536|      }
   87|  21.5k|      block64 b1(src + 64);
   88|  21.5k|      uint64_t e1 = 0;
   89|  21.5k|      const uint64_t m1 =
   90|  21.5k|          b1.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e1);
   91|  21.5k|      if ((!ignore_garbage && e1) || m1 != 0) {
  ------------------
  |  Branch (91:12): [True: 21.5k, Folded]
  |  Branch (91:31): [True: 208, False: 21.3k]
  |  Branch (91:38): [True: 198, False: 21.1k]
  ------------------
   92|    406|        break;
   93|    406|      }
   94|  21.1k|      b0.base64_decode_block(dst);
   95|  21.1k|      b1.template base64_decode_block<true>(dst + 48);
   96|  21.1k|      src += 128;
   97|  21.1k|      dst += 96;
   98|  21.1k|    }
   99|    956|  }
  100|  1.87k|  if (srclen >= 64) {
  ------------------
  |  Branch (100:7): [True: 1.61k, False: 256]
  ------------------
  101|  1.61k|    const chartype *const srcend64 = srcinit + srclen - 64;
  102|  73.5k|    while (src <= srcend64) {
  ------------------
  |  Branch (102:12): [True: 72.9k, False: 582]
  ------------------
  103|  72.9k|      block64 b(src);
  104|  72.9k|      uint64_t error = 0;
  105|  72.9k|      const uint64_t badcharmask =
  106|  72.9k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
  107|  72.9k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (107:11): [True: 72.9k, Folded]
  |  Branch (107:30): [True: 1.03k, False: 71.9k]
  ------------------
  108|  1.03k|        const size_t error_offset = trailing_zeroes(error);
  109|  1.03k|        return {error_code::INVALID_BASE64_CHARACTER,
  110|  1.03k|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
  111|  1.03k|      }
  112|  71.9k|      if (ignore_garbage && badcharmask != 0) {
  ------------------
  |  Branch (112:11): [Folded, False: 71.9k]
  |  Branch (112:29): [True: 0, False: 0]
  ------------------
  113|      0|        const uint64_t equals = block64(src).equal_sign_mask();
  114|      0|        if (equals != 0) {
  ------------------
  |  Branch (114:13): [True: 0, False: 0]
  ------------------
  115|      0|          const size_t offset = trailing_zeroes(equals);
  116|      0|          equallocation = size_t(src - srcinit) + offset;
  117|      0|          equalsigns = 1;
  118|      0|          srclen = equallocation;
  119|      0|          full_input_length = equallocation + 1;
  120|      0|          if (srclen == 0) {
  ------------------
  |  Branch (120:15): [True: 0, False: 0]
  ------------------
  121|      0|            return {SUCCESS, full_input_length, 0};
  122|      0|          }
  123|      0|          srcend = srcinit + srclen;
  124|      0|          src = srcend;
  125|      0|          bufferptr += b.compress_block(badcharmask | (~uint64_t(0) << offset),
  126|      0|                                        bufferptr);
  127|      0|          break;
  128|      0|        }
  129|      0|      }
  130|  71.9k|      src += 64;
  131|  71.9k|      if (badcharmask != 0) {
  ------------------
  |  Branch (131:11): [True: 44.9k, False: 26.9k]
  ------------------
  132|  44.9k|        bufferptr += b.compress_block(badcharmask, bufferptr);
  133|  44.9k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (133:18): [True: 26.1k, False: 888]
  ------------------
  134|  26.1k|        b.copy_block(bufferptr);
  135|  26.1k|        bufferptr += 64;
  136|  26.1k|      } else {
  137|    888|        b.template base64_decode_block<true>(dst);
  138|    888|        dst += 48;
  139|    888|      }
  140|  71.9k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (140:11): [True: 13.6k, False: 58.2k]
  ------------------
  141|  68.1k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (141:28): [True: 54.4k, False: 13.6k]
  ------------------
  142|  54.4k|          base64_decode_block(dst, buffer + i * 64);
  143|  54.4k|          dst += 48;
  144|  54.4k|        }
  145|  13.6k|        base64_decode_block<true>(dst, buffer + (block_size - 2) * 64);
  146|  13.6k|        dst += 48;
  147|  13.6k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  148|  13.6k|                    64); // 64 might be too much
  149|  13.6k|        bufferptr -= (block_size - 1) * 64;
  150|  13.6k|      }
  151|  71.9k|    }
  152|  1.61k|  }
  153|       |
  154|    838|  if (ignore_garbage && equalsigns == 0) {
  ------------------
  |  Branch (154:7): [Folded, False: 838]
  |  Branch (154:25): [True: 0, False: 0]
  ------------------
  155|      0|    const chartype *equal = src;
  156|      0|    while (equal < srcend && *equal != '=') {
  ------------------
  |  Branch (156:12): [True: 0, False: 0]
  |  Branch (156:30): [True: 0, False: 0]
  ------------------
  157|      0|      equal++;
  158|      0|    }
  159|      0|    if (equal < srcend) {
  ------------------
  |  Branch (159:9): [True: 0, False: 0]
  ------------------
  160|      0|      equallocation = size_t(equal - srcinit);
  161|      0|      equalsigns = 1;
  162|      0|      srclen = equallocation;
  163|      0|      full_input_length = equallocation + 1;
  164|      0|      if (srclen == 0) {
  ------------------
  |  Branch (164:11): [True: 0, False: 0]
  ------------------
  165|      0|        return {SUCCESS, full_input_length, 0};
  166|      0|      }
  167|      0|      srcend = equal;
  168|      0|    }
  169|      0|  }
  170|    838|  char *buffer_start = buffer;
  171|       |  // Optimization note: if this is almost full, then it is worth our
  172|       |  // time, otherwise, we should just decode directly.
  173|    838|  int last_block = (int)((bufferptr - buffer_start) % 64);
  174|    838|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (174:7): [True: 534, False: 304]
  |  Branch (174:26): [True: 68, False: 466]
  ------------------
  175|       |
  176|    846|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (176:12): [True: 796, False: 50]
  |  Branch (176:52): [True: 782, False: 14]
  ------------------
  177|    782|      uint8_t val = to_base64[uint8_t(*src)];
  178|    782|      *bufferptr = char(val);
  179|    782|      if (!ignore_garbage &&
  ------------------
  |  Branch (179:11): [True: 782, Folded]
  ------------------
  180|    782|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (180:12): [True: 0, False: 782]
  |  Branch (180:52): [True: 4, False: 778]
  ------------------
  181|      4|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  182|      4|                size_t(dst - dstinit)};
  183|      4|      }
  184|    778|      bufferptr += (val <= 63 && scalar::base64::is_eight_byte(*src));
  ------------------
  |  Branch (184:21): [True: 608, False: 170]
  |  Branch (184:34): [True: 608, False: 0]
  ------------------
  185|    778|      src++;
  186|    778|    }
  187|     68|  }
  188|       |
  189|  1.27k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (189:10): [True: 438, False: 834]
  ------------------
  190|       |    // 8 payload bytes still in the buffer become 6 output bytes, which cover
  191|       |    // the 4-byte tail of a wide store. Fewer than that, and the tail can
  192|       |    // stick out past the real end.
  193|    438|    const size_t after = size_t(bufferptr - (buffer_start + 64));
  194|    438|    if (after >= 8) {
  ------------------
  |  Branch (194:9): [True: 356, False: 82]
  ------------------
  195|    356|      base64_decode_block(dst, buffer_start);
  196|    356|    } else {
  197|     82|      base64_decode_block<true>(dst, buffer_start);
  198|     82|    }
  199|    438|    dst += 48;
  200|    438|  }
  201|    834|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (201:7): [True: 480, False: 354]
  ------------------
  202|  3.86k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (202:12): [True: 3.38k, False: 480]
  ------------------
  203|  3.38k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  204|  3.38k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  205|  3.38k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  206|  3.38k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  207|  3.38k|                        << 8;
  208|  3.38k|#if !SIMDUTF_IS_BIG_ENDIAN
  209|  3.38k|      triple = scalar::u32_swap_bytes(triple);
  210|  3.38k|#endif
  211|  3.38k|      std::memcpy(dst, &triple, 3);
  212|       |
  213|  3.38k|      dst += 3;
  214|  3.38k|      buffer_start += 4;
  215|  3.38k|    }
  216|    480|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (216:9): [True: 110, False: 370]
  ------------------
  217|    110|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  218|    110|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  219|    110|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  220|    110|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  221|    110|                        << 8;
  222|    110|#if !SIMDUTF_IS_BIG_ENDIAN
  223|    110|      triple = scalar::u32_swap_bytes(triple);
  224|    110|#endif
  225|    110|      std::memcpy(dst, &triple, 3);
  226|       |
  227|    110|      dst += 3;
  228|    110|      buffer_start += 4;
  229|    110|    }
  230|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  231|       |    // backtrack
  232|    480|    int leftover = int(bufferptr - buffer_start);
  233|  1.21k|    while (leftover > 0) {
  ------------------
  |  Branch (233:12): [True: 734, False: 480]
  ------------------
  234|    734|      if (!ignore_garbage) {
  ------------------
  |  Branch (234:11): [True: 734, Folded]
  ------------------
  235|  5.66k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (235:16): [True: 4.92k, False: 734]
  ------------------
  236|  4.92k|          src--;
  237|  4.92k|        }
  238|    734|      } else {
  239|      0|        while (!scalar::base64::is_eight_byte(*(src - 1)) ||
  ------------------
  |  Branch (239:16): [True: 0, False: 0]
  ------------------
  240|      0|               to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (240:16): [True: 0, False: 0]
  ------------------
  241|      0|          src--;
  242|      0|        }
  243|      0|      }
  244|    734|      src--;
  245|    734|      leftover--;
  246|    734|    }
  247|    480|  }
  248|    834|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (248:7): [True: 688, False: 146]
  ------------------
  249|    688|    full_result r = scalar::base64::base64_tail_decode(
  250|    688|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  251|    688|    r = scalar::base64::patch_tail_result(
  252|    688|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  253|    688|        full_input_length, last_chunk_options);
  254|       |    // When is_partial(last_chunk_options) is true, we must either end with
  255|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  256|       |    // character or at the very beginning of the stream.
  257|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  258|    688|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (258:9): [True: 370, False: 318]
  |  Branch (258:43): [True: 336, False: 34]
  ------------------
  259|    336|        r.input_count < full_input_length) {
  ------------------
  |  Branch (259:9): [True: 294, False: 42]
  ------------------
  260|       |      // First check if we can extend the input to the end of the stream
  261|    780|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (261:14): [True: 774, False: 6]
  ------------------
  262|    774|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (262:14): [True: 486, False: 288]
  ------------------
  263|    486|        r.input_count++;
  264|    486|      }
  265|       |      // If we are still not at the end of the stream, then we must backtrack
  266|       |      // to the last non-ignorable character.
  267|    294|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (267:11): [True: 288, False: 6]
  ------------------
  268|  2.01k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (268:16): [True: 1.95k, False: 58]
  ------------------
  269|  1.95k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (269:16): [True: 1.72k, False: 230]
  ------------------
  270|  1.72k|          r.input_count--;
  271|  1.72k|        }
  272|    288|      }
  273|    294|    }
  274|    688|    return r;
  275|    688|  }
  276|    146|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (276:7): [True: 146, Folded]
  |  Branch (276:26): [True: 0, False: 146]
  ------------------
  277|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (277:9): [True: 0, False: 0]
  ------------------
  278|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (278:9): [True: 0, False: 0]
  ------------------
  279|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  280|      0|              true};
  281|      0|    }
  282|      0|  }
  283|    146|  return {SUCCESS, full_input_length, size_t(dst - dstinit)};
  284|    146|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.98k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.98k|  const uint8_t *to_base64 =
   47|  1.98k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.98k]
  ------------------
   48|  1.98k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.98k]
  ------------------
   49|  1.98k|                                   : tables::base64::to_base64_value);
   50|  1.98k|  auto ri =
   51|  1.98k|      ignore_garbage
  ------------------
  |  Branch (51:7): [Folded, False: 1.98k]
  ------------------
   52|  1.98k|          ? simdutf::scalar::base64::reduced_input{0, srclen, srclen, srclen}
   53|  1.98k|          : simdutf::scalar::base64::find_end(src, srclen, options);
   54|  1.98k|  size_t equallocation = ri.equallocation;
   55|  1.98k|  size_t equalsigns = ri.equalsigns;
   56|  1.98k|  srclen = ri.srclen;
   57|  1.98k|  size_t full_input_length = ri.full_input_length;
   58|  1.98k|  if (srclen == 0) {
  ------------------
  |  Branch (58:7): [True: 20, False: 1.96k]
  ------------------
   59|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (59:9): [True: 20, Folded]
  |  Branch (59:28): [True: 10, False: 10]
  ------------------
   60|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   61|     10|    }
   62|     10|    return {SUCCESS, full_input_length, 0};
   63|     20|  }
   64|  1.96k|  const chartype *const srcinit = src;
   65|  1.96k|  const char *const dstinit = dst;
   66|  1.96k|  const chartype *srcend = src + srclen;
   67|       |
   68|  1.96k|  constexpr size_t block_size = 6;
   69|  1.96k|  static_assert(block_size >= 2, "block_size must be at least two");
   70|  1.96k|  simdutf_indeterminate char buffer[block_size * 64];
  ------------------
  |  |  194|  1.96k|    #define simdutf_indeterminate __attribute__((uninitialized))
  ------------------
   71|  1.96k|  char *bufferptr = buffer;
   72|       |  // A wide block store writes 4 bytes past its 48. That is safe when the next
   73|       |  // store starts 48 bytes later. Pairs of clean blocks wide-store the first
   74|       |  // and end the second on byte 48. Anything shorter, or a block that is not
   75|       |  // clean, uses the exact store. The pair attempt is only worth it on a long
   76|       |  // input: a short one often fails the first block and then repeats that work.
   77|  1.96k|  if (srclen >= 512) {
  ------------------
  |  Branch (77:7): [True: 986, False: 974]
  ------------------
   78|    986|    const chartype *const srcend128 = src + srclen - 128;
   79|  34.7k|    while (bufferptr == buffer && src <= srcend128) {
  ------------------
  |  Branch (79:12): [True: 34.7k, False: 0]
  |  Branch (79:35): [True: 34.7k, False: 22]
  ------------------
   80|  34.7k|      block64 b0(src);
   81|  34.7k|      uint64_t e0 = 0;
   82|  34.7k|      const uint64_t m0 =
   83|  34.7k|          b0.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e0);
   84|  34.7k|      if ((!ignore_garbage && e0) || m0 != 0) {
  ------------------
  |  Branch (84:12): [True: 34.7k, Folded]
  |  Branch (84:31): [True: 234, False: 34.5k]
  |  Branch (84:38): [True: 352, False: 34.1k]
  ------------------
   85|    586|        break;
   86|    586|      }
   87|  34.1k|      block64 b1(src + 64);
   88|  34.1k|      uint64_t e1 = 0;
   89|  34.1k|      const uint64_t m1 =
   90|  34.1k|          b1.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e1);
   91|  34.1k|      if ((!ignore_garbage && e1) || m1 != 0) {
  ------------------
  |  Branch (91:12): [True: 34.1k, Folded]
  |  Branch (91:31): [True: 206, False: 33.9k]
  |  Branch (91:38): [True: 172, False: 33.7k]
  ------------------
   92|    378|        break;
   93|    378|      }
   94|  33.7k|      b0.base64_decode_block(dst);
   95|  33.7k|      b1.template base64_decode_block<true>(dst + 48);
   96|  33.7k|      src += 128;
   97|  33.7k|      dst += 96;
   98|  33.7k|    }
   99|    986|  }
  100|  1.96k|  if (srclen >= 64) {
  ------------------
  |  Branch (100:7): [True: 1.66k, False: 300]
  ------------------
  101|  1.66k|    const chartype *const srcend64 = srcinit + srclen - 64;
  102|   146k|    while (src <= srcend64) {
  ------------------
  |  Branch (102:12): [True: 146k, False: 624]
  ------------------
  103|   146k|      block64 b(src);
  104|   146k|      uint64_t error = 0;
  105|   146k|      const uint64_t badcharmask =
  106|   146k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
  107|   146k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (107:11): [True: 146k, Folded]
  |  Branch (107:30): [True: 1.03k, False: 145k]
  ------------------
  108|  1.03k|        const size_t error_offset = trailing_zeroes(error);
  109|  1.03k|        return {error_code::INVALID_BASE64_CHARACTER,
  110|  1.03k|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
  111|  1.03k|      }
  112|   145k|      if (ignore_garbage && badcharmask != 0) {
  ------------------
  |  Branch (112:11): [Folded, False: 145k]
  |  Branch (112:29): [True: 0, False: 0]
  ------------------
  113|      0|        const uint64_t equals = block64(src).equal_sign_mask();
  114|      0|        if (equals != 0) {
  ------------------
  |  Branch (114:13): [True: 0, False: 0]
  ------------------
  115|      0|          const size_t offset = trailing_zeroes(equals);
  116|      0|          equallocation = size_t(src - srcinit) + offset;
  117|      0|          equalsigns = 1;
  118|      0|          srclen = equallocation;
  119|      0|          full_input_length = equallocation + 1;
  120|      0|          if (srclen == 0) {
  ------------------
  |  Branch (120:15): [True: 0, False: 0]
  ------------------
  121|      0|            return {SUCCESS, full_input_length, 0};
  122|      0|          }
  123|      0|          srcend = srcinit + srclen;
  124|      0|          src = srcend;
  125|      0|          bufferptr += b.compress_block(badcharmask | (~uint64_t(0) << offset),
  126|      0|                                        bufferptr);
  127|      0|          break;
  128|      0|        }
  129|      0|      }
  130|   145k|      src += 64;
  131|   145k|      if (badcharmask != 0) {
  ------------------
  |  Branch (131:11): [True: 60.8k, False: 84.2k]
  ------------------
  132|  60.8k|        bufferptr += b.compress_block(badcharmask, bufferptr);
  133|  84.2k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (133:18): [True: 83.5k, False: 748]
  ------------------
  134|  83.5k|        b.copy_block(bufferptr);
  135|  83.5k|        bufferptr += 64;
  136|  83.5k|      } else {
  137|    748|        b.template base64_decode_block<true>(dst);
  138|    748|        dst += 48;
  139|    748|      }
  140|   145k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (140:11): [True: 27.9k, False: 117k]
  ------------------
  141|   139k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (141:28): [True: 111k, False: 27.9k]
  ------------------
  142|   111k|          base64_decode_block(dst, buffer + i * 64);
  143|   111k|          dst += 48;
  144|   111k|        }
  145|  27.9k|        base64_decode_block<true>(dst, buffer + (block_size - 2) * 64);
  146|  27.9k|        dst += 48;
  147|  27.9k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  148|  27.9k|                    64); // 64 might be too much
  149|  27.9k|        bufferptr -= (block_size - 1) * 64;
  150|  27.9k|      }
  151|   145k|    }
  152|  1.66k|  }
  153|       |
  154|    924|  if (ignore_garbage && equalsigns == 0) {
  ------------------
  |  Branch (154:7): [Folded, False: 924]
  |  Branch (154:25): [True: 0, False: 0]
  ------------------
  155|      0|    const chartype *equal = src;
  156|      0|    while (equal < srcend && *equal != '=') {
  ------------------
  |  Branch (156:12): [True: 0, False: 0]
  |  Branch (156:30): [True: 0, False: 0]
  ------------------
  157|      0|      equal++;
  158|      0|    }
  159|      0|    if (equal < srcend) {
  ------------------
  |  Branch (159:9): [True: 0, False: 0]
  ------------------
  160|      0|      equallocation = size_t(equal - srcinit);
  161|      0|      equalsigns = 1;
  162|      0|      srclen = equallocation;
  163|      0|      full_input_length = equallocation + 1;
  164|      0|      if (srclen == 0) {
  ------------------
  |  Branch (164:11): [True: 0, False: 0]
  ------------------
  165|      0|        return {SUCCESS, full_input_length, 0};
  166|      0|      }
  167|      0|      srcend = equal;
  168|      0|    }
  169|      0|  }
  170|    924|  char *buffer_start = buffer;
  171|       |  // Optimization note: if this is almost full, then it is worth our
  172|       |  // time, otherwise, we should just decode directly.
  173|    924|  int last_block = (int)((bufferptr - buffer_start) % 64);
  174|    924|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (174:7): [True: 572, False: 352]
  |  Branch (174:26): [True: 86, False: 486]
  ------------------
  175|       |
  176|  1.12k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (176:12): [True: 1.06k, False: 64]
  |  Branch (176:52): [True: 1.04k, False: 16]
  ------------------
  177|  1.04k|      uint8_t val = to_base64[uint8_t(*src)];
  178|  1.04k|      *bufferptr = char(val);
  179|  1.04k|      if (!ignore_garbage &&
  ------------------
  |  Branch (179:11): [True: 1.04k, Folded]
  ------------------
  180|  1.04k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (180:12): [True: 0, False: 1.04k]
  |  Branch (180:52): [True: 6, False: 1.03k]
  ------------------
  181|      6|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  182|      6|                size_t(dst - dstinit)};
  183|      6|      }
  184|  1.03k|      bufferptr += (val <= 63 && scalar::base64::is_eight_byte(*src));
  ------------------
  |  Branch (184:21): [True: 832, False: 206]
  |  Branch (184:34): [True: 832, False: 0]
  ------------------
  185|  1.03k|      src++;
  186|  1.03k|    }
  187|     86|  }
  188|       |
  189|  1.39k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (189:10): [True: 472, False: 918]
  ------------------
  190|       |    // 8 payload bytes still in the buffer become 6 output bytes, which cover
  191|       |    // the 4-byte tail of a wide store. Fewer than that, and the tail can
  192|       |    // stick out past the real end.
  193|    472|    const size_t after = size_t(bufferptr - (buffer_start + 64));
  194|    472|    if (after >= 8) {
  ------------------
  |  Branch (194:9): [True: 382, False: 90]
  ------------------
  195|    382|      base64_decode_block(dst, buffer_start);
  196|    382|    } else {
  197|     90|      base64_decode_block<true>(dst, buffer_start);
  198|     90|    }
  199|    472|    dst += 48;
  200|    472|  }
  201|    918|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (201:7): [True: 502, False: 416]
  ------------------
  202|  4.22k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (202:12): [True: 3.71k, False: 502]
  ------------------
  203|  3.71k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  204|  3.71k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  205|  3.71k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  206|  3.71k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  207|  3.71k|                        << 8;
  208|  3.71k|#if !SIMDUTF_IS_BIG_ENDIAN
  209|  3.71k|      triple = scalar::u32_swap_bytes(triple);
  210|  3.71k|#endif
  211|  3.71k|      std::memcpy(dst, &triple, 3);
  212|       |
  213|  3.71k|      dst += 3;
  214|  3.71k|      buffer_start += 4;
  215|  3.71k|    }
  216|    502|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (216:9): [True: 128, False: 374]
  ------------------
  217|    128|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  218|    128|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  219|    128|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  220|    128|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  221|    128|                        << 8;
  222|    128|#if !SIMDUTF_IS_BIG_ENDIAN
  223|    128|      triple = scalar::u32_swap_bytes(triple);
  224|    128|#endif
  225|    128|      std::memcpy(dst, &triple, 3);
  226|       |
  227|    128|      dst += 3;
  228|    128|      buffer_start += 4;
  229|    128|    }
  230|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  231|       |    // backtrack
  232|    502|    int leftover = int(bufferptr - buffer_start);
  233|  1.27k|    while (leftover > 0) {
  ------------------
  |  Branch (233:12): [True: 768, False: 502]
  ------------------
  234|    768|      if (!ignore_garbage) {
  ------------------
  |  Branch (234:11): [True: 768, Folded]
  ------------------
  235|  7.17k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (235:16): [True: 6.40k, False: 768]
  ------------------
  236|  6.40k|          src--;
  237|  6.40k|        }
  238|    768|      } else {
  239|      0|        while (!scalar::base64::is_eight_byte(*(src - 1)) ||
  ------------------
  |  Branch (239:16): [True: 0, False: 0]
  ------------------
  240|      0|               to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (240:16): [True: 0, False: 0]
  ------------------
  241|      0|          src--;
  242|      0|        }
  243|      0|      }
  244|    768|      src--;
  245|    768|      leftover--;
  246|    768|    }
  247|    502|  }
  248|    918|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (248:7): [True: 768, False: 150]
  ------------------
  249|    768|    full_result r = scalar::base64::base64_tail_decode(
  250|    768|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  251|    768|    r = scalar::base64::patch_tail_result(
  252|    768|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  253|    768|        full_input_length, last_chunk_options);
  254|       |    // When is_partial(last_chunk_options) is true, we must either end with
  255|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  256|       |    // character or at the very beginning of the stream.
  257|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  258|    768|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (258:9): [True: 362, False: 406]
  |  Branch (258:43): [True: 336, False: 26]
  ------------------
  259|    336|        r.input_count < full_input_length) {
  ------------------
  |  Branch (259:9): [True: 262, False: 74]
  ------------------
  260|       |      // First check if we can extend the input to the end of the stream
  261|    642|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (261:14): [True: 634, False: 8]
  ------------------
  262|    634|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (262:14): [True: 380, False: 254]
  ------------------
  263|    380|        r.input_count++;
  264|    380|      }
  265|       |      // If we are still not at the end of the stream, then we must backtrack
  266|       |      // to the last non-ignorable character.
  267|    262|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (267:11): [True: 254, False: 8]
  ------------------
  268|  1.95k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (268:16): [True: 1.89k, False: 52]
  ------------------
  269|  1.89k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (269:16): [True: 1.69k, False: 202]
  ------------------
  270|  1.69k|          r.input_count--;
  271|  1.69k|        }
  272|    254|      }
  273|    262|    }
  274|    768|    return r;
  275|    768|  }
  276|    150|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (276:7): [True: 150, Folded]
  |  Branch (276:26): [True: 0, False: 150]
  ------------------
  277|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (277:9): [True: 0, False: 0]
  ------------------
  278|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (278:9): [True: 0, False: 0]
  ------------------
  279|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  280|      0|              true};
  281|      0|    }
  282|      0|  }
  283|    150|  return {SUCCESS, full_input_length, size_t(dst - dstinit)};
  284|    150|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.92k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.92k|  const uint8_t *to_base64 =
   47|  1.92k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.92k]
  ------------------
   48|  1.92k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.92k, Folded]
  ------------------
   49|  1.92k|                                   : tables::base64::to_base64_value);
   50|  1.92k|  auto ri =
   51|  1.92k|      ignore_garbage
  ------------------
  |  Branch (51:7): [Folded, False: 1.92k]
  ------------------
   52|  1.92k|          ? simdutf::scalar::base64::reduced_input{0, srclen, srclen, srclen}
   53|  1.92k|          : simdutf::scalar::base64::find_end(src, srclen, options);
   54|  1.92k|  size_t equallocation = ri.equallocation;
   55|  1.92k|  size_t equalsigns = ri.equalsigns;
   56|  1.92k|  srclen = ri.srclen;
   57|  1.92k|  size_t full_input_length = ri.full_input_length;
   58|  1.92k|  if (srclen == 0) {
  ------------------
  |  Branch (58:7): [True: 12, False: 1.91k]
  ------------------
   59|     12|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (59:9): [True: 12, Folded]
  |  Branch (59:28): [True: 8, False: 4]
  ------------------
   60|      8|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   61|      8|    }
   62|      4|    return {SUCCESS, full_input_length, 0};
   63|     12|  }
   64|  1.91k|  const chartype *const srcinit = src;
   65|  1.91k|  const char *const dstinit = dst;
   66|  1.91k|  const chartype *srcend = src + srclen;
   67|       |
   68|  1.91k|  constexpr size_t block_size = 6;
   69|  1.91k|  static_assert(block_size >= 2, "block_size must be at least two");
   70|  1.91k|  simdutf_indeterminate char buffer[block_size * 64];
  ------------------
  |  |  194|  1.91k|    #define simdutf_indeterminate __attribute__((uninitialized))
  ------------------
   71|  1.91k|  char *bufferptr = buffer;
   72|       |  // A wide block store writes 4 bytes past its 48. That is safe when the next
   73|       |  // store starts 48 bytes later. Pairs of clean blocks wide-store the first
   74|       |  // and end the second on byte 48. Anything shorter, or a block that is not
   75|       |  // clean, uses the exact store. The pair attempt is only worth it on a long
   76|       |  // input: a short one often fails the first block and then repeats that work.
   77|  1.91k|  if (srclen >= 512) {
  ------------------
  |  Branch (77:7): [True: 818, False: 1.09k]
  ------------------
   78|    818|    const chartype *const srcend128 = src + srclen - 128;
   79|  1.16k|    while (bufferptr == buffer && src <= srcend128) {
  ------------------
  |  Branch (79:12): [True: 1.16k, False: 0]
  |  Branch (79:35): [True: 1.15k, False: 10]
  ------------------
   80|  1.15k|      block64 b0(src);
   81|  1.15k|      uint64_t e0 = 0;
   82|  1.15k|      const uint64_t m0 =
   83|  1.15k|          b0.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e0);
   84|  1.15k|      if ((!ignore_garbage && e0) || m0 != 0) {
  ------------------
  |  Branch (84:12): [True: 1.15k, Folded]
  |  Branch (84:31): [True: 206, False: 950]
  |  Branch (84:38): [True: 306, False: 644]
  ------------------
   85|    512|        break;
   86|    512|      }
   87|    644|      block64 b1(src + 64);
   88|    644|      uint64_t e1 = 0;
   89|    644|      const uint64_t m1 =
   90|    644|          b1.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e1);
   91|    644|      if ((!ignore_garbage && e1) || m1 != 0) {
  ------------------
  |  Branch (91:12): [True: 644, Folded]
  |  Branch (91:31): [True: 162, False: 482]
  |  Branch (91:38): [True: 134, False: 348]
  ------------------
   92|    296|        break;
   93|    296|      }
   94|    348|      b0.base64_decode_block(dst);
   95|    348|      b1.template base64_decode_block<true>(dst + 48);
   96|    348|      src += 128;
   97|    348|      dst += 96;
   98|    348|    }
   99|    818|  }
  100|  1.91k|  if (srclen >= 64) {
  ------------------
  |  Branch (100:7): [True: 1.46k, False: 446]
  ------------------
  101|  1.46k|    const chartype *const srcend64 = srcinit + srclen - 64;
  102|  26.3k|    while (src <= srcend64) {
  ------------------
  |  Branch (102:12): [True: 25.7k, False: 580]
  ------------------
  103|  25.7k|      block64 b(src);
  104|  25.7k|      uint64_t error = 0;
  105|  25.7k|      const uint64_t badcharmask =
  106|  25.7k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
  107|  25.7k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (107:11): [True: 25.7k, Folded]
  |  Branch (107:30): [True: 884, False: 24.8k]
  ------------------
  108|    884|        const size_t error_offset = trailing_zeroes(error);
  109|    884|        return {error_code::INVALID_BASE64_CHARACTER,
  110|    884|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
  111|    884|      }
  112|  24.8k|      if (ignore_garbage && badcharmask != 0) {
  ------------------
  |  Branch (112:11): [Folded, False: 24.8k]
  |  Branch (112:29): [True: 0, False: 0]
  ------------------
  113|      0|        const uint64_t equals = block64(src).equal_sign_mask();
  114|      0|        if (equals != 0) {
  ------------------
  |  Branch (114:13): [True: 0, False: 0]
  ------------------
  115|      0|          const size_t offset = trailing_zeroes(equals);
  116|      0|          equallocation = size_t(src - srcinit) + offset;
  117|      0|          equalsigns = 1;
  118|      0|          srclen = equallocation;
  119|      0|          full_input_length = equallocation + 1;
  120|      0|          if (srclen == 0) {
  ------------------
  |  Branch (120:15): [True: 0, False: 0]
  ------------------
  121|      0|            return {SUCCESS, full_input_length, 0};
  122|      0|          }
  123|      0|          srcend = srcinit + srclen;
  124|      0|          src = srcend;
  125|      0|          bufferptr += b.compress_block(badcharmask | (~uint64_t(0) << offset),
  126|      0|                                        bufferptr);
  127|      0|          break;
  128|      0|        }
  129|      0|      }
  130|  24.8k|      src += 64;
  131|  24.8k|      if (badcharmask != 0) {
  ------------------
  |  Branch (131:11): [True: 20.3k, False: 4.54k]
  ------------------
  132|  20.3k|        bufferptr += b.compress_block(badcharmask, bufferptr);
  133|  20.3k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (133:18): [True: 4.02k, False: 512]
  ------------------
  134|  4.02k|        b.copy_block(bufferptr);
  135|  4.02k|        bufferptr += 64;
  136|  4.02k|      } else {
  137|    512|        b.template base64_decode_block<true>(dst);
  138|    512|        dst += 48;
  139|    512|      }
  140|  24.8k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (140:11): [True: 4.46k, False: 20.3k]
  ------------------
  141|  22.3k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (141:28): [True: 17.8k, False: 4.46k]
  ------------------
  142|  17.8k|          base64_decode_block(dst, buffer + i * 64);
  143|  17.8k|          dst += 48;
  144|  17.8k|        }
  145|  4.46k|        base64_decode_block<true>(dst, buffer + (block_size - 2) * 64);
  146|  4.46k|        dst += 48;
  147|  4.46k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  148|  4.46k|                    64); // 64 might be too much
  149|  4.46k|        bufferptr -= (block_size - 1) * 64;
  150|  4.46k|      }
  151|  24.8k|    }
  152|  1.46k|  }
  153|       |
  154|  1.02k|  if (ignore_garbage && equalsigns == 0) {
  ------------------
  |  Branch (154:7): [Folded, False: 1.02k]
  |  Branch (154:25): [True: 0, False: 0]
  ------------------
  155|      0|    const chartype *equal = src;
  156|      0|    while (equal < srcend && *equal != '=') {
  ------------------
  |  Branch (156:12): [True: 0, False: 0]
  |  Branch (156:30): [True: 0, False: 0]
  ------------------
  157|      0|      equal++;
  158|      0|    }
  159|      0|    if (equal < srcend) {
  ------------------
  |  Branch (159:9): [True: 0, False: 0]
  ------------------
  160|      0|      equallocation = size_t(equal - srcinit);
  161|      0|      equalsigns = 1;
  162|      0|      srclen = equallocation;
  163|      0|      full_input_length = equallocation + 1;
  164|      0|      if (srclen == 0) {
  ------------------
  |  Branch (164:11): [True: 0, False: 0]
  ------------------
  165|      0|        return {SUCCESS, full_input_length, 0};
  166|      0|      }
  167|      0|      srcend = equal;
  168|      0|    }
  169|      0|  }
  170|  1.02k|  char *buffer_start = buffer;
  171|       |  // Optimization note: if this is almost full, then it is worth our
  172|       |  // time, otherwise, we should just decode directly.
  173|  1.02k|  int last_block = (int)((bufferptr - buffer_start) % 64);
  174|  1.02k|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (174:7): [True: 544, False: 482]
  |  Branch (174:26): [True: 100, False: 444]
  ------------------
  175|       |
  176|    788|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (176:12): [True: 742, False: 46]
  |  Branch (176:52): [True: 726, False: 16]
  ------------------
  177|    726|      uint8_t val = to_base64[uint8_t(*src)];
  178|    726|      *bufferptr = char(val);
  179|    726|      if (!ignore_garbage &&
  ------------------
  |  Branch (179:11): [True: 726, Folded]
  ------------------
  180|    726|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (180:12): [True: 22, False: 704]
  |  Branch (180:52): [True: 16, False: 688]
  ------------------
  181|     38|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  182|     38|                size_t(dst - dstinit)};
  183|     38|      }
  184|    688|      bufferptr += (val <= 63 && scalar::base64::is_eight_byte(*src));
  ------------------
  |  Branch (184:21): [True: 276, False: 412]
  |  Branch (184:34): [True: 276, False: 0]
  ------------------
  185|    688|      src++;
  186|    688|    }
  187|    100|  }
  188|       |
  189|  1.35k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (189:10): [True: 362, False: 988]
  ------------------
  190|       |    // 8 payload bytes still in the buffer become 6 output bytes, which cover
  191|       |    // the 4-byte tail of a wide store. Fewer than that, and the tail can
  192|       |    // stick out past the real end.
  193|    362|    const size_t after = size_t(bufferptr - (buffer_start + 64));
  194|    362|    if (after >= 8) {
  ------------------
  |  Branch (194:9): [True: 298, False: 64]
  ------------------
  195|    298|      base64_decode_block(dst, buffer_start);
  196|    298|    } else {
  197|     64|      base64_decode_block<true>(dst, buffer_start);
  198|     64|    }
  199|    362|    dst += 48;
  200|    362|  }
  201|    988|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (201:7): [True: 460, False: 528]
  ------------------
  202|  3.77k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (202:12): [True: 3.31k, False: 460]
  ------------------
  203|  3.31k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  204|  3.31k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  205|  3.31k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  206|  3.31k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  207|  3.31k|                        << 8;
  208|  3.31k|#if !SIMDUTF_IS_BIG_ENDIAN
  209|  3.31k|      triple = scalar::u32_swap_bytes(triple);
  210|  3.31k|#endif
  211|  3.31k|      std::memcpy(dst, &triple, 3);
  212|       |
  213|  3.31k|      dst += 3;
  214|  3.31k|      buffer_start += 4;
  215|  3.31k|    }
  216|    460|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (216:9): [True: 124, False: 336]
  ------------------
  217|    124|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  218|    124|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  219|    124|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  220|    124|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  221|    124|                        << 8;
  222|    124|#if !SIMDUTF_IS_BIG_ENDIAN
  223|    124|      triple = scalar::u32_swap_bytes(triple);
  224|    124|#endif
  225|    124|      std::memcpy(dst, &triple, 3);
  226|       |
  227|    124|      dst += 3;
  228|    124|      buffer_start += 4;
  229|    124|    }
  230|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  231|       |    // backtrack
  232|    460|    int leftover = int(bufferptr - buffer_start);
  233|  1.10k|    while (leftover > 0) {
  ------------------
  |  Branch (233:12): [True: 642, False: 460]
  ------------------
  234|    642|      if (!ignore_garbage) {
  ------------------
  |  Branch (234:11): [True: 642, Folded]
  ------------------
  235|  6.59k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (235:16): [True: 5.94k, False: 642]
  ------------------
  236|  5.94k|          src--;
  237|  5.94k|        }
  238|    642|      } else {
  239|      0|        while (!scalar::base64::is_eight_byte(*(src - 1)) ||
  ------------------
  |  Branch (239:16): [True: 0, False: 0]
  ------------------
  240|      0|               to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (240:16): [True: 0, False: 0]
  ------------------
  241|      0|          src--;
  242|      0|        }
  243|      0|      }
  244|    642|      src--;
  245|    642|      leftover--;
  246|    642|    }
  247|    460|  }
  248|    988|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (248:7): [True: 834, False: 154]
  ------------------
  249|    834|    full_result r = scalar::base64::base64_tail_decode(
  250|    834|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  251|    834|    r = scalar::base64::patch_tail_result(
  252|    834|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  253|    834|        full_input_length, last_chunk_options);
  254|       |    // When is_partial(last_chunk_options) is true, we must either end with
  255|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  256|       |    // character or at the very beginning of the stream.
  257|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  258|    834|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (258:9): [True: 466, False: 368]
  |  Branch (258:43): [True: 338, False: 128]
  ------------------
  259|    338|        r.input_count < full_input_length) {
  ------------------
  |  Branch (259:9): [True: 298, False: 40]
  ------------------
  260|       |      // First check if we can extend the input to the end of the stream
  261|    930|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (261:14): [True: 924, False: 6]
  ------------------
  262|    924|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (262:14): [True: 632, False: 292]
  ------------------
  263|    632|        r.input_count++;
  264|    632|      }
  265|       |      // If we are still not at the end of the stream, then we must backtrack
  266|       |      // to the last non-ignorable character.
  267|    298|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (267:11): [True: 292, False: 6]
  ------------------
  268|  1.98k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (268:16): [True: 1.90k, False: 84]
  ------------------
  269|  1.90k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (269:16): [True: 1.69k, False: 208]
  ------------------
  270|  1.69k|          r.input_count--;
  271|  1.69k|        }
  272|    292|      }
  273|    298|    }
  274|    834|    return r;
  275|    834|  }
  276|    154|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (276:7): [True: 154, Folded]
  |  Branch (276:26): [True: 0, False: 154]
  ------------------
  277|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (277:9): [True: 0, False: 0]
  ------------------
  278|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (278:9): [True: 0, False: 0]
  ------------------
  279|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  280|      0|              true};
  281|      0|    }
  282|      0|  }
  283|    154|  return {SUCCESS, full_input_length, size_t(dst - dstinit)};
  284|    154|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.94k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.94k|  const uint8_t *to_base64 =
   47|  1.94k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.94k]
  ------------------
   48|  1.94k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.94k]
  ------------------
   49|  1.94k|                                   : tables::base64::to_base64_value);
   50|  1.94k|  auto ri =
   51|  1.94k|      ignore_garbage
  ------------------
  |  Branch (51:7): [Folded, False: 1.94k]
  ------------------
   52|  1.94k|          ? simdutf::scalar::base64::reduced_input{0, srclen, srclen, srclen}
   53|  1.94k|          : simdutf::scalar::base64::find_end(src, srclen, options);
   54|  1.94k|  size_t equallocation = ri.equallocation;
   55|  1.94k|  size_t equalsigns = ri.equalsigns;
   56|  1.94k|  srclen = ri.srclen;
   57|  1.94k|  size_t full_input_length = ri.full_input_length;
   58|  1.94k|  if (srclen == 0) {
  ------------------
  |  Branch (58:7): [True: 28, False: 1.91k]
  ------------------
   59|     28|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (59:9): [True: 28, Folded]
  |  Branch (59:28): [True: 12, False: 16]
  ------------------
   60|     12|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   61|     12|    }
   62|     16|    return {SUCCESS, full_input_length, 0};
   63|     28|  }
   64|  1.91k|  const chartype *const srcinit = src;
   65|  1.91k|  const char *const dstinit = dst;
   66|  1.91k|  const chartype *srcend = src + srclen;
   67|       |
   68|  1.91k|  constexpr size_t block_size = 6;
   69|  1.91k|  static_assert(block_size >= 2, "block_size must be at least two");
   70|  1.91k|  simdutf_indeterminate char buffer[block_size * 64];
  ------------------
  |  |  194|  1.91k|    #define simdutf_indeterminate __attribute__((uninitialized))
  ------------------
   71|  1.91k|  char *bufferptr = buffer;
   72|       |  // A wide block store writes 4 bytes past its 48. That is safe when the next
   73|       |  // store starts 48 bytes later. Pairs of clean blocks wide-store the first
   74|       |  // and end the second on byte 48. Anything shorter, or a block that is not
   75|       |  // clean, uses the exact store. The pair attempt is only worth it on a long
   76|       |  // input: a short one often fails the first block and then repeats that work.
   77|  1.91k|  if (srclen >= 512) {
  ------------------
  |  Branch (77:7): [True: 836, False: 1.08k]
  ------------------
   78|    836|    const chartype *const srcend128 = src + srclen - 128;
   79|  1.25k|    while (bufferptr == buffer && src <= srcend128) {
  ------------------
  |  Branch (79:12): [True: 1.25k, False: 0]
  |  Branch (79:35): [True: 1.23k, False: 16]
  ------------------
   80|  1.23k|      block64 b0(src);
   81|  1.23k|      uint64_t e0 = 0;
   82|  1.23k|      const uint64_t m0 =
   83|  1.23k|          b0.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e0);
   84|  1.23k|      if ((!ignore_garbage && e0) || m0 != 0) {
  ------------------
  |  Branch (84:12): [True: 1.23k, Folded]
  |  Branch (84:31): [True: 200, False: 1.03k]
  |  Branch (84:38): [True: 288, False: 748]
  ------------------
   85|    488|        break;
   86|    488|      }
   87|    748|      block64 b1(src + 64);
   88|    748|      uint64_t e1 = 0;
   89|    748|      const uint64_t m1 =
   90|    748|          b1.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e1);
   91|    748|      if ((!ignore_garbage && e1) || m1 != 0) {
  ------------------
  |  Branch (91:12): [True: 748, Folded]
  |  Branch (91:31): [True: 174, False: 574]
  |  Branch (91:38): [True: 158, False: 416]
  ------------------
   92|    332|        break;
   93|    332|      }
   94|    416|      b0.base64_decode_block(dst);
   95|    416|      b1.template base64_decode_block<true>(dst + 48);
   96|    416|      src += 128;
   97|    416|      dst += 96;
   98|    416|    }
   99|    836|  }
  100|  1.91k|  if (srclen >= 64) {
  ------------------
  |  Branch (100:7): [True: 1.47k, False: 446]
  ------------------
  101|  1.47k|    const chartype *const srcend64 = srcinit + srclen - 64;
  102|  80.2k|    while (src <= srcend64) {
  ------------------
  |  Branch (102:12): [True: 79.7k, False: 580]
  ------------------
  103|  79.7k|      block64 b(src);
  104|  79.7k|      uint64_t error = 0;
  105|  79.7k|      const uint64_t badcharmask =
  106|  79.7k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
  107|  79.7k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (107:11): [True: 79.7k, Folded]
  |  Branch (107:30): [True: 892, False: 78.8k]
  ------------------
  108|    892|        const size_t error_offset = trailing_zeroes(error);
  109|    892|        return {error_code::INVALID_BASE64_CHARACTER,
  110|    892|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
  111|    892|      }
  112|  78.8k|      if (ignore_garbage && badcharmask != 0) {
  ------------------
  |  Branch (112:11): [Folded, False: 78.8k]
  |  Branch (112:29): [True: 0, False: 0]
  ------------------
  113|      0|        const uint64_t equals = block64(src).equal_sign_mask();
  114|      0|        if (equals != 0) {
  ------------------
  |  Branch (114:13): [True: 0, False: 0]
  ------------------
  115|      0|          const size_t offset = trailing_zeroes(equals);
  116|      0|          equallocation = size_t(src - srcinit) + offset;
  117|      0|          equalsigns = 1;
  118|      0|          srclen = equallocation;
  119|      0|          full_input_length = equallocation + 1;
  120|      0|          if (srclen == 0) {
  ------------------
  |  Branch (120:15): [True: 0, False: 0]
  ------------------
  121|      0|            return {SUCCESS, full_input_length, 0};
  122|      0|          }
  123|      0|          srcend = srcinit + srclen;
  124|      0|          src = srcend;
  125|      0|          bufferptr += b.compress_block(badcharmask | (~uint64_t(0) << offset),
  126|      0|                                        bufferptr);
  127|      0|          break;
  128|      0|        }
  129|      0|      }
  130|  78.8k|      src += 64;
  131|  78.8k|      if (badcharmask != 0) {
  ------------------
  |  Branch (131:11): [True: 61.8k, False: 17.0k]
  ------------------
  132|  61.8k|        bufferptr += b.compress_block(badcharmask, bufferptr);
  133|  61.8k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (133:18): [True: 16.4k, False: 592]
  ------------------
  134|  16.4k|        b.copy_block(bufferptr);
  135|  16.4k|        bufferptr += 64;
  136|  16.4k|      } else {
  137|    592|        b.template base64_decode_block<true>(dst);
  138|    592|        dst += 48;
  139|    592|      }
  140|  78.8k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (140:11): [True: 15.1k, False: 63.6k]
  ------------------
  141|  75.6k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (141:28): [True: 60.5k, False: 15.1k]
  ------------------
  142|  60.5k|          base64_decode_block(dst, buffer + i * 64);
  143|  60.5k|          dst += 48;
  144|  60.5k|        }
  145|  15.1k|        base64_decode_block<true>(dst, buffer + (block_size - 2) * 64);
  146|  15.1k|        dst += 48;
  147|  15.1k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  148|  15.1k|                    64); // 64 might be too much
  149|  15.1k|        bufferptr -= (block_size - 1) * 64;
  150|  15.1k|      }
  151|  78.8k|    }
  152|  1.47k|  }
  153|       |
  154|  1.02k|  if (ignore_garbage && equalsigns == 0) {
  ------------------
  |  Branch (154:7): [Folded, False: 1.02k]
  |  Branch (154:25): [True: 0, False: 0]
  ------------------
  155|      0|    const chartype *equal = src;
  156|      0|    while (equal < srcend && *equal != '=') {
  ------------------
  |  Branch (156:12): [True: 0, False: 0]
  |  Branch (156:30): [True: 0, False: 0]
  ------------------
  157|      0|      equal++;
  158|      0|    }
  159|      0|    if (equal < srcend) {
  ------------------
  |  Branch (159:9): [True: 0, False: 0]
  ------------------
  160|      0|      equallocation = size_t(equal - srcinit);
  161|      0|      equalsigns = 1;
  162|      0|      srclen = equallocation;
  163|      0|      full_input_length = equallocation + 1;
  164|      0|      if (srclen == 0) {
  ------------------
  |  Branch (164:11): [True: 0, False: 0]
  ------------------
  165|      0|        return {SUCCESS, full_input_length, 0};
  166|      0|      }
  167|      0|      srcend = equal;
  168|      0|    }
  169|      0|  }
  170|  1.02k|  char *buffer_start = buffer;
  171|       |  // Optimization note: if this is almost full, then it is worth our
  172|       |  // time, otherwise, we should just decode directly.
  173|  1.02k|  int last_block = (int)((bufferptr - buffer_start) % 64);
  174|  1.02k|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (174:7): [True: 534, False: 492]
  |  Branch (174:26): [True: 102, False: 432]
  ------------------
  175|       |
  176|    958|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (176:12): [True: 916, False: 42]
  |  Branch (176:52): [True: 898, False: 18]
  ------------------
  177|    898|      uint8_t val = to_base64[uint8_t(*src)];
  178|    898|      *bufferptr = char(val);
  179|    898|      if (!ignore_garbage &&
  ------------------
  |  Branch (179:11): [True: 898, Folded]
  ------------------
  180|    898|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (180:12): [True: 26, False: 872]
  |  Branch (180:52): [True: 16, False: 856]
  ------------------
  181|     42|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  182|     42|                size_t(dst - dstinit)};
  183|     42|      }
  184|    856|      bufferptr += (val <= 63 && scalar::base64::is_eight_byte(*src));
  ------------------
  |  Branch (184:21): [True: 274, False: 582]
  |  Branch (184:34): [True: 274, False: 0]
  ------------------
  185|    856|      src++;
  186|    856|    }
  187|    102|  }
  188|       |
  189|  1.30k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (189:10): [True: 324, False: 984]
  ------------------
  190|       |    // 8 payload bytes still in the buffer become 6 output bytes, which cover
  191|       |    // the 4-byte tail of a wide store. Fewer than that, and the tail can
  192|       |    // stick out past the real end.
  193|    324|    const size_t after = size_t(bufferptr - (buffer_start + 64));
  194|    324|    if (after >= 8) {
  ------------------
  |  Branch (194:9): [True: 264, False: 60]
  ------------------
  195|    264|      base64_decode_block(dst, buffer_start);
  196|    264|    } else {
  197|     60|      base64_decode_block<true>(dst, buffer_start);
  198|     60|    }
  199|    324|    dst += 48;
  200|    324|  }
  201|    984|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (201:7): [True: 450, False: 534]
  ------------------
  202|  3.71k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (202:12): [True: 3.26k, False: 450]
  ------------------
  203|  3.26k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  204|  3.26k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  205|  3.26k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  206|  3.26k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  207|  3.26k|                        << 8;
  208|  3.26k|#if !SIMDUTF_IS_BIG_ENDIAN
  209|  3.26k|      triple = scalar::u32_swap_bytes(triple);
  210|  3.26k|#endif
  211|  3.26k|      std::memcpy(dst, &triple, 3);
  212|       |
  213|  3.26k|      dst += 3;
  214|  3.26k|      buffer_start += 4;
  215|  3.26k|    }
  216|    450|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (216:9): [True: 118, False: 332]
  ------------------
  217|    118|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  218|    118|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  219|    118|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  220|    118|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  221|    118|                        << 8;
  222|    118|#if !SIMDUTF_IS_BIG_ENDIAN
  223|    118|      triple = scalar::u32_swap_bytes(triple);
  224|    118|#endif
  225|    118|      std::memcpy(dst, &triple, 3);
  226|       |
  227|    118|      dst += 3;
  228|    118|      buffer_start += 4;
  229|    118|    }
  230|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  231|       |    // backtrack
  232|    450|    int leftover = int(bufferptr - buffer_start);
  233|  1.12k|    while (leftover > 0) {
  ------------------
  |  Branch (233:12): [True: 676, False: 450]
  ------------------
  234|    676|      if (!ignore_garbage) {
  ------------------
  |  Branch (234:11): [True: 676, Folded]
  ------------------
  235|  6.34k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (235:16): [True: 5.67k, False: 676]
  ------------------
  236|  5.67k|          src--;
  237|  5.67k|        }
  238|    676|      } else {
  239|      0|        while (!scalar::base64::is_eight_byte(*(src - 1)) ||
  ------------------
  |  Branch (239:16): [True: 0, False: 0]
  ------------------
  240|      0|               to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (240:16): [True: 0, False: 0]
  ------------------
  241|      0|          src--;
  242|      0|        }
  243|      0|      }
  244|    676|      src--;
  245|    676|      leftover--;
  246|    676|    }
  247|    450|  }
  248|    984|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (248:7): [True: 840, False: 144]
  ------------------
  249|    840|    full_result r = scalar::base64::base64_tail_decode(
  250|    840|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  251|    840|    r = scalar::base64::patch_tail_result(
  252|    840|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  253|    840|        full_input_length, last_chunk_options);
  254|       |    // When is_partial(last_chunk_options) is true, we must either end with
  255|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  256|       |    // character or at the very beginning of the stream.
  257|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  258|    840|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (258:9): [True: 432, False: 408]
  |  Branch (258:43): [True: 318, False: 114]
  ------------------
  259|    318|        r.input_count < full_input_length) {
  ------------------
  |  Branch (259:9): [True: 286, False: 32]
  ------------------
  260|       |      // First check if we can extend the input to the end of the stream
  261|    854|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (261:14): [True: 848, False: 6]
  ------------------
  262|    848|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (262:14): [True: 568, False: 280]
  ------------------
  263|    568|        r.input_count++;
  264|    568|      }
  265|       |      // If we are still not at the end of the stream, then we must backtrack
  266|       |      // to the last non-ignorable character.
  267|    286|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (267:11): [True: 280, False: 6]
  ------------------
  268|  2.26k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (268:16): [True: 2.19k, False: 68]
  ------------------
  269|  2.19k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (269:16): [True: 1.98k, False: 212]
  ------------------
  270|  1.98k|          r.input_count--;
  271|  1.98k|        }
  272|    280|      }
  273|    286|    }
  274|    840|    return r;
  275|    840|  }
  276|    144|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (276:7): [True: 144, Folded]
  |  Branch (276:26): [True: 0, False: 144]
  ------------------
  277|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (277:9): [True: 0, False: 0]
  ------------------
  278|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (278:9): [True: 0, False: 0]
  ------------------
  279|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  280|      0|              true};
  281|      0|    }
  282|      0|  }
  283|    144|  return {SUCCESS, full_input_length, size_t(dst - dstinit)};
  284|    144|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.89k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.89k|  const uint8_t *to_base64 =
   47|  1.89k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.89k]
  ------------------
   48|  1.89k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.89k, Folded]
  ------------------
   49|  1.89k|                                   : tables::base64::to_base64_value);
   50|  1.89k|  auto ri =
   51|  1.89k|      ignore_garbage
  ------------------
  |  Branch (51:7): [Folded, False: 1.89k]
  ------------------
   52|  1.89k|          ? simdutf::scalar::base64::reduced_input{0, srclen, srclen, srclen}
   53|  1.89k|          : simdutf::scalar::base64::find_end(src, srclen, options);
   54|  1.89k|  size_t equallocation = ri.equallocation;
   55|  1.89k|  size_t equalsigns = ri.equalsigns;
   56|  1.89k|  srclen = ri.srclen;
   57|  1.89k|  size_t full_input_length = ri.full_input_length;
   58|  1.89k|  if (srclen == 0) {
  ------------------
  |  Branch (58:7): [True: 18, False: 1.87k]
  ------------------
   59|     18|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (59:9): [True: 18, Folded]
  |  Branch (59:28): [True: 8, False: 10]
  ------------------
   60|      8|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   61|      8|    }
   62|     10|    return {SUCCESS, full_input_length, 0};
   63|     18|  }
   64|  1.87k|  const chartype *const srcinit = src;
   65|  1.87k|  const char *const dstinit = dst;
   66|  1.87k|  const chartype *srcend = src + srclen;
   67|       |
   68|  1.87k|  constexpr size_t block_size = 6;
   69|  1.87k|  static_assert(block_size >= 2, "block_size must be at least two");
   70|  1.87k|  simdutf_indeterminate char buffer[block_size * 64];
  ------------------
  |  |  194|  1.87k|    #define simdutf_indeterminate __attribute__((uninitialized))
  ------------------
   71|  1.87k|  char *bufferptr = buffer;
   72|       |  // A wide block store writes 4 bytes past its 48. That is safe when the next
   73|       |  // store starts 48 bytes later. Pairs of clean blocks wide-store the first
   74|       |  // and end the second on byte 48. Anything shorter, or a block that is not
   75|       |  // clean, uses the exact store. The pair attempt is only worth it on a long
   76|       |  // input: a short one often fails the first block and then repeats that work.
   77|  1.87k|  if (srclen >= 512) {
  ------------------
  |  Branch (77:7): [True: 956, False: 918]
  ------------------
   78|    956|    const chartype *const srcend128 = src + srclen - 128;
   79|  22.1k|    while (bufferptr == buffer && src <= srcend128) {
  ------------------
  |  Branch (79:12): [True: 22.1k, False: 0]
  |  Branch (79:35): [True: 22.1k, False: 14]
  ------------------
   80|  22.1k|      block64 b0(src);
   81|  22.1k|      uint64_t e0 = 0;
   82|  22.1k|      const uint64_t m0 =
   83|  22.1k|          b0.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e0);
   84|  22.1k|      if ((!ignore_garbage && e0) || m0 != 0) {
  ------------------
  |  Branch (84:12): [True: 22.1k, Folded]
  |  Branch (84:31): [True: 232, False: 21.8k]
  |  Branch (84:38): [True: 304, False: 21.5k]
  ------------------
   85|    536|        break;
   86|    536|      }
   87|  21.5k|      block64 b1(src + 64);
   88|  21.5k|      uint64_t e1 = 0;
   89|  21.5k|      const uint64_t m1 =
   90|  21.5k|          b1.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e1);
   91|  21.5k|      if ((!ignore_garbage && e1) || m1 != 0) {
  ------------------
  |  Branch (91:12): [True: 21.5k, Folded]
  |  Branch (91:31): [True: 208, False: 21.3k]
  |  Branch (91:38): [True: 198, False: 21.1k]
  ------------------
   92|    406|        break;
   93|    406|      }
   94|  21.1k|      b0.base64_decode_block(dst);
   95|  21.1k|      b1.template base64_decode_block<true>(dst + 48);
   96|  21.1k|      src += 128;
   97|  21.1k|      dst += 96;
   98|  21.1k|    }
   99|    956|  }
  100|  1.87k|  if (srclen >= 64) {
  ------------------
  |  Branch (100:7): [True: 1.61k, False: 256]
  ------------------
  101|  1.61k|    const chartype *const srcend64 = srcinit + srclen - 64;
  102|  73.5k|    while (src <= srcend64) {
  ------------------
  |  Branch (102:12): [True: 72.9k, False: 582]
  ------------------
  103|  72.9k|      block64 b(src);
  104|  72.9k|      uint64_t error = 0;
  105|  72.9k|      const uint64_t badcharmask =
  106|  72.9k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
  107|  72.9k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (107:11): [True: 72.9k, Folded]
  |  Branch (107:30): [True: 1.03k, False: 71.9k]
  ------------------
  108|  1.03k|        const size_t error_offset = trailing_zeroes(error);
  109|  1.03k|        return {error_code::INVALID_BASE64_CHARACTER,
  110|  1.03k|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
  111|  1.03k|      }
  112|  71.9k|      if (ignore_garbage && badcharmask != 0) {
  ------------------
  |  Branch (112:11): [Folded, False: 71.9k]
  |  Branch (112:29): [True: 0, False: 0]
  ------------------
  113|      0|        const uint64_t equals = block64(src).equal_sign_mask();
  114|      0|        if (equals != 0) {
  ------------------
  |  Branch (114:13): [True: 0, False: 0]
  ------------------
  115|      0|          const size_t offset = trailing_zeroes(equals);
  116|      0|          equallocation = size_t(src - srcinit) + offset;
  117|      0|          equalsigns = 1;
  118|      0|          srclen = equallocation;
  119|      0|          full_input_length = equallocation + 1;
  120|      0|          if (srclen == 0) {
  ------------------
  |  Branch (120:15): [True: 0, False: 0]
  ------------------
  121|      0|            return {SUCCESS, full_input_length, 0};
  122|      0|          }
  123|      0|          srcend = srcinit + srclen;
  124|      0|          src = srcend;
  125|      0|          bufferptr += b.compress_block(badcharmask | (~uint64_t(0) << offset),
  126|      0|                                        bufferptr);
  127|      0|          break;
  128|      0|        }
  129|      0|      }
  130|  71.9k|      src += 64;
  131|  71.9k|      if (badcharmask != 0) {
  ------------------
  |  Branch (131:11): [True: 44.9k, False: 26.9k]
  ------------------
  132|  44.9k|        bufferptr += b.compress_block(badcharmask, bufferptr);
  133|  44.9k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (133:18): [True: 26.1k, False: 888]
  ------------------
  134|  26.1k|        b.copy_block(bufferptr);
  135|  26.1k|        bufferptr += 64;
  136|  26.1k|      } else {
  137|    888|        b.template base64_decode_block<true>(dst);
  138|    888|        dst += 48;
  139|    888|      }
  140|  71.9k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (140:11): [True: 13.6k, False: 58.2k]
  ------------------
  141|  68.1k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (141:28): [True: 54.4k, False: 13.6k]
  ------------------
  142|  54.4k|          base64_decode_block(dst, buffer + i * 64);
  143|  54.4k|          dst += 48;
  144|  54.4k|        }
  145|  13.6k|        base64_decode_block<true>(dst, buffer + (block_size - 2) * 64);
  146|  13.6k|        dst += 48;
  147|  13.6k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  148|  13.6k|                    64); // 64 might be too much
  149|  13.6k|        bufferptr -= (block_size - 1) * 64;
  150|  13.6k|      }
  151|  71.9k|    }
  152|  1.61k|  }
  153|       |
  154|    838|  if (ignore_garbage && equalsigns == 0) {
  ------------------
  |  Branch (154:7): [Folded, False: 838]
  |  Branch (154:25): [True: 0, False: 0]
  ------------------
  155|      0|    const chartype *equal = src;
  156|      0|    while (equal < srcend && *equal != '=') {
  ------------------
  |  Branch (156:12): [True: 0, False: 0]
  |  Branch (156:30): [True: 0, False: 0]
  ------------------
  157|      0|      equal++;
  158|      0|    }
  159|      0|    if (equal < srcend) {
  ------------------
  |  Branch (159:9): [True: 0, False: 0]
  ------------------
  160|      0|      equallocation = size_t(equal - srcinit);
  161|      0|      equalsigns = 1;
  162|      0|      srclen = equallocation;
  163|      0|      full_input_length = equallocation + 1;
  164|      0|      if (srclen == 0) {
  ------------------
  |  Branch (164:11): [True: 0, False: 0]
  ------------------
  165|      0|        return {SUCCESS, full_input_length, 0};
  166|      0|      }
  167|      0|      srcend = equal;
  168|      0|    }
  169|      0|  }
  170|    838|  char *buffer_start = buffer;
  171|       |  // Optimization note: if this is almost full, then it is worth our
  172|       |  // time, otherwise, we should just decode directly.
  173|    838|  int last_block = (int)((bufferptr - buffer_start) % 64);
  174|    838|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (174:7): [True: 534, False: 304]
  |  Branch (174:26): [True: 68, False: 466]
  ------------------
  175|       |
  176|    846|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (176:12): [True: 796, False: 50]
  |  Branch (176:52): [True: 782, False: 14]
  ------------------
  177|    782|      uint8_t val = to_base64[uint8_t(*src)];
  178|    782|      *bufferptr = char(val);
  179|    782|      if (!ignore_garbage &&
  ------------------
  |  Branch (179:11): [True: 782, Folded]
  ------------------
  180|    782|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (180:12): [True: 0, False: 782]
  |  Branch (180:52): [True: 4, False: 778]
  ------------------
  181|      4|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  182|      4|                size_t(dst - dstinit)};
  183|      4|      }
  184|    778|      bufferptr += (val <= 63 && scalar::base64::is_eight_byte(*src));
  ------------------
  |  Branch (184:21): [True: 608, False: 170]
  |  Branch (184:34): [True: 608, False: 0]
  ------------------
  185|    778|      src++;
  186|    778|    }
  187|     68|  }
  188|       |
  189|  1.27k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (189:10): [True: 438, False: 834]
  ------------------
  190|       |    // 8 payload bytes still in the buffer become 6 output bytes, which cover
  191|       |    // the 4-byte tail of a wide store. Fewer than that, and the tail can
  192|       |    // stick out past the real end.
  193|    438|    const size_t after = size_t(bufferptr - (buffer_start + 64));
  194|    438|    if (after >= 8) {
  ------------------
  |  Branch (194:9): [True: 356, False: 82]
  ------------------
  195|    356|      base64_decode_block(dst, buffer_start);
  196|    356|    } else {
  197|     82|      base64_decode_block<true>(dst, buffer_start);
  198|     82|    }
  199|    438|    dst += 48;
  200|    438|  }
  201|    834|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (201:7): [True: 480, False: 354]
  ------------------
  202|  3.86k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (202:12): [True: 3.38k, False: 480]
  ------------------
  203|  3.38k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  204|  3.38k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  205|  3.38k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  206|  3.38k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  207|  3.38k|                        << 8;
  208|  3.38k|#if !SIMDUTF_IS_BIG_ENDIAN
  209|  3.38k|      triple = scalar::u32_swap_bytes(triple);
  210|  3.38k|#endif
  211|  3.38k|      std::memcpy(dst, &triple, 3);
  212|       |
  213|  3.38k|      dst += 3;
  214|  3.38k|      buffer_start += 4;
  215|  3.38k|    }
  216|    480|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (216:9): [True: 110, False: 370]
  ------------------
  217|    110|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  218|    110|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  219|    110|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  220|    110|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  221|    110|                        << 8;
  222|    110|#if !SIMDUTF_IS_BIG_ENDIAN
  223|    110|      triple = scalar::u32_swap_bytes(triple);
  224|    110|#endif
  225|    110|      std::memcpy(dst, &triple, 3);
  226|       |
  227|    110|      dst += 3;
  228|    110|      buffer_start += 4;
  229|    110|    }
  230|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  231|       |    // backtrack
  232|    480|    int leftover = int(bufferptr - buffer_start);
  233|  1.21k|    while (leftover > 0) {
  ------------------
  |  Branch (233:12): [True: 734, False: 480]
  ------------------
  234|    734|      if (!ignore_garbage) {
  ------------------
  |  Branch (234:11): [True: 734, Folded]
  ------------------
  235|  5.66k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (235:16): [True: 4.92k, False: 734]
  ------------------
  236|  4.92k|          src--;
  237|  4.92k|        }
  238|    734|      } else {
  239|      0|        while (!scalar::base64::is_eight_byte(*(src - 1)) ||
  ------------------
  |  Branch (239:16): [True: 0, False: 0]
  ------------------
  240|      0|               to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (240:16): [True: 0, False: 0]
  ------------------
  241|      0|          src--;
  242|      0|        }
  243|      0|      }
  244|    734|      src--;
  245|    734|      leftover--;
  246|    734|    }
  247|    480|  }
  248|    834|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (248:7): [True: 688, False: 146]
  ------------------
  249|    688|    full_result r = scalar::base64::base64_tail_decode(
  250|    688|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  251|    688|    r = scalar::base64::patch_tail_result(
  252|    688|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  253|    688|        full_input_length, last_chunk_options);
  254|       |    // When is_partial(last_chunk_options) is true, we must either end with
  255|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  256|       |    // character or at the very beginning of the stream.
  257|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  258|    688|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (258:9): [True: 370, False: 318]
  |  Branch (258:43): [True: 336, False: 34]
  ------------------
  259|    336|        r.input_count < full_input_length) {
  ------------------
  |  Branch (259:9): [True: 294, False: 42]
  ------------------
  260|       |      // First check if we can extend the input to the end of the stream
  261|    780|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (261:14): [True: 774, False: 6]
  ------------------
  262|    774|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (262:14): [True: 486, False: 288]
  ------------------
  263|    486|        r.input_count++;
  264|    486|      }
  265|       |      // If we are still not at the end of the stream, then we must backtrack
  266|       |      // to the last non-ignorable character.
  267|    294|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (267:11): [True: 288, False: 6]
  ------------------
  268|  2.01k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (268:16): [True: 1.95k, False: 58]
  ------------------
  269|  1.95k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (269:16): [True: 1.72k, False: 230]
  ------------------
  270|  1.72k|          r.input_count--;
  271|  1.72k|        }
  272|    288|      }
  273|    294|    }
  274|    688|    return r;
  275|    688|  }
  276|    146|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (276:7): [True: 146, Folded]
  |  Branch (276:26): [True: 0, False: 146]
  ------------------
  277|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (277:9): [True: 0, False: 0]
  ------------------
  278|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (278:9): [True: 0, False: 0]
  ------------------
  279|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  280|      0|              true};
  281|      0|    }
  282|      0|  }
  283|    146|  return {SUCCESS, full_input_length, size_t(dst - dstinit)};
  284|    146|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.98k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.98k|  const uint8_t *to_base64 =
   47|  1.98k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.98k]
  ------------------
   48|  1.98k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.98k]
  ------------------
   49|  1.98k|                                   : tables::base64::to_base64_value);
   50|  1.98k|  auto ri =
   51|  1.98k|      ignore_garbage
  ------------------
  |  Branch (51:7): [Folded, False: 1.98k]
  ------------------
   52|  1.98k|          ? simdutf::scalar::base64::reduced_input{0, srclen, srclen, srclen}
   53|  1.98k|          : simdutf::scalar::base64::find_end(src, srclen, options);
   54|  1.98k|  size_t equallocation = ri.equallocation;
   55|  1.98k|  size_t equalsigns = ri.equalsigns;
   56|  1.98k|  srclen = ri.srclen;
   57|  1.98k|  size_t full_input_length = ri.full_input_length;
   58|  1.98k|  if (srclen == 0) {
  ------------------
  |  Branch (58:7): [True: 20, False: 1.96k]
  ------------------
   59|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (59:9): [True: 20, Folded]
  |  Branch (59:28): [True: 10, False: 10]
  ------------------
   60|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   61|     10|    }
   62|     10|    return {SUCCESS, full_input_length, 0};
   63|     20|  }
   64|  1.96k|  const chartype *const srcinit = src;
   65|  1.96k|  const char *const dstinit = dst;
   66|  1.96k|  const chartype *srcend = src + srclen;
   67|       |
   68|  1.96k|  constexpr size_t block_size = 6;
   69|  1.96k|  static_assert(block_size >= 2, "block_size must be at least two");
   70|  1.96k|  simdutf_indeterminate char buffer[block_size * 64];
  ------------------
  |  |  194|  1.96k|    #define simdutf_indeterminate __attribute__((uninitialized))
  ------------------
   71|  1.96k|  char *bufferptr = buffer;
   72|       |  // A wide block store writes 4 bytes past its 48. That is safe when the next
   73|       |  // store starts 48 bytes later. Pairs of clean blocks wide-store the first
   74|       |  // and end the second on byte 48. Anything shorter, or a block that is not
   75|       |  // clean, uses the exact store. The pair attempt is only worth it on a long
   76|       |  // input: a short one often fails the first block and then repeats that work.
   77|  1.96k|  if (srclen >= 512) {
  ------------------
  |  Branch (77:7): [True: 986, False: 974]
  ------------------
   78|    986|    const chartype *const srcend128 = src + srclen - 128;
   79|  34.7k|    while (bufferptr == buffer && src <= srcend128) {
  ------------------
  |  Branch (79:12): [True: 34.7k, False: 0]
  |  Branch (79:35): [True: 34.7k, False: 22]
  ------------------
   80|  34.7k|      block64 b0(src);
   81|  34.7k|      uint64_t e0 = 0;
   82|  34.7k|      const uint64_t m0 =
   83|  34.7k|          b0.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e0);
   84|  34.7k|      if ((!ignore_garbage && e0) || m0 != 0) {
  ------------------
  |  Branch (84:12): [True: 34.7k, Folded]
  |  Branch (84:31): [True: 234, False: 34.5k]
  |  Branch (84:38): [True: 352, False: 34.1k]
  ------------------
   85|    586|        break;
   86|    586|      }
   87|  34.1k|      block64 b1(src + 64);
   88|  34.1k|      uint64_t e1 = 0;
   89|  34.1k|      const uint64_t m1 =
   90|  34.1k|          b1.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e1);
   91|  34.1k|      if ((!ignore_garbage && e1) || m1 != 0) {
  ------------------
  |  Branch (91:12): [True: 34.1k, Folded]
  |  Branch (91:31): [True: 206, False: 33.9k]
  |  Branch (91:38): [True: 172, False: 33.7k]
  ------------------
   92|    378|        break;
   93|    378|      }
   94|  33.7k|      b0.base64_decode_block(dst);
   95|  33.7k|      b1.template base64_decode_block<true>(dst + 48);
   96|  33.7k|      src += 128;
   97|  33.7k|      dst += 96;
   98|  33.7k|    }
   99|    986|  }
  100|  1.96k|  if (srclen >= 64) {
  ------------------
  |  Branch (100:7): [True: 1.66k, False: 300]
  ------------------
  101|  1.66k|    const chartype *const srcend64 = srcinit + srclen - 64;
  102|   146k|    while (src <= srcend64) {
  ------------------
  |  Branch (102:12): [True: 146k, False: 624]
  ------------------
  103|   146k|      block64 b(src);
  104|   146k|      uint64_t error = 0;
  105|   146k|      const uint64_t badcharmask =
  106|   146k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
  107|   146k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (107:11): [True: 146k, Folded]
  |  Branch (107:30): [True: 1.03k, False: 145k]
  ------------------
  108|  1.03k|        const size_t error_offset = trailing_zeroes(error);
  109|  1.03k|        return {error_code::INVALID_BASE64_CHARACTER,
  110|  1.03k|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
  111|  1.03k|      }
  112|   145k|      if (ignore_garbage && badcharmask != 0) {
  ------------------
  |  Branch (112:11): [Folded, False: 145k]
  |  Branch (112:29): [True: 0, False: 0]
  ------------------
  113|      0|        const uint64_t equals = block64(src).equal_sign_mask();
  114|      0|        if (equals != 0) {
  ------------------
  |  Branch (114:13): [True: 0, False: 0]
  ------------------
  115|      0|          const size_t offset = trailing_zeroes(equals);
  116|      0|          equallocation = size_t(src - srcinit) + offset;
  117|      0|          equalsigns = 1;
  118|      0|          srclen = equallocation;
  119|      0|          full_input_length = equallocation + 1;
  120|      0|          if (srclen == 0) {
  ------------------
  |  Branch (120:15): [True: 0, False: 0]
  ------------------
  121|      0|            return {SUCCESS, full_input_length, 0};
  122|      0|          }
  123|      0|          srcend = srcinit + srclen;
  124|      0|          src = srcend;
  125|      0|          bufferptr += b.compress_block(badcharmask | (~uint64_t(0) << offset),
  126|      0|                                        bufferptr);
  127|      0|          break;
  128|      0|        }
  129|      0|      }
  130|   145k|      src += 64;
  131|   145k|      if (badcharmask != 0) {
  ------------------
  |  Branch (131:11): [True: 60.8k, False: 84.2k]
  ------------------
  132|  60.8k|        bufferptr += b.compress_block(badcharmask, bufferptr);
  133|  84.2k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (133:18): [True: 83.5k, False: 748]
  ------------------
  134|  83.5k|        b.copy_block(bufferptr);
  135|  83.5k|        bufferptr += 64;
  136|  83.5k|      } else {
  137|    748|        b.template base64_decode_block<true>(dst);
  138|    748|        dst += 48;
  139|    748|      }
  140|   145k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (140:11): [True: 27.9k, False: 117k]
  ------------------
  141|   139k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (141:28): [True: 111k, False: 27.9k]
  ------------------
  142|   111k|          base64_decode_block(dst, buffer + i * 64);
  143|   111k|          dst += 48;
  144|   111k|        }
  145|  27.9k|        base64_decode_block<true>(dst, buffer + (block_size - 2) * 64);
  146|  27.9k|        dst += 48;
  147|  27.9k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  148|  27.9k|                    64); // 64 might be too much
  149|  27.9k|        bufferptr -= (block_size - 1) * 64;
  150|  27.9k|      }
  151|   145k|    }
  152|  1.66k|  }
  153|       |
  154|    924|  if (ignore_garbage && equalsigns == 0) {
  ------------------
  |  Branch (154:7): [Folded, False: 924]
  |  Branch (154:25): [True: 0, False: 0]
  ------------------
  155|      0|    const chartype *equal = src;
  156|      0|    while (equal < srcend && *equal != '=') {
  ------------------
  |  Branch (156:12): [True: 0, False: 0]
  |  Branch (156:30): [True: 0, False: 0]
  ------------------
  157|      0|      equal++;
  158|      0|    }
  159|      0|    if (equal < srcend) {
  ------------------
  |  Branch (159:9): [True: 0, False: 0]
  ------------------
  160|      0|      equallocation = size_t(equal - srcinit);
  161|      0|      equalsigns = 1;
  162|      0|      srclen = equallocation;
  163|      0|      full_input_length = equallocation + 1;
  164|      0|      if (srclen == 0) {
  ------------------
  |  Branch (164:11): [True: 0, False: 0]
  ------------------
  165|      0|        return {SUCCESS, full_input_length, 0};
  166|      0|      }
  167|      0|      srcend = equal;
  168|      0|    }
  169|      0|  }
  170|    924|  char *buffer_start = buffer;
  171|       |  // Optimization note: if this is almost full, then it is worth our
  172|       |  // time, otherwise, we should just decode directly.
  173|    924|  int last_block = (int)((bufferptr - buffer_start) % 64);
  174|    924|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (174:7): [True: 572, False: 352]
  |  Branch (174:26): [True: 86, False: 486]
  ------------------
  175|       |
  176|  1.12k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (176:12): [True: 1.06k, False: 64]
  |  Branch (176:52): [True: 1.04k, False: 16]
  ------------------
  177|  1.04k|      uint8_t val = to_base64[uint8_t(*src)];
  178|  1.04k|      *bufferptr = char(val);
  179|  1.04k|      if (!ignore_garbage &&
  ------------------
  |  Branch (179:11): [True: 1.04k, Folded]
  ------------------
  180|  1.04k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (180:12): [True: 0, False: 1.04k]
  |  Branch (180:52): [True: 6, False: 1.03k]
  ------------------
  181|      6|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  182|      6|                size_t(dst - dstinit)};
  183|      6|      }
  184|  1.03k|      bufferptr += (val <= 63 && scalar::base64::is_eight_byte(*src));
  ------------------
  |  Branch (184:21): [True: 832, False: 206]
  |  Branch (184:34): [True: 832, False: 0]
  ------------------
  185|  1.03k|      src++;
  186|  1.03k|    }
  187|     86|  }
  188|       |
  189|  1.39k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (189:10): [True: 472, False: 918]
  ------------------
  190|       |    // 8 payload bytes still in the buffer become 6 output bytes, which cover
  191|       |    // the 4-byte tail of a wide store. Fewer than that, and the tail can
  192|       |    // stick out past the real end.
  193|    472|    const size_t after = size_t(bufferptr - (buffer_start + 64));
  194|    472|    if (after >= 8) {
  ------------------
  |  Branch (194:9): [True: 382, False: 90]
  ------------------
  195|    382|      base64_decode_block(dst, buffer_start);
  196|    382|    } else {
  197|     90|      base64_decode_block<true>(dst, buffer_start);
  198|     90|    }
  199|    472|    dst += 48;
  200|    472|  }
  201|    918|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (201:7): [True: 502, False: 416]
  ------------------
  202|  4.22k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (202:12): [True: 3.71k, False: 502]
  ------------------
  203|  3.71k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  204|  3.71k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  205|  3.71k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  206|  3.71k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  207|  3.71k|                        << 8;
  208|  3.71k|#if !SIMDUTF_IS_BIG_ENDIAN
  209|  3.71k|      triple = scalar::u32_swap_bytes(triple);
  210|  3.71k|#endif
  211|  3.71k|      std::memcpy(dst, &triple, 3);
  212|       |
  213|  3.71k|      dst += 3;
  214|  3.71k|      buffer_start += 4;
  215|  3.71k|    }
  216|    502|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (216:9): [True: 128, False: 374]
  ------------------
  217|    128|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  218|    128|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  219|    128|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  220|    128|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  221|    128|                        << 8;
  222|    128|#if !SIMDUTF_IS_BIG_ENDIAN
  223|    128|      triple = scalar::u32_swap_bytes(triple);
  224|    128|#endif
  225|    128|      std::memcpy(dst, &triple, 3);
  226|       |
  227|    128|      dst += 3;
  228|    128|      buffer_start += 4;
  229|    128|    }
  230|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  231|       |    // backtrack
  232|    502|    int leftover = int(bufferptr - buffer_start);
  233|  1.27k|    while (leftover > 0) {
  ------------------
  |  Branch (233:12): [True: 768, False: 502]
  ------------------
  234|    768|      if (!ignore_garbage) {
  ------------------
  |  Branch (234:11): [True: 768, Folded]
  ------------------
  235|  7.17k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (235:16): [True: 6.40k, False: 768]
  ------------------
  236|  6.40k|          src--;
  237|  6.40k|        }
  238|    768|      } else {
  239|      0|        while (!scalar::base64::is_eight_byte(*(src - 1)) ||
  ------------------
  |  Branch (239:16): [True: 0, False: 0]
  ------------------
  240|      0|               to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (240:16): [True: 0, False: 0]
  ------------------
  241|      0|          src--;
  242|      0|        }
  243|      0|      }
  244|    768|      src--;
  245|    768|      leftover--;
  246|    768|    }
  247|    502|  }
  248|    918|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (248:7): [True: 768, False: 150]
  ------------------
  249|    768|    full_result r = scalar::base64::base64_tail_decode(
  250|    768|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  251|    768|    r = scalar::base64::patch_tail_result(
  252|    768|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  253|    768|        full_input_length, last_chunk_options);
  254|       |    // When is_partial(last_chunk_options) is true, we must either end with
  255|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  256|       |    // character or at the very beginning of the stream.
  257|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  258|    768|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (258:9): [True: 362, False: 406]
  |  Branch (258:43): [True: 336, False: 26]
  ------------------
  259|    336|        r.input_count < full_input_length) {
  ------------------
  |  Branch (259:9): [True: 262, False: 74]
  ------------------
  260|       |      // First check if we can extend the input to the end of the stream
  261|    642|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (261:14): [True: 634, False: 8]
  ------------------
  262|    634|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (262:14): [True: 380, False: 254]
  ------------------
  263|    380|        r.input_count++;
  264|    380|      }
  265|       |      // If we are still not at the end of the stream, then we must backtrack
  266|       |      // to the last non-ignorable character.
  267|    262|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (267:11): [True: 254, False: 8]
  ------------------
  268|  1.95k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (268:16): [True: 1.89k, False: 52]
  ------------------
  269|  1.89k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (269:16): [True: 1.69k, False: 202]
  ------------------
  270|  1.69k|          r.input_count--;
  271|  1.69k|        }
  272|    254|      }
  273|    262|    }
  274|    768|    return r;
  275|    768|  }
  276|    150|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (276:7): [True: 150, Folded]
  |  Branch (276:26): [True: 0, False: 150]
  ------------------
  277|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (277:9): [True: 0, False: 0]
  ------------------
  278|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (278:9): [True: 0, False: 0]
  ------------------
  279|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  280|      0|              true};
  281|      0|    }
  282|      0|  }
  283|    150|  return {SUCCESS, full_input_length, size_t(dst - dstinit)};
  284|    150|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.92k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.92k|  const uint8_t *to_base64 =
   47|  1.92k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.92k]
  ------------------
   48|  1.92k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.92k, Folded]
  ------------------
   49|  1.92k|                                   : tables::base64::to_base64_value);
   50|  1.92k|  auto ri =
   51|  1.92k|      ignore_garbage
  ------------------
  |  Branch (51:7): [Folded, False: 1.92k]
  ------------------
   52|  1.92k|          ? simdutf::scalar::base64::reduced_input{0, srclen, srclen, srclen}
   53|  1.92k|          : simdutf::scalar::base64::find_end(src, srclen, options);
   54|  1.92k|  size_t equallocation = ri.equallocation;
   55|  1.92k|  size_t equalsigns = ri.equalsigns;
   56|  1.92k|  srclen = ri.srclen;
   57|  1.92k|  size_t full_input_length = ri.full_input_length;
   58|  1.92k|  if (srclen == 0) {
  ------------------
  |  Branch (58:7): [True: 12, False: 1.91k]
  ------------------
   59|     12|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (59:9): [True: 12, Folded]
  |  Branch (59:28): [True: 8, False: 4]
  ------------------
   60|      8|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   61|      8|    }
   62|      4|    return {SUCCESS, full_input_length, 0};
   63|     12|  }
   64|  1.91k|  const chartype *const srcinit = src;
   65|  1.91k|  const char *const dstinit = dst;
   66|  1.91k|  const chartype *srcend = src + srclen;
   67|       |
   68|  1.91k|  constexpr size_t block_size = 6;
   69|  1.91k|  static_assert(block_size >= 2, "block_size must be at least two");
   70|  1.91k|  simdutf_indeterminate char buffer[block_size * 64];
  ------------------
  |  |  194|  1.91k|    #define simdutf_indeterminate __attribute__((uninitialized))
  ------------------
   71|  1.91k|  char *bufferptr = buffer;
   72|       |  // A wide block store writes 4 bytes past its 48. That is safe when the next
   73|       |  // store starts 48 bytes later. Pairs of clean blocks wide-store the first
   74|       |  // and end the second on byte 48. Anything shorter, or a block that is not
   75|       |  // clean, uses the exact store. The pair attempt is only worth it on a long
   76|       |  // input: a short one often fails the first block and then repeats that work.
   77|  1.91k|  if (srclen >= 512) {
  ------------------
  |  Branch (77:7): [True: 818, False: 1.09k]
  ------------------
   78|    818|    const chartype *const srcend128 = src + srclen - 128;
   79|  1.16k|    while (bufferptr == buffer && src <= srcend128) {
  ------------------
  |  Branch (79:12): [True: 1.16k, False: 0]
  |  Branch (79:35): [True: 1.15k, False: 10]
  ------------------
   80|  1.15k|      block64 b0(src);
   81|  1.15k|      uint64_t e0 = 0;
   82|  1.15k|      const uint64_t m0 =
   83|  1.15k|          b0.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e0);
   84|  1.15k|      if ((!ignore_garbage && e0) || m0 != 0) {
  ------------------
  |  Branch (84:12): [True: 1.15k, Folded]
  |  Branch (84:31): [True: 206, False: 950]
  |  Branch (84:38): [True: 306, False: 644]
  ------------------
   85|    512|        break;
   86|    512|      }
   87|    644|      block64 b1(src + 64);
   88|    644|      uint64_t e1 = 0;
   89|    644|      const uint64_t m1 =
   90|    644|          b1.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e1);
   91|    644|      if ((!ignore_garbage && e1) || m1 != 0) {
  ------------------
  |  Branch (91:12): [True: 644, Folded]
  |  Branch (91:31): [True: 162, False: 482]
  |  Branch (91:38): [True: 134, False: 348]
  ------------------
   92|    296|        break;
   93|    296|      }
   94|    348|      b0.base64_decode_block(dst);
   95|    348|      b1.template base64_decode_block<true>(dst + 48);
   96|    348|      src += 128;
   97|    348|      dst += 96;
   98|    348|    }
   99|    818|  }
  100|  1.91k|  if (srclen >= 64) {
  ------------------
  |  Branch (100:7): [True: 1.46k, False: 446]
  ------------------
  101|  1.46k|    const chartype *const srcend64 = srcinit + srclen - 64;
  102|  26.3k|    while (src <= srcend64) {
  ------------------
  |  Branch (102:12): [True: 25.7k, False: 580]
  ------------------
  103|  25.7k|      block64 b(src);
  104|  25.7k|      uint64_t error = 0;
  105|  25.7k|      const uint64_t badcharmask =
  106|  25.7k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
  107|  25.7k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (107:11): [True: 25.7k, Folded]
  |  Branch (107:30): [True: 884, False: 24.8k]
  ------------------
  108|    884|        const size_t error_offset = trailing_zeroes(error);
  109|    884|        return {error_code::INVALID_BASE64_CHARACTER,
  110|    884|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
  111|    884|      }
  112|  24.8k|      if (ignore_garbage && badcharmask != 0) {
  ------------------
  |  Branch (112:11): [Folded, False: 24.8k]
  |  Branch (112:29): [True: 0, False: 0]
  ------------------
  113|      0|        const uint64_t equals = block64(src).equal_sign_mask();
  114|      0|        if (equals != 0) {
  ------------------
  |  Branch (114:13): [True: 0, False: 0]
  ------------------
  115|      0|          const size_t offset = trailing_zeroes(equals);
  116|      0|          equallocation = size_t(src - srcinit) + offset;
  117|      0|          equalsigns = 1;
  118|      0|          srclen = equallocation;
  119|      0|          full_input_length = equallocation + 1;
  120|      0|          if (srclen == 0) {
  ------------------
  |  Branch (120:15): [True: 0, False: 0]
  ------------------
  121|      0|            return {SUCCESS, full_input_length, 0};
  122|      0|          }
  123|      0|          srcend = srcinit + srclen;
  124|      0|          src = srcend;
  125|      0|          bufferptr += b.compress_block(badcharmask | (~uint64_t(0) << offset),
  126|      0|                                        bufferptr);
  127|      0|          break;
  128|      0|        }
  129|      0|      }
  130|  24.8k|      src += 64;
  131|  24.8k|      if (badcharmask != 0) {
  ------------------
  |  Branch (131:11): [True: 20.3k, False: 4.54k]
  ------------------
  132|  20.3k|        bufferptr += b.compress_block(badcharmask, bufferptr);
  133|  20.3k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (133:18): [True: 4.02k, False: 512]
  ------------------
  134|  4.02k|        b.copy_block(bufferptr);
  135|  4.02k|        bufferptr += 64;
  136|  4.02k|      } else {
  137|    512|        b.template base64_decode_block<true>(dst);
  138|    512|        dst += 48;
  139|    512|      }
  140|  24.8k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (140:11): [True: 4.46k, False: 20.3k]
  ------------------
  141|  22.3k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (141:28): [True: 17.8k, False: 4.46k]
  ------------------
  142|  17.8k|          base64_decode_block(dst, buffer + i * 64);
  143|  17.8k|          dst += 48;
  144|  17.8k|        }
  145|  4.46k|        base64_decode_block<true>(dst, buffer + (block_size - 2) * 64);
  146|  4.46k|        dst += 48;
  147|  4.46k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  148|  4.46k|                    64); // 64 might be too much
  149|  4.46k|        bufferptr -= (block_size - 1) * 64;
  150|  4.46k|      }
  151|  24.8k|    }
  152|  1.46k|  }
  153|       |
  154|  1.02k|  if (ignore_garbage && equalsigns == 0) {
  ------------------
  |  Branch (154:7): [Folded, False: 1.02k]
  |  Branch (154:25): [True: 0, False: 0]
  ------------------
  155|      0|    const chartype *equal = src;
  156|      0|    while (equal < srcend && *equal != '=') {
  ------------------
  |  Branch (156:12): [True: 0, False: 0]
  |  Branch (156:30): [True: 0, False: 0]
  ------------------
  157|      0|      equal++;
  158|      0|    }
  159|      0|    if (equal < srcend) {
  ------------------
  |  Branch (159:9): [True: 0, False: 0]
  ------------------
  160|      0|      equallocation = size_t(equal - srcinit);
  161|      0|      equalsigns = 1;
  162|      0|      srclen = equallocation;
  163|      0|      full_input_length = equallocation + 1;
  164|      0|      if (srclen == 0) {
  ------------------
  |  Branch (164:11): [True: 0, False: 0]
  ------------------
  165|      0|        return {SUCCESS, full_input_length, 0};
  166|      0|      }
  167|      0|      srcend = equal;
  168|      0|    }
  169|      0|  }
  170|  1.02k|  char *buffer_start = buffer;
  171|       |  // Optimization note: if this is almost full, then it is worth our
  172|       |  // time, otherwise, we should just decode directly.
  173|  1.02k|  int last_block = (int)((bufferptr - buffer_start) % 64);
  174|  1.02k|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (174:7): [True: 544, False: 482]
  |  Branch (174:26): [True: 100, False: 444]
  ------------------
  175|       |
  176|    788|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (176:12): [True: 742, False: 46]
  |  Branch (176:52): [True: 726, False: 16]
  ------------------
  177|    726|      uint8_t val = to_base64[uint8_t(*src)];
  178|    726|      *bufferptr = char(val);
  179|    726|      if (!ignore_garbage &&
  ------------------
  |  Branch (179:11): [True: 726, Folded]
  ------------------
  180|    726|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (180:12): [True: 22, False: 704]
  |  Branch (180:52): [True: 16, False: 688]
  ------------------
  181|     38|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  182|     38|                size_t(dst - dstinit)};
  183|     38|      }
  184|    688|      bufferptr += (val <= 63 && scalar::base64::is_eight_byte(*src));
  ------------------
  |  Branch (184:21): [True: 276, False: 412]
  |  Branch (184:34): [True: 276, False: 0]
  ------------------
  185|    688|      src++;
  186|    688|    }
  187|    100|  }
  188|       |
  189|  1.35k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (189:10): [True: 362, False: 988]
  ------------------
  190|       |    // 8 payload bytes still in the buffer become 6 output bytes, which cover
  191|       |    // the 4-byte tail of a wide store. Fewer than that, and the tail can
  192|       |    // stick out past the real end.
  193|    362|    const size_t after = size_t(bufferptr - (buffer_start + 64));
  194|    362|    if (after >= 8) {
  ------------------
  |  Branch (194:9): [True: 298, False: 64]
  ------------------
  195|    298|      base64_decode_block(dst, buffer_start);
  196|    298|    } else {
  197|     64|      base64_decode_block<true>(dst, buffer_start);
  198|     64|    }
  199|    362|    dst += 48;
  200|    362|  }
  201|    988|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (201:7): [True: 460, False: 528]
  ------------------
  202|  3.77k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (202:12): [True: 3.31k, False: 460]
  ------------------
  203|  3.31k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  204|  3.31k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  205|  3.31k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  206|  3.31k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  207|  3.31k|                        << 8;
  208|  3.31k|#if !SIMDUTF_IS_BIG_ENDIAN
  209|  3.31k|      triple = scalar::u32_swap_bytes(triple);
  210|  3.31k|#endif
  211|  3.31k|      std::memcpy(dst, &triple, 3);
  212|       |
  213|  3.31k|      dst += 3;
  214|  3.31k|      buffer_start += 4;
  215|  3.31k|    }
  216|    460|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (216:9): [True: 124, False: 336]
  ------------------
  217|    124|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  218|    124|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  219|    124|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  220|    124|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  221|    124|                        << 8;
  222|    124|#if !SIMDUTF_IS_BIG_ENDIAN
  223|    124|      triple = scalar::u32_swap_bytes(triple);
  224|    124|#endif
  225|    124|      std::memcpy(dst, &triple, 3);
  226|       |
  227|    124|      dst += 3;
  228|    124|      buffer_start += 4;
  229|    124|    }
  230|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  231|       |    // backtrack
  232|    460|    int leftover = int(bufferptr - buffer_start);
  233|  1.10k|    while (leftover > 0) {
  ------------------
  |  Branch (233:12): [True: 642, False: 460]
  ------------------
  234|    642|      if (!ignore_garbage) {
  ------------------
  |  Branch (234:11): [True: 642, Folded]
  ------------------
  235|  6.59k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (235:16): [True: 5.94k, False: 642]
  ------------------
  236|  5.94k|          src--;
  237|  5.94k|        }
  238|    642|      } else {
  239|      0|        while (!scalar::base64::is_eight_byte(*(src - 1)) ||
  ------------------
  |  Branch (239:16): [True: 0, False: 0]
  ------------------
  240|      0|               to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (240:16): [True: 0, False: 0]
  ------------------
  241|      0|          src--;
  242|      0|        }
  243|      0|      }
  244|    642|      src--;
  245|    642|      leftover--;
  246|    642|    }
  247|    460|  }
  248|    988|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (248:7): [True: 834, False: 154]
  ------------------
  249|    834|    full_result r = scalar::base64::base64_tail_decode(
  250|    834|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  251|    834|    r = scalar::base64::patch_tail_result(
  252|    834|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  253|    834|        full_input_length, last_chunk_options);
  254|       |    // When is_partial(last_chunk_options) is true, we must either end with
  255|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  256|       |    // character or at the very beginning of the stream.
  257|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  258|    834|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (258:9): [True: 466, False: 368]
  |  Branch (258:43): [True: 338, False: 128]
  ------------------
  259|    338|        r.input_count < full_input_length) {
  ------------------
  |  Branch (259:9): [True: 298, False: 40]
  ------------------
  260|       |      // First check if we can extend the input to the end of the stream
  261|    930|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (261:14): [True: 924, False: 6]
  ------------------
  262|    924|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (262:14): [True: 632, False: 292]
  ------------------
  263|    632|        r.input_count++;
  264|    632|      }
  265|       |      // If we are still not at the end of the stream, then we must backtrack
  266|       |      // to the last non-ignorable character.
  267|    298|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (267:11): [True: 292, False: 6]
  ------------------
  268|  1.98k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (268:16): [True: 1.90k, False: 84]
  ------------------
  269|  1.90k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (269:16): [True: 1.69k, False: 208]
  ------------------
  270|  1.69k|          r.input_count--;
  271|  1.69k|        }
  272|    292|      }
  273|    298|    }
  274|    834|    return r;
  275|    834|  }
  276|    154|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (276:7): [True: 154, Folded]
  |  Branch (276:26): [True: 0, False: 154]
  ------------------
  277|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (277:9): [True: 0, False: 0]
  ------------------
  278|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (278:9): [True: 0, False: 0]
  ------------------
  279|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  280|      0|              true};
  281|      0|    }
  282|      0|  }
  283|    154|  return {SUCCESS, full_input_length, size_t(dst - dstinit)};
  284|    154|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.94k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.94k|  const uint8_t *to_base64 =
   47|  1.94k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.94k]
  ------------------
   48|  1.94k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.94k]
  ------------------
   49|  1.94k|                                   : tables::base64::to_base64_value);
   50|  1.94k|  auto ri =
   51|  1.94k|      ignore_garbage
  ------------------
  |  Branch (51:7): [Folded, False: 1.94k]
  ------------------
   52|  1.94k|          ? simdutf::scalar::base64::reduced_input{0, srclen, srclen, srclen}
   53|  1.94k|          : simdutf::scalar::base64::find_end(src, srclen, options);
   54|  1.94k|  size_t equallocation = ri.equallocation;
   55|  1.94k|  size_t equalsigns = ri.equalsigns;
   56|  1.94k|  srclen = ri.srclen;
   57|  1.94k|  size_t full_input_length = ri.full_input_length;
   58|  1.94k|  if (srclen == 0) {
  ------------------
  |  Branch (58:7): [True: 28, False: 1.91k]
  ------------------
   59|     28|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (59:9): [True: 28, Folded]
  |  Branch (59:28): [True: 12, False: 16]
  ------------------
   60|     12|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   61|     12|    }
   62|     16|    return {SUCCESS, full_input_length, 0};
   63|     28|  }
   64|  1.91k|  const chartype *const srcinit = src;
   65|  1.91k|  const char *const dstinit = dst;
   66|  1.91k|  const chartype *srcend = src + srclen;
   67|       |
   68|  1.91k|  constexpr size_t block_size = 6;
   69|  1.91k|  static_assert(block_size >= 2, "block_size must be at least two");
   70|  1.91k|  simdutf_indeterminate char buffer[block_size * 64];
  ------------------
  |  |  194|  1.91k|    #define simdutf_indeterminate __attribute__((uninitialized))
  ------------------
   71|  1.91k|  char *bufferptr = buffer;
   72|       |  // A wide block store writes 4 bytes past its 48. That is safe when the next
   73|       |  // store starts 48 bytes later. Pairs of clean blocks wide-store the first
   74|       |  // and end the second on byte 48. Anything shorter, or a block that is not
   75|       |  // clean, uses the exact store. The pair attempt is only worth it on a long
   76|       |  // input: a short one often fails the first block and then repeats that work.
   77|  1.91k|  if (srclen >= 512) {
  ------------------
  |  Branch (77:7): [True: 836, False: 1.08k]
  ------------------
   78|    836|    const chartype *const srcend128 = src + srclen - 128;
   79|  1.25k|    while (bufferptr == buffer && src <= srcend128) {
  ------------------
  |  Branch (79:12): [True: 1.25k, False: 0]
  |  Branch (79:35): [True: 1.23k, False: 16]
  ------------------
   80|  1.23k|      block64 b0(src);
   81|  1.23k|      uint64_t e0 = 0;
   82|  1.23k|      const uint64_t m0 =
   83|  1.23k|          b0.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e0);
   84|  1.23k|      if ((!ignore_garbage && e0) || m0 != 0) {
  ------------------
  |  Branch (84:12): [True: 1.23k, Folded]
  |  Branch (84:31): [True: 200, False: 1.03k]
  |  Branch (84:38): [True: 288, False: 748]
  ------------------
   85|    488|        break;
   86|    488|      }
   87|    748|      block64 b1(src + 64);
   88|    748|      uint64_t e1 = 0;
   89|    748|      const uint64_t m1 =
   90|    748|          b1.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&e1);
   91|    748|      if ((!ignore_garbage && e1) || m1 != 0) {
  ------------------
  |  Branch (91:12): [True: 748, Folded]
  |  Branch (91:31): [True: 174, False: 574]
  |  Branch (91:38): [True: 158, False: 416]
  ------------------
   92|    332|        break;
   93|    332|      }
   94|    416|      b0.base64_decode_block(dst);
   95|    416|      b1.template base64_decode_block<true>(dst + 48);
   96|    416|      src += 128;
   97|    416|      dst += 96;
   98|    416|    }
   99|    836|  }
  100|  1.91k|  if (srclen >= 64) {
  ------------------
  |  Branch (100:7): [True: 1.47k, False: 446]
  ------------------
  101|  1.47k|    const chartype *const srcend64 = srcinit + srclen - 64;
  102|  80.2k|    while (src <= srcend64) {
  ------------------
  |  Branch (102:12): [True: 79.7k, False: 580]
  ------------------
  103|  79.7k|      block64 b(src);
  104|  79.7k|      uint64_t error = 0;
  105|  79.7k|      const uint64_t badcharmask =
  106|  79.7k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
  107|  79.7k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (107:11): [True: 79.7k, Folded]
  |  Branch (107:30): [True: 892, False: 78.8k]
  ------------------
  108|    892|        const size_t error_offset = trailing_zeroes(error);
  109|    892|        return {error_code::INVALID_BASE64_CHARACTER,
  110|    892|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
  111|    892|      }
  112|  78.8k|      if (ignore_garbage && badcharmask != 0) {
  ------------------
  |  Branch (112:11): [Folded, False: 78.8k]
  |  Branch (112:29): [True: 0, False: 0]
  ------------------
  113|      0|        const uint64_t equals = block64(src).equal_sign_mask();
  114|      0|        if (equals != 0) {
  ------------------
  |  Branch (114:13): [True: 0, False: 0]
  ------------------
  115|      0|          const size_t offset = trailing_zeroes(equals);
  116|      0|          equallocation = size_t(src - srcinit) + offset;
  117|      0|          equalsigns = 1;
  118|      0|          srclen = equallocation;
  119|      0|          full_input_length = equallocation + 1;
  120|      0|          if (srclen == 0) {
  ------------------
  |  Branch (120:15): [True: 0, False: 0]
  ------------------
  121|      0|            return {SUCCESS, full_input_length, 0};
  122|      0|          }
  123|      0|          srcend = srcinit + srclen;
  124|      0|          src = srcend;
  125|      0|          bufferptr += b.compress_block(badcharmask | (~uint64_t(0) << offset),
  126|      0|                                        bufferptr);
  127|      0|          break;
  128|      0|        }
  129|      0|      }
  130|  78.8k|      src += 64;
  131|  78.8k|      if (badcharmask != 0) {
  ------------------
  |  Branch (131:11): [True: 61.8k, False: 17.0k]
  ------------------
  132|  61.8k|        bufferptr += b.compress_block(badcharmask, bufferptr);
  133|  61.8k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (133:18): [True: 16.4k, False: 592]
  ------------------
  134|  16.4k|        b.copy_block(bufferptr);
  135|  16.4k|        bufferptr += 64;
  136|  16.4k|      } else {
  137|    592|        b.template base64_decode_block<true>(dst);
  138|    592|        dst += 48;
  139|    592|      }
  140|  78.8k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (140:11): [True: 15.1k, False: 63.6k]
  ------------------
  141|  75.6k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (141:28): [True: 60.5k, False: 15.1k]
  ------------------
  142|  60.5k|          base64_decode_block(dst, buffer + i * 64);
  143|  60.5k|          dst += 48;
  144|  60.5k|        }
  145|  15.1k|        base64_decode_block<true>(dst, buffer + (block_size - 2) * 64);
  146|  15.1k|        dst += 48;
  147|  15.1k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  148|  15.1k|                    64); // 64 might be too much
  149|  15.1k|        bufferptr -= (block_size - 1) * 64;
  150|  15.1k|      }
  151|  78.8k|    }
  152|  1.47k|  }
  153|       |
  154|  1.02k|  if (ignore_garbage && equalsigns == 0) {
  ------------------
  |  Branch (154:7): [Folded, False: 1.02k]
  |  Branch (154:25): [True: 0, False: 0]
  ------------------
  155|      0|    const chartype *equal = src;
  156|      0|    while (equal < srcend && *equal != '=') {
  ------------------
  |  Branch (156:12): [True: 0, False: 0]
  |  Branch (156:30): [True: 0, False: 0]
  ------------------
  157|      0|      equal++;
  158|      0|    }
  159|      0|    if (equal < srcend) {
  ------------------
  |  Branch (159:9): [True: 0, False: 0]
  ------------------
  160|      0|      equallocation = size_t(equal - srcinit);
  161|      0|      equalsigns = 1;
  162|      0|      srclen = equallocation;
  163|      0|      full_input_length = equallocation + 1;
  164|      0|      if (srclen == 0) {
  ------------------
  |  Branch (164:11): [True: 0, False: 0]
  ------------------
  165|      0|        return {SUCCESS, full_input_length, 0};
  166|      0|      }
  167|      0|      srcend = equal;
  168|      0|    }
  169|      0|  }
  170|  1.02k|  char *buffer_start = buffer;
  171|       |  // Optimization note: if this is almost full, then it is worth our
  172|       |  // time, otherwise, we should just decode directly.
  173|  1.02k|  int last_block = (int)((bufferptr - buffer_start) % 64);
  174|  1.02k|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (174:7): [True: 534, False: 492]
  |  Branch (174:26): [True: 102, False: 432]
  ------------------
  175|       |
  176|    958|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (176:12): [True: 916, False: 42]
  |  Branch (176:52): [True: 898, False: 18]
  ------------------
  177|    898|      uint8_t val = to_base64[uint8_t(*src)];
  178|    898|      *bufferptr = char(val);
  179|    898|      if (!ignore_garbage &&
  ------------------
  |  Branch (179:11): [True: 898, Folded]
  ------------------
  180|    898|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (180:12): [True: 26, False: 872]
  |  Branch (180:52): [True: 16, False: 856]
  ------------------
  181|     42|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  182|     42|                size_t(dst - dstinit)};
  183|     42|      }
  184|    856|      bufferptr += (val <= 63 && scalar::base64::is_eight_byte(*src));
  ------------------
  |  Branch (184:21): [True: 274, False: 582]
  |  Branch (184:34): [True: 274, False: 0]
  ------------------
  185|    856|      src++;
  186|    856|    }
  187|    102|  }
  188|       |
  189|  1.30k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (189:10): [True: 324, False: 984]
  ------------------
  190|       |    // 8 payload bytes still in the buffer become 6 output bytes, which cover
  191|       |    // the 4-byte tail of a wide store. Fewer than that, and the tail can
  192|       |    // stick out past the real end.
  193|    324|    const size_t after = size_t(bufferptr - (buffer_start + 64));
  194|    324|    if (after >= 8) {
  ------------------
  |  Branch (194:9): [True: 264, False: 60]
  ------------------
  195|    264|      base64_decode_block(dst, buffer_start);
  196|    264|    } else {
  197|     60|      base64_decode_block<true>(dst, buffer_start);
  198|     60|    }
  199|    324|    dst += 48;
  200|    324|  }
  201|    984|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (201:7): [True: 450, False: 534]
  ------------------
  202|  3.71k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (202:12): [True: 3.26k, False: 450]
  ------------------
  203|  3.26k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  204|  3.26k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  205|  3.26k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  206|  3.26k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  207|  3.26k|                        << 8;
  208|  3.26k|#if !SIMDUTF_IS_BIG_ENDIAN
  209|  3.26k|      triple = scalar::u32_swap_bytes(triple);
  210|  3.26k|#endif
  211|  3.26k|      std::memcpy(dst, &triple, 3);
  212|       |
  213|  3.26k|      dst += 3;
  214|  3.26k|      buffer_start += 4;
  215|  3.26k|    }
  216|    450|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (216:9): [True: 118, False: 332]
  ------------------
  217|    118|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  218|    118|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  219|    118|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  220|    118|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  221|    118|                        << 8;
  222|    118|#if !SIMDUTF_IS_BIG_ENDIAN
  223|    118|      triple = scalar::u32_swap_bytes(triple);
  224|    118|#endif
  225|    118|      std::memcpy(dst, &triple, 3);
  226|       |
  227|    118|      dst += 3;
  228|    118|      buffer_start += 4;
  229|    118|    }
  230|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  231|       |    // backtrack
  232|    450|    int leftover = int(bufferptr - buffer_start);
  233|  1.12k|    while (leftover > 0) {
  ------------------
  |  Branch (233:12): [True: 676, False: 450]
  ------------------
  234|    676|      if (!ignore_garbage) {
  ------------------
  |  Branch (234:11): [True: 676, Folded]
  ------------------
  235|  6.34k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (235:16): [True: 5.67k, False: 676]
  ------------------
  236|  5.67k|          src--;
  237|  5.67k|        }
  238|    676|      } else {
  239|      0|        while (!scalar::base64::is_eight_byte(*(src - 1)) ||
  ------------------
  |  Branch (239:16): [True: 0, False: 0]
  ------------------
  240|      0|               to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (240:16): [True: 0, False: 0]
  ------------------
  241|      0|          src--;
  242|      0|        }
  243|      0|      }
  244|    676|      src--;
  245|    676|      leftover--;
  246|    676|    }
  247|    450|  }
  248|    984|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (248:7): [True: 840, False: 144]
  ------------------
  249|    840|    full_result r = scalar::base64::base64_tail_decode(
  250|    840|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  251|    840|    r = scalar::base64::patch_tail_result(
  252|    840|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  253|    840|        full_input_length, last_chunk_options);
  254|       |    // When is_partial(last_chunk_options) is true, we must either end with
  255|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  256|       |    // character or at the very beginning of the stream.
  257|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  258|    840|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (258:9): [True: 432, False: 408]
  |  Branch (258:43): [True: 318, False: 114]
  ------------------
  259|    318|        r.input_count < full_input_length) {
  ------------------
  |  Branch (259:9): [True: 286, False: 32]
  ------------------
  260|       |      // First check if we can extend the input to the end of the stream
  261|    854|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (261:14): [True: 848, False: 6]
  ------------------
  262|    848|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (262:14): [True: 568, False: 280]
  ------------------
  263|    568|        r.input_count++;
  264|    568|      }
  265|       |      // If we are still not at the end of the stream, then we must backtrack
  266|       |      // to the last non-ignorable character.
  267|    286|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (267:11): [True: 280, False: 6]
  ------------------
  268|  2.26k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (268:16): [True: 2.19k, False: 68]
  ------------------
  269|  2.19k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (269:16): [True: 1.98k, False: 212]
  ------------------
  270|  1.98k|          r.input_count--;
  271|  1.98k|        }
  272|    280|      }
  273|    286|    }
  274|    840|    return r;
  275|    840|  }
  276|    144|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (276:7): [True: 144, Folded]
  |  Branch (276:26): [True: 0, False: 144]
  ------------------
  277|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (277:9): [True: 0, False: 0]
  ------------------
  278|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (278:9): [True: 0, False: 0]
  ------------------
  279|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  280|      0|              true};
  281|      0|    }
  282|      0|  }
  283|    144|  return {SUCCESS, full_input_length, size_t(dst - dstinit)};
  284|    144|}

simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block64C2EPKc:
  488|   331k|  simdutf_really_inline block64(const char *src) {
  489|   331k|    chunks[0] = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src));
  490|   331k|    chunks[1] = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 32));
  491|   331k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6419base64_decode_blockILb0EEEvPc:
  529|  55.7k|  simdutf_really_inline void base64_decode_block(char *out) {
  530|  55.7k|    base64_decode(out, chunks[0]);
  531|  55.7k|    base64_decode<exact_tail>(out + 24, chunks[1]);
  532|  55.7k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_113base64_decodeILb0EEEvPcDv4_x:
  450|   722k|simdutf_really_inline void base64_decode(char *out, __m256i str) {
  451|       |  // credit: aqrit
  452|   722k|  const __m256i pack_shuffle =
  453|   722k|      _mm256_setr_epi8(2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1,
  454|   722k|                       2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1);
  455|   722k|  const __m256i t0 = _mm256_maddubs_epi16(str, _mm256_set1_epi32(0x01400140));
  456|   722k|  const __m256i t1 = _mm256_madd_epi16(t0, _mm256_set1_epi32(0x00011000));
  457|   722k|  const __m256i t2 = _mm256_shuffle_epi8(t1, pack_shuffle);
  458|       |
  459|       |  // Store the output:
  460|   722k|  _mm_storeu_si128((__m128i *)out, _mm256_castsi256_si128(t2));
  461|   722k|  const __m128i hi = _mm256_extracti128_si256(t2, 1);
  462|       |  if constexpr (exact_tail) {
  463|       |    _mm_storel_epi64((__m128i *)(out + 12), hi);
  464|       |    const int32_t last = _mm_extract_epi32(hi, 2);
  465|       |    std::memcpy(out + 20, &last, sizeof(last));
  466|   722k|  } else {
  467|   722k|    _mm_storeu_si128((__m128i *)(out + 12), hi);
  468|   722k|  }
  469|   722k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6419base64_decode_blockILb1EEEvPc:
  529|  58.4k|  simdutf_really_inline void base64_decode_block(char *out) {
  530|  58.4k|    base64_decode(out, chunks[0]);
  531|  58.4k|    base64_decode<exact_tail>(out + 24, chunks[1]);
  532|  58.4k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_113base64_decodeILb1EEEvPcDv4_x:
  450|   119k|simdutf_really_inline void base64_decode(char *out, __m256i str) {
  451|       |  // credit: aqrit
  452|   119k|  const __m256i pack_shuffle =
  453|   119k|      _mm256_setr_epi8(2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1,
  454|   119k|                       2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1);
  455|   119k|  const __m256i t0 = _mm256_maddubs_epi16(str, _mm256_set1_epi32(0x01400140));
  456|   119k|  const __m256i t1 = _mm256_madd_epi16(t0, _mm256_set1_epi32(0x00011000));
  457|   119k|  const __m256i t2 = _mm256_shuffle_epi8(t1, pack_shuffle);
  458|       |
  459|       |  // Store the output:
  460|   119k|  _mm_storeu_si128((__m128i *)out, _mm256_castsi256_si128(t2));
  461|   119k|  const __m128i hi = _mm256_extracti128_si256(t2, 1);
  462|   119k|  if constexpr (exact_tail) {
  463|   119k|    _mm_storel_epi64((__m128i *)(out + 12), hi);
  464|   119k|    const int32_t last = _mm_extract_epi32(hi, 2);
  465|   119k|    std::memcpy(out + 20, &last, sizeof(last));
  466|       |  } else {
  467|       |    _mm_storeu_si128((__m128i *)(out + 12), hi);
  468|       |  }
  469|   119k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414compress_blockEmPc:
  671|   187k|  simdutf_really_inline uint64_t compress_block(uint64_t mask, char *output) {
  672|   187k|    if (is_power_of_two(mask)) {
  ------------------
  |  Branch (672:9): [True: 148k, False: 39.5k]
  ------------------
  673|   148k|      return compress_block_single(mask, output);
  674|   148k|    }
  675|       |
  676|  39.5k|    uint64_t nmask = ~mask;
  677|  39.5k|    compress(chunks[0], uint32_t(mask), output);
  678|  39.5k|    compress(chunks[1], uint32_t(mask >> 32),
  679|  39.5k|             output + count_ones(nmask & 0xFFFFFFFF));
  680|  39.5k|    return count_ones(nmask);
  681|   187k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6421compress_block_singleEmPc:
  684|   148k|                                                     char *output) {
  685|   148k|    const size_t pos64 = trailing_zeroes(mask);
  686|   148k|    const int8_t pos = pos64 & 0xf;
  687|   148k|    switch (pos64 >> 4) {
  ------------------
  |  Branch (687:13): [True: 148k, False: 0]
  ------------------
  688|  35.7k|    case 0b00: {
  ------------------
  |  Branch (688:5): [True: 35.7k, False: 112k]
  ------------------
  689|  35.7k|      const __m128i lane0 = _mm256_extracti128_si256(chunks[0], 0);
  690|  35.7k|      const __m128i lane1 = _mm256_extracti128_si256(chunks[0], 1);
  691|       |
  692|  35.7k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  693|  35.7k|      const __m128i v1 =
  694|  35.7k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  695|  35.7k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  696|  35.7k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  697|  35.7k|      const __m128i compressed = _mm_shuffle_epi8(lane0, sh);
  698|       |
  699|  35.7k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), compressed);
  700|  35.7k|      _mm_storeu_si128((__m128i *)(output + 1 * 16 - 1), lane1);
  701|  35.7k|      _mm256_storeu_si256((__m256i *)(output + 2 * 16 - 1), chunks[1]);
  702|  35.7k|    } break;
  703|  38.0k|    case 0b01: {
  ------------------
  |  Branch (703:5): [True: 38.0k, False: 110k]
  ------------------
  704|  38.0k|      const __m128i lane0 = _mm256_extracti128_si256(chunks[0], 0);
  705|  38.0k|      const __m128i lane1 = _mm256_extracti128_si256(chunks[0], 1);
  706|  38.0k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), lane0);
  707|       |
  708|  38.0k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  709|  38.0k|      const __m128i v1 =
  710|  38.0k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  711|  38.0k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  712|  38.0k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  713|  38.0k|      const __m128i compressed = _mm_shuffle_epi8(lane1, sh);
  714|       |
  715|  38.0k|      _mm_storeu_si128((__m128i *)(output + 1 * 16), compressed);
  716|  38.0k|      _mm256_storeu_si256((__m256i *)(output + 2 * 16 - 1), chunks[1]);
  717|  38.0k|    } break;
  718|  38.4k|    case 0b10: {
  ------------------
  |  Branch (718:5): [True: 38.4k, False: 109k]
  ------------------
  719|  38.4k|      const __m128i lane2 = _mm256_extracti128_si256(chunks[1], 0);
  720|  38.4k|      const __m128i lane3 = _mm256_extracti128_si256(chunks[1], 1);
  721|       |
  722|  38.4k|      _mm256_storeu_si256((__m256i *)(output + 0 * 16), chunks[0]);
  723|       |
  724|  38.4k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  725|  38.4k|      const __m128i v1 =
  726|  38.4k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  727|  38.4k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  728|  38.4k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  729|  38.4k|      const __m128i compressed = _mm_shuffle_epi8(lane2, sh);
  730|       |
  731|  38.4k|      _mm_storeu_si128((__m128i *)(output + 2 * 16), compressed);
  732|  38.4k|      _mm_storeu_si128((__m128i *)(output + 3 * 16 - 1), lane3);
  733|  38.4k|    } break;
  734|  36.0k|    case 0b11: {
  ------------------
  |  Branch (734:5): [True: 36.0k, False: 112k]
  ------------------
  735|  36.0k|      const __m128i lane2 = _mm256_extracti128_si256(chunks[1], 0);
  736|  36.0k|      const __m128i lane3 = _mm256_extracti128_si256(chunks[1], 1);
  737|       |
  738|  36.0k|      _mm256_storeu_si256((__m256i *)(output + 0 * 16), chunks[0]);
  739|  36.0k|      _mm_storeu_si128((__m128i *)(output + 2 * 16), lane2);
  740|       |
  741|  36.0k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  742|  36.0k|      const __m128i v1 =
  743|  36.0k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  744|  36.0k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  745|  36.0k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  746|  36.0k|      const __m128i compressed = _mm_shuffle_epi8(lane3, sh);
  747|       |
  748|  36.0k|      _mm_storeu_si128((__m128i *)(output + 3 * 16), compressed);
  749|  36.0k|    } break;
  750|   148k|    }
  751|       |
  752|   148k|    return 63;
  753|   148k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_18compressIvEEvDv4_xjPc:
  435|  79.1k|simdutf_really_inline void compress(__m256i data, uint32_t mask, char *output) {
  436|  79.1k|  if (mask == 0) {
  ------------------
  |  Branch (436:7): [True: 15.7k, False: 63.4k]
  ------------------
  437|  15.7k|    _mm256_storeu_si256(reinterpret_cast<__m256i *>(output), data);
  438|  15.7k|    return;
  439|  15.7k|  }
  440|  63.4k|  compress(_mm256_castsi256_si128(data), uint16_t(mask), output);
  441|       |  compress(_mm256_extracti128_si256(data, 1), uint16_t(mask >> 16),
  442|  63.4k|           output + count_ones(~mask & 0xFFFF));
  443|  63.4k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_18compressEDv2_xtPc:
  398|   126k|static inline void compress(__m128i data, uint16_t mask, char *output) {
  399|   126k|  if (mask == 0) {
  ------------------
  |  Branch (399:7): [True: 43.5k, False: 83.3k]
  ------------------
  400|  43.5k|    _mm_storeu_si128(reinterpret_cast<__m128i *>(output), data);
  401|  43.5k|    return;
  402|  43.5k|  }
  403|       |  // this particular implementation was inspired by work done by @animetosho
  404|       |  // we do it in two steps, first 8 bytes and then second 8 bytes
  405|  83.3k|  uint8_t mask1 = uint8_t(mask);      // least significant 8 bits
  406|  83.3k|  uint8_t mask2 = uint8_t(mask >> 8); // most significant 8 bits
  407|       |  // next line just loads the 64-bit values thintable_epi8[mask1] and
  408|       |  // thintable_epi8[mask2] into a 128-bit register, using only
  409|       |  // two instructions on most compilers.
  410|       |
  411|  83.3k|  __m128i shufmask = _mm_set_epi64x(tables::base64::thintable_epi8[mask2],
  412|  83.3k|                                    tables::base64::thintable_epi8[mask1]);
  413|       |  // we increment by 0x08 the second half of the mask
  414|  83.3k|  shufmask =
  415|  83.3k|      _mm_add_epi8(shufmask, _mm_set_epi32(0x08080808, 0x08080808, 0, 0));
  416|       |  // this is the version "nearly pruned"
  417|  83.3k|  __m128i pruned = _mm_shuffle_epi8(data, shufmask);
  418|       |  // we still need to put the two halves together.
  419|       |  // we compute the popcount of the first half:
  420|  83.3k|  int pop1 = tables::base64::BitsSetTable256mul2[mask1];
  421|       |  // then load the corresponding mask, what it does is to write
  422|       |  // only the first pop1 bytes from the first 8 bytes, and then
  423|       |  // it fills in with the bytes from the second 8 bytes + some filling
  424|       |  // at the end.
  425|  83.3k|  __m128i compactmask = _mm_loadu_si128(reinterpret_cast<const __m128i *>(
  426|  83.3k|      tables::base64::pshufb_combine_table + pop1 * 8));
  427|  83.3k|  __m128i answer = _mm_shuffle_epi8(pruned, compactmask);
  428|       |
  429|  83.3k|  _mm_storeu_si128(reinterpret_cast<__m128i *>(output), answer);
  430|  83.3k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6410copy_blockEPc:
  522|   130k|  simdutf_really_inline void copy_block(char *output) {
  523|   130k|    _mm256_storeu_si256(reinterpret_cast<__m256i *>(output), chunks[0]);
  524|   130k|    _mm256_storeu_si256(reinterpret_cast<__m256i *>(output + 32), chunks[1]);
  525|   130k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_119base64_decode_blockILb0EEEvPcPKc:
  472|   245k|simdutf_really_inline void base64_decode_block(char *out, const char *src) {
  473|   245k|  base64_decode(out,
  474|   245k|                _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src)));
  475|   245k|  base64_decode<exact_tail>(
  476|   245k|      out + 24,
  477|   245k|      _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 32)));
  478|   245k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_119base64_decode_blockILb1EEEvPcPKc:
  472|  61.4k|simdutf_really_inline void base64_decode_block(char *out, const char *src) {
  473|  61.4k|  base64_decode(out,
  474|  61.4k|                _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src)));
  475|  61.4k|  base64_decode<exact_tail>(
  476|  61.4k|      out + 24,
  477|  61.4k|      _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 32)));
  478|  61.4k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb1ELb0ELb0EEEmPm:
  535|   144k|  simdutf_really_inline uint64_t to_base64_mask(uint64_t *error) {
  536|   144k|    uint32_t err0 = 0;
  537|   144k|    uint32_t err1 = 0;
  538|   144k|    uint64_t m0 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  539|   144k|        &chunks[0], &err0);
  540|   144k|    uint64_t m1 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  541|   144k|        &chunks[1], &err1);
  542|   144k|    if (!ignore_garbage) {
  ------------------
  |  Branch (542:9): [True: 144k, Folded]
  ------------------
  543|   144k|      *error = err0 | ((uint64_t)err1 << 32);
  544|   144k|    }
  545|   144k|    return m0 | (m1 << 32);
  546|   144k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb1ELb0ELb0EEEjPDv4_xPj:
  549|   288k|  simdutf_really_inline uint32_t to_base64_mask(__m256i *src, uint32_t *error) {
  550|   288k|    const __m256i ascii_space_tbl =
  551|   288k|        _mm256_setr_epi8(0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0xa,
  552|   288k|                         0x0, 0xc, 0xd, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0,
  553|   288k|                         0x0, 0x0, 0x0, 0x9, 0xa, 0x0, 0xc, 0xd, 0x0, 0x0);
  554|       |    // credit: aqrit
  555|   288k|    __m256i delta_asso;
  556|   288k|    if (default_or_url) {
  ------------------
  |  Branch (556:9): [Folded, False: 288k]
  ------------------
  557|      0|      delta_asso = _mm256_setr_epi8(
  558|      0|          0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
  559|      0|          0x00, 0x00, 0x11, 0x00, 0x16, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  560|      0|          0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x16);
  561|   288k|    } else if (base64_url) {
  ------------------
  |  Branch (561:16): [True: 288k, Folded]
  ------------------
  562|   288k|      delta_asso = _mm256_setr_epi8(0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0,
  563|   288k|                                    0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0xF, 0x1, 0x1,
  564|   288k|                                    0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0,
  565|   288k|                                    0x0, 0x0, 0xF, 0x0, 0xF);
  566|   288k|    } else {
  567|      0|      delta_asso = _mm256_setr_epi8(
  568|      0|          0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
  569|      0|          0x00, 0x00, 0x0F, 0x00, 0x0F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  570|      0|          0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x0F);
  571|      0|    }
  572|       |
  573|   288k|    __m256i delta_values;
  574|   288k|    if (default_or_url) {
  ------------------
  |  Branch (574:9): [Folded, False: 288k]
  ------------------
  575|      0|      delta_values = _mm256_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|      0|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0x13),
  581|      0|          uint8_t(0x04), uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  582|      0|          uint8_t(0xB9), uint8_t(0x00), uint8_t(0xFF), uint8_t(0x11),
  583|      0|          uint8_t(0xFF), uint8_t(0xBF), uint8_t(0x10), uint8_t(0xB9));
  584|   288k|    } else if (base64_url) {
  ------------------
  |  Branch (584:16): [True: 288k, Folded]
  ------------------
  585|   288k|      delta_values = _mm256_setr_epi8(
  586|   288k|          0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  587|   288k|          uint8_t(0xB9), 0x0, 0x11, uint8_t(0xC3), uint8_t(0xBF), uint8_t(0xE0),
  588|   288k|          uint8_t(0xB9), uint8_t(0xB9), 0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF),
  589|   288k|          uint8_t(0xBF), uint8_t(0xB9), uint8_t(0xB9), 0x0, 0x11, uint8_t(0xC3),
  590|   288k|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0xB9));
  591|   288k|    } else {
  592|      0|      delta_values = _mm256_setr_epi8(
  593|      0|          int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13), int8_t(0x04),
  594|      0|          int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9), int8_t(0x00),
  595|      0|          int8_t(0x10), int8_t(0xC3), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9),
  596|      0|          int8_t(0xB9), int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13),
  597|      0|          int8_t(0x04), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9),
  598|      0|          int8_t(0x00), int8_t(0x10), int8_t(0xC3), int8_t(0xBF), int8_t(0xBF),
  599|      0|          int8_t(0xB9), int8_t(0xB9));
  600|      0|    }
  601|       |
  602|   288k|    __m256i check_asso;
  603|   288k|    if (default_or_url) {
  ------------------
  |  Branch (603:9): [Folded, False: 288k]
  ------------------
  604|      0|      check_asso = _mm256_setr_epi8(
  605|      0|          0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
  606|      0|          0x07, 0x0B, 0x0E, 0x0B, 0x06, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01,
  607|      0|          0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x0B, 0x0E, 0x0B, 0x06);
  608|   288k|    } else if (base64_url) {
  ------------------
  |  Branch (608:16): [True: 288k, Folded]
  ------------------
  609|   288k|      check_asso = _mm256_setr_epi8(0xD, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
  610|   288k|                                    0x1, 0x3, 0x7, 0xB, 0xE, 0xB, 0x6, 0xD, 0x1,
  611|   288k|                                    0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3,
  612|   288k|                                    0x7, 0xB, 0xE, 0xB, 0x6);
  613|   288k|    } else {
  614|      0|      check_asso = _mm256_setr_epi8(
  615|      0|          0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
  616|      0|          0x07, 0x0B, 0x0B, 0x0B, 0x0F, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01,
  617|      0|          0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x0B, 0x0B, 0x0B, 0x0F);
  618|      0|    }
  619|   288k|    __m256i check_values;
  620|   288k|    if (default_or_url) {
  ------------------
  |  Branch (620:9): [Folded, False: 288k]
  ------------------
  621|      0|      check_values = _mm256_setr_epi8(
  622|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  623|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xD5), uint8_t(0xA6),
  624|      0|          uint8_t(0xB5), uint8_t(0xA1), uint8_t(0x00), uint8_t(0x80),
  625|      0|          uint8_t(0x00), uint8_t(0x80), uint8_t(0x00), uint8_t(0x80),
  626|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  627|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xD5), uint8_t(0xA6),
  628|      0|          uint8_t(0xB5), uint8_t(0xA1), uint8_t(0x00), uint8_t(0x80),
  629|      0|          uint8_t(0x00), uint8_t(0x80), uint8_t(0x00), uint8_t(0x80));
  630|   288k|    } else if (base64_url) {
  ------------------
  |  Branch (630:16): [True: 288k, Folded]
  ------------------
  631|   288k|      check_values = _mm256_setr_epi8(
  632|   288k|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  633|   288k|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xB6), uint8_t(0xA6),
  634|   288k|          uint8_t(0xB5), uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0, uint8_t(0x80),
  635|   288k|          0x0, uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  636|   288k|          uint8_t(0x80), uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xB6),
  637|   288k|          uint8_t(0xA6), uint8_t(0xB5), uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0,
  638|   288k|          uint8_t(0x80), 0x0, uint8_t(0x80));
  639|   288k|    } else {
  640|      0|      check_values = _mm256_setr_epi8(
  641|      0|          int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0xCF),
  642|      0|          int8_t(0xBF), int8_t(0xD5), int8_t(0xA6), int8_t(0xB5), int8_t(0x86),
  643|      0|          int8_t(0xD1), int8_t(0x80), int8_t(0xB1), int8_t(0x80), int8_t(0x91),
  644|      0|          int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80),
  645|      0|          int8_t(0xCF), int8_t(0xBF), int8_t(0xD5), int8_t(0xA6), int8_t(0xB5),
  646|      0|          int8_t(0x86), int8_t(0xD1), int8_t(0x80), int8_t(0xB1), int8_t(0x80),
  647|      0|          int8_t(0x91), int8_t(0x80));
  648|      0|    }
  649|   288k|    const __m256i shifted = _mm256_srli_epi32(*src, 3);
  650|   288k|    __m256i delta_hash =
  651|   288k|        _mm256_avg_epu8(_mm256_shuffle_epi8(delta_asso, *src), shifted);
  652|   288k|    if (default_or_url) {
  ------------------
  |  Branch (652:9): [Folded, False: 288k]
  ------------------
  653|      0|      delta_hash = _mm256_and_si256(delta_hash, _mm256_set1_epi8(0xf));
  654|      0|    }
  655|   288k|    const __m256i check_hash =
  656|   288k|        _mm256_avg_epu8(_mm256_shuffle_epi8(check_asso, *src), shifted);
  657|   288k|    const __m256i out =
  658|   288k|        _mm256_adds_epi8(_mm256_shuffle_epi8(delta_values, delta_hash), *src);
  659|   288k|    const __m256i chk =
  660|   288k|        _mm256_adds_epi8(_mm256_shuffle_epi8(check_values, check_hash), *src);
  661|   288k|    const int mask = _mm256_movemask_epi8(chk);
  662|   288k|    if (!ignore_garbage && mask) {
  ------------------
  |  Branch (662:9): [True: 288k, Folded]
  |  Branch (662:28): [True: 81.5k, False: 206k]
  ------------------
  663|  81.5k|      __m256i ascii_space =
  664|  81.5k|          _mm256_cmpeq_epi8(_mm256_shuffle_epi8(ascii_space_tbl, *src), *src);
  665|  81.5k|      *error = (mask ^ _mm256_movemask_epi8(ascii_space));
  666|  81.5k|    }
  667|   288k|    *src = out;
  668|   288k|    return (uint32_t)mask;
  669|   288k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb0ELb0ELb0EEEmPm:
  535|   296k|  simdutf_really_inline uint64_t to_base64_mask(uint64_t *error) {
  536|   296k|    uint32_t err0 = 0;
  537|   296k|    uint32_t err1 = 0;
  538|   296k|    uint64_t m0 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  539|   296k|        &chunks[0], &err0);
  540|   296k|    uint64_t m1 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  541|   296k|        &chunks[1], &err1);
  542|   296k|    if (!ignore_garbage) {
  ------------------
  |  Branch (542:9): [True: 296k, Folded]
  ------------------
  543|   296k|      *error = err0 | ((uint64_t)err1 << 32);
  544|   296k|    }
  545|   296k|    return m0 | (m1 << 32);
  546|   296k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb0ELb0ELb0EEEjPDv4_xPj:
  549|   593k|  simdutf_really_inline uint32_t to_base64_mask(__m256i *src, uint32_t *error) {
  550|   593k|    const __m256i ascii_space_tbl =
  551|   593k|        _mm256_setr_epi8(0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0xa,
  552|   593k|                         0x0, 0xc, 0xd, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0,
  553|   593k|                         0x0, 0x0, 0x0, 0x9, 0xa, 0x0, 0xc, 0xd, 0x0, 0x0);
  554|       |    // credit: aqrit
  555|   593k|    __m256i delta_asso;
  556|   593k|    if (default_or_url) {
  ------------------
  |  Branch (556:9): [Folded, False: 593k]
  ------------------
  557|      0|      delta_asso = _mm256_setr_epi8(
  558|      0|          0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
  559|      0|          0x00, 0x00, 0x11, 0x00, 0x16, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  560|      0|          0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x16);
  561|   593k|    } else if (base64_url) {
  ------------------
  |  Branch (561:16): [Folded, False: 593k]
  ------------------
  562|      0|      delta_asso = _mm256_setr_epi8(0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0,
  563|      0|                                    0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0xF, 0x1, 0x1,
  564|      0|                                    0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0,
  565|      0|                                    0x0, 0x0, 0xF, 0x0, 0xF);
  566|   593k|    } else {
  567|   593k|      delta_asso = _mm256_setr_epi8(
  568|   593k|          0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
  569|   593k|          0x00, 0x00, 0x0F, 0x00, 0x0F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  570|   593k|          0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x0F);
  571|   593k|    }
  572|       |
  573|   593k|    __m256i delta_values;
  574|   593k|    if (default_or_url) {
  ------------------
  |  Branch (574:9): [Folded, False: 593k]
  ------------------
  575|      0|      delta_values = _mm256_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|      0|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0x13),
  581|      0|          uint8_t(0x04), uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  582|      0|          uint8_t(0xB9), uint8_t(0x00), uint8_t(0xFF), uint8_t(0x11),
  583|      0|          uint8_t(0xFF), uint8_t(0xBF), uint8_t(0x10), uint8_t(0xB9));
  584|   593k|    } else if (base64_url) {
  ------------------
  |  Branch (584:16): [Folded, False: 593k]
  ------------------
  585|      0|      delta_values = _mm256_setr_epi8(
  586|      0|          0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  587|      0|          uint8_t(0xB9), 0x0, 0x11, uint8_t(0xC3), uint8_t(0xBF), uint8_t(0xE0),
  588|      0|          uint8_t(0xB9), uint8_t(0xB9), 0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF),
  589|      0|          uint8_t(0xBF), uint8_t(0xB9), uint8_t(0xB9), 0x0, 0x11, uint8_t(0xC3),
  590|      0|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0xB9));
  591|   593k|    } else {
  592|   593k|      delta_values = _mm256_setr_epi8(
  593|   593k|          int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13), int8_t(0x04),
  594|   593k|          int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9), int8_t(0x00),
  595|   593k|          int8_t(0x10), int8_t(0xC3), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9),
  596|   593k|          int8_t(0xB9), int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13),
  597|   593k|          int8_t(0x04), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9),
  598|   593k|          int8_t(0x00), int8_t(0x10), int8_t(0xC3), int8_t(0xBF), int8_t(0xBF),
  599|   593k|          int8_t(0xB9), int8_t(0xB9));
  600|   593k|    }
  601|       |
  602|   593k|    __m256i check_asso;
  603|   593k|    if (default_or_url) {
  ------------------
  |  Branch (603:9): [Folded, False: 593k]
  ------------------
  604|      0|      check_asso = _mm256_setr_epi8(
  605|      0|          0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
  606|      0|          0x07, 0x0B, 0x0E, 0x0B, 0x06, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01,
  607|      0|          0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x0B, 0x0E, 0x0B, 0x06);
  608|   593k|    } else if (base64_url) {
  ------------------
  |  Branch (608:16): [Folded, False: 593k]
  ------------------
  609|      0|      check_asso = _mm256_setr_epi8(0xD, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
  610|      0|                                    0x1, 0x3, 0x7, 0xB, 0xE, 0xB, 0x6, 0xD, 0x1,
  611|      0|                                    0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3,
  612|      0|                                    0x7, 0xB, 0xE, 0xB, 0x6);
  613|   593k|    } else {
  614|   593k|      check_asso = _mm256_setr_epi8(
  615|   593k|          0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
  616|   593k|          0x07, 0x0B, 0x0B, 0x0B, 0x0F, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01,
  617|   593k|          0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x0B, 0x0B, 0x0B, 0x0F);
  618|   593k|    }
  619|   593k|    __m256i check_values;
  620|   593k|    if (default_or_url) {
  ------------------
  |  Branch (620:9): [Folded, False: 593k]
  ------------------
  621|      0|      check_values = _mm256_setr_epi8(
  622|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  623|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xD5), uint8_t(0xA6),
  624|      0|          uint8_t(0xB5), uint8_t(0xA1), uint8_t(0x00), uint8_t(0x80),
  625|      0|          uint8_t(0x00), uint8_t(0x80), uint8_t(0x00), uint8_t(0x80),
  626|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  627|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xD5), uint8_t(0xA6),
  628|      0|          uint8_t(0xB5), uint8_t(0xA1), uint8_t(0x00), uint8_t(0x80),
  629|      0|          uint8_t(0x00), uint8_t(0x80), uint8_t(0x00), uint8_t(0x80));
  630|   593k|    } else if (base64_url) {
  ------------------
  |  Branch (630:16): [Folded, False: 593k]
  ------------------
  631|      0|      check_values = _mm256_setr_epi8(
  632|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  633|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xB6), uint8_t(0xA6),
  634|      0|          uint8_t(0xB5), uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0, uint8_t(0x80),
  635|      0|          0x0, uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  636|      0|          uint8_t(0x80), uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xB6),
  637|      0|          uint8_t(0xA6), uint8_t(0xB5), uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0,
  638|      0|          uint8_t(0x80), 0x0, uint8_t(0x80));
  639|   593k|    } else {
  640|   593k|      check_values = _mm256_setr_epi8(
  641|   593k|          int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0xCF),
  642|   593k|          int8_t(0xBF), int8_t(0xD5), int8_t(0xA6), int8_t(0xB5), int8_t(0x86),
  643|   593k|          int8_t(0xD1), int8_t(0x80), int8_t(0xB1), int8_t(0x80), int8_t(0x91),
  644|   593k|          int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80),
  645|   593k|          int8_t(0xCF), int8_t(0xBF), int8_t(0xD5), int8_t(0xA6), int8_t(0xB5),
  646|   593k|          int8_t(0x86), int8_t(0xD1), int8_t(0x80), int8_t(0xB1), int8_t(0x80),
  647|   593k|          int8_t(0x91), int8_t(0x80));
  648|   593k|    }
  649|   593k|    const __m256i shifted = _mm256_srli_epi32(*src, 3);
  650|   593k|    __m256i delta_hash =
  651|   593k|        _mm256_avg_epu8(_mm256_shuffle_epi8(delta_asso, *src), shifted);
  652|   593k|    if (default_or_url) {
  ------------------
  |  Branch (652:9): [Folded, False: 593k]
  ------------------
  653|      0|      delta_hash = _mm256_and_si256(delta_hash, _mm256_set1_epi8(0xf));
  654|      0|    }
  655|   593k|    const __m256i check_hash =
  656|   593k|        _mm256_avg_epu8(_mm256_shuffle_epi8(check_asso, *src), shifted);
  657|   593k|    const __m256i out =
  658|   593k|        _mm256_adds_epi8(_mm256_shuffle_epi8(delta_values, delta_hash), *src);
  659|   593k|    const __m256i chk =
  660|   593k|        _mm256_adds_epi8(_mm256_shuffle_epi8(check_values, check_hash), *src);
  661|   593k|    const int mask = _mm256_movemask_epi8(chk);
  662|   593k|    if (!ignore_garbage && mask) {
  ------------------
  |  Branch (662:9): [True: 593k, Folded]
  |  Branch (662:28): [True: 143k, False: 450k]
  ------------------
  663|   143k|      __m256i ascii_space =
  664|   143k|          _mm256_cmpeq_epi8(_mm256_shuffle_epi8(ascii_space_tbl, *src), *src);
  665|   143k|      *error = (mask ^ _mm256_movemask_epi8(ascii_space));
  666|   143k|    }
  667|   593k|    *src = out;
  668|   593k|    return (uint32_t)mask;
  669|   593k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block64C2EPKDs:
  495|   109k|  simdutf_really_inline block64(const char16_t *src) {
  496|   109k|    const auto m1 = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src));
  497|   109k|    const auto m2 =
  498|   109k|        _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 16));
  499|   109k|    const auto m3 =
  500|   109k|        _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 32));
  501|   109k|    const auto m4 =
  502|   109k|        _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 48));
  503|       |
  504|   109k|    const auto m1p = _mm256_permute2x128_si256(m1, m2, 0x20);
  505|   109k|    const auto m2p = _mm256_permute2x128_si256(m1, m2, 0x31);
  506|   109k|    const auto m3p = _mm256_permute2x128_si256(m3, m4, 0x20);
  507|   109k|    const auto m4p = _mm256_permute2x128_si256(m3, m4, 0x31);
  508|       |
  509|   109k|    chunks[0] = _mm256_packus_epi16(m1p, m2p);
  510|   109k|    chunks[1] = _mm256_packus_epi16(m3p, m4p);
  511|   109k|  }

_ZNK7simdutf7haswell14implementation16base64_to_binaryEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1341|  1.93k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1342|  1.93k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1342:7): [True: 0, False: 1.93k]
  ------------------
 1343|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1343:9): [True: 0, False: 0]
  ------------------
 1344|      0|      return base64::compress_decode_base64<false, true, true>(
 1345|      0|          output, input, length, options, last_chunk_options);
 1346|      0|    } else {
 1347|      0|      return base64::compress_decode_base64<false, false, true>(
 1348|      0|          output, input, length, options, last_chunk_options);
 1349|      0|    }
 1350|  1.93k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1350:14): [True: 946, False: 990]
  ------------------
 1351|    946|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1351:9): [True: 0, False: 946]
  ------------------
 1352|      0|      return base64::compress_decode_base64<true, true, false>(
 1353|      0|          output, input, length, options, last_chunk_options);
 1354|    946|    } else {
 1355|    946|      return base64::compress_decode_base64<true, false, false>(
 1356|    946|          output, input, length, options, last_chunk_options);
 1357|    946|    }
 1358|    990|  } else {
 1359|    990|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1359:9): [True: 0, False: 990]
  ------------------
 1360|      0|      return base64::compress_decode_base64<false, true, false>(
 1361|      0|          output, input, length, options, last_chunk_options);
 1362|    990|    } else {
 1363|    990|      return base64::compress_decode_base64<false, false, false>(
 1364|    990|          output, input, length, options, last_chunk_options);
 1365|    990|    }
 1366|    990|  }
 1367|  1.93k|}
_ZNK7simdutf7haswell14implementation24base64_to_binary_detailsEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1371|  1.93k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1372|  1.93k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1372:7): [True: 0, False: 1.93k]
  ------------------
 1373|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1373:9): [True: 0, False: 0]
  ------------------
 1374|      0|      return base64::compress_decode_base64<false, true, true>(
 1375|      0|          output, input, length, options, last_chunk_options);
 1376|      0|    } else {
 1377|      0|      return base64::compress_decode_base64<false, false, true>(
 1378|      0|          output, input, length, options, last_chunk_options);
 1379|      0|    }
 1380|  1.93k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1380:14): [True: 946, False: 990]
  ------------------
 1381|    946|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1381:9): [True: 0, False: 946]
  ------------------
 1382|      0|      return base64::compress_decode_base64<true, true, false>(
 1383|      0|          output, input, length, options, last_chunk_options);
 1384|    946|    } else {
 1385|    946|      return base64::compress_decode_base64<true, false, false>(
 1386|    946|          output, input, length, options, last_chunk_options);
 1387|    946|    }
 1388|    990|  } else {
 1389|    990|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1389:9): [True: 0, False: 990]
  ------------------
 1390|      0|      return base64::compress_decode_base64<false, true, false>(
 1391|      0|          output, input, length, options, last_chunk_options);
 1392|    990|    } else {
 1393|    990|      return base64::compress_decode_base64<false, false, false>(
 1394|    990|          output, input, length, options, last_chunk_options);
 1395|    990|    }
 1396|    990|  }
 1397|  1.93k|}
_ZNK7simdutf7haswell14implementation16base64_to_binaryEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1401|  1.93k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1402|  1.93k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1402:7): [True: 0, False: 1.93k]
  ------------------
 1403|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1403:9): [True: 0, False: 0]
  ------------------
 1404|      0|      return base64::compress_decode_base64<false, true, true>(
 1405|      0|          output, input, length, options, last_chunk_options);
 1406|      0|    } else {
 1407|      0|      return base64::compress_decode_base64<false, false, true>(
 1408|      0|          output, input, length, options, last_chunk_options);
 1409|      0|    }
 1410|  1.93k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1410:14): [True: 961, False: 973]
  ------------------
 1411|    961|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1411:9): [True: 0, False: 961]
  ------------------
 1412|      0|      return base64::compress_decode_base64<true, true, false>(
 1413|      0|          output, input, length, options, last_chunk_options);
 1414|    961|    } else {
 1415|    961|      return base64::compress_decode_base64<true, false, false>(
 1416|    961|          output, input, length, options, last_chunk_options);
 1417|    961|    }
 1418|    973|  } else {
 1419|    973|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1419:9): [True: 0, False: 973]
  ------------------
 1420|      0|      return base64::compress_decode_base64<false, true, false>(
 1421|      0|          output, input, length, options, last_chunk_options);
 1422|    973|    } else {
 1423|    973|      return base64::compress_decode_base64<false, false, false>(
 1424|    973|          output, input, length, options, last_chunk_options);
 1425|    973|    }
 1426|    973|  }
 1427|  1.93k|}
_ZNK7simdutf7haswell14implementation24base64_to_binary_detailsEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1431|  1.93k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1432|  1.93k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1432:7): [True: 0, False: 1.93k]
  ------------------
 1433|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1433:9): [True: 0, False: 0]
  ------------------
 1434|      0|      return base64::compress_decode_base64<false, true, true>(
 1435|      0|          output, input, length, options, last_chunk_options);
 1436|      0|    } else {
 1437|      0|      return base64::compress_decode_base64<false, false, true>(
 1438|      0|          output, input, length, options, last_chunk_options);
 1439|      0|    }
 1440|  1.93k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1440:14): [True: 961, False: 973]
  ------------------
 1441|    961|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1441:9): [True: 0, False: 961]
  ------------------
 1442|      0|      return base64::compress_decode_base64<true, true, false>(
 1443|      0|          output, input, length, options, last_chunk_options);
 1444|    961|    } else {
 1445|    961|      return base64::compress_decode_base64<true, false, false>(
 1446|    961|          output, input, length, options, last_chunk_options);
 1447|    961|    }
 1448|    973|  } else {
 1449|    973|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1449:9): [True: 0, False: 973]
  ------------------
 1450|      0|      return base64::compress_decode_base64<false, true, false>(
 1451|      0|          output, input, length, options, last_chunk_options);
 1452|    973|    } else {
 1453|    973|      return base64::compress_decode_base64<false, false, false>(
 1454|    973|          output, input, length, options, last_chunk_options);
 1455|    973|    }
 1456|    973|  }
 1457|  1.93k|}

_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|  5.80k|    const char *input, size_t length) const noexcept {
  118|  5.80k|  return scalar::base64::maximal_binary_length_from_base64(input, length);
  119|  5.80k|}
_ZNK7simdutf14implementation33maximal_binary_length_from_base64EPKDsm:
  122|  5.80k|    const char16_t *input, size_t length) const noexcept {
  123|  5.80k|  return scalar::base64::maximal_binary_length_from_base64(input, length);
  124|  5.80k|}
_ZNK7simdutf8internal29available_implementation_list5beginEv:
 1513|      1|available_implementation_list::begin() const noexcept {
 1514|      1|  return internal::get_available_implementation_pointers().begin();
 1515|      1|}
_ZNK7simdutf8internal29available_implementation_list3endEv:
 1517|      1|available_implementation_list::end() const noexcept {
 1518|      1|  return internal::get_available_implementation_pointers().end();
 1519|      1|}
_ZN7simdutf29get_available_implementationsEv:
 1568|      1|get_available_implementations() {
 1569|      1|#if !SIMDUTF_USE_STATIC_INITIALIZATION
 1570|      1|  static const internal::available_implementation_list
 1571|      1|      available_implementations_instance{};
 1572|      1|#endif
 1573|      1|  return available_implementations_instance;
 1574|      1|}
simdutf.cpp:_ZN7simdutf8internalL37get_available_implementation_pointersEv:
  938|      2|get_available_implementation_pointers() {
  939|      2|#if !SIMDUTF_USE_STATIC_INITIALIZATION
  940|      2|  static const std::initializer_list<const implementation *>
  941|      2|      available_implementation_pointers{
  942|      2|  #if SIMDUTF_IMPLEMENTATION_ICELAKE
  943|      2|          get_icelake_singleton(),
  944|      2|  #endif
  945|      2|  #if SIMDUTF_IMPLEMENTATION_HASWELL
  946|      2|          get_haswell_singleton(),
  947|      2|  #endif
  948|      2|  #if SIMDUTF_IMPLEMENTATION_WESTMERE
  949|      2|          get_westmere_singleton(),
  950|      2|  #endif
  951|       |  #if SIMDUTF_IMPLEMENTATION_ARM64
  952|       |          get_arm64_singleton(),
  953|       |  #endif
  954|       |  #if SIMDUTF_IMPLEMENTATION_PPC64
  955|       |          get_ppc64_singleton(),
  956|       |  #endif
  957|       |  #if SIMDUTF_IMPLEMENTATION_RVV
  958|       |          get_rvv_singleton(),
  959|       |  #endif
  960|       |  #if SIMDUTF_IMPLEMENTATION_LASX
  961|       |          get_lasx_singleton(),
  962|       |  #endif
  963|       |  #if SIMDUTF_IMPLEMENTATION_LSX
  964|       |          get_lsx_singleton(),
  965|       |  #endif
  966|      2|  #if SIMDUTF_IMPLEMENTATION_FALLBACK
  967|      2|          get_fallback_singleton(),
  968|      2|  #endif
  969|      2|      };
  970|      2|#endif
  971|      2|  return available_implementation_pointers;
  972|      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|   142k|simdutf_really_inline long long int count_ones(uint64_t input_num) {
   15|       |  return _popcnt64(input_num);
   16|   142k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_115trailing_zeroesEm:
   20|   152k|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|   152k|  return __builtin_ctzll(input_num);
   25|   152k|  #endif // SIMDUTF_REGULAR_VISUAL_STUDIO
   26|   152k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_115is_power_of_twoImEEbT_:
   29|   187k|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|   158k|simdutf_really_inline long long int count_ones(uint64_t input_num) {
   15|       |  return _popcnt64(input_num);
   16|   158k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115trailing_zeroesEm:
   20|   152k|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|   152k|  return __builtin_ctzll(input_num);
   27|   152k|  #endif // SIMDUTF_REGULAR_VISUAL_STUDIO
   28|   152k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115is_power_of_twoImEEbT_:
   31|   187k|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:
 1252|  1.93k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1253|  1.93k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1253:7): [True: 0, False: 1.93k]
  ------------------
 1254|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1254:9): [True: 0, False: 0]
  ------------------
 1255|      0|      return base64::compress_decode_base64<false, true, true>(
 1256|      0|          output, input, length, options, last_chunk_options);
 1257|      0|    } else {
 1258|      0|      return base64::compress_decode_base64<false, false, true>(
 1259|      0|          output, input, length, options, last_chunk_options);
 1260|      0|    }
 1261|  1.93k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1261:14): [True: 946, False: 990]
  ------------------
 1262|    946|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1262:9): [True: 0, False: 946]
  ------------------
 1263|      0|      return base64::compress_decode_base64<true, true, false>(
 1264|      0|          output, input, length, options, last_chunk_options);
 1265|    946|    } else {
 1266|    946|      return base64::compress_decode_base64<true, false, false>(
 1267|    946|          output, input, length, options, last_chunk_options);
 1268|    946|    }
 1269|    990|  } else {
 1270|    990|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1270:9): [True: 0, False: 990]
  ------------------
 1271|      0|      return base64::compress_decode_base64<false, true, false>(
 1272|      0|          output, input, length, options, last_chunk_options);
 1273|    990|    } else {
 1274|    990|      return base64::compress_decode_base64<false, false, false>(
 1275|    990|          output, input, length, options, last_chunk_options);
 1276|    990|    }
 1277|    990|  }
 1278|  1.93k|}
_ZNK7simdutf8westmere14implementation24base64_to_binary_detailsEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1282|  1.93k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1283|  1.93k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1283:7): [True: 0, False: 1.93k]
  ------------------
 1284|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1284:9): [True: 0, False: 0]
  ------------------
 1285|      0|      return base64::compress_decode_base64<false, true, true>(
 1286|      0|          output, input, length, options, last_chunk_options);
 1287|      0|    } else {
 1288|      0|      return base64::compress_decode_base64<false, false, true>(
 1289|      0|          output, input, length, options, last_chunk_options);
 1290|      0|    }
 1291|  1.93k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1291:14): [True: 946, False: 990]
  ------------------
 1292|    946|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1292:9): [True: 0, False: 946]
  ------------------
 1293|      0|      return base64::compress_decode_base64<true, true, false>(
 1294|      0|          output, input, length, options, last_chunk_options);
 1295|    946|    } else {
 1296|    946|      return base64::compress_decode_base64<true, false, false>(
 1297|    946|          output, input, length, options, last_chunk_options);
 1298|    946|    }
 1299|    990|  } else {
 1300|    990|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1300:9): [True: 0, False: 990]
  ------------------
 1301|      0|      return base64::compress_decode_base64<false, true, false>(
 1302|      0|          output, input, length, options, last_chunk_options);
 1303|    990|    } else {
 1304|    990|      return base64::compress_decode_base64<false, false, false>(
 1305|    990|          output, input, length, options, last_chunk_options);
 1306|    990|    }
 1307|    990|  }
 1308|  1.93k|}
_ZNK7simdutf8westmere14implementation16base64_to_binaryEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1312|  1.93k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1313|  1.93k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1313:7): [True: 0, False: 1.93k]
  ------------------
 1314|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1314:9): [True: 0, False: 0]
  ------------------
 1315|      0|      return base64::compress_decode_base64<false, true, true>(
 1316|      0|          output, input, length, options, last_chunk_options);
 1317|      0|    } else {
 1318|      0|      return base64::compress_decode_base64<false, false, true>(
 1319|      0|          output, input, length, options, last_chunk_options);
 1320|      0|    }
 1321|  1.93k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1321:14): [True: 961, False: 973]
  ------------------
 1322|    961|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1322:9): [True: 0, False: 961]
  ------------------
 1323|      0|      return base64::compress_decode_base64<true, true, false>(
 1324|      0|          output, input, length, options, last_chunk_options);
 1325|    961|    } else {
 1326|    961|      return base64::compress_decode_base64<true, false, false>(
 1327|    961|          output, input, length, options, last_chunk_options);
 1328|    961|    }
 1329|    973|  } else {
 1330|    973|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1330:9): [True: 0, False: 973]
  ------------------
 1331|      0|      return base64::compress_decode_base64<false, true, false>(
 1332|      0|          output, input, length, options, last_chunk_options);
 1333|    973|    } else {
 1334|    973|      return base64::compress_decode_base64<false, false, false>(
 1335|    973|          output, input, length, options, last_chunk_options);
 1336|    973|    }
 1337|    973|  }
 1338|  1.93k|}
_ZNK7simdutf8westmere14implementation24base64_to_binary_detailsEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1342|  1.93k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1343|  1.93k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1343:7): [True: 0, False: 1.93k]
  ------------------
 1344|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1344:9): [True: 0, False: 0]
  ------------------
 1345|      0|      return base64::compress_decode_base64<false, true, true>(
 1346|      0|          output, input, length, options, last_chunk_options);
 1347|      0|    } else {
 1348|      0|      return base64::compress_decode_base64<false, false, true>(
 1349|      0|          output, input, length, options, last_chunk_options);
 1350|      0|    }
 1351|  1.93k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1351:14): [True: 961, False: 973]
  ------------------
 1352|    961|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1352:9): [True: 0, False: 961]
  ------------------
 1353|      0|      return base64::compress_decode_base64<true, true, false>(
 1354|      0|          output, input, length, options, last_chunk_options);
 1355|    961|    } else {
 1356|    961|      return base64::compress_decode_base64<true, false, false>(
 1357|    961|          output, input, length, options, last_chunk_options);
 1358|    961|    }
 1359|    973|  } else {
 1360|    973|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1360:9): [True: 0, False: 973]
  ------------------
 1361|      0|      return base64::compress_decode_base64<false, true, false>(
 1362|      0|          output, input, length, options, last_chunk_options);
 1363|    973|    } else {
 1364|    973|      return base64::compress_decode_base64<false, false, false>(
 1365|    973|          output, input, length, options, last_chunk_options);
 1366|    973|    }
 1367|    973|  }
 1368|  1.93k|}

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

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

