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

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

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

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

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

simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6413is_eight_byteIcEEbT_:
   19|  27.3M|template <class char_type> simdutf_constexpr23 bool is_eight_byte(char_type c) {
   20|  27.3M|  if constexpr (sizeof(char_type) == 1) {
   21|  27.3M|    return true;
   22|  27.3M|  }
   23|      0|  return uint8_t(c) == c;
   24|  27.3M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6413is_eight_byteIDsEEbT_:
   19|  5.99M|template <class char_type> simdutf_constexpr23 bool is_eight_byte(char_type c) {
   20|       |  if constexpr (sizeof(char_type) == 1) {
   21|       |    return true;
   22|       |  }
   23|  5.99M|  return uint8_t(c) == c;
   24|  5.99M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKcEEmT_m:
  654|  3.86k|maximal_binary_length_from_base64(InputPtr input, size_t length) noexcept {
  655|       |  // We process the padding characters ('=') at the end to make sure
  656|       |  // that we return an exact result when the input has no ignorable characters
  657|       |  // (e.g., spaces).
  658|  3.86k|  size_t padding = 0;
  659|  3.86k|  if (length > 0) {
  ------------------
  |  Branch (659:7): [True: 3.84k, False: 15]
  ------------------
  660|  3.84k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (660:9): [True: 210, False: 3.63k]
  ------------------
  661|    210|      padding++;
  662|    210|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (662:11): [True: 204, False: 6]
  |  Branch (662:25): [True: 30, False: 174]
  ------------------
  663|     30|        padding++;
  664|     30|      }
  665|    210|    }
  666|  3.84k|  }
  667|       |  // The input is not otherwise processed for ignorable characters or
  668|       |  // validation, so that the function runs in constant time (very fast). In
  669|       |  // practice, base64 inputs without ignorable characters are common and the
  670|       |  // common case are line separated inputs with relatively long lines (e.g., 76
  671|       |  // characters) which leads this function to a slight (1%) overestimation of
  672|       |  // the output size.
  673|       |  //
  674|       |  // Of course, some inputs might contain an arbitrary number of spaces or
  675|       |  // newlines, which would make this function return a very pessimistic output
  676|       |  // size but systems that produce base64 outputs typically do not do that and
  677|       |  // if they do, they do not care much about minimizing memory usage.
  678|       |  //
  679|       |  // In specialized applications, users may know that their input is line
  680|       |  // separated, which can be checked very quickly by by iterating (e.g., over 76
  681|       |  // character chunks, looking for the linefeed characters only). We could
  682|       |  // provide a specialized function for that, but it is not clear that the added
  683|       |  // complexity is worth it for us.
  684|       |  //
  685|  3.86k|  size_t actual_length = length - padding;
  686|  3.86k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (686:7): [True: 3.29k, False: 567]
  ------------------
  687|  3.29k|    return actual_length / 4 * 3;
  688|  3.29k|  }
  689|       |  // if we have a valid input, then the remainder must be 2 or 3 adding one or
  690|       |  // two extra bytes.
  691|    567|  return actual_length / 4 * 3 + (actual_length % 4) - 1;
  692|  3.86k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKDsEEmT_m:
  654|  3.90k|maximal_binary_length_from_base64(InputPtr input, size_t length) noexcept {
  655|       |  // We process the padding characters ('=') at the end to make sure
  656|       |  // that we return an exact result when the input has no ignorable characters
  657|       |  // (e.g., spaces).
  658|  3.90k|  size_t padding = 0;
  659|  3.90k|  if (length > 0) {
  ------------------
  |  Branch (659:7): [True: 3.88k, False: 15]
  ------------------
  660|  3.88k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (660:9): [True: 297, False: 3.58k]
  ------------------
  661|    297|      padding++;
  662|    297|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (662:11): [True: 291, False: 6]
  |  Branch (662:25): [True: 33, False: 258]
  ------------------
  663|     33|        padding++;
  664|     33|      }
  665|    297|    }
  666|  3.88k|  }
  667|       |  // The input is not otherwise processed for ignorable characters or
  668|       |  // validation, so that the function runs in constant time (very fast). In
  669|       |  // practice, base64 inputs without ignorable characters are common and the
  670|       |  // common case are line separated inputs with relatively long lines (e.g., 76
  671|       |  // characters) which leads this function to a slight (1%) overestimation of
  672|       |  // the output size.
  673|       |  //
  674|       |  // Of course, some inputs might contain an arbitrary number of spaces or
  675|       |  // newlines, which would make this function return a very pessimistic output
  676|       |  // size but systems that produce base64 outputs typically do not do that and
  677|       |  // if they do, they do not care much about minimizing memory usage.
  678|       |  //
  679|       |  // In specialized applications, users may know that their input is line
  680|       |  // separated, which can be checked very quickly by by iterating (e.g., over 76
  681|       |  // character chunks, looking for the linefeed characters only). We could
  682|       |  // provide a specialized function for that, but it is not clear that the added
  683|       |  // complexity is worth it for us.
  684|       |  //
  685|  3.90k|  size_t actual_length = length - padding;
  686|  3.90k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (686:7): [True: 3.40k, False: 492]
  ------------------
  687|  3.40k|    return actual_length / 4 * 3;
  688|  3.40k|  }
  689|       |  // if we have a valid input, then the remainder must be 2 or 3 adding one or
  690|       |  // two extra bytes.
  691|    492|  return actual_length / 4 * 3 + (actual_length % 4) - 1;
  692|  3.90k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIcEEbT_NS_14base64_optionsE:
   28|  18.9k|                                      simdutf::base64_options options) {
   29|  18.9k|  const uint8_t *to_base64 =
   30|  18.9k|      (options & base64_default_or_url)
  ------------------
  |  Branch (30:7): [True: 0, False: 18.9k]
  ------------------
   31|  18.9k|          ? tables::base64::to_base64_default_or_url_value
   32|  18.9k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (32:14): [True: 8.35k, False: 10.5k]
  ------------------
   33|  18.9k|                                    : tables::base64::to_base64_value);
   34|  18.9k|  const bool ignore_garbage =
   35|  18.9k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (35:7): [True: 0, False: 18.9k]
  ------------------
   36|  18.9k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (36:7): [True: 0, False: 18.9k]
  ------------------
   37|  18.9k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (37:7): [True: 0, False: 18.9k]
  ------------------
   38|  18.9k|  uint8_t code = to_base64[uint8_t(c)];
   39|  18.9k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (39:7): [True: 18.9k, False: 0]
  |  Branch (39:27): [True: 2.78k, False: 16.1k]
  ------------------
   40|  2.78k|    return false;
   41|  2.78k|  }
   42|  16.1k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (42:7): [True: 16.1k, False: 0]
  |  Branch (42:27): [True: 16.1k, False: 0]
  ------------------
   43|  16.1k|    return true;
   44|  16.1k|  }
   45|      0|  return ignore_garbage;
   46|  16.1k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIDsEEbT_NS_14base64_optionsE:
   28|  35.4k|                                      simdutf::base64_options options) {
   29|  35.4k|  const uint8_t *to_base64 =
   30|  35.4k|      (options & base64_default_or_url)
  ------------------
  |  Branch (30:7): [True: 0, False: 35.4k]
  ------------------
   31|  35.4k|          ? tables::base64::to_base64_default_or_url_value
   32|  35.4k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (32:14): [True: 15.4k, False: 20.0k]
  ------------------
   33|  35.4k|                                    : tables::base64::to_base64_value);
   34|  35.4k|  const bool ignore_garbage =
   35|  35.4k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (35:7): [True: 0, False: 35.4k]
  ------------------
   36|  35.4k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (36:7): [True: 0, False: 35.4k]
  ------------------
   37|  35.4k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (37:7): [True: 0, False: 35.4k]
  ------------------
   38|  35.4k|  uint8_t code = to_base64[uint8_t(c)];
   39|  35.4k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (39:7): [True: 35.4k, False: 0]
  |  Branch (39:27): [True: 3.42k, False: 32.0k]
  ------------------
   40|  3.42k|    return false;
   41|  3.42k|  }
   42|  32.0k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (42:7): [True: 32.0k, False: 0]
  |  Branch (42:27): [True: 32.0k, False: 0]
  ------------------
   43|  32.0k|    return true;
   44|  32.0k|  }
   45|      0|  return ignore_garbage;
   46|  32.0k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIcEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  100|  7.72k|                                           simdutf::base64_options options) {
  101|  7.72k|  const uint8_t *to_base64 =
  102|  7.72k|      (options & base64_default_or_url)
  ------------------
  |  Branch (102:7): [True: 0, False: 7.72k]
  ------------------
  103|  7.72k|          ? tables::base64::to_base64_default_or_url_value
  104|  7.72k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (104:14): [True: 3.69k, False: 4.03k]
  ------------------
  105|  7.72k|                                    : tables::base64::to_base64_value);
  106|  7.72k|  const bool ignore_garbage =
  107|  7.72k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (107:7): [True: 0, False: 7.72k]
  ------------------
  108|  7.72k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (108:7): [True: 0, False: 7.72k]
  ------------------
  109|  7.72k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (109:7): [True: 0, False: 7.72k]
  ------------------
  110|       |
  111|  7.72k|  size_t equalsigns = 0;
  112|       |  // We intentionally include trailing spaces in the full input length.
  113|       |  // See https://github.com/simdutf/simdutf/issues/824
  114|  7.72k|  size_t full_input_length = srclen;
  115|       |  // skip trailing spaces
  116|  9.31k|  while (!ignore_garbage && srclen > 0 &&
  ------------------
  |  Branch (116:10): [True: 9.31k, False: 0]
  |  Branch (116:29): [True: 9.25k, False: 66]
  ------------------
  117|  9.25k|         scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (117:10): [True: 9.25k, False: 0]
  ------------------
  118|  9.25k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (118:10): [True: 1.59k, False: 7.66k]
  ------------------
  119|  1.59k|    srclen--;
  120|  1.59k|  }
  121|  7.72k|  size_t equallocation =
  122|  7.72k|      srclen; // location of the first padding character if any
  123|  7.72k|  if (ignore_garbage) {
  ------------------
  |  Branch (123:7): [True: 0, False: 7.72k]
  ------------------
  124|       |    // Technically, we don't need to find the first padding character, we can
  125|       |    // just change our algorithms, but it adds substantial complexity.
  126|      0|    auto it = simdutf::find(src, src + srclen, '=');
  127|      0|    if (it != src + srclen) {
  ------------------
  |  Branch (127:9): [True: 0, False: 0]
  ------------------
  128|      0|      equallocation = it - src;
  129|      0|      equalsigns = 1;
  130|      0|      srclen = equallocation;
  131|      0|      full_input_length = equallocation + 1;
  132|      0|    }
  133|      0|    return {equalsigns, equallocation, srclen, full_input_length};
  134|      0|  }
  135|  7.72k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (135:7): [True: 7.72k, False: 0]
  |  Branch (135:26): [True: 7.66k, False: 66]
  |  Branch (135:40): [True: 420, False: 7.24k]
  ------------------
  136|       |    // This is the last '=' sign.
  137|    420|    equallocation = srclen - 1;
  138|    420|    srclen--;
  139|    420|    equalsigns = 1;
  140|       |    // skip trailing spaces
  141|    918|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (141:12): [True: 870, False: 48]
  |  Branch (141:26): [True: 870, False: 0]
  ------------------
  142|    870|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (142:12): [True: 498, False: 372]
  ------------------
  143|    498|      srclen--;
  144|    498|    }
  145|    420|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (145:9): [True: 372, False: 48]
  |  Branch (145:23): [True: 60, False: 312]
  ------------------
  146|       |      // This is the second '=' sign.
  147|     60|      equallocation = srclen - 1;
  148|     60|      srclen--;
  149|     60|      equalsigns = 2;
  150|     60|    }
  151|    420|  }
  152|  7.72k|  return {equalsigns, equallocation, srclen, full_input_length};
  153|  7.72k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6417patch_tail_resultENS_11full_resultEmmmmNS_27last_chunk_handling_optionsE:
  394|  11.0k|                  last_chunk_handling_options last_chunk_options) {
  395|  11.0k|  r.input_count += previous_input;
  396|  11.0k|  r.output_count += previous_output;
  397|  11.0k|  if (r.padding_error) {
  ------------------
  |  Branch (397:7): [True: 270, False: 10.8k]
  ------------------
  398|    270|    r.input_count = equallocation;
  399|    270|  }
  400|       |
  401|  11.0k|  if (r.error == error_code::SUCCESS) {
  ------------------
  |  Branch (401:7): [True: 6.75k, False: 4.33k]
  ------------------
  402|  6.75k|    if (!is_partial(last_chunk_options)) {
  ------------------
  |  Branch (402:9): [True: 2.25k, False: 4.49k]
  ------------------
  403|       |      // A success when we are not in stop_before_partial mode.
  404|       |      // means that we have consumed the whole input buffer.
  405|  2.25k|      r.input_count = full_input_length;
  406|  4.49k|    } else if (r.output_count % 3 != 0) {
  ------------------
  |  Branch (406:16): [True: 30, False: 4.46k]
  ------------------
  407|     30|      r.input_count = full_input_length;
  408|     30|    }
  409|  6.75k|  }
  410|  11.0k|  return r;
  411|  11.0k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIDsEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  100|  7.80k|                                           simdutf::base64_options options) {
  101|  7.80k|  const uint8_t *to_base64 =
  102|  7.80k|      (options & base64_default_or_url)
  ------------------
  |  Branch (102:7): [True: 0, False: 7.80k]
  ------------------
  103|  7.80k|          ? tables::base64::to_base64_default_or_url_value
  104|  7.80k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (104:14): [True: 3.85k, False: 3.94k]
  ------------------
  105|  7.80k|                                    : tables::base64::to_base64_value);
  106|  7.80k|  const bool ignore_garbage =
  107|  7.80k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (107:7): [True: 0, False: 7.80k]
  ------------------
  108|  7.80k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (108:7): [True: 0, False: 7.80k]
  ------------------
  109|  7.80k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (109:7): [True: 0, False: 7.80k]
  ------------------
  110|       |
  111|  7.80k|  size_t equalsigns = 0;
  112|       |  // We intentionally include trailing spaces in the full input length.
  113|       |  // See https://github.com/simdutf/simdutf/issues/824
  114|  7.80k|  size_t full_input_length = srclen;
  115|       |  // skip trailing spaces
  116|  9.32k|  while (!ignore_garbage && srclen > 0 &&
  ------------------
  |  Branch (116:10): [True: 9.32k, False: 0]
  |  Branch (116:29): [True: 9.25k, False: 66]
  ------------------
  117|  9.25k|         scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (117:10): [True: 7.38k, False: 1.87k]
  ------------------
  118|  7.38k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (118:10): [True: 1.52k, False: 5.86k]
  ------------------
  119|  1.52k|    srclen--;
  120|  1.52k|  }
  121|  7.80k|  size_t equallocation =
  122|  7.80k|      srclen; // location of the first padding character if any
  123|  7.80k|  if (ignore_garbage) {
  ------------------
  |  Branch (123:7): [True: 0, False: 7.80k]
  ------------------
  124|       |    // Technically, we don't need to find the first padding character, we can
  125|       |    // just change our algorithms, but it adds substantial complexity.
  126|      0|    auto it = simdutf::find(src, src + srclen, '=');
  127|      0|    if (it != src + srclen) {
  ------------------
  |  Branch (127:9): [True: 0, False: 0]
  ------------------
  128|      0|      equallocation = it - src;
  129|      0|      equalsigns = 1;
  130|      0|      srclen = equallocation;
  131|      0|      full_input_length = equallocation + 1;
  132|      0|    }
  133|      0|    return {equalsigns, equallocation, srclen, full_input_length};
  134|      0|  }
  135|  7.80k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (135:7): [True: 7.80k, False: 0]
  |  Branch (135:26): [True: 7.73k, False: 66]
  |  Branch (135:40): [True: 594, False: 7.14k]
  ------------------
  136|       |    // This is the last '=' sign.
  137|    594|    equallocation = srclen - 1;
  138|    594|    srclen--;
  139|    594|    equalsigns = 1;
  140|       |    // skip trailing spaces
  141|  1.72k|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (141:12): [True: 1.66k, False: 54]
  |  Branch (141:26): [True: 1.43k, False: 234]
  ------------------
  142|  1.43k|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (142:12): [True: 1.12k, False: 306]
  ------------------
  143|  1.12k|      srclen--;
  144|  1.12k|    }
  145|    594|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (145:9): [True: 540, False: 54]
  |  Branch (145:23): [True: 66, False: 474]
  ------------------
  146|       |      // This is the second '=' sign.
  147|     66|      equallocation = srclen - 1;
  148|     66|      srclen--;
  149|     66|      equalsigns = 2;
  150|     66|    }
  151|    594|  }
  152|  7.80k|  return {equalsigns, equallocation, srclen, full_input_length};
  153|  7.80k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIcEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  727|  2.57k|    last_chunk_handling_options last_chunk_options) noexcept {
  728|  2.57k|  const bool ignore_garbage =
  729|  2.57k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (729:7): [True: 0, False: 2.57k]
  ------------------
  730|  2.57k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (730:7): [True: 0, False: 2.57k]
  ------------------
  731|  2.57k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (731:7): [True: 0, False: 2.57k]
  ------------------
  732|  2.57k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  733|  2.57k|  size_t equallocation = ri.equallocation;
  734|  2.57k|  size_t equalsigns = ri.equalsigns;
  735|  2.57k|  length = ri.srclen;
  736|  2.57k|  size_t full_input_length = ri.full_input_length;
  737|  2.57k|  if (length == 0) {
  ------------------
  |  Branch (737:7): [True: 40, False: 2.53k]
  ------------------
  738|     40|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (738:9): [True: 40, False: 0]
  |  Branch (738:28): [True: 18, False: 22]
  ------------------
  739|     18|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
  740|     18|    }
  741|     22|    return {SUCCESS, full_input_length, 0};
  742|     40|  }
  743|  2.53k|  full_result r = scalar::base64::base64_tail_decode(
  744|  2.53k|      output, input, length, equalsigns, options, last_chunk_options);
  745|  2.53k|  r = scalar::base64::patch_tail_result(r, 0, 0, equallocation,
  746|  2.53k|                                        full_input_length, last_chunk_options);
  747|  2.53k|  if (!is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (747:7): [True: 1.50k, False: 1.03k]
  |  Branch (747:42): [True: 698, False: 804]
  ------------------
  748|    698|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (748:7): [True: 8, False: 690]
  |  Branch (748:25): [True: 8, False: 0]
  ------------------
  749|       |    // additional checks
  750|      8|    if ((r.output_count % 3 == 0) ||
  ------------------
  |  Branch (750:9): [True: 0, False: 8]
  ------------------
  751|      8|        ((r.output_count % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (751:9): [True: 0, False: 8]
  ------------------
  752|      0|      return {INVALID_BASE64_CHARACTER, equallocation, r.output_count, true};
  753|      0|    }
  754|      8|  }
  755|       |  // When is_partial(last_chunk_options) is true, we must either end with
  756|       |  // the end of the stream (beyond whitespace) or right after a non-ignorable
  757|       |  // character or at the very beginning of the stream.
  758|       |  // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  759|  2.53k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (759:7): [True: 1.03k, False: 1.50k]
  |  Branch (759:41): [True: 756, False: 278]
  ------------------
  760|    756|      r.input_count < full_input_length) {
  ------------------
  |  Branch (760:7): [True: 530, False: 226]
  ------------------
  761|       |    // First check if we can extend the input to the end of the stream
  762|  4.31k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (762:12): [True: 4.30k, False: 10]
  ------------------
  763|  4.30k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (763:12): [True: 3.78k, False: 520]
  ------------------
  764|  3.78k|      r.input_count++;
  765|  3.78k|    }
  766|       |    // If we are still not at the end of the stream, then we must backtrack
  767|       |    // to the last non-ignorable character.
  768|    530|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (768:9): [True: 520, False: 10]
  ------------------
  769|  4.04k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (769:14): [True: 3.92k, False: 112]
  ------------------
  770|  3.92k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (770:14): [True: 3.52k, False: 408]
  ------------------
  771|  3.52k|        r.input_count--;
  772|  3.52k|      }
  773|    520|    }
  774|    530|  }
  775|  2.53k|  return r;
  776|  2.53k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6418base64_tail_decodeIcEENS_11full_resultEPcPKT_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  371|  5.49k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  372|  5.49k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  373|  5.49k|                                        options, last_chunk_options);
  374|  5.49k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EcEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  164|  5.49k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  165|  5.49k|  char *dstend = dst + outlen;
  166|  5.49k|  (void)dstend;
  167|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  168|       |  // two branches (easily predicted):
  169|  5.49k|  const uint8_t *to_base64 =
  170|  5.49k|      (options & base64_default_or_url)
  ------------------
  |  Branch (170:7): [True: 0, False: 5.49k]
  ------------------
  171|  5.49k|          ? tables::base64::to_base64_default_or_url_value
  172|  5.49k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (172:14): [True: 2.64k, False: 2.84k]
  ------------------
  173|  5.49k|                                    : tables::base64::to_base64_value);
  174|  5.49k|  const uint32_t *d0 =
  175|  5.49k|      (options & base64_default_or_url)
  ------------------
  |  Branch (175:7): [True: 0, False: 5.49k]
  ------------------
  176|  5.49k|          ? tables::base64::base64_default_or_url::d0
  177|  5.49k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (177:14): [True: 2.64k, False: 2.84k]
  ------------------
  178|  5.49k|                                    : tables::base64::base64_default::d0);
  179|  5.49k|  const uint32_t *d1 =
  180|  5.49k|      (options & base64_default_or_url)
  ------------------
  |  Branch (180:7): [True: 0, False: 5.49k]
  ------------------
  181|  5.49k|          ? tables::base64::base64_default_or_url::d1
  182|  5.49k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (182:14): [True: 2.64k, False: 2.84k]
  ------------------
  183|  5.49k|                                    : tables::base64::base64_default::d1);
  184|  5.49k|  const uint32_t *d2 =
  185|  5.49k|      (options & base64_default_or_url)
  ------------------
  |  Branch (185:7): [True: 0, False: 5.49k]
  ------------------
  186|  5.49k|          ? tables::base64::base64_default_or_url::d2
  187|  5.49k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (187:14): [True: 2.64k, False: 2.84k]
  ------------------
  188|  5.49k|                                    : tables::base64::base64_default::d2);
  189|  5.49k|  const uint32_t *d3 =
  190|  5.49k|      (options & base64_default_or_url)
  ------------------
  |  Branch (190:7): [True: 0, False: 5.49k]
  ------------------
  191|  5.49k|          ? tables::base64::base64_default_or_url::d3
  192|  5.49k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (192:14): [True: 2.64k, False: 2.84k]
  ------------------
  193|  5.49k|                                    : tables::base64::base64_default::d3);
  194|  5.49k|  const bool ignore_garbage =
  195|  5.49k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (195:7): [True: 0, False: 5.49k]
  ------------------
  196|  5.49k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (196:7): [True: 0, False: 5.49k]
  ------------------
  197|  5.49k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (197:7): [True: 0, False: 5.49k]
  ------------------
  198|       |
  199|  5.49k|  const char_type *srcend = src + length;
  200|  5.49k|  const char_type *srcinit = src;
  201|  5.49k|  const char *dstinit = dst;
  202|       |
  203|  5.49k|  uint32_t x;
  204|  5.49k|  size_t idx;
  205|  5.49k|  uint8_t buffer[4];
  206|   116k|  while (true) {
  ------------------
  |  Branch (206:10): [True: 116k, Folded]
  ------------------
  207|  6.55M|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (207:12): [True: 6.55M, False: 3.45k]
  |  Branch (207:33): [True: 6.55M, False: 0]
  ------------------
  208|  6.55M|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (208:12): [True: 6.55M, False: 0]
  |  Branch (208:37): [True: 6.55M, False: 0]
  ------------------
  209|  6.55M|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (209:12): [True: 6.55M, False: 0]
  ------------------
  210|  6.55M|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (210:12): [True: 6.44M, False: 112k]
  ------------------
  211|  6.55M|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  212|  6.44M|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (212:11): [Folded, False: 6.44M]
  |  Branch (212:29): [True: 0, False: 0]
  ------------------
  213|      0|        return {OUTPUT_BUFFER_TOO_SMALL, size_t(src - srcinit),
  214|      0|                size_t(dst - dstinit)};
  215|      0|      }
  216|  6.44M|      *dst++ = static_cast<char>(x & 0xFF);
  217|  6.44M|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  218|  6.44M|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  219|  6.44M|      src += 4;
  220|  6.44M|    }
  221|   116k|    const char_type *srccur = src;
  222|   116k|    idx = 0;
  223|       |    // we need at least four characters.
  224|   116k|#ifdef __clang__
  225|       |    // If possible, we read four characters at a time. (It is an optimization.)
  226|   116k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (226:9): [True: 0, False: 116k]
  |  Branch (226:27): [True: 0, False: 0]
  ------------------
  227|      0|      char_type c0 = src[0];
  228|      0|      char_type c1 = src[1];
  229|      0|      char_type c2 = src[2];
  230|      0|      char_type c3 = src[3];
  231|       |
  232|      0|      uint8_t code0 = to_base64[uint8_t(c0)];
  233|      0|      uint8_t code1 = to_base64[uint8_t(c1)];
  234|      0|      uint8_t code2 = to_base64[uint8_t(c2)];
  235|      0|      uint8_t code3 = to_base64[uint8_t(c3)];
  236|       |
  237|      0|      buffer[idx] = code0;
  238|      0|      idx += (is_eight_byte(c0) && code0 <= 63);
  ------------------
  |  Branch (238:15): [True: 0, False: 0]
  |  Branch (238:36): [True: 0, False: 0]
  ------------------
  239|      0|      buffer[idx] = code1;
  240|      0|      idx += (is_eight_byte(c1) && code1 <= 63);
  ------------------
  |  Branch (240:15): [True: 0, False: 0]
  |  Branch (240:36): [True: 0, False: 0]
  ------------------
  241|      0|      buffer[idx] = code2;
  242|      0|      idx += (is_eight_byte(c2) && code2 <= 63);
  ------------------
  |  Branch (242:15): [True: 0, False: 0]
  |  Branch (242:36): [True: 0, False: 0]
  ------------------
  243|      0|      buffer[idx] = code3;
  244|      0|      idx += (is_eight_byte(c3) && code3 <= 63);
  ------------------
  |  Branch (244:15): [True: 0, False: 0]
  |  Branch (244:36): [True: 0, False: 0]
  ------------------
  245|      0|      src += 4;
  246|      0|    }
  247|   116k|#endif
  248|   875k|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (248:12): [True: 764k, False: 110k]
  |  Branch (248:25): [True: 760k, False: 4.25k]
  ------------------
  249|   760k|      char_type c = *src;
  250|       |
  251|   760k|      uint8_t code = to_base64[uint8_t(c)];
  252|   760k|      buffer[idx] = uint8_t(code);
  253|   760k|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (253:11): [True: 760k, False: 0]
  |  Branch (253:31): [True: 449k, False: 310k]
  ------------------
  254|   449k|        idx++;
  255|   449k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (255:18): [True: 310k, False: 0]
  ------------------
  256|   310k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (256:19): [True: 1.23k, False: 309k]
  |  Branch (256:32): [True: 0, False: 309k]
  ------------------
  257|  1.23k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  258|  1.23k|                size_t(dst - dstinit)};
  259|   309k|      } else {
  260|       |        // We have a space or a newline or garbage. We ignore it.
  261|   309k|      }
  262|   759k|      src++;
  263|   759k|    }
  264|   114k|    if (idx != 4) {
  ------------------
  |  Branch (264:9): [True: 4.25k, False: 110k]
  ------------------
  265|  4.25k|      simdutf_log_assert(idx < 4, "idx should be less than 4");
  266|       |      // We never should have that the number of base64 characters + the
  267|       |      // number of padding characters is more than 4.
  268|  4.25k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (268:11): [True: 4.25k, False: 0]
  |  Branch (268:30): [True: 6, False: 4.25k]
  ------------------
  269|      6|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  270|      6|                size_t(dst - dstinit), true};
  271|      6|      }
  272|       |
  273|       |      // The idea here is that in loose mode,
  274|       |      // if there is padding at all, it must be used
  275|       |      // to form 4-wise chunk. However, in loose mode,
  276|       |      // we do accept no padding at all.
  277|  4.25k|      if (!ignore_garbage &&
  ------------------
  |  Branch (277:11): [True: 4.25k, False: 0]
  ------------------
  278|  4.25k|          last_chunk_options == last_chunk_handling_options::loose &&
  ------------------
  |  Branch (278:11): [True: 1.84k, False: 2.40k]
  ------------------
  279|  1.84k|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (279:11): [True: 1.11k, False: 730]
  |  Branch (279:25): [True: 12, False: 1.10k]
  ------------------
  280|     12|          ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (280:11): [True: 6, False: 6]
  ------------------
  281|      6|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  282|      6|                size_t(dst - dstinit), true};
  283|      6|      } else
  284|       |
  285|       |        // The idea here is that in strict mode, we do not want to accept
  286|       |        // incomplete base64 chunks. So if the chunk was otherwise valid, we
  287|       |        // return BASE64_INPUT_REMAINDER.
  288|  4.24k|        if (!ignore_garbage &&
  ------------------
  |  Branch (288:13): [True: 4.24k, False: 0]
  ------------------
  289|  4.24k|            last_chunk_options == last_chunk_handling_options::strict &&
  ------------------
  |  Branch (289:13): [True: 332, False: 3.91k]
  ------------------
  290|    332|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (290:13): [True: 162, False: 170]
  |  Branch (290:27): [True: 114, False: 48]
  ------------------
  291|       |          // The partial chunk was at src - idx
  292|    114|          return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  293|    114|                  size_t(dst - dstinit), true};
  294|    114|        } else
  295|       |          // If there is a partial chunk with insufficient padding, with
  296|       |          // stop_before_partial, we need to just ignore it. In "only full"
  297|       |          // mode, skip the minute there are padding characters.
  298|  4.13k|          if ((last_chunk_options ==
  ------------------
  |  Branch (298:16): [True: 2.07k, False: 2.05k]
  ------------------
  299|  4.13k|                   last_chunk_handling_options::stop_before_partial &&
  300|  2.07k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (300:16): [True: 2.06k, False: 12]
  |  Branch (300:50): [True: 1.59k, False: 470]
  ------------------
  301|  1.59k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (301:17): [True: 678, False: 912]
  |  Branch (301:29): [True: 882, False: 30]
  ------------------
  302|  2.57k|              (last_chunk_options ==
  ------------------
  |  Branch (302:16): [True: 0, False: 2.57k]
  ------------------
  303|  2.57k|                   last_chunk_handling_options::only_full_chunks &&
  304|  1.56k|               (idx >= 2 || padding_characters == 0))) {
  ------------------
  |  Branch (304:17): [True: 0, False: 0]
  |  Branch (304:29): [True: 0, False: 0]
  ------------------
  305|       |            // partial means that we are *not* going to consume the read
  306|       |            // characters. We need to rewind the src pointer.
  307|  1.56k|            src = srccur;
  308|  1.56k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  309|  2.57k|          } else {
  310|  2.57k|            if (idx == 2) {
  ------------------
  |  Branch (310:17): [True: 672, False: 1.89k]
  ------------------
  311|    672|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  312|    672|                                (uint32_t(buffer[1]) << 2 * 6);
  313|    672|              if (!ignore_garbage &&
  ------------------
  |  Branch (313:19): [True: 672, False: 0]
  ------------------
  314|    672|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (314:19): [True: 30, False: 642]
  ------------------
  315|     30|                  (triple & 0xffff)) {
  ------------------
  |  Branch (315:19): [True: 18, False: 12]
  ------------------
  316|     18|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  317|     18|                        size_t(dst - dstinit)};
  318|     18|              }
  319|    654|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (319:19): [Folded, False: 654]
  |  Branch (319:37): [True: 0, False: 0]
  ------------------
  320|      0|                return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  321|      0|                        size_t(dst - dstinit)};
  322|      0|              }
  323|    654|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  324|  1.89k|            } else if (idx == 3) {
  ------------------
  |  Branch (324:24): [True: 498, False: 1.40k]
  ------------------
  325|    498|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  326|    498|                                (uint32_t(buffer[1]) << 2 * 6) +
  327|    498|                                (uint32_t(buffer[2]) << 1 * 6);
  328|    498|              if (!ignore_garbage &&
  ------------------
  |  Branch (328:19): [True: 498, False: 0]
  ------------------
  329|    498|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (329:19): [True: 18, False: 480]
  ------------------
  330|     18|                  (triple & 0xff)) {
  ------------------
  |  Branch (330:19): [True: 12, False: 6]
  ------------------
  331|     12|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  332|     12|                        size_t(dst - dstinit)};
  333|     12|              }
  334|    486|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (334:19): [Folded, False: 486]
  |  Branch (334:37): [True: 0, False: 0]
  ------------------
  335|      0|                return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  336|      0|                        size_t(dst - dstinit)};
  337|      0|              }
  338|    486|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  339|    486|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  340|  1.40k|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (340:24): [True: 1.40k, False: 0]
  |  Branch (340:43): [True: 366, False: 1.03k]
  ------------------
  341|    366|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (341:25): [True: 336, False: 30]
  ------------------
  342|     30|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (342:26): [True: 30, False: 0]
  ------------------
  343|    366|                         padding_characters > 0))) {
  ------------------
  |  Branch (343:26): [True: 30, False: 0]
  ------------------
  344|    366|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  345|    366|                      size_t(dst - dstinit)};
  346|  1.03k|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (346:24): [True: 1.03k, False: 0]
  |  Branch (346:43): [True: 1.03k, False: 0]
  |  Branch (346:55): [True: 12, False: 1.02k]
  ------------------
  347|     12|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  348|     12|                      size_t(dst - dstinit), true};
  349|     12|            }
  350|  2.16k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  351|  2.57k|          }
  352|  4.25k|    }
  353|   110k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (353:9): [Folded, False: 110k]
  |  Branch (353:27): [True: 0, False: 0]
  ------------------
  354|      0|      return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  355|      0|              size_t(dst - dstinit)};
  356|      0|    }
  357|   110k|    uint32_t triple =
  358|   110k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  359|   110k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  360|   110k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  361|   110k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  362|   110k|    *dst++ = static_cast<char>(triple & 0xFF);
  363|   110k|  }
  364|  5.49k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIDsEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  727|  2.60k|    last_chunk_handling_options last_chunk_options) noexcept {
  728|  2.60k|  const bool ignore_garbage =
  729|  2.60k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (729:7): [True: 0, False: 2.60k]
  ------------------
  730|  2.60k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (730:7): [True: 0, False: 2.60k]
  ------------------
  731|  2.60k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (731:7): [True: 0, False: 2.60k]
  ------------------
  732|  2.60k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  733|  2.60k|  size_t equallocation = ri.equallocation;
  734|  2.60k|  size_t equalsigns = ri.equalsigns;
  735|  2.60k|  length = ri.srclen;
  736|  2.60k|  size_t full_input_length = ri.full_input_length;
  737|  2.60k|  if (length == 0) {
  ------------------
  |  Branch (737:7): [True: 42, False: 2.55k]
  ------------------
  738|     42|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (738:9): [True: 42, False: 0]
  |  Branch (738:28): [True: 20, False: 22]
  ------------------
  739|     20|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
  740|     20|    }
  741|     22|    return {SUCCESS, full_input_length, 0};
  742|     42|  }
  743|  2.55k|  full_result r = scalar::base64::base64_tail_decode(
  744|  2.55k|      output, input, length, equalsigns, options, last_chunk_options);
  745|  2.55k|  r = scalar::base64::patch_tail_result(r, 0, 0, equallocation,
  746|  2.55k|                                        full_input_length, last_chunk_options);
  747|  2.55k|  if (!is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (747:7): [True: 968, False: 1.59k]
  |  Branch (747:42): [True: 236, False: 732]
  ------------------
  748|    236|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (748:7): [True: 6, False: 230]
  |  Branch (748:25): [True: 6, False: 0]
  ------------------
  749|       |    // additional checks
  750|      6|    if ((r.output_count % 3 == 0) ||
  ------------------
  |  Branch (750:9): [True: 0, False: 6]
  ------------------
  751|      6|        ((r.output_count % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (751:9): [True: 0, False: 6]
  ------------------
  752|      0|      return {INVALID_BASE64_CHARACTER, equallocation, r.output_count, true};
  753|      0|    }
  754|      6|  }
  755|       |  // When is_partial(last_chunk_options) is true, we must either end with
  756|       |  // the end of the stream (beyond whitespace) or right after a non-ignorable
  757|       |  // character or at the very beginning of the stream.
  758|       |  // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  759|  2.55k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (759:7): [True: 1.59k, False: 968]
  |  Branch (759:41): [True: 954, False: 636]
  ------------------
  760|    954|      r.input_count < full_input_length) {
  ------------------
  |  Branch (760:7): [True: 660, False: 294]
  ------------------
  761|       |    // First check if we can extend the input to the end of the stream
  762|  8.45k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (762:12): [True: 8.44k, False: 12]
  ------------------
  763|  8.44k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (763:12): [True: 7.79k, False: 648]
  ------------------
  764|  7.79k|      r.input_count++;
  765|  7.79k|    }
  766|       |    // If we are still not at the end of the stream, then we must backtrack
  767|       |    // to the last non-ignorable character.
  768|    660|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (768:9): [True: 648, False: 12]
  ------------------
  769|  8.18k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (769:14): [True: 8.02k, False: 156]
  ------------------
  770|  8.02k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (770:14): [True: 7.53k, False: 492]
  ------------------
  771|  7.53k|        r.input_count--;
  772|  7.53k|      }
  773|    648|    }
  774|    660|  }
  775|  2.55k|  return r;
  776|  2.55k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6418base64_tail_decodeIDsEENS_11full_resultEPcPKT_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  371|  5.59k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  372|  5.59k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  373|  5.59k|                                        options, last_chunk_options);
  374|  5.59k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EDsEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  164|  5.59k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  165|  5.59k|  char *dstend = dst + outlen;
  166|  5.59k|  (void)dstend;
  167|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  168|       |  // two branches (easily predicted):
  169|  5.59k|  const uint8_t *to_base64 =
  170|  5.59k|      (options & base64_default_or_url)
  ------------------
  |  Branch (170:7): [True: 0, False: 5.59k]
  ------------------
  171|  5.59k|          ? tables::base64::to_base64_default_or_url_value
  172|  5.59k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (172:14): [True: 2.75k, False: 2.83k]
  ------------------
  173|  5.59k|                                    : tables::base64::to_base64_value);
  174|  5.59k|  const uint32_t *d0 =
  175|  5.59k|      (options & base64_default_or_url)
  ------------------
  |  Branch (175:7): [True: 0, False: 5.59k]
  ------------------
  176|  5.59k|          ? tables::base64::base64_default_or_url::d0
  177|  5.59k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (177:14): [True: 2.75k, False: 2.83k]
  ------------------
  178|  5.59k|                                    : tables::base64::base64_default::d0);
  179|  5.59k|  const uint32_t *d1 =
  180|  5.59k|      (options & base64_default_or_url)
  ------------------
  |  Branch (180:7): [True: 0, False: 5.59k]
  ------------------
  181|  5.59k|          ? tables::base64::base64_default_or_url::d1
  182|  5.59k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (182:14): [True: 2.75k, False: 2.83k]
  ------------------
  183|  5.59k|                                    : tables::base64::base64_default::d1);
  184|  5.59k|  const uint32_t *d2 =
  185|  5.59k|      (options & base64_default_or_url)
  ------------------
  |  Branch (185:7): [True: 0, False: 5.59k]
  ------------------
  186|  5.59k|          ? tables::base64::base64_default_or_url::d2
  187|  5.59k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (187:14): [True: 2.75k, False: 2.83k]
  ------------------
  188|  5.59k|                                    : tables::base64::base64_default::d2);
  189|  5.59k|  const uint32_t *d3 =
  190|  5.59k|      (options & base64_default_or_url)
  ------------------
  |  Branch (190:7): [True: 0, False: 5.59k]
  ------------------
  191|  5.59k|          ? tables::base64::base64_default_or_url::d3
  192|  5.59k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (192:14): [True: 2.75k, False: 2.83k]
  ------------------
  193|  5.59k|                                    : tables::base64::base64_default::d3);
  194|  5.59k|  const bool ignore_garbage =
  195|  5.59k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (195:7): [True: 0, False: 5.59k]
  ------------------
  196|  5.59k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (196:7): [True: 0, False: 5.59k]
  ------------------
  197|  5.59k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (197:7): [True: 0, False: 5.59k]
  ------------------
  198|       |
  199|  5.59k|  const char_type *srcend = src + length;
  200|  5.59k|  const char_type *srcinit = src;
  201|  5.59k|  const char *dstinit = dst;
  202|       |
  203|  5.59k|  uint32_t x;
  204|  5.59k|  size_t idx;
  205|  5.59k|  uint8_t buffer[4];
  206|  84.9k|  while (true) {
  ------------------
  |  Branch (206:10): [True: 84.9k, Folded]
  ------------------
  207|  1.31M|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (207:12): [True: 1.31M, False: 3.08k]
  |  Branch (207:33): [True: 1.31M, False: 334]
  ------------------
  208|  1.31M|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (208:12): [True: 1.31M, False: 190]
  |  Branch (208:37): [True: 1.31M, False: 188]
  ------------------
  209|  1.31M|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (209:12): [True: 1.31M, False: 294]
  ------------------
  210|  1.31M|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (210:12): [True: 1.23M, False: 80.8k]
  ------------------
  211|  1.31M|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  212|  1.23M|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (212:11): [Folded, False: 1.23M]
  |  Branch (212:29): [True: 0, False: 0]
  ------------------
  213|      0|        return {OUTPUT_BUFFER_TOO_SMALL, size_t(src - srcinit),
  214|      0|                size_t(dst - dstinit)};
  215|      0|      }
  216|  1.23M|      *dst++ = static_cast<char>(x & 0xFF);
  217|  1.23M|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  218|  1.23M|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  219|  1.23M|      src += 4;
  220|  1.23M|    }
  221|  84.9k|    const char_type *srccur = src;
  222|  84.9k|    idx = 0;
  223|       |    // we need at least four characters.
  224|  84.9k|#ifdef __clang__
  225|       |    // If possible, we read four characters at a time. (It is an optimization.)
  226|  84.9k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (226:9): [True: 0, False: 84.9k]
  |  Branch (226:27): [True: 0, False: 0]
  ------------------
  227|      0|      char_type c0 = src[0];
  228|      0|      char_type c1 = src[1];
  229|      0|      char_type c2 = src[2];
  230|      0|      char_type c3 = src[3];
  231|       |
  232|      0|      uint8_t code0 = to_base64[uint8_t(c0)];
  233|      0|      uint8_t code1 = to_base64[uint8_t(c1)];
  234|      0|      uint8_t code2 = to_base64[uint8_t(c2)];
  235|      0|      uint8_t code3 = to_base64[uint8_t(c3)];
  236|       |
  237|      0|      buffer[idx] = code0;
  238|      0|      idx += (is_eight_byte(c0) && code0 <= 63);
  ------------------
  |  Branch (238:15): [True: 0, False: 0]
  |  Branch (238:36): [True: 0, False: 0]
  ------------------
  239|      0|      buffer[idx] = code1;
  240|      0|      idx += (is_eight_byte(c1) && code1 <= 63);
  ------------------
  |  Branch (240:15): [True: 0, False: 0]
  |  Branch (240:36): [True: 0, False: 0]
  ------------------
  241|      0|      buffer[idx] = code2;
  242|      0|      idx += (is_eight_byte(c2) && code2 <= 63);
  ------------------
  |  Branch (242:15): [True: 0, False: 0]
  |  Branch (242:36): [True: 0, False: 0]
  ------------------
  243|      0|      buffer[idx] = code3;
  244|      0|      idx += (is_eight_byte(c3) && code3 <= 63);
  ------------------
  |  Branch (244:15): [True: 0, False: 0]
  |  Branch (244:36): [True: 0, False: 0]
  ------------------
  245|      0|      src += 4;
  246|      0|    }
  247|  84.9k|#endif
  248|   575k|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (248:12): [True: 495k, False: 79.3k]
  |  Branch (248:25): [True: 492k, False: 3.44k]
  ------------------
  249|   492k|      char_type c = *src;
  250|       |
  251|   492k|      uint8_t code = to_base64[uint8_t(c)];
  252|   492k|      buffer[idx] = uint8_t(code);
  253|   492k|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (253:11): [True: 490k, False: 1.41k]
  |  Branch (253:31): [True: 324k, False: 166k]
  ------------------
  254|   324k|        idx++;
  255|   324k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (255:18): [True: 168k, False: 0]
  ------------------
  256|   168k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (256:19): [True: 1.52k, False: 166k]
  |  Branch (256:32): [True: 624, False: 165k]
  ------------------
  257|  2.15k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  258|  2.15k|                size_t(dst - dstinit)};
  259|   165k|      } else {
  260|       |        // We have a space or a newline or garbage. We ignore it.
  261|   165k|      }
  262|   490k|      src++;
  263|   490k|    }
  264|  82.7k|    if (idx != 4) {
  ------------------
  |  Branch (264:9): [True: 3.44k, False: 79.3k]
  ------------------
  265|  3.44k|      simdutf_log_assert(idx < 4, "idx should be less than 4");
  266|       |      // We never should have that the number of base64 characters + the
  267|       |      // number of padding characters is more than 4.
  268|  3.44k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (268:11): [True: 3.44k, False: 0]
  |  Branch (268:30): [True: 12, False: 3.43k]
  ------------------
  269|     12|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  270|     12|                size_t(dst - dstinit), true};
  271|     12|      }
  272|       |
  273|       |      // The idea here is that in loose mode,
  274|       |      // if there is padding at all, it must be used
  275|       |      // to form 4-wise chunk. However, in loose mode,
  276|       |      // we do accept no padding at all.
  277|  3.43k|      if (!ignore_garbage &&
  ------------------
  |  Branch (277:11): [True: 3.43k, False: 0]
  ------------------
  278|  3.43k|          last_chunk_options == last_chunk_handling_options::loose &&
  ------------------
  |  Branch (278:11): [True: 660, False: 2.77k]
  ------------------
  279|    660|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (279:11): [True: 384, False: 276]
  |  Branch (279:25): [True: 12, False: 372]
  ------------------
  280|     12|          ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (280:11): [True: 6, False: 6]
  ------------------
  281|      6|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  282|      6|                size_t(dst - dstinit), true};
  283|      6|      } else
  284|       |
  285|       |        // The idea here is that in strict mode, we do not want to accept
  286|       |        // incomplete base64 chunks. So if the chunk was otherwise valid, we
  287|       |        // return BASE64_INPUT_REMAINDER.
  288|  3.42k|        if (!ignore_garbage &&
  ------------------
  |  Branch (288:13): [True: 3.42k, False: 0]
  ------------------
  289|  3.42k|            last_chunk_options == last_chunk_handling_options::strict &&
  ------------------
  |  Branch (289:13): [True: 284, False: 3.14k]
  ------------------
  290|    284|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (290:13): [True: 156, False: 128]
  |  Branch (290:27): [True: 102, False: 54]
  ------------------
  291|       |          // The partial chunk was at src - idx
  292|    102|          return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  293|    102|                  size_t(dst - dstinit), true};
  294|    102|        } else
  295|       |          // If there is a partial chunk with insufficient padding, with
  296|       |          // stop_before_partial, we need to just ignore it. In "only full"
  297|       |          // mode, skip the minute there are padding characters.
  298|  3.32k|          if ((last_chunk_options ==
  ------------------
  |  Branch (298:16): [True: 2.48k, False: 836]
  ------------------
  299|  3.32k|                   last_chunk_handling_options::stop_before_partial &&
  300|  2.48k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (300:16): [True: 2.47k, False: 18]
  |  Branch (300:50): [True: 1.96k, False: 502]
  ------------------
  301|  1.96k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (301:17): [True: 942, False: 1.02k]
  |  Branch (301:29): [True: 1.00k, False: 24]
  ------------------
  302|  1.38k|              (last_chunk_options ==
  ------------------
  |  Branch (302:16): [True: 0, False: 1.38k]
  ------------------
  303|  1.38k|                   last_chunk_handling_options::only_full_chunks &&
  304|  1.94k|               (idx >= 2 || padding_characters == 0))) {
  ------------------
  |  Branch (304:17): [True: 0, False: 0]
  |  Branch (304:29): [True: 0, False: 0]
  ------------------
  305|       |            // partial means that we are *not* going to consume the read
  306|       |            // characters. We need to rewind the src pointer.
  307|  1.94k|            src = srccur;
  308|  1.94k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  309|  1.94k|          } else {
  310|  1.38k|            if (idx == 2) {
  ------------------
  |  Branch (310:17): [True: 234, False: 1.14k]
  ------------------
  311|    234|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  312|    234|                                (uint32_t(buffer[1]) << 2 * 6);
  313|    234|              if (!ignore_garbage &&
  ------------------
  |  Branch (313:19): [True: 234, False: 0]
  ------------------
  314|    234|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (314:19): [True: 30, False: 204]
  ------------------
  315|     30|                  (triple & 0xffff)) {
  ------------------
  |  Branch (315:19): [True: 24, False: 6]
  ------------------
  316|     24|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  317|     24|                        size_t(dst - dstinit)};
  318|     24|              }
  319|    210|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (319:19): [Folded, False: 210]
  |  Branch (319:37): [True: 0, False: 0]
  ------------------
  320|      0|                return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  321|      0|                        size_t(dst - dstinit)};
  322|      0|              }
  323|    210|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  324|  1.14k|            } else if (idx == 3) {
  ------------------
  |  Branch (324:24): [True: 216, False: 930]
  ------------------
  325|    216|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  326|    216|                                (uint32_t(buffer[1]) << 2 * 6) +
  327|    216|                                (uint32_t(buffer[2]) << 1 * 6);
  328|    216|              if (!ignore_garbage &&
  ------------------
  |  Branch (328:19): [True: 216, False: 0]
  ------------------
  329|    216|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (329:19): [True: 24, False: 192]
  ------------------
  330|     24|                  (triple & 0xff)) {
  ------------------
  |  Branch (330:19): [True: 18, False: 6]
  ------------------
  331|     18|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  332|     18|                        size_t(dst - dstinit)};
  333|     18|              }
  334|    198|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (334:19): [Folded, False: 198]
  |  Branch (334:37): [True: 0, False: 0]
  ------------------
  335|      0|                return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  336|      0|                        size_t(dst - dstinit)};
  337|      0|              }
  338|    198|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  339|    198|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  340|    930|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (340:24): [True: 930, False: 0]
  |  Branch (340:43): [True: 240, False: 690]
  ------------------
  341|    240|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (341:25): [True: 216, False: 24]
  ------------------
  342|     24|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (342:26): [True: 24, False: 0]
  ------------------
  343|    240|                         padding_characters > 0))) {
  ------------------
  |  Branch (343:26): [True: 24, False: 0]
  ------------------
  344|    240|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  345|    240|                      size_t(dst - dstinit)};
  346|    690|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (346:24): [True: 690, False: 0]
  |  Branch (346:43): [True: 690, False: 0]
  |  Branch (346:55): [True: 12, False: 678]
  ------------------
  347|     12|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  348|     12|                      size_t(dst - dstinit), true};
  349|     12|            }
  350|  1.08k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  351|  1.38k|          }
  352|  3.43k|    }
  353|  79.3k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (353:9): [Folded, False: 79.3k]
  |  Branch (353:27): [True: 0, False: 0]
  ------------------
  354|      0|      return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  355|      0|              size_t(dst - dstinit)};
  356|      0|    }
  357|  79.3k|    uint32_t triple =
  358|  79.3k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  359|  79.3k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  360|  79.3k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  361|  79.3k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  362|  79.3k|    *dst++ = static_cast<char>(triple & 0xFF);
  363|  79.3k|  }
  364|  5.59k|}

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

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

simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.23k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.23k|  const uint8_t *to_base64 =
   47|  1.23k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.23k]
  ------------------
   48|  1.23k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.23k, Folded]
  ------------------
   49|  1.23k|                                   : tables::base64::to_base64_value);
   50|  1.23k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.23k|  size_t equallocation = ri.equallocation;
   52|  1.23k|  size_t equalsigns = ri.equalsigns;
   53|  1.23k|  srclen = ri.srclen;
   54|  1.23k|  size_t full_input_length = ri.full_input_length;
   55|  1.23k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 12, False: 1.22k]
  ------------------
   56|     12|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 12, Folded]
  |  Branch (56:28): [True: 6, False: 6]
  ------------------
   57|      6|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      6|    }
   59|      6|    return {SUCCESS, full_input_length, 0};
   60|     12|  }
   61|  1.22k|  char *end_of_safe_64byte_zone =
   62|  1.22k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 44, False: 1.17k]
  ------------------
   63|  1.22k|          ? nullptr
   64|  1.22k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 382, False: 794]
  ------------------
   65|  1.17k|                                        : dst);
   66|       |
   67|  1.22k|  const chartype *const srcinit = src;
   68|  1.22k|  const char *const dstinit = dst;
   69|  1.22k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.22k|  constexpr size_t block_size = 6;
   72|  1.22k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.22k|  char buffer[block_size * 64];
   74|  1.22k|  char *bufferptr = buffer;
   75|  1.22k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 982, False: 238]
  ------------------
   76|    982|    const chartype *const srcend64 = src + srclen - 64;
   77|   142k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 142k, False: 632]
  ------------------
   78|   142k|      block64 b(src);
   79|   142k|      src += 64;
   80|   142k|      uint64_t error = 0;
   81|   142k|      const uint64_t badcharmask =
   82|   142k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   142k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 142k, Folded]
  |  Branch (83:30): [True: 350, False: 141k]
  ------------------
   84|    350|        src -= 64;
   85|    350|        const size_t error_offset = trailing_zeroes(error);
   86|    350|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    350|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    350|      }
   89|   141k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 51.0k, False: 90.8k]
  ------------------
   90|  51.0k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  90.8k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 18.7k, False: 72.1k]
  ------------------
   92|  18.7k|        b.copy_block(bufferptr);
   93|  18.7k|        bufferptr += 64;
   94|  72.1k|      } else {
   95|  72.1k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 72.0k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|  72.0k|        } else {
   98|  72.0k|          b.base64_decode_block(dst);
   99|  72.0k|        }
  100|  72.1k|        dst += 48;
  101|  72.1k|      }
  102|   141k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 13.4k, False: 128k]
  ------------------
  103|  67.1k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 53.7k, False: 13.4k]
  ------------------
  104|  53.7k|          base64_decode_block(dst, buffer + i * 64);
  105|  53.7k|          dst += 48;
  106|  53.7k|        }
  107|  13.4k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 13.4k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  13.4k|        } else {
  110|  13.4k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  13.4k|        }
  112|  13.4k|        dst += 48;
  113|  13.4k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  13.4k|                    64); // 64 might be too much
  115|  13.4k|        bufferptr -= (block_size - 1) * 64;
  116|  13.4k|      }
  117|   141k|    }
  118|    982|  }
  119|       |
  120|    870|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    870|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    870|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 570, False: 300]
  |  Branch (124:26): [True: 72, False: 498]
  ------------------
  125|       |
  126|  1.10k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.05k, False: 50]
  |  Branch (126:52): [True: 1.03k, False: 16]
  ------------------
  127|  1.03k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.03k|      *bufferptr = char(val);
  129|  1.03k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.03k, Folded]
  ------------------
  130|  1.03k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.03k]
  |  Branch (130:52): [True: 6, False: 1.03k]
  ------------------
  131|      6|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      6|                size_t(dst - dstinit)};
  133|      6|      }
  134|  1.03k|      bufferptr += (val <= 63);
  135|  1.03k|      src++;
  136|  1.03k|    }
  137|     72|  }
  138|       |
  139|  1.27k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 410, False: 864]
  ------------------
  140|    410|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 34, False: 376]
  ------------------
  141|     34|      base64_decode_block_safe(dst, buffer_start);
  142|    376|    } else {
  143|    376|      base64_decode_block(dst, buffer_start);
  144|    376|    }
  145|    410|    dst += 48;
  146|    410|  }
  147|    864|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 514, False: 350]
  ------------------
  148|  4.26k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.75k, False: 514]
  ------------------
  149|  3.75k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.75k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.75k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.75k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.75k|                        << 8;
  154|  3.75k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.75k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.75k|#endif
  157|  3.75k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.75k|      dst += 3;
  160|  3.75k|      buffer_start += 4;
  161|  3.75k|    }
  162|    514|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 120, False: 394]
  ------------------
  163|    120|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    120|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    120|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    120|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    120|                        << 8;
  168|    120|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    120|      triple = scalar::u32_swap_bytes(triple);
  170|    120|#endif
  171|    120|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    120|      dst += 3;
  174|    120|      buffer_start += 4;
  175|    120|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    514|    int leftover = int(bufferptr - buffer_start);
  179|  1.28k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 774, False: 514]
  ------------------
  180|    774|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 774, Folded]
  ------------------
  181|  5.37k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.59k, False: 774]
  ------------------
  182|  4.59k|          src--;
  183|  4.59k|        }
  184|    774|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    774|      src--;
  190|    774|      leftover--;
  191|    774|    }
  192|    514|  }
  193|    864|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 714, False: 150]
  ------------------
  194|    714|    full_result r = scalar::base64::base64_tail_decode(
  195|    714|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    714|    r = scalar::base64::patch_tail_result(
  197|    714|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    714|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    714|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 326, False: 388]
  |  Branch (203:43): [True: 294, False: 32]
  ------------------
  204|    294|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 246, False: 48]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    612|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 606, False: 6]
  ------------------
  207|    606|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 366, False: 240]
  ------------------
  208|    366|        r.input_count++;
  209|    366|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    246|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 240, False: 6]
  ------------------
  213|  1.79k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.73k, False: 56]
  ------------------
  214|  1.73k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.55k, False: 184]
  ------------------
  215|  1.55k|          r.input_count--;
  216|  1.55k|        }
  217|    240|      }
  218|    246|    }
  219|    714|    return r;
  220|    714|  }
  221|    150|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 150, Folded]
  |  Branch (221:26): [True: 0, False: 150]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    150|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    150|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.34k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.34k|  const uint8_t *to_base64 =
   47|  1.34k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.34k]
  ------------------
   48|  1.34k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.34k]
  ------------------
   49|  1.34k|                                   : tables::base64::to_base64_value);
   50|  1.34k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.34k|  size_t equallocation = ri.equallocation;
   52|  1.34k|  size_t equalsigns = ri.equalsigns;
   53|  1.34k|  srclen = ri.srclen;
   54|  1.34k|  size_t full_input_length = ri.full_input_length;
   55|  1.34k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 28, False: 1.31k]
  ------------------
   56|     28|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 28, Folded]
  |  Branch (56:28): [True: 12, False: 16]
  ------------------
   57|     12|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     12|    }
   59|     16|    return {SUCCESS, full_input_length, 0};
   60|     28|  }
   61|  1.31k|  char *end_of_safe_64byte_zone =
   62|  1.31k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 50, False: 1.26k]
  ------------------
   63|  1.31k|          ? nullptr
   64|  1.31k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 418, False: 848]
  ------------------
   65|  1.26k|                                        : dst);
   66|       |
   67|  1.31k|  const chartype *const srcinit = src;
   68|  1.31k|  const char *const dstinit = dst;
   69|  1.31k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.31k|  constexpr size_t block_size = 6;
   72|  1.31k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.31k|  char buffer[block_size * 64];
   74|  1.31k|  char *bufferptr = buffer;
   75|  1.31k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 1.02k, False: 290]
  ------------------
   76|  1.02k|    const chartype *const srcend64 = src + srclen - 64;
   77|   272k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 272k, False: 656]
  ------------------
   78|   272k|      block64 b(src);
   79|   272k|      src += 64;
   80|   272k|      uint64_t error = 0;
   81|   272k|      const uint64_t badcharmask =
   82|   272k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   272k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 272k, Folded]
  |  Branch (83:30): [True: 370, False: 271k]
  ------------------
   84|    370|        src -= 64;
   85|    370|        const size_t error_offset = trailing_zeroes(error);
   86|    370|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    370|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    370|      }
   89|   271k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 39.5k, False: 232k]
  ------------------
   90|  39.5k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   232k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 162k, False: 69.5k]
  ------------------
   92|   162k|        b.copy_block(bufferptr);
   93|   162k|        bufferptr += 64;
   94|   162k|      } else {
   95|  69.5k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 14, False: 69.5k]
  ------------------
   96|     14|          b.base64_decode_block_safe(dst);
   97|  69.5k|        } else {
   98|  69.5k|          b.base64_decode_block(dst);
   99|  69.5k|        }
  100|  69.5k|        dst += 48;
  101|  69.5k|      }
  102|   271k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 39.7k, False: 231k]
  ------------------
  103|   198k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 158k, False: 39.7k]
  ------------------
  104|   158k|          base64_decode_block(dst, buffer + i * 64);
  105|   158k|          dst += 48;
  106|   158k|        }
  107|  39.7k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 39.7k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  39.7k|        } else {
  110|  39.7k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  39.7k|        }
  112|  39.7k|        dst += 48;
  113|  39.7k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  39.7k|                    64); // 64 might be too much
  115|  39.7k|        bufferptr -= (block_size - 1) * 64;
  116|  39.7k|      }
  117|   271k|    }
  118|  1.02k|  }
  119|       |
  120|    946|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    946|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    946|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 600, False: 346]
  |  Branch (124:26): [True: 102, False: 498]
  ------------------
  125|       |
  126|  1.41k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.34k, False: 78]
  |  Branch (126:52): [True: 1.32k, False: 12]
  ------------------
  127|  1.32k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.32k|      *bufferptr = char(val);
  129|  1.32k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.32k, Folded]
  ------------------
  130|  1.32k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.32k]
  |  Branch (130:52): [True: 12, False: 1.31k]
  ------------------
  131|     12|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     12|                size_t(dst - dstinit)};
  133|     12|      }
  134|  1.31k|      bufferptr += (val <= 63);
  135|  1.31k|      src++;
  136|  1.31k|    }
  137|    102|  }
  138|       |
  139|  1.46k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 528, False: 934]
  ------------------
  140|    528|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 40, False: 488]
  ------------------
  141|     40|      base64_decode_block_safe(dst, buffer_start);
  142|    488|    } else {
  143|    488|      base64_decode_block(dst, buffer_start);
  144|    488|    }
  145|    528|    dst += 48;
  146|    528|  }
  147|    934|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 510, False: 424]
  ------------------
  148|  4.35k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.84k, False: 510]
  ------------------
  149|  3.84k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.84k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.84k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.84k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.84k|                        << 8;
  154|  3.84k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.84k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.84k|#endif
  157|  3.84k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.84k|      dst += 3;
  160|  3.84k|      buffer_start += 4;
  161|  3.84k|    }
  162|    510|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 138, False: 372]
  ------------------
  163|    138|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    138|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    138|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    138|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    138|                        << 8;
  168|    138|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    138|      triple = scalar::u32_swap_bytes(triple);
  170|    138|#endif
  171|    138|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    138|      dst += 3;
  174|    138|      buffer_start += 4;
  175|    138|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    510|    int leftover = int(bufferptr - buffer_start);
  179|  1.22k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 718, False: 510]
  ------------------
  180|    718|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 718, Folded]
  ------------------
  181|  4.82k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.10k, False: 718]
  ------------------
  182|  4.10k|          src--;
  183|  4.10k|        }
  184|    718|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    718|      src--;
  190|    718|      leftover--;
  191|    718|    }
  192|    510|  }
  193|    934|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 764, False: 170]
  ------------------
  194|    764|    full_result r = scalar::base64::base64_tail_decode(
  195|    764|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    764|    r = scalar::base64::patch_tail_result(
  197|    764|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    764|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    764|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 370, False: 394]
  |  Branch (203:43): [True: 346, False: 24]
  ------------------
  204|    346|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 284, False: 62]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    820|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 816, False: 4]
  ------------------
  207|    816|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 536, False: 280]
  ------------------
  208|    536|        r.input_count++;
  209|    536|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    284|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 280, False: 4]
  ------------------
  213|  2.24k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.19k, False: 56]
  ------------------
  214|  2.19k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.96k, False: 224]
  ------------------
  215|  1.96k|          r.input_count--;
  216|  1.96k|        }
  217|    280|      }
  218|    284|    }
  219|    764|    return r;
  220|    764|  }
  221|    170|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 170, Folded]
  |  Branch (221:26): [True: 0, False: 170]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    170|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    170|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.28k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.28k|  const uint8_t *to_base64 =
   47|  1.28k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.28k]
  ------------------
   48|  1.28k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.28k, Folded]
  ------------------
   49|  1.28k|                                   : tables::base64::to_base64_value);
   50|  1.28k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.28k|  size_t equallocation = ri.equallocation;
   52|  1.28k|  size_t equalsigns = ri.equalsigns;
   53|  1.28k|  srclen = ri.srclen;
   54|  1.28k|  size_t full_input_length = ri.full_input_length;
   55|  1.28k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 18, False: 1.26k]
  ------------------
   56|     18|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 18, Folded]
  |  Branch (56:28): [True: 10, False: 8]
  ------------------
   57|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     10|    }
   59|      8|    return {SUCCESS, full_input_length, 0};
   60|     18|  }
   61|  1.26k|  char *end_of_safe_64byte_zone =
   62|  1.26k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 86, False: 1.18k]
  ------------------
   63|  1.26k|          ? nullptr
   64|  1.26k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 346, False: 834]
  ------------------
   65|  1.18k|                                        : dst);
   66|       |
   67|  1.26k|  const chartype *const srcinit = src;
   68|  1.26k|  const char *const dstinit = dst;
   69|  1.26k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.26k|  constexpr size_t block_size = 6;
   72|  1.26k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.26k|  char buffer[block_size * 64];
   74|  1.26k|  char *bufferptr = buffer;
   75|  1.26k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 956, False: 310]
  ------------------
   76|    956|    const chartype *const srcend64 = src + srclen - 64;
   77|  26.5k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 25.9k, False: 612]
  ------------------
   78|  25.9k|      block64 b(src);
   79|  25.9k|      src += 64;
   80|  25.9k|      uint64_t error = 0;
   81|  25.9k|      const uint64_t badcharmask =
   82|  25.9k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  25.9k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 25.9k, Folded]
  |  Branch (83:30): [True: 344, False: 25.6k]
  ------------------
   84|    344|        src -= 64;
   85|    344|        const size_t error_offset = trailing_zeroes(error);
   86|    344|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    344|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    344|      }
   89|  25.6k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 20.9k, False: 4.63k]
  ------------------
   90|  20.9k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  20.9k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 4.16k, False: 472]
  ------------------
   92|  4.16k|        b.copy_block(bufferptr);
   93|  4.16k|        bufferptr += 64;
   94|  4.16k|      } else {
   95|    472|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 462]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|    462|        } else {
   98|    462|          b.base64_decode_block(dst);
   99|    462|        }
  100|    472|        dst += 48;
  101|    472|      }
  102|  25.6k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 4.71k, False: 20.9k]
  ------------------
  103|  23.5k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 18.8k, False: 4.71k]
  ------------------
  104|  18.8k|          base64_decode_block(dst, buffer + i * 64);
  105|  18.8k|          dst += 48;
  106|  18.8k|        }
  107|  4.71k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 4.71k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  4.71k|        } else {
  110|  4.71k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  4.71k|        }
  112|  4.71k|        dst += 48;
  113|  4.71k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  4.71k|                    64); // 64 might be too much
  115|  4.71k|        bufferptr -= (block_size - 1) * 64;
  116|  4.71k|      }
  117|  25.6k|    }
  118|    956|  }
  119|       |
  120|    922|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    922|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    922|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 566, False: 356]
  |  Branch (124:26): [True: 98, False: 468]
  ------------------
  125|       |
  126|    574|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 534, False: 40]
  |  Branch (126:52): [True: 520, False: 14]
  ------------------
  127|    520|      uint8_t val = to_base64[uint8_t(*src)];
  128|    520|      *bufferptr = char(val);
  129|    520|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 520, Folded]
  ------------------
  130|    520|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 26, False: 494]
  |  Branch (130:52): [True: 18, False: 476]
  ------------------
  131|     44|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     44|                size_t(dst - dstinit)};
  133|     44|      }
  134|    476|      bufferptr += (val <= 63);
  135|    476|      src++;
  136|    476|    }
  137|     98|  }
  138|       |
  139|  1.22k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 342, False: 878]
  ------------------
  140|    342|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 28, False: 314]
  ------------------
  141|     28|      base64_decode_block_safe(dst, buffer_start);
  142|    314|    } else {
  143|    314|      base64_decode_block(dst, buffer_start);
  144|    314|    }
  145|    342|    dst += 48;
  146|    342|  }
  147|    878|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 482, False: 396]
  ------------------
  148|  3.87k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.39k, False: 482]
  ------------------
  149|  3.39k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.39k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.39k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.39k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.39k|                        << 8;
  154|  3.39k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.39k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.39k|#endif
  157|  3.39k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.39k|      dst += 3;
  160|  3.39k|      buffer_start += 4;
  161|  3.39k|    }
  162|    482|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 124, False: 358]
  ------------------
  163|    124|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    124|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    124|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    124|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    124|                        << 8;
  168|    124|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    124|      triple = scalar::u32_swap_bytes(triple);
  170|    124|#endif
  171|    124|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    124|      dst += 3;
  174|    124|      buffer_start += 4;
  175|    124|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    482|    int leftover = int(bufferptr - buffer_start);
  179|  1.20k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 722, False: 482]
  ------------------
  180|    722|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 722, Folded]
  ------------------
  181|  7.83k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 7.11k, False: 722]
  ------------------
  182|  7.11k|          src--;
  183|  7.11k|        }
  184|    722|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    722|      src--;
  190|    722|      leftover--;
  191|    722|    }
  192|    482|  }
  193|    878|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 746, False: 132]
  ------------------
  194|    746|    full_result r = scalar::base64::base64_tail_decode(
  195|    746|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    746|    r = scalar::base64::patch_tail_result(
  197|    746|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    746|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    746|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 494, False: 252]
  |  Branch (203:43): [True: 398, False: 96]
  ------------------
  204|    398|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 350, False: 48]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    742|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 736, False: 6]
  ------------------
  207|    736|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 392, False: 344]
  ------------------
  208|    392|        r.input_count++;
  209|    392|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    350|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 344, False: 6]
  ------------------
  213|  3.53k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 3.43k, False: 98]
  ------------------
  214|  3.43k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 3.18k, False: 246]
  ------------------
  215|  3.18k|          r.input_count--;
  216|  3.18k|        }
  217|    344|      }
  218|    350|    }
  219|    746|    return r;
  220|    746|  }
  221|    132|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 132, Folded]
  |  Branch (221:26): [True: 0, False: 132]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    132|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    132|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.31k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.31k|  const uint8_t *to_base64 =
   47|  1.31k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.31k]
  ------------------
   48|  1.31k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.31k]
  ------------------
   49|  1.31k|                                   : tables::base64::to_base64_value);
   50|  1.31k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.31k|  size_t equallocation = ri.equallocation;
   52|  1.31k|  size_t equalsigns = ri.equalsigns;
   53|  1.31k|  srclen = ri.srclen;
   54|  1.31k|  size_t full_input_length = ri.full_input_length;
   55|  1.31k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 24, False: 1.29k]
  ------------------
   56|     24|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 24, Folded]
  |  Branch (56:28): [True: 10, False: 14]
  ------------------
   57|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     10|    }
   59|     14|    return {SUCCESS, full_input_length, 0};
   60|     24|  }
   61|  1.29k|  char *end_of_safe_64byte_zone =
   62|  1.29k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 108, False: 1.18k]
  ------------------
   63|  1.29k|          ? nullptr
   64|  1.29k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 354, False: 830]
  ------------------
   65|  1.18k|                                        : dst);
   66|       |
   67|  1.29k|  const chartype *const srcinit = src;
   68|  1.29k|  const char *const dstinit = dst;
   69|  1.29k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.29k|  constexpr size_t block_size = 6;
   72|  1.29k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.29k|  char buffer[block_size * 64];
   74|  1.29k|  char *bufferptr = buffer;
   75|  1.29k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 960, False: 332]
  ------------------
   76|    960|    const chartype *const srcend64 = src + srclen - 64;
   77|  59.1k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 58.5k, False: 618]
  ------------------
   78|  58.5k|      block64 b(src);
   79|  58.5k|      src += 64;
   80|  58.5k|      uint64_t error = 0;
   81|  58.5k|      const uint64_t badcharmask =
   82|  58.5k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  58.5k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 58.5k, Folded]
  |  Branch (83:30): [True: 342, False: 58.2k]
  ------------------
   84|    342|        src -= 64;
   85|    342|        const size_t error_offset = trailing_zeroes(error);
   86|    342|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    342|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    342|      }
   89|  58.2k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 45.1k, False: 13.0k]
  ------------------
   90|  45.1k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  45.1k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 12.7k, False: 288]
  ------------------
   92|  12.7k|        b.copy_block(bufferptr);
   93|  12.7k|        bufferptr += 64;
   94|  12.7k|      } else {
   95|    288|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 2, False: 286]
  ------------------
   96|      2|          b.base64_decode_block_safe(dst);
   97|    286|        } else {
   98|    286|          b.base64_decode_block(dst);
   99|    286|        }
  100|    288|        dst += 48;
  101|    288|      }
  102|  58.2k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 11.1k, False: 47.0k]
  ------------------
  103|  55.8k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 44.6k, False: 11.1k]
  ------------------
  104|  44.6k|          base64_decode_block(dst, buffer + i * 64);
  105|  44.6k|          dst += 48;
  106|  44.6k|        }
  107|  11.1k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 11.1k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  11.1k|        } else {
  110|  11.1k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  11.1k|        }
  112|  11.1k|        dst += 48;
  113|  11.1k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  11.1k|                    64); // 64 might be too much
  115|  11.1k|        bufferptr -= (block_size - 1) * 64;
  116|  11.1k|      }
  117|  58.2k|    }
  118|    960|  }
  119|       |
  120|    950|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    950|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    950|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 590, False: 360]
  |  Branch (124:26): [True: 108, False: 482]
  ------------------
  125|       |
  126|    654|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 598, False: 56]
  |  Branch (126:52): [True: 586, False: 12]
  ------------------
  127|    586|      uint8_t val = to_base64[uint8_t(*src)];
  128|    586|      *bufferptr = char(val);
  129|    586|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 586, Folded]
  ------------------
  130|    586|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 20, False: 566]
  |  Branch (130:52): [True: 20, False: 546]
  ------------------
  131|     40|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     40|                size_t(dst - dstinit)};
  133|     40|      }
  134|    546|      bufferptr += (val <= 63);
  135|    546|      src++;
  136|    546|    }
  137|    108|  }
  138|       |
  139|  1.33k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 420, False: 910]
  ------------------
  140|    420|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 30, False: 390]
  ------------------
  141|     30|      base64_decode_block_safe(dst, buffer_start);
  142|    390|    } else {
  143|    390|      base64_decode_block(dst, buffer_start);
  144|    390|    }
  145|    420|    dst += 48;
  146|    420|  }
  147|    910|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 494, False: 416]
  ------------------
  148|  4.07k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.58k, False: 494]
  ------------------
  149|  3.58k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.58k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.58k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.58k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.58k|                        << 8;
  154|  3.58k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.58k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.58k|#endif
  157|  3.58k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.58k|      dst += 3;
  160|  3.58k|      buffer_start += 4;
  161|  3.58k|    }
  162|    494|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 144, False: 350]
  ------------------
  163|    144|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    144|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    144|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    144|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    144|                        << 8;
  168|    144|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    144|      triple = scalar::u32_swap_bytes(triple);
  170|    144|#endif
  171|    144|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    144|      dst += 3;
  174|    144|      buffer_start += 4;
  175|    144|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    494|    int leftover = int(bufferptr - buffer_start);
  179|  1.19k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 696, False: 494]
  ------------------
  180|    696|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 696, Folded]
  ------------------
  181|  5.06k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.36k, False: 696]
  ------------------
  182|  4.36k|          src--;
  183|  4.36k|        }
  184|    696|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    696|      src--;
  190|    696|      leftover--;
  191|    696|    }
  192|    494|  }
  193|    910|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 772, False: 138]
  ------------------
  194|    772|    full_result r = scalar::base64::base64_tail_decode(
  195|    772|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    772|    r = scalar::base64::patch_tail_result(
  197|    772|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    772|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    772|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 436, False: 336]
  |  Branch (203:43): [True: 354, False: 82]
  ------------------
  204|    354|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 310, False: 44]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    732|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 726, False: 6]
  ------------------
  207|    726|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 422, False: 304]
  ------------------
  208|    422|        r.input_count++;
  209|    422|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    310|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 304, False: 6]
  ------------------
  213|  4.65k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 4.59k, False: 58]
  ------------------
  214|  4.59k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 4.34k, False: 246]
  ------------------
  215|  4.34k|          r.input_count--;
  216|  4.34k|        }
  217|    304|      }
  218|    310|    }
  219|    772|    return r;
  220|    772|  }
  221|    138|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 138, Folded]
  |  Branch (221:26): [True: 0, False: 138]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    138|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    138|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.23k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.23k|  const uint8_t *to_base64 =
   47|  1.23k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.23k]
  ------------------
   48|  1.23k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.23k, Folded]
  ------------------
   49|  1.23k|                                   : tables::base64::to_base64_value);
   50|  1.23k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.23k|  size_t equallocation = ri.equallocation;
   52|  1.23k|  size_t equalsigns = ri.equalsigns;
   53|  1.23k|  srclen = ri.srclen;
   54|  1.23k|  size_t full_input_length = ri.full_input_length;
   55|  1.23k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 12, False: 1.22k]
  ------------------
   56|     12|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 12, Folded]
  |  Branch (56:28): [True: 6, False: 6]
  ------------------
   57|      6|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      6|    }
   59|      6|    return {SUCCESS, full_input_length, 0};
   60|     12|  }
   61|  1.22k|  char *end_of_safe_64byte_zone =
   62|  1.22k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 44, False: 1.17k]
  ------------------
   63|  1.22k|          ? nullptr
   64|  1.22k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 382, False: 794]
  ------------------
   65|  1.17k|                                        : dst);
   66|       |
   67|  1.22k|  const chartype *const srcinit = src;
   68|  1.22k|  const char *const dstinit = dst;
   69|  1.22k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.22k|  constexpr size_t block_size = 6;
   72|  1.22k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.22k|  char buffer[block_size * 64];
   74|  1.22k|  char *bufferptr = buffer;
   75|  1.22k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 982, False: 238]
  ------------------
   76|    982|    const chartype *const srcend64 = src + srclen - 64;
   77|   142k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 142k, False: 632]
  ------------------
   78|   142k|      block64 b(src);
   79|   142k|      src += 64;
   80|   142k|      uint64_t error = 0;
   81|   142k|      const uint64_t badcharmask =
   82|   142k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   142k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 142k, Folded]
  |  Branch (83:30): [True: 350, False: 141k]
  ------------------
   84|    350|        src -= 64;
   85|    350|        const size_t error_offset = trailing_zeroes(error);
   86|    350|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    350|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    350|      }
   89|   141k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 51.0k, False: 90.8k]
  ------------------
   90|  51.0k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  90.8k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 18.7k, False: 72.1k]
  ------------------
   92|  18.7k|        b.copy_block(bufferptr);
   93|  18.7k|        bufferptr += 64;
   94|  72.1k|      } else {
   95|  72.1k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 72.0k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|  72.0k|        } else {
   98|  72.0k|          b.base64_decode_block(dst);
   99|  72.0k|        }
  100|  72.1k|        dst += 48;
  101|  72.1k|      }
  102|   141k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 13.4k, False: 128k]
  ------------------
  103|  67.1k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 53.7k, False: 13.4k]
  ------------------
  104|  53.7k|          base64_decode_block(dst, buffer + i * 64);
  105|  53.7k|          dst += 48;
  106|  53.7k|        }
  107|  13.4k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 13.4k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  13.4k|        } else {
  110|  13.4k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  13.4k|        }
  112|  13.4k|        dst += 48;
  113|  13.4k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  13.4k|                    64); // 64 might be too much
  115|  13.4k|        bufferptr -= (block_size - 1) * 64;
  116|  13.4k|      }
  117|   141k|    }
  118|    982|  }
  119|       |
  120|    870|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    870|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    870|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 570, False: 300]
  |  Branch (124:26): [True: 72, False: 498]
  ------------------
  125|       |
  126|  1.10k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.05k, False: 50]
  |  Branch (126:52): [True: 1.03k, False: 16]
  ------------------
  127|  1.03k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.03k|      *bufferptr = char(val);
  129|  1.03k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.03k, Folded]
  ------------------
  130|  1.03k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.03k]
  |  Branch (130:52): [True: 6, False: 1.03k]
  ------------------
  131|      6|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      6|                size_t(dst - dstinit)};
  133|      6|      }
  134|  1.03k|      bufferptr += (val <= 63);
  135|  1.03k|      src++;
  136|  1.03k|    }
  137|     72|  }
  138|       |
  139|  1.27k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 410, False: 864]
  ------------------
  140|    410|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 34, False: 376]
  ------------------
  141|     34|      base64_decode_block_safe(dst, buffer_start);
  142|    376|    } else {
  143|    376|      base64_decode_block(dst, buffer_start);
  144|    376|    }
  145|    410|    dst += 48;
  146|    410|  }
  147|    864|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 514, False: 350]
  ------------------
  148|  4.26k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.75k, False: 514]
  ------------------
  149|  3.75k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.75k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.75k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.75k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.75k|                        << 8;
  154|  3.75k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.75k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.75k|#endif
  157|  3.75k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.75k|      dst += 3;
  160|  3.75k|      buffer_start += 4;
  161|  3.75k|    }
  162|    514|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 120, False: 394]
  ------------------
  163|    120|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    120|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    120|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    120|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    120|                        << 8;
  168|    120|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    120|      triple = scalar::u32_swap_bytes(triple);
  170|    120|#endif
  171|    120|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    120|      dst += 3;
  174|    120|      buffer_start += 4;
  175|    120|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    514|    int leftover = int(bufferptr - buffer_start);
  179|  1.28k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 774, False: 514]
  ------------------
  180|    774|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 774, Folded]
  ------------------
  181|  5.37k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.59k, False: 774]
  ------------------
  182|  4.59k|          src--;
  183|  4.59k|        }
  184|    774|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    774|      src--;
  190|    774|      leftover--;
  191|    774|    }
  192|    514|  }
  193|    864|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 714, False: 150]
  ------------------
  194|    714|    full_result r = scalar::base64::base64_tail_decode(
  195|    714|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    714|    r = scalar::base64::patch_tail_result(
  197|    714|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    714|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    714|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 326, False: 388]
  |  Branch (203:43): [True: 294, False: 32]
  ------------------
  204|    294|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 246, False: 48]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    612|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 606, False: 6]
  ------------------
  207|    606|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 366, False: 240]
  ------------------
  208|    366|        r.input_count++;
  209|    366|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    246|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 240, False: 6]
  ------------------
  213|  1.79k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.73k, False: 56]
  ------------------
  214|  1.73k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.55k, False: 184]
  ------------------
  215|  1.55k|          r.input_count--;
  216|  1.55k|        }
  217|    240|      }
  218|    246|    }
  219|    714|    return r;
  220|    714|  }
  221|    150|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 150, Folded]
  |  Branch (221:26): [True: 0, False: 150]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    150|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    150|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.34k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.34k|  const uint8_t *to_base64 =
   47|  1.34k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.34k]
  ------------------
   48|  1.34k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.34k]
  ------------------
   49|  1.34k|                                   : tables::base64::to_base64_value);
   50|  1.34k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.34k|  size_t equallocation = ri.equallocation;
   52|  1.34k|  size_t equalsigns = ri.equalsigns;
   53|  1.34k|  srclen = ri.srclen;
   54|  1.34k|  size_t full_input_length = ri.full_input_length;
   55|  1.34k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 28, False: 1.31k]
  ------------------
   56|     28|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 28, Folded]
  |  Branch (56:28): [True: 12, False: 16]
  ------------------
   57|     12|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     12|    }
   59|     16|    return {SUCCESS, full_input_length, 0};
   60|     28|  }
   61|  1.31k|  char *end_of_safe_64byte_zone =
   62|  1.31k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 50, False: 1.26k]
  ------------------
   63|  1.31k|          ? nullptr
   64|  1.31k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 418, False: 848]
  ------------------
   65|  1.26k|                                        : dst);
   66|       |
   67|  1.31k|  const chartype *const srcinit = src;
   68|  1.31k|  const char *const dstinit = dst;
   69|  1.31k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.31k|  constexpr size_t block_size = 6;
   72|  1.31k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.31k|  char buffer[block_size * 64];
   74|  1.31k|  char *bufferptr = buffer;
   75|  1.31k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 1.02k, False: 290]
  ------------------
   76|  1.02k|    const chartype *const srcend64 = src + srclen - 64;
   77|   272k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 272k, False: 656]
  ------------------
   78|   272k|      block64 b(src);
   79|   272k|      src += 64;
   80|   272k|      uint64_t error = 0;
   81|   272k|      const uint64_t badcharmask =
   82|   272k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   272k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 272k, Folded]
  |  Branch (83:30): [True: 370, False: 271k]
  ------------------
   84|    370|        src -= 64;
   85|    370|        const size_t error_offset = trailing_zeroes(error);
   86|    370|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    370|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    370|      }
   89|   271k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 39.5k, False: 232k]
  ------------------
   90|  39.5k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   232k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 162k, False: 69.5k]
  ------------------
   92|   162k|        b.copy_block(bufferptr);
   93|   162k|        bufferptr += 64;
   94|   162k|      } else {
   95|  69.5k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 14, False: 69.5k]
  ------------------
   96|     14|          b.base64_decode_block_safe(dst);
   97|  69.5k|        } else {
   98|  69.5k|          b.base64_decode_block(dst);
   99|  69.5k|        }
  100|  69.5k|        dst += 48;
  101|  69.5k|      }
  102|   271k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 39.7k, False: 231k]
  ------------------
  103|   198k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 158k, False: 39.7k]
  ------------------
  104|   158k|          base64_decode_block(dst, buffer + i * 64);
  105|   158k|          dst += 48;
  106|   158k|        }
  107|  39.7k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 39.7k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  39.7k|        } else {
  110|  39.7k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  39.7k|        }
  112|  39.7k|        dst += 48;
  113|  39.7k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  39.7k|                    64); // 64 might be too much
  115|  39.7k|        bufferptr -= (block_size - 1) * 64;
  116|  39.7k|      }
  117|   271k|    }
  118|  1.02k|  }
  119|       |
  120|    946|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    946|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    946|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 600, False: 346]
  |  Branch (124:26): [True: 102, False: 498]
  ------------------
  125|       |
  126|  1.41k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.34k, False: 78]
  |  Branch (126:52): [True: 1.32k, False: 12]
  ------------------
  127|  1.32k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.32k|      *bufferptr = char(val);
  129|  1.32k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.32k, Folded]
  ------------------
  130|  1.32k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.32k]
  |  Branch (130:52): [True: 12, False: 1.31k]
  ------------------
  131|     12|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     12|                size_t(dst - dstinit)};
  133|     12|      }
  134|  1.31k|      bufferptr += (val <= 63);
  135|  1.31k|      src++;
  136|  1.31k|    }
  137|    102|  }
  138|       |
  139|  1.46k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 528, False: 934]
  ------------------
  140|    528|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 40, False: 488]
  ------------------
  141|     40|      base64_decode_block_safe(dst, buffer_start);
  142|    488|    } else {
  143|    488|      base64_decode_block(dst, buffer_start);
  144|    488|    }
  145|    528|    dst += 48;
  146|    528|  }
  147|    934|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 510, False: 424]
  ------------------
  148|  4.35k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.84k, False: 510]
  ------------------
  149|  3.84k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.84k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.84k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.84k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.84k|                        << 8;
  154|  3.84k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.84k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.84k|#endif
  157|  3.84k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.84k|      dst += 3;
  160|  3.84k|      buffer_start += 4;
  161|  3.84k|    }
  162|    510|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 138, False: 372]
  ------------------
  163|    138|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    138|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    138|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    138|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    138|                        << 8;
  168|    138|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    138|      triple = scalar::u32_swap_bytes(triple);
  170|    138|#endif
  171|    138|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    138|      dst += 3;
  174|    138|      buffer_start += 4;
  175|    138|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    510|    int leftover = int(bufferptr - buffer_start);
  179|  1.22k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 718, False: 510]
  ------------------
  180|    718|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 718, Folded]
  ------------------
  181|  4.82k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.10k, False: 718]
  ------------------
  182|  4.10k|          src--;
  183|  4.10k|        }
  184|    718|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    718|      src--;
  190|    718|      leftover--;
  191|    718|    }
  192|    510|  }
  193|    934|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 764, False: 170]
  ------------------
  194|    764|    full_result r = scalar::base64::base64_tail_decode(
  195|    764|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    764|    r = scalar::base64::patch_tail_result(
  197|    764|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    764|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    764|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 370, False: 394]
  |  Branch (203:43): [True: 346, False: 24]
  ------------------
  204|    346|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 284, False: 62]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    820|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 816, False: 4]
  ------------------
  207|    816|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 536, False: 280]
  ------------------
  208|    536|        r.input_count++;
  209|    536|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    284|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 280, False: 4]
  ------------------
  213|  2.24k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.19k, False: 56]
  ------------------
  214|  2.19k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.96k, False: 224]
  ------------------
  215|  1.96k|          r.input_count--;
  216|  1.96k|        }
  217|    280|      }
  218|    284|    }
  219|    764|    return r;
  220|    764|  }
  221|    170|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 170, Folded]
  |  Branch (221:26): [True: 0, False: 170]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    170|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    170|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.28k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.28k|  const uint8_t *to_base64 =
   47|  1.28k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.28k]
  ------------------
   48|  1.28k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.28k, Folded]
  ------------------
   49|  1.28k|                                   : tables::base64::to_base64_value);
   50|  1.28k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.28k|  size_t equallocation = ri.equallocation;
   52|  1.28k|  size_t equalsigns = ri.equalsigns;
   53|  1.28k|  srclen = ri.srclen;
   54|  1.28k|  size_t full_input_length = ri.full_input_length;
   55|  1.28k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 18, False: 1.26k]
  ------------------
   56|     18|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 18, Folded]
  |  Branch (56:28): [True: 10, False: 8]
  ------------------
   57|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     10|    }
   59|      8|    return {SUCCESS, full_input_length, 0};
   60|     18|  }
   61|  1.26k|  char *end_of_safe_64byte_zone =
   62|  1.26k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 86, False: 1.18k]
  ------------------
   63|  1.26k|          ? nullptr
   64|  1.26k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 346, False: 834]
  ------------------
   65|  1.18k|                                        : dst);
   66|       |
   67|  1.26k|  const chartype *const srcinit = src;
   68|  1.26k|  const char *const dstinit = dst;
   69|  1.26k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.26k|  constexpr size_t block_size = 6;
   72|  1.26k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.26k|  char buffer[block_size * 64];
   74|  1.26k|  char *bufferptr = buffer;
   75|  1.26k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 956, False: 310]
  ------------------
   76|    956|    const chartype *const srcend64 = src + srclen - 64;
   77|  26.5k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 25.9k, False: 612]
  ------------------
   78|  25.9k|      block64 b(src);
   79|  25.9k|      src += 64;
   80|  25.9k|      uint64_t error = 0;
   81|  25.9k|      const uint64_t badcharmask =
   82|  25.9k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  25.9k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 25.9k, Folded]
  |  Branch (83:30): [True: 344, False: 25.6k]
  ------------------
   84|    344|        src -= 64;
   85|    344|        const size_t error_offset = trailing_zeroes(error);
   86|    344|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    344|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    344|      }
   89|  25.6k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 20.9k, False: 4.63k]
  ------------------
   90|  20.9k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  20.9k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 4.16k, False: 472]
  ------------------
   92|  4.16k|        b.copy_block(bufferptr);
   93|  4.16k|        bufferptr += 64;
   94|  4.16k|      } else {
   95|    472|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 462]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|    462|        } else {
   98|    462|          b.base64_decode_block(dst);
   99|    462|        }
  100|    472|        dst += 48;
  101|    472|      }
  102|  25.6k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 4.71k, False: 20.9k]
  ------------------
  103|  23.5k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 18.8k, False: 4.71k]
  ------------------
  104|  18.8k|          base64_decode_block(dst, buffer + i * 64);
  105|  18.8k|          dst += 48;
  106|  18.8k|        }
  107|  4.71k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 4.71k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  4.71k|        } else {
  110|  4.71k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  4.71k|        }
  112|  4.71k|        dst += 48;
  113|  4.71k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  4.71k|                    64); // 64 might be too much
  115|  4.71k|        bufferptr -= (block_size - 1) * 64;
  116|  4.71k|      }
  117|  25.6k|    }
  118|    956|  }
  119|       |
  120|    922|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    922|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    922|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 566, False: 356]
  |  Branch (124:26): [True: 98, False: 468]
  ------------------
  125|       |
  126|    574|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 534, False: 40]
  |  Branch (126:52): [True: 520, False: 14]
  ------------------
  127|    520|      uint8_t val = to_base64[uint8_t(*src)];
  128|    520|      *bufferptr = char(val);
  129|    520|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 520, Folded]
  ------------------
  130|    520|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 26, False: 494]
  |  Branch (130:52): [True: 18, False: 476]
  ------------------
  131|     44|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     44|                size_t(dst - dstinit)};
  133|     44|      }
  134|    476|      bufferptr += (val <= 63);
  135|    476|      src++;
  136|    476|    }
  137|     98|  }
  138|       |
  139|  1.22k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 342, False: 878]
  ------------------
  140|    342|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 28, False: 314]
  ------------------
  141|     28|      base64_decode_block_safe(dst, buffer_start);
  142|    314|    } else {
  143|    314|      base64_decode_block(dst, buffer_start);
  144|    314|    }
  145|    342|    dst += 48;
  146|    342|  }
  147|    878|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 482, False: 396]
  ------------------
  148|  3.87k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.39k, False: 482]
  ------------------
  149|  3.39k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.39k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.39k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.39k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.39k|                        << 8;
  154|  3.39k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.39k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.39k|#endif
  157|  3.39k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.39k|      dst += 3;
  160|  3.39k|      buffer_start += 4;
  161|  3.39k|    }
  162|    482|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 124, False: 358]
  ------------------
  163|    124|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    124|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    124|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    124|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    124|                        << 8;
  168|    124|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    124|      triple = scalar::u32_swap_bytes(triple);
  170|    124|#endif
  171|    124|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    124|      dst += 3;
  174|    124|      buffer_start += 4;
  175|    124|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    482|    int leftover = int(bufferptr - buffer_start);
  179|  1.20k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 722, False: 482]
  ------------------
  180|    722|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 722, Folded]
  ------------------
  181|  7.83k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 7.11k, False: 722]
  ------------------
  182|  7.11k|          src--;
  183|  7.11k|        }
  184|    722|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    722|      src--;
  190|    722|      leftover--;
  191|    722|    }
  192|    482|  }
  193|    878|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 746, False: 132]
  ------------------
  194|    746|    full_result r = scalar::base64::base64_tail_decode(
  195|    746|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    746|    r = scalar::base64::patch_tail_result(
  197|    746|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    746|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    746|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 494, False: 252]
  |  Branch (203:43): [True: 398, False: 96]
  ------------------
  204|    398|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 350, False: 48]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    742|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 736, False: 6]
  ------------------
  207|    736|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 392, False: 344]
  ------------------
  208|    392|        r.input_count++;
  209|    392|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    350|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 344, False: 6]
  ------------------
  213|  3.53k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 3.43k, False: 98]
  ------------------
  214|  3.43k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 3.18k, False: 246]
  ------------------
  215|  3.18k|          r.input_count--;
  216|  3.18k|        }
  217|    344|      }
  218|    350|    }
  219|    746|    return r;
  220|    746|  }
  221|    132|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 132, Folded]
  |  Branch (221:26): [True: 0, False: 132]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    132|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    132|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.31k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.31k|  const uint8_t *to_base64 =
   47|  1.31k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.31k]
  ------------------
   48|  1.31k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.31k]
  ------------------
   49|  1.31k|                                   : tables::base64::to_base64_value);
   50|  1.31k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.31k|  size_t equallocation = ri.equallocation;
   52|  1.31k|  size_t equalsigns = ri.equalsigns;
   53|  1.31k|  srclen = ri.srclen;
   54|  1.31k|  size_t full_input_length = ri.full_input_length;
   55|  1.31k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 24, False: 1.29k]
  ------------------
   56|     24|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 24, Folded]
  |  Branch (56:28): [True: 10, False: 14]
  ------------------
   57|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     10|    }
   59|     14|    return {SUCCESS, full_input_length, 0};
   60|     24|  }
   61|  1.29k|  char *end_of_safe_64byte_zone =
   62|  1.29k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 108, False: 1.18k]
  ------------------
   63|  1.29k|          ? nullptr
   64|  1.29k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 354, False: 830]
  ------------------
   65|  1.18k|                                        : dst);
   66|       |
   67|  1.29k|  const chartype *const srcinit = src;
   68|  1.29k|  const char *const dstinit = dst;
   69|  1.29k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.29k|  constexpr size_t block_size = 6;
   72|  1.29k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.29k|  char buffer[block_size * 64];
   74|  1.29k|  char *bufferptr = buffer;
   75|  1.29k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 960, False: 332]
  ------------------
   76|    960|    const chartype *const srcend64 = src + srclen - 64;
   77|  59.1k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 58.5k, False: 618]
  ------------------
   78|  58.5k|      block64 b(src);
   79|  58.5k|      src += 64;
   80|  58.5k|      uint64_t error = 0;
   81|  58.5k|      const uint64_t badcharmask =
   82|  58.5k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  58.5k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 58.5k, Folded]
  |  Branch (83:30): [True: 342, False: 58.2k]
  ------------------
   84|    342|        src -= 64;
   85|    342|        const size_t error_offset = trailing_zeroes(error);
   86|    342|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    342|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    342|      }
   89|  58.2k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 45.1k, False: 13.0k]
  ------------------
   90|  45.1k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  45.1k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 12.7k, False: 288]
  ------------------
   92|  12.7k|        b.copy_block(bufferptr);
   93|  12.7k|        bufferptr += 64;
   94|  12.7k|      } else {
   95|    288|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 2, False: 286]
  ------------------
   96|      2|          b.base64_decode_block_safe(dst);
   97|    286|        } else {
   98|    286|          b.base64_decode_block(dst);
   99|    286|        }
  100|    288|        dst += 48;
  101|    288|      }
  102|  58.2k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 11.1k, False: 47.0k]
  ------------------
  103|  55.8k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 44.6k, False: 11.1k]
  ------------------
  104|  44.6k|          base64_decode_block(dst, buffer + i * 64);
  105|  44.6k|          dst += 48;
  106|  44.6k|        }
  107|  11.1k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 11.1k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  11.1k|        } else {
  110|  11.1k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  11.1k|        }
  112|  11.1k|        dst += 48;
  113|  11.1k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  11.1k|                    64); // 64 might be too much
  115|  11.1k|        bufferptr -= (block_size - 1) * 64;
  116|  11.1k|      }
  117|  58.2k|    }
  118|    960|  }
  119|       |
  120|    950|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    950|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    950|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 590, False: 360]
  |  Branch (124:26): [True: 108, False: 482]
  ------------------
  125|       |
  126|    654|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 598, False: 56]
  |  Branch (126:52): [True: 586, False: 12]
  ------------------
  127|    586|      uint8_t val = to_base64[uint8_t(*src)];
  128|    586|      *bufferptr = char(val);
  129|    586|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 586, Folded]
  ------------------
  130|    586|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 20, False: 566]
  |  Branch (130:52): [True: 20, False: 546]
  ------------------
  131|     40|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     40|                size_t(dst - dstinit)};
  133|     40|      }
  134|    546|      bufferptr += (val <= 63);
  135|    546|      src++;
  136|    546|    }
  137|    108|  }
  138|       |
  139|  1.33k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 420, False: 910]
  ------------------
  140|    420|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 30, False: 390]
  ------------------
  141|     30|      base64_decode_block_safe(dst, buffer_start);
  142|    390|    } else {
  143|    390|      base64_decode_block(dst, buffer_start);
  144|    390|    }
  145|    420|    dst += 48;
  146|    420|  }
  147|    910|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 494, False: 416]
  ------------------
  148|  4.07k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.58k, False: 494]
  ------------------
  149|  3.58k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.58k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.58k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.58k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.58k|                        << 8;
  154|  3.58k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.58k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.58k|#endif
  157|  3.58k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.58k|      dst += 3;
  160|  3.58k|      buffer_start += 4;
  161|  3.58k|    }
  162|    494|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 144, False: 350]
  ------------------
  163|    144|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    144|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    144|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    144|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    144|                        << 8;
  168|    144|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    144|      triple = scalar::u32_swap_bytes(triple);
  170|    144|#endif
  171|    144|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    144|      dst += 3;
  174|    144|      buffer_start += 4;
  175|    144|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    494|    int leftover = int(bufferptr - buffer_start);
  179|  1.19k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 696, False: 494]
  ------------------
  180|    696|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 696, Folded]
  ------------------
  181|  5.06k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.36k, False: 696]
  ------------------
  182|  4.36k|          src--;
  183|  4.36k|        }
  184|    696|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    696|      src--;
  190|    696|      leftover--;
  191|    696|    }
  192|    494|  }
  193|    910|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 772, False: 138]
  ------------------
  194|    772|    full_result r = scalar::base64::base64_tail_decode(
  195|    772|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    772|    r = scalar::base64::patch_tail_result(
  197|    772|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    772|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    772|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 436, False: 336]
  |  Branch (203:43): [True: 354, False: 82]
  ------------------
  204|    354|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 310, False: 44]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    732|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 726, False: 6]
  ------------------
  207|    726|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 422, False: 304]
  ------------------
  208|    422|        r.input_count++;
  209|    422|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    310|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 304, False: 6]
  ------------------
  213|  4.65k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 4.59k, False: 58]
  ------------------
  214|  4.59k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 4.34k, False: 246]
  ------------------
  215|  4.34k|          r.input_count--;
  216|  4.34k|        }
  217|    304|      }
  218|    310|    }
  219|    772|    return r;
  220|    772|  }
  221|    138|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 138, Folded]
  |  Branch (221:26): [True: 0, False: 138]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    138|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    138|}

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

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

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

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

simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_110count_onesEm:
   14|   129k|simdutf_really_inline long long int count_ones(uint64_t input_num) {
   15|       |  return _popcnt64(input_num);
   16|   129k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_115trailing_zeroesEm:
   20|   121k|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|   121k|  return __builtin_ctzll(input_num);
   25|   121k|  #endif // SIMDUTF_REGULAR_VISUAL_STUDIO
   26|   121k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_115is_power_of_twoImEEbT_:
   29|   156k|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|   144k|simdutf_really_inline long long int count_ones(uint64_t input_num) {
   15|       |  return _popcnt64(input_num);
   16|   144k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115trailing_zeroesEm:
   20|   121k|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|   121k|  return __builtin_ctzll(input_num);
   27|   121k|  #endif // SIMDUTF_REGULAR_VISUAL_STUDIO
   28|   121k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115is_power_of_twoImEEbT_:
   31|   156k|template <typename T> bool is_power_of_two(T x) { return (x & (x - 1)) == 0; }

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

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

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

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

