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

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

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

_ZN7simdutf10is_partialENS_27last_chunk_handling_optionsE:
 4122|  23.7k|is_partial(last_chunk_handling_options options) {
 4123|  23.7k|  return (options == stop_before_partial) || (options == only_full_chunks);
  ------------------
  |  Branch (4123:10): [True: 12.6k, False: 11.0k]
  |  Branch (4123:46): [True: 0, False: 11.0k]
  ------------------
 4124|  23.7k|}
_ZNK7simdutf14implementation4nameEv:
 5092|      4|  virtual std::string_view name() const noexcept { return _name; }
_ZNK7simdutf14implementation25required_instruction_setsEv:
 5143|      8|  virtual uint32_t required_instruction_sets() const {
 5144|      8|    return _required_instruction_sets;
 5145|      8|  }
_ZN7simdutf14implementationC2EPKcS2_j:
 7029|      4|      : _name(name), _description(description),
 7030|      4|        _required_instruction_sets(required_instruction_sets) {}
_ZN7simdutf8internal29available_implementation_listC2Ev:
 7061|      1|  simdutf_really_inline available_implementation_list() {}
_ZN7simdutf16base64_ignorableEcNS_14base64_optionsE:
 4848|  21.9k|base64_ignorable(char input, base64_options options = base64_default) noexcept {
 4849|  21.9k|  return scalar::base64::is_ignorable(input, options);
 4850|  21.9k|}
_ZN7simdutf16base64_ignorableEDsNS_14base64_optionsE:
 4853|  16.9k|                 base64_options options = base64_default) noexcept {
 4854|  16.9k|  return scalar::base64::is_ignorable(input, options);
 4855|  16.9k|}

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|  26.3M|template <class char_type> simdutf_constexpr23 bool is_eight_byte(char_type c) {
   20|  26.3M|  if constexpr (sizeof(char_type) == 1) {
   21|  26.3M|    return true;
   22|  26.3M|  }
   23|      0|  return uint8_t(c) == c;
   24|  26.3M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6413is_eight_byteIDsEEbT_:
   19|  4.71M|template <class char_type> simdutf_constexpr23 bool is_eight_byte(char_type c) {
   20|       |  if constexpr (sizeof(char_type) == 1) {
   21|       |    return true;
   22|       |  }
   23|  4.71M|  return uint8_t(c) == c;
   24|  4.71M|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKcEEmT_m:
  654|  3.78k|maximal_binary_length_from_base64(InputPtr input, size_t length) noexcept {
  655|       |  // We process the padding characters ('=') at the end to make sure
  656|       |  // that we return an exact result when the input has no ignorable characters
  657|       |  // (e.g., spaces).
  658|  3.78k|  size_t padding = 0;
  659|  3.78k|  if (length > 0) {
  ------------------
  |  Branch (659:7): [True: 3.77k, False: 12]
  ------------------
  660|  3.77k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (660:9): [True: 213, False: 3.56k]
  ------------------
  661|    213|      padding++;
  662|    213|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (662:11): [True: 207, False: 6]
  |  Branch (662:25): [True: 39, False: 168]
  ------------------
  663|     39|        padding++;
  664|     39|      }
  665|    213|    }
  666|  3.77k|  }
  667|       |  // The input is not otherwise processed for ignorable characters or
  668|       |  // validation, so that the function runs in constant time (very fast). In
  669|       |  // practice, base64 inputs without ignorable characters are common and the
  670|       |  // common case are line separated inputs with relatively long lines (e.g., 76
  671|       |  // characters) which leads this function to a slight (1%) overestimation of
  672|       |  // the output size.
  673|       |  //
  674|       |  // Of course, some inputs might contain an arbitrary number of spaces or
  675|       |  // newlines, which would make this function return a very pessimistic output
  676|       |  // size but systems that produce base64 outputs typically do not do that and
  677|       |  // if they do, they do not care much about minimizing memory usage.
  678|       |  //
  679|       |  // In specialized applications, users may know that their input is line
  680|       |  // separated, which can be checked very quickly by by iterating (e.g., over 76
  681|       |  // character chunks, looking for the linefeed characters only). We could
  682|       |  // provide a specialized function for that, but it is not clear that the added
  683|       |  // complexity is worth it for us.
  684|       |  //
  685|  3.78k|  size_t actual_length = length - padding;
  686|  3.78k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (686:7): [True: 3.23k, False: 558]
  ------------------
  687|  3.23k|    return actual_length / 4 * 3;
  688|  3.23k|  }
  689|       |  // if we have a valid input, then the remainder must be 2 or 3 adding one or
  690|       |  // two extra bytes.
  691|    558|  return actual_length / 4 * 3 + (actual_length % 4) - 1;
  692|  3.78k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6433maximal_binary_length_from_base64IPKDsEEmT_m:
  654|  3.92k|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.92k|  size_t padding = 0;
  659|  3.92k|  if (length > 0) {
  ------------------
  |  Branch (659:7): [True: 3.90k, False: 15]
  ------------------
  660|  3.90k|    if (input[length - 1] == '=') {
  ------------------
  |  Branch (660:9): [True: 276, False: 3.63k]
  ------------------
  661|    276|      padding++;
  662|    276|      if (length > 1 && input[length - 2] == '=') {
  ------------------
  |  Branch (662:11): [True: 270, False: 6]
  |  Branch (662:25): [True: 36, False: 234]
  ------------------
  663|     36|        padding++;
  664|     36|      }
  665|    276|    }
  666|  3.90k|  }
  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.92k|  size_t actual_length = length - padding;
  686|  3.92k|  if (actual_length % 4 <= 1) {
  ------------------
  |  Branch (686:7): [True: 3.45k, False: 468]
  ------------------
  687|  3.45k|    return actual_length / 4 * 3;
  688|  3.45k|  }
  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.92k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIcEEbT_NS_14base64_optionsE:
   28|  21.9k|                                      simdutf::base64_options options) {
   29|  21.9k|  const uint8_t *to_base64 =
   30|  21.9k|      (options & base64_default_or_url)
  ------------------
  |  Branch (30:7): [True: 0, False: 21.9k]
  ------------------
   31|  21.9k|          ? tables::base64::to_base64_default_or_url_value
   32|  21.9k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (32:14): [True: 16.8k, False: 5.15k]
  ------------------
   33|  21.9k|                                    : tables::base64::to_base64_value);
   34|  21.9k|  const bool ignore_garbage =
   35|  21.9k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (35:7): [True: 0, False: 21.9k]
  ------------------
   36|  21.9k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (36:7): [True: 0, False: 21.9k]
  ------------------
   37|  21.9k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (37:7): [True: 0, False: 21.9k]
  ------------------
   38|  21.9k|  uint8_t code = to_base64[uint8_t(c)];
   39|  21.9k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (39:7): [True: 21.9k, False: 0]
  |  Branch (39:27): [True: 2.89k, False: 19.0k]
  ------------------
   40|  2.89k|    return false;
   41|  2.89k|  }
   42|  19.0k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (42:7): [True: 19.0k, False: 0]
  |  Branch (42:27): [True: 19.0k, False: 0]
  ------------------
   43|  19.0k|    return true;
   44|  19.0k|  }
   45|      0|  return ignore_garbage;
   46|  19.0k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6412is_ignorableIDsEEbT_NS_14base64_optionsE:
   28|  16.9k|                                      simdutf::base64_options options) {
   29|  16.9k|  const uint8_t *to_base64 =
   30|  16.9k|      (options & base64_default_or_url)
  ------------------
  |  Branch (30:7): [True: 0, False: 16.9k]
  ------------------
   31|  16.9k|          ? tables::base64::to_base64_default_or_url_value
   32|  16.9k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (32:14): [True: 10.9k, False: 6.04k]
  ------------------
   33|  16.9k|                                    : tables::base64::to_base64_value);
   34|  16.9k|  const bool ignore_garbage =
   35|  16.9k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (35:7): [True: 0, False: 16.9k]
  ------------------
   36|  16.9k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (36:7): [True: 0, False: 16.9k]
  ------------------
   37|  16.9k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (37:7): [True: 0, False: 16.9k]
  ------------------
   38|  16.9k|  uint8_t code = to_base64[uint8_t(c)];
   39|  16.9k|  if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (39:7): [True: 16.9k, False: 0]
  |  Branch (39:27): [True: 3.35k, False: 13.6k]
  ------------------
   40|  3.35k|    return false;
   41|  3.35k|  }
   42|  13.6k|  if (is_eight_byte(c) && code == 64) {
  ------------------
  |  Branch (42:7): [True: 13.6k, False: 0]
  |  Branch (42:27): [True: 13.6k, False: 0]
  ------------------
   43|  13.6k|    return true;
   44|  13.6k|  }
   45|      0|  return ignore_garbage;
   46|  13.6k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIcEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  100|  7.57k|                                           simdutf::base64_options options) {
  101|  7.57k|  const uint8_t *to_base64 =
  102|  7.57k|      (options & base64_default_or_url)
  ------------------
  |  Branch (102:7): [True: 0, False: 7.57k]
  ------------------
  103|  7.57k|          ? tables::base64::to_base64_default_or_url_value
  104|  7.57k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (104:14): [True: 3.60k, False: 3.97k]
  ------------------
  105|  7.57k|                                    : tables::base64::to_base64_value);
  106|  7.57k|  const bool ignore_garbage =
  107|  7.57k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (107:7): [True: 0, False: 7.57k]
  ------------------
  108|  7.57k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (108:7): [True: 0, False: 7.57k]
  ------------------
  109|  7.57k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (109:7): [True: 0, False: 7.57k]
  ------------------
  110|       |
  111|  7.57k|  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.57k|  size_t full_input_length = srclen;
  115|       |  // skip trailing spaces
  116|  9.06k|  while (!ignore_garbage && srclen > 0 &&
  ------------------
  |  Branch (116:10): [True: 9.06k, False: 0]
  |  Branch (116:29): [True: 8.99k, False: 66]
  ------------------
  117|  8.99k|         scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (117:10): [True: 8.99k, False: 0]
  ------------------
  118|  8.99k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (118:10): [True: 1.48k, False: 7.51k]
  ------------------
  119|  1.48k|    srclen--;
  120|  1.48k|  }
  121|  7.57k|  size_t equallocation =
  122|  7.57k|      srclen; // location of the first padding character if any
  123|  7.57k|  if (ignore_garbage) {
  ------------------
  |  Branch (123:7): [True: 0, False: 7.57k]
  ------------------
  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.57k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (135:7): [True: 7.57k, False: 0]
  |  Branch (135:26): [True: 7.51k, False: 66]
  |  Branch (135:40): [True: 426, False: 7.08k]
  ------------------
  136|       |    // This is the last '=' sign.
  137|    426|    equallocation = srclen - 1;
  138|    426|    srclen--;
  139|    426|    equalsigns = 1;
  140|       |    // skip trailing spaces
  141|  1.44k|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (141:12): [True: 1.39k, False: 54]
  |  Branch (141:26): [True: 1.39k, False: 0]
  ------------------
  142|  1.39k|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (142:12): [True: 1.02k, False: 372]
  ------------------
  143|  1.02k|      srclen--;
  144|  1.02k|    }
  145|    426|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (145:9): [True: 372, False: 54]
  |  Branch (145:23): [True: 78, False: 294]
  ------------------
  146|       |      // This is the second '=' sign.
  147|     78|      equallocation = srclen - 1;
  148|     78|      srclen--;
  149|     78|      equalsigns = 2;
  150|     78|    }
  151|    426|  }
  152|  7.57k|  return {equalsigns, equallocation, srclen, full_input_length};
  153|  7.57k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6417patch_tail_resultENS_11full_resultEmmmmNS_27last_chunk_handling_optionsE:
  394|  11.1k|                  last_chunk_handling_options last_chunk_options) {
  395|  11.1k|  r.input_count += previous_input;
  396|  11.1k|  r.output_count += previous_output;
  397|  11.1k|  if (r.padding_error) {
  ------------------
  |  Branch (397:7): [True: 264, False: 10.8k]
  ------------------
  398|    264|    r.input_count = equallocation;
  399|    264|  }
  400|       |
  401|  11.1k|  if (r.error == error_code::SUCCESS) {
  ------------------
  |  Branch (401:7): [True: 6.77k, False: 4.35k]
  ------------------
  402|  6.77k|    if (!is_partial(last_chunk_options)) {
  ------------------
  |  Branch (402:9): [True: 2.46k, False: 4.31k]
  ------------------
  403|       |      // A success when we are not in stop_before_partial mode.
  404|       |      // means that we have consumed the whole input buffer.
  405|  2.46k|      r.input_count = full_input_length;
  406|  4.31k|    } else if (r.output_count % 3 != 0) {
  ------------------
  |  Branch (406:16): [True: 24, False: 4.29k]
  ------------------
  407|     24|      r.input_count = full_input_length;
  408|     24|    }
  409|  6.77k|  }
  410|  11.1k|  return r;
  411|  11.1k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base648find_endIDsEENS2_13reduced_inputEPKT_mNS_14base64_optionsE:
  100|  7.84k|                                           simdutf::base64_options options) {
  101|  7.84k|  const uint8_t *to_base64 =
  102|  7.84k|      (options & base64_default_or_url)
  ------------------
  |  Branch (102:7): [True: 0, False: 7.84k]
  ------------------
  103|  7.84k|          ? tables::base64::to_base64_default_or_url_value
  104|  7.84k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (104:14): [True: 3.76k, False: 4.08k]
  ------------------
  105|  7.84k|                                    : tables::base64::to_base64_value);
  106|  7.84k|  const bool ignore_garbage =
  107|  7.84k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (107:7): [True: 0, False: 7.84k]
  ------------------
  108|  7.84k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (108:7): [True: 0, False: 7.84k]
  ------------------
  109|  7.84k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (109:7): [True: 0, False: 7.84k]
  ------------------
  110|       |
  111|  7.84k|  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.84k|  size_t full_input_length = srclen;
  115|       |  // skip trailing spaces
  116|  9.16k|  while (!ignore_garbage && srclen > 0 &&
  ------------------
  |  Branch (116:10): [True: 9.16k, False: 0]
  |  Branch (116:29): [True: 9.10k, False: 66]
  ------------------
  117|  9.10k|         scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (117:10): [True: 7.11k, False: 1.99k]
  ------------------
  118|  7.11k|         to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (118:10): [True: 1.32k, False: 5.79k]
  ------------------
  119|  1.32k|    srclen--;
  120|  1.32k|  }
  121|  7.84k|  size_t equallocation =
  122|  7.84k|      srclen; // location of the first padding character if any
  123|  7.84k|  if (ignore_garbage) {
  ------------------
  |  Branch (123:7): [True: 0, False: 7.84k]
  ------------------
  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.84k|  if (!ignore_garbage && srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (135:7): [True: 7.84k, False: 0]
  |  Branch (135:26): [True: 7.78k, False: 66]
  |  Branch (135:40): [True: 552, False: 7.23k]
  ------------------
  136|       |    // This is the last '=' sign.
  137|    552|    equallocation = srclen - 1;
  138|    552|    srclen--;
  139|    552|    equalsigns = 1;
  140|       |    // skip trailing spaces
  141|  1.20k|    while (srclen > 0 && scalar::base64::is_eight_byte(src[srclen - 1]) &&
  ------------------
  |  Branch (141:12): [True: 1.15k, False: 48]
  |  Branch (141:26): [True: 984, False: 174]
  ------------------
  142|    984|           to_base64[uint8_t(src[srclen - 1])] == 64) {
  ------------------
  |  Branch (142:12): [True: 654, False: 330]
  ------------------
  143|    654|      srclen--;
  144|    654|    }
  145|    552|    if (srclen > 0 && src[srclen - 1] == '=') {
  ------------------
  |  Branch (145:9): [True: 504, False: 48]
  |  Branch (145:23): [True: 78, False: 426]
  ------------------
  146|       |      // This is the second '=' sign.
  147|     78|      equallocation = srclen - 1;
  148|     78|      srclen--;
  149|     78|      equalsigns = 2;
  150|     78|    }
  151|    552|  }
  152|  7.84k|  return {equalsigns, equallocation, srclen, full_input_length};
  153|  7.84k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIcEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  727|  2.52k|    last_chunk_handling_options last_chunk_options) noexcept {
  728|  2.52k|  const bool ignore_garbage =
  729|  2.52k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (729:7): [True: 0, False: 2.52k]
  ------------------
  730|  2.52k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (730:7): [True: 0, False: 2.52k]
  ------------------
  731|  2.52k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (731:7): [True: 0, False: 2.52k]
  ------------------
  732|  2.52k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  733|  2.52k|  size_t equallocation = ri.equallocation;
  734|  2.52k|  size_t equalsigns = ri.equalsigns;
  735|  2.52k|  length = ri.srclen;
  736|  2.52k|  size_t full_input_length = ri.full_input_length;
  737|  2.52k|  if (length == 0) {
  ------------------
  |  Branch (737:7): [True: 42, False: 2.48k]
  ------------------
  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.48k|  full_result r = scalar::base64::base64_tail_decode(
  744|  2.48k|      output, input, length, equalsigns, options, last_chunk_options);
  745|  2.48k|  r = scalar::base64::patch_tail_result(r, 0, 0, equallocation,
  746|  2.48k|                                        full_input_length, last_chunk_options);
  747|  2.48k|  if (!is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (747:7): [True: 1.46k, False: 1.02k]
  |  Branch (747:42): [True: 706, False: 758]
  ------------------
  748|    706|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (748:7): [True: 6, False: 700]
  |  Branch (748:25): [True: 6, False: 0]
  ------------------
  749|       |    // additional checks
  750|      6|    if ((r.output_count % 3 == 0) ||
  ------------------
  |  Branch (750:9): [True: 0, False: 6]
  ------------------
  751|      6|        ((r.output_count % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (751:9): [True: 0, False: 6]
  ------------------
  752|      0|      return {INVALID_BASE64_CHARACTER, equallocation, r.output_count, true};
  753|      0|    }
  754|      6|  }
  755|       |  // When is_partial(last_chunk_options) is true, we must either end with
  756|       |  // the end of the stream (beyond whitespace) or right after a non-ignorable
  757|       |  // character or at the very beginning of the stream.
  758|       |  // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  759|  2.48k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (759:7): [True: 1.02k, False: 1.46k]
  |  Branch (759:41): [True: 750, False: 270]
  ------------------
  760|    750|      r.input_count < full_input_length) {
  ------------------
  |  Branch (760:7): [True: 552, False: 198]
  ------------------
  761|       |    // First check if we can extend the input to the end of the stream
  762|  5.19k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (762:12): [True: 5.17k, False: 14]
  ------------------
  763|  5.17k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (763:12): [True: 4.63k, False: 538]
  ------------------
  764|  4.63k|      r.input_count++;
  765|  4.63k|    }
  766|       |    // If we are still not at the end of the stream, then we must backtrack
  767|       |    // to the last non-ignorable character.
  768|    552|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (768:9): [True: 538, False: 14]
  ------------------
  769|  4.88k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (769:14): [True: 4.76k, False: 112]
  ------------------
  770|  4.76k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (770:14): [True: 4.34k, False: 426]
  ------------------
  771|  4.34k|        r.input_count--;
  772|  4.34k|      }
  773|    538|    }
  774|    552|  }
  775|  2.48k|  return r;
  776|  2.48k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6418base64_tail_decodeIcEENS_11full_resultEPcPKT_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  371|  5.47k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  372|  5.47k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  373|  5.47k|                                        options, last_chunk_options);
  374|  5.47k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EcEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  164|  5.47k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  165|  5.47k|  char *dstend = dst + outlen;
  166|  5.47k|  (void)dstend;
  167|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  168|       |  // two branches (easily predicted):
  169|  5.47k|  const uint8_t *to_base64 =
  170|  5.47k|      (options & base64_default_or_url)
  ------------------
  |  Branch (170:7): [True: 0, False: 5.47k]
  ------------------
  171|  5.47k|          ? tables::base64::to_base64_default_or_url_value
  172|  5.47k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (172:14): [True: 2.60k, False: 2.87k]
  ------------------
  173|  5.47k|                                    : tables::base64::to_base64_value);
  174|  5.47k|  const uint32_t *d0 =
  175|  5.47k|      (options & base64_default_or_url)
  ------------------
  |  Branch (175:7): [True: 0, False: 5.47k]
  ------------------
  176|  5.47k|          ? tables::base64::base64_default_or_url::d0
  177|  5.47k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (177:14): [True: 2.60k, False: 2.87k]
  ------------------
  178|  5.47k|                                    : tables::base64::base64_default::d0);
  179|  5.47k|  const uint32_t *d1 =
  180|  5.47k|      (options & base64_default_or_url)
  ------------------
  |  Branch (180:7): [True: 0, False: 5.47k]
  ------------------
  181|  5.47k|          ? tables::base64::base64_default_or_url::d1
  182|  5.47k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (182:14): [True: 2.60k, False: 2.87k]
  ------------------
  183|  5.47k|                                    : tables::base64::base64_default::d1);
  184|  5.47k|  const uint32_t *d2 =
  185|  5.47k|      (options & base64_default_or_url)
  ------------------
  |  Branch (185:7): [True: 0, False: 5.47k]
  ------------------
  186|  5.47k|          ? tables::base64::base64_default_or_url::d2
  187|  5.47k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (187:14): [True: 2.60k, False: 2.87k]
  ------------------
  188|  5.47k|                                    : tables::base64::base64_default::d2);
  189|  5.47k|  const uint32_t *d3 =
  190|  5.47k|      (options & base64_default_or_url)
  ------------------
  |  Branch (190:7): [True: 0, False: 5.47k]
  ------------------
  191|  5.47k|          ? tables::base64::base64_default_or_url::d3
  192|  5.47k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (192:14): [True: 2.60k, False: 2.87k]
  ------------------
  193|  5.47k|                                    : tables::base64::base64_default::d3);
  194|  5.47k|  const bool ignore_garbage =
  195|  5.47k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (195:7): [True: 0, False: 5.47k]
  ------------------
  196|  5.47k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (196:7): [True: 0, False: 5.47k]
  ------------------
  197|  5.47k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (197:7): [True: 0, False: 5.47k]
  ------------------
  198|       |
  199|  5.47k|  const char_type *srcend = src + length;
  200|  5.47k|  const char_type *srcinit = src;
  201|  5.47k|  const char *dstinit = dst;
  202|       |
  203|  5.47k|  uint32_t x;
  204|  5.47k|  size_t idx;
  205|  5.47k|  uint8_t buffer[4];
  206|   125k|  while (true) {
  ------------------
  |  Branch (206:10): [True: 125k, Folded]
  ------------------
  207|  6.08M|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (207:12): [True: 6.08M, False: 3.50k]
  |  Branch (207:33): [True: 6.08M, False: 0]
  ------------------
  208|  6.08M|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (208:12): [True: 6.08M, False: 0]
  |  Branch (208:37): [True: 6.08M, False: 0]
  ------------------
  209|  6.08M|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (209:12): [True: 6.08M, False: 0]
  ------------------
  210|  6.08M|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (210:12): [True: 5.96M, False: 122k]
  ------------------
  211|  6.08M|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  212|  5.96M|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (212:11): [Folded, False: 5.96M]
  |  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.96M|      *dst++ = static_cast<char>(x & 0xFF);
  217|  5.96M|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  218|  5.96M|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  219|  5.96M|      src += 4;
  220|  5.96M|    }
  221|   125k|    const char_type *srccur = src;
  222|   125k|    idx = 0;
  223|       |    // we need at least four characters.
  224|   125k|#ifdef __clang__
  225|       |    // If possible, we read four characters at a time. (It is an optimization.)
  226|   125k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (226:9): [True: 0, False: 125k]
  |  Branch (226:27): [True: 0, False: 0]
  ------------------
  227|      0|      char_type c0 = src[0];
  228|      0|      char_type c1 = src[1];
  229|      0|      char_type c2 = src[2];
  230|      0|      char_type c3 = src[3];
  231|       |
  232|      0|      uint8_t code0 = to_base64[uint8_t(c0)];
  233|      0|      uint8_t code1 = to_base64[uint8_t(c1)];
  234|      0|      uint8_t code2 = to_base64[uint8_t(c2)];
  235|      0|      uint8_t code3 = to_base64[uint8_t(c3)];
  236|       |
  237|      0|      buffer[idx] = code0;
  238|      0|      idx += (is_eight_byte(c0) && code0 <= 63);
  ------------------
  |  Branch (238:15): [True: 0, False: 0]
  |  Branch (238:36): [True: 0, False: 0]
  ------------------
  239|      0|      buffer[idx] = code1;
  240|      0|      idx += (is_eight_byte(c1) && code1 <= 63);
  ------------------
  |  Branch (240:15): [True: 0, False: 0]
  |  Branch (240:36): [True: 0, False: 0]
  ------------------
  241|      0|      buffer[idx] = code2;
  242|      0|      idx += (is_eight_byte(c2) && code2 <= 63);
  ------------------
  |  Branch (242:15): [True: 0, False: 0]
  |  Branch (242:36): [True: 0, False: 0]
  ------------------
  243|      0|      buffer[idx] = code3;
  244|      0|      idx += (is_eight_byte(c3) && code3 <= 63);
  ------------------
  |  Branch (244:15): [True: 0, False: 0]
  |  Branch (244:36): [True: 0, False: 0]
  ------------------
  245|      0|      src += 4;
  246|      0|    }
  247|   125k|#endif
  248|  1.34M|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (248:12): [True: 1.21M, False: 120k]
  |  Branch (248:25): [True: 1.21M, False: 4.33k]
  ------------------
  249|  1.21M|      char_type c = *src;
  250|       |
  251|  1.21M|      uint8_t code = to_base64[uint8_t(c)];
  252|  1.21M|      buffer[idx] = uint8_t(code);
  253|  1.21M|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (253:11): [True: 1.21M, False: 0]
  |  Branch (253:31): [True: 487k, False: 727k]
  ------------------
  254|   487k|        idx++;
  255|   727k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (255:18): [True: 727k, False: 0]
  ------------------
  256|   727k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (256:19): [True: 1.14k, False: 726k]
  |  Branch (256:32): [True: 0, False: 726k]
  ------------------
  257|  1.14k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  258|  1.14k|                size_t(dst - dstinit)};
  259|   726k|      } else {
  260|       |        // We have a space or a newline or garbage. We ignore it.
  261|   726k|      }
  262|  1.21M|      src++;
  263|  1.21M|    }
  264|   124k|    if (idx != 4) {
  ------------------
  |  Branch (264:9): [True: 4.33k, False: 120k]
  ------------------
  265|  4.33k|      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.33k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (268:11): [True: 4.33k, False: 0]
  |  Branch (268:30): [True: 6, False: 4.32k]
  ------------------
  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.32k|      if (!ignore_garbage &&
  ------------------
  |  Branch (277:11): [True: 4.32k, False: 0]
  ------------------
  278|  4.32k|          last_chunk_options == last_chunk_handling_options::loose &&
  ------------------
  |  Branch (278:11): [True: 2.03k, False: 2.29k]
  ------------------
  279|  2.03k|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (279:11): [True: 1.14k, False: 890]
  |  Branch (279:25): [True: 12, False: 1.12k]
  ------------------
  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.32k|        if (!ignore_garbage &&
  ------------------
  |  Branch (288:13): [True: 4.32k, False: 0]
  ------------------
  289|  4.32k|            last_chunk_options == last_chunk_handling_options::strict &&
  ------------------
  |  Branch (289:13): [True: 222, False: 4.10k]
  ------------------
  290|    222|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (290:13): [True: 108, False: 114]
  |  Branch (290:27): [True: 72, False: 36]
  ------------------
  291|       |          // The partial chunk was at src - idx
  292|     72|          return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  293|     72|                  size_t(dst - dstinit), true};
  294|     72|        } else
  295|       |          // If there is a partial chunk with insufficient padding, with
  296|       |          // stop_before_partial, we need to just ignore it. In "only full"
  297|       |          // mode, skip the minute there are padding characters.
  298|  4.25k|          if ((last_chunk_options ==
  ------------------
  |  Branch (298:16): [True: 2.07k, False: 2.17k]
  ------------------
  299|  4.25k|                   last_chunk_handling_options::stop_before_partial &&
  300|  2.07k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (300:16): [True: 2.06k, False: 12]
  |  Branch (300:50): [True: 1.65k, False: 414]
  ------------------
  301|  1.65k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (301:17): [True: 714, False: 936]
  |  Branch (301:29): [True: 900, False: 36]
  ------------------
  302|  2.63k|              (last_chunk_options ==
  ------------------
  |  Branch (302:16): [True: 0, False: 2.63k]
  ------------------
  303|  2.63k|                   last_chunk_handling_options::only_full_chunks &&
  304|  1.61k|               (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.61k|            src = srccur;
  308|  1.61k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  309|  2.63k|          } else {
  310|  2.63k|            if (idx == 2) {
  ------------------
  |  Branch (310:17): [True: 630, False: 2.00k]
  ------------------
  311|    630|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  312|    630|                                (uint32_t(buffer[1]) << 2 * 6);
  313|    630|              if (!ignore_garbage &&
  ------------------
  |  Branch (313:19): [True: 630, False: 0]
  ------------------
  314|    630|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (314:19): [True: 18, False: 612]
  ------------------
  315|     18|                  (triple & 0xffff)) {
  ------------------
  |  Branch (315:19): [True: 12, False: 6]
  ------------------
  316|     12|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  317|     12|                        size_t(dst - dstinit)};
  318|     12|              }
  319|    618|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (319:19): [Folded, False: 618]
  |  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|    618|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  324|  2.00k|            } else if (idx == 3) {
  ------------------
  |  Branch (324:24): [True: 552, False: 1.45k]
  ------------------
  325|    552|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  326|    552|                                (uint32_t(buffer[1]) << 2 * 6) +
  327|    552|                                (uint32_t(buffer[2]) << 1 * 6);
  328|    552|              if (!ignore_garbage &&
  ------------------
  |  Branch (328:19): [True: 552, False: 0]
  ------------------
  329|    552|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (329:19): [True: 18, False: 534]
  ------------------
  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|    540|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (334:19): [Folded, False: 540]
  |  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|    540|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  339|    540|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  340|  1.45k|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (340:24): [True: 1.45k, False: 0]
  |  Branch (340:43): [True: 432, False: 1.02k]
  ------------------
  341|    432|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (341:25): [True: 396, False: 36]
  ------------------
  342|     36|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (342:26): [True: 36, False: 0]
  ------------------
  343|    432|                         padding_characters > 0))) {
  ------------------
  |  Branch (343:26): [True: 36, False: 0]
  ------------------
  344|    432|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  345|    432|                      size_t(dst - dstinit)};
  346|  1.02k|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (346:24): [True: 1.02k, False: 0]
  |  Branch (346:43): [True: 1.02k, False: 0]
  |  Branch (346:55): [True: 18, False: 1.00k]
  ------------------
  347|     18|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  348|     18|                      size_t(dst - dstinit), true};
  349|     18|            }
  350|  2.16k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  351|  2.63k|          }
  352|  4.32k|    }
  353|   120k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (353:9): [Folded, False: 120k]
  |  Branch (353:27): [True: 0, False: 0]
  ------------------
  354|      0|      return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  355|      0|              size_t(dst - dstinit)};
  356|      0|    }
  357|   120k|    uint32_t triple =
  358|   120k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  359|   120k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  360|   120k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  361|   120k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  362|   120k|    *dst++ = static_cast<char>(triple & 0xFF);
  363|   120k|  }
  364|  5.47k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6429base64_to_binary_details_implIDsEENS_11full_resultEPKT_mPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  727|  2.61k|    last_chunk_handling_options last_chunk_options) noexcept {
  728|  2.61k|  const bool ignore_garbage =
  729|  2.61k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (729:7): [True: 0, False: 2.61k]
  ------------------
  730|  2.61k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (730:7): [True: 0, False: 2.61k]
  ------------------
  731|  2.61k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (731:7): [True: 0, False: 2.61k]
  ------------------
  732|  2.61k|  auto ri = simdutf::scalar::base64::find_end(input, length, options);
  733|  2.61k|  size_t equallocation = ri.equallocation;
  734|  2.61k|  size_t equalsigns = ri.equalsigns;
  735|  2.61k|  length = ri.srclen;
  736|  2.61k|  size_t full_input_length = ri.full_input_length;
  737|  2.61k|  if (length == 0) {
  ------------------
  |  Branch (737:7): [True: 40, False: 2.57k]
  ------------------
  738|     40|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (738:9): [True: 40, False: 0]
  |  Branch (738:28): [True: 18, False: 22]
  ------------------
  739|     18|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
  740|     18|    }
  741|     22|    return {SUCCESS, full_input_length, 0};
  742|     40|  }
  743|  2.57k|  full_result r = scalar::base64::base64_tail_decode(
  744|  2.57k|      output, input, length, equalsigns, options, last_chunk_options);
  745|  2.57k|  r = scalar::base64::patch_tail_result(r, 0, 0, equallocation,
  746|  2.57k|                                        full_input_length, last_chunk_options);
  747|  2.57k|  if (!is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (747:7): [True: 1.11k, False: 1.46k]
  |  Branch (747:42): [True: 312, False: 802]
  ------------------
  748|    312|      equalsigns > 0 && !ignore_garbage) {
  ------------------
  |  Branch (748:7): [True: 6, False: 306]
  |  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.57k|  if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (759:7): [True: 1.46k, False: 1.11k]
  |  Branch (759:41): [True: 864, False: 598]
  ------------------
  760|    864|      r.input_count < full_input_length) {
  ------------------
  |  Branch (760:7): [True: 638, False: 226]
  ------------------
  761|       |    // First check if we can extend the input to the end of the stream
  762|  3.88k|    while (r.input_count < full_input_length &&
  ------------------
  |  Branch (762:12): [True: 3.87k, False: 12]
  ------------------
  763|  3.87k|           base64_ignorable(*(input + r.input_count), options)) {
  ------------------
  |  Branch (763:12): [True: 3.25k, False: 626]
  ------------------
  764|  3.25k|      r.input_count++;
  765|  3.25k|    }
  766|       |    // If we are still not at the end of the stream, then we must backtrack
  767|       |    // to the last non-ignorable character.
  768|    638|    if (r.input_count < full_input_length) {
  ------------------
  |  Branch (768:9): [True: 626, False: 12]
  ------------------
  769|  3.60k|      while (r.input_count > 0 &&
  ------------------
  |  Branch (769:14): [True: 3.46k, False: 134]
  ------------------
  770|  3.46k|             base64_ignorable(*(input + r.input_count - 1), options)) {
  ------------------
  |  Branch (770:14): [True: 2.97k, False: 492]
  ------------------
  771|  2.97k|        r.input_count--;
  772|  2.97k|      }
  773|    626|    }
  774|    638|  }
  775|  2.57k|  return r;
  776|  2.57k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6418base64_tail_decodeIDsEENS_11full_resultEPcPKT_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  371|  5.65k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  372|  5.65k|  return base64_tail_decode_impl<false>(dst, 0, src, length, padding_characters,
  373|  5.65k|                                        options, last_chunk_options);
  374|  5.65k|}
simdutf.cpp:_ZN7simdutf6scalar12_GLOBAL__N_16base6423base64_tail_decode_implILb0EDsEENS_11full_resultEPcmPKT0_mmNS_14base64_optionsENS_27last_chunk_handling_optionsE:
  164|  5.65k|    base64_options options, last_chunk_handling_options last_chunk_options) {
  165|  5.65k|  char *dstend = dst + outlen;
  166|  5.65k|  (void)dstend;
  167|       |  // This looks like 10 branches, but we expect the compiler to resolve this to
  168|       |  // two branches (easily predicted):
  169|  5.65k|  const uint8_t *to_base64 =
  170|  5.65k|      (options & base64_default_or_url)
  ------------------
  |  Branch (170:7): [True: 0, False: 5.65k]
  ------------------
  171|  5.65k|          ? tables::base64::to_base64_default_or_url_value
  172|  5.65k|          : ((options & base64_url) ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (172:14): [True: 2.67k, False: 2.97k]
  ------------------
  173|  5.65k|                                    : tables::base64::to_base64_value);
  174|  5.65k|  const uint32_t *d0 =
  175|  5.65k|      (options & base64_default_or_url)
  ------------------
  |  Branch (175:7): [True: 0, False: 5.65k]
  ------------------
  176|  5.65k|          ? tables::base64::base64_default_or_url::d0
  177|  5.65k|          : ((options & base64_url) ? tables::base64::base64_url::d0
  ------------------
  |  Branch (177:14): [True: 2.67k, False: 2.97k]
  ------------------
  178|  5.65k|                                    : tables::base64::base64_default::d0);
  179|  5.65k|  const uint32_t *d1 =
  180|  5.65k|      (options & base64_default_or_url)
  ------------------
  |  Branch (180:7): [True: 0, False: 5.65k]
  ------------------
  181|  5.65k|          ? tables::base64::base64_default_or_url::d1
  182|  5.65k|          : ((options & base64_url) ? tables::base64::base64_url::d1
  ------------------
  |  Branch (182:14): [True: 2.67k, False: 2.97k]
  ------------------
  183|  5.65k|                                    : tables::base64::base64_default::d1);
  184|  5.65k|  const uint32_t *d2 =
  185|  5.65k|      (options & base64_default_or_url)
  ------------------
  |  Branch (185:7): [True: 0, False: 5.65k]
  ------------------
  186|  5.65k|          ? tables::base64::base64_default_or_url::d2
  187|  5.65k|          : ((options & base64_url) ? tables::base64::base64_url::d2
  ------------------
  |  Branch (187:14): [True: 2.67k, False: 2.97k]
  ------------------
  188|  5.65k|                                    : tables::base64::base64_default::d2);
  189|  5.65k|  const uint32_t *d3 =
  190|  5.65k|      (options & base64_default_or_url)
  ------------------
  |  Branch (190:7): [True: 0, False: 5.65k]
  ------------------
  191|  5.65k|          ? tables::base64::base64_default_or_url::d3
  192|  5.65k|          : ((options & base64_url) ? tables::base64::base64_url::d3
  ------------------
  |  Branch (192:14): [True: 2.67k, False: 2.97k]
  ------------------
  193|  5.65k|                                    : tables::base64::base64_default::d3);
  194|  5.65k|  const bool ignore_garbage =
  195|  5.65k|      (options == base64_options::base64_url_accept_garbage) ||
  ------------------
  |  Branch (195:7): [True: 0, False: 5.65k]
  ------------------
  196|  5.65k|      (options == base64_options::base64_default_accept_garbage) ||
  ------------------
  |  Branch (196:7): [True: 0, False: 5.65k]
  ------------------
  197|  5.65k|      (options == base64_options::base64_default_or_url_accept_garbage);
  ------------------
  |  Branch (197:7): [True: 0, False: 5.65k]
  ------------------
  198|       |
  199|  5.65k|  const char_type *srcend = src + length;
  200|  5.65k|  const char_type *srcinit = src;
  201|  5.65k|  const char *dstinit = dst;
  202|       |
  203|  5.65k|  uint32_t x;
  204|  5.65k|  size_t idx;
  205|  5.65k|  uint8_t buffer[4];
  206|  75.5k|  while (true) {
  ------------------
  |  Branch (206:10): [True: 75.5k, Folded]
  ------------------
  207|  1.01M|    while (srcend - src >= 4 && is_eight_byte(src[0]) &&
  ------------------
  |  Branch (207:12): [True: 1.01M, False: 3.12k]
  |  Branch (207:33): [True: 1.01M, False: 380]
  ------------------
  208|  1.01M|           is_eight_byte(src[1]) && is_eight_byte(src[2]) &&
  ------------------
  |  Branch (208:12): [True: 1.01M, False: 188]
  |  Branch (208:37): [True: 1.01M, False: 208]
  ------------------
  209|  1.01M|           is_eight_byte(src[3]) &&
  ------------------
  |  Branch (209:12): [True: 1.01M, False: 296]
  ------------------
  210|  1.01M|           (x = d0[uint8_t(src[0])] | d1[uint8_t(src[1])] |
  ------------------
  |  Branch (210:12): [True: 943k, False: 71.3k]
  ------------------
  211|  1.01M|                d2[uint8_t(src[2])] | d3[uint8_t(src[3])]) < 0x01FFFFFF) {
  212|   943k|      if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (212:11): [Folded, False: 943k]
  |  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|   943k|      *dst++ = static_cast<char>(x & 0xFF);
  217|   943k|      *dst++ = static_cast<char>((x >> 8) & 0xFF);
  218|   943k|      *dst++ = static_cast<char>((x >> 16) & 0xFF);
  219|   943k|      src += 4;
  220|   943k|    }
  221|  75.5k|    const char_type *srccur = src;
  222|  75.5k|    idx = 0;
  223|       |    // we need at least four characters.
  224|  75.5k|#ifdef __clang__
  225|       |    // If possible, we read four characters at a time. (It is an optimization.)
  226|  75.5k|    if (ignore_garbage && src + 4 <= srcend) {
  ------------------
  |  Branch (226:9): [True: 0, False: 75.5k]
  |  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|  75.5k|#endif
  248|   523k|    while ((idx < 4) && (src < srcend)) {
  ------------------
  |  Branch (248:12): [True: 453k, False: 69.8k]
  |  Branch (248:25): [True: 449k, False: 3.45k]
  ------------------
  249|   449k|      char_type c = *src;
  250|       |
  251|   449k|      uint8_t code = to_base64[uint8_t(c)];
  252|   449k|      buffer[idx] = uint8_t(code);
  253|   449k|      if (is_eight_byte(c) && code <= 63) {
  ------------------
  |  Branch (253:11): [True: 448k, False: 1.52k]
  |  Branch (253:31): [True: 286k, False: 161k]
  ------------------
  254|   286k|        idx++;
  255|   286k|      } else if (!ignore_garbage &&
  ------------------
  |  Branch (255:18): [True: 163k, False: 0]
  ------------------
  256|   163k|                 (code > 64 || !scalar::base64::is_eight_byte(c))) {
  ------------------
  |  Branch (256:19): [True: 1.42k, False: 161k]
  |  Branch (256:32): [True: 772, False: 160k]
  ------------------
  257|  2.19k|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  258|  2.19k|                size_t(dst - dstinit)};
  259|   160k|      } else {
  260|       |        // We have a space or a newline or garbage. We ignore it.
  261|   160k|      }
  262|   447k|      src++;
  263|   447k|    }
  264|  73.3k|    if (idx != 4) {
  ------------------
  |  Branch (264:9): [True: 3.45k, False: 69.8k]
  ------------------
  265|  3.45k|      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.45k|      if (!ignore_garbage && (idx + padding_characters > 4)) {
  ------------------
  |  Branch (268:11): [True: 3.45k, False: 0]
  |  Branch (268:30): [True: 6, False: 3.45k]
  ------------------
  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.45k|      if (!ignore_garbage &&
  ------------------
  |  Branch (277:11): [True: 3.45k, False: 0]
  ------------------
  278|  3.45k|          last_chunk_options == last_chunk_handling_options::loose &&
  ------------------
  |  Branch (278:11): [True: 812, False: 2.63k]
  ------------------
  279|    812|          (idx >= 2) && padding_characters > 0 &&
  ------------------
  |  Branch (279:11): [True: 438, False: 374]
  |  Branch (279:25): [True: 12, False: 426]
  ------------------
  280|     12|          ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (280:11): [True: 6, False: 6]
  ------------------
  281|      6|        return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  282|      6|                size_t(dst - dstinit), true};
  283|      6|      } else
  284|       |
  285|       |        // The idea here is that in strict mode, we do not want to accept
  286|       |        // incomplete base64 chunks. So if the chunk was otherwise valid, we
  287|       |        // return BASE64_INPUT_REMAINDER.
  288|  3.44k|        if (!ignore_garbage &&
  ------------------
  |  Branch (288:13): [True: 3.44k, False: 0]
  ------------------
  289|  3.44k|            last_chunk_options == last_chunk_handling_options::strict &&
  ------------------
  |  Branch (289:13): [True: 316, False: 3.12k]
  ------------------
  290|    316|            (idx >= 2) && ((idx + padding_characters) & 3) != 0) {
  ------------------
  |  Branch (290:13): [True: 168, False: 148]
  |  Branch (290:27): [True: 126, False: 42]
  ------------------
  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|  3.31k|          if ((last_chunk_options ==
  ------------------
  |  Branch (298:16): [True: 2.32k, False: 996]
  ------------------
  299|  3.31k|                   last_chunk_handling_options::stop_before_partial &&
  300|  2.32k|               (padding_characters + idx < 4) && (idx != 0) &&
  ------------------
  |  Branch (300:16): [True: 2.31k, False: 12]
  |  Branch (300:50): [True: 1.91k, False: 396]
  ------------------
  301|  1.91k|               (idx >= 2 || padding_characters == 0)) ||
  ------------------
  |  Branch (301:17): [True: 972, False: 942]
  |  Branch (301:29): [True: 906, False: 36]
  ------------------
  302|  1.44k|              (last_chunk_options ==
  ------------------
  |  Branch (302:16): [True: 0, False: 1.44k]
  ------------------
  303|  1.44k|                   last_chunk_handling_options::only_full_chunks &&
  304|  1.87k|               (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.87k|            src = srccur;
  308|  1.87k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  309|  1.87k|          } else {
  310|  1.44k|            if (idx == 2) {
  ------------------
  |  Branch (310:17): [True: 270, False: 1.17k]
  ------------------
  311|    270|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  312|    270|                                (uint32_t(buffer[1]) << 2 * 6);
  313|    270|              if (!ignore_garbage &&
  ------------------
  |  Branch (313:19): [True: 270, False: 0]
  ------------------
  314|    270|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (314:19): [True: 30, False: 240]
  ------------------
  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|    246|              if (check_capacity && dstend - dst < 1) {
  ------------------
  |  Branch (319:19): [Folded, False: 246]
  |  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|    246|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  324|  1.17k|            } else if (idx == 3) {
  ------------------
  |  Branch (324:24): [True: 216, False: 954]
  ------------------
  325|    216|              uint32_t triple = (uint32_t(buffer[0]) << 3 * 6) +
  326|    216|                                (uint32_t(buffer[1]) << 2 * 6) +
  327|    216|                                (uint32_t(buffer[2]) << 1 * 6);
  328|    216|              if (!ignore_garbage &&
  ------------------
  |  Branch (328:19): [True: 216, False: 0]
  ------------------
  329|    216|                  (last_chunk_options == last_chunk_handling_options::strict) &&
  ------------------
  |  Branch (329:19): [True: 12, False: 204]
  ------------------
  330|     12|                  (triple & 0xff)) {
  ------------------
  |  Branch (330:19): [True: 6, False: 6]
  ------------------
  331|      6|                return {BASE64_EXTRA_BITS, size_t(src - srcinit),
  332|      6|                        size_t(dst - dstinit)};
  333|      6|              }
  334|    210|              if (check_capacity && dstend - dst < 2) {
  ------------------
  |  Branch (334:19): [Folded, False: 210]
  |  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|    210|              *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  339|    210|              *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  340|    954|            } else if (!ignore_garbage && idx == 1 &&
  ------------------
  |  Branch (340:24): [True: 954, False: 0]
  |  Branch (340:43): [True: 264, False: 690]
  ------------------
  341|    264|                       (!is_partial(last_chunk_options) ||
  ------------------
  |  Branch (341:25): [True: 228, False: 36]
  ------------------
  342|     36|                        (is_partial(last_chunk_options) &&
  ------------------
  |  Branch (342:26): [True: 36, False: 0]
  ------------------
  343|    264|                         padding_characters > 0))) {
  ------------------
  |  Branch (343:26): [True: 36, False: 0]
  ------------------
  344|    264|              return {BASE64_INPUT_REMAINDER, size_t(src - srcinit),
  345|    264|                      size_t(dst - dstinit)};
  346|    690|            } else if (!ignore_garbage && idx == 0 && padding_characters > 0) {
  ------------------
  |  Branch (346:24): [True: 690, False: 0]
  |  Branch (346:43): [True: 690, False: 0]
  |  Branch (346:55): [True: 24, False: 666]
  ------------------
  347|     24|              return {INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  348|     24|                      size_t(dst - dstinit), true};
  349|     24|            }
  350|  1.12k|            return {SUCCESS, size_t(src - srcinit), size_t(dst - dstinit)};
  351|  1.44k|          }
  352|  3.45k|    }
  353|  69.8k|    if (check_capacity && dstend - dst < 3) {
  ------------------
  |  Branch (353:9): [Folded, False: 69.8k]
  |  Branch (353:27): [True: 0, False: 0]
  ------------------
  354|      0|      return {OUTPUT_BUFFER_TOO_SMALL, size_t(srccur - srcinit),
  355|      0|              size_t(dst - dstinit)};
  356|      0|    }
  357|  69.8k|    uint32_t triple =
  358|  69.8k|        (uint32_t(buffer[0]) << 3 * 6) + (uint32_t(buffer[1]) << 2 * 6) +
  359|  69.8k|        (uint32_t(buffer[2]) << 1 * 6) + (uint32_t(buffer[3]) << 0 * 6);
  360|  69.8k|    *dst++ = static_cast<char>((triple >> 16) & 0xFF);
  361|  69.8k|    *dst++ = static_cast<char>((triple >> 8) & 0xFF);
  362|  69.8k|    *dst++ = static_cast<char>(triple & 0xFF);
  363|  69.8k|  }
  364|  5.65k|}

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

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

simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.20k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.20k|  const uint8_t *to_base64 =
   47|  1.20k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.20k]
  ------------------
   48|  1.20k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.20k, Folded]
  ------------------
   49|  1.20k|                                   : tables::base64::to_base64_value);
   50|  1.20k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.20k|  size_t equallocation = ri.equallocation;
   52|  1.20k|  size_t equalsigns = ri.equalsigns;
   53|  1.20k|  srclen = ri.srclen;
   54|  1.20k|  size_t full_input_length = ri.full_input_length;
   55|  1.20k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 22, False: 1.17k]
  ------------------
   56|     22|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 22, Folded]
  |  Branch (56:28): [True: 14, False: 8]
  ------------------
   57|     14|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     14|    }
   59|      8|    return {SUCCESS, full_input_length, 0};
   60|     22|  }
   61|  1.17k|  char *end_of_safe_64byte_zone =
   62|  1.17k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 44, False: 1.13k]
  ------------------
   63|  1.17k|          ? nullptr
   64|  1.17k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 370, False: 764]
  ------------------
   65|  1.13k|                                        : dst);
   66|       |
   67|  1.17k|  const chartype *const srcinit = src;
   68|  1.17k|  const char *const dstinit = dst;
   69|  1.17k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.17k|  constexpr size_t block_size = 6;
   72|  1.17k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.17k|  char buffer[block_size * 64];
   74|  1.17k|  char *bufferptr = buffer;
   75|  1.17k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 946, False: 232]
  ------------------
   76|    946|    const chartype *const srcend64 = src + srclen - 64;
   77|   111k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 110k, False: 612]
  ------------------
   78|   110k|      block64 b(src);
   79|   110k|      src += 64;
   80|   110k|      uint64_t error = 0;
   81|   110k|      const uint64_t badcharmask =
   82|   110k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   110k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 110k, Folded]
  |  Branch (83:30): [True: 334, False: 110k]
  ------------------
   84|    334|        src -= 64;
   85|    334|        const size_t error_offset = trailing_zeroes(error);
   86|    334|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    334|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    334|      }
   89|   110k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 63.3k, False: 47.1k]
  ------------------
   90|  63.3k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  63.3k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 13.7k, False: 33.3k]
  ------------------
   92|  13.7k|        b.copy_block(bufferptr);
   93|  13.7k|        bufferptr += 64;
   94|  33.3k|      } else {
   95|  33.3k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 6, False: 33.3k]
  ------------------
   96|      6|          b.base64_decode_block_safe(dst);
   97|  33.3k|        } else {
   98|  33.3k|          b.base64_decode_block(dst);
   99|  33.3k|        }
  100|  33.3k|        dst += 48;
  101|  33.3k|      }
  102|   110k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 13.4k, False: 97.0k]
  ------------------
  103|  67.4k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 53.9k, False: 13.4k]
  ------------------
  104|  53.9k|          base64_decode_block(dst, buffer + i * 64);
  105|  53.9k|          dst += 48;
  106|  53.9k|        }
  107|  13.4k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 13.4k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  13.4k|        } else {
  110|  13.4k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  13.4k|        }
  112|  13.4k|        dst += 48;
  113|  13.4k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  13.4k|                    64); // 64 might be too much
  115|  13.4k|        bufferptr -= (block_size - 1) * 64;
  116|  13.4k|      }
  117|   110k|    }
  118|    946|  }
  119|       |
  120|    844|  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|    844|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    844|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 570, False: 274]
  |  Branch (124:26): [True: 76, False: 494]
  ------------------
  125|       |
  126|    762|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 708, False: 54]
  |  Branch (126:52): [True: 690, False: 18]
  ------------------
  127|    690|      uint8_t val = to_base64[uint8_t(*src)];
  128|    690|      *bufferptr = char(val);
  129|    690|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 690, Folded]
  ------------------
  130|    690|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 690]
  |  Branch (130:52): [True: 4, False: 686]
  ------------------
  131|      4|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      4|                size_t(dst - dstinit)};
  133|      4|      }
  134|    686|      bufferptr += (val <= 63);
  135|    686|      src++;
  136|    686|    }
  137|     76|  }
  138|       |
  139|  1.31k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 472, False: 840]
  ------------------
  140|    472|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 32, False: 440]
  ------------------
  141|     32|      base64_decode_block_safe(dst, buffer_start);
  142|    440|    } else {
  143|    440|      base64_decode_block(dst, buffer_start);
  144|    440|    }
  145|    472|    dst += 48;
  146|    472|  }
  147|    840|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 512, False: 328]
  ------------------
  148|  4.46k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.95k, False: 512]
  ------------------
  149|  3.95k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.95k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.95k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.95k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.95k|                        << 8;
  154|  3.95k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.95k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.95k|#endif
  157|  3.95k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.95k|      dst += 3;
  160|  3.95k|      buffer_start += 4;
  161|  3.95k|    }
  162|    512|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 118, False: 394]
  ------------------
  163|    118|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    118|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    118|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    118|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    118|                        << 8;
  168|    118|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    118|      triple = scalar::u32_swap_bytes(triple);
  170|    118|#endif
  171|    118|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    118|      dst += 3;
  174|    118|      buffer_start += 4;
  175|    118|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    512|    int leftover = int(bufferptr - buffer_start);
  179|  1.28k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 768, False: 512]
  ------------------
  180|    768|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 768, Folded]
  ------------------
  181|  5.99k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 5.23k, False: 768]
  ------------------
  182|  5.23k|          src--;
  183|  5.23k|        }
  184|    768|      } 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|    768|      src--;
  190|    768|      leftover--;
  191|    768|    }
  192|    512|  }
  193|    840|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 712, False: 128]
  ------------------
  194|    712|    full_result r = scalar::base64::base64_tail_decode(
  195|    712|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    712|    r = scalar::base64::patch_tail_result(
  197|    712|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    712|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    712|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 382, False: 330]
  |  Branch (203:43): [True: 350, False: 32]
  ------------------
  204|    350|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 302, False: 48]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    724|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 718, False: 6]
  ------------------
  207|    718|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 422, False: 296]
  ------------------
  208|    422|        r.input_count++;
  209|    422|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    302|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 296, False: 6]
  ------------------
  213|  3.85k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 3.78k, False: 64]
  ------------------
  214|  3.78k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 3.55k, False: 232]
  ------------------
  215|  3.55k|          r.input_count--;
  216|  3.55k|        }
  217|    296|      }
  218|    302|    }
  219|    712|    return r;
  220|    712|  }
  221|    128|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 128, Folded]
  |  Branch (221:26): [True: 0, False: 128]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    128|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    128|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.32k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.32k|  const uint8_t *to_base64 =
   47|  1.32k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.32k]
  ------------------
   48|  1.32k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.32k]
  ------------------
   49|  1.32k|                                   : tables::base64::to_base64_value);
   50|  1.32k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.32k|  size_t equallocation = ri.equallocation;
   52|  1.32k|  size_t equalsigns = ri.equalsigns;
   53|  1.32k|  srclen = ri.srclen;
   54|  1.32k|  size_t full_input_length = ri.full_input_length;
   55|  1.32k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 20, False: 1.30k]
  ------------------
   56|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 20, Folded]
  |  Branch (56:28): [True: 6, False: 14]
  ------------------
   57|      6|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      6|    }
   59|     14|    return {SUCCESS, full_input_length, 0};
   60|     20|  }
   61|  1.30k|  char *end_of_safe_64byte_zone =
   62|  1.30k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 50, False: 1.25k]
  ------------------
   63|  1.30k|          ? nullptr
   64|  1.30k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 412, False: 844]
  ------------------
   65|  1.25k|                                        : dst);
   66|       |
   67|  1.30k|  const chartype *const srcinit = src;
   68|  1.30k|  const char *const dstinit = dst;
   69|  1.30k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.30k|  constexpr size_t block_size = 6;
   72|  1.30k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.30k|  char buffer[block_size * 64];
   74|  1.30k|  char *bufferptr = buffer;
   75|  1.30k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 1.00k, False: 304]
  ------------------
   76|  1.00k|    const chartype *const srcend64 = src + srclen - 64;
   77|   281k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 280k, False: 654]
  ------------------
   78|   280k|      block64 b(src);
   79|   280k|      src += 64;
   80|   280k|      uint64_t error = 0;
   81|   280k|      const uint64_t badcharmask =
   82|   280k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   280k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 280k, Folded]
  |  Branch (83:30): [True: 348, False: 280k]
  ------------------
   84|    348|        src -= 64;
   85|    348|        const size_t error_offset = trailing_zeroes(error);
   86|    348|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    348|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    348|      }
   89|   280k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 38.9k, False: 241k]
  ------------------
   90|  38.9k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   241k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 120k, False: 121k]
  ------------------
   92|   120k|        b.copy_block(bufferptr);
   93|   120k|        bufferptr += 64;
   94|   121k|      } else {
   95|   121k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 121k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|   121k|        } else {
   98|   121k|          b.base64_decode_block(dst);
   99|   121k|        }
  100|   121k|        dst += 48;
  101|   121k|      }
  102|   280k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 31.2k, False: 248k]
  ------------------
  103|   156k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 124k, False: 31.2k]
  ------------------
  104|   124k|          base64_decode_block(dst, buffer + i * 64);
  105|   124k|          dst += 48;
  106|   124k|        }
  107|  31.2k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 31.2k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  31.2k|        } else {
  110|  31.2k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  31.2k|        }
  112|  31.2k|        dst += 48;
  113|  31.2k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  31.2k|                    64); // 64 might be too much
  115|  31.2k|        bufferptr -= (block_size - 1) * 64;
  116|  31.2k|      }
  117|   280k|    }
  118|  1.00k|  }
  119|       |
  120|    958|  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|    958|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    958|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 602, False: 356]
  |  Branch (124:26): [True: 92, False: 510]
  ------------------
  125|       |
  126|  1.43k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.36k, False: 66]
  |  Branch (126:52): [True: 1.34k, False: 20]
  ------------------
  127|  1.34k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.34k|      *bufferptr = char(val);
  129|  1.34k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.34k, Folded]
  ------------------
  130|  1.34k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.34k]
  |  Branch (130:52): [True: 6, False: 1.34k]
  ------------------
  131|      6|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      6|                size_t(dst - dstinit)};
  133|      6|      }
  134|  1.34k|      bufferptr += (val <= 63);
  135|  1.34k|      src++;
  136|  1.34k|    }
  137|     92|  }
  138|       |
  139|  1.43k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 478, False: 952]
  ------------------
  140|    478|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 34, False: 444]
  ------------------
  141|     34|      base64_decode_block_safe(dst, buffer_start);
  142|    444|    } else {
  143|    444|      base64_decode_block(dst, buffer_start);
  144|    444|    }
  145|    478|    dst += 48;
  146|    478|  }
  147|    952|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 530, False: 422]
  ------------------
  148|  4.43k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.90k, False: 530]
  ------------------
  149|  3.90k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.90k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.90k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.90k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.90k|                        << 8;
  154|  3.90k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.90k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.90k|#endif
  157|  3.90k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.90k|      dst += 3;
  160|  3.90k|      buffer_start += 4;
  161|  3.90k|    }
  162|    530|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 142, False: 388]
  ------------------
  163|    142|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    142|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    142|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    142|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    142|                        << 8;
  168|    142|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    142|      triple = scalar::u32_swap_bytes(triple);
  170|    142|#endif
  171|    142|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    142|      dst += 3;
  174|    142|      buffer_start += 4;
  175|    142|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    530|    int leftover = int(bufferptr - buffer_start);
  179|  1.28k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 756, False: 530]
  ------------------
  180|    756|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 756, Folded]
  ------------------
  181|  7.38k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 6.62k, False: 756]
  ------------------
  182|  6.62k|          src--;
  183|  6.62k|        }
  184|    756|      } 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|    756|      src--;
  190|    756|      leftover--;
  191|    756|    }
  192|    530|  }
  193|    952|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 784, False: 168]
  ------------------
  194|    784|    full_result r = scalar::base64::base64_tail_decode(
  195|    784|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    784|    r = scalar::base64::patch_tail_result(
  197|    784|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    784|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    784|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 322, False: 462]
  |  Branch (203:43): [True: 292, False: 30]
  ------------------
  204|    292|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 248, False: 44]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    532|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 526, False: 6]
  ------------------
  207|    526|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 284, False: 242]
  ------------------
  208|    284|        r.input_count++;
  209|    284|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    248|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 242, False: 6]
  ------------------
  213|  1.02k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 980, False: 48]
  ------------------
  214|    980|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 786, False: 194]
  ------------------
  215|    786|          r.input_count--;
  216|    786|        }
  217|    242|      }
  218|    248|    }
  219|    784|    return r;
  220|    784|  }
  221|    168|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 168, Folded]
  |  Branch (221:26): [True: 0, False: 168]
  ------------------
  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|    168|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    168|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.25k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.25k|  const uint8_t *to_base64 =
   47|  1.25k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.25k]
  ------------------
   48|  1.25k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.25k, Folded]
  ------------------
   49|  1.25k|                                   : tables::base64::to_base64_value);
   50|  1.25k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.25k|  size_t equallocation = ri.equallocation;
   52|  1.25k|  size_t equalsigns = ri.equalsigns;
   53|  1.25k|  srclen = ri.srclen;
   54|  1.25k|  size_t full_input_length = ri.full_input_length;
   55|  1.25k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 18, False: 1.23k]
  ------------------
   56|     18|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 18, Folded]
  |  Branch (56:28): [True: 10, False: 8]
  ------------------
   57|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     10|    }
   59|      8|    return {SUCCESS, full_input_length, 0};
   60|     18|  }
   61|  1.23k|  char *end_of_safe_64byte_zone =
   62|  1.23k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 86, False: 1.15k]
  ------------------
   63|  1.23k|          ? nullptr
   64|  1.23k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 338, False: 812]
  ------------------
   65|  1.15k|                                        : dst);
   66|       |
   67|  1.23k|  const chartype *const srcinit = src;
   68|  1.23k|  const char *const dstinit = dst;
   69|  1.23k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.23k|  constexpr size_t block_size = 6;
   72|  1.23k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.23k|  char buffer[block_size * 64];
   74|  1.23k|  char *bufferptr = buffer;
   75|  1.23k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 944, False: 292]
  ------------------
   76|    944|    const chartype *const srcend64 = src + srclen - 64;
   77|  21.0k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 20.3k, False: 622]
  ------------------
   78|  20.3k|      block64 b(src);
   79|  20.3k|      src += 64;
   80|  20.3k|      uint64_t error = 0;
   81|  20.3k|      const uint64_t badcharmask =
   82|  20.3k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  20.3k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 20.3k, Folded]
  |  Branch (83:30): [True: 322, False: 20.0k]
  ------------------
   84|    322|        src -= 64;
   85|    322|        const size_t error_offset = trailing_zeroes(error);
   86|    322|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    322|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    322|      }
   89|  20.0k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 16.2k, False: 3.76k]
  ------------------
   90|  16.2k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  16.2k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 3.42k, False: 342]
  ------------------
   92|  3.42k|        b.copy_block(bufferptr);
   93|  3.42k|        bufferptr += 64;
   94|  3.42k|      } else {
   95|    342|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 8, False: 334]
  ------------------
   96|      8|          b.base64_decode_block_safe(dst);
   97|    334|        } else {
   98|    334|          b.base64_decode_block(dst);
   99|    334|        }
  100|    342|        dst += 48;
  101|    342|      }
  102|  20.0k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 3.64k, False: 16.4k]
  ------------------
  103|  18.2k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 14.5k, False: 3.64k]
  ------------------
  104|  14.5k|          base64_decode_block(dst, buffer + i * 64);
  105|  14.5k|          dst += 48;
  106|  14.5k|        }
  107|  3.64k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 3.64k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  3.64k|        } else {
  110|  3.64k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  3.64k|        }
  112|  3.64k|        dst += 48;
  113|  3.64k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  3.64k|                    64); // 64 might be too much
  115|  3.64k|        bufferptr -= (block_size - 1) * 64;
  116|  3.64k|      }
  117|  20.0k|    }
  118|    944|  }
  119|       |
  120|    914|  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|    914|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    914|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 586, False: 328]
  |  Branch (124:26): [True: 110, False: 476]
  ------------------
  125|       |
  126|    582|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 546, False: 36]
  |  Branch (126:52): [True: 522, False: 24]
  ------------------
  127|    522|      uint8_t val = to_base64[uint8_t(*src)];
  128|    522|      *bufferptr = char(val);
  129|    522|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 522, Folded]
  ------------------
  130|    522|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 32, False: 490]
  |  Branch (130:52): [True: 18, False: 472]
  ------------------
  131|     50|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     50|                size_t(dst - dstinit)};
  133|     50|      }
  134|    472|      bufferptr += (val <= 63);
  135|    472|      src++;
  136|    472|    }
  137|    110|  }
  138|       |
  139|  1.20k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 340, False: 864]
  ------------------
  140|    340|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 26, False: 314]
  ------------------
  141|     26|      base64_decode_block_safe(dst, buffer_start);
  142|    314|    } else {
  143|    314|      base64_decode_block(dst, buffer_start);
  144|    314|    }
  145|    340|    dst += 48;
  146|    340|  }
  147|    864|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 500, False: 364]
  ------------------
  148|  4.09k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.59k, False: 500]
  ------------------
  149|  3.59k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.59k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.59k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.59k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.59k|                        << 8;
  154|  3.59k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.59k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.59k|#endif
  157|  3.59k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.59k|      dst += 3;
  160|  3.59k|      buffer_start += 4;
  161|  3.59k|    }
  162|    500|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 146, False: 354]
  ------------------
  163|    146|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    146|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    146|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    146|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    146|                        << 8;
  168|    146|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    146|      triple = scalar::u32_swap_bytes(triple);
  170|    146|#endif
  171|    146|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    146|      dst += 3;
  174|    146|      buffer_start += 4;
  175|    146|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    500|    int leftover = int(bufferptr - buffer_start);
  179|  1.23k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 734, False: 500]
  ------------------
  180|    734|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 734, Folded]
  ------------------
  181|  5.16k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.43k, False: 734]
  ------------------
  182|  4.43k|          src--;
  183|  4.43k|        }
  184|    734|      } 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|    734|      src--;
  190|    734|      leftover--;
  191|    734|    }
  192|    500|  }
  193|    864|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 720, False: 144]
  ------------------
  194|    720|    full_result r = scalar::base64::base64_tail_decode(
  195|    720|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    720|    r = scalar::base64::patch_tail_result(
  197|    720|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    720|        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|    720|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 476, False: 244]
  |  Branch (203:43): [True: 376, False: 100]
  ------------------
  204|    376|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 348, False: 28]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    796|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 792, False: 4]
  ------------------
  207|    792|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 448, False: 344]
  ------------------
  208|    448|        r.input_count++;
  209|    448|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    348|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 344, False: 4]
  ------------------
  213|  2.35k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.28k, False: 70]
  ------------------
  214|  2.28k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.01k, False: 274]
  ------------------
  215|  2.01k|          r.input_count--;
  216|  2.01k|        }
  217|    344|      }
  218|    348|    }
  219|    720|    return r;
  220|    720|  }
  221|    144|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 144, Folded]
  |  Branch (221:26): [True: 0, False: 144]
  ------------------
  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|    144|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    144|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.36k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.36k|  const uint8_t *to_base64 =
   47|  1.36k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.36k]
  ------------------
   48|  1.36k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.36k]
  ------------------
   49|  1.36k|                                   : tables::base64::to_base64_value);
   50|  1.36k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.36k|  size_t equallocation = ri.equallocation;
   52|  1.36k|  size_t equalsigns = ri.equalsigns;
   53|  1.36k|  srclen = ri.srclen;
   54|  1.36k|  size_t full_input_length = ri.full_input_length;
   55|  1.36k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 22, False: 1.34k]
  ------------------
   56|     22|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 22, Folded]
  |  Branch (56:28): [True: 8, False: 14]
  ------------------
   57|      8|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      8|    }
   59|     14|    return {SUCCESS, full_input_length, 0};
   60|     22|  }
   61|  1.34k|  char *end_of_safe_64byte_zone =
   62|  1.34k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 102, False: 1.23k]
  ------------------
   63|  1.34k|          ? nullptr
   64|  1.34k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 382, False: 856]
  ------------------
   65|  1.23k|                                        : dst);
   66|       |
   67|  1.34k|  const chartype *const srcinit = src;
   68|  1.34k|  const char *const dstinit = dst;
   69|  1.34k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.34k|  constexpr size_t block_size = 6;
   72|  1.34k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.34k|  char buffer[block_size * 64];
   74|  1.34k|  char *bufferptr = buffer;
   75|  1.34k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 1.00k, False: 334]
  ------------------
   76|  1.00k|    const chartype *const srcend64 = src + srclen - 64;
   77|  46.1k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 45.4k, False: 658]
  ------------------
   78|  45.4k|      block64 b(src);
   79|  45.4k|      src += 64;
   80|  45.4k|      uint64_t error = 0;
   81|  45.4k|      const uint64_t badcharmask =
   82|  45.4k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  45.4k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 45.4k, Folded]
  |  Branch (83:30): [True: 348, False: 45.1k]
  ------------------
   84|    348|        src -= 64;
   85|    348|        const size_t error_offset = trailing_zeroes(error);
   86|    348|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    348|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    348|      }
   89|  45.1k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 35.7k, False: 9.34k]
  ------------------
   90|  35.7k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  35.7k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 9.06k, False: 280]
  ------------------
   92|  9.06k|        b.copy_block(bufferptr);
   93|  9.06k|        bufferptr += 64;
   94|  9.06k|      } else {
   95|    280|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 4, False: 276]
  ------------------
   96|      4|          b.base64_decode_block_safe(dst);
   97|    276|        } else {
   98|    276|          b.base64_decode_block(dst);
   99|    276|        }
  100|    280|        dst += 48;
  101|    280|      }
  102|  45.1k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 8.53k, False: 36.5k]
  ------------------
  103|  42.6k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 34.1k, False: 8.53k]
  ------------------
  104|  34.1k|          base64_decode_block(dst, buffer + i * 64);
  105|  34.1k|          dst += 48;
  106|  34.1k|        }
  107|  8.53k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 8.53k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  8.53k|        } else {
  110|  8.53k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  8.53k|        }
  112|  8.53k|        dst += 48;
  113|  8.53k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  8.53k|                    64); // 64 might be too much
  115|  8.53k|        bufferptr -= (block_size - 1) * 64;
  116|  8.53k|      }
  117|  45.1k|    }
  118|  1.00k|  }
  119|       |
  120|    992|  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|    992|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    992|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 624, False: 368]
  |  Branch (124:26): [True: 130, False: 494]
  ------------------
  125|       |
  126|  1.13k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.07k, False: 60]
  |  Branch (126:52): [True: 1.05k, False: 16]
  ------------------
  127|  1.05k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.05k|      *bufferptr = char(val);
  129|  1.05k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.05k, Folded]
  ------------------
  130|  1.05k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 36, False: 1.01k]
  |  Branch (130:52): [True: 18, False: 1.00k]
  ------------------
  131|     54|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     54|                size_t(dst - dstinit)};
  133|     54|      }
  134|  1.00k|      bufferptr += (val <= 63);
  135|  1.00k|      src++;
  136|  1.00k|    }
  137|    130|  }
  138|       |
  139|  1.37k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 436, False: 938]
  ------------------
  140|    436|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 30, False: 406]
  ------------------
  141|     30|      base64_decode_block_safe(dst, buffer_start);
  142|    406|    } else {
  143|    406|      base64_decode_block(dst, buffer_start);
  144|    406|    }
  145|    436|    dst += 48;
  146|    436|  }
  147|    938|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 510, False: 428]
  ------------------
  148|  4.08k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.57k, False: 510]
  ------------------
  149|  3.57k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.57k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.57k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.57k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.57k|                        << 8;
  154|  3.57k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.57k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.57k|#endif
  157|  3.57k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.57k|      dst += 3;
  160|  3.57k|      buffer_start += 4;
  161|  3.57k|    }
  162|    510|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 118, False: 392]
  ------------------
  163|    118|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    118|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    118|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    118|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    118|                        << 8;
  168|    118|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    118|      triple = scalar::u32_swap_bytes(triple);
  170|    118|#endif
  171|    118|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    118|      dst += 3;
  174|    118|      buffer_start += 4;
  175|    118|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    510|    int leftover = int(bufferptr - buffer_start);
  179|  1.30k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 792, False: 510]
  ------------------
  180|    792|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 792, Folded]
  ------------------
  181|  6.36k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 5.57k, False: 792]
  ------------------
  182|  5.57k|          src--;
  183|  5.57k|        }
  184|    792|      } 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|    792|      src--;
  190|    792|      leftover--;
  191|    792|    }
  192|    510|  }
  193|    938|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 818, False: 120]
  ------------------
  194|    818|    full_result r = scalar::base64::base64_tail_decode(
  195|    818|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    818|    r = scalar::base64::patch_tail_result(
  197|    818|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    818|        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|    818|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 444, False: 374]
  |  Branch (203:43): [True: 332, False: 112]
  ------------------
  204|    332|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 290, False: 42]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    566|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 558, False: 8]
  ------------------
  207|    558|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 276, False: 282]
  ------------------
  208|    276|        r.input_count++;
  209|    276|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    290|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 282, False: 8]
  ------------------
  213|  1.24k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.18k, False: 64]
  ------------------
  214|  1.18k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 962, False: 218]
  ------------------
  215|    962|          r.input_count--;
  216|    962|        }
  217|    282|      }
  218|    290|    }
  219|    818|    return r;
  220|    818|  }
  221|    120|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 120, Folded]
  |  Branch (221:26): [True: 0, False: 120]
  ------------------
  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|    120|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    120|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.20k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.20k|  const uint8_t *to_base64 =
   47|  1.20k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.20k]
  ------------------
   48|  1.20k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.20k, Folded]
  ------------------
   49|  1.20k|                                   : tables::base64::to_base64_value);
   50|  1.20k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.20k|  size_t equallocation = ri.equallocation;
   52|  1.20k|  size_t equalsigns = ri.equalsigns;
   53|  1.20k|  srclen = ri.srclen;
   54|  1.20k|  size_t full_input_length = ri.full_input_length;
   55|  1.20k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 22, False: 1.17k]
  ------------------
   56|     22|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 22, Folded]
  |  Branch (56:28): [True: 14, False: 8]
  ------------------
   57|     14|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     14|    }
   59|      8|    return {SUCCESS, full_input_length, 0};
   60|     22|  }
   61|  1.17k|  char *end_of_safe_64byte_zone =
   62|  1.17k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 44, False: 1.13k]
  ------------------
   63|  1.17k|          ? nullptr
   64|  1.17k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 370, False: 764]
  ------------------
   65|  1.13k|                                        : dst);
   66|       |
   67|  1.17k|  const chartype *const srcinit = src;
   68|  1.17k|  const char *const dstinit = dst;
   69|  1.17k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.17k|  constexpr size_t block_size = 6;
   72|  1.17k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.17k|  char buffer[block_size * 64];
   74|  1.17k|  char *bufferptr = buffer;
   75|  1.17k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 946, False: 232]
  ------------------
   76|    946|    const chartype *const srcend64 = src + srclen - 64;
   77|   111k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 110k, False: 612]
  ------------------
   78|   110k|      block64 b(src);
   79|   110k|      src += 64;
   80|   110k|      uint64_t error = 0;
   81|   110k|      const uint64_t badcharmask =
   82|   110k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   110k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 110k, Folded]
  |  Branch (83:30): [True: 334, False: 110k]
  ------------------
   84|    334|        src -= 64;
   85|    334|        const size_t error_offset = trailing_zeroes(error);
   86|    334|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    334|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    334|      }
   89|   110k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 63.3k, False: 47.1k]
  ------------------
   90|  63.3k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  63.3k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 13.7k, False: 33.3k]
  ------------------
   92|  13.7k|        b.copy_block(bufferptr);
   93|  13.7k|        bufferptr += 64;
   94|  33.3k|      } else {
   95|  33.3k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 6, False: 33.3k]
  ------------------
   96|      6|          b.base64_decode_block_safe(dst);
   97|  33.3k|        } else {
   98|  33.3k|          b.base64_decode_block(dst);
   99|  33.3k|        }
  100|  33.3k|        dst += 48;
  101|  33.3k|      }
  102|   110k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 13.4k, False: 97.0k]
  ------------------
  103|  67.4k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 53.9k, False: 13.4k]
  ------------------
  104|  53.9k|          base64_decode_block(dst, buffer + i * 64);
  105|  53.9k|          dst += 48;
  106|  53.9k|        }
  107|  13.4k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 13.4k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  13.4k|        } else {
  110|  13.4k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  13.4k|        }
  112|  13.4k|        dst += 48;
  113|  13.4k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  13.4k|                    64); // 64 might be too much
  115|  13.4k|        bufferptr -= (block_size - 1) * 64;
  116|  13.4k|      }
  117|   110k|    }
  118|    946|  }
  119|       |
  120|    844|  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|    844|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    844|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 570, False: 274]
  |  Branch (124:26): [True: 76, False: 494]
  ------------------
  125|       |
  126|    762|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 708, False: 54]
  |  Branch (126:52): [True: 690, False: 18]
  ------------------
  127|    690|      uint8_t val = to_base64[uint8_t(*src)];
  128|    690|      *bufferptr = char(val);
  129|    690|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 690, Folded]
  ------------------
  130|    690|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 690]
  |  Branch (130:52): [True: 4, False: 686]
  ------------------
  131|      4|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      4|                size_t(dst - dstinit)};
  133|      4|      }
  134|    686|      bufferptr += (val <= 63);
  135|    686|      src++;
  136|    686|    }
  137|     76|  }
  138|       |
  139|  1.31k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 472, False: 840]
  ------------------
  140|    472|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 32, False: 440]
  ------------------
  141|     32|      base64_decode_block_safe(dst, buffer_start);
  142|    440|    } else {
  143|    440|      base64_decode_block(dst, buffer_start);
  144|    440|    }
  145|    472|    dst += 48;
  146|    472|  }
  147|    840|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 512, False: 328]
  ------------------
  148|  4.46k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.95k, False: 512]
  ------------------
  149|  3.95k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.95k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.95k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.95k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.95k|                        << 8;
  154|  3.95k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.95k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.95k|#endif
  157|  3.95k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.95k|      dst += 3;
  160|  3.95k|      buffer_start += 4;
  161|  3.95k|    }
  162|    512|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 118, False: 394]
  ------------------
  163|    118|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    118|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    118|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    118|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    118|                        << 8;
  168|    118|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    118|      triple = scalar::u32_swap_bytes(triple);
  170|    118|#endif
  171|    118|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    118|      dst += 3;
  174|    118|      buffer_start += 4;
  175|    118|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    512|    int leftover = int(bufferptr - buffer_start);
  179|  1.28k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 768, False: 512]
  ------------------
  180|    768|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 768, Folded]
  ------------------
  181|  5.99k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 5.23k, False: 768]
  ------------------
  182|  5.23k|          src--;
  183|  5.23k|        }
  184|    768|      } 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|    768|      src--;
  190|    768|      leftover--;
  191|    768|    }
  192|    512|  }
  193|    840|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 712, False: 128]
  ------------------
  194|    712|    full_result r = scalar::base64::base64_tail_decode(
  195|    712|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    712|    r = scalar::base64::patch_tail_result(
  197|    712|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    712|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    712|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 382, False: 330]
  |  Branch (203:43): [True: 350, False: 32]
  ------------------
  204|    350|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 302, False: 48]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    724|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 718, False: 6]
  ------------------
  207|    718|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 422, False: 296]
  ------------------
  208|    422|        r.input_count++;
  209|    422|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    302|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 296, False: 6]
  ------------------
  213|  3.85k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 3.78k, False: 64]
  ------------------
  214|  3.78k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 3.55k, False: 232]
  ------------------
  215|  3.55k|          r.input_count--;
  216|  3.55k|        }
  217|    296|      }
  218|    302|    }
  219|    712|    return r;
  220|    712|  }
  221|    128|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 128, Folded]
  |  Branch (221:26): [True: 0, False: 128]
  ------------------
  222|      0|    if ((size_t(dst - dstinit) % 3 == 0) ||
  ------------------
  |  Branch (222:9): [True: 0, False: 0]
  ------------------
  223|      0|        ((size_t(dst - dstinit) % 3) + 1 + equalsigns != 4)) {
  ------------------
  |  Branch (223:9): [True: 0, False: 0]
  ------------------
  224|      0|      return {INVALID_BASE64_CHARACTER, equallocation, size_t(dst - dstinit),
  225|      0|              true};
  226|      0|    }
  227|      0|  }
  228|    128|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    128|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EcEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.32k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.32k|  const uint8_t *to_base64 =
   47|  1.32k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.32k]
  ------------------
   48|  1.32k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.32k]
  ------------------
   49|  1.32k|                                   : tables::base64::to_base64_value);
   50|  1.32k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.32k|  size_t equallocation = ri.equallocation;
   52|  1.32k|  size_t equalsigns = ri.equalsigns;
   53|  1.32k|  srclen = ri.srclen;
   54|  1.32k|  size_t full_input_length = ri.full_input_length;
   55|  1.32k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 20, False: 1.30k]
  ------------------
   56|     20|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 20, Folded]
  |  Branch (56:28): [True: 6, False: 14]
  ------------------
   57|      6|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      6|    }
   59|     14|    return {SUCCESS, full_input_length, 0};
   60|     20|  }
   61|  1.30k|  char *end_of_safe_64byte_zone =
   62|  1.30k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 50, False: 1.25k]
  ------------------
   63|  1.30k|          ? nullptr
   64|  1.30k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 412, False: 844]
  ------------------
   65|  1.25k|                                        : dst);
   66|       |
   67|  1.30k|  const chartype *const srcinit = src;
   68|  1.30k|  const char *const dstinit = dst;
   69|  1.30k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.30k|  constexpr size_t block_size = 6;
   72|  1.30k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.30k|  char buffer[block_size * 64];
   74|  1.30k|  char *bufferptr = buffer;
   75|  1.30k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 1.00k, False: 304]
  ------------------
   76|  1.00k|    const chartype *const srcend64 = src + srclen - 64;
   77|   281k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 280k, False: 654]
  ------------------
   78|   280k|      block64 b(src);
   79|   280k|      src += 64;
   80|   280k|      uint64_t error = 0;
   81|   280k|      const uint64_t badcharmask =
   82|   280k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|   280k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 280k, Folded]
  |  Branch (83:30): [True: 348, False: 280k]
  ------------------
   84|    348|        src -= 64;
   85|    348|        const size_t error_offset = trailing_zeroes(error);
   86|    348|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    348|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    348|      }
   89|   280k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 38.9k, False: 241k]
  ------------------
   90|  38.9k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|   241k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 120k, False: 121k]
  ------------------
   92|   120k|        b.copy_block(bufferptr);
   93|   120k|        bufferptr += 64;
   94|   121k|      } else {
   95|   121k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 10, False: 121k]
  ------------------
   96|     10|          b.base64_decode_block_safe(dst);
   97|   121k|        } else {
   98|   121k|          b.base64_decode_block(dst);
   99|   121k|        }
  100|   121k|        dst += 48;
  101|   121k|      }
  102|   280k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 31.2k, False: 248k]
  ------------------
  103|   156k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 124k, False: 31.2k]
  ------------------
  104|   124k|          base64_decode_block(dst, buffer + i * 64);
  105|   124k|          dst += 48;
  106|   124k|        }
  107|  31.2k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 31.2k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  31.2k|        } else {
  110|  31.2k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  31.2k|        }
  112|  31.2k|        dst += 48;
  113|  31.2k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  31.2k|                    64); // 64 might be too much
  115|  31.2k|        bufferptr -= (block_size - 1) * 64;
  116|  31.2k|      }
  117|   280k|    }
  118|  1.00k|  }
  119|       |
  120|    958|  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|    958|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    958|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 602, False: 356]
  |  Branch (124:26): [True: 92, False: 510]
  ------------------
  125|       |
  126|  1.43k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.36k, False: 66]
  |  Branch (126:52): [True: 1.34k, False: 20]
  ------------------
  127|  1.34k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.34k|      *bufferptr = char(val);
  129|  1.34k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.34k, Folded]
  ------------------
  130|  1.34k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 0, False: 1.34k]
  |  Branch (130:52): [True: 6, False: 1.34k]
  ------------------
  131|      6|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|      6|                size_t(dst - dstinit)};
  133|      6|      }
  134|  1.34k|      bufferptr += (val <= 63);
  135|  1.34k|      src++;
  136|  1.34k|    }
  137|     92|  }
  138|       |
  139|  1.43k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 478, False: 952]
  ------------------
  140|    478|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 34, False: 444]
  ------------------
  141|     34|      base64_decode_block_safe(dst, buffer_start);
  142|    444|    } else {
  143|    444|      base64_decode_block(dst, buffer_start);
  144|    444|    }
  145|    478|    dst += 48;
  146|    478|  }
  147|    952|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 530, False: 422]
  ------------------
  148|  4.43k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.90k, False: 530]
  ------------------
  149|  3.90k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.90k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.90k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.90k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.90k|                        << 8;
  154|  3.90k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.90k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.90k|#endif
  157|  3.90k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.90k|      dst += 3;
  160|  3.90k|      buffer_start += 4;
  161|  3.90k|    }
  162|    530|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 142, False: 388]
  ------------------
  163|    142|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    142|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    142|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    142|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    142|                        << 8;
  168|    142|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    142|      triple = scalar::u32_swap_bytes(triple);
  170|    142|#endif
  171|    142|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    142|      dst += 3;
  174|    142|      buffer_start += 4;
  175|    142|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    530|    int leftover = int(bufferptr - buffer_start);
  179|  1.28k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 756, False: 530]
  ------------------
  180|    756|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 756, Folded]
  ------------------
  181|  7.38k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 6.62k, False: 756]
  ------------------
  182|  6.62k|          src--;
  183|  6.62k|        }
  184|    756|      } 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|    756|      src--;
  190|    756|      leftover--;
  191|    756|    }
  192|    530|  }
  193|    952|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 784, False: 168]
  ------------------
  194|    784|    full_result r = scalar::base64::base64_tail_decode(
  195|    784|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    784|    r = scalar::base64::patch_tail_result(
  197|    784|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    784|        full_input_length, last_chunk_options);
  199|       |    // When is_partial(last_chunk_options) is true, we must either end with
  200|       |    // the end of the stream (beyond whitespace) or right after a non-ignorable
  201|       |    // character or at the very beginning of the stream.
  202|       |    // See https://tc39.es/proposal-arraybuffer-base64/spec/#sec-frombase64
  203|    784|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 322, False: 462]
  |  Branch (203:43): [True: 292, False: 30]
  ------------------
  204|    292|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 248, False: 44]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    532|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 526, False: 6]
  ------------------
  207|    526|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 284, False: 242]
  ------------------
  208|    284|        r.input_count++;
  209|    284|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    248|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 242, False: 6]
  ------------------
  213|  1.02k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 980, False: 48]
  ------------------
  214|    980|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 786, False: 194]
  ------------------
  215|    786|          r.input_count--;
  216|    786|        }
  217|    242|      }
  218|    248|    }
  219|    784|    return r;
  220|    784|  }
  221|    168|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 168, Folded]
  |  Branch (221:26): [True: 0, False: 168]
  ------------------
  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|    168|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    168|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb1ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.25k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.25k|  const uint8_t *to_base64 =
   47|  1.25k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.25k]
  ------------------
   48|  1.25k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [True: 1.25k, Folded]
  ------------------
   49|  1.25k|                                   : tables::base64::to_base64_value);
   50|  1.25k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.25k|  size_t equallocation = ri.equallocation;
   52|  1.25k|  size_t equalsigns = ri.equalsigns;
   53|  1.25k|  srclen = ri.srclen;
   54|  1.25k|  size_t full_input_length = ri.full_input_length;
   55|  1.25k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 18, False: 1.23k]
  ------------------
   56|     18|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 18, Folded]
  |  Branch (56:28): [True: 10, False: 8]
  ------------------
   57|     10|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|     10|    }
   59|      8|    return {SUCCESS, full_input_length, 0};
   60|     18|  }
   61|  1.23k|  char *end_of_safe_64byte_zone =
   62|  1.23k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 86, False: 1.15k]
  ------------------
   63|  1.23k|          ? nullptr
   64|  1.23k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 338, False: 812]
  ------------------
   65|  1.15k|                                        : dst);
   66|       |
   67|  1.23k|  const chartype *const srcinit = src;
   68|  1.23k|  const char *const dstinit = dst;
   69|  1.23k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.23k|  constexpr size_t block_size = 6;
   72|  1.23k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.23k|  char buffer[block_size * 64];
   74|  1.23k|  char *bufferptr = buffer;
   75|  1.23k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 944, False: 292]
  ------------------
   76|    944|    const chartype *const srcend64 = src + srclen - 64;
   77|  21.0k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 20.3k, False: 622]
  ------------------
   78|  20.3k|      block64 b(src);
   79|  20.3k|      src += 64;
   80|  20.3k|      uint64_t error = 0;
   81|  20.3k|      const uint64_t badcharmask =
   82|  20.3k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  20.3k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 20.3k, Folded]
  |  Branch (83:30): [True: 322, False: 20.0k]
  ------------------
   84|    322|        src -= 64;
   85|    322|        const size_t error_offset = trailing_zeroes(error);
   86|    322|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    322|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    322|      }
   89|  20.0k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 16.2k, False: 3.76k]
  ------------------
   90|  16.2k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  16.2k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 3.42k, False: 342]
  ------------------
   92|  3.42k|        b.copy_block(bufferptr);
   93|  3.42k|        bufferptr += 64;
   94|  3.42k|      } else {
   95|    342|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 8, False: 334]
  ------------------
   96|      8|          b.base64_decode_block_safe(dst);
   97|    334|        } else {
   98|    334|          b.base64_decode_block(dst);
   99|    334|        }
  100|    342|        dst += 48;
  101|    342|      }
  102|  20.0k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 3.64k, False: 16.4k]
  ------------------
  103|  18.2k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 14.5k, False: 3.64k]
  ------------------
  104|  14.5k|          base64_decode_block(dst, buffer + i * 64);
  105|  14.5k|          dst += 48;
  106|  14.5k|        }
  107|  3.64k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 3.64k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  3.64k|        } else {
  110|  3.64k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  3.64k|        }
  112|  3.64k|        dst += 48;
  113|  3.64k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  3.64k|                    64); // 64 might be too much
  115|  3.64k|        bufferptr -= (block_size - 1) * 64;
  116|  3.64k|      }
  117|  20.0k|    }
  118|    944|  }
  119|       |
  120|    914|  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|    914|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    914|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 586, False: 328]
  |  Branch (124:26): [True: 110, False: 476]
  ------------------
  125|       |
  126|    582|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 546, False: 36]
  |  Branch (126:52): [True: 522, False: 24]
  ------------------
  127|    522|      uint8_t val = to_base64[uint8_t(*src)];
  128|    522|      *bufferptr = char(val);
  129|    522|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 522, Folded]
  ------------------
  130|    522|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 32, False: 490]
  |  Branch (130:52): [True: 18, False: 472]
  ------------------
  131|     50|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     50|                size_t(dst - dstinit)};
  133|     50|      }
  134|    472|      bufferptr += (val <= 63);
  135|    472|      src++;
  136|    472|    }
  137|    110|  }
  138|       |
  139|  1.20k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 340, False: 864]
  ------------------
  140|    340|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 26, False: 314]
  ------------------
  141|     26|      base64_decode_block_safe(dst, buffer_start);
  142|    314|    } else {
  143|    314|      base64_decode_block(dst, buffer_start);
  144|    314|    }
  145|    340|    dst += 48;
  146|    340|  }
  147|    864|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 500, False: 364]
  ------------------
  148|  4.09k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.59k, False: 500]
  ------------------
  149|  3.59k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.59k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.59k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.59k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.59k|                        << 8;
  154|  3.59k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.59k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.59k|#endif
  157|  3.59k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.59k|      dst += 3;
  160|  3.59k|      buffer_start += 4;
  161|  3.59k|    }
  162|    500|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 146, False: 354]
  ------------------
  163|    146|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    146|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    146|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    146|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    146|                        << 8;
  168|    146|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    146|      triple = scalar::u32_swap_bytes(triple);
  170|    146|#endif
  171|    146|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    146|      dst += 3;
  174|    146|      buffer_start += 4;
  175|    146|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    500|    int leftover = int(bufferptr - buffer_start);
  179|  1.23k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 734, False: 500]
  ------------------
  180|    734|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 734, Folded]
  ------------------
  181|  5.16k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 4.43k, False: 734]
  ------------------
  182|  4.43k|          src--;
  183|  4.43k|        }
  184|    734|      } 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|    734|      src--;
  190|    734|      leftover--;
  191|    734|    }
  192|    500|  }
  193|    864|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 720, False: 144]
  ------------------
  194|    720|    full_result r = scalar::base64::base64_tail_decode(
  195|    720|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    720|    r = scalar::base64::patch_tail_result(
  197|    720|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    720|        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|    720|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 476, False: 244]
  |  Branch (203:43): [True: 376, False: 100]
  ------------------
  204|    376|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 348, False: 28]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    796|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 792, False: 4]
  ------------------
  207|    792|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 448, False: 344]
  ------------------
  208|    448|        r.input_count++;
  209|    448|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    348|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 344, False: 4]
  ------------------
  213|  2.35k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 2.28k, False: 70]
  ------------------
  214|  2.28k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 2.01k, False: 274]
  ------------------
  215|  2.01k|          r.input_count--;
  216|  2.01k|        }
  217|    344|      }
  218|    348|    }
  219|    720|    return r;
  220|    720|  }
  221|    144|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 144, Folded]
  |  Branch (221:26): [True: 0, False: 144]
  ------------------
  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|    144|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    144|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_16base6422compress_decode_base64ILb0ELb0ELb0EDsEENS_11full_resultEPcPKT2_mNS_14base64_optionsENS_27last_chunk_handling_optionsE:
   45|  1.36k|                       last_chunk_handling_options last_chunk_options) {
   46|  1.36k|  const uint8_t *to_base64 =
   47|  1.36k|      default_or_url ? tables::base64::to_base64_default_or_url_value
  ------------------
  |  Branch (47:7): [Folded, False: 1.36k]
  ------------------
   48|  1.36k|                     : (base64_url ? tables::base64::to_base64_url_value
  ------------------
  |  Branch (48:25): [Folded, False: 1.36k]
  ------------------
   49|  1.36k|                                   : tables::base64::to_base64_value);
   50|  1.36k|  auto ri = simdutf::scalar::base64::find_end(src, srclen, options);
   51|  1.36k|  size_t equallocation = ri.equallocation;
   52|  1.36k|  size_t equalsigns = ri.equalsigns;
   53|  1.36k|  srclen = ri.srclen;
   54|  1.36k|  size_t full_input_length = ri.full_input_length;
   55|  1.36k|  if (srclen == 0) {
  ------------------
  |  Branch (55:7): [True: 22, False: 1.34k]
  ------------------
   56|     22|    if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (56:9): [True: 22, Folded]
  |  Branch (56:28): [True: 8, False: 14]
  ------------------
   57|      8|      return {INVALID_BASE64_CHARACTER, equallocation, 0, true};
   58|      8|    }
   59|     14|    return {SUCCESS, full_input_length, 0};
   60|     22|  }
   61|  1.34k|  char *end_of_safe_64byte_zone =
   62|  1.34k|      dst == nullptr
  ------------------
  |  Branch (62:7): [True: 102, False: 1.23k]
  ------------------
   63|  1.34k|          ? nullptr
   64|  1.34k|          : ((srclen + 3) / 4 * 3 >= 63 ? dst + (srclen + 3) / 4 * 3 - 63
  ------------------
  |  Branch (64:14): [True: 382, False: 856]
  ------------------
   65|  1.23k|                                        : dst);
   66|       |
   67|  1.34k|  const chartype *const srcinit = src;
   68|  1.34k|  const char *const dstinit = dst;
   69|  1.34k|  const chartype *const srcend = src + srclen;
   70|       |
   71|  1.34k|  constexpr size_t block_size = 6;
   72|  1.34k|  static_assert(block_size >= 2, "block_size must be at least two");
   73|  1.34k|  char buffer[block_size * 64];
   74|  1.34k|  char *bufferptr = buffer;
   75|  1.34k|  if (srclen >= 64) {
  ------------------
  |  Branch (75:7): [True: 1.00k, False: 334]
  ------------------
   76|  1.00k|    const chartype *const srcend64 = src + srclen - 64;
   77|  46.1k|    while (src <= srcend64) {
  ------------------
  |  Branch (77:12): [True: 45.4k, False: 658]
  ------------------
   78|  45.4k|      block64 b(src);
   79|  45.4k|      src += 64;
   80|  45.4k|      uint64_t error = 0;
   81|  45.4k|      const uint64_t badcharmask =
   82|  45.4k|          b.to_base64_mask<base64_url, ignore_garbage, default_or_url>(&error);
   83|  45.4k|      if (!ignore_garbage && error) {
  ------------------
  |  Branch (83:11): [True: 45.4k, Folded]
  |  Branch (83:30): [True: 348, False: 45.1k]
  ------------------
   84|    348|        src -= 64;
   85|    348|        const size_t error_offset = trailing_zeroes(error);
   86|    348|        return {error_code::INVALID_BASE64_CHARACTER,
   87|    348|                size_t(src - srcinit + error_offset), size_t(dst - dstinit)};
   88|    348|      }
   89|  45.1k|      if (badcharmask != 0) {
  ------------------
  |  Branch (89:11): [True: 35.7k, False: 9.34k]
  ------------------
   90|  35.7k|        bufferptr += b.compress_block(badcharmask, bufferptr);
   91|  35.7k|      } else if (bufferptr != buffer) {
  ------------------
  |  Branch (91:18): [True: 9.06k, False: 280]
  ------------------
   92|  9.06k|        b.copy_block(bufferptr);
   93|  9.06k|        bufferptr += 64;
   94|  9.06k|      } else {
   95|    280|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (95:13): [True: 4, False: 276]
  ------------------
   96|      4|          b.base64_decode_block_safe(dst);
   97|    276|        } else {
   98|    276|          b.base64_decode_block(dst);
   99|    276|        }
  100|    280|        dst += 48;
  101|    280|      }
  102|  45.1k|      if (bufferptr >= (block_size - 1) * 64 + buffer) {
  ------------------
  |  Branch (102:11): [True: 8.53k, False: 36.5k]
  ------------------
  103|  42.6k|        for (size_t i = 0; i < (block_size - 2); i++) {
  ------------------
  |  Branch (103:28): [True: 34.1k, False: 8.53k]
  ------------------
  104|  34.1k|          base64_decode_block(dst, buffer + i * 64);
  105|  34.1k|          dst += 48;
  106|  34.1k|        }
  107|  8.53k|        if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (107:13): [True: 0, False: 8.53k]
  ------------------
  108|      0|          base64_decode_block_safe(dst, buffer + (block_size - 2) * 64);
  109|  8.53k|        } else {
  110|  8.53k|          base64_decode_block(dst, buffer + (block_size - 2) * 64);
  111|  8.53k|        }
  112|  8.53k|        dst += 48;
  113|  8.53k|        std::memcpy(buffer, buffer + (block_size - 1) * 64,
  114|  8.53k|                    64); // 64 might be too much
  115|  8.53k|        bufferptr -= (block_size - 1) * 64;
  116|  8.53k|      }
  117|  45.1k|    }
  118|  1.00k|  }
  119|       |
  120|    992|  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|    992|  int last_block = (int)((bufferptr - buffer_start) % 64);
  124|    992|  if (last_block != 0 && srcend - src + last_block >= 64) {
  ------------------
  |  Branch (124:7): [True: 624, False: 368]
  |  Branch (124:26): [True: 130, False: 494]
  ------------------
  125|       |
  126|  1.13k|    while ((bufferptr - buffer_start) % 64 != 0 && src < srcend) {
  ------------------
  |  Branch (126:12): [True: 1.07k, False: 60]
  |  Branch (126:52): [True: 1.05k, False: 16]
  ------------------
  127|  1.05k|      uint8_t val = to_base64[uint8_t(*src)];
  128|  1.05k|      *bufferptr = char(val);
  129|  1.05k|      if (!ignore_garbage &&
  ------------------
  |  Branch (129:11): [True: 1.05k, Folded]
  ------------------
  130|  1.05k|          (!scalar::base64::is_eight_byte(*src) || val > 64)) {
  ------------------
  |  Branch (130:12): [True: 36, False: 1.01k]
  |  Branch (130:52): [True: 18, False: 1.00k]
  ------------------
  131|     54|        return {error_code::INVALID_BASE64_CHARACTER, size_t(src - srcinit),
  132|     54|                size_t(dst - dstinit)};
  133|     54|      }
  134|  1.00k|      bufferptr += (val <= 63);
  135|  1.00k|      src++;
  136|  1.00k|    }
  137|    130|  }
  138|       |
  139|  1.37k|  for (; buffer_start + 64 <= bufferptr; buffer_start += 64) {
  ------------------
  |  Branch (139:10): [True: 436, False: 938]
  ------------------
  140|    436|    if (dst >= end_of_safe_64byte_zone) {
  ------------------
  |  Branch (140:9): [True: 30, False: 406]
  ------------------
  141|     30|      base64_decode_block_safe(dst, buffer_start);
  142|    406|    } else {
  143|    406|      base64_decode_block(dst, buffer_start);
  144|    406|    }
  145|    436|    dst += 48;
  146|    436|  }
  147|    938|  if ((bufferptr - buffer_start) % 64 != 0) {
  ------------------
  |  Branch (147:7): [True: 510, False: 428]
  ------------------
  148|  4.08k|    while (buffer_start + 4 < bufferptr) {
  ------------------
  |  Branch (148:12): [True: 3.57k, False: 510]
  ------------------
  149|  3.57k|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  150|  3.57k|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  151|  3.57k|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  152|  3.57k|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  153|  3.57k|                        << 8;
  154|  3.57k|#if !SIMDUTF_IS_BIG_ENDIAN
  155|  3.57k|      triple = scalar::u32_swap_bytes(triple);
  156|  3.57k|#endif
  157|  3.57k|      std::memcpy(dst, &triple, 3);
  158|       |
  159|  3.57k|      dst += 3;
  160|  3.57k|      buffer_start += 4;
  161|  3.57k|    }
  162|    510|    if (buffer_start + 4 <= bufferptr) {
  ------------------
  |  Branch (162:9): [True: 118, False: 392]
  ------------------
  163|    118|      uint32_t triple = ((uint32_t(uint8_t(buffer_start[0])) << 3 * 6) +
  164|    118|                         (uint32_t(uint8_t(buffer_start[1])) << 2 * 6) +
  165|    118|                         (uint32_t(uint8_t(buffer_start[2])) << 1 * 6) +
  166|    118|                         (uint32_t(uint8_t(buffer_start[3])) << 0 * 6))
  167|    118|                        << 8;
  168|    118|#if !SIMDUTF_IS_BIG_ENDIAN
  169|    118|      triple = scalar::u32_swap_bytes(triple);
  170|    118|#endif
  171|    118|      std::memcpy(dst, &triple, 3);
  172|       |
  173|    118|      dst += 3;
  174|    118|      buffer_start += 4;
  175|    118|    }
  176|       |    // we may have 1, 2 or 3 bytes left and we need to decode them so let us
  177|       |    // backtrack
  178|    510|    int leftover = int(bufferptr - buffer_start);
  179|  1.30k|    while (leftover > 0) {
  ------------------
  |  Branch (179:12): [True: 792, False: 510]
  ------------------
  180|    792|      if (!ignore_garbage) {
  ------------------
  |  Branch (180:11): [True: 792, Folded]
  ------------------
  181|  6.36k|        while (to_base64[uint8_t(*(src - 1))] == 64) {
  ------------------
  |  Branch (181:16): [True: 5.57k, False: 792]
  ------------------
  182|  5.57k|          src--;
  183|  5.57k|        }
  184|    792|      } 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|    792|      src--;
  190|    792|      leftover--;
  191|    792|    }
  192|    510|  }
  193|    938|  if (src < srcend + equalsigns) {
  ------------------
  |  Branch (193:7): [True: 818, False: 120]
  ------------------
  194|    818|    full_result r = scalar::base64::base64_tail_decode(
  195|    818|        dst, src, srcend - src, equalsigns, options, last_chunk_options);
  196|    818|    r = scalar::base64::patch_tail_result(
  197|    818|        r, size_t(src - srcinit), size_t(dst - dstinit), equallocation,
  198|    818|        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|    818|    if (is_partial(last_chunk_options) && r.error == error_code::SUCCESS &&
  ------------------
  |  Branch (203:9): [True: 444, False: 374]
  |  Branch (203:43): [True: 332, False: 112]
  ------------------
  204|    332|        r.input_count < full_input_length) {
  ------------------
  |  Branch (204:9): [True: 290, False: 42]
  ------------------
  205|       |      // First check if we can extend the input to the end of the stream
  206|    566|      while (r.input_count < full_input_length &&
  ------------------
  |  Branch (206:14): [True: 558, False: 8]
  ------------------
  207|    558|             base64_ignorable(*(srcinit + r.input_count), options)) {
  ------------------
  |  Branch (207:14): [True: 276, False: 282]
  ------------------
  208|    276|        r.input_count++;
  209|    276|      }
  210|       |      // If we are still not at the end of the stream, then we must backtrack
  211|       |      // to the last non-ignorable character.
  212|    290|      if (r.input_count < full_input_length) {
  ------------------
  |  Branch (212:11): [True: 282, False: 8]
  ------------------
  213|  1.24k|        while (r.input_count > 0 &&
  ------------------
  |  Branch (213:16): [True: 1.18k, False: 64]
  ------------------
  214|  1.18k|               base64_ignorable(*(srcinit + r.input_count - 1), options)) {
  ------------------
  |  Branch (214:16): [True: 962, False: 218]
  ------------------
  215|    962|          r.input_count--;
  216|    962|        }
  217|    282|      }
  218|    290|    }
  219|    818|    return r;
  220|    818|  }
  221|    120|  if (!ignore_garbage && equalsigns > 0) {
  ------------------
  |  Branch (221:7): [True: 120, Folded]
  |  Branch (221:26): [True: 0, False: 120]
  ------------------
  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|    120|  return {SUCCESS, srclen, size_t(dst - dstinit)};
  229|    120|}

simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block64C2EPKc:
  507|   391k|  simdutf_really_inline block64(const char *src) {
  508|   391k|    chunks[0] = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src));
  509|   391k|    chunks[1] = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 32));
  510|   391k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414compress_blockEmPc:
  687|   154k|  simdutf_really_inline uint64_t compress_block(uint64_t mask, char *output) {
  688|   154k|    if (is_power_of_two(mask)) {
  ------------------
  |  Branch (688:9): [True: 106k, False: 47.5k]
  ------------------
  689|   106k|      return compress_block_single(mask, output);
  690|   106k|    }
  691|       |
  692|  47.5k|    uint64_t nmask = ~mask;
  693|  47.5k|    compress(chunks[0], uint32_t(mask), output);
  694|  47.5k|    compress(chunks[1], uint32_t(mask >> 32),
  695|  47.5k|             output + count_ones(nmask & 0xFFFFFFFF));
  696|  47.5k|    return count_ones(nmask);
  697|   154k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6421compress_block_singleEmPc:
  700|   106k|                                                     char *output) {
  701|   106k|    const size_t pos64 = trailing_zeroes(mask);
  702|   106k|    const int8_t pos = pos64 & 0xf;
  703|   106k|    switch (pos64 >> 4) {
  ------------------
  |  Branch (703:13): [True: 106k, False: 0]
  ------------------
  704|  25.5k|    case 0b00: {
  ------------------
  |  Branch (704:5): [True: 25.5k, False: 81.3k]
  ------------------
  705|  25.5k|      const __m128i lane0 = _mm256_extracti128_si256(chunks[0], 0);
  706|  25.5k|      const __m128i lane1 = _mm256_extracti128_si256(chunks[0], 1);
  707|       |
  708|  25.5k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  709|  25.5k|      const __m128i v1 =
  710|  25.5k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  711|  25.5k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  712|  25.5k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  713|  25.5k|      const __m128i compressed = _mm_shuffle_epi8(lane0, sh);
  714|       |
  715|  25.5k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), compressed);
  716|  25.5k|      _mm_storeu_si128((__m128i *)(output + 1 * 16 - 1), lane1);
  717|  25.5k|      _mm256_storeu_si256((__m256i *)(output + 2 * 16 - 1), chunks[1]);
  718|  25.5k|    } break;
  719|  27.9k|    case 0b01: {
  ------------------
  |  Branch (719:5): [True: 27.9k, False: 78.9k]
  ------------------
  720|  27.9k|      const __m128i lane0 = _mm256_extracti128_si256(chunks[0], 0);
  721|  27.9k|      const __m128i lane1 = _mm256_extracti128_si256(chunks[0], 1);
  722|  27.9k|      _mm_storeu_si128((__m128i *)(output + 0 * 16), lane0);
  723|       |
  724|  27.9k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  725|  27.9k|      const __m128i v1 =
  726|  27.9k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  727|  27.9k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  728|  27.9k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  729|  27.9k|      const __m128i compressed = _mm_shuffle_epi8(lane1, sh);
  730|       |
  731|  27.9k|      _mm_storeu_si128((__m128i *)(output + 1 * 16), compressed);
  732|  27.9k|      _mm256_storeu_si256((__m256i *)(output + 2 * 16 - 1), chunks[1]);
  733|  27.9k|    } break;
  734|  27.0k|    case 0b10: {
  ------------------
  |  Branch (734:5): [True: 27.0k, False: 79.8k]
  ------------------
  735|  27.0k|      const __m128i lane2 = _mm256_extracti128_si256(chunks[1], 0);
  736|  27.0k|      const __m128i lane3 = _mm256_extracti128_si256(chunks[1], 1);
  737|       |
  738|  27.0k|      _mm256_storeu_si256((__m256i *)(output + 0 * 16), chunks[0]);
  739|       |
  740|  27.0k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  741|  27.0k|      const __m128i v1 =
  742|  27.0k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  743|  27.0k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  744|  27.0k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  745|  27.0k|      const __m128i compressed = _mm_shuffle_epi8(lane2, sh);
  746|       |
  747|  27.0k|      _mm_storeu_si128((__m128i *)(output + 2 * 16), compressed);
  748|  27.0k|      _mm_storeu_si128((__m128i *)(output + 3 * 16 - 1), lane3);
  749|  27.0k|    } break;
  750|  26.4k|    case 0b11: {
  ------------------
  |  Branch (750:5): [True: 26.4k, False: 80.4k]
  ------------------
  751|  26.4k|      const __m128i lane2 = _mm256_extracti128_si256(chunks[1], 0);
  752|  26.4k|      const __m128i lane3 = _mm256_extracti128_si256(chunks[1], 1);
  753|       |
  754|  26.4k|      _mm256_storeu_si256((__m256i *)(output + 0 * 16), chunks[0]);
  755|  26.4k|      _mm_storeu_si128((__m128i *)(output + 2 * 16), lane2);
  756|       |
  757|  26.4k|      const __m128i v0 = _mm_set1_epi8(char(pos - 1));
  758|  26.4k|      const __m128i v1 =
  759|  26.4k|          _mm_setr_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  760|  26.4k|      const __m128i v2 = _mm_cmpgt_epi8(v1, v0);
  761|  26.4k|      const __m128i sh = _mm_sub_epi8(v1, v2);
  762|  26.4k|      const __m128i compressed = _mm_shuffle_epi8(lane3, sh);
  763|       |
  764|  26.4k|      _mm_storeu_si128((__m128i *)(output + 3 * 16), compressed);
  765|  26.4k|    } break;
  766|   106k|    }
  767|       |
  768|   106k|    return 63;
  769|   106k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_18compressIvEEvDv4_xjPc:
  455|  95.0k|simdutf_really_inline void compress(__m256i data, uint32_t mask, char *output) {
  456|  95.0k|  if (mask == 0) {
  ------------------
  |  Branch (456:7): [True: 16.5k, False: 78.5k]
  ------------------
  457|  16.5k|    _mm256_storeu_si256(reinterpret_cast<__m256i *>(output), data);
  458|  16.5k|    return;
  459|  16.5k|  }
  460|  78.5k|  compress(_mm256_castsi256_si128(data), uint16_t(mask), output);
  461|       |  compress(_mm256_extracti128_si256(data, 1), uint16_t(mask >> 16),
  462|  78.5k|           output + count_ones(~mask & 0xFFFF));
  463|  78.5k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_18compressEDv2_xtPc:
  418|   157k|static inline void compress(__m128i data, uint16_t mask, char *output) {
  419|   157k|  if (mask == 0) {
  ------------------
  |  Branch (419:7): [True: 47.6k, False: 109k]
  ------------------
  420|  47.6k|    _mm_storeu_si128(reinterpret_cast<__m128i *>(output), data);
  421|  47.6k|    return;
  422|  47.6k|  }
  423|       |  // this particular implementation was inspired by work done by @animetosho
  424|       |  // we do it in two steps, first 8 bytes and then second 8 bytes
  425|   109k|  uint8_t mask1 = uint8_t(mask);      // least significant 8 bits
  426|   109k|  uint8_t mask2 = uint8_t(mask >> 8); // most significant 8 bits
  427|       |  // next line just loads the 64-bit values thintable_epi8[mask1] and
  428|       |  // thintable_epi8[mask2] into a 128-bit register, using only
  429|       |  // two instructions on most compilers.
  430|       |
  431|   109k|  __m128i shufmask = _mm_set_epi64x(tables::base64::thintable_epi8[mask2],
  432|   109k|                                    tables::base64::thintable_epi8[mask1]);
  433|       |  // we increment by 0x08 the second half of the mask
  434|   109k|  shufmask =
  435|   109k|      _mm_add_epi8(shufmask, _mm_set_epi32(0x08080808, 0x08080808, 0, 0));
  436|       |  // this is the version "nearly pruned"
  437|   109k|  __m128i pruned = _mm_shuffle_epi8(data, shufmask);
  438|       |  // we still need to put the two halves together.
  439|       |  // we compute the popcount of the first half:
  440|   109k|  int pop1 = tables::base64::BitsSetTable256mul2[mask1];
  441|       |  // then load the corresponding mask, what it does is to write
  442|       |  // only the first pop1 bytes from the first 8 bytes, and then
  443|       |  // it fills in with the bytes from the second 8 bytes + some filling
  444|       |  // at the end.
  445|   109k|  __m128i compactmask = _mm_loadu_si128(reinterpret_cast<const __m128i *>(
  446|   109k|      tables::base64::pshufb_combine_table + pop1 * 8));
  447|   109k|  __m128i answer = _mm_shuffle_epi8(pruned, compactmask);
  448|       |
  449|   109k|  _mm_storeu_si128(reinterpret_cast<__m128i *>(output), answer);
  450|   109k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6410copy_blockEPc:
  532|   146k|  simdutf_really_inline void copy_block(char *output) {
  533|   146k|    _mm256_storeu_si256(reinterpret_cast<__m256i *>(output), chunks[0]);
  534|   146k|    _mm256_storeu_si256(reinterpret_cast<__m256i *>(output + 32), chunks[1]);
  535|   146k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6424base64_decode_block_safeEPc:
  543|     28|  simdutf_really_inline void base64_decode_block_safe(char *out) {
  544|     28|    base64_decode(out, chunks[0]);
  545|     28|    alignas(32) char buffer[32]; // We enforce safety with a buffer.
  546|     28|    base64_decode(buffer, chunks[1]);
  547|     28|    std::memcpy(out + 24, buffer, 24);
  548|     28|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_113base64_decodeIvEEvPcDv4_x:
  466|   882k|simdutf_really_inline void base64_decode(char *out, __m256i str) {
  467|       |  // credit: aqrit
  468|   882k|  const __m256i pack_shuffle =
  469|   882k|      _mm256_setr_epi8(2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1,
  470|   882k|                       2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1);
  471|   882k|  const __m256i t0 = _mm256_maddubs_epi16(str, _mm256_set1_epi32(0x01400140));
  472|   882k|  const __m256i t1 = _mm256_madd_epi16(t0, _mm256_set1_epi32(0x00011000));
  473|   882k|  const __m256i t2 = _mm256_shuffle_epi8(t1, pack_shuffle);
  474|       |
  475|       |  // Store the output:
  476|   882k|  _mm_storeu_si128((__m128i *)out, _mm256_castsi256_si128(t2));
  477|       |  _mm_storeu_si128((__m128i *)(out + 12), _mm256_extracti128_si256(t2, 1));
  478|   882k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6419base64_decode_blockEPc:
  538|   155k|  simdutf_really_inline void base64_decode_block(char *out) {
  539|   155k|    base64_decode(out, chunks[0]);
  540|   155k|    base64_decode(out + 24, chunks[1]);
  541|   155k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_119base64_decode_blockIvEEvPcPKc:
  481|   285k|simdutf_really_inline void base64_decode_block(char *out, const char *src) {
  482|   285k|  base64_decode(out,
  483|   285k|                _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src)));
  484|   285k|  base64_decode(out + 24, _mm256_loadu_si256(
  485|   285k|                              reinterpret_cast<const __m256i *>(src + 32)));
  486|   285k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_124base64_decode_block_safeIvEEvPcPKc:
  490|    122|                                                    const char *src) {
  491|    122|  base64_decode(out,
  492|    122|                _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src)));
  493|    122|  alignas(32) char buffer[32]; // We enforce safety with a buffer.
  494|    122|  base64_decode(
  495|    122|      buffer, _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 32)));
  496|    122|  std::memcpy(out + 24, buffer, 24);
  497|    122|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb1ELb0ELb0EEEmPm:
  551|   131k|  simdutf_really_inline uint64_t to_base64_mask(uint64_t *error) {
  552|   131k|    uint32_t err0 = 0;
  553|   131k|    uint32_t err1 = 0;
  554|   131k|    uint64_t m0 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  555|   131k|        &chunks[0], &err0);
  556|   131k|    uint64_t m1 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  557|   131k|        &chunks[1], &err1);
  558|   131k|    if (!ignore_garbage) {
  ------------------
  |  Branch (558:9): [True: 131k, Folded]
  ------------------
  559|   131k|      *error = err0 | ((uint64_t)err1 << 32);
  560|   131k|    }
  561|   131k|    return m0 | (m1 << 32);
  562|   131k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb1ELb0ELb0EEEjPDv4_xPj:
  565|   262k|  simdutf_really_inline uint32_t to_base64_mask(__m256i *src, uint32_t *error) {
  566|   262k|    const __m256i ascii_space_tbl =
  567|   262k|        _mm256_setr_epi8(0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0xa,
  568|   262k|                         0x0, 0xc, 0xd, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0,
  569|   262k|                         0x0, 0x0, 0x0, 0x9, 0xa, 0x0, 0xc, 0xd, 0x0, 0x0);
  570|       |    // credit: aqrit
  571|   262k|    __m256i delta_asso;
  572|   262k|    if (default_or_url) {
  ------------------
  |  Branch (572:9): [Folded, False: 262k]
  ------------------
  573|      0|      delta_asso = _mm256_setr_epi8(
  574|      0|          0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
  575|      0|          0x00, 0x00, 0x11, 0x00, 0x16, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  576|      0|          0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x16);
  577|   262k|    } else if (base64_url) {
  ------------------
  |  Branch (577:16): [True: 262k, Folded]
  ------------------
  578|   262k|      delta_asso = _mm256_setr_epi8(0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0,
  579|   262k|                                    0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0xF, 0x1, 0x1,
  580|   262k|                                    0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0,
  581|   262k|                                    0x0, 0x0, 0xF, 0x0, 0xF);
  582|   262k|    } else {
  583|      0|      delta_asso = _mm256_setr_epi8(
  584|      0|          0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
  585|      0|          0x00, 0x00, 0x0F, 0x00, 0x0F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  586|      0|          0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x0F);
  587|      0|    }
  588|       |
  589|   262k|    __m256i delta_values;
  590|   262k|    if (default_or_url) {
  ------------------
  |  Branch (590:9): [Folded, False: 262k]
  ------------------
  591|      0|      delta_values = _mm256_setr_epi8(
  592|      0|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0x13),
  593|      0|          uint8_t(0x04), uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  594|      0|          uint8_t(0xB9), uint8_t(0x00), uint8_t(0xFF), uint8_t(0x11),
  595|      0|          uint8_t(0xFF), uint8_t(0xBF), uint8_t(0x10), uint8_t(0xB9),
  596|      0|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0x13),
  597|      0|          uint8_t(0x04), uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  598|      0|          uint8_t(0xB9), uint8_t(0x00), uint8_t(0xFF), uint8_t(0x11),
  599|      0|          uint8_t(0xFF), uint8_t(0xBF), uint8_t(0x10), uint8_t(0xB9));
  600|   262k|    } else if (base64_url) {
  ------------------
  |  Branch (600:16): [True: 262k, Folded]
  ------------------
  601|   262k|      delta_values = _mm256_setr_epi8(
  602|   262k|          0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  603|   262k|          uint8_t(0xB9), 0x0, 0x11, uint8_t(0xC3), uint8_t(0xBF), uint8_t(0xE0),
  604|   262k|          uint8_t(0xB9), uint8_t(0xB9), 0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF),
  605|   262k|          uint8_t(0xBF), uint8_t(0xB9), uint8_t(0xB9), 0x0, 0x11, uint8_t(0xC3),
  606|   262k|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0xB9));
  607|   262k|    } else {
  608|      0|      delta_values = _mm256_setr_epi8(
  609|      0|          int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13), int8_t(0x04),
  610|      0|          int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9), int8_t(0x00),
  611|      0|          int8_t(0x10), int8_t(0xC3), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9),
  612|      0|          int8_t(0xB9), int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13),
  613|      0|          int8_t(0x04), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9),
  614|      0|          int8_t(0x00), int8_t(0x10), int8_t(0xC3), int8_t(0xBF), int8_t(0xBF),
  615|      0|          int8_t(0xB9), int8_t(0xB9));
  616|      0|    }
  617|       |
  618|   262k|    __m256i check_asso;
  619|   262k|    if (default_or_url) {
  ------------------
  |  Branch (619:9): [Folded, False: 262k]
  ------------------
  620|      0|      check_asso = _mm256_setr_epi8(
  621|      0|          0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
  622|      0|          0x07, 0x0B, 0x0E, 0x0B, 0x06, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01,
  623|      0|          0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x0B, 0x0E, 0x0B, 0x06);
  624|   262k|    } else if (base64_url) {
  ------------------
  |  Branch (624:16): [True: 262k, Folded]
  ------------------
  625|   262k|      check_asso = _mm256_setr_epi8(0xD, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
  626|   262k|                                    0x1, 0x3, 0x7, 0xB, 0xE, 0xB, 0x6, 0xD, 0x1,
  627|   262k|                                    0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3,
  628|   262k|                                    0x7, 0xB, 0xE, 0xB, 0x6);
  629|   262k|    } else {
  630|      0|      check_asso = _mm256_setr_epi8(
  631|      0|          0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
  632|      0|          0x07, 0x0B, 0x0B, 0x0B, 0x0F, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01,
  633|      0|          0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x0B, 0x0B, 0x0B, 0x0F);
  634|      0|    }
  635|   262k|    __m256i check_values;
  636|   262k|    if (default_or_url) {
  ------------------
  |  Branch (636:9): [Folded, False: 262k]
  ------------------
  637|      0|      check_values = _mm256_setr_epi8(
  638|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  639|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xD5), uint8_t(0xA6),
  640|      0|          uint8_t(0xB5), uint8_t(0xA1), uint8_t(0x00), uint8_t(0x80),
  641|      0|          uint8_t(0x00), uint8_t(0x80), uint8_t(0x00), uint8_t(0x80),
  642|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  643|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xD5), uint8_t(0xA6),
  644|      0|          uint8_t(0xB5), uint8_t(0xA1), uint8_t(0x00), uint8_t(0x80),
  645|      0|          uint8_t(0x00), uint8_t(0x80), uint8_t(0x00), uint8_t(0x80));
  646|   262k|    } else if (base64_url) {
  ------------------
  |  Branch (646:16): [True: 262k, Folded]
  ------------------
  647|   262k|      check_values = _mm256_setr_epi8(
  648|   262k|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  649|   262k|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xB6), uint8_t(0xA6),
  650|   262k|          uint8_t(0xB5), uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0, uint8_t(0x80),
  651|   262k|          0x0, uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  652|   262k|          uint8_t(0x80), uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xB6),
  653|   262k|          uint8_t(0xA6), uint8_t(0xB5), uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0,
  654|   262k|          uint8_t(0x80), 0x0, uint8_t(0x80));
  655|   262k|    } else {
  656|      0|      check_values = _mm256_setr_epi8(
  657|      0|          int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0xCF),
  658|      0|          int8_t(0xBF), int8_t(0xD5), int8_t(0xA6), int8_t(0xB5), int8_t(0x86),
  659|      0|          int8_t(0xD1), int8_t(0x80), int8_t(0xB1), int8_t(0x80), int8_t(0x91),
  660|      0|          int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80),
  661|      0|          int8_t(0xCF), int8_t(0xBF), int8_t(0xD5), int8_t(0xA6), int8_t(0xB5),
  662|      0|          int8_t(0x86), int8_t(0xD1), int8_t(0x80), int8_t(0xB1), int8_t(0x80),
  663|      0|          int8_t(0x91), int8_t(0x80));
  664|      0|    }
  665|   262k|    const __m256i shifted = _mm256_srli_epi32(*src, 3);
  666|   262k|    __m256i delta_hash =
  667|   262k|        _mm256_avg_epu8(_mm256_shuffle_epi8(delta_asso, *src), shifted);
  668|   262k|    if (default_or_url) {
  ------------------
  |  Branch (668:9): [Folded, False: 262k]
  ------------------
  669|      0|      delta_hash = _mm256_and_si256(delta_hash, _mm256_set1_epi8(0xf));
  670|      0|    }
  671|   262k|    const __m256i check_hash =
  672|   262k|        _mm256_avg_epu8(_mm256_shuffle_epi8(check_asso, *src), shifted);
  673|   262k|    const __m256i out =
  674|   262k|        _mm256_adds_epi8(_mm256_shuffle_epi8(delta_values, delta_hash), *src);
  675|   262k|    const __m256i chk =
  676|   262k|        _mm256_adds_epi8(_mm256_shuffle_epi8(check_values, check_hash), *src);
  677|   262k|    const int mask = _mm256_movemask_epi8(chk);
  678|   262k|    if (!ignore_garbage && mask) {
  ------------------
  |  Branch (678:9): [True: 262k, Folded]
  |  Branch (678:28): [True: 98.3k, False: 164k]
  ------------------
  679|  98.3k|      __m256i ascii_space =
  680|  98.3k|          _mm256_cmpeq_epi8(_mm256_shuffle_epi8(ascii_space_tbl, *src), *src);
  681|  98.3k|      *error = (mask ^ _mm256_movemask_epi8(ascii_space));
  682|  98.3k|    }
  683|   262k|    *src = out;
  684|   262k|    return (uint32_t)mask;
  685|   262k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb0ELb0ELb0EEEmPm:
  551|   326k|  simdutf_really_inline uint64_t to_base64_mask(uint64_t *error) {
  552|   326k|    uint32_t err0 = 0;
  553|   326k|    uint32_t err1 = 0;
  554|   326k|    uint64_t m0 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  555|   326k|        &chunks[0], &err0);
  556|   326k|    uint64_t m1 = to_base64_mask<base64_url, ignore_garbage, default_or_url>(
  557|   326k|        &chunks[1], &err1);
  558|   326k|    if (!ignore_garbage) {
  ------------------
  |  Branch (558:9): [True: 326k, Folded]
  ------------------
  559|   326k|      *error = err0 | ((uint64_t)err1 << 32);
  560|   326k|    }
  561|   326k|    return m0 | (m1 << 32);
  562|   326k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block6414to_base64_maskILb0ELb0ELb0EEEjPDv4_xPj:
  565|   652k|  simdutf_really_inline uint32_t to_base64_mask(__m256i *src, uint32_t *error) {
  566|   652k|    const __m256i ascii_space_tbl =
  567|   652k|        _mm256_setr_epi8(0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9, 0xa,
  568|   652k|                         0x0, 0xc, 0xd, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0,
  569|   652k|                         0x0, 0x0, 0x0, 0x9, 0xa, 0x0, 0xc, 0xd, 0x0, 0x0);
  570|       |    // credit: aqrit
  571|   652k|    __m256i delta_asso;
  572|   652k|    if (default_or_url) {
  ------------------
  |  Branch (572:9): [Folded, False: 652k]
  ------------------
  573|      0|      delta_asso = _mm256_setr_epi8(
  574|      0|          0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
  575|      0|          0x00, 0x00, 0x11, 0x00, 0x16, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  576|      0|          0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x16);
  577|   652k|    } else if (base64_url) {
  ------------------
  |  Branch (577:16): [Folded, False: 652k]
  ------------------
  578|      0|      delta_asso = _mm256_setr_epi8(0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0,
  579|      0|                                    0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0xF, 0x1, 0x1,
  580|      0|                                    0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0,
  581|      0|                                    0x0, 0x0, 0xF, 0x0, 0xF);
  582|   652k|    } else {
  583|   652k|      delta_asso = _mm256_setr_epi8(
  584|   652k|          0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
  585|   652k|          0x00, 0x00, 0x0F, 0x00, 0x0F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
  586|   652k|          0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x0F);
  587|   652k|    }
  588|       |
  589|   652k|    __m256i delta_values;
  590|   652k|    if (default_or_url) {
  ------------------
  |  Branch (590:9): [Folded, False: 652k]
  ------------------
  591|      0|      delta_values = _mm256_setr_epi8(
  592|      0|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0x13),
  593|      0|          uint8_t(0x04), uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  594|      0|          uint8_t(0xB9), uint8_t(0x00), uint8_t(0xFF), uint8_t(0x11),
  595|      0|          uint8_t(0xFF), uint8_t(0xBF), uint8_t(0x10), uint8_t(0xB9),
  596|      0|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0x13),
  597|      0|          uint8_t(0x04), uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  598|      0|          uint8_t(0xB9), uint8_t(0x00), uint8_t(0xFF), uint8_t(0x11),
  599|      0|          uint8_t(0xFF), uint8_t(0xBF), uint8_t(0x10), uint8_t(0xB9));
  600|   652k|    } else if (base64_url) {
  ------------------
  |  Branch (600:16): [Folded, False: 652k]
  ------------------
  601|      0|      delta_values = _mm256_setr_epi8(
  602|      0|          0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF), uint8_t(0xBF), uint8_t(0xB9),
  603|      0|          uint8_t(0xB9), 0x0, 0x11, uint8_t(0xC3), uint8_t(0xBF), uint8_t(0xE0),
  604|      0|          uint8_t(0xB9), uint8_t(0xB9), 0x0, 0x0, 0x0, 0x13, 0x4, uint8_t(0xBF),
  605|      0|          uint8_t(0xBF), uint8_t(0xB9), uint8_t(0xB9), 0x0, 0x11, uint8_t(0xC3),
  606|      0|          uint8_t(0xBF), uint8_t(0xE0), uint8_t(0xB9), uint8_t(0xB9));
  607|   652k|    } else {
  608|   652k|      delta_values = _mm256_setr_epi8(
  609|   652k|          int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13), int8_t(0x04),
  610|   652k|          int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9), int8_t(0x00),
  611|   652k|          int8_t(0x10), int8_t(0xC3), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9),
  612|   652k|          int8_t(0xB9), int8_t(0x00), int8_t(0x00), int8_t(0x00), int8_t(0x13),
  613|   652k|          int8_t(0x04), int8_t(0xBF), int8_t(0xBF), int8_t(0xB9), int8_t(0xB9),
  614|   652k|          int8_t(0x00), int8_t(0x10), int8_t(0xC3), int8_t(0xBF), int8_t(0xBF),
  615|   652k|          int8_t(0xB9), int8_t(0xB9));
  616|   652k|    }
  617|       |
  618|   652k|    __m256i check_asso;
  619|   652k|    if (default_or_url) {
  ------------------
  |  Branch (619:9): [Folded, False: 652k]
  ------------------
  620|      0|      check_asso = _mm256_setr_epi8(
  621|      0|          0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
  622|      0|          0x07, 0x0B, 0x0E, 0x0B, 0x06, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01,
  623|      0|          0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x0B, 0x0E, 0x0B, 0x06);
  624|   652k|    } else if (base64_url) {
  ------------------
  |  Branch (624:16): [Folded, False: 652k]
  ------------------
  625|      0|      check_asso = _mm256_setr_epi8(0xD, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
  626|      0|                                    0x1, 0x3, 0x7, 0xB, 0xE, 0xB, 0x6, 0xD, 0x1,
  627|      0|                                    0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x3,
  628|      0|                                    0x7, 0xB, 0xE, 0xB, 0x6);
  629|   652k|    } else {
  630|   652k|      check_asso = _mm256_setr_epi8(
  631|   652k|          0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
  632|   652k|          0x07, 0x0B, 0x0B, 0x0B, 0x0F, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01,
  633|   652k|          0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x0B, 0x0B, 0x0B, 0x0F);
  634|   652k|    }
  635|   652k|    __m256i check_values;
  636|   652k|    if (default_or_url) {
  ------------------
  |  Branch (636:9): [Folded, False: 652k]
  ------------------
  637|      0|      check_values = _mm256_setr_epi8(
  638|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  639|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xD5), uint8_t(0xA6),
  640|      0|          uint8_t(0xB5), uint8_t(0xA1), uint8_t(0x00), uint8_t(0x80),
  641|      0|          uint8_t(0x00), uint8_t(0x80), uint8_t(0x00), uint8_t(0x80),
  642|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  643|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xD5), uint8_t(0xA6),
  644|      0|          uint8_t(0xB5), uint8_t(0xA1), uint8_t(0x00), uint8_t(0x80),
  645|      0|          uint8_t(0x00), uint8_t(0x80), uint8_t(0x00), uint8_t(0x80));
  646|   652k|    } else if (base64_url) {
  ------------------
  |  Branch (646:16): [Folded, False: 652k]
  ------------------
  647|      0|      check_values = _mm256_setr_epi8(
  648|      0|          uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  649|      0|          uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xB6), uint8_t(0xA6),
  650|      0|          uint8_t(0xB5), uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0, uint8_t(0x80),
  651|      0|          0x0, uint8_t(0x80), uint8_t(0x80), uint8_t(0x80), uint8_t(0x80),
  652|      0|          uint8_t(0x80), uint8_t(0xCF), uint8_t(0xBF), uint8_t(0xB6),
  653|      0|          uint8_t(0xA6), uint8_t(0xB5), uint8_t(0xA1), 0x0, uint8_t(0x80), 0x0,
  654|      0|          uint8_t(0x80), 0x0, uint8_t(0x80));
  655|   652k|    } else {
  656|   652k|      check_values = _mm256_setr_epi8(
  657|   652k|          int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0xCF),
  658|   652k|          int8_t(0xBF), int8_t(0xD5), int8_t(0xA6), int8_t(0xB5), int8_t(0x86),
  659|   652k|          int8_t(0xD1), int8_t(0x80), int8_t(0xB1), int8_t(0x80), int8_t(0x91),
  660|   652k|          int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80), int8_t(0x80),
  661|   652k|          int8_t(0xCF), int8_t(0xBF), int8_t(0xD5), int8_t(0xA6), int8_t(0xB5),
  662|   652k|          int8_t(0x86), int8_t(0xD1), int8_t(0x80), int8_t(0xB1), int8_t(0x80),
  663|   652k|          int8_t(0x91), int8_t(0x80));
  664|   652k|    }
  665|   652k|    const __m256i shifted = _mm256_srli_epi32(*src, 3);
  666|   652k|    __m256i delta_hash =
  667|   652k|        _mm256_avg_epu8(_mm256_shuffle_epi8(delta_asso, *src), shifted);
  668|   652k|    if (default_or_url) {
  ------------------
  |  Branch (668:9): [Folded, False: 652k]
  ------------------
  669|      0|      delta_hash = _mm256_and_si256(delta_hash, _mm256_set1_epi8(0xf));
  670|      0|    }
  671|   652k|    const __m256i check_hash =
  672|   652k|        _mm256_avg_epu8(_mm256_shuffle_epi8(check_asso, *src), shifted);
  673|   652k|    const __m256i out =
  674|   652k|        _mm256_adds_epi8(_mm256_shuffle_epi8(delta_values, delta_hash), *src);
  675|   652k|    const __m256i chk =
  676|   652k|        _mm256_adds_epi8(_mm256_shuffle_epi8(check_values, check_hash), *src);
  677|   652k|    const int mask = _mm256_movemask_epi8(chk);
  678|   652k|    if (!ignore_garbage && mask) {
  ------------------
  |  Branch (678:9): [True: 652k, Folded]
  |  Branch (678:28): [True: 89.6k, False: 562k]
  ------------------
  679|  89.6k|      __m256i ascii_space =
  680|  89.6k|          _mm256_cmpeq_epi8(_mm256_shuffle_epi8(ascii_space_tbl, *src), *src);
  681|  89.6k|      *error = (mask ^ _mm256_movemask_epi8(ascii_space));
  682|  89.6k|    }
  683|   652k|    *src = out;
  684|   652k|    return (uint32_t)mask;
  685|   652k|  }
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_17block64C2EPKDs:
  514|  65.8k|  simdutf_really_inline block64(const char16_t *src) {
  515|  65.8k|    const auto m1 = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src));
  516|  65.8k|    const auto m2 =
  517|  65.8k|        _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 16));
  518|  65.8k|    const auto m3 =
  519|  65.8k|        _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 32));
  520|  65.8k|    const auto m4 =
  521|  65.8k|        _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src + 48));
  522|       |
  523|  65.8k|    const auto m1p = _mm256_permute2x128_si256(m1, m2, 0x20);
  524|  65.8k|    const auto m2p = _mm256_permute2x128_si256(m1, m2, 0x31);
  525|  65.8k|    const auto m3p = _mm256_permute2x128_si256(m3, m4, 0x20);
  526|  65.8k|    const auto m4p = _mm256_permute2x128_si256(m3, m4, 0x31);
  527|       |
  528|  65.8k|    chunks[0] = _mm256_packus_epi16(m1p, m2p);
  529|  65.8k|    chunks[1] = _mm256_packus_epi16(m3p, m4p);
  530|  65.8k|  }

_ZNK7simdutf7haswell14implementation16base64_to_binaryEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1283|  1.26k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1284|  1.26k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1284:7): [True: 0, False: 1.26k]
  ------------------
 1285|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1285:9): [True: 0, False: 0]
  ------------------
 1286|      0|      return base64::compress_decode_base64<false, true, true>(
 1287|      0|          output, input, length, options, last_chunk_options);
 1288|      0|    } else {
 1289|      0|      return base64::compress_decode_base64<false, false, true>(
 1290|      0|          output, input, length, options, last_chunk_options);
 1291|      0|    }
 1292|  1.26k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1292:14): [True: 600, False: 663]
  ------------------
 1293|    600|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1293:9): [True: 0, False: 600]
  ------------------
 1294|      0|      return base64::compress_decode_base64<true, true, false>(
 1295|      0|          output, input, length, options, last_chunk_options);
 1296|    600|    } else {
 1297|    600|      return base64::compress_decode_base64<true, false, false>(
 1298|    600|          output, input, length, options, last_chunk_options);
 1299|    600|    }
 1300|    663|  } else {
 1301|    663|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1301:9): [True: 0, False: 663]
  ------------------
 1302|      0|      return base64::compress_decode_base64<false, true, false>(
 1303|      0|          output, input, length, options, last_chunk_options);
 1304|    663|    } else {
 1305|    663|      return base64::compress_decode_base64<false, false, false>(
 1306|    663|          output, input, length, options, last_chunk_options);
 1307|    663|    }
 1308|    663|  }
 1309|  1.26k|}
_ZNK7simdutf7haswell14implementation24base64_to_binary_detailsEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1313|  1.26k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1314|  1.26k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1314:7): [True: 0, False: 1.26k]
  ------------------
 1315|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1315:9): [True: 0, False: 0]
  ------------------
 1316|      0|      return base64::compress_decode_base64<false, true, true>(
 1317|      0|          output, input, length, options, last_chunk_options);
 1318|      0|    } else {
 1319|      0|      return base64::compress_decode_base64<false, false, true>(
 1320|      0|          output, input, length, options, last_chunk_options);
 1321|      0|    }
 1322|  1.26k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1322:14): [True: 600, False: 663]
  ------------------
 1323|    600|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1323:9): [True: 0, False: 600]
  ------------------
 1324|      0|      return base64::compress_decode_base64<true, true, false>(
 1325|      0|          output, input, length, options, last_chunk_options);
 1326|    600|    } else {
 1327|    600|      return base64::compress_decode_base64<true, false, false>(
 1328|    600|          output, input, length, options, last_chunk_options);
 1329|    600|    }
 1330|    663|  } else {
 1331|    663|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1331:9): [True: 0, False: 663]
  ------------------
 1332|      0|      return base64::compress_decode_base64<false, true, false>(
 1333|      0|          output, input, length, options, last_chunk_options);
 1334|    663|    } else {
 1335|    663|      return base64::compress_decode_base64<false, false, false>(
 1336|    663|          output, input, length, options, last_chunk_options);
 1337|    663|    }
 1338|    663|  }
 1339|  1.26k|}
_ZNK7simdutf7haswell14implementation16base64_to_binaryEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1343|  1.30k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1344|  1.30k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1344:7): [True: 0, False: 1.30k]
  ------------------
 1345|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1345:9): [True: 0, False: 0]
  ------------------
 1346|      0|      return base64::compress_decode_base64<false, true, true>(
 1347|      0|          output, input, length, options, last_chunk_options);
 1348|      0|    } else {
 1349|      0|      return base64::compress_decode_base64<false, false, true>(
 1350|      0|          output, input, length, options, last_chunk_options);
 1351|      0|    }
 1352|  1.30k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1352:14): [True: 627, False: 681]
  ------------------
 1353|    627|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1353:9): [True: 0, False: 627]
  ------------------
 1354|      0|      return base64::compress_decode_base64<true, true, false>(
 1355|      0|          output, input, length, options, last_chunk_options);
 1356|    627|    } else {
 1357|    627|      return base64::compress_decode_base64<true, false, false>(
 1358|    627|          output, input, length, options, last_chunk_options);
 1359|    627|    }
 1360|    681|  } else {
 1361|    681|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1361:9): [True: 0, False: 681]
  ------------------
 1362|      0|      return base64::compress_decode_base64<false, true, false>(
 1363|      0|          output, input, length, options, last_chunk_options);
 1364|    681|    } else {
 1365|    681|      return base64::compress_decode_base64<false, false, false>(
 1366|    681|          output, input, length, options, last_chunk_options);
 1367|    681|    }
 1368|    681|  }
 1369|  1.30k|}
_ZNK7simdutf7haswell14implementation24base64_to_binary_detailsEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1373|  1.30k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1374|  1.30k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1374:7): [True: 0, False: 1.30k]
  ------------------
 1375|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1375:9): [True: 0, False: 0]
  ------------------
 1376|      0|      return base64::compress_decode_base64<false, true, true>(
 1377|      0|          output, input, length, options, last_chunk_options);
 1378|      0|    } else {
 1379|      0|      return base64::compress_decode_base64<false, false, true>(
 1380|      0|          output, input, length, options, last_chunk_options);
 1381|      0|    }
 1382|  1.30k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1382:14): [True: 627, False: 681]
  ------------------
 1383|    627|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1383:9): [True: 0, False: 627]
  ------------------
 1384|      0|      return base64::compress_decode_base64<true, true, false>(
 1385|      0|          output, input, length, options, last_chunk_options);
 1386|    627|    } else {
 1387|    627|      return base64::compress_decode_base64<true, false, false>(
 1388|    627|          output, input, length, options, last_chunk_options);
 1389|    627|    }
 1390|    681|  } else {
 1391|    681|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1391:9): [True: 0, False: 681]
  ------------------
 1392|      0|      return base64::compress_decode_base64<false, true, false>(
 1393|      0|          output, input, length, options, last_chunk_options);
 1394|    681|    } else {
 1395|    681|      return base64::compress_decode_base64<false, false, false>(
 1396|    681|          output, input, length, options, last_chunk_options);
 1397|    681|    }
 1398|    681|  }
 1399|  1.30k|}

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

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

simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_110count_onesEm:
   14|   173k|simdutf_really_inline long long int count_ones(uint64_t input_num) {
   15|       |  return _popcnt64(input_num);
   16|   173k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_115trailing_zeroesEm:
   20|   108k|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|   108k|  return __builtin_ctzll(input_num);
   25|   108k|  #endif // SIMDUTF_REGULAR_VISUAL_STUDIO
   26|   108k|}
simdutf.cpp:_ZN7simdutf7haswell12_GLOBAL__N_115is_power_of_twoImEEbT_:
   29|   154k|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|   190k|simdutf_really_inline long long int count_ones(uint64_t input_num) {
   15|       |  return _popcnt64(input_num);
   16|   190k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115trailing_zeroesEm:
   20|   108k|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|   108k|  return __builtin_ctzll(input_num);
   27|   108k|  #endif // SIMDUTF_REGULAR_VISUAL_STUDIO
   28|   108k|}
simdutf.cpp:_ZN7simdutf8westmere12_GLOBAL__N_115is_power_of_twoImEEbT_:
   31|   154k|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:
 1314|  1.26k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1315|  1.26k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1315:7): [True: 0, False: 1.26k]
  ------------------
 1316|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1316:9): [True: 0, False: 0]
  ------------------
 1317|      0|      return base64::compress_decode_base64<false, true, true>(
 1318|      0|          output, input, length, options, last_chunk_options);
 1319|      0|    } else {
 1320|      0|      return base64::compress_decode_base64<false, false, true>(
 1321|      0|          output, input, length, options, last_chunk_options);
 1322|      0|    }
 1323|  1.26k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1323:14): [True: 600, False: 663]
  ------------------
 1324|    600|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1324:9): [True: 0, False: 600]
  ------------------
 1325|      0|      return base64::compress_decode_base64<true, true, false>(
 1326|      0|          output, input, length, options, last_chunk_options);
 1327|    600|    } else {
 1328|    600|      return base64::compress_decode_base64<true, false, false>(
 1329|    600|          output, input, length, options, last_chunk_options);
 1330|    600|    }
 1331|    663|  } else {
 1332|    663|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1332:9): [True: 0, False: 663]
  ------------------
 1333|      0|      return base64::compress_decode_base64<false, true, false>(
 1334|      0|          output, input, length, options, last_chunk_options);
 1335|    663|    } else {
 1336|    663|      return base64::compress_decode_base64<false, false, false>(
 1337|    663|          output, input, length, options, last_chunk_options);
 1338|    663|    }
 1339|    663|  }
 1340|  1.26k|}
_ZNK7simdutf8westmere14implementation24base64_to_binary_detailsEPKcmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1344|  1.26k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1345|  1.26k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1345:7): [True: 0, False: 1.26k]
  ------------------
 1346|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1346:9): [True: 0, False: 0]
  ------------------
 1347|      0|      return base64::compress_decode_base64<false, true, true>(
 1348|      0|          output, input, length, options, last_chunk_options);
 1349|      0|    } else {
 1350|      0|      return base64::compress_decode_base64<false, false, true>(
 1351|      0|          output, input, length, options, last_chunk_options);
 1352|      0|    }
 1353|  1.26k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1353:14): [True: 600, False: 663]
  ------------------
 1354|    600|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1354:9): [True: 0, False: 600]
  ------------------
 1355|      0|      return base64::compress_decode_base64<true, true, false>(
 1356|      0|          output, input, length, options, last_chunk_options);
 1357|    600|    } else {
 1358|    600|      return base64::compress_decode_base64<true, false, false>(
 1359|    600|          output, input, length, options, last_chunk_options);
 1360|    600|    }
 1361|    663|  } else {
 1362|    663|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1362:9): [True: 0, False: 663]
  ------------------
 1363|      0|      return base64::compress_decode_base64<false, true, false>(
 1364|      0|          output, input, length, options, last_chunk_options);
 1365|    663|    } else {
 1366|    663|      return base64::compress_decode_base64<false, false, false>(
 1367|    663|          output, input, length, options, last_chunk_options);
 1368|    663|    }
 1369|    663|  }
 1370|  1.26k|}
_ZNK7simdutf8westmere14implementation16base64_to_binaryEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1374|  1.30k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1375|  1.30k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1375:7): [True: 0, False: 1.30k]
  ------------------
 1376|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1376:9): [True: 0, False: 0]
  ------------------
 1377|      0|      return base64::compress_decode_base64<false, true, true>(
 1378|      0|          output, input, length, options, last_chunk_options);
 1379|      0|    } else {
 1380|      0|      return base64::compress_decode_base64<false, false, true>(
 1381|      0|          output, input, length, options, last_chunk_options);
 1382|      0|    }
 1383|  1.30k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1383:14): [True: 627, False: 681]
  ------------------
 1384|    627|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1384:9): [True: 0, False: 627]
  ------------------
 1385|      0|      return base64::compress_decode_base64<true, true, false>(
 1386|      0|          output, input, length, options, last_chunk_options);
 1387|    627|    } else {
 1388|    627|      return base64::compress_decode_base64<true, false, false>(
 1389|    627|          output, input, length, options, last_chunk_options);
 1390|    627|    }
 1391|    681|  } else {
 1392|    681|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1392:9): [True: 0, False: 681]
  ------------------
 1393|      0|      return base64::compress_decode_base64<false, true, false>(
 1394|      0|          output, input, length, options, last_chunk_options);
 1395|    681|    } else {
 1396|    681|      return base64::compress_decode_base64<false, false, false>(
 1397|    681|          output, input, length, options, last_chunk_options);
 1398|    681|    }
 1399|    681|  }
 1400|  1.30k|}
_ZNK7simdutf8westmere14implementation24base64_to_binary_detailsEPKDsmPcNS_14base64_optionsENS_27last_chunk_handling_optionsE:
 1404|  1.30k|    last_chunk_handling_options last_chunk_options) const noexcept {
 1405|  1.30k|  if (options & base64_default_or_url) {
  ------------------
  |  Branch (1405:7): [True: 0, False: 1.30k]
  ------------------
 1406|      0|    if (options == base64_options::base64_default_or_url_accept_garbage) {
  ------------------
  |  Branch (1406:9): [True: 0, False: 0]
  ------------------
 1407|      0|      return base64::compress_decode_base64<false, true, true>(
 1408|      0|          output, input, length, options, last_chunk_options);
 1409|      0|    } else {
 1410|      0|      return base64::compress_decode_base64<false, false, true>(
 1411|      0|          output, input, length, options, last_chunk_options);
 1412|      0|    }
 1413|  1.30k|  } else if (options & base64_url) {
  ------------------
  |  Branch (1413:14): [True: 627, False: 681]
  ------------------
 1414|    627|    if (options == base64_options::base64_url_accept_garbage) {
  ------------------
  |  Branch (1414:9): [True: 0, False: 627]
  ------------------
 1415|      0|      return base64::compress_decode_base64<true, true, false>(
 1416|      0|          output, input, length, options, last_chunk_options);
 1417|    627|    } else {
 1418|    627|      return base64::compress_decode_base64<true, false, false>(
 1419|    627|          output, input, length, options, last_chunk_options);
 1420|    627|    }
 1421|    681|  } else {
 1422|    681|    if (options == base64_options::base64_default_accept_garbage) {
  ------------------
  |  Branch (1422:9): [True: 0, False: 681]
  ------------------
 1423|      0|      return base64::compress_decode_base64<false, true, false>(
 1424|      0|          output, input, length, options, last_chunk_options);
 1425|    681|    } else {
 1426|    681|      return base64::compress_decode_base64<false, false, false>(
 1427|    681|          output, input, length, options, last_chunk_options);
 1428|    681|    }
 1429|    681|  }
 1430|  1.30k|}

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

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

