LLVMFuzzerTestOneInput:
    7|  10.5k|{
    8|       |   // non-null terminated
    9|  10.5k|   {
   10|  10.5k|      const std::vector<char> buffer{Data, Data + Size};
   11|       |
   12|  10.5k|      static constexpr glz::opts opts{.null_terminated = false};
   13|  10.5k|      glz::generic json{};
   14|  10.5k|      auto ec = glz::read<opts>(json, buffer);
   15|  10.5k|      if (!ec) {
  ------------------
  |  Branch (15:11): [True: 2.67k, False: 7.86k]
  ------------------
   16|  2.67k|         [[maybe_unused]] auto s = json.size();
   17|  2.67k|      }
   18|  10.5k|   }
   19|       |
   20|       |   // use a vector with null termination instead of a std::string to avoid
   21|       |   // small string optimization to hide bounds problems
   22|  10.5k|   std::vector<char> buffer{Data, Data + Size};
   23|  10.5k|   buffer.push_back('\0');
   24|       |
   25|       |   // const qualified input buffer
   26|  10.5k|   {
   27|  10.5k|      const auto& input = buffer;
   28|  10.5k|      glz::generic json{};
   29|  10.5k|      auto ec = glz::read_json(json, input);
   30|  10.5k|      if (!ec) {
  ------------------
  |  Branch (30:11): [True: 2.67k, False: 7.86k]
  ------------------
   31|  2.67k|         [[maybe_unused]] auto s = json.size();
   32|  2.67k|      }
   33|  10.5k|   }
   34|       |
   35|       |   // non-const input buffer
   36|  10.5k|   {
   37|  10.5k|      glz::generic json{};
   38|  10.5k|      auto ec = glz::read_json(json, buffer);
   39|  10.5k|      if (!ec) {
  ------------------
  |  Branch (39:11): [True: 2.67k, False: 7.86k]
  ------------------
   40|  2.67k|         [[maybe_unused]] auto s = json.size();
   41|  2.67k|      }
   42|  10.5k|   }
   43|       |
   44|  10.5k|   return 0;
   45|  10.5k|}

_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEED2Ev:
  569|   164k|      {
  570|   164k|         free_data();
  571|   164k|         free_index();
  572|   164k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE9free_dataEv:
  266|   164k|      {
  267|   164k|         destroy_all();
  268|   164k|         ::operator delete(data_);
  269|   164k|         data_ = nullptr;
  270|   164k|         size_ = 0;
  271|   164k|         capacity_ = 0;
  272|   164k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE11destroy_allEv:
  259|   438k|      {
  260|  7.26M|         for (uint32_t i = 0; i < size_; ++i) {
  ------------------
  |  Branch (260:31): [True: 6.82M, False: 438k]
  ------------------
  261|  6.82M|            std::destroy_at(data_ + i);
  262|  6.82M|         }
  263|   438k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE10free_indexEv:
  308|   164k|      {
  309|   164k|         std::free(index_);
  310|   164k|         index_ = nullptr;
  311|   164k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEEC2Ev:
  566|  78.2k|      ordered_small_map() = default;
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEEC2EOS4_:
  610|  86.4k|         : data_(other.data_), size_(other.size_), capacity_(other.capacity_), index_(other.index_)
  611|  86.4k|      {
  612|  86.4k|         other.data_ = nullptr;
  613|  86.4k|         other.size_ = 0;
  614|  86.4k|         other.capacity_ = 0;
  615|  86.4k|         other.index_ = nullptr;
  616|  86.4k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEEixERKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  932|  3.28M|      {
  933|  3.28M|         return subscript_or_insert(key, [&] { emplace_back_impl(key, mapped_type{}); });
  934|  3.28M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE19subscript_or_insertINSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEZNS4_ixERKSC_EUlvE_EERS3_RKT_OT0_:
  491|  3.28M|      {
  492|  3.28M|         if (size_ <= linear_search_threshold) {
  ------------------
  |  Branch (492:14): [True: 546k, False: 2.74M]
  ------------------
  493|   546k|            auto it = linear_find(key);
  494|   546k|            if (it != end()) return it->second;
  ------------------
  |  Branch (494:17): [True: 26.6k, False: 519k]
  ------------------
  495|   519k|            append_fn();
  496|   519k|            return data_[size_ - 1].second;
  497|   546k|         }
  498|       |
  499|  2.74M|         const uint32_t h = hash_key(key);
  500|  2.74M|         if (try_bloom_insert(h, append_fn)) {
  ------------------
  |  Branch (500:14): [True: 1.95M, False: 782k]
  ------------------
  501|  1.95M|            return data_[size_ - 1].second;
  502|  1.95M|         }
  503|       |
  504|   782k|         auto [it, pos, _] = index_find_or_pos(key, h);
  505|   782k|         if (it != end()) return it->second;
  ------------------
  |  Branch (505:14): [True: 594k, False: 188k]
  ------------------
  506|       |
  507|   188k|         append_fn();
  508|   188k|         bloom_set(h);
  509|   188k|         if (index_size() > 0) {
  ------------------
  |  Branch (509:14): [True: 188k, False: 0]
  ------------------
  510|   188k|            const uint32_t n = index_->size;
  511|   188k|            ensure_index_capacity(static_cast<size_type>(n) + 1);
  512|   188k|            auto* entries = index_entries();
  513|   188k|            if (pos < n) {
  ------------------
  |  Branch (513:17): [True: 183k, False: 4.74k]
  ------------------
  514|   183k|               std::memmove(entries + pos + 1, entries + pos, (n - pos) * sizeof(hash_index_entry));
  515|   183k|            }
  516|   188k|            entries[pos] = {h, size_ - 1};
  517|   188k|            index_->size = size_;
  518|   188k|         }
  519|   188k|         return data_[size_ - 1].second;
  520|   782k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE11linear_findINSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEEEPNS6_4pairISC_S3_EERKT_:
  421|   546k|      {
  422|  2.56M|         for (uint32_t i = 0; i < size_; ++i) {
  ------------------
  |  Branch (422:31): [True: 2.04M, False: 519k]
  ------------------
  423|  2.04M|            if (data_[i].first == key) return data_ + i;
  ------------------
  |  Branch (423:17): [True: 26.6k, False: 2.01M]
  ------------------
  424|  2.04M|         }
  425|   519k|         return data_ + size_;
  426|   546k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE3endEv:
  649|  1.32M|      iterator end() noexcept { return data_ + size_; }
_ZZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEEixERKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEENKUlvE_clEv:
  933|  2.66M|         return subscript_or_insert(key, [&] { emplace_back_impl(key, mapped_type{}); });
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE17emplace_back_implIJRKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEES3_EEEvDpOT_:
  243|  2.66M|      {
  244|  2.66M|         grow_if_needed();
  245|  2.66M|         std::construct_at(data_ + size_, std::forward<Args>(args)...);
  246|  2.66M|         ++size_;
  247|  2.66M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE14grow_if_neededEv:
  217|  2.66M|      {
  218|  2.66M|         if (size_ == capacity_) {
  ------------------
  |  Branch (218:14): [True: 273k, False: 2.39M]
  ------------------
  219|   273k|            if (size_ == max_u32) {
  ------------------
  |  Branch (219:17): [True: 0, False: 273k]
  ------------------
  220|      0|               throw_capacity_overflow();
  221|      0|            }
  222|   273k|            const uint32_t new_cap = next_data_capacity(capacity_);
  223|   273k|            reallocate_data(new_cap);
  224|   273k|         }
  225|  2.66M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE18next_data_capacityEj:
  120|   273k|      {
  121|   273k|         if (current == 0) return 4;
  ------------------
  |  Branch (121:14): [True: 70.9k, False: 202k]
  ------------------
  122|   202k|         if (current > (max_u32 / 2)) return max_u32;
  ------------------
  |  Branch (122:14): [True: 0, False: 202k]
  ------------------
  123|   202k|         return current * 2;
  124|   202k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE15reallocate_dataEj:
  205|   273k|      {
  206|   273k|         if (new_cap < size_) {
  ------------------
  |  Branch (206:14): [True: 0, False: 273k]
  ------------------
  207|      0|            throw_capacity_overflow();
  208|      0|         }
  209|   273k|         auto* new_data = allocate_and_relocate(new_cap);
  210|   273k|         destroy_all();
  211|   273k|         ::operator delete(data_);
  212|   273k|         data_ = new_data;
  213|   273k|         capacity_ = new_cap;
  214|   273k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE21allocate_and_relocateEj:
  159|   273k|      {
  160|   273k|         auto* new_data = static_cast<value_type*>(::operator new(checked_data_allocation_bytes(new_cap)));
  161|   273k|#if __cpp_exceptions
  162|   273k|         uint32_t constructed = 0;
  163|   273k|         try {
  164|  4.43M|            for (; constructed < size_; ++constructed) {
  ------------------
  |  Branch (164:20): [True: 4.15M, False: 273k]
  ------------------
  165|  4.15M|               std::construct_at(new_data + constructed, std::move_if_noexcept(data_[constructed]));
  166|  4.15M|            }
  167|   273k|         }
  168|   273k|         catch (...) {
  169|      0|            destroy_range(new_data, constructed);
  170|      0|            ::operator delete(new_data);
  171|      0|            throw;
  172|      0|         }
  173|       |#else
  174|       |         for (uint32_t i = 0; i < size_; ++i) {
  175|       |            std::construct_at(new_data + i, std::move_if_noexcept(data_[i]));
  176|       |         }
  177|       |#endif
  178|   273k|         return new_data;
  179|   273k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE29checked_data_allocation_bytesEj:
  134|   273k|      {
  135|   273k|         if (count > ((std::numeric_limits<size_t>::max)() / sizeof(value_type))) {
  ------------------
  |  Branch (135:14): [True: 0, False: 273k]
  ------------------
  136|      0|            GLZ_THROW_OR_ABORT(std::bad_alloc{});
  ------------------
  |  |    8|      0|#define GLZ_THROW_OR_ABORT(EXC) (throw(EXC))
  ------------------
  137|      0|         }
  138|   273k|         return static_cast<size_t>(count) * sizeof(value_type);
  139|   273k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE8hash_keyENSt3__117basic_string_viewIcNS5_11char_traitsIcEEEE:
   97|  10.1M|      static uint32_t hash_key(std::string_view key) noexcept { return sweethash::sweet32(key); }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE16try_bloom_insertIRZNS4_ixERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEEUlvE_EEbjOT_:
  529|  2.74M|      {
  530|  2.74M|         if (index_ && size_ <= bloom_threshold && !bloom_maybe_contains(h)) {
  ------------------
  |  Branch (530:14): [True: 2.68M, False: 54.4k]
  |  Branch (530:24): [True: 2.54M, False: 144k]
  |  Branch (530:52): [True: 1.95M, False: 583k]
  ------------------
  531|       |            // Definitely not present — skip the search
  532|  1.95M|            append_fn();
  533|  1.95M|            bloom_set(h);
  534|       |            // Index is now stale (index_->size < size_), will rebuild on next lookup or false positive
  535|  1.95M|            return true;
  536|  1.95M|         }
  537|   782k|         return false;
  538|  2.74M|      }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE20bloom_maybe_containsEj:
  285|  2.54M|      {
  286|  2.54M|         const uint32_t a = h & bloom_mask;
  287|  2.54M|         const uint32_t b = (h >> 10) & bloom_mask;
  288|  2.54M|         return (index_->bloom[a >> 3] & (uint8_t(1) << (a & 7))) && (index_->bloom[b >> 3] & (uint8_t(1) << (b & 7)));
  ------------------
  |  Branch (288:17): [True: 758k, False: 1.78M]
  |  Branch (288:70): [True: 583k, False: 175k]
  ------------------
  289|  2.54M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE17index_find_or_posINSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEEENS4_17index_find_resultERKT_j:
  400|   782k|      {
  401|   782k|         ensure_index();
  402|       |
  403|   782k|         const auto* base = index_entries();
  404|   782k|         const auto* idx_end = base + index_->size;
  405|   782k|         const auto* p = branchless_lower_bound(base, index_->size, h);
  406|   782k|         const size_t pos = static_cast<size_t>(p - base);
  407|       |
  408|       |         // Scan adjacent entries with matching hash
  409|   804k|         for (auto* scan = p; scan != idx_end && scan->key_hash == h; ++scan) {
  ------------------
  |  Branch (409:31): [True: 799k, False: 4.75k]
  |  Branch (409:50): [True: 616k, False: 183k]
  ------------------
  410|   616k|            if (data_[scan->index].first == key) {
  ------------------
  |  Branch (410:17): [True: 594k, False: 22.2k]
  ------------------
  411|   594k|               return {data_ + scan->index, pos, h};
  412|   594k|            }
  413|   616k|         }
  414|       |
  415|   188k|         return {data_ + size_, pos, h};
  416|   782k|      }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE12ensure_indexEv:
  360|   782k|      {
  361|   782k|         if (size_ <= linear_search_threshold) return;
  ------------------
  |  Branch (361:14): [True: 0, False: 782k]
  ------------------
  362|   782k|         const auto current = index_size();
  363|   782k|         if (current == size_) return; // fully current
  ------------------
  |  Branch (363:14): [True: 477k, False: 305k]
  ------------------
  364|       |
  365|   305k|         if (current == 0 || (size_ - current) > linear_search_threshold) {
  ------------------
  |  Branch (365:14): [True: 54.4k, False: 250k]
  |  Branch (365:30): [True: 111k, False: 139k]
  ------------------
  366|   165k|            rebuild_index(); // full rebuild
  367|   165k|            return;
  368|   165k|         }
  369|       |
  370|       |         // Incrementally insert-sort the few new entries
  371|   441k|         for (uint32_t i = current; i < size_; ++i) {
  ------------------
  |  Branch (371:37): [True: 302k, False: 139k]
  ------------------
  372|   302k|            const hash_index_entry entry{hash_key(data_[i].first), i};
  373|   302k|            const auto* base = index_entries();
  374|   302k|            const auto* p = branchless_lower_bound(base, index_->size, entry.key_hash);
  375|   302k|            auto pos = static_cast<size_t>(p - base);
  376|       |
  377|   302k|            const uint32_t m = index_->size;
  378|   302k|            ensure_index_capacity(static_cast<size_type>(m) + 1);
  379|   302k|            auto* entries = index_entries();
  380|   302k|            if (pos < m) {
  ------------------
  |  Branch (380:17): [True: 292k, False: 9.90k]
  ------------------
  381|   292k|               std::memmove(entries + pos + 1, entries + pos, (m - pos) * sizeof(hash_index_entry));
  382|   292k|            }
  383|   302k|            entries[pos] = entry;
  384|   302k|            index_->size = i + 1;
  385|   302k|         }
  386|   139k|      }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE13rebuild_indexEv:
  343|   165k|      {
  344|   165k|         ensure_index_capacity(static_cast<size_type>(size_));
  345|   165k|         bloom_clear();
  346|   165k|         auto* entries = index_entries();
  347|  7.25M|         for (uint32_t i = 0; i < size_; ++i) {
  ------------------
  |  Branch (347:31): [True: 7.08M, False: 165k]
  ------------------
  348|  7.08M|            const uint32_t h = hash_key(data_[i].first);
  349|  7.08M|            entries[i] = {h, i};
  350|  7.08M|            bloom_set(h);
  351|  7.08M|         }
  352|   165k|         std::sort(entries, entries + size_, [](const auto& a, const auto& b) { return a.key_hash < b.key_hash; });
  353|   165k|         index_->size = size_;
  354|   165k|      }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE11bloom_clearEv:
  291|   165k|      void bloom_clear() const noexcept { std::memset(index_->bloom, 0, bloom_bytes); }
_ZZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE13rebuild_indexEvENKUlRKT_RKT0_E_clINS4_16hash_index_entryESD_EEDaS7_SA_:
  352|  49.6M|         std::sort(entries, entries + size_, [](const auto& a, const auto& b) { return a.key_hash < b.key_hash; });
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE22branchless_lower_boundEPKNS4_16hash_index_entryEmj:
  440|  1.08M|      {
  441|  7.99M|         while (len > 1) {
  ------------------
  |  Branch (441:17): [True: 6.91M, False: 1.08M]
  ------------------
  442|  6.91M|            size_t half = len / 2;
  443|  6.91M|            p += (p[half - 1].key_hash < target) * half;
  444|  6.91M|            len -= half;
  445|  6.91M|         }
  446|       |         // Final element check: advance past it if it's less than target
  447|  1.08M|         p += (len == 1 && p->key_hash < target);
  ------------------
  |  Branch (447:16): [True: 1.08M, False: 0]
  |  Branch (447:28): [True: 14.6k, False: 1.07M]
  ------------------
  448|  1.08M|         return p;
  449|  1.08M|      }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE9bloom_setEj:
  277|  9.23M|      {
  278|  9.23M|         const uint32_t a = h & bloom_mask;
  279|  9.23M|         const uint32_t b = (h >> 10) & bloom_mask;
  280|  9.23M|         index_->bloom[a >> 3] |= uint8_t(1) << (a & 7);
  281|  9.23M|         index_->bloom[b >> 3] |= uint8_t(1) << (b & 7);
  282|  9.23M|      }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE10index_sizeEv:
  300|   970k|      uint32_t index_size() const noexcept { return index_ ? index_->size : 0; }
  ------------------
  |  Branch (300:53): [True: 916k, False: 54.4k]
  ------------------
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE21ensure_index_capacityEm:
  314|   656k|      {
  315|   656k|         if (needed == 0) return;
  ------------------
  |  Branch (315:14): [True: 0, False: 656k]
  ------------------
  316|   656k|         if (needed > static_cast<size_type>(max_u32)) {
  ------------------
  |  Branch (316:14): [True: 0, False: 656k]
  ------------------
  317|      0|            throw_index_overflow();
  318|      0|         }
  319|   656k|         const auto needed_u32 = static_cast<uint32_t>(needed);
  320|   656k|         if (index_ && index_->capacity >= needed_u32) return;
  ------------------
  |  Branch (320:14): [True: 602k, False: 54.4k]
  |  Branch (320:24): [True: 517k, False: 85.1k]
  ------------------
  321|   139k|         uint32_t cap = index_ ? index_->capacity : 0;
  ------------------
  |  Branch (321:25): [True: 85.1k, False: 54.4k]
  ------------------
  322|   283k|         while (cap < needed_u32) {
  ------------------
  |  Branch (322:17): [True: 143k, False: 139k]
  ------------------
  323|   143k|            const uint32_t next = next_index_capacity(cap);
  324|   143k|            if (next <= cap) {
  ------------------
  |  Branch (324:17): [True: 0, False: 143k]
  ------------------
  325|      0|               throw_index_overflow();
  326|      0|            }
  327|   143k|            cap = next;
  328|   143k|         }
  329|   139k|         auto* block = static_cast<index_header*>(std::realloc(index_, checked_index_allocation_bytes(cap)));
  330|   139k|         if (!block) GLZ_THROW_OR_ABORT(std::bad_alloc{});
  ------------------
  |  |    8|      0|#define GLZ_THROW_OR_ABORT(EXC) (throw(EXC))
  ------------------
  |  Branch (330:14): [True: 0, False: 139k]
  ------------------
  331|   139k|         if (!index_) {
  ------------------
  |  Branch (331:14): [True: 54.4k, False: 85.1k]
  ------------------
  332|  54.4k|            block->size = 0;
  333|  54.4k|            std::memset(block->bloom, 0, bloom_bytes);
  334|  54.4k|         }
  335|   139k|         block->capacity = cap;
  336|   139k|         index_ = block;
  337|   139k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE19next_index_capacityEj:
  127|   143k|      {
  128|   143k|         if (current == 0) return 16;
  ------------------
  |  Branch (128:14): [True: 54.4k, False: 89.5k]
  ------------------
  129|  89.5k|         if (current > (max_u32 / 2)) return max_u32;
  ------------------
  |  Branch (129:14): [True: 0, False: 89.5k]
  ------------------
  130|  89.5k|         return current * 2;
  131|  89.5k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE30checked_index_allocation_bytesEj:
  142|   139k|      {
  143|   139k|         constexpr size_t header = sizeof(index_header);
  144|   139k|         constexpr size_t entry = sizeof(hash_index_entry);
  145|   139k|         if (count > (((std::numeric_limits<size_t>::max)() - header) / entry)) {
  ------------------
  |  Branch (145:14): [True: 0, False: 139k]
  ------------------
  146|      0|            GLZ_THROW_OR_ABORT(std::bad_alloc{});
  ------------------
  |  |    8|      0|#define GLZ_THROW_OR_ABORT(EXC) (throw(EXC))
  ------------------
  147|      0|         }
  148|   139k|         return header + static_cast<size_t>(count) * entry;
  149|   139k|      }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE13index_entriesEv:
  296|  1.74M|      {
  297|  1.74M|         return static_cast<hash_index_entry*>(static_cast<void*>(index_ + 1));
  298|  1.74M|      }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE4sizeEv:
  663|     12|      size_type size() const noexcept { return size_; }

_ZN3glz15resize_unfilledINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEEvRT_m:
   63|  3.31M|   {
   64|  3.31M|      if constexpr (requires { b.resize_and_overwrite(n, [](auto*, size_t written) { return written; }); }) {
   65|  3.31M|         b.resize_and_overwrite(n, [](auto*, size_t written) noexcept { return written; });
   66|       |      }
   67|       |      else {
   68|       |         b.resize(n);
   69|       |      }
   70|  3.31M|   }
_ZZN3glz15resize_unfilledINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEEvRT_mENKUlPS8_mE_clIcEEDaSA_m:
   65|  3.31M|         b.resize_and_overwrite(n, [](auto*, size_t written) noexcept { return written; });

_ZN3glz20inert_key_bits_scopeC2IRNS_7contextEEEOT_Pv:
  192|  78.7k|      constexpr inert_key_bits_scope(auto&&, void*) noexcept {}
_ZN3glz10get_memberIRNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEERKMS4_NSt3__17variantIJDndNS6_12basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEbNS6_6vectorIS4_NSB_IS4_EEEENS3_IS4_EEEEEEEDcOT_OT0_:
  677|  8.36M|   {
  678|  8.36M|      using V = std::decay_t<decltype(element)>;
  679|  8.36M|      if constexpr (std::is_member_object_pointer_v<V>) {
  680|  8.36M|         return value.*element;
  681|       |      }
  682|       |      else if constexpr (std::is_member_function_pointer_v<V>) {
  683|       |         return element;
  684|       |      }
  685|       |      else if constexpr (std::invocable<Element, Value> && not eigen_t<Element>) {
  686|       |         // Eigen places a static_assert inside of the operator()(), so we must target
  687|       |         // matrix types and reject them from the invocable check
  688|       |         // Eigen ought to put the check in the `enable_if` for operator()()
  689|       |         return std::invoke(std::forward<Element>(element), std::forward<Value>(value));
  690|       |      }
  691|       |      else if constexpr (std::is_pointer_v<V> && !std::is_reference_v<Element>) {
  692|       |         if constexpr (std::invocable<decltype(*element), Value>) {
  693|       |            return std::invoke(*element, std::forward<Value>(value));
  694|       |         }
  695|       |         else {
  696|       |            return *element;
  697|       |         }
  698|       |      }
  699|       |      else {
  700|       |         return element;
  701|       |      }
  702|  8.36M|   }

_ZNK3glz9error_ctxcvbEv:
  148|  31.6k|      operator bool() const noexcept { return ec != error_code::none; }
_ZN3glz10call_scopeINS_7contextEEC2ERS1_:
  272|  31.6k|      explicit call_scope(Ctx& c) noexcept : ctx(c), depth(c.depth)
  273|  31.6k|      {
  274|  31.6k|         ctx.error = error_code::none;
  275|  31.6k|         ctx.custom_error_message = {};
  276|  31.6k|      }
_ZN3glz11enter_depthITkNS_10is_contextENS_7contextEEEbRT_:
  344|  1.84M|   {
  345|  1.84M|      if (ctx.depth >= max_recursive_depth_limit) [[unlikely]] {
  ------------------
  |  Branch (345:11): [True: 32, False: 1.84M]
  ------------------
  346|     32|         ctx.error = error_code::exceeded_max_recursive_depth;
  347|     32|         return true;
  348|     32|      }
  349|  1.84M|      ++ctx.depth;
  350|  1.84M|      return false;
  351|  1.84M|   }
_ZN3glz18charge_speculationITkNS_10is_contextENS_7contextEEEbRT_m:
  311|  56.1k|   {
  312|  56.1k|      if constexpr (requires { ctx.speculation_budget; }) {
  313|  56.1k|         if (ctx.speculation_budget == 0) {
  ------------------
  |  Branch (313:14): [True: 0, False: 56.1k]
  ------------------
  314|      0|            return true;
  315|      0|         }
  316|  56.1k|         ctx.speculation_budget = consumed >= ctx.speculation_budget ? 1 : ctx.speculation_budget - consumed;
  ------------------
  |  Branch (316:35): [True: 0, False: 56.1k]
  ------------------
  317|  56.1k|         return ctx.speculation_budget > 1;
  318|       |      }
  319|       |      else {
  320|       |         return true;
  321|       |      }
  322|  56.1k|   }
_ZN3glz21speculation_exhaustedITkNS_10is_contextENS_7contextEEEbRT_:
  328|  3.31k|   {
  329|  3.31k|      if constexpr (requires { ctx.speculation_budget; }) {
  330|  3.31k|         return ctx.speculation_budget == 1; // the latched floor; 0 means unbudgeted
  331|       |      }
  332|       |      else {
  333|       |         return false;
  334|       |      }
  335|  3.31k|   }
_ZN3glz10call_scopeINS_7contextEED2Ev:
  277|  31.6k|      ~call_scope() { ctx.depth = depth; }

_ZN3glz4readITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEENS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_10contiguousERKNSt3__16vectorIcNS6_9allocatorIcEEEEQaa14read_supportedIT0_XdtT_6formatEEnt18is_input_streamingIT1_EEENS_9error_ctxERSD_OSE_:
  232|  10.5k|   {
  233|  10.5k|      format_context_t<Opts.format> ctx{};
  234|  10.5k|      return read<Opts>(value, buffer, ctx);
  235|  10.5k|   }
_ZN3glz4readITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEENS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_10contiguousERKNSt3__16vectorIcNS6_9allocatorIcEEEETkNS_10is_contextERNS_7contextEQaa14read_supportedIT0_XdtT_6formatEEnt18is_input_streamingIT1_EEENS_9error_ctxERSF_OSG_OT2_:
  152|  10.5k|   {
  153|  10.5k|      static_assert(sizeof(decltype(*buffer.data())) == 1);
  154|       |
  155|  10.5k|      call_scope scope{ctx};
  156|       |
  157|  10.5k|      if constexpr (Opts.format != NDJSON) {
  158|  10.5k|         if (buffer.size() == 0) [[unlikely]] {
  ------------------
  |  Branch (158:14): [True: 0, False: 10.5k]
  ------------------
  159|      0|            ctx.error = error_code::no_read_input;
  160|      0|            return {0, ctx.error, ctx.custom_error_message};
  161|      0|         }
  162|  10.5k|      }
  163|       |
  164|       |      // The reader used to grow the caller's buffer by `padding_bytes` here and shrink it back on
  165|       |      // the way out, so that its fixed width loads could run off the end of the document into
  166|       |      // defined bytes. Every one of those loads is now bounded against `end` instead (see
  167|       |      // `chunk_min`), which costs the last chunk of the buffer its chunked path and nothing else --
  168|       |      // measurably less than the round trip did. `std::string::resize` is an ABI entry point on
  169|       |      // both libc++ and libstdc++, so neither call inlined and the parse was spilled around both
  170|       |      // for what amounted to a sixteen byte store; the price did not scale with the document, so on
  171|       |      // a small one it was the bulk of the call. A caller who does have that slack can still say so
  172|       |      // and get the unbounded loads back, and nobody else pays for the buffer being touched at all.
  173|  10.5k|      ctx.padded_input = check_is_padded(Opts);
  174|       |
  175|  10.5k|      static constexpr auto ParseOpts = parse_opts_for<Opts, Buf>();
  176|       |
  177|  10.5k|      auto [it, end] = read_iterators<ParseOpts>(buffer);
  178|  10.5k|      auto start = it;
  179|       |
  180|       |      // Bound the speculative re-parsing a variant resolution may do, in bytes, relative to this
  181|       |      // input. Seeded per read so a reused context starts fresh. See charge_speculation.
  182|  10.5k|      if constexpr (requires { ctx.speculation_budget; }) {
  183|  10.5k|         const size_t proportional = max_speculative_parse_factor * size_t(end - it);
  184|  10.5k|         ctx.speculation_budget =
  185|  10.5k|            (proportional > min_speculative_parse_bytes ? proportional : min_speculative_parse_bytes) + 2;
  ------------------
  |  Branch (185:14): [True: 228, False: 10.3k]
  ------------------
  186|  10.5k|      }
  187|       |
  188|       |      // A YAML context marks its outermost parse with stream_begin and seeds its expansion budgets
  189|       |      // there, so clearing it here is what makes those budgets per-read like the one above. A
  190|       |      // reused context would otherwise carry a spent budget into the next document and reject a
  191|       |      // valid one, and would leave stream_begin pointing into the buffer of the previous read.
  192|       |      // Nested YAML parses do not route through glz::read, so they still cannot reseed themselves.
  193|       |      if constexpr (requires { ctx.stream_begin; }) {
  194|       |         ctx.stream_begin = nullptr;
  195|       |      }
  196|       |
  197|       |      // Normalized off before dispatching: no reader branches on it any more, so leaving it set
  198|       |      // would split every instantiation below between callers who declared padding and callers who
  199|       |      // did not, for a flag none of them reads.
  200|  10.5k|      parse<Opts.format>::template op<ParseOpts>(value, ctx, it, end);
  201|       |
  202|  10.5k|      if (bool(ctx.error)) [[unlikely]] {
  ------------------
  |  Branch (202:11): [True: 7.87k, False: 2.67k]
  ------------------
  203|  7.87k|         goto finish;
  204|  7.87k|      }
  205|       |
  206|       |      // The JSON RFC 8259 defines: JSON-text = ws value ws
  207|       |      // So, trailing whitespace is permitted and sometimes we want to
  208|       |      // validate this, even though this memory will not affect Glaze.
  209|       |      if constexpr (check_validate_trailing_whitespace(Opts)) {
  210|       |         if (it < end) {
  211|       |            skip_ws<ParseOpts>(ctx, it, end);
  212|       |            if (bool(ctx.error)) [[unlikely]] {
  213|       |               goto finish;
  214|       |            }
  215|       |            if (it != end) [[unlikely]] {
  216|       |               ctx.error = error_code::syntax_error;
  217|       |            }
  218|       |         }
  219|       |      }
  220|       |
  221|  10.5k|   finish:
  222|       |      // ParseOpts, not Opts: this reads `null_terminated` to tell a value that ended with the
  223|       |      // buffer from one that ran out, and it has to be told the same thing the parse was.
  224|  10.5k|      finalize_top_level_read<ParseOpts>(ctx, start, it, end);
  225|       |
  226|  10.5k|      return {size_t(it - start), ctx.error, ctx.custom_error_message};
  227|  2.67k|   }
_ZN3glz14read_iteratorsITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEETkNS_10contiguousERKNSt3__16vectorIcNS2_9allocatorIcEEEEEEDaOT0_:
   40|  21.0k|   {
   41|  21.0k|      static_assert(sizeof(decltype(*buffer.data())) == 1);
   42|       |
   43|  21.0k|      auto it = reinterpret_cast<const char*>(buffer.data());
   44|  21.0k|      auto end = it + buffer.size();
   45|       |
   46|  21.0k|      return std::pair{it, end};
   47|  21.0k|   }
_ZN3glz23finalize_top_level_readITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEETkNS_10is_contextERNS_7contextEEEvOT0_PKcS7_S7_:
  131|  31.6k|   {
  132|  31.6k|      if constexpr (Opts.format == JSON && !check_null_terminated(Opts)) {
  133|       |         // Deliberately not [[unlikely]]: a body that ends with the buffer lands here on every
  134|       |         // successful read, which is the ordinary case for a registry parsing a wire span.
  135|       |         // start < it, not !=, because a streaming origin can be empty or overshoot on an error
  136|       |         // path; neither is an absent value.
  137|  31.6k|         if (ctx.error == error_code::end_reached && ctx.depth == 0 && it == end && start < it) {
  ------------------
  |  Branch (137:14): [True: 1.71k, False: 29.9k]
  |  Branch (137:54): [True: 18, False: 1.70k]
  |  Branch (137:72): [True: 18, False: 0]
  |  Branch (137:85): [True: 18, False: 0]
  ------------------
  138|     18|            context ws_ctx{}; // only written to when skip_ws parses a comment; the result is unused
  139|     18|            const char* consumed = start;
  140|     18|            skip_ws<Opts>(ws_ctx, consumed, it);
  141|     18|            if (consumed == it) {
  ------------------
  |  Branch (141:17): [True: 17, False: 1]
  ------------------
  142|     17|               ctx.error = error_code::no_read_input;
  143|     17|            }
  144|     18|         }
  145|  31.6k|      }
  146|  31.6k|      finalize_read_context(ctx);
  147|  31.6k|   }
_ZN3glz21finalize_read_contextITkNS_10is_contextERNS_7contextEEEvOT_:
  109|  31.6k|   {
  110|  31.6k|      settle_partial_read_complete(ctx);
  111|  31.6k|      settle_end_reached(ctx);
  112|  31.6k|   }
_ZN3glz28settle_partial_read_completeITkNS_10is_contextERNS_7contextEEEvOT_:
  102|  31.6k|   {
  103|  31.6k|      if (ctx.error == error_code::partial_read_complete) {
  ------------------
  |  Branch (103:11): [True: 0, False: 31.6k]
  ------------------
  104|      0|         ctx.error = error_code::none;
  105|      0|      }
  106|  31.6k|   }
_ZN3glz18settle_end_reachedITkNS_10is_contextERNS_7contextEEEvOT_:
   88|  31.6k|   {
   89|  31.6k|      if (ctx.error == error_code::end_reached) {
  ------------------
  |  Branch (89:11): [True: 1.70k, False: 29.9k]
  ------------------
   90|  1.70k|         ctx.error = (ctx.depth == 0) ? error_code::none : error_code::unexpected_end;
  ------------------
  |  Branch (90:22): [True: 1, False: 1.70k]
  ------------------
   91|  1.70k|      }
   92|  31.6k|   }
_ZN3glz4readITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEENS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_10contiguousERKNSt3__16vectorIcNS6_9allocatorIcEEEETkNS_10is_contextERNS_7contextEQaa14read_supportedIT0_XdtT_6formatEEnt18is_input_streamingIT1_EEENS_9error_ctxERSF_OSG_OT2_:
  152|  10.5k|   {
  153|  10.5k|      static_assert(sizeof(decltype(*buffer.data())) == 1);
  154|       |
  155|  10.5k|      call_scope scope{ctx};
  156|       |
  157|  10.5k|      if constexpr (Opts.format != NDJSON) {
  158|  10.5k|         if (buffer.size() == 0) [[unlikely]] {
  ------------------
  |  Branch (158:14): [True: 0, False: 10.5k]
  ------------------
  159|      0|            ctx.error = error_code::no_read_input;
  160|      0|            return {0, ctx.error, ctx.custom_error_message};
  161|      0|         }
  162|  10.5k|      }
  163|       |
  164|       |      // The reader used to grow the caller's buffer by `padding_bytes` here and shrink it back on
  165|       |      // the way out, so that its fixed width loads could run off the end of the document into
  166|       |      // defined bytes. Every one of those loads is now bounded against `end` instead (see
  167|       |      // `chunk_min`), which costs the last chunk of the buffer its chunked path and nothing else --
  168|       |      // measurably less than the round trip did. `std::string::resize` is an ABI entry point on
  169|       |      // both libc++ and libstdc++, so neither call inlined and the parse was spilled around both
  170|       |      // for what amounted to a sixteen byte store; the price did not scale with the document, so on
  171|       |      // a small one it was the bulk of the call. A caller who does have that slack can still say so
  172|       |      // and get the unbounded loads back, and nobody else pays for the buffer being touched at all.
  173|  10.5k|      ctx.padded_input = check_is_padded(Opts);
  174|       |
  175|  10.5k|      static constexpr auto ParseOpts = parse_opts_for<Opts, Buf>();
  176|       |
  177|  10.5k|      auto [it, end] = read_iterators<ParseOpts>(buffer);
  178|  10.5k|      auto start = it;
  179|       |
  180|       |      // Bound the speculative re-parsing a variant resolution may do, in bytes, relative to this
  181|       |      // input. Seeded per read so a reused context starts fresh. See charge_speculation.
  182|  10.5k|      if constexpr (requires { ctx.speculation_budget; }) {
  183|  10.5k|         const size_t proportional = max_speculative_parse_factor * size_t(end - it);
  184|  10.5k|         ctx.speculation_budget =
  185|  10.5k|            (proportional > min_speculative_parse_bytes ? proportional : min_speculative_parse_bytes) + 2;
  ------------------
  |  Branch (185:14): [True: 230, False: 10.3k]
  ------------------
  186|  10.5k|      }
  187|       |
  188|       |      // A YAML context marks its outermost parse with stream_begin and seeds its expansion budgets
  189|       |      // there, so clearing it here is what makes those budgets per-read like the one above. A
  190|       |      // reused context would otherwise carry a spent budget into the next document and reject a
  191|       |      // valid one, and would leave stream_begin pointing into the buffer of the previous read.
  192|       |      // Nested YAML parses do not route through glz::read, so they still cannot reseed themselves.
  193|       |      if constexpr (requires { ctx.stream_begin; }) {
  194|       |         ctx.stream_begin = nullptr;
  195|       |      }
  196|       |
  197|       |      // Normalized off before dispatching: no reader branches on it any more, so leaving it set
  198|       |      // would split every instantiation below between callers who declared padding and callers who
  199|       |      // did not, for a flag none of them reads.
  200|  10.5k|      parse<Opts.format>::template op<ParseOpts>(value, ctx, it, end);
  201|       |
  202|  10.5k|      if (bool(ctx.error)) [[unlikely]] {
  ------------------
  |  Branch (202:11): [True: 7.86k, False: 2.67k]
  ------------------
  203|  7.86k|         goto finish;
  204|  7.86k|      }
  205|       |
  206|       |      // The JSON RFC 8259 defines: JSON-text = ws value ws
  207|       |      // So, trailing whitespace is permitted and sometimes we want to
  208|       |      // validate this, even though this memory will not affect Glaze.
  209|       |      if constexpr (check_validate_trailing_whitespace(Opts)) {
  210|       |         if (it < end) {
  211|       |            skip_ws<ParseOpts>(ctx, it, end);
  212|       |            if (bool(ctx.error)) [[unlikely]] {
  213|       |               goto finish;
  214|       |            }
  215|       |            if (it != end) [[unlikely]] {
  216|       |               ctx.error = error_code::syntax_error;
  217|       |            }
  218|       |         }
  219|       |      }
  220|       |
  221|  10.5k|   finish:
  222|       |      // ParseOpts, not Opts: this reads `null_terminated` to tell a value that ended with the
  223|       |      // buffer from one that ran out, and it has to be told the same thing the parse was.
  224|  10.5k|      finalize_top_level_read<ParseOpts>(ctx, start, it, end);
  225|       |
  226|  10.5k|      return {size_t(it - start), ctx.error, ctx.custom_error_message};
  227|  2.67k|   }
_ZN3glz4readITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEENS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_10contiguousERNSt3__16vectorIcNS6_9allocatorIcEEEETkNS_10is_contextERNS_7contextEQaa14read_supportedIT0_XdtT_6formatEEnt18is_input_streamingIT1_EEENS_9error_ctxERSE_OSF_OT2_:
  152|  10.5k|   {
  153|  10.5k|      static_assert(sizeof(decltype(*buffer.data())) == 1);
  154|       |
  155|  10.5k|      call_scope scope{ctx};
  156|       |
  157|  10.5k|      if constexpr (Opts.format != NDJSON) {
  158|  10.5k|         if (buffer.size() == 0) [[unlikely]] {
  ------------------
  |  Branch (158:14): [True: 0, False: 10.5k]
  ------------------
  159|      0|            ctx.error = error_code::no_read_input;
  160|      0|            return {0, ctx.error, ctx.custom_error_message};
  161|      0|         }
  162|  10.5k|      }
  163|       |
  164|       |      // The reader used to grow the caller's buffer by `padding_bytes` here and shrink it back on
  165|       |      // the way out, so that its fixed width loads could run off the end of the document into
  166|       |      // defined bytes. Every one of those loads is now bounded against `end` instead (see
  167|       |      // `chunk_min`), which costs the last chunk of the buffer its chunked path and nothing else --
  168|       |      // measurably less than the round trip did. `std::string::resize` is an ABI entry point on
  169|       |      // both libc++ and libstdc++, so neither call inlined and the parse was spilled around both
  170|       |      // for what amounted to a sixteen byte store; the price did not scale with the document, so on
  171|       |      // a small one it was the bulk of the call. A caller who does have that slack can still say so
  172|       |      // and get the unbounded loads back, and nobody else pays for the buffer being touched at all.
  173|  10.5k|      ctx.padded_input = check_is_padded(Opts);
  174|       |
  175|  10.5k|      static constexpr auto ParseOpts = parse_opts_for<Opts, Buf>();
  176|       |
  177|  10.5k|      auto [it, end] = read_iterators<ParseOpts>(buffer);
  178|  10.5k|      auto start = it;
  179|       |
  180|       |      // Bound the speculative re-parsing a variant resolution may do, in bytes, relative to this
  181|       |      // input. Seeded per read so a reused context starts fresh. See charge_speculation.
  182|  10.5k|      if constexpr (requires { ctx.speculation_budget; }) {
  183|  10.5k|         const size_t proportional = max_speculative_parse_factor * size_t(end - it);
  184|  10.5k|         ctx.speculation_budget =
  185|  10.5k|            (proportional > min_speculative_parse_bytes ? proportional : min_speculative_parse_bytes) + 2;
  ------------------
  |  Branch (185:14): [True: 230, False: 10.3k]
  ------------------
  186|  10.5k|      }
  187|       |
  188|       |      // A YAML context marks its outermost parse with stream_begin and seeds its expansion budgets
  189|       |      // there, so clearing it here is what makes those budgets per-read like the one above. A
  190|       |      // reused context would otherwise carry a spent budget into the next document and reject a
  191|       |      // valid one, and would leave stream_begin pointing into the buffer of the previous read.
  192|       |      // Nested YAML parses do not route through glz::read, so they still cannot reseed themselves.
  193|       |      if constexpr (requires { ctx.stream_begin; }) {
  194|       |         ctx.stream_begin = nullptr;
  195|       |      }
  196|       |
  197|       |      // Normalized off before dispatching: no reader branches on it any more, so leaving it set
  198|       |      // would split every instantiation below between callers who declared padding and callers who
  199|       |      // did not, for a flag none of them reads.
  200|  10.5k|      parse<Opts.format>::template op<ParseOpts>(value, ctx, it, end);
  201|       |
  202|  10.5k|      if (bool(ctx.error)) [[unlikely]] {
  ------------------
  |  Branch (202:11): [True: 7.86k, False: 2.67k]
  ------------------
  203|  7.86k|         goto finish;
  204|  7.86k|      }
  205|       |
  206|       |      // The JSON RFC 8259 defines: JSON-text = ws value ws
  207|       |      // So, trailing whitespace is permitted and sometimes we want to
  208|       |      // validate this, even though this memory will not affect Glaze.
  209|       |      if constexpr (check_validate_trailing_whitespace(Opts)) {
  210|       |         if (it < end) {
  211|       |            skip_ws<ParseOpts>(ctx, it, end);
  212|       |            if (bool(ctx.error)) [[unlikely]] {
  213|       |               goto finish;
  214|       |            }
  215|       |            if (it != end) [[unlikely]] {
  216|       |               ctx.error = error_code::syntax_error;
  217|       |            }
  218|       |         }
  219|       |      }
  220|       |
  221|  10.5k|   finish:
  222|       |      // ParseOpts, not Opts: this reads `null_terminated` to tell a value that ended with the
  223|       |      // buffer from one that ran out, and it has to be told the same thing the parse was.
  224|  10.5k|      finalize_top_level_read<ParseOpts>(ctx, start, it, end);
  225|       |
  226|  10.5k|      return {size_t(it - start), ctx.error, ctx.custom_error_message};
  227|  2.67k|   }
_ZN3glz14read_iteratorsITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEETkNS_10contiguousERNSt3__16vectorIcNS2_9allocatorIcEEEEEEDaOT0_:
   40|  10.5k|   {
   41|  10.5k|      static_assert(sizeof(decltype(*buffer.data())) == 1);
   42|       |
   43|  10.5k|      auto it = reinterpret_cast<const char*>(buffer.data());
   44|  10.5k|      auto end = it + buffer.size();
   45|       |
   46|  10.5k|      return std::pair{it, end};
   47|  10.5k|   }

_ZN3glz9sweethash7sweet32ITkNS0_16contiguous_rangeENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEEEjRKT_j:
  270|  10.1M|   {
  271|  10.1M|      return sweet32(static_cast<const void*>(s.data()), s.size(), seed);
  272|  10.1M|   }
_ZN3glz9sweethash7sweet32EPKvmj:
  154|  10.1M|   {
  155|  10.1M|      const uint8_t* p = static_cast<const uint8_t*>(data);
  156|       |
  157|       |      // For inputs <= 8 bytes, use simple hash (tail handler requires len >= 9)
  158|  10.1M|      if (len <= 8) {
  ------------------
  |  Branch (158:11): [True: 7.76M, False: 2.36M]
  ------------------
  159|  7.76M|         uint64_t v = 0;
  160|  7.76M|         switch (len) {
  161|   541k|         case 8:
  ------------------
  |  Branch (161:10): [True: 541k, False: 7.22M]
  ------------------
  162|   541k|            std::memcpy(&v, p, 8);
  163|   541k|            break;
  164|   562k|         case 7:
  ------------------
  |  Branch (164:10): [True: 562k, False: 7.19M]
  ------------------
  165|   562k|            std::memcpy(&v, p, 7);
  166|   562k|            break;
  167|   610k|         case 6:
  ------------------
  |  Branch (167:10): [True: 610k, False: 7.15M]
  ------------------
  168|   610k|            std::memcpy(&v, p, 6);
  169|   610k|            break;
  170|   426k|         case 5:
  ------------------
  |  Branch (170:10): [True: 426k, False: 7.33M]
  ------------------
  171|   426k|            std::memcpy(&v, p, 5);
  172|   426k|            break;
  173|   962k|         case 4:
  ------------------
  |  Branch (173:10): [True: 962k, False: 6.80M]
  ------------------
  174|   962k|            std::memcpy(&v, p, 4);
  175|   962k|            break;
  176|   452k|         case 3:
  ------------------
  |  Branch (176:10): [True: 452k, False: 7.30M]
  ------------------
  177|   452k|            std::memcpy(&v, p, 3);
  178|   452k|            break;
  179|  2.22M|         case 2:
  ------------------
  |  Branch (179:10): [True: 2.22M, False: 5.53M]
  ------------------
  180|  2.22M|            std::memcpy(&v, p, 2);
  181|  2.22M|            break;
  182|  1.80M|         case 1:
  ------------------
  |  Branch (182:10): [True: 1.80M, False: 5.95M]
  ------------------
  183|  1.80M|            v = p[0];
  184|  1.80M|            break;
  185|   167k|         default:
  ------------------
  |  Branch (185:10): [True: 167k, False: 7.59M]
  ------------------
  186|   167k|            break;
  187|  7.76M|         }
  188|  7.76M|         v = v ^ seed ^ (len + 1);
  189|  7.76M|         return static_cast<uint32_t>(v) ^ static_cast<uint32_t>(v >> 32);
  190|  7.76M|      }
  191|       |
  192|       |      // Full hash for inputs > 8 bytes
  193|  2.36M|      uint64_t seed64 = (static_cast<uint64_t>(seed) << 32) | static_cast<uint64_t>(seed);
  194|  2.36M|      uint64_t h = (seed64 ^ prime4) + (len * prime1);
  195|  2.36M|      const uint8_t* const end = p + len;
  196|       |
  197|  2.36M|      if (len >= 32) {
  ------------------
  |  Branch (197:11): [True: 223k, False: 2.14M]
  ------------------
  198|   223k|         uint64_t h1 = h;
  199|   223k|         uint64_t h2 = (seed64 * prime2) ^ prime3;
  200|   223k|         uint64_t h3 = (seed64 * prime3) ^ prime4;
  201|   223k|         uint64_t h4 = (seed64 * prime4) ^ prime5;
  202|       |
  203|  1.83M|         do {
  204|  1.83M|            uint64_t k1, k2, k3, k4;
  205|  1.83M|            std::memcpy(&k1, p, 8);
  206|  1.83M|            std::memcpy(&k2, p + 8, 8);
  207|  1.83M|            std::memcpy(&k3, p + 16, 8);
  208|  1.83M|            std::memcpy(&k4, p + 24, 8);
  209|       |
  210|  1.83M|            k1 = k1 * prime2;
  211|  1.83M|            k1 = k1 ^ (k1 >> 47);
  212|  1.83M|            h1 = h1 ^ k1;
  213|  1.83M|            h1 = h1 * prime1;
  214|       |
  215|  1.83M|            k2 = k2 * prime3;
  216|  1.83M|            k2 = k2 ^ (k2 >> 47);
  217|  1.83M|            h2 = h2 ^ k2;
  218|  1.83M|            h2 = h2 * prime2;
  219|       |
  220|  1.83M|            k3 = k3 * prime4;
  221|  1.83M|            k3 = k3 ^ (k3 >> 47);
  222|  1.83M|            h3 = h3 ^ k3;
  223|  1.83M|            h3 = h3 * prime3;
  224|       |
  225|  1.83M|            k4 = k4 * prime5;
  226|  1.83M|            k4 = k4 ^ (k4 >> 47);
  227|  1.83M|            h4 = h4 ^ k4;
  228|  1.83M|            h4 = h4 * prime4;
  229|       |
  230|  1.83M|            p = p + 32;
  231|  1.83M|            len = len - 32;
  232|  1.83M|         } while (len >= 32);
  ------------------
  |  Branch (232:19): [True: 1.61M, False: 223k]
  ------------------
  233|       |
  234|   223k|         h = h1 + h2 + h3 + h4;
  235|   223k|      }
  236|       |
  237|  5.61M|      while (len >= 8) {
  ------------------
  |  Branch (237:14): [True: 3.25M, False: 2.36M]
  ------------------
  238|  3.25M|         uint64_t k;
  239|  3.25M|         std::memcpy(&k, p, 8);
  240|  3.25M|         k = k * prime2;
  241|  3.25M|         k = k ^ (k >> 47);
  242|  3.25M|         h = h ^ k;
  243|  3.25M|         h = h * prime1;
  244|  3.25M|         p = p + 8;
  245|  3.25M|         len = len - 8;
  246|  3.25M|      }
  247|       |
  248|  2.36M|      if (len > 0) {
  ------------------
  |  Branch (248:11): [True: 2.17M, False: 190k]
  ------------------
  249|  2.17M|         uint64_t k;
  250|  2.17M|         std::memcpy(&k, end - 8, 8);
  251|  2.17M|         k = k * prime2;
  252|  2.17M|         k = k ^ (k >> 47);
  253|  2.17M|         k = k * prime3;
  254|  2.17M|         h = h ^ k;
  255|  2.17M|      }
  256|       |
  257|  2.36M|      h = mix64(h);
  258|  2.36M|      return static_cast<uint32_t>(h) ^ static_cast<uint32_t>(h >> 32);
  259|  10.1M|   }
_ZN3glz9sweethash5mix64Em:
   33|  2.36M|   {
   34|  2.36M|      v = v ^ (v >> 33);
   35|  2.36M|      v = v * prime2;
   36|  2.36M|      v = v ^ (v >> 29);
   37|  2.36M|      v = v * prime3;
   38|  2.36M|      return v;
   39|  2.36M|   }

_ZN3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEC2Ev:
  379|  7.39M|      generic_json() = default;
_ZN3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEED2Ev:
  131|  19.1M|      ~generic_json() = default;
_ZN3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEC2EOS3_:
  382|  11.7M|      generic_json(generic_json&& other) noexcept : data(std::move(other.data)) {}
_ZNK3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEE4sizeEv:
  575|  8.01k|      {
  576|  8.01k|         if (auto* v = get_if<object_t>()) {
  ------------------
  |  Branch (576:20): [True: 12, False: 8.00k]
  ------------------
  577|     12|            return v->size();
  578|     12|         }
  579|  8.00k|         else if (auto* v = get_if<array_t>()) {
  ------------------
  |  Branch (579:25): [True: 42, False: 7.96k]
  ------------------
  580|     42|            return v->size();
  581|     42|         }
  582|  7.96k|         else if (auto* v = get_if<std::string>()) {
  ------------------
  |  Branch (582:25): [True: 825, False: 7.13k]
  ------------------
  583|    825|            return v->size();
  584|    825|         }
  585|  7.13k|         else {
  586|  7.13k|            return 0;
  587|  7.13k|         }
  588|  8.01k|      }
_ZNK3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEE6get_ifINS2_IS3_EEEEPKT_v:
  182|  8.01k|      {
  183|  8.01k|         return std::get_if<T>(&data);
  184|  8.01k|      }
_ZNK3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEE6get_ifINSt3__16vectorIS3_NS5_9allocatorIS3_EEEEEEPKT_v:
  182|  8.00k|      {
  183|  8.00k|         return std::get_if<T>(&data);
  184|  8.00k|      }
_ZNK3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEE6get_ifINSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEEEPKT_v:
  182|  7.96k|      {
  183|  7.96k|         return std::get_if<T>(&data);
  184|  7.96k|      }

_ZN3glz5parseILj10EE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_10is_contextERNS_7contextERPKcSC_EEvOT0_OT1_OT2_T3_:
   49|  31.6k|      {
   50|       |         if constexpr (const_value_v<T>) {
   51|       |            if constexpr (check_error_on_const_read(Opts)) {
   52|       |               ctx.error = error_code::attempt_const_read;
   53|       |            }
   54|       |            else {
   55|       |               // do not read anything into the const value
   56|       |               skip_value<JSON>::op<Opts>(std::forward<Ctx>(ctx), std::forward<It0>(it), end);
   57|       |            }
   58|       |         }
   59|  31.6k|         else {
   60|  31.6k|            using V = std::remove_cvref_t<T>;
   61|  31.6k|            from<JSON, V>::template op<Opts>(std::forward<T>(value), std::forward<Ctx>(ctx), std::forward<It0>(it),
   62|  31.6k|                                             end);
   63|  31.6k|         }
   64|  31.6k|      }
_ZN3glz4fromILj10ENS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERS4_TkNS_10is_contextERNS_7contextERPKcSC_EEvOT0_OT1_OT2_T3_:
  150|  31.6k|      {
  151|  31.6k|         using V = std::decay_t<decltype(get_member(std::declval<Value>(), meta_wrapper_v<T>))>;
  152|  31.6k|         from<JSON, V>::template op<Opts>(get_member(std::forward<Value>(value), meta_wrapper_v<T>),
  153|  31.6k|                                          std::forward<Ctx>(ctx), std::forward<It0>(it), end);
  154|  31.6k|      }
_ZN3glz4fromILj10ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSP_EEvOT0_OT1_OT2_T3_:
 3860|  31.6k|      {
 3861|       |         if constexpr (tagging == variant_tagging_kind::adjacent) {
 3862|       |            read_adjacent<Options>(value, ctx, it, end);
 3863|       |         }
 3864|  31.6k|         else {
 3865|  31.6k|            read_deduced<Options>(value, ctx, it, end);
 3866|  31.6k|         }
 3867|  31.6k|      }
_ZN3glz4fromILj10ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE12read_deducedITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSP_EEvOT0_OT1_OT2_T3_:
 3871|  31.6k|      {
 3872|  31.6k|         constexpr auto Opts = ws_handled_off<Options>();
 3873|  31.6k|         if constexpr (variant_is_auto_deducible<T>()) {
 3874|  31.6k|            if constexpr (not check_ws_handled(Options)) {
 3875|  31.6k|               if (skip_ws<Opts>(ctx, it, end)) {
  ------------------
  |  Branch (3875:20): [True: 17, False: 31.6k]
  ------------------
 3876|     17|                  return;
 3877|     17|               }
 3878|  31.6k|            }
 3879|       |
 3880|  31.6k|            switch (*it) {
 3881|     37|            case '\0':
  ------------------
  |  Branch (3881:13): [True: 37, False: 31.5k]
  ------------------
 3882|     37|               ctx.error = error_code::unexpected_end;
 3883|     37|               return;
 3884|  15.3k|            case '{': {
  ------------------
  |  Branch (3884:13): [True: 15.3k, False: 16.2k]
  ------------------
 3885|       |               // This branch consumes the brace itself and hands the object to a reader with
 3886|       |               // `opening_handled`, which therefore does not count the level -- but does release it at
 3887|       |               // the closing brace. So the level is taken here, in both buffer modes, and paid back by
 3888|       |               // the reader below.
 3889|  15.3k|               if (enter_depth(ctx)) [[unlikely]] {
  ------------------
  |  Branch (3889:20): [True: 0, False: 15.3k]
  ------------------
 3890|      0|                  return;
 3891|      0|               }
 3892|       |
 3893|  15.3k|               ++it;
 3894|  15.3k|               if constexpr (not Opts.null_terminated) {
 3895|  15.3k|                  if (it == end) [[unlikely]] {
  ------------------
  |  Branch (3895:23): [True: 1, False: 15.3k]
  ------------------
 3896|      1|                     ctx.error = error_code::unexpected_end;
 3897|      1|                     return;
 3898|      1|                  }
 3899|  15.3k|               }
 3900|  15.3k|               using type_counts = variant_type_count<T>;
 3901|  15.3k|               constexpr auto n_object_candidates = variant_object_candidate_count_v<Opts, T>;
 3902|       |               if constexpr (n_object_candidates < 1) {
 3903|       |                  ctx.error = error_code::no_matching_variant_type;
 3904|       |                  return;
 3905|       |               }
 3906|  15.3k|               else if constexpr (n_object_candidates == 1 && tag_v<T>.empty()) {
 3907|  15.3k|                  constexpr auto first_idx = variant_first_object_candidate_v<Opts, T>;
 3908|  15.3k|                  using V = std::variant_alternative_t<first_idx, T>;
 3909|  15.3k|                  if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (3909:23): [True: 15.3k, False: 1]
  ------------------
 3910|  15.3k|                  parse<JSON>::op<opening_handled<Opts>()>(std::get<V>(value), ctx, it, end);
 3911|  15.3k|                  return;
 3912|       |               }
 3913|       |               else {
 3914|       |                  auto possible_types = bit_array<std::variant_size_v<T>>{}.flip();
 3915|       |                  static constexpr auto& deduction_bits = variant_deduction_bits<T>;
 3916|       |                  static constexpr size_t deduction_key_count = variant_deduction_key_count<T>;
 3917|       |                  static constexpr auto tag_literal = string_literal_from_view<tag_v<T>.size()>(tag_v<T>);
 3918|       |
 3919|       |                  // Track if we've encountered a tag and what value it had
 3920|       |                  std::optional<size_t> tag_specified_index{};
 3921|       |
 3922|       |                  if (skip_ws<Opts>(ctx, it, end)) {
 3923|       |                     return;
 3924|       |                  }
 3925|       |                  // Once the reader knows which alternative this object holds it may have to read
 3926|       |                  // it again from here. Anchor the position rather than keep the pointer: the scan
 3927|       |                  // below skips values, and a streaming skip refills, which moves the window out
 3928|       |                  // from under a raw pointer (see rewind_anchor).
 3929|       |                  auto start = make_rewind_anchor(ctx, it);
 3930|       |                  bool first_key = true;
 3931|       |                  // Parse bifurcation for tagged variants:
 3932|       |                  //
 3933|       |                  // Without this optimization, tagged variant parsing always uses two passes:
 3934|       |                  //   1. Scan all keys to find the tag (e.g. "type"), skipping values
 3935|       |                  //   2. Reset `it = start` and re-parse the entire object into the resolved type
 3936|       |                  //
 3937|       |                  // When the tag is the first key, the second pass redundantly re-reads every
 3938|       |                  // field that follows it. This lambda avoids that: if the tag was the first key,
 3939|       |                  // it advances past the trailing comma so the object parser picks up at the
 3940|       |                  // second field. If the tag was found later, it falls back to the full re-parse.
 3941|       |                  //
 3942|       |                  // One exception: if the tag name is also a field on the resolved struct
 3943|       |                  // (contains_tag), we must re-parse regardless so the value is stored in
 3944|       |                  // the struct field. This override is applied inside each std::visit lambda.
 3945|       |                  //
 3946|       |                  // Either way the rewind can fail under a streaming read: the window only holds so
 3947|       |                  // much, and an object wider than it has no start left to return to.
 3948|       |                  auto position_after_tag = [&] {
 3949|       |                     if (first_key) {
 3950|       |                        if (*it == ',') ++it; // skip comma; handles tag-only objects where *it == '}'
 3951|       |                        return true;
 3952|       |                     }
 3953|       |                     return start.rewind(ctx, it, end); // tag came later, re-parse from the beginning
 3954|       |                  };
 3955|       |                  // `first_key` also answers "were we reset to the object start", which is what
 3956|       |                  // position_after_tag does for every key but the first.
 3957|       |                  for (; *it != '}'; first_key = false) {
 3958|       |                     if (!first_key) {
 3959|       |                        if (match_invalid_end<',', Opts>(ctx, it, end)) {
 3960|       |                           return;
 3961|       |                        }
 3962|       |                     }
 3963|       |
 3964|       |                     if (skip_ws<Opts>(ctx, it, end)) {
 3965|       |                        return;
 3966|       |                     }
 3967|       |                     if (match_invalid_end<'"', Opts>(ctx, it, end)) {
 3968|       |                        return;
 3969|       |                     }
 3970|       |
 3971|       |                     auto* key_start = it;
 3972|       |                     skip_string_view(ctx, it, end);
 3973|       |                     if (bool(ctx.error)) [[unlikely]]
 3974|       |                        return;
 3975|       |                     if (validate_utf8_span<Opts>(ctx, key_start, it)) [[unlikely]]
 3976|       |                        return;
 3977|       |                     const sv key = {key_start, size_t(it - key_start)};
 3978|       |
 3979|       |                     if (match_invalid_end<'"', Opts>(ctx, it, end)) {
 3980|       |                        return;
 3981|       |                     }
 3982|       |
 3983|       |                     if constexpr (deduction_key_count > 0) {
 3984|       |                        // We first check if a tag is defined and see if the key matches the tag
 3985|       |                        if constexpr (not tag_v<T>.empty()) {
 3986|       |                           if (key == tag_v<T>) {
 3987|       |                              if (parse_ws_colon<Opts>(ctx, it, end)) {
 3988|       |                                 return;
 3989|       |                              }
 3990|       |
 3991|       |                              using id_type = std::decay_t<decltype(ids_v<T>[0])>;
 3992|       |
 3993|       |                              std::conditional_t<std::integral<id_type>, id_type, sv> type_id{};
 3994|       |                              if constexpr (std::integral<id_type>) {
 3995|       |                                 from<JSON, id_type>::template op<ws_handled<Opts>()>(type_id, ctx, it, end);
 3996|       |                              }
 3997|       |                              else {
 3998|       |                                 // The id is turned into an index below and never leaves this
 3999|       |                                 // reader, so the view of the window it borrows cannot outlive it.
 4000|       |                                 parse_transient_string_view<ws_handled<Opts>()>(type_id, ctx, it, end);
 4001|       |                              }
 4002|       |                              if (bool(ctx.error)) [[unlikely]]
 4003|       |                                 return;
 4004|       |                              if (skip_ws<Opts>(ctx, it, end)) {
 4005|       |                                 return;
 4006|       |                              }
 4007|       |                              if (!(*it == ',' || *it == '}')) [[unlikely]] {
 4008|       |                                 ctx.error = error_code::syntax_error;
 4009|       |                                 return;
 4010|       |                              }
 4011|       |
 4012|       |                              size_t type_index;
 4013|       |                              if constexpr (std::integral<id_type>) {
 4014|       |                                 type_index = variant_id_to_index<T>::op(type_id);
 4015|       |                              }
 4016|       |                              else {
 4017|       |                                 type_index = variant_id_to_index<T>::op(
 4018|       |                                    type_id.data(), type_id.data() + type_id.size(), type_id.size());
 4019|       |                              }
 4020|       |                              if (type_index < ids_v<T>.size()) [[likely]] {
 4021|       |                                 // Check if the deduced types include the tag-specified type
 4022|       |                                 // If not, the tag doesn't match the fields
 4023|       |                                 // We're already inside if constexpr (deduction_registry.size()), so we know deduction
 4024|       |                                 // is happening. At this point, possible_types has been narrowed by field deduction.
 4025|       |                                 // Check if the tag-specified type is still possible
 4026|       |                                 const bool type_is_possible = possible_types[type_index];
 4027|       |                                 if (!type_is_possible) {
 4028|       |                                    // Tag specifies a type that doesn't match the fields seen so far
 4029|       |                                    ctx.error = error_code::no_matching_variant_type;
 4030|       |                                    return;
 4031|       |                                 }
 4032|       |
 4033|       |                                 if (!position_after_tag()) return;
 4034|       |                                 tag_specified_index = type_index; // Store the tag-specified type
 4035|       |                                 if (value.index() != type_index) emplace_runtime_variant(value, type_index);
 4036|       |                                 std::visit(
 4037|       |                                    [&](auto&& v) {
 4038|       |                                       using V = std::decay_t<decltype(v)>;
 4039|       |                                       constexpr bool is_object =
 4040|       |                                          (glaze_object_t<V> || reflectable<V>) && not custom_read<V>;
 4041|       |                                       if constexpr (variant_unit_alternative<V>) {
 4042|       |                                          // A unit alternative carries no data; its object holds only the
 4043|       |                                          // discriminator. Consume that body through an empty reflected object so
 4044|       |                                          // unknown-key policy and terminator handling match every other alternative.
 4045|       |                                          detail::variant_unit_body unit_body{};
 4046|       |                                          from<JSON, detail::variant_unit_body>::template op<opening_handled<Opts>(),
 4047|       |                                                                                             tag_literal>(unit_body,
 4048|       |                                                                                                          ctx, it, end);
 4049|       |                                       }
 4050|       |                                       else if constexpr (is_object) {
 4051|       |                                          if constexpr (contains_tag<V, tag_literal>()) {
 4052|       |                                             // tag is a struct field, must re-parse
 4053|       |                                             if (!start.rewind(ctx, it, end)) return;
 4054|       |                                          }
 4055|       |                                          from<JSON, V>::template op<opening_handled<Opts>(), tag_literal>(v, ctx, it,
 4056|       |                                                                                                           end);
 4057|       |                                       }
 4058|       |                                       else if constexpr (is_memory_object<V>) {
 4059|       |                                          if (!v) {
 4060|       |                                             if constexpr (is_specialization_v<V, std::optional>) {
 4061|       |                                                if constexpr (requires { v.emplace(); }) {
 4062|       |                                                   v.emplace();
 4063|       |                                                }
 4064|       |                                                else {
 4065|       |                                                   v = typename V::value_type{};
 4066|       |                                                }
 4067|       |                                             }
 4068|       |                                             else if constexpr (is_specialization_v<V, std::unique_ptr>)
 4069|       |                                                v = std::make_unique<typename V::element_type>();
 4070|       |                                             else if constexpr (is_specialization_v<V, std::shared_ptr>)
 4071|       |                                                v = std::make_shared<typename V::element_type>();
 4072|       |                                             else if constexpr (constructible<V>) {
 4073|       |                                                v = meta_construct_v<V>();
 4074|       |                                             }
 4075|       |                                             else if constexpr (std::is_pointer_v<V> &&
 4076|       |                                                                can_allocate_raw_pointer<Opts,
 4077|       |                                                                                         std::decay_t<decltype(ctx)>>) {
 4078|       |                                                if (!try_allocate_raw_pointer<Opts>(v, ctx)) {
 4079|       |                                                   return;
 4080|       |                                                }
 4081|       |                                             }
 4082|       |                                             else {
 4083|       |                                                ctx.error = error_code::invalid_nullable_read;
 4084|       |                                                return;
 4085|       |                                                // Cannot read into unset nullable that is not std::optional,
 4086|       |                                                // std::unique_ptr, or std::shared_ptr
 4087|       |                                             }
 4088|       |                                          }
 4089|       |                                          if constexpr (contains_tag<memory_type<V>, tag_literal>()) {
 4090|       |                                             // tag is a struct field, must re-parse
 4091|       |                                             if (!start.rewind(ctx, it, end)) return;
 4092|       |                                          }
 4093|       |                                          from<JSON, memory_type<V>>::template op<opening_handled<Opts>(), tag_literal>(
 4094|       |                                             *v, ctx, it, end);
 4095|       |                                       }
 4096|       |                                       else if constexpr (custom_read<V>) {
 4097|       |                                          // Custom handlers parse the remaining body themselves and do not
 4098|       |                                          // accept the tag template parameter; the tag was already consumed.
 4099|       |                                          // This only works when the tag was the first key. If it came later,
 4100|       |                                          // we were reset to the object start and the custom handler would
 4101|       |                                          // absorb the tag, so error rather than corrupt the value.
 4102|       |                                          if (!first_key) {
 4103|       |                                             ctx.error = error_code::feature_not_supported;
 4104|       |                                             ctx.custom_error_message =
 4105|       |                                                "the tag must be the first key for a custom variant alternative";
 4106|       |                                             return;
 4107|       |                                          }
 4108|       |                                          from<JSON, V>::template op<opening_handled<Opts>()>(v, ctx, it, end);
 4109|       |                                       }
 4110|       |                                    },
 4111|       |                                    value);
 4112|       |
 4113|       |                                 return; // we've decoded our target type
 4114|       |                              }
 4115|       |                              else [[unlikely]] {
 4116|       |                                 // Check if we have a default type (ids array shorter than variant)
 4117|       |                                 constexpr auto ids_size = ids_v<T>.size();
 4118|       |                                 constexpr auto variant_size = std::variant_size_v<T>;
 4119|       |                                 if constexpr (ids_size < variant_size) {
 4120|       |                                    // Use the first unlabeled type as the default
 4121|       |                                    const auto default_type_index = ids_size;
 4122|       |
 4123|       |                                    if (!position_after_tag()) return;
 4124|       |                                    tag_specified_index = default_type_index; // Store the default type index
 4125|       |                                    if (value.index() != default_type_index)
 4126|       |                                       emplace_runtime_variant(value, default_type_index);
 4127|       |                                    std::visit(
 4128|       |                                       [&](auto&& v) {
 4129|       |                                          using V = std::decay_t<decltype(v)>;
 4130|       |                                          constexpr bool is_object =
 4131|       |                                             (glaze_object_t<V> || reflectable<V>) && not custom_read<V>;
 4132|       |                                          if constexpr (variant_unit_alternative<V>) {
 4133|       |                                             // A unit alternative carries no data; its object holds only the
 4134|       |                                             // discriminator. Consume that body through an empty reflected object so
 4135|       |                                             // unknown-key policy and terminator handling match every other
 4136|       |                                             // alternative.
 4137|       |                                             detail::variant_unit_body unit_body{};
 4138|       |                                             from<JSON, detail::variant_unit_body>::template op<opening_handled<Opts>(),
 4139|       |                                                                                                tag_literal>(
 4140|       |                                                unit_body, ctx, it, end);
 4141|       |                                          }
 4142|       |                                          else if constexpr (is_object) {
 4143|       |                                             if constexpr (contains_tag<V, tag_literal>()) {
 4144|       |                                                // tag is a struct field, must re-parse
 4145|       |                                                if (!start.rewind(ctx, it, end)) return;
 4146|       |                                             }
 4147|       |                                             from<JSON, V>::template op<opening_handled<Opts>()>(v, ctx, it, end);
 4148|       |                                          }
 4149|       |                                          else if constexpr (is_memory_object<V>) {
 4150|       |                                             if (!v) {
 4151|       |                                                if constexpr (is_specialization_v<V, std::optional>) {
 4152|       |                                                   if constexpr (requires { v.emplace(); }) {
 4153|       |                                                      v.emplace();
 4154|       |                                                   }
 4155|       |                                                   else {
 4156|       |                                                      v = typename V::value_type{};
 4157|       |                                                   }
 4158|       |                                                }
 4159|       |                                                else if constexpr (is_specialization_v<V, std::unique_ptr>)
 4160|       |                                                   v = std::make_unique<typename V::element_type>();
 4161|       |                                                else if constexpr (is_specialization_v<V, std::shared_ptr>)
 4162|       |                                                   v = std::make_shared<typename V::element_type>();
 4163|       |                                                else if constexpr (constructible<V>) {
 4164|       |                                                   v = meta_construct_v<V>();
 4165|       |                                                }
 4166|       |                                                else if constexpr (std::is_pointer_v<V> &&
 4167|       |                                                                   can_allocate_raw_pointer<
 4168|       |                                                                      Opts, std::decay_t<decltype(ctx)>>) {
 4169|       |                                                   if (!try_allocate_raw_pointer<Opts>(v, ctx)) {
 4170|       |                                                      return;
 4171|       |                                                   }
 4172|       |                                                }
 4173|       |                                                else {
 4174|       |                                                   ctx.error = error_code::invalid_nullable_read;
 4175|       |                                                   return;
 4176|       |                                                }
 4177|       |                                             }
 4178|       |                                             if constexpr (contains_tag<memory_type<V>, tag_literal>()) {
 4179|       |                                                // tag is a struct field, must re-parse
 4180|       |                                                if (!start.rewind(ctx, it, end)) return;
 4181|       |                                             }
 4182|       |                                             from<JSON, memory_type<V>>::template op<opening_handled<Opts>()>(*v, ctx,
 4183|       |                                                                                                              it, end);
 4184|       |                                          }
 4185|       |                                          else if constexpr (custom_read<V>) {
 4186|       |                                             // Custom handlers parse the remaining body themselves; this only
 4187|       |                                             // works when the tag was the first key (see above). If it came
 4188|       |                                             // later we were reset to the object start, so error rather than
 4189|       |                                             // let the custom handler absorb the tag.
 4190|       |                                             if (!first_key) {
 4191|       |                                                ctx.error = error_code::feature_not_supported;
 4192|       |                                                ctx.custom_error_message =
 4193|       |                                                   "the tag must be the first key for a custom variant alternative";
 4194|       |                                                return;
 4195|       |                                             }
 4196|       |                                             from<JSON, V>::template op<opening_handled<Opts>()>(v, ctx, it, end);
 4197|       |                                          }
 4198|       |                                       },
 4199|       |                                       value);
 4200|       |
 4201|       |                                    return;
 4202|       |                                 }
 4203|       |                                 else {
 4204|       |                                    ctx.error = error_code::no_matching_variant_type;
 4205|       |                                    ctx.custom_error_message = variant_ids_string_v<T>;
 4206|       |                                    return;
 4207|       |                                 }
 4208|       |                              }
 4209|       |                           }
 4210|       |                        }
 4211|       |
 4212|       |                        // Inline decode_hash lookup for variant deduction
 4213|       |                        using deduction_keys_t = keys_wrapper<variant_deduction_keys<T>>;
 4214|       |                        constexpr auto& DeductionHashInfo = hash_info<deduction_keys_t>;
 4215|       |                        const auto deduction_index =
 4216|       |                           decode_hash_with_size<JSON, deduction_keys_t, DeductionHashInfo, DeductionHashInfo.type>::op(
 4217|       |                              key.data(), key.data() + key.size(), key.size());
 4218|       |                        if (deduction_index < deduction_key_count && variant_deduction_keys<T>[deduction_index] == key)
 4219|       |                           [[likely]] {
 4220|       |                           possible_types &= deduction_bits[deduction_index];
 4221|       |                        }
 4222|       |                        else if constexpr (Opts.error_on_unknown_keys) {
 4223|       |                           ctx.error = error_code::unknown_key;
 4224|       |                           return;
 4225|       |                        }
 4226|       |                     }
 4227|       |                     else if constexpr (not tag_v<T>.empty()) {
 4228|       |                        // empty object case for variant, if there are no normal elements
 4229|       |                        if (key == tag_v<T>) {
 4230|       |                           if (parse_ws_colon<Opts>(ctx, it, end)) {
 4231|       |                              return;
 4232|       |                           }
 4233|       |
 4234|       |                           // The id is turned into an index below and never leaves this reader,
 4235|       |                           // so the view of the window it borrows cannot outlive that window.
 4236|       |                           std::string_view type_id{};
 4237|       |                           parse_transient_string_view<ws_handled<Opts>()>(type_id, ctx, it, end);
 4238|       |                           if (bool(ctx.error)) [[unlikely]]
 4239|       |                              return;
 4240|       |                           if (skip_ws<Opts>(ctx, it, end)) {
 4241|       |                              return;
 4242|       |                           }
 4243|       |
 4244|       |                           const auto type_index = variant_id_to_index<T>::op(
 4245|       |                              type_id.data(), type_id.data() + type_id.size(), type_id.size());
 4246|       |                           if (type_index < ids_v<T>.size()) [[likely]] {
 4247|       |                              if (!position_after_tag()) return;
 4248|       |                              tag_specified_index = type_index; // Store the tag-specified type
 4249|       |                              if (value.index() != type_index) emplace_runtime_variant(value, type_index);
 4250|       |                           }
 4251|       |                           else {
 4252|       |                              // Check if we have a default type (ids array shorter than variant)
 4253|       |                              constexpr auto ids_size = ids_v<T>.size();
 4254|       |                              constexpr auto variant_size = std::variant_size_v<T>;
 4255|       |                              if constexpr (ids_size < variant_size) {
 4256|       |                                 // Use the first unlabeled type as the default
 4257|       |                                 if (!position_after_tag()) return;
 4258|       |                                 const auto default_index = ids_size;
 4259|       |                                 tag_specified_index = default_index; // Store the default type index
 4260|       |                                 if (value.index() != default_index) emplace_runtime_variant(value, default_index);
 4261|       |                              }
 4262|       |                              else {
 4263|       |                                 ctx.error = error_code::no_matching_variant_type;
 4264|       |                                 ctx.custom_error_message = variant_ids_string_v<T>;
 4265|       |                                 return;
 4266|       |                              }
 4267|       |                           }
 4268|       |                           // Parse the type (handles tag skipping and unknown keys)
 4269|       |                           std::visit(
 4270|       |                              [&](auto&& v) {
 4271|       |                                 using V = std::decay_t<decltype(v)>;
 4272|       |                                 if constexpr (custom_read<V>) {
 4273|       |                                    // Custom handlers parse the remaining object body themselves and do not
 4274|       |                                    // accept the tag template parameter that reflected objects use to skip an
 4275|       |                                    // interior tag key. That only works when the tag is the first key (it was
 4276|       |                                    // just consumed). If the tag came after other keys, position_after_tag()
 4277|       |                                    // reset us to the object start and the custom handler would absorb the tag
 4278|       |                                    // into its value, so error here rather than corrupt the result.
 4279|       |                                    if (!first_key) {
 4280|       |                                       ctx.error = error_code::feature_not_supported;
 4281|       |                                       ctx.custom_error_message =
 4282|       |                                          "the tag must be the first key for a custom variant alternative";
 4283|       |                                       return;
 4284|       |                                    }
 4285|       |                                    from<JSON, V>::template op<opening_handled<Opts>()>(v, ctx, it, end);
 4286|       |                                 }
 4287|       |                                 else {
 4288|       |                                    if constexpr (contains_tag<V, tag_literal>()) {
 4289|       |                                       // tag is a struct field, must re-parse
 4290|       |                                       if (!start.rewind(ctx, it, end)) return;
 4291|       |                                    }
 4292|       |                                    from<JSON, V>::template op<opening_handled<Opts>(), tag_literal>(v, ctx, it, end);
 4293|       |                                 }
 4294|       |                              },
 4295|       |                              value);
 4296|       |                           return;
 4297|       |                        }
 4298|       |                        else if constexpr (Opts.error_on_unknown_keys) {
 4299|       |                           ctx.error = error_code::unknown_key;
 4300|       |                           return;
 4301|       |                        }
 4302|       |                        else {
 4303|       |                           // Skip unknown key's value (non-tag key in empty variant)
 4304|       |                           if (parse_ws_colon<Opts>(ctx, it, end)) {
 4305|       |                              return;
 4306|       |                           }
 4307|       |                           skip_value<JSON>::op<Opts>(ctx, it, end);
 4308|       |                           if (bool(ctx.error)) [[unlikely]]
 4309|       |                              return;
 4310|       |                           resync_window_end(ctx, end); // a streaming skip refills
 4311|       |                           if (skip_ws<Opts>(ctx, it, end)) {
 4312|       |                              return;
 4313|       |                           }
 4314|       |                           continue; // Continue loop to find the tag
 4315|       |                        }
 4316|       |                     }
 4317|       |                     else if constexpr (Opts.error_on_unknown_keys) {
 4318|       |                        ctx.error = error_code::unknown_key;
 4319|       |                        return;
 4320|       |                     }
 4321|       |
 4322|       |                     auto matching_types = possible_types.popcount();
 4323|       |                     if (matching_types == 0) {
 4324|       |                        ctx.error = error_code::no_matching_variant_type;
 4325|       |                        return;
 4326|       |                     }
 4327|       |                     // Only short-circuit for variants without tags
 4328|       |                     else if constexpr (tag_v<T>.empty()) {
 4329|       |                        if (matching_types == 1) {
 4330|       |                           if (!start.rewind(ctx, it, end)) return;
 4331|       |                           const auto type_index = possible_types.countr_zero();
 4332|       |
 4333|       |                           if (value.index() != static_cast<size_t>(type_index))
 4334|       |                              emplace_runtime_variant(value, type_index);
 4335|       |                           std::visit(
 4336|       |                              [&](auto&& v) {
 4337|       |                                 using V = std::decay_t<decltype(v)>;
 4338|       |                                 constexpr bool is_object = (glaze_object_t<V> || reflectable<V>) && not custom_read<V>;
 4339|       |                                 if constexpr (variant_unit_alternative<V>) {
 4340|       |                                    // A unit alternative carries no data; its object holds only the discriminator.
 4341|       |                                    // Consume that body through an empty reflected object so unknown-key policy and
 4342|       |                                    // terminator handling match every other alternative.
 4343|       |                                    detail::variant_unit_body unit_body{};
 4344|       |                                    from<JSON, detail::variant_unit_body>::template op<opening_handled<Opts>(),
 4345|       |                                                                                       tag_literal>(unit_body, ctx, it,
 4346|       |                                                                                                    end);
 4347|       |                                 }
 4348|       |                                 else if constexpr (is_object) {
 4349|       |                                    from<JSON, V>::template op<opening_handled<Opts>(), tag_literal>(v, ctx, it, end);
 4350|       |                                 }
 4351|       |                                 else if constexpr (is_memory_object<V>) {
 4352|       |                                    if (!v) {
 4353|       |                                       if constexpr (is_specialization_v<V, std::optional>) {
 4354|       |                                          if constexpr (requires { v.emplace(); }) {
 4355|       |                                             v.emplace();
 4356|       |                                          }
 4357|       |                                          else {
 4358|       |                                             v = typename V::value_type{};
 4359|       |                                          }
 4360|       |                                       }
 4361|       |                                       else if constexpr (is_specialization_v<V, std::unique_ptr>)
 4362|       |                                          v = std::make_unique<typename V::element_type>();
 4363|       |                                       else if constexpr (is_specialization_v<V, std::shared_ptr>)
 4364|       |                                          v = std::make_shared<typename V::element_type>();
 4365|       |                                       else if constexpr (constructible<V>) {
 4366|       |                                          v = meta_construct_v<V>();
 4367|       |                                       }
 4368|       |                                       else if constexpr (std::is_pointer_v<V> &&
 4369|       |                                                          can_allocate_raw_pointer<Opts, std::decay_t<decltype(ctx)>>) {
 4370|       |                                          if (!try_allocate_raw_pointer<Opts>(v, ctx)) {
 4371|       |                                             return;
 4372|       |                                          }
 4373|       |                                       }
 4374|       |                                       else {
 4375|       |                                          ctx.error = error_code::invalid_nullable_read;
 4376|       |                                          return;
 4377|       |                                          // Cannot read into unset nullable that is not std::optional,
 4378|       |                                          // std::unique_ptr, or std::shared_ptr
 4379|       |                                       }
 4380|       |                                    }
 4381|       |                                    from<JSON, memory_type<V>>::template op<opening_handled<Opts>(), tag_literal>(
 4382|       |                                       *v, ctx, it, end);
 4383|       |                                 }
 4384|       |                                 else if constexpr (custom_read<V>) {
 4385|       |                                    // Custom handlers parse the remaining body themselves.
 4386|       |                                    from<JSON, V>::template op<opening_handled<Opts>()>(v, ctx, it, end);
 4387|       |                                 }
 4388|       |                              },
 4389|       |                              value);
 4390|       |
 4391|       |                           return; // we've decoded our target type
 4392|       |                        }
 4393|       |                     }
 4394|       |                     // For tagged variants, continue processing to validate tags
 4395|       |                     if (parse_ws_colon<Opts>(ctx, it, end)) {
 4396|       |                        return;
 4397|       |                     }
 4398|       |
 4399|       |                     skip_value<JSON>::op<Opts>(ctx, it, end);
 4400|       |                     if (bool(ctx.error)) [[unlikely]]
 4401|       |                        return;
 4402|       |                     resync_window_end(ctx, end); // a streaming skip refills
 4403|       |                     if (skip_ws<Opts>(ctx, it, end)) {
 4404|       |                        return;
 4405|       |                     }
 4406|       |                  }
 4407|       |                  // Only apply ambiguous variant resolution if we have multiple object types
 4408|       |                  if constexpr ((type_counts::n_object + type_counts::n_nullable_object) > 1) {
 4409|       |                     // After parsing all keys, check if we have multiple matching types
 4410|       |                     // If so, choose the one with the fewest fields
 4411|       |                     auto final_matching = possible_types.popcount();
 4412|       |                     if (final_matching == 0) {
 4413|       |                        ctx.error = error_code::no_matching_variant_type;
 4414|       |                     }
 4415|       |                     else if (final_matching == 1) {
 4416|       |                        // Single type remains after field deduction
 4417|       |                        const auto type_index = possible_types.countr_zero();
 4418|       |
 4419|       |                        // Validate against tag if one was specified
 4420|       |                        if (tag_specified_index.has_value() &&
 4421|       |                            tag_specified_index.value() != static_cast<size_t>(type_index)) {
 4422|       |                           ctx.error = error_code::no_matching_variant_type;
 4423|       |                           return;
 4424|       |                        }
 4425|       |
 4426|       |                        if (!start.rewind(ctx, it, end)) return;
 4427|       |                        if (value.index() != static_cast<size_t>(type_index))
 4428|       |                           emplace_runtime_variant(value, type_index);
 4429|       |                        std::visit(
 4430|       |                           [&](auto&& v) {
 4431|       |                              using V = std::decay_t<decltype(v)>;
 4432|       |                              constexpr bool is_object = (glaze_object_t<V> || reflectable<V>) && not custom_read<V>;
 4433|       |                              if constexpr (variant_unit_alternative<V>) {
 4434|       |                                 // A unit alternative carries no data; its object holds only the discriminator.
 4435|       |                                 // Consume that body through an empty reflected object so unknown-key policy and
 4436|       |                                 // terminator handling match every other alternative.
 4437|       |                                 detail::variant_unit_body unit_body{};
 4438|       |                                 from<JSON, detail::variant_unit_body>::template op<opening_handled<Opts>(),
 4439|       |                                                                                    tag_literal>(unit_body, ctx, it,
 4440|       |                                                                                                 end);
 4441|       |                              }
 4442|       |                              else if constexpr (is_object) {
 4443|       |                                 from<JSON, V>::template op<opening_handled<Opts>(), tag_literal>(v, ctx, it, end);
 4444|       |                              }
 4445|       |                              else if constexpr (is_memory_object<V>) {
 4446|       |                                 if (!v) {
 4447|       |                                    if constexpr (is_specialization_v<V, std::optional>) {
 4448|       |                                       if constexpr (requires { v.emplace(); }) {
 4449|       |                                          v.emplace();
 4450|       |                                       }
 4451|       |                                       else {
 4452|       |                                          v = typename V::value_type{};
 4453|       |                                       }
 4454|       |                                    }
 4455|       |                                    else if constexpr (is_specialization_v<V, std::unique_ptr>)
 4456|       |                                       v = std::make_unique<typename V::element_type>();
 4457|       |                                    else if constexpr (is_specialization_v<V, std::shared_ptr>)
 4458|       |                                       v = std::make_shared<typename V::element_type>();
 4459|       |                                    else if constexpr (constructible<V>) {
 4460|       |                                       v = meta_construct_v<V>();
 4461|       |                                    }
 4462|       |                                    else if constexpr (std::is_pointer_v<V> &&
 4463|       |                                                       can_allocate_raw_pointer<Opts, std::decay_t<decltype(ctx)>>) {
 4464|       |                                       if (!try_allocate_raw_pointer<Opts>(v, ctx)) {
 4465|       |                                          return;
 4466|       |                                       }
 4467|       |                                    }
 4468|       |                                    else {
 4469|       |                                       ctx.error = error_code::invalid_nullable_read;
 4470|       |                                       return;
 4471|       |                                    }
 4472|       |                                 }
 4473|       |                                 from<JSON, memory_type<V>>::template op<opening_handled<Opts>(), tag_literal>(*v, ctx,
 4474|       |                                                                                                               it, end);
 4475|       |                              }
 4476|       |                              else if constexpr (custom_read<V>) {
 4477|       |                                 // Custom handlers parse the remaining body themselves.
 4478|       |                                 from<JSON, V>::template op<opening_handled<Opts>()>(v, ctx, it, end);
 4479|       |                              }
 4480|       |                           },
 4481|       |                           value);
 4482|       |                     }
 4483|       |                     else if (final_matching > 1) {
 4484|       |                        constexpr auto N = std::variant_size_v<T>;
 4485|       |
 4486|       |                        // Compile-time array of field counts for each variant type
 4487|       |                        constexpr auto field_counts = []<size_t... I>(std::index_sequence<I...>) {
 4488|       |                           return std::array<size_t, N> {
 4489|       |                              ([]<size_t J = I>() -> size_t {
 4490|       |                                 using V = std::decay_t<std::variant_alternative_t<J, T>>;
 4491|       |                                 if constexpr (glaze_object_t<V> || reflectable<V>) {
 4492|       |                                    return reflect<V>::size;
 4493|       |                                 }
 4494|       |                                 else if constexpr (is_memory_object<V>) {
 4495|       |                                    using X = memory_type<V>;
 4496|       |                                    if constexpr (glaze_object_t<X> || reflectable<X>) {
 4497|       |                                       return reflect<X>::size;
 4498|       |                                    }
 4499|       |                                    else {
 4500|       |                                       return (std::numeric_limits<size_t>::max)();
 4501|       |                                    }
 4502|       |                                 }
 4503|       |                                 else {
 4504|       |                                    return (std::numeric_limits<size_t>::max)();
 4505|       |                                 }
 4506|       |                              }.template operator()<I>())...
 4507|       |                           };
 4508|       |                        }(std::make_index_sequence<N>{});
 4509|       |
 4510|       |                        // Find the type with minimum field count among the possible types
 4511|       |                        size_t min_fields = (std::numeric_limits<size_t>::max)();
 4512|       |                        size_t chosen_index = N; // Invalid index initially
 4513|       |
 4514|       |                        for (size_t i = 0; i < N; ++i) {
 4515|       |                           if (possible_types[i] && field_counts[i] < min_fields) {
 4516|       |                              min_fields = field_counts[i];
 4517|       |                              chosen_index = i;
 4518|       |                           }
 4519|       |                        }
 4520|       |
 4521|       |                        if (chosen_index < N) {
 4522|       |                           // Validate against tag if one was specified
 4523|       |                           if (tag_specified_index.has_value() && tag_specified_index.value() != chosen_index) {
 4524|       |                              ctx.error = error_code::no_matching_variant_type;
 4525|       |                              return;
 4526|       |                           }
 4527|       |
 4528|       |                           if (!start.rewind(ctx, it, end)) return;
 4529|       |                           if (value.index() != chosen_index) emplace_runtime_variant(value, chosen_index);
 4530|       |                           std::visit(
 4531|       |                              [&](auto&& v) {
 4532|       |                                 using V = std::decay_t<decltype(v)>;
 4533|       |                                 constexpr bool is_object = (glaze_object_t<V> || reflectable<V>) && not custom_read<V>;
 4534|       |                                 if constexpr (variant_unit_alternative<V>) {
 4535|       |                                    // A unit alternative carries no data; its object holds only the discriminator.
 4536|       |                                    // Consume that body through an empty reflected object so unknown-key policy and
 4537|       |                                    // terminator handling match every other alternative.
 4538|       |                                    detail::variant_unit_body unit_body{};
 4539|       |                                    from<JSON, detail::variant_unit_body>::template op<opening_handled<Opts>(),
 4540|       |                                                                                       tag_literal>(unit_body, ctx, it,
 4541|       |                                                                                                    end);
 4542|       |                                 }
 4543|       |                                 else if constexpr (is_object) {
 4544|       |                                    from<JSON, V>::template op<opening_handled<Opts>(), tag_literal>(v, ctx, it, end);
 4545|       |                                 }
 4546|       |                                 else if constexpr (is_memory_object<V>) {
 4547|       |                                    if (!v) {
 4548|       |                                       if constexpr (is_specialization_v<V, std::optional>) {
 4549|       |                                          if constexpr (requires { v.emplace(); }) {
 4550|       |                                             v.emplace();
 4551|       |                                          }
 4552|       |                                          else {
 4553|       |                                             v = typename V::value_type{};
 4554|       |                                          }
 4555|       |                                       }
 4556|       |                                       else if constexpr (is_specialization_v<V, std::unique_ptr>)
 4557|       |                                          v = std::make_unique<typename V::element_type>();
 4558|       |                                       else if constexpr (is_specialization_v<V, std::shared_ptr>)
 4559|       |                                          v = std::make_shared<typename V::element_type>();
 4560|       |                                       else if constexpr (constructible<V>) {
 4561|       |                                          v = meta_construct_v<V>();
 4562|       |                                       }
 4563|       |                                       else if constexpr (std::is_pointer_v<V> &&
 4564|       |                                                          can_allocate_raw_pointer<Opts, std::decay_t<decltype(ctx)>>) {
 4565|       |                                          if (!try_allocate_raw_pointer<Opts>(v, ctx)) {
 4566|       |                                             return;
 4567|       |                                          }
 4568|       |                                       }
 4569|       |                                       else {
 4570|       |                                          ctx.error = error_code::invalid_nullable_read;
 4571|       |                                          return;
 4572|       |                                       }
 4573|       |                                    }
 4574|       |                                    from<JSON, memory_type<V>>::template op<opening_handled<Opts>(), tag_literal>(
 4575|       |                                       *v, ctx, it, end);
 4576|       |                                 }
 4577|       |                                 else if constexpr (custom_read<V>) {
 4578|       |                                    // Custom handlers parse the remaining body themselves.
 4579|       |                                    from<JSON, V>::template op<opening_handled<Opts>()>(v, ctx, it, end);
 4580|       |                                 }
 4581|       |                              },
 4582|       |                              value);
 4583|       |                        }
 4584|       |                        else {
 4585|       |                           ctx.error = error_code::no_matching_variant_type;
 4586|       |                        }
 4587|       |                     }
 4588|       |                  }
 4589|       |                  else {
 4590|       |                     // For variants with 0 or 1 object types, use the original error handling
 4591|       |                     ctx.error = error_code::no_matching_variant_type;
 4592|       |                  }
 4593|       |               }
 4594|      0|               break;
 4595|  15.3k|            }
 4596|  4.99k|            case '[':
  ------------------
  |  Branch (4596:13): [True: 4.99k, False: 26.6k]
  ------------------
 4597|       |               // As with '{' above: the array reader each alternative goes through counts the level.
 4598|  4.99k|               process_variant_alternatives<T, is_variant_array>::template op<Opts>(value, ctx, it, end);
 4599|  4.99k|               break;
 4600|  2.70k|            case '"': {
  ------------------
  |  Branch (4600:13): [True: 2.70k, False: 28.9k]
  ------------------
 4601|  2.70k|               process_variant_alternatives<T, is_variant_str>::template op<Opts>(value, ctx, it, end);
 4602|  2.70k|               break;
 4603|  15.3k|            }
 4604|    111|            case 't':
  ------------------
  |  Branch (4604:13): [True: 111, False: 31.5k]
  ------------------
 4605|    315|            case 'f': {
  ------------------
  |  Branch (4605:13): [True: 204, False: 31.4k]
  ------------------
 4606|    315|               process_variant_alternatives<T, is_variant_bool>::template op<Opts>(value, ctx, it, end);
 4607|    315|               break;
 4608|    111|            }
 4609|    138|            case 'n':
  ------------------
  |  Branch (4609:13): [True: 138, False: 31.4k]
  ------------------
 4610|       |               if constexpr (variant_count_v<T, is_variant_null> == 0) {
 4611|       |                  ctx.error = error_code::no_matching_variant_type;
 4612|       |               }
 4613|    138|               else {
 4614|    138|                  constexpr auto first_idx = variant_first_index_v<T, is_variant_null>;
 4615|    138|                  using V = std::variant_alternative_t<first_idx, T>;
 4616|    138|                  if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (4616:23): [True: 0, False: 138]
  ------------------
 4617|    138|                  match<"null", Opts>(ctx, it, end);
 4618|    138|               }
 4619|    138|               break;
 4620|  8.02k|            default: {
  ------------------
  |  Branch (4620:13): [True: 8.02k, False: 23.5k]
  ------------------
 4621|       |               // Not bool, string, object, or array so must be number or null
 4622|  8.02k|               process_variant_alternatives<T, is_variant_num>::template op<Opts>(value, ctx, it, end);
 4623|  8.02k|            }
 4624|  31.6k|            }
 4625|       |         }
 4626|       |         else {
 4627|       |            // For non-auto-deducible variants, try each type until one succeeds
 4628|       |            constexpr auto N = std::variant_size_v<T>;
 4629|       |            bool parsed = false;
 4630|       |            bool exhausted = false; // speculation budget spent; see charge_speculation
 4631|       |
 4632|       |            for_each<N>([&]<size_t I>() {
 4633|       |               if (parsed || exhausted || variant_alternative_exhausted(ctx)) return;
 4634|       |
 4635|       |               auto copy_it = it;
 4636|       |               // A rejected alternative may have bailed out inside a container, which leaves its
 4637|       |               // nesting level counted (see enter_depth), so the depth rewinds with the iterator.
 4638|       |               const auto copy_depth = ctx.depth;
 4639|       |
 4640|       |               // Try parsing as this type
 4641|       |               if (value.index() != I) {
 4642|       |                  emplace_runtime_variant(value, I);
 4643|       |               }
 4644|       |
 4645|       |               std::visit([&](auto&& v) { parse<JSON>::op<Options>(v, ctx, it, end); }, value);
 4646|       |               if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 4647|       |                  exhausted = true; // only rejected attempts are charged; see charge_speculation
 4648|       |               }
 4649|       |
 4650|       |               if (!bool(ctx.error)) {
 4651|       |                  parsed = true;
 4652|       |               }
 4653|       |               else if constexpr (not Options.null_terminated) {
 4654|       |                  // In non-null-terminated mode, if we hit end_reached after advancing the iterator,
 4655|       |                  // it means we successfully parsed the value but couldn't skip trailing whitespace
 4656|       |                  if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 4657|       |                     // We advanced the iterator, so we did parse something -- unless what advanced it
 4658|       |                     // was an abandoned attempt, which is what a spent speculation budget means.
 4659|       |                     parsed = true;
 4660|       |                     ctx.error = error_code::none;
 4661|       |                  }
 4662|       |                  else {
 4663|       |                     // Reset for next attempt (unless this is the last type)
 4664|       |                     it = copy_it;
 4665|       |                     rewind_depth<Options>(ctx, copy_depth);
 4666|       |                     if constexpr (I + 1 < N) {
 4667|       |                        if (not exhausted && not variant_alternative_exhausted(ctx)) {
 4668|       |                           ctx.error = error_code::none; // Clear error for next attempt
 4669|       |                        }
 4670|       |                     }
 4671|       |                  }
 4672|       |               }
 4673|       |               else {
 4674|       |                  // Reset for next attempt (unless this is the last type)
 4675|       |                  it = copy_it;
 4676|       |                  rewind_depth<Options>(ctx, copy_depth);
 4677|       |                  if constexpr (I + 1 < N) {
 4678|       |                     if (not exhausted && not variant_alternative_exhausted(ctx)) {
 4679|       |                        ctx.error = error_code::none; // Clear error for next attempt
 4680|       |                     }
 4681|       |                  }
 4682|       |               }
 4683|       |            });
 4684|       |         }
 4685|  31.6k|      }
_ZN3glz5parseILj10EE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES4_EEEETkNS_10is_contextERNS_7contextERPKcSD_EEvOT0_OT1_OT2_T3_:
   49|  78.8k|      {
   50|       |         if constexpr (const_value_v<T>) {
   51|       |            if constexpr (check_error_on_const_read(Opts)) {
   52|       |               ctx.error = error_code::attempt_const_read;
   53|       |            }
   54|       |            else {
   55|       |               // do not read anything into the const value
   56|       |               skip_value<JSON>::op<Opts>(std::forward<Ctx>(ctx), std::forward<It0>(it), end);
   57|       |            }
   58|       |         }
   59|  78.8k|         else {
   60|  78.8k|            using V = std::remove_cvref_t<T>;
   61|  78.8k|            from<JSON, V>::template op<Opts>(std::forward<T>(value), std::forward<Ctx>(ctx), std::forward<It0>(it),
   62|  78.8k|                                             end);
   63|  78.8k|         }
   64|  78.8k|      }
_ZN3glz4fromILj10ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEETnNS_14string_literalEXtlNS9_ILm1EEEEERS5_TkNS_10is_contextERNS_7contextERPKcSF_EEvOT1_OT2_OT3_T4_:
 2791|  78.8k|      {
 2792|  78.8k|         static constexpr auto num_members = reflect<T>::size;
 2793|       |
 2794|  78.8k|         static constexpr auto Opts = opening_handled_off<ws_handled_off<Options>()>();
 2795|       |         if constexpr (!check_opening_handled(Options)) {
 2796|       |            if constexpr (!check_ws_handled(Options)) {
 2797|       |               if (skip_ws<Opts>(ctx, it, end)) {
 2798|       |                  return;
 2799|       |               }
 2800|       |            }
 2801|       |            if (match_invalid_end<'{', Opts>(ctx, it, end)) {
 2802|       |               return;
 2803|       |            }
 2804|       |            if constexpr (not Opts.null_terminated) {
 2805|       |               if (it == end) [[unlikely]] {
 2806|       |                  ctx.error = error_code::unexpected_end;
 2807|       |                  return;
 2808|       |               }
 2809|       |            }
 2810|       |            // one nesting level (see enter_depth): counted in both modes so the limit binds,
 2811|       |            // released at each syntactic close below
 2812|       |            if (enter_depth(ctx)) [[unlikely]] {
 2813|       |               return;
 2814|       |            }
 2815|       |         }
 2816|  78.8k|         const auto ws_start = it;
 2817|  78.8k|         if (skip_ws<Opts>(ctx, it, end)) {
  ------------------
  |  Branch (2817:14): [True: 12, False: 78.7k]
  ------------------
 2818|     12|            return;
 2819|     12|         }
 2820|  78.7k|         const size_t ws_size = size_t(it - ws_start);
 2821|       |
 2822|       |         if constexpr ((glaze_object_t<T> || reflectable<T>) && num_members == 0 && Opts.error_on_unknown_keys) {
 2823|       |            if constexpr (not tag.sv().empty()) {
 2824|       |               if (*it == '"') {
 2825|       |                  ++it;
 2826|       |                  if constexpr (not Opts.null_terminated) {
 2827|       |                     if (it == end) [[unlikely]] {
 2828|       |                        ctx.error = error_code::unexpected_end;
 2829|       |                        return;
 2830|       |                     }
 2831|       |                  }
 2832|       |
 2833|       |                  const auto start = it;
 2834|       |                  skip_string_view(ctx, it, end);
 2835|       |                  if (bool(ctx.error)) [[unlikely]]
 2836|       |                     return;
 2837|       |                  if (validate_utf8_span<Opts>(ctx, start, it)) [[unlikely]]
 2838|       |                     return;
 2839|       |                  const sv key{start, size_t(it - start)};
 2840|       |                  ++it;
 2841|       |                  if constexpr (not Opts.null_terminated) {
 2842|       |                     if (it == end) [[unlikely]] {
 2843|       |                        ctx.error = error_code::unexpected_end;
 2844|       |                        return;
 2845|       |                     }
 2846|       |                  }
 2847|       |
 2848|       |                  if (key == tag.sv()) {
 2849|       |                     if (parse_ws_colon<Opts>(ctx, it, end)) {
 2850|       |                        return;
 2851|       |                     }
 2852|       |
 2853|       |                     parse<JSON>::handle_unknown<Opts>(key, value, ctx, it, end);
 2854|       |                     if (bool(ctx.error)) [[unlikely]]
 2855|       |                        return;
 2856|       |
 2857|       |                     if (skip_ws<Opts>(ctx, it, end)) {
 2858|       |                        return;
 2859|       |                     }
 2860|       |                  }
 2861|       |                  else {
 2862|       |                     ctx.error = error_code::unknown_key;
 2863|       |                     return;
 2864|       |                  }
 2865|       |               }
 2866|       |            }
 2867|       |
 2868|       |            if (*it == '}') [[likely]] {
 2869|       |               --ctx.depth;
 2870|       |               if constexpr (glaze_object_t<T> || reflectable<T>) {
 2871|       |                  if constexpr (has_self_constraint_v<T> && !check_skip_self_constraint(Opts)) {
 2872|       |                     auto wrapper = self_constraint_v<T>(value);
 2873|       |                     from<JSON, decltype(wrapper)>::template op<ws_handled<Opts>()>(wrapper, ctx, it, end);
 2874|       |                     if (bool(ctx.error)) {
 2875|       |                        return;
 2876|       |                     }
 2877|       |                  }
 2878|       |               }
 2879|       |               ++it;
 2880|       |               if constexpr (not Opts.null_terminated) {
 2881|       |                  if (it == end) {
 2882|       |                     ctx.error = error_code::end_reached;
 2883|       |                     return;
 2884|       |                  }
 2885|       |               }
 2886|       |               if constexpr (Opts.partial_read) {
 2887|       |                  ctx.error = error_code::partial_read_complete;
 2888|       |               }
 2889|       |               return;
 2890|       |            }
 2891|       |            ctx.error = error_code::unknown_key;
 2892|       |            return;
 2893|       |         }
 2894|  78.7k|         else {
 2895|  78.7k|            decltype(auto) fields = [&]() -> decltype(auto) {
 2896|  78.7k|               if constexpr ((glaze_object_t<T> || reflectable<T>) &&
 2897|  78.7k|                             (Opts.error_on_missing_keys || Opts.partial_read)) {
 2898|  78.7k|                  return bit_array<num_members>{};
 2899|  78.7k|               }
 2900|  78.7k|               else {
 2901|  78.7k|                  return nullptr;
 2902|  78.7k|               }
 2903|  78.7k|            }();
 2904|       |
 2905|       |            // A file include merges an external document into this object, so with
 2906|       |            // error_on_missing_keys the keys have to be counted across both documents (see
 2907|       |            // context::key_bits). While this object parses, its bits are published for its
 2908|       |            // includer members to hand down; and if this parse is itself an included document,
 2909|       |            // it claims the bits of the object that included us and merges into them at the
 2910|       |            // closing brace instead of running a check of its own.
 2911|  78.7k|            static constexpr bool tracks_include_keys = [] {
 2912|       |               // Nested so that reflecting over the members is only asked for when it can matter
 2913|  78.7k|               if constexpr ((glaze_object_t<T> || reflectable<T>) && Opts.error_on_missing_keys) {
 2914|  78.7k|                  return has_includer_member<T>;
 2915|  78.7k|               }
 2916|  78.7k|               else {
 2917|  78.7k|                  return false;
 2918|  78.7k|               }
 2919|  78.7k|            }();
 2920|  78.7k|            [[maybe_unused]] bit_array<num_members>* include_bits{};
 2921|       |            if constexpr (tracks_include_keys) {
 2922|       |               if (ctx.include_key_type == &include_key_tag<T>) {
 2923|       |                  include_bits = static_cast<bit_array<num_members>*>(ctx.include_key_bits);
 2924|       |                  ctx.include_key_bits = nullptr;
 2925|       |                  ctx.include_key_type = nullptr;
 2926|       |               }
 2927|       |            }
 2928|  78.7k|            [[maybe_unused]] const std::conditional_t<tracks_include_keys,
 2929|  78.7k|                                                      key_bits_scope<std::remove_reference_t<decltype(ctx)>>,
 2930|  78.7k|                                                      inert_key_bits_scope> published_bits{
 2931|  78.7k|               ctx, [&]() -> void* {
 2932|  78.7k|                  if constexpr (tracks_include_keys) {
 2933|  78.7k|                     return &fields;
 2934|  78.7k|                  }
 2935|  78.7k|                  else {
 2936|  78.7k|                     return nullptr;
 2937|  78.7k|                  }
 2938|  78.7k|               }()};
 2939|       |
 2940|  78.7k|            size_t read_count{}; // for partial_read
 2941|       |
 2942|  78.7k|            bool first = true;
 2943|  3.37M|            while (true) {
  ------------------
  |  Branch (2943:20): [True: 3.30M, Folded]
  ------------------
 2944|       |               if constexpr ((glaze_object_t<T> || reflectable<T>) && Opts.partial_read) {
 2945|       |                  static constexpr bit_array<num_members> all_fields = [] {
 2946|       |                     bit_array<num_members> arr{};
 2947|       |                     for (size_t i = 0; i < num_members; ++i) {
 2948|       |                        arr[i] = true;
 2949|       |                     }
 2950|       |                     return arr;
 2951|       |                  }();
 2952|       |
 2953|       |                  if ((all_fields & fields) == all_fields) {
 2954|       |                     ctx.error = error_code::partial_read_complete;
 2955|       |                     --ctx.depth; // as above: an early success still closes this level
 2956|       |                     return;
 2957|       |                  }
 2958|       |               }
 2959|       |
 2960|       |               // Streaming refill point: at start of each iteration, ensure buffer has data
 2961|       |               if constexpr (has_streaming_state<decltype(ctx)>) {
 2962|       |                  if (ctx.stream.enabled()) {
 2963|       |                     const size_t consumed = static_cast<size_t>(it - ctx.stream.data());
 2964|       |                     const size_t remaining = ctx.stream.size() - consumed;
 2965|       |                     // Refill when less than half of buffer remains to ensure space for next key-value pair
 2966|       |                     if (remaining <= ctx.stream.size() / 2 || it >= end) {
 2967|       |                        const char* new_it;
 2968|       |                        const char* new_end;
 2969|       |                        ctx.stream.consume_and_refill(consumed, new_it, new_end);
 2970|       |                        it = new_it;
 2971|       |                        end = new_end;
 2972|       |                        if (it >= end && ctx.stream.at_eof()) {
 2973|       |                           ctx.error = error_code::unexpected_end;
 2974|       |                           return;
 2975|       |                        }
 2976|       |                     }
 2977|       |                  }
 2978|       |               }
 2979|       |
 2980|  3.30M|               if (*it == '}') {
  ------------------
  |  Branch (2980:20): [True: 5.01k, False: 3.29M]
  ------------------
 2981|  5.01k|                  --ctx.depth;
 2982|       |                  if constexpr ((glaze_object_t<T> || reflectable<T>) && Opts.error_on_missing_keys) {
 2983|       |                     const bool defer_to_includer = [&] {
 2984|       |                        if constexpr (tracks_include_keys) {
 2985|       |                           if (include_bits) {
 2986|       |                              // An included document is a fragment: hand the keys it supplied to
 2987|       |                              // the object that included it, which checks the union of both.
 2988|       |                              *include_bits |= fields;
 2989|       |                              return true;
 2990|       |                           }
 2991|       |                        }
 2992|       |                        return false;
 2993|       |                     }();
 2994|       |                     constexpr auto req_fields = required_fields<T, Opts>();
 2995|       |                     if (not defer_to_includer && (req_fields & fields) != req_fields) {
 2996|       |                        for (size_t i = 0; i < num_members; ++i) {
 2997|       |                           if (not fields[i] && req_fields[i]) {
 2998|       |                              ctx.custom_error_message = reflect<T>::keys[i];
 2999|       |                              // We just return the first missing key in order to avoid heap allocations
 3000|       |                              break;
 3001|       |                           }
 3002|       |                        }
 3003|       |
 3004|       |                        ctx.error = error_code::missing_key;
 3005|       |                        return;
 3006|       |                     }
 3007|       |                  }
 3008|       |                  if constexpr (glaze_object_t<T> || reflectable<T>) {
 3009|       |                     if constexpr (has_self_constraint_v<T> && !check_skip_self_constraint(Opts)) {
 3010|       |                        auto wrapper = self_constraint_v<T>(value);
 3011|       |                        from<JSON, decltype(wrapper)>::template op<ws_handled<Opts>()>(wrapper, ctx, it, end);
 3012|       |                        if (bool(ctx.error)) {
 3013|       |                           return;
 3014|       |                        }
 3015|       |                     }
 3016|       |                  }
 3017|  5.01k|                  ++it; // Increment after checking for missing keys so errors are within buffer bounds
 3018|  5.01k|                  if constexpr (not Opts.null_terminated) {
 3019|  5.01k|                     if (it == end) {
  ------------------
  |  Branch (3019:26): [True: 10, False: 5.00k]
  ------------------
 3020|     10|                        ctx.error = error_code::end_reached;
 3021|     10|                        return;
 3022|     10|                     }
 3023|  5.01k|                  }
 3024|  5.00k|                  return;
 3025|  5.01k|               }
 3026|  3.29M|               else if (first) {
  ------------------
  |  Branch (3026:25): [True: 73.8k, False: 3.22M]
  ------------------
 3027|  73.8k|                  first = false;
 3028|  73.8k|               }
 3029|  3.22M|               else {
 3030|  3.22M|                  if (match_invalid_end<',', Opts>(ctx, it, end)) {
  ------------------
  |  Branch (3030:23): [True: 1.84k, False: 3.22M]
  ------------------
 3031|  1.84k|                     return;
 3032|  1.84k|                  }
 3033|  3.22M|                  if constexpr (not Opts.null_terminated) {
 3034|  3.22M|                     if (it == end) [[unlikely]] {
  ------------------
  |  Branch (3034:26): [True: 0, False: 3.22M]
  ------------------
 3035|      0|                        ctx.error = error_code::unexpected_end;
 3036|      0|                        return;
 3037|      0|                     }
 3038|  3.22M|                  }
 3039|       |
 3040|       |                  if constexpr ((not Opts.minified) && (num_members > 1 || not Opts.error_on_unknown_keys) &&
 3041|       |                                (!Opts.comments)) {
 3042|       |                     if (ws_size && ws_size < size_t(end - it)) {
 3043|       |                        skip_matching_ws(ws_start, it, ws_size);
 3044|       |                     }
 3045|       |                  }
 3046|       |
 3047|  3.22M|                  if (skip_ws<Opts>(ctx, it, end)) {
  ------------------
  |  Branch (3047:23): [True: 12, False: 3.22M]
  ------------------
 3048|     12|                     return;
 3049|     12|                  }
 3050|  3.22M|               }
 3051|       |
 3052|  3.29M|               constexpr auto reflection_type = glaze_object_t<T> || reflectable<T>;
  ------------------
  |  Branch (3052:49): [Folded, False: 0]
  |  Branch (3052:70): [Folded, False: 0]
  ------------------
 3053|       |
 3054|       |               if constexpr (reflection_type && (num_members == 0)) {
 3055|       |                  if constexpr (Opts.error_on_unknown_keys) {
 3056|       |                     static_assert(false_v<T>, "This should be unreachable");
 3057|       |                  }
 3058|       |                  else {
 3059|       |                     if (match_invalid_end<'"', Opts>(ctx, it, end)) {
 3060|       |                        return;
 3061|       |                     }
 3062|       |
 3063|       |                     // parsing to an empty object, but at this point the JSON presents keys
 3064|       |
 3065|       |                     // Unknown key handler does not unescape keys. Unknown escaped keys are
 3066|       |                     // handled by the user.
 3067|       |
 3068|       |                     const auto start = it;
 3069|       |                     uint64_t ascii_acc{};
 3070|       |                     skip_string_view(ctx, it, end, ascii_acc);
 3071|       |                     if (bool(ctx.error)) [[unlikely]]
 3072|       |                        return;
 3073|       |                     if (validate_utf8_span<Opts>(ctx, start, it, ascii_acc)) [[unlikely]]
 3074|       |                        return;
 3075|       |                     const sv key{start, size_t(it - start)};
 3076|       |                     ++it;
 3077|       |                     if constexpr (not Opts.null_terminated) {
 3078|       |                        if (it == end) [[unlikely]] {
 3079|       |                           ctx.error = error_code::unexpected_end;
 3080|       |                           return;
 3081|       |                        }
 3082|       |                     }
 3083|       |
 3084|       |                     if (parse_ws_colon<Opts>(ctx, it, end)) {
 3085|       |                        return;
 3086|       |                     }
 3087|       |
 3088|       |                     // Check if this key is the variant tag that should be skipped
 3089|       |                     if constexpr (not tag.sv().empty()) {
 3090|       |                        if (key == tag.sv()) {
 3091|       |                           // Skip the tag value
 3092|       |                           skip_value<JSON>::op<Opts>(ctx, it, end);
 3093|       |                           if (bool(ctx.error)) [[unlikely]]
 3094|       |                              return;
 3095|       |                           resync_window_end(ctx, end); // a streaming skip refills
 3096|       |                           if (skip_ws<Opts>(ctx, it, end)) {
 3097|       |                              return;
 3098|       |                           }
 3099|       |                           continue;
 3100|       |                        }
 3101|       |                     }
 3102|       |
 3103|       |                     parse<JSON>::handle_unknown<Opts>(key, value, ctx, it, end);
 3104|       |                     if (bool(ctx.error)) [[unlikely]]
 3105|       |                        return;
 3106|       |                     if constexpr (not Opts.null_terminated) {
 3107|       |                        if (it == end) [[unlikely]] {
 3108|       |                           ctx.error = error_code::unexpected_end;
 3109|       |                           return;
 3110|       |                        }
 3111|       |                     }
 3112|       |                     if (skip_ws<Opts>(ctx, it, end)) {
 3113|       |                        return;
 3114|       |                     }
 3115|       |                  }
 3116|       |               }
 3117|       |               else if constexpr (reflection_type) {
 3118|       |                  static_assert(bool(hash_info<T>.type));
 3119|       |
 3120|       |                  if (*it != '"') [[unlikely]] {
 3121|       |                     ctx.error = error_code::expected_quote;
 3122|       |                     return;
 3123|       |                  }
 3124|       |                  ++it;
 3125|       |                  if constexpr (not Opts.null_terminated) {
 3126|       |                     if (it == end) [[unlikely]] {
 3127|       |                        ctx.error = error_code::unexpected_end;
 3128|       |                        return;
 3129|       |                     }
 3130|       |                  }
 3131|       |
 3132|       |                  if constexpr (not tag.sv().empty() && not contains_tag<T, tag>()) {
 3133|       |                     // For tagged variants we first check to see if the key matches the tag
 3134|       |                     // We only need to do this if the tag is not part of the keys
 3135|       |
 3136|       |                     const auto start = it;
 3137|       |                     uint64_t ascii_acc{};
 3138|       |                     skip_string_view(ctx, it, end, ascii_acc);
 3139|       |                     if (bool(ctx.error)) [[unlikely]]
 3140|       |                        return;
 3141|       |                     if (validate_utf8_span<Opts>(ctx, start, it, ascii_acc)) [[unlikely]]
 3142|       |                        return;
 3143|       |                     const sv key{start, size_t(it - start)};
 3144|       |                     ++it;
 3145|       |                     if constexpr (not Opts.null_terminated) {
 3146|       |                        if (it == end) [[unlikely]] {
 3147|       |                           ctx.error = error_code::unexpected_end;
 3148|       |                           return;
 3149|       |                        }
 3150|       |                     }
 3151|       |
 3152|       |                     if (key == tag.sv()) {
 3153|       |                        if (parse_ws_colon<Opts>(ctx, it, end)) {
 3154|       |                           return;
 3155|       |                        }
 3156|       |
 3157|       |                        parse<JSON>::handle_unknown<Opts>(key, value, ctx, it, end);
 3158|       |                        if (bool(ctx.error)) [[unlikely]]
 3159|       |                           return;
 3160|       |
 3161|       |                        if (skip_ws<Opts>(ctx, it, end)) {
 3162|       |                           return;
 3163|       |                        }
 3164|       |                        continue;
 3165|       |                     }
 3166|       |                     else {
 3167|       |                        it = start; // reset the iterator
 3168|       |                     }
 3169|       |                  }
 3170|       |
 3171|       |                  if constexpr (Opts.error_on_missing_keys || Opts.partial_read) {
 3172|       |                     size_t index = num_members;
 3173|       |                     parse_and_invoke<Opts, T>(value, ctx, it, end, index);
 3174|       |                     if (bool(ctx.error)) [[unlikely]]
 3175|       |                        return;
 3176|       |                     if (index < num_members) {
 3177|       |                        fields[index] = true;
 3178|       |                     }
 3179|       |                  }
 3180|       |                  else {
 3181|       |                     parse_and_invoke<Opts, T>(value, ctx, it, end);
 3182|       |                     if (bool(ctx.error)) [[unlikely]]
 3183|       |                        return;
 3184|       |                  }
 3185|       |               }
 3186|  3.29M|               else {
 3187|       |                  // For types like std::map, std::unordered_map
 3188|       |
 3189|  3.29M|                  auto reading = [&](auto&& key) {
 3190|  3.29M|                     if constexpr (Opts.partial_read) {
 3191|  3.29M|                        if (auto element = value.find(key); element != value.end()) {
 3192|  3.29M|                           ++read_count;
 3193|  3.29M|                           parse<JSON>::op<ws_handled<Opts>()>(element->second, ctx, it, end);
 3194|  3.29M|                        }
 3195|  3.29M|                        else {
 3196|  3.29M|                           skip_value<JSON>::op<Opts>(ctx, it, end);
 3197|  3.29M|                        }
 3198|  3.29M|                     }
 3199|  3.29M|                     else {
 3200|  3.29M|                        parse<JSON>::op<ws_handled<Opts>()>(value[key], ctx, it, end);
 3201|  3.29M|                     }
 3202|  3.29M|                  };
 3203|       |
 3204|       |                  // using Key = std::conditional_t<heterogeneous_map<T>, sv, typename T::key_type>;
 3205|  3.29M|                  using Key = typename T::key_type;
 3206|  3.29M|                  if constexpr (std::is_same_v<Key, std::string>) {
 3207|  3.29M|                     ctx.scratch.clear();
 3208|  3.29M|                     parse<JSON>::op<Opts>(ctx.scratch, ctx, it, end);
 3209|  3.29M|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3209:26): [True: 3.57k, False: 3.29M]
  ------------------
 3210|  3.57k|                        return;
 3211|       |
 3212|  3.29M|                     if (parse_ws_colon<Opts>(ctx, it, end)) {
  ------------------
  |  Branch (3212:26): [True: 2.85k, False: 3.28M]
  ------------------
 3213|  2.85k|                        return;
 3214|  2.85k|                     }
 3215|       |
 3216|  3.28M|                     reading(ctx.scratch);
 3217|       |                     if constexpr (Opts.partial_read) {
 3218|       |                        if (read_count == value.size()) {
 3219|       |                           return;
 3220|       |                        }
 3221|       |                     }
 3222|  3.28M|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3222:26): [True: 65.0k, False: 3.22M]
  ------------------
 3223|  65.0k|                        return;
 3224|       |                  }
 3225|       |                  else if constexpr (str_t<Key>) {
 3226|       |                     Key key;
 3227|       |                     parse<JSON>::op<Opts>(key, ctx, it, end);
 3228|       |                     if (bool(ctx.error)) [[unlikely]]
 3229|       |                        return;
 3230|       |
 3231|       |                     if (parse_ws_colon<Opts>(ctx, it, end)) {
 3232|       |                        return;
 3233|       |                     }
 3234|       |
 3235|       |                     reading(key);
 3236|       |                     if constexpr (Opts.partial_read) {
 3237|       |                        if (read_count == value.size()) {
 3238|       |                           return;
 3239|       |                        }
 3240|       |                     }
 3241|       |                     if (bool(ctx.error)) [[unlikely]]
 3242|       |                        return;
 3243|       |                  }
 3244|       |                  else {
 3245|       |                     Key key_value{};
 3246|       |                     if constexpr (is_named_enum<Key> || mimics_str_t<Key>) {
 3247|       |                        parse<JSON>::op<Opts>(key_value, ctx, it, end);
 3248|       |                     }
 3249|       |                     else if constexpr (std::is_arithmetic_v<Key>) {
 3250|       |                        // prefer over quoted_t below to avoid double parsing of quoted_t
 3251|       |                        parse<JSON>::op<opt_true<Opts, quoted_num_opt_tag{}>>(key_value, ctx, it, end);
 3252|       |                     }
 3253|       |                     else {
 3254|       |                        parse<JSON>::op<opt_false<Opts, raw_string_opt_tag{}>>(quoted_t<Key>{key_value}, ctx, it, end);
 3255|       |                     }
 3256|       |                     if (bool(ctx.error)) [[unlikely]]
 3257|       |                        return;
 3258|       |
 3259|       |                     if (parse_ws_colon<Opts>(ctx, it, end)) {
 3260|       |                        return;
 3261|       |                     }
 3262|       |
 3263|       |                     reading(key_value);
 3264|       |                     if constexpr (Opts.partial_read) {
 3265|       |                        if (read_count == value.size()) {
 3266|       |                           return;
 3267|       |                        }
 3268|       |                     }
 3269|       |                     if (bool(ctx.error)) [[unlikely]]
 3270|       |                        return;
 3271|       |                  }
 3272|  3.29M|               }
 3273|       |
 3274|       |               // Streaming refill point: after parsing each key-value pair, refill if buffer is low
 3275|       |               if constexpr (has_streaming_state<decltype(ctx)>) {
 3276|       |                  if (ctx.stream.enabled()) {
 3277|       |                     const size_t consumed = static_cast<size_t>(it - ctx.stream.data());
 3278|       |                     // Refill when less than 25% of buffer remains to ensure enough space for next element
 3279|       |                     if (ctx.stream.size() - consumed <= ctx.stream.size() / 4 || it >= end) {
 3280|       |                        const char* new_it;
 3281|       |                        const char* new_end;
 3282|       |                        ctx.stream.consume_and_refill(consumed, new_it, new_end);
 3283|       |                        it = new_it;
 3284|       |                        end = new_end;
 3285|       |                        if (it >= end && ctx.stream.at_eof()) {
 3286|       |                           ctx.error = error_code::unexpected_end;
 3287|       |                           return;
 3288|       |                        }
 3289|       |                     }
 3290|       |                  }
 3291|       |               }
 3292|       |
 3293|  3.29M|               if (skip_ws<Opts>(ctx, it, end)) {
  ------------------
  |  Branch (3293:20): [True: 443, False: 3.29M]
  ------------------
 3294|    443|                  return;
 3295|    443|               }
 3296|  3.29M|            }
 3297|  78.7k|         }
 3298|  78.7k|      }
_ZZN3glz4fromILj10ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEETnNS_14string_literalEXtlNS9_ILm1EEEEERS5_TkNS_10is_contextERNS_7contextERPKcSF_EEvOT1_OT2_OT3_T4_ENKUlvE_clEv:
 2895|  78.7k|            decltype(auto) fields = [&]() -> decltype(auto) {
 2896|       |               if constexpr ((glaze_object_t<T> || reflectable<T>) &&
 2897|       |                             (Opts.error_on_missing_keys || Opts.partial_read)) {
 2898|       |                  return bit_array<num_members>{};
 2899|       |               }
 2900|  78.7k|               else {
 2901|  78.7k|                  return nullptr;
 2902|  78.7k|               }
 2903|  78.7k|            }();
_ZZN3glz4fromILj10ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEETnNS_14string_literalEXtlNS9_ILm1EEEEERS5_TkNS_10is_contextERNS_7contextERPKcSF_EEvOT1_OT2_OT3_T4_ENKUlvE1_clEv:
 2931|  78.7k|               ctx, [&]() -> void* {
 2932|       |                  if constexpr (tracks_include_keys) {
 2933|       |                     return &fields;
 2934|       |                  }
 2935|  78.7k|                  else {
 2936|  78.7k|                     return nullptr;
 2937|  78.7k|                  }
 2938|  78.7k|               }()};
_ZN3glz5parseILj10EE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEETkNS_10is_contextERNS_7contextERPKcSF_EEvOT0_OT1_OT2_T3_:
   49|  3.29M|      {
   50|       |         if constexpr (const_value_v<T>) {
   51|       |            if constexpr (check_error_on_const_read(Opts)) {
   52|       |               ctx.error = error_code::attempt_const_read;
   53|       |            }
   54|       |            else {
   55|       |               // do not read anything into the const value
   56|       |               skip_value<JSON>::op<Opts>(std::forward<Ctx>(ctx), std::forward<It0>(it), end);
   57|       |            }
   58|       |         }
   59|  3.29M|         else {
   60|  3.29M|            using V = std::remove_cvref_t<T>;
   61|  3.29M|            from<JSON, V>::template op<Opts>(std::forward<T>(value), std::forward<Ctx>(ctx), std::forward<It0>(it),
   62|  3.29M|                                             end);
   63|  3.29M|         }
   64|  3.29M|      }
_ZN3glz4fromILj10ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERPKcSC_S7_TkNS_10is_contextERNS_7contextEEEvRT2_OT3_OT0_T1_:
  887|  3.29M|      {
  888|       |         if constexpr (check_string_as_number(Opts)) {
  889|       |            auto start = it;
  890|       |            skip_number<Opts>(ctx, it, end);
  891|       |            if (bool(ctx.error)) [[unlikely]] {
  892|       |               return;
  893|       |            }
  894|       |            if (start == it) [[unlikely]] {
  895|       |               ctx.error = error_code::parse_number_failure;
  896|       |               return;
  897|       |            }
  898|       |            value.append(start, size_t(it - start));
  899|       |         }
  900|  3.29M|         else {
  901|  3.29M|            if constexpr (!check_opening_handled(Opts)) {
  902|  3.29M|               if constexpr (!check_ws_handled(Opts)) {
  903|  3.29M|                  if (skip_ws<Opts>(ctx, it, end)) {
  ------------------
  |  Branch (903:23): [True: 0, False: 3.29M]
  ------------------
  904|      0|                     return;
  905|      0|                  }
  906|  3.29M|               }
  907|       |
  908|  3.29M|               if (match_invalid_end<'"', Opts>(ctx, it, end)) {
  ------------------
  |  Branch (908:20): [True: 1.02k, False: 3.29M]
  ------------------
  909|  1.02k|                  return;
  910|  1.02k|               }
  911|  3.29M|            }
  912|       |
  913|  3.29M|            if constexpr (not check_raw_string(Opts)) {
  914|  3.29M|               static constexpr auto string_padding_bytes = 8;
  915|       |
  916|       |               // How much buffer has to remain for an eight byte load at the cursor to stay inside
  917|       |               // it. One on a padded input, where the last chunk is free to straddle the end of the
  918|       |               // document, so the byte tails below are unreachable; eight otherwise, which costs the
  919|       |               // final bytes of the buffer their chunked path and nothing else.
  920|  3.29M|               const std::ptrdiff_t scan_min = chunk_min<8>(ctx.padded_input);
  921|       |
  922|  3.29M|               if (size_t(end - it) >= 8) {
  ------------------
  |  Branch (922:20): [True: 3.28M, False: 10.5k]
  ------------------
  923|       |                  // The bound as a pointer, so the loops below spend a compare per chunk rather
  924|       |                  // than a subtract and a compare. Well defined here and nowhere else in this
  925|       |                  // reader: the branch has just established that at least eight bytes remain, and
  926|       |                  // `scan_min` is at most eight.
  927|  3.28M|                  const auto* const chunk_limit = end - scan_min;
  928|       |
  929|  3.28M|                  auto start = it;
  930|  3.28M|                  uint64_t ascii_acc{};
  931|  13.3M|                  while (it <= chunk_limit) {
  ------------------
  |  Branch (931:26): [True: 13.3M, False: 1.53k]
  ------------------
  932|  13.3M|                     uint64_t chunk;
  933|  13.3M|                     std::memcpy(&chunk, it, 8);
  934|       |                     if constexpr (std::endian::native == std::endian::big) {
  935|       |                        chunk = std::byteswap(chunk);
  936|       |                     }
  937|  13.3M|                     ascii_acc |= chunk;
  938|  13.3M|                     const uint64_t test_chars = has_quote(chunk);
  939|  13.3M|                     if (test_chars) {
  ------------------
  |  Branch (939:26): [True: 3.28M, False: 10.0M]
  ------------------
  940|  3.28M|                        it += (countr_zero(test_chars) >> 3);
  941|       |
  942|  3.28M|                        auto* prev = it - 1;
  943|  3.28M|                        while (*prev == '\\') {
  ------------------
  |  Branch (943:32): [True: 2.78k, False: 3.28M]
  ------------------
  944|  2.78k|                           --prev;
  945|  2.78k|                        }
  946|  3.28M|                        if (size_t(it - prev) % 2) {
  ------------------
  |  Branch (946:29): [True: 3.28M, False: 1.22k]
  ------------------
  947|  3.28M|                           goto continue_decode;
  948|  3.28M|                        }
  949|  1.22k|                        ++it; // skip the escaped quote
  950|  1.22k|                     }
  951|  10.0M|                     else {
  952|  10.0M|                        it += 8;
  953|  10.0M|                     }
  954|  13.3M|                  }
  955|       |
  956|  2.88k|                  while (it[-1] == '\\') [[unlikely]] {
  ------------------
  |  Branch (956:26): [True: 1.35k, False: 1.53k]
  ------------------
  957|       |                     // if we ended on an escape character then we need to rewind
  958|       |                     // because we lost our context
  959|  1.35k|                     --it;
  960|  1.35k|                  }
  961|       |
  962|       |                  // The byte-wise tail keeps feeding the accumulator: it has to cover every byte of
  963|       |                  // the string, or a non-ASCII byte reached here would be waved through unvalidated.
  964|  5.61k|                  for (; it < end; ++it) {
  ------------------
  |  Branch (964:26): [True: 5.32k, False: 289]
  ------------------
  965|  5.32k|                     ascii_acc |= uint8_t(*it);
  966|  5.32k|                     if (*it == '"') {
  ------------------
  |  Branch (966:26): [True: 1.28k, False: 4.03k]
  ------------------
  967|  1.28k|                        auto* prev = it - 1;
  968|  2.28k|                        while (*prev == '\\') {
  ------------------
  |  Branch (968:32): [True: 1.00k, False: 1.28k]
  ------------------
  969|  1.00k|                           --prev;
  970|  1.00k|                        }
  971|  1.28k|                        if (size_t(it - prev) % 2) {
  ------------------
  |  Branch (971:29): [True: 1.24k, False: 45]
  ------------------
  972|  1.24k|                           goto continue_decode;
  973|  1.24k|                        }
  974|  1.28k|                     }
  975|  5.32k|                  }
  976|       |
  977|    289|                  ctx.error = error_code::unexpected_end;
  978|    289|                  return;
  979|       |
  980|  3.28M|               continue_decode:
  981|       |
  982|  3.28M|                  if (validate_utf8_span<Opts>(ctx, start, it, ascii_acc)) [[unlikely]] {
  ------------------
  |  Branch (982:23): [True: 336, False: 3.28M]
  ------------------
  983|    336|                     return;
  984|    336|                  }
  985|       |
  986|  3.28M|                  auto n = size_t(it - start);
  987|       |
  988|       |                  // The padding lets the chunked copy below run up to the closing quote. Skip it when it
  989|       |                  // would be the only reason to allocate, as for a string that fits the small string
  990|       |                  // buffer but not with eight bytes to spare.
  991|  3.28M|                  bool pad = true;
  992|  3.28M|                  if constexpr (requires { value.capacity(); }) {
  993|  3.28M|                     const auto capacity = size_t(value.capacity());
  994|  3.28M|                     pad = capacity >= n + string_padding_bytes || capacity < n;
  ------------------
  |  Branch (994:28): [True: 3.26M, False: 15.8k]
  |  Branch (994:68): [True: 4.46k, False: 11.3k]
  ------------------
  995|  3.28M|                  }
  996|  3.28M|                  resize_unfilled(value, pad ? n + string_padding_bytes : n);
  ------------------
  |  Branch (996:42): [True: 3.27M, False: 11.3k]
  ------------------
  997|       |
  998|  3.28M|                  auto* p = value.data();
  999|       |
 1000|       |                  // An error below returns with the tail of `value` still unwritten. Leave the size at
 1001|       |                  // what was actually written rather than at the padded length, which resize_unfilled
 1002|       |                  // did not fill.
 1003|  3.28M|                  auto* const written_begin = p;
 1004|       |
 1005|       |                  // Without the padding, copy a chunk only while eight bytes remain before the quote.
 1006|       |                  // Unescaping never puts the output ahead of the input, so no store lands past the end.
 1007|  3.28M|                  const auto* const copy_end = pad ? it : it - (std::min)(n, size_t(7));
  ------------------
  |  Branch (1007:48): [True: 3.27M, False: 11.3k]
  ------------------
 1008|       |
 1009|       |                  // Copy eight bytes at a time for as long as eight bytes are there to read, then
 1010|       |                  // finish the span below. The chunked form reads past the character it is looking
 1011|       |                  // at, so on an unpadded buffer it has to stop short of the end; splitting it this
 1012|       |                  // way keeps it for the body of every string rather than giving it up whenever the
 1013|       |                  // string happens to finish near the end of the buffer -- which, for a document
 1014|       |                  // that is itself one string, is every string.
 1015|  15.2M|                  while (start < copy_end && start <= chunk_limit) {
  ------------------
  |  Branch (1015:26): [True: 11.9M, False: 3.27M]
  |  Branch (1015:46): [True: 11.9M, False: 486]
  ------------------
 1016|  11.9M|                     std::memcpy(p, start, 8);
 1017|  11.9M|                     uint64_t swar;
 1018|  11.9M|                     std::memcpy(&swar, p, 8);
 1019|       |                     if constexpr (std::endian::native == std::endian::big) {
 1020|       |                        swar = std::byteswap(swar);
 1021|       |                     }
 1022|       |
 1023|  11.9M|                     constexpr uint64_t lo7_mask = repeat_byte8(0b01111111);
 1024|  11.9M|                     const uint64_t lo7 = swar & lo7_mask;
 1025|  11.9M|                     const uint64_t backslash = (lo7 ^ repeat_byte8('\\')) + lo7_mask;
 1026|  11.9M|                     const uint64_t less_32 = (swar & repeat_byte8(0b01100000)) + lo7_mask;
 1027|  11.9M|                     uint64_t next = ~((backslash & less_32) | swar);
 1028|       |
 1029|  11.9M|                     next &= repeat_byte8(0b10000000);
 1030|  11.9M|                     if (next == 0) {
  ------------------
  |  Branch (1030:26): [True: 11.9M, False: 48.9k]
  ------------------
 1031|  11.9M|                        start += 8;
 1032|  11.9M|                        p += 8;
 1033|  11.9M|                        continue;
 1034|  11.9M|                     }
 1035|       |
 1036|  48.9k|                     next = countr_zero(next) >> 3;
 1037|  48.9k|                     start += next;
 1038|  48.9k|                     if (start >= it) {
  ------------------
  |  Branch (1038:26): [True: 4.77k, False: 44.1k]
  ------------------
 1039|  4.77k|                        break;
 1040|  4.77k|                     }
 1041|       |
 1042|  44.1k|                     if ((*start & 0b11100000) == 0) [[unlikely]] {
  ------------------
  |  Branch (1042:26): [True: 217, False: 43.9k]
  ------------------
 1043|    217|                        ctx.error = error_code::syntax_error;
 1044|    217|                        value.resize(size_t(p - written_begin));
 1045|    217|                        return;
 1046|    217|                     }
 1047|  43.9k|                     ++start; // skip the escape
 1048|  43.9k|                     if (*start == 'u') {
  ------------------
  |  Branch (1048:26): [True: 37.1k, False: 6.78k]
  ------------------
 1049|  37.1k|                        ++start;
 1050|  37.1k|                        p += next;
 1051|  37.1k|                        const auto mark = start;
 1052|  37.1k|                        const auto decoded = handle_unicode_code_point(start, p, end);
 1053|  37.1k|                        if (decoded.written == 0) [[unlikely]] {
  ------------------
  |  Branch (1053:29): [True: 286, False: 36.8k]
  ------------------
 1054|    286|                           ctx.error = decoded.truncated ? error_code::unexpected_end
  ------------------
  |  Branch (1054:40): [True: 0, False: 286]
  ------------------
 1055|    286|                                                         : error_code::unicode_escape_conversion_failure;
 1056|    286|                           value.resize(size_t(p - written_begin));
 1057|    286|                           return;
 1058|    286|                        }
 1059|  36.8k|                        n += decoded.written;
 1060|       |                        // escape + u + unicode code points
 1061|  36.8k|                        n -= 2 + uint32_t(start - mark);
 1062|  36.8k|                     }
 1063|  6.78k|                     else {
 1064|  6.78k|                        p += next;
 1065|  6.78k|                        *p = char_unescape_table[uint8_t(*start)];
 1066|  6.78k|                        if (*p == 0) [[unlikely]] {
  ------------------
  |  Branch (1066:29): [True: 40, False: 6.74k]
  ------------------
 1067|     40|                           ctx.error = error_code::invalid_escape;
 1068|     40|                           value.resize(size_t(p - written_begin));
 1069|     40|                           return;
 1070|     40|                        }
 1071|  6.74k|                        ++p;
 1072|  6.74k|                        ++start;
 1073|  6.74k|                        --n;
 1074|  6.74k|                     }
 1075|  43.9k|                  }
 1076|       |
 1077|       |                  // Whatever the chunked copy could not reach. `p` and `start` stay in step across
 1078|       |                  // that loop, so this picks up exactly where it stopped.
 1079|  3.31M|                  while (start < it) {
  ------------------
  |  Branch (1079:26): [True: 36.2k, False: 3.28M]
  ------------------
 1080|  36.2k|                     if ((*start & 0b11100000) == 0) [[unlikely]] {
  ------------------
  |  Branch (1080:26): [True: 15, False: 36.2k]
  ------------------
 1081|     15|                        ctx.error = error_code::syntax_error;
 1082|     15|                        value.resize(size_t(p - written_begin));
 1083|     15|                        return;
 1084|     15|                     }
 1085|  36.2k|                     if (*start == '\\') {
  ------------------
  |  Branch (1085:26): [True: 2.81k, False: 33.4k]
  ------------------
 1086|  2.81k|                        ++start; // skip the escape
 1087|  2.81k|                        if (*start == 'u') {
  ------------------
  |  Branch (1087:29): [True: 2.07k, False: 746]
  ------------------
 1088|  2.07k|                           ++start;
 1089|  2.07k|                           const auto mark = start;
 1090|  2.07k|                           const auto decoded = handle_unicode_code_point(start, p, end);
 1091|  2.07k|                           if (decoded.written == 0) [[unlikely]] {
  ------------------
  |  Branch (1091:32): [True: 139, False: 1.93k]
  ------------------
 1092|    139|                              ctx.error = decoded.truncated ? error_code::unexpected_end
  ------------------
  |  Branch (1092:43): [True: 0, False: 139]
  ------------------
 1093|    139|                                                            : error_code::unicode_escape_conversion_failure;
 1094|    139|                              value.resize(size_t(p - written_begin));
 1095|    139|                              return;
 1096|    139|                           }
 1097|  1.93k|                           n += decoded.written;
 1098|  1.93k|                           n -= 2 + uint32_t(start - mark);
 1099|  1.93k|                        }
 1100|    746|                        else {
 1101|    746|                           *p = char_unescape_table[uint8_t(*start)];
 1102|    746|                           if (*p == 0) [[unlikely]] {
  ------------------
  |  Branch (1102:32): [True: 24, False: 722]
  ------------------
 1103|     24|                              ctx.error = error_code::invalid_escape;
 1104|     24|                              value.resize(size_t(p - written_begin));
 1105|     24|                              return;
 1106|     24|                           }
 1107|    722|                           ++p;
 1108|    722|                           ++start;
 1109|    722|                           --n;
 1110|    722|                        }
 1111|  2.81k|                     }
 1112|  33.4k|                     else {
 1113|  33.4k|                        *p = *start;
 1114|  33.4k|                        ++p;
 1115|  33.4k|                        ++start;
 1116|  33.4k|                     }
 1117|  36.2k|                  }
 1118|       |
 1119|  3.28M|                  value.resize(n);
 1120|  3.28M|                  ++it;
 1121|  3.28M|               }
 1122|  10.5k|               else {
 1123|       |                  // For short strings
 1124|       |
 1125|  10.5k|                  std::array<char, 8> buffer{};
 1126|       |
 1127|  10.5k|                  auto* p = buffer.data();
 1128|  10.5k|                  const auto* const utf8_start = it;
 1129|       |
 1130|  18.5k|                  while (it < end) [[likely]] {
  ------------------
  |  Branch (1130:26): [True: 17.4k, False: 1.16k]
  ------------------
 1131|  17.4k|                     *p = *it;
 1132|  17.4k|                     if (*it == '"') {
  ------------------
  |  Branch (1132:26): [True: 8.68k, False: 8.73k]
  ------------------
 1133|  8.68k|                        if (validate_utf8_span<Opts>(ctx, utf8_start, it)) [[unlikely]] {
  ------------------
  |  Branch (1133:29): [True: 224, False: 8.46k]
  ------------------
 1134|    224|                           return;
 1135|    224|                        }
 1136|  8.46k|                        const size_t n = size_t(p - buffer.data());
 1137|  8.46k|#if __has_cpp_attribute(assume) >= 202207L
 1138|  8.46k|                        [[assume(n <= sizeof(buffer))]];
 1139|  8.46k|#endif
 1140|  8.46k|                        value.assign(buffer.data(), n);
 1141|  8.46k|                        ++it;
 1142|  8.46k|                        if constexpr (not Opts.null_terminated) {
 1143|  8.46k|                           if (it == end) {
  ------------------
  |  Branch (1143:32): [True: 147, False: 8.31k]
  ------------------
 1144|    147|                              ctx.error = error_code::end_reached;
 1145|    147|                              return;
 1146|    147|                           }
 1147|  8.46k|                        }
 1148|  8.31k|                        return;
 1149|  8.68k|                     }
 1150|  8.73k|                     else if (*it == '\\') {
  ------------------
  |  Branch (1150:31): [True: 395, False: 8.34k]
  ------------------
 1151|       |                        // Bounded whatever `null_terminated` says: a document cut off inside an
 1152|       |                        // escape has run out of input, and saying so beats blaming the terminator
 1153|       |                        // the cut exposed -- which is what reading on would find, and would report
 1154|       |                        // as a malformed escape.
 1155|    395|                        ++it; // skip the escape
 1156|    395|                        if (it == end) [[unlikely]] {
  ------------------
  |  Branch (1156:29): [True: 1, False: 394]
  ------------------
 1157|      1|                           ctx.error = error_code::unexpected_end;
 1158|      1|                           return;
 1159|      1|                        }
 1160|    394|                        if (*it == 'u') {
  ------------------
  |  Branch (1160:29): [True: 264, False: 130]
  ------------------
 1161|    264|                           ++it;
 1162|    264|                           if (it == end) [[unlikely]] {
  ------------------
  |  Branch (1162:32): [True: 1, False: 263]
  ------------------
 1163|      1|                              ctx.error = error_code::unexpected_end;
 1164|      1|                              return;
 1165|      1|                           }
 1166|    263|                           const auto decoded = handle_unicode_code_point(it, p, end);
 1167|    263|                           if (decoded.written == 0) [[unlikely]] {
  ------------------
  |  Branch (1167:32): [True: 133, False: 130]
  ------------------
 1168|    133|                              ctx.error = decoded.truncated ? error_code::unexpected_end
  ------------------
  |  Branch (1168:43): [True: 52, False: 81]
  ------------------
 1169|    133|                                                            : error_code::unicode_escape_conversion_failure;
 1170|    133|                              return;
 1171|    133|                           }
 1172|    263|                        }
 1173|    130|                        else {
 1174|    130|                           *p = char_unescape_table[uint8_t(*it)];
 1175|    130|                           if (*p == 0) [[unlikely]] {
  ------------------
  |  Branch (1175:32): [True: 26, False: 104]
  ------------------
 1176|     26|                              ctx.error = error_code::invalid_escape;
 1177|     26|                              return;
 1178|     26|                           }
 1179|    104|                           ++p;
 1180|    104|                           ++it;
 1181|    104|                        }
 1182|    394|                     }
 1183|  8.34k|                     else if ((*it & 0b11100000) == 0) [[unlikely]] {
  ------------------
  |  Branch (1183:31): [True: 533, False: 7.80k]
  ------------------
 1184|    533|                        ctx.error = error_code::syntax_error;
 1185|    533|                        return;
 1186|    533|                     }
 1187|  7.80k|                     else {
 1188|  7.80k|                        ++it;
 1189|  7.80k|                        ++p;
 1190|  7.80k|                     }
 1191|  17.4k|                  }
 1192|       |
 1193|  1.16k|                  ctx.error = error_code::unexpected_end;
 1194|  1.16k|               }
 1195|       |            }
 1196|       |            else {
 1197|       |               // raw_string
 1198|       |               auto start = it;
 1199|       |               skip_string_view(ctx, it, end);
 1200|       |               if (bool(ctx.error)) [[unlikely]]
 1201|       |                  return;
 1202|       |
 1203|       |               if (validate_utf8_span<Opts>(ctx, start, it)) [[unlikely]] {
 1204|       |                  return;
 1205|       |               }
 1206|       |
 1207|       |               value.assign(start, size_t(it - start));
 1208|       |               ++it;
 1209|       |            }
 1210|  3.29M|         }
 1211|  3.29M|      }
_ZN3glz14parse_ws_colonITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEETkNS_10is_contextENS_7contextERPKcS4_EEbRT0_OT1_T2_:
  159|  3.29M|   {
  160|  3.29M|      if (skip_ws<Opts>(ctx, it, end)) {
  ------------------
  |  Branch (160:11): [True: 144, False: 3.29M]
  ------------------
  161|    144|         return true;
  162|    144|      }
  163|  3.29M|      if (match_invalid_end<':', Opts>(ctx, it, end)) {
  ------------------
  |  Branch (163:11): [True: 2.68k, False: 3.28M]
  ------------------
  164|  2.68k|         return true;
  165|  2.68k|      }
  166|  3.28M|      if (skip_ws<Opts>(ctx, it, end)) {
  ------------------
  |  Branch (166:11): [True: 25, False: 3.28M]
  ------------------
  167|     25|         return true;
  168|     25|      }
  169|  3.28M|      return false;
  170|  3.28M|   }
_ZZN3glz4fromILj10ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEETnNS_14string_literalEXtlNS9_ILm1EEEEERS5_TkNS_10is_contextERNS_7contextERPKcSF_EEvOT1_OT2_OT3_T4_ENKUlOT_E_clIRNSt3__112basic_stringIcNSS_11char_traitsIcEENSS_9allocatorIcEEEEEEDaSP_:
 3189|  3.28M|                  auto reading = [&](auto&& key) {
 3190|       |                     if constexpr (Opts.partial_read) {
 3191|       |                        if (auto element = value.find(key); element != value.end()) {
 3192|       |                           ++read_count;
 3193|       |                           parse<JSON>::op<ws_handled<Opts>()>(element->second, ctx, it, end);
 3194|       |                        }
 3195|       |                        else {
 3196|       |                           skip_value<JSON>::op<Opts>(ctx, it, end);
 3197|       |                        }
 3198|       |                     }
 3199|  3.28M|                     else {
 3200|  3.28M|                        parse<JSON>::op<ws_handled<Opts>()>(value[key], ctx, it, end);
 3201|  3.28M|                     }
 3202|  3.28M|                  };
_ZN3glz5parseILj10EE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj4EEERNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_10is_contextERNS_7contextERPKcSC_EEvOT0_OT1_OT2_T3_:
   49|  8.33M|      {
   50|       |         if constexpr (const_value_v<T>) {
   51|       |            if constexpr (check_error_on_const_read(Opts)) {
   52|       |               ctx.error = error_code::attempt_const_read;
   53|       |            }
   54|       |            else {
   55|       |               // do not read anything into the const value
   56|       |               skip_value<JSON>::op<Opts>(std::forward<Ctx>(ctx), std::forward<It0>(it), end);
   57|       |            }
   58|       |         }
   59|  8.33M|         else {
   60|  8.33M|            using V = std::remove_cvref_t<T>;
   61|  8.33M|            from<JSON, V>::template op<Opts>(std::forward<T>(value), std::forward<Ctx>(ctx), std::forward<It0>(it),
   62|  8.33M|                                             end);
   63|  8.33M|         }
   64|  8.33M|      }
_ZN3glz4fromILj10ENS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj4EEERS4_TkNS_10is_contextERNS_7contextERPKcSC_EEvOT0_OT1_OT2_T3_:
  150|  8.33M|      {
  151|  8.33M|         using V = std::decay_t<decltype(get_member(std::declval<Value>(), meta_wrapper_v<T>))>;
  152|  8.33M|         from<JSON, V>::template op<Opts>(get_member(std::forward<Value>(value), meta_wrapper_v<T>),
  153|  8.33M|                                          std::forward<Ctx>(ctx), std::forward<It0>(it), end);
  154|  8.33M|      }
_ZN3glz4fromILj10ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj4EEERSH_TkNS_10is_contextERNS_7contextERPKcSP_EEvOT0_OT1_OT2_T3_:
 3860|  8.33M|      {
 3861|       |         if constexpr (tagging == variant_tagging_kind::adjacent) {
 3862|       |            read_adjacent<Options>(value, ctx, it, end);
 3863|       |         }
 3864|  8.33M|         else {
 3865|  8.33M|            read_deduced<Options>(value, ctx, it, end);
 3866|  8.33M|         }
 3867|  8.33M|      }
_ZN3glz4fromILj10ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE12read_deducedITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj4EEERSH_TkNS_10is_contextERNS_7contextERPKcSP_EEvOT0_OT1_OT2_T3_:
 3871|  8.33M|      {
 3872|  8.33M|         constexpr auto Opts = ws_handled_off<Options>();
 3873|  8.33M|         if constexpr (variant_is_auto_deducible<T>()) {
 3874|       |            if constexpr (not check_ws_handled(Options)) {
 3875|       |               if (skip_ws<Opts>(ctx, it, end)) {
 3876|       |                  return;
 3877|       |               }
 3878|       |            }
 3879|       |
 3880|  8.33M|            switch (*it) {
 3881|  4.05k|            case '\0':
  ------------------
  |  Branch (3881:13): [True: 4.05k, False: 8.32M]
  ------------------
 3882|  4.05k|               ctx.error = error_code::unexpected_end;
 3883|  4.05k|               return;
 3884|  63.5k|            case '{': {
  ------------------
  |  Branch (3884:13): [True: 63.5k, False: 8.26M]
  ------------------
 3885|       |               // This branch consumes the brace itself and hands the object to a reader with
 3886|       |               // `opening_handled`, which therefore does not count the level -- but does release it at
 3887|       |               // the closing brace. So the level is taken here, in both buffer modes, and paid back by
 3888|       |               // the reader below.
 3889|  63.5k|               if (enter_depth(ctx)) [[unlikely]] {
  ------------------
  |  Branch (3889:20): [True: 18, False: 63.4k]
  ------------------
 3890|     18|                  return;
 3891|     18|               }
 3892|       |
 3893|  63.4k|               ++it;
 3894|  63.4k|               if constexpr (not Opts.null_terminated) {
 3895|  63.4k|                  if (it == end) [[unlikely]] {
  ------------------
  |  Branch (3895:23): [True: 74, False: 63.4k]
  ------------------
 3896|     74|                     ctx.error = error_code::unexpected_end;
 3897|     74|                     return;
 3898|     74|                  }
 3899|  63.4k|               }
 3900|  63.4k|               using type_counts = variant_type_count<T>;
 3901|  63.4k|               constexpr auto n_object_candidates = variant_object_candidate_count_v<Opts, T>;
 3902|       |               if constexpr (n_object_candidates < 1) {
 3903|       |                  ctx.error = error_code::no_matching_variant_type;
 3904|       |                  return;
 3905|       |               }
 3906|  63.4k|               else if constexpr (n_object_candidates == 1 && tag_v<T>.empty()) {
 3907|  63.4k|                  constexpr auto first_idx = variant_first_object_candidate_v<Opts, T>;
 3908|  63.4k|                  using V = std::variant_alternative_t<first_idx, T>;
 3909|  63.4k|                  if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (3909:23): [True: 62.8k, False: 676]
  ------------------
 3910|  63.4k|                  parse<JSON>::op<opening_handled<Opts>()>(std::get<V>(value), ctx, it, end);
 3911|  63.4k|                  return;
 3912|       |               }
 3913|       |               else {
 3914|       |                  auto possible_types = bit_array<std::variant_size_v<T>>{}.flip();
 3915|       |                  static constexpr auto& deduction_bits = variant_deduction_bits<T>;
 3916|       |                  static constexpr size_t deduction_key_count = variant_deduction_key_count<T>;
 3917|       |                  static constexpr auto tag_literal = string_literal_from_view<tag_v<T>.size()>(tag_v<T>);
 3918|       |
 3919|       |                  // Track if we've encountered a tag and what value it had
 3920|       |                  std::optional<size_t> tag_specified_index{};
 3921|       |
 3922|       |                  if (skip_ws<Opts>(ctx, it, end)) {
 3923|       |                     return;
 3924|       |                  }
 3925|       |                  // Once the reader knows which alternative this object holds it may have to read
 3926|       |                  // it again from here. Anchor the position rather than keep the pointer: the scan
 3927|       |                  // below skips values, and a streaming skip refills, which moves the window out
 3928|       |                  // from under a raw pointer (see rewind_anchor).
 3929|       |                  auto start = make_rewind_anchor(ctx, it);
 3930|       |                  bool first_key = true;
 3931|       |                  // Parse bifurcation for tagged variants:
 3932|       |                  //
 3933|       |                  // Without this optimization, tagged variant parsing always uses two passes:
 3934|       |                  //   1. Scan all keys to find the tag (e.g. "type"), skipping values
 3935|       |                  //   2. Reset `it = start` and re-parse the entire object into the resolved type
 3936|       |                  //
 3937|       |                  // When the tag is the first key, the second pass redundantly re-reads every
 3938|       |                  // field that follows it. This lambda avoids that: if the tag was the first key,
 3939|       |                  // it advances past the trailing comma so the object parser picks up at the
 3940|       |                  // second field. If the tag was found later, it falls back to the full re-parse.
 3941|       |                  //
 3942|       |                  // One exception: if the tag name is also a field on the resolved struct
 3943|       |                  // (contains_tag), we must re-parse regardless so the value is stored in
 3944|       |                  // the struct field. This override is applied inside each std::visit lambda.
 3945|       |                  //
 3946|       |                  // Either way the rewind can fail under a streaming read: the window only holds so
 3947|       |                  // much, and an object wider than it has no start left to return to.
 3948|       |                  auto position_after_tag = [&] {
 3949|       |                     if (first_key) {
 3950|       |                        if (*it == ',') ++it; // skip comma; handles tag-only objects where *it == '}'
 3951|       |                        return true;
 3952|       |                     }
 3953|       |                     return start.rewind(ctx, it, end); // tag came later, re-parse from the beginning
 3954|       |                  };
 3955|       |                  // `first_key` also answers "were we reset to the object start", which is what
 3956|       |                  // position_after_tag does for every key but the first.
 3957|       |                  for (; *it != '}'; first_key = false) {
 3958|       |                     if (!first_key) {
 3959|       |                        if (match_invalid_end<',', Opts>(ctx, it, end)) {
 3960|       |                           return;
 3961|       |                        }
 3962|       |                     }
 3963|       |
 3964|       |                     if (skip_ws<Opts>(ctx, it, end)) {
 3965|       |                        return;
 3966|       |                     }
 3967|       |                     if (match_invalid_end<'"', Opts>(ctx, it, end)) {
 3968|       |                        return;
 3969|       |                     }
 3970|       |
 3971|       |                     auto* key_start = it;
 3972|       |                     skip_string_view(ctx, it, end);
 3973|       |                     if (bool(ctx.error)) [[unlikely]]
 3974|       |                        return;
 3975|       |                     if (validate_utf8_span<Opts>(ctx, key_start, it)) [[unlikely]]
 3976|       |                        return;
 3977|       |                     const sv key = {key_start, size_t(it - key_start)};
 3978|       |
 3979|       |                     if (match_invalid_end<'"', Opts>(ctx, it, end)) {
 3980|       |                        return;
 3981|       |                     }
 3982|       |
 3983|       |                     if constexpr (deduction_key_count > 0) {
 3984|       |                        // We first check if a tag is defined and see if the key matches the tag
 3985|       |                        if constexpr (not tag_v<T>.empty()) {
 3986|       |                           if (key == tag_v<T>) {
 3987|       |                              if (parse_ws_colon<Opts>(ctx, it, end)) {
 3988|       |                                 return;
 3989|       |                              }
 3990|       |
 3991|       |                              using id_type = std::decay_t<decltype(ids_v<T>[0])>;
 3992|       |
 3993|       |                              std::conditional_t<std::integral<id_type>, id_type, sv> type_id{};
 3994|       |                              if constexpr (std::integral<id_type>) {
 3995|       |                                 from<JSON, id_type>::template op<ws_handled<Opts>()>(type_id, ctx, it, end);
 3996|       |                              }
 3997|       |                              else {
 3998|       |                                 // The id is turned into an index below and never leaves this
 3999|       |                                 // reader, so the view of the window it borrows cannot outlive it.
 4000|       |                                 parse_transient_string_view<ws_handled<Opts>()>(type_id, ctx, it, end);
 4001|       |                              }
 4002|       |                              if (bool(ctx.error)) [[unlikely]]
 4003|       |                                 return;
 4004|       |                              if (skip_ws<Opts>(ctx, it, end)) {
 4005|       |                                 return;
 4006|       |                              }
 4007|       |                              if (!(*it == ',' || *it == '}')) [[unlikely]] {
 4008|       |                                 ctx.error = error_code::syntax_error;
 4009|       |                                 return;
 4010|       |                              }
 4011|       |
 4012|       |                              size_t type_index;
 4013|       |                              if constexpr (std::integral<id_type>) {
 4014|       |                                 type_index = variant_id_to_index<T>::op(type_id);
 4015|       |                              }
 4016|       |                              else {
 4017|       |                                 type_index = variant_id_to_index<T>::op(
 4018|       |                                    type_id.data(), type_id.data() + type_id.size(), type_id.size());
 4019|       |                              }
 4020|       |                              if (type_index < ids_v<T>.size()) [[likely]] {
 4021|       |                                 // Check if the deduced types include the tag-specified type
 4022|       |                                 // If not, the tag doesn't match the fields
 4023|       |                                 // We're already inside if constexpr (deduction_registry.size()), so we know deduction
 4024|       |                                 // is happening. At this point, possible_types has been narrowed by field deduction.
 4025|       |                                 // Check if the tag-specified type is still possible
 4026|       |                                 const bool type_is_possible = possible_types[type_index];
 4027|       |                                 if (!type_is_possible) {
 4028|       |                                    // Tag specifies a type that doesn't match the fields seen so far
 4029|       |                                    ctx.error = error_code::no_matching_variant_type;
 4030|       |                                    return;
 4031|       |                                 }
 4032|       |
 4033|       |                                 if (!position_after_tag()) return;
 4034|       |                                 tag_specified_index = type_index; // Store the tag-specified type
 4035|       |                                 if (value.index() != type_index) emplace_runtime_variant(value, type_index);
 4036|       |                                 std::visit(
 4037|       |                                    [&](auto&& v) {
 4038|       |                                       using V = std::decay_t<decltype(v)>;
 4039|       |                                       constexpr bool is_object =
 4040|       |                                          (glaze_object_t<V> || reflectable<V>) && not custom_read<V>;
 4041|       |                                       if constexpr (variant_unit_alternative<V>) {
 4042|       |                                          // A unit alternative carries no data; its object holds only the
 4043|       |                                          // discriminator. Consume that body through an empty reflected object so
 4044|       |                                          // unknown-key policy and terminator handling match every other alternative.
 4045|       |                                          detail::variant_unit_body unit_body{};
 4046|       |                                          from<JSON, detail::variant_unit_body>::template op<opening_handled<Opts>(),
 4047|       |                                                                                             tag_literal>(unit_body,
 4048|       |                                                                                                          ctx, it, end);
 4049|       |                                       }
 4050|       |                                       else if constexpr (is_object) {
 4051|       |                                          if constexpr (contains_tag<V, tag_literal>()) {
 4052|       |                                             // tag is a struct field, must re-parse
 4053|       |                                             if (!start.rewind(ctx, it, end)) return;
 4054|       |                                          }
 4055|       |                                          from<JSON, V>::template op<opening_handled<Opts>(), tag_literal>(v, ctx, it,
 4056|       |                                                                                                           end);
 4057|       |                                       }
 4058|       |                                       else if constexpr (is_memory_object<V>) {
 4059|       |                                          if (!v) {
 4060|       |                                             if constexpr (is_specialization_v<V, std::optional>) {
 4061|       |                                                if constexpr (requires { v.emplace(); }) {
 4062|       |                                                   v.emplace();
 4063|       |                                                }
 4064|       |                                                else {
 4065|       |                                                   v = typename V::value_type{};
 4066|       |                                                }
 4067|       |                                             }
 4068|       |                                             else if constexpr (is_specialization_v<V, std::unique_ptr>)
 4069|       |                                                v = std::make_unique<typename V::element_type>();
 4070|       |                                             else if constexpr (is_specialization_v<V, std::shared_ptr>)
 4071|       |                                                v = std::make_shared<typename V::element_type>();
 4072|       |                                             else if constexpr (constructible<V>) {
 4073|       |                                                v = meta_construct_v<V>();
 4074|       |                                             }
 4075|       |                                             else if constexpr (std::is_pointer_v<V> &&
 4076|       |                                                                can_allocate_raw_pointer<Opts,
 4077|       |                                                                                         std::decay_t<decltype(ctx)>>) {
 4078|       |                                                if (!try_allocate_raw_pointer<Opts>(v, ctx)) {
 4079|       |                                                   return;
 4080|       |                                                }
 4081|       |                                             }
 4082|       |                                             else {
 4083|       |                                                ctx.error = error_code::invalid_nullable_read;
 4084|       |                                                return;
 4085|       |                                                // Cannot read into unset nullable that is not std::optional,
 4086|       |                                                // std::unique_ptr, or std::shared_ptr
 4087|       |                                             }
 4088|       |                                          }
 4089|       |                                          if constexpr (contains_tag<memory_type<V>, tag_literal>()) {
 4090|       |                                             // tag is a struct field, must re-parse
 4091|       |                                             if (!start.rewind(ctx, it, end)) return;
 4092|       |                                          }
 4093|       |                                          from<JSON, memory_type<V>>::template op<opening_handled<Opts>(), tag_literal>(
 4094|       |                                             *v, ctx, it, end);
 4095|       |                                       }
 4096|       |                                       else if constexpr (custom_read<V>) {
 4097|       |                                          // Custom handlers parse the remaining body themselves and do not
 4098|       |                                          // accept the tag template parameter; the tag was already consumed.
 4099|       |                                          // This only works when the tag was the first key. If it came later,
 4100|       |                                          // we were reset to the object start and the custom handler would
 4101|       |                                          // absorb the tag, so error rather than corrupt the value.
 4102|       |                                          if (!first_key) {
 4103|       |                                             ctx.error = error_code::feature_not_supported;
 4104|       |                                             ctx.custom_error_message =
 4105|       |                                                "the tag must be the first key for a custom variant alternative";
 4106|       |                                             return;
 4107|       |                                          }
 4108|       |                                          from<JSON, V>::template op<opening_handled<Opts>()>(v, ctx, it, end);
 4109|       |                                       }
 4110|       |                                    },
 4111|       |                                    value);
 4112|       |
 4113|       |                                 return; // we've decoded our target type
 4114|       |                              }
 4115|       |                              else [[unlikely]] {
 4116|       |                                 // Check if we have a default type (ids array shorter than variant)
 4117|       |                                 constexpr auto ids_size = ids_v<T>.size();
 4118|       |                                 constexpr auto variant_size = std::variant_size_v<T>;
 4119|       |                                 if constexpr (ids_size < variant_size) {
 4120|       |                                    // Use the first unlabeled type as the default
 4121|       |                                    const auto default_type_index = ids_size;
 4122|       |
 4123|       |                                    if (!position_after_tag()) return;
 4124|       |                                    tag_specified_index = default_type_index; // Store the default type index
 4125|       |                                    if (value.index() != default_type_index)
 4126|       |                                       emplace_runtime_variant(value, default_type_index);
 4127|       |                                    std::visit(
 4128|       |                                       [&](auto&& v) {
 4129|       |                                          using V = std::decay_t<decltype(v)>;
 4130|       |                                          constexpr bool is_object =
 4131|       |                                             (glaze_object_t<V> || reflectable<V>) && not custom_read<V>;
 4132|       |                                          if constexpr (variant_unit_alternative<V>) {
 4133|       |                                             // A unit alternative carries no data; its object holds only the
 4134|       |                                             // discriminator. Consume that body through an empty reflected object so
 4135|       |                                             // unknown-key policy and terminator handling match every other
 4136|       |                                             // alternative.
 4137|       |                                             detail::variant_unit_body unit_body{};
 4138|       |                                             from<JSON, detail::variant_unit_body>::template op<opening_handled<Opts>(),
 4139|       |                                                                                                tag_literal>(
 4140|       |                                                unit_body, ctx, it, end);
 4141|       |                                          }
 4142|       |                                          else if constexpr (is_object) {
 4143|       |                                             if constexpr (contains_tag<V, tag_literal>()) {
 4144|       |                                                // tag is a struct field, must re-parse
 4145|       |                                                if (!start.rewind(ctx, it, end)) return;
 4146|       |                                             }
 4147|       |                                             from<JSON, V>::template op<opening_handled<Opts>()>(v, ctx, it, end);
 4148|       |                                          }
 4149|       |                                          else if constexpr (is_memory_object<V>) {
 4150|       |                                             if (!v) {
 4151|       |                                                if constexpr (is_specialization_v<V, std::optional>) {
 4152|       |                                                   if constexpr (requires { v.emplace(); }) {
 4153|       |                                                      v.emplace();
 4154|       |                                                   }
 4155|       |                                                   else {
 4156|       |                                                      v = typename V::value_type{};
 4157|       |                                                   }
 4158|       |                                                }
 4159|       |                                                else if constexpr (is_specialization_v<V, std::unique_ptr>)
 4160|       |                                                   v = std::make_unique<typename V::element_type>();
 4161|       |                                                else if constexpr (is_specialization_v<V, std::shared_ptr>)
 4162|       |                                                   v = std::make_shared<typename V::element_type>();
 4163|       |                                                else if constexpr (constructible<V>) {
 4164|       |                                                   v = meta_construct_v<V>();
 4165|       |                                                }
 4166|       |                                                else if constexpr (std::is_pointer_v<V> &&
 4167|       |                                                                   can_allocate_raw_pointer<
 4168|       |                                                                      Opts, std::decay_t<decltype(ctx)>>) {
 4169|       |                                                   if (!try_allocate_raw_pointer<Opts>(v, ctx)) {
 4170|       |                                                      return;
 4171|       |                                                   }
 4172|       |                                                }
 4173|       |                                                else {
 4174|       |                                                   ctx.error = error_code::invalid_nullable_read;
 4175|       |                                                   return;
 4176|       |                                                }
 4177|       |                                             }
 4178|       |                                             if constexpr (contains_tag<memory_type<V>, tag_literal>()) {
 4179|       |                                                // tag is a struct field, must re-parse
 4180|       |                                                if (!start.rewind(ctx, it, end)) return;
 4181|       |                                             }
 4182|       |                                             from<JSON, memory_type<V>>::template op<opening_handled<Opts>()>(*v, ctx,
 4183|       |                                                                                                              it, end);
 4184|       |                                          }
 4185|       |                                          else if constexpr (custom_read<V>) {
 4186|       |                                             // Custom handlers parse the remaining body themselves; this only
 4187|       |                                             // works when the tag was the first key (see above). If it came
 4188|       |                                             // later we were reset to the object start, so error rather than
 4189|       |                                             // let the custom handler absorb the tag.
 4190|       |                                             if (!first_key) {
 4191|       |                                                ctx.error = error_code::feature_not_supported;
 4192|       |                                                ctx.custom_error_message =
 4193|       |                                                   "the tag must be the first key for a custom variant alternative";
 4194|       |                                                return;
 4195|       |                                             }
 4196|       |                                             from<JSON, V>::template op<opening_handled<Opts>()>(v, ctx, it, end);
 4197|       |                                          }
 4198|       |                                       },
 4199|       |                                       value);
 4200|       |
 4201|       |                                    return;
 4202|       |                                 }
 4203|       |                                 else {
 4204|       |                                    ctx.error = error_code::no_matching_variant_type;
 4205|       |                                    ctx.custom_error_message = variant_ids_string_v<T>;
 4206|       |                                    return;
 4207|       |                                 }
 4208|       |                              }
 4209|       |                           }
 4210|       |                        }
 4211|       |
 4212|       |                        // Inline decode_hash lookup for variant deduction
 4213|       |                        using deduction_keys_t = keys_wrapper<variant_deduction_keys<T>>;
 4214|       |                        constexpr auto& DeductionHashInfo = hash_info<deduction_keys_t>;
 4215|       |                        const auto deduction_index =
 4216|       |                           decode_hash_with_size<JSON, deduction_keys_t, DeductionHashInfo, DeductionHashInfo.type>::op(
 4217|       |                              key.data(), key.data() + key.size(), key.size());
 4218|       |                        if (deduction_index < deduction_key_count && variant_deduction_keys<T>[deduction_index] == key)
 4219|       |                           [[likely]] {
 4220|       |                           possible_types &= deduction_bits[deduction_index];
 4221|       |                        }
 4222|       |                        else if constexpr (Opts.error_on_unknown_keys) {
 4223|       |                           ctx.error = error_code::unknown_key;
 4224|       |                           return;
 4225|       |                        }
 4226|       |                     }
 4227|       |                     else if constexpr (not tag_v<T>.empty()) {
 4228|       |                        // empty object case for variant, if there are no normal elements
 4229|       |                        if (key == tag_v<T>) {
 4230|       |                           if (parse_ws_colon<Opts>(ctx, it, end)) {
 4231|       |                              return;
 4232|       |                           }
 4233|       |
 4234|       |                           // The id is turned into an index below and never leaves this reader,
 4235|       |                           // so the view of the window it borrows cannot outlive that window.
 4236|       |                           std::string_view type_id{};
 4237|       |                           parse_transient_string_view<ws_handled<Opts>()>(type_id, ctx, it, end);
 4238|       |                           if (bool(ctx.error)) [[unlikely]]
 4239|       |                              return;
 4240|       |                           if (skip_ws<Opts>(ctx, it, end)) {
 4241|       |                              return;
 4242|       |                           }
 4243|       |
 4244|       |                           const auto type_index = variant_id_to_index<T>::op(
 4245|       |                              type_id.data(), type_id.data() + type_id.size(), type_id.size());
 4246|       |                           if (type_index < ids_v<T>.size()) [[likely]] {
 4247|       |                              if (!position_after_tag()) return;
 4248|       |                              tag_specified_index = type_index; // Store the tag-specified type
 4249|       |                              if (value.index() != type_index) emplace_runtime_variant(value, type_index);
 4250|       |                           }
 4251|       |                           else {
 4252|       |                              // Check if we have a default type (ids array shorter than variant)
 4253|       |                              constexpr auto ids_size = ids_v<T>.size();
 4254|       |                              constexpr auto variant_size = std::variant_size_v<T>;
 4255|       |                              if constexpr (ids_size < variant_size) {
 4256|       |                                 // Use the first unlabeled type as the default
 4257|       |                                 if (!position_after_tag()) return;
 4258|       |                                 const auto default_index = ids_size;
 4259|       |                                 tag_specified_index = default_index; // Store the default type index
 4260|       |                                 if (value.index() != default_index) emplace_runtime_variant(value, default_index);
 4261|       |                              }
 4262|       |                              else {
 4263|       |                                 ctx.error = error_code::no_matching_variant_type;
 4264|       |                                 ctx.custom_error_message = variant_ids_string_v<T>;
 4265|       |                                 return;
 4266|       |                              }
 4267|       |                           }
 4268|       |                           // Parse the type (handles tag skipping and unknown keys)
 4269|       |                           std::visit(
 4270|       |                              [&](auto&& v) {
 4271|       |                                 using V = std::decay_t<decltype(v)>;
 4272|       |                                 if constexpr (custom_read<V>) {
 4273|       |                                    // Custom handlers parse the remaining object body themselves and do not
 4274|       |                                    // accept the tag template parameter that reflected objects use to skip an
 4275|       |                                    // interior tag key. That only works when the tag is the first key (it was
 4276|       |                                    // just consumed). If the tag came after other keys, position_after_tag()
 4277|       |                                    // reset us to the object start and the custom handler would absorb the tag
 4278|       |                                    // into its value, so error here rather than corrupt the result.
 4279|       |                                    if (!first_key) {
 4280|       |                                       ctx.error = error_code::feature_not_supported;
 4281|       |                                       ctx.custom_error_message =
 4282|       |                                          "the tag must be the first key for a custom variant alternative";
 4283|       |                                       return;
 4284|       |                                    }
 4285|       |                                    from<JSON, V>::template op<opening_handled<Opts>()>(v, ctx, it, end);
 4286|       |                                 }
 4287|       |                                 else {
 4288|       |                                    if constexpr (contains_tag<V, tag_literal>()) {
 4289|       |                                       // tag is a struct field, must re-parse
 4290|       |                                       if (!start.rewind(ctx, it, end)) return;
 4291|       |                                    }
 4292|       |                                    from<JSON, V>::template op<opening_handled<Opts>(), tag_literal>(v, ctx, it, end);
 4293|       |                                 }
 4294|       |                              },
 4295|       |                              value);
 4296|       |                           return;
 4297|       |                        }
 4298|       |                        else if constexpr (Opts.error_on_unknown_keys) {
 4299|       |                           ctx.error = error_code::unknown_key;
 4300|       |                           return;
 4301|       |                        }
 4302|       |                        else {
 4303|       |                           // Skip unknown key's value (non-tag key in empty variant)
 4304|       |                           if (parse_ws_colon<Opts>(ctx, it, end)) {
 4305|       |                              return;
 4306|       |                           }
 4307|       |                           skip_value<JSON>::op<Opts>(ctx, it, end);
 4308|       |                           if (bool(ctx.error)) [[unlikely]]
 4309|       |                              return;
 4310|       |                           resync_window_end(ctx, end); // a streaming skip refills
 4311|       |                           if (skip_ws<Opts>(ctx, it, end)) {
 4312|       |                              return;
 4313|       |                           }
 4314|       |                           continue; // Continue loop to find the tag
 4315|       |                        }
 4316|       |                     }
 4317|       |                     else if constexpr (Opts.error_on_unknown_keys) {
 4318|       |                        ctx.error = error_code::unknown_key;
 4319|       |                        return;
 4320|       |                     }
 4321|       |
 4322|       |                     auto matching_types = possible_types.popcount();
 4323|       |                     if (matching_types == 0) {
 4324|       |                        ctx.error = error_code::no_matching_variant_type;
 4325|       |                        return;
 4326|       |                     }
 4327|       |                     // Only short-circuit for variants without tags
 4328|       |                     else if constexpr (tag_v<T>.empty()) {
 4329|       |                        if (matching_types == 1) {
 4330|       |                           if (!start.rewind(ctx, it, end)) return;
 4331|       |                           const auto type_index = possible_types.countr_zero();
 4332|       |
 4333|       |                           if (value.index() != static_cast<size_t>(type_index))
 4334|       |                              emplace_runtime_variant(value, type_index);
 4335|       |                           std::visit(
 4336|       |                              [&](auto&& v) {
 4337|       |                                 using V = std::decay_t<decltype(v)>;
 4338|       |                                 constexpr bool is_object = (glaze_object_t<V> || reflectable<V>) && not custom_read<V>;
 4339|       |                                 if constexpr (variant_unit_alternative<V>) {
 4340|       |                                    // A unit alternative carries no data; its object holds only the discriminator.
 4341|       |                                    // Consume that body through an empty reflected object so unknown-key policy and
 4342|       |                                    // terminator handling match every other alternative.
 4343|       |                                    detail::variant_unit_body unit_body{};
 4344|       |                                    from<JSON, detail::variant_unit_body>::template op<opening_handled<Opts>(),
 4345|       |                                                                                       tag_literal>(unit_body, ctx, it,
 4346|       |                                                                                                    end);
 4347|       |                                 }
 4348|       |                                 else if constexpr (is_object) {
 4349|       |                                    from<JSON, V>::template op<opening_handled<Opts>(), tag_literal>(v, ctx, it, end);
 4350|       |                                 }
 4351|       |                                 else if constexpr (is_memory_object<V>) {
 4352|       |                                    if (!v) {
 4353|       |                                       if constexpr (is_specialization_v<V, std::optional>) {
 4354|       |                                          if constexpr (requires { v.emplace(); }) {
 4355|       |                                             v.emplace();
 4356|       |                                          }
 4357|       |                                          else {
 4358|       |                                             v = typename V::value_type{};
 4359|       |                                          }
 4360|       |                                       }
 4361|       |                                       else if constexpr (is_specialization_v<V, std::unique_ptr>)
 4362|       |                                          v = std::make_unique<typename V::element_type>();
 4363|       |                                       else if constexpr (is_specialization_v<V, std::shared_ptr>)
 4364|       |                                          v = std::make_shared<typename V::element_type>();
 4365|       |                                       else if constexpr (constructible<V>) {
 4366|       |                                          v = meta_construct_v<V>();
 4367|       |                                       }
 4368|       |                                       else if constexpr (std::is_pointer_v<V> &&
 4369|       |                                                          can_allocate_raw_pointer<Opts, std::decay_t<decltype(ctx)>>) {
 4370|       |                                          if (!try_allocate_raw_pointer<Opts>(v, ctx)) {
 4371|       |                                             return;
 4372|       |                                          }
 4373|       |                                       }
 4374|       |                                       else {
 4375|       |                                          ctx.error = error_code::invalid_nullable_read;
 4376|       |                                          return;
 4377|       |                                          // Cannot read into unset nullable that is not std::optional,
 4378|       |                                          // std::unique_ptr, or std::shared_ptr
 4379|       |                                       }
 4380|       |                                    }
 4381|       |                                    from<JSON, memory_type<V>>::template op<opening_handled<Opts>(), tag_literal>(
 4382|       |                                       *v, ctx, it, end);
 4383|       |                                 }
 4384|       |                                 else if constexpr (custom_read<V>) {
 4385|       |                                    // Custom handlers parse the remaining body themselves.
 4386|       |                                    from<JSON, V>::template op<opening_handled<Opts>()>(v, ctx, it, end);
 4387|       |                                 }
 4388|       |                              },
 4389|       |                              value);
 4390|       |
 4391|       |                           return; // we've decoded our target type
 4392|       |                        }
 4393|       |                     }
 4394|       |                     // For tagged variants, continue processing to validate tags
 4395|       |                     if (parse_ws_colon<Opts>(ctx, it, end)) {
 4396|       |                        return;
 4397|       |                     }
 4398|       |
 4399|       |                     skip_value<JSON>::op<Opts>(ctx, it, end);
 4400|       |                     if (bool(ctx.error)) [[unlikely]]
 4401|       |                        return;
 4402|       |                     resync_window_end(ctx, end); // a streaming skip refills
 4403|       |                     if (skip_ws<Opts>(ctx, it, end)) {
 4404|       |                        return;
 4405|       |                     }
 4406|       |                  }
 4407|       |                  // Only apply ambiguous variant resolution if we have multiple object types
 4408|       |                  if constexpr ((type_counts::n_object + type_counts::n_nullable_object) > 1) {
 4409|       |                     // After parsing all keys, check if we have multiple matching types
 4410|       |                     // If so, choose the one with the fewest fields
 4411|       |                     auto final_matching = possible_types.popcount();
 4412|       |                     if (final_matching == 0) {
 4413|       |                        ctx.error = error_code::no_matching_variant_type;
 4414|       |                     }
 4415|       |                     else if (final_matching == 1) {
 4416|       |                        // Single type remains after field deduction
 4417|       |                        const auto type_index = possible_types.countr_zero();
 4418|       |
 4419|       |                        // Validate against tag if one was specified
 4420|       |                        if (tag_specified_index.has_value() &&
 4421|       |                            tag_specified_index.value() != static_cast<size_t>(type_index)) {
 4422|       |                           ctx.error = error_code::no_matching_variant_type;
 4423|       |                           return;
 4424|       |                        }
 4425|       |
 4426|       |                        if (!start.rewind(ctx, it, end)) return;
 4427|       |                        if (value.index() != static_cast<size_t>(type_index))
 4428|       |                           emplace_runtime_variant(value, type_index);
 4429|       |                        std::visit(
 4430|       |                           [&](auto&& v) {
 4431|       |                              using V = std::decay_t<decltype(v)>;
 4432|       |                              constexpr bool is_object = (glaze_object_t<V> || reflectable<V>) && not custom_read<V>;
 4433|       |                              if constexpr (variant_unit_alternative<V>) {
 4434|       |                                 // A unit alternative carries no data; its object holds only the discriminator.
 4435|       |                                 // Consume that body through an empty reflected object so unknown-key policy and
 4436|       |                                 // terminator handling match every other alternative.
 4437|       |                                 detail::variant_unit_body unit_body{};
 4438|       |                                 from<JSON, detail::variant_unit_body>::template op<opening_handled<Opts>(),
 4439|       |                                                                                    tag_literal>(unit_body, ctx, it,
 4440|       |                                                                                                 end);
 4441|       |                              }
 4442|       |                              else if constexpr (is_object) {
 4443|       |                                 from<JSON, V>::template op<opening_handled<Opts>(), tag_literal>(v, ctx, it, end);
 4444|       |                              }
 4445|       |                              else if constexpr (is_memory_object<V>) {
 4446|       |                                 if (!v) {
 4447|       |                                    if constexpr (is_specialization_v<V, std::optional>) {
 4448|       |                                       if constexpr (requires { v.emplace(); }) {
 4449|       |                                          v.emplace();
 4450|       |                                       }
 4451|       |                                       else {
 4452|       |                                          v = typename V::value_type{};
 4453|       |                                       }
 4454|       |                                    }
 4455|       |                                    else if constexpr (is_specialization_v<V, std::unique_ptr>)
 4456|       |                                       v = std::make_unique<typename V::element_type>();
 4457|       |                                    else if constexpr (is_specialization_v<V, std::shared_ptr>)
 4458|       |                                       v = std::make_shared<typename V::element_type>();
 4459|       |                                    else if constexpr (constructible<V>) {
 4460|       |                                       v = meta_construct_v<V>();
 4461|       |                                    }
 4462|       |                                    else if constexpr (std::is_pointer_v<V> &&
 4463|       |                                                       can_allocate_raw_pointer<Opts, std::decay_t<decltype(ctx)>>) {
 4464|       |                                       if (!try_allocate_raw_pointer<Opts>(v, ctx)) {
 4465|       |                                          return;
 4466|       |                                       }
 4467|       |                                    }
 4468|       |                                    else {
 4469|       |                                       ctx.error = error_code::invalid_nullable_read;
 4470|       |                                       return;
 4471|       |                                    }
 4472|       |                                 }
 4473|       |                                 from<JSON, memory_type<V>>::template op<opening_handled<Opts>(), tag_literal>(*v, ctx,
 4474|       |                                                                                                               it, end);
 4475|       |                              }
 4476|       |                              else if constexpr (custom_read<V>) {
 4477|       |                                 // Custom handlers parse the remaining body themselves.
 4478|       |                                 from<JSON, V>::template op<opening_handled<Opts>()>(v, ctx, it, end);
 4479|       |                              }
 4480|       |                           },
 4481|       |                           value);
 4482|       |                     }
 4483|       |                     else if (final_matching > 1) {
 4484|       |                        constexpr auto N = std::variant_size_v<T>;
 4485|       |
 4486|       |                        // Compile-time array of field counts for each variant type
 4487|       |                        constexpr auto field_counts = []<size_t... I>(std::index_sequence<I...>) {
 4488|       |                           return std::array<size_t, N> {
 4489|       |                              ([]<size_t J = I>() -> size_t {
 4490|       |                                 using V = std::decay_t<std::variant_alternative_t<J, T>>;
 4491|       |                                 if constexpr (glaze_object_t<V> || reflectable<V>) {
 4492|       |                                    return reflect<V>::size;
 4493|       |                                 }
 4494|       |                                 else if constexpr (is_memory_object<V>) {
 4495|       |                                    using X = memory_type<V>;
 4496|       |                                    if constexpr (glaze_object_t<X> || reflectable<X>) {
 4497|       |                                       return reflect<X>::size;
 4498|       |                                    }
 4499|       |                                    else {
 4500|       |                                       return (std::numeric_limits<size_t>::max)();
 4501|       |                                    }
 4502|       |                                 }
 4503|       |                                 else {
 4504|       |                                    return (std::numeric_limits<size_t>::max)();
 4505|       |                                 }
 4506|       |                              }.template operator()<I>())...
 4507|       |                           };
 4508|       |                        }(std::make_index_sequence<N>{});
 4509|       |
 4510|       |                        // Find the type with minimum field count among the possible types
 4511|       |                        size_t min_fields = (std::numeric_limits<size_t>::max)();
 4512|       |                        size_t chosen_index = N; // Invalid index initially
 4513|       |
 4514|       |                        for (size_t i = 0; i < N; ++i) {
 4515|       |                           if (possible_types[i] && field_counts[i] < min_fields) {
 4516|       |                              min_fields = field_counts[i];
 4517|       |                              chosen_index = i;
 4518|       |                           }
 4519|       |                        }
 4520|       |
 4521|       |                        if (chosen_index < N) {
 4522|       |                           // Validate against tag if one was specified
 4523|       |                           if (tag_specified_index.has_value() && tag_specified_index.value() != chosen_index) {
 4524|       |                              ctx.error = error_code::no_matching_variant_type;
 4525|       |                              return;
 4526|       |                           }
 4527|       |
 4528|       |                           if (!start.rewind(ctx, it, end)) return;
 4529|       |                           if (value.index() != chosen_index) emplace_runtime_variant(value, chosen_index);
 4530|       |                           std::visit(
 4531|       |                              [&](auto&& v) {
 4532|       |                                 using V = std::decay_t<decltype(v)>;
 4533|       |                                 constexpr bool is_object = (glaze_object_t<V> || reflectable<V>) && not custom_read<V>;
 4534|       |                                 if constexpr (variant_unit_alternative<V>) {
 4535|       |                                    // A unit alternative carries no data; its object holds only the discriminator.
 4536|       |                                    // Consume that body through an empty reflected object so unknown-key policy and
 4537|       |                                    // terminator handling match every other alternative.
 4538|       |                                    detail::variant_unit_body unit_body{};
 4539|       |                                    from<JSON, detail::variant_unit_body>::template op<opening_handled<Opts>(),
 4540|       |                                                                                       tag_literal>(unit_body, ctx, it,
 4541|       |                                                                                                    end);
 4542|       |                                 }
 4543|       |                                 else if constexpr (is_object) {
 4544|       |                                    from<JSON, V>::template op<opening_handled<Opts>(), tag_literal>(v, ctx, it, end);
 4545|       |                                 }
 4546|       |                                 else if constexpr (is_memory_object<V>) {
 4547|       |                                    if (!v) {
 4548|       |                                       if constexpr (is_specialization_v<V, std::optional>) {
 4549|       |                                          if constexpr (requires { v.emplace(); }) {
 4550|       |                                             v.emplace();
 4551|       |                                          }
 4552|       |                                          else {
 4553|       |                                             v = typename V::value_type{};
 4554|       |                                          }
 4555|       |                                       }
 4556|       |                                       else if constexpr (is_specialization_v<V, std::unique_ptr>)
 4557|       |                                          v = std::make_unique<typename V::element_type>();
 4558|       |                                       else if constexpr (is_specialization_v<V, std::shared_ptr>)
 4559|       |                                          v = std::make_shared<typename V::element_type>();
 4560|       |                                       else if constexpr (constructible<V>) {
 4561|       |                                          v = meta_construct_v<V>();
 4562|       |                                       }
 4563|       |                                       else if constexpr (std::is_pointer_v<V> &&
 4564|       |                                                          can_allocate_raw_pointer<Opts, std::decay_t<decltype(ctx)>>) {
 4565|       |                                          if (!try_allocate_raw_pointer<Opts>(v, ctx)) {
 4566|       |                                             return;
 4567|       |                                          }
 4568|       |                                       }
 4569|       |                                       else {
 4570|       |                                          ctx.error = error_code::invalid_nullable_read;
 4571|       |                                          return;
 4572|       |                                       }
 4573|       |                                    }
 4574|       |                                    from<JSON, memory_type<V>>::template op<opening_handled<Opts>(), tag_literal>(
 4575|       |                                       *v, ctx, it, end);
 4576|       |                                 }
 4577|       |                                 else if constexpr (custom_read<V>) {
 4578|       |                                    // Custom handlers parse the remaining body themselves.
 4579|       |                                    from<JSON, V>::template op<opening_handled<Opts>()>(v, ctx, it, end);
 4580|       |                                 }
 4581|       |                              },
 4582|       |                              value);
 4583|       |                        }
 4584|       |                        else {
 4585|       |                           ctx.error = error_code::no_matching_variant_type;
 4586|       |                        }
 4587|       |                     }
 4588|       |                  }
 4589|       |                  else {
 4590|       |                     // For variants with 0 or 1 object types, use the original error handling
 4591|       |                     ctx.error = error_code::no_matching_variant_type;
 4592|       |                  }
 4593|       |               }
 4594|      0|               break;
 4595|  63.5k|            }
 4596|  1.75M|            case '[':
  ------------------
  |  Branch (4596:13): [True: 1.75M, False: 6.57M]
  ------------------
 4597|       |               // As with '{' above: the array reader each alternative goes through counts the level.
 4598|  1.75M|               process_variant_alternatives<T, is_variant_array>::template op<Opts>(value, ctx, it, end);
 4599|  1.75M|               break;
 4600|  28.4k|            case '"': {
  ------------------
  |  Branch (4600:13): [True: 28.4k, False: 8.30M]
  ------------------
 4601|  28.4k|               process_variant_alternatives<T, is_variant_str>::template op<Opts>(value, ctx, it, end);
 4602|  28.4k|               break;
 4603|  63.5k|            }
 4604|  2.44k|            case 't':
  ------------------
  |  Branch (4604:13): [True: 2.44k, False: 8.32M]
  ------------------
 4605|  4.40k|            case 'f': {
  ------------------
  |  Branch (4605:13): [True: 1.95k, False: 8.32M]
  ------------------
 4606|  4.40k|               process_variant_alternatives<T, is_variant_bool>::template op<Opts>(value, ctx, it, end);
 4607|  4.40k|               break;
 4608|  2.44k|            }
 4609|  3.35k|            case 'n':
  ------------------
  |  Branch (4609:13): [True: 3.35k, False: 8.32M]
  ------------------
 4610|       |               if constexpr (variant_count_v<T, is_variant_null> == 0) {
 4611|       |                  ctx.error = error_code::no_matching_variant_type;
 4612|       |               }
 4613|  3.35k|               else {
 4614|  3.35k|                  constexpr auto first_idx = variant_first_index_v<T, is_variant_null>;
 4615|  3.35k|                  using V = std::variant_alternative_t<first_idx, T>;
 4616|  3.35k|                  if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (4616:23): [True: 1.07k, False: 2.28k]
  ------------------
 4617|  3.35k|                  match<"null", Opts>(ctx, it, end);
 4618|  3.35k|               }
 4619|  3.35k|               break;
 4620|  6.47M|            default: {
  ------------------
  |  Branch (4620:13): [True: 6.47M, False: 1.86M]
  ------------------
 4621|       |               // Not bool, string, object, or array so must be number or null
 4622|  6.47M|               process_variant_alternatives<T, is_variant_num>::template op<Opts>(value, ctx, it, end);
 4623|  6.47M|            }
 4624|  8.33M|            }
 4625|       |         }
 4626|       |         else {
 4627|       |            // For non-auto-deducible variants, try each type until one succeeds
 4628|       |            constexpr auto N = std::variant_size_v<T>;
 4629|       |            bool parsed = false;
 4630|       |            bool exhausted = false; // speculation budget spent; see charge_speculation
 4631|       |
 4632|       |            for_each<N>([&]<size_t I>() {
 4633|       |               if (parsed || exhausted || variant_alternative_exhausted(ctx)) return;
 4634|       |
 4635|       |               auto copy_it = it;
 4636|       |               // A rejected alternative may have bailed out inside a container, which leaves its
 4637|       |               // nesting level counted (see enter_depth), so the depth rewinds with the iterator.
 4638|       |               const auto copy_depth = ctx.depth;
 4639|       |
 4640|       |               // Try parsing as this type
 4641|       |               if (value.index() != I) {
 4642|       |                  emplace_runtime_variant(value, I);
 4643|       |               }
 4644|       |
 4645|       |               std::visit([&](auto&& v) { parse<JSON>::op<Options>(v, ctx, it, end); }, value);
 4646|       |               if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 4647|       |                  exhausted = true; // only rejected attempts are charged; see charge_speculation
 4648|       |               }
 4649|       |
 4650|       |               if (!bool(ctx.error)) {
 4651|       |                  parsed = true;
 4652|       |               }
 4653|       |               else if constexpr (not Options.null_terminated) {
 4654|       |                  // In non-null-terminated mode, if we hit end_reached after advancing the iterator,
 4655|       |                  // it means we successfully parsed the value but couldn't skip trailing whitespace
 4656|       |                  if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 4657|       |                     // We advanced the iterator, so we did parse something -- unless what advanced it
 4658|       |                     // was an abandoned attempt, which is what a spent speculation budget means.
 4659|       |                     parsed = true;
 4660|       |                     ctx.error = error_code::none;
 4661|       |                  }
 4662|       |                  else {
 4663|       |                     // Reset for next attempt (unless this is the last type)
 4664|       |                     it = copy_it;
 4665|       |                     rewind_depth<Options>(ctx, copy_depth);
 4666|       |                     if constexpr (I + 1 < N) {
 4667|       |                        if (not exhausted && not variant_alternative_exhausted(ctx)) {
 4668|       |                           ctx.error = error_code::none; // Clear error for next attempt
 4669|       |                        }
 4670|       |                     }
 4671|       |                  }
 4672|       |               }
 4673|       |               else {
 4674|       |                  // Reset for next attempt (unless this is the last type)
 4675|       |                  it = copy_it;
 4676|       |                  rewind_depth<Options>(ctx, copy_depth);
 4677|       |                  if constexpr (I + 1 < N) {
 4678|       |                     if (not exhausted && not variant_alternative_exhausted(ctx)) {
 4679|       |                        ctx.error = error_code::none; // Clear error for next attempt
 4680|       |                     }
 4681|       |                  }
 4682|       |               }
 4683|       |            });
 4684|       |         }
 4685|  8.33M|      }
_ZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_16is_variant_arrayEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_:
 3520|  1.76M|      {
 3521|  1.76M|         constexpr auto category_count = variant_count_v<Variant, Trait>;
 3522|       |
 3523|       |         if constexpr (category_count == 0) {
 3524|       |            ctx.error = error_code::no_matching_variant_type;
 3525|       |         }
 3526|  1.76M|         else {
 3527|  1.76M|            constexpr auto N = std::variant_size_v<Variant>;
 3528|  1.76M|            constexpr auto const_count = variant_filtered_count_v<Variant, Trait, true>;
 3529|  1.76M|            constexpr auto non_const_count = variant_filtered_count_v<Variant, Trait, false>;
 3530|       |
 3531|  1.76M|            bool found_match{};
 3532|       |            // Set when the speculative parsing budget runs out; see charge_speculation. An ambiguous
 3533|       |            // nest re-parses the same subtree per alternative at every level, which is exponential,
 3534|       |            // so the budget stops it and the failure already in hand is reported.
 3535|  1.76M|            bool exhausted{};
 3536|       |
 3537|       |            // First pass: const glaze types in this category
 3538|       |            if constexpr (const_count > 0) {
 3539|       |               for_each<N>([&]<size_t I>() {
 3540|       |                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
 3541|       |                     return;
 3542|       |                  }
 3543|       |                  using V = std::variant_alternative_t<I, Variant>;
 3544|       |                  if constexpr (Trait<V>::value && glaze_const_value_t<V>) {
 3545|       |                     // run time substitute to compare to const value
 3546|       |                     std::remove_const_t<std::remove_pointer_t<std::remove_const_t<meta_wrapper_t<V>>>> substitute{};
 3547|       |                     auto copy_it{it};
 3548|       |                     // A rejected alternative may have bailed out inside a container, which leaves its
 3549|       |                     // nesting level counted (see enter_depth). Rewind the depth with the iterator so
 3550|       |                     // trying N alternatives cannot spend N levels of the recursion budget.
 3551|       |                     const auto copy_depth{ctx.depth};
 3552|       |                     parse<JSON>::op<ws_handled<Options>()>(substitute, ctx, it, end);
 3553|       |                     static constexpr auto const_value{*meta_wrapper_v<V>};
 3554|       |                     if (substitute == const_value) {
 3555|       |                        found_match = true;
 3556|       |                        if (!std::holds_alternative<V>(value)) {
 3557|       |                           value = V{};
 3558|       |                        }
 3559|       |                     }
 3560|       |                     else {
 3561|       |                        // Rejected: charge the bytes it parsed before we rewind. See charge_speculation.
 3562|       |                        if (!charge_speculation(ctx, size_t(it - copy_it))) {
 3563|       |                           exhausted = true;
 3564|       |                        }
 3565|       |                        if constexpr (not Options.null_terminated) {
 3566|       |                           if (ctx.error == error_code::end_reached && not exhausted) {
 3567|       |                              ctx.error = error_code::none;
 3568|       |                           }
 3569|       |                        }
 3570|       |                        it = copy_it;
 3571|       |                        rewind_depth<Options>(ctx, copy_depth);
 3572|       |                     }
 3573|       |                  }
 3574|       |               });
 3575|       |               if (found_match) {
 3576|       |                  return;
 3577|       |               }
 3578|       |            }
 3579|       |
 3580|       |            // Second pass: non-const types in this category
 3581|  1.76M|            if constexpr (non_const_count > 0) {
 3582|       |               // Track position within matching types for "is last" check.
 3583|       |               // We iterate over all variant indices but only process matching types,
 3584|       |               // so we need runtime tracking (vs the old tuple-based approach where
 3585|       |               // the loop index directly corresponded to position in filtered set).
 3586|       |               // This has negligible cost: one increment per matching type.
 3587|  1.76M|               size_t non_const_idx = 0;
 3588|       |
 3589|  1.76M|               for_each<N>([&]<size_t I>() {
 3590|  1.76M|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
 3591|  1.76M|                     return;
 3592|  1.76M|                  }
 3593|  1.76M|                  using V = std::variant_alternative_t<I, Variant>;
 3594|  1.76M|                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|  1.76M|                     auto copy_it{it};
 3596|  1.76M|                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|  1.76M|                     if (!std::holds_alternative<V>(value)) {
 3598|  1.76M|                        value = V{};
 3599|  1.76M|                     }
 3600|  1.76M|                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|  1.76M|                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|  1.76M|                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|  1.76M|                     }
 3604|  1.76M|                     if (!bool(ctx.error)) {
 3605|  1.76M|                        found_match = true;
 3606|  1.76M|                     }
 3607|  1.76M|                     else if constexpr (not Options.null_terminated) {
 3608|  1.76M|                        constexpr bool is_complete_type =
 3609|  1.76M|                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|  1.76M|                        if constexpr (is_complete_type) {
 3612|  1.76M|                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|  1.76M|                              found_match = true;
 3614|  1.76M|                              ctx.error = error_code::none;
 3615|  1.76M|                           }
 3616|  1.76M|                           else {
 3617|  1.76M|                              it = copy_it;
 3618|  1.76M|                              rewind_depth<Options>(ctx, copy_depth);
 3619|  1.76M|                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|  1.76M|                                  not variant_alternative_exhausted(ctx)) {
 3621|  1.76M|                                 ctx.error = error_code::none;
 3622|  1.76M|                              }
 3623|  1.76M|                           }
 3624|  1.76M|                        }
 3625|  1.76M|                        else {
 3626|  1.76M|                           it = copy_it;
 3627|  1.76M|                           rewind_depth<Options>(ctx, copy_depth);
 3628|  1.76M|                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|  1.76M|                               not variant_alternative_exhausted(ctx)) {
 3630|  1.76M|                              ctx.error = error_code::none;
 3631|  1.76M|                           }
 3632|  1.76M|                        }
 3633|  1.76M|                     }
 3634|  1.76M|                     else {
 3635|  1.76M|                        it = copy_it;
 3636|  1.76M|                        rewind_depth<Options>(ctx, copy_depth);
 3637|  1.76M|                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|  1.76M|                            not variant_alternative_exhausted(ctx)) {
 3639|  1.76M|                           ctx.error = error_code::none;
 3640|  1.76M|                        }
 3641|  1.76M|                     }
 3642|  1.76M|                     ++non_const_idx;
 3643|  1.76M|                  }
 3644|  1.76M|               });
 3645|  1.76M|               if (!found_match) {
  ------------------
  |  Branch (3645:20): [True: 45.6k, False: 1.71M]
  ------------------
 3646|  45.6k|                  if constexpr (non_const_count == 1) {
 3647|       |                     // Keep the specific error from the single type we tried
 3648|       |                  }
 3649|       |                  else if (not exhausted && not variant_alternative_exhausted(ctx)) {
 3650|       |                     // Over-nested input is not a failure of the alternative set; keep saying so.
 3651|       |                     ctx.error = error_code::no_matching_variant_type;
 3652|       |                  }
 3653|  45.6k|               }
 3654|       |            }
 3655|       |            else {
 3656|       |               ctx.error = error_code::no_matching_variant_type;
 3657|       |            }
 3658|  1.76M|         }
 3659|  1.76M|      }
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_16is_variant_arrayEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm0EEEDav:
 3589|  1.76M|               for_each<N>([&]<size_t I>() {
 3590|  1.76M|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 0, False: 1.76M]
  |  Branch (3590:38): [True: 0, False: 1.76M]
  |  Branch (3590:51): [True: 0, False: 1.76M]
  ------------------
 3591|      0|                     return;
 3592|      0|                  }
 3593|  1.76M|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  1.76M|               });
_ZN3glz29variant_alternative_exhaustedITkNS_10is_contextENS_7contextEEEbRT_:
 3509|  21.9M|   {
 3510|  21.9M|      return ctx.error == error_code::exceeded_max_recursive_depth;
 3511|  21.9M|   }
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_16is_variant_arrayEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm1EEEDav:
 3589|  1.76M|               for_each<N>([&]<size_t I>() {
 3590|  1.76M|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 0, False: 1.76M]
  |  Branch (3590:38): [True: 0, False: 1.76M]
  |  Branch (3590:51): [True: 0, False: 1.76M]
  ------------------
 3591|      0|                     return;
 3592|      0|                  }
 3593|  1.76M|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  1.76M|               });
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_16is_variant_arrayEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm2EEEDav:
 3589|  1.76M|               for_each<N>([&]<size_t I>() {
 3590|  1.76M|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 0, False: 1.76M]
  |  Branch (3590:38): [True: 0, False: 1.76M]
  |  Branch (3590:51): [True: 0, False: 1.76M]
  ------------------
 3591|      0|                     return;
 3592|      0|                  }
 3593|  1.76M|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  1.76M|               });
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_16is_variant_arrayEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm3EEEDav:
 3589|  1.76M|               for_each<N>([&]<size_t I>() {
 3590|  1.76M|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 0, False: 1.76M]
  |  Branch (3590:38): [True: 0, False: 1.76M]
  |  Branch (3590:51): [True: 0, False: 1.76M]
  ------------------
 3591|      0|                     return;
 3592|      0|                  }
 3593|  1.76M|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  1.76M|               });
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_16is_variant_arrayEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm4EEEDav:
 3589|  1.76M|               for_each<N>([&]<size_t I>() {
 3590|  1.76M|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 0, False: 1.76M]
  |  Branch (3590:38): [True: 0, False: 1.76M]
  |  Branch (3590:51): [True: 0, False: 1.76M]
  ------------------
 3591|      0|                     return;
 3592|      0|                  }
 3593|  1.76M|                  using V = std::variant_alternative_t<I, Variant>;
 3594|  1.76M|                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|  1.76M|                     auto copy_it{it};
 3596|  1.76M|                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|  1.76M|                     if (!std::holds_alternative<V>(value)) {
  ------------------
  |  Branch (3597:26): [True: 1.42M, False: 340k]
  ------------------
 3598|  1.42M|                        value = V{};
 3599|  1.42M|                     }
 3600|  1.76M|                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|  1.76M|                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
  ------------------
  |  Branch (3601:26): [True: 45.6k, False: 1.71M]
  |  Branch (3601:45): [True: 0, False: 45.6k]
  ------------------
 3602|      0|                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|      0|                     }
 3604|  1.76M|                     if (!bool(ctx.error)) {
  ------------------
  |  Branch (3604:26): [True: 1.71M, False: 45.6k]
  ------------------
 3605|  1.71M|                        found_match = true;
 3606|  1.71M|                     }
 3607|  45.6k|                     else if constexpr (not Options.null_terminated) {
 3608|  45.6k|                        constexpr bool is_complete_type =
 3609|  45.6k|                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
  ------------------
  |  Branch (3609:28): [Folded, False: 0]
  |  Branch (3609:40): [Folded, False: 0]
  |  Branch (3609:53): [Folded, False: 0]
  |  Branch (3609:68): [Folded, False: 0]
  |  Branch (3609:89): [Folded, False: 0]
  |  Branch (3609:103): [Folded, False: 0]
  ------------------
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|  45.6k|                        else {
 3626|  45.6k|                           it = copy_it;
 3627|  45.6k|                           rewind_depth<Options>(ctx, copy_depth);
 3628|  45.6k|                           if (non_const_idx + 1 < non_const_count && not exhausted &&
  ------------------
  |  Branch (3628:32): [True: 0, False: 45.6k]
  |  Branch (3628:71): [True: 0, False: 0]
  ------------------
 3629|      0|                               not variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3629:32): [True: 0, False: 0]
  ------------------
 3630|      0|                              ctx.error = error_code::none;
 3631|      0|                           }
 3632|  45.6k|                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|  1.76M|                     ++non_const_idx;
 3643|  1.76M|                  }
 3644|  1.76M|               });
_ZN3glz5parseILj10EE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj4EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS4_9allocatorIS9_EEEETkNS_10is_contextERNS_7contextERPKcSH_EEvOT0_OT1_OT2_T3_:
   49|  1.76M|      {
   50|       |         if constexpr (const_value_v<T>) {
   51|       |            if constexpr (check_error_on_const_read(Opts)) {
   52|       |               ctx.error = error_code::attempt_const_read;
   53|       |            }
   54|       |            else {
   55|       |               // do not read anything into the const value
   56|       |               skip_value<JSON>::op<Opts>(std::forward<Ctx>(ctx), std::forward<It0>(it), end);
   57|       |            }
   58|       |         }
   59|  1.76M|         else {
   60|  1.76M|            using V = std::remove_cvref_t<T>;
   61|  1.76M|            from<JSON, V>::template op<Opts>(std::forward<T>(value), std::forward<Ctx>(ctx), std::forward<It0>(it),
   62|  1.76M|                                             end);
   63|  1.76M|         }
   64|  1.76M|      }
_ZN3glz4fromILj10ENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS1_9allocatorIS6_EEEEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj4EEERS9_TkNS_10is_contextERNS_7contextERPKcSH_EEvOT0_OT1_OT2_T3_:
 2050|  1.76M|      {
 2051|  1.76M|         constexpr auto Opts = ws_handled_off<Options>();
 2052|       |         if constexpr (!check_ws_handled(Options)) {
 2053|       |            if (skip_ws<Opts>(ctx, it, end)) {
 2054|       |               return;
 2055|       |            }
 2056|       |         }
 2057|       |
 2058|  1.76M|         if (match_invalid_end<'[', Opts>(ctx, it, end)) {
  ------------------
  |  Branch (2058:14): [True: 111, False: 1.76M]
  ------------------
 2059|    111|            return;
 2060|    111|         }
 2061|       |         // one nesting level (see enter_depth): counted in both modes so the limit binds,
 2062|       |         // released at each syntactic close below
 2063|  1.76M|         if (enter_depth(ctx)) [[unlikely]] {
  ------------------
  |  Branch (2063:14): [True: 14, False: 1.76M]
  ------------------
 2064|     14|            return;
 2065|     14|         }
 2066|       |
 2067|  1.76M|         const auto ws_start = it;
 2068|  1.76M|         if (skip_ws<Opts>(ctx, it, end)) {
  ------------------
  |  Branch (2068:14): [True: 28, False: 1.76M]
  ------------------
 2069|     28|            return;
 2070|     28|         }
 2071|       |
 2072|  1.76M|         if (*it == ']') {
  ------------------
  |  Branch (2072:14): [True: 46.3k, False: 1.71M]
  ------------------
 2073|  46.3k|            --ctx.depth;
 2074|  46.3k|            ++it;
 2075|  46.3k|            if constexpr ((resizable<T> || is_inplace_vector<T>) && not check_append_arrays(Opts)) {
 2076|  46.3k|               value.clear();
 2077|       |
 2078|       |               if constexpr (check_shrink_to_fit(Opts) && has_shrink_to_fit<T>) {
 2079|       |                  value.shrink_to_fit();
 2080|       |               }
 2081|  46.3k|            }
 2082|  46.3k|            return;
 2083|  46.3k|         }
 2084|       |
 2085|  1.71M|         const size_t ws_size = size_t(it - ws_start);
 2086|       |
 2087|  1.71M|         static constexpr bool should_append = (resizable<T> || is_inplace_vector<T>) && check_append_arrays(Opts);
  ------------------
  |  Branch (2087:49): [True: 1.71M, Folded]
  |  Branch (2087:65): [Folded, False: 0]
  |  Branch (2087:90): [Folded, False: 0]
  ------------------
 2088|  1.71M|         if constexpr (not should_append) {
 2089|  1.71M|            const auto n = value.size();
 2090|       |
 2091|  1.71M|            auto value_it = value.begin();
 2092|       |
 2093|  1.73M|            for (size_t i = 0; i < n; ++i) {
  ------------------
  |  Branch (2093:32): [True: 345k, False: 1.38M]
  ------------------
 2094|   345k|               parse<JSON>::op<ws_handled<Opts>()>(*value_it++, ctx, it, end);
 2095|   345k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2095:20): [True: 785, False: 344k]
  ------------------
 2096|    785|                  return;
 2097|   344k|               if (skip_ws<Opts>(ctx, it, end)) {
  ------------------
  |  Branch (2097:20): [True: 26, False: 344k]
  ------------------
 2098|     26|                  return;
 2099|     26|               }
 2100|   344k|               if (*it == ',') {
  ------------------
  |  Branch (2100:20): [True: 15.6k, False: 329k]
  ------------------
 2101|  15.6k|                  ++it;
 2102|       |
 2103|  15.6k|                  if constexpr (!Opts.minified && !Opts.comments) {
 2104|  15.6k|                     if (ws_size && ws_size < size_t(end - it)) {
  ------------------
  |  Branch (2104:26): [True: 8.42k, False: 7.25k]
  |  Branch (2104:37): [True: 7.87k, False: 550]
  ------------------
 2105|  7.87k|                        skip_matching_ws(ws_start, it, ws_size);
 2106|  7.87k|                     }
 2107|  15.6k|                  }
 2108|       |
 2109|  15.6k|                  if (skip_ws<Opts>(ctx, it, end)) {
  ------------------
  |  Branch (2109:23): [True: 85, False: 15.5k]
  ------------------
 2110|     85|                     return;
 2111|     85|                  }
 2112|  15.6k|               }
 2113|   329k|               else if (*it == ']') {
  ------------------
  |  Branch (2113:25): [True: 329k, False: 117]
  ------------------
 2114|   329k|                  --ctx.depth;
 2115|   329k|                  ++it;
 2116|   329k|                  if constexpr (erasable<T>) {
 2117|   329k|                     value.erase(value_it,
 2118|   329k|                                 value.end()); // use erase rather than resize for non-default constructible elements
 2119|       |
 2120|       |                     if constexpr (check_shrink_to_fit(Opts) && has_shrink_to_fit<T>) {
 2121|       |                        value.shrink_to_fit();
 2122|       |                     }
 2123|   329k|                  }
 2124|   329k|                  return;
 2125|   329k|               }
 2126|    117|               else [[unlikely]] {
 2127|    117|                  ctx.error = error_code::expected_bracket;
 2128|    117|                  return;
 2129|    117|               }
 2130|   344k|            }
 2131|  1.71M|         }
 2132|       |
 2133|       |         if constexpr (Opts.partial_read) {
 2134|       |            // partial_read stops early on a success path, so give the level back like the
 2135|       |            // syntactic-close paths do; otherwise it accumulates across reads sharing a context.
 2136|       |            --ctx.depth;
 2137|       |            return;
 2138|       |         }
 2139|  1.71M|         else {
 2140|       |            // growing
 2141|  1.71M|            if constexpr (emplace_backable<T> || has_try_emplace_back<T>) {
 2142|  5.02M|               while (it < end) {
  ------------------
  |  Branch (2142:23): [True: 4.69M, False: 330k]
  ------------------
 2143|       |                  // Streaming refill point: at start of each iteration, ensure buffer has data
 2144|       |                  if constexpr (has_streaming_state<decltype(ctx)>) {
 2145|       |                     if (ctx.stream.enabled()) {
 2146|       |                        const size_t consumed = static_cast<size_t>(it - ctx.stream.data());
 2147|       |                        const size_t remaining = ctx.stream.size() - consumed;
 2148|       |                        // Refill when less than half of buffer remains to ensure space for next element
 2149|       |                        if (remaining <= ctx.stream.size() / 2 || it >= end) {
 2150|       |                           const char* new_it;
 2151|       |                           const char* new_end;
 2152|       |                           ctx.stream.consume_and_refill(consumed, new_it, new_end);
 2153|       |                           it = new_it;
 2154|       |                           end = new_end;
 2155|       |                           if (it >= end && ctx.stream.at_eof()) {
 2156|       |                              break; // No more data, exit loop normally
 2157|       |                           }
 2158|       |                        }
 2159|       |                     }
 2160|       |                  }
 2161|       |
 2162|       |                  if constexpr (has_try_emplace_back<T>) {
 2163|       |                     if (value.try_emplace_back())
 2164|       |                        parse<JSON>::op<ws_handled<Opts>()>(value.back(), ctx, it, end);
 2165|       |                     else
 2166|       |                        ctx.error = error_code::exceeded_static_array_size;
 2167|       |                  }
 2168|  4.69M|                  else {
 2169|  4.69M|                     parse<JSON>::op<ws_handled<Opts>()>(value.emplace_back(), ctx, it, end);
 2170|  4.69M|                  }
 2171|       |
 2172|  4.69M|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2172:23): [True: 41.7k, False: 4.65M]
  ------------------
 2173|  41.7k|                     return;
 2174|       |
 2175|       |                  // Streaming refill point: after parsing each element, refill if buffer is low
 2176|       |                  if constexpr (has_streaming_state<decltype(ctx)>) {
 2177|       |                     if (ctx.stream.enabled()) {
 2178|       |                        const size_t consumed = static_cast<size_t>(it - ctx.stream.data());
 2179|       |                        // Refill when less than 25% of buffer remains to ensure enough space for next element
 2180|       |                        if (ctx.stream.size() - consumed <= ctx.stream.size() / 4 || it >= end) {
 2181|       |                           const char* new_it;
 2182|       |                           const char* new_end;
 2183|       |                           ctx.stream.consume_and_refill(consumed, new_it, new_end);
 2184|       |                           it = new_it;
 2185|       |                           end = new_end;
 2186|       |                           if (it >= end && ctx.stream.at_eof()) {
 2187|       |                              ctx.error = error_code::unexpected_end;
 2188|       |                              return;
 2189|       |                           }
 2190|       |                        }
 2191|       |                     }
 2192|       |                  }
 2193|       |
 2194|  4.65M|                  if (skip_ws<Opts>(ctx, it, end)) {
  ------------------
  |  Branch (2194:23): [True: 592, False: 4.65M]
  ------------------
 2195|    592|                     return;
 2196|    592|                  }
 2197|  4.65M|                  if (*it == ',') [[likely]] {
  ------------------
  |  Branch (2197:23): [True: 3.31M, False: 1.34M]
  ------------------
 2198|  3.31M|                     ++it;
 2199|       |
 2200|  3.31M|                     if constexpr (!Opts.minified && !Opts.comments) {
 2201|  3.31M|                        if (ws_size && ws_size < size_t(end - it)) {
  ------------------
  |  Branch (2201:29): [True: 35.8k, False: 3.27M]
  |  Branch (2201:40): [True: 35.1k, False: 719]
  ------------------
 2202|  35.1k|                           skip_matching_ws(ws_start, it, ws_size);
 2203|  35.1k|                        }
 2204|  3.31M|                     }
 2205|       |
 2206|  3.31M|                     if (skip_ws<Opts>(ctx, it, end)) {
  ------------------
  |  Branch (2206:26): [True: 178, False: 3.31M]
  ------------------
 2207|    178|                        return;
 2208|    178|                     }
 2209|  3.31M|                  }
 2210|  1.34M|                  else if (*it == ']') {
  ------------------
  |  Branch (2210:28): [True: 1.34M, False: 1.95k]
  ------------------
 2211|  1.34M|                     --ctx.depth;
 2212|  1.34M|                     ++it;
 2213|       |                     if constexpr (check_shrink_to_fit(Opts) && has_shrink_to_fit<T>) {
 2214|       |                        value.shrink_to_fit();
 2215|       |                     }
 2216|  1.34M|                     return;
 2217|  1.34M|                  }
 2218|  1.95k|                  else [[unlikely]] {
 2219|  1.95k|                     ctx.error = error_code::expected_bracket;
 2220|  1.95k|                     return;
 2221|  1.95k|                  }
 2222|  4.65M|               }
 2223|       |
 2224|       |               // A valid array always returns from inside the loop upon reaching ']'.
 2225|       |               // For a null-terminated buffer the loop can only exit here by falling
 2226|       |               // through when `it` reaches the terminator without a closing bracket,
 2227|       |               // which means the input was truncated (e.g. "[", "[1," or "[1,2,").
 2228|       |               // Non-null-terminated buffers surface this through skip_ws/depth
 2229|       |               // tracking (or the streaming refill break), so this guard is limited
 2230|       |               // to the null-terminated case.
 2231|       |               if constexpr (Opts.null_terminated) {
 2232|       |                  ctx.error = error_code::unexpected_end;
 2233|       |               }
 2234|       |            }
 2235|       |            else {
 2236|       |               ctx.error = error_code::exceeded_static_array_size;
 2237|       |            }
 2238|  1.71M|         }
 2239|  1.71M|      }
_ZN3glz12rewind_depthITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEETkNS_10is_contextENS_7contextEEEvRT0_j:
 3492|  52.8k|   {
 3493|  52.8k|      if (ctx.error == error_code::exceeded_max_recursive_depth) [[unlikely]] {
  ------------------
  |  Branch (3493:11): [True: 5.93k, False: 46.9k]
  ------------------
 3494|  5.93k|         return;
 3495|  5.93k|      }
 3496|       |      if constexpr (Opts.null_terminated) {
 3497|       |         ctx.depth = depth;
 3498|       |      }
 3499|  46.9k|      else {
 3500|  46.9k|         if (ctx.error != error_code::end_reached && ctx.error != error_code::unexpected_end) {
  ------------------
  |  Branch (3500:14): [True: 44.2k, False: 2.63k]
  |  Branch (3500:54): [True: 25.2k, False: 19.0k]
  ------------------
 3501|  25.2k|            ctx.depth = depth;
 3502|  25.2k|         }
 3503|  46.9k|      }
 3504|  46.9k|   }
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_16is_variant_arrayEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm5EEEDav:
 3589|  1.76M|               for_each<N>([&]<size_t I>() {
 3590|  1.76M|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 1.71M, False: 45.6k]
  |  Branch (3590:38): [True: 0, False: 45.6k]
  |  Branch (3590:51): [True: 5.93k, False: 39.7k]
  ------------------
 3591|  1.72M|                     return;
 3592|  1.72M|                  }
 3593|  39.7k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  39.7k|               });
_ZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_14is_variant_strEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_:
 3520|  31.1k|      {
 3521|  31.1k|         constexpr auto category_count = variant_count_v<Variant, Trait>;
 3522|       |
 3523|       |         if constexpr (category_count == 0) {
 3524|       |            ctx.error = error_code::no_matching_variant_type;
 3525|       |         }
 3526|  31.1k|         else {
 3527|  31.1k|            constexpr auto N = std::variant_size_v<Variant>;
 3528|  31.1k|            constexpr auto const_count = variant_filtered_count_v<Variant, Trait, true>;
 3529|  31.1k|            constexpr auto non_const_count = variant_filtered_count_v<Variant, Trait, false>;
 3530|       |
 3531|  31.1k|            bool found_match{};
 3532|       |            // Set when the speculative parsing budget runs out; see charge_speculation. An ambiguous
 3533|       |            // nest re-parses the same subtree per alternative at every level, which is exponential,
 3534|       |            // so the budget stops it and the failure already in hand is reported.
 3535|  31.1k|            bool exhausted{};
 3536|       |
 3537|       |            // First pass: const glaze types in this category
 3538|       |            if constexpr (const_count > 0) {
 3539|       |               for_each<N>([&]<size_t I>() {
 3540|       |                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
 3541|       |                     return;
 3542|       |                  }
 3543|       |                  using V = std::variant_alternative_t<I, Variant>;
 3544|       |                  if constexpr (Trait<V>::value && glaze_const_value_t<V>) {
 3545|       |                     // run time substitute to compare to const value
 3546|       |                     std::remove_const_t<std::remove_pointer_t<std::remove_const_t<meta_wrapper_t<V>>>> substitute{};
 3547|       |                     auto copy_it{it};
 3548|       |                     // A rejected alternative may have bailed out inside a container, which leaves its
 3549|       |                     // nesting level counted (see enter_depth). Rewind the depth with the iterator so
 3550|       |                     // trying N alternatives cannot spend N levels of the recursion budget.
 3551|       |                     const auto copy_depth{ctx.depth};
 3552|       |                     parse<JSON>::op<ws_handled<Options>()>(substitute, ctx, it, end);
 3553|       |                     static constexpr auto const_value{*meta_wrapper_v<V>};
 3554|       |                     if (substitute == const_value) {
 3555|       |                        found_match = true;
 3556|       |                        if (!std::holds_alternative<V>(value)) {
 3557|       |                           value = V{};
 3558|       |                        }
 3559|       |                     }
 3560|       |                     else {
 3561|       |                        // Rejected: charge the bytes it parsed before we rewind. See charge_speculation.
 3562|       |                        if (!charge_speculation(ctx, size_t(it - copy_it))) {
 3563|       |                           exhausted = true;
 3564|       |                        }
 3565|       |                        if constexpr (not Options.null_terminated) {
 3566|       |                           if (ctx.error == error_code::end_reached && not exhausted) {
 3567|       |                              ctx.error = error_code::none;
 3568|       |                           }
 3569|       |                        }
 3570|       |                        it = copy_it;
 3571|       |                        rewind_depth<Options>(ctx, copy_depth);
 3572|       |                     }
 3573|       |                  }
 3574|       |               });
 3575|       |               if (found_match) {
 3576|       |                  return;
 3577|       |               }
 3578|       |            }
 3579|       |
 3580|       |            // Second pass: non-const types in this category
 3581|  31.1k|            if constexpr (non_const_count > 0) {
 3582|       |               // Track position within matching types for "is last" check.
 3583|       |               // We iterate over all variant indices but only process matching types,
 3584|       |               // so we need runtime tracking (vs the old tuple-based approach where
 3585|       |               // the loop index directly corresponded to position in filtered set).
 3586|       |               // This has negligible cost: one increment per matching type.
 3587|  31.1k|               size_t non_const_idx = 0;
 3588|       |
 3589|  31.1k|               for_each<N>([&]<size_t I>() {
 3590|  31.1k|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
 3591|  31.1k|                     return;
 3592|  31.1k|                  }
 3593|  31.1k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|  31.1k|                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|  31.1k|                     auto copy_it{it};
 3596|  31.1k|                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|  31.1k|                     if (!std::holds_alternative<V>(value)) {
 3598|  31.1k|                        value = V{};
 3599|  31.1k|                     }
 3600|  31.1k|                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|  31.1k|                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|  31.1k|                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|  31.1k|                     }
 3604|  31.1k|                     if (!bool(ctx.error)) {
 3605|  31.1k|                        found_match = true;
 3606|  31.1k|                     }
 3607|  31.1k|                     else if constexpr (not Options.null_terminated) {
 3608|  31.1k|                        constexpr bool is_complete_type =
 3609|  31.1k|                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|  31.1k|                        if constexpr (is_complete_type) {
 3612|  31.1k|                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|  31.1k|                              found_match = true;
 3614|  31.1k|                              ctx.error = error_code::none;
 3615|  31.1k|                           }
 3616|  31.1k|                           else {
 3617|  31.1k|                              it = copy_it;
 3618|  31.1k|                              rewind_depth<Options>(ctx, copy_depth);
 3619|  31.1k|                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|  31.1k|                                  not variant_alternative_exhausted(ctx)) {
 3621|  31.1k|                                 ctx.error = error_code::none;
 3622|  31.1k|                              }
 3623|  31.1k|                           }
 3624|  31.1k|                        }
 3625|  31.1k|                        else {
 3626|  31.1k|                           it = copy_it;
 3627|  31.1k|                           rewind_depth<Options>(ctx, copy_depth);
 3628|  31.1k|                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|  31.1k|                               not variant_alternative_exhausted(ctx)) {
 3630|  31.1k|                              ctx.error = error_code::none;
 3631|  31.1k|                           }
 3632|  31.1k|                        }
 3633|  31.1k|                     }
 3634|  31.1k|                     else {
 3635|  31.1k|                        it = copy_it;
 3636|  31.1k|                        rewind_depth<Options>(ctx, copy_depth);
 3637|  31.1k|                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|  31.1k|                            not variant_alternative_exhausted(ctx)) {
 3639|  31.1k|                           ctx.error = error_code::none;
 3640|  31.1k|                        }
 3641|  31.1k|                     }
 3642|  31.1k|                     ++non_const_idx;
 3643|  31.1k|                  }
 3644|  31.1k|               });
 3645|  31.1k|               if (!found_match) {
  ------------------
  |  Branch (3645:20): [True: 2.48k, False: 28.6k]
  ------------------
 3646|  2.48k|                  if constexpr (non_const_count == 1) {
 3647|       |                     // Keep the specific error from the single type we tried
 3648|       |                  }
 3649|       |                  else if (not exhausted && not variant_alternative_exhausted(ctx)) {
 3650|       |                     // Over-nested input is not a failure of the alternative set; keep saying so.
 3651|       |                     ctx.error = error_code::no_matching_variant_type;
 3652|       |                  }
 3653|  2.48k|               }
 3654|       |            }
 3655|       |            else {
 3656|       |               ctx.error = error_code::no_matching_variant_type;
 3657|       |            }
 3658|  31.1k|         }
 3659|  31.1k|      }
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_14is_variant_strEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm0EEEDav:
 3589|  31.1k|               for_each<N>([&]<size_t I>() {
 3590|  31.1k|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 0, False: 31.1k]
  |  Branch (3590:38): [True: 0, False: 31.1k]
  |  Branch (3590:51): [True: 0, False: 31.1k]
  ------------------
 3591|      0|                     return;
 3592|      0|                  }
 3593|  31.1k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  31.1k|               });
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_14is_variant_strEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm1EEEDav:
 3589|  31.1k|               for_each<N>([&]<size_t I>() {
 3590|  31.1k|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 0, False: 31.1k]
  |  Branch (3590:38): [True: 0, False: 31.1k]
  |  Branch (3590:51): [True: 0, False: 31.1k]
  ------------------
 3591|      0|                     return;
 3592|      0|                  }
 3593|  31.1k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  31.1k|               });
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_14is_variant_strEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm2EEEDav:
 3589|  31.1k|               for_each<N>([&]<size_t I>() {
 3590|  31.1k|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 0, False: 31.1k]
  |  Branch (3590:38): [True: 0, False: 31.1k]
  |  Branch (3590:51): [True: 0, False: 31.1k]
  ------------------
 3591|      0|                     return;
 3592|      0|                  }
 3593|  31.1k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|  31.1k|                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|  31.1k|                     auto copy_it{it};
 3596|  31.1k|                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|  31.1k|                     if (!std::holds_alternative<V>(value)) {
  ------------------
  |  Branch (3597:26): [True: 20.1k, False: 10.9k]
  ------------------
 3598|  20.1k|                        value = V{};
 3599|  20.1k|                     }
 3600|  31.1k|                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|  31.1k|                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
  ------------------
  |  Branch (3601:26): [True: 2.64k, False: 28.4k]
  |  Branch (3601:45): [True: 0, False: 2.64k]
  ------------------
 3602|      0|                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|      0|                     }
 3604|  31.1k|                     if (!bool(ctx.error)) {
  ------------------
  |  Branch (3604:26): [True: 28.4k, False: 2.64k]
  ------------------
 3605|  28.4k|                        found_match = true;
 3606|  28.4k|                     }
 3607|  2.64k|                     else if constexpr (not Options.null_terminated) {
 3608|  2.64k|                        constexpr bool is_complete_type =
 3609|  2.64k|                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
  ------------------
  |  Branch (3609:28): [Folded, False: 0]
  |  Branch (3609:40): [Folded, False: 0]
  |  Branch (3609:53): [True: 0, Folded]
  |  Branch (3609:68): [Folded, False: 0]
  |  Branch (3609:89): [Folded, False: 0]
  |  Branch (3609:103): [Folded, False: 0]
  ------------------
 3610|       |
 3611|  2.64k|                        if constexpr (is_complete_type) {
 3612|  2.64k|                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
  ------------------
  |  Branch (3612:32): [True: 156, False: 2.48k]
  |  Branch (3612:72): [True: 156, False: 0]
  |  Branch (3612:88): [True: 156, False: 0]
  ------------------
 3613|    156|                              found_match = true;
 3614|    156|                              ctx.error = error_code::none;
 3615|    156|                           }
 3616|  2.48k|                           else {
 3617|  2.48k|                              it = copy_it;
 3618|  2.48k|                              rewind_depth<Options>(ctx, copy_depth);
 3619|  2.48k|                              if (non_const_idx + 1 < non_const_count && not exhausted &&
  ------------------
  |  Branch (3619:35): [True: 0, False: 2.48k]
  |  Branch (3619:74): [True: 0, False: 0]
  ------------------
 3620|      0|                                  not variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3620:35): [True: 0, False: 0]
  ------------------
 3621|      0|                                 ctx.error = error_code::none;
 3622|      0|                              }
 3623|  2.48k|                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|  31.1k|                     ++non_const_idx;
 3643|  31.1k|                  }
 3644|  31.1k|               });
_ZN3glz5parseILj10EE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj4EEERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEETkNS_10is_contextERNS_7contextERPKcSF_EEvOT0_OT1_OT2_T3_:
   49|  31.1k|      {
   50|       |         if constexpr (const_value_v<T>) {
   51|       |            if constexpr (check_error_on_const_read(Opts)) {
   52|       |               ctx.error = error_code::attempt_const_read;
   53|       |            }
   54|       |            else {
   55|       |               // do not read anything into the const value
   56|       |               skip_value<JSON>::op<Opts>(std::forward<Ctx>(ctx), std::forward<It0>(it), end);
   57|       |            }
   58|       |         }
   59|  31.1k|         else {
   60|  31.1k|            using V = std::remove_cvref_t<T>;
   61|  31.1k|            from<JSON, V>::template op<Opts>(std::forward<T>(value), std::forward<Ctx>(ctx), std::forward<It0>(it),
   62|  31.1k|                                             end);
   63|  31.1k|         }
   64|  31.1k|      }
_ZN3glz4fromILj10ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj4EEERPKcSC_S7_TkNS_10is_contextERNS_7contextEEEvRT2_OT3_OT0_T1_:
  887|  31.1k|      {
  888|       |         if constexpr (check_string_as_number(Opts)) {
  889|       |            auto start = it;
  890|       |            skip_number<Opts>(ctx, it, end);
  891|       |            if (bool(ctx.error)) [[unlikely]] {
  892|       |               return;
  893|       |            }
  894|       |            if (start == it) [[unlikely]] {
  895|       |               ctx.error = error_code::parse_number_failure;
  896|       |               return;
  897|       |            }
  898|       |            value.append(start, size_t(it - start));
  899|       |         }
  900|  31.1k|         else {
  901|  31.1k|            if constexpr (!check_opening_handled(Opts)) {
  902|       |               if constexpr (!check_ws_handled(Opts)) {
  903|       |                  if (skip_ws<Opts>(ctx, it, end)) {
  904|       |                     return;
  905|       |                  }
  906|       |               }
  907|       |
  908|  31.1k|               if (match_invalid_end<'"', Opts>(ctx, it, end)) {
  ------------------
  |  Branch (908:20): [True: 96, False: 31.0k]
  ------------------
  909|     96|                  return;
  910|     96|               }
  911|  31.1k|            }
  912|       |
  913|  31.1k|            if constexpr (not check_raw_string(Opts)) {
  914|  31.1k|               static constexpr auto string_padding_bytes = 8;
  915|       |
  916|       |               // How much buffer has to remain for an eight byte load at the cursor to stay inside
  917|       |               // it. One on a padded input, where the last chunk is free to straddle the end of the
  918|       |               // document, so the byte tails below are unreachable; eight otherwise, which costs the
  919|       |               // final bytes of the buffer their chunked path and nothing else.
  920|  31.1k|               const std::ptrdiff_t scan_min = chunk_min<8>(ctx.padded_input);
  921|       |
  922|  31.1k|               if (size_t(end - it) >= 8) {
  ------------------
  |  Branch (922:20): [True: 29.5k, False: 1.61k]
  ------------------
  923|       |                  // The bound as a pointer, so the loops below spend a compare per chunk rather
  924|       |                  // than a subtract and a compare. Well defined here and nowhere else in this
  925|       |                  // reader: the branch has just established that at least eight bytes remain, and
  926|       |                  // `scan_min` is at most eight.
  927|  29.5k|                  const auto* const chunk_limit = end - scan_min;
  928|       |
  929|  29.5k|                  auto start = it;
  930|  29.5k|                  uint64_t ascii_acc{};
  931|  7.01M|                  while (it <= chunk_limit) {
  ------------------
  |  Branch (931:26): [True: 7.01M, False: 1.12k]
  ------------------
  932|  7.01M|                     uint64_t chunk;
  933|  7.01M|                     std::memcpy(&chunk, it, 8);
  934|       |                     if constexpr (std::endian::native == std::endian::big) {
  935|       |                        chunk = std::byteswap(chunk);
  936|       |                     }
  937|  7.01M|                     ascii_acc |= chunk;
  938|  7.01M|                     const uint64_t test_chars = has_quote(chunk);
  939|  7.01M|                     if (test_chars) {
  ------------------
  |  Branch (939:26): [True: 29.4k, False: 6.98M]
  ------------------
  940|  29.4k|                        it += (countr_zero(test_chars) >> 3);
  941|       |
  942|  29.4k|                        auto* prev = it - 1;
  943|  32.8k|                        while (*prev == '\\') {
  ------------------
  |  Branch (943:32): [True: 3.48k, False: 29.4k]
  ------------------
  944|  3.48k|                           --prev;
  945|  3.48k|                        }
  946|  29.4k|                        if (size_t(it - prev) % 2) {
  ------------------
  |  Branch (946:29): [True: 28.3k, False: 1.03k]
  ------------------
  947|  28.3k|                           goto continue_decode;
  948|  28.3k|                        }
  949|  1.03k|                        ++it; // skip the escaped quote
  950|  1.03k|                     }
  951|  6.98M|                     else {
  952|  6.98M|                        it += 8;
  953|  6.98M|                     }
  954|  7.01M|                  }
  955|       |
  956|  2.68k|                  while (it[-1] == '\\') [[unlikely]] {
  ------------------
  |  Branch (956:26): [True: 1.55k, False: 1.12k]
  ------------------
  957|       |                     // if we ended on an escape character then we need to rewind
  958|       |                     // because we lost our context
  959|  1.55k|                     --it;
  960|  1.55k|                  }
  961|       |
  962|       |                  // The byte-wise tail keeps feeding the accumulator: it has to cover every byte of
  963|       |                  // the string, or a non-ASCII byte reached here would be waved through unvalidated.
  964|  5.34k|                  for (; it < end; ++it) {
  ------------------
  |  Branch (964:26): [True: 5.15k, False: 197]
  ------------------
  965|  5.15k|                     ascii_acc |= uint8_t(*it);
  966|  5.15k|                     if (*it == '"') {
  ------------------
  |  Branch (966:26): [True: 988, False: 4.16k]
  ------------------
  967|    988|                        auto* prev = it - 1;
  968|  1.75k|                        while (*prev == '\\') {
  ------------------
  |  Branch (968:32): [True: 764, False: 988]
  ------------------
  969|    764|                           --prev;
  970|    764|                        }
  971|    988|                        if (size_t(it - prev) % 2) {
  ------------------
  |  Branch (971:29): [True: 928, False: 60]
  ------------------
  972|    928|                           goto continue_decode;
  973|    928|                        }
  974|    988|                     }
  975|  5.15k|                  }
  976|       |
  977|    197|                  ctx.error = error_code::unexpected_end;
  978|    197|                  return;
  979|       |
  980|  29.3k|               continue_decode:
  981|       |
  982|  29.3k|                  if (validate_utf8_span<Opts>(ctx, start, it, ascii_acc)) [[unlikely]] {
  ------------------
  |  Branch (982:23): [True: 323, False: 28.9k]
  ------------------
  983|    323|                     return;
  984|    323|                  }
  985|       |
  986|  28.9k|                  auto n = size_t(it - start);
  987|       |
  988|       |                  // The padding lets the chunked copy below run up to the closing quote. Skip it when it
  989|       |                  // would be the only reason to allocate, as for a string that fits the small string
  990|       |                  // buffer but not with eight bytes to spare.
  991|  28.9k|                  bool pad = true;
  992|  28.9k|                  if constexpr (requires { value.capacity(); }) {
  993|  28.9k|                     const auto capacity = size_t(value.capacity());
  994|  28.9k|                     pad = capacity >= n + string_padding_bytes || capacity < n;
  ------------------
  |  Branch (994:28): [True: 18.1k, False: 10.8k]
  |  Branch (994:68): [True: 6.46k, False: 4.41k]
  ------------------
  995|  28.9k|                  }
  996|  28.9k|                  resize_unfilled(value, pad ? n + string_padding_bytes : n);
  ------------------
  |  Branch (996:42): [True: 24.5k, False: 4.41k]
  ------------------
  997|       |
  998|  28.9k|                  auto* p = value.data();
  999|       |
 1000|       |                  // An error below returns with the tail of `value` still unwritten. Leave the size at
 1001|       |                  // what was actually written rather than at the padded length, which resize_unfilled
 1002|       |                  // did not fill.
 1003|  28.9k|                  auto* const written_begin = p;
 1004|       |
 1005|       |                  // Without the padding, copy a chunk only while eight bytes remain before the quote.
 1006|       |                  // Unescaping never puts the output ahead of the input, so no store lands past the end.
 1007|  28.9k|                  const auto* const copy_end = pad ? it : it - (std::min)(n, size_t(7));
  ------------------
  |  Branch (1007:48): [True: 24.5k, False: 4.41k]
  ------------------
 1008|       |
 1009|       |                  // Copy eight bytes at a time for as long as eight bytes are there to read, then
 1010|       |                  // finish the span below. The chunked form reads past the character it is looking
 1011|       |                  // at, so on an unpadded buffer it has to stop short of the end; splitting it this
 1012|       |                  // way keeps it for the body of every string rather than giving it up whenever the
 1013|       |                  // string happens to finish near the end of the buffer -- which, for a document
 1014|       |                  // that is itself one string, is every string.
 1015|   786k|                  while (start < copy_end && start <= chunk_limit) {
  ------------------
  |  Branch (1015:26): [True: 759k, False: 27.3k]
  |  Branch (1015:46): [True: 758k, False: 334]
  ------------------
 1016|   758k|                     std::memcpy(p, start, 8);
 1017|   758k|                     uint64_t swar;
 1018|   758k|                     std::memcpy(&swar, p, 8);
 1019|       |                     if constexpr (std::endian::native == std::endian::big) {
 1020|       |                        swar = std::byteswap(swar);
 1021|       |                     }
 1022|       |
 1023|   758k|                     constexpr uint64_t lo7_mask = repeat_byte8(0b01111111);
 1024|   758k|                     const uint64_t lo7 = swar & lo7_mask;
 1025|   758k|                     const uint64_t backslash = (lo7 ^ repeat_byte8('\\')) + lo7_mask;
 1026|   758k|                     const uint64_t less_32 = (swar & repeat_byte8(0b01100000)) + lo7_mask;
 1027|   758k|                     uint64_t next = ~((backslash & less_32) | swar);
 1028|       |
 1029|   758k|                     next &= repeat_byte8(0b10000000);
 1030|   758k|                     if (next == 0) {
  ------------------
  |  Branch (1030:26): [True: 748k, False: 9.78k]
  ------------------
 1031|   748k|                        start += 8;
 1032|   748k|                        p += 8;
 1033|   748k|                        continue;
 1034|   748k|                     }
 1035|       |
 1036|  9.78k|                     next = countr_zero(next) >> 3;
 1037|  9.78k|                     start += next;
 1038|  9.78k|                     if (start >= it) {
  ------------------
  |  Branch (1038:26): [True: 633, False: 9.15k]
  ------------------
 1039|    633|                        break;
 1040|    633|                     }
 1041|       |
 1042|  9.15k|                     if ((*start & 0b11100000) == 0) [[unlikely]] {
  ------------------
  |  Branch (1042:26): [True: 276, False: 8.87k]
  ------------------
 1043|    276|                        ctx.error = error_code::syntax_error;
 1044|    276|                        value.resize(size_t(p - written_begin));
 1045|    276|                        return;
 1046|    276|                     }
 1047|  8.87k|                     ++start; // skip the escape
 1048|  8.87k|                     if (*start == 'u') {
  ------------------
  |  Branch (1048:26): [True: 6.51k, False: 2.36k]
  ------------------
 1049|  6.51k|                        ++start;
 1050|  6.51k|                        p += next;
 1051|  6.51k|                        const auto mark = start;
 1052|  6.51k|                        const auto decoded = handle_unicode_code_point(start, p, end);
 1053|  6.51k|                        if (decoded.written == 0) [[unlikely]] {
  ------------------
  |  Branch (1053:29): [True: 370, False: 6.14k]
  ------------------
 1054|    370|                           ctx.error = decoded.truncated ? error_code::unexpected_end
  ------------------
  |  Branch (1054:40): [True: 0, False: 370]
  ------------------
 1055|    370|                                                         : error_code::unicode_escape_conversion_failure;
 1056|    370|                           value.resize(size_t(p - written_begin));
 1057|    370|                           return;
 1058|    370|                        }
 1059|  6.14k|                        n += decoded.written;
 1060|       |                        // escape + u + unicode code points
 1061|  6.14k|                        n -= 2 + uint32_t(start - mark);
 1062|  6.14k|                     }
 1063|  2.36k|                     else {
 1064|  2.36k|                        p += next;
 1065|  2.36k|                        *p = char_unescape_table[uint8_t(*start)];
 1066|  2.36k|                        if (*p == 0) [[unlikely]] {
  ------------------
  |  Branch (1066:29): [True: 61, False: 2.30k]
  ------------------
 1067|     61|                           ctx.error = error_code::invalid_escape;
 1068|     61|                           value.resize(size_t(p - written_begin));
 1069|     61|                           return;
 1070|     61|                        }
 1071|  2.30k|                        ++p;
 1072|  2.30k|                        ++start;
 1073|  2.30k|                        --n;
 1074|  2.30k|                     }
 1075|  8.87k|                  }
 1076|       |
 1077|       |                  // Whatever the chunked copy could not reach. `p` and `start` stay in step across
 1078|       |                  // that loop, so this picks up exactly where it stopped.
 1079|  42.7k|                  while (start < it) {
  ------------------
  |  Branch (1079:26): [True: 14.6k, False: 28.0k]
  ------------------
 1080|  14.6k|                     if ((*start & 0b11100000) == 0) [[unlikely]] {
  ------------------
  |  Branch (1080:26): [True: 32, False: 14.6k]
  ------------------
 1081|     32|                        ctx.error = error_code::syntax_error;
 1082|     32|                        value.resize(size_t(p - written_begin));
 1083|     32|                        return;
 1084|     32|                     }
 1085|  14.6k|                     if (*start == '\\') {
  ------------------
  |  Branch (1085:26): [True: 2.19k, False: 12.4k]
  ------------------
 1086|  2.19k|                        ++start; // skip the escape
 1087|  2.19k|                        if (*start == 'u') {
  ------------------
  |  Branch (1087:29): [True: 1.71k, False: 479]
  ------------------
 1088|  1.71k|                           ++start;
 1089|  1.71k|                           const auto mark = start;
 1090|  1.71k|                           const auto decoded = handle_unicode_code_point(start, p, end);
 1091|  1.71k|                           if (decoded.written == 0) [[unlikely]] {
  ------------------
  |  Branch (1091:32): [True: 160, False: 1.55k]
  ------------------
 1092|    160|                              ctx.error = decoded.truncated ? error_code::unexpected_end
  ------------------
  |  Branch (1092:43): [True: 0, False: 160]
  ------------------
 1093|    160|                                                            : error_code::unicode_escape_conversion_failure;
 1094|    160|                              value.resize(size_t(p - written_begin));
 1095|    160|                              return;
 1096|    160|                           }
 1097|  1.55k|                           n += decoded.written;
 1098|  1.55k|                           n -= 2 + uint32_t(start - mark);
 1099|  1.55k|                        }
 1100|    479|                        else {
 1101|    479|                           *p = char_unescape_table[uint8_t(*start)];
 1102|    479|                           if (*p == 0) [[unlikely]] {
  ------------------
  |  Branch (1102:32): [True: 26, False: 453]
  ------------------
 1103|     26|                              ctx.error = error_code::invalid_escape;
 1104|     26|                              value.resize(size_t(p - written_begin));
 1105|     26|                              return;
 1106|     26|                           }
 1107|    453|                           ++p;
 1108|    453|                           ++start;
 1109|    453|                           --n;
 1110|    453|                        }
 1111|  2.19k|                     }
 1112|  12.4k|                     else {
 1113|  12.4k|                        *p = *start;
 1114|  12.4k|                        ++p;
 1115|  12.4k|                        ++start;
 1116|  12.4k|                     }
 1117|  14.6k|                  }
 1118|       |
 1119|  28.0k|                  value.resize(n);
 1120|  28.0k|                  ++it;
 1121|  28.0k|               }
 1122|  1.61k|               else {
 1123|       |                  // For short strings
 1124|       |
 1125|  1.61k|                  std::array<char, 8> buffer{};
 1126|       |
 1127|  1.61k|                  auto* p = buffer.data();
 1128|  1.61k|                  const auto* const utf8_start = it;
 1129|       |
 1130|  3.75k|                  while (it < end) [[likely]] {
  ------------------
  |  Branch (1130:26): [True: 3.59k, False: 161]
  ------------------
 1131|  3.59k|                     *p = *it;
 1132|  3.59k|                     if (*it == '"') {
  ------------------
  |  Branch (1132:26): [True: 845, False: 2.75k]
  ------------------
 1133|    845|                        if (validate_utf8_span<Opts>(ctx, utf8_start, it)) [[unlikely]] {
  ------------------
  |  Branch (1133:29): [True: 268, False: 577]
  ------------------
 1134|    268|                           return;
 1135|    268|                        }
 1136|    577|                        const size_t n = size_t(p - buffer.data());
 1137|    577|#if __has_cpp_attribute(assume) >= 202207L
 1138|    577|                        [[assume(n <= sizeof(buffer))]];
 1139|    577|#endif
 1140|    577|                        value.assign(buffer.data(), n);
 1141|    577|                        ++it;
 1142|    577|                        if constexpr (not Opts.null_terminated) {
 1143|    577|                           if (it == end) {
  ------------------
  |  Branch (1143:32): [True: 156, False: 421]
  ------------------
 1144|    156|                              ctx.error = error_code::end_reached;
 1145|    156|                              return;
 1146|    156|                           }
 1147|    577|                        }
 1148|    421|                        return;
 1149|    845|                     }
 1150|  2.75k|                     else if (*it == '\\') {
  ------------------
  |  Branch (1150:31): [True: 387, False: 2.36k]
  ------------------
 1151|       |                        // Bounded whatever `null_terminated` says: a document cut off inside an
 1152|       |                        // escape has run out of input, and saying so beats blaming the terminator
 1153|       |                        // the cut exposed -- which is what reading on would find, and would report
 1154|       |                        // as a malformed escape.
 1155|    387|                        ++it; // skip the escape
 1156|    387|                        if (it == end) [[unlikely]] {
  ------------------
  |  Branch (1156:29): [True: 2, False: 385]
  ------------------
 1157|      2|                           ctx.error = error_code::unexpected_end;
 1158|      2|                           return;
 1159|      2|                        }
 1160|    385|                        if (*it == 'u') {
  ------------------
  |  Branch (1160:29): [True: 263, False: 122]
  ------------------
 1161|    263|                           ++it;
 1162|    263|                           if (it == end) [[unlikely]] {
  ------------------
  |  Branch (1162:32): [True: 2, False: 261]
  ------------------
 1163|      2|                              ctx.error = error_code::unexpected_end;
 1164|      2|                              return;
 1165|      2|                           }
 1166|    261|                           const auto decoded = handle_unicode_code_point(it, p, end);
 1167|    261|                           if (decoded.written == 0) [[unlikely]] {
  ------------------
  |  Branch (1167:32): [True: 129, False: 132]
  ------------------
 1168|    129|                              ctx.error = decoded.truncated ? error_code::unexpected_end
  ------------------
  |  Branch (1168:43): [True: 55, False: 74]
  ------------------
 1169|    129|                                                            : error_code::unicode_escape_conversion_failure;
 1170|    129|                              return;
 1171|    129|                           }
 1172|    261|                        }
 1173|    122|                        else {
 1174|    122|                           *p = char_unescape_table[uint8_t(*it)];
 1175|    122|                           if (*p == 0) [[unlikely]] {
  ------------------
  |  Branch (1175:32): [True: 32, False: 90]
  ------------------
 1176|     32|                              ctx.error = error_code::invalid_escape;
 1177|     32|                              return;
 1178|     32|                           }
 1179|     90|                           ++p;
 1180|     90|                           ++it;
 1181|     90|                        }
 1182|    385|                     }
 1183|  2.36k|                     else if ((*it & 0b11100000) == 0) [[unlikely]] {
  ------------------
  |  Branch (1183:31): [True: 445, False: 1.91k]
  ------------------
 1184|    445|                        ctx.error = error_code::syntax_error;
 1185|    445|                        return;
 1186|    445|                     }
 1187|  1.91k|                     else {
 1188|  1.91k|                        ++it;
 1189|  1.91k|                        ++p;
 1190|  1.91k|                     }
 1191|  3.59k|                  }
 1192|       |
 1193|    161|                  ctx.error = error_code::unexpected_end;
 1194|    161|               }
 1195|       |            }
 1196|       |            else {
 1197|       |               // raw_string
 1198|       |               auto start = it;
 1199|       |               skip_string_view(ctx, it, end);
 1200|       |               if (bool(ctx.error)) [[unlikely]]
 1201|       |                  return;
 1202|       |
 1203|       |               if (validate_utf8_span<Opts>(ctx, start, it)) [[unlikely]] {
 1204|       |                  return;
 1205|       |               }
 1206|       |
 1207|       |               value.assign(start, size_t(it - start));
 1208|       |               ++it;
 1209|       |            }
 1210|  31.1k|         }
 1211|  31.1k|      }
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_14is_variant_strEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm3EEEDav:
 3589|  31.1k|               for_each<N>([&]<size_t I>() {
 3590|  31.1k|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 28.6k, False: 2.48k]
  |  Branch (3590:38): [True: 0, False: 2.48k]
  |  Branch (3590:51): [True: 0, False: 2.48k]
  ------------------
 3591|  28.6k|                     return;
 3592|  28.6k|                  }
 3593|  2.48k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  2.48k|               });
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_14is_variant_strEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm4EEEDav:
 3589|  31.1k|               for_each<N>([&]<size_t I>() {
 3590|  31.1k|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 28.6k, False: 2.48k]
  |  Branch (3590:38): [True: 0, False: 2.48k]
  |  Branch (3590:51): [True: 0, False: 2.48k]
  ------------------
 3591|  28.6k|                     return;
 3592|  28.6k|                  }
 3593|  2.48k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  2.48k|               });
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_14is_variant_strEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm5EEEDav:
 3589|  31.1k|               for_each<N>([&]<size_t I>() {
 3590|  31.1k|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 28.6k, False: 2.48k]
  |  Branch (3590:38): [True: 0, False: 2.48k]
  |  Branch (3590:51): [True: 0, False: 2.48k]
  ------------------
 3591|  28.6k|                     return;
 3592|  28.6k|                  }
 3593|  2.48k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  2.48k|               });
_ZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_15is_variant_boolEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_:
 3520|  4.71k|      {
 3521|  4.71k|         constexpr auto category_count = variant_count_v<Variant, Trait>;
 3522|       |
 3523|       |         if constexpr (category_count == 0) {
 3524|       |            ctx.error = error_code::no_matching_variant_type;
 3525|       |         }
 3526|  4.71k|         else {
 3527|  4.71k|            constexpr auto N = std::variant_size_v<Variant>;
 3528|  4.71k|            constexpr auto const_count = variant_filtered_count_v<Variant, Trait, true>;
 3529|  4.71k|            constexpr auto non_const_count = variant_filtered_count_v<Variant, Trait, false>;
 3530|       |
 3531|  4.71k|            bool found_match{};
 3532|       |            // Set when the speculative parsing budget runs out; see charge_speculation. An ambiguous
 3533|       |            // nest re-parses the same subtree per alternative at every level, which is exponential,
 3534|       |            // so the budget stops it and the failure already in hand is reported.
 3535|  4.71k|            bool exhausted{};
 3536|       |
 3537|       |            // First pass: const glaze types in this category
 3538|       |            if constexpr (const_count > 0) {
 3539|       |               for_each<N>([&]<size_t I>() {
 3540|       |                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
 3541|       |                     return;
 3542|       |                  }
 3543|       |                  using V = std::variant_alternative_t<I, Variant>;
 3544|       |                  if constexpr (Trait<V>::value && glaze_const_value_t<V>) {
 3545|       |                     // run time substitute to compare to const value
 3546|       |                     std::remove_const_t<std::remove_pointer_t<std::remove_const_t<meta_wrapper_t<V>>>> substitute{};
 3547|       |                     auto copy_it{it};
 3548|       |                     // A rejected alternative may have bailed out inside a container, which leaves its
 3549|       |                     // nesting level counted (see enter_depth). Rewind the depth with the iterator so
 3550|       |                     // trying N alternatives cannot spend N levels of the recursion budget.
 3551|       |                     const auto copy_depth{ctx.depth};
 3552|       |                     parse<JSON>::op<ws_handled<Options>()>(substitute, ctx, it, end);
 3553|       |                     static constexpr auto const_value{*meta_wrapper_v<V>};
 3554|       |                     if (substitute == const_value) {
 3555|       |                        found_match = true;
 3556|       |                        if (!std::holds_alternative<V>(value)) {
 3557|       |                           value = V{};
 3558|       |                        }
 3559|       |                     }
 3560|       |                     else {
 3561|       |                        // Rejected: charge the bytes it parsed before we rewind. See charge_speculation.
 3562|       |                        if (!charge_speculation(ctx, size_t(it - copy_it))) {
 3563|       |                           exhausted = true;
 3564|       |                        }
 3565|       |                        if constexpr (not Options.null_terminated) {
 3566|       |                           if (ctx.error == error_code::end_reached && not exhausted) {
 3567|       |                              ctx.error = error_code::none;
 3568|       |                           }
 3569|       |                        }
 3570|       |                        it = copy_it;
 3571|       |                        rewind_depth<Options>(ctx, copy_depth);
 3572|       |                     }
 3573|       |                  }
 3574|       |               });
 3575|       |               if (found_match) {
 3576|       |                  return;
 3577|       |               }
 3578|       |            }
 3579|       |
 3580|       |            // Second pass: non-const types in this category
 3581|  4.71k|            if constexpr (non_const_count > 0) {
 3582|       |               // Track position within matching types for "is last" check.
 3583|       |               // We iterate over all variant indices but only process matching types,
 3584|       |               // so we need runtime tracking (vs the old tuple-based approach where
 3585|       |               // the loop index directly corresponded to position in filtered set).
 3586|       |               // This has negligible cost: one increment per matching type.
 3587|  4.71k|               size_t non_const_idx = 0;
 3588|       |
 3589|  4.71k|               for_each<N>([&]<size_t I>() {
 3590|  4.71k|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
 3591|  4.71k|                     return;
 3592|  4.71k|                  }
 3593|  4.71k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|  4.71k|                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|  4.71k|                     auto copy_it{it};
 3596|  4.71k|                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|  4.71k|                     if (!std::holds_alternative<V>(value)) {
 3598|  4.71k|                        value = V{};
 3599|  4.71k|                     }
 3600|  4.71k|                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|  4.71k|                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|  4.71k|                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|  4.71k|                     }
 3604|  4.71k|                     if (!bool(ctx.error)) {
 3605|  4.71k|                        found_match = true;
 3606|  4.71k|                     }
 3607|  4.71k|                     else if constexpr (not Options.null_terminated) {
 3608|  4.71k|                        constexpr bool is_complete_type =
 3609|  4.71k|                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|  4.71k|                        if constexpr (is_complete_type) {
 3612|  4.71k|                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|  4.71k|                              found_match = true;
 3614|  4.71k|                              ctx.error = error_code::none;
 3615|  4.71k|                           }
 3616|  4.71k|                           else {
 3617|  4.71k|                              it = copy_it;
 3618|  4.71k|                              rewind_depth<Options>(ctx, copy_depth);
 3619|  4.71k|                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|  4.71k|                                  not variant_alternative_exhausted(ctx)) {
 3621|  4.71k|                                 ctx.error = error_code::none;
 3622|  4.71k|                              }
 3623|  4.71k|                           }
 3624|  4.71k|                        }
 3625|  4.71k|                        else {
 3626|  4.71k|                           it = copy_it;
 3627|  4.71k|                           rewind_depth<Options>(ctx, copy_depth);
 3628|  4.71k|                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|  4.71k|                               not variant_alternative_exhausted(ctx)) {
 3630|  4.71k|                              ctx.error = error_code::none;
 3631|  4.71k|                           }
 3632|  4.71k|                        }
 3633|  4.71k|                     }
 3634|  4.71k|                     else {
 3635|  4.71k|                        it = copy_it;
 3636|  4.71k|                        rewind_depth<Options>(ctx, copy_depth);
 3637|  4.71k|                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|  4.71k|                            not variant_alternative_exhausted(ctx)) {
 3639|  4.71k|                           ctx.error = error_code::none;
 3640|  4.71k|                        }
 3641|  4.71k|                     }
 3642|  4.71k|                     ++non_const_idx;
 3643|  4.71k|                  }
 3644|  4.71k|               });
 3645|  4.71k|               if (!found_match) {
  ------------------
  |  Branch (3645:20): [True: 429, False: 4.29k]
  ------------------
 3646|    429|                  if constexpr (non_const_count == 1) {
 3647|       |                     // Keep the specific error from the single type we tried
 3648|       |                  }
 3649|       |                  else if (not exhausted && not variant_alternative_exhausted(ctx)) {
 3650|       |                     // Over-nested input is not a failure of the alternative set; keep saying so.
 3651|       |                     ctx.error = error_code::no_matching_variant_type;
 3652|       |                  }
 3653|    429|               }
 3654|       |            }
 3655|       |            else {
 3656|       |               ctx.error = error_code::no_matching_variant_type;
 3657|       |            }
 3658|  4.71k|         }
 3659|  4.71k|      }
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_15is_variant_boolEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm0EEEDav:
 3589|  4.71k|               for_each<N>([&]<size_t I>() {
 3590|  4.71k|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 0, False: 4.71k]
  |  Branch (3590:38): [True: 0, False: 4.71k]
  |  Branch (3590:51): [True: 0, False: 4.71k]
  ------------------
 3591|      0|                     return;
 3592|      0|                  }
 3593|  4.71k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  4.71k|               });
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_15is_variant_boolEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm1EEEDav:
 3589|  4.71k|               for_each<N>([&]<size_t I>() {
 3590|  4.71k|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 0, False: 4.71k]
  |  Branch (3590:38): [True: 0, False: 4.71k]
  |  Branch (3590:51): [True: 0, False: 4.71k]
  ------------------
 3591|      0|                     return;
 3592|      0|                  }
 3593|  4.71k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  4.71k|               });
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_15is_variant_boolEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm2EEEDav:
 3589|  4.71k|               for_each<N>([&]<size_t I>() {
 3590|  4.71k|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 0, False: 4.71k]
  |  Branch (3590:38): [True: 0, False: 4.71k]
  |  Branch (3590:51): [True: 0, False: 4.71k]
  ------------------
 3591|      0|                     return;
 3592|      0|                  }
 3593|  4.71k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  4.71k|               });
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_15is_variant_boolEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm3EEEDav:
 3589|  4.71k|               for_each<N>([&]<size_t I>() {
 3590|  4.71k|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 0, False: 4.71k]
  |  Branch (3590:38): [True: 0, False: 4.71k]
  |  Branch (3590:51): [True: 0, False: 4.71k]
  ------------------
 3591|      0|                     return;
 3592|      0|                  }
 3593|  4.71k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|  4.71k|                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|  4.71k|                     auto copy_it{it};
 3596|  4.71k|                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|  4.71k|                     if (!std::holds_alternative<V>(value)) {
  ------------------
  |  Branch (3597:26): [True: 4.26k, False: 456]
  ------------------
 3598|  4.26k|                        value = V{};
 3599|  4.26k|                     }
 3600|  4.71k|                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|  4.71k|                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
  ------------------
  |  Branch (3601:26): [True: 451, False: 4.26k]
  |  Branch (3601:45): [True: 0, False: 451]
  ------------------
 3602|      0|                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|      0|                     }
 3604|  4.71k|                     if (!bool(ctx.error)) {
  ------------------
  |  Branch (3604:26): [True: 4.26k, False: 451]
  ------------------
 3605|  4.26k|                        found_match = true;
 3606|  4.26k|                     }
 3607|    451|                     else if constexpr (not Options.null_terminated) {
 3608|    451|                        constexpr bool is_complete_type =
 3609|    451|                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
  ------------------
  |  Branch (3609:28): [Folded, False: 0]
  |  Branch (3609:40): [True: 0, Folded]
  |  Branch (3609:53): [Folded, False: 0]
  |  Branch (3609:68): [Folded, False: 0]
  |  Branch (3609:89): [Folded, False: 0]
  |  Branch (3609:103): [Folded, False: 0]
  ------------------
 3610|       |
 3611|    451|                        if constexpr (is_complete_type) {
 3612|    451|                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
  ------------------
  |  Branch (3612:32): [True: 22, False: 429]
  |  Branch (3612:72): [True: 22, False: 0]
  |  Branch (3612:88): [True: 22, False: 0]
  ------------------
 3613|     22|                              found_match = true;
 3614|     22|                              ctx.error = error_code::none;
 3615|     22|                           }
 3616|    429|                           else {
 3617|    429|                              it = copy_it;
 3618|    429|                              rewind_depth<Options>(ctx, copy_depth);
 3619|    429|                              if (non_const_idx + 1 < non_const_count && not exhausted &&
  ------------------
  |  Branch (3619:35): [True: 0, False: 429]
  |  Branch (3619:74): [True: 0, False: 0]
  ------------------
 3620|      0|                                  not variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3620:35): [True: 0, False: 0]
  ------------------
 3621|      0|                                 ctx.error = error_code::none;
 3622|      0|                              }
 3623|    429|                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|  4.71k|                     ++non_const_idx;
 3643|  4.71k|                  }
 3644|  4.71k|               });
_ZN3glz5parseILj10EE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj4EEERbTkNS_10is_contextERNS_7contextERPKcS8_EEvOT0_OT1_OT2_T3_:
   49|  4.71k|      {
   50|       |         if constexpr (const_value_v<T>) {
   51|       |            if constexpr (check_error_on_const_read(Opts)) {
   52|       |               ctx.error = error_code::attempt_const_read;
   53|       |            }
   54|       |            else {
   55|       |               // do not read anything into the const value
   56|       |               skip_value<JSON>::op<Opts>(std::forward<Ctx>(ctx), std::forward<It0>(it), end);
   57|       |            }
   58|       |         }
   59|  4.71k|         else {
   60|  4.71k|            using V = std::remove_cvref_t<T>;
   61|  4.71k|            from<JSON, V>::template op<Opts>(std::forward<T>(value), std::forward<Ctx>(ctx), std::forward<It0>(it),
   62|  4.71k|                                             end);
   63|  4.71k|         }
   64|  4.71k|      }
_ZN3glz4fromILj10EbE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj4EEETkNS_6bool_tERbTkNS_10is_contextERNS_7contextERPKcS8_EEvOT0_OT1_OT2_T3_:
  667|  4.71k|      {
  668|       |         if constexpr (check_quoted_num(Opts)) {
  669|       |            if (skip_ws<Opts>(ctx, it, end)) {
  670|       |               return;
  671|       |            }
  672|       |            if (match_invalid_end<'"', Opts>(ctx, it, end)) {
  673|       |               return;
  674|       |            }
  675|       |         }
  676|       |
  677|       |         if constexpr (!check_ws_handled(Opts)) {
  678|       |            if (skip_ws<Opts>(ctx, it, end)) {
  679|       |               return;
  680|       |            }
  681|       |         }
  682|       |
  683|       |         if constexpr (check_bools_as_numbers(Opts)) {
  684|       |            if (*it == '1') {
  685|       |               value = true;
  686|       |               ++it;
  687|       |            }
  688|       |            else if (*it == '0') {
  689|       |               value = false;
  690|       |               ++it;
  691|       |            }
  692|       |            else {
  693|       |               ctx.error = error_code::syntax_error;
  694|       |               return;
  695|       |            }
  696|       |         }
  697|  4.71k|         else {
  698|  4.71k|            if (end - it < 4) [[unlikely]] {
  ------------------
  |  Branch (698:17): [True: 122, False: 4.59k]
  ------------------
  699|    122|               ctx.error = error_code::expected_true_or_false;
  700|    122|               return;
  701|    122|            }
  702|       |
  703|  4.59k|            uint32_t c;
  704|  4.59k|            static constexpr uint32_t u_true = 0b01100101'01110101'01110010'01110100;
  705|  4.59k|            static constexpr uint32_t u_fals = 0b01110011'01101100'01100001'01100110;
  706|  4.59k|            std::memcpy(&c, it, 4);
  707|       |            if constexpr (std::endian::native == std::endian::big) {
  708|       |               c = std::byteswap(c);
  709|       |            }
  710|  4.59k|            it += 4;
  711|  4.59k|            if (c == u_true) {
  ------------------
  |  Branch (711:17): [True: 2.37k, False: 2.22k]
  ------------------
  712|  2.37k|               value = true;
  713|  2.37k|            }
  714|  2.22k|            else if (it == end) [[unlikely]] {
  ------------------
  |  Branch (714:22): [True: 109, False: 2.11k]
  ------------------
  715|    109|               ctx.error = error_code::unexpected_end;
  716|    109|               return;
  717|    109|            }
  718|  2.11k|            else {
  719|  2.11k|               if (c == u_fals && (*it == 'e')) [[likely]] {
  ------------------
  |  Branch (719:20): [True: 1.94k, False: 166]
  |  Branch (719:35): [True: 1.91k, False: 32]
  ------------------
  720|  1.91k|                  value = false;
  721|  1.91k|                  ++it;
  722|  1.91k|               }
  723|    198|               else [[unlikely]] {
  724|    198|                  ctx.error = error_code::expected_true_or_false;
  725|    198|                  return;
  726|    198|               }
  727|  2.11k|            }
  728|  4.59k|         }
  729|       |
  730|       |         if constexpr (check_quoted_num(Opts)) {
  731|       |            if constexpr (not Opts.null_terminated) {
  732|       |               if (it == end) [[unlikely]] {
  733|       |                  ctx.error = error_code::unexpected_end;
  734|       |                  return;
  735|       |               }
  736|       |            }
  737|       |            if (match<'"'>(ctx, it)) {
  738|       |               return;
  739|       |            }
  740|       |            if constexpr (not Opts.null_terminated) {
  741|       |               if (it == end) {
  742|       |                  ctx.error = error_code::end_reached;
  743|       |                  return;
  744|       |               }
  745|       |            }
  746|       |         }
  747|  4.71k|         else {
  748|  4.71k|            if constexpr (not Opts.null_terminated) {
  749|  4.71k|               if (it == end) {
  ------------------
  |  Branch (749:20): [True: 22, False: 4.69k]
  ------------------
  750|     22|                  ctx.error = error_code::end_reached;
  751|     22|                  return;
  752|     22|               }
  753|  4.71k|            }
  754|  4.71k|         }
  755|  4.71k|      }
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_15is_variant_boolEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm4EEEDav:
 3589|  4.71k|               for_each<N>([&]<size_t I>() {
 3590|  4.71k|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 4.29k, False: 429]
  |  Branch (3590:38): [True: 0, False: 429]
  |  Branch (3590:51): [True: 0, False: 429]
  ------------------
 3591|  4.29k|                     return;
 3592|  4.29k|                  }
 3593|    429|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|    429|               });
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_15is_variant_boolEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm5EEEDav:
 3589|  4.71k|               for_each<N>([&]<size_t I>() {
 3590|  4.71k|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 4.29k, False: 429]
  |  Branch (3590:38): [True: 0, False: 429]
  |  Branch (3590:51): [True: 0, False: 429]
  ------------------
 3591|  4.29k|                     return;
 3592|  4.29k|                  }
 3593|    429|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|    429|               });
_ZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_14is_variant_numEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_:
 3520|  6.47M|      {
 3521|  6.47M|         constexpr auto category_count = variant_count_v<Variant, Trait>;
 3522|       |
 3523|       |         if constexpr (category_count == 0) {
 3524|       |            ctx.error = error_code::no_matching_variant_type;
 3525|       |         }
 3526|  6.47M|         else {
 3527|  6.47M|            constexpr auto N = std::variant_size_v<Variant>;
 3528|  6.47M|            constexpr auto const_count = variant_filtered_count_v<Variant, Trait, true>;
 3529|  6.47M|            constexpr auto non_const_count = variant_filtered_count_v<Variant, Trait, false>;
 3530|       |
 3531|  6.47M|            bool found_match{};
 3532|       |            // Set when the speculative parsing budget runs out; see charge_speculation. An ambiguous
 3533|       |            // nest re-parses the same subtree per alternative at every level, which is exponential,
 3534|       |            // so the budget stops it and the failure already in hand is reported.
 3535|  6.47M|            bool exhausted{};
 3536|       |
 3537|       |            // First pass: const glaze types in this category
 3538|       |            if constexpr (const_count > 0) {
 3539|       |               for_each<N>([&]<size_t I>() {
 3540|       |                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
 3541|       |                     return;
 3542|       |                  }
 3543|       |                  using V = std::variant_alternative_t<I, Variant>;
 3544|       |                  if constexpr (Trait<V>::value && glaze_const_value_t<V>) {
 3545|       |                     // run time substitute to compare to const value
 3546|       |                     std::remove_const_t<std::remove_pointer_t<std::remove_const_t<meta_wrapper_t<V>>>> substitute{};
 3547|       |                     auto copy_it{it};
 3548|       |                     // A rejected alternative may have bailed out inside a container, which leaves its
 3549|       |                     // nesting level counted (see enter_depth). Rewind the depth with the iterator so
 3550|       |                     // trying N alternatives cannot spend N levels of the recursion budget.
 3551|       |                     const auto copy_depth{ctx.depth};
 3552|       |                     parse<JSON>::op<ws_handled<Options>()>(substitute, ctx, it, end);
 3553|       |                     static constexpr auto const_value{*meta_wrapper_v<V>};
 3554|       |                     if (substitute == const_value) {
 3555|       |                        found_match = true;
 3556|       |                        if (!std::holds_alternative<V>(value)) {
 3557|       |                           value = V{};
 3558|       |                        }
 3559|       |                     }
 3560|       |                     else {
 3561|       |                        // Rejected: charge the bytes it parsed before we rewind. See charge_speculation.
 3562|       |                        if (!charge_speculation(ctx, size_t(it - copy_it))) {
 3563|       |                           exhausted = true;
 3564|       |                        }
 3565|       |                        if constexpr (not Options.null_terminated) {
 3566|       |                           if (ctx.error == error_code::end_reached && not exhausted) {
 3567|       |                              ctx.error = error_code::none;
 3568|       |                           }
 3569|       |                        }
 3570|       |                        it = copy_it;
 3571|       |                        rewind_depth<Options>(ctx, copy_depth);
 3572|       |                     }
 3573|       |                  }
 3574|       |               });
 3575|       |               if (found_match) {
 3576|       |                  return;
 3577|       |               }
 3578|       |            }
 3579|       |
 3580|       |            // Second pass: non-const types in this category
 3581|  6.47M|            if constexpr (non_const_count > 0) {
 3582|       |               // Track position within matching types for "is last" check.
 3583|       |               // We iterate over all variant indices but only process matching types,
 3584|       |               // so we need runtime tracking (vs the old tuple-based approach where
 3585|       |               // the loop index directly corresponded to position in filtered set).
 3586|       |               // This has negligible cost: one increment per matching type.
 3587|  6.47M|               size_t non_const_idx = 0;
 3588|       |
 3589|  6.47M|               for_each<N>([&]<size_t I>() {
 3590|  6.47M|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
 3591|  6.47M|                     return;
 3592|  6.47M|                  }
 3593|  6.47M|                  using V = std::variant_alternative_t<I, Variant>;
 3594|  6.47M|                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|  6.47M|                     auto copy_it{it};
 3596|  6.47M|                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|  6.47M|                     if (!std::holds_alternative<V>(value)) {
 3598|  6.47M|                        value = V{};
 3599|  6.47M|                     }
 3600|  6.47M|                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|  6.47M|                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|  6.47M|                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|  6.47M|                     }
 3604|  6.47M|                     if (!bool(ctx.error)) {
 3605|  6.47M|                        found_match = true;
 3606|  6.47M|                     }
 3607|  6.47M|                     else if constexpr (not Options.null_terminated) {
 3608|  6.47M|                        constexpr bool is_complete_type =
 3609|  6.47M|                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|  6.47M|                        if constexpr (is_complete_type) {
 3612|  6.47M|                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|  6.47M|                              found_match = true;
 3614|  6.47M|                              ctx.error = error_code::none;
 3615|  6.47M|                           }
 3616|  6.47M|                           else {
 3617|  6.47M|                              it = copy_it;
 3618|  6.47M|                              rewind_depth<Options>(ctx, copy_depth);
 3619|  6.47M|                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|  6.47M|                                  not variant_alternative_exhausted(ctx)) {
 3621|  6.47M|                                 ctx.error = error_code::none;
 3622|  6.47M|                              }
 3623|  6.47M|                           }
 3624|  6.47M|                        }
 3625|  6.47M|                        else {
 3626|  6.47M|                           it = copy_it;
 3627|  6.47M|                           rewind_depth<Options>(ctx, copy_depth);
 3628|  6.47M|                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|  6.47M|                               not variant_alternative_exhausted(ctx)) {
 3630|  6.47M|                              ctx.error = error_code::none;
 3631|  6.47M|                           }
 3632|  6.47M|                        }
 3633|  6.47M|                     }
 3634|  6.47M|                     else {
 3635|  6.47M|                        it = copy_it;
 3636|  6.47M|                        rewind_depth<Options>(ctx, copy_depth);
 3637|  6.47M|                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|  6.47M|                            not variant_alternative_exhausted(ctx)) {
 3639|  6.47M|                           ctx.error = error_code::none;
 3640|  6.47M|                        }
 3641|  6.47M|                     }
 3642|  6.47M|                     ++non_const_idx;
 3643|  6.47M|                  }
 3644|  6.47M|               });
 3645|  6.47M|               if (!found_match) {
  ------------------
  |  Branch (3645:20): [True: 4.26k, False: 6.47M]
  ------------------
 3646|  4.26k|                  if constexpr (non_const_count == 1) {
 3647|       |                     // Keep the specific error from the single type we tried
 3648|       |                  }
 3649|       |                  else if (not exhausted && not variant_alternative_exhausted(ctx)) {
 3650|       |                     // Over-nested input is not a failure of the alternative set; keep saying so.
 3651|       |                     ctx.error = error_code::no_matching_variant_type;
 3652|       |                  }
 3653|  4.26k|               }
 3654|       |            }
 3655|       |            else {
 3656|       |               ctx.error = error_code::no_matching_variant_type;
 3657|       |            }
 3658|  6.47M|         }
 3659|  6.47M|      }
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_14is_variant_numEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm0EEEDav:
 3589|  6.47M|               for_each<N>([&]<size_t I>() {
 3590|  6.47M|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 0, False: 6.47M]
  |  Branch (3590:38): [True: 0, False: 6.47M]
  |  Branch (3590:51): [True: 0, False: 6.47M]
  ------------------
 3591|      0|                     return;
 3592|      0|                  }
 3593|  6.47M|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  6.47M|               });
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_14is_variant_numEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm1EEEDav:
 3589|  6.47M|               for_each<N>([&]<size_t I>() {
 3590|  6.47M|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 0, False: 6.47M]
  |  Branch (3590:38): [True: 0, False: 6.47M]
  |  Branch (3590:51): [True: 0, False: 6.47M]
  ------------------
 3591|      0|                     return;
 3592|      0|                  }
 3593|  6.47M|                  using V = std::variant_alternative_t<I, Variant>;
 3594|  6.47M|                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|  6.47M|                     auto copy_it{it};
 3596|  6.47M|                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|  6.47M|                     if (!std::holds_alternative<V>(value)) {
  ------------------
  |  Branch (3597:26): [True: 5.90M, False: 572k]
  ------------------
 3598|  5.90M|                        value = V{};
 3599|  5.90M|                     }
 3600|  6.47M|                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|  6.47M|                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
  ------------------
  |  Branch (3601:26): [True: 7.39k, False: 6.47M]
  |  Branch (3601:45): [True: 0, False: 7.39k]
  ------------------
 3602|      0|                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|      0|                     }
 3604|  6.47M|                     if (!bool(ctx.error)) {
  ------------------
  |  Branch (3604:26): [True: 6.47M, False: 7.39k]
  ------------------
 3605|  6.47M|                        found_match = true;
 3606|  6.47M|                     }
 3607|  7.39k|                     else if constexpr (not Options.null_terminated) {
 3608|  7.39k|                        constexpr bool is_complete_type =
 3609|  7.39k|                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
  ------------------
  |  Branch (3609:28): [True: 7.39k, Folded]
  |  Branch (3609:40): [Folded, False: 0]
  |  Branch (3609:53): [Folded, False: 0]
  |  Branch (3609:68): [Folded, False: 0]
  |  Branch (3609:89): [Folded, False: 0]
  |  Branch (3609:103): [Folded, False: 0]
  ------------------
 3610|       |
 3611|  7.39k|                        if constexpr (is_complete_type) {
 3612|  7.39k|                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
  ------------------
  |  Branch (3612:32): [True: 3.13k, False: 4.26k]
  |  Branch (3612:72): [True: 3.13k, False: 0]
  |  Branch (3612:88): [True: 3.13k, False: 0]
  ------------------
 3613|  3.13k|                              found_match = true;
 3614|  3.13k|                              ctx.error = error_code::none;
 3615|  3.13k|                           }
 3616|  4.26k|                           else {
 3617|  4.26k|                              it = copy_it;
 3618|  4.26k|                              rewind_depth<Options>(ctx, copy_depth);
 3619|  4.26k|                              if (non_const_idx + 1 < non_const_count && not exhausted &&
  ------------------
  |  Branch (3619:35): [True: 0, False: 4.26k]
  |  Branch (3619:74): [True: 0, False: 0]
  ------------------
 3620|      0|                                  not variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3620:35): [True: 0, False: 0]
  ------------------
 3621|      0|                                 ctx.error = error_code::none;
 3622|      0|                              }
 3623|  4.26k|                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|  6.47M|                     ++non_const_idx;
 3643|  6.47M|                  }
 3644|  6.47M|               });
_ZN3glz5parseILj10EE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj4EEERdTkNS_10is_contextERNS_7contextERPKcS8_EEvOT0_OT1_OT2_T3_:
   49|  6.47M|      {
   50|       |         if constexpr (const_value_v<T>) {
   51|       |            if constexpr (check_error_on_const_read(Opts)) {
   52|       |               ctx.error = error_code::attempt_const_read;
   53|       |            }
   54|       |            else {
   55|       |               // do not read anything into the const value
   56|       |               skip_value<JSON>::op<Opts>(std::forward<Ctx>(ctx), std::forward<It0>(it), end);
   57|       |            }
   58|       |         }
   59|  6.47M|         else {
   60|  6.47M|            using V = std::remove_cvref_t<T>;
   61|  6.47M|            from<JSON, V>::template op<Opts>(std::forward<T>(value), std::forward<Ctx>(ctx), std::forward<It0>(it),
   62|  6.47M|                                             end);
   63|  6.47M|         }
   64|  6.47M|      }
_ZN3glz4fromILj10EdE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj4EEERPKcRdTkNS_10is_contextERNS_7contextES5_EEvOT1_OT2_OT0_T3_:
  763|  6.47M|      {
  764|       |         if constexpr (check_quoted_num(Opts)) {
  765|       |            if (skip_ws<Opts>(ctx, it, end)) {
  766|       |               return;
  767|       |            }
  768|       |            if (match_invalid_end<'"', Opts>(ctx, it, end)) {
  769|       |               return;
  770|       |            }
  771|       |         }
  772|       |
  773|       |         if constexpr (!check_ws_handled(Opts)) {
  774|       |            if (skip_ws<Opts>(ctx, it, end)) {
  775|       |               return;
  776|       |            }
  777|       |         }
  778|       |
  779|  6.47M|         using V = std::decay_t<decltype(value)>;
  780|       |         if constexpr (int_t<V>) {
  781|       |            static_assert(sizeof(*it) == sizeof(char));
  782|       |
  783|       |            if constexpr (Opts.null_terminated) {
  784|       |               if (not glz::atoi(value, it)) [[unlikely]] {
  785|       |                  ctx.error = error_code::parse_number_failure;
  786|       |                  return;
  787|       |               }
  788|       |            }
  789|       |            else {
  790|       |               if (not glz::atoi(value, it, end)) [[unlikely]] {
  791|       |                  ctx.error = error_code::parse_number_failure;
  792|       |                  return;
  793|       |               }
  794|       |            }
  795|       |         }
  796|  6.47M|         else {
  797|       |// float128_t requires std::from_chars for floating-point, unavailable on older Apple platforms (iOS < 16.3)
  798|  6.47M|#if !defined(_LIBCPP_VERSION) || defined(_LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT)
  799|       |            if constexpr (is_float128<V>) {
  800|       |               auto [ptr, ec] = std::from_chars(it, end, value);
  801|       |               if (ec != std::errc()) {
  802|       |                  ctx.error = error_code::parse_number_failure;
  803|       |                  return;
  804|       |               }
  805|       |               it = ptr;
  806|       |            }
  807|       |            else
  808|       |#endif
  809|  6.47M|            {
  810|       |               if constexpr (std::is_volatile_v<std::remove_reference_t<decltype(value)>>) {
  811|       |                  // Hardware may interact with value changes, so we parse into a temporary and assign in one
  812|       |                  // place
  813|       |                  V temp;
  814|       |                  if constexpr (is_size_optimized(Opts)) {
  815|       |                     auto [ptr, ec] = simple_float::from_chars<Opts.null_terminated>(it, end, temp);
  816|       |                     if (ec != std::errc{}) [[unlikely]] {
  817|       |                        ctx.error = error_code::parse_number_failure;
  818|       |                        return;
  819|       |                     }
  820|       |                     it = ptr;
  821|       |                  }
  822|       |                  else {
  823|       |                     auto [ptr, ec] = glz::from_chars<Opts.null_terminated>(it, end, temp);
  824|       |                     if (ec != std::errc()) [[unlikely]] {
  825|       |                        ctx.error = error_code::parse_number_failure;
  826|       |                        return;
  827|       |                     }
  828|       |                     it = ptr;
  829|       |                  }
  830|       |                  value = temp;
  831|       |               }
  832|  6.47M|               else {
  833|       |                  if constexpr (is_size_optimized(Opts)) {
  834|       |                     auto [ptr, ec] = simple_float::from_chars<Opts.null_terminated>(it, end, value);
  835|       |                     if (ec != std::errc{}) [[unlikely]] {
  836|       |                        ctx.error = error_code::parse_number_failure;
  837|       |                        return;
  838|       |                     }
  839|       |                     it = ptr;
  840|       |                  }
  841|  6.47M|                  else {
  842|  6.47M|                     auto [ptr, ec] = glz::from_chars<Opts.null_terminated>(it, end, value);
  843|  6.47M|                     if (ec != std::errc()) [[unlikely]] {
  ------------------
  |  Branch (843:26): [True: 4.26k, False: 6.47M]
  ------------------
  844|  4.26k|                        ctx.error = error_code::parse_number_failure;
  845|  4.26k|                        return;
  846|  4.26k|                     }
  847|  6.47M|                     it = ptr;
  848|  6.47M|                  }
  849|  6.47M|               }
  850|  6.47M|            }
  851|  6.47M|         }
  852|       |
  853|       |         if constexpr (check_quoted_num(Opts)) {
  854|       |            if constexpr (not Opts.null_terminated) {
  855|       |               if (it == end) [[unlikely]] {
  856|       |                  ctx.error = error_code::unexpected_end;
  857|       |                  return;
  858|       |               }
  859|       |            }
  860|       |            if (match<'"'>(ctx, it)) {
  861|       |               return;
  862|       |            }
  863|       |            if constexpr (not Opts.null_terminated) {
  864|       |               if (it == end) {
  865|       |                  ctx.error = error_code::end_reached;
  866|       |                  return;
  867|       |               }
  868|       |            }
  869|       |         }
  870|  6.47M|         else {
  871|  6.47M|            if constexpr (not Opts.null_terminated) {
  872|  6.47M|               if (it == end) {
  ------------------
  |  Branch (872:20): [True: 3.13k, False: 6.47M]
  ------------------
  873|  3.13k|                  ctx.error = error_code::end_reached;
  874|  3.13k|                  return;
  875|  3.13k|               }
  876|  6.47M|            }
  877|  6.47M|         }
  878|  6.47M|      }
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_14is_variant_numEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm2EEEDav:
 3589|  6.47M|               for_each<N>([&]<size_t I>() {
 3590|  6.47M|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 6.47M, False: 4.26k]
  |  Branch (3590:38): [True: 0, False: 4.26k]
  |  Branch (3590:51): [True: 0, False: 4.26k]
  ------------------
 3591|  6.47M|                     return;
 3592|  6.47M|                  }
 3593|  4.26k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  4.26k|               });
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_14is_variant_numEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm3EEEDav:
 3589|  6.47M|               for_each<N>([&]<size_t I>() {
 3590|  6.47M|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 6.47M, False: 4.26k]
  |  Branch (3590:38): [True: 0, False: 4.26k]
  |  Branch (3590:51): [True: 0, False: 4.26k]
  ------------------
 3591|  6.47M|                     return;
 3592|  6.47M|                  }
 3593|  4.26k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  4.26k|               });
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_14is_variant_numEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm4EEEDav:
 3589|  6.47M|               for_each<N>([&]<size_t I>() {
 3590|  6.47M|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 6.47M, False: 4.26k]
  |  Branch (3590:38): [True: 0, False: 4.26k]
  |  Branch (3590:51): [True: 0, False: 4.26k]
  ------------------
 3591|  6.47M|                     return;
 3592|  6.47M|                  }
 3593|  4.26k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  4.26k|               });
_ZZN3glz28process_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_14is_variant_numEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_7contextERPKcSQ_EEvOT0_OT1_OT2_T3_ENKUlTnmvE_clILm5EEEDav:
 3589|  6.47M|               for_each<N>([&]<size_t I>() {
 3590|  6.47M|                  if (found_match || exhausted || variant_alternative_exhausted(ctx)) {
  ------------------
  |  Branch (3590:23): [True: 6.47M, False: 4.26k]
  |  Branch (3590:38): [True: 0, False: 4.26k]
  |  Branch (3590:51): [True: 0, False: 4.26k]
  ------------------
 3591|  6.47M|                     return;
 3592|  6.47M|                  }
 3593|  4.26k|                  using V = std::variant_alternative_t<I, Variant>;
 3594|       |                  if constexpr (Trait<V>::value && !glaze_const_value_t<V>) {
 3595|       |                     auto copy_it{it};
 3596|       |                     const auto copy_depth{ctx.depth}; // rewound with `it`; see the note above
 3597|       |                     if (!std::holds_alternative<V>(value)) {
 3598|       |                        value = V{};
 3599|       |                     }
 3600|       |                     parse<JSON>::op<ws_handled<Options>()>(std::get<V>(value), ctx, it, end);
 3601|       |                     if (bool(ctx.error) && !charge_speculation(ctx, size_t(it - copy_it))) {
 3602|       |                        exhausted = true; // only rejected attempts are charged; see charge_speculation
 3603|       |                     }
 3604|       |                     if (!bool(ctx.error)) {
 3605|       |                        found_match = true;
 3606|       |                     }
 3607|       |                     else if constexpr (not Options.null_terminated) {
 3608|       |                        constexpr bool is_complete_type =
 3609|       |                           num_t<V> || bool_t<V> || string_t<V> || std::is_enum_v<V> || tuple_t<V> || is_std_tuple<V>;
 3610|       |
 3611|       |                        if constexpr (is_complete_type) {
 3612|       |                           if (ctx.error == error_code::end_reached && it > copy_it && not speculation_exhausted(ctx)) {
 3613|       |                              found_match = true;
 3614|       |                              ctx.error = error_code::none;
 3615|       |                           }
 3616|       |                           else {
 3617|       |                              it = copy_it;
 3618|       |                              rewind_depth<Options>(ctx, copy_depth);
 3619|       |                              if (non_const_idx + 1 < non_const_count && not exhausted &&
 3620|       |                                  not variant_alternative_exhausted(ctx)) {
 3621|       |                                 ctx.error = error_code::none;
 3622|       |                              }
 3623|       |                           }
 3624|       |                        }
 3625|       |                        else {
 3626|       |                           it = copy_it;
 3627|       |                           rewind_depth<Options>(ctx, copy_depth);
 3628|       |                           if (non_const_idx + 1 < non_const_count && not exhausted &&
 3629|       |                               not variant_alternative_exhausted(ctx)) {
 3630|       |                              ctx.error = error_code::none;
 3631|       |                           }
 3632|       |                        }
 3633|       |                     }
 3634|       |                     else {
 3635|       |                        it = copy_it;
 3636|       |                        rewind_depth<Options>(ctx, copy_depth);
 3637|       |                        if (non_const_idx + 1 < non_const_count && not exhausted &&
 3638|       |                            not variant_alternative_exhausted(ctx)) {
 3639|       |                           ctx.error = error_code::none;
 3640|       |                        }
 3641|       |                     }
 3642|       |                     ++non_const_idx;
 3643|       |                  }
 3644|  4.26k|               });
_ZN3glz9read_jsonITkNS_14read_supportedIL_ZNS_4JSONEEEENS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_9is_bufferERKNSt3__16vectorIcNS6_9allocatorIcEEEEQnt18is_input_streamingIu20__remove_reference_tIT0_EEEENS_9error_ctxERT_OSD_:
 5056|  10.5k|   {
 5057|  10.5k|      context ctx{};
 5058|  10.5k|      return read<opts{}>(value, std::forward<Buffer>(buffer), ctx);
 5059|  10.5k|   }
_ZN3glz9read_jsonITkNS_14read_supportedIL_ZNS_4JSONEEEENS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_9is_bufferERNSt3__16vectorIcNS6_9allocatorIcEEEEQnt18is_input_streamingIu20__remove_reference_tIT0_EEEENS_9error_ctxERT_OSC_:
 5056|  10.5k|   {
 5057|  10.5k|      context ctx{};
 5058|  10.5k|      return read<opts{}>(value, std::forward<Buffer>(buffer), ctx);
 5059|  10.5k|   }

_ZN3glz9has_quoteEm:
   86|  20.3M|   {
   87|  20.3M|      return has_zero(chunk ^ repeat_byte8('"'));
   88|  20.3M|   }
_ZN3glz8has_zeroEm:
   81|  20.3M|   {
   82|  20.3M|      return (((chunk - 0x0101010101010101ull) & ~chunk) & 0x8080808080808080ull);
   83|  20.3M|   }
_ZN3glz11countr_zeroEm:
   29|  3.37M|   {
   30|       |#ifdef _MSC_VER
   31|       |      return std::countr_zero(x);
   32|       |#else
   33|  3.37M|#if __has_builtin(__builtin_ctzll)
   34|  3.37M|      return __builtin_ctzll(x);
   35|       |#else
   36|       |      return std::countr_zero(x);
   37|       |#endif
   38|  3.37M|#endif
   39|  3.37M|   }

_ZN3glz10comparitorIL_ZZNS_5matchITnNS_14string_literalEXtlNS2_ILm5EEEtlA5_cLc110ELc117ELc108ELc108EEEETnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEETkNS_10is_contextERNS_7contextERPKcS9_EEvOT1_OT2_T3_E1SELm4EcEEbPKSB_:
  245|  3.39k|   {
  246|       |      // pack() builds values in little-endian order (byte 0 in LSB position).
  247|       |      // On big-endian systems, memcpy produces native (big-endian) values,
  248|       |      // so we need to byteswap to match the packed representation.
  249|       |      if constexpr (N == 8) {
  250|       |         static constexpr auto packed = pack<Str, 8>();
  251|       |         uint64_t in;
  252|       |         std::memcpy(&in, other, 8);
  253|       |         if constexpr (std::endian::native == std::endian::big) {
  254|       |            in = std::byteswap(in);
  255|       |         }
  256|       |         return (in == packed);
  257|       |      }
  258|       |      else if constexpr (N == 7) {
  259|       |         static constexpr auto packed = pack_buffered<Str, 8>();
  260|       |         uint64_t in{};
  261|       |         std::memcpy(&in, other, 7);
  262|       |         if constexpr (std::endian::native == std::endian::big) {
  263|       |            in = std::byteswap(in);
  264|       |         }
  265|       |         return (in == packed);
  266|       |      }
  267|       |      else if constexpr (N == 6) {
  268|       |         static constexpr auto packed = pack_buffered<Str, 8>();
  269|       |         uint64_t in{};
  270|       |         std::memcpy(&in, other, 6);
  271|       |         if constexpr (std::endian::native == std::endian::big) {
  272|       |            in = std::byteswap(in);
  273|       |         }
  274|       |         return (in == packed);
  275|       |      }
  276|       |      else if constexpr (N == 5) {
  277|       |         static constexpr auto packed = pack<Str, 4>();
  278|       |         uint32_t in;
  279|       |         std::memcpy(&in, other, 4);
  280|       |         if constexpr (std::endian::native == std::endian::big) {
  281|       |            in = std::byteswap(in);
  282|       |         }
  283|       |         return (in == packed) & (Str[4] == other[4]);
  284|       |      }
  285|  3.39k|      else if constexpr (N == 4) {
  286|  3.39k|         static constexpr auto packed = pack<Str, 4>();
  287|  3.39k|         uint32_t in;
  288|  3.39k|         std::memcpy(&in, other, 4);
  289|       |         if constexpr (std::endian::native == std::endian::big) {
  290|       |            in = std::byteswap(in);
  291|       |         }
  292|  3.39k|         return (in == packed);
  293|       |      }
  294|       |      else if constexpr (N == 3) {
  295|       |         static constexpr auto packed = pack<Str, 2>();
  296|       |         uint16_t in;
  297|       |         std::memcpy(&in, other, 2);
  298|       |         if constexpr (std::endian::native == std::endian::big) {
  299|       |            in = std::byteswap(in);
  300|       |         }
  301|       |         return (in == packed) & (Str[2] == other[2]);
  302|       |      }
  303|       |      else if constexpr (N == 2) {
  304|       |         static constexpr auto packed = pack<Str, 2>();
  305|       |         uint16_t in;
  306|       |         std::memcpy(&in, other, 2);
  307|       |         if constexpr (std::endian::native == std::endian::big) {
  308|       |            in = std::byteswap(in);
  309|       |         }
  310|       |         return (in == packed);
  311|       |      }
  312|       |      else if constexpr (N == 1) {
  313|       |         return Str[0] == other[0];
  314|       |      }
  315|       |      else if constexpr (N == 0) {
  316|       |         return true;
  317|       |      }
  318|       |      else {
  319|       |         // Clang and GCC optimize this extremely well for constexpr std::string_view
  320|       |         // Packing data can create more binary on GCC
  321|       |         // The other cases probably aren't needed as compiler explorer shows them optimized equally well as memcmp
  322|       |         return 0 == std::memcmp(Str.data(), other, N);
  323|       |      }
  324|  3.39k|   }

_ZN3glz10fast_float4spanIKcEC2Ev:
  438|  12.9M|  constexpr span() : ptr(nullptr), length(0) {}
_ZN3glz10fast_float10is_integerIcEEbT_:
 1481|  8.01k|fastfloat_really_inline constexpr bool is_integer(UC c) noexcept {
 1482|  8.01k|  return !(c > UC('9') || c < UC('0'));
  ------------------
  |  Branch (1482:12): [True: 3, False: 8.01k]
  |  Branch (1482:27): [True: 58, False: 7.95k]
  ------------------
 1483|  8.01k|}
_ZN3glz10fast_float11digit_valueIcEEmT_:
 1489|  33.4M|fastfloat_really_inline constexpr uint64_t digit_value(UC c) noexcept {
 1490|  33.4M|  return uint64_t(uint8_t(c) - uint8_t('0'));
 1491|  33.4M|}
_ZN3glz10fast_float4spanIKcEC2EPS2_m:
  436|  6.52M|  constexpr span(T const *_ptr, size_t _length) : ptr(_ptr), length(_length) {}
_ZN3glz10fast_float26loop_parse_if_eight_digitsERPKcS2_Rm:
 1679|  47.7k|                           uint64_t &i) {
 1680|       |  // optimizes better than parse_if_eight_digits_unrolled() for UC = char.
 1681|  5.74M|  while ((std::distance(p, pend) >= 8) &&
  ------------------
  |  Branch (1681:10): [True: 5.74M, False: 3.24k]
  ------------------
 1682|  5.74M|         is_made_of_eight_digits_fast(read8_to_u64(p))) {
  ------------------
  |  Branch (1682:10): [True: 5.69M, False: 44.5k]
  ------------------
 1683|  5.69M|    i = i * 100000000 +
 1684|  5.69M|        parse_eight_digits_unrolled(read8_to_u64(
 1685|  5.69M|            p)); // in rare cases, this will overflow, but that's ok
 1686|  5.69M|    p += 8;
 1687|  5.69M|  }
 1688|  47.7k|}
_ZN3glz10fast_float28is_made_of_eight_digits_fastEm:
 1597|  5.74M|is_made_of_eight_digits_fast(uint64_t val) noexcept {
 1598|  5.74M|  return !((((val + 0x4646464646464646) | (val - 0x3030303030303030)) &
 1599|  5.74M|            0x8080808080808080));
 1600|  5.74M|}
_ZN3glz10fast_float12read8_to_u64IcEEmPKT_:
 1503|  13.3M|read8_to_u64(UC const *chars) {
 1504|  13.3M|  if (cpp20_and_in_constexpr() || !std::is_same<UC, char>::value) {
  ------------------
  |  Branch (1504:7): [Folded, False: 0]
  |  Branch (1504:35): [Folded, False: 0]
  ------------------
 1505|      0|    uint64_t val = 0;
 1506|      0|    for (int i = 0; i < 8; ++i) {
  ------------------
  |  Branch (1506:21): [True: 0, False: 0]
  ------------------
 1507|      0|      val |= uint64_t(uint8_t(*chars)) << (i * 8);
 1508|      0|      ++chars;
 1509|      0|    }
 1510|      0|    return val;
 1511|      0|  }
 1512|  13.3M|  uint64_t val;
 1513|  13.3M|  ::memcpy(&val, chars, sizeof(uint64_t));
 1514|       |#if GLZ_FASTFLOAT_IS_BIG_ENDIAN == 1
 1515|       |  // Need to read as-if the number was in little-endian order.
 1516|       |  val = byteswap(val);
 1517|       |#endif
 1518|  13.3M|  return val;
 1519|  13.3M|}
_ZN3glz10fast_float27parse_eight_digits_unrolledEm:
 1575|  7.62M|parse_eight_digits_unrolled(uint64_t val) {
 1576|  7.62M|  uint64_t const mask = 0x000000FF000000FF;
 1577|  7.62M|  uint64_t const mul1 = 0x000F424000000064; // 100 + (1000000ULL << 32)
 1578|  7.62M|  uint64_t const mul2 = 0x0000271000000001; // 1 + (10000ULL << 32)
 1579|  7.62M|  val -= 0x3030303030303030;
 1580|  7.62M|  val = (val * 10) + (val >> 8); // val = (val * 2561) >> 8;
 1581|  7.62M|  val = (((val & mask) * mul1) + (((val >> 16) & mask) * mul2)) >> 32;
 1582|  7.62M|  return uint32_t(val);
 1583|  7.62M|}
_ZNK3glz10fast_float4spanIKcE3lenEv:
  440|   185k|  constexpr size_t len() const noexcept { return length; }
_ZN3glz10fast_float19from_chars_advancedIdcEENS0_19from_chars_result_tIT0_EERNS0_22parsed_number_string_tIS3_EERT_:
 4249|  6.47M|from_chars_advanced(parsed_number_string_t<UC> &pns, T &value) noexcept {
 4250|       |
 4251|  6.47M|  static_assert(is_supported_float_type<T>::value,
 4252|  6.47M|                "only some floating-point types are supported");
 4253|  6.47M|  static_assert(is_supported_char_type<UC>::value,
 4254|  6.47M|                "only char, wchar_t, char16_t and char32_t are supported");
 4255|       |
 4256|  6.47M|  from_chars_result_t<UC> answer;
 4257|       |
 4258|  6.47M|  answer.ec = std::errc(); // be optimistic
 4259|  6.47M|  answer.ptr = pns.lastmatch;
 4260|       |  // The implementation of the Clinger's fast path is convoluted because
 4261|       |  // we want round-to-nearest in all cases, irrespective of the rounding mode
 4262|       |  // selected on the thread.
 4263|       |  // We proceed optimistically, assuming that detail::rounds_to_nearest()
 4264|       |  // returns true.
 4265|  6.47M|  if (binary_format<T>::min_exponent_fast_path() <= pns.exponent &&
  ------------------
  |  Branch (4265:7): [True: 6.46M, False: 13.1k]
  ------------------
 4266|  6.46M|      pns.exponent <= binary_format<T>::max_exponent_fast_path() &&
  ------------------
  |  Branch (4266:7): [True: 6.42M, False: 33.0k]
  ------------------
 4267|  6.42M|      !pns.too_many_digits) {
  ------------------
  |  Branch (4267:7): [True: 6.39M, False: 35.8k]
  ------------------
 4268|       |    // Unfortunately, the conventional Clinger's fast path is only possible
 4269|       |    // when the system rounds to the nearest float.
 4270|       |    //
 4271|       |    // We expect the next branch to almost always be selected.
 4272|       |    // We could check it first (before the previous branch), but
 4273|       |    // there might be performance advantages at having the check
 4274|       |    // be last.
 4275|  6.39M|    if (!cpp20_and_in_constexpr() && detail::rounds_to_nearest()) {
  ------------------
  |  Branch (4275:9): [True: 6.39M, Folded]
  |  Branch (4275:38): [True: 6.39M, False: 0]
  ------------------
 4276|       |      // We have that fegetround() == FE_TONEAREST.
 4277|       |      // Next is Clinger's fast path.
 4278|  6.39M|      if (pns.mantissa <= binary_format<T>::max_mantissa_fast_path()) {
  ------------------
  |  Branch (4278:11): [True: 6.38M, False: 3.21k]
  ------------------
 4279|  6.38M|        value = T(pns.mantissa);
 4280|  6.38M|        if (pns.exponent < 0) {
  ------------------
  |  Branch (4280:13): [True: 6.31k, False: 6.38M]
  ------------------
 4281|  6.31k|          value = value / binary_format<T>::exact_power_of_ten(-pns.exponent);
 4282|  6.38M|        } else {
 4283|  6.38M|          value = value * binary_format<T>::exact_power_of_ten(pns.exponent);
 4284|  6.38M|        }
 4285|  6.38M|        if (pns.negative) {
  ------------------
  |  Branch (4285:13): [True: 4.48k, False: 6.38M]
  ------------------
 4286|  4.48k|          value = -value;
 4287|  4.48k|        }
 4288|  6.38M|        return answer;
 4289|  6.38M|      }
 4290|  6.39M|    } else {
 4291|       |      // We do not have that fegetround() == FE_TONEAREST.
 4292|       |      // Next is a modified Clinger's fast path, inspired by Jakub Jelínek's
 4293|       |      // proposal
 4294|      0|      if (pns.exponent >= 0 &&
  ------------------
  |  Branch (4294:11): [True: 0, False: 0]
  ------------------
 4295|      0|          pns.mantissa <=
  ------------------
  |  Branch (4295:11): [True: 0, False: 0]
  ------------------
 4296|      0|              binary_format<T>::max_mantissa_fast_path(pns.exponent)) {
 4297|      0|#if defined(__clang__) || defined(GLZ_FASTFLOAT_32BIT)
 4298|       |        // Clang may map 0 to -0.0 when fegetround() == FE_DOWNWARD
 4299|      0|        if (pns.mantissa == 0) {
  ------------------
  |  Branch (4299:13): [True: 0, False: 0]
  ------------------
 4300|      0|          value = pns.negative ? T(-0.) : T(0.);
  ------------------
  |  Branch (4300:19): [True: 0, False: 0]
  ------------------
 4301|      0|          return answer;
 4302|      0|        }
 4303|      0|#endif
 4304|      0|        value = T(pns.mantissa) *
 4305|      0|                binary_format<T>::exact_power_of_ten(pns.exponent);
 4306|      0|        if (pns.negative) {
  ------------------
  |  Branch (4306:13): [True: 0, False: 0]
  ------------------
 4307|      0|          value = -value;
 4308|      0|        }
 4309|      0|        return answer;
 4310|      0|      }
 4311|      0|    }
 4312|  6.39M|  }
 4313|  85.2k|  adjusted_mantissa am =
 4314|  85.2k|      compute_float<binary_format<T>>(pns.exponent, pns.mantissa);
 4315|  85.2k|  if (pns.too_many_digits && am.power2 >= 0) {
  ------------------
  |  Branch (4315:7): [True: 69.0k, False: 16.2k]
  |  Branch (4315:30): [True: 69.0k, False: 0]
  ------------------
 4316|  69.0k|    if (am != compute_float<binary_format<T>>(pns.exponent, pns.mantissa + 1)) {
  ------------------
  |  Branch (4316:9): [True: 58.7k, False: 10.3k]
  ------------------
 4317|  58.7k|      am = compute_error<binary_format<T>>(pns.exponent, pns.mantissa);
 4318|  58.7k|    }
 4319|  69.0k|  }
 4320|       |  // If we called compute_float<binary_format<T>>(pns.exponent, pns.mantissa)
 4321|       |  // and we have an invalid power (am.power2 < 0), then we need to go the long
 4322|       |  // way around again. This is very uncommon.
 4323|  85.2k|  if (am.power2 < 0) {
  ------------------
  |  Branch (4323:7): [True: 58.7k, False: 26.5k]
  ------------------
 4324|  58.7k|    am = digit_comp<T>(pns, am);
 4325|  58.7k|  }
 4326|  85.2k|  to_float(pns.negative, am, value);
 4327|       |  // Test for over/underflow.
 4328|  85.2k|  if ((pns.mantissa != 0 && am.mantissa == 0 && am.power2 == 0) ||
  ------------------
  |  Branch (4328:8): [True: 84.1k, False: 1.14k]
  |  Branch (4328:29): [True: 6.72k, False: 77.4k]
  |  Branch (4328:49): [True: 303, False: 6.42k]
  ------------------
 4329|  84.9k|      am.power2 == binary_format<T>::infinite_power()) {
  ------------------
  |  Branch (4329:7): [True: 396, False: 84.5k]
  ------------------
 4330|    699|    answer.ec = std::errc::result_out_of_range;
 4331|    699|  }
 4332|  85.2k|  return answer;
 4333|  6.47M|}
_ZN3glz10fast_float13binary_formatIdE22min_exponent_fast_pathEv:
  695|  6.47M|inline constexpr int binary_format<double>::min_exponent_fast_path() {
  696|       |#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
  697|       |  return 0;
  698|       |#else
  699|  6.47M|  return -22;
  700|  6.47M|#endif
  701|  6.47M|}
_ZN3glz10fast_float13binary_formatIdE22max_exponent_fast_pathEv:
  767|  6.46M|inline constexpr int binary_format<double>::max_exponent_fast_path() {
  768|  6.46M|  return 22;
  769|  6.46M|}
_ZN3glz10fast_float6detail17rounds_to_nearestEv:
 4129|  6.39M|fastfloat_really_inline bool rounds_to_nearest() noexcept {
 4130|       |  // https://lemire.me/blog/2020/06/26/gcc-not-nearest/
 4131|       |#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
 4132|       |  return false;
 4133|       |#endif
 4134|       |  // See
 4135|       |  // A fast function to check your floating-point rounding mode
 4136|       |  // https://lemire.me/blog/2022/11/16/a-fast-function-to-check-your-floating-point-rounding-mode/
 4137|       |  //
 4138|       |  // This function is meant to be equivalent to :
 4139|       |  // prior: #include <cfenv>
 4140|       |  //  return fegetround() == FE_TONEAREST;
 4141|       |  // However, it is expected to be much faster than the fegetround()
 4142|       |  // function call.
 4143|       |  //
 4144|       |  // The volatile keyword prevents the compiler from computing the function
 4145|       |  // at compile-time.
 4146|       |  // There might be other ways to prevent compile-time optimizations (e.g.,
 4147|       |  // asm). The value does not need to be std::numeric_limits<float>::min(), any
 4148|       |  // small value so that 1 + x should round to 1 would do (after accounting for
 4149|       |  // excess precision, as in 387 instructions).
 4150|  6.39M|  static float volatile fmin = (std::numeric_limits<float>::min)();
 4151|  6.39M|  float fmini = fmin; // we copy it so that it gets loaded at most once.
 4152|       |//
 4153|       |// Explanation:
 4154|       |// Only when fegetround() == FE_TONEAREST do we have that
 4155|       |// fmin + 1.0f == 1.0f - fmin.
 4156|       |//
 4157|       |// FE_UPWARD:
 4158|       |//  fmin + 1.0f > 1
 4159|       |//  1.0f - fmin == 1
 4160|       |//
 4161|       |// FE_DOWNWARD or  FE_TOWARDZERO:
 4162|       |//  fmin + 1.0f == 1
 4163|       |//  1.0f - fmin < 1
 4164|       |//
 4165|       |// Note: This may fail to be accurate if fast-math has been
 4166|       |// enabled, as rounding conventions may not apply.
 4167|       |#ifdef GLZ_FASTFLOAT_VISUAL_STUDIO
 4168|       |#pragma warning(push)
 4169|       |//  todo: is there a VS warning?
 4170|       |//  see
 4171|       |//  https://stackoverflow.com/questions/46079446/is-there-a-warning-for-floating-point-equality-checking-in-visual-studio-2013
 4172|       |#elif defined(__clang__)
 4173|       |#pragma clang diagnostic push
 4174|  6.39M|#pragma clang diagnostic ignored "-Wfloat-equal"
 4175|       |#elif defined(__GNUC__)
 4176|       |#pragma GCC diagnostic push
 4177|       |#pragma GCC diagnostic ignored "-Wfloat-equal"
 4178|       |#endif
 4179|  6.39M|  return (fmini + 1.0f == 1.0f - fmini);
 4180|       |#ifdef GLZ_FASTFLOAT_VISUAL_STUDIO
 4181|       |#pragma warning(pop)
 4182|       |#elif defined(__clang__)
 4183|       |#pragma clang diagnostic pop
 4184|       |#elif defined(__GNUC__)
 4185|       |#pragma GCC diagnostic pop
 4186|       |#endif
 4187|  6.39M|}
_ZN3glz10fast_float13binary_formatIdE22max_mantissa_fast_pathEv:
  777|  6.39M|inline constexpr uint64_t binary_format<double>::max_mantissa_fast_path() {
  778|  6.39M|  return uint64_t(2) << mantissa_explicit_bits();
  779|  6.39M|}
_ZN3glz10fast_float13binary_formatIdE22mantissa_explicit_bitsEv:
  713|  7.41M|inline constexpr int binary_format<double>::mantissa_explicit_bits() {
  714|  7.41M|  return 52;
  715|  7.41M|}
_ZN3glz10fast_float13binary_formatIdE18exact_power_of_tenEl:
 1057|  6.38M|binary_format<double>::exact_power_of_ten(int64_t power) {
 1058|       |  // Work around clang bug https://godbolt.org/z/zedh7rrhc
 1059|  6.38M|  return (void)powers_of_ten[0], powers_of_ten[power];
 1060|  6.38M|}
_ZN3glz10fast_float13compute_floatINS0_13binary_formatIdEEEENS0_17adjusted_mantissaElm:
 2852|   154k|compute_float(int64_t q, uint64_t w) noexcept {
 2853|   154k|  adjusted_mantissa answer;
 2854|   154k|  if ((w == 0) || (q < binary::smallest_power_of_ten())) {
  ------------------
  |  Branch (2854:7): [True: 1.14k, False: 153k]
  |  Branch (2854:19): [True: 345, False: 152k]
  ------------------
 2855|  1.48k|    answer.power2 = 0;
 2856|  1.48k|    answer.mantissa = 0;
 2857|       |    // result should be zero
 2858|  1.48k|    return answer;
 2859|  1.48k|  }
 2860|   152k|  if (q > binary::largest_power_of_ten()) {
  ------------------
  |  Branch (2860:7): [True: 468, False: 152k]
  ------------------
 2861|       |    // we want to get infinity:
 2862|    468|    answer.power2 = binary::infinite_power();
 2863|    468|    answer.mantissa = 0;
 2864|    468|    return answer;
 2865|    468|  }
 2866|       |  // At this point in time q is in [powers::smallest_power_of_five,
 2867|       |  // powers::largest_power_of_five].
 2868|       |
 2869|       |  // We want the most significant bit of i to be 1. Shift if needed.
 2870|   152k|  int lz = leading_zeroes(w);
 2871|   152k|  w <<= lz;
 2872|       |
 2873|       |  // The required precision is binary::mantissa_explicit_bits() + 3 because
 2874|       |  // 1. We need the implicit bit
 2875|       |  // 2. We need an extra bit for rounding purposes
 2876|       |  // 3. We might lose a bit due to the "upperbit" routine (result too small,
 2877|       |  // requiring a shift)
 2878|       |
 2879|   152k|  value128 product =
 2880|   152k|      compute_product_approximation<binary::mantissa_explicit_bits() + 3>(q, w);
 2881|       |  // The computed 'product' is always sufficient.
 2882|       |  // Mathematical proof:
 2883|       |  // Noble Mushtak and Daniel Lemire, Fast Number Parsing Without Fallback (to
 2884|       |  // appear) See script/mushtak_lemire.py
 2885|       |
 2886|       |  // The "compute_product_approximation" function can be slightly slower than a
 2887|       |  // branchless approach: value128 product = compute_product(q, w); but in
 2888|       |  // practice, we can win big with the compute_product_approximation if its
 2889|       |  // additional branch is easily predicted. Which is best is data specific.
 2890|   152k|  int upperbit = int(product.high >> 63);
 2891|   152k|  int shift = upperbit + 64 - binary::mantissa_explicit_bits() - 3;
 2892|       |
 2893|   152k|  answer.mantissa = product.high >> shift;
 2894|       |
 2895|   152k|  answer.power2 = int32_t(detail::power(int32_t(q)) + upperbit - lz -
 2896|   152k|                          binary::minimum_exponent());
 2897|   152k|  if (answer.power2 <= 0) { // we have a subnormal?
  ------------------
  |  Branch (2897:7): [True: 12.6k, False: 139k]
  ------------------
 2898|       |    // Here have that answer.power2 <= 0 so -answer.power2 >= 0
 2899|  12.6k|    if (-answer.power2 + 1 >=
  ------------------
  |  Branch (2899:9): [True: 9, False: 12.6k]
  ------------------
 2900|  12.6k|        64) { // if we have more than 64 bits below the minimum exponent, you
 2901|       |              // have a zero for sure.
 2902|      9|      answer.power2 = 0;
 2903|      9|      answer.mantissa = 0;
 2904|       |      // result should be zero
 2905|      9|      return answer;
 2906|      9|    }
 2907|       |    // next line is safe because -answer.power2 + 1 < 64
 2908|  12.6k|    answer.mantissa >>= -answer.power2 + 1;
 2909|       |    // Thankfully, we can't have both "round-to-even" and subnormals because
 2910|       |    // "round-to-even" only occurs for powers close to 0 in the 32-bit and
 2911|       |    // and 64-bit case (with no more than 19 digits).
 2912|  12.6k|    answer.mantissa += (answer.mantissa & 1); // round up
 2913|  12.6k|    answer.mantissa >>= 1;
 2914|       |    // There is a weird scenario where we don't have a subnormal but just.
 2915|       |    // Suppose we start with 2.2250738585072013e-308, we end up
 2916|       |    // with 0x3fffffffffffff x 2^-1023-53 which is technically subnormal
 2917|       |    // whereas 0x40000000000000 x 2^-1023-53  is normal. Now, we need to round
 2918|       |    // up 0x3fffffffffffff x 2^-1023-53  and once we do, we are no longer
 2919|       |    // subnormal, but we can only know this after rounding.
 2920|       |    // So we only declare a subnormal if we are smaller than the threshold.
 2921|  12.6k|    answer.power2 =
 2922|  12.6k|        (answer.mantissa < (uint64_t(1) << binary::mantissa_explicit_bits()))
  ------------------
  |  Branch (2922:9): [True: 12.5k, False: 9]
  ------------------
 2923|  12.6k|            ? 0
 2924|  12.6k|            : 1;
 2925|  12.6k|    return answer;
 2926|  12.6k|  }
 2927|       |
 2928|       |  // usually, we round *up*, but if we fall right in between and and we have an
 2929|       |  // even basis, we need to round down
 2930|       |  // We are only concerned with the cases where 5**q fits in single 64-bit word.
 2931|   139k|  if ((product.low <= 1) && (q >= binary::min_exponent_round_to_even()) &&
  ------------------
  |  Branch (2931:7): [True: 32.3k, False: 107k]
  |  Branch (2931:29): [True: 29.5k, False: 2.81k]
  ------------------
 2932|  29.5k|      (q <= binary::max_exponent_round_to_even()) &&
  ------------------
  |  Branch (2932:7): [True: 27.2k, False: 2.30k]
  ------------------
 2933|  27.2k|      ((answer.mantissa & 3) == 1)) { // we may fall between two floats!
  ------------------
  |  Branch (2933:7): [True: 13.1k, False: 14.0k]
  ------------------
 2934|       |    // To be in-between two floats we need that in doing
 2935|       |    //   answer.mantissa = product.high >> (upperbit + 64 -
 2936|       |    //   binary::mantissa_explicit_bits() - 3);
 2937|       |    // ... we dropped out only zeroes. But if this happened, then we can go
 2938|       |    // back!!!
 2939|  13.1k|    if ((answer.mantissa << shift) == product.high) {
  ------------------
  |  Branch (2939:9): [True: 9.36k, False: 3.80k]
  ------------------
 2940|  9.36k|      answer.mantissa &= ~uint64_t(1); // flip it so that we do not round up
 2941|  9.36k|    }
 2942|  13.1k|  }
 2943|       |
 2944|   139k|  answer.mantissa += (answer.mantissa & 1); // round up
 2945|   139k|  answer.mantissa >>= 1;
 2946|   139k|  if (answer.mantissa >= (uint64_t(2) << binary::mantissa_explicit_bits())) {
  ------------------
  |  Branch (2946:7): [True: 5.88k, False: 133k]
  ------------------
 2947|  5.88k|    answer.mantissa = (uint64_t(1) << binary::mantissa_explicit_bits());
 2948|  5.88k|    answer.power2++; // undo previous addition
 2949|  5.88k|  }
 2950|       |
 2951|   139k|  answer.mantissa &= ~(uint64_t(1) << binary::mantissa_explicit_bits());
 2952|   139k|  if (answer.power2 >= binary::infinite_power()) { // infinity
  ------------------
  |  Branch (2952:7): [True: 27, False: 139k]
  ------------------
 2953|     27|    answer.power2 = binary::infinite_power();
 2954|     27|    answer.mantissa = 0;
 2955|     27|  }
 2956|   139k|  return answer;
 2957|   152k|}
_ZN3glz10fast_float17adjusted_mantissaC2Ev:
  568|   271k|  adjusted_mantissa() = default;
_ZN3glz10fast_float13binary_formatIdE21smallest_power_of_tenEv:
 1077|   153k|inline constexpr int binary_format<double>::smallest_power_of_ten() {
 1078|   153k|  return -342;
 1079|   153k|}
_ZN3glz10fast_float13binary_formatIdE20largest_power_of_tenEv:
 1068|   152k|template <> inline constexpr int binary_format<double>::largest_power_of_ten() {
 1069|   152k|  return 308;
 1070|   152k|}
_ZN3glz10fast_float14leading_zeroesEm:
  488|   245k|leading_zeroes(uint64_t input_num) {
  489|   245k|  assert(input_num > 0);
  ------------------
  |  Branch (489:3): [True: 245k, False: 0]
  ------------------
  490|   245k|  if (cpp20_and_in_constexpr()) {
  ------------------
  |  Branch (490:7): [Folded, False: 245k]
  ------------------
  491|      0|    return leading_zeroes_generic(input_num);
  492|      0|  }
  493|       |#ifdef GLZ_FASTFLOAT_VISUAL_STUDIO
  494|       |#if defined(_M_X64) || defined(_M_ARM64)
  495|       |  unsigned long leading_zero = 0;
  496|       |  // Search the mask data from most significant bit (MSB)
  497|       |  // to least significant bit (LSB) for a set bit (1).
  498|       |  _BitScanReverse64(&leading_zero, input_num);
  499|       |  return (int)(63 - leading_zero);
  500|       |#else
  501|       |  return leading_zeroes_generic(input_num);
  502|       |#endif
  503|       |#else
  504|   245k|  return __builtin_clzll(input_num);
  505|   245k|#endif
  506|   245k|}
_ZN3glz10fast_float29compute_product_approximationILi55EEENS0_8value128Elm:
 2771|   211k|compute_product_approximation(int64_t q, uint64_t w) {
 2772|   211k|  int const index = 2 * int(q - powers::smallest_power_of_five);
 2773|       |  // For small values of q, e.g., q in [0,27], the answer is always exact
 2774|       |  // because The line value128 firstproduct = full_multiplication(w,
 2775|       |  // power_of_five_128[index]); gives the exact answer.
 2776|   211k|  value128 firstproduct =
 2777|   211k|      full_multiplication(w, powers::power_of_five_128[index]);
 2778|   211k|  static_assert((bit_precision >= 0) && (bit_precision <= 64),
 2779|   211k|                " precision should  be in (0,64]");
 2780|   211k|  constexpr uint64_t precision_mask =
 2781|   211k|      (bit_precision < 64) ? (uint64_t(0xFFFFFFFFFFFFFFFF) >> bit_precision)
  ------------------
  |  Branch (2781:7): [True: 0, Folded]
  ------------------
 2782|   211k|                           : uint64_t(0xFFFFFFFFFFFFFFFF);
 2783|   211k|  if ((firstproduct.high & precision_mask) ==
  ------------------
  |  Branch (2783:7): [True: 47.0k, False: 164k]
  ------------------
 2784|   211k|      precision_mask) { // could further guard with  (lower + w < lower)
 2785|       |    // regarding the second product, we only need secondproduct.high, but our
 2786|       |    // expectation is that the compiler will optimize this extra work away if
 2787|       |    // needed.
 2788|  47.0k|    value128 secondproduct =
 2789|  47.0k|        full_multiplication(w, powers::power_of_five_128[index + 1]);
 2790|  47.0k|    firstproduct.low += secondproduct.high;
 2791|  47.0k|    if (secondproduct.high > firstproduct.low) {
  ------------------
  |  Branch (2791:9): [True: 11.4k, False: 35.6k]
  ------------------
 2792|  11.4k|      firstproduct.high++;
 2793|  11.4k|    }
 2794|  47.0k|  }
 2795|   211k|  return firstproduct;
 2796|   211k|}
_ZN3glz10fast_float19full_multiplicationEmm:
  540|   258k|full_multiplication(uint64_t a, uint64_t b) {
  541|   258k|  if (cpp20_and_in_constexpr()) {
  ------------------
  |  Branch (541:7): [Folded, False: 258k]
  ------------------
  542|      0|    value128 answer;
  543|      0|    answer.low = umul128_generic(a, b, &answer.high);
  544|      0|    return answer;
  545|      0|  }
  546|   258k|  value128 answer;
  547|       |#if defined(_M_ARM64) && !defined(__MINGW32__)
  548|       |  // ARM64 has native support for 64-bit multiplications, no need to emulate
  549|       |  // But MinGW on ARM64 doesn't have native support for 64-bit multiplications
  550|       |  answer.high = __umulh(a, b);
  551|       |  answer.low = a * b;
  552|       |#elif defined(GLZ_FASTFLOAT_32BIT) ||                                              \
  553|       |    (defined(_WIN64) && !defined(__clang__) && !defined(_M_ARM64))
  554|       |  answer.low = _umul128(a, b, &answer.high); // _umul128 not available on ARM64
  555|       |#elif defined(GLZ_FASTFLOAT_64BIT) && defined(__SIZEOF_INT128__)
  556|       |  __uint128_t r = ((__uint128_t)a) * b;
  557|   258k|  answer.low = uint64_t(r);
  558|   258k|  answer.high = uint64_t(r >> 64);
  559|       |#else
  560|       |  answer.low = umul128_generic(a, b, &answer.high);
  561|       |#endif
  562|   258k|  return answer;
  563|   258k|}
_ZN3glz10fast_float8value128C2Ev:
  454|   258k|  constexpr value128() : low(0), high(0) {}
_ZN3glz10fast_float6detail5powerEi:
 2814|   211k|constexpr fastfloat_really_inline int32_t power(int32_t q) noexcept {
 2815|   211k|  return (((152170 + 65536) * q) >> 16) + 63;
 2816|   211k|}
_ZN3glz10fast_float13binary_formatIdE16minimum_exponentEv:
  742|   269k|template <> inline constexpr int binary_format<double>::minimum_exponent() {
  743|   269k|  return -1023;
  744|   269k|}
_ZN3glz10fast_float13binary_formatIdE26min_exponent_round_to_evenEv:
  733|  32.3k|inline constexpr int binary_format<double>::min_exponent_round_to_even() {
  734|  32.3k|  return -4;
  735|  32.3k|}
_ZN3glz10fast_float13binary_formatIdE26max_exponent_round_to_evenEv:
  723|  29.5k|inline constexpr int binary_format<double>::max_exponent_round_to_even() {
  724|  29.5k|  return 23;
  725|  29.5k|}
_ZNK3glz10fast_float17adjusted_mantissaneERKS1_:
  574|  69.0k|  constexpr bool operator!=(adjusted_mantissa const &o) const {
  575|  69.0k|    return mantissa != o.mantissa || power2 != o.power2;
  ------------------
  |  Branch (575:12): [True: 58.7k, False: 10.3k]
  |  Branch (575:38): [True: 0, False: 10.3k]
  ------------------
  576|  69.0k|  }
_ZN3glz10fast_float13compute_errorINS0_13binary_formatIdEEEENS0_17adjusted_mantissaElm:
 2837|  58.7k|compute_error(int64_t q, uint64_t w) noexcept {
 2838|  58.7k|  int lz = leading_zeroes(w);
 2839|  58.7k|  w <<= lz;
 2840|  58.7k|  value128 product =
 2841|  58.7k|      compute_product_approximation<binary::mantissa_explicit_bits() + 3>(q, w);
 2842|  58.7k|  return compute_error_scaled<binary>(q, product.high, lz);
 2843|  58.7k|}
_ZN3glz10fast_float20compute_error_scaledINS0_13binary_formatIdEEEENS0_17adjusted_mantissaElmi:
 2823|  58.7k|compute_error_scaled(int64_t q, uint64_t w, int lz) noexcept {
 2824|  58.7k|  int hilz = int(w >> 63) ^ 1;
 2825|  58.7k|  adjusted_mantissa answer;
 2826|  58.7k|  answer.mantissa = w << hilz;
 2827|  58.7k|  int bias = binary::mantissa_explicit_bits() - binary::minimum_exponent();
 2828|  58.7k|  answer.power2 = int32_t(detail::power(int32_t(q)) + bias - hilz - lz - 62 +
 2829|  58.7k|                          invalid_am_bias);
 2830|  58.7k|  return answer;
 2831|  58.7k|}
_ZN3glz10fast_float10digit_compIdcEENS0_17adjusted_mantissaERNS0_22parsed_number_string_tIT0_EES2_:
 4034|  58.7k|digit_comp(parsed_number_string_t<UC> &num, adjusted_mantissa am) noexcept {
 4035|       |  // remove the invalid exponent bias
 4036|  58.7k|  am.power2 -= invalid_am_bias;
 4037|       |
 4038|  58.7k|  int32_t sci_exp = scientific_exponent(num);
 4039|  58.7k|  size_t max_digits = binary_format<T>::max_digits();
 4040|  58.7k|  size_t digits = 0;
 4041|  58.7k|  bigint bigmant;
 4042|  58.7k|  parse_mantissa(bigmant, num, max_digits, digits);
 4043|       |  // can't underflow, since digits is at most max_digits.
 4044|  58.7k|  int32_t exponent = sci_exp + 1 - int32_t(digits);
 4045|  58.7k|  if (exponent >= 0) {
  ------------------
  |  Branch (4045:7): [True: 17.2k, False: 41.5k]
  ------------------
 4046|  17.2k|    return positive_digit_comp<T>(bigmant, exponent);
 4047|  41.5k|  } else {
 4048|  41.5k|    return negative_digit_comp<T>(bigmant, am, exponent);
 4049|  41.5k|  }
 4050|  58.7k|}
_ZN3glz10fast_float19scientific_exponentIcEEiRNS0_22parsed_number_string_tIT_EE:
 3640|  58.7k|scientific_exponent(parsed_number_string_t<UC> &num) noexcept {
 3641|  58.7k|  uint64_t mantissa = num.mantissa;
 3642|  58.7k|  int32_t exponent = int32_t(num.exponent);
 3643|   293k|  while (mantissa >= 10000) {
  ------------------
  |  Branch (3643:10): [True: 234k, False: 58.7k]
  ------------------
 3644|   234k|    mantissa /= 10000;
 3645|   234k|    exponent += 4;
 3646|   234k|  }
 3647|   117k|  while (mantissa >= 100) {
  ------------------
  |  Branch (3647:10): [True: 58.7k, False: 58.7k]
  ------------------
 3648|  58.7k|    mantissa /= 100;
 3649|  58.7k|    exponent += 2;
 3650|  58.7k|  }
 3651|  58.7k|  while (mantissa >= 10) {
  ------------------
  |  Branch (3651:10): [True: 0, False: 58.7k]
  ------------------
 3652|      0|    mantissa /= 10;
 3653|      0|    exponent += 1;
 3654|      0|  }
 3655|  58.7k|  return exponent;
 3656|  58.7k|}
_ZN3glz10fast_float13binary_formatIdE10max_digitsEv:
 1085|  58.7k|template <> inline constexpr size_t binary_format<double>::max_digits() {
 1086|  58.7k|  return 769;
 1087|  58.7k|}
_ZN3glz10fast_float6bigintC2Ev:
 3399|  58.7k|  GLZ_FASTFLOAT_CONSTEXPR20 bigint() : vec() {}
_ZN3glz10fast_float8stackvecILt62EEC2Ev:
 3006|   598k|  stackvec() = default;
_ZN3glz10fast_float14parse_mantissaIcEEvRNS0_6bigintERNS0_22parsed_number_string_tIT_EEmRm:
 3859|  58.7k|               size_t max_digits, size_t &digits) noexcept {
 3860|       |  // try to minimize the number of big integer and scalar multiplication.
 3861|       |  // therefore, try to parse 8 digits at a time, and multiply by the largest
 3862|       |  // scalar value (9 or 19 digits) for each step.
 3863|  58.7k|  size_t counter = 0;
 3864|  58.7k|  digits = 0;
 3865|  58.7k|  limb value = 0;
 3866|  58.7k|#ifdef GLZ_FASTFLOAT_64BIT_LIMB
 3867|  58.7k|  size_t step = 19;
 3868|       |#else
 3869|       |  size_t step = 9;
 3870|       |#endif
 3871|       |
 3872|       |  // process all integer digits.
 3873|  58.7k|  UC const *p = num.integer.ptr;
 3874|  58.7k|  UC const *pend = p + num.integer.len();
 3875|  58.7k|  skip_zeros(p, pend);
 3876|       |  // process all digits, in increments of step per loop
 3877|   639k|  while (p != pend) {
  ------------------
  |  Branch (3877:10): [True: 593k, False: 45.9k]
  ------------------
 3878|  1.70M|    while ((std::distance(p, pend) >= 8) && (step - counter >= 8) &&
  ------------------
  |  Branch (3878:12): [True: 1.63M, False: 65.4k]
  |  Branch (3878:45): [True: 1.11M, False: 518k]
  ------------------
 3879|  1.11M|           (max_digits - digits >= 8)) {
  ------------------
  |  Branch (3879:12): [True: 1.10M, False: 8.67k]
  ------------------
 3880|  1.10M|      parse_eight_digits(p, value, counter, digits);
 3881|  1.10M|    }
 3882|  2.28M|    while (counter < step && p != pend && digits < max_digits) {
  ------------------
  |  Branch (3882:12): [True: 1.74M, False: 538k]
  |  Branch (3882:30): [True: 1.70M, False: 45.2k]
  |  Branch (3882:43): [True: 1.69M, False: 9.09k]
  ------------------
 3883|  1.69M|      parse_one_digit(p, value, counter, digits);
 3884|  1.69M|    }
 3885|   593k|    if (digits == max_digits) {
  ------------------
  |  Branch (3885:9): [True: 12.7k, False: 580k]
  ------------------
 3886|       |      // add the temporary value, then check if we've truncated any digits
 3887|  12.7k|      add_native(result, limb(powers_of_ten_uint64[counter]), value);
 3888|  12.7k|      bool truncated = is_truncated(p, pend);
 3889|  12.7k|      if (num.fraction.ptr != nullptr) {
  ------------------
  |  Branch (3889:11): [True: 9.93k, False: 2.76k]
  ------------------
 3890|  9.93k|        truncated |= is_truncated(num.fraction);
 3891|  9.93k|      }
 3892|  12.7k|      if (truncated) {
  ------------------
  |  Branch (3892:11): [True: 7.24k, False: 5.46k]
  ------------------
 3893|  7.24k|        round_up_bigint(result, digits);
 3894|  7.24k|      }
 3895|  12.7k|      return;
 3896|   580k|    } else {
 3897|   580k|      add_native(result, limb(powers_of_ten_uint64[counter]), value);
 3898|   580k|      counter = 0;
 3899|   580k|      value = 0;
 3900|   580k|    }
 3901|   593k|  }
 3902|       |
 3903|       |  // add our fraction digits, if they're available.
 3904|  45.9k|  if (num.fraction.ptr != nullptr) {
  ------------------
  |  Branch (3904:7): [True: 25.6k, False: 20.3k]
  ------------------
 3905|  25.6k|    p = num.fraction.ptr;
 3906|  25.6k|    pend = p + num.fraction.len();
 3907|  25.6k|    if (digits == 0) {
  ------------------
  |  Branch (3907:9): [True: 4.31k, False: 21.3k]
  ------------------
 3908|  4.31k|      skip_zeros(p, pend);
 3909|  4.31k|    }
 3910|       |    // process all digits, in increments of step per loop
 3911|   441k|    while (p != pend) {
  ------------------
  |  Branch (3911:12): [True: 425k, False: 15.8k]
  ------------------
 3912|  1.24M|      while ((std::distance(p, pend) >= 8) && (step - counter >= 8) &&
  ------------------
  |  Branch (3912:14): [True: 1.21M, False: 24.6k]
  |  Branch (3912:47): [True: 819k, False: 397k]
  ------------------
 3913|   819k|             (max_digits - digits >= 8)) {
  ------------------
  |  Branch (3913:14): [True: 815k, False: 4.14k]
  ------------------
 3914|   815k|        parse_eight_digits(p, value, counter, digits);
 3915|   815k|      }
 3916|  1.69M|      while (counter < step && p != pend && digits < max_digits) {
  ------------------
  |  Branch (3916:14): [True: 1.29M, False: 404k]
  |  Branch (3916:32): [True: 1.27M, False: 15.1k]
  |  Branch (3916:45): [True: 1.26M, False: 6.58k]
  ------------------
 3917|  1.26M|        parse_one_digit(p, value, counter, digits);
 3918|  1.26M|      }
 3919|   425k|      if (digits == max_digits) {
  ------------------
  |  Branch (3919:11): [True: 9.80k, False: 416k]
  ------------------
 3920|       |        // add the temporary value, then check if we've truncated any digits
 3921|  9.80k|        add_native(result, limb(powers_of_ten_uint64[counter]), value);
 3922|  9.80k|        bool truncated = is_truncated(p, pend);
 3923|  9.80k|        if (truncated) {
  ------------------
  |  Branch (3923:13): [True: 6.26k, False: 3.54k]
  ------------------
 3924|  6.26k|          round_up_bigint(result, digits);
 3925|  6.26k|        }
 3926|  9.80k|        return;
 3927|   416k|      } else {
 3928|   416k|        add_native(result, limb(powers_of_ten_uint64[counter]), value);
 3929|   416k|        counter = 0;
 3930|   416k|        value = 0;
 3931|   416k|      }
 3932|   425k|    }
 3933|  25.6k|  }
 3934|       |
 3935|  36.1k|  if (counter != 0) {
  ------------------
  |  Branch (3935:7): [True: 0, False: 36.1k]
  ------------------
 3936|      0|    add_native(result, limb(powers_of_ten_uint64[counter]), value);
 3937|      0|  }
 3938|  36.1k|}
_ZN3glz10fast_float10skip_zerosIcEEvRPKT_S4_:
 3773|  63.0k|skip_zeros(UC const *&first, UC const *last) noexcept {
 3774|  63.0k|  uint64_t val;
 3775|  64.5k|  while (!cpp20_and_in_constexpr() &&
  ------------------
  |  Branch (3775:10): [True: 64.5k, Folded]
  ------------------
 3776|  64.5k|         std::distance(first, last) >= int_cmp_len<UC>()) {
  ------------------
  |  Branch (3776:10): [True: 53.6k, False: 10.9k]
  ------------------
 3777|  53.6k|    ::memcpy(&val, first, sizeof(uint64_t));
 3778|  53.6k|    if (val != int_cmp_zeros<UC>()) {
  ------------------
  |  Branch (3778:9): [True: 52.0k, False: 1.56k]
  ------------------
 3779|  52.0k|      break;
 3780|  52.0k|    }
 3781|  1.56k|    first += int_cmp_len<UC>();
 3782|  1.56k|  }
 3783|  73.2k|  while (first != last) {
  ------------------
  |  Branch (3783:10): [True: 68.8k, False: 4.31k]
  ------------------
 3784|  68.8k|    if (*first != UC('0')) {
  ------------------
  |  Branch (3784:9): [True: 58.7k, False: 10.1k]
  ------------------
 3785|  58.7k|      break;
 3786|  58.7k|    }
 3787|  10.1k|    first++;
 3788|  10.1k|  }
 3789|  63.0k|}
_ZN3glz10fast_float11int_cmp_lenIcEEiv:
 1180|   538k|template <typename UC> constexpr int int_cmp_len() {
 1181|   538k|  return sizeof(uint64_t) / sizeof(UC);
 1182|   538k|}
_ZN3glz10fast_float13int_cmp_zerosIcEEmv:
 1170|   279k|template <typename UC> constexpr uint64_t int_cmp_zeros() {
 1171|   279k|  static_assert((sizeof(UC) == 1) || (sizeof(UC) == 2) || (sizeof(UC) == 4),
 1172|   279k|                "Unsupported character size");
 1173|   279k|  return (sizeof(UC) == 1) ? 0x3030303030303030
  ------------------
  |  Branch (1173:10): [True: 279k, Folded]
  ------------------
 1174|   279k|         : (sizeof(UC) == 2)
  ------------------
  |  Branch (1174:12): [Folded, False: 0]
  ------------------
 1175|      0|             ? (uint64_t(UC('0')) << 48 | uint64_t(UC('0')) << 32 |
 1176|      0|                uint64_t(UC('0')) << 16 | UC('0'))
 1177|      0|             : (uint64_t(UC('0')) << 32 | UC('0'));
 1178|   279k|}
_ZN3glz10fast_float18parse_eight_digitsIcEEvRPKT_RmS6_S6_:
 3824|  1.92M|                   size_t &count) noexcept {
 3825|  1.92M|  value = value * 100000000 + parse_eight_digits_unrolled(p);
 3826|  1.92M|  p += 8;
 3827|  1.92M|  counter += 8;
 3828|  1.92M|  count += 8;
 3829|  1.92M|}
_ZN3glz10fast_float27parse_eight_digits_unrolledIcEEjPKT_:
 1588|  1.92M|parse_eight_digits_unrolled(UC const *chars) noexcept {
 1589|  1.92M|  if (cpp20_and_in_constexpr() || !has_simd_opt<UC>()) {
  ------------------
  |  Branch (1589:7): [Folded, False: 0]
  |  Branch (1589:35): [True: 0, Folded]
  ------------------
 1590|  1.92M|    return parse_eight_digits_unrolled(read8_to_u64(chars)); // truncation okay
 1591|  1.92M|  }
 1592|      0|  return parse_eight_digits_unrolled(simd_read8_to_u64(chars));
 1593|  1.92M|}
_ZN3glz10fast_float15parse_one_digitIcEEvRPKT_RmS6_S6_:
 3834|  2.96M|                size_t &count) noexcept {
 3835|  2.96M|  value = value * 10 + limb(*p - UC('0'));
 3836|  2.96M|  p++;
 3837|  2.96M|  counter++;
 3838|  2.96M|  count++;
 3839|  2.96M|}
_ZN3glz10fast_float10add_nativeERNS0_6bigintEmm:
 3842|  1.03M|add_native(bigint &big, limb power, limb value) noexcept {
 3843|  1.03M|  big.mul(power);
 3844|  1.03M|  big.add(value);
 3845|  1.03M|}
_ZN3glz10fast_float6bigint3mulEm:
 3552|  1.03M|  GLZ_FASTFLOAT_CONSTEXPR20 bool mul(limb y) noexcept { return small_mul(vec, y); }
_ZN3glz10fast_float9small_mulILt62EEEbRNS0_8stackvecIXT_EEEm:
 3249|  1.77M|                                            limb y) noexcept {
 3250|  1.77M|  limb carry = 0;
 3251|  29.0M|  for (size_t index = 0; index < vec.len(); index++) {
  ------------------
  |  Branch (3251:26): [True: 27.2M, False: 1.77M]
  ------------------
 3252|  27.2M|    vec[index] = scalar_mul(vec[index], y, carry);
 3253|  27.2M|  }
 3254|  1.77M|  if (carry != 0) {
  ------------------
  |  Branch (3254:7): [True: 1.59M, False: 173k]
  ------------------
 3255|  1.59M|    GLZ_FASTFLOAT_TRY(vec.try_push(carry));
  ------------------
  |  |  354|  1.59M|  {                                                                            \
  |  |  355|  1.59M|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 1.59M]
  |  |  ------------------
  |  |  356|  1.59M|      return false;                                                            \
  |  |  357|  1.59M|  }
  ------------------
 3256|  1.59M|  }
 3257|  1.77M|  return true;
 3258|  1.77M|}
_ZNK3glz10fast_float8stackvecILt62EE3lenEv:
 3039|  36.9M|  constexpr size_t len() const noexcept { return length; }
_ZN3glz10fast_float10scalar_mulEmmRm:
 3196|  27.2M|scalar_mul(limb x, limb y, limb &carry) noexcept {
 3197|  27.2M|#ifdef GLZ_FASTFLOAT_64BIT_LIMB
 3198|  27.2M|#if defined(__SIZEOF_INT128__)
 3199|       |  // GCC and clang both define it as an extension.
 3200|  27.2M|  __uint128_t z = __uint128_t(x) * __uint128_t(y) + __uint128_t(carry);
 3201|  27.2M|  carry = limb(z >> limb_bits);
 3202|  27.2M|  return limb(z);
 3203|       |#else
 3204|       |  // fallback, no native 128-bit integer multiplication with carry.
 3205|       |  // on msvc, this optimizes identically, somehow.
 3206|       |  value128 z = full_multiplication(x, y);
 3207|       |  bool overflow;
 3208|       |  z.low = scalar_add(z.low, carry, overflow);
 3209|       |  z.high += uint64_t(overflow); // cannot overflow
 3210|       |  carry = z.high;
 3211|       |  return z.low;
 3212|       |#endif
 3213|       |#else
 3214|       |  uint64_t z = uint64_t(x) * uint64_t(y) + uint64_t(carry);
 3215|       |  carry = limb(z >> limb_bits);
 3216|       |  return limb(z);
 3217|       |#endif
 3218|  27.2M|}
_ZN3glz10fast_float8stackvecILt62EEixEm:
 3017|  67.3M|  GLZ_FASTFLOAT_CONSTEXPR14 limb &operator[](size_t index) noexcept {
 3018|  67.3M|    GLZ_FASTFLOAT_DEBUG_ASSERT(index < length);
  ------------------
  |  |  349|  67.3M|  { ((void)(x)); }
  ------------------
 3019|  67.3M|    return data[index];
 3020|  67.3M|  }
_ZN3glz10fast_float8stackvecILt62EE8try_pushEm:
 3052|  1.67M|  GLZ_FASTFLOAT_CONSTEXPR14 bool try_push(limb value) noexcept {
 3053|  1.67M|    if (len() < capacity()) {
  ------------------
  |  Branch (3053:9): [True: 1.67M, False: 0]
  ------------------
 3054|  1.67M|      push_unchecked(value);
 3055|  1.67M|      return true;
 3056|  1.67M|    } else {
 3057|      0|      return false;
 3058|      0|    }
 3059|  1.67M|  }
_ZNK3glz10fast_float8stackvecILt62EE8capacityEv:
 3043|  2.82M|  constexpr size_t capacity() const noexcept { return size; }
_ZN3glz10fast_float8stackvecILt62EE14push_uncheckedEm:
 3046|  1.71M|  GLZ_FASTFLOAT_CONSTEXPR14 void push_unchecked(limb value) noexcept {
 3047|  1.71M|    data[length] = value;
 3048|  1.71M|    length++;
 3049|  1.71M|  }
_ZN3glz10fast_float6bigint3addEm:
 3554|  1.03M|  GLZ_FASTFLOAT_CONSTEXPR20 bool add(limb y) noexcept { return small_add(vec, y); }
_ZN3glz10fast_float9small_addILt62EEEbRNS0_8stackvecIXT_EEEm:
 3242|  1.03M|small_add(stackvec<size> &vec, limb y) noexcept {
 3243|  1.03M|  return small_add_from(vec, y, 0);
 3244|  1.03M|}
_ZN3glz10fast_float14small_add_fromILt62EEEbRNS0_8stackvecIXT_EEEmm:
 3224|  1.03M|                                                 size_t start) noexcept {
 3225|  1.03M|  size_t index = start;
 3226|  1.03M|  limb carry = y;
 3227|  1.03M|  bool overflow;
 3228|  1.36M|  while (carry != 0 && index < vec.len()) {
  ------------------
  |  Branch (3228:10): [True: 393k, False: 968k]
  |  Branch (3228:24): [True: 329k, False: 63.9k]
  ------------------
 3229|   329k|    vec[index] = scalar_add(vec[index], carry, overflow);
 3230|   329k|    carry = limb(overflow);
 3231|   329k|    index += 1;
 3232|   329k|  }
 3233|  1.03M|  if (carry != 0) {
  ------------------
  |  Branch (3233:7): [True: 63.9k, False: 968k]
  ------------------
 3234|  63.9k|    GLZ_FASTFLOAT_TRY(vec.try_push(carry));
  ------------------
  |  |  354|  63.9k|  {                                                                            \
  |  |  355|  63.9k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 63.9k]
  |  |  ------------------
  |  |  356|  63.9k|      return false;                                                            \
  |  |  357|  63.9k|  }
  ------------------
 3235|  63.9k|  }
 3236|  1.03M|  return true;
 3237|  1.03M|}
_ZN3glz10fast_float10scalar_addEmmRb:
 3176|  7.88M|scalar_add(limb x, limb y, bool &overflow) noexcept {
 3177|  7.88M|  limb z;
 3178|       |// gcc and clang
 3179|  7.88M|#if defined(__has_builtin)
 3180|  7.88M|#if __has_builtin(__builtin_add_overflow)
 3181|  7.88M|  if (!cpp20_and_in_constexpr()) {
  ------------------
  |  Branch (3181:7): [True: 7.88M, Folded]
  ------------------
 3182|  7.88M|    overflow = __builtin_add_overflow(x, y, &z);
 3183|  7.88M|    return z;
 3184|  7.88M|  }
 3185|      0|#endif
 3186|      0|#endif
 3187|       |
 3188|       |  // generic, this still optimizes correctly on MSVC.
 3189|      0|  z = x + y;
 3190|      0|  overflow = z < x;
 3191|      0|  return z;
 3192|  7.88M|}
_ZN3glz10fast_float12is_truncatedIcEEbPKT_S4_:
 3795|  32.4k|is_truncated(UC const *first, UC const *last) noexcept {
 3796|       |  // do 8-bit optimizations, can just compare to 8 literal 0s.
 3797|  32.4k|  uint64_t val;
 3798|   252k|  while (!cpp20_and_in_constexpr() &&
  ------------------
  |  Branch (3798:10): [True: 252k, Folded]
  ------------------
 3799|   252k|         std::distance(first, last) >= int_cmp_len<UC>()) {
  ------------------
  |  Branch (3799:10): [True: 225k, False: 26.8k]
  ------------------
 3800|   225k|    ::memcpy(&val, first, sizeof(uint64_t));
 3801|   225k|    if (val != int_cmp_zeros<UC>()) {
  ------------------
  |  Branch (3801:9): [True: 5.54k, False: 219k]
  ------------------
 3802|  5.54k|      return true;
 3803|  5.54k|    }
 3804|   219k|    first += int_cmp_len<UC>();
 3805|   219k|  }
 3806|  68.7k|  while (first != last) {
  ------------------
  |  Branch (3806:10): [True: 53.2k, False: 15.4k]
  ------------------
 3807|  53.2k|    if (*first != UC('0')) {
  ------------------
  |  Branch (3807:9): [True: 11.4k, False: 41.8k]
  ------------------
 3808|  11.4k|      return true;
 3809|  11.4k|    }
 3810|  41.8k|    ++first;
 3811|  41.8k|  }
 3812|  15.4k|  return false;
 3813|  26.8k|}
_ZN3glz10fast_float12is_truncatedIcEEbNS0_4spanIKT_EE:
 3817|  9.93k|is_truncated(span<UC const> s) noexcept {
 3818|  9.93k|  return is_truncated(s.ptr, s.ptr + s.len());
 3819|  9.93k|}
_ZN3glz10fast_float15round_up_bigintERNS0_6bigintERm:
 3848|  13.5k|round_up_bigint(bigint &big, size_t &count) noexcept {
 3849|       |  // need to round-up the digits, but need to avoid rounding
 3850|       |  // ....9999 to ...10000, which could cause a false halfway point.
 3851|  13.5k|  add_native(big, 10, 1);
 3852|  13.5k|  count++;
 3853|  13.5k|}
_ZN3glz10fast_float19positive_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintEi:
 3942|  17.2k|positive_digit_comp(bigint &bigmant, int32_t exponent) noexcept {
 3943|  17.2k|  GLZ_FASTFLOAT_ASSERT(bigmant.pow10(uint32_t(exponent)));
  ------------------
  |  |  344|  17.2k|  { ((void)(x)); }
  ------------------
 3944|  17.2k|  adjusted_mantissa answer;
 3945|  17.2k|  bool truncated;
 3946|  17.2k|  answer.mantissa = bigmant.hi64(truncated);
 3947|  17.2k|  int bias = binary_format<T>::mantissa_explicit_bits() -
 3948|  17.2k|             binary_format<T>::minimum_exponent();
 3949|  17.2k|  answer.power2 = bigmant.bit_length() - 64 + bias;
 3950|       |
 3951|  17.2k|  round<T>(answer, [truncated](adjusted_mantissa &a, int32_t shift) {
 3952|  17.2k|    round_nearest_tie_even(
 3953|  17.2k|        a, shift,
 3954|  17.2k|        [truncated](bool is_odd, bool is_halfway, bool is_above) -> bool {
 3955|  17.2k|          return is_above || (is_halfway && truncated) ||
 3956|  17.2k|                 (is_odd && is_halfway);
 3957|  17.2k|        });
 3958|  17.2k|  });
 3959|       |
 3960|  17.2k|  return answer;
 3961|  17.2k|}
_ZN3glz10fast_float6bigint5pow10Ej:
 3591|  17.2k|  GLZ_FASTFLOAT_CONSTEXPR20 bool pow10(uint32_t exp) noexcept {
 3592|  17.2k|    GLZ_FASTFLOAT_TRY(pow5(exp));
  ------------------
  |  |  354|  17.2k|  {                                                                            \
  |  |  355|  17.2k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 17.2k]
  |  |  ------------------
  |  |  356|  17.2k|      return false;                                                            \
  |  |  357|  17.2k|  }
  ------------------
 3593|  17.2k|    return pow2(exp);
 3594|  17.2k|  }
_ZN3glz10fast_float6bigint4pow5Ej:
 3560|  58.7k|  GLZ_FASTFLOAT_CONSTEXPR20 bool pow5(uint32_t exp) noexcept {
 3561|       |    // multiply by a power of 5
 3562|  58.7k|    size_t large_length = sizeof(large_power_of_5) / sizeof(limb);
 3563|  58.7k|    limb_span large = limb_span(large_power_of_5, large_length);
 3564|   183k|    while (exp >= large_step) {
  ------------------
  |  Branch (3564:12): [True: 124k, False: 58.7k]
  ------------------
 3565|   124k|      GLZ_FASTFLOAT_TRY(large_mul(vec, large));
  ------------------
  |  |  354|   124k|  {                                                                            \
  |  |  355|   124k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 124k]
  |  |  ------------------
  |  |  356|   124k|      return false;                                                            \
  |  |  357|   124k|  }
  ------------------
 3566|   124k|      exp -= large_step;
 3567|   124k|    }
 3568|  58.7k|#ifdef GLZ_FASTFLOAT_64BIT_LIMB
 3569|  58.7k|    uint32_t small_step = 27;
 3570|  58.7k|    limb max_native = 7450580596923828125UL;
 3571|       |#else
 3572|       |    uint32_t small_step = 13;
 3573|       |    limb max_native = 1220703125U;
 3574|       |#endif
 3575|   124k|    while (exp >= small_step) {
  ------------------
  |  Branch (3575:12): [True: 65.6k, False: 58.7k]
  ------------------
 3576|  65.6k|      GLZ_FASTFLOAT_TRY(small_mul(vec, max_native));
  ------------------
  |  |  354|  65.6k|  {                                                                            \
  |  |  355|  65.6k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 65.6k]
  |  |  ------------------
  |  |  356|  65.6k|      return false;                                                            \
  |  |  357|  65.6k|  }
  ------------------
 3577|  65.6k|      exp -= small_step;
 3578|  65.6k|    }
 3579|  58.7k|    if (exp != 0) {
  ------------------
  |  Branch (3579:9): [True: 50.7k, False: 7.94k]
  ------------------
 3580|       |      // Work around clang bug https://godbolt.org/z/zedh7rrhc
 3581|       |      // This is similar to https://github.com/llvm/llvm-project/issues/47746,
 3582|       |      // except the workaround described there don't work here
 3583|  50.7k|      GLZ_FASTFLOAT_TRY(small_mul(
  ------------------
  |  |  354|  50.7k|  {                                                                            \
  |  |  355|  50.7k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 50.7k]
  |  |  ------------------
  |  |  356|  50.7k|      return false;                                                            \
  |  |  357|  50.7k|  }
  ------------------
 3584|  50.7k|          vec, limb(((void)small_power_of_5[0], small_power_of_5[exp]))));
 3585|  50.7k|    }
 3586|       |
 3587|  58.7k|    return true;
 3588|  58.7k|  }
_ZN3glz10fast_float4spanImEC2EPKmm:
  436|   806k|  constexpr span(T const *_ptr, size_t _length) : ptr(_ptr), length(_length) {}
_ZN3glz10fast_float9large_mulILt62EEEbRNS0_8stackvecIXT_EEENS0_4spanImEE:
 3329|   124k|GLZ_FASTFLOAT_CONSTEXPR20 bool large_mul(stackvec<size> &x, limb_span y) noexcept {
 3330|   124k|  if (y.len() == 1) {
  ------------------
  |  Branch (3330:7): [True: 0, False: 124k]
  ------------------
 3331|      0|    GLZ_FASTFLOAT_TRY(small_mul(x, y[0]));
  ------------------
  |  |  354|      0|  {                                                                            \
  |  |  355|      0|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  356|      0|      return false;                                                            \
  |  |  357|      0|  }
  ------------------
 3332|   124k|  } else {
 3333|   124k|    GLZ_FASTFLOAT_TRY(long_mul(x, y));
  ------------------
  |  |  354|   124k|  {                                                                            \
  |  |  355|   124k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 124k]
  |  |  ------------------
  |  |  356|   124k|      return false;                                                            \
  |  |  357|   124k|  }
  ------------------
 3334|   124k|  }
 3335|   124k|  return true;
 3336|   124k|}
_ZNK3glz10fast_float4spanImE3lenEv:
  440|  9.59M|  constexpr size_t len() const noexcept { return length; }
_ZNK3glz10fast_float4spanImEixEm:
  442|  5.98M|  GLZ_FASTFLOAT_CONSTEXPR14 const T &operator[](size_t index) const noexcept {
  443|  5.98M|    GLZ_FASTFLOAT_DEBUG_ASSERT(index < length);
  ------------------
  |  |  349|  5.98M|  { ((void)(x)); }
  ------------------
  444|  5.98M|    return ptr[index];
  445|  5.98M|  }
_ZN3glz10fast_float8long_mulILt62EEEbRNS0_8stackvecIXT_EEENS0_4spanImEE:
 3301|   124k|GLZ_FASTFLOAT_CONSTEXPR20 bool long_mul(stackvec<size> &x, limb_span y) noexcept {
 3302|   124k|  limb_span xs = limb_span(x.data, x.len());
 3303|   124k|  stackvec<size> z(xs);
 3304|   124k|  limb_span zs = limb_span(z.data, z.len());
 3305|       |
 3306|   124k|  if (y.len() != 0) {
  ------------------
  |  Branch (3306:7): [True: 124k, False: 0]
  ------------------
 3307|   124k|    limb y0 = y[0];
 3308|   124k|    GLZ_FASTFLOAT_TRY(small_mul(x, y0));
  ------------------
  |  |  354|   124k|  {                                                                            \
  |  |  355|   124k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 124k]
  |  |  ------------------
  |  |  356|   124k|      return false;                                                            \
  |  |  357|   124k|  }
  ------------------
 3309|   623k|    for (size_t index = 1; index < y.len(); index++) {
  ------------------
  |  Branch (3309:28): [True: 498k, False: 124k]
  ------------------
 3310|   498k|      limb yi = y[index];
 3311|   498k|      stackvec<size> zi;
 3312|   498k|      if (yi != 0) {
  ------------------
  |  Branch (3312:11): [True: 498k, False: 0]
  ------------------
 3313|       |        // re-use the same buffer throughout
 3314|   498k|        zi.set_len(0);
 3315|   498k|        GLZ_FASTFLOAT_TRY(zi.try_extend(zs));
  ------------------
  |  |  354|   498k|  {                                                                            \
  |  |  355|   498k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 498k]
  |  |  ------------------
  |  |  356|   498k|      return false;                                                            \
  |  |  357|   498k|  }
  ------------------
 3316|   498k|        GLZ_FASTFLOAT_TRY(small_mul(zi, yi));
  ------------------
  |  |  354|   498k|  {                                                                            \
  |  |  355|   498k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 498k]
  |  |  ------------------
  |  |  356|   498k|      return false;                                                            \
  |  |  357|   498k|  }
  ------------------
 3317|   498k|        limb_span zis = limb_span(zi.data, zi.len());
 3318|   498k|        GLZ_FASTFLOAT_TRY(large_add_from(x, zis, index));
  ------------------
  |  |  354|   498k|  {                                                                            \
  |  |  355|   498k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 498k]
  |  |  ------------------
  |  |  356|   498k|      return false;                                                            \
  |  |  357|   498k|  }
  ------------------
 3319|   498k|      }
 3320|   498k|    }
 3321|   124k|  }
 3322|       |
 3323|   124k|  x.normalize();
 3324|   124k|  return true;
 3325|   124k|}
_ZN3glz10fast_float8stackvecILt62EEC2ENS0_4spanImEE:
 3013|   124k|  GLZ_FASTFLOAT_CONSTEXPR20 stackvec(limb_span s) {
 3014|   124k|    GLZ_FASTFLOAT_ASSERT(try_extend(s));
  ------------------
  |  |  344|   124k|  { ((void)(x)); }
  ------------------
 3015|   124k|  }
_ZN3glz10fast_float8stackvecILt62EE7set_lenEm:
 3035|  1.65M|  GLZ_FASTFLOAT_CONSTEXPR14 void set_len(size_t len) noexcept {
 3036|  1.65M|    length = uint16_t(len);
 3037|  1.65M|  }
_ZN3glz10fast_float8stackvecILt62EE10try_extendENS0_4spanImEE:
 3069|   623k|  GLZ_FASTFLOAT_CONSTEXPR20 bool try_extend(limb_span s) noexcept {
 3070|   623k|    if (len() + s.len() <= capacity()) {
  ------------------
  |  Branch (3070:9): [True: 623k, False: 0]
  ------------------
 3071|   623k|      extend_unchecked(s);
 3072|   623k|      return true;
 3073|   623k|    } else {
 3074|      0|      return false;
 3075|      0|    }
 3076|   623k|  }
_ZN3glz10fast_float8stackvecILt62EE16extend_uncheckedENS0_4spanImEE:
 3062|   623k|  GLZ_FASTFLOAT_CONSTEXPR20 void extend_unchecked(limb_span s) noexcept {
 3063|   623k|    limb *ptr = data + length;
 3064|   623k|    std::copy_n(s.ptr, s.len(), ptr);
 3065|   623k|    set_len(len() + s.len());
 3066|   623k|  }
_ZN3glz10fast_float14large_add_fromILt62EEEbRNS0_8stackvecIXT_EEENS0_4spanImEEm:
 3264|   498k|                                          size_t start) noexcept {
 3265|       |  // the effective x buffer is from `xstart..x.len()`, so exit early
 3266|       |  // if we can't get that current range.
 3267|   498k|  if (x.len() < start || y.len() > x.len() - start) {
  ------------------
  |  Branch (3267:7): [True: 0, False: 498k]
  |  Branch (3267:26): [True: 494k, False: 4.38k]
  ------------------
 3268|   494k|    GLZ_FASTFLOAT_TRY(x.try_resize(y.len() + start, 0));
  ------------------
  |  |  354|   494k|  {                                                                            \
  |  |  355|   494k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 494k]
  |  |  ------------------
  |  |  356|   494k|      return false;                                                            \
  |  |  357|   494k|  }
  ------------------
 3269|   494k|  }
 3270|       |
 3271|   498k|  bool carry = false;
 3272|  5.86M|  for (size_t index = 0; index < y.len(); index++) {
  ------------------
  |  Branch (3272:26): [True: 5.36M, False: 498k]
  ------------------
 3273|  5.36M|    limb xi = x[index + start];
 3274|  5.36M|    limb yi = y[index];
 3275|  5.36M|    bool c1 = false;
 3276|  5.36M|    bool c2 = false;
 3277|  5.36M|    xi = scalar_add(xi, yi, c1);
 3278|  5.36M|    if (carry) {
  ------------------
  |  Branch (3278:9): [True: 2.18M, False: 3.17M]
  ------------------
 3279|  2.18M|      xi = scalar_add(xi, 1, c2);
 3280|  2.18M|    }
 3281|  5.36M|    x[index + start] = xi;
 3282|  5.36M|    carry = c1 | c2;
 3283|  5.36M|  }
 3284|       |
 3285|       |  // handle overflow
 3286|   498k|  if (carry) {
  ------------------
  |  Branch (3286:7): [True: 0, False: 498k]
  ------------------
 3287|      0|    GLZ_FASTFLOAT_TRY(small_add_from(x, 1, y.len() + start));
  ------------------
  |  |  354|      0|  {                                                                            \
  |  |  355|      0|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  356|      0|      return false;                                                            \
  |  |  357|      0|  }
  ------------------
 3288|      0|  }
 3289|   498k|  return true;
 3290|   498k|}
_ZN3glz10fast_float8stackvecILt62EE10try_resizeEmm:
 3095|   494k|  GLZ_FASTFLOAT_CONSTEXPR20 bool try_resize(size_t new_len, limb value) noexcept {
 3096|   494k|    if (new_len > capacity()) {
  ------------------
  |  Branch (3096:9): [True: 0, False: 494k]
  ------------------
 3097|      0|      return false;
 3098|   494k|    } else {
 3099|   494k|      resize_unchecked(new_len, value);
 3100|   494k|      return true;
 3101|   494k|    }
 3102|   494k|  }
_ZN3glz10fast_float8stackvecILt62EE16resize_uncheckedEmm:
 3082|   494k|  void resize_unchecked(size_t new_len, limb value) noexcept {
 3083|   494k|    if (new_len > len()) {
  ------------------
  |  Branch (3083:9): [True: 494k, False: 0]
  ------------------
 3084|   494k|      size_t count = new_len - len();
 3085|   494k|      limb *first = data + len();
 3086|   494k|      limb *last = first + count;
 3087|   494k|      ::std::fill(first, last, value);
 3088|   494k|      set_len(new_len);
 3089|   494k|    } else {
 3090|      0|      set_len(new_len);
 3091|      0|    }
 3092|   494k|  }
_ZN3glz10fast_float8stackvecILt62EE9normalizeEv:
 3118|   166k|  GLZ_FASTFLOAT_CONSTEXPR14 void normalize() noexcept {
 3119|   166k|    while (len() > 0 && rindex(0) == 0) {
  ------------------
  |  Branch (3119:12): [True: 166k, False: 0]
  |  Branch (3119:25): [True: 0, False: 166k]
  ------------------
 3120|      0|      length--;
 3121|      0|    }
 3122|   166k|  }
_ZNK3glz10fast_float8stackvecILt62EE6rindexEm:
 3028|   224k|  GLZ_FASTFLOAT_CONSTEXPR14 const limb &rindex(size_t index) const noexcept {
 3029|   224k|    GLZ_FASTFLOAT_DEBUG_ASSERT(index < length);
  ------------------
  |  |  349|   224k|  { ((void)(x)); }
  ------------------
 3030|   224k|    size_t rindex = length - index - 1;
 3031|   224k|    return data[rindex];
 3032|   224k|  }
_ZN3glz10fast_float6bigint4pow2Ej:
 3557|  57.7k|  GLZ_FASTFLOAT_CONSTEXPR20 bool pow2(uint32_t exp) noexcept { return shl(exp); }
_ZN3glz10fast_float6bigint3shlEm:
 3519|  57.7k|  GLZ_FASTFLOAT_CONSTEXPR20 bool shl(size_t n) noexcept {
 3520|  57.7k|    size_t rem = n % limb_bits;
 3521|  57.7k|    size_t div = n / limb_bits;
 3522|  57.7k|    if (rem != 0) {
  ------------------
  |  Branch (3522:9): [True: 47.1k, False: 10.5k]
  ------------------
 3523|  47.1k|      GLZ_FASTFLOAT_TRY(shl_bits(rem));
  ------------------
  |  |  354|  47.1k|  {                                                                            \
  |  |  355|  47.1k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 47.1k]
  |  |  ------------------
  |  |  356|  47.1k|      return false;                                                            \
  |  |  357|  47.1k|  }
  ------------------
 3524|  47.1k|    }
 3525|  57.7k|    if (div != 0) {
  ------------------
  |  Branch (3525:9): [True: 35.9k, False: 21.7k]
  ------------------
 3526|  35.9k|      GLZ_FASTFLOAT_TRY(shl_limbs(div));
  ------------------
  |  |  354|  35.9k|  {                                                                            \
  |  |  355|  35.9k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 35.9k]
  |  |  ------------------
  |  |  356|  35.9k|      return false;                                                            \
  |  |  357|  35.9k|  }
  ------------------
 3527|  35.9k|    }
 3528|  57.7k|    return true;
 3529|  57.7k|  }
_ZN3glz10fast_float6bigint8shl_bitsEm:
 3472|  47.1k|  GLZ_FASTFLOAT_CONSTEXPR20 bool shl_bits(size_t n) noexcept {
 3473|       |    // Internally, for each item, we shift left by n, and add the previous
 3474|       |    // right shifted limb-bits.
 3475|       |    // For example, we transform (for u8) shifted left 2, to:
 3476|       |    //      b10100100 b01000010
 3477|       |    //      b10 b10010001 b00001000
 3478|  47.1k|    GLZ_FASTFLOAT_DEBUG_ASSERT(n != 0);
  ------------------
  |  |  349|  47.1k|  { ((void)(x)); }
  ------------------
 3479|  47.1k|    GLZ_FASTFLOAT_DEBUG_ASSERT(n < sizeof(limb) * 8);
  ------------------
  |  |  349|  47.1k|  { ((void)(x)); }
  ------------------
 3480|       |
 3481|  47.1k|    size_t shl = n;
 3482|  47.1k|    size_t shr = limb_bits - shl;
 3483|  47.1k|    limb prev = 0;
 3484|   736k|    for (size_t index = 0; index < vec.len(); index++) {
  ------------------
  |  Branch (3484:28): [True: 689k, False: 47.1k]
  ------------------
 3485|   689k|      limb xi = vec[index];
 3486|   689k|      vec[index] = (xi << shl) | (prev >> shr);
 3487|   689k|      prev = xi;
 3488|   689k|    }
 3489|       |
 3490|  47.1k|    limb carry = prev >> shr;
 3491|  47.1k|    if (carry != 0) {
  ------------------
  |  Branch (3491:9): [True: 11.7k, False: 35.4k]
  ------------------
 3492|  11.7k|      return vec.try_push(carry);
 3493|  11.7k|    }
 3494|  35.4k|    return true;
 3495|  47.1k|  }
_ZN3glz10fast_float6bigint9shl_limbsEm:
 3498|  35.9k|  GLZ_FASTFLOAT_CONSTEXPR20 bool shl_limbs(size_t n) noexcept {
 3499|  35.9k|    GLZ_FASTFLOAT_DEBUG_ASSERT(n != 0);
  ------------------
  |  |  349|  35.9k|  { ((void)(x)); }
  ------------------
 3500|  35.9k|    if (n + vec.len() > vec.capacity()) {
  ------------------
  |  Branch (3500:9): [True: 0, False: 35.9k]
  ------------------
 3501|      0|      return false;
 3502|  35.9k|    } else if (!vec.is_empty()) {
  ------------------
  |  Branch (3502:16): [True: 35.9k, False: 0]
  ------------------
 3503|       |      // move limbs
 3504|  35.9k|      limb *dst = vec.data + n;
 3505|  35.9k|      limb const *src = vec.data;
 3506|  35.9k|      std::copy_backward(src, src + vec.len(), dst + vec.len());
 3507|       |      // fill in empty limbs
 3508|  35.9k|      limb *first = vec.data;
 3509|  35.9k|      limb *last = first + n;
 3510|  35.9k|      ::std::fill(first, last, 0);
 3511|  35.9k|      vec.set_len(n + vec.len());
 3512|  35.9k|      return true;
 3513|  35.9k|    } else {
 3514|      0|      return true;
 3515|      0|    }
 3516|  35.9k|  }
_ZNK3glz10fast_float8stackvecILt62EE8is_emptyEv:
 3041|  53.1k|  constexpr bool is_empty() const noexcept { return length == 0; }
_ZNK3glz10fast_float6bigint4hi64ERb:
 3418|  17.2k|  GLZ_FASTFLOAT_CONSTEXPR20 uint64_t hi64(bool &truncated) const noexcept {
 3419|  17.2k|#ifdef GLZ_FASTFLOAT_64BIT_LIMB
 3420|  17.2k|    if (vec.len() == 0) {
  ------------------
  |  Branch (3420:9): [True: 0, False: 17.2k]
  ------------------
 3421|      0|      return empty_hi64(truncated);
 3422|  17.2k|    } else if (vec.len() == 1) {
  ------------------
  |  Branch (3422:16): [True: 4.26k, False: 12.9k]
  ------------------
 3423|  4.26k|      return uint64_hi64(vec.rindex(0), truncated);
 3424|  12.9k|    } else {
 3425|  12.9k|      uint64_t result = uint64_hi64(vec.rindex(0), vec.rindex(1), truncated);
 3426|  12.9k|      truncated |= vec.nonzero(2);
 3427|  12.9k|      return result;
 3428|  12.9k|    }
 3429|       |#else
 3430|       |    if (vec.len() == 0) {
 3431|       |      return empty_hi64(truncated);
 3432|       |    } else if (vec.len() == 1) {
 3433|       |      return uint32_hi64(vec.rindex(0), truncated);
 3434|       |    } else if (vec.len() == 2) {
 3435|       |      return uint32_hi64(vec.rindex(0), vec.rindex(1), truncated);
 3436|       |    } else {
 3437|       |      uint64_t result =
 3438|       |          uint32_hi64(vec.rindex(0), vec.rindex(1), vec.rindex(2), truncated);
 3439|       |      truncated |= vec.nonzero(3);
 3440|       |      return result;
 3441|       |    }
 3442|       |#endif
 3443|  17.2k|  }
_ZN3glz10fast_float11uint64_hi64EmRb:
 3132|  4.26k|uint64_hi64(uint64_t r0, bool &truncated) noexcept {
 3133|  4.26k|  truncated = false;
 3134|  4.26k|  int shl = leading_zeroes(r0);
 3135|  4.26k|  return r0 << shl;
 3136|  4.26k|}
_ZN3glz10fast_float11uint64_hi64EmmRb:
 3139|  12.9k|uint64_hi64(uint64_t r0, uint64_t r1, bool &truncated) noexcept {
 3140|  12.9k|  int shl = leading_zeroes(r0);
 3141|  12.9k|  if (shl == 0) {
  ------------------
  |  Branch (3141:7): [True: 1.38k, False: 11.5k]
  ------------------
 3142|  1.38k|    truncated = r1 != 0;
 3143|  1.38k|    return r0;
 3144|  11.5k|  } else {
 3145|  11.5k|    int shr = 64 - shl;
 3146|  11.5k|    truncated = (r1 << shl) != 0;
 3147|  11.5k|    return (r0 << shl) | (r1 >> shr);
 3148|  11.5k|  }
 3149|  12.9k|}
_ZNK3glz10fast_float8stackvecILt62EE7nonzeroEm:
 3107|  12.9k|  GLZ_FASTFLOAT_CONSTEXPR14 bool nonzero(size_t index) const noexcept {
 3108|  17.6k|    while (index < len()) {
  ------------------
  |  Branch (3108:12): [True: 10.7k, False: 6.90k]
  ------------------
 3109|  10.7k|      if (rindex(index) != 0) {
  ------------------
  |  Branch (3109:11): [True: 6.02k, False: 4.68k]
  ------------------
 3110|  6.02k|        return true;
 3111|  6.02k|      }
 3112|  4.68k|      index++;
 3113|  4.68k|    }
 3114|  6.90k|    return false;
 3115|  12.9k|  }
_ZNK3glz10fast_float6bigint10bit_lengthEv:
 3547|  17.2k|  GLZ_FASTFLOAT_CONSTEXPR20 int bit_length() const noexcept {
 3548|  17.2k|    int lz = ctlz();
 3549|  17.2k|    return int(limb_bits * vec.len()) - lz;
 3550|  17.2k|  }
_ZNK3glz10fast_float6bigint4ctlzEv:
 3532|  17.2k|  GLZ_FASTFLOAT_CONSTEXPR20 int ctlz() const noexcept {
 3533|  17.2k|    if (vec.is_empty()) {
  ------------------
  |  Branch (3533:9): [True: 0, False: 17.2k]
  ------------------
 3534|      0|      return 0;
 3535|  17.2k|    } else {
 3536|  17.2k|#ifdef GLZ_FASTFLOAT_64BIT_LIMB
 3537|  17.2k|      return leading_zeroes(vec.rindex(0));
 3538|       |#else
 3539|       |      // no use defining a specialized leading_zeroes for a 32-bit type.
 3540|       |      uint64_t r0 = vec.rindex(0);
 3541|       |      return leading_zeroes(r0 << 32);
 3542|       |#endif
 3543|  17.2k|    }
 3544|  17.2k|  }
_ZN3glz10fast_float5roundIdZNS0_19positive_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintEiEUlRS3_iE_EEvS6_T0_:
 3707|  17.2k|                                                         callback cb) noexcept {
 3708|  17.2k|  int32_t mantissa_shift = 64 - binary_format<T>::mantissa_explicit_bits() - 1;
 3709|  17.2k|  if (-am.power2 >= mantissa_shift) {
  ------------------
  |  Branch (3709:7): [True: 0, False: 17.2k]
  ------------------
 3710|       |    // have a denormal float
 3711|      0|    int32_t shift = -am.power2 + 1;
 3712|      0|    cb(am, (std::min<int32_t>)(shift, 64));
 3713|       |    // check for round-up: if rounding-nearest carried us to the hidden bit.
 3714|      0|    am.power2 = (am.mantissa <
  ------------------
  |  Branch (3714:17): [True: 0, False: 0]
  ------------------
 3715|      0|                 (uint64_t(1) << binary_format<T>::mantissa_explicit_bits()))
 3716|      0|                    ? 0
 3717|      0|                    : 1;
 3718|      0|    return;
 3719|      0|  }
 3720|       |
 3721|       |  // have a normal float, use the default shift.
 3722|  17.2k|  cb(am, mantissa_shift);
 3723|       |
 3724|       |  // check for carry
 3725|  17.2k|  if (am.mantissa >=
  ------------------
  |  Branch (3725:7): [True: 2.41k, False: 14.7k]
  ------------------
 3726|  17.2k|      (uint64_t(2) << binary_format<T>::mantissa_explicit_bits())) {
 3727|  2.41k|    am.mantissa = (uint64_t(1) << binary_format<T>::mantissa_explicit_bits());
 3728|  2.41k|    am.power2++;
 3729|  2.41k|  }
 3730|       |
 3731|       |  // check for infinite: we could have carried to an infinite power
 3732|  17.2k|  am.mantissa &= ~(uint64_t(1) << binary_format<T>::mantissa_explicit_bits());
 3733|  17.2k|  if (am.power2 >= binary_format<T>::infinite_power()) {
  ------------------
  |  Branch (3733:7): [True: 0, False: 17.2k]
  ------------------
 3734|      0|    am.power2 = binary_format<T>::infinite_power();
 3735|      0|    am.mantissa = 0;
 3736|      0|  }
 3737|  17.2k|}
_ZZN3glz10fast_float19positive_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintEiENKUlRS2_iE_clES5_i:
 3951|  17.2k|  round<T>(answer, [truncated](adjusted_mantissa &a, int32_t shift) {
 3952|  17.2k|    round_nearest_tie_even(
 3953|  17.2k|        a, shift,
 3954|  17.2k|        [truncated](bool is_odd, bool is_halfway, bool is_above) -> bool {
 3955|  17.2k|          return is_above || (is_halfway && truncated) ||
 3956|  17.2k|                 (is_odd && is_halfway);
 3957|  17.2k|        });
 3958|  17.2k|  });
_ZN3glz10fast_float22round_nearest_tie_evenIZZNS0_19positive_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintEiENKUlRS3_iE_clES6_iEUlbbbE_EEvS6_iT_:
 3742|  17.2k|                       callback cb) noexcept {
 3743|  17.2k|  uint64_t const mask = (shift == 64) ? UINT64_MAX : (uint64_t(1) << shift) - 1;
  ------------------
  |  Branch (3743:25): [True: 0, False: 17.2k]
  ------------------
 3744|  17.2k|  uint64_t const halfway = (shift == 0) ? 0 : uint64_t(1) << (shift - 1);
  ------------------
  |  Branch (3744:28): [True: 0, False: 17.2k]
  ------------------
 3745|  17.2k|  uint64_t truncated_bits = am.mantissa & mask;
 3746|  17.2k|  bool is_above = truncated_bits > halfway;
 3747|  17.2k|  bool is_halfway = truncated_bits == halfway;
 3748|       |
 3749|       |  // shift digits into position
 3750|  17.2k|  if (shift == 64) {
  ------------------
  |  Branch (3750:7): [True: 0, False: 17.2k]
  ------------------
 3751|      0|    am.mantissa = 0;
 3752|  17.2k|  } else {
 3753|  17.2k|    am.mantissa >>= shift;
 3754|  17.2k|  }
 3755|  17.2k|  am.power2 += shift;
 3756|       |
 3757|  17.2k|  bool is_odd = (am.mantissa & 1) == 1;
 3758|  17.2k|  am.mantissa += uint64_t(cb(is_odd, is_halfway, is_above));
 3759|  17.2k|}
_ZZZN3glz10fast_float19positive_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintEiENKUlRS2_iE_clES5_iENKUlbbbE_clEbbb:
 3954|  17.2k|        [truncated](bool is_odd, bool is_halfway, bool is_above) -> bool {
 3955|  17.2k|          return is_above || (is_halfway && truncated) ||
  ------------------
  |  Branch (3955:18): [True: 3.81k, False: 13.3k]
  |  Branch (3955:31): [True: 9.64k, False: 3.74k]
  |  Branch (3955:45): [True: 4.64k, False: 5.00k]
  ------------------
 3956|  8.74k|                 (is_odd && is_halfway);
  ------------------
  |  Branch (3956:19): [True: 2.71k, False: 6.03k]
  |  Branch (3956:29): [True: 24, False: 2.69k]
  ------------------
 3957|  17.2k|        });
_ZN3glz10fast_float19negative_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintES2_i:
 3970|  41.5k|    bigint &bigmant, adjusted_mantissa am, int32_t exponent) noexcept {
 3971|  41.5k|  bigint &real_digits = bigmant;
 3972|  41.5k|  int32_t real_exp = exponent;
 3973|       |
 3974|       |  // get the value of `b`, rounded down, and get a bigint representation of b+h
 3975|  41.5k|  adjusted_mantissa am_b = am;
 3976|       |  // gcc7 buf: use a lambda to remove the noexcept qualifier bug with
 3977|       |  // -Wnoexcept-type.
 3978|  41.5k|  round<T>(am_b,
 3979|  41.5k|           [](adjusted_mantissa &a, int32_t shift) { round_down(a, shift); });
 3980|  41.5k|  T b;
 3981|  41.5k|  to_float(false, am_b, b);
 3982|  41.5k|  adjusted_mantissa theor = to_extended_halfway(b);
 3983|  41.5k|  bigint theor_digits(theor.mantissa);
 3984|  41.5k|  int32_t theor_exp = theor.power2;
 3985|       |
 3986|       |  // scale real digits and theor digits to be same power.
 3987|  41.5k|  int32_t pow2_exp = theor_exp - real_exp;
 3988|  41.5k|  uint32_t pow5_exp = uint32_t(-real_exp);
 3989|  41.5k|  if (pow5_exp != 0) {
  ------------------
  |  Branch (3989:7): [True: 41.5k, False: 0]
  ------------------
 3990|  41.5k|    GLZ_FASTFLOAT_ASSERT(theor_digits.pow5(pow5_exp));
  ------------------
  |  |  344|  41.5k|  { ((void)(x)); }
  ------------------
 3991|  41.5k|  }
 3992|  41.5k|  if (pow2_exp > 0) {
  ------------------
  |  Branch (3992:7): [True: 28.3k, False: 13.1k]
  ------------------
 3993|  28.3k|    GLZ_FASTFLOAT_ASSERT(theor_digits.pow2(uint32_t(pow2_exp)));
  ------------------
  |  |  344|  28.3k|  { ((void)(x)); }
  ------------------
 3994|  28.3k|  } else if (pow2_exp < 0) {
  ------------------
  |  Branch (3994:14): [True: 12.1k, False: 969]
  ------------------
 3995|  12.1k|    GLZ_FASTFLOAT_ASSERT(real_digits.pow2(uint32_t(-pow2_exp)));
  ------------------
  |  |  344|  12.1k|  { ((void)(x)); }
  ------------------
 3996|  12.1k|  }
 3997|       |
 3998|       |  // compare digits, and use it to director rounding
 3999|  41.5k|  int ord = real_digits.compare(theor_digits);
 4000|  41.5k|  adjusted_mantissa answer = am;
 4001|  41.5k|  round<T>(answer, [ord](adjusted_mantissa &a, int32_t shift) {
 4002|  41.5k|    round_nearest_tie_even(
 4003|  41.5k|        a, shift, [ord](bool is_odd, bool _, bool __) -> bool {
 4004|  41.5k|          (void)_;  // not needed, since we've done our comparison
 4005|  41.5k|          (void)__; // not needed, since we've done our comparison
 4006|  41.5k|          if (ord > 0) {
 4007|  41.5k|            return true;
 4008|  41.5k|          } else if (ord < 0) {
 4009|  41.5k|            return false;
 4010|  41.5k|          } else {
 4011|  41.5k|            return is_odd;
 4012|  41.5k|          }
 4013|  41.5k|        });
 4014|  41.5k|  });
 4015|       |
 4016|  41.5k|  return answer;
 4017|  41.5k|}
_ZN3glz10fast_float5roundIdZNS0_19negative_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintES3_iEUlRS3_iE_EEvS6_T0_:
 3707|  41.5k|                                                         callback cb) noexcept {
 3708|  41.5k|  int32_t mantissa_shift = 64 - binary_format<T>::mantissa_explicit_bits() - 1;
 3709|  41.5k|  if (-am.power2 >= mantissa_shift) {
  ------------------
  |  Branch (3709:7): [True: 5.37k, False: 36.1k]
  ------------------
 3710|       |    // have a denormal float
 3711|  5.37k|    int32_t shift = -am.power2 + 1;
 3712|  5.37k|    cb(am, (std::min<int32_t>)(shift, 64));
 3713|       |    // check for round-up: if rounding-nearest carried us to the hidden bit.
 3714|  5.37k|    am.power2 = (am.mantissa <
  ------------------
  |  Branch (3714:17): [True: 5.37k, False: 0]
  ------------------
 3715|  5.37k|                 (uint64_t(1) << binary_format<T>::mantissa_explicit_bits()))
 3716|  5.37k|                    ? 0
 3717|  5.37k|                    : 1;
 3718|  5.37k|    return;
 3719|  5.37k|  }
 3720|       |
 3721|       |  // have a normal float, use the default shift.
 3722|  36.1k|  cb(am, mantissa_shift);
 3723|       |
 3724|       |  // check for carry
 3725|  36.1k|  if (am.mantissa >=
  ------------------
  |  Branch (3725:7): [True: 0, False: 36.1k]
  ------------------
 3726|  36.1k|      (uint64_t(2) << binary_format<T>::mantissa_explicit_bits())) {
 3727|      0|    am.mantissa = (uint64_t(1) << binary_format<T>::mantissa_explicit_bits());
 3728|      0|    am.power2++;
 3729|      0|  }
 3730|       |
 3731|       |  // check for infinite: we could have carried to an infinite power
 3732|  36.1k|  am.mantissa &= ~(uint64_t(1) << binary_format<T>::mantissa_explicit_bits());
 3733|  36.1k|  if (am.power2 >= binary_format<T>::infinite_power()) {
  ------------------
  |  Branch (3733:7): [True: 0, False: 36.1k]
  ------------------
 3734|      0|    am.power2 = binary_format<T>::infinite_power();
 3735|      0|    am.mantissa = 0;
 3736|      0|  }
 3737|  36.1k|}
_ZZN3glz10fast_float19negative_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintES2_iENKUlRS2_iE_clES5_i:
 3979|  41.5k|           [](adjusted_mantissa &a, int32_t shift) { round_down(a, shift); });
_ZN3glz10fast_float10round_downERNS0_17adjusted_mantissaEi:
 3762|  41.5k|round_down(adjusted_mantissa &am, int32_t shift) noexcept {
 3763|  41.5k|  if (shift == 64) {
  ------------------
  |  Branch (3763:7): [True: 1.03k, False: 40.4k]
  ------------------
 3764|  1.03k|    am.mantissa = 0;
 3765|  40.4k|  } else {
 3766|  40.4k|    am.mantissa >>= shift;
 3767|  40.4k|  }
 3768|  41.5k|  am.power2 += shift;
 3769|  41.5k|}
_ZN3glz10fast_float19to_extended_halfwayIdEENS0_17adjusted_mantissaET_:
 3696|  41.5k|to_extended_halfway(T value) noexcept {
 3697|  41.5k|  adjusted_mantissa am = to_extended(value);
 3698|  41.5k|  am.mantissa <<= 1;
 3699|  41.5k|  am.mantissa += 1;
 3700|  41.5k|  am.power2 -= 1;
 3701|  41.5k|  return am;
 3702|  41.5k|}
_ZN3glz10fast_float11to_extendedIdEENS0_17adjusted_mantissaET_:
 3661|  41.5k|to_extended(T value) noexcept {
 3662|  41.5k|  using equiv_uint = equiv_uint_t<T>;
 3663|  41.5k|  constexpr equiv_uint exponent_mask = binary_format<T>::exponent_mask();
 3664|  41.5k|  constexpr equiv_uint mantissa_mask = binary_format<T>::mantissa_mask();
 3665|  41.5k|  constexpr equiv_uint hidden_bit_mask = binary_format<T>::hidden_bit_mask();
 3666|       |
 3667|  41.5k|  adjusted_mantissa am;
 3668|  41.5k|  int32_t bias = binary_format<T>::mantissa_explicit_bits() -
 3669|  41.5k|                 binary_format<T>::minimum_exponent();
 3670|  41.5k|  equiv_uint bits;
 3671|  41.5k|#if GLZ_FASTFLOAT_HAS_BIT_CAST
 3672|  41.5k|  bits = std::bit_cast<equiv_uint>(value);
 3673|       |#else
 3674|       |  ::memcpy(&bits, &value, sizeof(T));
 3675|       |#endif
 3676|  41.5k|  if ((bits & exponent_mask) == 0) {
  ------------------
  |  Branch (3676:7): [True: 5.37k, False: 36.1k]
  ------------------
 3677|       |    // denormal
 3678|  5.37k|    am.power2 = 1 - bias;
 3679|  5.37k|    am.mantissa = bits & mantissa_mask;
 3680|  36.1k|  } else {
 3681|       |    // normal
 3682|  36.1k|    am.power2 = int32_t((bits & exponent_mask) >>
 3683|  36.1k|                        binary_format<T>::mantissa_explicit_bits());
 3684|  36.1k|    am.power2 -= bias;
 3685|  36.1k|    am.mantissa = (bits & mantissa_mask) | hidden_bit_mask;
 3686|  36.1k|  }
 3687|       |
 3688|  41.5k|  return am;
 3689|  41.5k|}
_ZN3glz10fast_float6bigintC2Em:
 3406|  41.5k|  GLZ_FASTFLOAT_CONSTEXPR20 bigint(uint64_t value) : vec() {
 3407|  41.5k|#ifdef GLZ_FASTFLOAT_64BIT_LIMB
 3408|  41.5k|    vec.push_unchecked(value);
 3409|       |#else
 3410|       |    vec.push_unchecked(uint32_t(value));
 3411|       |    vec.push_unchecked(uint32_t(value >> 32));
 3412|       |#endif
 3413|  41.5k|    vec.normalize();
 3414|  41.5k|  }
_ZNK3glz10fast_float6bigint7compareERKS1_:
 3451|  41.5k|  GLZ_FASTFLOAT_CONSTEXPR20 int compare(bigint const &other) const noexcept {
 3452|  41.5k|    if (vec.len() > other.vec.len()) {
  ------------------
  |  Branch (3452:9): [True: 0, False: 41.5k]
  ------------------
 3453|      0|      return 1;
 3454|  41.5k|    } else if (vec.len() < other.vec.len()) {
  ------------------
  |  Branch (3454:16): [True: 0, False: 41.5k]
  ------------------
 3455|      0|      return -1;
 3456|  41.5k|    } else {
 3457|  86.2k|      for (size_t index = vec.len(); index > 0; index--) {
  ------------------
  |  Branch (3457:38): [True: 83.6k, False: 2.65k]
  ------------------
 3458|  83.6k|        limb xi = vec[index - 1];
 3459|  83.6k|        limb yi = other.vec[index - 1];
 3460|  83.6k|        if (xi > yi) {
  ------------------
  |  Branch (3460:13): [True: 13.9k, False: 69.6k]
  ------------------
 3461|  13.9k|          return 1;
 3462|  69.6k|        } else if (xi < yi) {
  ------------------
  |  Branch (3462:20): [True: 24.8k, False: 44.7k]
  ------------------
 3463|  24.8k|          return -1;
 3464|  24.8k|        }
 3465|  83.6k|      }
 3466|  2.65k|      return 0;
 3467|  41.5k|    }
 3468|  41.5k|  }
_ZNK3glz10fast_float8stackvecILt62EEixEm:
 3022|   167k|  GLZ_FASTFLOAT_CONSTEXPR14 const limb &operator[](size_t index) const noexcept {
 3023|   167k|    GLZ_FASTFLOAT_DEBUG_ASSERT(index < length);
  ------------------
  |  |  349|   167k|  { ((void)(x)); }
  ------------------
 3024|   167k|    return data[index];
 3025|   167k|  }
_ZN3glz10fast_float5roundIdZNS0_19negative_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintES3_iEUlRS3_iE0_EEvS6_T0_:
 3707|  41.5k|                                                         callback cb) noexcept {
 3708|  41.5k|  int32_t mantissa_shift = 64 - binary_format<T>::mantissa_explicit_bits() - 1;
 3709|  41.5k|  if (-am.power2 >= mantissa_shift) {
  ------------------
  |  Branch (3709:7): [True: 5.37k, False: 36.1k]
  ------------------
 3710|       |    // have a denormal float
 3711|  5.37k|    int32_t shift = -am.power2 + 1;
 3712|  5.37k|    cb(am, (std::min<int32_t>)(shift, 64));
 3713|       |    // check for round-up: if rounding-nearest carried us to the hidden bit.
 3714|  5.37k|    am.power2 = (am.mantissa <
  ------------------
  |  Branch (3714:17): [True: 5.36k, False: 3]
  ------------------
 3715|  5.37k|                 (uint64_t(1) << binary_format<T>::mantissa_explicit_bits()))
 3716|  5.37k|                    ? 0
 3717|  5.37k|                    : 1;
 3718|  5.37k|    return;
 3719|  5.37k|  }
 3720|       |
 3721|       |  // have a normal float, use the default shift.
 3722|  36.1k|  cb(am, mantissa_shift);
 3723|       |
 3724|       |  // check for carry
 3725|  36.1k|  if (am.mantissa >=
  ------------------
  |  Branch (3725:7): [True: 1.61k, False: 34.5k]
  ------------------
 3726|  36.1k|      (uint64_t(2) << binary_format<T>::mantissa_explicit_bits())) {
 3727|  1.61k|    am.mantissa = (uint64_t(1) << binary_format<T>::mantissa_explicit_bits());
 3728|  1.61k|    am.power2++;
 3729|  1.61k|  }
 3730|       |
 3731|       |  // check for infinite: we could have carried to an infinite power
 3732|  36.1k|  am.mantissa &= ~(uint64_t(1) << binary_format<T>::mantissa_explicit_bits());
 3733|  36.1k|  if (am.power2 >= binary_format<T>::infinite_power()) {
  ------------------
  |  Branch (3733:7): [True: 0, False: 36.1k]
  ------------------
 3734|      0|    am.power2 = binary_format<T>::infinite_power();
 3735|      0|    am.mantissa = 0;
 3736|      0|  }
 3737|  36.1k|}
_ZZN3glz10fast_float19negative_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintES2_iENKUlRS2_iE0_clES5_i:
 4001|  41.5k|  round<T>(answer, [ord](adjusted_mantissa &a, int32_t shift) {
 4002|  41.5k|    round_nearest_tie_even(
 4003|  41.5k|        a, shift, [ord](bool is_odd, bool _, bool __) -> bool {
 4004|  41.5k|          (void)_;  // not needed, since we've done our comparison
 4005|  41.5k|          (void)__; // not needed, since we've done our comparison
 4006|  41.5k|          if (ord > 0) {
 4007|  41.5k|            return true;
 4008|  41.5k|          } else if (ord < 0) {
 4009|  41.5k|            return false;
 4010|  41.5k|          } else {
 4011|  41.5k|            return is_odd;
 4012|  41.5k|          }
 4013|  41.5k|        });
 4014|  41.5k|  });
_ZN3glz10fast_float22round_nearest_tie_evenIZZNS0_19negative_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintES3_iENKUlRS3_iE0_clES6_iEUlbbbE_EEvS6_iT_:
 3742|  41.5k|                       callback cb) noexcept {
 3743|  41.5k|  uint64_t const mask = (shift == 64) ? UINT64_MAX : (uint64_t(1) << shift) - 1;
  ------------------
  |  Branch (3743:25): [True: 1.03k, False: 40.4k]
  ------------------
 3744|  41.5k|  uint64_t const halfway = (shift == 0) ? 0 : uint64_t(1) << (shift - 1);
  ------------------
  |  Branch (3744:28): [True: 0, False: 41.5k]
  ------------------
 3745|  41.5k|  uint64_t truncated_bits = am.mantissa & mask;
 3746|  41.5k|  bool is_above = truncated_bits > halfway;
 3747|  41.5k|  bool is_halfway = truncated_bits == halfway;
 3748|       |
 3749|       |  // shift digits into position
 3750|  41.5k|  if (shift == 64) {
  ------------------
  |  Branch (3750:7): [True: 1.03k, False: 40.4k]
  ------------------
 3751|  1.03k|    am.mantissa = 0;
 3752|  40.4k|  } else {
 3753|  40.4k|    am.mantissa >>= shift;
 3754|  40.4k|  }
 3755|  41.5k|  am.power2 += shift;
 3756|       |
 3757|  41.5k|  bool is_odd = (am.mantissa & 1) == 1;
 3758|  41.5k|  am.mantissa += uint64_t(cb(is_odd, is_halfway, is_above));
 3759|  41.5k|}
_ZZZN3glz10fast_float19negative_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintES2_iENKUlRS2_iE0_clES5_iENKUlbbbE_clEbbb:
 4003|  41.5k|        a, shift, [ord](bool is_odd, bool _, bool __) -> bool {
 4004|  41.5k|          (void)_;  // not needed, since we've done our comparison
 4005|  41.5k|          (void)__; // not needed, since we've done our comparison
 4006|  41.5k|          if (ord > 0) {
  ------------------
  |  Branch (4006:15): [True: 13.9k, False: 27.5k]
  ------------------
 4007|  13.9k|            return true;
 4008|  27.5k|          } else if (ord < 0) {
  ------------------
  |  Branch (4008:22): [True: 24.8k, False: 2.65k]
  ------------------
 4009|  24.8k|            return false;
 4010|  24.8k|          } else {
 4011|  2.65k|            return is_odd;
 4012|  2.65k|          }
 4013|  41.5k|        });
_ZN3glz10fast_float8to_floatIdEEvbNS0_17adjusted_mantissaERT_:
 1131|   126k|to_float(bool negative, adjusted_mantissa am, T &value) {
 1132|   126k|  using equiv_uint = equiv_uint_t<T>;
 1133|   126k|  equiv_uint word = equiv_uint(am.mantissa);
 1134|   126k|  word = equiv_uint(word | equiv_uint(am.power2)
 1135|   126k|                               << binary_format<T>::mantissa_explicit_bits());
 1136|   126k|  word =
 1137|   126k|      equiv_uint(word | equiv_uint(negative) << binary_format<T>::sign_index());
 1138|   126k|#if GLZ_FASTFLOAT_HAS_BIT_CAST
 1139|   126k|  value = std::bit_cast<T>(word);
 1140|       |#else
 1141|       |  ::memcpy(&value, &word, sizeof(T));
 1142|       |#endif
 1143|   126k|}
_ZN3glz10fast_float13binary_formatIdE10sign_indexEv:
  758|   126k|template <> inline constexpr int binary_format<double>::sign_index() {
  759|   126k|  return 63;
  760|   126k|}
_ZN3glz10fast_float13binary_formatIdE14infinite_powerEv:
  750|   314k|template <> inline constexpr int binary_format<double>::infinite_power() {
  751|   314k|  return 0x7FF;
  752|   314k|}

_ZN3glz8for_eachILm6EZNS_28process_variant_alternativesINSt3__17variantIJDndNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbNS2_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS7_ISE_EEEENSD_ISE_EEEEENS_16is_variant_arrayEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSI_TkNS_10is_contextERNS_7contextERPKcSR_EEvOT0_OT1_OT2_T3_EUlTnmvE_EEvSU_:
   27|  1.76M|   {
   28|  1.76M|      if constexpr (N > 0) {
   29|       |         // Explicit sizes for small N to help the compiler and make debugging easier
   30|       |         // These generate less assembly with O0, but make no difference for higher optimization
   31|       |         if constexpr (N == 1) {
   32|       |            lambda.template operator()<0>();
   33|       |         }
   34|       |         else if constexpr (N == 2) {
   35|       |            lambda.template operator()<0>();
   36|       |            lambda.template operator()<1>();
   37|       |         }
   38|       |         else if constexpr (N == 3) {
   39|       |            lambda.template operator()<0>();
   40|       |            lambda.template operator()<1>();
   41|       |            lambda.template operator()<2>();
   42|       |         }
   43|       |         else if constexpr (N == 4) {
   44|       |            lambda.template operator()<0>();
   45|       |            lambda.template operator()<1>();
   46|       |            lambda.template operator()<2>();
   47|       |            lambda.template operator()<3>();
   48|       |         }
   49|  1.76M|         else {
   50|  1.76M|            [&]<size_t... I>(std::index_sequence<I...>) {
   51|  1.76M|               (void)(lambda.template operator()<I>(), ...);
   52|  1.76M|            }(std::make_index_sequence<N>{});
   53|  1.76M|         }
   54|  1.76M|      }
   55|  1.76M|   }
_ZZN3glz8for_eachILm6EZNS_28process_variant_alternativesINSt3__17variantIJDndNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbNS2_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS7_ISE_EEEENSD_ISE_EEEEENS_16is_variant_arrayEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSI_TkNS_10is_contextERNS_7contextERPKcSR_EEvOT0_OT1_OT2_T3_EUlTnmvE_EEvSU_ENKUlTpTnmNS2_16integer_sequenceImJXspT_EEEEE_clIJLm0ELm1ELm2ELm3ELm4ELm5EEEEDaS12_:
   50|  1.76M|            [&]<size_t... I>(std::index_sequence<I...>) {
   51|  1.76M|               (void)(lambda.template operator()<I>(), ...);
   52|  1.76M|            }(std::make_index_sequence<N>{});
_ZN3glz8for_eachILm6EZNS_28process_variant_alternativesINSt3__17variantIJDndNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbNS2_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS7_ISE_EEEENSD_ISE_EEEEENS_14is_variant_strEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSI_TkNS_10is_contextERNS_7contextERPKcSR_EEvOT0_OT1_OT2_T3_EUlTnmvE_EEvSU_:
   27|  31.1k|   {
   28|  31.1k|      if constexpr (N > 0) {
   29|       |         // Explicit sizes for small N to help the compiler and make debugging easier
   30|       |         // These generate less assembly with O0, but make no difference for higher optimization
   31|       |         if constexpr (N == 1) {
   32|       |            lambda.template operator()<0>();
   33|       |         }
   34|       |         else if constexpr (N == 2) {
   35|       |            lambda.template operator()<0>();
   36|       |            lambda.template operator()<1>();
   37|       |         }
   38|       |         else if constexpr (N == 3) {
   39|       |            lambda.template operator()<0>();
   40|       |            lambda.template operator()<1>();
   41|       |            lambda.template operator()<2>();
   42|       |         }
   43|       |         else if constexpr (N == 4) {
   44|       |            lambda.template operator()<0>();
   45|       |            lambda.template operator()<1>();
   46|       |            lambda.template operator()<2>();
   47|       |            lambda.template operator()<3>();
   48|       |         }
   49|  31.1k|         else {
   50|  31.1k|            [&]<size_t... I>(std::index_sequence<I...>) {
   51|  31.1k|               (void)(lambda.template operator()<I>(), ...);
   52|  31.1k|            }(std::make_index_sequence<N>{});
   53|  31.1k|         }
   54|  31.1k|      }
   55|  31.1k|   }
_ZZN3glz8for_eachILm6EZNS_28process_variant_alternativesINSt3__17variantIJDndNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbNS2_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS7_ISE_EEEENSD_ISE_EEEEENS_14is_variant_strEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSI_TkNS_10is_contextERNS_7contextERPKcSR_EEvOT0_OT1_OT2_T3_EUlTnmvE_EEvSU_ENKUlTpTnmNS2_16integer_sequenceImJXspT_EEEEE_clIJLm0ELm1ELm2ELm3ELm4ELm5EEEEDaS12_:
   50|  31.1k|            [&]<size_t... I>(std::index_sequence<I...>) {
   51|  31.1k|               (void)(lambda.template operator()<I>(), ...);
   52|  31.1k|            }(std::make_index_sequence<N>{});
_ZN3glz8for_eachILm6EZNS_28process_variant_alternativesINSt3__17variantIJDndNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbNS2_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS7_ISE_EEEENSD_ISE_EEEEENS_15is_variant_boolEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSI_TkNS_10is_contextERNS_7contextERPKcSR_EEvOT0_OT1_OT2_T3_EUlTnmvE_EEvSU_:
   27|  4.71k|   {
   28|  4.71k|      if constexpr (N > 0) {
   29|       |         // Explicit sizes for small N to help the compiler and make debugging easier
   30|       |         // These generate less assembly with O0, but make no difference for higher optimization
   31|       |         if constexpr (N == 1) {
   32|       |            lambda.template operator()<0>();
   33|       |         }
   34|       |         else if constexpr (N == 2) {
   35|       |            lambda.template operator()<0>();
   36|       |            lambda.template operator()<1>();
   37|       |         }
   38|       |         else if constexpr (N == 3) {
   39|       |            lambda.template operator()<0>();
   40|       |            lambda.template operator()<1>();
   41|       |            lambda.template operator()<2>();
   42|       |         }
   43|       |         else if constexpr (N == 4) {
   44|       |            lambda.template operator()<0>();
   45|       |            lambda.template operator()<1>();
   46|       |            lambda.template operator()<2>();
   47|       |            lambda.template operator()<3>();
   48|       |         }
   49|  4.71k|         else {
   50|  4.71k|            [&]<size_t... I>(std::index_sequence<I...>) {
   51|  4.71k|               (void)(lambda.template operator()<I>(), ...);
   52|  4.71k|            }(std::make_index_sequence<N>{});
   53|  4.71k|         }
   54|  4.71k|      }
   55|  4.71k|   }
_ZZN3glz8for_eachILm6EZNS_28process_variant_alternativesINSt3__17variantIJDndNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbNS2_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS7_ISE_EEEENSD_ISE_EEEEENS_15is_variant_boolEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSI_TkNS_10is_contextERNS_7contextERPKcSR_EEvOT0_OT1_OT2_T3_EUlTnmvE_EEvSU_ENKUlTpTnmNS2_16integer_sequenceImJXspT_EEEEE_clIJLm0ELm1ELm2ELm3ELm4ELm5EEEEDaS12_:
   50|  4.71k|            [&]<size_t... I>(std::index_sequence<I...>) {
   51|  4.71k|               (void)(lambda.template operator()<I>(), ...);
   52|  4.71k|            }(std::make_index_sequence<N>{});
_ZN3glz8for_eachILm6EZNS_28process_variant_alternativesINSt3__17variantIJDndNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbNS2_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS7_ISE_EEEENSD_ISE_EEEEENS_14is_variant_numEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSI_TkNS_10is_contextERNS_7contextERPKcSR_EEvOT0_OT1_OT2_T3_EUlTnmvE_EEvSU_:
   27|  6.47M|   {
   28|  6.47M|      if constexpr (N > 0) {
   29|       |         // Explicit sizes for small N to help the compiler and make debugging easier
   30|       |         // These generate less assembly with O0, but make no difference for higher optimization
   31|       |         if constexpr (N == 1) {
   32|       |            lambda.template operator()<0>();
   33|       |         }
   34|       |         else if constexpr (N == 2) {
   35|       |            lambda.template operator()<0>();
   36|       |            lambda.template operator()<1>();
   37|       |         }
   38|       |         else if constexpr (N == 3) {
   39|       |            lambda.template operator()<0>();
   40|       |            lambda.template operator()<1>();
   41|       |            lambda.template operator()<2>();
   42|       |         }
   43|       |         else if constexpr (N == 4) {
   44|       |            lambda.template operator()<0>();
   45|       |            lambda.template operator()<1>();
   46|       |            lambda.template operator()<2>();
   47|       |            lambda.template operator()<3>();
   48|       |         }
   49|  6.47M|         else {
   50|  6.47M|            [&]<size_t... I>(std::index_sequence<I...>) {
   51|  6.47M|               (void)(lambda.template operator()<I>(), ...);
   52|  6.47M|            }(std::make_index_sequence<N>{});
   53|  6.47M|         }
   54|  6.47M|      }
   55|  6.47M|   }
_ZZN3glz8for_eachILm6EZNS_28process_variant_alternativesINSt3__17variantIJDndNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbNS2_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS7_ISE_EEEENSD_ISE_EEEEENS_14is_variant_numEE2opITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEERSI_TkNS_10is_contextERNS_7contextERPKcSR_EEvOT0_OT1_OT2_T3_EUlTnmvE_EEvSU_ENKUlTpTnmNS2_16integer_sequenceImJXspT_EEEEE_clIJLm0ELm1ELm2ELm3ELm4ELm5EEEEDaS12_:
   50|  6.47M|            [&]<size_t... I>(std::index_sequence<I...>) {
   51|  6.47M|               (void)(lambda.template operator()<I>(), ...);
   52|  6.47M|            }(std::make_index_sequence<N>{});

_ZN3glz10from_charsILb0EdcEENS_10fast_float19from_chars_result_tIT1_EEPKS3_S6_RT0_:
  235|  6.47M|   {
  236|  6.47M|      using namespace glz::fast_float;
  237|  6.47M|      static_assert(is_supported_float_type<T>(), "only some floating-point types are supported");
  238|  6.47M|      static_assert(is_supported_char_type<UC>(), "only char, wchar_t, char16_t and char32_t are supported");
  239|       |
  240|  6.47M|      parsed_number_string_t<UC> pns = glz::parse_number_string<null_terminated, UC>(first, last);
  241|  6.47M|      if (!pns.valid) [[unlikely]] {
  ------------------
  |  Branch (241:11): [True: 3.56k, False: 6.47M]
  ------------------
  242|  3.56k|         return {.ptr = first, .ec = std::errc::invalid_argument};
  243|  3.56k|      }
  244|       |
  245|  6.47M|      return from_chars_advanced(pns, value);
  246|  6.47M|   }
_ZN3glz19parse_number_stringILb0EcEENS_10fast_float22parsed_number_string_tIT0_EEPKS3_S6_:
   18|  6.47M|   {
   19|  6.47M|      using namespace glz::fast_float;
   20|  6.47M|      static constexpr UC decimal_point = '.';
   21|       |
   22|  6.47M|      parsed_number_string_t<UC> answer;
   23|  6.47M|      answer.valid = false;
   24|  6.47M|      answer.too_many_digits = false;
   25|  6.47M|      answer.negative = (*p == UC('-'));
   26|  6.47M|      if (*p == UC('-')) { // C++17 20.19.3.(7.1) explicitly forbids '+' sign here
  ------------------
  |  Branch (26:11): [True: 8.02k, False: 6.47M]
  ------------------
   27|  8.02k|         ++p;
   28|       |
   29|  8.02k|         if constexpr (not null_terminated) {
   30|  8.02k|            if (p == pend) [[unlikely]] {
  ------------------
  |  Branch (30:17): [True: 8, False: 8.01k]
  ------------------
   31|      8|               return answer;
   32|      8|            }
   33|  8.02k|         }
   34|       |
   35|  8.02k|         if (!glz::fast_float::is_integer(*p)) [[unlikely]] { // a sign must be followed by an integer
  ------------------
  |  Branch (35:14): [True: 61, False: 7.96k]
  ------------------
   36|     61|            return answer;
   37|     61|         }
   38|  8.02k|      }
   39|  6.47M|      UC const* const start_digits = p;
   40|       |
   41|  6.47M|      uint64_t i = 0; // an unsigned int avoids signed overflows (which are bad)
   42|       |
   43|  6.47M|      uint64_t digit;
   44|       |      if constexpr (null_terminated) {
   45|       |         while ((digit = glz::fast_float::digit_value(*p)) <= 9) {
   46|       |            // a multiplication by 10 is cheaper than an arbitrary integer
   47|       |            // multiplication
   48|       |            i = 10 * i + digit; // might overflow, we will handle the overflow later
   49|       |            ++p;
   50|       |         }
   51|       |      }
   52|  6.47M|      else {
   53|  33.0M|         while ((p != pend) && (digit = glz::fast_float::digit_value(*p)) <= 9) {
  ------------------
  |  Branch (53:17): [True: 33.0M, False: 1.06k]
  |  Branch (53:32): [True: 26.5M, False: 6.47M]
  ------------------
   54|       |            // a multiplication by 10 is cheaper than an arbitrary integer
   55|       |            // multiplication
   56|  26.5M|            i = 10 * i + digit; // might overflow, we will handle the overflow later
   57|  26.5M|            ++p;
   58|  26.5M|         }
   59|  6.47M|      }
   60|       |
   61|  6.47M|      UC const* const end_of_integer_part = p;
   62|  6.47M|      int64_t digit_count = int64_t(end_of_integer_part - start_digits);
   63|  6.47M|      answer.integer = glz::fast_float::span<const UC>(start_digits, size_t(digit_count));
   64|       |
   65|       |      // at least 1 digit in integer part, without leading zeros
   66|  6.47M|      if (digit_count == 0 || (start_digits[0] == UC('0') && digit_count > 1)) {
  ------------------
  |  Branch (66:11): [True: 3.17k, False: 6.47M]
  |  Branch (66:32): [True: 2.79M, False: 3.68M]
  |  Branch (66:62): [True: 144, False: 2.79M]
  ------------------
   67|  3.30k|         return answer;
   68|  3.30k|      }
   69|       |
   70|  6.47M|      int64_t exponent = 0;
   71|  6.47M|      const bool has_decimal_point = [&] {
   72|  6.47M|         if constexpr (null_terminated) {
   73|  6.47M|            return (*p == decimal_point);
   74|  6.47M|         }
   75|  6.47M|         else {
   76|  6.47M|            return (p != pend) && (*p == decimal_point);
   77|  6.47M|         }
   78|  6.47M|      }();
   79|  6.47M|      if (has_decimal_point) {
  ------------------
  |  Branch (79:11): [True: 47.7k, False: 6.42M]
  ------------------
   80|  47.7k|         ++p;
   81|  47.7k|         UC const* before = p;
   82|       |         // can occur at most twice without overflowing, but let it occur more, since
   83|       |         // for integers with many digits, digit parsing is the primary bottleneck.
   84|  47.7k|         loop_parse_if_eight_digits(p, pend, i);
   85|       |
   86|       |         if constexpr (null_terminated) {
   87|       |            while ((digit = glz::fast_float::digit_value(*p)) <= 9) {
   88|       |               ++p;
   89|       |               i = i * 10 + digit; // in rare cases, this will overflow, but that's ok
   90|       |            }
   91|       |         }
   92|  47.7k|         else {
   93|   186k|            while ((p != pend) && (digit = glz::fast_float::digit_value(*p)) <= 9) {
  ------------------
  |  Branch (93:20): [True: 185k, False: 1.06k]
  |  Branch (93:35): [True: 138k, False: 46.7k]
  ------------------
   94|   138k|               ++p;
   95|   138k|               i = i * 10 + digit; // in rare cases, this will overflow, but that's ok
   96|   138k|            }
   97|  47.7k|         }
   98|  47.7k|         exponent = before - p;
   99|  47.7k|         answer.fraction = glz::fast_float::span<const UC>(before, size_t(p - before));
  100|  47.7k|         digit_count -= exponent;
  101|  47.7k|      }
  102|       |      // at least 1 digit in fractional part
  103|  6.47M|      if (has_decimal_point && exponent == 0) {
  ------------------
  |  Branch (103:11): [True: 47.7k, False: 6.42M]
  |  Branch (103:32): [True: 63, False: 47.7k]
  ------------------
  104|     63|         return answer;
  105|     63|      }
  106|       |
  107|  6.47M|      int64_t exp_number = 0; // explicit exponential part
  108|       |
  109|       |      // An exponent marker must be followed by at least one digit, after an optional sign. Unlike
  110|       |      // std::from_chars, which ends the number before a digitless marker, "1e", "1e+" and "1.0E-" are
  111|       |      // rejected: ending early would read "1.0e" as 1 wherever trailing content goes unchecked.
  112|       |      if constexpr (null_terminated) {
  113|       |         if ((UC('e') == *p) || (UC('E') == *p)) {
  114|       |            ++p;
  115|       |            bool neg_exp = false;
  116|       |            if (UC('-') == *p) {
  117|       |               neg_exp = true;
  118|       |               ++p;
  119|       |            }
  120|       |            else if (UC('+') == *p) { // '+' on exponent is allowed by C++17 20.19.3.(7.1)
  121|       |               ++p;
  122|       |            }
  123|       |            if ((digit = glz::fast_float::digit_value(*p)) > 9) [[unlikely]] {
  124|       |               return answer;
  125|       |            }
  126|       |            else {
  127|       |               do {
  128|       |                  if (exp_number < 0x10000000) {
  129|       |                     exp_number = 10 * exp_number + digit;
  130|       |                  }
  131|       |                  ++p;
  132|       |               } while ((digit = glz::fast_float::digit_value(*p)) <= 9);
  133|       |               if (neg_exp) {
  134|       |                  exp_number = -exp_number;
  135|       |               }
  136|       |               exponent += exp_number;
  137|       |            }
  138|       |         }
  139|       |      }
  140|  6.47M|      else {
  141|  6.47M|         if ((p != pend) && ((UC('e') == *p) || (UC('E') == *p))) {
  ------------------
  |  Branch (141:14): [True: 6.47M, False: 2.10k]
  |  Branch (141:30): [True: 22.4k, False: 6.45M]
  |  Branch (141:49): [True: 23.8k, False: 6.42M]
  ------------------
  142|  46.3k|            ++p;
  143|  46.3k|            bool neg_exp = false;
  144|  46.3k|            if ((p != pend) && (UC('-') == *p)) {
  ------------------
  |  Branch (144:17): [True: 46.3k, False: 10]
  |  Branch (144:32): [True: 24.4k, False: 21.9k]
  ------------------
  145|  24.4k|               neg_exp = true;
  146|  24.4k|               ++p;
  147|  24.4k|            }
  148|  21.9k|            else if ((p != pend) && (UC('+') == *p)) { // '+' on exponent is allowed by C++17 20.19.3.(7.1)
  ------------------
  |  Branch (148:22): [True: 21.9k, False: 10]
  |  Branch (148:37): [True: 1.72k, False: 20.2k]
  ------------------
  149|  1.72k|               ++p;
  150|  1.72k|            }
  151|  46.3k|            if ((p == pend) || (digit = glz::fast_float::digit_value(*p)) > 9) [[unlikely]] {
  ------------------
  |  Branch (151:17): [True: 24, False: 46.3k]
  |  Branch (151:32): [True: 105, False: 46.2k]
  ------------------
  152|    129|               return answer;
  153|    129|            }
  154|  46.2k|            else {
  155|   122k|               do {
  156|   122k|                  if (exp_number < 0x10000000) {
  ------------------
  |  Branch (156:23): [True: 120k, False: 1.83k]
  ------------------
  157|   120k|                     exp_number = 10 * exp_number + digit;
  158|   120k|                  }
  159|   122k|                  ++p;
  160|   122k|               } while ((p != pend) && (digit = glz::fast_float::digit_value(*p)) <= 9);
  ------------------
  |  Branch (160:25): [True: 121k, False: 1.26k]
  |  Branch (160:40): [True: 76.2k, False: 44.9k]
  ------------------
  161|  46.2k|               if (neg_exp) {
  ------------------
  |  Branch (161:20): [True: 24.4k, False: 21.8k]
  ------------------
  162|  24.4k|                  exp_number = -exp_number;
  163|  24.4k|               }
  164|  46.2k|               exponent += exp_number;
  165|  46.2k|            }
  166|  46.3k|         }
  167|  6.47M|      }
  168|       |
  169|  6.47M|      answer.lastmatch = p;
  170|  6.47M|      answer.valid = true;
  171|       |
  172|       |      // If we frequently had to deal with long strings of digits,
  173|       |      // we could extend our code by using a 128-bit integer instead
  174|       |      // of a 64-bit integer. However, this is uncommon.
  175|       |      //
  176|       |      // We can deal with up to 19 digits.
  177|  6.47M|      if (digit_count > 19) { // this is uncommon
  ------------------
  |  Branch (177:11): [True: 70.2k, False: 6.40M]
  ------------------
  178|       |         // It is possible that the integer had an overflow.
  179|       |         // We have to handle the case where we have 0.0000somenumber.
  180|       |         // We need to be mindful of the case where we only have zeroes...
  181|       |         // E.g., 0.000000000...000.
  182|  70.2k|         UC const* start = start_digits;
  183|       |         if constexpr (null_terminated) {
  184|       |            while ((*start == UC('0') || *start == decimal_point)) {
  185|       |               if (*start == UC('0')) {
  186|       |                  --digit_count;
  187|       |               }
  188|       |               ++start;
  189|       |            }
  190|       |         }
  191|  70.2k|         else {
  192|  3.64M|            while ((start != pend) && (*start == UC('0') || *start == decimal_point)) {
  ------------------
  |  Branch (192:20): [True: 3.64M, False: 26]
  |  Branch (192:40): [True: 3.55M, False: 92.4k]
  |  Branch (192:61): [True: 22.2k, False: 70.2k]
  ------------------
  193|  3.57M|               if (*start == UC('0')) {
  ------------------
  |  Branch (193:20): [True: 3.55M, False: 22.2k]
  ------------------
  194|  3.55M|                  --digit_count;
  195|  3.55M|               }
  196|  3.57M|               ++start;
  197|  3.57M|            }
  198|  70.2k|         }
  199|       |
  200|  70.2k|         if (digit_count > 19) {
  ------------------
  |  Branch (200:14): [True: 69.0k, False: 1.22k]
  ------------------
  201|  69.0k|            answer.too_many_digits = true;
  202|       |            // Let us start again, this time, avoiding overflows.
  203|       |            // We don't need to check if is_integer, since we use the
  204|       |            // pre-tokenized spans from above.
  205|  69.0k|            i = 0;
  206|  69.0k|            p = answer.integer.ptr;
  207|  69.0k|            UC const* int_end = p + answer.integer.len();
  208|  69.0k|            const uint64_t minimal_nineteen_digit_integer{1000000000000000000};
  209|  1.10M|            while ((i < minimal_nineteen_digit_integer) && (p != int_end)) {
  ------------------
  |  Branch (209:20): [True: 1.06M, False: 46.5k]
  |  Branch (209:60): [True: 1.03M, False: 22.4k]
  ------------------
  210|  1.03M|               i = i * 10 + uint64_t(*p - UC('0'));
  211|  1.03M|               ++p;
  212|  1.03M|            }
  213|  69.0k|            if (i >= minimal_nineteen_digit_integer) { // We have a big integers
  ------------------
  |  Branch (213:17): [True: 46.5k, False: 22.4k]
  ------------------
  214|  46.5k|               exponent = end_of_integer_part - p + exp_number;
  215|  46.5k|            }
  216|  22.4k|            else { // We have a value with a fractional component.
  217|  22.4k|               p = answer.fraction.ptr;
  218|  22.4k|               UC const* frac_end = p + answer.fraction.len();
  219|   321k|               while ((i < minimal_nineteen_digit_integer) && (p != frac_end)) {
  ------------------
  |  Branch (219:23): [True: 299k, False: 22.4k]
  |  Branch (219:63): [True: 299k, False: 0]
  ------------------
  220|   299k|                  i = i * 10 + uint64_t(*p - UC('0'));
  221|   299k|                  ++p;
  222|   299k|               }
  223|  22.4k|               exponent = answer.fraction.ptr - p + exp_number;
  224|  22.4k|            }
  225|       |            // We have now corrected both exponent and i, to a truncated value
  226|  69.0k|         }
  227|  70.2k|      }
  228|  6.47M|      answer.exponent = exponent;
  229|  6.47M|      answer.mantissa = i;
  230|  6.47M|      return answer;
  231|  6.47M|   }
_ZZN3glz19parse_number_stringILb0EcEENS_10fast_float22parsed_number_string_tIT0_EEPKS3_S6_ENKUlvE_clEv:
   71|  6.47M|      const bool has_decimal_point = [&] {
   72|       |         if constexpr (null_terminated) {
   73|       |            return (*p == decimal_point);
   74|       |         }
   75|  6.47M|         else {
   76|  6.47M|            return (p != pend) && (*p == decimal_point);
  ------------------
  |  Branch (76:20): [True: 6.47M, False: 1.03k]
  |  Branch (76:35): [True: 47.7k, False: 6.42M]
  ------------------
   77|  6.47M|         }
   78|  6.47M|      }();

_ZN3glz7skip_wsIXtlNS_7ws_optsEEETkNS_10is_contextERNS_7contextERPKcS5_EEbOT0_OT1_T2_:
  663|  26.5M|   {
  664|  26.5M|      using namespace glz::detail;
  665|       |
  666|  26.5M|      if constexpr (not Opts.minified) {
  667|       |         if constexpr (Opts.null_terminated) {
  668|       |            if constexpr (Opts.comments) {
  669|       |               while (whitespace_comment_table[uint8_t(*it)]) {
  670|       |                  if (*it == '/') [[unlikely]] {
  671|       |                     skip_comment(ctx, it, end);
  672|       |                     if (bool(ctx.error)) [[unlikely]] {
  673|       |                        return true;
  674|       |                     }
  675|       |                  }
  676|       |                  else [[likely]] {
  677|       |                     ++it;
  678|       |                  }
  679|       |               }
  680|       |            }
  681|       |            else {
  682|       |               while (whitespace_table[uint8_t(*it)]) {
  683|       |                  ++it;
  684|       |               }
  685|       |            }
  686|       |         }
  687|  26.5M|         else {
  688|       |            if constexpr (Opts.comments) {
  689|       |               while (it < end && whitespace_comment_table[uint8_t(*it)]) {
  690|       |                  if (*it == '/') [[unlikely]] {
  691|       |                     skip_comment(ctx, it, end);
  692|       |                     if (bool(ctx.error)) [[unlikely]] {
  693|       |                        return true;
  694|       |                     }
  695|       |                  }
  696|       |                  else [[likely]] {
  697|       |                     ++it;
  698|       |                  }
  699|       |               }
  700|       |               if (it == end) [[unlikely]] {
  701|       |                  ctx.error = error_code::end_reached;
  702|       |                  return true;
  703|       |               }
  704|       |            }
  705|  26.5M|            else {
  706|  45.3M|               while (it < end && whitespace_table[uint8_t(*it)]) {
  ------------------
  |  Branch (706:23): [True: 45.3M, False: 1.57k]
  |  Branch (706:35): [True: 18.8M, False: 26.5M]
  ------------------
  707|  18.8M|                  ++it;
  708|  18.8M|               }
  709|  26.5M|               if (it == end) [[unlikely]] {
  ------------------
  |  Branch (709:20): [True: 1.57k, False: 26.5M]
  ------------------
  710|  1.57k|                  ctx.error = error_code::end_reached;
  711|  1.57k|                  return true;
  712|  1.57k|               }
  713|  26.5M|            }
  714|  26.5M|         }
  715|       |      }
  716|       |      else if constexpr (not Opts.null_terminated) {
  717|       |         // Minified input has no whitespace to skip, but a non-null-terminated buffer can still
  718|       |         // be exhausted at this point. The non-minified branch above performs the same check; a
  719|       |         // null-terminated buffer relies on the trailing sentinel and keeps this a pure no-op.
  720|       |         if (it == end) [[unlikely]] {
  721|       |            ctx.error = error_code::end_reached;
  722|       |            return true;
  723|       |         }
  724|       |      }
  725|       |
  726|  26.5M|      return false;
  727|  26.5M|   }
_ZN3glz17match_invalid_endILc44EXtlNS_22match_invalid_end_optsEEETkNS_10is_contextENS_7contextERPKcS4_EEbRT1_OT2_T3_:
  470|  3.22M|   {
  471|  3.22M|      if (*it != C) [[unlikely]] {
  ------------------
  |  Branch (471:11): [True: 1.69k, False: 3.22M]
  ------------------
  472|       |         if constexpr (C == '"') {
  473|       |            ctx.error = error_code::expected_quote;
  474|       |         }
  475|  1.69k|         else if constexpr (C == ',') {
  476|  1.69k|            ctx.error = error_code::expected_comma;
  477|       |         }
  478|       |         else if constexpr (C == ':') {
  479|       |            ctx.error = error_code::expected_colon;
  480|       |         }
  481|       |         else if constexpr (C == '[' || C == ']') {
  482|       |            ctx.error = error_code::expected_bracket;
  483|       |         }
  484|       |         else if constexpr (C == '{' || C == '}') {
  485|       |            ctx.error = error_code::expected_brace;
  486|       |         }
  487|       |         else {
  488|       |            ctx.error = error_code::syntax_error;
  489|       |         }
  490|  1.69k|         return true;
  491|  1.69k|      }
  492|  3.22M|      else [[likely]] {
  493|  3.22M|         ++it;
  494|  3.22M|      }
  495|  3.22M|      if constexpr (not Opts.null_terminated) {
  496|  3.22M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 146, False: 3.22M]
  ------------------
  497|    146|            ctx.error = error_code::unexpected_end;
  498|    146|            return true;
  499|    146|         }
  500|  3.22M|      }
  501|  3.22M|      return false;
  502|  3.22M|   }
_ZN3glz17match_invalid_endILc34EXtlNS_22match_invalid_end_optsEEETkNS_10is_contextENS_7contextERPKcS4_EEbRT1_OT2_T3_:
  470|  3.32M|   {
  471|  3.32M|      if (*it != C) [[unlikely]] {
  ------------------
  |  Branch (471:11): [True: 946, False: 3.32M]
  ------------------
  472|    946|         if constexpr (C == '"') {
  473|    946|            ctx.error = error_code::expected_quote;
  474|       |         }
  475|       |         else if constexpr (C == ',') {
  476|       |            ctx.error = error_code::expected_comma;
  477|       |         }
  478|       |         else if constexpr (C == ':') {
  479|       |            ctx.error = error_code::expected_colon;
  480|       |         }
  481|       |         else if constexpr (C == '[' || C == ']') {
  482|       |            ctx.error = error_code::expected_bracket;
  483|       |         }
  484|       |         else if constexpr (C == '{' || C == '}') {
  485|       |            ctx.error = error_code::expected_brace;
  486|       |         }
  487|       |         else {
  488|       |            ctx.error = error_code::syntax_error;
  489|       |         }
  490|    946|         return true;
  491|    946|      }
  492|  3.32M|      else [[likely]] {
  493|  3.32M|         ++it;
  494|  3.32M|      }
  495|  3.32M|      if constexpr (not Opts.null_terminated) {
  496|  3.32M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 170, False: 3.32M]
  ------------------
  497|    170|            ctx.error = error_code::unexpected_end;
  498|    170|            return true;
  499|    170|         }
  500|  3.32M|      }
  501|  3.32M|      return false;
  502|  3.32M|   }
_ZN3glz9chunk_minILm8EEElb:
   47|  3.32M|   {
   48|  3.32M|      static_assert(Width <= padding_bytes);
   49|  3.32M|      return padded ? 1 : std::ptrdiff_t(Width);
  ------------------
  |  Branch (49:14): [True: 0, False: 3.32M]
  ------------------
   50|  3.32M|   }
_ZN3glz18validate_utf8_spanITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEETkNS_10is_contextERNS_7contextEccEEbOT0_PKT1_PKT2_m:
  873|  3.29M|   {
  874|       |      if constexpr (not check_validate_utf8(Opts)) {
  875|       |         // Everything the caller computed for us is dead, which lets its scan loop drop the
  876|       |         // accumulator entirely.
  877|       |         (void)ctx, (void)start, (void)fin, (void)ascii_acc;
  878|       |         return false;
  879|       |      }
  880|  3.29M|      else {
  881|  3.29M|         if ((ascii_acc & repeat_byte8(0b10000000)) == 0) {
  ------------------
  |  Branch (881:14): [True: 3.13M, False: 154k]
  ------------------
  882|  3.13M|            return false; // pure ASCII is trivially well formed UTF-8
  883|  3.13M|         }
  884|   154k|         if (!validate_utf8(start, size_t(fin - start))) [[unlikely]] {
  ------------------
  |  Branch (884:14): [True: 560, False: 153k]
  ------------------
  885|    560|            ctx.error = error_code::invalid_utf8;
  886|    560|            return true;
  887|    560|         }
  888|   153k|         return false;
  889|   154k|      }
  890|  3.29M|   }
_ZN3glz13validate_utf8IcEEbPKT_m:
  842|   168k|   {
  843|   168k|      const uint8_t* it = reinterpret_cast<const uint8_t*>(str);
  844|   168k|      const uint8_t* const end = it + size;
  845|       |#if defined(GLZ_UTF8_SIMD)
  846|       |      // 16 is a measured compromise, not a register-size coincidence. The scalar path skips ASCII 8
  847|       |      // bytes at a time, so on ASCII it stays ahead of the vector path's fixed setup cost until the
  848|       |      // input is long enough for the 64 byte ASCII step to engage; on non-ASCII the vector path
  849|       |      // wins from roughly 8 bytes. Raising the threshold buys a few percent on short ASCII and
  850|       |      // costs up to 2.3x on mid length non-ASCII strings, so it stays low.
  851|       |      if (size >= 16) {
  852|       |         return detail::utf8_simd::validate(it, end);
  853|       |      }
  854|       |#endif
  855|   168k|      return validate_utf8_scalar(it, end);
  856|   168k|   }
_ZN3glz20validate_utf8_scalarEPKhS1_:
  793|   168k|   {
  794|  5.58M|      while (it < end) {
  ------------------
  |  Branch (794:14): [True: 5.41M, False: 166k]
  ------------------
  795|       |         // Optimistic SWAR check for ASCII
  796|  5.41M|         if (it + 8 <= end) {
  ------------------
  |  Branch (796:14): [True: 5.06M, False: 350k]
  ------------------
  797|  5.06M|            uint64_t chunk;
  798|  5.06M|            std::memcpy(&chunk, it, 8);
  799|  5.06M|            if ((chunk & glz::repeat_byte8(0x80)) == 0) {
  ------------------
  |  Branch (799:17): [True: 4.95M, False: 108k]
  ------------------
  800|  4.95M|               it += 8;
  801|  4.95M|               continue;
  802|  4.95M|            }
  803|  5.06M|         }
  804|       |
  805|       |         // Byte-by-byte validation (standard conformant)
  806|   458k|         uint8_t byte = *it;
  807|       |
  808|   458k|         if (byte < 0x80) {
  ------------------
  |  Branch (808:14): [True: 324k, False: 134k]
  ------------------
  809|   324k|            it++;
  810|   324k|         }
  811|   134k|         else if ((byte & 0xE0) == 0xC0) {
  ------------------
  |  Branch (811:19): [True: 117k, False: 16.7k]
  ------------------
  812|       |            // 2-byte sequence
  813|   117k|            if (it + 2 > end || (it[1] & 0xC0) != 0x80) return false;
  ------------------
  |  Branch (813:17): [True: 46, False: 117k]
  |  Branch (813:33): [True: 98, False: 117k]
  ------------------
  814|   117k|            if (byte < 0xC2) return false; // Overlong
  ------------------
  |  Branch (814:17): [True: 42, False: 117k]
  ------------------
  815|   117k|            it += 2;
  816|   117k|         }
  817|  16.7k|         else if ((byte & 0xF0) == 0xE0) {
  ------------------
  |  Branch (817:19): [True: 9.74k, False: 6.99k]
  ------------------
  818|       |            // 3-byte sequence
  819|  9.74k|            if (it + 3 > end || (it[1] & 0xC0) != 0x80 || (it[2] & 0xC0) != 0x80) return false;
  ------------------
  |  Branch (819:17): [True: 27, False: 9.71k]
  |  Branch (819:33): [True: 66, False: 9.65k]
  |  Branch (819:59): [True: 75, False: 9.57k]
  ------------------
  820|  9.57k|            if (byte == 0xE0 && it[1] < 0xA0) return false; // Overlong
  ------------------
  |  Branch (820:17): [True: 3.61k, False: 5.96k]
  |  Branch (820:33): [True: 95, False: 3.51k]
  ------------------
  821|  9.48k|            if (byte == 0xED && it[1] >= 0xA0) return false; // Surrogate
  ------------------
  |  Branch (821:17): [True: 2.40k, False: 7.08k]
  |  Branch (821:33): [True: 56, False: 2.34k]
  ------------------
  822|  9.42k|            it += 3;
  823|  9.42k|         }
  824|  6.99k|         else if ((byte & 0xF8) == 0xF0) {
  ------------------
  |  Branch (824:19): [True: 6.68k, False: 309]
  ------------------
  825|       |            // 4-byte sequence
  826|  6.68k|            if (it + 4 > end || (it[1] & 0xC0) != 0x80 || (it[2] & 0xC0) != 0x80 || (it[3] & 0xC0) != 0x80)
  ------------------
  |  Branch (826:17): [True: 36, False: 6.65k]
  |  Branch (826:33): [True: 57, False: 6.59k]
  |  Branch (826:59): [True: 62, False: 6.53k]
  |  Branch (826:85): [True: 55, False: 6.47k]
  ------------------
  827|    210|               return false;
  828|  6.47k|            if (byte == 0xF0 && it[1] < 0x90) return false; // Overlong
  ------------------
  |  Branch (828:17): [True: 2.71k, False: 3.76k]
  |  Branch (828:33): [True: 63, False: 2.65k]
  ------------------
  829|  6.41k|            if (byte == 0xF4 && it[1] >= 0x90) return false; // > U+10FFFF
  ------------------
  |  Branch (829:17): [True: 1.67k, False: 4.74k]
  |  Branch (829:33): [True: 27, False: 1.64k]
  ------------------
  830|  6.38k|            if (byte > 0xF4) return false; // > U+10FFFF
  ------------------
  |  Branch (830:17): [True: 37, False: 6.34k]
  ------------------
  831|  6.34k|            it += 4;
  832|  6.34k|         }
  833|    309|         else {
  834|    309|            return false;
  835|    309|         }
  836|   458k|      }
  837|       |
  838|   166k|      return true;
  839|   168k|   }
_ZN3glz25handle_unicode_code_pointIccEENS_14unicode_resultERPKT_RPT0_S4_:
  347|  47.9k|   {
  348|  47.9k|      using namespace unicode;
  349|       |
  350|  47.9k|      if (end - it <= 4) [[unlikely]] {
  ------------------
  |  Branch (350:11): [True: 290, False: 47.6k]
  ------------------
  351|    290|         return {0, escape_prefix_intact<false>(it, end)};
  352|    290|      }
  353|  47.6k|      const uint32_t high = hex_to_u32(it);
  354|  47.6k|      if (high == 0xFFFFFFFFu) [[unlikely]] {
  ------------------
  |  Branch (354:11): [True: 217, False: 47.4k]
  ------------------
  355|    217|         return {};
  356|    217|      }
  357|  47.4k|      it += 4; // skip the code point characters
  358|       |
  359|  47.4k|      uint32_t code_point;
  360|       |
  361|  47.4k|      if ((high & generic_surrogate_mask) == generic_surrogate_value) {
  ------------------
  |  Branch (361:11): [True: 3.56k, False: 43.8k]
  ------------------
  362|       |         // surrogate pair code points
  363|  3.56k|         if ((high & surrogate_mask) != high_surrogate_value) {
  ------------------
  |  Branch (363:14): [True: 77, False: 3.48k]
  ------------------
  364|     77|            return {};
  365|     77|         }
  366|       |
  367|  3.48k|         if (end - it <= 6) [[unlikely]] {
  ------------------
  |  Branch (367:14): [True: 276, False: 3.21k]
  ------------------
  368|    276|            return {0, escape_prefix_intact<true>(it, end)};
  369|    276|         }
  370|       |         // The next two characters must be `\u`
  371|  3.21k|         uint16_t u;
  372|  3.21k|         std::memcpy(&u, it, 2);
  373|  3.21k|         if (u != to_uint16_t(R"(\u)")) [[unlikely]] {
  ------------------
  |  Branch (373:14): [True: 255, False: 2.95k]
  ------------------
  374|    255|            return {};
  375|    255|         }
  376|  2.95k|         it += 2;
  377|       |         // verify that second unicode escape sequence is present
  378|  2.95k|         const uint32_t low = hex_to_u32(it);
  379|  2.95k|         if (low == 0xFFFFFFFFu) [[unlikely]] {
  ------------------
  |  Branch (379:14): [True: 30, False: 2.92k]
  ------------------
  380|     30|            return {};
  381|     30|         }
  382|  2.92k|         it += 4;
  383|       |
  384|  2.92k|         if ((low & surrogate_mask) != low_surrogate_value) [[unlikely]] {
  ------------------
  |  Branch (384:14): [True: 72, False: 2.85k]
  ------------------
  385|     72|            return {};
  386|     72|         }
  387|       |
  388|  2.85k|         code_point = (high & surrogate_codepoint_mask) << surrogate_codepoint_bits;
  389|  2.85k|         code_point |= (low & surrogate_codepoint_mask);
  390|  2.85k|         code_point += surrogate_codepoint_offset;
  391|  2.85k|      }
  392|  43.8k|      else {
  393|  43.8k|         code_point = high;
  394|  43.8k|      }
  395|  46.7k|      const uint32_t offset = code_point_to_utf8(code_point, dst);
  396|  46.7k|      dst += offset;
  397|  46.7k|      return {offset, false};
  398|  47.4k|   }
_ZN3glz20escape_prefix_intactILb0EccEEbPKT0_PKT1_:
  329|    290|   {
  330|    290|      auto n = size_t(end - it);
  331|       |      if constexpr (ExpectOpener) {
  332|       |         if (n > 0 && it[0] != '\\') return false;
  333|       |         if (n > 1 && it[1] != 'u') return false;
  334|       |         if (n < 2) return true;
  335|       |         it += 2;
  336|       |         n -= 2;
  337|       |      }
  338|    866|      for (size_t i = 0; i < n; ++i) {
  ------------------
  |  Branch (338:26): [True: 761, False: 105]
  ------------------
  339|    761|         if (digit_hex_table[uint8_t(it[i])] == 255) return false;
  ------------------
  |  Branch (339:14): [True: 185, False: 576]
  ------------------
  340|    761|      }
  341|    105|      return true;
  342|    290|   }
_ZN3glz10hex_to_u32EPKc:
  224|  50.6k|   {
  225|  50.6k|      constexpr auto& t = digit_hex_table;
  226|  50.6k|      const uint8_t arr[4]{t[uint8_t(c[3])], t[uint8_t(c[2])], t[uint8_t(c[1])], t[uint8_t(c[0])]};
  227|  50.6k|      auto chunk = std::bit_cast<uint32_t>(arr);
  228|       |      // On big-endian, bit_cast produces bytes in opposite order than expected
  229|       |      // byteswap to get consistent little-endian representation
  230|       |      if constexpr (std::endian::native == std::endian::big) {
  231|       |         chunk = std::byteswap(chunk);
  232|       |      }
  233|       |      // check that all hex characters are valid
  234|  50.6k|      if (chunk & repeat_byte4(0b11110000u)) [[unlikely]] {
  ------------------
  |  Branch (234:11): [True: 247, False: 50.3k]
  ------------------
  235|    247|         return 0xFFFFFFFFu;
  236|    247|      }
  237|       |
  238|       |      // now pack into first four bytes of uint32_t
  239|  50.3k|      uint32_t packed{};
  240|  50.3k|      packed |= (chunk & 0x0000000F);
  241|  50.3k|      packed |= (chunk & 0x00000F00) >> 4;
  242|  50.3k|      packed |= (chunk & 0x000F0000) >> 8;
  243|  50.3k|      packed |= (chunk & 0x0F000000) >> 12;
  244|  50.3k|      return packed;
  245|  50.6k|   }
_ZN3glz20escape_prefix_intactILb1EccEEbPKT0_PKT1_:
  329|    276|   {
  330|    276|      auto n = size_t(end - it);
  331|    276|      if constexpr (ExpectOpener) {
  332|    276|         if (n > 0 && it[0] != '\\') return false;
  ------------------
  |  Branch (332:14): [True: 276, False: 0]
  |  Branch (332:23): [True: 163, False: 113]
  ------------------
  333|    113|         if (n > 1 && it[1] != 'u') return false;
  ------------------
  |  Branch (333:14): [True: 111, False: 2]
  |  Branch (333:23): [True: 63, False: 48]
  ------------------
  334|     50|         if (n < 2) return true;
  ------------------
  |  Branch (334:14): [True: 2, False: 48]
  ------------------
  335|     48|         it += 2;
  336|     48|         n -= 2;
  337|     48|      }
  338|    324|      for (size_t i = 0; i < n; ++i) {
  ------------------
  |  Branch (338:26): [True: 96, False: 228]
  ------------------
  339|     96|         if (digit_hex_table[uint8_t(it[i])] == 255) return false;
  ------------------
  |  Branch (339:14): [True: 48, False: 48]
  ------------------
  340|     96|      }
  341|    228|      return true;
  342|    276|   }
_ZN3glz18code_point_to_utf8IcEEjjPT_:
  249|  46.7k|   {
  250|  46.7k|      if (code_point <= 0x7F) {
  ------------------
  |  Branch (250:11): [True: 32.4k, False: 14.2k]
  ------------------
  251|  32.4k|         c[0] = Char(code_point);
  252|  32.4k|         return 1;
  253|  32.4k|      }
  254|  14.2k|      if (code_point <= 0x7FF) {
  ------------------
  |  Branch (254:11): [True: 5.87k, False: 8.36k]
  ------------------
  255|  5.87k|         c[0] = Char(0xC0 | ((code_point >> 6) & 0x1F));
  256|  5.87k|         c[1] = Char(0x80 | (code_point & 0x3F));
  257|  5.87k|         return 2;
  258|  5.87k|      }
  259|  8.36k|      if (code_point <= 0xFFFF) {
  ------------------
  |  Branch (259:11): [True: 5.51k, False: 2.85k]
  ------------------
  260|  5.51k|         c[0] = Char(0xE0 | ((code_point >> 12) & 0x0F));
  261|  5.51k|         c[1] = Char(0x80 | ((code_point >> 6) & 0x3F));
  262|  5.51k|         c[2] = Char(0x80 | (code_point & 0x3F));
  263|  5.51k|         return 3;
  264|  5.51k|      }
  265|  2.85k|      if (code_point <= 0x10FFFF) {
  ------------------
  |  Branch (265:11): [True: 2.85k, False: 0]
  ------------------
  266|  2.85k|         c[0] = Char(0xF0 | ((code_point >> 18) & 0x07));
  267|  2.85k|         c[1] = Char(0x80 | ((code_point >> 12) & 0x3F));
  268|  2.85k|         c[2] = Char(0x80 | ((code_point >> 6) & 0x3F));
  269|  2.85k|         c[3] = Char(0x80 | (code_point & 0x3F));
  270|  2.85k|         return 4;
  271|  2.85k|      }
  272|      0|      return 0;
  273|  2.85k|   }
_ZN3glz17match_invalid_endILc58EXtlNS_22match_invalid_end_optsEEETkNS_10is_contextENS_7contextERPKcS4_EEbRT1_OT2_T3_:
  470|  3.29M|   {
  471|  3.29M|      if (*it != C) [[unlikely]] {
  ------------------
  |  Branch (471:11): [True: 1.15k, False: 3.28M]
  ------------------
  472|       |         if constexpr (C == '"') {
  473|       |            ctx.error = error_code::expected_quote;
  474|       |         }
  475|       |         else if constexpr (C == ',') {
  476|       |            ctx.error = error_code::expected_comma;
  477|       |         }
  478|  1.15k|         else if constexpr (C == ':') {
  479|  1.15k|            ctx.error = error_code::expected_colon;
  480|       |         }
  481|       |         else if constexpr (C == '[' || C == ']') {
  482|       |            ctx.error = error_code::expected_bracket;
  483|       |         }
  484|       |         else if constexpr (C == '{' || C == '}') {
  485|       |            ctx.error = error_code::expected_brace;
  486|       |         }
  487|       |         else {
  488|       |            ctx.error = error_code::syntax_error;
  489|       |         }
  490|  1.15k|         return true;
  491|  1.15k|      }
  492|  3.28M|      else [[likely]] {
  493|  3.28M|         ++it;
  494|  3.28M|      }
  495|  3.28M|      if constexpr (not Opts.null_terminated) {
  496|  3.28M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 1.53k, False: 3.28M]
  ------------------
  497|  1.53k|            ctx.error = error_code::unexpected_end;
  498|  1.53k|            return true;
  499|  1.53k|         }
  500|  3.28M|      }
  501|  3.28M|      return false;
  502|  3.29M|   }
_ZN3glz17match_invalid_endILc91EXtlNS_22match_invalid_end_optsEEETkNS_10is_contextENS_7contextERPKcS4_EEbRT1_OT2_T3_:
  470|  1.76M|   {
  471|  1.76M|      if (*it != C) [[unlikely]] {
  ------------------
  |  Branch (471:11): [True: 0, False: 1.76M]
  ------------------
  472|       |         if constexpr (C == '"') {
  473|       |            ctx.error = error_code::expected_quote;
  474|       |         }
  475|       |         else if constexpr (C == ',') {
  476|       |            ctx.error = error_code::expected_comma;
  477|       |         }
  478|       |         else if constexpr (C == ':') {
  479|       |            ctx.error = error_code::expected_colon;
  480|       |         }
  481|      0|         else if constexpr (C == '[' || C == ']') {
  482|      0|            ctx.error = error_code::expected_bracket;
  483|       |         }
  484|       |         else if constexpr (C == '{' || C == '}') {
  485|       |            ctx.error = error_code::expected_brace;
  486|       |         }
  487|       |         else {
  488|       |            ctx.error = error_code::syntax_error;
  489|       |         }
  490|      0|         return true;
  491|      0|      }
  492|  1.76M|      else [[likely]] {
  493|  1.76M|         ++it;
  494|  1.76M|      }
  495|  1.76M|      if constexpr (not Opts.null_terminated) {
  496|  1.76M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 111, False: 1.76M]
  ------------------
  497|    111|            ctx.error = error_code::unexpected_end;
  498|    111|            return true;
  499|    111|         }
  500|  1.76M|      }
  501|  1.76M|      return false;
  502|  1.76M|   }
_ZN3glz16skip_matching_wsIcRPKcEEvPKT_OT0_m:
  730|  42.9k|   {
  731|  42.9k|      if (length > 7) {
  ------------------
  |  Branch (731:11): [True: 10.9k, False: 32.0k]
  ------------------
  732|  10.9k|         uint64_t v[2];
  733|  14.7k|         while (length > 8) {
  ------------------
  |  Branch (733:17): [True: 8.18k, False: 6.53k]
  ------------------
  734|  8.18k|            std::memcpy(v, ws, 8);
  735|  8.18k|            std::memcpy(v + 1, it, 8);
  736|  8.18k|            if (v[0] != v[1]) {
  ------------------
  |  Branch (736:17): [True: 4.41k, False: 3.77k]
  ------------------
  737|  4.41k|               return;
  738|  4.41k|            }
  739|  3.77k|            length -= 8;
  740|  3.77k|            ws += 8;
  741|  3.77k|            it += 8;
  742|  3.77k|         }
  743|       |
  744|  6.53k|         const auto shift = 8 - length;
  745|  6.53k|         ws -= shift;
  746|  6.53k|         it -= shift;
  747|       |
  748|  6.53k|         std::memcpy(v, ws, 8);
  749|  6.53k|         std::memcpy(v + 1, it, 8);
  750|  6.53k|         if (v[0] != v[1]) {
  ------------------
  |  Branch (750:14): [True: 4.28k, False: 2.24k]
  ------------------
  751|  4.28k|            return;
  752|  4.28k|         }
  753|  2.24k|         it += 8;
  754|  2.24k|         return;
  755|  6.53k|      }
  756|  32.0k|      {
  757|  32.0k|         constexpr uint64_t n{sizeof(uint32_t)};
  758|  32.0k|         if (length >= n) {
  ------------------
  |  Branch (758:14): [True: 19.5k, False: 12.5k]
  ------------------
  759|  19.5k|            uint32_t v[2];
  760|  19.5k|            std::memcpy(v, ws, n);
  761|  19.5k|            std::memcpy(v + 1, it, n);
  762|  19.5k|            if (v[0] != v[1]) {
  ------------------
  |  Branch (762:17): [True: 11.5k, False: 8.02k]
  ------------------
  763|  11.5k|               return;
  764|  11.5k|            }
  765|  8.02k|            length -= n;
  766|  8.02k|            ws += n;
  767|  8.02k|            it += n;
  768|  8.02k|         }
  769|  32.0k|      }
  770|  20.5k|      {
  771|  20.5k|         constexpr uint64_t n{sizeof(uint16_t)};
  772|  20.5k|         if (length >= n) {
  ------------------
  |  Branch (772:14): [True: 4.78k, False: 15.7k]
  ------------------
  773|  4.78k|            uint16_t v[2];
  774|  4.78k|            std::memcpy(v, ws, n);
  775|  4.78k|            std::memcpy(v + 1, it, n);
  776|  4.78k|            if (v[0] != v[1]) {
  ------------------
  |  Branch (776:17): [True: 2.44k, False: 2.34k]
  ------------------
  777|  2.44k|               return;
  778|  2.44k|            }
  779|       |            // length -= n;
  780|       |            // ws += n;
  781|  2.34k|            it += n;
  782|  2.34k|         }
  783|  20.5k|      }
  784|       |      // We have to call a whitespace check after this function
  785|       |      // in case the whitespace is mismatching.
  786|       |      // So, we forgo this check as to not duplicate.
  787|       |      /*if (length && *ws == *it) {
  788|       |         ++it;
  789|       |      }*/
  790|  20.5k|   }
_ZN3glz18validate_utf8_spanITnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj4EEETkNS_10is_contextERNS_7contextEccEEbOT0_PKT1_PKT2_m:
  873|  30.1k|   {
  874|       |      if constexpr (not check_validate_utf8(Opts)) {
  875|       |         // Everything the caller computed for us is dead, which lets its scan loop drop the
  876|       |         // accumulator entirely.
  877|       |         (void)ctx, (void)start, (void)fin, (void)ascii_acc;
  878|       |         return false;
  879|       |      }
  880|  30.1k|      else {
  881|  30.1k|         if ((ascii_acc & repeat_byte8(0b10000000)) == 0) {
  ------------------
  |  Branch (881:14): [True: 16.0k, False: 14.1k]
  ------------------
  882|  16.0k|            return false; // pure ASCII is trivially well formed UTF-8
  883|  16.0k|         }
  884|  14.1k|         if (!validate_utf8(start, size_t(fin - start))) [[unlikely]] {
  ------------------
  |  Branch (884:14): [True: 591, False: 13.5k]
  ------------------
  885|    591|            ctx.error = error_code::invalid_utf8;
  886|    591|            return true;
  887|    591|         }
  888|  13.5k|         return false;
  889|  14.1k|      }
  890|  30.1k|   }
_ZN3glz5matchITnNS_14string_literalEXtlNS1_ILm5EEEtlA5_cLc110ELc117ELc108ELc108EEEETnDaXtlNS_4optsELj10ELb0ELb0ELb1ELb1EEETkNS_10is_contextERNS_7contextERPKcS8_EEvOT1_OT2_T3_:
  539|  3.49k|   {
  540|  3.49k|      static constexpr auto S = str.sv();
  541|  3.49k|      if ((end - it < std::ptrdiff_t(str.size())) || not comparitor<S>(it)) [[unlikely]] {
  ------------------
  |  Branch (541:11): [True: 95, False: 3.39k]
  |  Branch (541:54): [True: 280, False: 3.11k]
  ------------------
  542|    375|         ctx.error = error_code::syntax_error;
  543|    375|      }
  544|  3.11k|      else [[likely]] {
  545|  3.11k|         it += str.size();
  546|  3.11k|      }
  547|  3.49k|   }

_ZNK3glz14string_literalILm5EE4sizeEv:
   25|  6.60k|      [[nodiscard]] constexpr size_t size() const noexcept { return length; }

