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

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

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

_ZN7simdutf10is_partialENS_27last_chunk_handling_optionsE:
 4147|  23.0k|is_partial(last_chunk_handling_options options) {
 4148|  23.0k|  return (options == stop_before_partial) || (options == only_full_chunks);
  ------------------
  |  Branch (4148:10): [True: 12.7k, False: 10.2k]
  |  Branch (4148:46): [True: 0, False: 10.2k]
  ------------------
 4149|  23.0k|}
_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|  24.7k|base64_ignorable(char input, base64_options options = base64_default) noexcept {
 4874|  24.7k|  return scalar::base64::is_ignorable(input, options);
 4875|  24.7k|}
_ZN7simdutf16base64_ignorableEDsNS_14base64_optionsE:
 4878|  22.7k|                 base64_options options = base64_default) noexcept {
 4879|  22.7k|  return scalar::base64::is_ignorable(input, options);
 4880|  22.7k|}

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|  22.8M|template <class char_type> simdutf_constexpr23 bool is_eight_byte(char_type c) {
   20|  22.8M|  if constexpr (sizeof(char_type) == 1) {
   21|  22.8M|    return true;
   22|  22.8M|  }
   23|      0|  return uint8_t(c) == c;
   24|  22.8M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6413is_eight_byteIDsEEbT_:
   19|  6.43M|template <class char_type> simdutf_constexpr23 bool is_eight_byte(char_type c) {
   20|       |  if constexpr (sizeof(char_type) == 1) {
   21|       |    return true;
   22|       |  }
   23|  6.43M|  return uint8_t(c) == c;
   24|  6.43M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKcEEmT_m:
  654|  3.66k|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.66k|  size_t padding = 0;
  659|  3.66k|  if (length > 0) {
  ------------------
  |  Branch (659:7): [True: 3.65k, False: 15]
  ------------------
  660|  3.65k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (660:9): [True: 174, False: 3.48k]
  ------------------
  661|    174|      padding++;
  662|    174|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (662:11): [True: 168, False: 6]
  |  Branch (662:25): [True: 27, False: 141]
  ------------------
  663|     27|        padding++;
  664|     27|      }
  665|    174|    }
  666|  3.65k|  }
  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.66k|  size_t actual_length = length - padding;
  686|  3.66k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (686:7): [True: 3.09k, False: 573]
  ------------------
  687|  3.09k|    return actual_length / 4 * 3;
  688|  3.09k|  }
  689|       |  // if we have a valid input, then the remainder must be 2 or 3 adding one or
  690|       |  // two extra bytes.
  691|    573|  return actual_length / 4 * 3 + (actual_length % 4) - 1;
  692|  3.66k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKDsEEmT_m:
  654|  3.79k|maximal_binary_length_from_base64(InputPtr input, size_t length) noexcept {
  655|       |  // We process the padding characters ('=') at the end to make sure
  656|       |  // that we return an exact result when the input has no ignorable characters
  657|       |  // (e.g., spaces).
  658|  3.79k|  size_t padding = 0;
  659|  3.79k|  if (length > 0) {
  ------------------
  |  Branch (659:7): [True: 3.78k, False: 12]
  ------------------
  660|  3.78k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (660:9): [True: 294, False: 3.49k]
  ------------------
  661|    294|      padding++;
  662|    294|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (662:11): [True: 288, False: 6]
  |  Branch (662:25): [True: 36, False: 252]
  ------------------
  663|     36|        padding++;
  664|     36|      }
  665|    294|    }
  666|  3.78k|  }
  667|       |  // The input is not otherwise processed for ignorable characters or
  668|       |  // validation, so that the function runs in constant time (very fast). In
  669|       |  // practice, base64 inputs without ignorable characters are common and the
  670|       |  // common case are line separated inputs with relatively long lines (e.g., 76
  671|       |  // characters) which leads this function to a slight (1%) overestimation of
  672|       |  // the output size.
  673|       |  //
  674|       |  // Of course, some inputs might contain an arbitrary number of spaces or
  675|       |  // newlines, which would make this function return a very pessimistic output
  676|       |  // size but systems that produce base64 outputs typically do not do that and
  677|       |  // if they do, they do not care much about minimizing memory usage.
  678|       |  //
  679|       |  // In specialized applications, users may know that their input is line
  680|       |  // separated, which can be checked very quickly by by iterating (e.g., over 76
  681|       |  // character chunks, looking for the linefeed characters only). We could
  682|       |  // provide a specialized function for that, but it is not clear that the added
  683|       |  // complexity is worth it for us.
  684|       |  //
  685|  3.79k|  size_t actual_length = length - padding;
  686|  3.79k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (686:7): [True: 3.33k, False: 468]
  ------------------
  687|  3.33k|    return actual_length / 4 * 3;
  688|  3.33k|  }
  689|       |  // if we have a valid input, then the remainder must be 2 or 3 adding one or
  690|       |  // two extra bytes.
  691|    468|  return actual_length / 4 * 3 + (actual_length % 4) - 1;
  692|  3.79k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIcEEbT_NS_14base64_optionsE:
   28|  24.7k|                                      simdutf::base64_options options) {
   29|  24.7k|  const uint8_t *to_base64 =
   30|  24.7k|      (options & base64_default_or_url)
  ------------------
  |  Branch (30:7): [True: 0, False: 24.7k]
  ------------------
   31|  24.7k|          ? tables::base64::to_base64_default_or_url_value
   32|  24.7k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (32:14): [True: 10.4k, False: 14.3k]
  ------------------
   33|  24.7k|                                    : tables::base64::to_base64_value);
   34|  24.7k|  const bool ignore_garbage =
   35|  24.7k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (35:7): [True: 0, False: 24.7k]
  ------------------
   36|  24.7k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (36:7): [True: 0, False: 24.7k]
  ------------------
   37|  24.7k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (37:7): [True: 0, False: 24.7k]
  ------------------
   38|  24.7k|  uint8_t code = to_base64[uint8_t(c)];
   39|  24.7k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (39:7): [True: 24.7k, False: 0]
  |  Branch (39:27): [True: 2.64k, False: 22.1k]
  ------------------
   40|  2.64k|    return false;
   41|  2.64k|  }
   42|  22.1k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (42:7): [True: 22.1k, False: 0]
  |  Branch (42:27): [True: 22.1k, False: 0]
  ------------------
   43|  22.1k|    return true;
   44|  22.1k|  }
   45|      0|  return ignore_garbage;
   46|  22.1k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIDsEEbT_NS_14base64_optionsE:
   28|  22.7k|                                      simdutf::base64_options options) {
   29|  22.7k|  const uint8_t *to_base64 =
   30|  22.7k|      (options & base64_default_or_url)
  ------------------
  |  Branch (30:7): [True: 0, False: 22.7k]
  ------------------
   31|  22.7k|          ? tables::base64::to_base64_default_or_url_value
   32|  22.7k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (32:14): [True: 10.0k, False: 12.6k]
  ------------------
   33|  22.7k|                                    : tables::base64::to_base64_value);
   34|  22.7k|  const bool ignore_garbage =
   35|  22.7k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (35:7): [True: 0, False: 22.7k]
  ------------------
   36|  22.7k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (36:7): [True: 0, False: 22.7k]
  ------------------
   37|  22.7k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (37:7): [True: 0, False: 22.7k]
  ------------------
   38|  22.7k|  uint8_t code = to_base64[uint8_t(c)];
   39|  22.7k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (39:7): [True: 22.7k, False: 0]
  |  Branch (39:27): [True: 3.36k, False: 19.3k]
  ------------------
   40|  3.36k|    return false;
   41|  3.36k|  }
   42|  19.3k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (42:7): [True: 19.3k, False: 0]
  |  Branch (42:27): [True: 19.3k, False: 0]
  ------------------
   43|  19.3k|    return true;
   44|  19.3k|  }
   45|      0|  return ignore_garbage;
   46|  19.3k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIcEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  100|  7.33k|                                           simdutf::base64_options options) {
  101|  7.33k|  const uint8_t *to_base64 =
  102|  7.33k|      (options & base64_default_or_url)
  ------------------
  |  Branch (102:7): [True: 0, False: 7.33k]
  ------------------
  103|  7.33k|          ? tables::base64::to_base64_default_or_url_value
  104|  7.33k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (104:14): [True: 3.49k, False: 3.84k]
  ------------------
  105|  7.33k|                                    : tables::base64::to_base64_value);
  106|  7.33k|  const bool ignore_garbage =
  107|  7.33k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (107:7): [True: 0, False: 7.33k]
  ------------------
  108|  7.33k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (108:7): [True: 0, False: 7.33k]
  ------------------
  109|  7.33k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (109:7): [True: 0, False: 7.33k]
  ------------------
  110|       |
  111|  7.33k|  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.33k|  size_t full_input_length = srclen;
  115|       |  // skip trailing spaces
  116|  8.73k|  while (!ignore_garbage && srclen > 0 &&
  ------------------
  |  Branch (116:10): [True: 8.73k, False: 0]
  |  Branch (116:29): [True: 8.67k, False: 66]
  ------------------
  117|  8.67k|         scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (117:10): [True: 8.67k, False: 0]
  ------------------
  118|  8.67k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (118:10): [True: 1.39k, False: 7.27k]
  ------------------
  119|  1.39k|    srclen--;
  120|  1.39k|  }
  121|  7.33k|  size_t equallocation =
  122|  7.33k|      srclen; // location of the first padding character if any
  123|  7.33k|  if (ignore_garbage) {
  ------------------
  |  Branch (123:7): [True: 0, False: 7.33k]
  ------------------
  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.33k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (135:7): [True: 7.33k, False: 0]
  |  Branch (135:26): [True: 7.27k, False: 66]
  |  Branch (135:40): [True: 348, False: 6.92k]
  ------------------
  136|       |    // This is the last '=' sign.
  137|    348|    equallocation = srclen - 1;
  138|    348|    srclen--;
  139|    348|    equalsigns = 1;
  140|       |    // skip trailing spaces
  141|  1.04k|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (141:12): [True: 990, False: 54]
  |  Branch (141:26): [True: 990, False: 0]
  ------------------
  142|    990|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (142:12): [True: 696, False: 294]
  ------------------
  143|    696|      srclen--;
  144|    696|    }
  145|    348|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (145:9): [True: 294, False: 54]
  |  Branch (145:23): [True: 54, False: 240]
  ------------------
  146|       |      // This is the second '=' sign.
  147|     54|      equallocation = srclen - 1;
  148|     54|      srclen--;
  149|     54|      equalsigns = 2;
  150|     54|    }
  151|    348|  }
  152|  7.33k|  return {equalsigns, equallocation, srclen, full_input_length};
  153|  7.33k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6417patch_tail_resultENS_11full_resultEmmmmNS_27last_chunk_handling_optionsE:
  394|  10.8k|                  last_chunk_handling_options last_chunk_options) {
  395|  10.8k|  r.input_count += previous_input;
  396|  10.8k|  r.output_count += previous_output;
  397|  10.8k|  if (r.padding_error) {
  ------------------
  |  Branch (397:7): [True: 312, False: 10.5k]
  ------------------
  398|    312|    r.input_count = equallocation;
  399|    312|  }
  400|       |
  401|  10.8k|  if (r.error == error_code::SUCCESS) {
  ------------------
  |  Branch (401:7): [True: 6.69k, False: 4.15k]
  ------------------
  402|  6.69k|    if (!is_partial(last_chunk_options)) {
  ------------------
  |  Branch (402:9): [True: 2.36k, False: 4.32k]
  ------------------
  403|       |      // A success when we are not in stop_before_partial mode.
  404|       |      // means that we have consumed the whole input buffer.
  405|  2.36k|      r.input_count = full_input_length;
  406|  4.32k|    } else if (r.output_count % 3 != 0) {
  ------------------
  |  Branch (406:16): [True: 30, False: 4.29k]
  ------------------
  407|     30|      r.input_count = full_input_length;
  408|     30|    }
  409|  6.69k|  }
  410|  10.8k|  return r;
  411|  10.8k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIDsEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  100|  7.59k|                                           simdutf::base64_options options) {
  101|  7.59k|  const uint8_t *to_base64 =
  102|  7.59k|      (options & base64_default_or_url)
  ------------------
  |  Branch (102:7): [True: 0, False: 7.59k]
  ------------------
  103|  7.59k|          ? tables::base64::to_base64_default_or_url_value
  104|  7.59k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (104:14): [True: 3.71k, False: 3.88k]
  ------------------
  105|  7.59k|                                    : tables::base64::to_base64_value);
  106|  7.59k|  const bool ignore_garbage =
  107|  7.59k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (107:7): [True: 0, False: 7.59k]
  ------------------
  108|  7.59k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (108:7): [True: 0, False: 7.59k]
  ------------------
  109|  7.59k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (109:7): [True: 0, False: 7.59k]
  ------------------
  110|       |
  111|  7.59k|  size_t equalsigns = 0;
  112|       |  // We intentionally include trailing spaces in the full input length.
  113|       |  // See https://github.com/simdutf/simdutf/issues/824
  114|  7.59k|  size_t full_input_length = srclen;
  115|       |  // skip trailing spaces
  116|  8.94k|  while (!ignore_garbage && srclen > 0 &&
  ------------------
  |  Branch (116:10): [True: 8.94k, False: 0]
  |  Branch (116:29): [True: 8.88k, False: 60]
  ------------------
  117|  8.88k|         scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (117:10): [True: 6.97k, False: 1.90k]
  ------------------
  118|  6.97k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (118:10): [True: 1.35k, False: 5.62k]
  ------------------
  119|  1.35k|    srclen--;
  120|  1.35k|  }
  121|  7.59k|  size_t equallocation =
  122|  7.59k|      srclen; // location of the first padding character if any
  123|  7.59k|  if (ignore_garbage) {
  ------------------
  |  Branch (123:7): [True: 0, False: 7.59k]
  ------------------
  124|       |    // Technically, we don't need to find the first padding character, we can
  125|       |    // just change our algorithms, but it adds substantial complexity.
  126|      0|    auto it = simdutf::find(src, src + srclen, '=');
  127|      0|    if (it != src + srclen) {
  ------------------
  |  Branch (127:9): [True: 0, False: 0]
  ------------------
  128|      0|      equallocation = it - src;
  129|      0|      equalsigns = 1;
  130|      0|      srclen = equallocation;
  131|      0|      full_input_length = equallocation + 1;
  132|      0|    }
  133|      0|    return {equalsigns, equallocation, srclen, full_input_length};
  134|      0|  }
  135|  7.59k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (135:7): [True: 7.59k, False: 0]
  |  Branch (135:26): [True: 7.53k, False: 60]
  |  Branch (135:40): [True: 588, False: 6.94k]
  ------------------
  136|       |    // This is the last '=' sign.
  137|    588|    equallocation = srclen - 1;
  138|    588|    srclen--;
  139|    588|    equalsigns = 1;
  140|       |    // skip trailing spaces
  141|  1.23k|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (141:12): [True: 1.18k, False: 48]
  |  Branch (141:26): [True: 1.00k, False: 186]
  ------------------
  142|  1.00k|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (142:12): [True: 648, False: 354]
  ------------------
  143|    648|      srclen--;
  144|    648|    }
  145|    588|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (145:9): [True: 540, False: 48]
  |  Branch (145:23): [True: 72, False: 468]
  ------------------
  146|       |      // This is the second '=' sign.
  147|     72|      equallocation = srclen - 1;
  148|     72|      srclen--;
  149|     72|      equalsigns = 2;
  150|     72|    }
  151|    588|  }
  152|  7.59k|  return {equalsigns, equallocation, srclen, full_input_length};
  153|  7.59k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIcEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  727|  2.44k|    last_chunk_handling_options last_chunk_options) noexcept {
  728|  2.44k|  const bool ignore_garbage =
  729|  2.44k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (729:7): [True: 0, False: 2.44k]
  ------------------
  730|  2.44k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (730:7): [True: 0, False: 2.44k]
  ------------------
  731|  2.44k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (731:7): [True: 0, False: 2.44k]
  ------------------
  732|  2.44k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  733|  2.44k|  size_t equallocation = ri.equallocation;
  734|  2.44k|  size_t equalsigns = ri.equalsigns;
  735|  2.44k|  length = ri.srclen;
  736|  2.44k|  size_t full_input_length = ri.full_input_length;
  737|  2.44k|  if (length == 0) {
  ------------------
  |  Branch (737:7): [True: 42, False: 2.40k]
  ------------------
  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.40k|  full_result r = scalar::base64::base64_tail_decode(
  744|  2.40k|      output, input, length, equalsigns, options, last_chunk_options);
  745|  2.40k|  r = scalar::base64::patch_tail_result(r, 0, 0, equallocation,
  746|  2.40k|                                        full_input_length, last_chunk_options);
  747|  2.40k|  if (!is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (747:7): [True: 1.39k, False: 1.01k]
  |  Branch (747:42): [True: 682, False: 710]
  ------------------
  748|    682|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (748:7): [True: 6, False: 676]
  |  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.40k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (759:7): [True: 1.01k, False: 1.39k]
  |  Branch (759:41): [True: 740, False: 272]
  ------------------
  760|    740|      r.input_count < full_input_length) {
  ------------------
  |  Branch (760:7): [True: 516, False: 224]
  ------------------
  761|       |    // First check if we can extend the input to the end of the stream
  762|  5.88k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (762:12): [True: 5.86k, False: 14]
  ------------------
  763|  5.86k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (763:12): [True: 5.36k, False: 502]
  ------------------
  764|  5.36k|      r.input_count++;
  765|  5.36k|    }
  766|       |    // If we are still not at the end of the stream, then we must backtrack
  767|       |    // to the last non-ignorable character.
  768|    516|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (768:9): [True: 502, False: 14]
  ------------------
  769|  5.58k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (769:14): [True: 5.45k, False: 124]
  ------------------
  770|  5.45k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (770:14): [True: 5.08k, False: 378]
  ------------------
  771|  5.08k|        r.input_count--;
  772|  5.08k|      }
  773|    502|    }
  774|    516|  }
  775|  2.40k|  return r;
  776|  2.40k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6418base64_tail_decodeIcEENS_11full_resultEPcPKT_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  371|  5.32k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  372|  5.32k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  373|  5.32k|                                        options, last_chunk_options);
  374|  5.32k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EcEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  164|  5.32k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  165|  5.32k|  char *dstend = dst + outlen;
  166|  5.32k|  (void)dstend;
  167|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  168|       |  // two branches (easily predicted):
  169|  5.32k|  const uint8_t *to_base64 =
  170|  5.32k|      (options & base64_default_or_url)
  ------------------
  |  Branch (170:7): [True: 0, False: 5.32k]
  ------------------
  171|  5.32k|          ? tables::base64::to_base64_default_or_url_value
  172|  5.32k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (172:14): [True: 2.51k, False: 2.80k]
  ------------------
  173|  5.32k|                                    : tables::base64::to_base64_value);
  174|  5.32k|  const uint32_t *d0 =
  175|  5.32k|      (options & base64_default_or_url)
  ------------------
  |  Branch (175:7): [True: 0, False: 5.32k]
  ------------------
  176|  5.32k|          ? tables::base64::base64_default_or_url::d0
  177|  5.32k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (177:14): [True: 2.51k, False: 2.80k]
  ------------------
  178|  5.32k|                                    : tables::base64::base64_default::d0);
  179|  5.32k|  const uint32_t *d1 =
  180|  5.32k|      (options & base64_default_or_url)
  ------------------
  |  Branch (180:7): [True: 0, False: 5.32k]
  ------------------
  181|  5.32k|          ? tables::base64::base64_default_or_url::d1
  182|  5.32k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (182:14): [True: 2.51k, False: 2.80k]
  ------------------
  183|  5.32k|                                    : tables::base64::base64_default::d1);
  184|  5.32k|  const uint32_t *d2 =
  185|  5.32k|      (options & base64_default_or_url)
  ------------------
  |  Branch (185:7): [True: 0, False: 5.32k]
  ------------------
  186|  5.32k|          ? tables::base64::base64_default_or_url::d2
  187|  5.32k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (187:14): [True: 2.51k, False: 2.80k]
  ------------------
  188|  5.32k|                                    : tables::base64::base64_default::d2);
  189|  5.32k|  const uint32_t *d3 =
  190|  5.32k|      (options & base64_default_or_url)
  ------------------
  |  Branch (190:7): [True: 0, False: 5.32k]
  ------------------
  191|  5.32k|          ? tables::base64::base64_default_or_url::d3
  192|  5.32k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (192:14): [True: 2.51k, False: 2.80k]
  ------------------
  193|  5.32k|                                    : tables::base64::base64_default::d3);
  194|  5.32k|  const bool ignore_garbage =
  195|  5.32k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (195:7): [True: 0, False: 5.32k]
  ------------------
  196|  5.32k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (196:7): [True: 0, False: 5.32k]
  ------------------
  197|  5.32k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (197:7): [True: 0, False: 5.32k]
  ------------------
  198|       |
  199|  5.32k|  const char_type *srcend = src + length;
  200|  5.32k|  const char_type *srcinit = src;
  201|  5.32k|  const char *dstinit = dst;
  202|       |
  203|  5.32k|  uint32_t x;
  204|  5.32k|  size_t idx;
  205|  5.32k|  uint8_t buffer[4];
  206|  79.7k|  while (true) {
  ------------------
  |  Branch (206:10): [True: 79.7k, Folded]
  ------------------
  207|  5.46M|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (207:12): [True: 5.46M, False: 3.50k]
  |  Branch (207:33): [True: 5.46M, False: 0]
  ------------------
  208|  5.46M|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (208:12): [True: 5.46M, False: 0]
  |  Branch (208:37): [True: 5.46M, False: 0]
  ------------------
  209|  5.46M|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (209:12): [True: 5.46M, False: 0]
  ------------------
  210|  5.46M|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (210:12): [True: 5.38M, False: 76.2k]
  ------------------
  211|  5.46M|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  212|  5.38M|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (212:11): [Folded, False: 5.38M]
  |  Branch (212:29): [True: 0, False: 0]
  ------------------
  213|      0|        return {OUTPUT_BUFFER_TOO_SMALL, size_t(src - srcinit),
  214|      0|                size_t(dst - dstinit)};
  215|      0|      }
  216|  5.38M|      *dst++ = static_cast<char>(x & 0xFF);
  217|  5.38M|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  218|  5.38M|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  219|  5.38M|      src += 4;
  220|  5.38M|    }
  221|  79.7k|    const char_type *srccur = src;
  222|  79.7k|    idx = 0;
  223|       |    // we need at least four characters.
  224|  79.7k|#ifdef __clang__
  225|       |    // If possible, we read four characters at a time. (It is an optimization.)
  226|  79.7k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (226:9): [True: 0, False: 79.7k]
  |  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|  79.7k|#endif
  248|   692k|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (248:12): [True: 617k, False: 74.4k]
  |  Branch (248:25): [True: 613k, False: 4.21k]
  ------------------
  249|   613k|      char_type c = *src;
  250|       |
  251|   613k|      uint8_t code = to_base64[uint8_t(c)];
  252|   613k|      buffer[idx] = uint8_t(code);
  253|   613k|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (253:11): [True: 613k, False: 0]
  |  Branch (253:31): [True: 304k, False: 308k]
  ------------------
  254|   304k|        idx++;
  255|   308k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (255:18): [True: 308k, False: 0]
  ------------------
  256|   308k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (256:19): [True: 1.10k, False: 307k]
  |  Branch (256:32): [True: 0, False: 307k]
  ------------------
  257|  1.10k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  258|  1.10k|                size_t(dst - dstinit)};
  259|   307k|      } else {
  260|       |        // We have a space or a newline or garbage. We ignore it.
  261|   307k|      }
  262|   612k|      src++;
  263|   612k|    }
  264|  78.6k|    if (idx != 4) {
  ------------------
  |  Branch (264:9): [True: 4.21k, False: 74.4k]
  ------------------
  265|  4.21k|      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.21k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (268:11): [True: 4.21k, False: 0]
  |  Branch (268:30): [True: 6, False: 4.21k]
  ------------------
  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.21k|      if (!ignore_garbage &&
  ------------------
  |  Branch (277:11): [True: 4.21k, False: 0]
  ------------------
  278|  4.21k|          last_chunk_options == last_chunk_handling_options::loose &&
  ------------------
  |  Branch (278:11): [True: 1.82k, False: 2.38k]
  ------------------
  279|  1.82k|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (279:11): [True: 1.08k, False: 742]
  |  Branch (279:25): [True: 12, False: 1.06k]
  ------------------
  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.20k|        if (!ignore_garbage &&
  ------------------
  |  Branch (288:13): [True: 4.20k, False: 0]
  ------------------
  289|  4.20k|            last_chunk_options == last_chunk_handling_options::strict &&
  ------------------
  |  Branch (289:13): [True: 370, False: 3.83k]
  ------------------
  290|    370|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (290:13): [True: 174, False: 196]
  |  Branch (290:27): [True: 126, False: 48]
  ------------------
  291|       |          // The partial chunk was at src - idx
  292|    126|          return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  293|    126|                  size_t(dst - dstinit), true};
  294|    126|        } 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.07k|          if ((last_chunk_options ==
  ------------------
  |  Branch (298:16): [True: 2.01k, False: 2.06k]
  ------------------
  299|  4.07k|                   last_chunk_handling_options::stop_before_partial &&
  300|  2.01k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (300:16): [True: 2.00k, False: 18]
  |  Branch (300:50): [True: 1.54k, False: 458]
  ------------------
  301|  1.54k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (301:17): [True: 660, False: 882]
  |  Branch (301:29): [True: 846, False: 36]
  ------------------
  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.50k|               (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.50k|            src = srccur;
  308|  1.50k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  309|  2.57k|          } else {
  310|  2.57k|            if (idx == 2) {
  ------------------
  |  Branch (310:17): [True: 594, False: 1.97k]
  ------------------
  311|    594|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  312|    594|                                (uint32_t(buffer[1]) << 2 * 6);
  313|    594|              if (!ignore_garbage &&
  ------------------
  |  Branch (313:19): [True: 594, False: 0]
  ------------------
  314|    594|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (314:19): [True: 30, False: 564]
  ------------------
  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|    570|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (319:19): [Folded, False: 570]
  |  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|    570|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  324|  1.97k|            } else if (idx == 3) {
  ------------------
  |  Branch (324:24): [True: 546, False: 1.43k]
  ------------------
  325|    546|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  326|    546|                                (uint32_t(buffer[1]) << 2 * 6) +
  327|    546|                                (uint32_t(buffer[2]) << 1 * 6);
  328|    546|              if (!ignore_garbage &&
  ------------------
  |  Branch (328:19): [True: 546, False: 0]
  ------------------
  329|    546|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (329:19): [True: 18, False: 528]
  ------------------
  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|    534|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (334:19): [Folded, False: 534]
  |  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|    534|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  339|    534|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  340|  1.43k|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (340:24): [True: 1.43k, False: 0]
  |  Branch (340:43): [True: 372, False: 1.06k]
  ------------------
  341|    372|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (341:25): [True: 336, False: 36]
  ------------------
  342|     36|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (342:26): [True: 36, False: 0]
  ------------------
  343|    372|                         padding_characters > 0))) {
  ------------------
  |  Branch (343:26): [True: 36, False: 0]
  ------------------
  344|    372|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  345|    372|                      size_t(dst - dstinit)};
  346|  1.06k|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (346:24): [True: 1.06k, False: 0]
  |  Branch (346:43): [True: 1.06k, False: 0]
  |  Branch (346:55): [True: 12, False: 1.04k]
  ------------------
  347|     12|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  348|     12|                      size_t(dst - dstinit), true};
  349|     12|            }
  350|  2.15k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  351|  2.57k|          }
  352|  4.21k|    }
  353|  74.4k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (353:9): [Folded, False: 74.4k]
  |  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|  74.4k|    uint32_t triple =
  358|  74.4k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  359|  74.4k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  360|  74.4k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  361|  74.4k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  362|  74.4k|    *dst++ = static_cast<char>(triple & 0xFF);
  363|  74.4k|  }
  364|  5.32k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIDsEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  727|  2.53k|    last_chunk_handling_options last_chunk_options) noexcept {
  728|  2.53k|  const bool ignore_garbage =
  729|  2.53k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (729:7): [True: 0, False: 2.53k]
  ------------------
  730|  2.53k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (730:7): [True: 0, False: 2.53k]
  ------------------
  731|  2.53k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (731:7): [True: 0, False: 2.53k]
  ------------------
  732|  2.53k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  733|  2.53k|  size_t equallocation = ri.equallocation;
  734|  2.53k|  size_t equalsigns = ri.equalsigns;
  735|  2.53k|  length = ri.srclen;
  736|  2.53k|  size_t full_input_length = ri.full_input_length;
  737|  2.53k|  if (length == 0) {
  ------------------
  |  Branch (737:7): [True: 38, False: 2.49k]
  ------------------
  738|     38|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (738:9): [True: 38, False: 0]
  |  Branch (738:28): [True: 18, False: 20]
  ------------------
  739|     18|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
  740|     18|    }
  741|     20|    return {SUCCESS, full_input_length, 0};
  742|     38|  }
  743|  2.49k|  full_result r = scalar::base64::base64_tail_decode(
  744|  2.49k|      output, input, length, equalsigns, options, last_chunk_options);
  745|  2.49k|  r = scalar::base64::patch_tail_result(r, 0, 0, equallocation,
  746|  2.49k|                                        full_input_length, last_chunk_options);
  747|  2.49k|  if (!is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (747:7): [True: 974, False: 1.52k]
  |  Branch (747:42): [True: 278, False: 696]
  ------------------
  748|    278|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (748:7): [True: 8, False: 270]
  |  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.49k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (759:7): [True: 1.52k, False: 974]
  |  Branch (759:41): [True: 902, False: 618]
  ------------------
  760|    902|      r.input_count < full_input_length) {
  ------------------
  |  Branch (760:7): [True: 644, False: 258]
  ------------------
  761|       |    // First check if we can extend the input to the end of the stream
  762|  5.38k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (762:12): [True: 5.36k, False: 16]
  ------------------
  763|  5.36k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (763:12): [True: 4.74k, False: 628]
  ------------------
  764|  4.74k|      r.input_count++;
  765|  4.74k|    }
  766|       |    // If we are still not at the end of the stream, then we must backtrack
  767|       |    // to the last non-ignorable character.
  768|    644|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (768:9): [True: 628, False: 16]
  ------------------
  769|  5.07k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (769:14): [True: 4.94k, False: 134]
  ------------------
  770|  4.94k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (770:14): [True: 4.45k, False: 494]
  ------------------
  771|  4.45k|        r.input_count--;
  772|  4.45k|      }
  773|    628|    }
  774|    644|  }
  775|  2.49k|  return r;
  776|  2.49k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6418base64_tail_decodeIDsEENS_11full_resultEPcPKT_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  371|  5.52k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  372|  5.52k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  373|  5.52k|                                        options, last_chunk_options);
  374|  5.52k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EDsEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  164|  5.52k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  165|  5.52k|  char *dstend = dst + outlen;
  166|  5.52k|  (void)dstend;
  167|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  168|       |  // two branches (easily predicted):
  169|  5.52k|  const uint8_t *to_base64 =
  170|  5.52k|      (options & base64_default_or_url)
  ------------------
  |  Branch (170:7): [True: 0, False: 5.52k]
  ------------------
  171|  5.52k|          ? tables::base64::to_base64_default_or_url_value
  172|  5.52k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (172:14): [True: 2.71k, False: 2.80k]
  ------------------
  173|  5.52k|                                    : tables::base64::to_base64_value);
  174|  5.52k|  const uint32_t *d0 =
  175|  5.52k|      (options & base64_default_or_url)
  ------------------
  |  Branch (175:7): [True: 0, False: 5.52k]
  ------------------
  176|  5.52k|          ? tables::base64::base64_default_or_url::d0
  177|  5.52k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (177:14): [True: 2.71k, False: 2.80k]
  ------------------
  178|  5.52k|                                    : tables::base64::base64_default::d0);
  179|  5.52k|  const uint32_t *d1 =
  180|  5.52k|      (options & base64_default_or_url)
  ------------------
  |  Branch (180:7): [True: 0, False: 5.52k]
  ------------------
  181|  5.52k|          ? tables::base64::base64_default_or_url::d1
  182|  5.52k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (182:14): [True: 2.71k, False: 2.80k]
  ------------------
  183|  5.52k|                                    : tables::base64::base64_default::d1);
  184|  5.52k|  const uint32_t *d2 =
  185|  5.52k|      (options & base64_default_or_url)
  ------------------
  |  Branch (185:7): [True: 0, False: 5.52k]
  ------------------
  186|  5.52k|          ? tables::base64::base64_default_or_url::d2
  187|  5.52k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (187:14): [True: 2.71k, False: 2.80k]
  ------------------
  188|  5.52k|                                    : tables::base64::base64_default::d2);
  189|  5.52k|  const uint32_t *d3 =
  190|  5.52k|      (options & base64_default_or_url)
  ------------------
  |  Branch (190:7): [True: 0, False: 5.52k]
  ------------------
  191|  5.52k|          ? tables::base64::base64_default_or_url::d3
  192|  5.52k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (192:14): [True: 2.71k, False: 2.80k]
  ------------------
  193|  5.52k|                                    : tables::base64::base64_default::d3);
  194|  5.52k|  const bool ignore_garbage =
  195|  5.52k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (195:7): [True: 0, False: 5.52k]
  ------------------
  196|  5.52k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (196:7): [True: 0, False: 5.52k]
  ------------------
  197|  5.52k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (197:7): [True: 0, False: 5.52k]
  ------------------
  198|       |
  199|  5.52k|  const char_type *srcend = src + length;
  200|  5.52k|  const char_type *srcinit = src;
  201|  5.52k|  const char *dstinit = dst;
  202|       |
  203|  5.52k|  uint32_t x;
  204|  5.52k|  size_t idx;
  205|  5.52k|  uint8_t buffer[4];
  206|  90.7k|  while (true) {
  ------------------
  |  Branch (206:10): [True: 90.7k, Folded]
  ------------------
  207|  1.42M|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (207:12): [True: 1.41M, False: 3.11k]
  |  Branch (207:33): [True: 1.41M, False: 352]
  ------------------
  208|  1.41M|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (208:12): [True: 1.41M, False: 196]
  |  Branch (208:37): [True: 1.41M, False: 206]
  ------------------
  209|  1.41M|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (209:12): [True: 1.41M, False: 216]
  ------------------
  210|  1.41M|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (210:12): [True: 1.33M, False: 86.7k]
  ------------------
  211|  1.41M|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  212|  1.33M|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (212:11): [Folded, False: 1.33M]
  |  Branch (212:29): [True: 0, False: 0]
  ------------------
  213|      0|        return {OUTPUT_BUFFER_TOO_SMALL, size_t(src - srcinit),
  214|      0|                size_t(dst - dstinit)};
  215|      0|      }
  216|  1.33M|      *dst++ = static_cast<char>(x & 0xFF);
  217|  1.33M|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  218|  1.33M|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  219|  1.33M|      src += 4;
  220|  1.33M|    }
  221|  90.7k|    const char_type *srccur = src;
  222|  90.7k|    idx = 0;
  223|       |    // we need at least four characters.
  224|  90.7k|#ifdef __clang__
  225|       |    // If possible, we read four characters at a time. (It is an optimization.)
  226|  90.7k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (226:9): [True: 0, False: 90.7k]
  |  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|  90.7k|#endif
  248|   619k|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (248:12): [True: 533k, False: 85.2k]
  |  Branch (248:25): [True: 530k, False: 3.38k]
  ------------------
  249|   530k|      char_type c = *src;
  250|       |
  251|   530k|      uint8_t code = to_base64[uint8_t(c)];
  252|   530k|      buffer[idx] = uint8_t(code);
  253|   530k|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (253:11): [True: 529k, False: 1.43k]
  |  Branch (253:31): [True: 348k, False: 180k]
  ------------------
  254|   348k|        idx++;
  255|   348k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (255:18): [True: 182k, False: 0]
  ------------------
  256|   182k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (256:19): [True: 1.51k, False: 180k]
  |  Branch (256:32): [True: 622, False: 180k]
  ------------------
  257|  2.13k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  258|  2.13k|                size_t(dst - dstinit)};
  259|   180k|      } else {
  260|       |        // We have a space or a newline or garbage. We ignore it.
  261|   180k|      }
  262|   528k|      src++;
  263|   528k|    }
  264|  88.6k|    if (idx != 4) {
  ------------------
  |  Branch (264:9): [True: 3.38k, False: 85.2k]
  ------------------
  265|  3.38k|      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.38k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (268:11): [True: 3.38k, False: 0]
  |  Branch (268:30): [True: 6, False: 3.38k]
  ------------------
  269|      6|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  270|      6|                size_t(dst - dstinit), true};
  271|      6|      }
  272|       |
  273|       |      // The idea here is that in loose mode,
  274|       |      // if there is padding at all, it must be used
  275|       |      // to form 4-wise chunk. However, in loose mode,
  276|       |      // we do accept no padding at all.
  277|  3.38k|      if (!ignore_garbage &&
  ------------------
  |  Branch (277:11): [True: 3.38k, False: 0]
  ------------------
  278|  3.38k|          last_chunk_options == last_chunk_handling_options::loose &&
  ------------------
  |  Branch (278:11): [True: 736, False: 2.64k]
  ------------------
  279|    736|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (279:11): [True: 456, False: 280]
  |  Branch (279:25): [True: 18, False: 438]
  ------------------
  280|     18|          ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (280:11): [True: 6, False: 12]
  ------------------
  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.37k|        if (!ignore_garbage &&
  ------------------
  |  Branch (288:13): [True: 3.37k, False: 0]
  ------------------
  289|  3.37k|            last_chunk_options == last_chunk_handling_options::strict &&
  ------------------
  |  Branch (289:13): [True: 264, False: 3.11k]
  ------------------
  290|    264|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (290:13): [True: 162, False: 102]
  |  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|  3.26k|          if ((last_chunk_options ==
  ------------------
  |  Branch (298:16): [True: 2.38k, False: 880]
  ------------------
  299|  3.26k|                   last_chunk_handling_options::stop_before_partial &&
  300|  2.38k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (300:16): [True: 2.36k, False: 12]
  |  Branch (300:50): [True: 1.90k, False: 460]
  ------------------
  301|  1.90k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (301:17): [True: 960, False: 948]
  |  Branch (301:29): [True: 924, False: 24]
  ------------------
  302|  1.37k|              (last_chunk_options ==
  ------------------
  |  Branch (302:16): [True: 0, False: 1.37k]
  ------------------
  303|  1.37k|                   last_chunk_handling_options::only_full_chunks &&
  304|  1.88k|               (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.88k|            src = srccur;
  308|  1.88k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  309|  1.88k|          } else {
  310|  1.37k|            if (idx == 2) {
  ------------------
  |  Branch (310:17): [True: 264, False: 1.11k]
  ------------------
  311|    264|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  312|    264|                                (uint32_t(buffer[1]) << 2 * 6);
  313|    264|              if (!ignore_garbage &&
  ------------------
  |  Branch (313:19): [True: 264, False: 0]
  ------------------
  314|    264|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (314:19): [True: 30, False: 234]
  ------------------
  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|    240|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (319:19): [Folded, False: 240]
  |  Branch (319:37): [True: 0, False: 0]
  ------------------
  320|      0|                return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  321|      0|                        size_t(dst - dstinit)};
  322|      0|              }
  323|    240|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  324|  1.11k|            } else if (idx == 3) {
  ------------------
  |  Branch (324:24): [True: 246, False: 866]
  ------------------
  325|    246|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  326|    246|                                (uint32_t(buffer[1]) << 2 * 6) +
  327|    246|                                (uint32_t(buffer[2]) << 1 * 6);
  328|    246|              if (!ignore_garbage &&
  ------------------
  |  Branch (328:19): [True: 246, False: 0]
  ------------------
  329|    246|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (329:19): [True: 18, False: 228]
  ------------------
  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|    234|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (334:19): [Folded, False: 234]
  |  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|    234|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  339|    234|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  340|    866|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (340:24): [True: 866, False: 0]
  |  Branch (340:43): [True: 156, False: 710]
  ------------------
  341|    156|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (341:25): [True: 132, False: 24]
  ------------------
  342|     24|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (342:26): [True: 24, False: 0]
  ------------------
  343|    156|                         padding_characters > 0))) {
  ------------------
  |  Branch (343:26): [True: 24, False: 0]
  ------------------
  344|    156|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  345|    156|                      size_t(dst - dstinit)};
  346|    710|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (346:24): [True: 710, False: 0]
  |  Branch (346:43): [True: 710, False: 0]
  |  Branch (346:55): [True: 36, False: 674]
  ------------------
  347|     36|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  348|     36|                      size_t(dst - dstinit), true};
  349|     36|            }
  350|  1.14k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  351|  1.37k|          }
  352|  3.38k|    }
  353|  85.2k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (353:9): [Folded, False: 85.2k]
  |  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|  85.2k|    uint32_t triple =
  358|  85.2k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  359|  85.2k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  360|  85.2k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  361|  85.2k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  362|  85.2k|    *dst++ = static_cast<char>(triple & 0xFF);
  363|  85.2k|  }
  364|  5.52k|}

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

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

simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.16k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.16k|  const uint8_t *to_base64 =
   47|  1.16k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.16k]
  ------------------
   48|  1.16k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.16k, Folded]
  ------------------
   49|  1.16k|                                   : tables::base64::to_base64_value);
   50|  1.16k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.16k|  size_t equallocation = ri.equallocation;
   52|  1.16k|  size_t equalsigns = ri.equalsigns;
   53|  1.16k|  srclen = ri.srclen;
   54|  1.16k|  size_t full_input_length = ri.full_input_length;
   55|  1.16k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 22, False: 1.14k]
  ------------------
   56|     22|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 22, Folded]
  |  Branch (56:28): [True: 10, False: 12]
  ------------------
   57|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     10|    }
   59|     12|    return {SUCCESS, full_input_length, 0};
   60|     22|  }
   61|  1.14k|  char *end_of_safe_64byte_zone =
   62|  1.14k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 38, False: 1.10k]
  ------------------
   63|  1.14k|          ? nullptr
   64|  1.14k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 358, False: 748]
  ------------------
   65|  1.10k|                                        : dst);
   66|       |
   67|  1.14k|  const chartype *const srcinit = src;
   68|  1.14k|  const char *const dstinit = dst;
   69|  1.14k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.14k|  constexpr size_t block_size = 6;
   72|  1.14k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.14k|  char buffer[block_size * 64];
   74|  1.14k|  char *bufferptr = buffer;
   75|  1.14k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 912, False: 232]
  ------------------
   76|    912|    const chartype *const srcend64 = src + srclen - 64;
   77|   144k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 143k, False: 606]
  ------------------
   78|   143k|      block64 b(src);
   79|   143k|      src += 64;
   80|   143k|      uint64_t error = 0;
   81|   143k|      const uint64_t badcharmask =
   82|   143k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   143k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 143k, Folded]
  |  Branch (83:30): [True: 306, False: 143k]
  ------------------
   84|    306|        src -= 64;
   85|    306|        const size_t error_offset = trailing_zeroes(error);
   86|    306|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    306|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    306|      }
   89|   143k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 28.4k, False: 114k]
  ------------------
   90|  28.4k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   114k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 29.6k, False: 85.1k]
  ------------------
   92|  29.6k|        b.copy_block(bufferptr);
   93|  29.6k|        bufferptr += 64;
   94|  85.1k|      } else {
   95|  85.1k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 85.0k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|  85.0k|        } else {
   98|  85.0k|          b.base64_decode_block(dst);
   99|  85.0k|        }
  100|  85.1k|        dst += 48;
  101|  85.1k|      }
  102|   143k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 11.0k, False: 132k]
  ------------------
  103|  55.4k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 44.3k, False: 11.0k]
  ------------------
  104|  44.3k|          base64_decode_block(dst, buffer + i * 64);
  105|  44.3k|          dst += 48;
  106|  44.3k|        }
  107|  11.0k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 11.0k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  11.0k|        } else {
  110|  11.0k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  11.0k|        }
  112|  11.0k|        dst += 48;
  113|  11.0k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  11.0k|                    64); // 64 might be too much
  115|  11.0k|        bufferptr -= (block_size - 1) * 64;
  116|  11.0k|      }
  117|   143k|    }
  118|    912|  }
  119|       |
  120|    838|  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|    838|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    838|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 552, False: 286]
  |  Branch (124:26): [True: 82, False: 470]
  ------------------
  125|       |
  126|    942|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 882, False: 60]
  |  Branch (126:52): [True: 866, False: 16]
  ------------------
  127|    866|      uint8_t val = to_base64[uint8_t(*src)];
  128|    866|      *bufferptr = char(val);
  129|    866|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 866, Folded]
  ------------------
  130|    866|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 866]
  |  Branch (130:52): [True: 6, False: 860]
  ------------------
  131|      6|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      6|                size_t(dst - dstinit)};
  133|      6|      }
  134|    860|      bufferptr += (val <= 63);
  135|    860|      src++;
  136|    860|    }
  137|     82|  }
  138|       |
  139|  1.28k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 450, False: 832]
  ------------------
  140|    450|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 38, False: 412]
  ------------------
  141|     38|      base64_decode_block_safe(dst, buffer_start);
  142|    412|    } else {
  143|    412|      base64_decode_block(dst, buffer_start);
  144|    412|    }
  145|    450|    dst += 48;
  146|    450|  }
  147|    832|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 486, False: 346]
  ------------------
  148|  4.08k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.60k, False: 486]
  ------------------
  149|  3.60k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.60k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.60k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.60k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.60k|                        << 8;
  154|  3.60k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.60k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.60k|#endif
  157|  3.60k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.60k|      dst += 3;
  160|  3.60k|      buffer_start += 4;
  161|  3.60k|    }
  162|    486|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 130, False: 356]
  ------------------
  163|    130|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    130|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    130|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    130|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    130|                        << 8;
  168|    130|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    130|      triple = scalar::u32_swap_bytes(triple);
  170|    130|#endif
  171|    130|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    130|      dst += 3;
  174|    130|      buffer_start += 4;
  175|    130|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    486|    int leftover = int(bufferptr - buffer_start);
  179|  1.21k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 726, False: 486]
  ------------------
  180|    726|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 726, Folded]
  ------------------
  181|  12.5k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 11.8k, False: 726]
  ------------------
  182|  11.8k|          src--;
  183|  11.8k|        }
  184|    726|      } 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|    726|      src--;
  190|    726|      leftover--;
  191|    726|    }
  192|    486|  }
  193|    832|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 686, False: 146]
  ------------------
  194|    686|    full_result r = scalar::base64::base64_tail_decode(
  195|    686|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    686|    r = scalar::base64::patch_tail_result(
  197|    686|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    686|        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|    686|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 302, False: 384]
  |  Branch (203:43): [True: 280, False: 22]
  ------------------
  204|    280|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 232, False: 48]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    594|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 586, False: 8]
  ------------------
  207|    586|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 362, False: 224]
  ------------------
  208|    362|        r.input_count++;
  209|    362|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    232|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 224, False: 8]
  ------------------
  213|  2.32k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.26k, False: 58]
  ------------------
  214|  2.26k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.10k, False: 166]
  ------------------
  215|  2.10k|          r.input_count--;
  216|  2.10k|        }
  217|    224|      }
  218|    232|    }
  219|    686|    return r;
  220|    686|  }
  221|    146|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 146, Folded]
  |  Branch (221:26): [True: 0, False: 146]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    146|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    146|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.28k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.28k|  const uint8_t *to_base64 =
   47|  1.28k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.28k]
  ------------------
   48|  1.28k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.28k]
  ------------------
   49|  1.28k|                                   : tables::base64::to_base64_value);
   50|  1.28k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.28k|  size_t equallocation = ri.equallocation;
   52|  1.28k|  size_t equalsigns = ri.equalsigns;
   53|  1.28k|  srclen = ri.srclen;
   54|  1.28k|  size_t full_input_length = ri.full_input_length;
   55|  1.28k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 20, False: 1.26k]
  ------------------
   56|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 20, Folded]
  |  Branch (56:28): [True: 10, False: 10]
  ------------------
   57|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     10|    }
   59|     10|    return {SUCCESS, full_input_length, 0};
   60|     20|  }
   61|  1.26k|  char *end_of_safe_64byte_zone =
   62|  1.26k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 54, False: 1.20k]
  ------------------
   63|  1.26k|          ? nullptr
   64|  1.26k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 364, False: 842]
  ------------------
   65|  1.20k|                                        : 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: 958, False: 302]
  ------------------
   76|    958|    const chartype *const srcend64 = src + srclen - 64;
   77|   203k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 202k, False: 634]
  ------------------
   78|   202k|      block64 b(src);
   79|   202k|      src += 64;
   80|   202k|      uint64_t error = 0;
   81|   202k|      const uint64_t badcharmask =
   82|   202k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   202k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 202k, Folded]
  |  Branch (83:30): [True: 324, False: 202k]
  ------------------
   84|    324|        src -= 64;
   85|    324|        const size_t error_offset = trailing_zeroes(error);
   86|    324|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    324|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    324|      }
   89|   202k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 30.8k, False: 171k]
  ------------------
   90|  30.8k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   171k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 119k, False: 51.1k]
  ------------------
   92|   119k|        b.copy_block(bufferptr);
   93|   119k|        bufferptr += 64;
   94|   119k|      } else {
   95|  51.1k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 8, False: 51.1k]
  ------------------
   96|      8|          b.base64_decode_block_safe(dst);
   97|  51.1k|        } else {
   98|  51.1k|          b.base64_decode_block(dst);
   99|  51.1k|        }
  100|  51.1k|        dst += 48;
  101|  51.1k|      }
  102|   202k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 29.5k, False: 172k]
  ------------------
  103|   147k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 118k, False: 29.5k]
  ------------------
  104|   118k|          base64_decode_block(dst, buffer + i * 64);
  105|   118k|          dst += 48;
  106|   118k|        }
  107|  29.5k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 29.5k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  29.5k|        } else {
  110|  29.5k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  29.5k|        }
  112|  29.5k|        dst += 48;
  113|  29.5k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  29.5k|                    64); // 64 might be too much
  115|  29.5k|        bufferptr -= (block_size - 1) * 64;
  116|  29.5k|      }
  117|   202k|    }
  118|    958|  }
  119|       |
  120|    936|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    936|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    936|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 590, False: 346]
  |  Branch (124:26): [True: 86, False: 504]
  ------------------
  125|       |
  126|    918|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 856, False: 62]
  |  Branch (126:52): [True: 836, False: 20]
  ------------------
  127|    836|      uint8_t val = to_base64[uint8_t(*src)];
  128|    836|      *bufferptr = char(val);
  129|    836|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 836, Folded]
  ------------------
  130|    836|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 836]
  |  Branch (130:52): [True: 4, False: 832]
  ------------------
  131|      4|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      4|                size_t(dst - dstinit)};
  133|      4|      }
  134|    832|      bufferptr += (val <= 63);
  135|    832|      src++;
  136|    832|    }
  137|     86|  }
  138|       |
  139|  1.37k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 438, False: 932]
  ------------------
  140|    438|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 34, False: 404]
  ------------------
  141|     34|      base64_decode_block_safe(dst, buffer_start);
  142|    404|    } else {
  143|    404|      base64_decode_block(dst, buffer_start);
  144|    404|    }
  145|    438|    dst += 48;
  146|    438|  }
  147|    932|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 524, False: 408]
  ------------------
  148|  4.51k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.98k, False: 524]
  ------------------
  149|  3.98k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.98k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.98k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.98k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.98k|                        << 8;
  154|  3.98k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.98k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.98k|#endif
  157|  3.98k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.98k|      dst += 3;
  160|  3.98k|      buffer_start += 4;
  161|  3.98k|    }
  162|    524|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 144, False: 380]
  ------------------
  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|    524|    int leftover = int(bufferptr - buffer_start);
  179|  1.28k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 760, False: 524]
  ------------------
  180|    760|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 760, Folded]
  ------------------
  181|  5.77k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 5.01k, False: 760]
  ------------------
  182|  5.01k|          src--;
  183|  5.01k|        }
  184|    760|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    760|      src--;
  190|    760|      leftover--;
  191|    760|    }
  192|    524|  }
  193|    932|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 774, False: 158]
  ------------------
  194|    774|    full_result r = scalar::base64::base64_tail_decode(
  195|    774|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    774|    r = scalar::base64::patch_tail_result(
  197|    774|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    774|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    774|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 388, False: 386]
  |  Branch (203:43): [True: 338, False: 50]
  ------------------
  204|    338|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 284, False: 54]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    684|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 678, False: 6]
  ------------------
  207|    678|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 400, False: 278]
  ------------------
  208|    400|        r.input_count++;
  209|    400|      }
  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: 278, False: 6]
  ------------------
  213|  3.25k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 3.19k, False: 66]
  ------------------
  214|  3.19k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.97k, False: 212]
  ------------------
  215|  2.97k|          r.input_count--;
  216|  2.97k|        }
  217|    278|      }
  218|    284|    }
  219|    774|    return r;
  220|    774|  }
  221|    158|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 158, Folded]
  |  Branch (221:26): [True: 0, False: 158]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    158|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    158|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.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: 16, False: 1.22k]
  ------------------
   56|     16|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 16, Folded]
  |  Branch (56:28): [True: 8, False: 8]
  ------------------
   57|      8|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      8|    }
   59|      8|    return {SUCCESS, full_input_length, 0};
   60|     16|  }
   61|  1.22k|  char *end_of_safe_64byte_zone =
   62|  1.22k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 102, False: 1.12k]
  ------------------
   63|  1.22k|          ? nullptr
   64|  1.22k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 312, False: 808]
  ------------------
   65|  1.12k|                                        : 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: 914, False: 308]
  ------------------
   76|    914|    const chartype *const srcend64 = src + srclen - 64;
   77|  22.3k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 21.7k, False: 610]
  ------------------
   78|  21.7k|      block64 b(src);
   79|  21.7k|      src += 64;
   80|  21.7k|      uint64_t error = 0;
   81|  21.7k|      const uint64_t badcharmask =
   82|  21.7k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  21.7k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 21.7k, Folded]
  |  Branch (83:30): [True: 304, False: 21.4k]
  ------------------
   84|    304|        src -= 64;
   85|    304|        const size_t error_offset = trailing_zeroes(error);
   86|    304|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    304|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    304|      }
   89|  21.4k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 17.1k, False: 4.25k]
  ------------------
   90|  17.1k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  17.1k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 3.77k, False: 478]
  ------------------
   92|  3.77k|        b.copy_block(bufferptr);
   93|  3.77k|        bufferptr += 64;
   94|  3.77k|      } else {
   95|    478|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 468]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|    468|        } else {
   98|    468|          b.base64_decode_block(dst);
   99|    468|        }
  100|    478|        dst += 48;
  101|    478|      }
  102|  21.4k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 3.88k, False: 17.5k]
  ------------------
  103|  19.4k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 15.5k, False: 3.88k]
  ------------------
  104|  15.5k|          base64_decode_block(dst, buffer + i * 64);
  105|  15.5k|          dst += 48;
  106|  15.5k|        }
  107|  3.88k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 3.88k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  3.88k|        } else {
  110|  3.88k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  3.88k|        }
  112|  3.88k|        dst += 48;
  113|  3.88k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  3.88k|                    64); // 64 might be too much
  115|  3.88k|        bufferptr -= (block_size - 1) * 64;
  116|  3.88k|      }
  117|  21.4k|    }
  118|    914|  }
  119|       |
  120|    918|  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|    918|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    918|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 560, False: 358]
  |  Branch (124:26): [True: 96, False: 464]
  ------------------
  125|       |
  126|    740|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 700, False: 40]
  |  Branch (126:52): [True: 684, False: 16]
  ------------------
  127|    684|      uint8_t val = to_base64[uint8_t(*src)];
  128|    684|      *bufferptr = char(val);
  129|    684|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 684, Folded]
  ------------------
  130|    684|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 24, False: 660]
  |  Branch (130:52): [True: 16, False: 644]
  ------------------
  131|     40|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     40|                size_t(dst - dstinit)};
  133|     40|      }
  134|    644|      bufferptr += (val <= 63);
  135|    644|      src++;
  136|    644|    }
  137|     96|  }
  138|       |
  139|  1.19k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 318, False: 878]
  ------------------
  140|    318|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 26, False: 292]
  ------------------
  141|     26|      base64_decode_block_safe(dst, buffer_start);
  142|    292|    } else {
  143|    292|      base64_decode_block(dst, buffer_start);
  144|    292|    }
  145|    318|    dst += 48;
  146|    318|  }
  147|    878|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 480, False: 398]
  ------------------
  148|  3.93k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.45k, False: 480]
  ------------------
  149|  3.45k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.45k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.45k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.45k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.45k|                        << 8;
  154|  3.45k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.45k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.45k|#endif
  157|  3.45k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.45k|      dst += 3;
  160|  3.45k|      buffer_start += 4;
  161|  3.45k|    }
  162|    480|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 112, False: 368]
  ------------------
  163|    112|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    112|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    112|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    112|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    112|                        << 8;
  168|    112|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    112|      triple = scalar::u32_swap_bytes(triple);
  170|    112|#endif
  171|    112|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    112|      dst += 3;
  174|    112|      buffer_start += 4;
  175|    112|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    480|    int leftover = int(bufferptr - buffer_start);
  179|  1.23k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 752, False: 480]
  ------------------
  180|    752|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 752, Folded]
  ------------------
  181|  5.67k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.92k, False: 752]
  ------------------
  182|  4.92k|          src--;
  183|  4.92k|        }
  184|    752|      } 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|    752|      src--;
  190|    752|      leftover--;
  191|    752|    }
  192|    480|  }
  193|    878|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 748, False: 130]
  ------------------
  194|    748|    full_result r = scalar::base64::base64_tail_decode(
  195|    748|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    748|    r = scalar::base64::patch_tail_result(
  197|    748|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    748|        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|    748|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 470, False: 278]
  |  Branch (203:43): [True: 364, False: 106]
  ------------------
  204|    364|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 330, False: 34]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    662|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 656, False: 6]
  ------------------
  207|    656|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 332, False: 324]
  ------------------
  208|    332|        r.input_count++;
  209|    332|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    330|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 324, False: 6]
  ------------------
  213|  2.20k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.13k, False: 68]
  ------------------
  214|  2.13k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.87k, False: 256]
  ------------------
  215|  1.87k|          r.input_count--;
  216|  1.87k|        }
  217|    324|      }
  218|    330|    }
  219|    748|    return r;
  220|    748|  }
  221|    130|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 130, Folded]
  |  Branch (221:26): [True: 0, False: 130]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    130|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    130|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.29k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.29k|  const uint8_t *to_base64 =
   47|  1.29k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.29k]
  ------------------
   48|  1.29k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.29k]
  ------------------
   49|  1.29k|                                   : tables::base64::to_base64_value);
   50|  1.29k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.29k|  size_t equallocation = ri.equallocation;
   52|  1.29k|  size_t equalsigns = ri.equalsigns;
   53|  1.29k|  srclen = ri.srclen;
   54|  1.29k|  size_t full_input_length = ri.full_input_length;
   55|  1.29k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 22, False: 1.27k]
  ------------------
   56|     22|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 22, Folded]
  |  Branch (56:28): [True: 10, False: 12]
  ------------------
   57|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     10|    }
   59|     12|    return {SUCCESS, full_input_length, 0};
   60|     22|  }
   61|  1.27k|  char *end_of_safe_64byte_zone =
   62|  1.27k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 90, False: 1.18k]
  ------------------
   63|  1.27k|          ? nullptr
   64|  1.27k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 362, False: 820]
  ------------------
   65|  1.18k|                                        : dst);
   66|       |
   67|  1.27k|  const chartype *const srcinit = src;
   68|  1.27k|  const char *const dstinit = dst;
   69|  1.27k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.27k|  constexpr size_t block_size = 6;
   72|  1.27k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.27k|  char buffer[block_size * 64];
   74|  1.27k|  char *bufferptr = buffer;
   75|  1.27k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 958, False: 314]
  ------------------
   76|    958|    const chartype *const srcend64 = src + srclen - 64;
   77|  70.0k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 69.4k, False: 614]
  ------------------
   78|  69.4k|      block64 b(src);
   79|  69.4k|      src += 64;
   80|  69.4k|      uint64_t error = 0;
   81|  69.4k|      const uint64_t badcharmask =
   82|  69.4k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  69.4k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 69.4k, Folded]
  |  Branch (83:30): [True: 344, False: 69.1k]
  ------------------
   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|  69.1k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 54.5k, False: 14.6k]
  ------------------
   90|  54.5k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  54.5k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 14.1k, False: 472]
  ------------------
   92|  14.1k|        b.copy_block(bufferptr);
   93|  14.1k|        bufferptr += 64;
   94|  14.1k|      } else {
   95|    472|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 4, False: 468]
  ------------------
   96|      4|          b.base64_decode_block_safe(dst);
   97|    468|        } else {
   98|    468|          b.base64_decode_block(dst);
   99|    468|        }
  100|    472|        dst += 48;
  101|    472|      }
  102|  69.1k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 13.2k, False: 55.8k]
  ------------------
  103|  66.3k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 53.0k, False: 13.2k]
  ------------------
  104|  53.0k|          base64_decode_block(dst, buffer + i * 64);
  105|  53.0k|          dst += 48;
  106|  53.0k|        }
  107|  13.2k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 13.2k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  13.2k|        } else {
  110|  13.2k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  13.2k|        }
  112|  13.2k|        dst += 48;
  113|  13.2k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  13.2k|                    64); // 64 might be too much
  115|  13.2k|        bufferptr -= (block_size - 1) * 64;
  116|  13.2k|      }
  117|  69.1k|    }
  118|    958|  }
  119|       |
  120|    928|  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|    928|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    928|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 580, False: 348]
  |  Branch (124:26): [True: 110, False: 470]
  ------------------
  125|       |
  126|    860|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 804, False: 56]
  |  Branch (126:52): [True: 788, False: 16]
  ------------------
  127|    788|      uint8_t val = to_base64[uint8_t(*src)];
  128|    788|      *bufferptr = char(val);
  129|    788|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 788, Folded]
  ------------------
  130|    788|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 22, False: 766]
  |  Branch (130:52): [True: 16, False: 750]
  ------------------
  131|     38|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     38|                size_t(dst - dstinit)};
  133|     38|      }
  134|    750|      bufferptr += (val <= 63);
  135|    750|      src++;
  136|    750|    }
  137|    110|  }
  138|       |
  139|  1.30k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 414, False: 890]
  ------------------
  140|    414|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 30, False: 384]
  ------------------
  141|     30|      base64_decode_block_safe(dst, buffer_start);
  142|    384|    } else {
  143|    384|      base64_decode_block(dst, buffer_start);
  144|    384|    }
  145|    414|    dst += 48;
  146|    414|  }
  147|    890|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 486, False: 404]
  ------------------
  148|  4.20k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.71k, False: 486]
  ------------------
  149|  3.71k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.71k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.71k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.71k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.71k|                        << 8;
  154|  3.71k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.71k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.71k|#endif
  157|  3.71k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.71k|      dst += 3;
  160|  3.71k|      buffer_start += 4;
  161|  3.71k|    }
  162|    486|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 114, False: 372]
  ------------------
  163|    114|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    114|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    114|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    114|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    114|                        << 8;
  168|    114|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    114|      triple = scalar::u32_swap_bytes(triple);
  170|    114|#endif
  171|    114|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    114|      dst += 3;
  174|    114|      buffer_start += 4;
  175|    114|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    486|    int leftover = int(bufferptr - buffer_start);
  179|  1.23k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 748, False: 486]
  ------------------
  180|    748|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 748, Folded]
  ------------------
  181|  7.49k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 6.74k, False: 748]
  ------------------
  182|  6.74k|          src--;
  183|  6.74k|        }
  184|    748|      } 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|    748|      src--;
  190|    748|      leftover--;
  191|    748|    }
  192|    486|  }
  193|    890|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 766, False: 124]
  ------------------
  194|    766|    full_result r = scalar::base64::base64_tail_decode(
  195|    766|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    766|    r = scalar::base64::patch_tail_result(
  197|    766|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    766|        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|    766|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 448, False: 318]
  |  Branch (203:43): [True: 360, False: 88]
  ------------------
  204|    360|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 312, False: 48]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    624|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 616, False: 8]
  ------------------
  207|    616|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 312, False: 304]
  ------------------
  208|    312|        r.input_count++;
  209|    312|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    312|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 304, False: 8]
  ------------------
  213|  2.87k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.81k, False: 66]
  ------------------
  214|  2.81k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.57k, False: 238]
  ------------------
  215|  2.57k|          r.input_count--;
  216|  2.57k|        }
  217|    304|      }
  218|    312|    }
  219|    766|    return r;
  220|    766|  }
  221|    124|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 124, Folded]
  |  Branch (221:26): [True: 0, False: 124]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    124|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    124|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.16k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.16k|  const uint8_t *to_base64 =
   47|  1.16k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.16k]
  ------------------
   48|  1.16k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.16k, Folded]
  ------------------
   49|  1.16k|                                   : tables::base64::to_base64_value);
   50|  1.16k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.16k|  size_t equallocation = ri.equallocation;
   52|  1.16k|  size_t equalsigns = ri.equalsigns;
   53|  1.16k|  srclen = ri.srclen;
   54|  1.16k|  size_t full_input_length = ri.full_input_length;
   55|  1.16k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 22, False: 1.14k]
  ------------------
   56|     22|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 22, Folded]
  |  Branch (56:28): [True: 10, False: 12]
  ------------------
   57|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     10|    }
   59|     12|    return {SUCCESS, full_input_length, 0};
   60|     22|  }
   61|  1.14k|  char *end_of_safe_64byte_zone =
   62|  1.14k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 38, False: 1.10k]
  ------------------
   63|  1.14k|          ? nullptr
   64|  1.14k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 358, False: 748]
  ------------------
   65|  1.10k|                                        : dst);
   66|       |
   67|  1.14k|  const chartype *const srcinit = src;
   68|  1.14k|  const char *const dstinit = dst;
   69|  1.14k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.14k|  constexpr size_t block_size = 6;
   72|  1.14k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.14k|  char buffer[block_size * 64];
   74|  1.14k|  char *bufferptr = buffer;
   75|  1.14k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 912, False: 232]
  ------------------
   76|    912|    const chartype *const srcend64 = src + srclen - 64;
   77|   144k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 143k, False: 606]
  ------------------
   78|   143k|      block64 b(src);
   79|   143k|      src += 64;
   80|   143k|      uint64_t error = 0;
   81|   143k|      const uint64_t badcharmask =
   82|   143k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   143k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 143k, Folded]
  |  Branch (83:30): [True: 306, False: 143k]
  ------------------
   84|    306|        src -= 64;
   85|    306|        const size_t error_offset = trailing_zeroes(error);
   86|    306|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    306|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    306|      }
   89|   143k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 28.4k, False: 114k]
  ------------------
   90|  28.4k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   114k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 29.6k, False: 85.1k]
  ------------------
   92|  29.6k|        b.copy_block(bufferptr);
   93|  29.6k|        bufferptr += 64;
   94|  85.1k|      } else {
   95|  85.1k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 85.0k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|  85.0k|        } else {
   98|  85.0k|          b.base64_decode_block(dst);
   99|  85.0k|        }
  100|  85.1k|        dst += 48;
  101|  85.1k|      }
  102|   143k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 11.0k, False: 132k]
  ------------------
  103|  55.4k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 44.3k, False: 11.0k]
  ------------------
  104|  44.3k|          base64_decode_block(dst, buffer + i * 64);
  105|  44.3k|          dst += 48;
  106|  44.3k|        }
  107|  11.0k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 11.0k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  11.0k|        } else {
  110|  11.0k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  11.0k|        }
  112|  11.0k|        dst += 48;
  113|  11.0k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  11.0k|                    64); // 64 might be too much
  115|  11.0k|        bufferptr -= (block_size - 1) * 64;
  116|  11.0k|      }
  117|   143k|    }
  118|    912|  }
  119|       |
  120|    838|  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|    838|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    838|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 552, False: 286]
  |  Branch (124:26): [True: 82, False: 470]
  ------------------
  125|       |
  126|    942|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 882, False: 60]
  |  Branch (126:52): [True: 866, False: 16]
  ------------------
  127|    866|      uint8_t val = to_base64[uint8_t(*src)];
  128|    866|      *bufferptr = char(val);
  129|    866|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 866, Folded]
  ------------------
  130|    866|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 866]
  |  Branch (130:52): [True: 6, False: 860]
  ------------------
  131|      6|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      6|                size_t(dst - dstinit)};
  133|      6|      }
  134|    860|      bufferptr += (val <= 63);
  135|    860|      src++;
  136|    860|    }
  137|     82|  }
  138|       |
  139|  1.28k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 450, False: 832]
  ------------------
  140|    450|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 38, False: 412]
  ------------------
  141|     38|      base64_decode_block_safe(dst, buffer_start);
  142|    412|    } else {
  143|    412|      base64_decode_block(dst, buffer_start);
  144|    412|    }
  145|    450|    dst += 48;
  146|    450|  }
  147|    832|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 486, False: 346]
  ------------------
  148|  4.08k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.60k, False: 486]
  ------------------
  149|  3.60k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.60k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.60k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.60k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.60k|                        << 8;
  154|  3.60k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.60k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.60k|#endif
  157|  3.60k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.60k|      dst += 3;
  160|  3.60k|      buffer_start += 4;
  161|  3.60k|    }
  162|    486|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 130, False: 356]
  ------------------
  163|    130|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    130|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    130|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    130|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    130|                        << 8;
  168|    130|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    130|      triple = scalar::u32_swap_bytes(triple);
  170|    130|#endif
  171|    130|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    130|      dst += 3;
  174|    130|      buffer_start += 4;
  175|    130|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    486|    int leftover = int(bufferptr - buffer_start);
  179|  1.21k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 726, False: 486]
  ------------------
  180|    726|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 726, Folded]
  ------------------
  181|  12.5k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 11.8k, False: 726]
  ------------------
  182|  11.8k|          src--;
  183|  11.8k|        }
  184|    726|      } 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|    726|      src--;
  190|    726|      leftover--;
  191|    726|    }
  192|    486|  }
  193|    832|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 686, False: 146]
  ------------------
  194|    686|    full_result r = scalar::base64::base64_tail_decode(
  195|    686|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    686|    r = scalar::base64::patch_tail_result(
  197|    686|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    686|        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|    686|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 302, False: 384]
  |  Branch (203:43): [True: 280, False: 22]
  ------------------
  204|    280|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 232, False: 48]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    594|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 586, False: 8]
  ------------------
  207|    586|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 362, False: 224]
  ------------------
  208|    362|        r.input_count++;
  209|    362|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    232|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 224, False: 8]
  ------------------
  213|  2.32k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.26k, False: 58]
  ------------------
  214|  2.26k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.10k, False: 166]
  ------------------
  215|  2.10k|          r.input_count--;
  216|  2.10k|        }
  217|    224|      }
  218|    232|    }
  219|    686|    return r;
  220|    686|  }
  221|    146|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 146, Folded]
  |  Branch (221:26): [True: 0, False: 146]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    146|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    146|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.28k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.28k|  const uint8_t *to_base64 =
   47|  1.28k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.28k]
  ------------------
   48|  1.28k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.28k]
  ------------------
   49|  1.28k|                                   : tables::base64::to_base64_value);
   50|  1.28k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.28k|  size_t equallocation = ri.equallocation;
   52|  1.28k|  size_t equalsigns = ri.equalsigns;
   53|  1.28k|  srclen = ri.srclen;
   54|  1.28k|  size_t full_input_length = ri.full_input_length;
   55|  1.28k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 20, False: 1.26k]
  ------------------
   56|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 20, Folded]
  |  Branch (56:28): [True: 10, False: 10]
  ------------------
   57|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     10|    }
   59|     10|    return {SUCCESS, full_input_length, 0};
   60|     20|  }
   61|  1.26k|  char *end_of_safe_64byte_zone =
   62|  1.26k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 54, False: 1.20k]
  ------------------
   63|  1.26k|          ? nullptr
   64|  1.26k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 364, False: 842]
  ------------------
   65|  1.20k|                                        : 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: 958, False: 302]
  ------------------
   76|    958|    const chartype *const srcend64 = src + srclen - 64;
   77|   203k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 202k, False: 634]
  ------------------
   78|   202k|      block64 b(src);
   79|   202k|      src += 64;
   80|   202k|      uint64_t error = 0;
   81|   202k|      const uint64_t badcharmask =
   82|   202k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   202k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 202k, Folded]
  |  Branch (83:30): [True: 324, False: 202k]
  ------------------
   84|    324|        src -= 64;
   85|    324|        const size_t error_offset = trailing_zeroes(error);
   86|    324|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    324|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    324|      }
   89|   202k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 30.8k, False: 171k]
  ------------------
   90|  30.8k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   171k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 119k, False: 51.1k]
  ------------------
   92|   119k|        b.copy_block(bufferptr);
   93|   119k|        bufferptr += 64;
   94|   119k|      } else {
   95|  51.1k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 8, False: 51.1k]
  ------------------
   96|      8|          b.base64_decode_block_safe(dst);
   97|  51.1k|        } else {
   98|  51.1k|          b.base64_decode_block(dst);
   99|  51.1k|        }
  100|  51.1k|        dst += 48;
  101|  51.1k|      }
  102|   202k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 29.5k, False: 172k]
  ------------------
  103|   147k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 118k, False: 29.5k]
  ------------------
  104|   118k|          base64_decode_block(dst, buffer + i * 64);
  105|   118k|          dst += 48;
  106|   118k|        }
  107|  29.5k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 29.5k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  29.5k|        } else {
  110|  29.5k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  29.5k|        }
  112|  29.5k|        dst += 48;
  113|  29.5k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  29.5k|                    64); // 64 might be too much
  115|  29.5k|        bufferptr -= (block_size - 1) * 64;
  116|  29.5k|      }
  117|   202k|    }
  118|    958|  }
  119|       |
  120|    936|  char *buffer_start = buffer;
  121|       |  // Optimization note: if this is almost full, then it is worth our
  122|       |  // time, otherwise, we should just decode directly.
  123|    936|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    936|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 590, False: 346]
  |  Branch (124:26): [True: 86, False: 504]
  ------------------
  125|       |
  126|    918|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 856, False: 62]
  |  Branch (126:52): [True: 836, False: 20]
  ------------------
  127|    836|      uint8_t val = to_base64[uint8_t(*src)];
  128|    836|      *bufferptr = char(val);
  129|    836|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 836, Folded]
  ------------------
  130|    836|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 836]
  |  Branch (130:52): [True: 4, False: 832]
  ------------------
  131|      4|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      4|                size_t(dst - dstinit)};
  133|      4|      }
  134|    832|      bufferptr += (val <= 63);
  135|    832|      src++;
  136|    832|    }
  137|     86|  }
  138|       |
  139|  1.37k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 438, False: 932]
  ------------------
  140|    438|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 34, False: 404]
  ------------------
  141|     34|      base64_decode_block_safe(dst, buffer_start);
  142|    404|    } else {
  143|    404|      base64_decode_block(dst, buffer_start);
  144|    404|    }
  145|    438|    dst += 48;
  146|    438|  }
  147|    932|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 524, False: 408]
  ------------------
  148|  4.51k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.98k, False: 524]
  ------------------
  149|  3.98k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.98k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.98k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.98k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.98k|                        << 8;
  154|  3.98k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.98k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.98k|#endif
  157|  3.98k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.98k|      dst += 3;
  160|  3.98k|      buffer_start += 4;
  161|  3.98k|    }
  162|    524|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 144, False: 380]
  ------------------
  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|    524|    int leftover = int(bufferptr - buffer_start);
  179|  1.28k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 760, False: 524]
  ------------------
  180|    760|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 760, Folded]
  ------------------
  181|  5.77k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 5.01k, False: 760]
  ------------------
  182|  5.01k|          src--;
  183|  5.01k|        }
  184|    760|      } else {
  185|      0|        while (to_base64[uint8_t(*(src - 1))] >= 64) {
  ------------------
  |  Branch (185:16): [True: 0, False: 0]
  ------------------
  186|      0|          src--;
  187|      0|        }
  188|      0|      }
  189|    760|      src--;
  190|    760|      leftover--;
  191|    760|    }
  192|    524|  }
  193|    932|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 774, False: 158]
  ------------------
  194|    774|    full_result r = scalar::base64::base64_tail_decode(
  195|    774|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    774|    r = scalar::base64::patch_tail_result(
  197|    774|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    774|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    774|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 388, False: 386]
  |  Branch (203:43): [True: 338, False: 50]
  ------------------
  204|    338|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 284, False: 54]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    684|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 678, False: 6]
  ------------------
  207|    678|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 400, False: 278]
  ------------------
  208|    400|        r.input_count++;
  209|    400|      }
  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: 278, False: 6]
  ------------------
  213|  3.25k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 3.19k, False: 66]
  ------------------
  214|  3.19k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.97k, False: 212]
  ------------------
  215|  2.97k|          r.input_count--;
  216|  2.97k|        }
  217|    278|      }
  218|    284|    }
  219|    774|    return r;
  220|    774|  }
  221|    158|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 158, Folded]
  |  Branch (221:26): [True: 0, False: 158]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    158|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    158|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.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: 16, False: 1.22k]
  ------------------
   56|     16|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 16, Folded]
  |  Branch (56:28): [True: 8, False: 8]
  ------------------
   57|      8|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      8|    }
   59|      8|    return {SUCCESS, full_input_length, 0};
   60|     16|  }
   61|  1.22k|  char *end_of_safe_64byte_zone =
   62|  1.22k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 102, False: 1.12k]
  ------------------
   63|  1.22k|          ? nullptr
   64|  1.22k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 312, False: 808]
  ------------------
   65|  1.12k|                                        : 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: 914, False: 308]
  ------------------
   76|    914|    const chartype *const srcend64 = src + srclen - 64;
   77|  22.3k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 21.7k, False: 610]
  ------------------
   78|  21.7k|      block64 b(src);
   79|  21.7k|      src += 64;
   80|  21.7k|      uint64_t error = 0;
   81|  21.7k|      const uint64_t badcharmask =
   82|  21.7k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  21.7k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 21.7k, Folded]
  |  Branch (83:30): [True: 304, False: 21.4k]
  ------------------
   84|    304|        src -= 64;
   85|    304|        const size_t error_offset = trailing_zeroes(error);
   86|    304|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    304|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    304|      }
   89|  21.4k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 17.1k, False: 4.25k]
  ------------------
   90|  17.1k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  17.1k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 3.77k, False: 478]
  ------------------
   92|  3.77k|        b.copy_block(bufferptr);
   93|  3.77k|        bufferptr += 64;
   94|  3.77k|      } else {
   95|    478|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 468]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|    468|        } else {
   98|    468|          b.base64_decode_block(dst);
   99|    468|        }
  100|    478|        dst += 48;
  101|    478|      }
  102|  21.4k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 3.88k, False: 17.5k]
  ------------------
  103|  19.4k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 15.5k, False: 3.88k]
  ------------------
  104|  15.5k|          base64_decode_block(dst, buffer + i * 64);
  105|  15.5k|          dst += 48;
  106|  15.5k|        }
  107|  3.88k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 3.88k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  3.88k|        } else {
  110|  3.88k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  3.88k|        }
  112|  3.88k|        dst += 48;
  113|  3.88k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  3.88k|                    64); // 64 might be too much
  115|  3.88k|        bufferptr -= (block_size - 1) * 64;
  116|  3.88k|      }
  117|  21.4k|    }
  118|    914|  }
  119|       |
  120|    918|  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|    918|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    918|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 560, False: 358]
  |  Branch (124:26): [True: 96, False: 464]
  ------------------
  125|       |
  126|    740|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 700, False: 40]
  |  Branch (126:52): [True: 684, False: 16]
  ------------------
  127|    684|      uint8_t val = to_base64[uint8_t(*src)];
  128|    684|      *bufferptr = char(val);
  129|    684|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 684, Folded]
  ------------------
  130|    684|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 24, False: 660]
  |  Branch (130:52): [True: 16, False: 644]
  ------------------
  131|     40|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     40|                size_t(dst - dstinit)};
  133|     40|      }
  134|    644|      bufferptr += (val <= 63);
  135|    644|      src++;
  136|    644|    }
  137|     96|  }
  138|       |
  139|  1.19k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 318, False: 878]
  ------------------
  140|    318|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 26, False: 292]
  ------------------
  141|     26|      base64_decode_block_safe(dst, buffer_start);
  142|    292|    } else {
  143|    292|      base64_decode_block(dst, buffer_start);
  144|    292|    }
  145|    318|    dst += 48;
  146|    318|  }
  147|    878|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 480, False: 398]
  ------------------
  148|  3.93k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.45k, False: 480]
  ------------------
  149|  3.45k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.45k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.45k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.45k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.45k|                        << 8;
  154|  3.45k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.45k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.45k|#endif
  157|  3.45k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.45k|      dst += 3;
  160|  3.45k|      buffer_start += 4;
  161|  3.45k|    }
  162|    480|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 112, False: 368]
  ------------------
  163|    112|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    112|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    112|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    112|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    112|                        << 8;
  168|    112|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    112|      triple = scalar::u32_swap_bytes(triple);
  170|    112|#endif
  171|    112|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    112|      dst += 3;
  174|    112|      buffer_start += 4;
  175|    112|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    480|    int leftover = int(bufferptr - buffer_start);
  179|  1.23k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 752, False: 480]
  ------------------
  180|    752|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 752, Folded]
  ------------------
  181|  5.67k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.92k, False: 752]
  ------------------
  182|  4.92k|          src--;
  183|  4.92k|        }
  184|    752|      } 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|    752|      src--;
  190|    752|      leftover--;
  191|    752|    }
  192|    480|  }
  193|    878|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 748, False: 130]
  ------------------
  194|    748|    full_result r = scalar::base64::base64_tail_decode(
  195|    748|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    748|    r = scalar::base64::patch_tail_result(
  197|    748|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    748|        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|    748|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 470, False: 278]
  |  Branch (203:43): [True: 364, False: 106]
  ------------------
  204|    364|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 330, False: 34]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    662|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 656, False: 6]
  ------------------
  207|    656|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 332, False: 324]
  ------------------
  208|    332|        r.input_count++;
  209|    332|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    330|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 324, False: 6]
  ------------------
  213|  2.20k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.13k, False: 68]
  ------------------
  214|  2.13k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 1.87k, False: 256]
  ------------------
  215|  1.87k|          r.input_count--;
  216|  1.87k|        }
  217|    324|      }
  218|    330|    }
  219|    748|    return r;
  220|    748|  }
  221|    130|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 130, Folded]
  |  Branch (221:26): [True: 0, False: 130]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    130|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    130|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.29k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.29k|  const uint8_t *to_base64 =
   47|  1.29k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.29k]
  ------------------
   48|  1.29k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.29k]
  ------------------
   49|  1.29k|                                   : tables::base64::to_base64_value);
   50|  1.29k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.29k|  size_t equallocation = ri.equallocation;
   52|  1.29k|  size_t equalsigns = ri.equalsigns;
   53|  1.29k|  srclen = ri.srclen;
   54|  1.29k|  size_t full_input_length = ri.full_input_length;
   55|  1.29k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 22, False: 1.27k]
  ------------------
   56|     22|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 22, Folded]
  |  Branch (56:28): [True: 10, False: 12]
  ------------------
   57|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     10|    }
   59|     12|    return {SUCCESS, full_input_length, 0};
   60|     22|  }
   61|  1.27k|  char *end_of_safe_64byte_zone =
   62|  1.27k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 90, False: 1.18k]
  ------------------
   63|  1.27k|          ? nullptr
   64|  1.27k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 362, False: 820]
  ------------------
   65|  1.18k|                                        : dst);
   66|       |
   67|  1.27k|  const chartype *const srcinit = src;
   68|  1.27k|  const char *const dstinit = dst;
   69|  1.27k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.27k|  constexpr size_t block_size = 6;
   72|  1.27k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.27k|  char buffer[block_size * 64];
   74|  1.27k|  char *bufferptr = buffer;
   75|  1.27k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 958, False: 314]
  ------------------
   76|    958|    const chartype *const srcend64 = src + srclen - 64;
   77|  70.0k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 69.4k, False: 614]
  ------------------
   78|  69.4k|      block64 b(src);
   79|  69.4k|      src += 64;
   80|  69.4k|      uint64_t error = 0;
   81|  69.4k|      const uint64_t badcharmask =
   82|  69.4k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  69.4k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 69.4k, Folded]
  |  Branch (83:30): [True: 344, False: 69.1k]
  ------------------
   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|  69.1k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 54.5k, False: 14.6k]
  ------------------
   90|  54.5k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  54.5k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 14.1k, False: 472]
  ------------------
   92|  14.1k|        b.copy_block(bufferptr);
   93|  14.1k|        bufferptr += 64;
   94|  14.1k|      } else {
   95|    472|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 4, False: 468]
  ------------------
   96|      4|          b.base64_decode_block_safe(dst);
   97|    468|        } else {
   98|    468|          b.base64_decode_block(dst);
   99|    468|        }
  100|    472|        dst += 48;
  101|    472|      }
  102|  69.1k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 13.2k, False: 55.8k]
  ------------------
  103|  66.3k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 53.0k, False: 13.2k]
  ------------------
  104|  53.0k|          base64_decode_block(dst, buffer + i * 64);
  105|  53.0k|          dst += 48;
  106|  53.0k|        }
  107|  13.2k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 13.2k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  13.2k|        } else {
  110|  13.2k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  13.2k|        }
  112|  13.2k|        dst += 48;
  113|  13.2k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  13.2k|                    64); // 64 might be too much
  115|  13.2k|        bufferptr -= (block_size - 1) * 64;
  116|  13.2k|      }
  117|  69.1k|    }
  118|    958|  }
  119|       |
  120|    928|  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|    928|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    928|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 580, False: 348]
  |  Branch (124:26): [True: 110, False: 470]
  ------------------
  125|       |
  126|    860|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 804, False: 56]
  |  Branch (126:52): [True: 788, False: 16]
  ------------------
  127|    788|      uint8_t val = to_base64[uint8_t(*src)];
  128|    788|      *bufferptr = char(val);
  129|    788|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 788, Folded]
  ------------------
  130|    788|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 22, False: 766]
  |  Branch (130:52): [True: 16, False: 750]
  ------------------
  131|     38|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     38|                size_t(dst - dstinit)};
  133|     38|      }
  134|    750|      bufferptr += (val <= 63);
  135|    750|      src++;
  136|    750|    }
  137|    110|  }
  138|       |
  139|  1.30k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 414, False: 890]
  ------------------
  140|    414|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 30, False: 384]
  ------------------
  141|     30|      base64_decode_block_safe(dst, buffer_start);
  142|    384|    } else {
  143|    384|      base64_decode_block(dst, buffer_start);
  144|    384|    }
  145|    414|    dst += 48;
  146|    414|  }
  147|    890|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 486, False: 404]
  ------------------
  148|  4.20k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.71k, False: 486]
  ------------------
  149|  3.71k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.71k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.71k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.71k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.71k|                        << 8;
  154|  3.71k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.71k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.71k|#endif
  157|  3.71k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.71k|      dst += 3;
  160|  3.71k|      buffer_start += 4;
  161|  3.71k|    }
  162|    486|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 114, False: 372]
  ------------------
  163|    114|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    114|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    114|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    114|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    114|                        << 8;
  168|    114|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    114|      triple = scalar::u32_swap_bytes(triple);
  170|    114|#endif
  171|    114|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    114|      dst += 3;
  174|    114|      buffer_start += 4;
  175|    114|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    486|    int leftover = int(bufferptr - buffer_start);
  179|  1.23k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 748, False: 486]
  ------------------
  180|    748|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 748, Folded]
  ------------------
  181|  7.49k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 6.74k, False: 748]
  ------------------
  182|  6.74k|          src--;
  183|  6.74k|        }
  184|    748|      } 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|    748|      src--;
  190|    748|      leftover--;
  191|    748|    }
  192|    486|  }
  193|    890|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 766, False: 124]
  ------------------
  194|    766|    full_result r = scalar::base64::base64_tail_decode(
  195|    766|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    766|    r = scalar::base64::patch_tail_result(
  197|    766|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    766|        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|    766|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 448, False: 318]
  |  Branch (203:43): [True: 360, False: 88]
  ------------------
  204|    360|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 312, False: 48]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    624|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 616, False: 8]
  ------------------
  207|    616|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 312, False: 304]
  ------------------
  208|    312|        r.input_count++;
  209|    312|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    312|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 304, False: 8]
  ------------------
  213|  2.87k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.81k, False: 66]
  ------------------
  214|  2.81k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.57k, False: 238]
  ------------------
  215|  2.57k|          r.input_count--;
  216|  2.57k|        }
  217|    304|      }
  218|    312|    }
  219|    766|    return r;
  220|    766|  }
  221|    124|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 124, Folded]
  |  Branch (221:26): [True: 0, False: 124]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    124|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    124|}

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

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

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

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

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

_ZN7simdutf7haswell14implementationC2Ev:
   16|      1|      : simdutf::implementation("haswell", "Intel/AMD AVX2",
   17|      1|                                internal::instruction_set::AVX2 |
   18|      1|                                    internal::instruction_set::BMI1 |
   19|      1|                                    internal::instruction_set::BMI2) {}

_ZN7simdutf7icelake14implementationC2Ev:
   16|      1|      : simdutf::implementation(
   17|      1|            "icelake",
   18|      1|            "Intel AVX512 (AVX-512BW, AVX-512CD, AVX-512VL, AVX-512VBMI2 "
   19|      1|            "extensions)",
   20|      1|            internal::instruction_set::AVX2 | internal::instruction_set::BMI1 |
   21|      1|                internal::instruction_set::BMI2 |
   22|      1|                internal::instruction_set::AVX512BW |
   23|      1|                internal::instruction_set::AVX512CD |
   24|      1|                internal::instruction_set::AVX512VL |
   25|      1|                internal::instruction_set::AVX512VBMI2 |
   26|      1|                internal::instruction_set::AVX512VPOPCNTDQ) {}

simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_110count_onesEm:
   14|   132k|simdutf_really_inline long long int count_ones(uint64_t input_num) {
   15|       |  return _popcnt64(input_num);
   16|   132k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115trailing_zeroesEm:
   20|  99.1k|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|  99.1k|  return __builtin_ctzll(input_num);
   27|  99.1k|  #endif // SIMDUTF_REGULAR_VISUAL_STUDIO
   28|  99.1k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115is_power_of_twoImEEbT_:
   31|   131k|template <typename T> bool is_power_of_two(T x) { return (x & (x - 1)) == 0; }

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

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

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

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

