LLVMFuzzerTestOneInput:
    8|  39.9k|{
    9|       |   // The YAML reader is bounded by `end` and never consults a trailing sentinel, so it must
   10|       |   // parse a buffer that has no '\0' after it. An exact-size heap buffer puts the ASAN
   11|       |   // redzone immediately after the last byte, so any read past the end fails here.
   12|  39.9k|   {
   13|  39.9k|      const std::vector<char> buffer{Data, Data + Size};
   14|       |
   15|  39.9k|      static constexpr glz::opts opts{.format = glz::YAML, .null_terminated = false};
   16|  39.9k|      glz::generic yaml{};
   17|  39.9k|      auto ec = glz::read<opts>(yaml, buffer);
   18|  39.9k|      if (!ec) {
  ------------------
  |  Branch (18:11): [True: 8.48k, False: 31.4k]
  ------------------
   19|  8.48k|         [[maybe_unused]] auto s = yaml.size();
   20|  8.48k|      }
   21|  39.9k|   }
   22|       |
   23|       |   // glz::yaml_opts has no null_terminated member at all, so this covers the default
   24|       |   // read_yaml path, where check_null_terminated falls back to false.
   25|  39.9k|   {
   26|  39.9k|      const std::vector<char> buffer{Data, Data + Size};
   27|       |
   28|  39.9k|      glz::generic yaml{};
   29|  39.9k|      auto ec = glz::read_yaml(yaml, buffer);
   30|  39.9k|      if (!ec) {
  ------------------
  |  Branch (30:11): [True: 8.48k, False: 31.4k]
  ------------------
   31|  8.48k|         [[maybe_unused]] auto s = yaml.size();
   32|  8.48k|      }
   33|  39.9k|   }
   34|       |
   35|       |   // use a vector with null termination instead of a std::string to avoid
   36|       |   // small string optimization to hide bounds problems
   37|  39.9k|   std::vector<char> buffer{Data, Data + Size};
   38|  39.9k|   buffer.push_back('\0');
   39|       |
   40|       |   // const qualified input buffer
   41|  39.9k|   {
   42|  39.9k|      const auto& input = buffer;
   43|  39.9k|      glz::generic yaml{};
   44|  39.9k|      auto ec = glz::read_yaml(yaml, input);
   45|  39.9k|      if (!ec) {
  ------------------
  |  Branch (45:11): [True: 801, False: 39.1k]
  ------------------
   46|    801|         [[maybe_unused]] auto s = yaml.size();
   47|    801|      }
   48|  39.9k|   }
   49|       |
   50|       |   // non-const input buffer
   51|  39.9k|   {
   52|  39.9k|      glz::generic yaml{};
   53|  39.9k|      auto ec = glz::read_yaml(yaml, buffer);
   54|  39.9k|      if (!ec) {
  ------------------
  |  Branch (54:11): [True: 801, False: 39.1k]
  ------------------
   55|    801|         [[maybe_unused]] auto s = yaml.size();
   56|    801|      }
   57|  39.9k|   }
   58|       |
   59|  39.9k|   return 0;
   60|  39.9k|}

_ZN3glz11empty_rangeITkNS_5rangeERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS1_9allocatorIS6_EEEEEEbOT_:
  304|  1.15M|   {
  305|  1.15M|#ifdef __cpp_lib_ranges
  306|  1.15M|      return std::ranges::empty(rng);
  307|       |#else
  308|       |      // in lieu of std::ranges::empty
  309|       |      if constexpr (requires() {
  310|       |                       { rng.empty() } -> std::convertible_to<bool>;
  311|       |                    }) {
  312|       |         return rng.empty();
  313|       |      }
  314|       |      else if constexpr (requires() {
  315|       |                            { rng.size() } -> std::same_as<std::size_t>;
  316|       |                         }) {
  317|       |         return rng.size() == std::size_t{0};
  318|       |      }
  319|       |      else {
  320|       |         return std::cbegin(rng) == std::cend(rng);
  321|       |      }
  322|       |#endif
  323|  1.15M|   }
_ZN3glz11empty_rangeITkNS_5rangeERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEEEbOT_:
  304|  7.16M|   {
  305|  7.16M|#ifdef __cpp_lib_ranges
  306|  7.16M|      return std::ranges::empty(rng);
  307|       |#else
  308|       |      // in lieu of std::ranges::empty
  309|       |      if constexpr (requires() {
  310|       |                       { rng.empty() } -> std::convertible_to<bool>;
  311|       |                    }) {
  312|       |         return rng.empty();
  313|       |      }
  314|       |      else if constexpr (requires() {
  315|       |                            { rng.size() } -> std::same_as<std::size_t>;
  316|       |                         }) {
  317|       |         return rng.size() == std::size_t{0};
  318|       |      }
  319|       |      else {
  320|       |         return std::cbegin(rng) == std::cend(rng);
  321|       |      }
  322|       |#endif
  323|  7.16M|   }

_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEED2Ev:
  569|  30.6M|      {
  570|  30.6M|         free_data();
  571|  30.6M|         free_index();
  572|  30.6M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE9free_dataEv:
  266|  30.6M|      {
  267|  30.6M|         destroy_all();
  268|  30.6M|         ::operator delete(data_);
  269|  30.6M|         data_ = nullptr;
  270|  30.6M|         size_ = 0;
  271|  30.6M|         capacity_ = 0;
  272|  30.6M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE11destroy_allEv:
  259|  39.5M|      {
  260|  60.0M|         for (uint32_t i = 0; i < size_; ++i) {
  ------------------
  |  Branch (260:31): [True: 20.4M, False: 39.5M]
  ------------------
  261|  20.4M|            std::destroy_at(data_ + i);
  262|  20.4M|         }
  263|  39.5M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE10free_indexEv:
  308|  30.6M|      {
  309|  30.6M|         std::free(index_);
  310|  30.6M|         index_ = nullptr;
  311|  30.6M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEEC2Ev:
  566|  17.7M|      ordered_small_map() = default;
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEEaSEOS4_:
  628|  2.14k|      {
  629|  2.14k|         if (this != &other) {
  ------------------
  |  Branch (629:14): [True: 2.14k, False: 0]
  ------------------
  630|  2.14k|            free_data();
  631|  2.14k|            free_index();
  632|  2.14k|            data_ = other.data_;
  633|  2.14k|            size_ = other.size_;
  634|  2.14k|            capacity_ = other.capacity_;
  635|  2.14k|            index_ = other.index_;
  636|  2.14k|            other.data_ = nullptr;
  637|  2.14k|            other.size_ = 0;
  638|  2.14k|            other.capacity_ = 0;
  639|  2.14k|            other.index_ = nullptr;
  640|  2.14k|         }
  641|  2.14k|         return *this;
  642|  2.14k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEEC2EOS4_:
  610|  12.8M|         : data_(other.data_), size_(other.size_), capacity_(other.capacity_), index_(other.index_)
  611|  12.8M|      {
  612|  12.8M|         other.data_ = nullptr;
  613|  12.8M|         other.size_ = 0;
  614|  12.8M|         other.capacity_ = 0;
  615|  12.8M|         other.index_ = nullptr;
  616|  12.8M|      }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE5emptyEv:
  662|  15.9M|      [[nodiscard]] bool empty() const noexcept { return size_ == 0; }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE5beginEv:
  645|  15.7M|      iterator begin() noexcept { return data_; }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE3endEv:
  649|  34.1M|      iterator end() noexcept { return data_ + size_; }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE11linear_findINSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEEEPNS6_4pairISC_S3_EERKT_:
  421|  16.7M|      {
  422|  28.2M|         for (uint32_t i = 0; i < size_; ++i) {
  ------------------
  |  Branch (422:31): [True: 14.6M, False: 13.6M]
  ------------------
  423|  14.6M|            if (data_[i].first == key) return data_ + i;
  ------------------
  |  Branch (423:17): [True: 3.10M, False: 11.5M]
  ------------------
  424|  14.6M|         }
  425|  13.6M|         return data_ + size_;
  426|  16.7M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE14grow_if_neededEv:
  217|  15.5M|      {
  218|  15.5M|         if (size_ == capacity_) {
  ------------------
  |  Branch (218:14): [True: 8.90M, False: 6.64M]
  ------------------
  219|  8.90M|            if (size_ == max_u32) {
  ------------------
  |  Branch (219:17): [True: 0, False: 8.90M]
  ------------------
  220|      0|               throw_capacity_overflow();
  221|      0|            }
  222|  8.90M|            const uint32_t new_cap = next_data_capacity(capacity_);
  223|  8.90M|            reallocate_data(new_cap);
  224|  8.90M|         }
  225|  15.5M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE18next_data_capacityEj:
  120|  8.90M|      {
  121|  8.90M|         if (current == 0) return 4;
  ------------------
  |  Branch (121:14): [True: 8.47M, False: 425k]
  ------------------
  122|   425k|         if (current > (max_u32 / 2)) return max_u32;
  ------------------
  |  Branch (122:14): [True: 0, False: 425k]
  ------------------
  123|   425k|         return current * 2;
  124|   425k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE15reallocate_dataEj:
  205|  8.90M|      {
  206|  8.90M|         if (new_cap < size_) {
  ------------------
  |  Branch (206:14): [True: 0, False: 8.90M]
  ------------------
  207|      0|            throw_capacity_overflow();
  208|      0|         }
  209|  8.90M|         auto* new_data = allocate_and_relocate(new_cap);
  210|  8.90M|         destroy_all();
  211|  8.90M|         ::operator delete(data_);
  212|  8.90M|         data_ = new_data;
  213|  8.90M|         capacity_ = new_cap;
  214|  8.90M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE21allocate_and_relocateEj:
  159|  8.90M|      {
  160|  8.90M|         auto* new_data = static_cast<value_type*>(::operator new(checked_data_allocation_bytes(new_cap)));
  161|  8.90M|#if __cpp_exceptions
  162|  8.90M|         uint32_t constructed = 0;
  163|  8.90M|         try {
  164|  13.8M|            for (; constructed < size_; ++constructed) {
  ------------------
  |  Branch (164:20): [True: 4.93M, False: 8.90M]
  ------------------
  165|  4.93M|               std::construct_at(new_data + constructed, std::move_if_noexcept(data_[constructed]));
  166|  4.93M|            }
  167|  8.90M|         }
  168|  8.90M|         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|  8.90M|         return new_data;
  179|  8.90M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE29checked_data_allocation_bytesEj:
  134|  8.90M|      {
  135|  8.90M|         if (count > ((std::numeric_limits<size_t>::max)() / sizeof(value_type))) {
  ------------------
  |  Branch (135:14): [True: 0, False: 8.90M]
  ------------------
  136|      0|            GLZ_THROW_OR_ABORT(std::bad_alloc{});
  ------------------
  |  |    8|      0|#define GLZ_THROW_OR_ABORT(EXC) (throw(EXC))
  ------------------
  137|      0|         }
  138|  8.90M|         return static_cast<size_t>(count) * sizeof(value_type);
  139|  8.90M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE8hash_keyENSt3__117basic_string_viewIcNS5_11char_traitsIcEEEE:
   97|  7.49M|      static uint32_t hash_key(std::string_view key) noexcept { return sweethash::sweet32(key); }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE20bloom_maybe_containsEj:
  285|  2.99M|      {
  286|  2.99M|         const uint32_t a = h & bloom_mask;
  287|  2.99M|         const uint32_t b = (h >> 10) & bloom_mask;
  288|  2.99M|         return (index_->bloom[a >> 3] & (uint8_t(1) << (a & 7))) && (index_->bloom[b >> 3] & (uint8_t(1) << (b & 7)));
  ------------------
  |  Branch (288:17): [True: 1.60M, False: 1.39M]
  |  Branch (288:70): [True: 1.42M, False: 181k]
  ------------------
  289|  2.99M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE17index_find_or_posINSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEEENS4_17index_find_resultERKT_j:
  400|  1.53M|      {
  401|  1.53M|         ensure_index();
  402|       |
  403|  1.53M|         const auto* base = index_entries();
  404|  1.53M|         const auto* idx_end = base + index_->size;
  405|  1.53M|         const auto* p = branchless_lower_bound(base, index_->size, h);
  406|  1.53M|         const size_t pos = static_cast<size_t>(p - base);
  407|       |
  408|       |         // Scan adjacent entries with matching hash
  409|  1.60M|         for (auto* scan = p; scan != idx_end && scan->key_hash == h; ++scan) {
  ------------------
  |  Branch (409:31): [True: 1.59M, False: 2.00k]
  |  Branch (409:50): [True: 1.21M, False: 386k]
  ------------------
  410|  1.21M|            if (data_[scan->index].first == key) {
  ------------------
  |  Branch (410:17): [True: 1.14M, False: 63.3k]
  ------------------
  411|  1.14M|               return {data_ + scan->index, pos, h};
  412|  1.14M|            }
  413|  1.21M|         }
  414|       |
  415|   388k|         return {data_ + size_, pos, h};
  416|  1.53M|      }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE12ensure_indexEv:
  360|  1.53M|      {
  361|  1.53M|         if (size_ <= linear_search_threshold) return;
  ------------------
  |  Branch (361:14): [True: 0, False: 1.53M]
  ------------------
  362|  1.53M|         const auto current = index_size();
  363|  1.53M|         if (current == size_) return; // fully current
  ------------------
  |  Branch (363:14): [True: 1.04M, False: 493k]
  ------------------
  364|       |
  365|   493k|         if (current == 0 || (size_ - current) > linear_search_threshold) {
  ------------------
  |  Branch (365:14): [True: 46.9k, False: 446k]
  |  Branch (365:30): [True: 53.5k, False: 392k]
  ------------------
  366|   100k|            rebuild_index(); // full rebuild
  367|   100k|            return;
  368|   100k|         }
  369|       |
  370|       |         // Incrementally insert-sort the few new entries
  371|  1.22M|         for (uint32_t i = current; i < size_; ++i) {
  ------------------
  |  Branch (371:37): [True: 834k, False: 392k]
  ------------------
  372|   834k|            const hash_index_entry entry{hash_key(data_[i].first), i};
  373|   834k|            const auto* base = index_entries();
  374|   834k|            const auto* p = branchless_lower_bound(base, index_->size, entry.key_hash);
  375|   834k|            auto pos = static_cast<size_t>(p - base);
  376|       |
  377|   834k|            const uint32_t m = index_->size;
  378|   834k|            ensure_index_capacity(static_cast<size_type>(m) + 1);
  379|   834k|            auto* entries = index_entries();
  380|   834k|            if (pos < m) {
  ------------------
  |  Branch (380:17): [True: 802k, False: 32.0k]
  ------------------
  381|   802k|               std::memmove(entries + pos + 1, entries + pos, (m - pos) * sizeof(hash_index_entry));
  382|   802k|            }
  383|   834k|            entries[pos] = entry;
  384|   834k|            index_->size = i + 1;
  385|   834k|         }
  386|   392k|      }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE13rebuild_indexEv:
  343|   100k|      {
  344|   100k|         ensure_index_capacity(static_cast<size_type>(size_));
  345|   100k|         bloom_clear();
  346|   100k|         auto* entries = index_entries();
  347|  3.65M|         for (uint32_t i = 0; i < size_; ++i) {
  ------------------
  |  Branch (347:31): [True: 3.55M, False: 100k]
  ------------------
  348|  3.55M|            const uint32_t h = hash_key(data_[i].first);
  349|  3.55M|            entries[i] = {h, i};
  350|  3.55M|            bloom_set(h);
  351|  3.55M|         }
  352|   100k|         std::sort(entries, entries + size_, [](const auto& a, const auto& b) { return a.key_hash < b.key_hash; });
  353|   100k|         index_->size = size_;
  354|   100k|      }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE11bloom_clearEv:
  291|   100k|      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|  24.5M|         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|  2.37M|      {
  441|  16.4M|         while (len > 1) {
  ------------------
  |  Branch (441:17): [True: 14.0M, False: 2.37M]
  ------------------
  442|  14.0M|            size_t half = len / 2;
  443|  14.0M|            p += (p[half - 1].key_hash < target) * half;
  444|  14.0M|            len -= half;
  445|  14.0M|         }
  446|       |         // Final element check: advance past it if it's less than target
  447|  2.37M|         p += (len == 1 && p->key_hash < target);
  ------------------
  |  Branch (447:16): [True: 2.37M, False: 0]
  |  Branch (447:28): [True: 34.0k, False: 2.33M]
  ------------------
  448|  2.37M|         return p;
  449|  2.37M|      }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE9bloom_setEj:
  277|  5.51M|      {
  278|  5.51M|         const uint32_t a = h & bloom_mask;
  279|  5.51M|         const uint32_t b = (h >> 10) & bloom_mask;
  280|  5.51M|         index_->bloom[a >> 3] |= uint8_t(1) << (a & 7);
  281|  5.51M|         index_->bloom[b >> 3] |= uint8_t(1) << (b & 7);
  282|  5.51M|      }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE10index_sizeEv:
  300|  1.92M|      uint32_t index_size() const noexcept { return index_ ? index_->size : 0; }
  ------------------
  |  Branch (300:53): [True: 1.87M, False: 46.9k]
  ------------------
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE21ensure_index_capacityEm:
  314|  1.32M|      {
  315|  1.32M|         if (needed == 0) return;
  ------------------
  |  Branch (315:14): [True: 0, False: 1.32M]
  ------------------
  316|  1.32M|         if (needed > static_cast<size_type>(max_u32)) {
  ------------------
  |  Branch (316:14): [True: 0, False: 1.32M]
  ------------------
  317|      0|            throw_index_overflow();
  318|      0|         }
  319|  1.32M|         const auto needed_u32 = static_cast<uint32_t>(needed);
  320|  1.32M|         if (index_ && index_->capacity >= needed_u32) return;
  ------------------
  |  Branch (320:14): [True: 1.27M, False: 46.9k]
  |  Branch (320:24): [True: 1.20M, False: 71.2k]
  ------------------
  321|   118k|         uint32_t cap = index_ ? index_->capacity : 0;
  ------------------
  |  Branch (321:25): [True: 71.2k, False: 46.9k]
  ------------------
  322|   237k|         while (cap < needed_u32) {
  ------------------
  |  Branch (322:17): [True: 118k, False: 118k]
  ------------------
  323|   118k|            const uint32_t next = next_index_capacity(cap);
  324|   118k|            if (next <= cap) {
  ------------------
  |  Branch (324:17): [True: 0, False: 118k]
  ------------------
  325|      0|               throw_index_overflow();
  326|      0|            }
  327|   118k|            cap = next;
  328|   118k|         }
  329|   118k|         auto* block = static_cast<index_header*>(std::realloc(index_, checked_index_allocation_bytes(cap)));
  330|   118k|         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: 118k]
  ------------------
  331|   118k|         if (!index_) {
  ------------------
  |  Branch (331:14): [True: 46.9k, False: 71.2k]
  ------------------
  332|  46.9k|            block->size = 0;
  333|  46.9k|            std::memset(block->bloom, 0, bloom_bytes);
  334|  46.9k|         }
  335|   118k|         block->capacity = cap;
  336|   118k|         index_ = block;
  337|   118k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE19next_index_capacityEj:
  127|   118k|      {
  128|   118k|         if (current == 0) return 16;
  ------------------
  |  Branch (128:14): [True: 46.9k, False: 72.0k]
  ------------------
  129|  72.0k|         if (current > (max_u32 / 2)) return max_u32;
  ------------------
  |  Branch (129:14): [True: 0, False: 72.0k]
  ------------------
  130|  72.0k|         return current * 2;
  131|  72.0k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE30checked_index_allocation_bytesEj:
  142|   118k|      {
  143|   118k|         constexpr size_t header = sizeof(index_header);
  144|   118k|         constexpr size_t entry = sizeof(hash_index_entry);
  145|   118k|         if (count > (((std::numeric_limits<size_t>::max)() - header) / entry)) {
  ------------------
  |  Branch (145:14): [True: 0, False: 118k]
  ------------------
  146|      0|            GLZ_THROW_OR_ABORT(std::bad_alloc{});
  ------------------
  |  |    8|      0|#define GLZ_THROW_OR_ABORT(EXC) (throw(EXC))
  ------------------
  147|      0|         }
  148|   118k|         return header + static_cast<size_t>(count) * entry;
  149|   118k|      }
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE13index_entriesEv:
  296|  3.69M|      {
  297|  3.69M|         return static_cast<hash_index_entry*>(static_cast<void*>(index_ + 1));
  298|  3.69M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE4findINSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEEEPNS6_4pairISC_S3_EERKT_:
  902|  96.9k|      {
  903|  96.9k|         if (size_ <= linear_search_threshold) {
  ------------------
  |  Branch (903:14): [True: 96.9k, False: 0]
  ------------------
  904|  96.9k|            return linear_find(key);
  905|  96.9k|         }
  906|      0|         return index_find(key);
  907|  96.9k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE6insertEONSt3__14pairINS5_12basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEES3_EE:
  719|  96.9k|      {
  720|  96.9k|         if (size_ <= linear_search_threshold) {
  ------------------
  |  Branch (720:14): [True: 96.9k, False: 0]
  ------------------
  721|  96.9k|            auto it = linear_find(value.first);
  722|  96.9k|            if (it != end()) return {it, false};
  ------------------
  |  Branch (722:17): [True: 0, False: 96.9k]
  ------------------
  723|  96.9k|            push_back_impl(std::move(value));
  724|  96.9k|            return {data_ + size_ - 1, true};
  725|  96.9k|         }
  726|      0|         const uint32_t h = hash_key(value.first);
  727|      0|         if (try_bloom_insert(h, [&] { push_back_impl(std::move(value)); })) {
  ------------------
  |  Branch (727:14): [True: 0, False: 0]
  ------------------
  728|      0|            return {data_ + size_ - 1, true};
  729|      0|         }
  730|       |         // try_bloom_insert returned false without calling the lambda, so value is still valid
  731|      0|         return indexed_insert(value.first, h, [&] { push_back_impl(std::move(value)); });
  732|      0|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE14push_back_implEONSt3__14pairINS5_12basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEES3_EE:
  235|  96.9k|      {
  236|  96.9k|         grow_if_needed();
  237|  96.9k|         std::construct_at(data_ + size_, std::move(val));
  238|  96.9k|         ++size_;
  239|  96.9k|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE7emplaceINSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEJS3_EEENS6_4pairIPNSD_ISC_S3_EEbEEOT_DpOT0_:
  746|  19.7M|      {
  747|  19.7M|         return try_emplace(std::forward<K>(key), std::forward<Args>(args)...);
  748|  19.7M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE11try_emplaceINSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEJS3_EEENS6_4pairIPNSD_ISC_S3_EEbEEOT_DpOT0_:
  752|  19.7M|      {
  753|  19.7M|         if (size_ <= linear_search_threshold) {
  ------------------
  |  Branch (753:14): [True: 16.5M, False: 3.11M]
  ------------------
  754|  16.5M|            auto it = linear_find(key);
  755|  16.5M|            if (it != end()) return {it, false};
  ------------------
  |  Branch (755:17): [True: 3.10M, False: 13.4M]
  ------------------
  756|  13.4M|            emplace_back_kv(std::forward<K>(key), std::forward<Args>(args)...);
  757|  13.4M|            return {data_ + size_ - 1, true};
  758|  16.5M|         }
  759|  3.11M|         const uint32_t h = hash_key(key);
  760|  3.11M|         if (try_bloom_insert(h, [&] { emplace_back_kv(std::forward<K>(key), std::forward<Args>(args)...); })) {
  ------------------
  |  Branch (760:14): [True: 1.57M, False: 1.53M]
  ------------------
  761|  1.57M|            return {data_ + size_ - 1, true};
  762|  1.57M|         }
  763|  1.53M|         auto [it, pos, _] = index_find_or_pos(key, h);
  764|  1.53M|         if (it != end()) return {it, false};
  ------------------
  |  Branch (764:14): [True: 1.14M, False: 388k]
  ------------------
  765|   388k|         emplace_back_kv(std::forward<K>(key), std::forward<Args>(args)...);
  766|   388k|         bloom_set(h);
  767|   388k|         if (index_size() > 0) {
  ------------------
  |  Branch (767:14): [True: 388k, False: 0]
  ------------------
  768|   388k|            const uint32_t n = index_->size;
  769|   388k|            ensure_index_capacity(static_cast<size_type>(n) + 1);
  770|   388k|            auto* entries = index_entries();
  771|   388k|            if (pos < n) {
  ------------------
  |  Branch (771:17): [True: 386k, False: 1.99k]
  ------------------
  772|   386k|               std::memmove(entries + pos + 1, entries + pos, (n - pos) * sizeof(hash_index_entry));
  773|   386k|            }
  774|   388k|            entries[pos] = {h, static_cast<uint32_t>(size_ - 1)};
  775|   388k|            index_->size = size_;
  776|   388k|         }
  777|   388k|         return {data_ + size_ - 1, true};
  778|  1.53M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE15emplace_back_kvINSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEJS3_EEEvOT_DpOT0_:
  251|  15.4M|      {
  252|  15.4M|         grow_if_needed();
  253|  15.4M|         std::construct_at(data_ + size_, std::piecewise_construct, std::forward_as_tuple(std::forward<K>(key)),
  254|  15.4M|                           std::forward_as_tuple(std::forward<Args>(args)...));
  255|  15.4M|         ++size_;
  256|  15.4M|      }
_ZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE16try_bloom_insertIZNS4_11try_emplaceINSt3__112basic_stringIcNS7_11char_traitsIcEENS7_9allocatorIcEEEEJS3_EEENS7_4pairIPNSE_ISD_S3_EEbEEOT_DpOT0_EUlvE_EEbjSJ_:
  529|  3.11M|      {
  530|  3.11M|         if (index_ && size_ <= bloom_threshold && !bloom_maybe_contains(h)) {
  ------------------
  |  Branch (530:14): [True: 3.06M, False: 46.9k]
  |  Branch (530:24): [True: 2.99M, False: 66.3k]
  |  Branch (530:52): [True: 1.57M, False: 1.42M]
  ------------------
  531|       |            // Definitely not present — skip the search
  532|  1.57M|            append_fn();
  533|  1.57M|            bloom_set(h);
  534|       |            // Index is now stale (index_->size < size_), will rebuild on next lookup or false positive
  535|  1.57M|            return true;
  536|  1.57M|         }
  537|  1.53M|         return false;
  538|  3.11M|      }
_ZZN3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE11try_emplaceINSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEJS3_EEENS6_4pairIPNSD_ISC_S3_EEbEEOT_DpOT0_ENKUlvE_clEv:
  760|  1.57M|         if (try_bloom_insert(h, [&] { emplace_back_kv(std::forward<K>(key), std::forward<Args>(args)...); })) {
_ZNK3glz17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES0_EEE4sizeEv:
  663|  10.0k|      size_type size() const noexcept { return size_; }

_ZN3glz15resize_unfilledINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEEvRT_m:
   63|  5.52M|   {
   64|  5.52M|      if constexpr (requires { b.resize_and_overwrite(n, [](auto*, size_t written) { return written; }); }) {
   65|  5.52M|         b.resize_and_overwrite(n, [](auto*, size_t written) noexcept { return written; });
   66|       |      }
   67|       |      else {
   68|       |         b.resize(n);
   69|       |      }
   70|  5.52M|   }
_ZZN3glz15resize_unfilledINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEEvRT_mENKUlPS8_mE_clIcEEDaSA_m:
   65|  5.52M|         b.resize_and_overwrite(n, [](auto*, size_t written) noexcept { return written; });
_ZN3glz12ensure_spaceINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEETkNS_10is_contextENS_7contextEEEbRT0_RT_m:
  265|  30.3M|   {
  266|  30.3M|      using Buffer = std::remove_cvref_t<B>;
  267|       |
  268|  30.3M|      if constexpr (vector_like<Buffer>) {
  269|  30.3M|         if (required > b.size()) [[unlikely]] {
  ------------------
  |  Branch (269:14): [True: 403k, False: 29.9M]
  ------------------
  270|   403k|            grow_buffer(b, required);
  271|   403k|         }
  272|  30.3M|         return true;
  273|       |      }
  274|       |      else if constexpr (has_bounded_capacity<Buffer>) {
  275|       |         if (required > buffer_traits<Buffer>::capacity(b)) [[unlikely]] {
  276|       |            ctx.error = error_code::buffer_overflow;
  277|       |            return false;
  278|       |         }
  279|       |         return true;
  280|       |      }
  281|       |      else {
  282|       |         return true; // Raw pointer or other - trust caller
  283|       |      }
  284|  30.3M|   }
_ZN3glz11grow_bufferINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEEvRT_m:
  143|   404k|   {
  144|   404k|      using traits = buffer_traits<std::remove_cvref_t<B>>;
  145|   404k|      if constexpr (requires { traits::grow(b, required); }) {
  146|   404k|         traits::grow(b, required);
  147|       |      }
  148|       |      else {
  149|       |         // A user specialization written before `grow` existed: keep the growth it used to get.
  150|       |         resize_unfilled(b, 2 * required);
  151|       |      }
  152|   404k|   }
_ZN3glz13buffer_traitsINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE4growERS7_mQL_ZNS_13buffer_traits12is_resizableEE:
  118|   404k|      {
  119|   404k|         resize_unfilled(b, 2 * required);
  120|   404k|      }
_ZN3glz13buffer_traitsINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE8finalizeERS7_m:
  124|  5.11M|      {
  125|  5.11M|         if constexpr (is_resizable) {
  126|  5.11M|            b.resize(written);
  127|  5.11M|         }
  128|       |         // For fixed buffers: no-op, count is returned in result
  129|  5.11M|      }

_ZN3glz8str_viewINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERS7_EENS1_17basic_string_viewIcS4_EEOT0_:
  341|  1.85M|   {
  342|       |      if constexpr (std::same_as<std::decay_t<T>, std::string_view>) {
  343|       |         return value; // already the answer; rebuilding it from data() and size() costs instructions
  344|       |      }
  345|       |      else if constexpr (!char_array_t<T> && std::is_pointer_v<std::decay_t<T>>) {
  346|       |         return value ? std::string_view{value} : std::string_view{};
  347|       |      }
  348|  1.85M|      else if constexpr (has_data<T> && has_size<T>) {
  349|  1.85M|         return std::string_view{value.data(), value.size()};
  350|       |      }
  351|       |      else {
  352|       |         return std::string_view{value};
  353|       |      }
  354|  1.85M|   }
_ZN3glz8str_viewINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKS7_EENS1_17basic_string_viewIcS4_EEOT0_:
  341|  12.4M|   {
  342|       |      if constexpr (std::same_as<std::decay_t<T>, std::string_view>) {
  343|       |         return value; // already the answer; rebuilding it from data() and size() costs instructions
  344|       |      }
  345|       |      else if constexpr (!char_array_t<T> && std::is_pointer_v<std::decay_t<T>>) {
  346|       |         return value ? std::string_view{value} : std::string_view{};
  347|       |      }
  348|  12.4M|      else if constexpr (has_data<T> && has_size<T>) {
  349|  12.4M|         return std::string_view{value.data(), value.size()};
  350|       |      }
  351|       |      else {
  352|       |         return std::string_view{value};
  353|       |      }
  354|  12.4M|   }
_ZN3glz10get_memberIRNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEERKMS4_NSt3__17variantIJDndNS6_12basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEbNS6_6vectorIS4_NSB_IS4_EEEENS3_IS4_EEEEEEEDcOT_OT0_:
  678|  37.0M|   {
  679|  37.0M|      using V = std::decay_t<decltype(element)>;
  680|  37.0M|      if constexpr (std::is_member_object_pointer_v<V>) {
  681|  37.0M|         return value.*element;
  682|       |      }
  683|       |      else if constexpr (std::is_member_function_pointer_v<V>) {
  684|       |         return element;
  685|       |      }
  686|       |      else if constexpr (std::invocable<Element, Value> && not eigen_t<Element>) {
  687|       |         // Eigen places a static_assert inside of the operator()(), so we must target
  688|       |         // matrix types and reject them from the invocable check
  689|       |         // Eigen ought to put the check in the `enable_if` for operator()()
  690|       |         return std::invoke(std::forward<Element>(element), std::forward<Value>(value));
  691|       |      }
  692|       |      else if constexpr (std::is_pointer_v<V> && !std::is_reference_v<Element>) {
  693|       |         if constexpr (std::invocable<decltype(*element), Value>) {
  694|       |            return std::invoke(*element, std::forward<Value>(value));
  695|       |         }
  696|       |         else {
  697|       |            return *element;
  698|       |         }
  699|       |      }
  700|       |      else {
  701|       |         return element;
  702|       |      }
  703|  37.0M|   }

_ZNK3glz9error_ctxcvbEv:
  148|   159k|      operator bool() const noexcept { return ec != error_code::none; }
_ZN3glz10call_scopeINS_4yaml12yaml_contextEEC2ERS2_:
  272|   159k|      explicit call_scope(Ctx& c) noexcept : ctx(c), depth(c.depth)
  273|   159k|      {
  274|   159k|         ctx.error = error_code::none;
  275|   159k|         ctx.custom_error_message = {};
  276|   159k|      }
_ZN3glz23seed_speculation_budgetITkNS_10is_contextENS_4yaml12yaml_contextEEEvRT_m:
  312|   159k|   {
  313|   159k|      if constexpr (requires { ctx.speculation_budget; }) {
  314|   159k|         const size_t proportional = max_speculative_parse_factor * input_bytes;
  315|   159k|         ctx.speculation_budget =
  316|   159k|            (proportional > min_speculative_parse_bytes ? proportional : min_speculative_parse_bytes) + 2;
  ------------------
  |  Branch (316:14): [True: 1.37k, False: 158k]
  ------------------
  317|   159k|      }
  318|   159k|   }
_ZN3glz11depth_guardINS_4yaml12yaml_contextEEC2ERS2_m:
  215|  18.1M|      depth_guard(Ctx& c, const size_t limit = max_recursive_depth_limit) noexcept : ctx(c)
  216|  18.1M|      {
  217|  18.1M|         if (ctx.depth >= limit) [[unlikely]] {
  ------------------
  |  Branch (217:14): [True: 6.72k, False: 18.1M]
  ------------------
  218|  6.72k|            ctx.error = error_code::exceeded_max_recursive_depth;
  219|  6.72k|            return;
  220|  6.72k|         }
  221|  18.1M|         ++ctx.depth;
  222|  18.1M|         entered = true;
  223|  18.1M|      }
_ZNK3glz11depth_guardINS_4yaml12yaml_contextEEcvbEv:
  228|  18.1M|      explicit operator bool() const noexcept { return entered; }
_ZN3glz10call_scopeINS_7contextEEC2ERS1_:
  272|  5.11M|      explicit call_scope(Ctx& c) noexcept : ctx(c), depth(c.depth)
  273|  5.11M|      {
  274|  5.11M|         ctx.error = error_code::none;
  275|  5.11M|         ctx.custom_error_message = {};
  276|  5.11M|      }
_ZN3glz10call_scopeINS_7contextEED2Ev:
  277|  5.11M|      ~call_scope() { ctx.depth = depth; }
_ZN3glz11depth_guardINS_4yaml12yaml_contextEED2Ev:
  225|  18.1M|      {
  226|  18.1M|         if (entered) --ctx.depth;
  ------------------
  |  Branch (226:14): [True: 18.1M, False: 6.72k]
  ------------------
  227|  18.1M|      }
_ZN3glz10call_scopeINS_4yaml12yaml_contextEED2Ev:
  277|   159k|      ~call_scope() { ctx.depth = depth; }

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

_ZN3glz5writeITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_13output_bufferENSt3__112basic_stringIcNS7_11char_traitsIcEENS7_9allocatorIcEEEEQ15write_supportedIT0_XdtT_6formatEEEENS_9error_ctxEOSE_RT1_:
  111|  5.11M|   {
  112|  5.11M|      context ctx{};
  113|  5.11M|      return write<Opts>(std::forward<T>(value), buffer, ctx);
  114|  5.11M|   }
_ZN3glz5writeITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_13output_bufferENSt3__112basic_stringIcNS7_11char_traitsIcEENS7_9allocatorIcEEEETkNS_10is_contextERNS_7contextEQaa15write_supportedIT0_XdtT_6formatEEnt17byte_array_bufferIT1_EEENS_9error_ctxEOSG_RSH_OT2_:
   18|  5.11M|   {
   19|  5.11M|      using traits = buffer_traits<std::remove_cvref_t<Buffer>>;
   20|  5.11M|      call_scope scope{ctx};
   21|       |
   22|  5.11M|      if constexpr (traits::is_resizable) {
   23|       |         // A buffer could be size 1, to ensure we have sufficient memory we can't just check `empty()`
   24|  5.11M|         if (buffer.size() < 2 * write_padding_bytes) {
  ------------------
  |  Branch (24:14): [True: 5.11M, False: 0]
  ------------------
   25|  5.11M|            resize_unfilled(buffer, 2 * write_padding_bytes);
   26|  5.11M|         }
   27|  5.11M|      }
   28|  5.11M|      size_t ix = 0; // overwrite index
   29|  5.11M|      to<Opts.format, std::remove_cvref_t<T>>::template op<Opts>(std::forward<T>(value), ctx, buffer, ix);
   30|       |
   31|  5.11M|      if (bool(ctx.error)) [[unlikely]] {
  ------------------
  |  Branch (31:11): [True: 0, False: 5.11M]
  ------------------
   32|       |         // Truncate on the way out too: the padding above is grown without being filled, so a
   33|       |         // buffer left at its padded length would hand the caller indeterminate bytes. Not
   34|       |         // `finalize`, which for a streaming buffer means flushing -- a failed write must not
   35|       |         // push the partial document downstream on its way out.
   36|      0|         if constexpr (traits::is_resizable && not traits::is_output_streaming) {
   37|      0|            buffer.resize(ix);
   38|      0|         }
   39|      0|         return {ix, ctx.error, ctx.custom_error_message};
   40|      0|      }
   41|       |
   42|  5.11M|      traits::finalize(buffer, ix);
   43|  5.11M|      return {ix, error_code::none, ctx.custom_error_message};
   44|  5.11M|   }

_ZN3glz11write_chars2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj128EEERNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEETkNS_5num_tERdTkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_:
  206|   496k|      {
  207|       |         /*if constexpr (std::same_as<std::decay_t<B>, std::string>) {
  208|       |            // more efficient strings in C++23:
  209|       |          https://en.cppreference.com/w/cpp/string/basic_string/resize_and_overwrite
  210|       |          }*/
  211|       |
  212|       |         // https://stackoverflow.com/questions/1701055/what-is-the-maximum-length-in-chars-needed-to-represent-any-double-value
  213|       |         // maximum length for a double should be 24 chars, we use 64 to be sufficient for float128_t
  214|       |         if constexpr (resizable<B> && not check_write_unchecked(Opts)) {
  215|       |            if (const auto k = ix + 64; k > b.size()) {
  216|       |               grow_buffer(b, k);
  217|       |            }
  218|       |         }
  219|       |
  220|   496k|         using V = std::decay_t<decltype(value)>;
  221|       |
  222|   496k|         if constexpr (std::floating_point<V>) {
  223|   496k|            using opts_type = std::decay_t<decltype(Opts)>;
  224|   496k|            constexpr bool use_float_format = requires { opts_type::float_format; };
  225|       |
  226|       |            // User-specified float_format takes priority over all other options
  227|       |            if constexpr (use_float_format && is_any_of<V, float, double>) {
  228|       |#if GLZ_USE_STD_FORMAT_FLOAT
  229|       |               // Use std::format with user-provided format string (e.g., "{:.2f}")
  230|       |               // Format string is validated at compile-time via std::format_string
  231|       |               constexpr auto fmt = std::format_string<V>{opts_type::float_format};
  232|       |
  233|       |               if constexpr (check_write_unchecked(Opts)) {
  234|       |                  // Caller guarantees buffer has enough space
  235|       |                  const auto start = reinterpret_cast<char*>(&b[ix]);
  236|       |                  auto result = std::format_to(start, fmt, V(value));
  237|       |                  ix += size_t(result - start);
  238|       |               }
  239|       |               else {
  240|       |                  // format_to_n writes up to 'available' chars and returns total size needed.
  241|       |                  // Common case: output fits in pre-allocated buffer (single pass).
  242|       |                  // Rare case: output exceeds buffer (e.g., "{:.100f}"), requires resize.
  243|       |                  const auto start = reinterpret_cast<char*>(&b[ix]);
  244|       |                  const auto available = b.size() - ix;
  245|       |                  auto [out, size] = std::format_to_n(start, available, fmt, V(value));
  246|       |
  247|       |                  if (static_cast<size_t>(size) > available) {
  248|       |                     // Output was truncated - size tells us exactly how much space we need
  249|       |                     if constexpr (resizable<B>) {
  250|       |                        grow_buffer(b, ix + size);
  251|       |                        std::format_to(reinterpret_cast<char*>(&b[ix]), fmt, V(value));
  252|       |                     }
  253|       |                     else {
  254|       |                        ctx.error = error_code::unexpected_end;
  255|       |                        return;
  256|       |                     }
  257|       |                  }
  258|       |                  ix += size;
  259|       |               }
  260|       |#else
  261|       |               // snprintf fallback for platforms without std::format float support (e.g., iOS < 16.3)
  262|       |               // Convert std::format spec to printf format at compile time
  263|       |               constexpr auto printf_fmt = detail::to_printf_fmt(opts_type::float_format);
  264|       |
  265|       |               const auto start = reinterpret_cast<char*>(&b[ix]);
  266|       |               const auto available = check_write_unchecked(Opts) ? size_t(64) : (b.size() - ix);
  267|       |
  268|       |               // snprintf returns chars that would be written (excluding null), or negative on error
  269|       |               const int len = std::snprintf(start, available, printf_fmt.data, static_cast<double>(value));
  270|       |
  271|       |               if (len < 0) {
  272|       |                  ctx.error = error_code::unexpected_end;
  273|       |                  return;
  274|       |               }
  275|       |
  276|       |               if (static_cast<size_t>(len) >= available) {
  277|       |                  // Output was truncated, need to resize and retry
  278|       |                  if constexpr (resizable<B> && not check_write_unchecked(Opts)) {
  279|       |                     grow_buffer(b, ix + static_cast<size_t>(len) + 1);
  280|       |                     std::snprintf(reinterpret_cast<char*>(&b[ix]), static_cast<size_t>(len) + 1, printf_fmt.data,
  281|       |                                   static_cast<double>(value));
  282|       |                  }
  283|       |                  else {
  284|       |                     ctx.error = error_code::unexpected_end;
  285|       |                     return;
  286|       |                  }
  287|       |               }
  288|       |               ix += static_cast<size_t>(len);
  289|       |#endif
  290|       |            }
  291|   496k|            else {
  292|   496k|               constexpr auto max_precision = uint8_t(check_float_max_write_precision(Opts));
  293|   496k|               constexpr bool narrows = max_precision > 0 && max_precision < sizeof(V);
  ------------------
  |  Branch (293:41): [Folded, False: 496k]
  |  Branch (293:62): [True: 0, Folded]
  ------------------
  294|   496k|#if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT
  295|   496k|               constexpr bool has_full_precision_writer = is_any_of<V, float, double> || is_float128<V>;
  ------------------
  |  Branch (295:59): [True: 496k, Folded]
  |  Branch (295:90): [Folded, False: 0]
  ------------------
  296|       |#else
  297|       |               constexpr bool has_full_precision_writer = is_any_of<V, float, double>;
  298|       |#endif
  299|       |               if constexpr (narrows) {
  300|       |                  // we cast to a lower precision floating point value before writing out
  301|       |                  static_assert(max_precision == 4 || max_precision == 8, "invalid float_max_write_precision");
  302|       |                  using reduced_t = std::conditional_t<max_precision == 4, float, double>;
  303|       |                  const auto reduced = static_cast<reduced_t>(value);
  304|       |                  // A finite value beyond the reduced type's range rounds to infinity, which would be written as
  305|       |                  // null. Such a value is written at full precision below instead.
  306|       |                  const bool overflowed = std::isinf(reduced) && value != static_cast<V>(reduced);
  307|       |                  if (not has_full_precision_writer || not overflowed) {
  308|       |                     const auto start = reinterpret_cast<char*>(&b[ix]);
  309|       |                     const auto end = glz::to_chars(start, reduced);
  310|       |                     ix += size_t(end - start);
  311|       |                     return;
  312|       |                  }
  313|       |               }
  314|       |
  315|       |               // Size optimization: pass OptSize=true so the ~17KB pow-10 lookup
  316|       |               // tables are dropped (recomputed on the fly). Much faster than the
  317|       |               // old simple_float::to_chars path at essentially the same footprint.
  318|       |               // See discussion #2519.
  319|       |               if constexpr (is_size_optimized(Opts) && is_any_of<V, float, double>) {
  320|       |                  const auto start = reinterpret_cast<char*>(&b[ix]);
  321|       |                  const auto end = glz::to_chars<V, /*OptSize=*/true>(start, V(value));
  322|       |                  ix += size_t(end - start);
  323|       |               }
  324|   496k|               else if constexpr (is_any_of<V, float, double>) {
  325|   496k|                  const auto start = reinterpret_cast<char*>(&b[ix]);
  326|   496k|                  const auto end = glz::to_chars(start, value);
  327|   496k|                  ix += size_t(end - start);
  328|       |               }
  329|       |// float128_t requires std::to_chars for floating-point, unavailable on older Apple platforms (iOS < 16.3)
  330|       |#if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT
  331|       |               else if constexpr (is_float128<V>) {
  332|       |                  const auto start = reinterpret_cast<char*>(&b[ix]);
  333|       |                  const auto [ptr, ec] = std::to_chars(start, &b[0] + b.size(), value, std::chars_format::general);
  334|       |                  if (ec != std::errc()) {
  335|       |                     ctx.error = error_code::unexpected_end;
  336|       |                     return;
  337|       |                  }
  338|       |                  ix += size_t(ptr - start);
  339|       |               }
  340|       |#endif
  341|       |               else if constexpr (not narrows) {
  342|       |                  static_assert(false_v<V>, "type is not supported");
  343|       |               }
  344|   496k|            }
  345|       |         }
  346|       |         else if constexpr (is_any_of<V, int8_t, uint8_t, int16_t, uint16_t>) {
  347|       |            // Small integers: always use to_chars (400B tables)
  348|       |            // The 40KB digit_quads table doesn't help for these small ranges
  349|       |            const auto start = reinterpret_cast<char*>(&b[ix]);
  350|       |            const auto end = glz::to_chars(start, value);
  351|       |            ix += size_t(end - start);
  352|       |         }
  353|       |         else if constexpr (is_any_of<V, int32_t, uint32_t, int64_t, uint64_t>) {
  354|       |            const auto start = reinterpret_cast<char*>(&b[ix]);
  355|       |            if constexpr (is_size_optimized(Opts)) {
  356|       |               // Size mode: use glz::to_chars (400B lookup tables)
  357|       |               const auto end = glz::to_chars(start, value);
  358|       |               ix += size_t(end - start);
  359|       |            }
  360|       |            else {
  361|       |               // Normal mode: use to_chars_40kb (40KB digit_quads table)
  362|       |               const auto end = glz::to_chars_40kb(start, value);
  363|       |               ix += size_t(end - start);
  364|       |            }
  365|       |         }
  366|       |         else if constexpr (std::integral<V>) {
  367|       |            // Handle other integral types (char, wchar_t, etc.) by casting to sized types
  368|       |            using X = std::decay_t<decltype(sized_integer_conversion<V>())>;
  369|       |            const auto start = reinterpret_cast<char*>(&b[ix]);
  370|       |            if constexpr (is_size_optimized(Opts)) {
  371|       |               // Size mode: use glz::to_chars (400B lookup tables)
  372|       |               const auto end = glz::to_chars(start, static_cast<X>(value));
  373|       |               ix += size_t(end - start);
  374|       |            }
  375|       |            else {
  376|       |               // Normal mode: use to_chars_40kb
  377|       |               const auto end = glz::to_chars_40kb(start, static_cast<X>(value));
  378|       |               ix += size_t(end - start);
  379|       |            }
  380|       |         }
  381|       |         else {
  382|       |            static_assert(false_v<V>, "type is not supported");
  383|       |         }
  384|   496k|      }

_ZN3glz9sweethash7sweet32ITkNS0_16contiguous_rangeENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEEEjRKT_j:
  270|  7.49M|   {
  271|  7.49M|      return sweet32(static_cast<const void*>(s.data()), s.size(), seed);
  272|  7.49M|   }
_ZN3glz9sweethash7sweet32EPKvmj:
  154|  7.49M|   {
  155|  7.49M|      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|  7.49M|      if (len <= 8) {
  ------------------
  |  Branch (158:11): [True: 6.43M, False: 1.05M]
  ------------------
  159|  6.43M|         uint64_t v = 0;
  160|  6.43M|         switch (len) {
  161|   149k|         case 8:
  ------------------
  |  Branch (161:10): [True: 149k, False: 6.29M]
  ------------------
  162|   149k|            std::memcpy(&v, p, 8);
  163|   149k|            break;
  164|   171k|         case 7:
  ------------------
  |  Branch (164:10): [True: 171k, False: 6.26M]
  ------------------
  165|   171k|            std::memcpy(&v, p, 7);
  166|   171k|            break;
  167|   333k|         case 6:
  ------------------
  |  Branch (167:10): [True: 333k, False: 6.10M]
  ------------------
  168|   333k|            std::memcpy(&v, p, 6);
  169|   333k|            break;
  170|   374k|         case 5:
  ------------------
  |  Branch (170:10): [True: 374k, False: 6.06M]
  ------------------
  171|   374k|            std::memcpy(&v, p, 5);
  172|   374k|            break;
  173|   580k|         case 4:
  ------------------
  |  Branch (173:10): [True: 580k, False: 5.85M]
  ------------------
  174|   580k|            std::memcpy(&v, p, 4);
  175|   580k|            break;
  176|  1.12M|         case 3:
  ------------------
  |  Branch (176:10): [True: 1.12M, False: 5.31M]
  ------------------
  177|  1.12M|            std::memcpy(&v, p, 3);
  178|  1.12M|            break;
  179|  1.62M|         case 2:
  ------------------
  |  Branch (179:10): [True: 1.62M, False: 4.81M]
  ------------------
  180|  1.62M|            std::memcpy(&v, p, 2);
  181|  1.62M|            break;
  182|  1.56M|         case 1:
  ------------------
  |  Branch (182:10): [True: 1.56M, False: 4.87M]
  ------------------
  183|  1.56M|            v = p[0];
  184|  1.56M|            break;
  185|   516k|         default:
  ------------------
  |  Branch (185:10): [True: 516k, False: 5.92M]
  ------------------
  186|   516k|            break;
  187|  6.43M|         }
  188|  6.43M|         v = v ^ seed ^ (len + 1);
  189|  6.43M|         return static_cast<uint32_t>(v) ^ static_cast<uint32_t>(v >> 32);
  190|  6.43M|      }
  191|       |
  192|       |      // Full hash for inputs > 8 bytes
  193|  1.05M|      uint64_t seed64 = (static_cast<uint64_t>(seed) << 32) | static_cast<uint64_t>(seed);
  194|  1.05M|      uint64_t h = (seed64 ^ prime4) + (len * prime1);
  195|  1.05M|      const uint8_t* const end = p + len;
  196|       |
  197|  1.05M|      if (len >= 32) {
  ------------------
  |  Branch (197:11): [True: 202k, False: 857k]
  ------------------
  198|   202k|         uint64_t h1 = h;
  199|   202k|         uint64_t h2 = (seed64 * prime2) ^ prime3;
  200|   202k|         uint64_t h3 = (seed64 * prime3) ^ prime4;
  201|   202k|         uint64_t h4 = (seed64 * prime4) ^ prime5;
  202|       |
  203|  1.74M|         do {
  204|  1.74M|            uint64_t k1, k2, k3, k4;
  205|  1.74M|            std::memcpy(&k1, p, 8);
  206|  1.74M|            std::memcpy(&k2, p + 8, 8);
  207|  1.74M|            std::memcpy(&k3, p + 16, 8);
  208|  1.74M|            std::memcpy(&k4, p + 24, 8);
  209|       |
  210|  1.74M|            k1 = k1 * prime2;
  211|  1.74M|            k1 = k1 ^ (k1 >> 47);
  212|  1.74M|            h1 = h1 ^ k1;
  213|  1.74M|            h1 = h1 * prime1;
  214|       |
  215|  1.74M|            k2 = k2 * prime3;
  216|  1.74M|            k2 = k2 ^ (k2 >> 47);
  217|  1.74M|            h2 = h2 ^ k2;
  218|  1.74M|            h2 = h2 * prime2;
  219|       |
  220|  1.74M|            k3 = k3 * prime4;
  221|  1.74M|            k3 = k3 ^ (k3 >> 47);
  222|  1.74M|            h3 = h3 ^ k3;
  223|  1.74M|            h3 = h3 * prime3;
  224|       |
  225|  1.74M|            k4 = k4 * prime5;
  226|  1.74M|            k4 = k4 ^ (k4 >> 47);
  227|  1.74M|            h4 = h4 ^ k4;
  228|  1.74M|            h4 = h4 * prime4;
  229|       |
  230|  1.74M|            p = p + 32;
  231|  1.74M|            len = len - 32;
  232|  1.74M|         } while (len >= 32);
  ------------------
  |  Branch (232:19): [True: 1.54M, False: 202k]
  ------------------
  233|       |
  234|   202k|         h = h1 + h2 + h3 + h4;
  235|   202k|      }
  236|       |
  237|  2.53M|      while (len >= 8) {
  ------------------
  |  Branch (237:14): [True: 1.47M, False: 1.05M]
  ------------------
  238|  1.47M|         uint64_t k;
  239|  1.47M|         std::memcpy(&k, p, 8);
  240|  1.47M|         k = k * prime2;
  241|  1.47M|         k = k ^ (k >> 47);
  242|  1.47M|         h = h ^ k;
  243|  1.47M|         h = h * prime1;
  244|  1.47M|         p = p + 8;
  245|  1.47M|         len = len - 8;
  246|  1.47M|      }
  247|       |
  248|  1.05M|      if (len > 0) {
  ------------------
  |  Branch (248:11): [True: 985k, False: 74.8k]
  ------------------
  249|   985k|         uint64_t k;
  250|   985k|         std::memcpy(&k, end - 8, 8);
  251|   985k|         k = k * prime2;
  252|   985k|         k = k ^ (k >> 47);
  253|   985k|         k = k * prime3;
  254|   985k|         h = h ^ k;
  255|   985k|      }
  256|       |
  257|  1.05M|      h = mix64(h);
  258|  1.05M|      return static_cast<uint32_t>(h) ^ static_cast<uint32_t>(h >> 32);
  259|  7.49M|   }
_ZN3glz9sweethash5mix64Em:
   33|  1.05M|   {
   34|  1.05M|      v = v ^ (v >> 33);
   35|  1.05M|      v = v * prime2;
   36|  1.05M|      v = v ^ (v >> 29);
   37|  1.05M|      v = v * prime3;
   38|  1.05M|      return v;
   39|  1.05M|   }

_ZN3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEC2Ev:
  411|  39.7M|      generic_json() = default;
_ZN3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEED2Ev:
  131|  66.7M|      ~generic_json() = default;
_ZN3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEaSEDn:
  272|    188|      {
  273|    188|         data = value;
  274|    188|         return *this;
  275|    188|      }
_ZN3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEaSEOS3_:
  425|  9.38M|      {
  426|  9.38M|         val_t value = std::move(other.data);
  427|  9.38M|         data = std::move(value);
  428|  9.38M|         return *this;
  429|  9.38M|      }
_ZN3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEC2EOS3_:
  413|  26.9M|      generic_json(generic_json&& other) noexcept : data(std::move(other.data)) {}
_ZN3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEixITkNSt3__114convertible_toINS5_17basic_string_viewIcNS5_11char_traitsIcEEEEEERNS5_12basic_stringIcS9_NS5_9allocatorIcEEEEEERS3_OT_:
  245|  96.9k|      {
  246|  96.9k|         if (holds<null_t>()) data = object_t{};
  ------------------
  |  Branch (246:14): [True: 96.9k, False: 0]
  ------------------
  247|  96.9k|         auto* object = std::get_if<object_t>(&data);
  248|  96.9k|         if (!object) [[unlikely]] {
  ------------------
  |  Branch (248:14): [True: 0, False: 96.9k]
  ------------------
  249|      0|            key_type_mismatch(key);
  250|      0|         }
  251|  96.9k|         auto iter = object->find(key);
  252|  96.9k|         if (iter == object->end()) {
  ------------------
  |  Branch (252:14): [True: 96.9k, False: 0]
  ------------------
  253|  96.9k|            iter = object->insert(std::make_pair(std::string(std::forward<decltype(key)>(key)), generic_json{})).first;
  254|  96.9k|         }
  255|  96.9k|         return iter->second;
  256|  96.9k|      }
_ZNK3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEE5holdsIDnEEbv:
  224|  4.33M|      {
  225|  4.33M|         return std::holds_alternative<T>(data);
  226|  4.33M|      }
_ZNK3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEE7is_nullEv:
  505|  4.23M|      [[nodiscard]] bool is_null() const noexcept { return holds<std::nullptr_t>(); }
_ZN3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEE6get_ifINSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEEEPT_v:
  176|  5.89M|      {
  177|  5.89M|         return std::get_if<T>(&data);
  178|  5.89M|      }
_ZNK3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEE4sizeEv:
  621|  18.5k|      {
  622|  18.5k|         if (auto* v = get_if<object_t>()) {
  ------------------
  |  Branch (622:20): [True: 10.0k, False: 8.55k]
  ------------------
  623|  10.0k|            return v->size();
  624|  10.0k|         }
  625|  8.55k|         else if (auto* v = get_if<array_t>()) {
  ------------------
  |  Branch (625:25): [True: 2.24k, False: 6.31k]
  ------------------
  626|  2.24k|            return v->size();
  627|  2.24k|         }
  628|  6.31k|         else if (auto* v = get_if<std::string>()) {
  ------------------
  |  Branch (628:25): [True: 3.14k, False: 3.16k]
  ------------------
  629|  3.14k|            return v->size();
  630|  3.14k|         }
  631|  3.16k|         else {
  632|  3.16k|            return 0;
  633|  3.16k|         }
  634|  18.5k|      }
_ZNK3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEE6get_ifINS2_IS3_EEEEPKT_v:
  182|  18.5k|      {
  183|  18.5k|         return std::get_if<T>(&data);
  184|  18.5k|      }
_ZNK3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEE6get_ifINSt3__16vectorIS3_NS5_9allocatorIS3_EEEEEEPKT_v:
  182|  8.55k|      {
  183|  8.55k|         return std::get_if<T>(&data);
  184|  8.55k|      }
_ZNK3glz12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEE6get_ifINSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEEEPKT_v:
  182|  6.31k|      {
  183|  6.31k|         return std::get_if<T>(&data);
  184|  6.31k|      }

_ZN3glz10write_jsonITkNS_15write_supportedIL_ZNS_4JSONEEEERNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_13output_bufferERNSt3__112basic_stringIcNS7_11char_traitsIcEENS7_9allocatorIcEEEEEENS_9error_ctxEOT_OT0_:
 2904|  5.11M|   {
 2905|  5.11M|      return write<opts{}>(std::forward<T>(value), std::forward<Buffer>(buffer));
 2906|  5.11M|   }
_ZN3glz2toILj10ENS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS4_TkNS_10is_contextERNS_7contextERNSt3__112basic_stringIcNSB_11char_traitsIcEENSB_9allocatorIcEEEERmEEvOT0_OT1_OT2_OT3_:
  525|  19.1M|      {
  526|  19.1M|         using V = std::remove_cvref_t<decltype(get_member(std::declval<Value>(), meta_wrapper_v<T>))>;
  527|  19.1M|         to<JSON, V>::template op<Opts>(get_member(std::forward<Value>(value), meta_wrapper_v<T>),
  528|  19.1M|                                        std::forward<Ctx>(ctx), std::forward<B>(b), std::forward<IX>(ix));
  529|  19.1M|      }
_ZN3glz2toILj10ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS8_RSH_TkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_:
 1955|  19.1M|      {
 1956|       |         // Adjacent tagging needs no per-alternative dispatch: the discriminator and the value are
 1957|       |         // written side by side whatever the alternative is. The visit below still instantiates in
 1958|       |         // that mode (`if constexpr` does not discard the statements after it), but both of its
 1959|       |         // tagged branches are compile-time dead there and the runtime `return` keeps it unreached.
 1960|       |         if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::adjacent) {
 1961|       |            write_adjacent<Opts>(value, ctx, b, ix);
 1962|       |            return;
 1963|       |         }
 1964|  19.1M|         std::visit(
 1965|  19.1M|            [&](auto&& val) {
 1966|  19.1M|               using V = std::decay_t<decltype(val)>;
 1967|       |
 1968|  19.1M|               if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 1969|  19.1M|                             custom_write<V>) {
 1970|       |                  // Custom alternative: the user's serializer emits the object body, into which we
 1971|       |                  // merge the variant tag. For this to produce valid JSON the custom to<> must (1)
 1972|       |                  // write an object body and (2) honor opening_and_closing_handled (suppress its own
 1973|       |                  // braces) so the tag shares the alternative's object. A custom writer that emits a
 1974|       |                  // scalar/array, or that ignores those flags, would yield malformed output.
 1975|       |                  //
 1976|       |                  // The tag-emission below mirrors the reflected-object branch that follows; keep the
 1977|       |                  // two in sync. The body size is not known at compile time, so we always write the
 1978|       |                  // tag separator and then drop it at runtime if the body turned out empty.
 1979|  19.1M|                  if (missing_id(value, ctx)) {
 1980|  19.1M|                     return;
 1981|  19.1M|                  }
 1982|  19.1M|                  using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 1983|  19.1M|                  if constexpr (Opts.prettify) {
 1984|  19.1M|                     dump("{\n", b, ix);
 1985|  19.1M|                     ctx.depth += check_indentation_width(Opts);
 1986|  19.1M|                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 1987|  19.1M|                     dump('"', b, ix);
 1988|  19.1M|                     dump_maybe_empty(tag_v<T>, b, ix);
 1989|  19.1M|                     if constexpr (std::integral<id_type>) {
 1990|  19.1M|                        dump("\": ", b, ix);
 1991|  19.1M|                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 1992|  19.1M|                     }
 1993|  19.1M|                     else {
 1994|  19.1M|                        dump("\": \"", b, ix);
 1995|  19.1M|                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 1996|  19.1M|                        dump('"', b, ix);
 1997|  19.1M|                     }
 1998|  19.1M|                     const auto pos_after_tag = ix;
 1999|  19.1M|                     dump(",\n", b, ix);
 2000|  19.1M|                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2001|  19.1M|                     const auto pos_body_start = ix;
 2002|  19.1M|                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2003|  19.1M|                     if (ix == pos_body_start) {
 2004|  19.1M|                        ix = pos_after_tag; // custom body was empty: undo the tag separator
 2005|  19.1M|                     }
 2006|  19.1M|                     ctx.depth -= check_indentation_width(Opts);
 2007|  19.1M|                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2008|  19.1M|                        return;
 2009|  19.1M|                     }
 2010|  19.1M|                     std::memcpy(&b[ix], "\n", 1);
 2011|  19.1M|                     ++ix;
 2012|  19.1M|                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2013|  19.1M|                     ix += ctx.depth;
 2014|  19.1M|                     std::memcpy(&b[ix], "}", 1);
 2015|  19.1M|                     ++ix;
 2016|  19.1M|                  }
 2017|  19.1M|                  else {
 2018|  19.1M|                     dump("{\"", b, ix);
 2019|  19.1M|                     dump_maybe_empty(tag_v<T>, b, ix);
 2020|  19.1M|                     if constexpr (std::integral<id_type>) {
 2021|  19.1M|                        dump("\":", b, ix);
 2022|  19.1M|                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2023|  19.1M|                     }
 2024|  19.1M|                     else {
 2025|  19.1M|                        dump("\":\"", b, ix);
 2026|  19.1M|                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2027|  19.1M|                        dump('"', b, ix);
 2028|  19.1M|                     }
 2029|  19.1M|                     const auto pos_after_tag = ix;
 2030|  19.1M|                     dump(',', b, ix);
 2031|  19.1M|                     const auto pos_body_start = ix;
 2032|  19.1M|                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2033|  19.1M|                     if (ix == pos_body_start) {
 2034|  19.1M|                        ix = pos_after_tag; // custom body was empty: undo the tag separator
 2035|  19.1M|                     }
 2036|  19.1M|                     dump('}', b, ix);
 2037|  19.1M|                  }
 2038|  19.1M|               }
 2039|  19.1M|               else if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 2040|  19.1M|                                  variant_unit_alternative<V>) {
 2041|       |                  // A unit alternative carries no data, so internal tagging renders it as the
 2042|       |                  // discriminator alone -- the same object an empty struct alternative produces.
 2043|  19.1M|                  if (missing_id(value, ctx)) {
 2044|  19.1M|                     return;
 2045|  19.1M|                  }
 2046|  19.1M|                  if constexpr (Opts.prettify) {
 2047|  19.1M|                     dump("{\n", b, ix);
 2048|  19.1M|                     ctx.depth += check_indentation_width(Opts);
 2049|  19.1M|                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2050|  19.1M|                     dump('"', b, ix);
 2051|  19.1M|                     dump_maybe_empty(tag_v<T>, b, ix);
 2052|  19.1M|                     dump("\": ", b, ix);
 2053|  19.1M|                     write_id<Opts>(value, ctx, b, ix);
 2054|  19.1M|                     ctx.depth -= check_indentation_width(Opts);
 2055|  19.1M|                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2056|  19.1M|                        return;
 2057|  19.1M|                     }
 2058|  19.1M|                     std::memcpy(&b[ix], "\n", 1);
 2059|  19.1M|                     ++ix;
 2060|  19.1M|                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2061|  19.1M|                     ix += ctx.depth;
 2062|  19.1M|                     std::memcpy(&b[ix], "}", 1);
 2063|  19.1M|                     ++ix;
 2064|  19.1M|                  }
 2065|  19.1M|                  else {
 2066|  19.1M|                     dump("{\"", b, ix);
 2067|  19.1M|                     dump_maybe_empty(tag_v<T>, b, ix);
 2068|  19.1M|                     dump("\":", b, ix);
 2069|  19.1M|                     write_id<Opts>(value, ctx, b, ix);
 2070|  19.1M|                     dump('}', b, ix);
 2071|  19.1M|                  }
 2072|  19.1M|               }
 2073|  19.1M|               else if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 2074|  19.1M|                                  (glaze_object_t<V> || reflectable<V> || is_memory_object<V>) &&
 2075|  19.1M|                                  (not alternative_declares_key<V>(tag_v<T>))) {
 2076|       |                  // An alternative that declares a member named like the discriminator carries the
 2077|       |                  // discriminator itself, so no tag is merged here and the bare-write branch below
 2078|       |                  // handles it. Previously only `reflectable` alternatives were excluded; a
 2079|       |                  // `glaze_object_t` one fell through to this branch and emitted the key twice.
 2080|  19.1M|                  if (missing_id(value, ctx)) {
 2081|  19.1M|                     return;
 2082|  19.1M|                  }
 2083|  19.1M|                  constexpr auto N = []() {
 2084|  19.1M|                     if constexpr (is_memory_object<V>) {
 2085|  19.1M|                        return reflect<memory_type<V>>::size;
 2086|  19.1M|                     }
 2087|  19.1M|                     else {
 2088|  19.1M|                        return reflect<V>::size;
 2089|  19.1M|                     }
 2090|  19.1M|                  }();
 2091|       |
 2092|       |                  // must first write out type
 2093|  19.1M|                  if constexpr (Opts.prettify) {
 2094|  19.1M|                     dump("{\n", b, ix);
 2095|  19.1M|                     ctx.depth += check_indentation_width(Opts);
 2096|  19.1M|                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2097|  19.1M|                     dump('"', b, ix);
 2098|  19.1M|                     dump_maybe_empty(tag_v<T>, b, ix);
 2099|       |
 2100|  19.1M|                     using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 2101|       |
 2102|  19.1M|                     if constexpr (std::integral<id_type>) {
 2103|  19.1M|                        dump("\": ", b, ix);
 2104|  19.1M|                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2105|  19.1M|                        if constexpr (N > 0) {
 2106|  19.1M|                           dump(",\n", b, ix);
 2107|  19.1M|                           dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2108|  19.1M|                        }
 2109|  19.1M|                     }
 2110|  19.1M|                     else {
 2111|  19.1M|                        dump("\": \"", b, ix);
 2112|  19.1M|                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2113|  19.1M|                        if constexpr (N == 0) {
 2114|  19.1M|                           dump('"', b, ix);
 2115|  19.1M|                        }
 2116|  19.1M|                        else {
 2117|  19.1M|                           dump("\",\n", b, ix);
 2118|  19.1M|                           dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2119|  19.1M|                        }
 2120|  19.1M|                     }
 2121|  19.1M|                  }
 2122|  19.1M|                  else {
 2123|  19.1M|                     using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 2124|       |
 2125|  19.1M|                     dump("{\"", b, ix);
 2126|  19.1M|                     dump_maybe_empty(tag_v<T>, b, ix);
 2127|       |
 2128|  19.1M|                     if constexpr (std::integral<id_type>) {
 2129|  19.1M|                        dump("\":", b, ix);
 2130|  19.1M|                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2131|  19.1M|                        if constexpr (N > 0) {
 2132|  19.1M|                           dump(',', b, ix);
 2133|  19.1M|                        }
 2134|  19.1M|                     }
 2135|  19.1M|                     else {
 2136|  19.1M|                        dump("\":\"", b, ix);
 2137|  19.1M|                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2138|  19.1M|                        if constexpr (N == 0) {
 2139|  19.1M|                           dump('"', b, ix);
 2140|  19.1M|                        }
 2141|  19.1M|                        else {
 2142|  19.1M|                           dump("\",", b, ix);
 2143|  19.1M|                        }
 2144|  19.1M|                     }
 2145|  19.1M|                  }
 2146|  19.1M|                  if constexpr (is_memory_object<V>) {
 2147|  19.1M|                     if (!val) [[unlikely]] {
 2148|  19.1M|                        ctx.error = error_code::invalid_variant_object;
 2149|  19.1M|                        return;
 2150|  19.1M|                     }
 2151|  19.1M|                     to<JSON, memory_type<V>>::template op<opening_and_closing_handled<Opts>()>(*val, ctx, b, ix);
 2152|  19.1M|                  }
 2153|  19.1M|                  else {
 2154|  19.1M|                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2155|  19.1M|                  }
 2156|       |                  // If we skip everything then we may have an extra comma, which we want to revert
 2157|  19.1M|                  if constexpr (Opts.skip_null_members) {
 2158|  19.1M|                     if (b[ix - 1] == ',') {
 2159|  19.1M|                        --ix;
 2160|  19.1M|                     }
 2161|  19.1M|                  }
 2162|       |
 2163|  19.1M|                  if constexpr (Opts.prettify) {
 2164|  19.1M|                     ctx.depth -= check_indentation_width(Opts);
 2165|  19.1M|                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2166|  19.1M|                        return;
 2167|  19.1M|                     }
 2168|  19.1M|                     std::memcpy(&b[ix], "\n", 1);
 2169|  19.1M|                     ++ix;
 2170|  19.1M|                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2171|  19.1M|                     ix += ctx.depth;
 2172|  19.1M|                     std::memcpy(&b[ix], "}", 1);
 2173|  19.1M|                     ++ix;
 2174|  19.1M|                  }
 2175|  19.1M|                  else {
 2176|  19.1M|                     dump('}', b, ix);
 2177|  19.1M|                  }
 2178|  19.1M|               }
 2179|  19.1M|               else {
 2180|  19.1M|                  to<JSON, V>::template op<Opts>(val, ctx, b, ix);
 2181|  19.1M|               }
 2182|  19.1M|            },
 2183|  19.1M|            value);
 2184|  19.1M|      }
_ZZN3glz2toILj10ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS8_RSH_TkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_ENKUlOT_E_clIRDnEEDaSY_:
 1965|  8.28M|            [&](auto&& val) {
 1966|  8.28M|               using V = std::decay_t<decltype(val)>;
 1967|       |
 1968|       |               if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 1969|       |                             custom_write<V>) {
 1970|       |                  // Custom alternative: the user's serializer emits the object body, into which we
 1971|       |                  // merge the variant tag. For this to produce valid JSON the custom to<> must (1)
 1972|       |                  // write an object body and (2) honor opening_and_closing_handled (suppress its own
 1973|       |                  // braces) so the tag shares the alternative's object. A custom writer that emits a
 1974|       |                  // scalar/array, or that ignores those flags, would yield malformed output.
 1975|       |                  //
 1976|       |                  // The tag-emission below mirrors the reflected-object branch that follows; keep the
 1977|       |                  // two in sync. The body size is not known at compile time, so we always write the
 1978|       |                  // tag separator and then drop it at runtime if the body turned out empty.
 1979|       |                  if (missing_id(value, ctx)) {
 1980|       |                     return;
 1981|       |                  }
 1982|       |                  using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 1983|       |                  if constexpr (Opts.prettify) {
 1984|       |                     dump("{\n", b, ix);
 1985|       |                     ctx.depth += check_indentation_width(Opts);
 1986|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 1987|       |                     dump('"', b, ix);
 1988|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 1989|       |                     if constexpr (std::integral<id_type>) {
 1990|       |                        dump("\": ", b, ix);
 1991|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 1992|       |                     }
 1993|       |                     else {
 1994|       |                        dump("\": \"", b, ix);
 1995|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 1996|       |                        dump('"', b, ix);
 1997|       |                     }
 1998|       |                     const auto pos_after_tag = ix;
 1999|       |                     dump(",\n", b, ix);
 2000|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2001|       |                     const auto pos_body_start = ix;
 2002|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2003|       |                     if (ix == pos_body_start) {
 2004|       |                        ix = pos_after_tag; // custom body was empty: undo the tag separator
 2005|       |                     }
 2006|       |                     ctx.depth -= check_indentation_width(Opts);
 2007|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2008|       |                        return;
 2009|       |                     }
 2010|       |                     std::memcpy(&b[ix], "\n", 1);
 2011|       |                     ++ix;
 2012|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2013|       |                     ix += ctx.depth;
 2014|       |                     std::memcpy(&b[ix], "}", 1);
 2015|       |                     ++ix;
 2016|       |                  }
 2017|       |                  else {
 2018|       |                     dump("{\"", b, ix);
 2019|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2020|       |                     if constexpr (std::integral<id_type>) {
 2021|       |                        dump("\":", b, ix);
 2022|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2023|       |                     }
 2024|       |                     else {
 2025|       |                        dump("\":\"", b, ix);
 2026|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2027|       |                        dump('"', b, ix);
 2028|       |                     }
 2029|       |                     const auto pos_after_tag = ix;
 2030|       |                     dump(',', b, ix);
 2031|       |                     const auto pos_body_start = ix;
 2032|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2033|       |                     if (ix == pos_body_start) {
 2034|       |                        ix = pos_after_tag; // custom body was empty: undo the tag separator
 2035|       |                     }
 2036|       |                     dump('}', b, ix);
 2037|       |                  }
 2038|       |               }
 2039|       |               else if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 2040|       |                                  variant_unit_alternative<V>) {
 2041|       |                  // A unit alternative carries no data, so internal tagging renders it as the
 2042|       |                  // discriminator alone -- the same object an empty struct alternative produces.
 2043|       |                  if (missing_id(value, ctx)) {
 2044|       |                     return;
 2045|       |                  }
 2046|       |                  if constexpr (Opts.prettify) {
 2047|       |                     dump("{\n", b, ix);
 2048|       |                     ctx.depth += check_indentation_width(Opts);
 2049|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2050|       |                     dump('"', b, ix);
 2051|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2052|       |                     dump("\": ", b, ix);
 2053|       |                     write_id<Opts>(value, ctx, b, ix);
 2054|       |                     ctx.depth -= check_indentation_width(Opts);
 2055|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2056|       |                        return;
 2057|       |                     }
 2058|       |                     std::memcpy(&b[ix], "\n", 1);
 2059|       |                     ++ix;
 2060|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2061|       |                     ix += ctx.depth;
 2062|       |                     std::memcpy(&b[ix], "}", 1);
 2063|       |                     ++ix;
 2064|       |                  }
 2065|       |                  else {
 2066|       |                     dump("{\"", b, ix);
 2067|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2068|       |                     dump("\":", b, ix);
 2069|       |                     write_id<Opts>(value, ctx, b, ix);
 2070|       |                     dump('}', b, ix);
 2071|       |                  }
 2072|       |               }
 2073|       |               else if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 2074|       |                                  (glaze_object_t<V> || reflectable<V> || is_memory_object<V>) &&
 2075|       |                                  (not alternative_declares_key<V>(tag_v<T>))) {
 2076|       |                  // An alternative that declares a member named like the discriminator carries the
 2077|       |                  // discriminator itself, so no tag is merged here and the bare-write branch below
 2078|       |                  // handles it. Previously only `reflectable` alternatives were excluded; a
 2079|       |                  // `glaze_object_t` one fell through to this branch and emitted the key twice.
 2080|       |                  if (missing_id(value, ctx)) {
 2081|       |                     return;
 2082|       |                  }
 2083|       |                  constexpr auto N = []() {
 2084|       |                     if constexpr (is_memory_object<V>) {
 2085|       |                        return reflect<memory_type<V>>::size;
 2086|       |                     }
 2087|       |                     else {
 2088|       |                        return reflect<V>::size;
 2089|       |                     }
 2090|       |                  }();
 2091|       |
 2092|       |                  // must first write out type
 2093|       |                  if constexpr (Opts.prettify) {
 2094|       |                     dump("{\n", b, ix);
 2095|       |                     ctx.depth += check_indentation_width(Opts);
 2096|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2097|       |                     dump('"', b, ix);
 2098|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2099|       |
 2100|       |                     using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 2101|       |
 2102|       |                     if constexpr (std::integral<id_type>) {
 2103|       |                        dump("\": ", b, ix);
 2104|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2105|       |                        if constexpr (N > 0) {
 2106|       |                           dump(",\n", b, ix);
 2107|       |                           dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2108|       |                        }
 2109|       |                     }
 2110|       |                     else {
 2111|       |                        dump("\": \"", b, ix);
 2112|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2113|       |                        if constexpr (N == 0) {
 2114|       |                           dump('"', b, ix);
 2115|       |                        }
 2116|       |                        else {
 2117|       |                           dump("\",\n", b, ix);
 2118|       |                           dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2119|       |                        }
 2120|       |                     }
 2121|       |                  }
 2122|       |                  else {
 2123|       |                     using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 2124|       |
 2125|       |                     dump("{\"", b, ix);
 2126|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2127|       |
 2128|       |                     if constexpr (std::integral<id_type>) {
 2129|       |                        dump("\":", b, ix);
 2130|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2131|       |                        if constexpr (N > 0) {
 2132|       |                           dump(',', b, ix);
 2133|       |                        }
 2134|       |                     }
 2135|       |                     else {
 2136|       |                        dump("\":\"", b, ix);
 2137|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2138|       |                        if constexpr (N == 0) {
 2139|       |                           dump('"', b, ix);
 2140|       |                        }
 2141|       |                        else {
 2142|       |                           dump("\",", b, ix);
 2143|       |                        }
 2144|       |                     }
 2145|       |                  }
 2146|       |                  if constexpr (is_memory_object<V>) {
 2147|       |                     if (!val) [[unlikely]] {
 2148|       |                        ctx.error = error_code::invalid_variant_object;
 2149|       |                        return;
 2150|       |                     }
 2151|       |                     to<JSON, memory_type<V>>::template op<opening_and_closing_handled<Opts>()>(*val, ctx, b, ix);
 2152|       |                  }
 2153|       |                  else {
 2154|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2155|       |                  }
 2156|       |                  // If we skip everything then we may have an extra comma, which we want to revert
 2157|       |                  if constexpr (Opts.skip_null_members) {
 2158|       |                     if (b[ix - 1] == ',') {
 2159|       |                        --ix;
 2160|       |                     }
 2161|       |                  }
 2162|       |
 2163|       |                  if constexpr (Opts.prettify) {
 2164|       |                     ctx.depth -= check_indentation_width(Opts);
 2165|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2166|       |                        return;
 2167|       |                     }
 2168|       |                     std::memcpy(&b[ix], "\n", 1);
 2169|       |                     ++ix;
 2170|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2171|       |                     ix += ctx.depth;
 2172|       |                     std::memcpy(&b[ix], "}", 1);
 2173|       |                     ++ix;
 2174|       |                  }
 2175|       |                  else {
 2176|       |                     dump('}', b, ix);
 2177|       |                  }
 2178|       |               }
 2179|  8.28M|               else {
 2180|  8.28M|                  to<JSON, V>::template op<Opts>(val, ctx, b, ix);
 2181|  8.28M|               }
 2182|  8.28M|            },
_ZN3glz2toILj10EDnE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERDnTkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_:
 1849|  8.28M|      {
 1850|  8.28M|         if constexpr (not check_write_unchecked(Opts)) {
 1851|  8.28M|            if (!ensure_space(ctx, b, ix + 4)) [[unlikely]] {
  ------------------
  |  Branch (1851:17): [True: 0, False: 8.28M]
  ------------------
 1852|      0|               return;
 1853|      0|            }
 1854|  8.28M|         }
 1855|       |         if constexpr (std::endian::native == std::endian::big) {
 1856|       |            static constexpr char null_v[] = "null";
 1857|       |            std::memcpy(&b[ix], null_v, 4);
 1858|       |         }
 1859|  8.28M|         else {
 1860|  8.28M|            static constexpr uint32_t null_v = 1819047278;
 1861|  8.28M|            std::memcpy(&b[ix], &null_v, 4);
 1862|  8.28M|         }
 1863|  8.28M|         ix += 4;
 1864|  8.28M|      }
_ZZN3glz2toILj10ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS8_RSH_TkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_ENKUlOT_E_clIRdEEDaSY_:
 1965|   496k|            [&](auto&& val) {
 1966|   496k|               using V = std::decay_t<decltype(val)>;
 1967|       |
 1968|       |               if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 1969|       |                             custom_write<V>) {
 1970|       |                  // Custom alternative: the user's serializer emits the object body, into which we
 1971|       |                  // merge the variant tag. For this to produce valid JSON the custom to<> must (1)
 1972|       |                  // write an object body and (2) honor opening_and_closing_handled (suppress its own
 1973|       |                  // braces) so the tag shares the alternative's object. A custom writer that emits a
 1974|       |                  // scalar/array, or that ignores those flags, would yield malformed output.
 1975|       |                  //
 1976|       |                  // The tag-emission below mirrors the reflected-object branch that follows; keep the
 1977|       |                  // two in sync. The body size is not known at compile time, so we always write the
 1978|       |                  // tag separator and then drop it at runtime if the body turned out empty.
 1979|       |                  if (missing_id(value, ctx)) {
 1980|       |                     return;
 1981|       |                  }
 1982|       |                  using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 1983|       |                  if constexpr (Opts.prettify) {
 1984|       |                     dump("{\n", b, ix);
 1985|       |                     ctx.depth += check_indentation_width(Opts);
 1986|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 1987|       |                     dump('"', b, ix);
 1988|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 1989|       |                     if constexpr (std::integral<id_type>) {
 1990|       |                        dump("\": ", b, ix);
 1991|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 1992|       |                     }
 1993|       |                     else {
 1994|       |                        dump("\": \"", b, ix);
 1995|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 1996|       |                        dump('"', b, ix);
 1997|       |                     }
 1998|       |                     const auto pos_after_tag = ix;
 1999|       |                     dump(",\n", b, ix);
 2000|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2001|       |                     const auto pos_body_start = ix;
 2002|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2003|       |                     if (ix == pos_body_start) {
 2004|       |                        ix = pos_after_tag; // custom body was empty: undo the tag separator
 2005|       |                     }
 2006|       |                     ctx.depth -= check_indentation_width(Opts);
 2007|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2008|       |                        return;
 2009|       |                     }
 2010|       |                     std::memcpy(&b[ix], "\n", 1);
 2011|       |                     ++ix;
 2012|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2013|       |                     ix += ctx.depth;
 2014|       |                     std::memcpy(&b[ix], "}", 1);
 2015|       |                     ++ix;
 2016|       |                  }
 2017|       |                  else {
 2018|       |                     dump("{\"", b, ix);
 2019|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2020|       |                     if constexpr (std::integral<id_type>) {
 2021|       |                        dump("\":", b, ix);
 2022|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2023|       |                     }
 2024|       |                     else {
 2025|       |                        dump("\":\"", b, ix);
 2026|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2027|       |                        dump('"', b, ix);
 2028|       |                     }
 2029|       |                     const auto pos_after_tag = ix;
 2030|       |                     dump(',', b, ix);
 2031|       |                     const auto pos_body_start = ix;
 2032|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2033|       |                     if (ix == pos_body_start) {
 2034|       |                        ix = pos_after_tag; // custom body was empty: undo the tag separator
 2035|       |                     }
 2036|       |                     dump('}', b, ix);
 2037|       |                  }
 2038|       |               }
 2039|       |               else if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 2040|       |                                  variant_unit_alternative<V>) {
 2041|       |                  // A unit alternative carries no data, so internal tagging renders it as the
 2042|       |                  // discriminator alone -- the same object an empty struct alternative produces.
 2043|       |                  if (missing_id(value, ctx)) {
 2044|       |                     return;
 2045|       |                  }
 2046|       |                  if constexpr (Opts.prettify) {
 2047|       |                     dump("{\n", b, ix);
 2048|       |                     ctx.depth += check_indentation_width(Opts);
 2049|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2050|       |                     dump('"', b, ix);
 2051|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2052|       |                     dump("\": ", b, ix);
 2053|       |                     write_id<Opts>(value, ctx, b, ix);
 2054|       |                     ctx.depth -= check_indentation_width(Opts);
 2055|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2056|       |                        return;
 2057|       |                     }
 2058|       |                     std::memcpy(&b[ix], "\n", 1);
 2059|       |                     ++ix;
 2060|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2061|       |                     ix += ctx.depth;
 2062|       |                     std::memcpy(&b[ix], "}", 1);
 2063|       |                     ++ix;
 2064|       |                  }
 2065|       |                  else {
 2066|       |                     dump("{\"", b, ix);
 2067|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2068|       |                     dump("\":", b, ix);
 2069|       |                     write_id<Opts>(value, ctx, b, ix);
 2070|       |                     dump('}', b, ix);
 2071|       |                  }
 2072|       |               }
 2073|       |               else if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 2074|       |                                  (glaze_object_t<V> || reflectable<V> || is_memory_object<V>) &&
 2075|       |                                  (not alternative_declares_key<V>(tag_v<T>))) {
 2076|       |                  // An alternative that declares a member named like the discriminator carries the
 2077|       |                  // discriminator itself, so no tag is merged here and the bare-write branch below
 2078|       |                  // handles it. Previously only `reflectable` alternatives were excluded; a
 2079|       |                  // `glaze_object_t` one fell through to this branch and emitted the key twice.
 2080|       |                  if (missing_id(value, ctx)) {
 2081|       |                     return;
 2082|       |                  }
 2083|       |                  constexpr auto N = []() {
 2084|       |                     if constexpr (is_memory_object<V>) {
 2085|       |                        return reflect<memory_type<V>>::size;
 2086|       |                     }
 2087|       |                     else {
 2088|       |                        return reflect<V>::size;
 2089|       |                     }
 2090|       |                  }();
 2091|       |
 2092|       |                  // must first write out type
 2093|       |                  if constexpr (Opts.prettify) {
 2094|       |                     dump("{\n", b, ix);
 2095|       |                     ctx.depth += check_indentation_width(Opts);
 2096|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2097|       |                     dump('"', b, ix);
 2098|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2099|       |
 2100|       |                     using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 2101|       |
 2102|       |                     if constexpr (std::integral<id_type>) {
 2103|       |                        dump("\": ", b, ix);
 2104|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2105|       |                        if constexpr (N > 0) {
 2106|       |                           dump(",\n", b, ix);
 2107|       |                           dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2108|       |                        }
 2109|       |                     }
 2110|       |                     else {
 2111|       |                        dump("\": \"", b, ix);
 2112|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2113|       |                        if constexpr (N == 0) {
 2114|       |                           dump('"', b, ix);
 2115|       |                        }
 2116|       |                        else {
 2117|       |                           dump("\",\n", b, ix);
 2118|       |                           dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2119|       |                        }
 2120|       |                     }
 2121|       |                  }
 2122|       |                  else {
 2123|       |                     using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 2124|       |
 2125|       |                     dump("{\"", b, ix);
 2126|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2127|       |
 2128|       |                     if constexpr (std::integral<id_type>) {
 2129|       |                        dump("\":", b, ix);
 2130|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2131|       |                        if constexpr (N > 0) {
 2132|       |                           dump(',', b, ix);
 2133|       |                        }
 2134|       |                     }
 2135|       |                     else {
 2136|       |                        dump("\":\"", b, ix);
 2137|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2138|       |                        if constexpr (N == 0) {
 2139|       |                           dump('"', b, ix);
 2140|       |                        }
 2141|       |                        else {
 2142|       |                           dump("\",", b, ix);
 2143|       |                        }
 2144|       |                     }
 2145|       |                  }
 2146|       |                  if constexpr (is_memory_object<V>) {
 2147|       |                     if (!val) [[unlikely]] {
 2148|       |                        ctx.error = error_code::invalid_variant_object;
 2149|       |                        return;
 2150|       |                     }
 2151|       |                     to<JSON, memory_type<V>>::template op<opening_and_closing_handled<Opts>()>(*val, ctx, b, ix);
 2152|       |                  }
 2153|       |                  else {
 2154|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2155|       |                  }
 2156|       |                  // If we skip everything then we may have an extra comma, which we want to revert
 2157|       |                  if constexpr (Opts.skip_null_members) {
 2158|       |                     if (b[ix - 1] == ',') {
 2159|       |                        --ix;
 2160|       |                     }
 2161|       |                  }
 2162|       |
 2163|       |                  if constexpr (Opts.prettify) {
 2164|       |                     ctx.depth -= check_indentation_width(Opts);
 2165|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2166|       |                        return;
 2167|       |                     }
 2168|       |                     std::memcpy(&b[ix], "\n", 1);
 2169|       |                     ++ix;
 2170|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2171|       |                     ix += ctx.depth;
 2172|       |                     std::memcpy(&b[ix], "}", 1);
 2173|       |                     ++ix;
 2174|       |                  }
 2175|       |                  else {
 2176|       |                     dump('}', b, ix);
 2177|       |                  }
 2178|       |               }
 2179|   496k|               else {
 2180|   496k|                  to<JSON, V>::template op<Opts>(val, ctx, b, ix);
 2181|   496k|               }
 2182|   496k|            },
_ZN3glz2toILj10EdE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERdTkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_:
  814|   496k|      {
  815|   496k|         if constexpr (not check_write_unchecked(Opts)) {
  816|   496k|            static_assert(required_padding<T>());
  817|   496k|            if (!ensure_space(ctx, b, ix + required_padding<T>())) [[unlikely]] {
  ------------------
  |  Branch (817:17): [True: 0, False: 496k]
  ------------------
  818|      0|               return;
  819|      0|            }
  820|   496k|         }
  821|       |
  822|   496k|         static constexpr auto O = write_unchecked_on<Opts>();
  823|       |
  824|       |         if constexpr (check_quoted_num(Opts)) {
  825|       |            std::memcpy(&b[ix], "\"", 1);
  826|       |            ++ix;
  827|       |            write_chars::op<O>(value, ctx, b, ix);
  828|       |            std::memcpy(&b[ix], "\"", 1);
  829|       |            ++ix;
  830|       |         }
  831|   496k|         else {
  832|   496k|            write_chars::op<O>(value, ctx, b, ix);
  833|   496k|         }
  834|   496k|      }
_ZN3glz16required_paddingIdEEmv:
  538|   496k|   {
  539|   496k|      constexpr auto value = []() -> size_t {
  540|   496k|         if constexpr (boolean_like<T>) {
  541|   496k|            return 8;
  542|   496k|         }
  543|   496k|         else if constexpr (num_t<T>) {
  544|   496k|            if constexpr (std::floating_point<T>) {
  545|   496k|               if constexpr (sizeof(T) > 8) {
  546|   496k|                  return 64;
  547|   496k|               }
  548|   496k|               else if constexpr (sizeof(T) > 4) {
  549|       |                  // zmij scratch + 4 for optional quotes and trailing comma.
  550|   496k|                  return zmij::double_buffer_size + 4;
  551|   496k|               }
  552|   496k|               else {
  553|   496k|                  return zmij::float_buffer_size + 4;
  554|   496k|               }
  555|   496k|            }
  556|   496k|            else if constexpr (sizeof(T) > 4) {
  557|   496k|               return 24;
  558|   496k|            }
  559|   496k|            else if constexpr (sizeof(T) > 2) {
  560|   496k|               return 16;
  561|   496k|            }
  562|   496k|            else {
  563|   496k|               return 8;
  564|   496k|            }
  565|   496k|         }
  566|   496k|         else if constexpr (nullable_like<T>) {
  567|   496k|            if constexpr (has_value_type<T>) {
  568|   496k|               return required_padding<typename T::value_type>();
  569|   496k|            }
  570|   496k|            else if constexpr (has_element_type<T>) {
  571|   496k|               return required_padding<typename T::element_type>();
  572|   496k|            }
  573|   496k|            else {
  574|   496k|               return 0;
  575|   496k|            }
  576|   496k|         }
  577|   496k|         else if constexpr (always_null_t<T>) {
  578|   496k|            return 8;
  579|   496k|         }
  580|   496k|         else {
  581|   496k|            return 0;
  582|   496k|         }
  583|   496k|      }();
  584|       |
  585|       |      if constexpr (value >= (write_padding_bytes - 16)) {
  586|       |         // we always require 16 bytes available from write_padding_bytes
  587|       |         // for opening and closing characters
  588|       |         return 0;
  589|       |      }
  590|   496k|      return value;
  591|   496k|   }
_ZZN3glz2toILj10ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS8_RSH_TkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_ENKUlOT_E_clISL_EEDaSY_:
 1965|  1.85M|            [&](auto&& val) {
 1966|  1.85M|               using V = std::decay_t<decltype(val)>;
 1967|       |
 1968|       |               if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 1969|       |                             custom_write<V>) {
 1970|       |                  // Custom alternative: the user's serializer emits the object body, into which we
 1971|       |                  // merge the variant tag. For this to produce valid JSON the custom to<> must (1)
 1972|       |                  // write an object body and (2) honor opening_and_closing_handled (suppress its own
 1973|       |                  // braces) so the tag shares the alternative's object. A custom writer that emits a
 1974|       |                  // scalar/array, or that ignores those flags, would yield malformed output.
 1975|       |                  //
 1976|       |                  // The tag-emission below mirrors the reflected-object branch that follows; keep the
 1977|       |                  // two in sync. The body size is not known at compile time, so we always write the
 1978|       |                  // tag separator and then drop it at runtime if the body turned out empty.
 1979|       |                  if (missing_id(value, ctx)) {
 1980|       |                     return;
 1981|       |                  }
 1982|       |                  using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 1983|       |                  if constexpr (Opts.prettify) {
 1984|       |                     dump("{\n", b, ix);
 1985|       |                     ctx.depth += check_indentation_width(Opts);
 1986|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 1987|       |                     dump('"', b, ix);
 1988|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 1989|       |                     if constexpr (std::integral<id_type>) {
 1990|       |                        dump("\": ", b, ix);
 1991|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 1992|       |                     }
 1993|       |                     else {
 1994|       |                        dump("\": \"", b, ix);
 1995|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 1996|       |                        dump('"', b, ix);
 1997|       |                     }
 1998|       |                     const auto pos_after_tag = ix;
 1999|       |                     dump(",\n", b, ix);
 2000|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2001|       |                     const auto pos_body_start = ix;
 2002|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2003|       |                     if (ix == pos_body_start) {
 2004|       |                        ix = pos_after_tag; // custom body was empty: undo the tag separator
 2005|       |                     }
 2006|       |                     ctx.depth -= check_indentation_width(Opts);
 2007|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2008|       |                        return;
 2009|       |                     }
 2010|       |                     std::memcpy(&b[ix], "\n", 1);
 2011|       |                     ++ix;
 2012|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2013|       |                     ix += ctx.depth;
 2014|       |                     std::memcpy(&b[ix], "}", 1);
 2015|       |                     ++ix;
 2016|       |                  }
 2017|       |                  else {
 2018|       |                     dump("{\"", b, ix);
 2019|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2020|       |                     if constexpr (std::integral<id_type>) {
 2021|       |                        dump("\":", b, ix);
 2022|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2023|       |                     }
 2024|       |                     else {
 2025|       |                        dump("\":\"", b, ix);
 2026|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2027|       |                        dump('"', b, ix);
 2028|       |                     }
 2029|       |                     const auto pos_after_tag = ix;
 2030|       |                     dump(',', b, ix);
 2031|       |                     const auto pos_body_start = ix;
 2032|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2033|       |                     if (ix == pos_body_start) {
 2034|       |                        ix = pos_after_tag; // custom body was empty: undo the tag separator
 2035|       |                     }
 2036|       |                     dump('}', b, ix);
 2037|       |                  }
 2038|       |               }
 2039|       |               else if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 2040|       |                                  variant_unit_alternative<V>) {
 2041|       |                  // A unit alternative carries no data, so internal tagging renders it as the
 2042|       |                  // discriminator alone -- the same object an empty struct alternative produces.
 2043|       |                  if (missing_id(value, ctx)) {
 2044|       |                     return;
 2045|       |                  }
 2046|       |                  if constexpr (Opts.prettify) {
 2047|       |                     dump("{\n", b, ix);
 2048|       |                     ctx.depth += check_indentation_width(Opts);
 2049|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2050|       |                     dump('"', b, ix);
 2051|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2052|       |                     dump("\": ", b, ix);
 2053|       |                     write_id<Opts>(value, ctx, b, ix);
 2054|       |                     ctx.depth -= check_indentation_width(Opts);
 2055|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2056|       |                        return;
 2057|       |                     }
 2058|       |                     std::memcpy(&b[ix], "\n", 1);
 2059|       |                     ++ix;
 2060|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2061|       |                     ix += ctx.depth;
 2062|       |                     std::memcpy(&b[ix], "}", 1);
 2063|       |                     ++ix;
 2064|       |                  }
 2065|       |                  else {
 2066|       |                     dump("{\"", b, ix);
 2067|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2068|       |                     dump("\":", b, ix);
 2069|       |                     write_id<Opts>(value, ctx, b, ix);
 2070|       |                     dump('}', b, ix);
 2071|       |                  }
 2072|       |               }
 2073|       |               else if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 2074|       |                                  (glaze_object_t<V> || reflectable<V> || is_memory_object<V>) &&
 2075|       |                                  (not alternative_declares_key<V>(tag_v<T>))) {
 2076|       |                  // An alternative that declares a member named like the discriminator carries the
 2077|       |                  // discriminator itself, so no tag is merged here and the bare-write branch below
 2078|       |                  // handles it. Previously only `reflectable` alternatives were excluded; a
 2079|       |                  // `glaze_object_t` one fell through to this branch and emitted the key twice.
 2080|       |                  if (missing_id(value, ctx)) {
 2081|       |                     return;
 2082|       |                  }
 2083|       |                  constexpr auto N = []() {
 2084|       |                     if constexpr (is_memory_object<V>) {
 2085|       |                        return reflect<memory_type<V>>::size;
 2086|       |                     }
 2087|       |                     else {
 2088|       |                        return reflect<V>::size;
 2089|       |                     }
 2090|       |                  }();
 2091|       |
 2092|       |                  // must first write out type
 2093|       |                  if constexpr (Opts.prettify) {
 2094|       |                     dump("{\n", b, ix);
 2095|       |                     ctx.depth += check_indentation_width(Opts);
 2096|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2097|       |                     dump('"', b, ix);
 2098|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2099|       |
 2100|       |                     using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 2101|       |
 2102|       |                     if constexpr (std::integral<id_type>) {
 2103|       |                        dump("\": ", b, ix);
 2104|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2105|       |                        if constexpr (N > 0) {
 2106|       |                           dump(",\n", b, ix);
 2107|       |                           dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2108|       |                        }
 2109|       |                     }
 2110|       |                     else {
 2111|       |                        dump("\": \"", b, ix);
 2112|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2113|       |                        if constexpr (N == 0) {
 2114|       |                           dump('"', b, ix);
 2115|       |                        }
 2116|       |                        else {
 2117|       |                           dump("\",\n", b, ix);
 2118|       |                           dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2119|       |                        }
 2120|       |                     }
 2121|       |                  }
 2122|       |                  else {
 2123|       |                     using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 2124|       |
 2125|       |                     dump("{\"", b, ix);
 2126|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2127|       |
 2128|       |                     if constexpr (std::integral<id_type>) {
 2129|       |                        dump("\":", b, ix);
 2130|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2131|       |                        if constexpr (N > 0) {
 2132|       |                           dump(',', b, ix);
 2133|       |                        }
 2134|       |                     }
 2135|       |                     else {
 2136|       |                        dump("\":\"", b, ix);
 2137|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2138|       |                        if constexpr (N == 0) {
 2139|       |                           dump('"', b, ix);
 2140|       |                        }
 2141|       |                        else {
 2142|       |                           dump("\",", b, ix);
 2143|       |                        }
 2144|       |                     }
 2145|       |                  }
 2146|       |                  if constexpr (is_memory_object<V>) {
 2147|       |                     if (!val) [[unlikely]] {
 2148|       |                        ctx.error = error_code::invalid_variant_object;
 2149|       |                        return;
 2150|       |                     }
 2151|       |                     to<JSON, memory_type<V>>::template op<opening_and_closing_handled<Opts>()>(*val, ctx, b, ix);
 2152|       |                  }
 2153|       |                  else {
 2154|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2155|       |                  }
 2156|       |                  // If we skip everything then we may have an extra comma, which we want to revert
 2157|       |                  if constexpr (Opts.skip_null_members) {
 2158|       |                     if (b[ix - 1] == ',') {
 2159|       |                        --ix;
 2160|       |                     }
 2161|       |                  }
 2162|       |
 2163|       |                  if constexpr (Opts.prettify) {
 2164|       |                     ctx.depth -= check_indentation_width(Opts);
 2165|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2166|       |                        return;
 2167|       |                     }
 2168|       |                     std::memcpy(&b[ix], "\n", 1);
 2169|       |                     ++ix;
 2170|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2171|       |                     ix += ctx.depth;
 2172|       |                     std::memcpy(&b[ix], "}", 1);
 2173|       |                     ++ix;
 2174|       |                  }
 2175|       |                  else {
 2176|       |                     dump('}', b, ix);
 2177|       |                  }
 2178|       |               }
 2179|  1.85M|               else {
 2180|  1.85M|                  to<JSON, V>::template op<Opts>(val, ctx, b, ix);
 2181|  1.85M|               }
 2182|  1.85M|            },
_ZN3glz2toILj10ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS7_SB_TkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_:
  845|  1.85M|      {
  846|       |         if constexpr (check_string_as_number(Opts)) {
  847|       |            const sv str = [&]() -> const sv {
  848|       |               if constexpr (array_char_t<T>) {
  849|       |                  const auto* start = value.data();
  850|       |                  const auto* end = static_cast<const char*>(std::memchr(start, '\0', value.size()));
  851|       |                  return sv{start, end ? size_t(end - start) : value.size()};
  852|       |               }
  853|       |               else if constexpr (u8str_t<T>) {
  854|       |                  return sv{reinterpret_cast<const char*>(value.data()), value.size()};
  855|       |               }
  856|       |               else {
  857|       |                  return str_view<T>(value);
  858|       |               }
  859|       |            }();
  860|       |            if (!ensure_space(ctx, b, ix + str.size() + write_padding_bytes)) [[unlikely]] {
  861|       |               return;
  862|       |            }
  863|       |            dump_maybe_empty<false>(str, b, ix);
  864|       |         }
  865|       |         else if constexpr (char_t<T>) {
  866|       |            if constexpr (check_unquoted(Opts)) {
  867|       |               dump(value, b, ix);
  868|       |            }
  869|       |            else {
  870|       |               // 8 bytes is enough for quotes and escaped character (worst case: \uXXXX = 6 + 2 quotes)
  871|       |               if (!ensure_space(ctx, b, ix + 8)) [[unlikely]] {
  872|       |                  return;
  873|       |               }
  874|       |
  875|       |               std::memcpy(&b[ix], "\"", 1);
  876|       |               ++ix;
  877|       |               if (const auto escaped = char_escape_table[uint8_t(value)]; escaped) {
  878|       |                  std::memcpy(&b[ix], &escaped, 2);
  879|       |                  ix += 2;
  880|       |               }
  881|       |               else if (value == '\0') {
  882|       |                  // null character treated as empty string
  883|       |               }
  884|       |               else if constexpr (check_escape_control_characters(Opts)) {
  885|       |                  if (uint8_t(value) < 0x20) {
  886|       |                     // Write as \uXXXX format
  887|       |                     char unicode_escape[6] = {'\\', 'u', '0', '0', '0', '0'};
  888|       |                     constexpr char hex_digits[] = "0123456789ABCDEF";
  889|       |                     unicode_escape[4] = hex_digits[(value >> 4) & 0xF];
  890|       |                     unicode_escape[5] = hex_digits[value & 0xF];
  891|       |                     std::memcpy(&b[ix], unicode_escape, 6);
  892|       |                     ix += 6;
  893|       |                  }
  894|       |                  else {
  895|       |                     std::memcpy(&b[ix], &value, 1);
  896|       |                     ++ix;
  897|       |                  }
  898|       |               }
  899|       |               else {
  900|       |                  if constexpr (check_reject_control_characters(Opts)) {
  901|       |                     if (uint8_t(value) < 0x20) [[unlikely]] {
  902|       |                        ctx.error = error_code::invalid_control_character;
  903|       |                     }
  904|       |                  }
  905|       |                  std::memcpy(&b[ix], &value, 1);
  906|       |                  ++ix;
  907|       |               }
  908|       |               std::memcpy(&b[ix], "\"", 1);
  909|       |               ++ix;
  910|       |            }
  911|       |         }
  912|  1.85M|         else {
  913|       |            if constexpr (check_raw_string(Opts)) {
  914|       |               const sv str = [&]() -> const sv {
  915|       |                  if constexpr (u8str_t<T>) {
  916|       |                     return sv{reinterpret_cast<const char*>(value.data()), value.size()};
  917|       |                  }
  918|       |                  else {
  919|       |                     return str_view<T>(value);
  920|       |                  }
  921|       |               }();
  922|       |
  923|       |               // We need space for quotes and the string length: 2 + n.
  924|       |               // Use +8 for extra buffer
  925|       |               if (!ensure_space(ctx, b, ix + 8 + str.size())) [[unlikely]] {
  926|       |                  return;
  927|       |               }
  928|       |               // now we don't have to check writing
  929|       |
  930|       |               if constexpr (not check_unquoted(Opts)) {
  931|       |                  std::memcpy(&b[ix], "\"", 1);
  932|       |                  ++ix;
  933|       |               }
  934|       |               if (str.size()) [[likely]] {
  935|       |                  const auto n = str.size();
  936|       |                  std::memcpy(&b[ix], str.data(), n);
  937|       |                  ix += n;
  938|       |               }
  939|       |               if constexpr (not check_unquoted(Opts)) {
  940|       |                  std::memcpy(&b[ix], "\"", 1);
  941|       |                  ++ix;
  942|       |               }
  943|       |            }
  944|  1.85M|            else {
  945|  1.85M|               const sv str = [&]() -> const sv {
  946|  1.85M|                  if constexpr (array_char_t<T>) {
  947|  1.85M|                     return sv{value.data(), value.size()};
  948|  1.85M|                  }
  949|  1.85M|                  else if constexpr (u8str_t<T>) {
  950|  1.85M|                     return sv{reinterpret_cast<const char*>(value.data()), value.size()};
  951|  1.85M|                  }
  952|  1.85M|                  else {
  953|  1.85M|                     return str_view<T>(value);
  954|  1.85M|                  }
  955|  1.85M|               }();
  956|  1.85M|               const auto n = str.size();
  957|       |
  958|       |               // In the case n == 0 we need two characters for quotes.
  959|       |               // For each individual character we need room for two characters to handle escapes.
  960|       |               // When using Unicode escapes, we might need up to 6 characters (\uXXXX) per character
  961|       |               if constexpr (check_escape_control_characters(Opts)) {
  962|       |                  if constexpr (has_bounded_capacity<B>) {
  963|       |                     // 6 bytes per character is a ceiling only a string of nothing but control
  964|       |                     // characters reaches. A resizable buffer merely over-allocates against it,
  965|       |                     // but a fixed buffer has nowhere to grow, so the ceiling would reject output
  966|       |                     // that fits. Measuring the string answers exactly, at the cost of a pass over
  967|       |                     // it, so bracket the measurement between two O(1) bounds and only pay it when
  968|       |                     // the answer is still in doubt: the ceiling fitting means yes, and the floor
  969|       |                     // of one byte per character not fitting means no.
  970|       |                     const size_t capacity = buffer_traits<std::remove_cvref_t<B>>::capacity(b);
  971|       |                     size_t required = ix + 10 + 6 * n;
  972|       |                     if (required > capacity) [[unlikely]] {
  973|       |                        required = ix + 10 + n;
  974|       |                        if (required <= capacity) {
  975|       |                           required = ix + 10 + detail::escaped_string_size(str);
  976|       |                        }
  977|       |                     }
  978|       |                     if (!ensure_space(ctx, b, required)) [[unlikely]] {
  979|       |                        return;
  980|       |                     }
  981|       |                  }
  982|       |                  // We need 2 + 6 * n characters in the worst case (all control chars)
  983|       |                  else if (!ensure_space(ctx, b, ix + 10 + 6 * n)) [[unlikely]] {
  984|       |                     return;
  985|       |                  }
  986|       |               }
  987|  1.85M|               else {
  988|       |                  // Using the original sizing
  989|  1.85M|                  if (!ensure_space(ctx, b, ix + 10 + 2 * n)) [[unlikely]] {
  ------------------
  |  Branch (989:23): [True: 0, False: 1.85M]
  ------------------
  990|      0|                     return;
  991|      0|                  }
  992|  1.85M|               }
  993|       |               // now we don't have to check writing
  994|       |
  995|       |               if constexpr (check_unquoted(Opts)) {
  996|       |                  if (n) {
  997|       |                     std::memcpy(&b[ix], str.data(), n);
  998|       |                     ix += n;
  999|       |                  }
 1000|       |               }
 1001|  1.85M|               else {
 1002|  1.85M|                  std::memcpy(&b[ix], "\"", 1);
 1003|  1.85M|                  ++ix;
 1004|       |
 1005|  1.85M|                  const auto* c = str.data();
 1006|  1.85M|                  const auto* const e = c + n;
 1007|  1.85M|                  const auto start = &b[ix];
 1008|  1.85M|                  auto data = start;
 1009|       |
 1010|       |                  // By default we don't escape control characters for performance. Invalid JSON characters
 1011|       |                  // result in null characters in the output, making the JSON invalid — these would then be
 1012|       |                  // detected upon reading. Enable the `escape_control_characters` option to properly escape
 1013|       |                  // control characters (0x00–0x1F) as \uXXXX sequences.
 1014|       |
 1015|       |                  // Escape handler: writes the escaped form of *c into data, advances both pointers
 1016|  1.85M|                  auto write_escape = [&]() {
 1017|  1.85M|                     if constexpr (check_escape_control_characters(Opts)) {
 1018|  1.85M|                        if (const auto escaped = char_escape_table[uint8_t(*c)]; escaped) {
 1019|  1.85M|                           std::memcpy(data, &escaped, 2);
 1020|  1.85M|                           data += 2;
 1021|  1.85M|                        }
 1022|  1.85M|                        else {
 1023|  1.85M|                           char unicode_escape[6] = {'\\', 'u', '0', '0', '0', '0'};
 1024|  1.85M|                           constexpr char hex_digits[] = "0123456789ABCDEF";
 1025|  1.85M|                           unicode_escape[4] = hex_digits[(uint8_t(*c) >> 4) & 0xF];
 1026|  1.85M|                           unicode_escape[5] = hex_digits[uint8_t(*c) & 0xF];
 1027|  1.85M|                           std::memcpy(data, unicode_escape, 6);
 1028|  1.85M|                           data += 6;
 1029|  1.85M|                        }
 1030|  1.85M|                     }
 1031|  1.85M|                     else {
 1032|  1.85M|                        if constexpr (check_reject_control_characters(Opts)) {
 1033|       |                           // A control character with no two-character escape cannot be written
 1034|       |                           // without \uXXXX. The table entry is zero, so the memcpy below would
 1035|       |                           // put two NULs where one byte was. Flag it and let the loop finish:
 1036|       |                           // returning early here would leave c un-advanced and the SIMD scan
 1037|       |                           // would find the same byte forever. The output is abandoned anyway.
 1038|  1.85M|                           if (char_escape_table[uint8_t(*c)] == 0) [[unlikely]] {
 1039|  1.85M|                              ctx.error = error_code::invalid_control_character;
 1040|  1.85M|                           }
 1041|  1.85M|                        }
 1042|  1.85M|                        std::memcpy(data, &char_escape_table[uint8_t(*c)], 2);
 1043|  1.85M|                        data += 2;
 1044|  1.85M|                     }
 1045|  1.85M|                     ++c;
 1046|  1.85M|                  };
 1047|       |
 1048|       |                  // Adding a helper here means adding a branch to string_escape_simd() in
 1049|       |                  // simd/backends.hpp, which names the widest one this cascade invokes, and a row
 1050|       |                  // to known_builds in tests/json_test/utf8_validation_test.cpp, which checks it.
 1051|       |#if defined(GLZ_USE_AVX2)
 1052|       |                  detail::avx2_string_escape(c, e, data, n, write_escape);
 1053|       |#endif
 1054|  1.85M|#if defined(GLZ_USE_SSE2)
 1055|  1.85M|                  detail::sse2_string_escape(c, e, data, n, write_escape);
 1056|       |#elif defined(GLZ_USE_NEON)
 1057|       |                  detail::neon_string_escape(c, e, data, n, write_escape);
 1058|       |#endif
 1059|       |
 1060|       |                  // SWAR: 8 bytes at a time
 1061|  1.85M|                  if (n > 7) {
  ------------------
  |  Branch (1061:23): [True: 392k, False: 1.46M]
  ------------------
 1062|   740k|                     for (const auto end_m7 = e - 7; c < end_m7;) {
  ------------------
  |  Branch (1062:54): [True: 348k, False: 392k]
  ------------------
 1063|   348k|                        std::memcpy(data, c, 8);
 1064|   348k|                        uint64_t swar;
 1065|   348k|                        std::memcpy(&swar, c, 8);
 1066|       |                        if constexpr (std::endian::native == std::endian::big) {
 1067|       |                           swar = std::byteswap(swar);
 1068|       |                        }
 1069|       |
 1070|   348k|                        constexpr uint64_t lo7_mask = repeat_byte8(0b01111111);
 1071|   348k|                        const uint64_t lo7 = swar & lo7_mask;
 1072|   348k|                        const uint64_t quote = (lo7 ^ repeat_byte8('"')) + lo7_mask;
 1073|   348k|                        const uint64_t backslash = (lo7 ^ repeat_byte8('\\')) + lo7_mask;
 1074|   348k|                        const uint64_t less_32 = (swar & repeat_byte8(0b01100000)) + lo7_mask;
 1075|   348k|                        uint64_t next = ~((quote & backslash & less_32) | swar);
 1076|       |
 1077|   348k|                        next &= repeat_byte8(0b10000000);
 1078|   348k|                        if (next == 0) {
  ------------------
  |  Branch (1078:29): [True: 194k, False: 153k]
  ------------------
 1079|   194k|                           data += 8;
 1080|   194k|                           c += 8;
 1081|   194k|                           continue;
 1082|   194k|                        }
 1083|       |
 1084|   153k|                        const auto length = (countr_zero(next) >> 3);
 1085|   153k|                        c += length;
 1086|   153k|                        data += length;
 1087|   153k|                        write_escape();
 1088|   153k|                     }
 1089|   392k|                  }
 1090|       |
 1091|       |                  // Scalar tail
 1092|  6.16M|                  for (; c < e; ++c) {
  ------------------
  |  Branch (1092:26): [True: 4.30M, False: 1.85M]
  ------------------
 1093|  4.30M|                     if (const auto escaped = char_escape_table[uint8_t(*c)]; escaped) {
  ------------------
  |  Branch (1093:79): [True: 154k, False: 4.15M]
  ------------------
 1094|   154k|                        std::memcpy(data, &escaped, 2);
 1095|   154k|                        data += 2;
 1096|   154k|                     }
 1097|       |                     else if constexpr (check_escape_control_characters(Opts)) {
 1098|       |                        if (uint8_t(*c) < 0x20) {
 1099|       |                           char unicode_escape[6] = {'\\', 'u', '0', '0', '0', '0'};
 1100|       |                           constexpr char hex_digits[] = "0123456789ABCDEF";
 1101|       |                           unicode_escape[4] = hex_digits[(uint8_t(*c) >> 4) & 0xF];
 1102|       |                           unicode_escape[5] = hex_digits[uint8_t(*c) & 0xF];
 1103|       |                           std::memcpy(data, unicode_escape, 6);
 1104|       |                           data += 6;
 1105|       |                        }
 1106|       |                        else {
 1107|       |                           std::memcpy(data, c, 1);
 1108|       |                           ++data;
 1109|       |                        }
 1110|       |                     }
 1111|  4.15M|                     else {
 1112|       |                        if constexpr (check_reject_control_characters(Opts)) {
 1113|       |                           if (uint8_t(*c) < 0x20) [[unlikely]] {
 1114|       |                              ctx.error = error_code::invalid_control_character;
 1115|       |                           }
 1116|       |                        }
 1117|  4.15M|                        std::memcpy(data, c, 1);
 1118|  4.15M|                        ++data;
 1119|  4.15M|                     }
 1120|  4.30M|                  }
 1121|       |
 1122|  1.85M|                  ix += size_t(data - start);
 1123|       |
 1124|  1.85M|                  std::memcpy(&b[ix], "\"", 1);
 1125|  1.85M|                  ++ix;
 1126|  1.85M|               }
 1127|  1.85M|            }
 1128|  1.85M|         }
 1129|  1.85M|      }
_ZZN3glz2toILj10ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS7_SB_TkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_ENKUlvE_clEv:
  945|  1.85M|               const sv str = [&]() -> const sv {
  946|       |                  if constexpr (array_char_t<T>) {
  947|       |                     return sv{value.data(), value.size()};
  948|       |                  }
  949|       |                  else if constexpr (u8str_t<T>) {
  950|       |                     return sv{reinterpret_cast<const char*>(value.data()), value.size()};
  951|       |                  }
  952|  1.85M|                  else {
  953|  1.85M|                     return str_view<T>(value);
  954|  1.85M|                  }
  955|  1.85M|               }();
_ZZN3glz2toILj10ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS7_SB_TkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_ENKUlvE0_clEv:
 1016|   228k|                  auto write_escape = [&]() {
 1017|       |                     if constexpr (check_escape_control_characters(Opts)) {
 1018|       |                        if (const auto escaped = char_escape_table[uint8_t(*c)]; escaped) {
 1019|       |                           std::memcpy(data, &escaped, 2);
 1020|       |                           data += 2;
 1021|       |                        }
 1022|       |                        else {
 1023|       |                           char unicode_escape[6] = {'\\', 'u', '0', '0', '0', '0'};
 1024|       |                           constexpr char hex_digits[] = "0123456789ABCDEF";
 1025|       |                           unicode_escape[4] = hex_digits[(uint8_t(*c) >> 4) & 0xF];
 1026|       |                           unicode_escape[5] = hex_digits[uint8_t(*c) & 0xF];
 1027|       |                           std::memcpy(data, unicode_escape, 6);
 1028|       |                           data += 6;
 1029|       |                        }
 1030|       |                     }
 1031|   228k|                     else {
 1032|       |                        if constexpr (check_reject_control_characters(Opts)) {
 1033|       |                           // A control character with no two-character escape cannot be written
 1034|       |                           // without \uXXXX. The table entry is zero, so the memcpy below would
 1035|       |                           // put two NULs where one byte was. Flag it and let the loop finish:
 1036|       |                           // returning early here would leave c un-advanced and the SIMD scan
 1037|       |                           // would find the same byte forever. The output is abandoned anyway.
 1038|       |                           if (char_escape_table[uint8_t(*c)] == 0) [[unlikely]] {
 1039|       |                              ctx.error = error_code::invalid_control_character;
 1040|       |                           }
 1041|       |                        }
 1042|   228k|                        std::memcpy(data, &char_escape_table[uint8_t(*c)], 2);
 1043|   228k|                        data += 2;
 1044|   228k|                     }
 1045|   228k|                     ++c;
 1046|   228k|                  };
_ZZN3glz2toILj10ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS8_RSH_TkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_ENKUlOT_E_clIRbEEDaSY_:
 1965|   181k|            [&](auto&& val) {
 1966|   181k|               using V = std::decay_t<decltype(val)>;
 1967|       |
 1968|       |               if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 1969|       |                             custom_write<V>) {
 1970|       |                  // Custom alternative: the user's serializer emits the object body, into which we
 1971|       |                  // merge the variant tag. For this to produce valid JSON the custom to<> must (1)
 1972|       |                  // write an object body and (2) honor opening_and_closing_handled (suppress its own
 1973|       |                  // braces) so the tag shares the alternative's object. A custom writer that emits a
 1974|       |                  // scalar/array, or that ignores those flags, would yield malformed output.
 1975|       |                  //
 1976|       |                  // The tag-emission below mirrors the reflected-object branch that follows; keep the
 1977|       |                  // two in sync. The body size is not known at compile time, so we always write the
 1978|       |                  // tag separator and then drop it at runtime if the body turned out empty.
 1979|       |                  if (missing_id(value, ctx)) {
 1980|       |                     return;
 1981|       |                  }
 1982|       |                  using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 1983|       |                  if constexpr (Opts.prettify) {
 1984|       |                     dump("{\n", b, ix);
 1985|       |                     ctx.depth += check_indentation_width(Opts);
 1986|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 1987|       |                     dump('"', b, ix);
 1988|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 1989|       |                     if constexpr (std::integral<id_type>) {
 1990|       |                        dump("\": ", b, ix);
 1991|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 1992|       |                     }
 1993|       |                     else {
 1994|       |                        dump("\": \"", b, ix);
 1995|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 1996|       |                        dump('"', b, ix);
 1997|       |                     }
 1998|       |                     const auto pos_after_tag = ix;
 1999|       |                     dump(",\n", b, ix);
 2000|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2001|       |                     const auto pos_body_start = ix;
 2002|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2003|       |                     if (ix == pos_body_start) {
 2004|       |                        ix = pos_after_tag; // custom body was empty: undo the tag separator
 2005|       |                     }
 2006|       |                     ctx.depth -= check_indentation_width(Opts);
 2007|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2008|       |                        return;
 2009|       |                     }
 2010|       |                     std::memcpy(&b[ix], "\n", 1);
 2011|       |                     ++ix;
 2012|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2013|       |                     ix += ctx.depth;
 2014|       |                     std::memcpy(&b[ix], "}", 1);
 2015|       |                     ++ix;
 2016|       |                  }
 2017|       |                  else {
 2018|       |                     dump("{\"", b, ix);
 2019|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2020|       |                     if constexpr (std::integral<id_type>) {
 2021|       |                        dump("\":", b, ix);
 2022|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2023|       |                     }
 2024|       |                     else {
 2025|       |                        dump("\":\"", b, ix);
 2026|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2027|       |                        dump('"', b, ix);
 2028|       |                     }
 2029|       |                     const auto pos_after_tag = ix;
 2030|       |                     dump(',', b, ix);
 2031|       |                     const auto pos_body_start = ix;
 2032|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2033|       |                     if (ix == pos_body_start) {
 2034|       |                        ix = pos_after_tag; // custom body was empty: undo the tag separator
 2035|       |                     }
 2036|       |                     dump('}', b, ix);
 2037|       |                  }
 2038|       |               }
 2039|       |               else if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 2040|       |                                  variant_unit_alternative<V>) {
 2041|       |                  // A unit alternative carries no data, so internal tagging renders it as the
 2042|       |                  // discriminator alone -- the same object an empty struct alternative produces.
 2043|       |                  if (missing_id(value, ctx)) {
 2044|       |                     return;
 2045|       |                  }
 2046|       |                  if constexpr (Opts.prettify) {
 2047|       |                     dump("{\n", b, ix);
 2048|       |                     ctx.depth += check_indentation_width(Opts);
 2049|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2050|       |                     dump('"', b, ix);
 2051|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2052|       |                     dump("\": ", b, ix);
 2053|       |                     write_id<Opts>(value, ctx, b, ix);
 2054|       |                     ctx.depth -= check_indentation_width(Opts);
 2055|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2056|       |                        return;
 2057|       |                     }
 2058|       |                     std::memcpy(&b[ix], "\n", 1);
 2059|       |                     ++ix;
 2060|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2061|       |                     ix += ctx.depth;
 2062|       |                     std::memcpy(&b[ix], "}", 1);
 2063|       |                     ++ix;
 2064|       |                  }
 2065|       |                  else {
 2066|       |                     dump("{\"", b, ix);
 2067|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2068|       |                     dump("\":", b, ix);
 2069|       |                     write_id<Opts>(value, ctx, b, ix);
 2070|       |                     dump('}', b, ix);
 2071|       |                  }
 2072|       |               }
 2073|       |               else if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 2074|       |                                  (glaze_object_t<V> || reflectable<V> || is_memory_object<V>) &&
 2075|       |                                  (not alternative_declares_key<V>(tag_v<T>))) {
 2076|       |                  // An alternative that declares a member named like the discriminator carries the
 2077|       |                  // discriminator itself, so no tag is merged here and the bare-write branch below
 2078|       |                  // handles it. Previously only `reflectable` alternatives were excluded; a
 2079|       |                  // `glaze_object_t` one fell through to this branch and emitted the key twice.
 2080|       |                  if (missing_id(value, ctx)) {
 2081|       |                     return;
 2082|       |                  }
 2083|       |                  constexpr auto N = []() {
 2084|       |                     if constexpr (is_memory_object<V>) {
 2085|       |                        return reflect<memory_type<V>>::size;
 2086|       |                     }
 2087|       |                     else {
 2088|       |                        return reflect<V>::size;
 2089|       |                     }
 2090|       |                  }();
 2091|       |
 2092|       |                  // must first write out type
 2093|       |                  if constexpr (Opts.prettify) {
 2094|       |                     dump("{\n", b, ix);
 2095|       |                     ctx.depth += check_indentation_width(Opts);
 2096|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2097|       |                     dump('"', b, ix);
 2098|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2099|       |
 2100|       |                     using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 2101|       |
 2102|       |                     if constexpr (std::integral<id_type>) {
 2103|       |                        dump("\": ", b, ix);
 2104|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2105|       |                        if constexpr (N > 0) {
 2106|       |                           dump(",\n", b, ix);
 2107|       |                           dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2108|       |                        }
 2109|       |                     }
 2110|       |                     else {
 2111|       |                        dump("\": \"", b, ix);
 2112|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2113|       |                        if constexpr (N == 0) {
 2114|       |                           dump('"', b, ix);
 2115|       |                        }
 2116|       |                        else {
 2117|       |                           dump("\",\n", b, ix);
 2118|       |                           dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2119|       |                        }
 2120|       |                     }
 2121|       |                  }
 2122|       |                  else {
 2123|       |                     using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 2124|       |
 2125|       |                     dump("{\"", b, ix);
 2126|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2127|       |
 2128|       |                     if constexpr (std::integral<id_type>) {
 2129|       |                        dump("\":", b, ix);
 2130|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2131|       |                        if constexpr (N > 0) {
 2132|       |                           dump(',', b, ix);
 2133|       |                        }
 2134|       |                     }
 2135|       |                     else {
 2136|       |                        dump("\":\"", b, ix);
 2137|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2138|       |                        if constexpr (N == 0) {
 2139|       |                           dump('"', b, ix);
 2140|       |                        }
 2141|       |                        else {
 2142|       |                           dump("\",", b, ix);
 2143|       |                        }
 2144|       |                     }
 2145|       |                  }
 2146|       |                  if constexpr (is_memory_object<V>) {
 2147|       |                     if (!val) [[unlikely]] {
 2148|       |                        ctx.error = error_code::invalid_variant_object;
 2149|       |                        return;
 2150|       |                     }
 2151|       |                     to<JSON, memory_type<V>>::template op<opening_and_closing_handled<Opts>()>(*val, ctx, b, ix);
 2152|       |                  }
 2153|       |                  else {
 2154|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2155|       |                  }
 2156|       |                  // If we skip everything then we may have an extra comma, which we want to revert
 2157|       |                  if constexpr (Opts.skip_null_members) {
 2158|       |                     if (b[ix - 1] == ',') {
 2159|       |                        --ix;
 2160|       |                     }
 2161|       |                  }
 2162|       |
 2163|       |                  if constexpr (Opts.prettify) {
 2164|       |                     ctx.depth -= check_indentation_width(Opts);
 2165|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2166|       |                        return;
 2167|       |                     }
 2168|       |                     std::memcpy(&b[ix], "\n", 1);
 2169|       |                     ++ix;
 2170|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2171|       |                     ix += ctx.depth;
 2172|       |                     std::memcpy(&b[ix], "}", 1);
 2173|       |                     ++ix;
 2174|       |                  }
 2175|       |                  else {
 2176|       |                     dump('}', b, ix);
 2177|       |                  }
 2178|       |               }
 2179|   181k|               else {
 2180|   181k|                  to<JSON, V>::template op<Opts>(val, ctx, b, ix);
 2181|   181k|               }
 2182|   181k|            },
_ZN3glz2toILj10EbE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEETkNS_10is_contextERNS_7contextEmEEvbOT1_OT0_RT2_:
  777|   181k|      {
  778|   181k|         static constexpr auto checked = not check_write_unchecked(Opts);
  779|   181k|         if constexpr (checked) {
  780|   181k|            if (!ensure_space(ctx, b, ix + 8)) [[unlikely]] {
  ------------------
  |  Branch (780:17): [True: 0, False: 181k]
  ------------------
  781|      0|               return;
  782|      0|            }
  783|   181k|         }
  784|       |
  785|       |         if constexpr (check_bools_as_numbers(Opts)) {
  786|       |            if (value) {
  787|       |               std::memcpy(&b[ix], "1", 1);
  788|       |            }
  789|       |            else {
  790|       |               std::memcpy(&b[ix], "0", 1);
  791|       |            }
  792|       |            ++ix;
  793|       |         }
  794|   181k|         else {
  795|   181k|            if (value) {
  ------------------
  |  Branch (795:17): [True: 48.6k, False: 132k]
  ------------------
  796|  48.6k|               std::memcpy(&b[ix], "true", 4);
  797|  48.6k|               ix += 4;
  798|  48.6k|            }
  799|   132k|            else {
  800|   132k|               std::memcpy(&b[ix], "false", 5);
  801|   132k|               ix += 5;
  802|   132k|            }
  803|   181k|         }
  804|   181k|      }
_ZZN3glz2toILj10ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS8_RSH_TkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_ENKUlOT_E_clIRSF_EEDaSY_:
 1965|  1.15M|            [&](auto&& val) {
 1966|  1.15M|               using V = std::decay_t<decltype(val)>;
 1967|       |
 1968|       |               if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 1969|       |                             custom_write<V>) {
 1970|       |                  // Custom alternative: the user's serializer emits the object body, into which we
 1971|       |                  // merge the variant tag. For this to produce valid JSON the custom to<> must (1)
 1972|       |                  // write an object body and (2) honor opening_and_closing_handled (suppress its own
 1973|       |                  // braces) so the tag shares the alternative's object. A custom writer that emits a
 1974|       |                  // scalar/array, or that ignores those flags, would yield malformed output.
 1975|       |                  //
 1976|       |                  // The tag-emission below mirrors the reflected-object branch that follows; keep the
 1977|       |                  // two in sync. The body size is not known at compile time, so we always write the
 1978|       |                  // tag separator and then drop it at runtime if the body turned out empty.
 1979|       |                  if (missing_id(value, ctx)) {
 1980|       |                     return;
 1981|       |                  }
 1982|       |                  using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 1983|       |                  if constexpr (Opts.prettify) {
 1984|       |                     dump("{\n", b, ix);
 1985|       |                     ctx.depth += check_indentation_width(Opts);
 1986|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 1987|       |                     dump('"', b, ix);
 1988|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 1989|       |                     if constexpr (std::integral<id_type>) {
 1990|       |                        dump("\": ", b, ix);
 1991|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 1992|       |                     }
 1993|       |                     else {
 1994|       |                        dump("\": \"", b, ix);
 1995|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 1996|       |                        dump('"', b, ix);
 1997|       |                     }
 1998|       |                     const auto pos_after_tag = ix;
 1999|       |                     dump(",\n", b, ix);
 2000|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2001|       |                     const auto pos_body_start = ix;
 2002|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2003|       |                     if (ix == pos_body_start) {
 2004|       |                        ix = pos_after_tag; // custom body was empty: undo the tag separator
 2005|       |                     }
 2006|       |                     ctx.depth -= check_indentation_width(Opts);
 2007|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2008|       |                        return;
 2009|       |                     }
 2010|       |                     std::memcpy(&b[ix], "\n", 1);
 2011|       |                     ++ix;
 2012|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2013|       |                     ix += ctx.depth;
 2014|       |                     std::memcpy(&b[ix], "}", 1);
 2015|       |                     ++ix;
 2016|       |                  }
 2017|       |                  else {
 2018|       |                     dump("{\"", b, ix);
 2019|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2020|       |                     if constexpr (std::integral<id_type>) {
 2021|       |                        dump("\":", b, ix);
 2022|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2023|       |                     }
 2024|       |                     else {
 2025|       |                        dump("\":\"", b, ix);
 2026|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2027|       |                        dump('"', b, ix);
 2028|       |                     }
 2029|       |                     const auto pos_after_tag = ix;
 2030|       |                     dump(',', b, ix);
 2031|       |                     const auto pos_body_start = ix;
 2032|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2033|       |                     if (ix == pos_body_start) {
 2034|       |                        ix = pos_after_tag; // custom body was empty: undo the tag separator
 2035|       |                     }
 2036|       |                     dump('}', b, ix);
 2037|       |                  }
 2038|       |               }
 2039|       |               else if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 2040|       |                                  variant_unit_alternative<V>) {
 2041|       |                  // A unit alternative carries no data, so internal tagging renders it as the
 2042|       |                  // discriminator alone -- the same object an empty struct alternative produces.
 2043|       |                  if (missing_id(value, ctx)) {
 2044|       |                     return;
 2045|       |                  }
 2046|       |                  if constexpr (Opts.prettify) {
 2047|       |                     dump("{\n", b, ix);
 2048|       |                     ctx.depth += check_indentation_width(Opts);
 2049|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2050|       |                     dump('"', b, ix);
 2051|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2052|       |                     dump("\": ", b, ix);
 2053|       |                     write_id<Opts>(value, ctx, b, ix);
 2054|       |                     ctx.depth -= check_indentation_width(Opts);
 2055|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2056|       |                        return;
 2057|       |                     }
 2058|       |                     std::memcpy(&b[ix], "\n", 1);
 2059|       |                     ++ix;
 2060|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2061|       |                     ix += ctx.depth;
 2062|       |                     std::memcpy(&b[ix], "}", 1);
 2063|       |                     ++ix;
 2064|       |                  }
 2065|       |                  else {
 2066|       |                     dump("{\"", b, ix);
 2067|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2068|       |                     dump("\":", b, ix);
 2069|       |                     write_id<Opts>(value, ctx, b, ix);
 2070|       |                     dump('}', b, ix);
 2071|       |                  }
 2072|       |               }
 2073|       |               else if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 2074|       |                                  (glaze_object_t<V> || reflectable<V> || is_memory_object<V>) &&
 2075|       |                                  (not alternative_declares_key<V>(tag_v<T>))) {
 2076|       |                  // An alternative that declares a member named like the discriminator carries the
 2077|       |                  // discriminator itself, so no tag is merged here and the bare-write branch below
 2078|       |                  // handles it. Previously only `reflectable` alternatives were excluded; a
 2079|       |                  // `glaze_object_t` one fell through to this branch and emitted the key twice.
 2080|       |                  if (missing_id(value, ctx)) {
 2081|       |                     return;
 2082|       |                  }
 2083|       |                  constexpr auto N = []() {
 2084|       |                     if constexpr (is_memory_object<V>) {
 2085|       |                        return reflect<memory_type<V>>::size;
 2086|       |                     }
 2087|       |                     else {
 2088|       |                        return reflect<V>::size;
 2089|       |                     }
 2090|       |                  }();
 2091|       |
 2092|       |                  // must first write out type
 2093|       |                  if constexpr (Opts.prettify) {
 2094|       |                     dump("{\n", b, ix);
 2095|       |                     ctx.depth += check_indentation_width(Opts);
 2096|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2097|       |                     dump('"', b, ix);
 2098|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2099|       |
 2100|       |                     using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 2101|       |
 2102|       |                     if constexpr (std::integral<id_type>) {
 2103|       |                        dump("\": ", b, ix);
 2104|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2105|       |                        if constexpr (N > 0) {
 2106|       |                           dump(",\n", b, ix);
 2107|       |                           dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2108|       |                        }
 2109|       |                     }
 2110|       |                     else {
 2111|       |                        dump("\": \"", b, ix);
 2112|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2113|       |                        if constexpr (N == 0) {
 2114|       |                           dump('"', b, ix);
 2115|       |                        }
 2116|       |                        else {
 2117|       |                           dump("\",\n", b, ix);
 2118|       |                           dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2119|       |                        }
 2120|       |                     }
 2121|       |                  }
 2122|       |                  else {
 2123|       |                     using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 2124|       |
 2125|       |                     dump("{\"", b, ix);
 2126|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2127|       |
 2128|       |                     if constexpr (std::integral<id_type>) {
 2129|       |                        dump("\":", b, ix);
 2130|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2131|       |                        if constexpr (N > 0) {
 2132|       |                           dump(',', b, ix);
 2133|       |                        }
 2134|       |                     }
 2135|       |                     else {
 2136|       |                        dump("\":\"", b, ix);
 2137|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2138|       |                        if constexpr (N == 0) {
 2139|       |                           dump('"', b, ix);
 2140|       |                        }
 2141|       |                        else {
 2142|       |                           dump("\",", b, ix);
 2143|       |                        }
 2144|       |                     }
 2145|       |                  }
 2146|       |                  if constexpr (is_memory_object<V>) {
 2147|       |                     if (!val) [[unlikely]] {
 2148|       |                        ctx.error = error_code::invalid_variant_object;
 2149|       |                        return;
 2150|       |                     }
 2151|       |                     to<JSON, memory_type<V>>::template op<opening_and_closing_handled<Opts>()>(*val, ctx, b, ix);
 2152|       |                  }
 2153|       |                  else {
 2154|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2155|       |                  }
 2156|       |                  // If we skip everything then we may have an extra comma, which we want to revert
 2157|       |                  if constexpr (Opts.skip_null_members) {
 2158|       |                     if (b[ix - 1] == ',') {
 2159|       |                        --ix;
 2160|       |                     }
 2161|       |                  }
 2162|       |
 2163|       |                  if constexpr (Opts.prettify) {
 2164|       |                     ctx.depth -= check_indentation_width(Opts);
 2165|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2166|       |                        return;
 2167|       |                     }
 2168|       |                     std::memcpy(&b[ix], "\n", 1);
 2169|       |                     ++ix;
 2170|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2171|       |                     ix += ctx.depth;
 2172|       |                     std::memcpy(&b[ix], "}", 1);
 2173|       |                     ++ix;
 2174|       |                  }
 2175|       |                  else {
 2176|       |                     dump('}', b, ix);
 2177|       |                  }
 2178|       |               }
 2179|  1.15M|               else {
 2180|  1.15M|                  to<JSON, V>::template op<Opts>(val, ctx, b, ix);
 2181|  1.15M|               }
 2182|  1.15M|            },
_ZN3glz2toILj10ENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS1_9allocatorIS6_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERNS1_12basic_stringIcNS1_11char_traitsIcEENS7_IcEEEERS9_TkNS_10is_contextERNS_7contextEmQaa16writable_array_tIT_EquL_ZNS0_ILj10ESM_E14map_like_arrayEEeqcl17check_concatenateTL0__ELb0ELb1EEEvOT1_OT2_OT0_RT3_:
 1435|  1.15M|      {
 1436|  1.15M|         if (empty_range(value)) {
  ------------------
  |  Branch (1436:14): [True: 183k, False: 973k]
  ------------------
 1437|   183k|            dump("[]", b, ix);
 1438|   183k|         }
 1439|   973k|         else {
 1440|       |            // For bounded buffers, skip pre-allocation path since value_padding is for SIMD, not actual size
 1441|       |            if constexpr (has_size<T> && array_padding_known<T> && !has_bounded_capacity<B>) {
 1442|       |               const auto n = value.size();
 1443|       |
 1444|       |               static constexpr auto value_padding = []() -> size_t {
 1445|       |                  if constexpr (required_padding<typename T::value_type>() > 0)
 1446|       |                     return required_padding<typename T::value_type>();
 1447|       |                  else
 1448|       |                     return fixed_padding<typename T::value_type>;
 1449|       |               }();
 1450|       |
 1451|       |               if constexpr (Opts.prettify) {
 1452|       |                  if constexpr (check_new_lines_in_arrays(Opts)) {
 1453|       |                     ctx.depth += check_indentation_width(Opts);
 1454|       |                  }
 1455|       |
 1456|       |                  // add space for '\n' and ',' characters for each element, hence `+ 2`
 1457|       |                  // use n + 1 because we put the end array character after the last element with whitespace
 1458|       |                  if (!ensure_space(ctx, b, ix + (n + 1) * (value_padding + ctx.depth + 2) + write_padding_bytes))
 1459|       |                     [[unlikely]] {
 1460|       |                     return;
 1461|       |                  }
 1462|       |
 1463|       |                  if constexpr (check_new_lines_in_arrays(Opts)) {
 1464|       |                     std::memcpy(&b[ix], "[\n", 2);
 1465|       |                     ix += 2;
 1466|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 1467|       |                     ix += ctx.depth;
 1468|       |                  }
 1469|       |                  else {
 1470|       |                     std::memcpy(&b[ix], "[", 1);
 1471|       |                     ++ix;
 1472|       |                  }
 1473|       |               }
 1474|       |               else {
 1475|       |                  static constexpr auto comma_padding = 1;
 1476|       |                  if (!ensure_space(ctx, b, ix + n * (value_padding + comma_padding) + write_padding_bytes))
 1477|       |                     [[unlikely]] {
 1478|       |                     return;
 1479|       |                  }
 1480|       |                  std::memcpy(&b[ix], "[", 1);
 1481|       |                  ++ix;
 1482|       |               }
 1483|       |
 1484|       |               auto it = std::begin(value);
 1485|       |               using val_t = std::remove_cvref_t<decltype(*it)>;
 1486|       |               to<JSON, val_t>::template op<write_unchecked_on<Opts>()>(*it, ctx, b, ix);
 1487|       |
 1488|       |               ++it;
 1489|       |               for (const auto fin = std::end(value); it != fin; ++it) {
 1490|       |                  if constexpr (Opts.prettify) {
 1491|       |                     if constexpr (check_new_lines_in_arrays(Opts)) {
 1492|       |                        std::memcpy(&b[ix], ",\n", 2);
 1493|       |                        ix += 2;
 1494|       |                        fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 1495|       |                        ix += ctx.depth;
 1496|       |                     }
 1497|       |                     else {
 1498|       |                        std::memcpy(&b[ix], ", ", 2);
 1499|       |                        ix += 2;
 1500|       |                     }
 1501|       |                  }
 1502|       |                  else {
 1503|       |                     std::memcpy(&b[ix], ",", 1);
 1504|       |                     ++ix;
 1505|       |                  }
 1506|       |                  if constexpr (is_output_streaming<B>) {
 1507|       |                     flush_buffer(b, ix);
 1508|       |                  }
 1509|       |
 1510|       |                  to<JSON, val_t>::template op<write_unchecked_on<Opts>()>(*it, ctx, b, ix);
 1511|       |               }
 1512|       |               if constexpr (Opts.prettify && check_new_lines_in_arrays(Opts)) {
 1513|       |                  ctx.depth -= check_indentation_width(Opts);
 1514|       |                  std::memcpy(&b[ix], "\n", 1);
 1515|       |                  ++ix;
 1516|       |                  fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 1517|       |                  ix += ctx.depth;
 1518|       |               }
 1519|       |
 1520|       |               std::memcpy(&b[ix], "]", 1);
 1521|       |               ++ix;
 1522|       |            }
 1523|   973k|            else {
 1524|       |               // we either can't get the size (std::forward_list) or we cannot compute the allocation size
 1525|       |
 1526|       |               if constexpr (Opts.prettify) {
 1527|       |                  if constexpr (check_new_lines_in_arrays(Opts)) {
 1528|       |                     ctx.depth += check_indentation_width(Opts);
 1529|       |                  }
 1530|       |
 1531|       |                  if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 1532|       |                     return;
 1533|       |                  }
 1534|       |
 1535|       |                  if constexpr (check_new_lines_in_arrays(Opts)) {
 1536|       |                     std::memcpy(&b[ix], "[\n", 2);
 1537|       |                     ix += 2;
 1538|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 1539|       |                     ix += ctx.depth;
 1540|       |                  }
 1541|       |                  else {
 1542|       |                     std::memcpy(&b[ix], "[", 1);
 1543|       |                     ++ix;
 1544|       |                  }
 1545|       |               }
 1546|   973k|               else {
 1547|   973k|                  if (!ensure_space(ctx, b, ix + write_padding_bytes)) [[unlikely]] {
  ------------------
  |  Branch (1547:23): [True: 0, False: 973k]
  ------------------
 1548|      0|                     return;
 1549|      0|                  }
 1550|   973k|                  std::memcpy(&b[ix], "[", 1);
 1551|   973k|                  ++ix;
 1552|   973k|               }
 1553|       |
 1554|      0|               auto it = std::begin(value);
 1555|   973k|               using val_t = std::remove_cvref_t<decltype(*it)>;
 1556|       |               if constexpr (required_padding<val_t>()) {
 1557|       |                  to<JSON, val_t>::template op<write_unchecked_on<Opts>()>(*it, ctx, b, ix);
 1558|       |               }
 1559|   973k|               else {
 1560|   973k|                  to<JSON, val_t>::template op<Opts>(*it, ctx, b, ix);
 1561|   973k|                  if (bool(ctx.error)) [[unlikely]] {
  ------------------
  |  Branch (1561:23): [True: 0, False: 973k]
  ------------------
 1562|      0|                     return;
 1563|      0|                  }
 1564|   973k|               }
 1565|       |
 1566|   973k|               ++it;
 1567|  1.56M|               for (const auto fin = std::end(value); it != fin; ++it) {
  ------------------
  |  Branch (1567:55): [True: 595k, False: 973k]
  ------------------
 1568|       |                  if constexpr (required_padding<val_t>()) {
 1569|       |                     if constexpr (Opts.prettify) {
 1570|       |                        if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 1571|       |                           return;
 1572|       |                        }
 1573|       |                     }
 1574|       |                     else {
 1575|       |                        if (!ensure_space(ctx, b, ix + write_padding_bytes)) [[unlikely]] {
 1576|       |                           return;
 1577|       |                        }
 1578|       |                     }
 1579|       |
 1580|       |                     if constexpr (Opts.prettify) {
 1581|       |                        if constexpr (check_new_lines_in_arrays(Opts)) {
 1582|       |                           std::memcpy(&b[ix], ",\n", 2);
 1583|       |                           ix += 2;
 1584|       |                           fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 1585|       |                           ix += ctx.depth;
 1586|       |                        }
 1587|       |                        else {
 1588|       |                           std::memcpy(&b[ix], ", ", 2);
 1589|       |                           ix += 2;
 1590|       |                        }
 1591|       |                     }
 1592|       |                     else {
 1593|       |                        std::memcpy(&b[ix], ",", 1);
 1594|       |                        ++ix;
 1595|       |                     }
 1596|       |                     if constexpr (is_output_streaming<B>) {
 1597|       |                        flush_buffer(b, ix);
 1598|       |                     }
 1599|       |
 1600|       |                     to<JSON, val_t>::template op<write_unchecked_on<Opts>()>(*it, ctx, b, ix);
 1601|       |                  }
 1602|   595k|                  else {
 1603|   595k|                     write_array_entry_separator<Opts>(ctx, b, ix);
 1604|   595k|                     to<JSON, val_t>::template op<Opts>(*it, ctx, b, ix);
 1605|   595k|                     if (bool(ctx.error)) [[unlikely]] {
  ------------------
  |  Branch (1605:26): [True: 0, False: 595k]
  ------------------
 1606|      0|                        return;
 1607|      0|                     }
 1608|   595k|                  }
 1609|   595k|               }
 1610|       |               if constexpr (Opts.prettify && check_new_lines_in_arrays(Opts)) {
 1611|       |                  ctx.depth -= check_indentation_width(Opts);
 1612|       |                  dump_newline_indent(check_indentation_char(Opts), ctx.depth, b, ix);
 1613|       |               }
 1614|       |
 1615|   973k|               dump(']', b, ix);
 1616|   973k|            }
 1617|   973k|         }
 1618|  1.15M|      }
_ZN3glz27write_array_entry_separatorITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEELb1ERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEETkNS_10is_contextERNS_7contextEmEEvOT2_OT1_RT3_:
 1362|   595k|   {
 1363|       |      if constexpr (Opts.prettify) {
 1364|       |         if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 1365|       |            return;
 1366|       |         }
 1367|       |         if constexpr (check_new_lines_in_arrays(Opts)) {
 1368|       |            std::memcpy(&b[ix], ",\n", 2);
 1369|       |            ix += 2;
 1370|       |            fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 1371|       |            ix += ctx.depth;
 1372|       |         }
 1373|       |         else {
 1374|       |            std::memcpy(&b[ix], ", ", 2);
 1375|       |            ix += 2;
 1376|       |         }
 1377|       |      }
 1378|   595k|      else {
 1379|   595k|         if constexpr (minified_check) {
 1380|   595k|            if (!ensure_space(ctx, b, ix + 1)) [[unlikely]] {
  ------------------
  |  Branch (1380:17): [True: 0, False: 595k]
  ------------------
 1381|      0|               return;
 1382|      0|            }
 1383|   595k|         }
 1384|   595k|         std::memcpy(&b[ix], ",", 1);
 1385|   595k|         ++ix;
 1386|   595k|      }
 1387|       |      if constexpr (is_output_streaming<B>) {
 1388|       |         flush_buffer(b, ix);
 1389|       |      }
 1390|   595k|   }
_ZZN3glz2toILj10ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS8_RSH_TkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_ENKUlOT_E_clIRSG_EEDaSY_:
 1965|  7.16M|            [&](auto&& val) {
 1966|  7.16M|               using V = std::decay_t<decltype(val)>;
 1967|       |
 1968|       |               if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 1969|       |                             custom_write<V>) {
 1970|       |                  // Custom alternative: the user's serializer emits the object body, into which we
 1971|       |                  // merge the variant tag. For this to produce valid JSON the custom to<> must (1)
 1972|       |                  // write an object body and (2) honor opening_and_closing_handled (suppress its own
 1973|       |                  // braces) so the tag shares the alternative's object. A custom writer that emits a
 1974|       |                  // scalar/array, or that ignores those flags, would yield malformed output.
 1975|       |                  //
 1976|       |                  // The tag-emission below mirrors the reflected-object branch that follows; keep the
 1977|       |                  // two in sync. The body size is not known at compile time, so we always write the
 1978|       |                  // tag separator and then drop it at runtime if the body turned out empty.
 1979|       |                  if (missing_id(value, ctx)) {
 1980|       |                     return;
 1981|       |                  }
 1982|       |                  using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 1983|       |                  if constexpr (Opts.prettify) {
 1984|       |                     dump("{\n", b, ix);
 1985|       |                     ctx.depth += check_indentation_width(Opts);
 1986|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 1987|       |                     dump('"', b, ix);
 1988|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 1989|       |                     if constexpr (std::integral<id_type>) {
 1990|       |                        dump("\": ", b, ix);
 1991|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 1992|       |                     }
 1993|       |                     else {
 1994|       |                        dump("\": \"", b, ix);
 1995|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 1996|       |                        dump('"', b, ix);
 1997|       |                     }
 1998|       |                     const auto pos_after_tag = ix;
 1999|       |                     dump(",\n", b, ix);
 2000|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2001|       |                     const auto pos_body_start = ix;
 2002|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2003|       |                     if (ix == pos_body_start) {
 2004|       |                        ix = pos_after_tag; // custom body was empty: undo the tag separator
 2005|       |                     }
 2006|       |                     ctx.depth -= check_indentation_width(Opts);
 2007|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2008|       |                        return;
 2009|       |                     }
 2010|       |                     std::memcpy(&b[ix], "\n", 1);
 2011|       |                     ++ix;
 2012|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2013|       |                     ix += ctx.depth;
 2014|       |                     std::memcpy(&b[ix], "}", 1);
 2015|       |                     ++ix;
 2016|       |                  }
 2017|       |                  else {
 2018|       |                     dump("{\"", b, ix);
 2019|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2020|       |                     if constexpr (std::integral<id_type>) {
 2021|       |                        dump("\":", b, ix);
 2022|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2023|       |                     }
 2024|       |                     else {
 2025|       |                        dump("\":\"", b, ix);
 2026|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2027|       |                        dump('"', b, ix);
 2028|       |                     }
 2029|       |                     const auto pos_after_tag = ix;
 2030|       |                     dump(',', b, ix);
 2031|       |                     const auto pos_body_start = ix;
 2032|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2033|       |                     if (ix == pos_body_start) {
 2034|       |                        ix = pos_after_tag; // custom body was empty: undo the tag separator
 2035|       |                     }
 2036|       |                     dump('}', b, ix);
 2037|       |                  }
 2038|       |               }
 2039|       |               else if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 2040|       |                                  variant_unit_alternative<V>) {
 2041|       |                  // A unit alternative carries no data, so internal tagging renders it as the
 2042|       |                  // discriminator alone -- the same object an empty struct alternative produces.
 2043|       |                  if (missing_id(value, ctx)) {
 2044|       |                     return;
 2045|       |                  }
 2046|       |                  if constexpr (Opts.prettify) {
 2047|       |                     dump("{\n", b, ix);
 2048|       |                     ctx.depth += check_indentation_width(Opts);
 2049|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2050|       |                     dump('"', b, ix);
 2051|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2052|       |                     dump("\": ", b, ix);
 2053|       |                     write_id<Opts>(value, ctx, b, ix);
 2054|       |                     ctx.depth -= check_indentation_width(Opts);
 2055|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2056|       |                        return;
 2057|       |                     }
 2058|       |                     std::memcpy(&b[ix], "\n", 1);
 2059|       |                     ++ix;
 2060|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2061|       |                     ix += ctx.depth;
 2062|       |                     std::memcpy(&b[ix], "}", 1);
 2063|       |                     ++ix;
 2064|       |                  }
 2065|       |                  else {
 2066|       |                     dump("{\"", b, ix);
 2067|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2068|       |                     dump("\":", b, ix);
 2069|       |                     write_id<Opts>(value, ctx, b, ix);
 2070|       |                     dump('}', b, ix);
 2071|       |                  }
 2072|       |               }
 2073|       |               else if constexpr (check_write_type_info(Opts) && tagging == variant_tagging_kind::internal &&
 2074|       |                                  (glaze_object_t<V> || reflectable<V> || is_memory_object<V>) &&
 2075|       |                                  (not alternative_declares_key<V>(tag_v<T>))) {
 2076|       |                  // An alternative that declares a member named like the discriminator carries the
 2077|       |                  // discriminator itself, so no tag is merged here and the bare-write branch below
 2078|       |                  // handles it. Previously only `reflectable` alternatives were excluded; a
 2079|       |                  // `glaze_object_t` one fell through to this branch and emitted the key twice.
 2080|       |                  if (missing_id(value, ctx)) {
 2081|       |                     return;
 2082|       |                  }
 2083|       |                  constexpr auto N = []() {
 2084|       |                     if constexpr (is_memory_object<V>) {
 2085|       |                        return reflect<memory_type<V>>::size;
 2086|       |                     }
 2087|       |                     else {
 2088|       |                        return reflect<V>::size;
 2089|       |                     }
 2090|       |                  }();
 2091|       |
 2092|       |                  // must first write out type
 2093|       |                  if constexpr (Opts.prettify) {
 2094|       |                     dump("{\n", b, ix);
 2095|       |                     ctx.depth += check_indentation_width(Opts);
 2096|       |                     dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2097|       |                     dump('"', b, ix);
 2098|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2099|       |
 2100|       |                     using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 2101|       |
 2102|       |                     if constexpr (std::integral<id_type>) {
 2103|       |                        dump("\": ", b, ix);
 2104|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2105|       |                        if constexpr (N > 0) {
 2106|       |                           dump(",\n", b, ix);
 2107|       |                           dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2108|       |                        }
 2109|       |                     }
 2110|       |                     else {
 2111|       |                        dump("\": \"", b, ix);
 2112|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2113|       |                        if constexpr (N == 0) {
 2114|       |                           dump('"', b, ix);
 2115|       |                        }
 2116|       |                        else {
 2117|       |                           dump("\",\n", b, ix);
 2118|       |                           dumpn(check_indentation_char(Opts), ctx.depth, b, ix);
 2119|       |                        }
 2120|       |                     }
 2121|       |                  }
 2122|       |                  else {
 2123|       |                     using id_type = std::decay_t<decltype(ids_v<T>[value.index()])>;
 2124|       |
 2125|       |                     dump("{\"", b, ix);
 2126|       |                     dump_maybe_empty(tag_v<T>, b, ix);
 2127|       |
 2128|       |                     if constexpr (std::integral<id_type>) {
 2129|       |                        dump("\":", b, ix);
 2130|       |                        serialize<JSON>::op<Opts>(ids_v<T>[value.index()], ctx, b, ix);
 2131|       |                        if constexpr (N > 0) {
 2132|       |                           dump(',', b, ix);
 2133|       |                        }
 2134|       |                     }
 2135|       |                     else {
 2136|       |                        dump("\":\"", b, ix);
 2137|       |                        dump_maybe_empty(ids_v<T>[value.index()], b, ix);
 2138|       |                        if constexpr (N == 0) {
 2139|       |                           dump('"', b, ix);
 2140|       |                        }
 2141|       |                        else {
 2142|       |                           dump("\",", b, ix);
 2143|       |                        }
 2144|       |                     }
 2145|       |                  }
 2146|       |                  if constexpr (is_memory_object<V>) {
 2147|       |                     if (!val) [[unlikely]] {
 2148|       |                        ctx.error = error_code::invalid_variant_object;
 2149|       |                        return;
 2150|       |                     }
 2151|       |                     to<JSON, memory_type<V>>::template op<opening_and_closing_handled<Opts>()>(*val, ctx, b, ix);
 2152|       |                  }
 2153|       |                  else {
 2154|       |                     to<JSON, V>::template op<opening_and_closing_handled<Opts>()>(val, ctx, b, ix);
 2155|       |                  }
 2156|       |                  // If we skip everything then we may have an extra comma, which we want to revert
 2157|       |                  if constexpr (Opts.skip_null_members) {
 2158|       |                     if (b[ix - 1] == ',') {
 2159|       |                        --ix;
 2160|       |                     }
 2161|       |                  }
 2162|       |
 2163|       |                  if constexpr (Opts.prettify) {
 2164|       |                     ctx.depth -= check_indentation_width(Opts);
 2165|       |                     if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 2166|       |                        return;
 2167|       |                     }
 2168|       |                     std::memcpy(&b[ix], "\n", 1);
 2169|       |                     ++ix;
 2170|       |                     fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 2171|       |                     ix += ctx.depth;
 2172|       |                     std::memcpy(&b[ix], "}", 1);
 2173|       |                     ++ix;
 2174|       |                  }
 2175|       |                  else {
 2176|       |                     dump('}', b, ix);
 2177|       |                  }
 2178|       |               }
 2179|  7.16M|               else {
 2180|  7.16M|                  to<JSON, V>::template op<Opts>(val, ctx, b, ix);
 2181|  7.16M|               }
 2182|  7.16M|            },
_ZN3glz2toILj10ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEERS5_TkNS_10is_contextERNS_7contextEmQoo14writable_map_tIT_EaaL_ZNS0_ILj10ESK_E14map_like_arrayEEeqcl17check_concatenateTL0__ELb1EEEvOT1_OT2_OT0_RT3_:
 1623|  7.16M|      {
 1624|  7.16M|         if constexpr (not check_opening_handled(Opts)) {
 1625|  7.16M|            dump('{', b, ix);
 1626|  7.16M|         }
 1627|       |
 1628|  7.16M|         if (!empty_range(value)) {
  ------------------
  |  Branch (1628:14): [True: 6.96M, False: 207k]
  ------------------
 1629|  6.96M|            if constexpr (!check_opening_handled(Opts)) {
 1630|       |               if constexpr (Opts.prettify) {
 1631|       |                  ctx.depth += check_indentation_width(Opts);
 1632|       |                  if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 1633|       |                     return;
 1634|       |                  }
 1635|       |                  std::memcpy(&b[ix], "\n", 1);
 1636|       |                  ++ix;
 1637|       |                  fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 1638|       |                  ix += ctx.depth;
 1639|       |               }
 1640|  6.96M|            }
 1641|       |
 1642|  6.96M|            using val_t = detail::iterator_second_type<T>; // the type of value in each [key, value] pair
 1643|  6.96M|            if constexpr (!never_written<Opts, val_t>) {
 1644|       |               if constexpr (null_t<val_t> && Opts.skip_null_members) {
 1645|       |                  auto write_first_entry = [&](auto&& it) {
 1646|       |                     auto&& [key, entry_val] = *it;
 1647|       |                     if (skip_member<Opts>(entry_val)) {
 1648|       |                        return true;
 1649|       |                     }
 1650|       |                     write_pair_content<Opts>(key, entry_val, ctx, b, ix);
 1651|       |                     return bool(ctx.error);
 1652|       |                  };
 1653|       |
 1654|       |                  auto it = std::begin(value);
 1655|       |                  bool first = write_first_entry(it);
 1656|       |                  if (bool(ctx.error)) [[unlikely]] {
 1657|       |                     return;
 1658|       |                  }
 1659|       |                  ++it;
 1660|       |                  for (const auto end = std::end(value); it != end; ++it) {
 1661|       |                     auto&& [key, entry_val] = *it;
 1662|       |                     if (skip_member<Opts>(entry_val)) {
 1663|       |                        continue;
 1664|       |                     }
 1665|       |
 1666|       |                     // When Opts.skip_null_members, *any* entry may be skipped, meaning separator dumping must be
 1667|       |                     // conditional for every entry.
 1668|       |                     // Alternatively, write separator after each entry except last but then branch is permanent
 1669|       |                     if (not first) {
 1670|       |                        write_object_entry_separator<Opts>(ctx, b, ix);
 1671|       |                     }
 1672|       |
 1673|       |                     write_pair_content<Opts>(key, entry_val, ctx, b, ix);
 1674|       |                     if (bool(ctx.error)) [[unlikely]] {
 1675|       |                        return;
 1676|       |                     }
 1677|       |
 1678|       |                     first = false;
 1679|       |                  }
 1680|       |               }
 1681|  6.96M|               else {
 1682|  6.96M|                  auto write_first_entry = [&](auto&& it) {
 1683|  6.96M|                     auto&& [key, entry_val] = *it;
 1684|  6.96M|                     write_pair_content<Opts>(key, entry_val, ctx, b, ix);
 1685|  6.96M|                  };
 1686|       |
 1687|  6.96M|                  auto it = std::begin(value);
 1688|  6.96M|                  write_first_entry(it);
 1689|  6.96M|                  if (bool(ctx.error)) [[unlikely]] {
  ------------------
  |  Branch (1689:23): [True: 0, False: 6.96M]
  ------------------
 1690|      0|                     return;
 1691|      0|                  }
 1692|  6.96M|                  ++it;
 1693|  12.4M|                  for (const auto end = std::end(value); it != end; ++it) {
  ------------------
  |  Branch (1693:58): [True: 5.49M, False: 6.96M]
  ------------------
 1694|  5.49M|                     auto&& [key, entry_val] = *it;
 1695|  5.49M|                     write_object_entry_separator<Opts>(ctx, b, ix);
 1696|  5.49M|                     write_pair_content<Opts>(key, entry_val, ctx, b, ix);
 1697|  5.49M|                     if (bool(ctx.error)) [[unlikely]] {
  ------------------
  |  Branch (1697:26): [True: 0, False: 5.49M]
  ------------------
 1698|      0|                        return;
 1699|      0|                     }
 1700|  5.49M|                  }
 1701|  6.96M|               }
 1702|  6.96M|            }
 1703|       |
 1704|  6.96M|            if constexpr (!check_closing_handled(Opts)) {
 1705|       |               if constexpr (Opts.prettify) {
 1706|       |                  ctx.depth -= check_indentation_width(Opts);
 1707|       |                  if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
 1708|       |                     return;
 1709|       |                  }
 1710|       |                  std::memcpy(&b[ix], "\n", 1);
 1711|       |                  ++ix;
 1712|       |                  fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
 1713|       |                  ix += ctx.depth;
 1714|       |               }
 1715|  6.96M|            }
 1716|  6.96M|         }
 1717|       |
 1718|  7.16M|         if constexpr (!check_closing_handled(Opts)) {
 1719|  7.16M|            dump('}', b, ix);
 1720|  7.16M|         }
 1721|  7.16M|      }
_ZZN3glz2toILj10ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEERS5_TkNS_10is_contextERNS_7contextEmQoo14writable_map_tIT_EaaL_ZNS0_ILj10ESK_E14map_like_arrayEEeqcl17check_concatenateTL0__ELb1EEEvOT1_OT2_OT0_RT3_ENKUlOSK_E_clIRPNS9_4pairISF_S4_EEEEDaSU_:
 1682|  6.96M|                  auto write_first_entry = [&](auto&& it) {
 1683|  6.96M|                     auto&& [key, entry_val] = *it;
 1684|  6.96M|                     write_pair_content<Opts>(key, entry_val, ctx, b, ix);
 1685|  6.96M|                  };
_ZN3glz28write_object_entry_separatorITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEELb1ERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEETkNS_10is_contextERNS_7contextEmQooeqdtT_6formatL_ZNS_4JSONEEeqdtT_6formatL_ZNS_6NDJSONEEEEvOT2_OT1_RT3_:
  158|  5.49M|   {
  159|       |      if constexpr (Opts.prettify) {
  160|       |         if (!ensure_space(ctx, b, ix + ctx.depth + write_padding_bytes)) [[unlikely]] {
  161|       |            return;
  162|       |         }
  163|       |         std::memcpy(&b[ix], ",\n", 2);
  164|       |         ix += 2;
  165|       |         fill_bytes(&b[ix], check_indentation_char(Opts), ctx.depth);
  166|       |         ix += ctx.depth;
  167|       |      }
  168|  5.49M|      else {
  169|  5.49M|         if constexpr (minified_check) {
  170|  5.49M|            if (!ensure_space(ctx, b, ix + 1)) [[unlikely]] {
  ------------------
  |  Branch (170:17): [True: 0, False: 5.49M]
  ------------------
  171|      0|               return;
  172|      0|            }
  173|  5.49M|         }
  174|  5.49M|         std::memcpy(&b[ix], ",", 1);
  175|  5.49M|         ++ix;
  176|  5.49M|      }
  177|       |      if constexpr (is_output_streaming<B>) {
  178|       |         flush_buffer(b, ix);
  179|       |      }
  180|  5.49M|   }
_ZN3glz18write_pair_contentITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_10is_contextENS_7contextERS8_mEEvRKT0_OT1_RT2_OT3_RT4_:
 1395|  12.4M|   {
 1396|       |      if constexpr (str_t<Key> || char_t<Key> || is_named_enum<Key> || mimics_str_t<Key> || custom_str_t<Key> ||
 1397|  12.4M|                    check_quoted_num(Opts)) {
 1398|  12.4M|         to<JSON, core_t<Key>>::template op<Opts>(key, ctx, b, ix);
 1399|       |      }
 1400|       |      else if constexpr (num_t<Key>) {
 1401|       |         serialize<JSON>::op<opt_true<Opts, quoted_num_opt_tag{}>>(key, ctx, b, ix);
 1402|       |      }
 1403|       |      else {
 1404|       |         serialize<JSON>::op<opt_false<Opts, raw_string_opt_tag{}>>(quoted_t<const Key>{key}, ctx, b, ix);
 1405|       |      }
 1406|  12.4M|      if (bool(ctx.error)) [[unlikely]] {
  ------------------
  |  Branch (1406:11): [True: 0, False: 12.4M]
  ------------------
 1407|      0|         return;
 1408|      0|      }
 1409|       |      if constexpr (Opts.prettify) {
 1410|       |         dump(": ", b, ix);
 1411|       |      }
 1412|  12.4M|      else {
 1413|  12.4M|         dump(':', b, ix);
 1414|  12.4M|      }
 1415|       |
 1416|  12.4M|      using V = core_t<decltype(value)>;
 1417|  12.4M|      to<JSON, V>::template op<opening_and_closing_handled_off<Opts>()>(value, ctx, b, ix);
 1418|  12.4M|   }
_ZN3glz2toILj10ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS7_RKS7_TkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_:
  845|  12.4M|      {
  846|       |         if constexpr (check_string_as_number(Opts)) {
  847|       |            const sv str = [&]() -> const sv {
  848|       |               if constexpr (array_char_t<T>) {
  849|       |                  const auto* start = value.data();
  850|       |                  const auto* end = static_cast<const char*>(std::memchr(start, '\0', value.size()));
  851|       |                  return sv{start, end ? size_t(end - start) : value.size()};
  852|       |               }
  853|       |               else if constexpr (u8str_t<T>) {
  854|       |                  return sv{reinterpret_cast<const char*>(value.data()), value.size()};
  855|       |               }
  856|       |               else {
  857|       |                  return str_view<T>(value);
  858|       |               }
  859|       |            }();
  860|       |            if (!ensure_space(ctx, b, ix + str.size() + write_padding_bytes)) [[unlikely]] {
  861|       |               return;
  862|       |            }
  863|       |            dump_maybe_empty<false>(str, b, ix);
  864|       |         }
  865|       |         else if constexpr (char_t<T>) {
  866|       |            if constexpr (check_unquoted(Opts)) {
  867|       |               dump(value, b, ix);
  868|       |            }
  869|       |            else {
  870|       |               // 8 bytes is enough for quotes and escaped character (worst case: \uXXXX = 6 + 2 quotes)
  871|       |               if (!ensure_space(ctx, b, ix + 8)) [[unlikely]] {
  872|       |                  return;
  873|       |               }
  874|       |
  875|       |               std::memcpy(&b[ix], "\"", 1);
  876|       |               ++ix;
  877|       |               if (const auto escaped = char_escape_table[uint8_t(value)]; escaped) {
  878|       |                  std::memcpy(&b[ix], &escaped, 2);
  879|       |                  ix += 2;
  880|       |               }
  881|       |               else if (value == '\0') {
  882|       |                  // null character treated as empty string
  883|       |               }
  884|       |               else if constexpr (check_escape_control_characters(Opts)) {
  885|       |                  if (uint8_t(value) < 0x20) {
  886|       |                     // Write as \uXXXX format
  887|       |                     char unicode_escape[6] = {'\\', 'u', '0', '0', '0', '0'};
  888|       |                     constexpr char hex_digits[] = "0123456789ABCDEF";
  889|       |                     unicode_escape[4] = hex_digits[(value >> 4) & 0xF];
  890|       |                     unicode_escape[5] = hex_digits[value & 0xF];
  891|       |                     std::memcpy(&b[ix], unicode_escape, 6);
  892|       |                     ix += 6;
  893|       |                  }
  894|       |                  else {
  895|       |                     std::memcpy(&b[ix], &value, 1);
  896|       |                     ++ix;
  897|       |                  }
  898|       |               }
  899|       |               else {
  900|       |                  if constexpr (check_reject_control_characters(Opts)) {
  901|       |                     if (uint8_t(value) < 0x20) [[unlikely]] {
  902|       |                        ctx.error = error_code::invalid_control_character;
  903|       |                     }
  904|       |                  }
  905|       |                  std::memcpy(&b[ix], &value, 1);
  906|       |                  ++ix;
  907|       |               }
  908|       |               std::memcpy(&b[ix], "\"", 1);
  909|       |               ++ix;
  910|       |            }
  911|       |         }
  912|  12.4M|         else {
  913|       |            if constexpr (check_raw_string(Opts)) {
  914|       |               const sv str = [&]() -> const sv {
  915|       |                  if constexpr (u8str_t<T>) {
  916|       |                     return sv{reinterpret_cast<const char*>(value.data()), value.size()};
  917|       |                  }
  918|       |                  else {
  919|       |                     return str_view<T>(value);
  920|       |                  }
  921|       |               }();
  922|       |
  923|       |               // We need space for quotes and the string length: 2 + n.
  924|       |               // Use +8 for extra buffer
  925|       |               if (!ensure_space(ctx, b, ix + 8 + str.size())) [[unlikely]] {
  926|       |                  return;
  927|       |               }
  928|       |               // now we don't have to check writing
  929|       |
  930|       |               if constexpr (not check_unquoted(Opts)) {
  931|       |                  std::memcpy(&b[ix], "\"", 1);
  932|       |                  ++ix;
  933|       |               }
  934|       |               if (str.size()) [[likely]] {
  935|       |                  const auto n = str.size();
  936|       |                  std::memcpy(&b[ix], str.data(), n);
  937|       |                  ix += n;
  938|       |               }
  939|       |               if constexpr (not check_unquoted(Opts)) {
  940|       |                  std::memcpy(&b[ix], "\"", 1);
  941|       |                  ++ix;
  942|       |               }
  943|       |            }
  944|  12.4M|            else {
  945|  12.4M|               const sv str = [&]() -> const sv {
  946|  12.4M|                  if constexpr (array_char_t<T>) {
  947|  12.4M|                     return sv{value.data(), value.size()};
  948|  12.4M|                  }
  949|  12.4M|                  else if constexpr (u8str_t<T>) {
  950|  12.4M|                     return sv{reinterpret_cast<const char*>(value.data()), value.size()};
  951|  12.4M|                  }
  952|  12.4M|                  else {
  953|  12.4M|                     return str_view<T>(value);
  954|  12.4M|                  }
  955|  12.4M|               }();
  956|  12.4M|               const auto n = str.size();
  957|       |
  958|       |               // In the case n == 0 we need two characters for quotes.
  959|       |               // For each individual character we need room for two characters to handle escapes.
  960|       |               // When using Unicode escapes, we might need up to 6 characters (\uXXXX) per character
  961|       |               if constexpr (check_escape_control_characters(Opts)) {
  962|       |                  if constexpr (has_bounded_capacity<B>) {
  963|       |                     // 6 bytes per character is a ceiling only a string of nothing but control
  964|       |                     // characters reaches. A resizable buffer merely over-allocates against it,
  965|       |                     // but a fixed buffer has nowhere to grow, so the ceiling would reject output
  966|       |                     // that fits. Measuring the string answers exactly, at the cost of a pass over
  967|       |                     // it, so bracket the measurement between two O(1) bounds and only pay it when
  968|       |                     // the answer is still in doubt: the ceiling fitting means yes, and the floor
  969|       |                     // of one byte per character not fitting means no.
  970|       |                     const size_t capacity = buffer_traits<std::remove_cvref_t<B>>::capacity(b);
  971|       |                     size_t required = ix + 10 + 6 * n;
  972|       |                     if (required > capacity) [[unlikely]] {
  973|       |                        required = ix + 10 + n;
  974|       |                        if (required <= capacity) {
  975|       |                           required = ix + 10 + detail::escaped_string_size(str);
  976|       |                        }
  977|       |                     }
  978|       |                     if (!ensure_space(ctx, b, required)) [[unlikely]] {
  979|       |                        return;
  980|       |                     }
  981|       |                  }
  982|       |                  // We need 2 + 6 * n characters in the worst case (all control chars)
  983|       |                  else if (!ensure_space(ctx, b, ix + 10 + 6 * n)) [[unlikely]] {
  984|       |                     return;
  985|       |                  }
  986|       |               }
  987|  12.4M|               else {
  988|       |                  // Using the original sizing
  989|  12.4M|                  if (!ensure_space(ctx, b, ix + 10 + 2 * n)) [[unlikely]] {
  ------------------
  |  Branch (989:23): [True: 0, False: 12.4M]
  ------------------
  990|      0|                     return;
  991|      0|                  }
  992|  12.4M|               }
  993|       |               // now we don't have to check writing
  994|       |
  995|       |               if constexpr (check_unquoted(Opts)) {
  996|       |                  if (n) {
  997|       |                     std::memcpy(&b[ix], str.data(), n);
  998|       |                     ix += n;
  999|       |                  }
 1000|       |               }
 1001|  12.4M|               else {
 1002|  12.4M|                  std::memcpy(&b[ix], "\"", 1);
 1003|  12.4M|                  ++ix;
 1004|       |
 1005|  12.4M|                  const auto* c = str.data();
 1006|  12.4M|                  const auto* const e = c + n;
 1007|  12.4M|                  const auto start = &b[ix];
 1008|  12.4M|                  auto data = start;
 1009|       |
 1010|       |                  // By default we don't escape control characters for performance. Invalid JSON characters
 1011|       |                  // result in null characters in the output, making the JSON invalid — these would then be
 1012|       |                  // detected upon reading. Enable the `escape_control_characters` option to properly escape
 1013|       |                  // control characters (0x00–0x1F) as \uXXXX sequences.
 1014|       |
 1015|       |                  // Escape handler: writes the escaped form of *c into data, advances both pointers
 1016|  12.4M|                  auto write_escape = [&]() {
 1017|  12.4M|                     if constexpr (check_escape_control_characters(Opts)) {
 1018|  12.4M|                        if (const auto escaped = char_escape_table[uint8_t(*c)]; escaped) {
 1019|  12.4M|                           std::memcpy(data, &escaped, 2);
 1020|  12.4M|                           data += 2;
 1021|  12.4M|                        }
 1022|  12.4M|                        else {
 1023|  12.4M|                           char unicode_escape[6] = {'\\', 'u', '0', '0', '0', '0'};
 1024|  12.4M|                           constexpr char hex_digits[] = "0123456789ABCDEF";
 1025|  12.4M|                           unicode_escape[4] = hex_digits[(uint8_t(*c) >> 4) & 0xF];
 1026|  12.4M|                           unicode_escape[5] = hex_digits[uint8_t(*c) & 0xF];
 1027|  12.4M|                           std::memcpy(data, unicode_escape, 6);
 1028|  12.4M|                           data += 6;
 1029|  12.4M|                        }
 1030|  12.4M|                     }
 1031|  12.4M|                     else {
 1032|  12.4M|                        if constexpr (check_reject_control_characters(Opts)) {
 1033|       |                           // A control character with no two-character escape cannot be written
 1034|       |                           // without \uXXXX. The table entry is zero, so the memcpy below would
 1035|       |                           // put two NULs where one byte was. Flag it and let the loop finish:
 1036|       |                           // returning early here would leave c un-advanced and the SIMD scan
 1037|       |                           // would find the same byte forever. The output is abandoned anyway.
 1038|  12.4M|                           if (char_escape_table[uint8_t(*c)] == 0) [[unlikely]] {
 1039|  12.4M|                              ctx.error = error_code::invalid_control_character;
 1040|  12.4M|                           }
 1041|  12.4M|                        }
 1042|  12.4M|                        std::memcpy(data, &char_escape_table[uint8_t(*c)], 2);
 1043|  12.4M|                        data += 2;
 1044|  12.4M|                     }
 1045|  12.4M|                     ++c;
 1046|  12.4M|                  };
 1047|       |
 1048|       |                  // Adding a helper here means adding a branch to string_escape_simd() in
 1049|       |                  // simd/backends.hpp, which names the widest one this cascade invokes, and a row
 1050|       |                  // to known_builds in tests/json_test/utf8_validation_test.cpp, which checks it.
 1051|       |#if defined(GLZ_USE_AVX2)
 1052|       |                  detail::avx2_string_escape(c, e, data, n, write_escape);
 1053|       |#endif
 1054|  12.4M|#if defined(GLZ_USE_SSE2)
 1055|  12.4M|                  detail::sse2_string_escape(c, e, data, n, write_escape);
 1056|       |#elif defined(GLZ_USE_NEON)
 1057|       |                  detail::neon_string_escape(c, e, data, n, write_escape);
 1058|       |#endif
 1059|       |
 1060|       |                  // SWAR: 8 bytes at a time
 1061|  12.4M|                  if (n > 7) {
  ------------------
  |  Branch (1061:23): [True: 4.94M, False: 7.51M]
  ------------------
 1062|  11.5M|                     for (const auto end_m7 = e - 7; c < end_m7;) {
  ------------------
  |  Branch (1062:54): [True: 6.61M, False: 4.94M]
  ------------------
 1063|  6.61M|                        std::memcpy(data, c, 8);
 1064|  6.61M|                        uint64_t swar;
 1065|  6.61M|                        std::memcpy(&swar, c, 8);
 1066|       |                        if constexpr (std::endian::native == std::endian::big) {
 1067|       |                           swar = std::byteswap(swar);
 1068|       |                        }
 1069|       |
 1070|  6.61M|                        constexpr uint64_t lo7_mask = repeat_byte8(0b01111111);
 1071|  6.61M|                        const uint64_t lo7 = swar & lo7_mask;
 1072|  6.61M|                        const uint64_t quote = (lo7 ^ repeat_byte8('"')) + lo7_mask;
 1073|  6.61M|                        const uint64_t backslash = (lo7 ^ repeat_byte8('\\')) + lo7_mask;
 1074|  6.61M|                        const uint64_t less_32 = (swar & repeat_byte8(0b01100000)) + lo7_mask;
 1075|  6.61M|                        uint64_t next = ~((quote & backslash & less_32) | swar);
 1076|       |
 1077|  6.61M|                        next &= repeat_byte8(0b10000000);
 1078|  6.61M|                        if (next == 0) {
  ------------------
  |  Branch (1078:29): [True: 1.69M, False: 4.92M]
  ------------------
 1079|  1.69M|                           data += 8;
 1080|  1.69M|                           c += 8;
 1081|  1.69M|                           continue;
 1082|  1.69M|                        }
 1083|       |
 1084|  4.92M|                        const auto length = (countr_zero(next) >> 3);
 1085|  4.92M|                        c += length;
 1086|  4.92M|                        data += length;
 1087|  4.92M|                        write_escape();
 1088|  4.92M|                     }
 1089|  4.94M|                  }
 1090|       |
 1091|       |                  // Scalar tail
 1092|  50.3M|                  for (; c < e; ++c) {
  ------------------
  |  Branch (1092:26): [True: 37.8M, False: 12.4M]
  ------------------
 1093|  37.8M|                     if (const auto escaped = char_escape_table[uint8_t(*c)]; escaped) {
  ------------------
  |  Branch (1093:79): [True: 1.21M, False: 36.6M]
  ------------------
 1094|  1.21M|                        std::memcpy(data, &escaped, 2);
 1095|  1.21M|                        data += 2;
 1096|  1.21M|                     }
 1097|       |                     else if constexpr (check_escape_control_characters(Opts)) {
 1098|       |                        if (uint8_t(*c) < 0x20) {
 1099|       |                           char unicode_escape[6] = {'\\', 'u', '0', '0', '0', '0'};
 1100|       |                           constexpr char hex_digits[] = "0123456789ABCDEF";
 1101|       |                           unicode_escape[4] = hex_digits[(uint8_t(*c) >> 4) & 0xF];
 1102|       |                           unicode_escape[5] = hex_digits[uint8_t(*c) & 0xF];
 1103|       |                           std::memcpy(data, unicode_escape, 6);
 1104|       |                           data += 6;
 1105|       |                        }
 1106|       |                        else {
 1107|       |                           std::memcpy(data, c, 1);
 1108|       |                           ++data;
 1109|       |                        }
 1110|       |                     }
 1111|  36.6M|                     else {
 1112|       |                        if constexpr (check_reject_control_characters(Opts)) {
 1113|       |                           if (uint8_t(*c) < 0x20) [[unlikely]] {
 1114|       |                              ctx.error = error_code::invalid_control_character;
 1115|       |                           }
 1116|       |                        }
 1117|  36.6M|                        std::memcpy(data, c, 1);
 1118|  36.6M|                        ++data;
 1119|  36.6M|                     }
 1120|  37.8M|                  }
 1121|       |
 1122|  12.4M|                  ix += size_t(data - start);
 1123|       |
 1124|  12.4M|                  std::memcpy(&b[ix], "\"", 1);
 1125|  12.4M|                  ++ix;
 1126|  12.4M|               }
 1127|  12.4M|            }
 1128|  12.4M|         }
 1129|  12.4M|      }
_ZZN3glz2toILj10ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS7_RKS7_TkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_ENKUlvE_clEv:
  945|  12.4M|               const sv str = [&]() -> const sv {
  946|       |                  if constexpr (array_char_t<T>) {
  947|       |                     return sv{value.data(), value.size()};
  948|       |                  }
  949|       |                  else if constexpr (u8str_t<T>) {
  950|       |                     return sv{reinterpret_cast<const char*>(value.data()), value.size()};
  951|       |                  }
  952|  12.4M|                  else {
  953|  12.4M|                     return str_view<T>(value);
  954|  12.4M|                  }
  955|  12.4M|               }();
_ZZN3glz2toILj10ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS7_RKS7_TkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_ENKUlvE0_clEv:
 1016|  3.17G|                  auto write_escape = [&]() {
 1017|       |                     if constexpr (check_escape_control_characters(Opts)) {
 1018|       |                        if (const auto escaped = char_escape_table[uint8_t(*c)]; escaped) {
 1019|       |                           std::memcpy(data, &escaped, 2);
 1020|       |                           data += 2;
 1021|       |                        }
 1022|       |                        else {
 1023|       |                           char unicode_escape[6] = {'\\', 'u', '0', '0', '0', '0'};
 1024|       |                           constexpr char hex_digits[] = "0123456789ABCDEF";
 1025|       |                           unicode_escape[4] = hex_digits[(uint8_t(*c) >> 4) & 0xF];
 1026|       |                           unicode_escape[5] = hex_digits[uint8_t(*c) & 0xF];
 1027|       |                           std::memcpy(data, unicode_escape, 6);
 1028|       |                           data += 6;
 1029|       |                        }
 1030|       |                     }
 1031|  3.17G|                     else {
 1032|       |                        if constexpr (check_reject_control_characters(Opts)) {
 1033|       |                           // A control character with no two-character escape cannot be written
 1034|       |                           // without \uXXXX. The table entry is zero, so the memcpy below would
 1035|       |                           // put two NULs where one byte was. Flag it and let the loop finish:
 1036|       |                           // returning early here would leave c un-advanced and the SIMD scan
 1037|       |                           // would find the same byte forever. The output is abandoned anyway.
 1038|       |                           if (char_escape_table[uint8_t(*c)] == 0) [[unlikely]] {
 1039|       |                              ctx.error = error_code::invalid_control_character;
 1040|       |                           }
 1041|       |                        }
 1042|  3.17G|                        std::memcpy(data, &char_escape_table[uint8_t(*c)], 2);
 1043|  3.17G|                        data += 2;
 1044|  3.17G|                     }
 1045|  3.17G|                     ++c;
 1046|  3.17G|                  };

_ZN3glz6detail18sse2_string_escapeIcRZNS_2toILj10ENSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS9_SD_TkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_EUlvE0_EEvRPKcSR_RPT_mSL_:
   20|  1.85M|   {
   21|       |      // SSE2: 16 bytes at a time with direct comparison instructions
   22|  1.85M|      if (n > 15) {
  ------------------
  |  Branch (22:11): [True: 171k, False: 1.68M]
  ------------------
   23|   171k|         const __m128i quote_vec = _mm_set1_epi8('"');
   24|   171k|         const __m128i bs_vec = _mm_set1_epi8('\\');
   25|   171k|         const __m128i ctrl_mask = _mm_set1_epi8(static_cast<int8_t>(0xE0));
   26|   171k|         const __m128i zero = _mm_setzero_si128();
   27|       |
   28|  15.5M|         for (const char* end_m15 = e - 15; c < end_m15;) {
  ------------------
  |  Branch (28:45): [True: 15.4M, False: 171k]
  ------------------
   29|  15.4M|            __m128i v = _mm_loadu_si128(reinterpret_cast<const __m128i*>(c));
   30|  15.4M|            _mm_storeu_si128(reinterpret_cast<__m128i*>(data), v);
   31|       |
   32|  15.4M|            const uint32_t mask = static_cast<uint32_t>(
   33|  15.4M|               _mm_movemask_epi8(_mm_or_si128(_mm_or_si128(_mm_cmpeq_epi8(v, quote_vec), _mm_cmpeq_epi8(v, bs_vec)),
   34|  15.4M|                                              _mm_cmpeq_epi8(_mm_and_si128(v, ctrl_mask), zero))));
   35|       |
   36|  15.4M|            if (mask == 0) {
  ------------------
  |  Branch (36:17): [True: 15.3M, False: 74.5k]
  ------------------
   37|  15.3M|               data += 16;
   38|  15.3M|               c += 16;
   39|  15.3M|               continue;
   40|  15.3M|            }
   41|       |
   42|  74.5k|            const uint32_t length = countr_zero(mask);
   43|  74.5k|            c += length;
   44|  74.5k|            data += length;
   45|  74.5k|            write_escape();
   46|  74.5k|         }
   47|   171k|      }
   48|  1.85M|   }
_ZN3glz6detail18sse2_string_escapeIcRZNS_2toILj10ENSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb1ELb1EEERS9_RKS9_TkNS_10is_contextERNS_7contextEmEEvOT1_OT2_OT0_RT3_EUlvE0_EEvRPKcST_RPT_mSN_:
   20|  12.4M|   {
   21|       |      // SSE2: 16 bytes at a time with direct comparison instructions
   22|  12.4M|      if (n > 15) {
  ------------------
  |  Branch (22:11): [True: 3.31M, False: 9.14M]
  ------------------
   23|  3.31M|         const __m128i quote_vec = _mm_set1_epi8('"');
   24|  3.31M|         const __m128i bs_vec = _mm_set1_epi8('\\');
   25|  3.31M|         const __m128i ctrl_mask = _mm_set1_epi8(static_cast<int8_t>(0xE0));
   26|  3.31M|         const __m128i zero = _mm_setzero_si128();
   27|       |
   28|  3.22G|         for (const char* end_m15 = e - 15; c < end_m15;) {
  ------------------
  |  Branch (28:45): [True: 3.22G, False: 3.31M]
  ------------------
   29|  3.22G|            __m128i v = _mm_loadu_si128(reinterpret_cast<const __m128i*>(c));
   30|  3.22G|            _mm_storeu_si128(reinterpret_cast<__m128i*>(data), v);
   31|       |
   32|  3.22G|            const uint32_t mask = static_cast<uint32_t>(
   33|  3.22G|               _mm_movemask_epi8(_mm_or_si128(_mm_or_si128(_mm_cmpeq_epi8(v, quote_vec), _mm_cmpeq_epi8(v, bs_vec)),
   34|  3.22G|                                              _mm_cmpeq_epi8(_mm_and_si128(v, ctrl_mask), zero))));
   35|       |
   36|  3.22G|            if (mask == 0) {
  ------------------
  |  Branch (36:17): [True: 50.4M, False: 3.16G]
  ------------------
   37|  50.4M|               data += 16;
   38|  50.4M|               c += 16;
   39|  50.4M|               continue;
   40|  50.4M|            }
   41|       |
   42|  3.16G|            const uint32_t length = countr_zero(mask);
   43|  3.16G|            c += length;
   44|  3.16G|            data += length;
   45|  3.16G|            write_escape();
   46|  3.16G|         }
   47|  3.31M|      }
   48|  12.4M|   }

_ZN3glz11countr_zeroEj:
   16|  3.17G|   {
   17|       |#ifdef _MSC_VER
   18|       |      return std::countr_zero(x);
   19|       |#else
   20|  3.17G|#if __has_builtin(__builtin_ctzl)
   21|  3.17G|      return __builtin_ctzl(x);
   22|       |#else
   23|       |      return std::countr_zero(x);
   24|       |#endif
   25|  3.17G|#endif
   26|  3.17G|   }
_ZN3glz11countr_zeroEm:
   29|  5.07M|   {
   30|       |#ifdef _MSC_VER
   31|       |      return std::countr_zero(x);
   32|       |#else
   33|  5.07M|#if __has_builtin(__builtin_ctzll)
   34|  5.07M|      return __builtin_ctzll(x);
   35|       |#else
   36|       |      return std::countr_zero(x);
   37|       |#endif
   38|  5.07M|#endif
   39|  5.07M|   }

_ZN3glz4dumpILb1ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEEvNS1_17basic_string_viewIcS4_EERT0_Rm:
  192|   183k|   {
  193|   183k|      const auto n = str.size();
  194|   183k|      if constexpr (vector_like<B>) {
  195|   183k|         if constexpr (Checked) {
  196|   183k|            const auto k = ix + n;
  197|   183k|            if (ix + n > b.size()) [[unlikely]] {
  ------------------
  |  Branch (197:17): [True: 0, False: 183k]
  ------------------
  198|      0|               grow_buffer(b, k);
  199|      0|            }
  200|   183k|         }
  201|   183k|      }
  202|   183k|      std::memcpy(&b[ix], str.data(), n);
  203|   183k|      ix += n;
  204|   183k|   }
_ZN3glz4dumpILb1ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEETkNS_10byte_sizedEcEEvT1_RT0_Rm:
  150|  27.7M|   {
  151|  27.7M|      if constexpr (Checked && vector_like<B>) {
  152|  27.7M|         if (ix == b.size()) [[unlikely]] {
  ------------------
  |  Branch (152:14): [True: 714, False: 27.7M]
  ------------------
  153|    714|            grow_buffer(b, b.size() == 0 ? 64 : ix + 1);
  ------------------
  |  Branch (153:28): [True: 0, False: 714]
  ------------------
  154|    714|         }
  155|  27.7M|      }
  156|  27.7M|      assign_maybe_cast(c, b, ix);
  157|  27.7M|      ++ix;
  158|  27.7M|   }
_ZN3glz17assign_maybe_castITkNS_10byte_sizedEcNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEEvT_RT0_Rm:
   95|  27.7M|   {
   96|  27.7M|      using V = std::decay_t<decltype(b[0])>;
   97|  27.7M|      using C = std::decay_t<decltype(c)>;
   98|  27.7M|      if constexpr (std::same_as<V, C>) {
   99|  27.7M|         b[ix] = c;
  100|       |      }
  101|       |      else {
  102|       |         b[ix] = static_cast<V>(c);
  103|       |      }
  104|  27.7M|   }

_ZN3glz10fast_float10from_charsIdciEENS0_19from_chars_result_tIT0_EEPKS3_S6_RT_NS0_12chars_formatE:
 4237|  3.18M|           chars_format fmt /*= chars_format::general*/) noexcept {
 4238|  3.18M|  return from_chars_caller<T>::call(first, last, value,
 4239|  3.18M|                                    parse_options_t<UC>(fmt));
 4240|  3.18M|}
_ZN3glz10fast_float17from_chars_callerIdE4callIcEENS0_19from_chars_result_tIT_EEPKS5_S8_RdNS0_15parse_options_tIS5_EE:
 4195|  3.18M|       parse_options_t<UC> options) noexcept {
 4196|  3.18M|    return from_chars_advanced(first, last, value, options);
 4197|  3.18M|  }
_ZN3glz10fast_float19from_chars_advancedIdcEENS0_19from_chars_result_tIT0_EEPKS3_S6_RT_NS0_15parse_options_tIS3_EE:
 4443|  3.18M|                    parse_options_t<UC> options) noexcept {
 4444|  3.18M|  return from_chars_advanced_caller<
 4445|  3.18M|      size_t(is_supported_float_type<T>::value) +
 4446|  3.18M|      2 * size_t(is_supported_integer_type<T>::value)>::call(first, last, value,
 4447|  3.18M|                                                             options);
 4448|  3.18M|}
_ZN3glz10fast_float26from_chars_advanced_callerILm1EE4callIdcEENS0_19from_chars_result_tIT0_EEPKS5_S8_RT_NS0_15parse_options_tIS5_EE:
 4426|  3.18M|       parse_options_t<UC> options) noexcept {
 4427|  3.18M|    return from_chars_float_advanced(first, last, value, options);
 4428|  3.18M|  }
_ZN3glz10fast_float25from_chars_float_advancedIdcEENS0_19from_chars_result_tIT0_EEPKS3_S6_RT_NS0_15parse_options_tIS3_EE:
 4338|  3.18M|                          parse_options_t<UC> options) noexcept {
 4339|       |
 4340|  3.18M|  static_assert(is_supported_float_type<T>::value,
 4341|  3.18M|                "only some floating-point types are supported");
 4342|  3.18M|  static_assert(is_supported_char_type<UC>::value,
 4343|  3.18M|                "only char, wchar_t, char16_t and char32_t are supported");
 4344|       |
 4345|  3.18M|  chars_format const fmt = detail::adjust_for_feature_macros(options.format);
 4346|       |
 4347|  3.18M|  from_chars_result_t<UC> answer;
 4348|  3.18M|  if (uint64_t(fmt & chars_format::skip_white_space)) {
  ------------------
  |  Branch (4348:7): [True: 0, False: 3.18M]
  ------------------
 4349|      0|    while ((first != last) && fast_float::is_space(*first)) {
  ------------------
  |  Branch (4349:12): [True: 0, False: 0]
  |  Branch (4349:31): [True: 0, False: 0]
  ------------------
 4350|      0|      first++;
 4351|      0|    }
 4352|      0|  }
 4353|  3.18M|  if (first == last) {
  ------------------
  |  Branch (4353:7): [True: 1.52k, False: 3.18M]
  ------------------
 4354|  1.52k|    answer.ec = std::errc::invalid_argument;
 4355|  1.52k|    answer.ptr = first;
 4356|  1.52k|    return answer;
 4357|  1.52k|  }
 4358|  3.18M|  parsed_number_string_t<UC> pns =
 4359|  3.18M|      uint64_t(fmt & detail::basic_json_fmt)
  ------------------
  |  Branch (4359:7): [True: 0, False: 3.18M]
  ------------------
 4360|  3.18M|          ? parse_number_string<true, UC>(first, last, options)
 4361|  3.18M|          : parse_number_string<false, UC>(first, last, options);
 4362|  3.18M|  if (!pns.valid) {
  ------------------
  |  Branch (4362:7): [True: 205k, False: 2.97M]
  ------------------
 4363|   205k|    if (uint64_t(fmt & chars_format::no_infnan)) {
  ------------------
  |  Branch (4363:9): [True: 0, False: 205k]
  ------------------
 4364|      0|      answer.ec = std::errc::invalid_argument;
 4365|      0|      answer.ptr = first;
 4366|      0|      return answer;
 4367|   205k|    } else {
 4368|   205k|      return detail::parse_infnan(first, last, value, fmt);
 4369|   205k|    }
 4370|   205k|  }
 4371|       |
 4372|       |  // call overload that takes parsed_number_string_t directly.
 4373|  2.97M|  return from_chars_advanced(pns, value);
 4374|  3.18M|}
_ZN3glz10fast_float6detail25adjust_for_feature_macrosENS0_12chars_formatE:
 1375|  6.37M|constexpr chars_format adjust_for_feature_macros(chars_format fmt) {
 1376|  6.37M|  return fmt
 1377|       |#ifdef GLZ_FASTFLOAT_ALLOWS_LEADING_PLUS
 1378|       |         | chars_format::allow_leading_plus
 1379|       |#endif
 1380|       |#ifdef GLZ_FASTFLOAT_SKIP_WHITE_SPACE
 1381|       |         | chars_format::skip_white_space
 1382|       |#endif
 1383|  6.37M|      ;
 1384|  6.37M|}
_ZN3glz10fast_floatanENS0_12chars_formatES1_:
 1340|  21.7M|constexpr chars_format operator&(chars_format lhs, chars_format rhs) noexcept {
 1341|  21.7M|  using int_type = std::underlying_type<chars_format>::type;
 1342|  21.7M|  return static_cast<chars_format>(static_cast<int_type>(lhs) &
 1343|  21.7M|                                   static_cast<int_type>(rhs));
 1344|  21.7M|}
_ZN3glz10fast_float4spanIKcEC2Ev:
  438|  6.78M|  constexpr span() : ptr(nullptr), length(0) {}
_ZN3glz10fast_float18report_parse_errorIcEENS0_22parsed_number_string_tIT_EEPKS3_NS0_11parse_errorE:
 1727|   205k|report_parse_error(UC const *p, parse_error error) {
 1728|   205k|  parsed_number_string_t<UC> answer;
 1729|   205k|  answer.valid = false;
 1730|   205k|  answer.lastmatch = p;
 1731|   205k|  answer.error = error;
 1732|   205k|  return answer;
 1733|   205k|}
_ZN3glz10fast_float10is_integerIcEEbT_:
 1481|   225k|fastfloat_really_inline constexpr bool is_integer(UC c) noexcept {
 1482|   225k|  return !(c > UC('9') || c < UC('0'));
  ------------------
  |  Branch (1482:12): [True: 9.44k, False: 215k]
  |  Branch (1482:27): [True: 9.66k, False: 205k]
  ------------------
 1483|   225k|}
_ZN3glz10fast_float11digit_valueIcEEmT_:
 1489|  10.0M|fastfloat_really_inline constexpr uint64_t digit_value(UC c) noexcept {
 1490|  10.0M|  return uint64_t(uint8_t(c) - uint8_t('0'));
 1491|  10.0M|}
_ZN3glz10fast_float4spanIKcEC2EPS2_m:
  436|  3.38M|  constexpr span(T const *_ptr, size_t _length) : ptr(_ptr), length(_length) {}
_ZN3glz10fast_float26loop_parse_if_eight_digitsERPKcS2_Rm:
 1679|   205k|                           uint64_t &i) {
 1680|       |  // optimizes better than parse_if_eight_digits_unrolled() for UC = char.
 1681|   566k|  while ((std::distance(p, pend) >= 8) &&
  ------------------
  |  Branch (1681:10): [True: 383k, False: 183k]
  ------------------
 1682|   383k|         is_made_of_eight_digits_fast(read8_to_u64(p))) {
  ------------------
  |  Branch (1682:10): [True: 361k, False: 22.7k]
  ------------------
 1683|   361k|    i = i * 100000000 +
 1684|   361k|        parse_eight_digits_unrolled(read8_to_u64(
 1685|   361k|            p)); // in rare cases, this will overflow, but that's ok
 1686|   361k|    p += 8;
 1687|   361k|  }
 1688|   205k|}
_ZN3glz10fast_float28is_made_of_eight_digits_fastEm:
 1597|   383k|is_made_of_eight_digits_fast(uint64_t val) noexcept {
 1598|   383k|  return !((((val + 0x4646464646464646) | (val - 0x3030303030303030)) &
 1599|   383k|            0x8080808080808080));
 1600|   383k|}
_ZN3glz10fast_float12read8_to_u64IcEEmPKT_:
 1503|   951k|read8_to_u64(UC const *chars) {
 1504|   951k|  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|   951k|  uint64_t val;
 1513|   951k|  ::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|   951k|  return val;
 1519|   951k|}
_ZN3glz10fast_float27parse_eight_digits_unrolledEm:
 1575|   567k|parse_eight_digits_unrolled(uint64_t val) {
 1576|   567k|  uint64_t const mask = 0x000000FF000000FF;
 1577|   567k|  uint64_t const mul1 = 0x000F424000000064; // 100 + (1000000ULL << 32)
 1578|   567k|  uint64_t const mul2 = 0x0000271000000001; // 1 + (10000ULL << 32)
 1579|   567k|  val -= 0x3030303030303030;
 1580|   567k|  val = (val * 10) + (val >> 8); // val = (val * 2561) >> 8;
 1581|   567k|  val = (((val & mask) * mul1) + (((val >> 16) & mask) * mul2)) >> 32;
 1582|   567k|  return uint32_t(val);
 1583|   567k|}
_ZNK3glz10fast_float4spanIKcE3lenEv:
  440|  89.0k|  constexpr size_t len() const noexcept { return length; }
_ZN3glz10fast_float19parse_number_stringILb0EcEENS0_22parsed_number_string_tIT0_EEPKS3_S6_NS0_15parse_options_tIS3_EE:
 1740|  3.18M|                    parse_options_t<UC> options) noexcept {
 1741|  3.18M|  chars_format const fmt = detail::adjust_for_feature_macros(options.format);
 1742|  3.18M|  UC const decimal_point = options.decimal_point;
 1743|       |
 1744|  3.18M|  parsed_number_string_t<UC> answer;
 1745|  3.18M|  answer.valid = false;
 1746|  3.18M|  answer.too_many_digits = false;
 1747|       |  // assume p < pend, so dereference without checks;
 1748|  3.18M|  answer.negative = (*p == UC('-'));
 1749|       |  // C++17 20.19.3.(7.1) explicitly forbids '+' sign here
 1750|  3.18M|  if ((*p == UC('-')) || (uint64_t(fmt & chars_format::allow_leading_plus) &&
  ------------------
  |  Branch (1750:7): [True: 26.1k, False: 3.15M]
  |  Branch (1750:27): [True: 0, False: 3.15M]
  ------------------
 1751|  26.1k|                          !basic_json_fmt && *p == UC('+'))) {
  ------------------
  |  Branch (1751:27): [True: 0, Folded]
  |  Branch (1751:46): [True: 0, False: 0]
  ------------------
 1752|  26.1k|    ++p;
 1753|  26.1k|    if (p == pend) {
  ------------------
  |  Branch (1753:9): [True: 3.60k, False: 22.5k]
  ------------------
 1754|  3.60k|      return report_parse_error<UC>(
 1755|  3.60k|          p, parse_error::missing_integer_or_dot_after_sign);
 1756|  3.60k|    }
 1757|  22.5k|    GLZ_FASTFLOAT_IF_CONSTEXPR17(basic_json_fmt) {
  ------------------
  |  |  127|  22.5k|#define GLZ_FASTFLOAT_IF_CONSTEXPR17(x) if constexpr (x)
  ------------------
 1758|  22.5k|      if (!is_integer(*p)) { // a sign must be followed by an integer
 1759|  22.5k|        return report_parse_error<UC>(p,
 1760|  22.5k|                                      parse_error::missing_integer_after_sign);
 1761|  22.5k|      }
 1762|  22.5k|    }
 1763|  22.5k|    else {
 1764|  22.5k|      if (!is_integer(*p) &&
  ------------------
  |  Branch (1764:11): [True: 7.31k, False: 15.2k]
  ------------------
 1765|  7.31k|          (*p !=
  ------------------
  |  Branch (1765:11): [True: 1.87k, False: 5.44k]
  ------------------
 1766|  7.31k|           decimal_point)) { // a sign must be followed by an integer or the dot
 1767|  1.87k|        return report_parse_error<UC>(
 1768|  1.87k|            p, parse_error::missing_integer_or_dot_after_sign);
 1769|  1.87k|      }
 1770|  22.5k|    }
 1771|  22.5k|  }
 1772|  3.18M|  UC const *const start_digits = p;
 1773|       |
 1774|  3.18M|  uint64_t i = 0; // an unsigned int avoids signed overflows (which are bad)
 1775|       |
 1776|  3.18M|  uint64_t digit;
 1777|  12.5M|  while ((p != pend) && (digit = digit_value(*p)) <= 9) {
  ------------------
  |  Branch (1777:10): [True: 9.86M, False: 2.67M]
  |  Branch (1777:25): [True: 9.36M, False: 508k]
  ------------------
 1778|       |    // a multiplication by 10 is cheaper than an arbitrary integer
 1779|       |    // multiplication
 1780|  9.36M|    i = 10 * i + digit; // might overflow, we will handle the overflow later
 1781|  9.36M|    ++p;
 1782|  9.36M|  }
 1783|  3.18M|  UC const *const end_of_integer_part = p;
 1784|  3.18M|  int64_t digit_count = int64_t(end_of_integer_part - start_digits);
 1785|  3.18M|  answer.integer = span<UC const>(start_digits, size_t(digit_count));
 1786|  3.18M|  GLZ_FASTFLOAT_IF_CONSTEXPR17(basic_json_fmt) {
  ------------------
  |  |  127|  3.18M|#define GLZ_FASTFLOAT_IF_CONSTEXPR17(x) if constexpr (x)
  ------------------
 1787|       |    // at least 1 digit in integer part, without leading zeros
 1788|       |    if (digit_count == 0) {
 1789|       |      return report_parse_error<UC>(p, parse_error::no_digits_in_integer_part);
 1790|       |    }
 1791|       |    if ((start_digits[0] == UC('0') && digit_count > 1)) {
 1792|       |      return report_parse_error<UC>(start_digits,
 1793|       |                                    parse_error::leading_zeros_in_integer_part);
 1794|       |    }
 1795|       |  }
 1796|       |
 1797|  3.18M|  int64_t exponent = 0;
 1798|  3.18M|  bool const has_decimal_point = (p != pend) && (*p == decimal_point);
  ------------------
  |  Branch (1798:34): [True: 508k, False: 2.67M]
  |  Branch (1798:49): [True: 205k, False: 302k]
  ------------------
 1799|  3.18M|  if (has_decimal_point) {
  ------------------
  |  Branch (1799:7): [True: 205k, False: 2.97M]
  ------------------
 1800|   205k|    ++p;
 1801|   205k|    UC const *before = p;
 1802|       |    // can occur at most twice without overflowing, but let it occur more, since
 1803|       |    // for integers with many digits, digit parsing is the primary bottleneck.
 1804|   205k|    loop_parse_if_eight_digits(p, pend, i);
 1805|       |
 1806|   320k|    while ((p != pend) && (digit = digit_value(*p)) <= 9) {
  ------------------
  |  Branch (1806:12): [True: 207k, False: 112k]
  |  Branch (1806:27): [True: 114k, False: 93.1k]
  ------------------
 1807|   114k|      ++p;
 1808|   114k|      i = i * 10 + digit; // in rare cases, this will overflow, but that's ok
 1809|   114k|    }
 1810|   205k|    exponent = before - p;
 1811|   205k|    answer.fraction = span<UC const>(before, size_t(p - before));
 1812|   205k|    digit_count -= exponent;
 1813|   205k|  }
 1814|  3.18M|  GLZ_FASTFLOAT_IF_CONSTEXPR17(basic_json_fmt) {
  ------------------
  |  |  127|  3.18M|#define GLZ_FASTFLOAT_IF_CONSTEXPR17(x) if constexpr (x)
  ------------------
 1815|       |    // at least 1 digit in fractional part
 1816|       |    if (has_decimal_point && exponent == 0) {
 1817|       |      return report_parse_error<UC>(p,
 1818|       |                                    parse_error::no_digits_in_fractional_part);
 1819|       |    }
 1820|       |  }
 1821|  3.18M|  else if (digit_count == 0) { // we must have encountered at least one integer!
  ------------------
  |  Branch (1821:12): [True: 200k, False: 2.98M]
  ------------------
 1822|   200k|    return report_parse_error<UC>(p, parse_error::no_digits_in_mantissa);
 1823|   200k|  }
 1824|  2.98M|  int64_t exp_number = 0; // explicit exponential part
 1825|  3.18M|  if ((uint64_t(fmt & chars_format::scientific) && (p != pend) &&
  ------------------
  |  Branch (1825:8): [True: 2.97M, False: 202k]
  |  Branch (1825:52): [True: 273k, False: 2.70M]
  ------------------
 1826|   273k|       ((UC('e') == *p) || (UC('E') == *p))) ||
  ------------------
  |  Branch (1826:9): [True: 5.44k, False: 268k]
  |  Branch (1826:28): [True: 19.9k, False: 248k]
  ------------------
 1827|  2.95M|      (uint64_t(fmt & detail::basic_fortran_fmt) && (p != pend) &&
  ------------------
  |  Branch (1827:8): [True: 0, False: 2.95M]
  |  Branch (1827:53): [True: 0, False: 0]
  ------------------
 1828|      0|       ((UC('+') == *p) || (UC('-') == *p) || (UC('d') == *p) ||
  ------------------
  |  Branch (1828:9): [True: 0, False: 0]
  |  Branch (1828:28): [True: 0, False: 0]
  |  Branch (1828:47): [True: 0, False: 0]
  ------------------
 1829|  25.3k|        (UC('D') == *p)))) {
  ------------------
  |  Branch (1829:9): [True: 0, False: 0]
  ------------------
 1830|  25.3k|    UC const *location_of_e = p;
 1831|  25.3k|    if ((UC('e') == *p) || (UC('E') == *p) || (UC('d') == *p) ||
  ------------------
  |  Branch (1831:9): [True: 5.44k, False: 19.9k]
  |  Branch (1831:28): [True: 19.9k, False: 0]
  |  Branch (1831:47): [True: 0, False: 0]
  ------------------
 1832|  25.3k|        (UC('D') == *p)) {
  ------------------
  |  Branch (1832:9): [True: 0, False: 0]
  ------------------
 1833|  25.3k|      ++p;
 1834|  25.3k|    }
 1835|  25.3k|    bool neg_exp = false;
 1836|  25.3k|    if ((p != pend) && (UC('-') == *p)) {
  ------------------
  |  Branch (1836:9): [True: 23.1k, False: 2.24k]
  |  Branch (1836:24): [True: 9.03k, False: 14.0k]
  ------------------
 1837|  9.03k|      neg_exp = true;
 1838|  9.03k|      ++p;
 1839|  16.3k|    } else if ((p != pend) &&
  ------------------
  |  Branch (1839:16): [True: 14.0k, False: 2.24k]
  ------------------
 1840|  14.0k|               (UC('+') ==
  ------------------
  |  Branch (1840:16): [True: 316, False: 13.7k]
  ------------------
 1841|  14.0k|                *p)) { // '+' on exponent is allowed by C++17 20.19.3.(7.1)
 1842|    316|      ++p;
 1843|    316|    }
 1844|  25.3k|    if ((p == pend) || !is_integer(*p)) {
  ------------------
  |  Branch (1844:9): [True: 2.42k, False: 22.9k]
  |  Branch (1844:24): [True: 7.57k, False: 15.3k]
  ------------------
 1845|  9.99k|      if (!uint64_t(fmt & chars_format::fixed)) {
  ------------------
  |  Branch (1845:11): [True: 0, False: 9.99k]
  ------------------
 1846|       |        // The exponential part is invalid for scientific notation, so it must
 1847|       |        // be a trailing token for fixed notation. However, fixed notation is
 1848|       |        // disabled, so report a scientific notation error.
 1849|      0|        return report_parse_error<UC>(p, parse_error::missing_exponential_part);
 1850|      0|      }
 1851|       |      // Otherwise, we will be ignoring the 'e'.
 1852|  9.99k|      p = location_of_e;
 1853|  15.3k|    } else {
 1854|   190k|      while ((p != pend) && is_integer(*p)) {
  ------------------
  |  Branch (1854:14): [True: 179k, False: 11.1k]
  |  Branch (1854:29): [True: 175k, False: 4.22k]
  ------------------
 1855|   175k|        uint8_t exp_digit = uint8_t(*p - UC('0'));
 1856|   175k|        if (exp_number < 0x10000000) {
  ------------------
  |  Branch (1856:13): [True: 49.4k, False: 125k]
  ------------------
 1857|  49.4k|          exp_number = 10 * exp_number + exp_digit;
 1858|  49.4k|        }
 1859|   175k|        ++p;
 1860|   175k|      }
 1861|  15.3k|      if (neg_exp) {
  ------------------
  |  Branch (1861:11): [True: 9.01k, False: 6.35k]
  ------------------
 1862|  9.01k|        exp_number = -exp_number;
 1863|  9.01k|      }
 1864|  15.3k|      exponent += exp_number;
 1865|  15.3k|    }
 1866|  3.15M|  } else {
 1867|       |    // If it scientific and not fixed, we have to bail out.
 1868|  3.15M|    if (uint64_t(fmt & chars_format::scientific) &&
  ------------------
  |  Branch (1868:9): [True: 2.95M, False: 202k]
  ------------------
 1869|  2.95M|        !uint64_t(fmt & chars_format::fixed)) {
  ------------------
  |  Branch (1869:9): [True: 0, False: 2.95M]
  ------------------
 1870|      0|      return report_parse_error<UC>(p, parse_error::missing_exponential_part);
 1871|      0|    }
 1872|  3.15M|  }
 1873|  3.18M|  answer.lastmatch = p;
 1874|  3.18M|  answer.valid = true;
 1875|       |
 1876|       |  // If we frequently had to deal with long strings of digits,
 1877|       |  // we could extend our code by using a 128-bit integer instead
 1878|       |  // of a 64-bit integer. However, this is uncommon.
 1879|       |  //
 1880|       |  // We can deal with up to 19 digits.
 1881|  3.18M|  if (digit_count > 19) { // this is uncommon
  ------------------
  |  Branch (1881:7): [True: 64.2k, False: 3.11M]
  ------------------
 1882|       |    // It is possible that the integer had an overflow.
 1883|       |    // We have to handle the case where we have 0.0000somenumber.
 1884|       |    // We need to be mindful of the case where we only have zeroes...
 1885|       |    // E.g., 0.000000000...000.
 1886|  64.2k|    UC const *start = start_digits;
 1887|  13.7M|    while ((start != pend) && (*start == UC('0') || *start == decimal_point)) {
  ------------------
  |  Branch (1887:12): [True: 13.7M, False: 274]
  |  Branch (1887:32): [True: 13.6M, False: 72.4k]
  |  Branch (1887:53): [True: 8.49k, False: 63.9k]
  ------------------
 1888|  13.6M|      if (*start == UC('0')) {
  ------------------
  |  Branch (1888:11): [True: 13.6M, False: 8.49k]
  ------------------
 1889|  13.6M|        digit_count--;
 1890|  13.6M|      }
 1891|  13.6M|      start++;
 1892|  13.6M|    }
 1893|       |
 1894|  64.2k|    if (digit_count > 19) {
  ------------------
  |  Branch (1894:9): [True: 60.8k, False: 3.38k]
  ------------------
 1895|  60.8k|      answer.too_many_digits = true;
 1896|       |      // Let us start again, this time, avoiding overflows.
 1897|       |      // We don't need to check if is_integer, since we use the
 1898|       |      // pre-tokenized spans from above.
 1899|  60.8k|      i = 0;
 1900|  60.8k|      p = answer.integer.ptr;
 1901|  60.8k|      UC const *int_end = p + answer.integer.len();
 1902|  60.8k|      uint64_t const minimal_nineteen_digit_integer{1000000000000000000};
 1903|  1.28M|      while ((i < minimal_nineteen_digit_integer) && (p != int_end)) {
  ------------------
  |  Branch (1903:14): [True: 1.23M, False: 52.5k]
  |  Branch (1903:54): [True: 1.22M, False: 8.33k]
  ------------------
 1904|  1.22M|        i = i * 10 + uint64_t(*p - UC('0'));
 1905|  1.22M|        ++p;
 1906|  1.22M|      }
 1907|  60.8k|      if (i >= minimal_nineteen_digit_integer) { // We have a big integers
  ------------------
  |  Branch (1907:11): [True: 52.5k, False: 8.33k]
  ------------------
 1908|  52.5k|        exponent = end_of_integer_part - p + exp_number;
 1909|  52.5k|      } else { // We have a value with a fractional component.
 1910|  8.33k|        p = answer.fraction.ptr;
 1911|  8.33k|        UC const *frac_end = p + answer.fraction.len();
 1912|   145k|        while ((i < minimal_nineteen_digit_integer) && (p != frac_end)) {
  ------------------
  |  Branch (1912:16): [True: 137k, False: 8.33k]
  |  Branch (1912:56): [True: 137k, False: 0]
  ------------------
 1913|   137k|          i = i * 10 + uint64_t(*p - UC('0'));
 1914|   137k|          ++p;
 1915|   137k|        }
 1916|  8.33k|        exponent = answer.fraction.ptr - p + exp_number;
 1917|  8.33k|      }
 1918|       |      // We have now corrected both exponent and i, to a truncated value
 1919|  60.8k|    }
 1920|  64.2k|  }
 1921|  3.18M|  answer.exponent = exponent;
 1922|  3.18M|  answer.mantissa = i;
 1923|  3.18M|  return answer;
 1924|  3.18M|}
_ZN3glz10fast_float6detail12parse_infnanIdcEENS0_19from_chars_result_tIT0_EEPKS4_S7_RT_NS0_12chars_formatE:
 4076|   205k|                                       T &value, chars_format fmt) noexcept {
 4077|   205k|  from_chars_result_t<UC> answer{};
 4078|   205k|  answer.ptr = first;
 4079|   205k|  answer.ec = std::errc(); // be optimistic
 4080|       |  // assume first < last, so dereference without checks;
 4081|   205k|  bool const minusSign = (*first == UC('-'));
 4082|       |  // C++17 20.19.3.(7.1) explicitly forbids '+' sign here
 4083|   205k|  if ((*first == UC('-')) ||
  ------------------
  |  Branch (4083:7): [True: 6.30k, False: 199k]
  ------------------
 4084|   199k|      (uint64_t(fmt & chars_format::allow_leading_plus) &&
  ------------------
  |  Branch (4084:8): [True: 0, False: 199k]
  ------------------
 4085|  6.30k|       (*first == UC('+')))) {
  ------------------
  |  Branch (4085:8): [True: 0, False: 0]
  ------------------
 4086|  6.30k|    ++first;
 4087|  6.30k|  }
 4088|   205k|  if (last - first >= 3) {
  ------------------
  |  Branch (4088:7): [True: 76.4k, False: 129k]
  ------------------
 4089|  76.4k|    if (fastfloat_strncasecmp(first, str_const_nan<UC>(), 3)) {
  ------------------
  |  Branch (4089:9): [True: 4.66k, False: 71.8k]
  ------------------
 4090|  4.66k|      answer.ptr = (first += 3);
 4091|  4.66k|      value = minusSign ? -std::numeric_limits<T>::quiet_NaN()
  ------------------
  |  Branch (4091:15): [True: 86, False: 4.58k]
  ------------------
 4092|  4.66k|                        : std::numeric_limits<T>::quiet_NaN();
 4093|       |      // Check for possible nan(n-char-seq-opt), C++17 20.19.3.7,
 4094|       |      // C11 7.20.1.3.3. At least MSVC produces nan(ind) and nan(snan).
 4095|  4.66k|      if (first != last && *first == UC('(')) {
  ------------------
  |  Branch (4095:11): [True: 4.16k, False: 498]
  |  Branch (4095:28): [True: 3.72k, False: 446]
  ------------------
 4096|  11.3k|        for (UC const *ptr = first + 1; ptr != last; ++ptr) {
  ------------------
  |  Branch (4096:41): [True: 9.75k, False: 1.64k]
  ------------------
 4097|  9.75k|          if (*ptr == UC(')')) {
  ------------------
  |  Branch (4097:15): [True: 284, False: 9.46k]
  ------------------
 4098|    284|            answer.ptr = ptr + 1; // valid nan(n-char-seq-opt)
 4099|    284|            break;
 4100|  9.46k|          } else if (!((UC('a') <= *ptr && *ptr <= UC('z')) ||
  ------------------
  |  Branch (4100:25): [True: 540, False: 8.92k]
  |  Branch (4100:44): [True: 350, False: 190]
  ------------------
 4101|  9.11k|                       (UC('A') <= *ptr && *ptr <= UC('Z')) ||
  ------------------
  |  Branch (4101:25): [True: 7.11k, False: 2.00k]
  |  Branch (4101:44): [True: 6.91k, False: 200]
  ------------------
 4102|  2.20k|                       (UC('0') <= *ptr && *ptr <= UC('9')) || *ptr == UC('_')))
  ------------------
  |  Branch (4102:25): [True: 1.65k, False: 558]
  |  Branch (4102:44): [True: 410, False: 1.24k]
  |  Branch (4102:64): [True: 0, False: 1.79k]
  ------------------
 4103|  1.79k|            break; // forbidden char, not nan(n-char-seq-opt)
 4104|  9.75k|        }
 4105|  3.72k|      }
 4106|  4.66k|      return answer;
 4107|  4.66k|    }
 4108|  71.8k|    if (fastfloat_strncasecmp(first, str_const_inf<UC>(), 3)) {
  ------------------
  |  Branch (4108:9): [True: 4.64k, False: 67.1k]
  ------------------
 4109|  4.64k|      if ((last - first >= 8) &&
  ------------------
  |  Branch (4109:11): [True: 3.60k, False: 1.04k]
  ------------------
 4110|  3.60k|          fastfloat_strncasecmp(first + 3, str_const_inf<UC>() + 3, 5)) {
  ------------------
  |  Branch (4110:11): [True: 254, False: 3.35k]
  ------------------
 4111|    254|        answer.ptr = first + 8;
 4112|  4.39k|      } else {
 4113|  4.39k|        answer.ptr = first + 3;
 4114|  4.39k|      }
 4115|  4.64k|      value = minusSign ? -std::numeric_limits<T>::infinity()
  ------------------
  |  Branch (4115:15): [True: 256, False: 4.39k]
  ------------------
 4116|  4.64k|                        : std::numeric_limits<T>::infinity();
 4117|  4.64k|      return answer;
 4118|  4.64k|    }
 4119|  71.8k|  }
 4120|   196k|  answer.ec = std::errc::invalid_argument;
 4121|   196k|  return answer;
 4122|   205k|}
_ZN3glz10fast_float21fastfloat_strncasecmpIcEEbPKT_S4_m:
  417|   151k|                      size_t length) {
  418|   192k|  for (size_t i = 0; i < length; ++i) {
  ------------------
  |  Branch (418:22): [True: 182k, False: 9.56k]
  ------------------
  419|   182k|    UC const actual = actual_mixedcase[i];
  420|   182k|    if ((actual < 256 ? actual | 32 : actual) != expected_lowercase[i]) {
  ------------------
  |  Branch (420:9): [True: 142k, False: 40.5k]
  |  Branch (420:10): [True: 182k, False: 0]
  ------------------
  421|   142k|      return false;
  422|   142k|    }
  423|   182k|  }
  424|  9.56k|  return true;
  425|   151k|}
_ZN3glz10fast_float13str_const_nanIcEEPKT_v:
 1186|  76.4k|template <> constexpr char const *str_const_nan<char>() { return "nan"; }
_ZN3glz10fast_float13str_const_infIcEEPKT_v:
 1206|  75.4k|template <> constexpr char const *str_const_inf<char>() { return "infinity"; }
_ZN3glz10fast_float19from_chars_advancedIdcEENS0_19from_chars_result_tIT0_EERNS0_22parsed_number_string_tIS3_EERT_:
 4249|  2.97M|from_chars_advanced(parsed_number_string_t<UC> &pns, T &value) noexcept {
 4250|       |
 4251|  2.97M|  static_assert(is_supported_float_type<T>::value,
 4252|  2.97M|                "only some floating-point types are supported");
 4253|  2.97M|  static_assert(is_supported_char_type<UC>::value,
 4254|  2.97M|                "only char, wchar_t, char16_t and char32_t are supported");
 4255|       |
 4256|  2.97M|  from_chars_result_t<UC> answer;
 4257|       |
 4258|  2.97M|  answer.ec = std::errc(); // be optimistic
 4259|  2.97M|  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|  2.97M|  if (binary_format<T>::min_exponent_fast_path() <= pns.exponent &&
  ------------------
  |  Branch (4265:7): [True: 2.97M, False: 8.94k]
  ------------------
 4266|  2.97M|      pns.exponent <= binary_format<T>::max_exponent_fast_path() &&
  ------------------
  |  Branch (4266:7): [True: 2.95M, False: 18.7k]
  ------------------
 4267|  2.95M|      !pns.too_many_digits) {
  ------------------
  |  Branch (4267:7): [True: 2.91M, False: 38.9k]
  ------------------
 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|  2.91M|    if (!cpp20_and_in_constexpr() && detail::rounds_to_nearest()) {
  ------------------
  |  Branch (4275:9): [True: 2.91M, Folded]
  |  Branch (4275:38): [True: 2.91M, False: 0]
  ------------------
 4276|       |      // We have that fegetround() == FE_TONEAREST.
 4277|       |      // Next is Clinger's fast path.
 4278|  2.91M|      if (pns.mantissa <= binary_format<T>::max_mantissa_fast_path()) {
  ------------------
  |  Branch (4278:11): [True: 2.89M, False: 14.5k]
  ------------------
 4279|  2.89M|        value = T(pns.mantissa);
 4280|  2.89M|        if (pns.exponent < 0) {
  ------------------
  |  Branch (4280:13): [True: 36.6k, False: 2.86M]
  ------------------
 4281|  36.6k|          value = value / binary_format<T>::exact_power_of_ten(-pns.exponent);
 4282|  2.86M|        } else {
 4283|  2.86M|          value = value * binary_format<T>::exact_power_of_ten(pns.exponent);
 4284|  2.86M|        }
 4285|  2.89M|        if (pns.negative) {
  ------------------
  |  Branch (4285:13): [True: 17.7k, False: 2.88M]
  ------------------
 4286|  17.7k|          value = -value;
 4287|  17.7k|        }
 4288|  2.89M|        return answer;
 4289|  2.89M|      }
 4290|  2.91M|    } 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|  2.91M|  }
 4313|  81.2k|  adjusted_mantissa am =
 4314|  81.2k|      compute_float<binary_format<T>>(pns.exponent, pns.mantissa);
 4315|  81.2k|  if (pns.too_many_digits && am.power2 >= 0) {
  ------------------
  |  Branch (4315:7): [True: 60.8k, False: 20.3k]
  |  Branch (4315:30): [True: 60.8k, False: 0]
  ------------------
 4316|  60.8k|    if (am != compute_float<binary_format<T>>(pns.exponent, pns.mantissa + 1)) {
  ------------------
  |  Branch (4316:9): [True: 11.7k, False: 49.1k]
  ------------------
 4317|  11.7k|      am = compute_error<binary_format<T>>(pns.exponent, pns.mantissa);
 4318|  11.7k|    }
 4319|  60.8k|  }
 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|  81.2k|  if (am.power2 < 0) {
  ------------------
  |  Branch (4323:7): [True: 11.7k, False: 69.4k]
  ------------------
 4324|  11.7k|    am = digit_comp<T>(pns, am);
 4325|  11.7k|  }
 4326|  81.2k|  to_float(pns.negative, am, value);
 4327|       |  // Test for over/underflow.
 4328|  81.2k|  if ((pns.mantissa != 0 && am.mantissa == 0 && am.power2 == 0) ||
  ------------------
  |  Branch (4328:8): [True: 80.2k, False: 988]
  |  Branch (4328:29): [True: 7.09k, False: 73.1k]
  |  Branch (4328:49): [True: 1.47k, False: 5.61k]
  ------------------
 4329|  79.7k|      am.power2 == binary_format<T>::infinite_power()) {
  ------------------
  |  Branch (4329:7): [True: 1.77k, False: 77.9k]
  ------------------
 4330|  3.25k|    answer.ec = std::errc::result_out_of_range;
 4331|  3.25k|  }
 4332|  81.2k|  return answer;
 4333|  2.97M|}
_ZN3glz10fast_float13binary_formatIdE22min_exponent_fast_pathEv:
  695|  2.97M|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|  2.97M|  return -22;
  700|  2.97M|#endif
  701|  2.97M|}
_ZN3glz10fast_float13binary_formatIdE22max_exponent_fast_pathEv:
  767|  2.97M|inline constexpr int binary_format<double>::max_exponent_fast_path() {
  768|  2.97M|  return 22;
  769|  2.97M|}
_ZN3glz10fast_float6detail17rounds_to_nearestEv:
 4129|  2.91M|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|  2.91M|  static float volatile fmin = (std::numeric_limits<float>::min)();
 4151|  2.91M|  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|  2.91M|#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|  2.91M|  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|  2.91M|}
_ZN3glz10fast_float13binary_formatIdE22max_mantissa_fast_pathEv:
  777|  2.91M|inline constexpr uint64_t binary_format<double>::max_mantissa_fast_path() {
  778|  2.91M|  return uint64_t(2) << mantissa_explicit_bits();
  779|  2.91M|}
_ZN3glz10fast_float13binary_formatIdE22mantissa_explicit_bitsEv:
  713|  3.49M|inline constexpr int binary_format<double>::mantissa_explicit_bits() {
  714|  3.49M|  return 52;
  715|  3.49M|}
_ZN3glz10fast_float13binary_formatIdE18exact_power_of_tenEl:
 1057|  2.89M|binary_format<double>::exact_power_of_ten(int64_t power) {
 1058|       |  // Work around clang bug https://godbolt.org/z/zedh7rrhc
 1059|  2.89M|  return (void)powers_of_ten[0], powers_of_ten[power];
 1060|  2.89M|}
_ZN3glz10fast_float13compute_floatINS0_13binary_formatIdEEEENS0_17adjusted_mantissaElm:
 2852|   142k|compute_float(int64_t q, uint64_t w) noexcept {
 2853|   142k|  adjusted_mantissa answer;
 2854|   142k|  if ((w == 0) || (q < binary::smallest_power_of_ten())) {
  ------------------
  |  Branch (2854:7): [True: 988, False: 141k]
  |  Branch (2854:19): [True: 1.51k, False: 139k]
  ------------------
 2855|  2.50k|    answer.power2 = 0;
 2856|  2.50k|    answer.mantissa = 0;
 2857|       |    // result should be zero
 2858|  2.50k|    return answer;
 2859|  2.50k|  }
 2860|   139k|  if (q > binary::largest_power_of_ten()) {
  ------------------
  |  Branch (2860:7): [True: 1.89k, False: 137k]
  ------------------
 2861|       |    // we want to get infinity:
 2862|  1.89k|    answer.power2 = binary::infinite_power();
 2863|  1.89k|    answer.mantissa = 0;
 2864|  1.89k|    return answer;
 2865|  1.89k|  }
 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|   137k|  int lz = leading_zeroes(w);
 2871|   137k|  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|   137k|  value128 product =
 2880|   137k|      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|   137k|  int upperbit = int(product.high >> 63);
 2891|   137k|  int shift = upperbit + 64 - binary::mantissa_explicit_bits() - 3;
 2892|       |
 2893|   137k|  answer.mantissa = product.high >> shift;
 2894|       |
 2895|   137k|  answer.power2 = int32_t(detail::power(int32_t(q)) + upperbit - lz -
 2896|   137k|                          binary::minimum_exponent());
 2897|   137k|  if (answer.power2 <= 0) { // we have a subnormal?
  ------------------
  |  Branch (2897:7): [True: 11.0k, False: 126k]
  ------------------
 2898|       |    // Here have that answer.power2 <= 0 so -answer.power2 >= 0
 2899|  11.0k|    if (-answer.power2 + 1 >=
  ------------------
  |  Branch (2899:9): [True: 500, False: 10.5k]
  ------------------
 2900|  11.0k|        64) { // if we have more than 64 bits below the minimum exponent, you
 2901|       |              // have a zero for sure.
 2902|    500|      answer.power2 = 0;
 2903|    500|      answer.mantissa = 0;
 2904|       |      // result should be zero
 2905|    500|      return answer;
 2906|    500|    }
 2907|       |    // next line is safe because -answer.power2 + 1 < 64
 2908|  10.5k|    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|  10.5k|    answer.mantissa += (answer.mantissa & 1); // round up
 2913|  10.5k|    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|  10.5k|    answer.power2 =
 2922|  10.5k|        (answer.mantissa < (uint64_t(1) << binary::mantissa_explicit_bits()))
  ------------------
  |  Branch (2922:9): [True: 10.4k, False: 4]
  ------------------
 2923|  10.5k|            ? 0
 2924|  10.5k|            : 1;
 2925|  10.5k|    return answer;
 2926|  11.0k|  }
 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|   126k|  if ((product.low <= 1) && (q >= binary::min_exponent_round_to_even()) &&
  ------------------
  |  Branch (2931:7): [True: 67.7k, False: 58.9k]
  |  Branch (2931:29): [True: 66.8k, False: 876]
  ------------------
 2932|  66.8k|      (q <= binary::max_exponent_round_to_even()) &&
  ------------------
  |  Branch (2932:7): [True: 65.6k, False: 1.26k]
  ------------------
 2933|  65.6k|      ((answer.mantissa & 3) == 1)) { // we may fall between two floats!
  ------------------
  |  Branch (2933:7): [True: 3.66k, False: 61.9k]
  ------------------
 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|  3.66k|    if ((answer.mantissa << shift) == product.high) {
  ------------------
  |  Branch (2939:9): [True: 2.13k, False: 1.52k]
  ------------------
 2940|  2.13k|      answer.mantissa &= ~uint64_t(1); // flip it so that we do not round up
 2941|  2.13k|    }
 2942|  3.66k|  }
 2943|       |
 2944|   126k|  answer.mantissa += (answer.mantissa & 1); // round up
 2945|   126k|  answer.mantissa >>= 1;
 2946|   126k|  if (answer.mantissa >= (uint64_t(2) << binary::mantissa_explicit_bits())) {
  ------------------
  |  Branch (2946:7): [True: 5.29k, False: 121k]
  ------------------
 2947|  5.29k|    answer.mantissa = (uint64_t(1) << binary::mantissa_explicit_bits());
 2948|  5.29k|    answer.power2++; // undo previous addition
 2949|  5.29k|  }
 2950|       |
 2951|   126k|  answer.mantissa &= ~(uint64_t(1) << binary::mantissa_explicit_bits());
 2952|   126k|  if (answer.power2 >= binary::infinite_power()) { // infinity
  ------------------
  |  Branch (2952:7): [True: 990, False: 125k]
  ------------------
 2953|    990|    answer.power2 = binary::infinite_power();
 2954|    990|    answer.mantissa = 0;
 2955|    990|  }
 2956|   126k|  return answer;
 2957|   137k|}
_ZN3glz10fast_float17adjusted_mantissaC2Ev:
  568|   165k|  adjusted_mantissa() = default;
_ZN3glz10fast_float13binary_formatIdE21smallest_power_of_tenEv:
 1077|   141k|inline constexpr int binary_format<double>::smallest_power_of_ten() {
 1078|   141k|  return -342;
 1079|   141k|}
_ZN3glz10fast_float13binary_formatIdE20largest_power_of_tenEv:
 1068|   139k|template <> inline constexpr int binary_format<double>::largest_power_of_ten() {
 1069|   139k|  return 308;
 1070|   139k|}
_ZN3glz10fast_float14leading_zeroesEm:
  488|   157k|leading_zeroes(uint64_t input_num) {
  489|   157k|  assert(input_num > 0);
  ------------------
  |  Branch (489:3): [True: 157k, False: 0]
  ------------------
  490|   157k|  if (cpp20_and_in_constexpr()) {
  ------------------
  |  Branch (490:7): [Folded, False: 157k]
  ------------------
  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|   157k|  return __builtin_clzll(input_num);
  505|   157k|#endif
  506|   157k|}
_ZN3glz10fast_float29compute_product_approximationILi55EEENS0_8value128Elm:
 2771|   149k|compute_product_approximation(int64_t q, uint64_t w) {
 2772|   149k|  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|   149k|  value128 firstproduct =
 2777|   149k|      full_multiplication(w, powers::power_of_five_128[index]);
 2778|   149k|  static_assert((bit_precision >= 0) && (bit_precision <= 64),
 2779|   149k|                " precision should  be in (0,64]");
 2780|   149k|  constexpr uint64_t precision_mask =
 2781|   149k|      (bit_precision < 64) ? (uint64_t(0xFFFFFFFFFFFFFFFF) >> bit_precision)
  ------------------
  |  Branch (2781:7): [True: 0, Folded]
  ------------------
 2782|   149k|                           : uint64_t(0xFFFFFFFFFFFFFFFF);
 2783|   149k|  if ((firstproduct.high & precision_mask) ==
  ------------------
  |  Branch (2783:7): [True: 15.9k, False: 133k]
  ------------------
 2784|   149k|      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|  15.9k|    value128 secondproduct =
 2789|  15.9k|        full_multiplication(w, powers::power_of_five_128[index + 1]);
 2790|  15.9k|    firstproduct.low += secondproduct.high;
 2791|  15.9k|    if (secondproduct.high > firstproduct.low) {
  ------------------
  |  Branch (2791:9): [True: 4.13k, False: 11.8k]
  ------------------
 2792|  4.13k|      firstproduct.high++;
 2793|  4.13k|    }
 2794|  15.9k|  }
 2795|   149k|  return firstproduct;
 2796|   149k|}
_ZN3glz10fast_float19full_multiplicationEmm:
  540|   165k|full_multiplication(uint64_t a, uint64_t b) {
  541|   165k|  if (cpp20_and_in_constexpr()) {
  ------------------
  |  Branch (541:7): [Folded, False: 165k]
  ------------------
  542|      0|    value128 answer;
  543|      0|    answer.low = umul128_generic(a, b, &answer.high);
  544|      0|    return answer;
  545|      0|  }
  546|   165k|  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|   165k|  answer.low = uint64_t(r);
  558|   165k|  answer.high = uint64_t(r >> 64);
  559|       |#else
  560|       |  answer.low = umul128_generic(a, b, &answer.high);
  561|       |#endif
  562|   165k|  return answer;
  563|   165k|}
_ZN3glz10fast_float8value128C2Ev:
  454|   165k|  constexpr value128() : low(0), high(0) {}
_ZN3glz10fast_float6detail5powerEi:
 2814|   149k|constexpr fastfloat_really_inline int32_t power(int32_t q) noexcept {
 2815|   149k|  return (((152170 + 65536) * q) >> 16) + 63;
 2816|   149k|}
_ZN3glz10fast_float13binary_formatIdE16minimum_exponentEv:
  742|   161k|template <> inline constexpr int binary_format<double>::minimum_exponent() {
  743|   161k|  return -1023;
  744|   161k|}
_ZN3glz10fast_float13binary_formatIdE26min_exponent_round_to_evenEv:
  733|  67.7k|inline constexpr int binary_format<double>::min_exponent_round_to_even() {
  734|  67.7k|  return -4;
  735|  67.7k|}
_ZN3glz10fast_float13binary_formatIdE26max_exponent_round_to_evenEv:
  723|  66.8k|inline constexpr int binary_format<double>::max_exponent_round_to_even() {
  724|  66.8k|  return 23;
  725|  66.8k|}
_ZNK3glz10fast_float17adjusted_mantissaneERKS1_:
  574|  60.8k|  constexpr bool operator!=(adjusted_mantissa const &o) const {
  575|  60.8k|    return mantissa != o.mantissa || power2 != o.power2;
  ------------------
  |  Branch (575:12): [True: 11.7k, False: 49.1k]
  |  Branch (575:38): [True: 0, False: 49.1k]
  ------------------
  576|  60.8k|  }
_ZN3glz10fast_float13compute_errorINS0_13binary_formatIdEEEENS0_17adjusted_mantissaElm:
 2837|  11.7k|compute_error(int64_t q, uint64_t w) noexcept {
 2838|  11.7k|  int lz = leading_zeroes(w);
 2839|  11.7k|  w <<= lz;
 2840|  11.7k|  value128 product =
 2841|  11.7k|      compute_product_approximation<binary::mantissa_explicit_bits() + 3>(q, w);
 2842|  11.7k|  return compute_error_scaled<binary>(q, product.high, lz);
 2843|  11.7k|}
_ZN3glz10fast_float20compute_error_scaledINS0_13binary_formatIdEEEENS0_17adjusted_mantissaElmi:
 2823|  11.7k|compute_error_scaled(int64_t q, uint64_t w, int lz) noexcept {
 2824|  11.7k|  int hilz = int(w >> 63) ^ 1;
 2825|  11.7k|  adjusted_mantissa answer;
 2826|  11.7k|  answer.mantissa = w << hilz;
 2827|  11.7k|  int bias = binary::mantissa_explicit_bits() - binary::minimum_exponent();
 2828|  11.7k|  answer.power2 = int32_t(detail::power(int32_t(q)) + bias - hilz - lz - 62 +
 2829|  11.7k|                          invalid_am_bias);
 2830|  11.7k|  return answer;
 2831|  11.7k|}
_ZN3glz10fast_float10digit_compIdcEENS0_17adjusted_mantissaERNS0_22parsed_number_string_tIT0_EES2_:
 4034|  11.7k|digit_comp(parsed_number_string_t<UC> &num, adjusted_mantissa am) noexcept {
 4035|       |  // remove the invalid exponent bias
 4036|  11.7k|  am.power2 -= invalid_am_bias;
 4037|       |
 4038|  11.7k|  int32_t sci_exp = scientific_exponent(num);
 4039|  11.7k|  size_t max_digits = binary_format<T>::max_digits();
 4040|  11.7k|  size_t digits = 0;
 4041|  11.7k|  bigint bigmant;
 4042|  11.7k|  parse_mantissa(bigmant, num, max_digits, digits);
 4043|       |  // can't underflow, since digits is at most max_digits.
 4044|  11.7k|  int32_t exponent = sci_exp + 1 - int32_t(digits);
 4045|  11.7k|  if (exponent >= 0) {
  ------------------
  |  Branch (4045:7): [True: 4.16k, False: 7.58k]
  ------------------
 4046|  4.16k|    return positive_digit_comp<T>(bigmant, exponent);
 4047|  7.58k|  } else {
 4048|  7.58k|    return negative_digit_comp<T>(bigmant, am, exponent);
 4049|  7.58k|  }
 4050|  11.7k|}
_ZN3glz10fast_float19scientific_exponentIcEEiRNS0_22parsed_number_string_tIT_EE:
 3640|  11.7k|scientific_exponent(parsed_number_string_t<UC> &num) noexcept {
 3641|  11.7k|  uint64_t mantissa = num.mantissa;
 3642|  11.7k|  int32_t exponent = int32_t(num.exponent);
 3643|  58.7k|  while (mantissa >= 10000) {
  ------------------
  |  Branch (3643:10): [True: 47.0k, False: 11.7k]
  ------------------
 3644|  47.0k|    mantissa /= 10000;
 3645|  47.0k|    exponent += 4;
 3646|  47.0k|  }
 3647|  23.5k|  while (mantissa >= 100) {
  ------------------
  |  Branch (3647:10): [True: 11.7k, False: 11.7k]
  ------------------
 3648|  11.7k|    mantissa /= 100;
 3649|  11.7k|    exponent += 2;
 3650|  11.7k|  }
 3651|  11.7k|  while (mantissa >= 10) {
  ------------------
  |  Branch (3651:10): [True: 0, False: 11.7k]
  ------------------
 3652|      0|    mantissa /= 10;
 3653|      0|    exponent += 1;
 3654|      0|  }
 3655|  11.7k|  return exponent;
 3656|  11.7k|}
_ZN3glz10fast_float13binary_formatIdE10max_digitsEv:
 1085|  11.7k|template <> inline constexpr size_t binary_format<double>::max_digits() {
 1086|  11.7k|  return 769;
 1087|  11.7k|}
_ZN3glz10fast_float6bigintC2Ev:
 3399|  11.7k|  GLZ_FASTFLOAT_CONSTEXPR20 bigint() : vec() {}
_ZN3glz10fast_float8stackvecILt62EEC2Ev:
 3006|  72.8k|  stackvec() = default;
_ZN3glz10fast_float14parse_mantissaIcEEvRNS0_6bigintERNS0_22parsed_number_string_tIT_EEmRm:
 3859|  11.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|  11.7k|  size_t counter = 0;
 3864|  11.7k|  digits = 0;
 3865|  11.7k|  limb value = 0;
 3866|  11.7k|#ifdef GLZ_FASTFLOAT_64BIT_LIMB
 3867|  11.7k|  size_t step = 19;
 3868|       |#else
 3869|       |  size_t step = 9;
 3870|       |#endif
 3871|       |
 3872|       |  // process all integer digits.
 3873|  11.7k|  UC const *p = num.integer.ptr;
 3874|  11.7k|  UC const *pend = p + num.integer.len();
 3875|  11.7k|  skip_zeros(p, pend);
 3876|       |  // process all digits, in increments of step per loop
 3877|  30.3k|  while (p != pend) {
  ------------------
  |  Branch (3877:10): [True: 18.5k, False: 11.7k]
  ------------------
 3878|  37.8k|    while ((std::distance(p, pend) >= 8) && (step - counter >= 8) &&
  ------------------
  |  Branch (3878:12): [True: 24.2k, False: 13.5k]
  |  Branch (3878:45): [True: 19.2k, False: 5.01k]
  ------------------
 3879|  19.2k|           (max_digits - digits >= 8)) {
  ------------------
  |  Branch (3879:12): [True: 19.2k, False: 0]
  ------------------
 3880|  19.2k|      parse_eight_digits(p, value, counter, digits);
 3881|  19.2k|    }
 3882|  69.0k|    while (counter < step && p != pend && digits < max_digits) {
  ------------------
  |  Branch (3882:12): [True: 61.1k, False: 7.91k]
  |  Branch (3882:30): [True: 50.4k, False: 10.6k]
  |  Branch (3882:43): [True: 50.4k, False: 0]
  ------------------
 3883|  50.4k|      parse_one_digit(p, value, counter, digits);
 3884|  50.4k|    }
 3885|  18.5k|    if (digits == max_digits) {
  ------------------
  |  Branch (3885:9): [True: 0, False: 18.5k]
  ------------------
 3886|       |      // add the temporary value, then check if we've truncated any digits
 3887|      0|      add_native(result, limb(powers_of_ten_uint64[counter]), value);
 3888|      0|      bool truncated = is_truncated(p, pend);
 3889|      0|      if (num.fraction.ptr != nullptr) {
  ------------------
  |  Branch (3889:11): [True: 0, False: 0]
  ------------------
 3890|      0|        truncated |= is_truncated(num.fraction);
 3891|      0|      }
 3892|      0|      if (truncated) {
  ------------------
  |  Branch (3892:11): [True: 0, False: 0]
  ------------------
 3893|      0|        round_up_bigint(result, digits);
 3894|      0|      }
 3895|      0|      return;
 3896|  18.5k|    } else {
 3897|  18.5k|      add_native(result, limb(powers_of_ten_uint64[counter]), value);
 3898|  18.5k|      counter = 0;
 3899|  18.5k|      value = 0;
 3900|  18.5k|    }
 3901|  18.5k|  }
 3902|       |
 3903|       |  // add our fraction digits, if they're available.
 3904|  11.7k|  if (num.fraction.ptr != nullptr) {
  ------------------
  |  Branch (3904:7): [True: 8.11k, False: 3.64k]
  ------------------
 3905|  8.11k|    p = num.fraction.ptr;
 3906|  8.11k|    pend = p + num.fraction.len();
 3907|  8.11k|    if (digits == 0) {
  ------------------
  |  Branch (3907:9): [True: 1.04k, False: 7.06k]
  ------------------
 3908|  1.04k|      skip_zeros(p, pend);
 3909|  1.04k|    }
 3910|       |    // process all digits, in increments of step per loop
 3911|   104k|    while (p != pend) {
  ------------------
  |  Branch (3911:12): [True: 98.3k, False: 6.13k]
  ------------------
 3912|   285k|      while ((std::distance(p, pend) >= 8) && (step - counter >= 8) &&
  ------------------
  |  Branch (3912:14): [True: 278k, False: 7.64k]
  |  Branch (3912:47): [True: 188k, False: 89.6k]
  ------------------
 3913|   188k|             (max_digits - digits >= 8)) {
  ------------------
  |  Branch (3913:14): [True: 187k, False: 1.04k]
  ------------------
 3914|   187k|        parse_eight_digits(p, value, counter, digits);
 3915|   187k|      }
 3916|   389k|      while (counter < step && p != pend && digits < max_digits) {
  ------------------
  |  Branch (3916:14): [True: 298k, False: 91.1k]
  |  Branch (3916:32): [True: 292k, False: 5.19k]
  |  Branch (3916:45): [True: 290k, False: 1.93k]
  ------------------
 3917|   290k|        parse_one_digit(p, value, counter, digits);
 3918|   290k|      }
 3919|  98.3k|      if (digits == max_digits) {
  ------------------
  |  Branch (3919:11): [True: 1.97k, False: 96.3k]
  ------------------
 3920|       |        // add the temporary value, then check if we've truncated any digits
 3921|  1.97k|        add_native(result, limb(powers_of_ten_uint64[counter]), value);
 3922|  1.97k|        bool truncated = is_truncated(p, pend);
 3923|  1.97k|        if (truncated) {
  ------------------
  |  Branch (3923:13): [True: 1.25k, False: 720]
  ------------------
 3924|  1.25k|          round_up_bigint(result, digits);
 3925|  1.25k|        }
 3926|  1.97k|        return;
 3927|  96.3k|      } else {
 3928|  96.3k|        add_native(result, limb(powers_of_ten_uint64[counter]), value);
 3929|  96.3k|        counter = 0;
 3930|  96.3k|        value = 0;
 3931|  96.3k|      }
 3932|  98.3k|    }
 3933|  8.11k|  }
 3934|       |
 3935|  9.78k|  if (counter != 0) {
  ------------------
  |  Branch (3935:7): [True: 0, False: 9.78k]
  ------------------
 3936|      0|    add_native(result, limb(powers_of_ten_uint64[counter]), value);
 3937|      0|  }
 3938|  9.78k|}
_ZN3glz10fast_float10skip_zerosIcEEvRPKT_S4_:
 3773|  12.7k|skip_zeros(UC const *&first, UC const *last) noexcept {
 3774|  12.7k|  uint64_t val;
 3775|  17.1k|  while (!cpp20_and_in_constexpr() &&
  ------------------
  |  Branch (3775:10): [True: 17.1k, Folded]
  ------------------
 3776|  17.1k|         std::distance(first, last) >= int_cmp_len<UC>()) {
  ------------------
  |  Branch (3776:10): [True: 13.0k, False: 4.04k]
  ------------------
 3777|  13.0k|    ::memcpy(&val, first, sizeof(uint64_t));
 3778|  13.0k|    if (val != int_cmp_zeros<UC>()) {
  ------------------
  |  Branch (3778:9): [True: 8.75k, False: 4.33k]
  ------------------
 3779|  8.75k|      break;
 3780|  8.75k|    }
 3781|  4.33k|    first += int_cmp_len<UC>();
 3782|  4.33k|  }
 3783|  20.8k|  while (first != last) {
  ------------------
  |  Branch (3783:10): [True: 19.7k, False: 1.04k]
  ------------------
 3784|  19.7k|    if (*first != UC('0')) {
  ------------------
  |  Branch (3784:9): [True: 11.7k, False: 8.03k]
  ------------------
 3785|  11.7k|      break;
 3786|  11.7k|    }
 3787|  8.03k|    first++;
 3788|  8.03k|  }
 3789|  12.7k|}
_ZN3glz10fast_float11int_cmp_lenIcEEiv:
 1180|   218k|template <typename UC> constexpr int int_cmp_len() {
 1181|   218k|  return sizeof(uint64_t) / sizeof(UC);
 1182|   218k|}
_ZN3glz10fast_float13int_cmp_zerosIcEEmv:
 1170|   111k|template <typename UC> constexpr uint64_t int_cmp_zeros() {
 1171|   111k|  static_assert((sizeof(UC) == 1) || (sizeof(UC) == 2) || (sizeof(UC) == 4),
 1172|   111k|                "Unsupported character size");
 1173|   111k|  return (sizeof(UC) == 1) ? 0x3030303030303030
  ------------------
  |  Branch (1173:10): [True: 111k, Folded]
  ------------------
 1174|   111k|         : (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|   111k|}
_ZN3glz10fast_float18parse_eight_digitsIcEEvRPKT_RmS6_S6_:
 3824|   206k|                   size_t &count) noexcept {
 3825|   206k|  value = value * 100000000 + parse_eight_digits_unrolled(p);
 3826|   206k|  p += 8;
 3827|   206k|  counter += 8;
 3828|   206k|  count += 8;
 3829|   206k|}
_ZN3glz10fast_float27parse_eight_digits_unrolledIcEEjPKT_:
 1588|   206k|parse_eight_digits_unrolled(UC const *chars) noexcept {
 1589|   206k|  if (cpp20_and_in_constexpr() || !has_simd_opt<UC>()) {
  ------------------
  |  Branch (1589:7): [Folded, False: 0]
  |  Branch (1589:35): [True: 0, Folded]
  ------------------
 1590|   206k|    return parse_eight_digits_unrolled(read8_to_u64(chars)); // truncation okay
 1591|   206k|  }
 1592|      0|  return parse_eight_digits_unrolled(simd_read8_to_u64(chars));
 1593|   206k|}
_ZN3glz10fast_float15parse_one_digitIcEEvRPKT_RmS6_S6_:
 3834|   341k|                size_t &count) noexcept {
 3835|   341k|  value = value * 10 + limb(*p - UC('0'));
 3836|   341k|  p++;
 3837|   341k|  counter++;
 3838|   341k|  count++;
 3839|   341k|}
_ZN3glz10fast_float10add_nativeERNS0_6bigintEmm:
 3842|   118k|add_native(bigint &big, limb power, limb value) noexcept {
 3843|   118k|  big.mul(power);
 3844|   118k|  big.add(value);
 3845|   118k|}
_ZN3glz10fast_float6bigint3mulEm:
 3552|   118k|  GLZ_FASTFLOAT_CONSTEXPR20 bool mul(limb y) noexcept { return small_mul(vec, y); }
_ZN3glz10fast_float9small_mulILt62EEEbRNS0_8stackvecIXT_EEEm:
 3249|   205k|                                            limb y) noexcept {
 3250|   205k|  limb carry = 0;
 3251|  2.88M|  for (size_t index = 0; index < vec.len(); index++) {
  ------------------
  |  Branch (3251:26): [True: 2.67M, False: 205k]
  ------------------
 3252|  2.67M|    vec[index] = scalar_mul(vec[index], y, carry);
 3253|  2.67M|  }
 3254|   205k|  if (carry != 0) {
  ------------------
  |  Branch (3254:7): [True: 179k, False: 26.5k]
  ------------------
 3255|   179k|    GLZ_FASTFLOAT_TRY(vec.try_push(carry));
  ------------------
  |  |  354|   179k|  {                                                                            \
  |  |  355|   179k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 179k]
  |  |  ------------------
  |  |  356|   179k|      return false;                                                            \
  |  |  357|   179k|  }
  ------------------
 3256|   179k|  }
 3257|   205k|  return true;
 3258|   205k|}
_ZNK3glz10fast_float8stackvecILt62EE3lenEv:
 3039|  3.83M|  constexpr size_t len() const noexcept { return length; }
_ZN3glz10fast_float10scalar_mulEmmRm:
 3196|  2.67M|scalar_mul(limb x, limb y, limb &carry) noexcept {
 3197|  2.67M|#ifdef GLZ_FASTFLOAT_64BIT_LIMB
 3198|  2.67M|#if defined(__SIZEOF_INT128__)
 3199|       |  // GCC and clang both define it as an extension.
 3200|  2.67M|  __uint128_t z = __uint128_t(x) * __uint128_t(y) + __uint128_t(carry);
 3201|  2.67M|  carry = limb(z >> limb_bits);
 3202|  2.67M|  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|  2.67M|}
_ZN3glz10fast_float8stackvecILt62EEixEm:
 3017|  6.75M|  GLZ_FASTFLOAT_CONSTEXPR14 limb &operator[](size_t index) noexcept {
 3018|  6.75M|    GLZ_FASTFLOAT_DEBUG_ASSERT(index < length);
  ------------------
  |  |  349|  6.75M|  { ((void)(x)); }
  ------------------
 3019|  6.75M|    return data[index];
 3020|  6.75M|  }
_ZN3glz10fast_float8stackvecILt62EE8try_pushEm:
 3052|   193k|  GLZ_FASTFLOAT_CONSTEXPR14 bool try_push(limb value) noexcept {
 3053|   193k|    if (len() < capacity()) {
  ------------------
  |  Branch (3053:9): [True: 193k, False: 0]
  ------------------
 3054|   193k|      push_unchecked(value);
 3055|   193k|      return true;
 3056|   193k|    } else {
 3057|      0|      return false;
 3058|      0|    }
 3059|   193k|  }
_ZNK3glz10fast_float8stackvecILt62EE8capacityEv:
 3043|   318k|  constexpr size_t capacity() const noexcept { return size; }
_ZN3glz10fast_float8stackvecILt62EE14push_uncheckedEm:
 3046|   201k|  GLZ_FASTFLOAT_CONSTEXPR14 void push_unchecked(limb value) noexcept {
 3047|   201k|    data[length] = value;
 3048|   201k|    length++;
 3049|   201k|  }
_ZN3glz10fast_float6bigint3addEm:
 3554|   118k|  GLZ_FASTFLOAT_CONSTEXPR20 bool add(limb y) noexcept { return small_add(vec, y); }
_ZN3glz10fast_float9small_addILt62EEEbRNS0_8stackvecIXT_EEEm:
 3242|   118k|small_add(stackvec<size> &vec, limb y) noexcept {
 3243|   118k|  return small_add_from(vec, y, 0);
 3244|   118k|}
_ZN3glz10fast_float14small_add_fromILt62EEEbRNS0_8stackvecIXT_EEEmm:
 3224|   118k|                                                 size_t start) noexcept {
 3225|   118k|  size_t index = start;
 3226|   118k|  limb carry = y;
 3227|   118k|  bool overflow;
 3228|   198k|  while (carry != 0 && index < vec.len()) {
  ------------------
  |  Branch (3228:10): [True: 92.4k, False: 106k]
  |  Branch (3228:24): [True: 80.4k, False: 12.0k]
  ------------------
 3229|  80.4k|    vec[index] = scalar_add(vec[index], carry, overflow);
 3230|  80.4k|    carry = limb(overflow);
 3231|  80.4k|    index += 1;
 3232|  80.4k|  }
 3233|   118k|  if (carry != 0) {
  ------------------
  |  Branch (3233:7): [True: 12.0k, False: 106k]
  ------------------
 3234|  12.0k|    GLZ_FASTFLOAT_TRY(vec.try_push(carry));
  ------------------
  |  |  354|  12.0k|  {                                                                            \
  |  |  355|  12.0k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 12.0k]
  |  |  ------------------
  |  |  356|  12.0k|      return false;                                                            \
  |  |  357|  12.0k|  }
  ------------------
 3235|  12.0k|  }
 3236|   118k|  return true;
 3237|   118k|}
_ZN3glz10fast_float10scalar_addEmmRb:
 3176|   849k|scalar_add(limb x, limb y, bool &overflow) noexcept {
 3177|   849k|  limb z;
 3178|       |// gcc and clang
 3179|   849k|#if defined(__has_builtin)
 3180|   849k|#if __has_builtin(__builtin_add_overflow)
 3181|   849k|  if (!cpp20_and_in_constexpr()) {
  ------------------
  |  Branch (3181:7): [True: 849k, Folded]
  ------------------
 3182|   849k|    overflow = __builtin_add_overflow(x, y, &z);
 3183|   849k|    return z;
 3184|   849k|  }
 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|   849k|}
_ZN3glz10fast_float12is_truncatedIcEEbPKT_S4_:
 3795|  1.97k|is_truncated(UC const *first, UC const *last) noexcept {
 3796|       |  // do 8-bit optimizations, can just compare to 8 literal 0s.
 3797|  1.97k|  uint64_t val;
 3798|  99.7k|  while (!cpp20_and_in_constexpr() &&
  ------------------
  |  Branch (3798:10): [True: 99.7k, Folded]
  ------------------
 3799|  99.7k|         std::distance(first, last) >= int_cmp_len<UC>()) {
  ------------------
  |  Branch (3799:10): [True: 98.6k, False: 1.10k]
  ------------------
 3800|  98.6k|    ::memcpy(&val, first, sizeof(uint64_t));
 3801|  98.6k|    if (val != int_cmp_zeros<UC>()) {
  ------------------
  |  Branch (3801:9): [True: 868, False: 97.7k]
  ------------------
 3802|    868|      return true;
 3803|    868|    }
 3804|  97.7k|    first += int_cmp_len<UC>();
 3805|  97.7k|  }
 3806|  3.24k|  while (first != last) {
  ------------------
  |  Branch (3806:10): [True: 2.52k, False: 720]
  ------------------
 3807|  2.52k|    if (*first != UC('0')) {
  ------------------
  |  Branch (3807:9): [True: 386, False: 2.14k]
  ------------------
 3808|    386|      return true;
 3809|    386|    }
 3810|  2.14k|    ++first;
 3811|  2.14k|  }
 3812|    720|  return false;
 3813|  1.10k|}
_ZN3glz10fast_float15round_up_bigintERNS0_6bigintERm:
 3848|  1.25k|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|  1.25k|  add_native(big, 10, 1);
 3852|  1.25k|  count++;
 3853|  1.25k|}
_ZN3glz10fast_float19positive_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintEi:
 3942|  4.16k|positive_digit_comp(bigint &bigmant, int32_t exponent) noexcept {
 3943|  4.16k|  GLZ_FASTFLOAT_ASSERT(bigmant.pow10(uint32_t(exponent)));
  ------------------
  |  |  344|  4.16k|  { ((void)(x)); }
  ------------------
 3944|  4.16k|  adjusted_mantissa answer;
 3945|  4.16k|  bool truncated;
 3946|  4.16k|  answer.mantissa = bigmant.hi64(truncated);
 3947|  4.16k|  int bias = binary_format<T>::mantissa_explicit_bits() -
 3948|  4.16k|             binary_format<T>::minimum_exponent();
 3949|  4.16k|  answer.power2 = bigmant.bit_length() - 64 + bias;
 3950|       |
 3951|  4.16k|  round<T>(answer, [truncated](adjusted_mantissa &a, int32_t shift) {
 3952|  4.16k|    round_nearest_tie_even(
 3953|  4.16k|        a, shift,
 3954|  4.16k|        [truncated](bool is_odd, bool is_halfway, bool is_above) -> bool {
 3955|  4.16k|          return is_above || (is_halfway && truncated) ||
 3956|  4.16k|                 (is_odd && is_halfway);
 3957|  4.16k|        });
 3958|  4.16k|  });
 3959|       |
 3960|  4.16k|  return answer;
 3961|  4.16k|}
_ZN3glz10fast_float6bigint5pow10Ej:
 3591|  4.16k|  GLZ_FASTFLOAT_CONSTEXPR20 bool pow10(uint32_t exp) noexcept {
 3592|  4.16k|    GLZ_FASTFLOAT_TRY(pow5(exp));
  ------------------
  |  |  354|  4.16k|  {                                                                            \
  |  |  355|  4.16k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 4.16k]
  |  |  ------------------
  |  |  356|  4.16k|      return false;                                                            \
  |  |  357|  4.16k|  }
  ------------------
 3593|  4.16k|    return pow2(exp);
 3594|  4.16k|  }
_ZN3glz10fast_float6bigint4pow5Ej:
 3560|  11.7k|  GLZ_FASTFLOAT_CONSTEXPR20 bool pow5(uint32_t exp) noexcept {
 3561|       |    // multiply by a power of 5
 3562|  11.7k|    size_t large_length = sizeof(large_power_of_5) / sizeof(limb);
 3563|  11.7k|    limb_span large = limb_span(large_power_of_5, large_length);
 3564|  25.1k|    while (exp >= large_step) {
  ------------------
  |  Branch (3564:12): [True: 13.3k, False: 11.7k]
  ------------------
 3565|  13.3k|      GLZ_FASTFLOAT_TRY(large_mul(vec, large));
  ------------------
  |  |  354|  13.3k|  {                                                                            \
  |  |  355|  13.3k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 13.3k]
  |  |  ------------------
  |  |  356|  13.3k|      return false;                                                            \
  |  |  357|  13.3k|  }
  ------------------
 3566|  13.3k|      exp -= large_step;
 3567|  13.3k|    }
 3568|  11.7k|#ifdef GLZ_FASTFLOAT_64BIT_LIMB
 3569|  11.7k|    uint32_t small_step = 27;
 3570|  11.7k|    limb max_native = 7450580596923828125UL;
 3571|       |#else
 3572|       |    uint32_t small_step = 13;
 3573|       |    limb max_native = 1220703125U;
 3574|       |#endif
 3575|  24.3k|    while (exp >= small_step) {
  ------------------
  |  Branch (3575:12): [True: 12.6k, False: 11.7k]
  ------------------
 3576|  12.6k|      GLZ_FASTFLOAT_TRY(small_mul(vec, max_native));
  ------------------
  |  |  354|  12.6k|  {                                                                            \
  |  |  355|  12.6k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 12.6k]
  |  |  ------------------
  |  |  356|  12.6k|      return false;                                                            \
  |  |  357|  12.6k|  }
  ------------------
 3577|  12.6k|      exp -= small_step;
 3578|  12.6k|    }
 3579|  11.7k|    if (exp != 0) {
  ------------------
  |  Branch (3579:9): [True: 8.32k, False: 3.43k]
  ------------------
 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|  8.32k|      GLZ_FASTFLOAT_TRY(small_mul(
  ------------------
  |  |  354|  8.32k|  {                                                                            \
  |  |  355|  8.32k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 8.32k]
  |  |  ------------------
  |  |  356|  8.32k|      return false;                                                            \
  |  |  357|  8.32k|  }
  ------------------
 3584|  8.32k|          vec, limb(((void)small_power_of_5[0], small_power_of_5[exp]))));
 3585|  8.32k|    }
 3586|       |
 3587|  11.7k|    return true;
 3588|  11.7k|  }
_ZN3glz10fast_float4spanImEC2EPKmm:
  436|  92.0k|  constexpr span(T const *_ptr, size_t _length) : ptr(_ptr), length(_length) {}
_ZN3glz10fast_float9large_mulILt62EEEbRNS0_8stackvecIXT_EEENS0_4spanImEE:
 3329|  13.3k|GLZ_FASTFLOAT_CONSTEXPR20 bool large_mul(stackvec<size> &x, limb_span y) noexcept {
 3330|  13.3k|  if (y.len() == 1) {
  ------------------
  |  Branch (3330:7): [True: 0, False: 13.3k]
  ------------------
 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|  13.3k|  } else {
 3333|  13.3k|    GLZ_FASTFLOAT_TRY(long_mul(x, y));
  ------------------
  |  |  354|  13.3k|  {                                                                            \
  |  |  355|  13.3k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 13.3k]
  |  |  ------------------
  |  |  356|  13.3k|      return false;                                                            \
  |  |  357|  13.3k|  }
  ------------------
 3334|  13.3k|  }
 3335|  13.3k|  return true;
 3336|  13.3k|}
_ZNK3glz10fast_float4spanImE3lenEv:
  440|   998k|  constexpr size_t len() const noexcept { return length; }
_ZNK3glz10fast_float4spanImEixEm:
  442|   611k|  GLZ_FASTFLOAT_CONSTEXPR14 const T &operator[](size_t index) const noexcept {
  443|   611k|    GLZ_FASTFLOAT_DEBUG_ASSERT(index < length);
  ------------------
  |  |  349|   611k|  { ((void)(x)); }
  ------------------
  444|   611k|    return ptr[index];
  445|   611k|  }
_ZN3glz10fast_float8long_mulILt62EEEbRNS0_8stackvecIXT_EEENS0_4spanImEE:
 3301|  13.3k|GLZ_FASTFLOAT_CONSTEXPR20 bool long_mul(stackvec<size> &x, limb_span y) noexcept {
 3302|  13.3k|  limb_span xs = limb_span(x.data, x.len());
 3303|  13.3k|  stackvec<size> z(xs);
 3304|  13.3k|  limb_span zs = limb_span(z.data, z.len());
 3305|       |
 3306|  13.3k|  if (y.len() != 0) {
  ------------------
  |  Branch (3306:7): [True: 13.3k, False: 0]
  ------------------
 3307|  13.3k|    limb y0 = y[0];
 3308|  13.3k|    GLZ_FASTFLOAT_TRY(small_mul(x, y0));
  ------------------
  |  |  354|  13.3k|  {                                                                            \
  |  |  355|  13.3k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 13.3k]
  |  |  ------------------
  |  |  356|  13.3k|      return false;                                                            \
  |  |  357|  13.3k|  }
  ------------------
 3309|  66.8k|    for (size_t index = 1; index < y.len(); index++) {
  ------------------
  |  Branch (3309:28): [True: 53.5k, False: 13.3k]
  ------------------
 3310|  53.5k|      limb yi = y[index];
 3311|  53.5k|      stackvec<size> zi;
 3312|  53.5k|      if (yi != 0) {
  ------------------
  |  Branch (3312:11): [True: 53.5k, False: 0]
  ------------------
 3313|       |        // re-use the same buffer throughout
 3314|  53.5k|        zi.set_len(0);
 3315|  53.5k|        GLZ_FASTFLOAT_TRY(zi.try_extend(zs));
  ------------------
  |  |  354|  53.5k|  {                                                                            \
  |  |  355|  53.5k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 53.5k]
  |  |  ------------------
  |  |  356|  53.5k|      return false;                                                            \
  |  |  357|  53.5k|  }
  ------------------
 3316|  53.5k|        GLZ_FASTFLOAT_TRY(small_mul(zi, yi));
  ------------------
  |  |  354|  53.5k|  {                                                                            \
  |  |  355|  53.5k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 53.5k]
  |  |  ------------------
  |  |  356|  53.5k|      return false;                                                            \
  |  |  357|  53.5k|  }
  ------------------
 3317|  53.5k|        limb_span zis = limb_span(zi.data, zi.len());
 3318|  53.5k|        GLZ_FASTFLOAT_TRY(large_add_from(x, zis, index));
  ------------------
  |  |  354|  53.5k|  {                                                                            \
  |  |  355|  53.5k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 53.5k]
  |  |  ------------------
  |  |  356|  53.5k|      return false;                                                            \
  |  |  357|  53.5k|  }
  ------------------
 3319|  53.5k|      }
 3320|  53.5k|    }
 3321|  13.3k|  }
 3322|       |
 3323|  13.3k|  x.normalize();
 3324|  13.3k|  return true;
 3325|  13.3k|}
_ZN3glz10fast_float8stackvecILt62EEC2ENS0_4spanImEE:
 3013|  13.3k|  GLZ_FASTFLOAT_CONSTEXPR20 stackvec(limb_span s) {
 3014|  13.3k|    GLZ_FASTFLOAT_ASSERT(try_extend(s));
  ------------------
  |  |  344|  13.3k|  { ((void)(x)); }
  ------------------
 3015|  13.3k|  }
_ZN3glz10fast_float8stackvecILt62EE7set_lenEm:
 3035|   178k|  GLZ_FASTFLOAT_CONSTEXPR14 void set_len(size_t len) noexcept {
 3036|   178k|    length = uint16_t(len);
 3037|   178k|  }
_ZN3glz10fast_float8stackvecILt62EE10try_extendENS0_4spanImEE:
 3069|  66.8k|  GLZ_FASTFLOAT_CONSTEXPR20 bool try_extend(limb_span s) noexcept {
 3070|  66.8k|    if (len() + s.len() <= capacity()) {
  ------------------
  |  Branch (3070:9): [True: 66.8k, False: 0]
  ------------------
 3071|  66.8k|      extend_unchecked(s);
 3072|  66.8k|      return true;
 3073|  66.8k|    } else {
 3074|      0|      return false;
 3075|      0|    }
 3076|  66.8k|  }
_ZN3glz10fast_float8stackvecILt62EE16extend_uncheckedENS0_4spanImEE:
 3062|  66.8k|  GLZ_FASTFLOAT_CONSTEXPR20 void extend_unchecked(limb_span s) noexcept {
 3063|  66.8k|    limb *ptr = data + length;
 3064|  66.8k|    std::copy_n(s.ptr, s.len(), ptr);
 3065|  66.8k|    set_len(len() + s.len());
 3066|  66.8k|  }
_ZN3glz10fast_float14large_add_fromILt62EEEbRNS0_8stackvecIXT_EEENS0_4spanImEEm:
 3264|  53.5k|                                          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|  53.5k|  if (x.len() < start || y.len() > x.len() - start) {
  ------------------
  |  Branch (3267:7): [True: 0, False: 53.5k]
  |  Branch (3267:26): [True: 52.9k, False: 612]
  ------------------
 3268|  52.9k|    GLZ_FASTFLOAT_TRY(x.try_resize(y.len() + start, 0));
  ------------------
  |  |  354|  52.9k|  {                                                                            \
  |  |  355|  52.9k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 52.9k]
  |  |  ------------------
  |  |  356|  52.9k|      return false;                                                            \
  |  |  357|  52.9k|  }
  ------------------
 3269|  52.9k|  }
 3270|       |
 3271|  53.5k|  bool carry = false;
 3272|   597k|  for (size_t index = 0; index < y.len(); index++) {
  ------------------
  |  Branch (3272:26): [True: 544k, False: 53.5k]
  ------------------
 3273|   544k|    limb xi = x[index + start];
 3274|   544k|    limb yi = y[index];
 3275|   544k|    bool c1 = false;
 3276|   544k|    bool c2 = false;
 3277|   544k|    xi = scalar_add(xi, yi, c1);
 3278|   544k|    if (carry) {
  ------------------
  |  Branch (3278:9): [True: 225k, False: 318k]
  ------------------
 3279|   225k|      xi = scalar_add(xi, 1, c2);
 3280|   225k|    }
 3281|   544k|    x[index + start] = xi;
 3282|   544k|    carry = c1 | c2;
 3283|   544k|  }
 3284|       |
 3285|       |  // handle overflow
 3286|  53.5k|  if (carry) {
  ------------------
  |  Branch (3286:7): [True: 0, False: 53.5k]
  ------------------
 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|  53.5k|  return true;
 3290|  53.5k|}
_ZN3glz10fast_float8stackvecILt62EE10try_resizeEmm:
 3095|  52.9k|  GLZ_FASTFLOAT_CONSTEXPR20 bool try_resize(size_t new_len, limb value) noexcept {
 3096|  52.9k|    if (new_len > capacity()) {
  ------------------
  |  Branch (3096:9): [True: 0, False: 52.9k]
  ------------------
 3097|      0|      return false;
 3098|  52.9k|    } else {
 3099|  52.9k|      resize_unchecked(new_len, value);
 3100|  52.9k|      return true;
 3101|  52.9k|    }
 3102|  52.9k|  }
_ZN3glz10fast_float8stackvecILt62EE16resize_uncheckedEmm:
 3082|  52.9k|  void resize_unchecked(size_t new_len, limb value) noexcept {
 3083|  52.9k|    if (new_len > len()) {
  ------------------
  |  Branch (3083:9): [True: 52.9k, False: 0]
  ------------------
 3084|  52.9k|      size_t count = new_len - len();
 3085|  52.9k|      limb *first = data + len();
 3086|  52.9k|      limb *last = first + count;
 3087|  52.9k|      ::std::fill(first, last, value);
 3088|  52.9k|      set_len(new_len);
 3089|  52.9k|    } else {
 3090|      0|      set_len(new_len);
 3091|      0|    }
 3092|  52.9k|  }
_ZN3glz10fast_float8stackvecILt62EE9normalizeEv:
 3118|  20.9k|  GLZ_FASTFLOAT_CONSTEXPR14 void normalize() noexcept {
 3119|  20.9k|    while (len() > 0 && rindex(0) == 0) {
  ------------------
  |  Branch (3119:12): [True: 20.9k, False: 0]
  |  Branch (3119:25): [True: 0, False: 20.9k]
  ------------------
 3120|      0|      length--;
 3121|      0|    }
 3122|  20.9k|  }
_ZNK3glz10fast_float8stackvecILt62EE6rindexEm:
 3028|  34.3k|  GLZ_FASTFLOAT_CONSTEXPR14 const limb &rindex(size_t index) const noexcept {
 3029|  34.3k|    GLZ_FASTFLOAT_DEBUG_ASSERT(index < length);
  ------------------
  |  |  349|  34.3k|  { ((void)(x)); }
  ------------------
 3030|  34.3k|    size_t rindex = length - index - 1;
 3031|  34.3k|    return data[rindex];
 3032|  34.3k|  }
_ZN3glz10fast_float6bigint4pow2Ej:
 3557|  11.5k|  GLZ_FASTFLOAT_CONSTEXPR20 bool pow2(uint32_t exp) noexcept { return shl(exp); }
_ZN3glz10fast_float6bigint3shlEm:
 3519|  11.5k|  GLZ_FASTFLOAT_CONSTEXPR20 bool shl(size_t n) noexcept {
 3520|  11.5k|    size_t rem = n % limb_bits;
 3521|  11.5k|    size_t div = n / limb_bits;
 3522|  11.5k|    if (rem != 0) {
  ------------------
  |  Branch (3522:9): [True: 7.90k, False: 3.66k]
  ------------------
 3523|  7.90k|      GLZ_FASTFLOAT_TRY(shl_bits(rem));
  ------------------
  |  |  354|  7.90k|  {                                                                            \
  |  |  355|  7.90k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 7.90k]
  |  |  ------------------
  |  |  356|  7.90k|      return false;                                                            \
  |  |  357|  7.90k|  }
  ------------------
 3524|  7.90k|    }
 3525|  11.5k|    if (div != 0) {
  ------------------
  |  Branch (3525:9): [True: 5.05k, False: 6.51k]
  ------------------
 3526|  5.05k|      GLZ_FASTFLOAT_TRY(shl_limbs(div));
  ------------------
  |  |  354|  5.05k|  {                                                                            \
  |  |  355|  5.05k|    if (!(x))                                                                  \
  |  |  ------------------
  |  |  |  Branch (355:9): [True: 0, False: 5.05k]
  |  |  ------------------
  |  |  356|  5.05k|      return false;                                                            \
  |  |  357|  5.05k|  }
  ------------------
 3527|  5.05k|    }
 3528|  11.5k|    return true;
 3529|  11.5k|  }
_ZN3glz10fast_float6bigint8shl_bitsEm:
 3472|  7.90k|  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|  7.90k|    GLZ_FASTFLOAT_DEBUG_ASSERT(n != 0);
  ------------------
  |  |  349|  7.90k|  { ((void)(x)); }
  ------------------
 3479|  7.90k|    GLZ_FASTFLOAT_DEBUG_ASSERT(n < sizeof(limb) * 8);
  ------------------
  |  |  349|  7.90k|  { ((void)(x)); }
  ------------------
 3480|       |
 3481|  7.90k|    size_t shl = n;
 3482|  7.90k|    size_t shr = limb_bits - shl;
 3483|  7.90k|    limb prev = 0;
 3484|  88.4k|    for (size_t index = 0; index < vec.len(); index++) {
  ------------------
  |  Branch (3484:28): [True: 80.5k, False: 7.90k]
  ------------------
 3485|  80.5k|      limb xi = vec[index];
 3486|  80.5k|      vec[index] = (xi << shl) | (prev >> shr);
 3487|  80.5k|      prev = xi;
 3488|  80.5k|    }
 3489|       |
 3490|  7.90k|    limb carry = prev >> shr;
 3491|  7.90k|    if (carry != 0) {
  ------------------
  |  Branch (3491:9): [True: 2.26k, False: 5.64k]
  ------------------
 3492|  2.26k|      return vec.try_push(carry);
 3493|  2.26k|    }
 3494|  5.64k|    return true;
 3495|  7.90k|  }
_ZN3glz10fast_float6bigint9shl_limbsEm:
 3498|  5.05k|  GLZ_FASTFLOAT_CONSTEXPR20 bool shl_limbs(size_t n) noexcept {
 3499|  5.05k|    GLZ_FASTFLOAT_DEBUG_ASSERT(n != 0);
  ------------------
  |  |  349|  5.05k|  { ((void)(x)); }
  ------------------
 3500|  5.05k|    if (n + vec.len() > vec.capacity()) {
  ------------------
  |  Branch (3500:9): [True: 0, False: 5.05k]
  ------------------
 3501|      0|      return false;
 3502|  5.05k|    } else if (!vec.is_empty()) {
  ------------------
  |  Branch (3502:16): [True: 5.05k, False: 0]
  ------------------
 3503|       |      // move limbs
 3504|  5.05k|      limb *dst = vec.data + n;
 3505|  5.05k|      limb const *src = vec.data;
 3506|  5.05k|      std::copy_backward(src, src + vec.len(), dst + vec.len());
 3507|       |      // fill in empty limbs
 3508|  5.05k|      limb *first = vec.data;
 3509|  5.05k|      limb *last = first + n;
 3510|  5.05k|      ::std::fill(first, last, 0);
 3511|  5.05k|      vec.set_len(n + vec.len());
 3512|  5.05k|      return true;
 3513|  5.05k|    } else {
 3514|      0|      return true;
 3515|      0|    }
 3516|  5.05k|  }
_ZNK3glz10fast_float8stackvecILt62EE8is_emptyEv:
 3041|  9.22k|  constexpr bool is_empty() const noexcept { return length == 0; }
_ZNK3glz10fast_float6bigint4hi64ERb:
 3418|  4.16k|  GLZ_FASTFLOAT_CONSTEXPR20 uint64_t hi64(bool &truncated) const noexcept {
 3419|  4.16k|#ifdef GLZ_FASTFLOAT_64BIT_LIMB
 3420|  4.16k|    if (vec.len() == 0) {
  ------------------
  |  Branch (3420:9): [True: 0, False: 4.16k]
  ------------------
 3421|      0|      return empty_hi64(truncated);
 3422|  4.16k|    } else if (vec.len() == 1) {
  ------------------
  |  Branch (3422:16): [True: 836, False: 3.33k]
  ------------------
 3423|    836|      return uint64_hi64(vec.rindex(0), truncated);
 3424|  3.33k|    } else {
 3425|  3.33k|      uint64_t result = uint64_hi64(vec.rindex(0), vec.rindex(1), truncated);
 3426|  3.33k|      truncated |= vec.nonzero(2);
 3427|  3.33k|      return result;
 3428|  3.33k|    }
 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|  4.16k|  }
_ZN3glz10fast_float11uint64_hi64EmRb:
 3132|    836|uint64_hi64(uint64_t r0, bool &truncated) noexcept {
 3133|    836|  truncated = false;
 3134|    836|  int shl = leading_zeroes(r0);
 3135|    836|  return r0 << shl;
 3136|    836|}
_ZN3glz10fast_float11uint64_hi64EmmRb:
 3139|  3.33k|uint64_hi64(uint64_t r0, uint64_t r1, bool &truncated) noexcept {
 3140|  3.33k|  int shl = leading_zeroes(r0);
 3141|  3.33k|  if (shl == 0) {
  ------------------
  |  Branch (3141:7): [True: 350, False: 2.98k]
  ------------------
 3142|    350|    truncated = r1 != 0;
 3143|    350|    return r0;
 3144|  2.98k|  } else {
 3145|  2.98k|    int shr = 64 - shl;
 3146|  2.98k|    truncated = (r1 << shl) != 0;
 3147|  2.98k|    return (r0 << shl) | (r1 >> shr);
 3148|  2.98k|  }
 3149|  3.33k|}
_ZNK3glz10fast_float8stackvecILt62EE7nonzeroEm:
 3107|  3.33k|  GLZ_FASTFLOAT_CONSTEXPR14 bool nonzero(size_t index) const noexcept {
 3108|  3.52k|    while (index < len()) {
  ------------------
  |  Branch (3108:12): [True: 1.72k, False: 1.79k]
  ------------------
 3109|  1.72k|      if (rindex(index) != 0) {
  ------------------
  |  Branch (3109:11): [True: 1.53k, False: 188]
  ------------------
 3110|  1.53k|        return true;
 3111|  1.53k|      }
 3112|    188|      index++;
 3113|    188|    }
 3114|  1.79k|    return false;
 3115|  3.33k|  }
_ZNK3glz10fast_float6bigint10bit_lengthEv:
 3547|  4.16k|  GLZ_FASTFLOAT_CONSTEXPR20 int bit_length() const noexcept {
 3548|  4.16k|    int lz = ctlz();
 3549|  4.16k|    return int(limb_bits * vec.len()) - lz;
 3550|  4.16k|  }
_ZNK3glz10fast_float6bigint4ctlzEv:
 3532|  4.16k|  GLZ_FASTFLOAT_CONSTEXPR20 int ctlz() const noexcept {
 3533|  4.16k|    if (vec.is_empty()) {
  ------------------
  |  Branch (3533:9): [True: 0, False: 4.16k]
  ------------------
 3534|      0|      return 0;
 3535|  4.16k|    } else {
 3536|  4.16k|#ifdef GLZ_FASTFLOAT_64BIT_LIMB
 3537|  4.16k|      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|  4.16k|    }
 3544|  4.16k|  }
_ZN3glz10fast_float5roundIdZNS0_19positive_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintEiEUlRS3_iE_EEvS6_T0_:
 3707|  4.16k|                                                         callback cb) noexcept {
 3708|  4.16k|  int32_t mantissa_shift = 64 - binary_format<T>::mantissa_explicit_bits() - 1;
 3709|  4.16k|  if (-am.power2 >= mantissa_shift) {
  ------------------
  |  Branch (3709:7): [True: 0, False: 4.16k]
  ------------------
 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|  4.16k|  cb(am, mantissa_shift);
 3723|       |
 3724|       |  // check for carry
 3725|  4.16k|  if (am.mantissa >=
  ------------------
  |  Branch (3725:7): [True: 0, False: 4.16k]
  ------------------
 3726|  4.16k|      (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|  4.16k|  am.mantissa &= ~(uint64_t(1) << binary_format<T>::mantissa_explicit_bits());
 3733|  4.16k|  if (am.power2 >= binary_format<T>::infinite_power()) {
  ------------------
  |  Branch (3733:7): [True: 0, False: 4.16k]
  ------------------
 3734|      0|    am.power2 = binary_format<T>::infinite_power();
 3735|      0|    am.mantissa = 0;
 3736|      0|  }
 3737|  4.16k|}
_ZZN3glz10fast_float19positive_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintEiENKUlRS2_iE_clES5_i:
 3951|  4.16k|  round<T>(answer, [truncated](adjusted_mantissa &a, int32_t shift) {
 3952|  4.16k|    round_nearest_tie_even(
 3953|  4.16k|        a, shift,
 3954|  4.16k|        [truncated](bool is_odd, bool is_halfway, bool is_above) -> bool {
 3955|  4.16k|          return is_above || (is_halfway && truncated) ||
 3956|  4.16k|                 (is_odd && is_halfway);
 3957|  4.16k|        });
 3958|  4.16k|  });
_ZN3glz10fast_float22round_nearest_tie_evenIZZNS0_19positive_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintEiENKUlRS3_iE_clES6_iEUlbbbE_EEvS6_iT_:
 3742|  4.16k|                       callback cb) noexcept {
 3743|  4.16k|  uint64_t const mask = (shift == 64) ? UINT64_MAX : (uint64_t(1) << shift) - 1;
  ------------------
  |  Branch (3743:25): [True: 0, False: 4.16k]
  ------------------
 3744|  4.16k|  uint64_t const halfway = (shift == 0) ? 0 : uint64_t(1) << (shift - 1);
  ------------------
  |  Branch (3744:28): [True: 0, False: 4.16k]
  ------------------
 3745|  4.16k|  uint64_t truncated_bits = am.mantissa & mask;
 3746|  4.16k|  bool is_above = truncated_bits > halfway;
 3747|  4.16k|  bool is_halfway = truncated_bits == halfway;
 3748|       |
 3749|       |  // shift digits into position
 3750|  4.16k|  if (shift == 64) {
  ------------------
  |  Branch (3750:7): [True: 0, False: 4.16k]
  ------------------
 3751|      0|    am.mantissa = 0;
 3752|  4.16k|  } else {
 3753|  4.16k|    am.mantissa >>= shift;
 3754|  4.16k|  }
 3755|  4.16k|  am.power2 += shift;
 3756|       |
 3757|  4.16k|  bool is_odd = (am.mantissa & 1) == 1;
 3758|  4.16k|  am.mantissa += uint64_t(cb(is_odd, is_halfway, is_above));
 3759|  4.16k|}
_ZZZN3glz10fast_float19positive_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintEiENKUlRS2_iE_clES5_iENKUlbbbE_clEbbb:
 3954|  4.16k|        [truncated](bool is_odd, bool is_halfway, bool is_above) -> bool {
 3955|  4.16k|          return is_above || (is_halfway && truncated) ||
  ------------------
  |  Branch (3955:18): [True: 512, False: 3.65k]
  |  Branch (3955:31): [True: 1.57k, False: 2.08k]
  |  Branch (3955:45): [True: 856, False: 716]
  ------------------
 3956|  2.80k|                 (is_odd && is_halfway);
  ------------------
  |  Branch (3956:19): [True: 1.42k, False: 1.38k]
  |  Branch (3956:29): [True: 298, False: 1.12k]
  ------------------
 3957|  4.16k|        });
_ZN3glz10fast_float19negative_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintES2_i:
 3970|  7.58k|    bigint &bigmant, adjusted_mantissa am, int32_t exponent) noexcept {
 3971|  7.58k|  bigint &real_digits = bigmant;
 3972|  7.58k|  int32_t real_exp = exponent;
 3973|       |
 3974|       |  // get the value of `b`, rounded down, and get a bigint representation of b+h
 3975|  7.58k|  adjusted_mantissa am_b = am;
 3976|       |  // gcc7 buf: use a lambda to remove the noexcept qualifier bug with
 3977|       |  // -Wnoexcept-type.
 3978|  7.58k|  round<T>(am_b,
 3979|  7.58k|           [](adjusted_mantissa &a, int32_t shift) { round_down(a, shift); });
 3980|  7.58k|  T b;
 3981|  7.58k|  to_float(false, am_b, b);
 3982|  7.58k|  adjusted_mantissa theor = to_extended_halfway(b);
 3983|  7.58k|  bigint theor_digits(theor.mantissa);
 3984|  7.58k|  int32_t theor_exp = theor.power2;
 3985|       |
 3986|       |  // scale real digits and theor digits to be same power.
 3987|  7.58k|  int32_t pow2_exp = theor_exp - real_exp;
 3988|  7.58k|  uint32_t pow5_exp = uint32_t(-real_exp);
 3989|  7.58k|  if (pow5_exp != 0) {
  ------------------
  |  Branch (3989:7): [True: 7.58k, False: 0]
  ------------------
 3990|  7.58k|    GLZ_FASTFLOAT_ASSERT(theor_digits.pow5(pow5_exp));
  ------------------
  |  |  344|  7.58k|  { ((void)(x)); }
  ------------------
 3991|  7.58k|  }
 3992|  7.58k|  if (pow2_exp > 0) {
  ------------------
  |  Branch (3992:7): [True: 4.80k, False: 2.78k]
  ------------------
 3993|  4.80k|    GLZ_FASTFLOAT_ASSERT(theor_digits.pow2(uint32_t(pow2_exp)));
  ------------------
  |  |  344|  4.80k|  { ((void)(x)); }
  ------------------
 3994|  4.80k|  } else if (pow2_exp < 0) {
  ------------------
  |  Branch (3994:14): [True: 2.59k, False: 190]
  ------------------
 3995|  2.59k|    GLZ_FASTFLOAT_ASSERT(real_digits.pow2(uint32_t(-pow2_exp)));
  ------------------
  |  |  344|  2.59k|  { ((void)(x)); }
  ------------------
 3996|  2.59k|  }
 3997|       |
 3998|       |  // compare digits, and use it to director rounding
 3999|  7.58k|  int ord = real_digits.compare(theor_digits);
 4000|  7.58k|  adjusted_mantissa answer = am;
 4001|  7.58k|  round<T>(answer, [ord](adjusted_mantissa &a, int32_t shift) {
 4002|  7.58k|    round_nearest_tie_even(
 4003|  7.58k|        a, shift, [ord](bool is_odd, bool _, bool __) -> bool {
 4004|  7.58k|          (void)_;  // not needed, since we've done our comparison
 4005|  7.58k|          (void)__; // not needed, since we've done our comparison
 4006|  7.58k|          if (ord > 0) {
 4007|  7.58k|            return true;
 4008|  7.58k|          } else if (ord < 0) {
 4009|  7.58k|            return false;
 4010|  7.58k|          } else {
 4011|  7.58k|            return is_odd;
 4012|  7.58k|          }
 4013|  7.58k|        });
 4014|  7.58k|  });
 4015|       |
 4016|  7.58k|  return answer;
 4017|  7.58k|}
_ZN3glz10fast_float5roundIdZNS0_19negative_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintES3_iEUlRS3_iE_EEvS6_T0_:
 3707|  7.58k|                                                         callback cb) noexcept {
 3708|  7.58k|  int32_t mantissa_shift = 64 - binary_format<T>::mantissa_explicit_bits() - 1;
 3709|  7.58k|  if (-am.power2 >= mantissa_shift) {
  ------------------
  |  Branch (3709:7): [True: 766, False: 6.82k]
  ------------------
 3710|       |    // have a denormal float
 3711|    766|    int32_t shift = -am.power2 + 1;
 3712|    766|    cb(am, (std::min<int32_t>)(shift, 64));
 3713|       |    // check for round-up: if rounding-nearest carried us to the hidden bit.
 3714|    766|    am.power2 = (am.mantissa <
  ------------------
  |  Branch (3714:17): [True: 766, False: 0]
  ------------------
 3715|    766|                 (uint64_t(1) << binary_format<T>::mantissa_explicit_bits()))
 3716|    766|                    ? 0
 3717|    766|                    : 1;
 3718|    766|    return;
 3719|    766|  }
 3720|       |
 3721|       |  // have a normal float, use the default shift.
 3722|  6.82k|  cb(am, mantissa_shift);
 3723|       |
 3724|       |  // check for carry
 3725|  6.82k|  if (am.mantissa >=
  ------------------
  |  Branch (3725:7): [True: 0, False: 6.82k]
  ------------------
 3726|  6.82k|      (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|  6.82k|  am.mantissa &= ~(uint64_t(1) << binary_format<T>::mantissa_explicit_bits());
 3733|  6.82k|  if (am.power2 >= binary_format<T>::infinite_power()) {
  ------------------
  |  Branch (3733:7): [True: 0, False: 6.82k]
  ------------------
 3734|      0|    am.power2 = binary_format<T>::infinite_power();
 3735|      0|    am.mantissa = 0;
 3736|      0|  }
 3737|  6.82k|}
_ZZN3glz10fast_float19negative_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintES2_iENKUlRS2_iE_clES5_i:
 3979|  7.58k|           [](adjusted_mantissa &a, int32_t shift) { round_down(a, shift); });
_ZN3glz10fast_float10round_downERNS0_17adjusted_mantissaEi:
 3762|  7.58k|round_down(adjusted_mantissa &am, int32_t shift) noexcept {
 3763|  7.58k|  if (shift == 64) {
  ------------------
  |  Branch (3763:7): [True: 0, False: 7.58k]
  ------------------
 3764|      0|    am.mantissa = 0;
 3765|  7.58k|  } else {
 3766|  7.58k|    am.mantissa >>= shift;
 3767|  7.58k|  }
 3768|  7.58k|  am.power2 += shift;
 3769|  7.58k|}
_ZN3glz10fast_float19to_extended_halfwayIdEENS0_17adjusted_mantissaET_:
 3696|  7.58k|to_extended_halfway(T value) noexcept {
 3697|  7.58k|  adjusted_mantissa am = to_extended(value);
 3698|  7.58k|  am.mantissa <<= 1;
 3699|  7.58k|  am.mantissa += 1;
 3700|  7.58k|  am.power2 -= 1;
 3701|  7.58k|  return am;
 3702|  7.58k|}
_ZN3glz10fast_float11to_extendedIdEENS0_17adjusted_mantissaET_:
 3661|  7.58k|to_extended(T value) noexcept {
 3662|  7.58k|  using equiv_uint = equiv_uint_t<T>;
 3663|  7.58k|  constexpr equiv_uint exponent_mask = binary_format<T>::exponent_mask();
 3664|  7.58k|  constexpr equiv_uint mantissa_mask = binary_format<T>::mantissa_mask();
 3665|  7.58k|  constexpr equiv_uint hidden_bit_mask = binary_format<T>::hidden_bit_mask();
 3666|       |
 3667|  7.58k|  adjusted_mantissa am;
 3668|  7.58k|  int32_t bias = binary_format<T>::mantissa_explicit_bits() -
 3669|  7.58k|                 binary_format<T>::minimum_exponent();
 3670|  7.58k|  equiv_uint bits;
 3671|  7.58k|#if GLZ_FASTFLOAT_HAS_BIT_CAST
 3672|  7.58k|  bits = std::bit_cast<equiv_uint>(value);
 3673|       |#else
 3674|       |  ::memcpy(&bits, &value, sizeof(T));
 3675|       |#endif
 3676|  7.58k|  if ((bits & exponent_mask) == 0) {
  ------------------
  |  Branch (3676:7): [True: 766, False: 6.82k]
  ------------------
 3677|       |    // denormal
 3678|    766|    am.power2 = 1 - bias;
 3679|    766|    am.mantissa = bits & mantissa_mask;
 3680|  6.82k|  } else {
 3681|       |    // normal
 3682|  6.82k|    am.power2 = int32_t((bits & exponent_mask) >>
 3683|  6.82k|                        binary_format<T>::mantissa_explicit_bits());
 3684|  6.82k|    am.power2 -= bias;
 3685|  6.82k|    am.mantissa = (bits & mantissa_mask) | hidden_bit_mask;
 3686|  6.82k|  }
 3687|       |
 3688|  7.58k|  return am;
 3689|  7.58k|}
_ZN3glz10fast_float6bigintC2Em:
 3406|  7.58k|  GLZ_FASTFLOAT_CONSTEXPR20 bigint(uint64_t value) : vec() {
 3407|  7.58k|#ifdef GLZ_FASTFLOAT_64BIT_LIMB
 3408|  7.58k|    vec.push_unchecked(value);
 3409|       |#else
 3410|       |    vec.push_unchecked(uint32_t(value));
 3411|       |    vec.push_unchecked(uint32_t(value >> 32));
 3412|       |#endif
 3413|  7.58k|    vec.normalize();
 3414|  7.58k|  }
_ZNK3glz10fast_float6bigint7compareERKS1_:
 3451|  7.58k|  GLZ_FASTFLOAT_CONSTEXPR20 int compare(bigint const &other) const noexcept {
 3452|  7.58k|    if (vec.len() > other.vec.len()) {
  ------------------
  |  Branch (3452:9): [True: 0, False: 7.58k]
  ------------------
 3453|      0|      return 1;
 3454|  7.58k|    } else if (vec.len() < other.vec.len()) {
  ------------------
  |  Branch (3454:16): [True: 0, False: 7.58k]
  ------------------
 3455|      0|      return -1;
 3456|  7.58k|    } else {
 3457|  23.1k|      for (size_t index = vec.len(); index > 0; index--) {
  ------------------
  |  Branch (3457:38): [True: 22.8k, False: 330]
  ------------------
 3458|  22.8k|        limb xi = vec[index - 1];
 3459|  22.8k|        limb yi = other.vec[index - 1];
 3460|  22.8k|        if (xi > yi) {
  ------------------
  |  Branch (3460:13): [True: 3.72k, False: 19.0k]
  ------------------
 3461|  3.72k|          return 1;
 3462|  19.0k|        } else if (xi < yi) {
  ------------------
  |  Branch (3462:20): [True: 3.53k, False: 15.5k]
  ------------------
 3463|  3.53k|          return -1;
 3464|  3.53k|        }
 3465|  22.8k|      }
 3466|    330|      return 0;
 3467|  7.58k|    }
 3468|  7.58k|  }
_ZNK3glz10fast_float8stackvecILt62EEixEm:
 3022|  45.6k|  GLZ_FASTFLOAT_CONSTEXPR14 const limb &operator[](size_t index) const noexcept {
 3023|  45.6k|    GLZ_FASTFLOAT_DEBUG_ASSERT(index < length);
  ------------------
  |  |  349|  45.6k|  { ((void)(x)); }
  ------------------
 3024|  45.6k|    return data[index];
 3025|  45.6k|  }
_ZN3glz10fast_float5roundIdZNS0_19negative_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintES3_iEUlRS3_iE0_EEvS6_T0_:
 3707|  7.58k|                                                         callback cb) noexcept {
 3708|  7.58k|  int32_t mantissa_shift = 64 - binary_format<T>::mantissa_explicit_bits() - 1;
 3709|  7.58k|  if (-am.power2 >= mantissa_shift) {
  ------------------
  |  Branch (3709:7): [True: 766, False: 6.82k]
  ------------------
 3710|       |    // have a denormal float
 3711|    766|    int32_t shift = -am.power2 + 1;
 3712|    766|    cb(am, (std::min<int32_t>)(shift, 64));
 3713|       |    // check for round-up: if rounding-nearest carried us to the hidden bit.
 3714|    766|    am.power2 = (am.mantissa <
  ------------------
  |  Branch (3714:17): [True: 766, False: 0]
  ------------------
 3715|    766|                 (uint64_t(1) << binary_format<T>::mantissa_explicit_bits()))
 3716|    766|                    ? 0
 3717|    766|                    : 1;
 3718|    766|    return;
 3719|    766|  }
 3720|       |
 3721|       |  // have a normal float, use the default shift.
 3722|  6.82k|  cb(am, mantissa_shift);
 3723|       |
 3724|       |  // check for carry
 3725|  6.82k|  if (am.mantissa >=
  ------------------
  |  Branch (3725:7): [True: 274, False: 6.54k]
  ------------------
 3726|  6.82k|      (uint64_t(2) << binary_format<T>::mantissa_explicit_bits())) {
 3727|    274|    am.mantissa = (uint64_t(1) << binary_format<T>::mantissa_explicit_bits());
 3728|    274|    am.power2++;
 3729|    274|  }
 3730|       |
 3731|       |  // check for infinite: we could have carried to an infinite power
 3732|  6.82k|  am.mantissa &= ~(uint64_t(1) << binary_format<T>::mantissa_explicit_bits());
 3733|  6.82k|  if (am.power2 >= binary_format<T>::infinite_power()) {
  ------------------
  |  Branch (3733:7): [True: 0, False: 6.82k]
  ------------------
 3734|      0|    am.power2 = binary_format<T>::infinite_power();
 3735|      0|    am.mantissa = 0;
 3736|      0|  }
 3737|  6.82k|}
_ZZN3glz10fast_float19negative_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintES2_iENKUlRS2_iE0_clES5_i:
 4001|  7.58k|  round<T>(answer, [ord](adjusted_mantissa &a, int32_t shift) {
 4002|  7.58k|    round_nearest_tie_even(
 4003|  7.58k|        a, shift, [ord](bool is_odd, bool _, bool __) -> bool {
 4004|  7.58k|          (void)_;  // not needed, since we've done our comparison
 4005|  7.58k|          (void)__; // not needed, since we've done our comparison
 4006|  7.58k|          if (ord > 0) {
 4007|  7.58k|            return true;
 4008|  7.58k|          } else if (ord < 0) {
 4009|  7.58k|            return false;
 4010|  7.58k|          } else {
 4011|  7.58k|            return is_odd;
 4012|  7.58k|          }
 4013|  7.58k|        });
 4014|  7.58k|  });
_ZN3glz10fast_float22round_nearest_tie_evenIZZNS0_19negative_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintES3_iENKUlRS3_iE0_clES6_iEUlbbbE_EEvS6_iT_:
 3742|  7.58k|                       callback cb) noexcept {
 3743|  7.58k|  uint64_t const mask = (shift == 64) ? UINT64_MAX : (uint64_t(1) << shift) - 1;
  ------------------
  |  Branch (3743:25): [True: 0, False: 7.58k]
  ------------------
 3744|  7.58k|  uint64_t const halfway = (shift == 0) ? 0 : uint64_t(1) << (shift - 1);
  ------------------
  |  Branch (3744:28): [True: 0, False: 7.58k]
  ------------------
 3745|  7.58k|  uint64_t truncated_bits = am.mantissa & mask;
 3746|  7.58k|  bool is_above = truncated_bits > halfway;
 3747|  7.58k|  bool is_halfway = truncated_bits == halfway;
 3748|       |
 3749|       |  // shift digits into position
 3750|  7.58k|  if (shift == 64) {
  ------------------
  |  Branch (3750:7): [True: 0, False: 7.58k]
  ------------------
 3751|      0|    am.mantissa = 0;
 3752|  7.58k|  } else {
 3753|  7.58k|    am.mantissa >>= shift;
 3754|  7.58k|  }
 3755|  7.58k|  am.power2 += shift;
 3756|       |
 3757|  7.58k|  bool is_odd = (am.mantissa & 1) == 1;
 3758|  7.58k|  am.mantissa += uint64_t(cb(is_odd, is_halfway, is_above));
 3759|  7.58k|}
_ZZZN3glz10fast_float19negative_digit_compIdEENS0_17adjusted_mantissaERNS0_6bigintES2_iENKUlRS2_iE0_clES5_iENKUlbbbE_clEbbb:
 4003|  7.58k|        a, shift, [ord](bool is_odd, bool _, bool __) -> bool {
 4004|  7.58k|          (void)_;  // not needed, since we've done our comparison
 4005|  7.58k|          (void)__; // not needed, since we've done our comparison
 4006|  7.58k|          if (ord > 0) {
  ------------------
  |  Branch (4006:15): [True: 3.72k, False: 3.86k]
  ------------------
 4007|  3.72k|            return true;
 4008|  3.86k|          } else if (ord < 0) {
  ------------------
  |  Branch (4008:22): [True: 3.53k, False: 330]
  ------------------
 4009|  3.53k|            return false;
 4010|  3.53k|          } else {
 4011|    330|            return is_odd;
 4012|    330|          }
 4013|  7.58k|        });
_ZN3glz10fast_float8to_floatIdEEvbNS0_17adjusted_mantissaERT_:
 1131|  88.8k|to_float(bool negative, adjusted_mantissa am, T &value) {
 1132|  88.8k|  using equiv_uint = equiv_uint_t<T>;
 1133|  88.8k|  equiv_uint word = equiv_uint(am.mantissa);
 1134|  88.8k|  word = equiv_uint(word | equiv_uint(am.power2)
 1135|  88.8k|                               << binary_format<T>::mantissa_explicit_bits());
 1136|  88.8k|  word =
 1137|  88.8k|      equiv_uint(word | equiv_uint(negative) << binary_format<T>::sign_index());
 1138|  88.8k|#if GLZ_FASTFLOAT_HAS_BIT_CAST
 1139|  88.8k|  value = std::bit_cast<T>(word);
 1140|       |#else
 1141|       |  ::memcpy(&value, &word, sizeof(T));
 1142|       |#endif
 1143|  88.8k|}
_ZN3glz10fast_float13binary_formatIdE10sign_indexEv:
  758|  88.8k|template <> inline constexpr int binary_format<double>::sign_index() {
  759|  88.8k|  return 63;
  760|  88.8k|}
_ZN3glz10fast_float13binary_formatIdE14infinite_powerEv:
  750|   227k|template <> inline constexpr int binary_format<double>::infinite_power() {
  751|   227k|  return 0x7FF;
  752|   227k|}
_ZN3glz10fast_float15parse_options_tIcEC2ENS0_12chars_formatEci:
  217|  3.18M|      : format(fmt), decimal_point(dot), base(b) {}

_ZN3glz18code_point_to_utf8IcEEjjPT_:
  249|  5.81k|   {
  250|  5.81k|      if (code_point <= 0x7F) {
  ------------------
  |  Branch (250:11): [True: 1.22k, False: 4.59k]
  ------------------
  251|  1.22k|         c[0] = Char(code_point);
  252|  1.22k|         return 1;
  253|  1.22k|      }
  254|  4.59k|      if (code_point <= 0x7FF) {
  ------------------
  |  Branch (254:11): [True: 1.56k, False: 3.03k]
  ------------------
  255|  1.56k|         c[0] = Char(0xC0 | ((code_point >> 6) & 0x1F));
  256|  1.56k|         c[1] = Char(0x80 | (code_point & 0x3F));
  257|  1.56k|         return 2;
  258|  1.56k|      }
  259|  3.03k|      if (code_point <= 0xFFFF) {
  ------------------
  |  Branch (259:11): [True: 2.78k, False: 250]
  ------------------
  260|  2.78k|         c[0] = Char(0xE0 | ((code_point >> 12) & 0x0F));
  261|  2.78k|         c[1] = Char(0x80 | ((code_point >> 6) & 0x3F));
  262|  2.78k|         c[2] = Char(0x80 | (code_point & 0x3F));
  263|  2.78k|         return 3;
  264|  2.78k|      }
  265|    250|      if (code_point <= 0x10FFFF) {
  ------------------
  |  Branch (265:11): [True: 250, False: 0]
  ------------------
  266|    250|         c[0] = Char(0xF0 | ((code_point >> 18) & 0x07));
  267|    250|         c[1] = Char(0x80 | ((code_point >> 12) & 0x3F));
  268|    250|         c[2] = Char(0x80 | ((code_point >> 6) & 0x3F));
  269|    250|         c[3] = Char(0x80 | (code_point & 0x3F));
  270|    250|         return 4;
  271|    250|      }
  272|      0|      return 0;
  273|    250|   }
_ZN3glz10hex_to_u32EPKc:
  224|  6.56k|   {
  225|  6.56k|      constexpr auto& t = digit_hex_table;
  226|  6.56k|      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|  6.56k|      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|  6.56k|      if (chunk & repeat_byte4(0b11110000u)) [[unlikely]] {
  ------------------
  |  Branch (234:11): [True: 82, False: 6.48k]
  ------------------
  235|     82|         return 0xFFFFFFFFu;
  236|     82|      }
  237|       |
  238|       |      // now pack into first four bytes of uint32_t
  239|  6.48k|      uint32_t packed{};
  240|  6.48k|      packed |= (chunk & 0x0000000F);
  241|  6.48k|      packed |= (chunk & 0x00000F00) >> 4;
  242|  6.48k|      packed |= (chunk & 0x000F0000) >> 8;
  243|  6.48k|      packed |= (chunk & 0x0F000000) >> 12;
  244|  6.48k|      return packed;
  245|  6.56k|   }

_ZN3glz8to_charsITkNSt3__114floating_pointEdLb0EEEPcS2_T_:
 1118|   496k|   {
 1119|   496k|      static_assert(std::is_same_v<T, float> || std::is_same_v<T, double>);
 1120|   496k|      return zmij::detail::write<T, OptSize>(val, buf);
 1121|   496k|   }
_ZN3glz4zmij6detail5writeIdLb0EEEPcT_S3_:
  975|   496k|      {
  976|   496k|         using namespace detail_impl;
  977|   496k|         using traits = float_traits<Float>;
  978|   496k|         auto bits = traits::to_bits(value);
  979|   496k|         auto bin_exp = traits::get_exp(bits);
  980|   496k|         auto bin_sig = traits::get_sig(bits);
  981|       |
  982|   496k|         *buffer = '-';
  983|   496k|         buffer += traits::is_negative(bits);
  984|       |
  985|   496k|         const auto* c = &consts_v<OptSize>;
  986|   496k|         ZMIJ_ASM(("" : "+r"(c)));
  ------------------
  |  |  126|   496k|#define ZMIJ_ASM(x) asm x
  ------------------
  987|   496k|         int64_t threshold = traits::num_bits == 64 ? static_cast<int64_t>(c->threshold) : 10'000'000;
  ------------------
  |  Branch (987:30): [True: 496k, Folded]
  ------------------
  988|       |
  989|   496k|         to_decimal_result dec;
  990|   496k|         bool is_normal = unsigned(bin_exp - 1) < unsigned(traits::exp_mask - 1);
  991|   496k|         if (!is_normal) [[unlikely]] {
  ------------------
  |  Branch (991:14): [True: 248k, False: 247k]
  ------------------
  992|   248k|            if (bin_exp != 0) {
  ------------------
  |  Branch (992:17): [True: 55.2k, False: 193k]
  ------------------
  993|       |#if GLZ_ZMIJ_EMIT_INF_NAN
  994|       |               memcpy(buffer, bin_sig == 0 ? "inf" : "nan", 4);
  995|       |               return buffer + 3;
  996|       |#else
  997|       |               // Undo the speculative '-' for sign-bit-set NaN/Inf: JSON "null"
  998|       |               // never carries a sign.
  999|  55.2k|               buffer -= traits::is_negative(bits);
 1000|  55.2k|               memcpy(buffer, "null", 4);
 1001|  55.2k|               return buffer + 4;
 1002|  55.2k|#endif
 1003|  55.2k|            }
 1004|   193k|            if (bin_sig == 0) {
  ------------------
  |  Branch (1004:17): [True: 190k, False: 2.98k]
  ------------------
 1005|   190k|               memcpy(buffer, "0", 2);
 1006|   190k|               return buffer + 1;
 1007|   190k|            }
 1008|  2.98k|            dec = detail_impl::to_decimal<Float, typename traits::sig_type, OptSize>(bin_sig, 1, true, *c);
 1009|  2.98k|            int64_t dec_sig = dec.sig * 10 + (dec.has_last_digit ? dec.last_digit : 0);
  ------------------
  |  Branch (1009:47): [True: 880, False: 2.10k]
  ------------------
 1010|  2.98k|            int32_t dec_exp = dec.exp;
 1011|  11.5k|            while (dec_sig < threshold) {
  ------------------
  |  Branch (1011:20): [True: 8.53k, False: 2.98k]
  ------------------
 1012|  8.53k|               dec_sig *= 10;
 1013|  8.53k|               --dec_exp;
 1014|  8.53k|            }
 1015|  2.98k|            int64_t d = static_cast<int64_t>(detail_impl::div10(static_cast<uint64_t>(dec_sig)));
 1016|  2.98k|            int32_t last_digit = static_cast<int32_t>(dec_sig - d * 10);
 1017|  2.98k|            dec = {d, dec_exp, last_digit, last_digit != 0};
 1018|  2.98k|         }
 1019|   247k|         else {
 1020|   247k|            dec = detail_impl::to_decimal<Float, typename traits::sig_type, OptSize>(bin_sig | traits::implicit_bit,
 1021|   247k|                                                                                     bin_exp, bin_sig != 0, *c);
 1022|   247k|         }
 1023|   250k|         bool extra_digit = dec.sig >= threshold;
 1024|   250k|         int dec_exp = dec.exp + traits::max_digits10 - 2 + extra_digit;
 1025|   250k|         if (traits::num_bits == 32 && dec.sig < 1'000'000) [[unlikely]] {
  ------------------
  |  Branch (1025:14): [Folded, False: 250k]
  |  Branch (1025:40): [True: 0, False: 0]
  ------------------
 1026|      0|            dec.sig = 10 * dec.sig + (dec.has_last_digit ? dec.last_digit : 0);
  ------------------
  |  Branch (1026:39): [True: 0, False: 0]
  ------------------
 1027|      0|            dec.has_last_digit = false;
 1028|      0|            --dec_exp;
 1029|      0|         }
 1030|       |
 1031|   250k|         char* start = buffer;
 1032|   250k|         auto dig = to_digits<traits::num_bits, OptSize>(static_cast<uint64_t>(dec.sig), extra_digit, *c);
 1033|   250k|         constexpr int bcd_size = traits::num_bits == 64 ? 16 : 8;
  ------------------
  |  Branch (1033:35): [True: 0, Folded]
  ------------------
 1034|   250k|         if (dec_exp >= traits::min_fixed_dec_exp && dec_exp <= traits::max_fixed_dec_exp) {
  ------------------
  |  Branch (1034:14): [True: 246k, False: 4.11k]
  |  Branch (1034:54): [True: 239k, False: 6.66k]
  ------------------
 1035|   239k|            memcpy(start, &zeros_v, 8);
 1036|   239k|            const auto& fmt = dec_exp_formats.get<traits>(dec_exp);
 1037|   239k|            buffer += fmt.start_pos;
 1038|   239k|            memcpy(buffer, &dig.digits, bcd_size);
 1039|   239k|            memmove(buffer, buffer + !extra_digit, bcd_size);
 1040|   239k|            buffer[bcd_size + extra_digit - 1] = static_cast<char>('0' + (dec.has_last_digit ? dec.last_digit : 0));
  ------------------
  |  Branch (1040:75): [True: 896, False: 239k]
  ------------------
 1041|   239k|            memmove(start + fmt.shift_pos, start + fmt.point_pos, bcd_size);
 1042|   239k|            start[fmt.point_pos] = '.';
 1043|   239k|            int num_digits = dec.has_last_digit ? bcd_size : dig.num_digits - 1;
  ------------------
  |  Branch (1043:30): [True: 896, False: 239k]
  ------------------
 1044|   239k|            return buffer + fmt.exp_pos[num_digits + extra_digit - 1];
 1045|   239k|         }
 1046|  10.7k|         buffer += extra_digit;
 1047|  10.7k|         memcpy(buffer, &dig.digits, bcd_size);
 1048|  10.7k|         buffer[bcd_size] = static_cast<char>('0' + dec.last_digit);
 1049|  10.7k|         buffer += dec.has_last_digit ? bcd_size + 1 : dig.num_digits;
  ------------------
  |  Branch (1049:20): [True: 5.41k, False: 5.35k]
  ------------------
 1050|  10.7k|         start[0] = start[1];
 1051|  10.7k|         start[1] = '.';
 1052|  10.7k|         buffer -= (buffer - 1 == start + 1);
 1053|       |
 1054|  10.7k|         if constexpr (exp_string_table<OptSize>::enable) {
 1055|  10.7k|            uint64_t exp_data = exp_strings_v<OptSize>.data[dec_exp + exp_string_table<OptSize>::offset];
 1056|  10.7k|            int len = int(exp_data >> 48);
 1057|  10.7k|            if (is_big_endian) exp_data = bswap64(exp_data);
  ------------------
  |  Branch (1057:17): [Folded, False: 10.7k]
  ------------------
 1058|  10.7k|            memcpy(buffer, &exp_data, traits::max_exponent10 >= 100 ? 8 : 4);
  ------------------
  |  Branch (1058:39): [True: 10.7k, Folded]
  ------------------
 1059|  10.7k|            return buffer + len;
 1060|  10.7k|         }
 1061|       |         // Glaze emits uppercase 'E', omits '+' on positive exponents, and
 1062|       |         // drops the leading zero on single-digit exponents (E7, not E07).
 1063|       |         // Branchless: write "E-" always, then advance past the '-' only when
 1064|       |         // the exponent is negative.
 1065|      0|         bool neg = dec_exp < 0;
 1066|  10.7k|         buffer[0] = 'E';
 1067|  10.7k|         buffer[1] = '-';
 1068|  10.7k|         buffer += 1 + unsigned(neg);
 1069|  10.7k|         dec_exp = neg ? -dec_exp : dec_exp;
  ------------------
  |  Branch (1069:20): [True: 0, False: 10.7k]
  ------------------
 1070|  10.7k|         unsigned hundreds_written = 0;
 1071|  10.7k|         if constexpr (traits::max_exponent10 >= 100) {
 1072|  10.7k|            int32_t digit = 0;
 1073|       |            if constexpr (use_umul128_hi64) {
 1074|       |               digit = static_cast<int32_t>(umul128_hi64(static_cast<uint64_t>(dec_exp), 0x290000000000000ull));
 1075|       |            }
 1076|  10.7k|            else {
 1077|  10.7k|               digit = static_cast<int32_t>((uint32_t(dec_exp) * div100_sig) >> div100_exp);
 1078|  10.7k|            }
 1079|  10.7k|            *buffer = static_cast<char>('0' + digit);
 1080|  10.7k|            hundreds_written = unsigned(dec_exp >= 100);
 1081|  10.7k|            buffer += hundreds_written;
 1082|  10.7k|            dec_exp -= digit * 100;
 1083|  10.7k|         }
 1084|       |         // dec_exp now in [0, 99]. Skip the tens digit only when no higher
 1085|       |         // digit has been written (i.e. true leading zero, not interior).
 1086|  10.7k|         const char* d2 = digits2(dec_exp);
 1087|  10.7k|         *buffer = d2[0];
 1088|  10.7k|         buffer += hundreds_written | unsigned(dec_exp >= 10);
 1089|  10.7k|         *buffer = d2[1];
 1090|  10.7k|         return buffer + 1;
 1091|   250k|      }
_ZN3glz4zmij11detail_impl12float_traitsIdE7to_bitsEd:
  358|   496k|         {
  359|   496k|            sig_type bits;
  360|   496k|            memcpy(&bits, &value, sizeof(value));
  361|   496k|            return bits;
  362|   496k|         }
_ZN3glz4zmij11detail_impl12float_traitsIdE7get_expEm:
  367|   496k|         {
  368|   496k|            return static_cast<int32_t>((bits << 1) >> (num_sig_bits + 1));
  369|   496k|         }
_ZN3glz4zmij11detail_impl12float_traitsIdE7get_sigEm:
  365|   496k|         static auto get_sig(sig_type bits) noexcept -> sig_type { return bits & (implicit_bit - 1); }
_ZN3glz4zmij11detail_impl12float_traitsIdE11is_negativeEm:
  364|   551k|         static auto is_negative(sig_type bits) noexcept -> bool { return bits >> (num_bits - 1); }
_ZN3glz4zmij11detail_impl10to_decimalIdmLb0EEENS1_17to_decimal_resultET0_lbRKNS1_9constantsIXT1_EEE:
  868|   250k|      {
  869|   250k|         using traits = float_traits<Float>;
  870|   250k|         int64_t bin_exp = raw_exp - traits::exp_offset;
  871|   250k|         constexpr int num_bits = std::numeric_limits<UInt>::digits;
  872|       |
  873|   250k|         constexpr uint64_t log10_2_sig = 78'913;
  874|   250k|         constexpr int32_t log10_2_exp = 18;
  875|   250k|         int32_t dec_exp = 0;
  876|       |         if constexpr (use_umul128_hi64) {
  877|       |            dec_exp =
  878|       |               static_cast<int32_t>(umul128_hi64(static_cast<uint64_t>(bin_exp), log10_2_sig << (64 - log10_2_exp)));
  879|       |         }
  880|   250k|         else {
  881|   250k|            dec_exp = compute_dec_exp(bin_exp);
  882|   250k|         }
  883|   250k|         uint64_t even = 1 - (bin_sig & 1);
  884|   250k|         constexpr int32_t extra_shift = exp_shift_table<OptSize>::extra_shift;
  885|       |
  886|   250k|         if (!regular) [[unlikely]] {
  ------------------
  |  Branch (886:14): [True: 138k, False: 112k]
  ------------------
  887|   138k|            int32_t irregular_dec_exp = compute_dec_exp(bin_exp, false);
  888|   138k|            int32_t shift = compute_exp_shift(bin_exp, irregular_dec_exp + 1) + extra_shift;
  889|   138k|            uint128 pow10 = c.pow10_significands[-irregular_dec_exp - 1];
  890|   138k|            uint128 p = umul192_hi128(pow10.hi, pow10.lo, bin_sig << shift);
  891|       |
  892|   138k|            int64_t integral = p.hi >> extra_shift;
  893|   138k|            uint64_t fractional = p.hi << (64 - extra_shift) | p.lo >> extra_shift;
  894|       |
  895|   138k|            uint64_t half_ulp = pow10.hi >> (extra_shift + 1 - shift);
  896|   138k|            bool round_up = half_ulp > ~uint64_t(0) - fractional;
  897|   138k|            bool round_down = (half_ulp >> 1) > fractional;
  898|   138k|            integral += round_up;
  899|       |
  900|   138k|            int32_t digit = static_cast<int32_t>(umul128_add_hi64(fractional, 10, (uint64_t(1) << 63) - 1));
  901|   138k|            int32_t lo = static_cast<int32_t>(umul128_add_hi64(fractional - (half_ulp >> 1), 10, ~uint64_t(0)));
  902|   138k|            if (digit < lo) digit = lo;
  ------------------
  |  Branch (902:17): [True: 137k, False: 720]
  ------------------
  903|   138k|            return {integral, irregular_dec_exp, digit, (round_up + round_down) == 0};
  904|   138k|         }
  905|       |
  906|       |         if constexpr (num_bits == 32) {
  907|       |            constexpr int32_t float_extra_shift = 34;
  908|       |            int32_t shift = compute_exp_shift(bin_exp, dec_exp + 1) + float_extra_shift;
  909|       |            uint64_t pow10_hi = c.pow10_significands[-dec_exp - 1].hi;
  910|       |            uint64_t p = umul128_hi64(pow10_hi + 1, uint64_t(bin_sig) << shift);
  911|       |
  912|       |            int64_t integral = p >> float_extra_shift;
  913|       |            uint64_t fractional = p & ((1ull << float_extra_shift) - 1);
  914|       |
  915|       |            uint64_t half_ulp = (pow10_hi >> (65 - shift)) + even;
  916|       |            bool round_up = (fractional + half_ulp) >> float_extra_shift;
  917|       |            bool round_down = half_ulp > fractional;
  918|       |            integral += round_up;
  919|       |
  920|       |            uint64_t prod = fractional * 10;
  921|       |            int32_t digit = static_cast<int32_t>(prod >> float_extra_shift);
  922|       |            uint64_t rem = prod & ((1ull << float_extra_shift) - 1);
  923|       |            digit +=
  924|       |               rem > (1ull << (float_extra_shift - 1)) || (rem == (1ull << (float_extra_shift - 1)) && (digit & 1));
  925|       |            return {integral, dec_exp, digit, (round_up + round_down) == 0};
  926|       |         }
  927|   112k|         else {
  928|   112k|            int32_t shift = exp_shift_table<OptSize>::enable ? exp_shifts_v<OptSize>.data[bin_exp + traits::exp_offset]
  ------------------
  |  Branch (928:29): [True: 112k, Folded]
  ------------------
  929|   112k|                                                             : compute_exp_shift(bin_exp, dec_exp + 1) + extra_shift;
  930|   112k|            ZMIJ_ASM(("" : "+r"(dec_exp)));
  ------------------
  |  |  126|   112k|#define ZMIJ_ASM(x) asm x
  ------------------
  931|   112k|            uint128 pow10 = c.pow10_significands[-dec_exp - 1];
  932|   112k|            uint128 p = umul192_hi128(pow10.hi, pow10.lo, bin_sig << shift);
  933|   112k|            int64_t integral = p.hi >> extra_shift;
  934|   112k|            uint64_t fractional = p.hi << (64 - extra_shift) | p.lo >> extra_shift;
  935|   112k|            uint64_t half_ulp = (pow10.hi >> (extra_shift + 1 - shift)) + even;
  936|   112k|            bool round_up = fractional + half_ulp < fractional;
  937|   112k|            bool round_down = half_ulp > fractional;
  938|   112k|            integral += round_up;
  939|       |
  940|   112k|            int32_t digit = static_cast<int32_t>(umul128_add_hi64(fractional, 10, c.biased_half));
  941|   112k|            if (fractional == (1ull << 62)) [[unlikely]] {
  ------------------
  |  Branch (941:17): [True: 210, False: 112k]
  ------------------
  942|    210|               digit = 2;
  943|    210|            }
  944|   112k|            return {integral, dec_exp, digit, (round_up + round_down) == 0};
  945|   112k|         }
  946|   112k|      }
_ZN3glz4zmij11detail_impl15compute_dec_expElb:
  333|   388k|      {
  334|   388k|         assert(bin_exp >= -1334 && bin_exp <= 2620);
  ------------------
  |  Branch (334:10): [True: 388k, False: 0]
  |  Branch (334:10): [True: 388k, False: 0]
  |  Branch (334:10): [True: 388k, False: 0]
  ------------------
  335|   388k|         constexpr int log10_3_over_4_sig = 131'072;
  336|   388k|         constexpr int log10_2_sig = 315'653, log10_2_exp = 20;
  337|   388k|         return static_cast<int32_t>((bin_exp * log10_2_sig - !regular * log10_3_over_4_sig) >> log10_2_exp);
  338|   388k|      }
_ZN3glz4zmij11detail_impl17compute_exp_shiftEli:
  457|   138k|      {
  458|   138k|         assert(dec_exp >= -350 && dec_exp <= 350);
  ------------------
  |  Branch (458:10): [True: 138k, False: 0]
  |  Branch (458:10): [True: 138k, False: 0]
  |  Branch (458:10): [True: 138k, False: 0]
  ------------------
  459|   138k|         constexpr int log2_pow10_sig = 217'707, log2_pow10_exp = 16;
  460|   138k|         int pow10_bin_exp = -dec_exp * log2_pow10_sig >> log2_pow10_exp;
  461|   138k|         return static_cast<int32_t>(bin_exp + pow10_bin_exp + 1);
  462|   138k|      }
_ZNK3glz4zmij11detail_impl23pow10_significand_tableILb0EEixEi:
  440|   250k|         {
  441|   250k|            constexpr int dec_exp_min = -293;
  442|   250k|            int i = dec_exp - dec_exp_min;
  443|   250k|            if (compress) return compute(i);
  ------------------
  |  Branch (443:17): [Folded, False: 250k]
  ------------------
  444|   250k|            if (!split_tables) return {data[i * 2], data[i * 2 + 1]};
  ------------------
  |  Branch (444:17): [True: 250k, Folded]
  ------------------
  445|       |
  446|      0|            const uint64_t* hi = data + num_pow10s + dec_exp_min - 1;
  447|      0|            const uint64_t* lo = hi + num_pow10s;
  448|       |
  449|      0|            if !consteval {
  450|      0|               ZMIJ_ASM(volatile("" : "+r"(hi), "+r"(lo)));
  ------------------
  |  |  126|      0|#define ZMIJ_ASM(x) asm x
  ------------------
  451|      0|            }
  452|      0|            return {hi[-dec_exp], lo[-dec_exp]};
  453|   250k|         }
_ZN3glz4zmij11detail_impl13umul192_hi128Emmm:
  308|   250k|      {
  309|   250k|         uint128_t p = umul128(x_hi, y);
  310|   250k|         uint64_t lo = uint64_t(p) + uint64_t(umul128(x_lo, y) >> 64);
  311|   250k|         return {uint64_t(p >> 64) + (lo < uint64_t(p)), lo};
  312|   250k|      }
_ZN3glz4zmij11detail_impl7umul128Emm:
  265|   504k|      {
  266|   504k|#if ZMIJ_USE_INT128
  267|   504k|         return uint128_t(x) * y;
  268|       |#else
  269|       |#if defined(_M_AMD64)
  270|       |         if !consteval {
  271|       |            uint64_t hi = 0;
  272|       |            uint64_t lo = _umul128(x, y, &hi);
  273|       |            return {hi, lo};
  274|       |         }
  275|       |#elif defined(_M_ARM64)
  276|       |         if !consteval {
  277|       |            return {__umulh(x, y), x * y};
  278|       |         }
  279|       |#endif
  280|       |         uint64_t a = x >> 32;
  281|       |         uint64_t b = uint32_t(x);
  282|       |         uint64_t c = y >> 32;
  283|       |         uint64_t d = uint32_t(y);
  284|       |
  285|       |         uint64_t ac = a * c;
  286|       |         uint64_t bc = b * c;
  287|       |         uint64_t ad = a * d;
  288|       |         uint64_t bd = b * d;
  289|       |
  290|       |         uint64_t cs = (bd >> 32) + uint32_t(ad) + uint32_t(bc);
  291|       |         return {ac + (ad >> 32) + (bc >> 32) + (cs >> 32), (cs << 32) + uint32_t(bd)};
  292|       |#endif
  293|   504k|      }
_ZN3glz4zmij11detail_impl16umul128_add_hi64Emmm:
  298|   388k|      {
  299|   388k|#if ZMIJ_USE_INT128
  300|   388k|         return uint64_t((uint128_t(x) * y + c) >> 64);
  301|       |#else
  302|       |         auto p = umul128(x, y);
  303|       |         return p.hi + (p.lo + c < p.lo);
  304|       |#endif
  305|   388k|      }
_ZN3glz4zmij11detail_impl5div10Em:
  326|  2.98k|      {
  327|  2.98k|         assert(x <= (1ull << 62));
  ------------------
  |  Branch (327:10): [True: 2.98k, False: 0]
  ------------------
  328|  2.98k|         constexpr uint64_t div10_sig64 = (1ull << 63) / 5 + 1;
  329|  2.98k|         return ZMIJ_USE_INT128 ? umul128_hi64(x, div10_sig64) : x / 10;
  ------------------
  |  |  247|  2.98k|#define ZMIJ_USE_INT128 1
  |  |  ------------------
  |  |  |  Branch (247:25): [True: 2.98k, Folded]
  |  |  ------------------
  ------------------
  330|  2.98k|      }
_ZN3glz4zmij11detail_impl12umul128_hi64Emm:
  295|  2.98k|      constexpr auto umul128_hi64(uint64_t x, uint64_t y) noexcept -> uint64_t { return uint64_t(umul128(x, y) >> 64); }
_ZN3glz4zmij11detail_impl9to_digitsILi64ELb0EEENS1_10dec_digitsIXT_EEEmbRKNS1_9constantsIXT0_EEE:
  809|   250k|      {
  810|       |         if constexpr (num_bits == 32) {
  811|       |            auto result = to_bcd8<OptSize>(value);
  812|       |            return {result.bcd + zeros_v, result.len};
  813|       |         }
  814|   250k|         else {
  815|       |#if !ZMIJ_USE_NEON && !ZMIJ_USE_SSE
  816|       |            uint32_t bbccddee = uint32_t(value / 100'000'000);
  817|       |            uint32_t ffgghhii = uint32_t(value % 100'000'000);
  818|       |            auto hi = to_bcd8<OptSize>(bbccddee);
  819|       |            if (ffgghhii == 0) return {{hi.bcd + zeros_v, zeros_v}, hi.len};
  820|       |            auto lo = to_bcd8<OptSize>(ffgghhii);
  821|       |            return {{hi.bcd + zeros_v, lo.bcd + zeros_v}, 8 + lo.len};
  822|       |#elif ZMIJ_USE_NEON
  823|       |            auto unshuffled_digits = to_unshuffled_digits(value, c);
  824|       |            uint8x16_t digits = vrev64q_u8(unshuffled_digits);
  825|       |            uint16x8_t str = vaddq_u16(vreinterpretq_u16_u8(digits), vreinterpretq_u16_s8(vdupq_n_s8('0')));
  826|       |
  827|       |            // vcgtzq_s8 is AArch64-only; the portable spelling (ARMv7 NEON and
  828|       |            // up) is "compare greater-than against a zero vector".
  829|       |            uint16x8_t is_not_zero = vreinterpretq_u16_u8(vcgtq_s8(vreinterpretq_s8_u8(digits), vdupq_n_s8(0)));
  830|       |            uint64_t zeroes = vget_lane_u64(vreinterpret_u64_u8(vshrn_n_u16(is_not_zero, 4)), 0);
  831|       |            return {str, 16 - (clz(zeroes) >> 2)};
  832|       |#else
  833|   250k|            uint32_t abbccddee = uint32_t(value / 100'000'000);
  834|   250k|            uint32_t ffgghhii = uint32_t(value % 100'000'000);
  835|       |
  836|   250k|            const __m128i zeros = _mm_load_si128(m128ptr(&c.zeros));
  837|   250k|            auto unshuffled_bcd = to_unshuffled_digits(abbccddee, ffgghhii, c);
  838|       |#if ZMIJ_USE_SSE4_1
  839|       |            const __m128i bswap = _mm_load_si128(m128ptr(&c.bswap));
  840|       |            auto bcd = _mm_shuffle_epi8(unshuffled_bcd, bswap);
  841|       |#else
  842|   250k|            auto bcd = _mm_shuffle_epi32(unshuffled_bcd, _MM_SHUFFLE(0, 1, 2, 3));
  843|   250k|#endif
  844|       |
  845|   250k|            __m128i mask128 = _mm_cmpgt_epi8(bcd, _mm_setzero_si128());
  846|   250k|            uint64_t mask = _mm_movemask_epi8(mask128);
  847|       |#if defined(__LZCNT__) && !defined(ZMIJ_NO_BUILTINS)
  848|       |            int len = 32 - _lzcnt_u32(mask);
  849|       |#else
  850|   250k|            int len = 63 - clz((mask << 1) | 1);
  851|   250k|#endif
  852|   250k|            return {_mm_or_si128(bcd, zeros), len};
  853|   250k|#endif
  854|   250k|         }
  855|   250k|      }
_ZN3glz4zmij11detail_impl20to_unshuffled_digitsILb0EEEDv2_xjjRKNS1_9constantsIXT_EEE:
  735|   250k|      {
  736|   250k|         const __m128i div10k = _mm_load_si128(m128ptr(&c.div10k));
  737|   250k|         const __m128i neg10k = _mm_load_si128(m128ptr(&c.neg10k));
  738|   250k|         __m128i x = _mm_set_epi64x(bbccddee, ffgghhii);
  739|   250k|         __m128i y = _mm_add_epi64(x, _mm_mul_epu32(neg10k, _mm_srli_epi64(_mm_mul_epu32(x, div10k), div10k_exp)));
  740|   250k|         return to_bcd_4x4(y, c);
  741|   250k|      }
_ZN3glz4zmij11detail_impl10to_bcd_4x4ILb0EEEDv2_xS3_RKNS1_9constantsIXT_EEE:
  712|   250k|      {
  713|   250k|         const __m128i div100 = _mm_load_si128(m128ptr(&c.div100));
  714|   250k|         const __m128i div10 = _mm_load_si128(m128ptr(&c.div10));
  715|       |#if ZMIJ_USE_SSE4_1
  716|       |         const __m128i neg100 = _mm_load_si128(m128ptr(&c.neg100));
  717|       |         const __m128i neg10 = _mm_load_si128(m128ptr(&c.neg10));
  718|       |
  719|       |         __m128i z = _mm_add_epi64(y, _mm_mullo_epi32(neg100, _mm_srli_epi32(_mm_mulhi_epu16(y, div100), 3)));
  720|       |         return _mm_add_epi16(z, _mm_mullo_epi16(neg10, _mm_mulhi_epu16(z, div10)));
  721|       |#else
  722|   250k|         const __m128i hundred = _mm_load_si128(m128ptr(&c.hundred));
  723|   250k|         const __m128i moddiv10 = _mm_load_si128(m128ptr(&c.moddiv10));
  724|       |
  725|   250k|         __m128i y_div_100 = _mm_srli_epi16(_mm_mulhi_epu16(y, div100), 3);
  726|   250k|         __m128i y_mod_100 = _mm_sub_epi16(y, _mm_mullo_epi16(y_div_100, hundred));
  727|   250k|         __m128i z = _mm_or_si128(_mm_slli_epi32(y_mod_100, 16), y_div_100);
  728|   250k|         return _mm_sub_epi16(_mm_slli_epi16(z, 8), _mm_mullo_epi16(moddiv10, _mm_mulhi_epu16(z, div10)));
  729|   250k|#endif
  730|   250k|      }
_ZN3glz4zmij11detail_impl3clzEm:
  187|   250k|      {
  188|   250k|         assert(x != 0);
  ------------------
  |  Branch (188:10): [True: 250k, False: 0]
  ------------------
  189|   250k|#if ZMIJ_HAS_BUILTIN(__builtin_clzll)
  190|   250k|         return __builtin_clzll(x);
  191|       |#elif defined(_M_AMD64) && defined(__AVX2__)
  192|       |         return __lzcnt64(x);
  193|       |#elif defined(_M_AMD64) || defined(_M_ARM64)
  194|       |         unsigned long idx;
  195|       |         _BitScanReverse64(&idx, x);
  196|       |         return 63 - idx;
  197|       |#elif ZMIJ_MSC_VER
  198|       |         unsigned long idx;
  199|       |         if (_BitScanReverse(&idx, uint32_t(x >> 32))) return 31 - idx;
  200|       |         _BitScanReverse(&idx, uint32_t(x));
  201|       |         return 63 - idx;
  202|       |#else
  203|       |         int n = 64;
  204|       |         for (; x > 0; x >>= 1) --n;
  205|       |         return n;
  206|       |#endif
  207|   250k|      }
_ZNK3glz4zmij11detail_impl20dec_exp_format_table3getINS1_12float_traitsIdEEEERKNS2_5entryEi:
  559|   239k|         {
  560|   239k|            constexpr auto min = traits::min_fixed_dec_exp, max = Traits::max_fixed_dec_exp;
  561|   239k|            unsigned i = unsigned(dec_exp - min);
  562|   239k|            return data[i <= unsigned(max - min) ? i : num_entries - 1];
  ------------------
  |  Branch (562:25): [True: 239k, False: 0]
  ------------------
  563|   239k|         }

_ZNK3glz4yaml12yaml_context12indent_stackMUlvE_clEv:
  101|  7.60M|      std::vector<int16_t> indent_stack = [] {
  102|  7.60M|         std::vector<int16_t> v;
  103|  7.60M|         v.reserve(max_yaml_recursive_depth);
  104|  7.60M|         return v;
  105|  7.60M|      }();
_ZN3glz4yaml12yaml_context16reset_read_stateEv:
  382|   159k|      {
  383|   159k|         indent_stack.clear();
  384|   159k|         anchors.clear();
  385|   159k|         active_alias_spans.clear();
  386|   159k|         sequence_item_value_context = false;
  387|   159k|         forced_block_mapping_indent = -1;
  388|   159k|         sequence_dash_indent = -1;
  389|   159k|         explicit_mapping_key_context = false;
  390|   159k|         allow_indentless_sequence = false;
  391|   159k|         reset_line_memo();
  392|   159k|      }
_ZNK3glz4yaml12yaml_context15reset_line_memoEv:
  328|   159k|      {
  329|   159k|         memo_line_begin = nullptr;
  330|   159k|         memo_verified_end = nullptr;
  331|   159k|         memo_first_tab = nullptr;
  332|   159k|         memo_first_content = nullptr;
  333|   159k|      }
_ZN3glz4yaml19skip_document_startIRPKcS3_NS0_12yaml_contextEEEvOT_T0_RT1_:
 1245|   159k|   {
 1246|   159k|      ctx.secondary_tag_handle_overridden = false;
 1247|       |
 1248|       |      // Skip leading blank/comment-only lines before directives or document start.
 1249|   165k|      while (it != end) {
  ------------------
  |  Branch (1249:14): [True: 165k, False: 66]
  ------------------
 1250|   165k|         auto line = it;
 1251|   165k|         skip_inline_ws(line, end);
 1252|   165k|         if (line == end) {
  ------------------
  |  Branch (1252:14): [True: 20, False: 165k]
  ------------------
 1253|     20|            it = line;
 1254|     20|            break;
 1255|     20|         }
 1256|   165k|         if (*line == '#') {
  ------------------
  |  Branch (1256:14): [True: 1.12k, False: 164k]
  ------------------
 1257|  1.12k|            it = line;
 1258|  1.12k|            skip_comment(it, end);
 1259|  1.12k|            skip_newline(it, end);
 1260|  1.12k|            continue;
 1261|  1.12k|         }
 1262|   164k|         if (*line == '\n' || *line == '\r') {
  ------------------
  |  Branch (1262:14): [True: 1.84k, False: 162k]
  |  Branch (1262:31): [True: 2.66k, False: 159k]
  ------------------
 1263|  4.50k|            it = line;
 1264|  4.50k|            skip_newline(it, end);
 1265|  4.50k|            continue;
 1266|  4.50k|         }
 1267|   159k|         it = line;
 1268|   159k|         break;
 1269|   164k|      }
 1270|       |
 1271|       |      // Track if we've seen a %YAML directive (duplicates are an error per spec)
 1272|   159k|      bool seen_yaml_directive = false;
 1273|   159k|      bool saw_any_directive = false;
 1274|   159k|      bool consumed_document_start = false;
 1275|       |
 1276|       |      // Process YAML directives (lines starting with %) until we hit --- or content
 1277|       |      // Directives must appear at the start of a line and before ---
 1278|   169k|      while (it != end && *it == '%') {
  ------------------
  |  Branch (1278:14): [True: 168k, False: 608]
  |  Branch (1278:27): [True: 9.82k, False: 159k]
  ------------------
 1279|  9.82k|         saw_any_directive = true;
 1280|  9.82k|         ++it; // Skip the '%'
 1281|       |
 1282|       |         // Parse directive name
 1283|  9.82k|         auto name_start = it;
 1284|   120k|         while (it != end && *it != ' ' && *it != '\t' && *it != '\n' && *it != '\r') {
  ------------------
  |  Branch (1284:17): [True: 120k, False: 172]
  |  Branch (1284:30): [True: 117k, False: 3.26k]
  |  Branch (1284:44): [True: 112k, False: 4.86k]
  |  Branch (1284:59): [True: 111k, False: 988]
  |  Branch (1284:74): [True: 111k, False: 536]
  ------------------
 1285|   111k|            ++it;
 1286|   111k|         }
 1287|  9.82k|         std::string_view directive_name(name_start, static_cast<size_t>(it - name_start));
 1288|       |
 1289|       |         // Check for %YAML directive
 1290|  9.82k|         if (directive_name == "YAML") {
  ------------------
  |  Branch (1290:14): [True: 184, False: 9.64k]
  ------------------
 1291|       |            // Error on duplicate %YAML directive (per spec: "It is an error to specify
 1292|       |            // more than one YAML directive for the same document")
 1293|    184|            if (seen_yaml_directive) {
  ------------------
  |  Branch (1293:17): [True: 6, False: 178]
  ------------------
 1294|      6|               ctx.error = error_code::syntax_error;
 1295|      6|               return;
 1296|      6|            }
 1297|    178|            seen_yaml_directive = true;
 1298|       |
 1299|       |            // Skip whitespace before version
 1300|    710|            while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (1300:20): [True: 696, False: 14]
  |  Branch (1300:34): [True: 348, False: 348]
  |  Branch (1300:48): [True: 184, False: 164]
  ------------------
 1301|    532|               ++it;
 1302|    532|            }
 1303|       |
 1304|       |            // Parse major.minor version and reject malformed forms.
 1305|    178|            if (it == end || *it < '0' || *it > '9') {
  ------------------
  |  Branch (1305:17): [True: 14, False: 164]
  |  Branch (1305:30): [True: 20, False: 144]
  |  Branch (1305:43): [True: 4, False: 140]
  ------------------
 1306|     38|               ctx.error = error_code::syntax_error;
 1307|     38|               return;
 1308|     38|            }
 1309|       |            // Clamp rather than accumulate without bound. An int accumulator overflows on a long
 1310|       |            // digit run -- undefined behavior, and in practice a wrap that carries a huge version
 1311|       |            // back into the accepted range, so "%YAML 4294967296.0" was read as major version 0.
 1312|       |            //
 1313|       |            // Clamping is safe because the accumulator only grows: it stops updating once it has
 1314|       |            // already reached max_tracked_version, so a clamped value is always at least that
 1315|       |            // large, and the clamp is far above the threshold checked below. A version big enough
 1316|       |            // to freeze the accumulator therefore still compares greater and is still rejected.
 1317|       |            // The bound is deliberately independent of that threshold, so raising the threshold
 1318|       |            // later cannot quietly reintroduce the wrap. Peak value is 999, well inside int.
 1319|    140|            constexpr int max_tracked_version = 100;
 1320|    140|            int major_version = 0;
 1321|    704|            while (it != end && *it >= '0' && *it <= '9') {
  ------------------
  |  Branch (1321:20): [True: 688, False: 16]
  |  Branch (1321:33): [True: 568, False: 120]
  |  Branch (1321:47): [True: 564, False: 4]
  ------------------
 1322|    564|               if (major_version < max_tracked_version) {
  ------------------
  |  Branch (1322:20): [True: 356, False: 208]
  ------------------
 1323|    356|                  major_version = major_version * 10 + (*it - '0');
 1324|    356|               }
 1325|    564|               ++it;
 1326|    564|            }
 1327|    140|            if (it == end || *it != '.') {
  ------------------
  |  Branch (1327:17): [True: 16, False: 124]
  |  Branch (1327:30): [True: 36, False: 88]
  ------------------
 1328|     52|               ctx.error = error_code::syntax_error;
 1329|     52|               return;
 1330|     52|            }
 1331|     88|            ++it; // skip '.'
 1332|     88|            if (it == end || *it < '0' || *it > '9') {
  ------------------
  |  Branch (1332:17): [True: 2, False: 86]
  |  Branch (1332:30): [True: 6, False: 80]
  |  Branch (1332:43): [True: 4, False: 76]
  ------------------
 1333|     12|               ctx.error = error_code::syntax_error;
 1334|     12|               return;
 1335|     12|            }
 1336|    328|            while (it != end && *it >= '0' && *it <= '9') {
  ------------------
  |  Branch (1336:20): [True: 322, False: 6]
  |  Branch (1336:33): [True: 256, False: 66]
  |  Branch (1336:47): [True: 252, False: 4]
  ------------------
 1337|    252|               ++it;
 1338|    252|            }
 1339|       |
 1340|       |            // Check for major version > 1 (per spec: should be rejected)
 1341|     76|            if (major_version > 1) {
  ------------------
  |  Branch (1341:17): [True: 4, False: 72]
  ------------------
 1342|      4|               ctx.error = error_code::syntax_error;
 1343|      4|               return;
 1344|      4|            }
 1345|       |
 1346|       |            // After the version, only spaces/tabs and optional comment are allowed.
 1347|       |            // A '#' must be separated by at least one space.
 1348|     72|            if (it != end && *it == '#') {
  ------------------
  |  Branch (1348:17): [True: 68, False: 4]
  |  Branch (1348:30): [True: 4, False: 64]
  ------------------
 1349|      4|               ctx.error = error_code::syntax_error;
 1350|      4|               return;
 1351|      4|            }
 1352|    456|            while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (1352:20): [True: 446, False: 10]
  |  Branch (1352:34): [True: 196, False: 250]
  |  Branch (1352:48): [True: 192, False: 58]
  ------------------
 1353|    388|               ++it;
 1354|    388|            }
 1355|     68|            if (it != end && *it != '\n' && *it != '\r' && *it != '#') {
  ------------------
  |  Branch (1355:17): [True: 58, False: 10]
  |  Branch (1355:30): [True: 54, False: 4]
  |  Branch (1355:45): [True: 46, False: 8]
  |  Branch (1355:60): [True: 42, False: 4]
  ------------------
 1356|     42|               ctx.error = error_code::syntax_error;
 1357|     42|               return;
 1358|     42|            }
 1359|     68|         }
 1360|  9.64k|         else if (directive_name == "TAG") {
  ------------------
  |  Branch (1360:19): [True: 5.80k, False: 3.83k]
  ------------------
 1361|  15.6k|            while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (1361:20): [True: 15.6k, False: 16]
  |  Branch (1361:34): [True: 5.22k, False: 10.4k]
  |  Branch (1361:48): [True: 4.61k, False: 5.79k]
  ------------------
 1362|  9.84k|               ++it;
 1363|  9.84k|            }
 1364|       |
 1365|  5.80k|            auto handle_start = it;
 1366|   276k|            while (it != end && *it != ' ' && *it != '\t' && *it != '\n' && *it != '\r') {
  ------------------
  |  Branch (1366:20): [True: 276k, False: 54]
  |  Branch (1366:33): [True: 271k, False: 5.21k]
  |  Branch (1366:47): [True: 270k, False: 532]
  |  Branch (1366:62): [True: 270k, False: 4]
  |  Branch (1366:77): [True: 270k, False: 4]
  ------------------
 1367|   270k|               ++it;
 1368|   270k|            }
 1369|  5.80k|            const std::string_view handle(handle_start, static_cast<size_t>(it - handle_start));
 1370|       |
 1371|  12.4k|            while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (1371:20): [True: 12.3k, False: 78]
  |  Branch (1371:34): [True: 5.84k, False: 6.48k]
  |  Branch (1371:48): [True: 760, False: 5.72k]
  ------------------
 1372|  6.60k|               ++it;
 1373|  6.60k|            }
 1374|       |
 1375|  5.80k|            auto prefix_start = it;
 1376|  39.6k|            while (it != end && *it != ' ' && *it != '\t' && *it != '\n' && *it != '\r') {
  ------------------
  |  Branch (1376:20): [True: 39.4k, False: 150]
  |  Branch (1376:33): [True: 36.3k, False: 3.13k]
  |  Branch (1376:47): [True: 36.1k, False: 232]
  |  Branch (1376:62): [True: 34.1k, False: 1.98k]
  |  Branch (1376:77): [True: 33.8k, False: 308]
  ------------------
 1377|  33.8k|               ++it;
 1378|  33.8k|            }
 1379|  5.80k|            const std::string_view prefix(prefix_start, static_cast<size_t>(it - prefix_start));
 1380|       |
 1381|  5.80k|            if (handle.empty() || prefix.empty()) {
  ------------------
  |  Branch (1381:17): [True: 24, False: 5.78k]
  |  Branch (1381:35): [True: 62, False: 5.72k]
  ------------------
 1382|     86|               ctx.error = error_code::syntax_error;
 1383|     86|               return;
 1384|     86|            }
 1385|       |
 1386|  5.72k|            if (handle == "!!") {
  ------------------
  |  Branch (1386:17): [True: 1.44k, False: 4.27k]
  ------------------
 1387|  1.44k|               ctx.secondary_tag_handle_overridden = (prefix != "tag:yaml.org,2002:");
 1388|  1.44k|            }
 1389|  5.72k|         }
 1390|       |         // %TAG and other directives are silently skipped (per spec: should be ignored)
 1391|       |
 1392|       |         // Skip to end of directive line
 1393|  99.7k|         while (it != end && *it != '\n' && *it != '\r') {
  ------------------
  |  Branch (1393:17): [True: 99.3k, False: 420]
  |  Branch (1393:30): [True: 92.7k, False: 6.60k]
  |  Branch (1393:45): [True: 90.1k, False: 2.55k]
  ------------------
 1394|  90.1k|            ++it;
 1395|  90.1k|         }
 1396|       |         // Skip the newline
 1397|  9.58k|         skip_newline(it, end);
 1398|       |         // Skip blank and comment-only lines between directives and document start.
 1399|  11.7k|         while (it != end) {
  ------------------
  |  Branch (1399:17): [True: 11.2k, False: 512]
  ------------------
 1400|  11.2k|            auto line = it;
 1401|  11.2k|            skip_inline_ws(line, end);
 1402|  11.2k|            if (line == end) {
  ------------------
  |  Branch (1402:17): [True: 10, False: 11.2k]
  ------------------
 1403|     10|               it = line;
 1404|     10|               break;
 1405|     10|            }
 1406|  11.2k|            if (*line == '#') {
  ------------------
  |  Branch (1406:17): [True: 700, False: 10.5k]
  ------------------
 1407|    700|               it = line;
 1408|    700|               skip_comment(it, end);
 1409|    700|               skip_newline(it, end);
 1410|    700|               continue;
 1411|    700|            }
 1412|  10.5k|            if (*line == '\n' || *line == '\r') {
  ------------------
  |  Branch (1412:17): [True: 748, False: 9.82k]
  |  Branch (1412:34): [True: 764, False: 9.05k]
  ------------------
 1413|  1.51k|               it = line;
 1414|  1.51k|               skip_newline(it, end);
 1415|  1.51k|               continue;
 1416|  1.51k|            }
 1417|  9.05k|            break;
 1418|  10.5k|         }
 1419|  9.58k|      }
 1420|       |
 1421|       |      // Check for ---
 1422|   159k|      if (end - it >= 3 && it[0] == '-' && it[1] == '-' && it[2] == '-') {
  ------------------
  |  Branch (1422:11): [True: 157k, False: 2.02k]
  |  Branch (1422:28): [True: 4.31k, False: 153k]
  |  Branch (1422:44): [True: 310, False: 4.00k]
  |  Branch (1422:60): [True: 272, False: 38]
  ------------------
 1423|    272|         auto after = it + 3;
 1424|       |         // Must be followed by whitespace, newline, or end
 1425|    272|         if (after == end || *after == ' ' || *after == '\t' || *after == '\n' || *after == '\r' || *after == '#') {
  ------------------
  |  Branch (1425:14): [True: 4, False: 268]
  |  Branch (1425:30): [True: 60, False: 208]
  |  Branch (1425:47): [True: 68, False: 140]
  |  Branch (1425:65): [True: 36, False: 104]
  |  Branch (1425:83): [True: 32, False: 72]
  |  Branch (1425:101): [True: 24, False: 48]
  ------------------
 1426|    224|            auto content = after;
 1427|    744|            while (content != end && (*content == ' ' || *content == '\t')) {
  ------------------
  |  Branch (1427:20): [True: 728, False: 16]
  |  Branch (1427:39): [True: 260, False: 468]
  |  Branch (1427:58): [True: 260, False: 208]
  ------------------
 1428|    520|               ++content;
 1429|    520|            }
 1430|       |            // Per yaml-test-suite, block mappings cannot begin on the same line as '---'.
 1431|    224|            if (content != end && *content != '\n' && *content != '\r' && *content != '#' &&
  ------------------
  |  Branch (1431:17): [True: 208, False: 16]
  |  Branch (1431:35): [True: 172, False: 36]
  |  Branch (1431:55): [True: 136, False: 36]
  |  Branch (1431:75): [True: 112, False: 24]
  ------------------
 1432|    112|                line_could_be_block_mapping(content, end)) {
  ------------------
  |  Branch (1432:17): [True: 22, False: 90]
  ------------------
 1433|     22|               ctx.error = error_code::syntax_error;
 1434|     22|               return;
 1435|     22|            }
 1436|    202|            consumed_document_start = true;
 1437|    202|            it = after;
 1438|       |            // Skip rest of line (whitespace and optional comment)
 1439|    202|            skip_ws_and_comment(it, end);
 1440|    202|            skip_newline(it, end);
 1441|    202|         }
 1442|    272|      }
 1443|       |
 1444|       |      // A directives section must be followed by a document start marker.
 1445|   159k|      if (saw_any_directive && !consumed_document_start) {
  ------------------
  |  Branch (1445:11): [True: 776, False: 158k]
  |  Branch (1445:32): [True: 746, False: 30]
  ------------------
 1446|    746|         ctx.error = error_code::syntax_error;
 1447|    746|         return;
 1448|    746|      }
 1449|   159k|   }
_ZN3glz4yaml14skip_inline_wsIRPKcS3_EEvOT_T0_:
  941|   150M|   {
  942|   205M|      while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (942:14): [True: 204M, False: 889k]
  |  Branch (942:28): [True: 54.2M, False: 150M]
  |  Branch (942:42): [True: 1.30M, False: 149M]
  ------------------
  943|  55.5M|         ++it;
  944|  55.5M|      }
  945|   150M|   }
_ZN3glz4yaml12skip_commentIRPKcS3_EEvOT_T0_:
  950|  9.49M|   {
  951|  9.49M|      if (it != end && *it == '#') {
  ------------------
  |  Branch (951:11): [True: 8.90M, False: 593k]
  |  Branch (951:24): [True: 1.94M, False: 6.96M]
  ------------------
  952|       |         // Stops on a forbidden control byte rather than consuming it, leaving the
  953|       |         // caller's line-end validation to reject the document.
  954|   214M|         while (it != end && !comment_end_or_control_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (954:17): [True: 214M, False: 67.7k]
  |  Branch (954:30): [True: 212M, False: 1.87M]
  ------------------
  955|   212M|            ++it;
  956|   212M|         }
  957|  1.94M|      }
  958|  9.49M|   }
_ZN3glz4yaml27line_could_be_block_mappingIPKcS3_EEbT_T0_:
 1156|  3.05M|   {
 1157|  3.05M|      const auto stop = implicit_key_scan_end(it, end);
 1158|       |      // A quote is an indicator only where a node can begin. Once a plain scalar is under way it
 1159|       |      // runs to the end of the line, and the spaces and quotes inside it are content ("a 'b'" is
 1160|       |      // one plain scalar, "a '''" likewise), so the guard is whether a node starts here rather
 1161|       |      // than what the preceding character was. A node starts at the beginning of the scan, after
 1162|       |      // an indicator that ends the node before it, and after the properties that precede one. The
 1163|       |      // other implicit-key probes carry the same model and point here for it.
 1164|  3.05M|      bool at_node_start = true;
 1165|  3.05M|      bool prev_was_whitespace = true; // For the '#' rule, which is about the preceding character
 1166|  3.05M|      int flow_depth = 0;
 1167|  65.9M|      while (it != stop) {
  ------------------
  |  Branch (1167:14): [True: 65.6M, False: 340k]
  ------------------
 1168|  65.6M|         const char c = *it;
 1169|  65.6M|         if (c == '\n' || c == '\r') {
  ------------------
  |  Branch (1169:14): [True: 607k, False: 64.9M]
  |  Branch (1169:27): [True: 762k, False: 64.2M]
  ------------------
 1170|  1.37M|            return false;
 1171|  1.37M|         }
 1172|  64.2M|         if (c == ' ' || c == '\t') {
  ------------------
  |  Branch (1172:14): [True: 5.40M, False: 58.8M]
  |  Branch (1172:26): [True: 1.03M, False: 57.7M]
  ------------------
 1173|  6.44M|            prev_was_whitespace = true; // Whitespace separates nodes, it does not end one
 1174|  6.44M|            ++it;
 1175|  6.44M|            continue;
 1176|  6.44M|         }
 1177|       |         // Past here `c` is an indicator or content. Either way it ends a run of whitespace, and
 1178|       |         // unless a branch below says otherwise it begins a plain scalar that owns the rest of the
 1179|       |         // line, so both flags clear by default and a branch opts back in.
 1180|  57.7M|         const bool after_whitespace = std::exchange(prev_was_whitespace, false);
 1181|  57.7M|         const bool node_start = std::exchange(at_node_start, false);
 1182|       |
 1183|  57.7M|         if (c == ':' && flow_depth == 0) {
  ------------------
  |  Branch (1183:14): [True: 2.77M, False: 55.0M]
  |  Branch (1183:26): [True: 1.90M, False: 863k]
  ------------------
 1184|  1.90M|            ++it;
 1185|       |            // Colon followed by space, newline, or end indicates a mapping key
 1186|  1.90M|            if (it == end || *it == ' ' || *it == '\t' || *it == '\n' || *it == '\r') {
  ------------------
  |  Branch (1186:17): [True: 88.1k, False: 1.82M]
  |  Branch (1186:30): [True: 801k, False: 1.01M]
  |  Branch (1186:44): [True: 52.0k, False: 967k]
  |  Branch (1186:59): [True: 99.8k, False: 867k]
  |  Branch (1186:74): [True: 117k, False: 749k]
  ------------------
 1187|  1.15M|               return true;
 1188|  1.15M|            }
 1189|       |            // Otherwise this ':' is part of plain content (e.g., "::", "http://").
 1190|       |            // Continue scanning for a later mapping separator on the same line.
 1191|   749k|            continue;
 1192|  1.90M|         }
 1193|       |         // Per YAML spec: # only starts a comment when preceded by whitespace
 1194|       |         // Stop scanning if we hit a comment - any colon after is not a key indicator
 1195|  55.8M|         if (c == '#' && flow_depth == 0 && after_whitespace) {
  ------------------
  |  Branch (1195:14): [True: 931k, False: 54.9M]
  |  Branch (1195:26): [True: 827k, False: 103k]
  |  Branch (1195:45): [True: 153k, False: 674k]
  ------------------
 1196|   153k|            return false;
 1197|   153k|         }
 1198|  55.7M|         if ((c == '"' || c == '\'') && node_start) {
  ------------------
  |  Branch (1198:15): [True: 434k, False: 55.2M]
  |  Branch (1198:27): [True: 67.7k, False: 55.2M]
  |  Branch (1198:41): [True: 352k, False: 149k]
  ------------------
 1199|   352k|            if (not skip_probe_quoted_scalar(it, stop)) {
  ------------------
  |  Branch (1199:17): [True: 33.3k, False: 318k]
  ------------------
 1200|  33.3k|               return false;
 1201|  33.3k|            }
 1202|   318k|            continue;
 1203|   352k|         }
 1204|       |         // A flow collection opens only where a node can begin, and thereafter every bracket is
 1205|       |         // an indicator because ns-plain-safe-in excludes them. In block context a plain scalar
 1206|       |         // already under way swallows them instead: "a['][]" is one plain key.
 1207|  55.3M|         if ((c == '[' || c == '{') && (node_start || flow_depth > 0)) {
  ------------------
  |  Branch (1207:15): [True: 424k, False: 54.9M]
  |  Branch (1207:27): [True: 777k, False: 54.1M]
  |  Branch (1207:41): [True: 770k, False: 431k]
  |  Branch (1207:55): [True: 118k, False: 312k]
  ------------------
 1208|   888k|            ++flow_depth;
 1209|   888k|            at_node_start = true;
 1210|   888k|            ++it;
 1211|   888k|            continue;
 1212|   888k|         }
 1213|  54.4M|         if ((c == ']' || c == '}') && flow_depth > 0) {
  ------------------
  |  Branch (1213:15): [True: 149k, False: 54.3M]
  |  Branch (1213:27): [True: 415k, False: 53.9M]
  |  Branch (1213:40): [True: 182k, False: 382k]
  ------------------
 1214|   182k|            --flow_depth; // A closing bracket ends a node; it never starts one
 1215|   182k|            ++it;
 1216|   182k|            continue;
 1217|   182k|         }
 1218|       |         // Inside a flow collection ',' separates entries and ':' ends a key, so a node begins
 1219|       |         // after either. Outside one both are ordinary plain content -- ns-plain-safe-out admits
 1220|       |         // them, which is why "a,'b: c" is a single plain key and "a[b]'c: d" another.
 1221|  54.2M|         if (flow_depth > 0 && (c == ',' || c == ':')) {
  ------------------
  |  Branch (1221:14): [True: 7.22M, False: 47.0M]
  |  Branch (1221:33): [True: 660k, False: 6.56M]
  |  Branch (1221:45): [True: 863k, False: 5.69M]
  ------------------
 1222|  1.52M|            at_node_start = true;
 1223|  1.52M|            ++it;
 1224|  1.52M|            continue;
 1225|  1.52M|         }
 1226|  52.7M|         if (node_start && skip_probe_node_property(it, stop)) {
  ------------------
  |  Branch (1226:14): [True: 4.39M, False: 48.3M]
  |  Branch (1226:28): [True: 1.43M, False: 2.95M]
  ------------------
 1227|  1.43M|            at_node_start = true; // Properties precede the node, so it is still starting
 1228|  1.43M|            continue;
 1229|  1.43M|         }
 1230|  51.3M|         ++it;
 1231|  51.3M|      }
 1232|   340k|      return false;
 1233|  3.05M|   }
_ZN3glz4yaml21implicit_key_scan_endIPKcS3_EET_S4_T0_:
   89|  15.2M|   {
   90|  15.2M|      const size_t remaining = size_t(end - it);
   91|  15.2M|      return it + (remaining < max_implicit_key_lookahead ? remaining : max_implicit_key_lookahead);
  ------------------
  |  Branch (91:20): [True: 12.2M, False: 3.04M]
  ------------------
   92|  15.2M|   }
_ZN3glz4yaml24skip_probe_quoted_scalarIPKcS3_EEbRT_T0_:
 1089|  1.35M|   {
 1090|  1.35M|      const char quote = *it;
 1091|  1.35M|      ++it;
 1092|  5.74M|      while (it != stop) {
  ------------------
  |  Branch (1092:14): [True: 5.72M, False: 15.0k]
  ------------------
 1093|  5.72M|         const char c = *it;
 1094|  5.72M|         if (c == '\n' || c == '\r') {
  ------------------
  |  Branch (1094:14): [True: 21.3k, False: 5.70M]
  |  Branch (1094:27): [True: 74.0k, False: 5.63M]
  ------------------
 1095|  95.3k|            return false;
 1096|  95.3k|         }
 1097|  5.63M|         if (c == quote) {
  ------------------
  |  Branch (1097:14): [True: 1.24M, False: 4.38M]
  ------------------
 1098|  1.24M|            ++it;
 1099|  1.24M|            if (quote == '\'' && it != stop && *it == '\'') {
  ------------------
  |  Branch (1099:17): [True: 67.6k, False: 1.17M]
  |  Branch (1099:34): [True: 62.6k, False: 4.96k]
  |  Branch (1099:48): [True: 25.7k, False: 36.8k]
  ------------------
 1100|  25.7k|               ++it; // '' is an escaped quote, not the end of the scalar
 1101|  25.7k|               continue;
 1102|  25.7k|            }
 1103|       |            // A closing quote on the last byte of the window reports closed, though the byte past
 1104|       |            // it could have made the pair an escape. Harmless: `it` is then `stop`, so the caller's
 1105|       |            // loop ends and the probe answers false either way.
 1106|  1.21M|            return true;
 1107|  1.24M|         }
 1108|  4.38M|         if (c == '\\' && quote == '"') {
  ------------------
  |  Branch (1108:14): [True: 72.1k, False: 4.31M]
  |  Branch (1108:27): [True: 66.3k, False: 5.77k]
  ------------------
 1109|  66.3k|            ++it; // Skip escape character
 1110|  66.3k|            if (it == stop) {
  ------------------
  |  Branch (1110:17): [True: 6.49k, False: 59.8k]
  ------------------
 1111|  6.49k|               return false;
 1112|  6.49k|            }
 1113|  59.8k|            if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (1113:17): [True: 9.30k, False: 50.5k]
  |  Branch (1113:32): [True: 7.01k, False: 43.5k]
  ------------------
 1114|  16.3k|               return false;
 1115|  16.3k|            }
 1116|  59.8k|         }
 1117|  4.36M|         ++it;
 1118|  4.36M|      }
 1119|  15.0k|      return false;
 1120|  1.35M|   }
_ZN3glz4yaml24skip_probe_node_propertyIPKcS3_EEbRT_T0_:
 1128|  19.9M|   {
 1129|  19.9M|      const char c = *it;
 1130|  19.9M|      if (c == '&' || c == '!') {
  ------------------
  |  Branch (1130:11): [True: 2.67M, False: 17.2M]
  |  Branch (1130:23): [True: 1.62M, False: 15.6M]
  ------------------
 1131|       |         // An anchor name and a tag shorthand both run to the next whitespace or flow indicator.
 1132|  4.29M|         ++it;
 1133|   627M|         while (it != stop && *it != ' ' && *it != '\t' && *it != ',' && *it != '[' && *it != ']' && *it != '{' &&
  ------------------
  |  Branch (1133:17): [True: 627M, False: 102k]
  |  Branch (1133:31): [True: 624M, False: 2.44M]
  |  Branch (1133:45): [True: 624M, False: 718k]
  |  Branch (1133:60): [True: 624M, False: 89.8k]
  |  Branch (1133:74): [True: 623M, False: 89.5k]
  |  Branch (1133:88): [True: 623M, False: 24.4k]
  |  Branch (1133:102): [True: 623M, False: 352k]
  ------------------
 1134|   623M|                *it != '}' && *it != '\n' && *it != '\r') {
  ------------------
  |  Branch (1134:17): [True: 623M, False: 81.4k]
  |  Branch (1134:31): [True: 623M, False: 201k]
  |  Branch (1134:46): [True: 623M, False: 197k]
  ------------------
 1135|   623M|            ++it;
 1136|   623M|         }
 1137|  4.29M|         return true;
 1138|  4.29M|      }
 1139|       |      // Only "? " is the explicit key indicator; "?foo" is an ordinary plain scalar.
 1140|  15.6M|      if (c == '?') {
  ------------------
  |  Branch (1140:11): [True: 871k, False: 14.7M]
  ------------------
 1141|   871k|         const auto next = it + 1;
 1142|   871k|         if (next != stop && (*next == ' ' || *next == '\t')) {
  ------------------
  |  Branch (1142:14): [True: 868k, False: 3.02k]
  |  Branch (1142:31): [True: 302k, False: 566k]
  |  Branch (1142:47): [True: 2.16k, False: 563k]
  ------------------
 1143|   304k|            ++it;
 1144|   304k|            return true;
 1145|   304k|         }
 1146|   871k|      }
 1147|  15.3M|      return false;
 1148|  15.6M|   }
_ZN3glz4yaml19skip_ws_and_commentIRPKcS3_EEvOT_T0_:
  963|  2.60M|   {
  964|  2.60M|      skip_inline_ws(it, end);
  965|  2.60M|      skip_comment(it, end);
  966|  2.60M|   }
_ZN3glz4yaml17at_document_startIRPKcS3_EEbOT_T0_:
 1455|  7.65M|   {
 1456|  7.65M|      if (end - it >= 3 && it[0] == '-' && it[1] == '-' && it[2] == '-') {
  ------------------
  |  Branch (1456:11): [True: 7.34M, False: 312k]
  |  Branch (1456:28): [True: 388k, False: 6.95M]
  |  Branch (1456:44): [True: 50.9k, False: 337k]
  |  Branch (1456:60): [True: 39.9k, False: 11.0k]
  ------------------
 1457|  39.9k|         auto after = it + 3;
 1458|  39.9k|         return after == end || *after == ' ' || *after == '\t' || *after == '\n' || *after == '\r';
  ------------------
  |  Branch (1458:17): [True: 5.72k, False: 34.2k]
  |  Branch (1458:33): [True: 2.92k, False: 31.3k]
  |  Branch (1458:50): [True: 3.48k, False: 27.8k]
  |  Branch (1458:68): [True: 3.58k, False: 24.2k]
  |  Branch (1458:86): [True: 1.64k, False: 22.6k]
  ------------------
 1459|  39.9k|      }
 1460|  7.61M|      return false;
 1461|  7.65M|   }
_ZN3glz4yaml15at_document_endIRPKcS3_EEbOT_T0_:
 1467|  10.0M|   {
 1468|  10.0M|      if (end - it >= 3 && it[0] == '.' && it[1] == '.' && it[2] == '.') {
  ------------------
  |  Branch (1468:11): [True: 9.61M, False: 433k]
  |  Branch (1468:28): [True: 160k, False: 9.45M]
  |  Branch (1468:44): [True: 105k, False: 54.6k]
  |  Branch (1468:60): [True: 79.7k, False: 26.2k]
  ------------------
 1469|  79.7k|         auto after = it + 3;
 1470|   187k|         while (after != end && (*after == ' ' || *after == '\t')) ++after;
  ------------------
  |  Branch (1470:17): [True: 167k, False: 20.0k]
  |  Branch (1470:34): [True: 63.4k, False: 103k]
  |  Branch (1470:51): [True: 43.8k, False: 59.7k]
  ------------------
 1471|  79.7k|         return after == end || *after == '\n' || *after == '\r' || *after == '#';
  ------------------
  |  Branch (1471:17): [True: 20.0k, False: 59.7k]
  |  Branch (1471:33): [True: 18.6k, False: 41.0k]
  |  Branch (1471:51): [True: 12.4k, False: 28.6k]
  |  Branch (1471:69): [True: 6.97k, False: 21.6k]
  ------------------
 1472|  79.7k|      }
 1473|  9.96M|      return false;
 1474|  10.0M|   }
_ZN3glz4yaml25skip_ws_newlines_commentsIRPKcS3_EEvOT_T0_:
 1006|  18.5M|   {
 1007|  23.9M|      while (it != end) {
  ------------------
  |  Branch (1007:14): [True: 23.9M, False: 1.00k]
  ------------------
 1008|  23.9M|         if (*it == ' ' || *it == '\t') {
  ------------------
  |  Branch (1008:14): [True: 5.06M, False: 18.9M]
  |  Branch (1008:28): [True: 27.0k, False: 18.8M]
  ------------------
 1009|  5.09M|            ++it;
 1010|  5.09M|         }
 1011|  18.8M|         else if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (1011:19): [True: 97.3k, False: 18.8M]
  |  Branch (1011:34): [True: 158k, False: 18.6M]
  ------------------
 1012|   256k|            skip_newline(it, end);
 1013|   256k|         }
 1014|  18.6M|         else if (*it == '#') {
  ------------------
  |  Branch (1014:19): [True: 51.4k, False: 18.5M]
  ------------------
 1015|  51.4k|            skip_comment(it, end);
 1016|  51.4k|         }
 1017|  18.5M|         else {
 1018|  18.5M|            break;
 1019|  18.5M|         }
 1020|  23.9M|      }
 1021|  18.5M|   }
_ZN3glz4yaml17parse_anchor_nameIPKcS3_EENSt3__117basic_string_viewIcNS4_11char_traitsIcEEEERT_T0_:
 1555|  19.2M|   {
 1556|  19.2M|      auto start = it;
 1557|  19.2M|      if (start == end) return {};
  ------------------
  |  Branch (1557:11): [True: 3.81k, False: 19.2M]
  ------------------
 1558|  3.73G|      while (it != end) {
  ------------------
  |  Branch (1558:14): [True: 3.73G, False: 275k]
  ------------------
 1559|  3.73G|         const char c = *it;
 1560|       |         // Per YAML, anchor names end at whitespace or flow indicators.
 1561|       |         // Colon is allowed in anchor names.
 1562|  3.73G|         if (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == ',' || c == '[' || c == ']' || c == '{' ||
  ------------------
  |  Branch (1562:14): [True: 9.53M, False: 3.72G]
  |  Branch (1562:26): [True: 341k, False: 3.72G]
  |  Branch (1562:39): [True: 2.31M, False: 3.71G]
  |  Branch (1562:52): [True: 772k, False: 3.71G]
  |  Branch (1562:65): [True: 1.07M, False: 3.71G]
  |  Branch (1562:77): [True: 206k, False: 3.71G]
  |  Branch (1562:89): [True: 43.5k, False: 3.71G]
  |  Branch (1562:101): [True: 1.92M, False: 3.71G]
  ------------------
 1563|  3.71G|             c == '}') {
  ------------------
  |  Branch (1563:14): [True: 2.75M, False: 3.71G]
  ------------------
 1564|  18.9M|            break;
 1565|  18.9M|         }
 1566|  3.71G|         ++it;
 1567|  3.71G|      }
 1568|  19.2M|      return std::string_view(&*start, static_cast<size_t>(it - start));
 1569|  19.2M|   }
_ZNK3glz4yaml12yaml_context23transparent_string_hashclENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  138|  55.3M|         size_t operator()(std::string_view key) const noexcept { return std::hash<std::string_view>{}(key); }
_ZNK3glz4yaml12yaml_context24transparent_string_equalclENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEES7_:
  145|  13.8M|         bool operator()(std::string_view lhs, std::string_view rhs) const noexcept { return lhs == rhs; }
_ZN3glz4yaml14parse_yaml_tagIPKcS3_NS0_12yaml_contextEEENS0_8yaml_tagERT_T0_RKT1_:
  892|  35.9M|   {
  893|  35.9M|      return parse_yaml_tag(it, end, !ctx.secondary_tag_handle_overridden);
  894|  35.9M|   }
_ZN3glz4yaml14parse_yaml_tagIPKcS3_EENS0_8yaml_tagERT_T0_b:
  773|  35.9M|   {
  774|  35.9M|      if (it == end || *it != '!') {
  ------------------
  |  Branch (774:11): [True: 0, False: 35.9M]
  |  Branch (774:24): [True: 32.8M, False: 3.03M]
  ------------------
  775|  32.8M|         return yaml_tag::none;
  776|  32.8M|      }
  777|       |
  778|  3.03M|      ++it; // skip first !
  779|       |
  780|  3.03M|      if (it == end) {
  ------------------
  |  Branch (780:11): [True: 708, False: 3.03M]
  ------------------
  781|    708|         return yaml_tag::unknown;
  782|    708|      }
  783|       |
  784|       |      // Check for !! (shorthand tag)
  785|  3.03M|      if (*it == '!') {
  ------------------
  |  Branch (785:11): [True: 1.36M, False: 1.67M]
  ------------------
  786|  1.36M|         ++it; // skip second !
  787|       |
  788|       |         // Read tag name
  789|  1.36M|         auto tag_start = it;
  790|   520M|         while (it != end && !plain_scalar_end_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (790:17): [True: 520M, False: 9.65k]
  |  Branch (790:30): [True: 519M, False: 1.35M]
  ------------------
  791|   519M|            ++it;
  792|   519M|         }
  793|       |
  794|  1.36M|         std::string_view tag_name(tag_start, static_cast<size_t>(it - tag_start));
  795|  1.36M|         if (tag_name.empty() || malformed_tag_token(tag_name)) {
  ------------------
  |  Branch (795:14): [True: 1.22k, False: 1.36M]
  |  Branch (795:34): [True: 0, False: 1.36M]
  ------------------
  796|  1.22k|            return yaml_tag::unknown;
  797|  1.22k|         }
  798|  1.36M|         if (it != end && malformed_tag_termination(*it)) {
  ------------------
  |  Branch (798:14): [True: 1.35M, False: 8.78k]
  |  Branch (798:27): [True: 288, False: 1.35M]
  ------------------
  799|    288|            return yaml_tag::unknown;
  800|    288|         }
  801|       |
  802|       |         // Skip whitespace after tag
  803|  3.79M|         while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (803:17): [True: 3.78M, False: 9.62k]
  |  Branch (803:31): [True: 1.56M, False: 2.21M]
  |  Branch (803:45): [True: 866k, False: 1.35M]
  ------------------
  804|  2.43M|            ++it;
  805|  2.43M|         }
  806|       |
  807|  1.36M|         if (!allow_core_schema_secondary_handle) {
  ------------------
  |  Branch (807:14): [True: 202, False: 1.36M]
  ------------------
  808|    202|            return yaml_tag::none;
  809|    202|         }
  810|       |
  811|       |         // Match known tags
  812|  1.36M|         if (tag_name == "str") return yaml_tag::str;
  ------------------
  |  Branch (812:14): [True: 41.0k, False: 1.31M]
  ------------------
  813|  1.31M|         if (tag_name == "int") return yaml_tag::int_tag;
  ------------------
  |  Branch (813:14): [True: 51.6k, False: 1.26M]
  ------------------
  814|  1.26M|         if (tag_name == "float") return yaml_tag::float_tag;
  ------------------
  |  Branch (814:14): [True: 23.4k, False: 1.24M]
  ------------------
  815|  1.24M|         if (tag_name == "bool") return yaml_tag::bool_tag;
  ------------------
  |  Branch (815:14): [True: 194k, False: 1.04M]
  ------------------
  816|  1.04M|         if (tag_name == "null") return yaml_tag::null_tag;
  ------------------
  |  Branch (816:14): [True: 8.29k, False: 1.04M]
  ------------------
  817|  1.04M|         if (tag_name == "map") return yaml_tag::map;
  ------------------
  |  Branch (817:14): [True: 281k, False: 759k]
  ------------------
  818|   759k|         if (tag_name == "seq") return yaml_tag::seq;
  ------------------
  |  Branch (818:14): [True: 188k, False: 571k]
  ------------------
  819|       |
  820|       |         // Unrecognized shorthand tag (e.g., !!omap) — ignore and parse value normally
  821|   571k|         return yaml_tag::none;
  822|   759k|      }
  823|       |
  824|       |      // Check for verbatim tag !<...>
  825|  1.67M|      if (*it == '<') {
  ------------------
  |  Branch (825:11): [True: 7.14k, False: 1.66M]
  ------------------
  826|  7.14k|         ++it;
  827|  7.14k|         auto tag_start = it;
  828|  2.29M|         while (it != end && *it != '>') {
  ------------------
  |  Branch (828:17): [True: 2.29M, False: 320]
  |  Branch (828:30): [True: 2.28M, False: 6.82k]
  ------------------
  829|  2.28M|            ++it;
  830|  2.28M|         }
  831|  7.14k|         if (it == end) {
  ------------------
  |  Branch (831:14): [True: 320, False: 6.82k]
  ------------------
  832|    320|            return yaml_tag::unknown;
  833|    320|         }
  834|       |
  835|  6.82k|         std::string_view tag_uri(tag_start, static_cast<size_t>(it - tag_start));
  836|  6.82k|         if (tag_uri.empty() || malformed_tag_token(tag_uri)) {
  ------------------
  |  Branch (836:14): [True: 194, False: 6.62k]
  |  Branch (836:33): [True: 380, False: 6.24k]
  ------------------
  837|    574|            return yaml_tag::unknown;
  838|    574|         }
  839|  6.24k|         ++it; // skip >
  840|  6.24k|         if (it != end && malformed_tag_termination(*it)) {
  ------------------
  |  Branch (840:14): [True: 4.48k, False: 1.76k]
  |  Branch (840:27): [True: 388, False: 4.09k]
  ------------------
  841|    388|            return yaml_tag::unknown;
  842|    388|         }
  843|       |
  844|       |         // Skip whitespace after tag
  845|  12.4k|         while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (845:17): [True: 10.2k, False: 2.12k]
  |  Branch (845:31): [True: 4.19k, False: 6.09k]
  |  Branch (845:45): [True: 2.35k, False: 3.73k]
  ------------------
  846|  6.55k|            ++it;
  847|  6.55k|         }
  848|       |
  849|       |         // Match known YAML 1.2 URIs
  850|  5.86k|         if (tag_uri == "tag:yaml.org,2002:str") return yaml_tag::str;
  ------------------
  |  Branch (850:14): [True: 934, False: 4.92k]
  ------------------
  851|  4.92k|         if (tag_uri == "tag:yaml.org,2002:int") return yaml_tag::int_tag;
  ------------------
  |  Branch (851:14): [True: 210, False: 4.71k]
  ------------------
  852|  4.71k|         if (tag_uri == "tag:yaml.org,2002:float") return yaml_tag::float_tag;
  ------------------
  |  Branch (852:14): [True: 394, False: 4.32k]
  ------------------
  853|  4.32k|         if (tag_uri == "tag:yaml.org,2002:bool") return yaml_tag::bool_tag;
  ------------------
  |  Branch (853:14): [True: 190, False: 4.13k]
  ------------------
  854|  4.13k|         if (tag_uri == "tag:yaml.org,2002:null") return yaml_tag::null_tag;
  ------------------
  |  Branch (854:14): [True: 190, False: 3.94k]
  ------------------
  855|  3.94k|         if (tag_uri == "tag:yaml.org,2002:map") return yaml_tag::map;
  ------------------
  |  Branch (855:14): [True: 450, False: 3.49k]
  ------------------
  856|  3.49k|         if (tag_uri == "tag:yaml.org,2002:seq") return yaml_tag::seq;
  ------------------
  |  Branch (856:14): [True: 190, False: 3.30k]
  ------------------
  857|       |
  858|       |         // Unrecognized verbatim tag — ignore and parse value normally
  859|  3.30k|         return yaml_tag::none;
  860|  3.49k|      }
  861|       |
  862|       |      // Named tag !name - skip it and read name
  863|  1.66M|      auto tag_start = it;
  864|   166M|      while (it != end && !plain_scalar_end_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (864:14): [True: 166M, False: 6.48k]
  |  Branch (864:27): [True: 164M, False: 1.65M]
  ------------------
  865|   164M|         ++it;
  866|   164M|      }
  867|  1.66M|      std::string_view tag_name(tag_start, static_cast<size_t>(it - tag_start));
  868|  1.66M|      if (!tag_name.empty() && malformed_tag_token(tag_name)) {
  ------------------
  |  Branch (868:11): [True: 1.11M, False: 545k]
  |  Branch (868:32): [True: 0, False: 1.11M]
  ------------------
  869|      0|         return yaml_tag::unknown;
  870|      0|      }
  871|  1.66M|      if (!tag_name.empty() && it != end && malformed_tag_termination(*it)) {
  ------------------
  |  Branch (871:11): [True: 1.11M, False: 545k]
  |  Branch (871:32): [True: 1.11M, False: 6.48k]
  |  Branch (871:45): [True: 948, False: 1.11M]
  ------------------
  872|    948|         return yaml_tag::unknown;
  873|    948|      }
  874|       |
  875|       |      // Skip whitespace after tag
  876|  4.09M|      while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (876:14): [True: 4.09M, False: 7.78k]
  |  Branch (876:28): [True: 2.14M, False: 1.95M]
  |  Branch (876:42): [True: 295k, False: 1.65M]
  ------------------
  877|  2.43M|         ++it;
  878|  2.43M|      }
  879|       |
  880|       |      // Unrecognized named tag — ignore and parse value normally
  881|  1.66M|      return yaml_tag::none;
  882|  1.66M|   }
_ZN3glz4yaml19malformed_tag_tokenENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  751|  2.48M|   {
  752|       |      // Reject obviously malformed tag tokens used by conformance tests.
  753|       |      // Unknown-but-well-formed tags are still ignored.
  754|   686M|      for (const char c : token) {
  ------------------
  |  Branch (754:25): [True: 686M, False: 2.48M]
  ------------------
  755|   686M|         if (c == '{' || c == '}') return true;
  ------------------
  |  Branch (755:14): [True: 190, False: 686M]
  |  Branch (755:26): [True: 190, False: 686M]
  ------------------
  756|   686M|      }
  757|  2.48M|      return false;
  758|  2.48M|   }
_ZN3glz4yaml25malformed_tag_terminationEc:
  761|  2.46M|   {
  762|  2.46M|      return !(c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '#' || c == ',' || c == ']' || c == '}');
  ------------------
  |  Branch (762:16): [True: 1.17M, False: 1.29M]
  |  Branch (762:28): [True: 852k, False: 443k]
  |  Branch (762:41): [True: 78.0k, False: 365k]
  |  Branch (762:54): [True: 110k, False: 255k]
  |  Branch (762:67): [True: 135k, False: 119k]
  |  Branch (762:79): [True: 74.9k, False: 44.7k]
  |  Branch (762:91): [True: 13.8k, False: 30.8k]
  |  Branch (762:103): [True: 29.2k, False: 1.62k]
  ------------------
  763|  2.46M|   }
_ZN3glz4yaml20tag_valid_for_stringENS0_8yaml_tagE:
  898|  19.2M|   {
  899|  19.2M|      return tag == yaml_tag::none || tag == yaml_tag::str;
  ------------------
  |  Branch (899:14): [True: 19.2M, False: 10.0k]
  |  Branch (899:39): [True: 9.85k, False: 172]
  ------------------
  900|  19.2M|   }
_ZN3glz4yaml17tag_valid_for_mapENS0_8yaml_tagE:
  934|  9.03M|   {
  935|  9.03M|      return tag == yaml_tag::none || tag == yaml_tag::map;
  ------------------
  |  Branch (935:14): [True: 9.03M, False: 3.45k]
  |  Branch (935:39): [True: 3.42k, False: 28]
  ------------------
  936|  9.03M|   }
_ZNK3glz4yaml12yaml_context23alias_span_is_replayingEPKcS3_:
  158|  2.24M|      {
  159|  4.44M|         for (const auto& [b, e] : active_alias_spans) {
  ------------------
  |  Branch (159:34): [True: 4.44M, False: 2.24M]
  ------------------
  160|  4.44M|            if (b == begin && e == end) return true;
  ------------------
  |  Branch (160:17): [True: 11.5k, False: 4.43M]
  |  Branch (160:31): [True: 3.40k, False: 8.17k]
  ------------------
  161|  4.44M|         }
  162|  2.24M|         return false;
  163|  2.24M|      }
_ZN3glz4yaml12yaml_context22charge_alias_expansionEm:
  178|  4.39M|      {
  179|  4.39M|         if (alias_expansion_budget == 0) {
  ------------------
  |  Branch (179:14): [True: 0, False: 4.39M]
  ------------------
  180|      0|            return true; // unbudgeted
  181|      0|         }
  182|  4.39M|         if (bytes >= alias_expansion_budget) {
  ------------------
  |  Branch (182:14): [True: 460, False: 4.39M]
  ------------------
  183|    460|            alias_expansion_budget = 1; // latch: spent, and still not "unbudgeted"
  184|    460|            return false;
  185|    460|         }
  186|  4.39M|         alias_expansion_budget -= bytes;
  187|  4.39M|         return true;
  188|  4.39M|      }
_ZN3glz4yaml12yaml_context11push_indentEi:
  110|  4.95M|      {
  111|  4.95M|         if (indent_stack.size() >= max_yaml_recursive_depth) [[unlikely]] {
  ------------------
  |  Branch (111:14): [True: 0, False: 4.95M]
  ------------------
  112|      0|            error = error_code::exceeded_max_recursive_depth;
  113|      0|            return false;
  114|      0|         }
  115|  4.95M|         indent_stack.push_back(static_cast<int16_t>(indent));
  116|  4.95M|         return true;
  117|  4.95M|      }
_ZN3glz4yaml20skip_ws_and_newlinesIRPKcS3_EEvOT_T0_:
  991|  28.4M|   {
  992|  32.5M|      while (it != end && (*it == ' ' || *it == '\t' || *it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (992:14): [True: 32.5M, False: 80.1k]
  |  Branch (992:28): [True: 2.28M, False: 30.2M]
  |  Branch (992:42): [True: 248k, False: 29.9M]
  |  Branch (992:57): [True: 418k, False: 29.5M]
  |  Branch (992:72): [True: 1.15M, False: 28.3M]
  ------------------
  993|  4.10M|         if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (993:14): [True: 418k, False: 3.68M]
  |  Branch (993:29): [True: 1.15M, False: 2.53M]
  ------------------
  994|  1.57M|            skip_newline(it, end);
  995|  1.57M|         }
  996|  2.53M|         else {
  997|  2.53M|            ++it;
  998|  2.53M|         }
  999|  4.10M|      }
 1000|  28.4M|   }
_ZN3glz4yaml19detect_scalar_styleEc:
 1573|  3.52M|   {
 1574|  3.52M|      switch (c) {
 1575|  43.8k|      case '"':
  ------------------
  |  Branch (1575:7): [True: 43.8k, False: 3.48M]
  ------------------
 1576|  43.8k|         return scalar_style::double_quoted;
 1577|  18.6k|      case '\'':
  ------------------
  |  Branch (1577:7): [True: 18.6k, False: 3.51M]
  ------------------
 1578|  18.6k|         return scalar_style::single_quoted;
 1579|  10.0k|      case '|':
  ------------------
  |  Branch (1579:7): [True: 10.0k, False: 3.51M]
  ------------------
 1580|  10.0k|         return scalar_style::literal_block;
 1581|  36.0k|      case '>':
  ------------------
  |  Branch (1581:7): [True: 36.0k, False: 3.49M]
  ------------------
 1582|  36.0k|         return scalar_style::folded_block;
 1583|  3.42M|      default:
  ------------------
  |  Branch (1583:7): [True: 3.42M, False: 108k]
  ------------------
 1584|  3.42M|         return scalar_style::plain;
 1585|  3.52M|      }
 1586|  3.52M|   }
_ZN3glz4yaml23skip_folded_line_indentINS0_12yaml_contextEEEbRPKcS4_RT_Pi:
 1057|   350k|   {
 1058|   350k|      bool saw_space = false;
 1059|   350k|      int indent_count = 0;
 1060|   561k|      while (src < src_end && (*src == ' ' || *src == '\t')) {
  ------------------
  |  Branch (1060:14): [True: 537k, False: 23.8k]
  |  Branch (1060:32): [True: 165k, False: 371k]
  |  Branch (1060:47): [True: 44.8k, False: 326k]
  ------------------
 1061|       |         // In nested block contexts, a tab at indentation column 0 is invalid.
 1062|   210k|         if (*src == '\t' && !saw_space && ctx.current_indent() >= 0) {
  ------------------
  |  Branch (1062:14): [True: 44.8k, False: 165k]
  |  Branch (1062:30): [True: 19.2k, False: 25.6k]
  |  Branch (1062:44): [True: 116, False: 19.1k]
  ------------------
 1063|    116|            ctx.error = error_code::syntax_error;
 1064|    116|            return false;
 1065|    116|         }
 1066|   210k|         if (*src == ' ') saw_space = true;
  ------------------
  |  Branch (1066:14): [True: 165k, False: 44.7k]
  ------------------
 1067|   210k|         ++indent_count;
 1068|   210k|         ++src;
 1069|   210k|      }
 1070|   350k|      if (ctx.current_indent() >= 0 && src < src_end && *src != '\n' && *src != '\r' &&
  ------------------
  |  Branch (1070:11): [True: 58.7k, False: 291k]
  |  Branch (1070:40): [True: 45.0k, False: 13.7k]
  |  Branch (1070:57): [True: 19.8k, False: 25.2k]
  |  Branch (1070:73): [True: 11.4k, False: 8.36k]
  ------------------
 1071|  11.4k|          indent_count < ctx.current_indent()) {
  ------------------
  |  Branch (1071:11): [True: 126, False: 11.3k]
  ------------------
 1072|    126|         ctx.error = error_code::syntax_error;
 1073|    126|         return false;
 1074|    126|      }
 1075|   350k|      if (indent_out) *indent_out = indent_count;
  ------------------
  |  Branch (1075:11): [True: 350k, False: 0]
  ------------------
 1076|   350k|      return true;
 1077|   350k|   }
_ZN3glz4yaml27starts_with_document_markerIPKcS3_EEbT_T0_:
 1034|   298k|   {
 1035|   298k|      if (src >= src_end) return false;
  ------------------
  |  Branch (1035:11): [True: 11.8k, False: 286k]
  ------------------
 1036|   286k|      if ((src_end - src) >= 3) {
  ------------------
  |  Branch (1036:11): [True: 266k, False: 20.3k]
  ------------------
 1037|   266k|         if (src[0] == '-' && src[1] == '-' && src[2] == '-') {
  ------------------
  |  Branch (1037:14): [True: 30.4k, False: 236k]
  |  Branch (1037:31): [True: 24.6k, False: 5.79k]
  |  Branch (1037:48): [True: 1.74k, False: 22.9k]
  ------------------
 1038|  1.74k|            const auto* after = src + 3;
 1039|  1.74k|            return after == src_end || *after == ' ' || *after == '\t' || *after == '\n' || *after == '\r' ||
  ------------------
  |  Branch (1039:20): [True: 34, False: 1.71k]
  |  Branch (1039:40): [True: 30, False: 1.68k]
  |  Branch (1039:57): [True: 30, False: 1.65k]
  |  Branch (1039:75): [True: 30, False: 1.62k]
  |  Branch (1039:93): [True: 30, False: 1.59k]
  ------------------
 1040|  1.59k|                   *after == '#';
  ------------------
  |  Branch (1040:20): [True: 18, False: 1.57k]
  ------------------
 1041|  1.74k|         }
 1042|   264k|         if (src[0] == '.' && src[1] == '.' && src[2] == '.') {
  ------------------
  |  Branch (1042:14): [True: 18.7k, False: 246k]
  |  Branch (1042:31): [True: 14.4k, False: 4.32k]
  |  Branch (1042:48): [True: 12.4k, False: 1.98k]
  ------------------
 1043|  12.4k|            const auto* after = src + 3;
 1044|  12.4k|            return after == src_end || *after == ' ' || *after == '\t' || *after == '\n' || *after == '\r' ||
  ------------------
  |  Branch (1044:20): [True: 38, False: 12.4k]
  |  Branch (1044:40): [True: 54, False: 12.3k]
  |  Branch (1044:57): [True: 30, False: 12.3k]
  |  Branch (1044:75): [True: 38, False: 12.3k]
  |  Branch (1044:93): [True: 30, False: 12.2k]
  ------------------
 1045|  12.2k|                   *after == '#';
  ------------------
  |  Branch (1045:20): [True: 4, False: 12.2k]
  ------------------
 1046|  12.4k|         }
 1047|   264k|      }
 1048|   272k|      return false;
 1049|   286k|   }
_ZN3glz4yaml19tag_valid_for_floatENS0_8yaml_tagE:
  910|  3.45M|   {
  911|  3.45M|      return tag == yaml_tag::none || tag == yaml_tag::float_tag || tag == yaml_tag::int_tag;
  ------------------
  |  Branch (911:14): [True: 3.44M, False: 10.8k]
  |  Branch (911:39): [True: 4.87k, False: 5.96k]
  |  Branch (911:69): [True: 4.29k, False: 1.67k]
  ------------------
  912|  3.45M|   }
_ZN3glz4yaml18tag_valid_for_boolENS0_8yaml_tagE:
  916|   328k|   {
  917|   328k|      return tag == yaml_tag::none || tag == yaml_tag::bool_tag;
  ------------------
  |  Branch (917:14): [True: 320k, False: 7.88k]
  |  Branch (917:39): [True: 7.86k, False: 28]
  ------------------
  918|   328k|   }
_ZN3glz4yaml12is_yaml_nullENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
 1608|  82.9k|   {
 1609|  82.9k|      return s == "null" || s == "Null" || s == "NULL" || s == "~" || s.empty();
  ------------------
  |  Branch (1609:14): [True: 28.2k, False: 54.6k]
  |  Branch (1609:29): [True: 17.5k, False: 37.1k]
  |  Branch (1609:44): [True: 33.1k, False: 3.98k]
  |  Branch (1609:59): [True: 0, False: 3.98k]
  |  Branch (1609:71): [True: 3.67k, False: 312]
  ------------------
 1610|  82.9k|   }
_ZN3glz4yaml14measure_indentILb1ERPKcS3_NS0_12yaml_contextEEEiOT0_T1_RT2_:
 1484|  1.79M|   {
 1485|  1.79M|      int32_t indent = 0;
 1486|  11.1M|      while (it != end && *it == ' ') {
  ------------------
  |  Branch (1486:14): [True: 10.9M, False: 197k]
  |  Branch (1486:27): [True: 9.37M, False: 1.60M]
  ------------------
 1487|  9.37M|         ++indent;
 1488|  9.37M|         ++it;
 1489|  9.37M|      }
 1490|       |      // YAML spec: "Tab characters must not be used for indentation"
 1491|  1.79M|      if constexpr (error_on_tab) {
 1492|  1.79M|         if (it != end && *it == '\t') {
  ------------------
  |  Branch (1492:14): [True: 1.60M, False: 197k]
  |  Branch (1492:27): [True: 110, False: 1.60M]
  ------------------
 1493|    110|            ctx.error = error_code::syntax_error;
 1494|    110|         }
 1495|       |      }
 1496|       |      else {
 1497|       |         // In block scalar context: tabs after spaces are content, not indentation.
 1498|       |         // Only error when tab is the first character (pure tab indentation).
 1499|       |         if (indent == 0 && it != end && *it == '\t') {
 1500|       |            ctx.error = error_code::syntax_error;
 1501|       |         }
 1502|       |      }
 1503|  1.79M|      return indent;
 1504|  1.79M|   }
_ZNK3glz4yaml12yaml_context13line_begin_ofEPKc:
  306|  13.3M|      {
  307|  13.3M|         if (!stream_begin || p < stream_begin) {
  ------------------
  |  Branch (307:14): [True: 0, False: 13.3M]
  |  Branch (307:31): [True: 0, False: 13.3M]
  ------------------
  308|      0|            return p;
  309|      0|         }
  310|  13.3M|         memoize_line(p);
  311|  13.3M|         return memo_line_begin;
  312|  13.3M|      }
_ZNK3glz4yaml12yaml_context12memoize_lineEPKc:
  270|  13.3M|      {
  271|  13.3M|         if (memo_line_begin && p >= memo_line_begin && p <= memo_verified_end) {
  ------------------
  |  Branch (271:14): [True: 12.8M, False: 484k]
  |  Branch (271:33): [True: 11.4M, False: 1.35M]
  |  Branch (271:57): [True: 4.60M, False: 6.89M]
  ------------------
  272|  4.60M|            return;
  273|  4.60M|         }
  274|       |         // A query past the memoized span only has to walk the new bytes; one before it (or with
  275|       |         // no memo yet) walks all the way back.
  276|  8.72M|         const bool extends = memo_line_begin && p > memo_verified_end;
  ------------------
  |  Branch (276:31): [True: 8.24M, False: 484k]
  |  Branch (276:50): [True: 6.89M, False: 1.35M]
  ------------------
  277|  8.72M|         const char* const floor = extends ? memo_verified_end : stream_begin;
  ------------------
  |  Branch (277:36): [True: 6.89M, False: 1.83M]
  ------------------
  278|  8.72M|         const char* first_tab = nullptr;
  279|  8.72M|         const char* first_content = nullptr;
  280|  8.72M|         const char* q = p;
  281|  2.05G|         while (q > floor) {
  ------------------
  |  Branch (281:17): [True: 2.05G, False: 3.14M]
  ------------------
  282|  2.05G|            const char c = *(q - 1);
  283|  2.05G|            if (c == '\n' || c == '\r') break;
  ------------------
  |  Branch (283:17): [True: 2.49M, False: 2.04G]
  |  Branch (283:30): [True: 3.08M, False: 2.04G]
  ------------------
  284|  2.04G|            --q;
  285|       |            // Walking backward, the last one seen is the earliest one on the line.
  286|  2.04G|            if (c == '\t')
  ------------------
  |  Branch (286:17): [True: 599k, False: 2.04G]
  ------------------
  287|   599k|               first_tab = q;
  288|  2.04G|            else if (c != ' ')
  ------------------
  |  Branch (288:22): [True: 2.00G, False: 44.7M]
  ------------------
  289|  2.00G|               first_content = q;
  290|  2.04G|         }
  291|  8.72M|         if (extends && q == floor) {
  ------------------
  |  Branch (291:14): [True: 6.89M, False: 1.83M]
  |  Branch (291:25): [True: 2.65M, False: 4.24M]
  ------------------
  292|       |            // The new bytes continue the memoized line, so anything it already found is earlier.
  293|  2.65M|            if (memo_first_tab) first_tab = memo_first_tab;
  ------------------
  |  Branch (293:17): [True: 81.3k, False: 2.56M]
  ------------------
  294|  2.65M|            if (memo_first_content) first_content = memo_first_content;
  ------------------
  |  Branch (294:17): [True: 1.62M, False: 1.02M]
  ------------------
  295|  2.65M|         }
  296|  6.07M|         else {
  297|  6.07M|            memo_line_begin = q;
  298|  6.07M|         }
  299|  8.72M|         memo_verified_end = p;
  300|  8.72M|         memo_first_tab = first_tab;
  301|  8.72M|         memo_first_content = first_content;
  302|  8.72M|      }
_ZN3glz4yaml12yaml_context10pop_indentEv:
  120|  4.59M|      {
  121|  4.59M|         if (!indent_stack.empty()) {
  ------------------
  |  Branch (121:14): [True: 4.59M, False: 0]
  ------------------
  122|  4.59M|            indent_stack.pop_back();
  123|  4.59M|         }
  124|  4.59M|      }
_ZN3glz4yaml17tag_valid_for_seqENS0_8yaml_tagE:
  928|  1.67M|   {
  929|  1.67M|      return tag == yaml_tag::none || tag == yaml_tag::seq;
  ------------------
  |  Branch (929:14): [True: 1.66M, False: 14.6k]
  |  Branch (929:39): [True: 14.6k, False: 28]
  ------------------
  930|  1.67M|   }
_ZN3glz4yaml12yaml_context20charge_key_expansionEm:
  198|  5.11M|      {
  199|  5.11M|         if (key_expansion_budget == 0) {
  ------------------
  |  Branch (199:14): [True: 0, False: 5.11M]
  ------------------
  200|      0|            return true; // unbudgeted
  201|      0|         }
  202|  5.11M|         if (bytes >= key_expansion_budget) {
  ------------------
  |  Branch (202:14): [True: 400, False: 5.11M]
  ------------------
  203|    400|            key_expansion_budget = 1; // latch: spent, and still not "unbudgeted"
  204|    400|            return false;
  205|    400|         }
  206|  5.11M|         key_expansion_budget -= bytes;
  207|  5.11M|         return true;
  208|  5.11M|      }
_ZN3glz4yaml14measure_indentILb0ERPKcS3_NS0_12yaml_contextEEEiOT0_T1_RT2_:
 1484|  10.4M|   {
 1485|  10.4M|      int32_t indent = 0;
 1486|  21.1M|      while (it != end && *it == ' ') {
  ------------------
  |  Branch (1486:14): [True: 21.0M, False: 100k]
  |  Branch (1486:27): [True: 10.6M, False: 10.3M]
  ------------------
 1487|  10.6M|         ++indent;
 1488|  10.6M|         ++it;
 1489|  10.6M|      }
 1490|       |      // YAML spec: "Tab characters must not be used for indentation"
 1491|       |      if constexpr (error_on_tab) {
 1492|       |         if (it != end && *it == '\t') {
 1493|       |            ctx.error = error_code::syntax_error;
 1494|       |         }
 1495|       |      }
 1496|  10.4M|      else {
 1497|       |         // In block scalar context: tabs after spaces are content, not indentation.
 1498|       |         // Only error when tab is the first character (pure tab indentation).
 1499|  10.4M|         if (indent == 0 && it != end && *it == '\t') {
  ------------------
  |  Branch (1499:14): [True: 9.72M, False: 766k]
  |  Branch (1499:29): [True: 9.63M, False: 99.3k]
  |  Branch (1499:42): [True: 284, False: 9.63M]
  ------------------
 1500|    284|            ctx.error = error_code::syntax_error;
 1501|    284|         }
 1502|  10.4M|      }
 1503|  10.4M|      return indent;
 1504|  10.4M|   }
_ZNK3glz4yaml12yaml_context16make_speculativeEv:
  402|  7.44M|      {
  403|  7.44M|         yaml_context c{};
  404|  7.44M|         c.indent_stack = indent_stack;
  405|  7.44M|         c.anchors = anchors;
  406|  7.44M|         c.active_alias_spans = active_alias_spans;
  407|       |         // Speculative work is real work: a probe that expands aliases spends the same budget,
  408|       |         // and the sites that adopt a probe's anchors adopt what it spent along with them.
  409|  7.44M|         c.alias_expansion_budget = alias_expansion_budget;
  410|       |         // Likewise for key text: a probe that built a complex key did the work whether or not
  411|       |         // its alternative is adopted, and an attempt that is never billed can be repeated free.
  412|  7.44M|         c.key_expansion_budget = key_expansion_budget;
  413|  7.44M|         c.sequence_item_value_context = sequence_item_value_context;
  414|  7.44M|         c.sequence_dash_indent = sequence_dash_indent;
  415|  7.44M|         c.explicit_mapping_key_context = explicit_mapping_key_context;
  416|  7.44M|         c.allow_indentless_sequence = allow_indentless_sequence;
  417|  7.44M|         c.stream_begin = stream_begin;
  418|       |         // The line memo only records what the buffer says, so a probe may keep using it.
  419|  7.44M|         c.memo_line_begin = memo_line_begin;
  420|  7.44M|         c.memo_verified_end = memo_verified_end;
  421|  7.44M|         c.memo_first_tab = memo_first_tab;
  422|  7.44M|         c.memo_first_content = memo_first_content;
  423|  7.44M|         c.secondary_tag_handle_overridden = secondary_tag_handle_overridden;
  424|       |         // Carry the recursion depth so a speculative type-probe shares the parent's budget
  425|       |         // and can't reset the stack-overflow guard partway down a deeply nested value.
  426|  7.44M|         c.depth = depth;
  427|  7.44M|         return c;
  428|  7.44M|      }
_ZNK3glz4yaml12yaml_context14current_indentEv:
  107|  69.5M|      int32_t current_indent() const noexcept { return indent_stack.empty() ? int32_t(-1) : indent_stack.back(); }
  ------------------
  |  Branch (107:56): [True: 48.7M, False: 20.7M]
  ------------------
_ZNK3glz4yaml12yaml_context18line_prefix_beforeEPKc:
  315|  10.0M|      {
  316|  10.0M|         const char* const begin = line_begin_of(p);
  317|  10.0M|         if (begin >= p) {
  ------------------
  |  Branch (317:14): [True: 3.03M, False: 6.97M]
  ------------------
  318|  3.03M|            return {};
  319|  3.03M|         }
  320|  6.97M|         return {int32_t(p - begin), memo_first_tab && memo_first_tab < p,
  ------------------
  |  Branch (320:38): [True: 504k, False: 6.46M]
  |  Branch (320:56): [True: 477k, False: 26.4k]
  ------------------
  321|  6.97M|                 memo_first_content && memo_first_content < p};
  ------------------
  |  Branch (321:18): [True: 6.09M, False: 880k]
  |  Branch (321:40): [True: 6.08M, False: 4.56k]
  ------------------
  322|  10.0M|      }
_ZN3glz4yaml12skip_newlineIRPKcS3_EEbOT_T0_:
  971|  51.7M|   {
  972|  51.7M|      if (it == end) return false;
  ------------------
  |  Branch (972:11): [True: 74.7k, False: 51.6M]
  ------------------
  973|       |
  974|  51.6M|      if (*it == '\r') {
  ------------------
  |  Branch (974:11): [True: 33.2M, False: 18.4M]
  ------------------
  975|  33.2M|         ++it;
  976|  33.2M|         if (it != end && *it == '\n') {
  ------------------
  |  Branch (976:14): [True: 32.4M, False: 782k]
  |  Branch (976:27): [True: 1.74M, False: 30.7M]
  ------------------
  977|  1.74M|            ++it;
  978|  1.74M|         }
  979|  33.2M|         return true;
  980|  33.2M|      }
  981|  18.4M|      else if (*it == '\n') {
  ------------------
  |  Branch (981:16): [True: 18.4M, False: 3.92k]
  ------------------
  982|  18.4M|         ++it;
  983|  18.4M|         return true;
  984|  18.4M|      }
  985|  3.92k|      return false;
  986|  51.6M|   }

_ZN3glz5parseILj450EE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_10is_contextERNS_4yaml12yaml_contextERPKcSD_EEvOT0_OT1_OT2_T3_:
   70|  39.9k|      {
   71|  39.9k|         if constexpr (requires { ctx.stream_begin; }) {
   72|  39.9k|            if (!ctx.stream_begin && it != end) {
  ------------------
  |  Branch (72:17): [True: 39.9k, False: 0]
  |  Branch (72:38): [True: 39.9k, False: 0]
  ------------------
   73|  39.9k|               ctx.stream_begin = &*it;
   74|       |               // Anchors and the line memo hold pointers into whatever buffer filled them, so a
   75|       |               // reused context must not carry a previous read's into this one.
   76|  39.9k|               if constexpr (requires { ctx.reset_read_state(); }) {
   77|  39.9k|                  ctx.reset_read_state();
   78|  39.9k|               }
   79|       |               // Seed the alias replay budget from the document this read was handed. Done here
   80|       |               // rather than in glz::read so every YAML entry point is covered, and only on the
   81|       |               // outermost parse so a nested document does not hand itself a fresh budget.
   82|  39.9k|               if constexpr (requires { ctx.alias_expansion_budget; } && requires { size_t(end - it); }) {
   83|  39.9k|                  const size_t scaled = size_t(end - it) * yaml::max_alias_expansion_factor;
   84|  39.9k|                  ctx.alias_expansion_budget =
   85|  39.9k|                     scaled > yaml::min_alias_expansion_bytes ? scaled : yaml::min_alias_expansion_bytes;
  ------------------
  |  Branch (85:22): [True: 341, False: 39.6k]
  ------------------
   86|  39.9k|               }
   87|       |               // Same treatment for the text complex keys materialize, seeded on its own budget so
   88|       |               // exhausting one reports which of the two ran away.
   89|  39.9k|               if constexpr (requires { ctx.key_expansion_budget; } && requires { size_t(end - it); }) {
   90|  39.9k|                  const size_t scaled = size_t(end - it) * yaml::max_key_expansion_factor;
   91|  39.9k|                  ctx.key_expansion_budget =
   92|  39.9k|                     scaled > yaml::min_key_expansion_bytes ? scaled : yaml::min_key_expansion_bytes;
  ------------------
  |  Branch (92:22): [True: 341, False: 39.6k]
  ------------------
   93|  39.9k|               }
   94|  39.9k|            }
   95|  39.9k|         }
   96|       |         // Skip YAML directives and document start marker (---) if present
   97|  39.9k|         yaml::skip_document_start(it, end, ctx);
   98|  39.9k|         if (bool(ctx.error)) [[unlikely]] {
  ------------------
  |  Branch (98:14): [True: 257, False: 39.7k]
  ------------------
   99|    257|            return;
  100|    257|         }
  101|       |
  102|  39.7k|         using V = std::remove_cvref_t<T>;
  103|  39.7k|         if (it == end) {
  ------------------
  |  Branch (103:14): [True: 60, False: 39.6k]
  ------------------
  104|       |            // An empty document is a valid YAML null document.
  105|     60|            if constexpr (requires { value = nullptr; }) {
  106|     60|               value = nullptr;
  107|     60|               return;
  108|       |            }
  109|       |            else if constexpr (nullable_like<V>) {
  110|       |               value = {};
  111|       |               return;
  112|       |            }
  113|       |            else {
  114|       |               ctx.error = error_code::unexpected_end;
  115|       |               return;
  116|       |            }
  117|     60|         }
  118|       |
  119|       |         // A bare document boundary marker at root denotes an empty document.
  120|       |         // Examples: "---\n---\n", "# comment\n...\n"
  121|  39.7k|         if (yaml::at_document_start(it, end) || yaml::at_document_end(it, end)) {
  ------------------
  |  Branch (121:14): [True: 64, False: 39.6k]
  |  Branch (121:50): [True: 21, False: 39.6k]
  ------------------
  122|     25|            if constexpr (requires { value = nullptr; }) {
  123|     25|               value = nullptr;
  124|     25|               return;
  125|       |            }
  126|       |            else if constexpr (nullable_like<V>) {
  127|       |               value = {};
  128|       |               return;
  129|       |            }
  130|       |            else {
  131|       |               ctx.error = error_code::unexpected_end;
  132|       |               return;
  133|       |            }
  134|     25|         }
  135|       |
  136|      0|         from<YAML, V>::template op<Opts>(std::forward<T>(value), std::forward<Ctx>(ctx), std::forward<It0>(it), end);
  137|       |
  138|       |         // A directive line (%YAML/%TAG/...) is only valid in the document prefix.
  139|       |         // If parsing stopped before the end and we encounter a directive in the
  140|       |         // remaining tail, treat it as malformed stream structure. This is a document-level
  141|       |         // concern, so only enforce it at the document root: a nested call (e.g. a tagged
  142|       |         // variant handing a custom alternative its body) is mid-document and its tail
  143|       |         // belongs to an enclosing node, not this value.
  144|  39.7k|         if constexpr (!check_partial_read(Opts)) {
  145|  39.7k|            if (!bool(ctx.error) && ctx.current_indent() < 0) {
  ------------------
  |  Branch (145:17): [True: 9.02k, False: 30.6k]
  |  Branch (145:37): [True: 9.02k, False: 0]
  ------------------
  146|  9.02k|               auto is_document_start = [&](auto pos) {
  147|  9.02k|                  if (end - pos >= 3 && pos[0] == '-' && pos[1] == '-' && pos[2] == '-') {
  148|  9.02k|                     auto after = pos + 3;
  149|  9.02k|                     return after == end || *after == ' ' || *after == '\t' || *after == '\n' || *after == '\r' ||
  150|  9.02k|                            *after == '#';
  151|  9.02k|                  }
  152|  9.02k|                  return false;
  153|  9.02k|               };
  154|       |
  155|       |               // The scan below reads the tail a line at a time, which only means anything if the
  156|       |               // tail starts at one. A root node can stop mid-line -- a plain scalar ends at a
  157|       |               // ':' it is not allowed to take as a separator, a flow collection ends at its
  158|       |               // bracket -- and what sits after it there is leftover content on that line, not
  159|       |               // the opening of a new one. Only inline whitespace and a comment may follow. Let
  160|       |               // the line scan see anything else and it misreads it: a leftover ':' passes as an
  161|       |               // explicit-key continuation and the remainder of the document falls on the floor.
  162|  9.02k|               if constexpr (requires { ctx.line_prefix_before(it); }) {
  163|  9.02k|                  if (it != end && ctx.line_prefix_before(it).has_content) {
  ------------------
  |  Branch (163:23): [True: 1.44k, False: 7.57k]
  |  Branch (163:23): [True: 971, False: 8.05k]
  |  Branch (163:36): [True: 971, False: 478]
  ------------------
  164|    971|                     auto rest = it;
  165|  3.48k|                     while (rest != end && (*rest == ' ' || *rest == '\t')) ++rest;
  ------------------
  |  Branch (165:29): [True: 3.43k, False: 49]
  |  Branch (165:45): [True: 2.06k, False: 1.36k]
  |  Branch (165:61): [True: 446, False: 922]
  ------------------
  166|    971|                     if (rest != end && *rest != '\n' && *rest != '\r' && *rest != '#') {
  ------------------
  |  Branch (166:26): [True: 922, False: 49]
  |  Branch (166:41): [True: 724, False: 198]
  |  Branch (166:58): [True: 416, False: 308]
  |  Branch (166:75): [True: 328, False: 88]
  ------------------
  167|    328|                        ctx.error = error_code::syntax_error;
  168|    328|                        return;
  169|    328|                     }
  170|    971|                  }
  171|  9.02k|               }
  172|       |
  173|  8.70k|               auto tail_scan = it;
  174|  9.02k|               bool seen_document_end_marker = false;
  175|  82.7k|               while (tail_scan != end) {
  ------------------
  |  Branch (175:23): [True: 74.3k, False: 8.36k]
  ------------------
  176|  74.3k|                  auto line = tail_scan;
  177|  85.8k|                  while (line != end && (*line == ' ' || *line == '\t')) ++line;
  ------------------
  |  Branch (177:26): [True: 85.7k, False: 81]
  |  Branch (177:42): [True: 10.8k, False: 74.9k]
  |  Branch (177:58): [True: 612, False: 74.3k]
  ------------------
  178|  74.3k|                  if (line != tail_scan && line != end && *line != '\n' && *line != '\r' && *line != '#') {
  ------------------
  |  Branch (178:23): [True: 1.25k, False: 73.1k]
  |  Branch (178:44): [True: 1.17k, False: 81]
  |  Branch (178:59): [True: 890, False: 287]
  |  Branch (178:76): [True: 601, False: 289]
  |  Branch (178:93): [True: 135, False: 466]
  ------------------
  179|       |                     // Indented tail usually belongs to continuation content.
  180|       |                     // But a plain "key: value" pattern here indicates malformed
  181|       |                     // trailing mapping content after a completed root node.
  182|    135|                     const char first = *line;
  183|       |                     // A block sequence entry here has nothing it can belong to: every node
  184|       |                     // that could own it has returned, so accepting it would drop it and every
  185|       |                     // line after it from the document.
  186|    135|                     if (first == '-' &&
  ------------------
  |  Branch (186:26): [True: 15, False: 120]
  ------------------
  187|     15|                         ((line + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(line + 1))])) {
  ------------------
  |  Branch (187:27): [True: 4, False: 11]
  |  Branch (187:48): [True: 2, False: 9]
  ------------------
  188|      6|                        ctx.error = error_code::syntax_error;
  189|      6|                        return;
  190|      6|                     }
  191|    129|                     const bool explicit_or_structural_start =
  192|    129|                        (first == ':' || first == '?' || first == '!' || first == '&' || first == '*' || first == '[' ||
  ------------------
  |  Branch (192:26): [True: 11, False: 118]
  |  Branch (192:42): [True: 5, False: 113]
  |  Branch (192:58): [True: 2, False: 111]
  |  Branch (192:74): [True: 2, False: 109]
  |  Branch (192:90): [True: 4, False: 105]
  |  Branch (192:106): [True: 5, False: 100]
  ------------------
  193|    100|                         first == '{' || first == '"' || first == '\'' || first == '-');
  ------------------
  |  Branch (193:26): [True: 2, False: 98]
  |  Branch (193:42): [True: 2, False: 96]
  |  Branch (193:58): [True: 3, False: 93]
  |  Branch (193:75): [True: 9, False: 84]
  ------------------
  194|    129|                     if (!explicit_or_structural_start) {
  ------------------
  |  Branch (194:26): [True: 84, False: 45]
  ------------------
  195|     84|                        auto scan = line;
  196|  2.51k|                        while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (196:32): [True: 2.46k, False: 43]
  |  Branch (196:47): [True: 2.45k, False: 9]
  |  Branch (196:64): [True: 2.45k, False: 5]
  ------------------
  197|  2.45k|                           if (*scan == ':') {
  ------------------
  |  Branch (197:32): [True: 300, False: 2.15k]
  ------------------
  198|    300|                              auto after = scan + 1;
  199|    300|                              if (after == end || *after == ' ' || *after == '\t' || *after == '\n' || *after == '\r') {
  ------------------
  |  Branch (199:35): [True: 17, False: 283]
  |  Branch (199:51): [True: 5, False: 278]
  |  Branch (199:68): [True: 2, False: 276]
  |  Branch (199:86): [True: 1, False: 275]
  |  Branch (199:104): [True: 2, False: 273]
  ------------------
  200|     27|                                 ctx.error = error_code::syntax_error;
  201|     27|                                 return;
  202|     27|                              }
  203|    300|                           }
  204|  2.42k|                           ++scan;
  205|  2.42k|                        }
  206|     84|                     }
  207|    102|                     return;
  208|    129|                  }
  209|  74.2k|                  if (line == end) {
  ------------------
  |  Branch (209:23): [True: 81, False: 74.1k]
  ------------------
  210|     81|                     return;
  211|     81|                  }
  212|  74.1k|                  if (*line == ':' || *line == '?') {
  ------------------
  |  Branch (212:23): [True: 20, False: 74.1k]
  |  Branch (212:39): [True: 16, False: 74.1k]
  ------------------
  213|     36|                     return; // Explicit key/value continuation.
  214|     36|                  }
  215|  74.1k|                  if (*line == '\n' || *line == '\r') {
  ------------------
  |  Branch (215:23): [True: 62.0k, False: 12.1k]
  |  Branch (215:40): [True: 3.82k, False: 8.28k]
  ------------------
  216|  65.8k|                     tail_scan = line;
  217|  65.8k|                     yaml::skip_newline(tail_scan, end);
  218|  65.8k|                     continue;
  219|  65.8k|                  }
  220|  8.28k|                  if (*line == '#') {
  ------------------
  |  Branch (220:23): [True: 5.95k, False: 2.32k]
  ------------------
  221|  41.1k|                     while (tail_scan != end && *tail_scan != '\n' && *tail_scan != '\r') ++tail_scan;
  ------------------
  |  Branch (221:29): [True: 40.9k, False: 120]
  |  Branch (221:49): [True: 39.5k, False: 1.44k]
  |  Branch (221:71): [True: 35.1k, False: 4.39k]
  ------------------
  222|  5.95k|                     yaml::skip_newline(tail_scan, end);
  223|  5.95k|                     continue;
  224|  5.95k|                  }
  225|  2.32k|                  if (yaml::at_document_end(line, end)) {
  ------------------
  |  Branch (225:23): [True: 1.91k, False: 412]
  ------------------
  226|  1.91k|                     seen_document_end_marker = true;
  227|  13.8k|                     while (tail_scan != end && *tail_scan != '\n' && *tail_scan != '\r') ++tail_scan;
  ------------------
  |  Branch (227:29): [True: 13.7k, False: 97]
  |  Branch (227:49): [True: 12.6k, False: 1.09k]
  |  Branch (227:71): [True: 11.9k, False: 719]
  ------------------
  228|  1.91k|                     yaml::skip_newline(tail_scan, end);
  229|  1.91k|                     continue;
  230|  1.91k|                  }
  231|    412|                  if (is_document_start(line)) {
  ------------------
  |  Branch (231:23): [True: 131, False: 281]
  ------------------
  232|       |                     // Additional documents are accepted, but document-start lines
  233|       |                     // that use non-standard tag handles (e.g. !prefix!Type) are
  234|       |                     // malformed in this single-document reader unless re-declared
  235|       |                     // for that document. Reject this shape in the stream tail.
  236|    131|                     auto header = line + 3;
  237|    787|                     while (header != end && (*header == ' ' || *header == '\t')) ++header;
  ------------------
  |  Branch (237:29): [True: 753, False: 34]
  |  Branch (237:47): [True: 322, False: 431]
  |  Branch (237:65): [True: 334, False: 97]
  ------------------
  238|    131|                     if (header != end && *header == '!') {
  ------------------
  |  Branch (238:26): [True: 97, False: 34]
  |  Branch (238:43): [True: 48, False: 49]
  ------------------
  239|     48|                        auto tag_end = header + 1;
  240|   595k|                        while (tag_end != end && *tag_end != ' ' && *tag_end != '\t' && *tag_end != '\n' &&
  ------------------
  |  Branch (240:32): [True: 595k, False: 22]
  |  Branch (240:50): [True: 595k, False: 15]
  |  Branch (240:69): [True: 595k, False: 2]
  |  Branch (240:89): [True: 595k, False: 1]
  ------------------
  241|   595k|                               *tag_end != '\r' && *tag_end != '#') {
  ------------------
  |  Branch (241:32): [True: 595k, False: 3]
  |  Branch (241:52): [True: 595k, False: 5]
  ------------------
  242|   595k|                           ++tag_end;
  243|   595k|                        }
  244|     48|                        std::string_view tag_token(header, static_cast<size_t>(tag_end - header));
  245|     48|                        const auto second_bang = tag_token.find('!', 1);
  246|     48|                        if (second_bang != std::string_view::npos) {
  ------------------
  |  Branch (246:29): [True: 30, False: 18]
  ------------------
  247|     30|                           std::string_view handle = tag_token.substr(0, second_bang + 1);
  248|     30|                           if (handle != "!" && handle != "!!") {
  ------------------
  |  Branch (248:32): [True: 30, False: 0]
  |  Branch (248:49): [True: 27, False: 3]
  ------------------
  249|     27|                              ctx.error = error_code::syntax_error;
  250|     27|                              return;
  251|     27|                           }
  252|     30|                        }
  253|     48|                     }
  254|    104|                     return; // Additional documents are allowed in the stream tail.
  255|    131|                  }
  256|    281|                  if (line != end && *line == '%') {
  ------------------
  |  Branch (256:23): [True: 281, False: 0]
  |  Branch (256:38): [True: 7, False: 274]
  ------------------
  257|       |                     // YAML directives are only valid in document prefixes. A directive
  258|       |                     // encountered mid-document (without a prior ...) is malformed.
  259|      7|                     if (!seen_document_end_marker) {
  ------------------
  |  Branch (259:26): [True: 5, False: 2]
  ------------------
  260|      5|                        ctx.error = error_code::syntax_error;
  261|      5|                        return;
  262|      5|                     }
  263|      2|                     return;
  264|      7|                  }
  265|    274|                  if (seen_document_end_marker) {
  ------------------
  |  Branch (265:23): [True: 36, False: 238]
  ------------------
  266|     36|                     return; // Implicit next document after explicit document end marker.
  267|     36|                  }
  268|    238|                  ctx.error = error_code::syntax_error;
  269|    238|                  return;
  270|    274|               }
  271|  9.02k|            }
  272|  39.7k|         }
  273|  39.7k|      }
_ZN3glz4fromILj450ENS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERS4_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSD_EEvOT0_OT1_OT2_T3_:
  283|   498k|      {
  284|   498k|         using V = std::decay_t<decltype(get_member(std::declval<Value>(), meta_wrapper_v<T>))>;
  285|   498k|         from<YAML, V>::template op<Opts>(get_member(std::forward<Value>(value), meta_wrapper_v<T>),
  286|   498k|                                          std::forward<Ctx>(ctx), std::forward<It0>(it), end);
  287|   498k|      }
_ZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_:
 5797|   666k|      {
 5798|       |         // Inside op() rather than at class scope: read_supported is `requires { from<Format, T>{}; }`,
 5799|       |         // so a class-scope assert turns that feature probe into a hard error instead of `false`.
 5800|   666k|         static_assert(content_v<std::remove_cvref_t<T>>.empty(),
 5801|   666k|                       "Adjacent variant tagging (glz::meta `content`) is implemented for JSON and "
 5802|   666k|                       "BEVE but not yet for YAML. Reading this variant as YAML would silently expect "
 5803|   666k|                       "the internally tagged shape, so it is rejected here instead.");
 5804|   666k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5804:14): [True: 0, False: 666k]
  ------------------
 5805|      0|            return;
 5806|       |
 5807|       |         // No depth is taken here: the sequence and mapping readers this dispatches to count the
 5808|       |         // levels, so a scalar at the bottom of a document costs nothing, as in JSON. The one way
 5809|       |         // back into this reader that opens no collection is `redispatch`, which counts itself.
 5810|       |
 5811|       |         // At root level (indent == -1), skip leading whitespace, newlines, and comments
 5812|       |         // For nested values, only skip inline whitespace to preserve block structure
 5813|   666k|         if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (5813:14): [True: 117k, False: 548k]
  ------------------
 5814|   117k|            yaml::skip_ws_newlines_comments(it, end);
 5815|   117k|         }
 5816|   548k|         else {
 5817|   548k|            yaml::skip_inline_ws(it, end);
 5818|   548k|         }
 5819|       |
 5820|   666k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (5820:14): [True: 113, False: 665k]
  ------------------
 5821|    113|            ctx.error = error_code::unexpected_end;
 5822|    113|            return;
 5823|    113|         }
 5824|       |
 5825|       |         // Tagged variants: a discriminator key (meta::tag) selects the alternative, with the
 5826|       |         // matching meta::ids entry naming each type. This mirrors the JSON behavior so the
 5827|       |         // same variant definitions round-trip across both formats.
 5828|       |         if constexpr (not tag_v<std::remove_cvref_t<T>>.empty()) {
 5829|       |            using V = std::remove_cvref_t<T>;
 5830|       |            const bool value_is_mapping =
 5831|       |               (*it == '{') || (!yaml::check_flow_context(Opts) && yaml::line_could_be_block_mapping(it, end));
 5832|       |            if (value_is_mapping) {
 5833|       |               // The mapping's keys sit at the column of `it`. Recover that column from the buffer:
 5834|       |               // the indent stack carries the parent context's indent (a struct member, a sequence
 5835|       |               // item, etc. each push a different offset), not this mapping's true column (see helper).
 5836|       |               const int32_t mapping_column = tagged_mapping_visual_indent(ctx, it, ctx.current_indent() + 1);
 5837|       |               auto tag_ctx = ctx.make_speculative();
 5838|       |               const size_t index = scan_variant_tag_index<V, Opts>(tag_ctx, it, end, mapping_column);
 5839|       |               ctx.alias_expansion_budget = tag_ctx.alias_expansion_budget; // charged even if no tag matched
 5840|       |               ctx.key_expansion_budget = tag_ctx.key_expansion_budget;
 5841|       |               if (index < ids_v<V>.size()) {
 5842|       |                  static constexpr auto tag_literal = string_literal_from_view<tag_v<V>.size()>(tag_v<V>);
 5843|       |                  emplace_runtime_variant(value, index);
 5844|       |                  // Establish the mapping's true column on the indent stack for the alternative parse.
 5845|       |                  // The chosen object is then parsed - and the discriminator's inline value skipped -
 5846|       |                  // at a consistent indent in every context, so a tag on the first key does not fold
 5847|       |                  // the following sibling entries into its value (no special-casing needed downstream).
 5848|       |                  if (!ctx.push_indent(mapping_column)) [[unlikely]] {
 5849|       |                     ctx.error = error_code::exceeded_max_recursive_depth;
 5850|       |                     return;
 5851|       |                  }
 5852|       |                  std::visit(
 5853|       |                     [&](auto&& alt) {
 5854|       |                        using Alt = std::remove_cvref_t<decltype(alt)>;
 5855|       |                        if constexpr ((glaze_object_t<Alt> || reflectable<Alt>) && not custom_read<Alt>) {
 5856|       |                           // Parse the mapping into the resolved struct; the tag key is skipped.
 5857|       |                           from<YAML, Alt>::template op<Opts, tag_literal>(alt, ctx, it, end);
 5858|       |                        }
 5859|       |                        else if constexpr (custom_read<Alt>) {
 5860|       |                           // Custom alternatives read the mapping body themselves and cannot skip an
 5861|       |                           // interior tag key the way reflected objects do, so the tag must be the
 5862|       |                           // first key (glaze always writes it first). Consume that leading "tag: id"
 5863|       |                           // entry, then hand the remaining mapping to the custom handler.
 5864|       |                           if constexpr (yaml::check_flow_context(Opts)) {
 5865|       |                              ctx.error = error_code::feature_not_supported;
 5866|       |                              ctx.custom_error_message =
 5867|       |                                 "custom variant alternatives are not supported in YAML flow style";
 5868|       |                           }
 5869|       |                           else {
 5870|       |                              ctx.scratch.clear();
 5871|       |                              if (yaml::parse_yaml_key(ctx.scratch, ctx, it, end, false)) {
 5872|       |                                 if (std::string_view{ctx.scratch} != tag_v<V>) {
 5873|       |                                    ctx.error = error_code::feature_not_supported;
 5874|       |                                    ctx.custom_error_message =
 5875|       |                                       "the tag must be the first key for a custom variant alternative";
 5876|       |                                 }
 5877|       |                                 else {
 5878|       |                                    yaml::skip_inline_ws(it, end);
 5879|       |                                    if (it == end || *it != ':') {
 5880|       |                                       ctx.error = error_code::syntax_error;
 5881|       |                                    }
 5882|       |                                    else {
 5883|       |                                       ++it;
 5884|       |                                       yaml::skip_inline_ws(it, end);
 5885|       |                                       yaml::skip_unknown_block_value<Opts>(ctx, it, end, mapping_column);
 5886|       |                                       if (!bool(ctx.error)) {
 5887|       |                                          // If nothing but trailing whitespace/comments remains, the tag
 5888|       |                                          // was the whole mapping: leave the alternative default.
 5889|       |                                          auto probe = it;
 5890|       |                                          yaml::skip_ws_newlines_comments(probe, end);
 5891|       |                                          if (probe == end) {
 5892|       |                                             it = probe;
 5893|       |                                          }
 5894|       |                                          else {
 5895|       |                                             // Publish the mapping's column so the custom handler's block
 5896|       |                                             // mapping (which would otherwise discover its own indent) reads
 5897|       |                                             // the remaining entries at the variant's indent and dedents
 5898|       |                                             // correctly in every context (root, sequence, nested).
 5899|       |                                             ctx.forced_block_mapping_indent = mapping_column;
 5900|       |                                             from<YAML, Alt>::template op<Opts>(alt, ctx, it, end);
 5901|       |                                             ctx.forced_block_mapping_indent = -1;
 5902|       |                                          }
 5903|       |                                       }
 5904|       |                                    }
 5905|       |                                 }
 5906|       |                              }
 5907|       |                           }
 5908|       |                        }
 5909|       |                        else {
 5910|       |                           // Non-object alternative (e.g. std::monostate): the emplaced default is
 5911|       |                           // the value, but the mapping must still be consumed.
 5912|       |                           walk_tagged_mapping<Opts>(
 5913|       |                              ctx, it, end, tag_v<V>, mapping_column,
 5914|       |                              [&](auto&& c, auto&& i, auto&& e, int32_t line_indent, bool in_flow) {
 5915|       |                                 yaml::skip_yaml_value<Opts>(c, i, e, in_flow ? 0 : line_indent, in_flow);
 5916|       |                              });
 5917|       |                        }
 5918|       |                     },
 5919|       |                     value);
 5920|       |                  ctx.pop_indent();
 5921|       |                  return;
 5922|       |               }
 5923|       |               // No resolvable tag key was found. Fall through to structural deduction:
 5924|       |               // if the alternatives are distinguishable by their fields this still succeeds,
 5925|       |               // otherwise the deduction path reports no_matching_variant_type.
 5926|       |            }
 5927|       |         }
 5928|       |
 5929|   665k|         if constexpr (yaml_variant_is_auto_deducible<std::remove_cvref_t<T>>()) {
 5930|   665k|            using V = std::remove_cvref_t<T>;
 5931|   665k|            using counts = yaml_variant_type_count<V>;
 5932|   665k|            const char c = *it;
 5933|   665k|            auto is_plain_scalar_boundary = [](const char ch) {
 5934|   665k|               switch (ch) {
 5935|   665k|               case ' ':
 5936|   665k|               case '\t':
 5937|   665k|               case '\n':
 5938|   665k|               case '\r':
 5939|   665k|               case ',':
 5940|   665k|               case ']':
 5941|   665k|               case '}':
 5942|   665k|                  return true;
 5943|   665k|               default:
 5944|   665k|                  return false;
 5945|   665k|               }
 5946|   665k|            };
 5947|       |
 5948|   665k|            auto has_indented_block_continuation = [&](auto word_end) {
 5949|   665k|               if constexpr (yaml::check_flow_context(Opts)) {
 5950|   665k|                  return false;
 5951|   665k|               }
 5952|   665k|               if (ctx.current_indent() < 0) {
 5953|   665k|                  return false;
 5954|   665k|               }
 5955|   665k|               if (word_end == end || (*word_end != '\n' && *word_end != '\r')) {
 5956|   665k|                  return false;
 5957|   665k|               }
 5958|       |
 5959|   665k|               auto look = word_end;
 5960|   665k|               yaml::skip_newline(look, end);
 5961|   665k|               while (look != end) {
 5962|   665k|                  int32_t line_indent = 0;
 5963|   665k|                  while (look != end && *look == ' ') {
 5964|   665k|                     ++line_indent;
 5965|   665k|                     ++look;
 5966|   665k|                  }
 5967|   665k|                  if (look != end && *look == '\t') {
 5968|   665k|                     return false;
 5969|   665k|                  }
 5970|   665k|                  if (look == end || *look == '\n' || *look == '\r') {
 5971|   665k|                     if (look != end) {
 5972|   665k|                        yaml::skip_newline(look, end);
 5973|   665k|                        continue;
 5974|   665k|                     }
 5975|   665k|                     return false;
 5976|   665k|                  }
 5977|   665k|                  if (*look == '#') {
 5978|   665k|                     yaml::skip_comment(look, end);
 5979|   665k|                     if (look != end && (*look == '\n' || *look == '\r')) {
 5980|   665k|                        yaml::skip_newline(look, end);
 5981|   665k|                        continue;
 5982|   665k|                     }
 5983|   665k|                     return false;
 5984|   665k|                  }
 5985|       |
 5986|       |                  // If the next non-empty line is an implicit mapping entry,
 5987|       |                  // don't treat it as scalar continuation for auto-deduced
 5988|       |                  // booleans/nulls.
 5989|   665k|                  {
 5990|   665k|                     auto scan = look;
 5991|   665k|                     while (scan != end && *scan != '\n' && *scan != '\r') {
 5992|   665k|                        if (*scan == ':') {
 5993|   665k|                           auto after_colon = scan + 1;
 5994|   665k|                           if (after_colon == end || *after_colon == ' ' || *after_colon == '\t' ||
 5995|   665k|                               *after_colon == '\n' || *after_colon == '\r') {
 5996|   665k|                              return false;
 5997|   665k|                           }
 5998|   665k|                        }
 5999|   665k|                        ++scan;
 6000|   665k|                     }
 6001|   665k|                  }
 6002|       |
 6003|   665k|                  return line_indent > ctx.current_indent();
 6004|   665k|               }
 6005|   665k|               return false;
 6006|   665k|            };
 6007|   665k|            auto is_word_boundary = [&](const auto ptr) {
 6008|   665k|               if (ptr == end) {
 6009|   665k|                  return true;
 6010|   665k|               }
 6011|   665k|               if (*ptr == ':') {
 6012|   665k|                  auto next = ptr + 1;
 6013|   665k|                  return (next == end) || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
 6014|   665k|               }
 6015|   665k|               return is_plain_scalar_boundary(*ptr);
 6016|   665k|            };
 6017|       |
 6018|   665k|            switch (c) {
 6019|   118k|            case '&': {
  ------------------
  |  Branch (6019:13): [True: 118k, False: 547k]
  ------------------
 6020|       |               // Anchor before value: parse name, then re-dispatch
 6021|   118k|               ++it;
 6022|   118k|               auto aname = yaml::parse_anchor_name(it, end);
 6023|   118k|               if (aname.empty()) {
  ------------------
  |  Branch (6023:20): [True: 139, False: 118k]
  ------------------
 6024|    139|                  ctx.error = error_code::syntax_error;
 6025|    139|                  return;
 6026|    139|               }
 6027|   118k|               yaml::skip_inline_ws(it, end);
 6028|   118k|               bool anchor_on_same_line = true;
 6029|   118k|               bool value_is_indentless_sequence = false;
 6030|   118k|               if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (6030:20): [True: 1.23k, False: 117k]
  |  Branch (6030:33): [True: 8.52k, False: 108k]
  |  Branch (6030:48): [True: 13.3k, False: 95.5k]
  |  Branch (6030:63): [True: 5.72k, False: 89.8k]
  ------------------
 6031|       |                  // Anchor followed by end-of-line. Check if the value continues on the
 6032|       |                  // next line (indented past current context) or if this is an empty node.
 6033|  28.8k|                  bool value_on_next_line = false;
 6034|  28.8k|                  if (it != end) {
  ------------------
  |  Branch (6034:23): [True: 27.5k, False: 1.23k]
  ------------------
 6035|  27.5k|                     auto peek = it;
 6036|       |                     // Skip comment if present
 6037|  27.5k|                     if (*peek == '#') {
  ------------------
  |  Branch (6037:26): [True: 5.72k, False: 21.8k]
  ------------------
 6038|  71.0k|                        while (peek != end && *peek != '\n' && *peek != '\r') ++peek;
  ------------------
  |  Branch (6038:32): [True: 70.6k, False: 443]
  |  Branch (6038:47): [True: 68.5k, False: 2.06k]
  |  Branch (6038:64): [True: 65.3k, False: 3.21k]
  ------------------
 6039|  5.72k|                     }
 6040|       |                     // Skip newline
 6041|  27.5k|                     if (peek != end && (*peek == '\n' || *peek == '\r')) {
  ------------------
  |  Branch (6041:26): [True: 27.1k, False: 443]
  |  Branch (6041:42): [True: 10.5k, False: 16.5k]
  |  Branch (6041:59): [True: 16.5k, False: 0]
  ------------------
 6042|  27.1k|                        yaml::skip_newline(peek, end);
 6043|       |                        // Skip blank lines
 6044|  44.1k|                        while (peek != end && (*peek == '\n' || *peek == '\r')) {
  ------------------
  |  Branch (6044:32): [True: 42.1k, False: 1.93k]
  |  Branch (6044:48): [True: 12.4k, False: 29.6k]
  |  Branch (6044:65): [True: 4.46k, False: 25.2k]
  ------------------
 6045|  16.9k|                           yaml::skip_newline(peek, end);
 6046|  16.9k|                        }
 6047|       |                        // Measure indent of next content line
 6048|  27.1k|                        int32_t next_indent = 0;
 6049|   168k|                        while (peek != end && *peek == ' ') {
  ------------------
  |  Branch (6049:32): [True: 166k, False: 2.31k]
  |  Branch (6049:47): [True: 141k, False: 24.8k]
  ------------------
 6050|   141k|                           ++next_indent;
 6051|   141k|                           ++peek;
 6052|   141k|                        }
 6053|  27.1k|                        if (peek != end && *peek != '\n' && *peek != '\r') {
  ------------------
  |  Branch (6053:29): [True: 24.8k, False: 2.31k]
  |  Branch (6053:44): [True: 24.3k, False: 484]
  |  Branch (6053:61): [True: 23.3k, False: 1.03k]
  ------------------
 6054|  23.3k|                           const bool indentless_sequence =
 6055|  23.3k|                              (!ctx.sequence_item_value_context) && (*peek == '-') &&
  ------------------
  |  Branch (6055:31): [True: 20.0k, False: 3.22k]
  |  Branch (6055:69): [True: 10.2k, False: 9.80k]
  ------------------
 6056|  10.2k|                              ((peek + 1) == end ||
  ------------------
  |  Branch (6056:32): [True: 288, False: 10.0k]
  ------------------
 6057|  10.0k|                               yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(peek + 1))]) &&
  ------------------
  |  Branch (6057:32): [True: 9.54k, False: 457]
  ------------------
 6058|  9.83k|                              (next_indent == ctx.current_indent() ||
  ------------------
  |  Branch (6058:32): [True: 5.08k, False: 4.75k]
  ------------------
 6059|  4.75k|                               (ctx.current_indent() > 0 && (next_indent + 1) == ctx.current_indent()));
  ------------------
  |  Branch (6059:33): [True: 3.53k, False: 1.22k]
  |  Branch (6059:61): [True: 1.27k, False: 2.25k]
  ------------------
 6060|  23.3k|                           value_is_indentless_sequence = indentless_sequence;
 6061|  23.3k|                           const bool same_indent_property_node =
 6062|  23.3k|                              (next_indent == ctx.current_indent()) &&
  ------------------
  |  Branch (6062:31): [True: 8.65k, False: 14.6k]
  ------------------
 6063|  8.65k|                              (*peek == '!' || *peek == '&' || *peek == '*' || *peek == '[' || *peek == '{' ||
  ------------------
  |  Branch (6063:32): [True: 958, False: 7.69k]
  |  Branch (6063:48): [True: 774, False: 6.92k]
  |  Branch (6063:64): [True: 256, False: 6.66k]
  |  Branch (6063:80): [True: 266, False: 6.39k]
  |  Branch (6063:96): [True: 306, False: 6.09k]
  ------------------
 6064|  6.09k|                               *peek == '"' || *peek == '\'' || *peek == '|' || *peek == '>');
  ------------------
  |  Branch (6064:32): [True: 272, False: 5.82k]
  |  Branch (6064:48): [True: 169, False: 5.65k]
  |  Branch (6064:65): [True: 225, False: 5.42k]
  |  Branch (6064:81): [True: 54, False: 5.37k]
  ------------------
 6065|  23.3k|                           value_on_next_line =
 6066|  23.3k|                              (next_indent > ctx.current_indent()) || indentless_sequence || same_indent_property_node;
  ------------------
  |  Branch (6066:31): [True: 9.68k, False: 13.6k]
  |  Branch (6066:71): [True: 6.35k, False: 7.27k]
  |  Branch (6066:94): [True: 3.28k, False: 3.99k]
  ------------------
 6067|  23.3k|                        }
 6068|  27.1k|                     }
 6069|  27.5k|                  }
 6070|  28.8k|                  if (!value_on_next_line) {
  ------------------
  |  Branch (6070:23): [True: 9.50k, False: 19.3k]
  ------------------
 6071|       |                     // Anchor on empty/null node — store empty span, leave value as default
 6072|  9.50k|                     ctx.anchors[std::string(aname)] = {&*it, &*it, ctx.current_indent()};
 6073|  9.50k|                     return;
 6074|  9.50k|                  }
 6075|       |                  // Value is on next line — advance past newline/blank lines to the content
 6076|  19.3k|                  if (*it == '#') {
  ------------------
  |  Branch (6076:23): [True: 3.88k, False: 15.4k]
  ------------------
 6077|  42.2k|                     while (it != end && *it != '\n' && *it != '\r') ++it;
  ------------------
  |  Branch (6077:29): [True: 42.2k, False: 0]
  |  Branch (6077:42): [True: 41.0k, False: 1.24k]
  |  Branch (6077:57): [True: 38.3k, False: 2.63k]
  ------------------
 6078|  3.88k|                  }
 6079|  19.3k|                  if (it != end) yaml::skip_newline(it, end);
  ------------------
  |  Branch (6079:23): [True: 19.3k, False: 0]
  ------------------
 6080|  34.3k|                  while (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (6080:26): [True: 34.3k, False: 0]
  |  Branch (6080:40): [True: 12.0k, False: 22.2k]
  |  Branch (6080:55): [True: 2.88k, False: 19.3k]
  ------------------
 6081|  14.9k|                     yaml::skip_newline(it, end);
 6082|  14.9k|                  }
 6083|  19.3k|                  yaml::skip_inline_ws(it, end);
 6084|  19.3k|                  anchor_on_same_line = false;
 6085|  19.3k|               }
 6086|       |
 6087|   109k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6088|   109k|                  if (anchor_on_same_line && *it == '-' &&
  ------------------
  |  Branch (6088:23): [True: 89.8k, False: 19.3k]
  |  Branch (6088:46): [True: 8.14k, False: 81.7k]
  ------------------
 6089|  8.14k|                      ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))])) {
  ------------------
  |  Branch (6089:24): [True: 3, False: 8.13k]
  |  Branch (6089:43): [True: 4, False: 8.13k]
  ------------------
 6090|       |                     // "&anchor - item" is malformed in block context.
 6091|      7|                     ctx.error = error_code::syntax_error;
 6092|      7|                     return;
 6093|      7|                  }
 6094|   109k|               }
 6095|       |
 6096|       |               // Anchor on alias (&anchor *alias) is invalid per YAML spec.
 6097|       |               // But alias-as-key (&anchor *alias : value) is valid.
 6098|   109k|               if (it != end && *it == '*' && !yaml::alias_token_is_mapping_key(it, end)) {
  ------------------
  |  Branch (6098:20): [True: 109k, False: 19]
  |  Branch (6098:33): [True: 578, False: 108k]
  |  Branch (6098:47): [True: 73, False: 505]
  ------------------
 6099|     73|                  ctx.error = error_code::syntax_error;
 6100|     73|                  return;
 6101|     73|               }
 6102|       |
 6103|   109k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6104|   109k|                  if (!anchor_on_same_line && it != end && *it == '&') {
  ------------------
  |  Branch (6104:23): [True: 19.3k, False: 89.7k]
  |  Branch (6104:47): [True: 19.2k, False: 12]
  |  Branch (6104:60): [True: 1.31k, False: 17.9k]
  ------------------
 6105|  1.31k|                     auto probe = it + 1;
 6106|  1.31k|                     auto nested_anchor_name = yaml::parse_anchor_name(probe, end);
 6107|  1.31k|                     if (nested_anchor_name.empty()) {
  ------------------
  |  Branch (6107:26): [True: 25, False: 1.29k]
  ------------------
 6108|     25|                        ctx.error = error_code::syntax_error;
 6109|     25|                        return;
 6110|     25|                     }
 6111|  1.29k|                     yaml::skip_inline_ws(probe, end);
 6112|       |                     // Allow nested anchor usage only when it clearly starts a
 6113|       |                     // nested mapping entry ("&k key: value"). Otherwise this is
 6114|       |                     // a second anchor on the same node (4JVG-style), which is invalid.
 6115|  1.29k|                     if (!yaml::line_could_be_block_mapping(probe, end)) {
  ------------------
  |  Branch (6115:26): [True: 36, False: 1.25k]
  ------------------
 6116|     36|                        ctx.error = error_code::syntax_error;
 6117|     36|                        return;
 6118|     36|                     }
 6119|  1.29k|                  }
 6120|   109k|               }
 6121|       |
 6122|   109k|               const char* anchor_start = &*it;
 6123|   109k|               const int32_t anchor_indent = ctx.current_indent();
 6124|       |
 6125|   109k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6126|       |                  // Check if the anchor is on a block-mapping key (&name key: value).
 6127|       |                  // Only when the anchor and key are on the SAME line — if the value was on the
 6128|       |                  // next line, the anchor applies to the entire next-line content.
 6129|   109k|                  if (anchor_on_same_line && yaml::line_could_be_block_mapping(it, end)) {
  ------------------
  |  Branch (6129:23): [True: 89.7k, False: 19.3k]
  |  Branch (6129:46): [True: 41.4k, False: 48.3k]
  ------------------
 6130|  41.4k|                     auto key_start = it;
 6131|  41.4k|                     if (*key_start == '!') {
  ------------------
  |  Branch (6131:26): [True: 1.48k, False: 39.9k]
  ------------------
 6132|  1.48k|                        const auto key_tag = yaml::parse_yaml_tag(key_start, end, ctx);
 6133|  1.48k|                        if (key_tag == yaml::yaml_tag::unknown || !yaml::tag_valid_for_string(key_tag)) {
  ------------------
  |  Branch (6133:29): [True: 4, False: 1.48k]
  |  Branch (6133:67): [True: 10, False: 1.47k]
  ------------------
 6134|     14|                           ctx.error = error_code::syntax_error;
 6135|     14|                           return;
 6136|     14|                        }
 6137|  1.47k|                        yaml::skip_inline_ws(key_start, end);
 6138|  1.47k|                        if (key_start == end) {
  ------------------
  |  Branch (6138:29): [True: 3, False: 1.46k]
  ------------------
 6139|      3|                           ctx.error = error_code::unexpected_end;
 6140|      3|                           return;
 6141|      3|                        }
 6142|  1.46k|                        if (*key_start == '\n' || *key_start == '\r') {
  ------------------
  |  Branch (6142:29): [True: 2, False: 1.46k]
  |  Branch (6142:51): [True: 3, False: 1.46k]
  ------------------
 6143|      5|                           ctx.error = error_code::syntax_error;
 6144|      5|                           return;
 6145|      5|                        }
 6146|       |
 6147|       |                        // Re-apply the anchor-on-alias rule now that the tag is consumed. The
 6148|       |                        // check above ran before the tag, so "&anchor !tag *alias" reached the
 6149|       |                        // key-span registration below while the untagged spelling was rejected;
 6150|       |                        // an alias node carries no other properties either way.
 6151|  1.46k|                        if (*key_start == '*' && !yaml::alias_token_is_mapping_key(key_start, end)) {
  ------------------
  |  Branch (6151:29): [True: 195, False: 1.26k]
  |  Branch (6151:50): [True: 8, False: 187]
  ------------------
 6152|      8|                           ctx.error = error_code::syntax_error;
 6153|      8|                           return;
 6154|      8|                        }
 6155|  1.46k|                     }
 6156|       |
 6157|       |                     // Find the key span by scanning to the key-value separator
 6158|  41.3k|                     auto key_scan = key_start;
 6159|  41.3k|                     auto key_end = key_start;
 6160|  41.3k|                     if (*key_scan == '"' || *key_scan == '\'') {
  ------------------
  |  Branch (6160:26): [True: 546, False: 40.8k]
  |  Branch (6160:46): [True: 328, False: 40.5k]
  ------------------
 6161|       |                        // Quoted key: skip to closing quote
 6162|    874|                        const char quote = *key_scan;
 6163|    874|                        ++key_scan;
 6164|  6.46k|                        while (key_scan != end && *key_scan != quote) {
  ------------------
  |  Branch (6164:32): [True: 6.46k, False: 2]
  |  Branch (6164:51): [True: 5.58k, False: 872]
  ------------------
 6165|  5.58k|                           if (*key_scan == '\\' && quote == '"') {
  ------------------
  |  Branch (6165:32): [True: 583, False: 5.00k]
  |  Branch (6165:53): [True: 262, False: 321]
  ------------------
 6166|    262|                              ++key_scan;
 6167|    262|                              if (key_scan != end) ++key_scan;
  ------------------
  |  Branch (6167:35): [True: 262, False: 0]
  ------------------
 6168|    262|                           }
 6169|  5.32k|                           else {
 6170|  5.32k|                              ++key_scan;
 6171|  5.32k|                           }
 6172|  5.58k|                        }
 6173|    874|                        if (key_scan == end) {
  ------------------
  |  Branch (6173:29): [True: 2, False: 872]
  ------------------
 6174|      2|                           ctx.error = error_code::syntax_error;
 6175|      2|                           return;
 6176|      2|                        }
 6177|    872|                        ++key_scan; // past closing quote
 6178|    872|                        key_end = key_scan;
 6179|    872|                        yaml::skip_inline_ws(key_scan, end);
 6180|    872|                     }
 6181|  40.5k|                     else {
 6182|       |                        // Plain key: scan to ':'
 6183|   595k|                        while (key_scan != end) {
  ------------------
  |  Branch (6183:32): [True: 595k, False: 4]
  ------------------
 6184|   595k|                           if (*key_scan == ':') {
  ------------------
  |  Branch (6184:32): [True: 71.6k, False: 524k]
  ------------------
 6185|  71.6k|                              auto next = key_scan + 1;
 6186|  71.6k|                              if (next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r') {
  ------------------
  |  Branch (6186:35): [True: 6.09k, False: 65.5k]
  |  Branch (6186:50): [True: 28.5k, False: 36.9k]
  |  Branch (6186:66): [True: 1.49k, False: 35.4k]
  |  Branch (6186:83): [True: 2.52k, False: 32.9k]
  |  Branch (6186:100): [True: 1.80k, False: 31.1k]
  ------------------
 6187|  40.5k|                                 break;
 6188|  40.5k|                              }
 6189|  71.6k|                           }
 6190|   555k|                           ++key_scan;
 6191|   555k|                        }
 6192|  40.5k|                        key_end = key_scan;
 6193|  47.8k|                        while (key_end != key_start && (*(key_end - 1) == ' ' || *(key_end - 1) == '\t')) {
  ------------------
  |  Branch (6193:32): [True: 45.5k, False: 2.24k]
  |  Branch (6193:57): [True: 6.74k, False: 38.8k]
  |  Branch (6193:82): [True: 575, False: 38.2k]
  ------------------
 6194|  7.31k|                           --key_end;
 6195|  7.31k|                        }
 6196|  40.5k|                     }
 6197|  41.3k|                     if (key_scan == end || *key_scan != ':') {
  ------------------
  |  Branch (6197:26): [True: 5, False: 41.3k]
  |  Branch (6197:45): [True: 26, False: 41.3k]
  ------------------
 6198|     31|                        ctx.error = error_code::syntax_error;
 6199|     31|                        return;
 6200|     31|                     }
 6201|       |                     // Store anchor with just the key text span
 6202|  41.3k|                     ctx.anchors[std::string(aname)] = {&*key_start, &*key_end, anchor_indent};
 6203|  41.3k|                     it = key_start;
 6204|       |                     // Parse as an object alternative so complex keys (e.g. flow collections) stay in mapping context.
 6205|  41.3k|                     if constexpr (counts::n_object > 0) {
 6206|  41.3k|                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6207|  41.3k|                                                                                                        end);
 6208|       |                     }
 6209|       |                     else {
 6210|       |                        redispatch<Opts>(value, ctx, it, end);
 6211|       |                     }
 6212|  41.3k|                     return;
 6213|  41.3k|                  }
 6214|   109k|               }
 6215|       |
 6216|  67.6k|               const bool prev_allow_indentless_sequence = ctx.allow_indentless_sequence;
 6217|   109k|               ctx.allow_indentless_sequence = value_is_indentless_sequence;
 6218|   109k|               redispatch<Opts>(value, ctx, it, end);
 6219|   109k|               ctx.allow_indentless_sequence = prev_allow_indentless_sequence;
 6220|   109k|               if (!bool(ctx.error)) {
  ------------------
  |  Branch (6220:20): [True: 64.3k, False: 44.7k]
  ------------------
 6221|  64.3k|                  ctx.anchors[std::string(aname)] = {anchor_start, &*it, anchor_indent};
 6222|  64.3k|               }
 6223|   109k|               return;
 6224|   109k|            }
 6225|  86.3k|            case '*': {
  ------------------
  |  Branch (6225:13): [True: 86.3k, False: 579k]
  ------------------
 6226|       |               // In block context, "*alias : value" starts a mapping with an alias key.
 6227|  86.3k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6228|  86.3k|                  if (yaml::alias_token_is_mapping_key(it, end)) {
  ------------------
  |  Branch (6228:23): [True: 5.59k, False: 80.7k]
  ------------------
 6229|  5.59k|                     if constexpr (counts::n_object > 0) {
 6230|  5.59k|                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6231|  5.59k|                                                                                                        end);
 6232|  5.59k|                        return;
 6233|       |                     }
 6234|       |                     else {
 6235|       |                        ctx.error = error_code::syntax_error;
 6236|       |                        return;
 6237|       |                     }
 6238|  5.59k|                  }
 6239|  86.3k|               }
 6240|       |
 6241|       |               // Alias value: look up anchor and replay
 6242|      0|               yaml::handle_alias<Opts>(value, ctx, it, end);
 6243|  86.3k|               return;
 6244|   109k|            }
 6245|  79.1k|            case '!': {
  ------------------
  |  Branch (6245:13): [True: 79.1k, False: 586k]
  ------------------
 6246|       |               // Tag - parse it and dispatch based on tag type
 6247|  79.1k|               const auto tag = yaml::parse_yaml_tag(it, end, ctx);
 6248|  79.1k|               if (tag == yaml::yaml_tag::unknown) {
  ------------------
  |  Branch (6248:20): [True: 89, False: 79.0k]
  ------------------
 6249|     89|                  ctx.error = error_code::syntax_error;
 6250|     89|                  return;
 6251|     89|               }
 6252|  79.0k|               yaml::skip_inline_ws(it, end);
 6253|  79.0k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (6253:20): [True: 78.4k, False: 641]
  |  Branch (6253:33): [True: 11.2k, False: 67.2k]
  ------------------
 6254|  11.2k|                  yaml::skip_comment(it, end);
 6255|  11.2k|               }
 6256|  79.0k|               if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (6256:20): [True: 78.0k, False: 989]
  |  Branch (6256:34): [True: 13.5k, False: 64.4k]
  |  Branch (6256:49): [True: 9.95k, False: 54.5k]
  ------------------
 6257|  23.5k|                  auto content = it;
 6258|  23.5k|                  yaml::skip_newline(content, end);
 6259|  23.5k|                  yaml::skip_to_content(content, end);
 6260|       |
 6261|  23.5k|                  bool consume_following_content = false;
 6262|  23.5k|                  auto content_token = content;
 6263|  23.5k|                  if (content != end) {
  ------------------
  |  Branch (6263:23): [True: 22.1k, False: 1.39k]
  ------------------
 6264|  22.1k|                     auto indent_probe = content;
 6265|  22.1k|                     const int32_t content_indent = yaml::measure_indent<false>(indent_probe, end, ctx);
 6266|  22.1k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (6266:26): [True: 4, False: 22.1k]
  ------------------
 6267|      4|                        return;
 6268|  22.1k|                     content_token = indent_probe;
 6269|       |
 6270|       |                     // A tag at the end of a sequence/map entry has an empty value
 6271|       |                     // unless the next non-empty content is nested under the current node.
 6272|  22.1k|                     bool tagged_indentless_sequence = false;
 6273|  22.1k|                     if (tag == yaml::yaml_tag::seq && indent_probe != end && *indent_probe == '-') {
  ------------------
  |  Branch (6273:26): [True: 2.58k, False: 19.5k]
  |  Branch (6273:56): [True: 2.58k, False: 0]
  |  Branch (6273:79): [True: 2.22k, False: 362]
  ------------------
 6274|  2.22k|                        const auto after_dash = indent_probe + 1;
 6275|  2.22k|                        if (after_dash == end ||
  ------------------
  |  Branch (6275:29): [True: 249, False: 1.97k]
  ------------------
 6276|  1.97k|                            yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_dash)]) {
  ------------------
  |  Branch (6276:29): [True: 1.54k, False: 424]
  ------------------
 6277|  1.79k|                           tagged_indentless_sequence =
 6278|  1.79k|                              (content_indent == ctx.current_indent()) ||
  ------------------
  |  Branch (6278:31): [True: 559, False: 1.23k]
  ------------------
 6279|  1.23k|                              (ctx.current_indent() > 0 && (content_indent + 1) == ctx.current_indent());
  ------------------
  |  Branch (6279:32): [True: 563, False: 674]
  |  Branch (6279:60): [True: 484, False: 79]
  ------------------
 6280|  1.79k|                        }
 6281|  2.22k|                     }
 6282|       |
 6283|  22.1k|                     consume_following_content = (ctx.current_indent() < 0) ||
  ------------------
  |  Branch (6283:50): [True: 1.35k, False: 20.7k]
  ------------------
 6284|  20.7k|                                                 (content_indent > ctx.current_indent()) || tagged_indentless_sequence;
  ------------------
  |  Branch (6284:50): [True: 5.02k, False: 15.7k]
  |  Branch (6284:93): [True: 1.04k, False: 14.7k]
  ------------------
 6285|  22.1k|                  }
 6286|       |
 6287|  23.5k|                  if (consume_following_content) {
  ------------------
  |  Branch (6287:23): [True: 7.42k, False: 16.1k]
  ------------------
 6288|  7.42k|                     it = content_token;
 6289|  7.42k|                  }
 6290|  16.1k|                  else {
 6291|  16.1k|                     if (tag == yaml::yaml_tag::str) {
  ------------------
  |  Branch (6291:26): [True: 2.05k, False: 14.0k]
  ------------------
 6292|  2.05k|                        if constexpr (counts::n_str > 0) {
 6293|  2.05k|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_str>;
 6294|  2.05k|                           using StrType = std::variant_alternative_t<first_idx, V>;
 6295|  2.05k|                           value = StrType{};
 6296|  2.05k|                           return;
 6297|  2.05k|                        }
 6298|  2.05k|                     }
 6299|  16.1k|                     if (tag == yaml::yaml_tag::null_tag) {
  ------------------
  |  Branch (6299:26): [True: 347, False: 15.7k]
  ------------------
 6300|    347|                        if constexpr (counts::n_null > 0) {
 6301|    347|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6302|    347|                           using NullType = std::variant_alternative_t<first_idx, V>;
 6303|    347|                           if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6303:32): [True: 0, False: 347]
  ------------------
 6304|    347|                           return;
 6305|    347|                        }
 6306|    347|                     }
 6307|  16.1k|                     if (tag == yaml::yaml_tag::none) {
  ------------------
  |  Branch (6307:26): [True: 13.3k, False: 2.72k]
  ------------------
 6308|  13.3k|                        if constexpr (counts::n_null > 0) {
 6309|  13.3k|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6310|  13.3k|                           using NullType = std::variant_alternative_t<first_idx, V>;
 6311|  13.3k|                           if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6311:32): [True: 0, False: 13.3k]
  ------------------
 6312|  13.3k|                           return;
 6313|  13.3k|                        }
 6314|  13.3k|                     }
 6315|  16.1k|                  }
 6316|  23.5k|               }
 6317|  79.0k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6318|       |                  // In block context, a comma immediately after a tag token is malformed
 6319|       |                  // (e.g., "!!str, value"). Flow context has legitimate ", ] }" usage.
 6320|  79.0k|                  if (it != end && *it == ',') {
  ------------------
  |  Branch (6320:23): [True: 62.2k, False: 16.7k]
  |  Branch (6320:36): [True: 14, False: 62.2k]
  ------------------
 6321|     14|                     ctx.error = error_code::syntax_error;
 6322|     14|                     return;
 6323|     14|                  }
 6324|  79.0k|                  if constexpr (counts::n_object > 0) {
 6325|       |                     // Tagged keys like "!!str key: value" must parse as mappings.
 6326|  79.0k|                     const bool starts_block_sequence_entry =
 6327|  79.0k|                        (it != end && *it == '-') &&
  ------------------
  |  Branch (6327:26): [True: 62.2k, False: 16.7k]
  |  Branch (6327:39): [True: 3.64k, False: 58.6k]
  ------------------
 6328|  3.64k|                        ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
  ------------------
  |  Branch (6328:26): [True: 529, False: 3.11k]
  |  Branch (6328:45): [True: 2.32k, False: 788]
  ------------------
 6329|  79.0k|                     if (!starts_block_sequence_entry && yaml::line_could_be_block_mapping(it, end)) {
  ------------------
  |  Branch (6329:26): [True: 60.3k, False: 18.6k]
  |  Branch (6329:58): [True: 17.9k, False: 42.4k]
  ------------------
 6330|       |                        // Re-dispatch from the post-tag token so '&key key: val' is
 6331|       |                        // handled by the anchor-aware key path, not as a map-level anchor.
 6332|  17.9k|                        redispatch<Opts>(value, ctx, it, end);
 6333|  17.9k|                        return;
 6334|  17.9k|                     }
 6335|  79.0k|                  }
 6336|  79.0k|               }
 6337|  79.0k|               if (it == end) {
  ------------------
  |  Branch (6337:20): [True: 989, False: 78.0k]
  ------------------
 6338|    989|                  if (tag == yaml::yaml_tag::str) {
  ------------------
  |  Branch (6338:23): [True: 306, False: 683]
  ------------------
 6339|    306|                     if constexpr (counts::n_str > 0) {
 6340|    306|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_str>;
 6341|    306|                        using StrType = std::variant_alternative_t<first_idx, V>;
 6342|    306|                        value = StrType{};
 6343|    306|                        return;
 6344|    306|                     }
 6345|    306|                  }
 6346|    989|                  if (tag == yaml::yaml_tag::none) {
  ------------------
  |  Branch (6346:23): [True: 658, False: 331]
  ------------------
 6347|    658|                     if constexpr (counts::n_null > 0) {
 6348|    658|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6349|    658|                        using NullType = std::variant_alternative_t<first_idx, V>;
 6350|    658|                        if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6350:29): [True: 0, False: 658]
  ------------------
 6351|    658|                        return;
 6352|    658|                     }
 6353|    658|                  }
 6354|      0|                  ctx.error = error_code::unexpected_end;
 6355|    989|                  return;
 6356|    989|               }
 6357|  78.0k|               switch (tag) {
 6358|  1.10k|               case yaml::yaml_tag::str:
  ------------------
  |  Branch (6358:16): [True: 1.10k, False: 76.9k]
  ------------------
 6359|  1.10k|                  process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6360|  1.10k|                  return;
 6361|  3.28k|               case yaml::yaml_tag::int_tag:
  ------------------
  |  Branch (6361:16): [True: 3.28k, False: 74.7k]
  ------------------
 6362|  3.40k|               case yaml::yaml_tag::float_tag:
  ------------------
  |  Branch (6362:16): [True: 124, False: 77.9k]
  ------------------
 6363|  3.40k|                  if constexpr (counts::n_num > 0) {
 6364|  3.40k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, ctx, it, end);
 6365|  3.40k|                     return;
 6366|       |                  }
 6367|       |                  else { // else used to fix MSVC unreachable code warning
 6368|       |                     ctx.error = error_code::syntax_error;
 6369|       |                     return;
 6370|       |                  }
 6371|  12.5k|               case yaml::yaml_tag::bool_tag:
  ------------------
  |  Branch (6371:16): [True: 9.18k, False: 68.8k]
  ------------------
 6372|  12.5k|                  if constexpr (counts::n_bool > 0) {
 6373|  12.5k|                     process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it, end);
 6374|  12.5k|                     return;
 6375|       |                  }
 6376|       |                  else { // else used to fix MSVC unreachable code warning
 6377|       |                     ctx.error = error_code::syntax_error;
 6378|       |                     return;
 6379|       |                  }
 6380|  12.8k|               case yaml::yaml_tag::null_tag:
  ------------------
  |  Branch (6380:16): [True: 298, False: 77.7k]
  ------------------
 6381|  12.8k|                  if constexpr (counts::n_null > 0) {
 6382|  12.8k|                     constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6383|  12.8k|                     using NullType = std::variant_alternative_t<first_idx, V>;
 6384|  12.8k|                     if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6384:26): [True: 0, False: 12.8k]
  ------------------
 6385|  12.8k|                     from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6386|  12.8k|                     return;
 6387|       |                  }
 6388|       |                  else { // else used to fix MSVC unreachable code warning
 6389|       |                     ctx.error = error_code::syntax_error;
 6390|       |                     return;
 6391|       |                  }
 6392|  17.3k|               case yaml::yaml_tag::map:
  ------------------
  |  Branch (6392:16): [True: 4.48k, False: 73.5k]
  ------------------
 6393|  17.3k|                  if constexpr (counts::n_object > 0) {
 6394|  17.3k|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6395|  17.3k|                                                                                                     end);
 6396|  17.3k|                     return;
 6397|       |                  }
 6398|       |                  else { // else used to fix MSVC unreachable code warning
 6399|       |                     ctx.error = error_code::syntax_error;
 6400|       |                     return;
 6401|       |                  }
 6402|  27.7k|               case yaml::yaml_tag::seq:
  ------------------
  |  Branch (6402:16): [True: 10.4k, False: 67.6k]
  ------------------
 6403|  27.7k|                  if constexpr (counts::n_array > 0) {
 6404|  27.7k|                     const bool prev_allow_indentless_sequence = ctx.allow_indentless_sequence;
 6405|  27.7k|                     if constexpr (!yaml::check_flow_context(Opts)) {
 6406|  27.7k|                        if (it != end && *it == '-') {
  ------------------
  |  Branch (6406:29): [True: 10.4k, False: 17.3k]
  |  Branch (6406:42): [True: 1.90k, False: 8.50k]
  ------------------
 6407|  1.90k|                           ctx.allow_indentless_sequence = true;
 6408|  1.90k|                        }
 6409|  27.7k|                     }
 6410|  27.7k|                     process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6411|  27.7k|                                                                                                    end);
 6412|  27.7k|                     ctx.allow_indentless_sequence = prev_allow_indentless_sequence;
 6413|  27.7k|                     return;
 6414|       |                  }
 6415|       |                  else { // else used to fix MSVC unreachable code warning
 6416|       |                     ctx.error = error_code::syntax_error;
 6417|       |                     return;
 6418|       |                  }
 6419|  43.2k|               default: {
  ------------------
  |  Branch (6419:16): [True: 15.4k, False: 62.5k]
  ------------------
 6420|       |                  // Explicit unknown/non-core tags disable implicit scalar resolution.
 6421|       |                  // Preserve collection kinds, otherwise treat as string content.
 6422|  43.2k|                  if (it != end && *it == '*') {
  ------------------
  |  Branch (6422:23): [True: 15.4k, False: 27.7k]
  |  Branch (6422:36): [True: 2.89k, False: 12.5k]
  ------------------
 6423|  2.89k|                     yaml::handle_alias<Opts>(value, ctx, it, end);
 6424|  2.89k|                     return;
 6425|  2.89k|                  }
 6426|       |
 6427|  40.3k|                  if constexpr (counts::n_array > 0) {
 6428|  40.3k|                     if (it != end && *it == '[') {
  ------------------
  |  Branch (6428:26): [True: 12.5k, False: 27.7k]
  |  Branch (6428:39): [True: 305, False: 12.2k]
  ------------------
 6429|    305|                        process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6430|    305|                                                                                                       end);
 6431|    305|                        return;
 6432|    305|                     }
 6433|  40.3k|                  }
 6434|  40.3k|                  if constexpr (counts::n_object > 0) {
 6435|  40.3k|                     if (it != end && *it == '{') {
  ------------------
  |  Branch (6435:26): [True: 12.2k, False: 28.0k]
  |  Branch (6435:39): [True: 329, False: 11.9k]
  ------------------
 6436|    329|                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6437|    329|                                                                                                        end);
 6438|    329|                        return;
 6439|    329|                     }
 6440|  40.3k|                  }
 6441|       |
 6442|  40.3k|                  if constexpr (!yaml::check_flow_context(Opts)) {
 6443|  40.3k|                     if constexpr (counts::n_array > 0) {
 6444|  40.3k|                        const bool starts_block_sequence_entry =
 6445|  40.3k|                           (it != end && *it == '-') &&
  ------------------
  |  Branch (6445:29): [True: 11.9k, False: 28.4k]
  |  Branch (6445:42): [True: 1.36k, False: 10.5k]
  ------------------
 6446|  1.36k|                           ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
  ------------------
  |  Branch (6446:29): [True: 280, False: 1.08k]
  |  Branch (6446:48): [True: 763, False: 325]
  ------------------
 6447|  40.3k|                        if (starts_block_sequence_entry) {
  ------------------
  |  Branch (6447:29): [True: 1.04k, False: 39.3k]
  ------------------
 6448|  1.04k|                           process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx,
 6449|  1.04k|                                                                                                          it, end);
 6450|  1.04k|                           return;
 6451|  1.04k|                        }
 6452|  40.3k|                     }
 6453|  40.3k|                     if constexpr (counts::n_object > 0) {
 6454|  40.3k|                        const bool starts_explicit_mapping_indicator =
 6455|  40.3k|                           (it != end && (*it == '?' || *it == ':')) &&
  ------------------
  |  Branch (6455:29): [True: 10.8k, False: 29.4k]
  |  Branch (6455:43): [True: 934, False: 9.96k]
  |  Branch (6455:57): [True: 723, False: 9.24k]
  ------------------
 6456|  1.65k|                           ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
  ------------------
  |  Branch (6456:29): [True: 328, False: 1.32k]
  |  Branch (6456:48): [True: 589, False: 740]
  ------------------
 6457|  40.3k|                        if (starts_explicit_mapping_indicator) {
  ------------------
  |  Branch (6457:29): [True: 917, False: 39.4k]
  ------------------
 6458|    917|                           process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx,
 6459|    917|                                                                                                           it, end);
 6460|    917|                           return;
 6461|    917|                        }
 6462|  39.4k|                        if (yaml::line_could_be_block_mapping(it, end)) {
  ------------------
  |  Branch (6462:29): [True: 0, False: 39.4k]
  ------------------
 6463|      0|                           process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx,
 6464|      0|                                                                                                           it, end);
 6465|      0|                           return;
 6466|      0|                        }
 6467|  39.4k|                     }
 6468|  40.3k|                  }
 6469|       |
 6470|  40.3k|                  if constexpr (counts::n_str > 0) {
 6471|  40.3k|                     process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6472|  40.3k|                     return;
 6473|  40.3k|                  }
 6474|       |
 6475|       |                  // Fall back if no string alternative exists.
 6476|      0|                  redispatch<Opts>(value, ctx, it, end);
 6477|  40.3k|                  return;
 6478|  43.2k|               }
 6479|  78.0k|               }
 6480|      0|               return;
 6481|  78.0k|            }
 6482|  22.7k|            case '{':
  ------------------
  |  Branch (6482:13): [True: 22.7k, False: 643k]
  ------------------
 6483|  22.7k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6484|       |                  // In block context, "{...}: value" can be a complex mapping key.
 6485|  22.7k|                  if (ctx.current_indent() < 0 && yaml::line_could_be_block_mapping(it, end)) {
  ------------------
  |  Branch (6485:23): [True: 9.67k, False: 13.0k]
  |  Branch (6485:51): [True: 891, False: 8.78k]
  ------------------
 6486|    891|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6487|    891|                                                                                                     end);
 6488|    891|                     return;
 6489|    891|                  }
 6490|  22.7k|               }
 6491|       |               // Flow mapping - object type
 6492|  21.8k|               process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it, end);
 6493|  22.7k|               return;
 6494|  27.6k|            case '[':
  ------------------
  |  Branch (6494:13): [True: 27.6k, False: 638k]
  ------------------
 6495|  27.6k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6496|       |                  // In block context, "[...]: value" can be a complex mapping key.
 6497|  27.6k|                  if (ctx.current_indent() < 0 && yaml::line_could_be_block_mapping(it, end)) {
  ------------------
  |  Branch (6497:23): [True: 18.2k, False: 9.40k]
  |  Branch (6497:51): [True: 941, False: 17.3k]
  ------------------
 6498|    941|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6499|    941|                                                                                                     end);
 6500|    941|                     return;
 6501|    941|                  }
 6502|  27.6k|               }
 6503|       |               // Flow sequence - array type
 6504|  26.7k|               process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it, end);
 6505|  27.6k|               return;
 6506|  77.7k|            case '?':
  ------------------
  |  Branch (6506:13): [True: 77.7k, False: 588k]
  ------------------
 6507|       |               // Explicit mapping key indicator ("? key")
 6508|  77.7k|               if ((end - it >= 2) && it[1] == '\t') {
  ------------------
  |  Branch (6508:20): [True: 77.6k, False: 27]
  |  Branch (6508:39): [True: 2, False: 77.6k]
  ------------------
 6509|      2|                  ctx.error = error_code::syntax_error;
 6510|      2|                  return;
 6511|      2|               }
 6512|  77.7k|               if ((end - it >= 2) && (it[1] == ' ' || it[1] == '\n' || it[1] == '\r')) {
  ------------------
  |  Branch (6512:20): [True: 77.6k, False: 27]
  |  Branch (6512:40): [True: 27.8k, False: 49.7k]
  |  Branch (6512:56): [True: 28.3k, False: 21.4k]
  |  Branch (6512:73): [True: 16.4k, False: 5.02k]
  ------------------
 6513|  72.6k|                  if constexpr (counts::n_object > 0) {
 6514|  72.6k|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6515|  72.6k|                                                                                                     end);
 6516|  72.6k|                     return;
 6517|  72.6k|                  }
 6518|  72.6k|               }
 6519|      0|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6520|  77.7k|               return;
 6521|     12|            case '%':
  ------------------
  |  Branch (6521:13): [True: 12, False: 665k]
  ------------------
 6522|       |               // Reserved directive indicator is not a plain scalar start.
 6523|     12|               ctx.error = error_code::syntax_error;
 6524|     12|               return;
 6525|  2.10k|            case '"':
  ------------------
  |  Branch (6525:13): [True: 2.10k, False: 663k]
  ------------------
 6526|  3.11k|            case '\'':
  ------------------
  |  Branch (6526:13): [True: 1.01k, False: 664k]
  ------------------
 6527|       |               // Could be a quoted string OR a quoted key in a block mapping
 6528|       |               // Try block mapping first (e.g., "key": value), then fall back to string
 6529|  3.11k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6530|  3.11k|               return;
 6531|  7.54k|            case 't':
  ------------------
  |  Branch (6531:13): [True: 7.54k, False: 658k]
  ------------------
 6532|  11.1k|            case 'T':
  ------------------
  |  Branch (6532:13): [True: 3.63k, False: 662k]
  ------------------
 6533|       |               // Could be "true", "True", "TRUE", or a key/string starting with t/T
 6534|  11.1k|               if constexpr (counts::n_bool > 0) {
 6535|  11.1k|                  if ((end - it >= 4) && ((it[1] == 'r' && it[2] == 'u' && it[3] == 'e') ||
  ------------------
  |  Branch (6535:23): [True: 10.2k, False: 935]
  |  Branch (6535:44): [True: 7.89k, False: 2.35k]
  |  Branch (6535:60): [True: 7.07k, False: 819]
  |  Branch (6535:76): [True: 6.31k, False: 760]
  ------------------
 6536|  6.98k|                                          (it[1] == 'R' && it[2] == 'U' && it[3] == 'E'))) {
  ------------------
  |  Branch (6536:44): [True: 1.20k, False: 2.73k]
  |  Branch (6536:60): [True: 934, False: 270]
  |  Branch (6536:76): [True: 665, False: 269]
  ------------------
 6537|       |                     // Check what follows the word "true"
 6538|  6.98k|                     const auto after_true = it + 4;
 6539|  6.98k|                     const bool at_word_boundary = is_word_boundary(after_true);
 6540|       |
 6541|  6.98k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6541:26): [True: 6.73k, False: 245]
  ------------------
 6542|  6.73k|                        if (has_indented_block_continuation(after_true)) {
  ------------------
  |  Branch (6542:29): [True: 305, False: 6.43k]
  ------------------
 6543|    305|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6544|    305|                           return;
 6545|    305|                        }
 6546|       |                        // Check if this is a key (followed by ": ") rather than a boolean value
 6547|       |                        // "true: value" should parse as {true: value}, not as the boolean true
 6548|  6.43k|                        if ((end - it > 4) && it[4] == ':' &&
  ------------------
  |  Branch (6548:29): [True: 5.81k, False: 613]
  |  Branch (6548:47): [True: 2.31k, False: 3.49k]
  ------------------
 6549|  2.31k|                            (end - it == 5 || it[5] == ' ' || it[5] == '\t' || it[5] == '\n' || it[5] == '\r')) {
  ------------------
  |  Branch (6549:30): [True: 908, False: 1.41k]
  |  Branch (6549:47): [True: 508, False: 903]
  |  Branch (6549:63): [True: 258, False: 645]
  |  Branch (6549:80): [True: 377, False: 268]
  |  Branch (6549:97): [True: 268, False: 0]
  ------------------
 6550|       |                           // This is "true:" followed by space/tab/newline/end - treat as key
 6551|  2.31k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6552|  2.31k|                           return;
 6553|  2.31k|                        }
 6554|  4.11k|                        process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it,
 6555|  4.11k|                                                                                                      end);
 6556|  4.11k|                        return;
 6557|  6.43k|                     }
 6558|       |                     // "true" is followed by more characters (e.g., "True\b") - treat as string
 6559|  6.98k|                  }
 6560|  11.1k|               }
 6561|  4.45k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6562|  11.1k|               return;
 6563|  8.50k|            case 'f':
  ------------------
  |  Branch (6563:13): [True: 8.50k, False: 657k]
  ------------------
 6564|  13.8k|            case 'F':
  ------------------
  |  Branch (6564:13): [True: 5.39k, False: 660k]
  ------------------
 6565|       |               // Could be "false", "False", "FALSE", or a key/string starting with f/F
 6566|  13.8k|               if constexpr (counts::n_bool > 0) {
 6567|  13.8k|                  if ((end - it >= 5) && ((it[1] == 'a' && it[2] == 'l' && it[3] == 's' && it[4] == 'e') ||
  ------------------
  |  Branch (6567:23): [True: 13.5k, False: 301]
  |  Branch (6567:44): [True: 8.77k, False: 4.82k]
  |  Branch (6567:60): [True: 8.05k, False: 723]
  |  Branch (6567:76): [True: 5.93k, False: 2.11k]
  |  Branch (6567:92): [True: 5.45k, False: 482]
  ------------------
 6568|  8.14k|                                          (it[1] == 'A' && it[2] == 'L' && it[3] == 'S' && it[4] == 'E'))) {
  ------------------
  |  Branch (6568:44): [True: 1.43k, False: 6.70k]
  |  Branch (6568:60): [True: 1.17k, False: 258]
  |  Branch (6568:76): [True: 918, False: 259]
  |  Branch (6568:92): [True: 612, False: 306]
  ------------------
 6569|       |                     // Check what follows the word "false"
 6570|  6.06k|                     const auto after_false = it + 5;
 6571|  6.06k|                     const bool at_word_boundary = is_word_boundary(after_false);
 6572|       |
 6573|  6.06k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6573:26): [True: 5.45k, False: 609]
  ------------------
 6574|  5.45k|                        if (has_indented_block_continuation(after_false)) {
  ------------------
  |  Branch (6574:29): [True: 354, False: 5.10k]
  ------------------
 6575|    354|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6576|    354|                           return;
 6577|    354|                        }
 6578|       |                        // Check if this is a key (followed by ": ") rather than a boolean value
 6579|       |                        // "false: value" should parse as {false: value}, not as the boolean false
 6580|  5.10k|                        if ((end - it > 5) && it[5] == ':' &&
  ------------------
  |  Branch (6580:29): [True: 4.81k, False: 290]
  |  Branch (6580:47): [True: 1.59k, False: 3.21k]
  ------------------
 6581|  1.59k|                            (end - it == 6 || it[6] == ' ' || it[6] == '\t' || it[6] == '\n' || it[6] == '\r')) {
  ------------------
  |  Branch (6581:30): [True: 144, False: 1.45k]
  |  Branch (6581:47): [True: 231, False: 1.22k]
  |  Branch (6581:63): [True: 275, False: 945]
  |  Branch (6581:80): [True: 260, False: 685]
  |  Branch (6581:97): [True: 685, False: 0]
  ------------------
 6582|       |                           // This is "false:" followed by space/tab/newline/end - treat as key
 6583|  1.59k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6584|  1.59k|                           return;
 6585|  1.59k|                        }
 6586|  3.50k|                        process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it,
 6587|  3.50k|                                                                                                      end);
 6588|  3.50k|                        return;
 6589|  5.10k|                     }
 6590|       |                     // "false" is followed by more characters (e.g., "False\b") - treat as string
 6591|  6.06k|                  }
 6592|  13.8k|               }
 6593|  8.44k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6594|  13.8k|               return;
 6595|  9.58k|            case 'n':
  ------------------
  |  Branch (6595:13): [True: 9.58k, False: 656k]
  ------------------
 6596|  19.9k|            case 'N':
  ------------------
  |  Branch (6596:13): [True: 10.3k, False: 655k]
  ------------------
 6597|       |               // Could be "null", "Null", "NULL", or a key/string starting with n/N
 6598|  19.9k|               if constexpr (counts::n_null > 0) {
 6599|  19.9k|                  if ((end - it >= 4) && ((it[1] == 'u' && it[2] == 'l' && it[3] == 'l') ||
  ------------------
  |  Branch (6599:23): [True: 19.7k, False: 253]
  |  Branch (6599:44): [True: 11.4k, False: 8.31k]
  |  Branch (6599:60): [True: 10.1k, False: 1.27k]
  |  Branch (6599:76): [True: 4.79k, False: 5.34k]
  ------------------
 6600|  14.9k|                                          (it[1] == 'U' && it[2] == 'L' && it[3] == 'L'))) {
  ------------------
  |  Branch (6600:44): [True: 7.48k, False: 7.43k]
  |  Branch (6600:60): [True: 6.81k, False: 668]
  |  Branch (6600:76): [True: 6.49k, False: 324]
  ------------------
 6601|       |                     // Check what follows the word "null"
 6602|  11.2k|                     const auto after_null = it + 4;
 6603|  11.2k|                     const bool at_word_boundary = is_word_boundary(after_null);
 6604|       |
 6605|  11.2k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6605:26): [True: 9.84k, False: 1.45k]
  ------------------
 6606|  9.84k|                        if (has_indented_block_continuation(after_null)) {
  ------------------
  |  Branch (6606:29): [True: 309, False: 9.53k]
  ------------------
 6607|    309|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6608|    309|                           return;
 6609|    309|                        }
 6610|       |                        // Check if this is a key (followed by ": ") rather than a null value
 6611|       |                        // "null: value" should parse as {null: value}, not as the null type
 6612|  9.53k|                        if ((end - it > 4) && it[4] == ':' &&
  ------------------
  |  Branch (6612:29): [True: 9.14k, False: 386]
  |  Branch (6612:47): [True: 1.30k, False: 7.83k]
  ------------------
 6613|  1.30k|                            (end - it == 5 || it[5] == ' ' || it[5] == '\t' || it[5] == '\n' || it[5] == '\r')) {
  ------------------
  |  Branch (6613:30): [True: 257, False: 1.05k]
  |  Branch (6613:47): [True: 249, False: 802]
  |  Branch (6613:63): [True: 219, False: 583]
  |  Branch (6613:80): [True: 350, False: 233]
  |  Branch (6613:97): [True: 233, False: 0]
  ------------------
 6614|       |                           // This is "null:" followed by space/tab/newline/end - treat as key
 6615|  1.30k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6616|  1.30k|                           return;
 6617|  1.30k|                        }
 6618|  8.22k|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6619|  8.22k|                        using NullType = std::variant_alternative_t<first_idx, V>;
 6620|  8.22k|                        if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6620:29): [True: 0, False: 8.22k]
  ------------------
 6621|  8.22k|                        from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6622|  8.22k|                        return;
 6623|  9.53k|                     }
 6624|       |                     // "null" is followed by more characters (e.g., "Null\b") - treat as string
 6625|  11.2k|                  }
 6626|  19.9k|               }
 6627|  10.1k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6628|  19.9k|               return;
 6629|  1.50k|            case '~':
  ------------------
  |  Branch (6629:13): [True: 1.50k, False: 664k]
  ------------------
 6630|       |               // Null indicator
 6631|  1.50k|               if constexpr (counts::n_null > 0) {
 6632|  1.50k|                  constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6633|  1.50k|                  using NullType = std::variant_alternative_t<first_idx, V>;
 6634|  1.50k|                  if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6634:23): [True: 0, False: 1.50k]
  ------------------
 6635|  1.50k|                  from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6636|  1.50k|                  return;
 6637|  1.50k|               }
 6638|      0|               break; // Fall through to try other types
 6639|  42.8k|            case '-':
  ------------------
  |  Branch (6639:13): [True: 42.8k, False: 623k]
  ------------------
 6640|       |               // Could be negative number or block sequence indicator
 6641|  42.8k|               if (((it + 1) == end) || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(it[1])]) {
  ------------------
  |  Branch (6641:20): [True: 524, False: 42.3k]
  |  Branch (6641:41): [True: 33.2k, False: 9.07k]
  ------------------
 6642|       |                  // Block sequence indicator "- "
 6643|  33.8k|                  if constexpr (counts::n_array > 0) {
 6644|  33.8k|                     process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6645|  33.8k|                                                                                                    end);
 6646|  33.8k|                     return;
 6647|  33.8k|                  }
 6648|  33.8k|               }
 6649|  42.8k|               if constexpr (counts::n_num > 0) {
 6650|  42.8k|                  if ((end - it >= 2) && (std::isdigit(static_cast<unsigned char>(it[1])) || it[1] == '.')) {
  ------------------
  |  Branch (6650:23): [True: 9.07k, False: 33.8k]
  |  Branch (6650:43): [True: 727, False: 8.35k]
  |  Branch (6650:94): [True: 827, False: 7.52k]
  ------------------
 6651|  1.55k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, ctx, it, end);
 6652|  1.55k|                     return;
 6653|  1.55k|                  }
 6654|  42.8k|               }
 6655|  41.3k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6656|  42.8k|               return;
 6657|  3.49k|            case '+':
  ------------------
  |  Branch (6657:13): [True: 3.49k, False: 662k]
  ------------------
 6658|  9.64k|            case '.':
  ------------------
  |  Branch (6658:13): [True: 6.14k, False: 659k]
  ------------------
 6659|       |               // Could be a number (.5, +5, .inf, etc.) or a string (.c, .cpp, +name, etc.)
 6660|       |               // Try parsing as number speculatively, fall back to string on failure
 6661|  9.64k|               if constexpr (counts::n_num > 0) {
 6662|  9.64k|                  auto start_it = it;
 6663|  9.64k|                  auto temp_ctx = ctx.make_speculative();
 6664|  9.64k|                  process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, temp_ctx, it,
 6665|  9.64k|                                                                                               end);
 6666|  9.64k|                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6667|  9.64k|                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6668|  9.64k|                  if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (6668:23): [True: 2.86k, False: 6.77k]
  ------------------
 6669|  2.86k|                     ctx.anchors = std::move(temp_ctx.anchors);
 6670|  2.86k|                     return; // Successfully parsed as number
 6671|  2.86k|                  }
 6672|  6.77k|                  it = start_it; // Restore and fall through to string
 6673|  6.77k|               }
 6674|      0|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6675|  9.64k|               return;
 6676|   151k|            default:
  ------------------
  |  Branch (6676:13): [True: 151k, False: 514k]
  ------------------
 6677|       |               // Check for digit (0-9) - numeric or block mapping key starting with digit
 6678|   151k|               if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (6678:20): [True: 105k, False: 45.5k]
  |  Branch (6678:32): [True: 30.7k, False: 75.0k]
  ------------------
 6679|       |                  // Try block mapping first (e.g., "123key: value")
 6680|  30.7k|                  if (try_parse_block_mapping_into_variant<V, Opts>(value, ctx, it, end)) {
  ------------------
  |  Branch (6680:23): [True: 9.88k, False: 20.8k]
  ------------------
 6681|  9.88k|                     return;
 6682|  9.88k|                  }
 6683|       |                  // Try numeric value speculatively - values like "12:30" look numeric but aren't
 6684|  20.8k|                  if constexpr (counts::n_num > 0) {
 6685|  20.8k|                     auto start_it = it;
 6686|  20.8k|                     auto temp_ctx = ctx.make_speculative();
 6687|  20.8k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, temp_ctx, it,
 6688|  20.8k|                                                                                                  end);
 6689|  20.8k|                     ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6690|  20.8k|                     ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6691|  20.8k|                     if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (6691:26): [True: 4.12k, False: 16.7k]
  ------------------
 6692|  4.12k|                        ctx.anchors = std::move(temp_ctx.anchors);
 6693|  4.12k|                        return; // Successfully parsed as number
 6694|  4.12k|                     }
 6695|  16.7k|                     it = start_it; // Restore and fall through to string
 6696|  16.7k|                  }
 6697|       |                  // Fall through to string
 6698|      0|                  process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6699|  20.8k|                  return;
 6700|  30.7k|               }
 6701|       |               // Plain scalar - try block mapping, then string
 6702|   120k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6703|   120k|               return;
 6704|   665k|            }
 6705|   665k|         }
 6706|       |
 6707|       |         // For non-auto-deducible variants or fallback, try each type until one succeeds
 6708|      0|         constexpr auto N = std::variant_size_v<std::remove_cvref_t<T>>;
 6709|       |
 6710|       |         // This fold discards each alternative's error and reports only that nothing fit, which
 6711|       |         // misdiagnoses a document that exhausted an expansion budget as merely the wrong shape.
 6712|       |         // Kept aside and used only if no alternative parsed, so a later one that does parse
 6713|       |         // (possible under a latched budget if it materializes no key text) is unaffected.
 6714|   665k|         error_code expansion_error{};
 6715|   665k|         std::string_view expansion_message{};
 6716|       |
 6717|   665k|         auto try_parse = [&]<size_t I>() -> bool {
 6718|   665k|            using V = std::variant_alternative_t<I, std::remove_cvref_t<T>>;
 6719|   665k|            auto start = it;
 6720|       |
 6721|   665k|            V v{};
 6722|   665k|            auto temp_ctx = ctx.make_speculative();
 6723|   665k|            from<YAML, V>::template op<Opts>(v, temp_ctx, it, end);
 6724|   665k|            ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6725|   665k|            ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6726|       |
 6727|   665k|            if (!bool(temp_ctx.error)) {
 6728|   665k|               value = std::move(v);
 6729|   665k|               ctx.anchors = std::move(temp_ctx.anchors);
 6730|   665k|               return true;
 6731|   665k|            }
 6732|       |
 6733|   665k|            if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 6734|   665k|               expansion_error = temp_ctx.error;
 6735|   665k|               expansion_message = temp_ctx.custom_error_message;
 6736|   665k|            }
 6737|   665k|            it = start;
 6738|   665k|            return false;
 6739|   665k|         };
 6740|       |
 6741|   665k|         bool parsed = false;
 6742|   665k|         [&]<size_t... Is>(std::index_sequence<Is...>) {
 6743|   665k|            ((parsed = parsed || try_parse.template operator()<Is>()), ...);
 6744|   665k|         }(std::make_index_sequence<N>{});
 6745|       |
 6746|   665k|         if (!parsed) {
  ------------------
  |  Branch (6746:14): [True: 0, False: 665k]
  ------------------
 6747|      0|            if (expansion_error != error_code::none) {
  ------------------
  |  Branch (6747:17): [True: 0, False: 0]
  ------------------
 6748|      0|               ctx.error = expansion_error;
 6749|      0|               ctx.custom_error_message = expansion_message;
 6750|      0|            }
 6751|      0|            else {
 6752|      0|               ctx.error = error_code::no_matching_variant_type;
 6753|      0|            }
 6754|      0|         }
 6755|   665k|      }
_ZN3glz4yaml26alias_token_is_mapping_keyIPKcS3_EEbT_T0_:
  380|  9.42M|      {
  381|  9.42M|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (381:14): [True: 0, False: 9.42M]
  |  Branch (381:27): [True: 8.79M, False: 630k]
  ------------------
  382|   630k|         ++it; // skip '*'
  383|   630k|         auto name = parse_anchor_name(it, end);
  384|   630k|         if (name.empty()) return false;
  ------------------
  |  Branch (384:14): [True: 892, False: 629k]
  ------------------
  385|   629k|         skip_inline_ws(it, end);
  386|   629k|         return (it != end && *it == ':') &&
  ------------------
  |  Branch (386:18): [True: 611k, False: 18.5k]
  |  Branch (386:31): [True: 104k, False: 506k]
  ------------------
  387|   104k|                ((it + 1) == end || whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
  ------------------
  |  Branch (387:18): [True: 18.3k, False: 85.8k]
  |  Branch (387:37): [True: 59.3k, False: 26.4k]
  ------------------
  388|   630k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_22is_yaml_variant_objectEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   273k|      {
 5356|   273k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   273k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   273k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   273k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   273k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 273k, False: 0]
  ------------------
 5366|   273k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   273k|      }
_ZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_:
 4660|   276k|      {
 4661|   276k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4661:14): [True: 0, False: 276k]
  ------------------
 4662|      0|            return;
 4663|       |
 4664|   276k|         yaml::node_preamble_state preamble{};
 4665|   276k|         if (yaml::parse_node_preamble<Opts, yaml::node_property_policy{true, true, false, false}>(
  ------------------
  |  Branch (4665:14): [True: 3.70k, False: 272k]
  ------------------
 4666|   276k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_map(tag); }))
 4667|  3.70k|            return;
 4668|       |
 4669|   272k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 4670|   272k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (4670:14): [True: 8, False: 272k]
  ------------------
 4671|      8|            return;
 4672|       |
 4673|   272k|         using key_t = typename std::remove_cvref_t<T>::key_type;
 4674|   272k|         using val_t = typename std::remove_cvref_t<T>::mapped_type;
 4675|       |
 4676|       |         // Reading a YAML mapping MERGES into the target: an entry overwrites the
 4677|       |         // value of a key that existed before the read and adds new keys, while
 4678|       |         // pre-existing keys the document does not mention are preserved (like a
 4679|       |         // struct/object read, and like json/read.hpp's per-key value[key]).
 4680|       |         // Within a single document a repeated key keeps its FIRST value -- YAML
 4681|       |         // mappings disallow duplicate keys and the conformance suite expects
 4682|       |         // first-wins, which falls out of emplace into an empty map. Any
 4683|       |         // pre-existing entry the document leaves untouched is restored on scope
 4684|       |         // exit (including error paths). When the target starts empty (the common
 4685|       |         // case) this is a no-op with negligible cost.
 4686|   272k|         std::remove_cvref_t<T> preexisting_entries;
 4687|   272k|         if (!value.empty()) {
  ------------------
  |  Branch (4687:14): [True: 0, False: 272k]
  ------------------
 4688|      0|            preexisting_entries = std::move(value);
 4689|      0|            value.clear();
 4690|      0|         }
 4691|   272k|         struct merge_restore_guard
 4692|   272k|         {
 4693|   272k|            std::remove_cvref_t<T>& target;
 4694|   272k|            std::remove_cvref_t<T>& saved;
 4695|   272k|            ~merge_restore_guard()
 4696|   272k|            {
 4697|       |               // emplace is a no-op for keys the document already wrote, so only
 4698|       |               // untouched pre-existing entries are put back.
 4699|   272k|               for (auto& entry : saved) {
 4700|   272k|                  target.emplace(entry.first, std::move(entry.second));
 4701|   272k|               }
 4702|   272k|            }
 4703|   272k|         } merge_restore{value, preexisting_entries};
 4704|       |
 4705|   272k|         const bool treat_as_block_mapping =
 4706|   272k|            !yaml::check_flow_context(Opts) && *it == '{' && yaml::inline_value_has_plain_mapping_indicator(it, end);
  ------------------
  |  Branch (4706:13): [True: 272k, Folded]
  |  Branch (4706:48): [True: 26.2k, False: 246k]
  |  Branch (4706:62): [True: 508, False: 25.7k]
  ------------------
 4707|       |
 4708|   272k|         if (*it == '{' && !treat_as_block_mapping) {
  ------------------
  |  Branch (4708:14): [True: 26.2k, False: 246k]
  |  Branch (4708:28): [True: 25.7k, False: 508]
  ------------------
 4709|       |            // Flow mapping
 4710|  25.7k|            ++it;
 4711|       |            // Skip whitespace and newlines after opening brace
 4712|  25.7k|            yaml::skip_ws_and_newlines(it, end);
 4713|       |
 4714|  25.7k|            if (it != end && *it == '}') {
  ------------------
  |  Branch (4714:17): [True: 25.3k, False: 450]
  |  Branch (4714:30): [True: 3.72k, False: 21.5k]
  ------------------
 4715|  3.72k|               ++it;
 4716|  3.72k|               yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4717|  3.72k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4717:20): [True: 14, False: 3.70k]
  ------------------
 4718|     14|                  return;
 4719|  3.70k|               yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 4720|  3.70k|               return;
 4721|  3.72k|            }
 4722|       |
 4723|  71.7k|            while (it != end) {
  ------------------
  |  Branch (4723:20): [True: 69.6k, False: 2.12k]
  ------------------
 4724|       |               // Skip whitespace and newlines at start of each iteration
 4725|  69.6k|               yaml::skip_ws_and_newlines(it, end);
 4726|       |
 4727|  69.6k|               if (it != end && *it == '}') {
  ------------------
  |  Branch (4727:20): [True: 69.6k, False: 0]
  |  Branch (4727:33): [True: 2.88k, False: 66.7k]
  ------------------
 4728|  2.88k|                  ++it;
 4729|  2.88k|                  yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4730|  2.88k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4730:23): [True: 8, False: 2.87k]
  ------------------
 4731|      8|                     return;
 4732|  2.87k|                  break;
 4733|  2.88k|               }
 4734|       |
 4735|  66.7k|               bool explicit_flow_key = false;
 4736|  66.7k|               auto explicit_probe = it;
 4737|  66.7k|               yaml::skip_inline_ws(explicit_probe, end);
 4738|  66.7k|               if (explicit_probe != end && *explicit_probe == '?') {
  ------------------
  |  Branch (4738:20): [True: 66.7k, False: 0]
  |  Branch (4738:45): [True: 2.83k, False: 63.8k]
  ------------------
 4739|  2.83k|                  const auto after_q = explicit_probe + 1;
 4740|  2.83k|                  if (after_q == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_q)] ||
  ------------------
  |  Branch (4740:23): [True: 10, False: 2.82k]
  |  Branch (4740:41): [True: 1.14k, False: 1.68k]
  ------------------
 4741|  1.94k|                      *after_q == ',' || *after_q == '}') {
  ------------------
  |  Branch (4741:23): [True: 421, False: 1.26k]
  |  Branch (4741:42): [True: 374, False: 886]
  ------------------
 4742|  1.94k|                     explicit_flow_key = true;
 4743|  1.94k|                     it = explicit_probe + 1;
 4744|  1.94k|                     yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4745|  1.94k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4745:26): [True: 2, False: 1.94k]
  ------------------
 4746|      2|                        return;
 4747|  1.94k|                  }
 4748|  2.83k|               }
 4749|       |               // Parse key
 4750|  66.7k|               key_t key{};
 4751|  66.7k|               if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 4752|  66.7k|                  if (explicit_flow_key && it != end && (*it == ':' || *it == ',' || *it == '}')) {
  ------------------
  |  Branch (4752:23): [True: 1.94k, False: 64.7k]
  |  Branch (4752:44): [True: 1.92k, False: 21]
  |  Branch (4752:58): [True: 415, False: 1.51k]
  |  Branch (4752:72): [True: 649, False: 861]
  |  Branch (4752:86): [True: 375, False: 486]
  ------------------
 4753|  1.43k|                     key.clear();
 4754|  1.43k|                  }
 4755|  65.2k|                  else {
 4756|  65.2k|                     auto key_probe = it;
 4757|  65.2k|                     yaml::skip_inline_ws(key_probe, end);
 4758|       |
 4759|       |                     // Use full node parsing only for structurally complex flow keys.
 4760|       |                     // Plain/quoted/alias keys stay on parse_yaml_key() for compatibility.
 4761|  65.2k|                     bool parse_complex_flow_key = false;
 4762|  65.2k|                     if (key_probe != end) {
  ------------------
  |  Branch (4762:26): [True: 65.2k, False: 21]
  ------------------
 4763|  65.2k|                        if (*key_probe == '[' || *key_probe == '{') {
  ------------------
  |  Branch (4763:29): [True: 635, False: 64.6k]
  |  Branch (4763:50): [True: 2.11k, False: 62.5k]
  ------------------
 4764|  2.75k|                           parse_complex_flow_key = true;
 4765|  2.75k|                        }
 4766|  62.5k|                        else if (*key_probe == '&') {
  ------------------
  |  Branch (4766:34): [True: 7.12k, False: 55.3k]
  ------------------
 4767|  7.12k|                           ++key_probe;
 4768|  7.12k|                           yaml::parse_anchor_name(key_probe, end);
 4769|  7.12k|                           yaml::skip_inline_ws(key_probe, end);
 4770|  7.12k|                           if (key_probe != end && (*key_probe == '[' || *key_probe == '{')) {
  ------------------
  |  Branch (4770:32): [True: 7.06k, False: 64]
  |  Branch (4770:53): [True: 467, False: 6.59k]
  |  Branch (4770:74): [True: 795, False: 5.80k]
  ------------------
 4771|  1.26k|                              parse_complex_flow_key = true;
 4772|  1.26k|                           }
 4773|  7.12k|                        }
 4774|  65.2k|                     }
 4775|       |
 4776|  65.2k|                     if (parse_complex_flow_key) {
  ------------------
  |  Branch (4776:26): [True: 4.01k, False: 61.2k]
  ------------------
 4777|  4.01k|                        glz::generic key_node{};
 4778|  4.01k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 4779|  4.01k|                        if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4779:29): [True: 998, False: 3.01k]
  ------------------
 4780|    998|                           return;
 4781|  3.01k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (4781:29): [True: 4, False: 3.01k]
  ------------------
 4782|      4|                           return;
 4783|  3.01k|                     }
 4784|  61.2k|                     else {
 4785|  61.2k|                        if (!yaml::parse_yaml_key(key, ctx, it, end, true)) {
  ------------------
  |  Branch (4785:29): [True: 1.99k, False: 59.2k]
  ------------------
 4786|  1.99k|                           return;
 4787|  1.99k|                        }
 4788|  61.2k|                     }
 4789|  65.2k|                  }
 4790|       |               }
 4791|       |               else {
 4792|       |                  if (explicit_flow_key && it != end && (*it == ':' || *it == ',' || *it == '}')) {
 4793|       |                     ctx.error = error_code::syntax_error;
 4794|       |                     return;
 4795|       |                  }
 4796|       |                  from<YAML, key_t>::template op<yaml::flow_context_on<Opts>()>(key, ctx, it, end);
 4797|       |                  if (bool(ctx.error)) [[unlikely]]
 4798|       |                     return;
 4799|       |               }
 4800|       |
 4801|       |               // Separation between flow key and ':' may include comments/newlines.
 4802|       |               // In flow context, newlines are allowed between key and ':'.
 4803|  63.7k|               yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4804|  66.7k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4804:20): [True: 3, False: 66.7k]
  ------------------
 4805|      3|                  return;
 4806|       |
 4807|  66.7k|               auto parse_implicit_null = [&](val_t& val) -> bool {
 4808|  66.7k|                  if constexpr (nullable_like<std::remove_cvref_t<val_t>>) {
 4809|  66.7k|                     val = {};
 4810|  66.7k|                     return true;
 4811|  66.7k|                  }
 4812|  66.7k|                  else if constexpr (std::same_as<std::remove_cvref_t<val_t>, glz::generic>) {
 4813|  66.7k|                     val = glz::generic{};
 4814|  66.7k|                     return true;
 4815|  66.7k|                  }
 4816|  66.7k|                  else {
 4817|  66.7k|                     static constexpr std::string_view null_value{"null"};
 4818|  66.7k|                     auto null_it = null_value.data();
 4819|  66.7k|                     const yaml::yaml_context::scoped_stream literal_stream{ctx, null_value.data()};
 4820|  66.7k|                     from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(
 4821|  66.7k|                        val, ctx, null_it, null_value.data() + null_value.size());
 4822|  66.7k|                     return !bool(ctx.error);
 4823|  66.7k|                  }
 4824|  66.7k|               };
 4825|       |
 4826|  66.7k|               if (it != end && (*it == ',' || *it == '}')) {
  ------------------
  |  Branch (4826:20): [True: 62.3k, False: 4.38k]
  |  Branch (4826:34): [True: 39.3k, False: 22.9k]
  |  Branch (4826:48): [True: 6.68k, False: 16.3k]
  ------------------
 4827|  46.0k|                  val_t val{};
 4828|  46.0k|                  if (!parse_implicit_null(val)) [[unlikely]]
  ------------------
  |  Branch (4828:23): [True: 0, False: 46.0k]
  ------------------
 4829|      0|                     return;
 4830|       |
 4831|  46.0k|                  value.emplace(std::move(key), std::move(val));
 4832|       |
 4833|  46.0k|                  if (*it == '}') {
  ------------------
  |  Branch (4833:23): [True: 6.68k, False: 39.3k]
  ------------------
 4834|  6.68k|                     ++it;
 4835|  6.68k|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4836|  6.68k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4836:26): [True: 23, False: 6.66k]
  ------------------
 4837|     23|                        return;
 4838|  6.66k|                     break;
 4839|  6.68k|                  }
 4840|       |
 4841|  39.3k|                  ++it; // skip comma
 4842|  39.3k|                  yaml::skip_ws_and_newlines(it, end);
 4843|  39.3k|                  continue;
 4844|  46.0k|               }
 4845|       |
 4846|  20.6k|               if (it == end || *it != ':') {
  ------------------
  |  Branch (4846:20): [True: 4.38k, False: 16.3k]
  |  Branch (4846:33): [True: 266, False: 16.0k]
  ------------------
 4847|  1.65k|                  ctx.error = error_code::syntax_error;
 4848|  1.65k|                  return;
 4849|  1.65k|               }
 4850|  19.0k|               ++it;
 4851|       |
 4852|  19.0k|               yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4853|  19.0k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4853:20): [True: 3, False: 19.0k]
  ------------------
 4854|      3|                  return;
 4855|       |
 4856|       |               // Omitted value after an explicit ':' maps to an implicit null.
 4857|  19.0k|               if (it != end && (*it == ',' || *it == '}')) {
  ------------------
  |  Branch (4857:20): [True: 15.9k, False: 3.07k]
  |  Branch (4857:34): [True: 2.50k, False: 13.4k]
  |  Branch (4857:48): [True: 3.27k, False: 10.1k]
  ------------------
 4858|  5.77k|                  val_t val{};
 4859|  5.77k|                  if (!parse_implicit_null(val)) [[unlikely]]
  ------------------
  |  Branch (4859:23): [True: 0, False: 5.77k]
  ------------------
 4860|      0|                     return;
 4861|       |
 4862|  5.77k|                  value.emplace(std::move(key), std::move(val));
 4863|       |
 4864|  5.77k|                  if (*it == '}') {
  ------------------
  |  Branch (4864:23): [True: 3.27k, False: 2.50k]
  ------------------
 4865|  3.27k|                     ++it;
 4866|  3.27k|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4867|  3.27k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4867:26): [True: 2, False: 3.26k]
  ------------------
 4868|      2|                        return;
 4869|  3.26k|                     break;
 4870|  3.27k|                  }
 4871|       |
 4872|  2.50k|                  ++it; // skip comma
 4873|  2.50k|                  yaml::skip_ws_and_newlines(it, end);
 4874|  2.50k|                  continue;
 4875|  5.77k|               }
 4876|       |
 4877|       |               // Parse value
 4878|  13.2k|               val_t val{};
 4879|  13.2k|               from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(val, ctx, it, end);
 4880|  13.2k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4880:20): [True: 381, False: 12.8k]
  ------------------
 4881|    381|                  return;
 4882|       |
 4883|  12.8k|               value.emplace(std::move(key), std::move(val));
 4884|       |
 4885|  12.8k|               yaml::skip_inline_ws(it, end);
 4886|       |
 4887|  12.8k|               if (it != end && *it == '}') {
  ------------------
  |  Branch (4887:20): [True: 9.56k, False: 3.31k]
  |  Branch (4887:33): [True: 1.27k, False: 8.28k]
  ------------------
 4888|  1.27k|                  ++it;
 4889|  1.27k|                  yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4890|  1.27k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4890:23): [True: 10, False: 1.26k]
  ------------------
 4891|     10|                     return;
 4892|  1.26k|                  break;
 4893|  1.27k|               }
 4894|  11.5k|               else if (it != end && *it == ',') {
  ------------------
  |  Branch (4894:25): [True: 8.28k, False: 3.31k]
  |  Branch (4894:38): [True: 6.75k, False: 1.52k]
  ------------------
 4895|  6.75k|                  ++it;
 4896|       |                  // Skip whitespace and newlines after comma
 4897|  6.75k|                  yaml::skip_ws_and_newlines(it, end);
 4898|  6.75k|               }
 4899|  4.84k|               else if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (4899:25): [True: 1.52k, False: 3.31k]
  |  Branch (4899:39): [True: 541, False: 988]
  |  Branch (4899:54): [True: 922, False: 66]
  ------------------
 4900|       |                  // Newlines may precede either the closing brace or the
 4901|       |                  // separator comma for the next entry.
 4902|  1.46k|                  yaml::skip_ws_and_newlines(it, end);
 4903|  1.46k|                  if (it != end && *it == '}') {
  ------------------
  |  Branch (4903:23): [True: 1.40k, False: 56]
  |  Branch (4903:36): [True: 294, False: 1.11k]
  ------------------
 4904|    294|                     ++it;
 4905|    294|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4906|    294|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4906:26): [True: 2, False: 292]
  ------------------
 4907|      2|                        return;
 4908|    292|                     break;
 4909|    294|                  }
 4910|  1.16k|                  if (it != end && *it == ',') {
  ------------------
  |  Branch (4910:23): [True: 1.11k, False: 56]
  |  Branch (4910:36): [True: 1.08k, False: 29]
  ------------------
 4911|  1.08k|                     ++it;
 4912|  1.08k|                     yaml::skip_ws_and_newlines(it, end);
 4913|  1.08k|                     continue;
 4914|  1.08k|                  }
 4915|     85|                  ctx.error = error_code::syntax_error;
 4916|     85|                  return;
 4917|  1.16k|               }
 4918|  3.37k|               else {
 4919|  3.37k|                  ctx.error = error_code::syntax_error;
 4920|  3.37k|                  return;
 4921|  3.37k|               }
 4922|  12.8k|            }
 4923|  22.0k|         }
 4924|   247k|         else {
 4925|       |            // Block mapping - use shared loop with map-specific callback
 4926|   247k|            yaml::parse_block_mapping_loop<Opts>(
 4927|   247k|               ctx, it, end, int32_t(-1), [&](auto& ctx, auto& it, auto end, int32_t line_indent) -> bool {
 4928|   247k|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|   247k|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 4930|   247k|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|   247k|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|   247k|                           if (ctx.stream_begin) {
 4938|   247k|                              auto is_line_content_start = [&](auto pos) {
 4939|   247k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   247k|                              };
 4941|       |
 4942|   247k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   247k|                                 const char* line = ctx.line_begin_of(pos);
 4944|   247k|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|   247k|                                 return line != end && *line == ':';
 4946|   247k|                              };
 4947|       |
 4948|   247k|                              if (!is_line_content_start(it) &&
 4949|   247k|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
 4950|   247k|                                  !line_has_explicit_value_indicator(it)) {
 4951|   247k|                                 ctx.error = error_code::syntax_error;
 4952|   247k|                                 return false;
 4953|   247k|                              }
 4954|   247k|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|   247k|                           }
 4956|   247k|                        }
 4957|       |
 4958|   247k|                        if (*it == '-' &&
 4959|   247k|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
 4960|   247k|                            !line_starts_with_explicit_value_indicator) {
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|   247k|                           ctx.error = error_code::syntax_error;
 4963|   247k|                           return false;
 4964|   247k|                        }
 4965|       |
 4966|   247k|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 4967|   247k|                           return false;
 4968|   247k|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|   247k|                        ctx.pop_indent();
 4970|   247k|                     }
 4971|   247k|                     else {
 4972|   247k|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|   247k|                        if (nested_indent >= 0) {
 4974|   247k|                           yaml::skip_to_content(it, end);
 4975|   247k|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
 4976|   247k|                              ctx.error = error_code::syntax_error;
 4977|   247k|                              return false;
 4978|   247k|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|   247k|                           const int32_t value_indent =
 4982|   247k|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
 4983|   247k|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
 4984|   247k|                              return false;
 4985|   247k|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|   247k|                           ctx.pop_indent();
 4987|   247k|                        }
 4988|   247k|                     }
 4989|   247k|                     return !bool(ctx.error);
 4990|   247k|                  };
 4991|       |
 4992|       |                  // Explicit key entry form:
 4993|       |                  // ? key
 4994|       |                  // : value
 4995|   247k|                  if (*it == '?' && ((it + 1) != end) && *(it + 1) == '\t') {
 4996|   247k|                     ctx.error = error_code::syntax_error;
 4997|   247k|                     return false;
 4998|   247k|                  }
 4999|   247k|                  if (*it == '?' && ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\n' || *(it + 1) == '\r')) {
 5000|   247k|                     ++it; // skip '?'
 5001|   247k|                     yaml::skip_inline_ws(it, end);
 5002|       |
 5003|   247k|                     const int32_t explicit_value_indicator_indent =
 5004|   247k|                        (ctx.current_indent() < 0) ? 0 : (ctx.current_indent() + 1);
 5005|       |
 5006|   247k|                     key_t key{};
 5007|   247k|                     if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5008|   247k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   247k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   247k|                        };
 5011|       |
 5012|   247k|                        auto key_it = it;
 5013|   247k|                        yaml::skip_inline_ws(key_it, end);
 5014|       |
 5015|   247k|                        auto content = key_it;
 5016|   247k|                        yaml::skip_to_content(content, end);
 5017|   247k|                        bool handled_anchor_only_empty_key = false;
 5018|       |
 5019|       |                        // Anchor on an empty explicit key node:
 5020|       |                        //   ? &a
 5021|       |                        //   : value
 5022|   247k|                        if (content != end && *content == '&') {
 5023|   247k|                           auto anchor_probe = content + 1;
 5024|   247k|                           auto anchor_name = yaml::parse_anchor_name(anchor_probe, end);
 5025|   247k|                           if (!anchor_name.empty()) {
 5026|   247k|                              auto after_anchor = anchor_probe;
 5027|   247k|                              yaml::skip_inline_ws(after_anchor, end);
 5028|       |
 5029|   247k|                              auto value_indicator = after_anchor;
 5030|   247k|                              if (value_indicator != end && *value_indicator == ':') {
 5031|   247k|                                 key.clear();
 5032|   247k|                                 ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5033|   247k|                                 it = value_indicator;
 5034|   247k|                                 handled_anchor_only_empty_key = true;
 5035|   247k|                              }
 5036|   247k|                              else {
 5037|   247k|                                 if (value_indicator != end && *value_indicator == '#') {
 5038|   247k|                                    yaml::skip_comment(value_indicator, end);
 5039|   247k|                                 }
 5040|   247k|                                 if (value_indicator != end && (*value_indicator == '\n' || *value_indicator == '\r')) {
 5041|   247k|                                    yaml::skip_newline(value_indicator, end);
 5042|   247k|                                    auto value_line = value_indicator;
 5043|   247k|                                    int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5044|   247k|                                    if (bool(ctx.error)) [[unlikely]]
 5045|   247k|                                       return false;
 5046|   247k|                                    if (value_line != end && *value_line == ':' &&
 5047|   247k|                                        value_indent == explicit_value_indicator_indent) {
 5048|   247k|                                       key.clear();
 5049|   247k|                                       ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5050|   247k|                                       it = value_line;
 5051|   247k|                                       handled_anchor_only_empty_key = true;
 5052|   247k|                                    }
 5053|   247k|                                    else if (value_line != end && *value_line == ':') {
 5054|       |                                       // In explicit-key form ("? &a"), a following ':'
 5055|       |                                       // starts the outer value indicator only at the same
 5056|       |                                       // indentation. A deeper-indented ': value' is malformed.
 5057|   247k|                                       ctx.error = error_code::syntax_error;
 5058|   247k|                                       return false;
 5059|   247k|                                    }
 5060|   247k|                                 }
 5061|   247k|                              }
 5062|   247k|                           }
 5063|   247k|                        }
 5064|       |
 5065|   247k|                        const bool key_content_spans_lines = [&] {
 5066|   247k|                           auto scan = key_it;
 5067|   247k|                           while (scan != content && scan != end) {
 5068|   247k|                              if (*scan == '\n' || *scan == '\r') return true;
 5069|   247k|                              ++scan;
 5070|   247k|                           }
 5071|   247k|                           return false;
 5072|   247k|                        }();
 5073|       |
 5074|   247k|                        if (handled_anchor_only_empty_key) {
 5075|       |                           // 'it' already points to the explicit value indicator ':'
 5076|   247k|                        }
 5077|   247k|                        else if (content == end || (*content == ':' && key_content_spans_lines)) {
 5078|   247k|                           key.clear();
 5079|   247k|                           it = content;
 5080|   247k|                        }
 5081|   247k|                        else {
 5082|       |                           // Explicit mapping keys ('? key-node') are full YAML nodes.
 5083|       |                           // Parse the key node structurally (not via plain-key scanning)
 5084|       |                           // so inputs like '? []: x' and '? JSON: like' are interpreted
 5085|       |                           // as complex keys, not split into implicit key/value pairs.
 5086|   247k|                           auto key_node_it = content;
 5087|   247k|                           auto key_node_end = end;
 5088|   247k|                           if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 5089|       |                              // In explicit-key form, a following standalone ':'
 5090|       |                              // line (same or lower indentation) belongs to the
 5091|       |                              // outer mapping value, not the key node itself.
 5092|   247k|                              auto scan = content;
 5093|   247k|                              while (scan != end) {
 5094|   247k|                                 while (scan != end && *scan != '\n' && *scan != '\r') {
 5095|   247k|                                    ++scan;
 5096|   247k|                                 }
 5097|   247k|                                 if (scan == end) {
 5098|   247k|                                    break;
 5099|   247k|                                 }
 5100|       |
 5101|   247k|                                 yaml::skip_newline(scan, end);
 5102|   247k|                                 auto line_start = scan;
 5103|       |
 5104|   247k|                                 int32_t indicator_indent = 0;
 5105|   247k|                                 while (scan != end && *scan == ' ') {
 5106|   247k|                                    ++indicator_indent;
 5107|   247k|                                    ++scan;
 5108|   247k|                                 }
 5109|       |
 5110|   247k|                                 if (scan != end && *scan == ':') {
 5111|   247k|                                    const auto after_colon = scan + 1;
 5112|   247k|                                    if ((after_colon == end ||
 5113|   247k|                                         yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
 5114|   247k|                                        indicator_indent <= line_indent) {
 5115|   247k|                                       key_node_end = line_start;
 5116|   247k|                                       break;
 5117|   247k|                                    }
 5118|   247k|                                 }
 5119|   247k|                              }
 5120|   247k|                           }
 5121|       |
 5122|   247k|                           glz::generic key_node{};
 5123|   247k|                           const bool prev_explicit_mapping_key_context = ctx.explicit_mapping_key_context;
 5124|   247k|                           ctx.explicit_mapping_key_context = true;
 5125|   247k|                           from<YAML, glz::generic>::template op<Opts>(key_node, ctx, key_node_it, key_node_end);
 5126|   247k|                           ctx.explicit_mapping_key_context = prev_explicit_mapping_key_context;
 5127|   247k|                           if (bool(ctx.error)) [[unlikely]]
 5128|   247k|                              return false;
 5129|   247k|                           it = key_node_it;
 5130|   247k|                           if (!to_string_key(key_node)) [[unlikely]]
 5131|   247k|                              return false;
 5132|   247k|                        }
 5133|   247k|                     }
 5134|   247k|                     else {
 5135|   247k|                        if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 5136|   247k|                           from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5137|   247k|                           if (bool(ctx.error)) [[unlikely]]
 5138|   247k|                              return false;
 5139|   247k|                        }
 5140|   247k|                     }
 5141|       |
 5142|   247k|                     yaml::skip_inline_ws(it, end);
 5143|   247k|                     yaml::skip_comment(it, end);
 5144|       |
 5145|       |                     // Value indicator may appear on the next line at the same indent.
 5146|   247k|                     if (it != end && (*it == '\n' || *it == '\r')) {
 5147|   247k|                        auto probe = it;
 5148|   247k|                        bool found_value_indicator = false;
 5149|       |
 5150|   247k|                        while (probe != end && (*probe == '\n' || *probe == '\r')) {
 5151|   247k|                           yaml::skip_newline(probe, end);
 5152|       |
 5153|   247k|                           auto value_line = probe;
 5154|   247k|                           int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5155|   247k|                           if (bool(ctx.error)) [[unlikely]]
 5156|   247k|                              return false;
 5157|       |
 5158|   247k|                           if (value_line == end || *value_line == '\n' || *value_line == '\r') {
 5159|   247k|                              probe = value_line;
 5160|   247k|                              continue; // blank line
 5161|   247k|                           }
 5162|   247k|                           if (*value_line == '#') {
 5163|   247k|                              yaml::skip_comment(value_line, end);
 5164|   247k|                              probe = value_line;
 5165|   247k|                              continue; // comment-only line
 5166|   247k|                           }
 5167|   247k|                           if (*value_line == ':' && value_indent == explicit_value_indicator_indent) {
 5168|   247k|                              it = value_line;
 5169|   247k|                              found_value_indicator = true;
 5170|   247k|                           }
 5171|   247k|                           break;
 5172|   247k|                        }
 5173|       |
 5174|   247k|                        if (found_value_indicator) {
 5175|   247k|                           yaml::skip_inline_ws(it, end);
 5176|   247k|                        }
 5177|   247k|                     }
 5178|       |
 5179|   247k|                     val_t val{};
 5180|   247k|                     if (it != end && *it == ':') {
 5181|   247k|                        ++it;
 5182|   247k|                        if (it != end && *it == '\t') {
 5183|   247k|                           ctx.error = error_code::syntax_error;
 5184|   247k|                           return false;
 5185|   247k|                        }
 5186|   247k|                        if (it != end && (*it == '\n' || *it == '\r')) {
 5187|   247k|                           auto probe = it;
 5188|   247k|                           yaml::skip_newline(probe, end);
 5189|   247k|                           while (probe != end && *probe == ' ') ++probe;
 5190|   247k|                           if (probe != end && *probe == ':' && ((probe + 1) != end) && *(probe + 1) == '\t') {
 5191|   247k|                              ctx.error = error_code::syntax_error;
 5192|   247k|                              return false;
 5193|   247k|                           }
 5194|   247k|                        }
 5195|   247k|                        yaml::skip_inline_ws(it, end);
 5196|   247k|                        if (!parse_map_value(val)) [[unlikely]]
 5197|   247k|                           return false;
 5198|   247k|                     }
 5199|       |
 5200|   247k|                     value.emplace(std::move(key), std::move(val));
 5201|   247k|                     return true;
 5202|   247k|                  }
 5203|       |
 5204|   247k|                  key_t key{};
 5205|   247k|                  if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5206|   247k|                     auto key_probe = it;
 5207|   247k|                     yaml::skip_inline_ws(key_probe, end);
 5208|   247k|                     const bool complex_flow_key = (key_probe != end && (*key_probe == '[' || *key_probe == '{'));
 5209|   247k|                     if (complex_flow_key) {
 5210|   247k|                        glz::generic key_node{};
 5211|   247k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 5212|   247k|                        if (bool(ctx.error)) [[unlikely]]
 5213|   247k|                           return false;
 5214|   247k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
 5215|   247k|                           return false;
 5216|   247k|                     }
 5217|   247k|                     else {
 5218|   247k|                        if (!yaml::parse_yaml_key(key, ctx, it, end, false)) {
 5219|   247k|                           return false;
 5220|   247k|                        }
 5221|   247k|                     }
 5222|   247k|                  }
 5223|   247k|                  else {
 5224|   247k|                     from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5225|   247k|                     if (bool(ctx.error)) [[unlikely]]
 5226|   247k|                        return false;
 5227|   247k|                  }
 5228|       |
 5229|   247k|                  yaml::skip_inline_ws(it, end);
 5230|       |
 5231|   247k|                  if (it == end || *it != ':') {
 5232|   247k|                     ctx.error = error_code::syntax_error;
 5233|   247k|                     return false;
 5234|   247k|                  }
 5235|   247k|                  ++it;
 5236|   247k|                  yaml::skip_inline_ws(it, end);
 5237|       |
 5238|   247k|                  val_t val{};
 5239|   247k|                  if (!parse_map_value(val)) [[unlikely]]
 5240|   247k|                     return false;
 5241|       |
 5242|   247k|                  value.emplace(std::move(key), std::move(val));
 5243|   247k|                  return true;
 5244|   247k|               });
 5245|   247k|         }
 5246|       |
 5247|   263k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 5248|   263k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEEXtlNS0_20node_property_policyELb1ELb1EEELb0ERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES4_EEEENS0_12yaml_contextEPKcSC_ZNS_4fromILj450ES8_E2opITnDaXtlS2_Lj450ELb0ELb0ELb1ELb1EEERSC_S9_TkNS_10is_contextERSA_SC_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSL_RSO_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   276k|      {
  475|   276k|         skip_inline_ws(it, end);
  476|       |
  477|   276k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 7, False: 276k]
  ------------------
  478|      7|            if constexpr (!AllowEmptyInput) {
  479|      7|               ctx.error = error_code::unexpected_end;
  480|      7|            }
  481|      7|            return true;
  482|      7|         }
  483|       |
  484|   276k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   276k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 4, False: 276k]
  ------------------
  486|      4|            ctx.error = error_code::syntax_error;
  487|      4|            return true;
  488|      4|         }
  489|   276k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 2, False: 276k]
  ------------------
  490|      2|            ctx.error = error_code::syntax_error;
  491|      2|            return true;
  492|      2|         }
  493|       |
  494|   276k|         skip_inline_ws(it, end);
  495|       |
  496|   276k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 5, False: 276k]
  ------------------
  497|      5|            if constexpr (!AllowEmptyInput) {
  498|      5|               ctx.error = error_code::unexpected_end;
  499|      5|            }
  500|      5|            return true;
  501|      5|         }
  502|       |
  503|   276k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 3.68k, False: 272k]
  ------------------
  504|  3.68k|            return true;
  505|  3.68k|         }
  506|       |
  507|   272k|         return false;
  508|   276k|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlNSD_8yaml_tagEE_clESN_:
 4666|   276k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_map(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEEXtlNS0_20node_property_policyELb1ELb1EEERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES4_EEEENS0_12yaml_contextEPKcSC_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   276k|      {
  418|   276k|         state.has_anchor = false;
  419|   276k|         state.anchor_name.clear();
  420|   276k|         state.anchor_start = nullptr;
  421|   276k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   276k|         if constexpr (Policy.allow_alias) {
  424|   276k|            if constexpr (Policy.alias_can_be_mapping_key) {
  425|   276k|               if (!alias_token_is_mapping_key(it, end)) {
  ------------------
  |  Branch (425:20): [True: 270k, False: 6.03k]
  ------------------
  426|   270k|                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (426:23): [True: 3.65k, False: 266k]
  ------------------
  427|   270k|               }
  428|       |            }
  429|       |            else {
  430|       |               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  431|       |            }
  432|   276k|         }
  433|       |
  434|   276k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 272k, False: 3.65k]
  |  Branch (434:27): [True: 18.2k, False: 254k]
  ------------------
  435|  18.2k|            ++it;
  436|  18.2k|            auto name = parse_anchor_name(it, end);
  437|  18.2k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 17, False: 18.2k]
  ------------------
  438|     17|               ctx.error = error_code::syntax_error;
  439|     17|               return true;
  440|     17|            }
  441|  18.2k|            skip_inline_ws(it, end);
  442|  18.2k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 9, False: 18.2k]
  ------------------
  443|      9|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|      9|                  ctx.error = error_code::unexpected_end;
  445|      9|               }
  446|      9|               return true;
  447|      9|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  18.2k|            state.has_anchor = true;
  455|  18.2k|            state.anchor_name = std::string(name);
  456|  18.2k|            state.anchor_start = &*it;
  457|  18.2k|         }
  458|       |
  459|   276k|         return false;
  460|   276k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES3_EEEENS0_12yaml_contextEPKcSB_EEbOT0_RT1_RT2_T3_:
  309|   270k|      {
  310|   270k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 270k]
  |  Branch (310:27): [True: 266k, False: 3.65k]
  ------------------
  311|       |
  312|  3.65k|         ++it; // skip '*'
  313|  3.65k|         auto name = parse_anchor_name(it, end);
  314|  3.65k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 14, False: 3.64k]
  ------------------
  315|     14|            ctx.error = error_code::syntax_error;
  316|     14|            return true;
  317|     14|         }
  318|       |
  319|  3.64k|         auto anchor_it = ctx.anchors.find(name);
  320|  3.64k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 23, False: 3.61k]
  ------------------
  321|     23|            ctx.error = error_code::syntax_error; // undefined alias
  322|     23|            return true;
  323|     23|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  3.61k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  3.61k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 704, False: 2.91k]
  ------------------
  331|    704|            return true;
  332|    704|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  2.91k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 20, False: 2.89k]
  ------------------
  338|     20|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     20|            return true;
  340|     20|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  2.89k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  2.89k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 2, False: 2.89k]
  ------------------
  348|      2|            return true;
  349|       |
  350|  2.89k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 0, False: 2.89k]
  ------------------
  351|      0|            ctx.error = error_code::exceeded_max_expansion;
  352|      0|            ctx.custom_error_message = "alias expansion";
  353|      0|            return true;
  354|      0|         }
  355|       |
  356|  2.89k|         auto replay_it = span.begin;
  357|  2.89k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  2.89k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  2.89k|         ctx.indent_stack.clear();
  362|  2.89k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 2.05k, False: 839]
  ------------------
  363|  2.05k|            ctx.push_indent(span.base_indent - 1);
  364|  2.05k|         }
  365|       |
  366|  2.89k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  2.89k|         using V = std::remove_cvref_t<T>;
  369|  2.89k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  2.89k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  2.89k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  2.89k|         return true;
  376|  2.89k|      }
_ZN3glz4yaml40inline_value_has_plain_mapping_indicatorIPKcS3_EEbT_T0_:
 3131|  3.24M|      {
 3132|  3.24M|         const auto stop = yaml::implicit_key_scan_end(pos, end);
 3133|       |         // See `line_could_be_block_mapping` for why a quote is an indicator only where a node can
 3134|       |         // begin. The value segment is itself a node position, so the scan starts at one.
 3135|  3.24M|         bool at_node_start = true;
 3136|  3.24M|         int flow_depth = 0;
 3137|  37.7M|         while (pos != stop) {
  ------------------
  |  Branch (3137:17): [True: 37.6M, False: 184k]
  ------------------
 3138|  37.6M|            const char c = *pos;
 3139|  37.6M|            if (c == '\n' || c == '\r' || c == '#') return false;
  ------------------
  |  Branch (3139:17): [True: 514k, False: 37.0M]
  |  Branch (3139:30): [True: 441k, False: 36.6M]
  |  Branch (3139:43): [True: 1.51M, False: 35.1M]
  ------------------
 3140|  35.1M|            if (c == ' ' || c == '\t') {
  ------------------
  |  Branch (3140:17): [True: 5.63M, False: 29.4M]
  |  Branch (3140:29): [True: 797k, False: 28.7M]
  ------------------
 3141|  6.42M|               ++pos;
 3142|  6.42M|               continue;
 3143|  6.42M|            }
 3144|  28.7M|            const bool node_start = std::exchange(at_node_start, false);
 3145|       |
 3146|  28.7M|            if ((c == '"' || c == '\'') && node_start) {
  ------------------
  |  Branch (3146:18): [True: 170k, False: 28.5M]
  |  Branch (3146:30): [True: 60.7k, False: 28.4M]
  |  Branch (3146:44): [True: 141k, False: 90.0k]
  ------------------
 3147|       |               // A quote in a plain scalar must not make the probe scan a later line, and the
 3148|       |               // '' escape must not be mistaken for the end of a single-quoted scalar.
 3149|   141k|               if (not yaml::skip_probe_quoted_scalar(pos, stop)) return false;
  ------------------
  |  Branch (3149:20): [True: 8.27k, False: 132k]
  ------------------
 3150|   132k|               continue;
 3151|   141k|            }
 3152|  28.5M|            if ((c == '[' || c == '{') && (node_start || flow_depth > 0)) {
  ------------------
  |  Branch (3152:18): [True: 298k, False: 28.2M]
  |  Branch (3152:30): [True: 559k, False: 27.7M]
  |  Branch (3152:44): [True: 683k, False: 174k]
  |  Branch (3152:58): [True: 86.4k, False: 88.0k]
  ------------------
 3153|   769k|               ++flow_depth;
 3154|   769k|               at_node_start = true;
 3155|   769k|               ++pos;
 3156|   769k|               continue;
 3157|   769k|            }
 3158|  27.7M|            if ((c == ']' || c == '}') && flow_depth > 0) {
  ------------------
  |  Branch (3158:18): [True: 143k, False: 27.6M]
  |  Branch (3158:30): [True: 224k, False: 27.4M]
  |  Branch (3158:43): [True: 210k, False: 158k]
  ------------------
 3159|   210k|               --flow_depth;
 3160|   210k|               ++pos;
 3161|   210k|               continue;
 3162|   210k|            }
 3163|  27.5M|            if (c == ':' && flow_depth == 0) {
  ------------------
  |  Branch (3163:17): [True: 1.02M, False: 26.5M]
  |  Branch (3163:29): [True: 580k, False: 439k]
  ------------------
 3164|   580k|               const auto next = pos + 1;
 3165|   580k|               return (next == end) || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
  ------------------
  |  Branch (3165:23): [True: 4.84k, False: 575k]
  |  Branch (3165:40): [True: 223k, False: 352k]
  |  Branch (3165:56): [True: 9.50k, False: 342k]
  |  Branch (3165:73): [True: 25.6k, False: 317k]
  |  Branch (3165:90): [True: 49.5k, False: 267k]
  ------------------
 3166|   580k|            }
 3167|  26.9M|            if (flow_depth > 0 && (c == ',' || c == ':')) {
  ------------------
  |  Branch (3167:17): [True: 3.75M, False: 23.2M]
  |  Branch (3167:36): [True: 242k, False: 3.51M]
  |  Branch (3167:48): [True: 439k, False: 3.07M]
  ------------------
 3168|   682k|               at_node_start = true;
 3169|   682k|               ++pos;
 3170|   682k|               continue;
 3171|   682k|            }
 3172|  26.3M|            if (node_start && yaml::skip_probe_node_property(pos, stop)) {
  ------------------
  |  Branch (3172:17): [True: 5.48M, False: 20.8M]
  |  Branch (3172:31): [True: 2.60M, False: 2.88M]
  ------------------
 3173|  2.60M|               at_node_start = true;
 3174|  2.60M|               continue;
 3175|  2.60M|            }
 3176|  23.7M|            ++pos;
 3177|  23.7M|         }
 3178|   184k|         return false;
 3179|  3.24M|      }
_ZN3glz4yaml32validate_flow_node_adjacent_tailINS0_12yaml_contextEPKcS4_EEvRT_RT0_T1_:
  956|  5.04M|      {
  957|  5.04M|         if (it == end) return;
  ------------------
  |  Branch (957:14): [True: 1.96M, False: 3.08M]
  ------------------
  958|  3.08M|         const char c = *it;
  959|       |         // After a flow collection closes, the next character must be a structural
  960|       |         // separator or whitespace/comment. Adjacent plain content is malformed.
  961|  3.08M|         if (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '#' || c == ',' || c == ']' || c == '}' ||
  ------------------
  |  Branch (961:14): [True: 293k, False: 2.78M]
  |  Branch (961:26): [True: 65.8k, False: 2.72M]
  |  Branch (961:39): [True: 75.4k, False: 2.64M]
  |  Branch (961:52): [True: 107k, False: 2.53M]
  |  Branch (961:65): [True: 73.9k, False: 2.46M]
  |  Branch (961:77): [True: 2.00M, False: 462k]
  |  Branch (961:89): [True: 36.3k, False: 426k]
  |  Branch (961:101): [True: 69.3k, False: 357k]
  ------------------
  962|  3.07M|             c == ':') {
  ------------------
  |  Branch (962:14): [True: 354k, False: 3.23k]
  ------------------
  963|  3.07M|            return;
  964|  3.07M|         }
  965|  3.23k|         ctx.error = error_code::syntax_error;
  966|  3.23k|      }
_ZN3glz4yaml20finalize_node_anchorINS0_12yaml_contextEPKcEEvRNS0_19node_property_stateERT_T0_:
  464|  17.2M|      {
  465|  17.2M|         if (state.has_anchor && !bool(ctx.error)) {
  ------------------
  |  Branch (465:14): [True: 556k, False: 16.7M]
  |  Branch (465:34): [True: 527k, False: 28.3k]
  ------------------
  466|   527k|            ctx.anchors[std::move(state.anchor_name)] = {state.anchor_start, &*it, state.anchor_indent};
  467|   527k|         }
  468|  17.2M|      }
_ZN3glz4yaml25skip_flow_ws_and_newlinesINS0_12yaml_contextEPKcS4_EEvRT_RT0_T1_Pb:
  878|  29.0M|      {
  879|  29.0M|         bool at_line_start = false;
  880|  29.0M|         bool saw_separation_ws = false;
  881|  29.0M|         bool line_has_indent = false;
  882|  54.7M|         while (it != end) {
  ------------------
  |  Branch (882:17): [True: 54.0M, False: 630k]
  ------------------
  883|  54.0M|            if (*it == ' ') {
  ------------------
  |  Branch (883:17): [True: 20.5M, False: 33.5M]
  ------------------
  884|  20.5M|               ++it;
  885|  20.5M|               saw_separation_ws = true;
  886|  20.5M|               if (at_line_start) line_has_indent = true;
  ------------------
  |  Branch (886:20): [True: 3.19M, False: 17.3M]
  ------------------
  887|  20.5M|               continue;
  888|  20.5M|            }
  889|  33.5M|            if (*it == '\t') {
  ------------------
  |  Branch (889:17): [True: 579k, False: 32.9M]
  ------------------
  890|   579k|               if (at_line_start && !line_has_indent) {
  ------------------
  |  Branch (890:20): [True: 141k, False: 437k]
  |  Branch (890:37): [True: 103k, False: 37.8k]
  ------------------
  891|   103k|                  auto probe = it;
  892|   249k|                  while (probe != end && (*probe == ' ' || *probe == '\t')) ++probe;
  ------------------
  |  Branch (892:26): [True: 248k, False: 1.63k]
  |  Branch (892:43): [True: 26.0k, False: 222k]
  |  Branch (892:60): [True: 119k, False: 102k]
  ------------------
  893|   103k|                  if (probe != end && *probe != '\n' && *probe != '\r' && *probe != '#') {
  ------------------
  |  Branch (893:23): [True: 102k, False: 1.63k]
  |  Branch (893:39): [True: 84.5k, False: 17.4k]
  |  Branch (893:57): [True: 10.7k, False: 73.8k]
  |  Branch (893:75): [True: 7.51k, False: 3.24k]
  ------------------
  894|  7.51k|                     const char c = *probe;
  895|  7.51k|                     const bool allowed_flow_delim = (c == ']' || c == '}' || c == '[' || c == '{' || c == ',');
  ------------------
  |  Branch (895:55): [True: 446, False: 7.06k]
  |  Branch (895:67): [True: 2.63k, False: 4.43k]
  |  Branch (895:79): [True: 166, False: 4.27k]
  |  Branch (895:91): [True: 438, False: 3.83k]
  |  Branch (895:103): [True: 3.65k, False: 178]
  ------------------
  896|  7.51k|                     if (!allowed_flow_delim) {
  ------------------
  |  Branch (896:26): [True: 178, False: 7.33k]
  ------------------
  897|    178|                        ctx.error = error_code::syntax_error;
  898|    178|                        return;
  899|    178|                     }
  900|  7.51k|                  }
  901|   103k|               }
  902|   579k|               ++it;
  903|   579k|               saw_separation_ws = true;
  904|   579k|               if (at_line_start) line_has_indent = true;
  ------------------
  |  Branch (904:20): [True: 141k, False: 437k]
  ------------------
  905|   579k|               continue;
  906|   579k|            }
  907|  32.9M|            if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (907:17): [True: 1.14M, False: 31.7M]
  |  Branch (907:32): [True: 3.14M, False: 28.6M]
  ------------------
  908|  4.29M|               skip_newline(it, end);
  909|  4.29M|               if (saw_line_break) *saw_line_break = true;
  ------------------
  |  Branch (909:20): [True: 19.4k, False: 4.27M]
  ------------------
  910|  4.29M|               at_line_start = true;
  911|  4.29M|               saw_separation_ws = true;
  912|  4.29M|               line_has_indent = false;
  913|  4.29M|               continue;
  914|  4.29M|            }
  915|  28.6M|            if (*it == '#') {
  ------------------
  |  Branch (915:17): [True: 264k, False: 28.3M]
  ------------------
  916|       |               // In flow style, comments require separation from the previous token.
  917|       |               // Allow comment-only lines and comments after inline whitespace, but
  918|       |               // reject adjacency forms like ",#comment" (CVW2).
  919|   264k|               bool separated_by_prev_ws = false;
  920|   264k|               if constexpr (std::is_pointer_v<std::decay_t<It>>) {
  921|   264k|                  if (ctx.stream_begin && it > ctx.stream_begin) {
  ------------------
  |  Branch (921:23): [True: 264k, False: 0]
  |  Branch (921:43): [True: 264k, False: 0]
  ------------------
  922|   264k|                     const char prev = *(it - 1);
  923|   264k|                     separated_by_prev_ws = (prev == ' ' || prev == '\t');
  ------------------
  |  Branch (923:46): [True: 117k, False: 146k]
  |  Branch (923:61): [True: 25.2k, False: 121k]
  ------------------
  924|   264k|                  }
  925|   264k|               }
  926|   264k|               if (!(at_line_start || saw_separation_ws || separated_by_prev_ws)) {
  ------------------
  |  Branch (926:22): [True: 112k, False: 151k]
  |  Branch (926:39): [True: 49.7k, False: 101k]
  |  Branch (926:60): [True: 69.9k, False: 31.9k]
  ------------------
  927|  31.9k|                  break;
  928|  31.9k|               }
  929|   232k|               skip_comment(it, end);
  930|   232k|               if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (930:20): [True: 227k, False: 4.57k]
  |  Branch (930:34): [True: 124k, False: 102k]
  |  Branch (930:49): [True: 102k, False: 548]
  ------------------
  931|   226k|                  skip_newline(it, end);
  932|   226k|                  if (saw_line_break) *saw_line_break = true;
  ------------------
  |  Branch (932:23): [True: 856, False: 226k]
  ------------------
  933|   226k|                  at_line_start = true;
  934|   226k|                  saw_separation_ws = true;
  935|   226k|                  continue;
  936|   226k|               }
  937|  5.12k|               continue;
  938|   232k|            }
  939|       |
  940|       |            // In block context, multiline flow nodes require indentation on content
  941|       |            // continuation lines (except structural tokens).
  942|  28.3M|            if (at_line_start && ctx.current_indent() >= 0 && !line_has_indent) {
  ------------------
  |  Branch (942:17): [True: 2.99M, False: 25.3M]
  |  Branch (942:34): [True: 103k, False: 2.89M]
  |  Branch (942:63): [True: 44.3k, False: 59.5k]
  ------------------
  943|  44.3k|               const char c = *it;
  944|  44.3k|               const bool structural = (c == ']' || c == '}' || c == ',');
  ------------------
  |  Branch (944:41): [True: 4.18k, False: 40.1k]
  |  Branch (944:53): [True: 13.3k, False: 26.7k]
  |  Branch (944:65): [True: 26.3k, False: 436]
  ------------------
  945|  44.3k|               if (!structural) {
  ------------------
  |  Branch (945:20): [True: 436, False: 43.8k]
  ------------------
  946|    436|                  ctx.error = error_code::syntax_error;
  947|    436|                  return;
  948|    436|               }
  949|  44.3k|            }
  950|  28.3M|            break;
  951|  28.3M|         }
  952|  29.0M|      }
_ZN3glz4fromILj450ENS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERS4_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSD_EEvOT0_OT1_OT2_T3_:
  283|  1.64M|      {
  284|  1.64M|         using V = std::decay_t<decltype(get_member(std::declval<Value>(), meta_wrapper_v<T>))>;
  285|  1.64M|         from<YAML, V>::template op<Opts>(get_member(std::forward<Value>(value), meta_wrapper_v<T>),
  286|  1.64M|                                          std::forward<Ctx>(ctx), std::forward<It0>(it), end);
  287|  1.64M|      }
_ZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_:
 5797|  2.32M|      {
 5798|       |         // Inside op() rather than at class scope: read_supported is `requires { from<Format, T>{}; }`,
 5799|       |         // so a class-scope assert turns that feature probe into a hard error instead of `false`.
 5800|  2.32M|         static_assert(content_v<std::remove_cvref_t<T>>.empty(),
 5801|  2.32M|                       "Adjacent variant tagging (glz::meta `content`) is implemented for JSON and "
 5802|  2.32M|                       "BEVE but not yet for YAML. Reading this variant as YAML would silently expect "
 5803|  2.32M|                       "the internally tagged shape, so it is rejected here instead.");
 5804|  2.32M|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5804:14): [True: 0, False: 2.32M]
  ------------------
 5805|      0|            return;
 5806|       |
 5807|       |         // No depth is taken here: the sequence and mapping readers this dispatches to count the
 5808|       |         // levels, so a scalar at the bottom of a document costs nothing, as in JSON. The one way
 5809|       |         // back into this reader that opens no collection is `redispatch`, which counts itself.
 5810|       |
 5811|       |         // At root level (indent == -1), skip leading whitespace, newlines, and comments
 5812|       |         // For nested values, only skip inline whitespace to preserve block structure
 5813|  2.32M|         if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (5813:14): [True: 1.91M, False: 410k]
  ------------------
 5814|  1.91M|            yaml::skip_ws_newlines_comments(it, end);
 5815|  1.91M|         }
 5816|   410k|         else {
 5817|   410k|            yaml::skip_inline_ws(it, end);
 5818|   410k|         }
 5819|       |
 5820|  2.32M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (5820:14): [True: 404, False: 2.32M]
  ------------------
 5821|    404|            ctx.error = error_code::unexpected_end;
 5822|    404|            return;
 5823|    404|         }
 5824|       |
 5825|       |         // Tagged variants: a discriminator key (meta::tag) selects the alternative, with the
 5826|       |         // matching meta::ids entry naming each type. This mirrors the JSON behavior so the
 5827|       |         // same variant definitions round-trip across both formats.
 5828|       |         if constexpr (not tag_v<std::remove_cvref_t<T>>.empty()) {
 5829|       |            using V = std::remove_cvref_t<T>;
 5830|       |            const bool value_is_mapping =
 5831|       |               (*it == '{') || (!yaml::check_flow_context(Opts) && yaml::line_could_be_block_mapping(it, end));
 5832|       |            if (value_is_mapping) {
 5833|       |               // The mapping's keys sit at the column of `it`. Recover that column from the buffer:
 5834|       |               // the indent stack carries the parent context's indent (a struct member, a sequence
 5835|       |               // item, etc. each push a different offset), not this mapping's true column (see helper).
 5836|       |               const int32_t mapping_column = tagged_mapping_visual_indent(ctx, it, ctx.current_indent() + 1);
 5837|       |               auto tag_ctx = ctx.make_speculative();
 5838|       |               const size_t index = scan_variant_tag_index<V, Opts>(tag_ctx, it, end, mapping_column);
 5839|       |               ctx.alias_expansion_budget = tag_ctx.alias_expansion_budget; // charged even if no tag matched
 5840|       |               ctx.key_expansion_budget = tag_ctx.key_expansion_budget;
 5841|       |               if (index < ids_v<V>.size()) {
 5842|       |                  static constexpr auto tag_literal = string_literal_from_view<tag_v<V>.size()>(tag_v<V>);
 5843|       |                  emplace_runtime_variant(value, index);
 5844|       |                  // Establish the mapping's true column on the indent stack for the alternative parse.
 5845|       |                  // The chosen object is then parsed - and the discriminator's inline value skipped -
 5846|       |                  // at a consistent indent in every context, so a tag on the first key does not fold
 5847|       |                  // the following sibling entries into its value (no special-casing needed downstream).
 5848|       |                  if (!ctx.push_indent(mapping_column)) [[unlikely]] {
 5849|       |                     ctx.error = error_code::exceeded_max_recursive_depth;
 5850|       |                     return;
 5851|       |                  }
 5852|       |                  std::visit(
 5853|       |                     [&](auto&& alt) {
 5854|       |                        using Alt = std::remove_cvref_t<decltype(alt)>;
 5855|       |                        if constexpr ((glaze_object_t<Alt> || reflectable<Alt>) && not custom_read<Alt>) {
 5856|       |                           // Parse the mapping into the resolved struct; the tag key is skipped.
 5857|       |                           from<YAML, Alt>::template op<Opts, tag_literal>(alt, ctx, it, end);
 5858|       |                        }
 5859|       |                        else if constexpr (custom_read<Alt>) {
 5860|       |                           // Custom alternatives read the mapping body themselves and cannot skip an
 5861|       |                           // interior tag key the way reflected objects do, so the tag must be the
 5862|       |                           // first key (glaze always writes it first). Consume that leading "tag: id"
 5863|       |                           // entry, then hand the remaining mapping to the custom handler.
 5864|       |                           if constexpr (yaml::check_flow_context(Opts)) {
 5865|       |                              ctx.error = error_code::feature_not_supported;
 5866|       |                              ctx.custom_error_message =
 5867|       |                                 "custom variant alternatives are not supported in YAML flow style";
 5868|       |                           }
 5869|       |                           else {
 5870|       |                              ctx.scratch.clear();
 5871|       |                              if (yaml::parse_yaml_key(ctx.scratch, ctx, it, end, false)) {
 5872|       |                                 if (std::string_view{ctx.scratch} != tag_v<V>) {
 5873|       |                                    ctx.error = error_code::feature_not_supported;
 5874|       |                                    ctx.custom_error_message =
 5875|       |                                       "the tag must be the first key for a custom variant alternative";
 5876|       |                                 }
 5877|       |                                 else {
 5878|       |                                    yaml::skip_inline_ws(it, end);
 5879|       |                                    if (it == end || *it != ':') {
 5880|       |                                       ctx.error = error_code::syntax_error;
 5881|       |                                    }
 5882|       |                                    else {
 5883|       |                                       ++it;
 5884|       |                                       yaml::skip_inline_ws(it, end);
 5885|       |                                       yaml::skip_unknown_block_value<Opts>(ctx, it, end, mapping_column);
 5886|       |                                       if (!bool(ctx.error)) {
 5887|       |                                          // If nothing but trailing whitespace/comments remains, the tag
 5888|       |                                          // was the whole mapping: leave the alternative default.
 5889|       |                                          auto probe = it;
 5890|       |                                          yaml::skip_ws_newlines_comments(probe, end);
 5891|       |                                          if (probe == end) {
 5892|       |                                             it = probe;
 5893|       |                                          }
 5894|       |                                          else {
 5895|       |                                             // Publish the mapping's column so the custom handler's block
 5896|       |                                             // mapping (which would otherwise discover its own indent) reads
 5897|       |                                             // the remaining entries at the variant's indent and dedents
 5898|       |                                             // correctly in every context (root, sequence, nested).
 5899|       |                                             ctx.forced_block_mapping_indent = mapping_column;
 5900|       |                                             from<YAML, Alt>::template op<Opts>(alt, ctx, it, end);
 5901|       |                                             ctx.forced_block_mapping_indent = -1;
 5902|       |                                          }
 5903|       |                                       }
 5904|       |                                    }
 5905|       |                                 }
 5906|       |                              }
 5907|       |                           }
 5908|       |                        }
 5909|       |                        else {
 5910|       |                           // Non-object alternative (e.g. std::monostate): the emplaced default is
 5911|       |                           // the value, but the mapping must still be consumed.
 5912|       |                           walk_tagged_mapping<Opts>(
 5913|       |                              ctx, it, end, tag_v<V>, mapping_column,
 5914|       |                              [&](auto&& c, auto&& i, auto&& e, int32_t line_indent, bool in_flow) {
 5915|       |                                 yaml::skip_yaml_value<Opts>(c, i, e, in_flow ? 0 : line_indent, in_flow);
 5916|       |                              });
 5917|       |                        }
 5918|       |                     },
 5919|       |                     value);
 5920|       |                  ctx.pop_indent();
 5921|       |                  return;
 5922|       |               }
 5923|       |               // No resolvable tag key was found. Fall through to structural deduction:
 5924|       |               // if the alternatives are distinguishable by their fields this still succeeds,
 5925|       |               // otherwise the deduction path reports no_matching_variant_type.
 5926|       |            }
 5927|       |         }
 5928|       |
 5929|  2.32M|         if constexpr (yaml_variant_is_auto_deducible<std::remove_cvref_t<T>>()) {
 5930|  2.32M|            using V = std::remove_cvref_t<T>;
 5931|  2.32M|            using counts = yaml_variant_type_count<V>;
 5932|  2.32M|            const char c = *it;
 5933|  2.32M|            auto is_plain_scalar_boundary = [](const char ch) {
 5934|  2.32M|               switch (ch) {
 5935|  2.32M|               case ' ':
 5936|  2.32M|               case '\t':
 5937|  2.32M|               case '\n':
 5938|  2.32M|               case '\r':
 5939|  2.32M|               case ',':
 5940|  2.32M|               case ']':
 5941|  2.32M|               case '}':
 5942|  2.32M|                  return true;
 5943|  2.32M|               default:
 5944|  2.32M|                  return false;
 5945|  2.32M|               }
 5946|  2.32M|            };
 5947|       |
 5948|  2.32M|            auto has_indented_block_continuation = [&](auto word_end) {
 5949|  2.32M|               if constexpr (yaml::check_flow_context(Opts)) {
 5950|  2.32M|                  return false;
 5951|  2.32M|               }
 5952|  2.32M|               if (ctx.current_indent() < 0) {
 5953|  2.32M|                  return false;
 5954|  2.32M|               }
 5955|  2.32M|               if (word_end == end || (*word_end != '\n' && *word_end != '\r')) {
 5956|  2.32M|                  return false;
 5957|  2.32M|               }
 5958|       |
 5959|  2.32M|               auto look = word_end;
 5960|  2.32M|               yaml::skip_newline(look, end);
 5961|  2.32M|               while (look != end) {
 5962|  2.32M|                  int32_t line_indent = 0;
 5963|  2.32M|                  while (look != end && *look == ' ') {
 5964|  2.32M|                     ++line_indent;
 5965|  2.32M|                     ++look;
 5966|  2.32M|                  }
 5967|  2.32M|                  if (look != end && *look == '\t') {
 5968|  2.32M|                     return false;
 5969|  2.32M|                  }
 5970|  2.32M|                  if (look == end || *look == '\n' || *look == '\r') {
 5971|  2.32M|                     if (look != end) {
 5972|  2.32M|                        yaml::skip_newline(look, end);
 5973|  2.32M|                        continue;
 5974|  2.32M|                     }
 5975|  2.32M|                     return false;
 5976|  2.32M|                  }
 5977|  2.32M|                  if (*look == '#') {
 5978|  2.32M|                     yaml::skip_comment(look, end);
 5979|  2.32M|                     if (look != end && (*look == '\n' || *look == '\r')) {
 5980|  2.32M|                        yaml::skip_newline(look, end);
 5981|  2.32M|                        continue;
 5982|  2.32M|                     }
 5983|  2.32M|                     return false;
 5984|  2.32M|                  }
 5985|       |
 5986|       |                  // If the next non-empty line is an implicit mapping entry,
 5987|       |                  // don't treat it as scalar continuation for auto-deduced
 5988|       |                  // booleans/nulls.
 5989|  2.32M|                  {
 5990|  2.32M|                     auto scan = look;
 5991|  2.32M|                     while (scan != end && *scan != '\n' && *scan != '\r') {
 5992|  2.32M|                        if (*scan == ':') {
 5993|  2.32M|                           auto after_colon = scan + 1;
 5994|  2.32M|                           if (after_colon == end || *after_colon == ' ' || *after_colon == '\t' ||
 5995|  2.32M|                               *after_colon == '\n' || *after_colon == '\r') {
 5996|  2.32M|                              return false;
 5997|  2.32M|                           }
 5998|  2.32M|                        }
 5999|  2.32M|                        ++scan;
 6000|  2.32M|                     }
 6001|  2.32M|                  }
 6002|       |
 6003|  2.32M|                  return line_indent > ctx.current_indent();
 6004|  2.32M|               }
 6005|  2.32M|               return false;
 6006|  2.32M|            };
 6007|  2.32M|            auto is_word_boundary = [&](const auto ptr) {
 6008|  2.32M|               if (ptr == end) {
 6009|  2.32M|                  return true;
 6010|  2.32M|               }
 6011|  2.32M|               if (*ptr == ':') {
 6012|  2.32M|                  auto next = ptr + 1;
 6013|  2.32M|                  return (next == end) || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
 6014|  2.32M|               }
 6015|  2.32M|               return is_plain_scalar_boundary(*ptr);
 6016|  2.32M|            };
 6017|       |
 6018|  2.32M|            switch (c) {
 6019|   491k|            case '&': {
  ------------------
  |  Branch (6019:13): [True: 491k, False: 1.83M]
  ------------------
 6020|       |               // Anchor before value: parse name, then re-dispatch
 6021|   491k|               ++it;
 6022|   491k|               auto aname = yaml::parse_anchor_name(it, end);
 6023|   491k|               if (aname.empty()) {
  ------------------
  |  Branch (6023:20): [True: 183, False: 491k]
  ------------------
 6024|    183|                  ctx.error = error_code::syntax_error;
 6025|    183|                  return;
 6026|    183|               }
 6027|   491k|               yaml::skip_inline_ws(it, end);
 6028|   491k|               bool anchor_on_same_line = true;
 6029|   491k|               bool value_is_indentless_sequence = false;
 6030|   491k|               if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (6030:20): [True: 5.20k, False: 486k]
  |  Branch (6030:33): [True: 23.6k, False: 462k]
  |  Branch (6030:48): [True: 28.5k, False: 434k]
  |  Branch (6030:63): [True: 5.25k, False: 428k]
  ------------------
 6031|       |                  // Anchor followed by end-of-line. Check if the value continues on the
 6032|       |                  // next line (indented past current context) or if this is an empty node.
 6033|  62.6k|                  bool value_on_next_line = false;
 6034|  62.6k|                  if (it != end) {
  ------------------
  |  Branch (6034:23): [True: 57.4k, False: 5.20k]
  ------------------
 6035|  57.4k|                     auto peek = it;
 6036|       |                     // Skip comment if present
 6037|  57.4k|                     if (*peek == '#') {
  ------------------
  |  Branch (6037:26): [True: 5.25k, False: 52.2k]
  ------------------
 6038|   205k|                        while (peek != end && *peek != '\n' && *peek != '\r') ++peek;
  ------------------
  |  Branch (6038:32): [True: 204k, False: 682]
  |  Branch (6038:47): [True: 202k, False: 2.40k]
  |  Branch (6038:64): [True: 200k, False: 2.17k]
  ------------------
 6039|  5.25k|                     }
 6040|       |                     // Skip newline
 6041|  57.4k|                     if (peek != end && (*peek == '\n' || *peek == '\r')) {
  ------------------
  |  Branch (6041:26): [True: 56.8k, False: 682]
  |  Branch (6041:42): [True: 26.0k, False: 30.7k]
  |  Branch (6041:59): [True: 30.7k, False: 0]
  ------------------
 6042|  56.8k|                        yaml::skip_newline(peek, end);
 6043|       |                        // Skip blank lines
 6044|  96.7k|                        while (peek != end && (*peek == '\n' || *peek == '\r')) {
  ------------------
  |  Branch (6044:32): [True: 93.5k, False: 3.19k]
  |  Branch (6044:48): [True: 20.6k, False: 72.8k]
  |  Branch (6044:65): [True: 19.2k, False: 53.6k]
  ------------------
 6045|  39.9k|                           yaml::skip_newline(peek, end);
 6046|  39.9k|                        }
 6047|       |                        // Measure indent of next content line
 6048|  56.8k|                        int32_t next_indent = 0;
 6049|   167k|                        while (peek != end && *peek == ' ') {
  ------------------
  |  Branch (6049:32): [True: 163k, False: 4.10k]
  |  Branch (6049:47): [True: 110k, False: 52.6k]
  ------------------
 6050|   110k|                           ++next_indent;
 6051|   110k|                           ++peek;
 6052|   110k|                        }
 6053|  56.8k|                        if (peek != end && *peek != '\n' && *peek != '\r') {
  ------------------
  |  Branch (6053:29): [True: 52.6k, False: 4.10k]
  |  Branch (6053:44): [True: 51.7k, False: 986]
  |  Branch (6053:61): [True: 50.8k, False: 853]
  ------------------
 6054|  50.8k|                           const bool indentless_sequence =
 6055|  50.8k|                              (!ctx.sequence_item_value_context) && (*peek == '-') &&
  ------------------
  |  Branch (6055:31): [True: 49.8k, False: 1.02k]
  |  Branch (6055:69): [True: 11.5k, False: 38.3k]
  ------------------
 6056|  11.5k|                              ((peek + 1) == end ||
  ------------------
  |  Branch (6056:32): [True: 554, False: 10.9k]
  ------------------
 6057|  10.9k|                               yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(peek + 1))]) &&
  ------------------
  |  Branch (6057:32): [True: 10.2k, False: 715]
  ------------------
 6058|  10.7k|                              (next_indent == ctx.current_indent() ||
  ------------------
  |  Branch (6058:32): [True: 1.45k, False: 9.33k]
  ------------------
 6059|  9.33k|                               (ctx.current_indent() > 0 && (next_indent + 1) == ctx.current_indent()));
  ------------------
  |  Branch (6059:33): [True: 3.99k, False: 5.33k]
  |  Branch (6059:61): [True: 3.70k, False: 297]
  ------------------
 6060|  50.8k|                           value_is_indentless_sequence = indentless_sequence;
 6061|  50.8k|                           const bool same_indent_property_node =
 6062|  50.8k|                              (next_indent == ctx.current_indent()) &&
  ------------------
  |  Branch (6062:31): [True: 6.62k, False: 44.2k]
  ------------------
 6063|  6.62k|                              (*peek == '!' || *peek == '&' || *peek == '*' || *peek == '[' || *peek == '{' ||
  ------------------
  |  Branch (6063:32): [True: 380, False: 6.24k]
  |  Branch (6063:48): [True: 1.19k, False: 5.04k]
  |  Branch (6063:64): [True: 287, False: 4.76k]
  |  Branch (6063:80): [True: 384, False: 4.37k]
  |  Branch (6063:96): [True: 499, False: 3.87k]
  ------------------
 6064|  3.87k|                               *peek == '"' || *peek == '\'' || *peek == '|' || *peek == '>');
  ------------------
  |  Branch (6064:32): [True: 293, False: 3.58k]
  |  Branch (6064:48): [True: 510, False: 3.07k]
  |  Branch (6064:65): [True: 354, False: 2.72k]
  |  Branch (6064:81): [True: 348, False: 2.37k]
  ------------------
 6065|  50.8k|                           value_on_next_line =
 6066|  50.8k|                              (next_indent > ctx.current_indent()) || indentless_sequence || same_indent_property_node;
  ------------------
  |  Branch (6066:31): [True: 35.3k, False: 15.5k]
  |  Branch (6066:71): [True: 5.15k, False: 10.3k]
  |  Branch (6066:94): [True: 4.24k, False: 6.11k]
  ------------------
 6067|  50.8k|                        }
 6068|  56.8k|                     }
 6069|  57.4k|                  }
 6070|  62.6k|                  if (!value_on_next_line) {
  ------------------
  |  Branch (6070:23): [True: 17.9k, False: 44.7k]
  ------------------
 6071|       |                     // Anchor on empty/null node — store empty span, leave value as default
 6072|  17.9k|                     ctx.anchors[std::string(aname)] = {&*it, &*it, ctx.current_indent()};
 6073|  17.9k|                     return;
 6074|  17.9k|                  }
 6075|       |                  // Value is on next line — advance past newline/blank lines to the content
 6076|  44.7k|                  if (*it == '#') {
  ------------------
  |  Branch (6076:23): [True: 3.29k, False: 41.4k]
  ------------------
 6077|   174k|                     while (it != end && *it != '\n' && *it != '\r') ++it;
  ------------------
  |  Branch (6077:29): [True: 174k, False: 0]
  |  Branch (6077:42): [True: 172k, False: 2.15k]
  |  Branch (6077:57): [True: 171k, False: 1.13k]
  ------------------
 6078|  3.29k|                  }
 6079|  44.7k|                  if (it != end) yaml::skip_newline(it, end);
  ------------------
  |  Branch (6079:23): [True: 44.7k, False: 0]
  ------------------
 6080|  71.6k|                  while (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (6080:26): [True: 71.6k, False: 0]
  |  Branch (6080:40): [True: 10.1k, False: 61.5k]
  |  Branch (6080:55): [True: 16.7k, False: 44.7k]
  ------------------
 6081|  26.9k|                     yaml::skip_newline(it, end);
 6082|  26.9k|                  }
 6083|  44.7k|                  yaml::skip_inline_ws(it, end);
 6084|  44.7k|                  anchor_on_same_line = false;
 6085|  44.7k|               }
 6086|       |
 6087|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6088|       |                  if (anchor_on_same_line && *it == '-' &&
 6089|       |                      ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))])) {
 6090|       |                     // "&anchor - item" is malformed in block context.
 6091|       |                     ctx.error = error_code::syntax_error;
 6092|       |                     return;
 6093|       |                  }
 6094|       |               }
 6095|       |
 6096|       |               // Anchor on alias (&anchor *alias) is invalid per YAML spec.
 6097|       |               // But alias-as-key (&anchor *alias : value) is valid.
 6098|   473k|               if (it != end && *it == '*' && !yaml::alias_token_is_mapping_key(it, end)) {
  ------------------
  |  Branch (6098:20): [True: 473k, False: 14]
  |  Branch (6098:33): [True: 582, False: 473k]
  |  Branch (6098:47): [True: 53, False: 529]
  ------------------
 6099|     53|                  ctx.error = error_code::syntax_error;
 6100|     53|                  return;
 6101|     53|               }
 6102|       |
 6103|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6104|       |                  if (!anchor_on_same_line && it != end && *it == '&') {
 6105|       |                     auto probe = it + 1;
 6106|       |                     auto nested_anchor_name = yaml::parse_anchor_name(probe, end);
 6107|       |                     if (nested_anchor_name.empty()) {
 6108|       |                        ctx.error = error_code::syntax_error;
 6109|       |                        return;
 6110|       |                     }
 6111|       |                     yaml::skip_inline_ws(probe, end);
 6112|       |                     // Allow nested anchor usage only when it clearly starts a
 6113|       |                     // nested mapping entry ("&k key: value"). Otherwise this is
 6114|       |                     // a second anchor on the same node (4JVG-style), which is invalid.
 6115|       |                     if (!yaml::line_could_be_block_mapping(probe, end)) {
 6116|       |                        ctx.error = error_code::syntax_error;
 6117|       |                        return;
 6118|       |                     }
 6119|       |                  }
 6120|       |               }
 6121|       |
 6122|   473k|               const char* anchor_start = &*it;
 6123|   473k|               const int32_t anchor_indent = ctx.current_indent();
 6124|       |
 6125|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6126|       |                  // Check if the anchor is on a block-mapping key (&name key: value).
 6127|       |                  // Only when the anchor and key are on the SAME line — if the value was on the
 6128|       |                  // next line, the anchor applies to the entire next-line content.
 6129|       |                  if (anchor_on_same_line && yaml::line_could_be_block_mapping(it, end)) {
 6130|       |                     auto key_start = it;
 6131|       |                     if (*key_start == '!') {
 6132|       |                        const auto key_tag = yaml::parse_yaml_tag(key_start, end, ctx);
 6133|       |                        if (key_tag == yaml::yaml_tag::unknown || !yaml::tag_valid_for_string(key_tag)) {
 6134|       |                           ctx.error = error_code::syntax_error;
 6135|       |                           return;
 6136|       |                        }
 6137|       |                        yaml::skip_inline_ws(key_start, end);
 6138|       |                        if (key_start == end) {
 6139|       |                           ctx.error = error_code::unexpected_end;
 6140|       |                           return;
 6141|       |                        }
 6142|       |                        if (*key_start == '\n' || *key_start == '\r') {
 6143|       |                           ctx.error = error_code::syntax_error;
 6144|       |                           return;
 6145|       |                        }
 6146|       |
 6147|       |                        // Re-apply the anchor-on-alias rule now that the tag is consumed. The
 6148|       |                        // check above ran before the tag, so "&anchor !tag *alias" reached the
 6149|       |                        // key-span registration below while the untagged spelling was rejected;
 6150|       |                        // an alias node carries no other properties either way.
 6151|       |                        if (*key_start == '*' && !yaml::alias_token_is_mapping_key(key_start, end)) {
 6152|       |                           ctx.error = error_code::syntax_error;
 6153|       |                           return;
 6154|       |                        }
 6155|       |                     }
 6156|       |
 6157|       |                     // Find the key span by scanning to the key-value separator
 6158|       |                     auto key_scan = key_start;
 6159|       |                     auto key_end = key_start;
 6160|       |                     if (*key_scan == '"' || *key_scan == '\'') {
 6161|       |                        // Quoted key: skip to closing quote
 6162|       |                        const char quote = *key_scan;
 6163|       |                        ++key_scan;
 6164|       |                        while (key_scan != end && *key_scan != quote) {
 6165|       |                           if (*key_scan == '\\' && quote == '"') {
 6166|       |                              ++key_scan;
 6167|       |                              if (key_scan != end) ++key_scan;
 6168|       |                           }
 6169|       |                           else {
 6170|       |                              ++key_scan;
 6171|       |                           }
 6172|       |                        }
 6173|       |                        if (key_scan == end) {
 6174|       |                           ctx.error = error_code::syntax_error;
 6175|       |                           return;
 6176|       |                        }
 6177|       |                        ++key_scan; // past closing quote
 6178|       |                        key_end = key_scan;
 6179|       |                        yaml::skip_inline_ws(key_scan, end);
 6180|       |                     }
 6181|       |                     else {
 6182|       |                        // Plain key: scan to ':'
 6183|       |                        while (key_scan != end) {
 6184|       |                           if (*key_scan == ':') {
 6185|       |                              auto next = key_scan + 1;
 6186|       |                              if (next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r') {
 6187|       |                                 break;
 6188|       |                              }
 6189|       |                           }
 6190|       |                           ++key_scan;
 6191|       |                        }
 6192|       |                        key_end = key_scan;
 6193|       |                        while (key_end != key_start && (*(key_end - 1) == ' ' || *(key_end - 1) == '\t')) {
 6194|       |                           --key_end;
 6195|       |                        }
 6196|       |                     }
 6197|       |                     if (key_scan == end || *key_scan != ':') {
 6198|       |                        ctx.error = error_code::syntax_error;
 6199|       |                        return;
 6200|       |                     }
 6201|       |                     // Store anchor with just the key text span
 6202|       |                     ctx.anchors[std::string(aname)] = {&*key_start, &*key_end, anchor_indent};
 6203|       |                     it = key_start;
 6204|       |                     // Parse as an object alternative so complex keys (e.g. flow collections) stay in mapping context.
 6205|       |                     if constexpr (counts::n_object > 0) {
 6206|       |                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6207|       |                                                                                                        end);
 6208|       |                     }
 6209|       |                     else {
 6210|       |                        redispatch<Opts>(value, ctx, it, end);
 6211|       |                     }
 6212|       |                     return;
 6213|       |                  }
 6214|       |               }
 6215|       |
 6216|   473k|               const bool prev_allow_indentless_sequence = ctx.allow_indentless_sequence;
 6217|   473k|               ctx.allow_indentless_sequence = value_is_indentless_sequence;
 6218|   473k|               redispatch<Opts>(value, ctx, it, end);
 6219|   473k|               ctx.allow_indentless_sequence = prev_allow_indentless_sequence;
 6220|   473k|               if (!bool(ctx.error)) {
  ------------------
  |  Branch (6220:20): [True: 463k, False: 10.3k]
  ------------------
 6221|   463k|                  ctx.anchors[std::string(aname)] = {anchor_start, &*it, anchor_indent};
 6222|   463k|               }
 6223|   473k|               return;
 6224|   473k|            }
 6225|   186k|            case '*': {
  ------------------
  |  Branch (6225:13): [True: 186k, False: 2.13M]
  ------------------
 6226|       |               // In block context, "*alias : value" starts a mapping with an alias key.
 6227|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6228|       |                  if (yaml::alias_token_is_mapping_key(it, end)) {
 6229|       |                     if constexpr (counts::n_object > 0) {
 6230|       |                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6231|       |                                                                                                        end);
 6232|       |                        return;
 6233|       |                     }
 6234|       |                     else {
 6235|       |                        ctx.error = error_code::syntax_error;
 6236|       |                        return;
 6237|       |                     }
 6238|       |                  }
 6239|       |               }
 6240|       |
 6241|       |               // Alias value: look up anchor and replay
 6242|   186k|               yaml::handle_alias<Opts>(value, ctx, it, end);
 6243|   186k|               return;
 6244|   473k|            }
 6245|   153k|            case '!': {
  ------------------
  |  Branch (6245:13): [True: 153k, False: 2.16M]
  ------------------
 6246|       |               // Tag - parse it and dispatch based on tag type
 6247|   153k|               const auto tag = yaml::parse_yaml_tag(it, end, ctx);
 6248|   153k|               if (tag == yaml::yaml_tag::unknown) {
  ------------------
  |  Branch (6248:20): [True: 41, False: 153k]
  ------------------
 6249|     41|                  ctx.error = error_code::syntax_error;
 6250|     41|                  return;
 6251|     41|               }
 6252|   153k|               yaml::skip_inline_ws(it, end);
 6253|   153k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (6253:20): [True: 152k, False: 1.12k]
  |  Branch (6253:33): [True: 7.59k, False: 144k]
  ------------------
 6254|  7.59k|                  yaml::skip_comment(it, end);
 6255|  7.59k|               }
 6256|   153k|               if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (6256:20): [True: 152k, False: 1.56k]
  |  Branch (6256:34): [True: 11.7k, False: 140k]
  |  Branch (6256:49): [True: 18.1k, False: 122k]
  ------------------
 6257|  29.9k|                  auto content = it;
 6258|  29.9k|                  yaml::skip_newline(content, end);
 6259|  29.9k|                  yaml::skip_to_content(content, end);
 6260|       |
 6261|  29.9k|                  bool consume_following_content = false;
 6262|  29.9k|                  auto content_token = content;
 6263|  29.9k|                  if (content != end) {
  ------------------
  |  Branch (6263:23): [True: 27.7k, False: 2.19k]
  ------------------
 6264|  27.7k|                     auto indent_probe = content;
 6265|  27.7k|                     const int32_t content_indent = yaml::measure_indent<false>(indent_probe, end, ctx);
 6266|  27.7k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (6266:26): [True: 2, False: 27.7k]
  ------------------
 6267|      2|                        return;
 6268|  27.7k|                     content_token = indent_probe;
 6269|       |
 6270|       |                     // A tag at the end of a sequence/map entry has an empty value
 6271|       |                     // unless the next non-empty content is nested under the current node.
 6272|  27.7k|                     bool tagged_indentless_sequence = false;
 6273|  27.7k|                     if (tag == yaml::yaml_tag::seq && indent_probe != end && *indent_probe == '-') {
  ------------------
  |  Branch (6273:26): [True: 3.88k, False: 23.8k]
  |  Branch (6273:56): [True: 3.88k, False: 0]
  |  Branch (6273:79): [True: 2.35k, False: 1.53k]
  ------------------
 6274|  2.35k|                        const auto after_dash = indent_probe + 1;
 6275|  2.35k|                        if (after_dash == end ||
  ------------------
  |  Branch (6275:29): [True: 525, False: 1.82k]
  ------------------
 6276|  2.06k|                            yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_dash)]) {
  ------------------
  |  Branch (6276:29): [True: 1.54k, False: 284]
  ------------------
 6277|  2.06k|                           tagged_indentless_sequence =
 6278|  2.06k|                              (content_indent == ctx.current_indent()) ||
  ------------------
  |  Branch (6278:31): [True: 468, False: 1.60k]
  ------------------
 6279|  1.60k|                              (ctx.current_indent() > 0 && (content_indent + 1) == ctx.current_indent());
  ------------------
  |  Branch (6279:32): [True: 632, False: 968]
  |  Branch (6279:60): [True: 133, False: 499]
  ------------------
 6280|  2.06k|                        }
 6281|  2.35k|                     }
 6282|       |
 6283|  27.7k|                     consume_following_content = (ctx.current_indent() < 0) ||
  ------------------
  |  Branch (6283:50): [True: 16.4k, False: 11.3k]
  ------------------
 6284|  11.3k|                                                 (content_indent > ctx.current_indent()) || tagged_indentless_sequence;
  ------------------
  |  Branch (6284:50): [True: 3.96k, False: 7.35k]
  |  Branch (6284:93): [True: 601, False: 6.75k]
  ------------------
 6285|  27.7k|                  }
 6286|       |
 6287|  29.9k|                  if (consume_following_content) {
  ------------------
  |  Branch (6287:23): [True: 21.0k, False: 8.95k]
  ------------------
 6288|  21.0k|                     it = content_token;
 6289|  21.0k|                  }
 6290|  8.95k|                  else {
 6291|  8.95k|                     if (tag == yaml::yaml_tag::str) {
  ------------------
  |  Branch (6291:26): [True: 242, False: 8.71k]
  ------------------
 6292|    242|                        if constexpr (counts::n_str > 0) {
 6293|    242|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_str>;
 6294|    242|                           using StrType = std::variant_alternative_t<first_idx, V>;
 6295|    242|                           value = StrType{};
 6296|    242|                           return;
 6297|    242|                        }
 6298|    242|                     }
 6299|  8.95k|                     if (tag == yaml::yaml_tag::null_tag) {
  ------------------
  |  Branch (6299:26): [True: 264, False: 8.69k]
  ------------------
 6300|    264|                        if constexpr (counts::n_null > 0) {
 6301|    264|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6302|    264|                           using NullType = std::variant_alternative_t<first_idx, V>;
 6303|    264|                           if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6303:32): [True: 0, False: 264]
  ------------------
 6304|    264|                           return;
 6305|    264|                        }
 6306|    264|                     }
 6307|  8.95k|                     if (tag == yaml::yaml_tag::none) {
  ------------------
  |  Branch (6307:26): [True: 6.36k, False: 2.59k]
  ------------------
 6308|  6.36k|                        if constexpr (counts::n_null > 0) {
 6309|  6.36k|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6310|  6.36k|                           using NullType = std::variant_alternative_t<first_idx, V>;
 6311|  6.36k|                           if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6311:32): [True: 0, False: 6.36k]
  ------------------
 6312|  6.36k|                           return;
 6313|  6.36k|                        }
 6314|  6.36k|                     }
 6315|  8.95k|                  }
 6316|  29.9k|               }
 6317|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6318|       |                  // In block context, a comma immediately after a tag token is malformed
 6319|       |                  // (e.g., "!!str, value"). Flow context has legitimate ", ] }" usage.
 6320|       |                  if (it != end && *it == ',') {
 6321|       |                     ctx.error = error_code::syntax_error;
 6322|       |                     return;
 6323|       |                  }
 6324|       |                  if constexpr (counts::n_object > 0) {
 6325|       |                     // Tagged keys like "!!str key: value" must parse as mappings.
 6326|       |                     const bool starts_block_sequence_entry =
 6327|       |                        (it != end && *it == '-') &&
 6328|       |                        ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
 6329|       |                     if (!starts_block_sequence_entry && yaml::line_could_be_block_mapping(it, end)) {
 6330|       |                        // Re-dispatch from the post-tag token so '&key key: val' is
 6331|       |                        // handled by the anchor-aware key path, not as a map-level anchor.
 6332|       |                        redispatch<Opts>(value, ctx, it, end);
 6333|       |                        return;
 6334|       |                     }
 6335|       |                  }
 6336|       |               }
 6337|   153k|               if (it == end) {
  ------------------
  |  Branch (6337:20): [True: 1.56k, False: 152k]
  ------------------
 6338|  1.56k|                  if (tag == yaml::yaml_tag::str) {
  ------------------
  |  Branch (6338:23): [True: 292, False: 1.27k]
  ------------------
 6339|    292|                     if constexpr (counts::n_str > 0) {
 6340|    292|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_str>;
 6341|    292|                        using StrType = std::variant_alternative_t<first_idx, V>;
 6342|    292|                        value = StrType{};
 6343|    292|                        return;
 6344|    292|                     }
 6345|    292|                  }
 6346|  1.56k|                  if (tag == yaml::yaml_tag::none) {
  ------------------
  |  Branch (6346:23): [True: 1.26k, False: 302]
  ------------------
 6347|  1.26k|                     if constexpr (counts::n_null > 0) {
 6348|  1.26k|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6349|  1.26k|                        using NullType = std::variant_alternative_t<first_idx, V>;
 6350|  1.26k|                        if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6350:29): [True: 0, False: 1.26k]
  ------------------
 6351|  1.26k|                        return;
 6352|  1.26k|                     }
 6353|  1.26k|                  }
 6354|      0|                  ctx.error = error_code::unexpected_end;
 6355|  1.56k|                  return;
 6356|  1.56k|               }
 6357|   152k|               switch (tag) {
 6358|    553|               case yaml::yaml_tag::str:
  ------------------
  |  Branch (6358:16): [True: 553, False: 151k]
  ------------------
 6359|    553|                  process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6360|    553|                  return;
 6361|  2.83k|               case yaml::yaml_tag::int_tag:
  ------------------
  |  Branch (6361:16): [True: 2.83k, False: 149k]
  ------------------
 6362|  5.88k|               case yaml::yaml_tag::float_tag:
  ------------------
  |  Branch (6362:16): [True: 3.04k, False: 149k]
  ------------------
 6363|  5.88k|                  if constexpr (counts::n_num > 0) {
 6364|  5.88k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, ctx, it, end);
 6365|  5.88k|                     return;
 6366|       |                  }
 6367|       |                  else { // else used to fix MSVC unreachable code warning
 6368|       |                     ctx.error = error_code::syntax_error;
 6369|       |                     return;
 6370|       |                  }
 6371|  19.4k|               case yaml::yaml_tag::bool_tag:
  ------------------
  |  Branch (6371:16): [True: 13.5k, False: 138k]
  ------------------
 6372|  19.4k|                  if constexpr (counts::n_bool > 0) {
 6373|  19.4k|                     process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it, end);
 6374|  19.4k|                     return;
 6375|       |                  }
 6376|       |                  else { // else used to fix MSVC unreachable code warning
 6377|       |                     ctx.error = error_code::syntax_error;
 6378|       |                     return;
 6379|       |                  }
 6380|  19.8k|               case yaml::yaml_tag::null_tag:
  ------------------
  |  Branch (6380:16): [True: 370, False: 151k]
  ------------------
 6381|  19.8k|                  if constexpr (counts::n_null > 0) {
 6382|  19.8k|                     constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6383|  19.8k|                     using NullType = std::variant_alternative_t<first_idx, V>;
 6384|  19.8k|                     if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6384:26): [True: 0, False: 19.8k]
  ------------------
 6385|  19.8k|                     from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6386|  19.8k|                     return;
 6387|       |                  }
 6388|       |                  else { // else used to fix MSVC unreachable code warning
 6389|       |                     ctx.error = error_code::syntax_error;
 6390|       |                     return;
 6391|       |                  }
 6392|  37.3k|               case yaml::yaml_tag::map:
  ------------------
  |  Branch (6392:16): [True: 17.5k, False: 134k]
  ------------------
 6393|  37.3k|                  if constexpr (counts::n_object > 0) {
 6394|  37.3k|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6395|  37.3k|                                                                                                     end);
 6396|  37.3k|                     return;
 6397|       |                  }
 6398|       |                  else { // else used to fix MSVC unreachable code warning
 6399|       |                     ctx.error = error_code::syntax_error;
 6400|       |                     return;
 6401|       |                  }
 6402|  48.9k|               case yaml::yaml_tag::seq:
  ------------------
  |  Branch (6402:16): [True: 11.5k, False: 140k]
  ------------------
 6403|  48.9k|                  if constexpr (counts::n_array > 0) {
 6404|  48.9k|                     const bool prev_allow_indentless_sequence = ctx.allow_indentless_sequence;
 6405|       |                     if constexpr (!yaml::check_flow_context(Opts)) {
 6406|       |                        if (it != end && *it == '-') {
 6407|       |                           ctx.allow_indentless_sequence = true;
 6408|       |                        }
 6409|       |                     }
 6410|  48.9k|                     process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6411|  48.9k|                                                                                                    end);
 6412|  48.9k|                     ctx.allow_indentless_sequence = prev_allow_indentless_sequence;
 6413|  48.9k|                     return;
 6414|       |                  }
 6415|       |                  else { // else used to fix MSVC unreachable code warning
 6416|       |                     ctx.error = error_code::syntax_error;
 6417|       |                     return;
 6418|       |                  }
 6419|   144k|               default: {
  ------------------
  |  Branch (6419:16): [True: 95.7k, False: 56.3k]
  ------------------
 6420|       |                  // Explicit unknown/non-core tags disable implicit scalar resolution.
 6421|       |                  // Preserve collection kinds, otherwise treat as string content.
 6422|   144k|                  if (it != end && *it == '*') {
  ------------------
  |  Branch (6422:23): [True: 95.7k, False: 48.9k]
  |  Branch (6422:36): [True: 36.7k, False: 58.9k]
  ------------------
 6423|  36.7k|                     yaml::handle_alias<Opts>(value, ctx, it, end);
 6424|  36.7k|                     return;
 6425|  36.7k|                  }
 6426|       |
 6427|   107k|                  if constexpr (counts::n_array > 0) {
 6428|   107k|                     if (it != end && *it == '[') {
  ------------------
  |  Branch (6428:26): [True: 58.9k, False: 48.9k]
  |  Branch (6428:39): [True: 1.25k, False: 57.7k]
  ------------------
 6429|  1.25k|                        process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6430|  1.25k|                                                                                                       end);
 6431|  1.25k|                        return;
 6432|  1.25k|                     }
 6433|   107k|                  }
 6434|   107k|                  if constexpr (counts::n_object > 0) {
 6435|   107k|                     if (it != end && *it == '{') {
  ------------------
  |  Branch (6435:26): [True: 57.7k, False: 50.1k]
  |  Branch (6435:39): [True: 838, False: 56.8k]
  ------------------
 6436|    838|                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6437|    838|                                                                                                        end);
 6438|    838|                        return;
 6439|    838|                     }
 6440|   107k|                  }
 6441|       |
 6442|       |                  if constexpr (!yaml::check_flow_context(Opts)) {
 6443|       |                     if constexpr (counts::n_array > 0) {
 6444|       |                        const bool starts_block_sequence_entry =
 6445|       |                           (it != end && *it == '-') &&
 6446|       |                           ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
 6447|       |                        if (starts_block_sequence_entry) {
 6448|       |                           process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx,
 6449|       |                                                                                                          it, end);
 6450|       |                           return;
 6451|       |                        }
 6452|       |                     }
 6453|       |                     if constexpr (counts::n_object > 0) {
 6454|       |                        const bool starts_explicit_mapping_indicator =
 6455|       |                           (it != end && (*it == '?' || *it == ':')) &&
 6456|       |                           ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
 6457|       |                        if (starts_explicit_mapping_indicator) {
 6458|       |                           process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx,
 6459|       |                                                                                                           it, end);
 6460|       |                           return;
 6461|       |                        }
 6462|       |                        if (yaml::line_could_be_block_mapping(it, end)) {
 6463|       |                           process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx,
 6464|       |                                                                                                           it, end);
 6465|       |                           return;
 6466|       |                        }
 6467|       |                     }
 6468|       |                  }
 6469|       |
 6470|   107k|                  if constexpr (counts::n_str > 0) {
 6471|   107k|                     process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6472|   107k|                     return;
 6473|   107k|                  }
 6474|       |
 6475|       |                  // Fall back if no string alternative exists.
 6476|      0|                  redispatch<Opts>(value, ctx, it, end);
 6477|   107k|                  return;
 6478|   144k|               }
 6479|   152k|               }
 6480|      0|               return;
 6481|   152k|            }
 6482|   383k|            case '{':
  ------------------
  |  Branch (6482:13): [True: 383k, False: 1.93M]
  ------------------
 6483|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6484|       |                  // In block context, "{...}: value" can be a complex mapping key.
 6485|       |                  if (ctx.current_indent() < 0 && yaml::line_could_be_block_mapping(it, end)) {
 6486|       |                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6487|       |                                                                                                     end);
 6488|       |                     return;
 6489|       |                  }
 6490|       |               }
 6491|       |               // Flow mapping - object type
 6492|   383k|               process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it, end);
 6493|   383k|               return;
 6494|  45.7k|            case '[':
  ------------------
  |  Branch (6494:13): [True: 45.7k, False: 2.27M]
  ------------------
 6495|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6496|       |                  // In block context, "[...]: value" can be a complex mapping key.
 6497|       |                  if (ctx.current_indent() < 0 && yaml::line_could_be_block_mapping(it, end)) {
 6498|       |                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6499|       |                                                                                                     end);
 6500|       |                     return;
 6501|       |                  }
 6502|       |               }
 6503|       |               // Flow sequence - array type
 6504|  45.7k|               process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it, end);
 6505|  45.7k|               return;
 6506|   109k|            case '?':
  ------------------
  |  Branch (6506:13): [True: 109k, False: 2.21M]
  ------------------
 6507|       |               // Explicit mapping key indicator ("? key")
 6508|   109k|               if ((end - it >= 2) && it[1] == '\t') {
  ------------------
  |  Branch (6508:20): [True: 109k, False: 23]
  |  Branch (6508:39): [True: 3, False: 109k]
  ------------------
 6509|      3|                  ctx.error = error_code::syntax_error;
 6510|      3|                  return;
 6511|      3|               }
 6512|   109k|               if ((end - it >= 2) && (it[1] == ' ' || it[1] == '\n' || it[1] == '\r')) {
  ------------------
  |  Branch (6512:20): [True: 109k, False: 23]
  |  Branch (6512:40): [True: 27.3k, False: 82.0k]
  |  Branch (6512:56): [True: 45.7k, False: 36.2k]
  |  Branch (6512:73): [True: 24.1k, False: 12.1k]
  ------------------
 6513|  97.2k|                  if constexpr (counts::n_object > 0) {
 6514|  97.2k|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6515|  97.2k|                                                                                                     end);
 6516|  97.2k|                     return;
 6517|  97.2k|                  }
 6518|  97.2k|               }
 6519|      0|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6520|   109k|               return;
 6521|     16|            case '%':
  ------------------
  |  Branch (6521:13): [True: 16, False: 2.32M]
  ------------------
 6522|       |               // Reserved directive indicator is not a plain scalar start.
 6523|     16|               ctx.error = error_code::syntax_error;
 6524|     16|               return;
 6525|  4.36k|            case '"':
  ------------------
  |  Branch (6525:13): [True: 4.36k, False: 2.31M]
  ------------------
 6526|  6.69k|            case '\'':
  ------------------
  |  Branch (6526:13): [True: 2.33k, False: 2.32M]
  ------------------
 6527|       |               // Could be a quoted string OR a quoted key in a block mapping
 6528|       |               // Try block mapping first (e.g., "key": value), then fall back to string
 6529|  6.69k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6530|  6.69k|               return;
 6531|  9.74k|            case 't':
  ------------------
  |  Branch (6531:13): [True: 9.74k, False: 2.31M]
  ------------------
 6532|  27.3k|            case 'T':
  ------------------
  |  Branch (6532:13): [True: 17.6k, False: 2.30M]
  ------------------
 6533|       |               // Could be "true", "True", "TRUE", or a key/string starting with t/T
 6534|  27.3k|               if constexpr (counts::n_bool > 0) {
 6535|  27.3k|                  if ((end - it >= 4) && ((it[1] == 'r' && it[2] == 'u' && it[3] == 'e') ||
  ------------------
  |  Branch (6535:23): [True: 26.7k, False: 590]
  |  Branch (6535:44): [True: 19.5k, False: 7.23k]
  |  Branch (6535:60): [True: 19.0k, False: 550]
  |  Branch (6535:76): [True: 14.6k, False: 4.31k]
  ------------------
 6536|  15.8k|                                          (it[1] == 'R' && it[2] == 'U' && it[3] == 'E'))) {
  ------------------
  |  Branch (6536:44): [True: 2.20k, False: 9.90k]
  |  Branch (6536:60): [True: 1.44k, False: 760]
  |  Branch (6536:76): [True: 1.11k, False: 326]
  ------------------
 6537|       |                     // Check what follows the word "true"
 6538|  15.8k|                     const auto after_true = it + 4;
 6539|  15.8k|                     const bool at_word_boundary = is_word_boundary(after_true);
 6540|       |
 6541|  15.8k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6541:26): [True: 15.0k, False: 804]
  ------------------
 6542|  15.0k|                        if (has_indented_block_continuation(after_true)) {
  ------------------
  |  Branch (6542:29): [True: 0, False: 15.0k]
  ------------------
 6543|      0|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6544|      0|                           return;
 6545|      0|                        }
 6546|       |                        // Check if this is a key (followed by ": ") rather than a boolean value
 6547|       |                        // "true: value" should parse as {true: value}, not as the boolean true
 6548|  15.0k|                        if ((end - it > 4) && it[4] == ':' &&
  ------------------
  |  Branch (6548:29): [True: 14.5k, False: 411]
  |  Branch (6548:47): [True: 11.5k, False: 3.02k]
  ------------------
 6549|  11.5k|                            (end - it == 5 || it[5] == ' ' || it[5] == '\t' || it[5] == '\n' || it[5] == '\r')) {
  ------------------
  |  Branch (6549:30): [True: 513, False: 11.0k]
  |  Branch (6549:47): [True: 9.02k, False: 2.03k]
  |  Branch (6549:63): [True: 1.28k, False: 747]
  |  Branch (6549:80): [True: 425, False: 322]
  |  Branch (6549:97): [True: 322, False: 0]
  ------------------
 6550|       |                           // This is "true:" followed by space/tab/newline/end - treat as key
 6551|  11.5k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6552|  11.5k|                           return;
 6553|  11.5k|                        }
 6554|  3.43k|                        process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it,
 6555|  3.43k|                                                                                                      end);
 6556|  3.43k|                        return;
 6557|  15.0k|                     }
 6558|       |                     // "true" is followed by more characters (e.g., "True\b") - treat as string
 6559|  15.8k|                  }
 6560|  27.3k|               }
 6561|  12.3k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6562|  27.3k|               return;
 6563|  17.0k|            case 'f':
  ------------------
  |  Branch (6563:13): [True: 17.0k, False: 2.30M]
  ------------------
 6564|  26.0k|            case 'F':
  ------------------
  |  Branch (6564:13): [True: 9.00k, False: 2.31M]
  ------------------
 6565|       |               // Could be "false", "False", "FALSE", or a key/string starting with f/F
 6566|  26.0k|               if constexpr (counts::n_bool > 0) {
 6567|  26.0k|                  if ((end - it >= 5) && ((it[1] == 'a' && it[2] == 'l' && it[3] == 's' && it[4] == 'e') ||
  ------------------
  |  Branch (6567:23): [True: 25.3k, False: 681]
  |  Branch (6567:44): [True: 11.5k, False: 13.7k]
  |  Branch (6567:60): [True: 8.36k, False: 3.23k]
  |  Branch (6567:76): [True: 7.86k, False: 502]
  |  Branch (6567:92): [True: 7.43k, False: 435]
  ------------------
 6568|  17.9k|                                          (it[1] == 'A' && it[2] == 'L' && it[3] == 'S' && it[4] == 'E'))) {
  ------------------
  |  Branch (6568:44): [True: 3.26k, False: 14.6k]
  |  Branch (6568:60): [True: 1.90k, False: 1.36k]
  |  Branch (6568:76): [True: 1.48k, False: 419]
  |  Branch (6568:92): [True: 688, False: 793]
  ------------------
 6569|       |                     // Check what follows the word "false"
 6570|  8.11k|                     const auto after_false = it + 5;
 6571|  8.11k|                     const bool at_word_boundary = is_word_boundary(after_false);
 6572|       |
 6573|  8.11k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6573:26): [True: 7.24k, False: 873]
  ------------------
 6574|  7.24k|                        if (has_indented_block_continuation(after_false)) {
  ------------------
  |  Branch (6574:29): [True: 0, False: 7.24k]
  ------------------
 6575|      0|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6576|      0|                           return;
 6577|      0|                        }
 6578|       |                        // Check if this is a key (followed by ": ") rather than a boolean value
 6579|       |                        // "false: value" should parse as {false: value}, not as the boolean false
 6580|  7.24k|                        if ((end - it > 5) && it[5] == ':' &&
  ------------------
  |  Branch (6580:29): [True: 6.80k, False: 445]
  |  Branch (6580:47): [True: 5.86k, False: 934]
  ------------------
 6581|  5.86k|                            (end - it == 6 || it[6] == ' ' || it[6] == '\t' || it[6] == '\n' || it[6] == '\r')) {
  ------------------
  |  Branch (6581:30): [True: 337, False: 5.52k]
  |  Branch (6581:47): [True: 2.49k, False: 3.03k]
  |  Branch (6581:63): [True: 966, False: 2.06k]
  |  Branch (6581:80): [True: 414, False: 1.65k]
  |  Branch (6581:97): [True: 1.65k, False: 0]
  ------------------
 6582|       |                           // This is "false:" followed by space/tab/newline/end - treat as key
 6583|  5.86k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6584|  5.86k|                           return;
 6585|  5.86k|                        }
 6586|  1.37k|                        process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it,
 6587|  1.37k|                                                                                                      end);
 6588|  1.37k|                        return;
 6589|  7.24k|                     }
 6590|       |                     // "false" is followed by more characters (e.g., "False\b") - treat as string
 6591|  8.11k|                  }
 6592|  26.0k|               }
 6593|  18.8k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6594|  26.0k|               return;
 6595|  17.5k|            case 'n':
  ------------------
  |  Branch (6595:13): [True: 17.5k, False: 2.30M]
  ------------------
 6596|  22.8k|            case 'N':
  ------------------
  |  Branch (6596:13): [True: 5.29k, False: 2.31M]
  ------------------
 6597|       |               // Could be "null", "Null", "NULL", or a key/string starting with n/N
 6598|  22.8k|               if constexpr (counts::n_null > 0) {
 6599|  22.8k|                  if ((end - it >= 4) && ((it[1] == 'u' && it[2] == 'l' && it[3] == 'l') ||
  ------------------
  |  Branch (6599:23): [True: 22.4k, False: 347]
  |  Branch (6599:44): [True: 14.9k, False: 7.57k]
  |  Branch (6599:60): [True: 11.7k, False: 3.13k]
  |  Branch (6599:76): [True: 11.2k, False: 522]
  ------------------
 6600|  11.8k|                                          (it[1] == 'U' && it[2] == 'L' && it[3] == 'L'))) {
  ------------------
  |  Branch (6600:44): [True: 1.75k, False: 9.47k]
  |  Branch (6600:60): [True: 1.23k, False: 519]
  |  Branch (6600:76): [True: 604, False: 632]
  ------------------
 6601|       |                     // Check what follows the word "null"
 6602|  11.8k|                     const auto after_null = it + 4;
 6603|  11.8k|                     const bool at_word_boundary = is_word_boundary(after_null);
 6604|       |
 6605|  11.8k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6605:26): [True: 10.0k, False: 1.81k]
  ------------------
 6606|  10.0k|                        if (has_indented_block_continuation(after_null)) {
  ------------------
  |  Branch (6606:29): [True: 0, False: 10.0k]
  ------------------
 6607|      0|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6608|      0|                           return;
 6609|      0|                        }
 6610|       |                        // Check if this is a key (followed by ": ") rather than a null value
 6611|       |                        // "null: value" should parse as {null: value}, not as the null type
 6612|  10.0k|                        if ((end - it > 4) && it[4] == ':' &&
  ------------------
  |  Branch (6612:29): [True: 9.78k, False: 268]
  |  Branch (6612:47): [True: 6.73k, False: 3.05k]
  ------------------
 6613|  6.73k|                            (end - it == 5 || it[5] == ' ' || it[5] == '\t' || it[5] == '\n' || it[5] == '\r')) {
  ------------------
  |  Branch (6613:30): [True: 329, False: 6.40k]
  |  Branch (6613:47): [True: 415, False: 5.99k]
  |  Branch (6613:63): [True: 5.44k, False: 545]
  |  Branch (6613:80): [True: 243, False: 302]
  |  Branch (6613:97): [True: 302, False: 0]
  ------------------
 6614|       |                           // This is "null:" followed by space/tab/newline/end - treat as key
 6615|  6.73k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6616|  6.73k|                           return;
 6617|  6.73k|                        }
 6618|  3.31k|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6619|  3.31k|                        using NullType = std::variant_alternative_t<first_idx, V>;
 6620|  3.31k|                        if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6620:29): [True: 0, False: 3.31k]
  ------------------
 6621|  3.31k|                        from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6622|  3.31k|                        return;
 6623|  10.0k|                     }
 6624|       |                     // "null" is followed by more characters (e.g., "Null\b") - treat as string
 6625|  11.8k|                  }
 6626|  22.8k|               }
 6627|  12.7k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6628|  22.8k|               return;
 6629|  1.89k|            case '~':
  ------------------
  |  Branch (6629:13): [True: 1.89k, False: 2.32M]
  ------------------
 6630|       |               // Null indicator
 6631|  1.89k|               if constexpr (counts::n_null > 0) {
 6632|  1.89k|                  constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6633|  1.89k|                  using NullType = std::variant_alternative_t<first_idx, V>;
 6634|  1.89k|                  if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6634:23): [True: 0, False: 1.89k]
  ------------------
 6635|  1.89k|                  from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6636|  1.89k|                  return;
 6637|  1.89k|               }
 6638|      0|               break; // Fall through to try other types
 6639|  79.0k|            case '-':
  ------------------
  |  Branch (6639:13): [True: 79.0k, False: 2.24M]
  ------------------
 6640|       |               // Could be negative number or block sequence indicator
 6641|  79.0k|               if (((it + 1) == end) || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(it[1])]) {
  ------------------
  |  Branch (6641:20): [True: 1.95k, False: 77.0k]
  |  Branch (6641:41): [True: 58.5k, False: 18.5k]
  ------------------
 6642|       |                  // Block sequence indicator "- "
 6643|  60.4k|                  if constexpr (counts::n_array > 0) {
 6644|  60.4k|                     process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6645|  60.4k|                                                                                                    end);
 6646|  60.4k|                     return;
 6647|  60.4k|                  }
 6648|  60.4k|               }
 6649|  79.0k|               if constexpr (counts::n_num > 0) {
 6650|  79.0k|                  if ((end - it >= 2) && (std::isdigit(static_cast<unsigned char>(it[1])) || it[1] == '.')) {
  ------------------
  |  Branch (6650:23): [True: 18.5k, False: 60.4k]
  |  Branch (6650:43): [True: 1.54k, False: 17.0k]
  |  Branch (6650:94): [True: 1.30k, False: 15.7k]
  ------------------
 6651|  2.84k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, ctx, it, end);
 6652|  2.84k|                     return;
 6653|  2.84k|                  }
 6654|  79.0k|               }
 6655|  76.1k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6656|  79.0k|               return;
 6657|  7.09k|            case '+':
  ------------------
  |  Branch (6657:13): [True: 7.09k, False: 2.31M]
  ------------------
 6658|  23.1k|            case '.':
  ------------------
  |  Branch (6658:13): [True: 16.0k, False: 2.30M]
  ------------------
 6659|       |               // Could be a number (.5, +5, .inf, etc.) or a string (.c, .cpp, +name, etc.)
 6660|       |               // Try parsing as number speculatively, fall back to string on failure
 6661|  23.1k|               if constexpr (counts::n_num > 0) {
 6662|  23.1k|                  auto start_it = it;
 6663|  23.1k|                  auto temp_ctx = ctx.make_speculative();
 6664|  23.1k|                  process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, temp_ctx, it,
 6665|  23.1k|                                                                                               end);
 6666|  23.1k|                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6667|  23.1k|                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6668|  23.1k|                  if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (6668:23): [True: 2.84k, False: 20.3k]
  ------------------
 6669|  2.84k|                     ctx.anchors = std::move(temp_ctx.anchors);
 6670|  2.84k|                     return; // Successfully parsed as number
 6671|  2.84k|                  }
 6672|  20.3k|                  it = start_it; // Restore and fall through to string
 6673|  20.3k|               }
 6674|      0|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6675|  23.1k|               return;
 6676|   765k|            default:
  ------------------
  |  Branch (6676:13): [True: 765k, False: 1.55M]
  ------------------
 6677|       |               // Check for digit (0-9) - numeric or block mapping key starting with digit
 6678|   765k|               if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (6678:20): [True: 667k, False: 97.2k]
  |  Branch (6678:32): [True: 544k, False: 123k]
  ------------------
 6679|       |                  // Try block mapping first (e.g., "123key: value")
 6680|   544k|                  if (try_parse_block_mapping_into_variant<V, Opts>(value, ctx, it, end)) {
  ------------------
  |  Branch (6680:23): [True: 3.62k, False: 540k]
  ------------------
 6681|  3.62k|                     return;
 6682|  3.62k|                  }
 6683|       |                  // Try numeric value speculatively - values like "12:30" look numeric but aren't
 6684|   540k|                  if constexpr (counts::n_num > 0) {
 6685|   540k|                     auto start_it = it;
 6686|   540k|                     auto temp_ctx = ctx.make_speculative();
 6687|   540k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, temp_ctx, it,
 6688|   540k|                                                                                                  end);
 6689|   540k|                     ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6690|   540k|                     ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6691|   540k|                     if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (6691:26): [True: 509k, False: 31.0k]
  ------------------
 6692|   509k|                        ctx.anchors = std::move(temp_ctx.anchors);
 6693|   509k|                        return; // Successfully parsed as number
 6694|   509k|                     }
 6695|  31.0k|                     it = start_it; // Restore and fall through to string
 6696|  31.0k|                  }
 6697|       |                  // Fall through to string
 6698|      0|                  process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6699|   540k|                  return;
 6700|   544k|               }
 6701|       |               // Plain scalar - try block mapping, then string
 6702|   221k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6703|   221k|               return;
 6704|  2.32M|            }
 6705|  2.32M|         }
 6706|       |
 6707|       |         // For non-auto-deducible variants or fallback, try each type until one succeeds
 6708|      0|         constexpr auto N = std::variant_size_v<std::remove_cvref_t<T>>;
 6709|       |
 6710|       |         // This fold discards each alternative's error and reports only that nothing fit, which
 6711|       |         // misdiagnoses a document that exhausted an expansion budget as merely the wrong shape.
 6712|       |         // Kept aside and used only if no alternative parsed, so a later one that does parse
 6713|       |         // (possible under a latched budget if it materializes no key text) is unaffected.
 6714|  2.32M|         error_code expansion_error{};
 6715|  2.32M|         std::string_view expansion_message{};
 6716|       |
 6717|  2.32M|         auto try_parse = [&]<size_t I>() -> bool {
 6718|  2.32M|            using V = std::variant_alternative_t<I, std::remove_cvref_t<T>>;
 6719|  2.32M|            auto start = it;
 6720|       |
 6721|  2.32M|            V v{};
 6722|  2.32M|            auto temp_ctx = ctx.make_speculative();
 6723|  2.32M|            from<YAML, V>::template op<Opts>(v, temp_ctx, it, end);
 6724|  2.32M|            ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6725|  2.32M|            ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6726|       |
 6727|  2.32M|            if (!bool(temp_ctx.error)) {
 6728|  2.32M|               value = std::move(v);
 6729|  2.32M|               ctx.anchors = std::move(temp_ctx.anchors);
 6730|  2.32M|               return true;
 6731|  2.32M|            }
 6732|       |
 6733|  2.32M|            if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 6734|  2.32M|               expansion_error = temp_ctx.error;
 6735|  2.32M|               expansion_message = temp_ctx.custom_error_message;
 6736|  2.32M|            }
 6737|  2.32M|            it = start;
 6738|  2.32M|            return false;
 6739|  2.32M|         };
 6740|       |
 6741|  2.32M|         bool parsed = false;
 6742|  2.32M|         [&]<size_t... Is>(std::index_sequence<Is...>) {
 6743|  2.32M|            ((parsed = parsed || try_parse.template operator()<Is>()), ...);
 6744|  2.32M|         }(std::make_index_sequence<N>{});
 6745|       |
 6746|  2.32M|         if (!parsed) {
  ------------------
  |  Branch (6746:14): [True: 0, False: 2.32M]
  ------------------
 6747|      0|            if (expansion_error != error_code::none) {
  ------------------
  |  Branch (6747:17): [True: 0, False: 0]
  ------------------
 6748|      0|               ctx.error = expansion_error;
 6749|      0|               ctx.custom_error_message = expansion_message;
 6750|      0|            }
 6751|      0|            else {
 6752|      0|               ctx.error = error_code::no_matching_variant_type;
 6753|      0|            }
 6754|      0|         }
 6755|  2.32M|      }
_ZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE10redispatchITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_:
 6762|   473k|      {
 6763|   473k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 6764|   473k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (6764:14): [True: 11, False: 473k]
  ------------------
 6765|     11|            return;
 6766|   473k|         op<Opts>(value, ctx, it, end);
 6767|   473k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERNSt3__17variantIJDndNS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbNS3_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS8_ISF_EEEENSE_ISF_EEEEENS0_12yaml_contextEPKcSN_EEbOT0_RT1_RT2_T3_:
  309|   222k|      {
  310|   222k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 222k]
  |  Branch (310:27): [True: 0, False: 222k]
  ------------------
  311|       |
  312|   222k|         ++it; // skip '*'
  313|   222k|         auto name = parse_anchor_name(it, end);
  314|   222k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 179, False: 222k]
  ------------------
  315|    179|            ctx.error = error_code::syntax_error;
  316|    179|            return true;
  317|    179|         }
  318|       |
  319|   222k|         auto anchor_it = ctx.anchors.find(name);
  320|   222k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 450, False: 222k]
  ------------------
  321|    450|            ctx.error = error_code::syntax_error; // undefined alias
  322|    450|            return true;
  323|    450|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|   222k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|   222k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 18.8k, False: 203k]
  ------------------
  331|  18.8k|            return true;
  332|  18.8k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|   203k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 15, False: 203k]
  ------------------
  338|     15|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     15|            return true;
  340|     15|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|   203k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|   203k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 2, False: 203k]
  ------------------
  348|      2|            return true;
  349|       |
  350|   203k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 13, False: 203k]
  ------------------
  351|     13|            ctx.error = error_code::exceeded_max_expansion;
  352|     13|            ctx.custom_error_message = "alias expansion";
  353|     13|            return true;
  354|     13|         }
  355|       |
  356|   203k|         auto replay_it = span.begin;
  357|   203k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|   203k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|   203k|         ctx.indent_stack.clear();
  362|   203k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 9.25k, False: 194k]
  ------------------
  363|  9.25k|            ctx.push_indent(span.base_indent - 1);
  364|  9.25k|         }
  365|       |
  366|   203k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|   203k|         using V = std::remove_cvref_t<T>;
  369|   203k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|   203k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|   203k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|   203k|         return true;
  376|   203k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_19is_yaml_variant_strEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   295k|      {
 5356|   295k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   295k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   295k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   295k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   295k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 295k, False: 0]
  ------------------
 5366|   295k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   295k|      }
_ZN3glz4fromILj450ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS7_TkNS_10is_contextERNS_4yaml12yaml_contextESC_EEvOT1_OT2_OT0_T3_:
 1987|   301k|      {
 1988|   301k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (1988:14): [True: 5.12k, False: 296k]
  ------------------
 1989|  5.12k|            return;
 1990|       |
 1991|   296k|         yaml::node_preamble_state preamble{};
 1992|   296k|         if (yaml::parse_node_preamble<Opts, yaml::node_property_policy{true, false, false, true}>(
  ------------------
  |  Branch (1992:14): [True: 8.24k, False: 288k]
  ------------------
 1993|   296k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_string(tag); }))
 1994|  8.24k|            return;
 1995|       |
 1996|   288k|         std::string str;
 1997|   288k|         const auto style = yaml::detect_scalar_style(*it);
 1998|       |
 1999|   288k|         switch (style) {
  ------------------
  |  Branch (1999:18): [True: 288k, False: 0]
  ------------------
 2000|  3.06k|         case yaml::scalar_style::double_quoted:
  ------------------
  |  Branch (2000:10): [True: 3.06k, False: 285k]
  ------------------
 2001|  3.06k|            yaml::parse_double_quoted_string(str, ctx, it, end);
 2002|  3.06k|            break;
 2003|  1.25k|         case yaml::scalar_style::single_quoted:
  ------------------
  |  Branch (2003:10): [True: 1.25k, False: 286k]
  ------------------
 2004|  1.25k|            yaml::parse_single_quoted_string(str, ctx, it, end);
 2005|  1.25k|            break;
 2006|    456|         case yaml::scalar_style::literal_block:
  ------------------
  |  Branch (2006:10): [True: 456, False: 287k]
  ------------------
 2007|  3.29k|         case yaml::scalar_style::folded_block:
  ------------------
  |  Branch (2007:10): [True: 2.83k, False: 285k]
  ------------------
 2008|       |            // For same-line mapping/sequence values, parsing context is typically pushed
 2009|       |            // one column past the key/item indicator; block scalar indentation is relative
 2010|       |            // to the parent line indent.
 2011|  3.29k|            yaml::parse_block_scalar(str, ctx, it, end,
 2012|  3.29k|                                     ctx.current_indent() > 0 ? (ctx.current_indent() - 1) : ctx.current_indent());
  ------------------
  |  Branch (2012:38): [True: 822, False: 2.47k]
  ------------------
 2013|  3.29k|            break;
 2014|   280k|         case yaml::scalar_style::plain:
  ------------------
  |  Branch (2014:10): [True: 280k, False: 7.61k]
  ------------------
 2015|       |            // A collection where a string is expected is a type mismatch. Reading it as a
 2016|       |            // plain scalar would store its source text, and for a block sequence only the
 2017|       |            // first entry, as the value.
 2018|   280k|            if (yaml::plain_scalar_starts_collection(it, end)) [[unlikely]] {
  ------------------
  |  Branch (2018:17): [True: 72, False: 280k]
  ------------------
 2019|     72|               ctx.error = error_code::syntax_error;
 2020|     72|               return;
 2021|     72|            }
 2022|       |            // In block context with known indent, use multiline parsing to support
 2023|       |            // plain scalars that span multiple lines (folding behavior)
 2024|       |            if constexpr (!yaml::check_flow_context(Opts)) {
 2025|       |               if (ctx.current_indent() >= 0) {
 2026|       |                  yaml::parse_plain_scalar_multiline(str, ctx, it, end, ctx.current_indent());
 2027|       |               }
 2028|       |               else {
 2029|       |                  // Top-level plain scalars may continue on same-indent or indented lines.
 2030|       |                  yaml::parse_plain_scalar_multiline(str, ctx, it, end, int32_t(0));
 2031|       |               }
 2032|       |            }
 2033|   280k|            else {
 2034|   280k|               yaml::parse_plain_scalar(str, ctx, it, end, true);
 2035|   280k|            }
 2036|   280k|            break;
 2037|   288k|         }
 2038|       |
 2039|   288k|         if (!bool(ctx.error)) {
  ------------------
  |  Branch (2039:14): [True: 287k, False: 1.00k]
  ------------------
 2040|   287k|            value = std::move(str);
 2041|   287k|            yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 2042|   287k|         }
 2043|   288k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1ELb0ELb0ELb1EEELb0ERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_12yaml_contextEPKcSE_ZNS_4fromILj450ESA_E2opITnDaXtlS2_Lj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERSE_SB_TkNS_10is_contextERSC_SE_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSN_RSQ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   296k|      {
  475|   296k|         skip_inline_ws(it, end);
  476|       |
  477|   296k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 13, False: 296k]
  ------------------
  478|     13|            if constexpr (!AllowEmptyInput) {
  479|     13|               ctx.error = error_code::unexpected_end;
  480|     13|            }
  481|     13|            return true;
  482|     13|         }
  483|       |
  484|   296k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   296k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 13, False: 296k]
  ------------------
  486|     13|            ctx.error = error_code::syntax_error;
  487|     13|            return true;
  488|     13|         }
  489|   296k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 3, False: 296k]
  ------------------
  490|      3|            ctx.error = error_code::syntax_error;
  491|      3|            return true;
  492|      3|         }
  493|       |
  494|   296k|         skip_inline_ws(it, end);
  495|       |
  496|   296k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 7, False: 296k]
  ------------------
  497|      7|            if constexpr (!AllowEmptyInput) {
  498|      7|               ctx.error = error_code::unexpected_end;
  499|      7|            }
  500|      7|            return true;
  501|      7|         }
  502|       |
  503|   296k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 8.20k, False: 288k]
  ------------------
  504|  8.20k|            return true;
  505|  8.20k|         }
  506|       |
  507|   288k|         return false;
  508|   296k|      }
_ZZN3glz4fromILj450ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS7_TkNS_10is_contextERNS_4yaml12yaml_contextESC_EEvOT1_OT2_OT0_T3_ENKUlNSF_8yaml_tagEE_clESP_:
 1993|   296k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_string(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1ELb0ELb0ELb1EEERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_12yaml_contextEPKcSE_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   296k|      {
  418|   296k|         state.has_anchor = false;
  419|   296k|         state.anchor_name.clear();
  420|   296k|         state.anchor_start = nullptr;
  421|   296k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   296k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|   296k|            else {
  430|   296k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 8.16k, False: 288k]
  ------------------
  431|   296k|            }
  432|   296k|         }
  433|       |
  434|   296k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 288k, False: 8.16k]
  |  Branch (434:27): [True: 12.5k, False: 275k]
  ------------------
  435|  12.5k|            ++it;
  436|  12.5k|            auto name = parse_anchor_name(it, end);
  437|  12.5k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 10, False: 12.5k]
  ------------------
  438|     10|               ctx.error = error_code::syntax_error;
  439|     10|               return true;
  440|     10|            }
  441|  12.5k|            skip_inline_ws(it, end);
  442|  12.5k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 26, False: 12.5k]
  ------------------
  443|     26|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     26|                  ctx.error = error_code::unexpected_end;
  445|     26|               }
  446|     26|               return true;
  447|     26|            }
  448|  12.5k|            if constexpr (Policy.disallow_anchor_on_alias) {
  449|  12.5k|               if (*it == '*') {
  ------------------
  |  Branch (449:20): [True: 4, False: 12.5k]
  ------------------
  450|      4|                  ctx.error = error_code::syntax_error;
  451|      4|                  return true;
  452|      4|               }
  453|  12.5k|            }
  454|  12.5k|            state.has_anchor = true;
  455|  12.5k|            state.anchor_name = std::string(name);
  456|  12.5k|            state.anchor_start = &*it;
  457|  12.5k|         }
  458|       |
  459|   296k|         return false;
  460|   296k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS0_12yaml_contextEPKcSD_EEbOT0_RT1_RT2_T3_:
  309|   296k|      {
  310|   296k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 296k]
  |  Branch (310:27): [True: 288k, False: 8.16k]
  ------------------
  311|       |
  312|  8.16k|         ++it; // skip '*'
  313|  8.16k|         auto name = parse_anchor_name(it, end);
  314|  8.16k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 14, False: 8.15k]
  ------------------
  315|     14|            ctx.error = error_code::syntax_error;
  316|     14|            return true;
  317|     14|         }
  318|       |
  319|  8.15k|         auto anchor_it = ctx.anchors.find(name);
  320|  8.15k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 27, False: 8.12k]
  ------------------
  321|     27|            ctx.error = error_code::syntax_error; // undefined alias
  322|     27|            return true;
  323|     27|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  8.12k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  8.12k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 1.93k, False: 6.19k]
  ------------------
  331|  1.93k|            return true;
  332|  1.93k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  6.19k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 7, False: 6.18k]
  ------------------
  338|      7|            ctx.error = error_code::syntax_error; // cyclic alias
  339|      7|            return true;
  340|      7|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  6.18k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  6.18k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 2, False: 6.18k]
  ------------------
  348|      2|            return true;
  349|       |
  350|  6.18k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 8, False: 6.17k]
  ------------------
  351|      8|            ctx.error = error_code::exceeded_max_expansion;
  352|      8|            ctx.custom_error_message = "alias expansion";
  353|      8|            return true;
  354|      8|         }
  355|       |
  356|  6.17k|         auto replay_it = span.begin;
  357|  6.17k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  6.17k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  6.17k|         ctx.indent_stack.clear();
  362|  6.17k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 828, False: 5.34k]
  ------------------
  363|    828|            ctx.push_indent(span.base_indent - 1);
  364|    828|         }
  365|       |
  366|  6.17k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  6.17k|         using V = std::remove_cvref_t<T>;
  369|  6.17k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  6.17k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  6.17k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  6.17k|         return true;
  376|  6.18k|      }
_ZN3glz4yaml26parse_double_quoted_stringINS0_12yaml_contextEPKcS4_EEvRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEERT_RT0_T1_:
  514|  1.16M|      {
  515|  1.16M|         static constexpr size_t string_padding_bytes = 8;
  516|       |
  517|  1.16M|         if (it == end || *it != '"') [[unlikely]] {
  ------------------
  |  Branch (517:14): [True: 0, False: 1.16M]
  |  Branch (517:27): [True: 0, False: 1.16M]
  ------------------
  518|      0|            ctx.error = error_code::expected_quote;
  519|      0|            return;
  520|      0|         }
  521|       |
  522|  1.16M|         ++it; // skip opening quote
  523|  1.16M|         auto start = it;
  524|       |
  525|       |         // Pass 1: Find closing quote byte-by-byte (need to handle newlines and escapes)
  526|  9.20M|         while (it != end && *it != '"') {
  ------------------
  |  Branch (526:17): [True: 9.20M, False: 446]
  |  Branch (526:30): [True: 8.04M, False: 1.16M]
  ------------------
  527|  8.04M|            if (*it == '\\') {
  ------------------
  |  Branch (527:17): [True: 69.5k, False: 7.97M]
  ------------------
  528|  69.5k|               ++it;
  529|  69.5k|               if (it == end) [[unlikely]] {
  ------------------
  |  Branch (529:20): [True: 40, False: 69.5k]
  ------------------
  530|     40|                  ctx.error = error_code::unexpected_end;
  531|     40|                  return;
  532|     40|               }
  533|  69.5k|            }
  534|  7.97M|            else if (forbidden_control_table[uint8_t(*it)]) [[unlikely]] {
  ------------------
  |  Branch (534:22): [True: 430, False: 7.97M]
  ------------------
  535|       |               // A raw control byte is invalid; the \xXX escape form above is how such a
  536|       |               // character is legitimately carried in a double-quoted scalar.
  537|    430|               ctx.error = error_code::invalid_control_character;
  538|    430|               return;
  539|    430|            }
  540|  8.04M|            ++it;
  541|  8.04M|         }
  542|       |
  543|  1.16M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (543:14): [True: 446, False: 1.16M]
  ------------------
  544|    446|            ctx.error = error_code::unexpected_end;
  545|    446|            return;
  546|    446|         }
  547|       |
  548|       |         // Allocate buffer with room for potential expansion and SWAR padding
  549|       |         // Some YAML escapes expand: \L, \P -> 3 bytes UTF-8
  550|  1.16M|         const auto input_len = static_cast<size_t>(it - start);
  551|  1.16M|         value.resize(input_len + (input_len / 2) + string_padding_bytes);
  552|  1.16M|         auto* dst = value.data();
  553|  1.16M|         auto* const dst_start = dst;
  554|       |
  555|       |         // Pass 2: Copy and process escapes and line folding
  556|  1.16M|         auto src = start;
  557|  1.16M|         const auto* const src_end = &*it;
  558|       |         // Track position past which we should not trim. Escape-produced characters
  559|       |         // (even whitespace like \t) are content and must not be trimmed by line folding.
  560|  1.16M|         auto* last_non_trimmable = dst;
  561|       |
  562|  4.81M|         while (src < src_end) {
  ------------------
  |  Branch (562:17): [True: 3.64M, False: 1.16M]
  ------------------
  563|       |            // Check for newline - needs line folding
  564|  3.64M|            if (*src == '\n' || *src == '\r') {
  ------------------
  |  Branch (564:17): [True: 16.6k, False: 3.63M]
  |  Branch (564:33): [True: 46.1k, False: 3.58M]
  ------------------
  565|       |               // Trim trailing LITERAL whitespace from output before processing newline.
  566|       |               // Escape-produced whitespace (e.g. from \t) is preserved.
  567|  62.8k|               dst = (std::max)(last_non_trimmable, dst_start);
  568|       |
  569|       |               // Skip the newline
  570|  62.8k|               if (*src == '\r' && (src + 1) < src_end && *(src + 1) == '\n') {
  ------------------
  |  Branch (570:20): [True: 46.1k, False: 16.6k]
  |  Branch (570:36): [True: 44.7k, False: 1.39k]
  |  Branch (570:59): [True: 1.62k, False: 43.1k]
  ------------------
  571|  1.62k|                  src += 2; // CRLF
  572|  1.62k|               }
  573|  61.2k|               else {
  574|  61.2k|                  ++src;
  575|  61.2k|               }
  576|       |
  577|       |               // Skip leading indentation on the next line.
  578|  62.8k|               int indent_count = 0;
  579|  62.8k|               if (!yaml::skip_folded_line_indent(src, src_end, ctx, &indent_count)) return;
  ------------------
  |  Branch (579:20): [True: 42, False: 62.8k]
  ------------------
  580|  62.8k|               if (indent_count == 0 && yaml::starts_with_document_marker(src, src_end)) {
  ------------------
  |  Branch (580:20): [True: 38.8k, False: 23.9k]
  |  Branch (580:41): [True: 96, False: 38.7k]
  ------------------
  581|     96|                  ctx.error = error_code::syntax_error;
  582|     96|                  return;
  583|     96|               }
  584|       |
  585|       |               // Check if this is a blank line (another newline follows)
  586|  62.7k|               if (src < src_end && (*src == '\n' || *src == '\r')) {
  ------------------
  |  Branch (586:20): [True: 58.0k, False: 4.63k]
  |  Branch (586:38): [True: 5.23k, False: 52.8k]
  |  Branch (586:54): [True: 8.10k, False: 44.7k]
  ------------------
  587|       |                  // Blank line(s) - output newlines for each blank line
  588|  52.3k|                  while (src < src_end && (*src == '\n' || *src == '\r')) {
  ------------------
  |  Branch (588:26): [True: 48.5k, False: 3.77k]
  |  Branch (588:44): [True: 22.2k, False: 26.3k]
  |  Branch (588:60): [True: 16.9k, False: 9.45k]
  ------------------
  589|  39.1k|                     *dst++ = '\n';
  590|       |                     // Skip the newline
  591|  39.1k|                     if (*src == '\r' && (src + 1) < src_end && *(src + 1) == '\n') {
  ------------------
  |  Branch (591:26): [True: 16.9k, False: 22.2k]
  |  Branch (591:42): [True: 14.7k, False: 2.14k]
  |  Branch (591:65): [True: 1.19k, False: 13.5k]
  ------------------
  592|  1.19k|                        src += 2; // CRLF
  593|  1.19k|                     }
  594|  37.9k|                     else {
  595|  37.9k|                        ++src;
  596|  37.9k|                     }
  597|  39.1k|                     int blank_indent_count = 0;
  598|  39.1k|                     if (!yaml::skip_folded_line_indent(src, src_end, ctx, &blank_indent_count)) return;
  ------------------
  |  Branch (598:26): [True: 32, False: 39.0k]
  ------------------
  599|  39.0k|                     if (blank_indent_count == 0 && yaml::starts_with_document_marker(src, src_end)) {
  ------------------
  |  Branch (599:26): [True: 36.3k, False: 2.68k]
  |  Branch (599:53): [True: 66, False: 36.3k]
  ------------------
  600|     66|                        ctx.error = error_code::syntax_error;
  601|     66|                        return;
  602|     66|                     }
  603|  39.0k|                  }
  604|       |                  // Don't add space - we're now at content after blank line(s)
  605|  13.3k|               }
  606|  49.3k|               else {
  607|       |                  // Single newline - fold to space
  608|  49.3k|                  *dst++ = ' ';
  609|  49.3k|               }
  610|  62.6k|               last_non_trimmable = dst;
  611|  62.6k|               continue;
  612|  62.7k|            }
  613|       |
  614|  3.58M|            if (*src == '\\') {
  ------------------
  |  Branch (614:17): [True: 51.5k, False: 3.53M]
  ------------------
  615|  51.5k|               ++src;
  616|  51.5k|               if (src >= src_end) [[unlikely]] {
  ------------------
  |  Branch (616:20): [True: 0, False: 51.5k]
  ------------------
  617|       |                  // Shouldn't happen - we validated in pass 1
  618|      0|                  ctx.error = error_code::syntax_error;
  619|      0|                  return;
  620|      0|               }
  621|       |
  622|  51.5k|               const auto esc = uint8_t(*src);
  623|       |
  624|       |               // Check for escaped newline (line continuation - no space)
  625|  51.5k|               if (esc == '\n' || esc == '\r') {
  ------------------
  |  Branch (625:20): [True: 14.7k, False: 36.8k]
  |  Branch (625:35): [True: 4.67k, False: 32.1k]
  ------------------
  626|       |                  // Skip the newline
  627|  19.4k|                  if (esc == '\r' && (src + 1) < src_end && *(src + 1) == '\n') {
  ------------------
  |  Branch (627:23): [True: 4.67k, False: 14.7k]
  |  Branch (627:38): [True: 2.44k, False: 2.23k]
  |  Branch (627:61): [True: 270, False: 2.17k]
  ------------------
  628|    270|                     src += 2; // CRLF
  629|    270|                  }
  630|  19.1k|                  else {
  631|  19.1k|                     ++src;
  632|  19.1k|                  }
  633|       |
  634|  19.4k|                  int indent_count = 0;
  635|  19.4k|                  if (!yaml::skip_folded_line_indent(src, src_end, ctx, &indent_count)) return;
  ------------------
  |  Branch (635:23): [True: 24, False: 19.3k]
  ------------------
  636|  19.3k|                  if (indent_count == 0 && yaml::starts_with_document_marker(src, src_end)) {
  ------------------
  |  Branch (636:23): [True: 16.6k, False: 2.75k]
  |  Branch (636:44): [True: 64, False: 16.5k]
  ------------------
  637|     64|                     ctx.error = error_code::syntax_error;
  638|     64|                     return;
  639|     64|                  }
  640|       |                  // No output - this is line continuation without space
  641|  19.3k|                  last_non_trimmable = dst;
  642|  19.3k|                  continue;
  643|  19.3k|               }
  644|       |
  645|       |               // Check simple escape table first
  646|  32.1k|               if (yaml_escape_is_simple[esc]) {
  ------------------
  |  Branch (646:20): [True: 13.4k, False: 18.6k]
  ------------------
  647|  13.4k|                  *dst++ = yaml_unescape_table[esc];
  648|  13.4k|                  ++src;
  649|  13.4k|               }
  650|       |               // Handle escapes requiring special processing
  651|  18.6k|               else if (yaml_escape_needs_special[esc]) {
  ------------------
  |  Branch (651:25): [True: 6.75k, False: 11.9k]
  ------------------
  652|  6.75k|                  ++src; // skip escape char
  653|  6.75k|                  switch (esc) {
  654|    916|                  case 'x': {
  ------------------
  |  Branch (654:19): [True: 916, False: 5.84k]
  ------------------
  655|       |                     // \xXX - 2 hex digits
  656|    916|                     if (static_cast<size_t>(src_end - src) < 2) [[unlikely]] {
  ------------------
  |  Branch (656:26): [True: 6, False: 910]
  ------------------
  657|      6|                        ctx.error = error_code::syntax_error;
  658|      6|                        return;
  659|      6|                     }
  660|    910|                     const uint32_t hi = digit_hex_table[uint8_t(src[0])];
  661|    910|                     const uint32_t lo = digit_hex_table[uint8_t(src[1])];
  662|    910|                     if ((hi | lo) & 0xF0) [[unlikely]] {
  ------------------
  |  Branch (662:26): [True: 10, False: 900]
  ------------------
  663|     10|                        ctx.error = error_code::syntax_error;
  664|     10|                        return;
  665|     10|                     }
  666|    900|                     const uint32_t codepoint = (hi << 4) | lo;
  667|    900|                     src += 2;
  668|    900|                     dst += code_point_to_utf8(codepoint, dst);
  669|    900|                     break;
  670|    910|                  }
  671|  2.38k|                  case 'u': {
  ------------------
  |  Branch (671:19): [True: 2.38k, False: 4.37k]
  ------------------
  672|       |                     // \uXXXX - 4 hex digits
  673|  2.38k|                     if (static_cast<size_t>(src_end - src) < 4) [[unlikely]] {
  ------------------
  |  Branch (673:26): [True: 10, False: 2.37k]
  ------------------
  674|     10|                        ctx.error = error_code::syntax_error;
  675|     10|                        return;
  676|     10|                     }
  677|  2.37k|                     const uint32_t codepoint = hex_to_u32(src);
  678|  2.37k|                     if (codepoint == 0xFFFFFFFFu || (codepoint >= 0xD800 && codepoint <= 0xDFFF)) [[unlikely]] {
  ------------------
  |  Branch (678:26): [True: 26, False: 2.35k]
  |  Branch (678:55): [True: 1.40k, False: 946]
  |  Branch (678:78): [True: 30, False: 1.37k]
  ------------------
  679|     56|                        ctx.error = error_code::syntax_error;
  680|     56|                        return;
  681|     56|                     }
  682|  2.32k|                     src += 4;
  683|  2.32k|                     dst += code_point_to_utf8(codepoint, dst);
  684|  2.32k|                     break;
  685|  2.37k|                  }
  686|  2.10k|                  case 'U': {
  ------------------
  |  Branch (686:19): [True: 2.10k, False: 4.65k]
  ------------------
  687|       |                     // \UXXXXXXXX - 8 hex digits
  688|  2.10k|                     if (static_cast<size_t>(src_end - src) < 8) [[unlikely]] {
  ------------------
  |  Branch (688:26): [True: 6, False: 2.09k]
  ------------------
  689|      6|                        ctx.error = error_code::syntax_error;
  690|      6|                        return;
  691|      6|                     }
  692|  2.09k|                     const uint32_t hi = hex_to_u32(src);
  693|  2.09k|                     const uint32_t lo = hex_to_u32(src + 4);
  694|  2.09k|                     if ((hi | lo) == 0xFFFFFFFFu) [[unlikely]] {
  ------------------
  |  Branch (694:26): [True: 28, False: 2.06k]
  ------------------
  695|     28|                        ctx.error = error_code::syntax_error;
  696|     28|                        return;
  697|     28|                     }
  698|  2.06k|                     const uint32_t codepoint = (hi << 16) | lo;
  699|  2.06k|                     src += 8;
  700|  2.06k|                     if (codepoint >= 0xD800 && codepoint <= 0xDFFF) [[unlikely]] {
  ------------------
  |  Branch (700:26): [True: 1.10k, False: 964]
  |  Branch (700:49): [True: 10, False: 1.09k]
  ------------------
  701|     10|                        ctx.error = error_code::syntax_error;
  702|     10|                        return;
  703|     10|                     }
  704|  2.05k|                     if (codepoint <= 0x10FFFF) {
  ------------------
  |  Branch (704:26): [True: 1.24k, False: 814]
  ------------------
  705|  1.24k|                        dst += code_point_to_utf8(codepoint, dst);
  706|  1.24k|                     }
  707|  2.05k|                     break;
  708|  2.06k|                  }
  709|    564|                  case 'N': {
  ------------------
  |  Branch (709:19): [True: 564, False: 6.19k]
  ------------------
  710|       |                     // Next line U+0085
  711|    564|                     dst += code_point_to_utf8(0x0085, dst);
  712|    564|                     break;
  713|  2.06k|                  }
  714|    278|                  case '_': {
  ------------------
  |  Branch (714:19): [True: 278, False: 6.48k]
  ------------------
  715|       |                     // Non-breaking space U+00A0
  716|    278|                     dst += code_point_to_utf8(0x00A0, dst);
  717|    278|                     break;
  718|  2.06k|                  }
  719|    318|                  case 'L': {
  ------------------
  |  Branch (719:19): [True: 318, False: 6.44k]
  ------------------
  720|       |                     // Line separator U+2028
  721|    318|                     dst += code_point_to_utf8(0x2028, dst);
  722|    318|                     break;
  723|  2.06k|                  }
  724|    196|                  case 'P': {
  ------------------
  |  Branch (724:19): [True: 196, False: 6.56k]
  ------------------
  725|       |                     // Paragraph separator U+2029
  726|    196|                     dst += code_point_to_utf8(0x2029, dst);
  727|    196|                     break;
  728|  2.06k|                  }
  729|      0|                  default:
  ------------------
  |  Branch (729:19): [True: 0, False: 6.75k]
  ------------------
  730|      0|                     break;
  731|  6.75k|                  }
  732|  6.75k|               }
  733|  11.9k|               else {
  734|       |                  // Preserve unknown escapes for compatibility, but reject a subset that
  735|       |                  // YAML test-suite marks as malformed in double-quoted scalars.
  736|  11.9k|                  if (esc == '.' || esc == '\'') {
  ------------------
  |  Branch (736:23): [True: 18, False: 11.8k]
  |  Branch (736:37): [True: 6, False: 11.8k]
  ------------------
  737|     24|                     ctx.error = error_code::syntax_error;
  738|     24|                     return;
  739|     24|                  }
  740|  11.8k|                  *dst++ = '\\';
  741|  11.8k|                  *dst++ = static_cast<char>(esc);
  742|  11.8k|                  ++src;
  743|  11.8k|               }
  744|       |               // All escape-produced characters are content, not trimmable
  745|  31.9k|               last_non_trimmable = dst;
  746|  31.9k|            }
  747|  3.53M|            else {
  748|  3.53M|               const char ch = *src++;
  749|  3.53M|               *dst++ = ch;
  750|       |               // Only update non-trimmable for non-whitespace literal characters
  751|  3.53M|               if (ch != ' ' && ch != '\t') {
  ------------------
  |  Branch (751:20): [True: 3.39M, False: 135k]
  |  Branch (751:33): [True: 3.37M, False: 20.5k]
  ------------------
  752|  3.37M|                  last_non_trimmable = dst;
  753|  3.37M|               }
  754|  3.53M|            }
  755|  3.58M|         }
  756|       |
  757|       |         // Resize to actual length
  758|  1.16M|         value.resize(static_cast<size_t>(dst - dst_start));
  759|  1.16M|         ++it; // skip closing quote
  760|  1.16M|      }
_ZN3glz4yaml26parse_single_quoted_stringINS0_12yaml_contextEPKcS4_EEvRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEERT_RT0_T1_:
  767|  35.8k|      {
  768|  35.8k|         static constexpr size_t string_padding_bytes = 8;
  769|       |
  770|  35.8k|         if (it == end || *it != '\'') [[unlikely]] {
  ------------------
  |  Branch (770:14): [True: 0, False: 35.8k]
  |  Branch (770:27): [True: 0, False: 35.8k]
  ------------------
  771|      0|            ctx.error = error_code::expected_quote;
  772|      0|            return;
  773|      0|         }
  774|       |
  775|  35.8k|         ++it; // skip opening quote
  776|  35.8k|         auto start = it;
  777|       |
  778|       |         // Pass 1: Find closing quote (handling '' escapes)
  779|  11.0M|         while (it != end) {
  ------------------
  |  Branch (779:17): [True: 11.0M, False: 418]
  ------------------
  780|  11.0M|            if (*it == '\'') {
  ------------------
  |  Branch (780:17): [True: 49.5k, False: 11.0M]
  ------------------
  781|  49.5k|               if ((it + 1) != end && *(it + 1) == '\'') {
  ------------------
  |  Branch (781:20): [True: 43.8k, False: 5.71k]
  |  Branch (781:39): [True: 14.4k, False: 29.3k]
  ------------------
  782|  14.4k|                  it += 2; // Skip escaped quote
  783|  14.4k|               }
  784|  35.0k|               else {
  785|  35.0k|                  break; // Found closing quote
  786|  35.0k|               }
  787|  49.5k|            }
  788|  11.0M|            else {
  789|  11.0M|               if (forbidden_control_table[uint8_t(*it)]) [[unlikely]] {
  ------------------
  |  Branch (789:20): [True: 384, False: 11.0M]
  ------------------
  790|    384|                  ctx.error = error_code::invalid_control_character;
  791|    384|                  return;
  792|    384|               }
  793|  11.0M|               ++it;
  794|  11.0M|            }
  795|  11.0M|         }
  796|       |
  797|  35.4k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (797:14): [True: 418, False: 35.0k]
  ------------------
  798|    418|            ctx.error = error_code::unexpected_end;
  799|    418|            return;
  800|    418|         }
  801|       |
  802|  35.0k|         const auto input_len = static_cast<size_t>(it - start);
  803|  35.0k|         value.resize(input_len + string_padding_bytes);
  804|  35.0k|         auto* dst = value.data();
  805|  35.0k|         auto* const dst_start = dst;
  806|  35.0k|         auto src = start;
  807|  35.0k|         const auto* const src_end = &*it;
  808|       |
  809|       |         // Pass 2: Process content with line folding and '' escapes
  810|  7.48M|         while (src < src_end) {
  ------------------
  |  Branch (810:17): [True: 7.45M, False: 34.7k]
  ------------------
  811|       |            // Check for newline - needs line folding
  812|  7.45M|            if (*src == '\n' || *src == '\r') {
  ------------------
  |  Branch (812:17): [True: 93.6k, False: 7.36M]
  |  Branch (812:33): [True: 26.2k, False: 7.33M]
  ------------------
  813|       |               // Trim trailing whitespace from output before processing newline
  814|   171k|               while (dst > dst_start && (*(dst - 1) == ' ' || *(dst - 1) == '\t')) {
  ------------------
  |  Branch (814:23): [True: 164k, False: 6.56k]
  |  Branch (814:43): [True: 47.8k, False: 116k]
  |  Branch (814:64): [True: 3.43k, False: 113k]
  ------------------
  815|  51.3k|                  --dst;
  816|  51.3k|               }
  817|       |
  818|       |               // Skip the newline
  819|   119k|               if (*src == '\r' && (src + 1) < src_end && *(src + 1) == '\n') {
  ------------------
  |  Branch (819:20): [True: 26.2k, False: 93.6k]
  |  Branch (819:36): [True: 25.2k, False: 992]
  |  Branch (819:59): [True: 2.10k, False: 23.1k]
  ------------------
  820|  2.10k|                  src += 2; // CRLF
  821|  2.10k|               }
  822|   117k|               else {
  823|   117k|                  ++src;
  824|   117k|               }
  825|       |
  826|       |               // Skip leading indentation on the next line.
  827|   119k|               int indent_count = 0;
  828|   119k|               if (!yaml::skip_folded_line_indent(src, src_end, ctx, &indent_count)) return;
  ------------------
  |  Branch (828:20): [True: 72, False: 119k]
  ------------------
  829|   119k|               if (indent_count == 0 && yaml::starts_with_document_marker(src, src_end)) {
  ------------------
  |  Branch (829:20): [True: 104k, False: 15.1k]
  |  Branch (829:41): [True: 72, False: 104k]
  ------------------
  830|     72|                  ctx.error = error_code::syntax_error;
  831|     72|                  return;
  832|     72|               }
  833|       |
  834|       |               // Check if this is a blank line (another newline follows)
  835|   119k|               if (src < src_end && (*src == '\n' || *src == '\r')) {
  ------------------
  |  Branch (835:20): [True: 114k, False: 5.47k]
  |  Branch (835:38): [True: 56.6k, False: 57.6k]
  |  Branch (835:54): [True: 13.9k, False: 43.7k]
  ------------------
  836|       |                  // Blank line(s) - output newlines for each blank line
  837|   179k|                  while (src < src_end && (*src == '\n' || *src == '\r')) {
  ------------------
  |  Branch (837:26): [True: 174k, False: 5.44k]
  |  Branch (837:44): [True: 89.5k, False: 84.8k]
  |  Branch (837:60): [True: 19.8k, False: 64.9k]
  ------------------
  838|   109k|                     *dst++ = '\n';
  839|       |                     // Skip the newline
  840|   109k|                     if (*src == '\r' && (src + 1) < src_end && *(src + 1) == '\n') {
  ------------------
  |  Branch (840:26): [True: 19.8k, False: 89.5k]
  |  Branch (840:42): [True: 18.6k, False: 1.22k]
  |  Branch (840:65): [True: 466, False: 18.1k]
  ------------------
  841|    466|                        src += 2; // CRLF
  842|    466|                     }
  843|   108k|                     else {
  844|   108k|                        ++src;
  845|   108k|                     }
  846|   109k|                     int blank_indent_count = 0;
  847|   109k|                     if (!yaml::skip_folded_line_indent(src, src_end, ctx, &blank_indent_count)) return;
  ------------------
  |  Branch (847:26): [True: 72, False: 109k]
  ------------------
  848|   109k|                     if (blank_indent_count == 0 && yaml::starts_with_document_marker(src, src_end)) {
  ------------------
  |  Branch (848:26): [True: 102k, False: 7.25k]
  |  Branch (848:53): [True: 68, False: 102k]
  ------------------
  849|     68|                        ctx.error = error_code::syntax_error;
  850|     68|                        return;
  851|     68|                     }
  852|   109k|                  }
  853|       |                  // Don't add space - we're now at content after blank line(s)
  854|  70.5k|               }
  855|  49.2k|               else {
  856|       |                  // Single newline - fold to space
  857|  49.2k|                  *dst++ = ' ';
  858|  49.2k|               }
  859|   119k|               continue;
  860|   119k|            }
  861|       |
  862|  7.33M|            if (*src == '\'') {
  ------------------
  |  Branch (862:17): [True: 13.5k, False: 7.32M]
  ------------------
  863|       |               // Must be '' (escaped quote) - we validated this in pass 1
  864|  13.5k|               *dst++ = '\'';
  865|  13.5k|               src += 2;
  866|  13.5k|            }
  867|  7.32M|            else {
  868|  7.32M|               *dst++ = *src++;
  869|  7.32M|            }
  870|  7.33M|         }
  871|       |
  872|  34.7k|         value.resize(static_cast<size_t>(dst - dst_start));
  873|  34.7k|         ++it; // skip closing quote
  874|  34.7k|      }
_ZN3glz4yaml18parse_block_scalarINS0_12yaml_contextEPKcS4_EEvRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEERT_RT0_T1_i:
 1372|  46.0k|      {
 1373|  46.0k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (1373:14): [True: 0, False: 46.0k]
  ------------------
 1374|      0|            ctx.error = error_code::unexpected_end;
 1375|      0|            return;
 1376|      0|         }
 1377|       |
 1378|  46.0k|         const char indicator = *it;
 1379|  46.0k|         ++it;
 1380|  46.0k|         const auto header_start = it;
 1381|       |
 1382|       |         // Chomping indicator: - (strip), + (keep), or none (clip)
 1383|  46.0k|         char chomping = ' '; // default: clip
 1384|  46.0k|         int explicit_indent = 0;
 1385|  46.0k|         bool seen_chomping = false;
 1386|  46.0k|         bool seen_indent = false;
 1387|       |
 1388|  79.5k|         while (it != end && *it != '\n' && *it != '\r') {
  ------------------
  |  Branch (1388:17): [True: 78.1k, False: 1.37k]
  |  Branch (1388:30): [True: 57.3k, False: 20.7k]
  |  Branch (1388:45): [True: 40.6k, False: 16.7k]
  ------------------
 1389|  40.6k|            if (*it == '-' || *it == '+') {
  ------------------
  |  Branch (1389:17): [True: 1.61k, False: 39.0k]
  |  Branch (1389:31): [True: 3.36k, False: 35.6k]
  ------------------
 1390|  4.98k|               if (seen_chomping) {
  ------------------
  |  Branch (1390:20): [True: 14, False: 4.97k]
  ------------------
 1391|     14|                  ctx.error = error_code::syntax_error;
 1392|     14|                  return;
 1393|     14|               }
 1394|  4.97k|               seen_chomping = true;
 1395|  4.97k|               chomping = *it;
 1396|  4.97k|            }
 1397|  35.6k|            else if (*it >= '1' && *it <= '9') {
  ------------------
  |  Branch (1397:22): [True: 1.81k, False: 33.8k]
  |  Branch (1397:36): [True: 1.73k, False: 82]
  ------------------
 1398|  1.73k|               if (seen_indent) {
  ------------------
  |  Branch (1398:20): [True: 10, False: 1.72k]
  ------------------
 1399|       |                  // YAML indentation indicator is a single digit [1-9].
 1400|     10|                  ctx.error = error_code::syntax_error;
 1401|     10|                  return;
 1402|     10|               }
 1403|  1.72k|               seen_indent = true;
 1404|  1.72k|               explicit_indent = *it - '0';
 1405|  1.72k|            }
 1406|  33.9k|            else if (*it == '0') {
  ------------------
  |  Branch (1406:22): [True: 12, False: 33.9k]
  ------------------
 1407|       |               // Indentation indicator 0 is invalid by spec.
 1408|     12|               ctx.error = error_code::syntax_error;
 1409|     12|               return;
 1410|     12|            }
 1411|  33.9k|            else if (*it == ' ' || *it == '\t') {
  ------------------
  |  Branch (1411:22): [True: 20.6k, False: 13.3k]
  |  Branch (1411:36): [True: 6.15k, False: 7.19k]
  ------------------
 1412|       |               // Skip whitespace
 1413|  26.7k|            }
 1414|  7.19k|            else if (*it == '#') {
  ------------------
  |  Branch (1414:22): [True: 6.79k, False: 392]
  ------------------
 1415|       |               // Block scalar comments require separation whitespace.
 1416|  6.79k|               if (it == header_start || (*(it - 1) != ' ' && *(it - 1) != '\t')) {
  ------------------
  |  Branch (1416:20): [True: 6, False: 6.79k]
  |  Branch (1416:43): [True: 3.16k, False: 3.63k]
  |  Branch (1416:63): [True: 6, False: 3.15k]
  ------------------
 1417|     12|                  ctx.error = error_code::syntax_error;
 1418|     12|                  return;
 1419|     12|               }
 1420|       |               // Skip comment
 1421|  78.3k|               while (it != end && *it != '\n' && *it != '\r') {
  ------------------
  |  Branch (1421:23): [True: 78.0k, False: 224]
  |  Branch (1421:36): [True: 73.6k, False: 4.41k]
  |  Branch (1421:51): [True: 71.5k, False: 2.14k]
  ------------------
 1422|  71.5k|                  ++it;
 1423|  71.5k|               }
 1424|  6.78k|               break;
 1425|  6.79k|            }
 1426|    392|            else {
 1427|    392|               ctx.error = error_code::syntax_error;
 1428|    392|               return;
 1429|    392|            }
 1430|  33.4k|            ++it;
 1431|  33.4k|         }
 1432|       |
 1433|       |         // Skip newline after indicator
 1434|  45.6k|         if (!skip_newline(it, end)) {
  ------------------
  |  Branch (1434:14): [True: 1.59k, False: 44.0k]
  ------------------
 1435|       |            // Empty block scalar
 1436|  1.59k|            value.clear();
 1437|  1.59k|            return;
 1438|  1.59k|         }
 1439|       |
 1440|  44.0k|         value.clear();
 1441|       |
 1442|       |         // Determine content indentation
 1443|  44.0k|         int32_t content_indent = -1;
 1444|  44.0k|         int32_t leading_blank_indent_max = -1;
 1445|  44.0k|         bool first_line = true;
 1446|  44.0k|         bool previous_line_starts_with_tab = false;
 1447|  44.0k|         bool previous_line_more_indented = false;
 1448|  44.0k|         std::string trailing_newlines;
 1449|       |
 1450|  8.39M|         while (it != end) {
  ------------------
  |  Branch (1450:17): [True: 8.37M, False: 21.2k]
  ------------------
 1451|  8.37M|            auto line_start = it;
 1452|  8.37M|            int32_t line_indent = measure_indent<false>(it, end, ctx);
 1453|  8.37M|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (1453:17): [True: 6, False: 8.37M]
  ------------------
 1454|      6|               return;
 1455|       |
 1456|       |            // Check for blank line
 1457|  8.37M|            if (it == end || *it == '\n' || *it == '\r') {
  ------------------
  |  Branch (1457:17): [True: 830, False: 8.37M]
  |  Branch (1457:30): [True: 30.0k, False: 8.34M]
  |  Branch (1457:45): [True: 8.24M, False: 98.4k]
  ------------------
 1458|       |               // In literal mode, a line with more spaces than content_indent
 1459|       |               // has whitespace content that must be preserved.
 1460|  8.27M|               if (content_indent >= 0 && line_indent > content_indent && indicator == '|') {
  ------------------
  |  Branch (1460:20): [True: 8.22M, False: 48.6k]
  |  Branch (1460:43): [True: 1.59k, False: 8.22M]
  |  Branch (1460:75): [True: 772, False: 826]
  ------------------
 1461|    772|                  it = line_start;
 1462|  1.59k|                  for (int32_t i = 0; i < content_indent && it != end && *it == ' '; ++i) {
  ------------------
  |  Branch (1462:39): [True: 822, False: 772]
  |  Branch (1462:61): [True: 822, False: 0]
  |  Branch (1462:74): [True: 822, False: 0]
  ------------------
 1463|    822|                     ++it;
 1464|    822|                  }
 1465|       |                  // Fall through to content processing below
 1466|    772|               }
 1467|  8.27M|               else {
 1468|  8.27M|                  if (content_indent < 0) {
  ------------------
  |  Branch (1468:23): [True: 48.6k, False: 8.22M]
  ------------------
 1469|  48.6k|                     leading_blank_indent_max = (std::max)(leading_blank_indent_max, line_indent);
 1470|  48.6k|                  }
 1471|  8.27M|                  trailing_newlines.push_back('\n');
 1472|  8.27M|                  skip_newline(it, end);
 1473|  8.27M|                  continue;
 1474|  8.27M|               }
 1475|  8.27M|            }
 1476|       |
 1477|       |            // Top-level zero-indented block scalars must stop at document boundary markers.
 1478|  99.2k|            if (base_indent < 0 && line_indent == 0 && (at_document_start(it, end) || at_document_end(it, end))) {
  ------------------
  |  Branch (1478:17): [True: 81.4k, False: 17.7k]
  |  Branch (1478:36): [True: 73.2k, False: 8.22k]
  |  Branch (1478:57): [True: 1.08k, False: 72.1k]
  |  Branch (1478:87): [True: 1.17k, False: 70.9k]
  ------------------
 1479|  2.25k|               it = line_start;
 1480|  2.25k|               break;
 1481|  2.25k|            }
 1482|       |
 1483|       |            // First content line determines indentation
 1484|  96.9k|            if (content_indent < 0) {
  ------------------
  |  Branch (1484:17): [True: 35.9k, False: 61.0k]
  ------------------
 1485|  35.9k|               if (explicit_indent > 0) {
  ------------------
  |  Branch (1485:20): [True: 1.00k, False: 34.9k]
  ------------------
 1486|  1.00k|                  content_indent = base_indent + explicit_indent;
 1487|  1.00k|               }
 1488|  34.9k|               else {
 1489|  34.9k|                  content_indent = line_indent;
 1490|  34.9k|               }
 1491|       |
 1492|  35.9k|               if (content_indent <= base_indent) {
  ------------------
  |  Branch (1492:20): [True: 14.0k, False: 21.8k]
  ------------------
 1493|  14.0k|                  it = line_start;
 1494|  14.0k|                  break;
 1495|  14.0k|               }
 1496|  21.8k|               if (leading_blank_indent_max > content_indent) {
  ------------------
  |  Branch (1496:20): [True: 52, False: 21.8k]
  ------------------
 1497|     52|                  ctx.error = error_code::syntax_error;
 1498|     52|                  return;
 1499|     52|               }
 1500|  21.8k|            }
 1501|       |
 1502|       |            // Check if we've dedented
 1503|  82.8k|            if (line_indent < content_indent) {
  ------------------
  |  Branch (1503:17): [True: 5.88k, False: 76.9k]
  ------------------
 1504|  5.88k|               it = line_start;
 1505|  5.88k|               break;
 1506|  5.88k|            }
 1507|       |
 1508|       |            // Skip to content_indent level
 1509|  76.9k|            it = line_start;
 1510|  1.63M|            for (int32_t i = 0; i < content_indent && it != end && *it == ' '; ++i) {
  ------------------
  |  Branch (1510:33): [True: 1.55M, False: 76.9k]
  |  Branch (1510:55): [True: 1.55M, False: 0]
  |  Branch (1510:68): [True: 1.55M, False: 0]
  ------------------
 1511|  1.55M|               ++it;
 1512|  1.55M|            }
 1513|       |
 1514|  76.9k|            const bool current_line_starts_with_tab = (it != end && *it == '\t');
  ------------------
  |  Branch (1514:56): [True: 76.9k, False: 0]
  |  Branch (1514:69): [True: 890, False: 76.0k]
  ------------------
 1515|  76.9k|            const bool current_line_more_indented = (line_indent > content_indent);
 1516|       |
 1517|       |            // Add previous newlines
 1518|  76.9k|            if (first_line) {
  ------------------
  |  Branch (1518:17): [True: 21.0k, False: 55.8k]
  ------------------
 1519|       |               // Leading blank lines are part of block scalar content
 1520|  21.0k|               value += trailing_newlines;
 1521|  21.0k|            }
 1522|  55.8k|            else {
 1523|  55.8k|               if (indicator == '|') {
  ------------------
  |  Branch (1523:20): [True: 23.6k, False: 32.2k]
  ------------------
 1524|       |                  // Literal: preserve newlines
 1525|  23.6k|                  value += trailing_newlines;
 1526|  23.6k|               }
 1527|  32.2k|               else {
 1528|       |                  // Folded: single newline becomes space, paragraph breaks keep one newline.
 1529|       |                  // Folding does not apply adjacent to "more indented" or tab-leading lines.
 1530|  32.2k|                  const size_t break_count = trailing_newlines.size();
 1531|  32.2k|                  const bool adjacent_special = previous_line_starts_with_tab || current_line_starts_with_tab ||
  ------------------
  |  Branch (1531:49): [True: 330, False: 31.9k]
  |  Branch (1531:82): [True: 566, False: 31.3k]
  ------------------
 1532|  31.3k|                                                previous_line_more_indented || current_line_more_indented;
  ------------------
  |  Branch (1532:49): [True: 662, False: 30.7k]
  |  Branch (1532:80): [True: 1.41k, False: 29.2k]
  ------------------
 1533|  32.2k|                  if (break_count == 1) {
  ------------------
  |  Branch (1533:23): [True: 27.4k, False: 4.82k]
  ------------------
 1534|  27.4k|                     if (adjacent_special) {
  ------------------
  |  Branch (1534:26): [True: 2.00k, False: 25.4k]
  ------------------
 1535|  2.00k|                        value.push_back('\n');
 1536|  2.00k|                     }
 1537|  25.4k|                     else {
 1538|  25.4k|                        value.push_back(' ');
 1539|  25.4k|                     }
 1540|  27.4k|                  }
 1541|  4.82k|                  else if (break_count > 1) {
  ------------------
  |  Branch (1541:28): [True: 4.82k, False: 0]
  ------------------
 1542|  4.82k|                     const size_t preserve_count = adjacent_special ? break_count : (break_count - 1);
  ------------------
  |  Branch (1542:52): [True: 966, False: 3.86k]
  ------------------
 1543|  4.82k|                     value.append(preserve_count, '\n');
 1544|  4.82k|                  }
 1545|  32.2k|               }
 1546|  55.8k|            }
 1547|  76.9k|            trailing_newlines.clear();
 1548|  76.9k|            first_line = false;
 1549|  76.9k|            previous_line_starts_with_tab = current_line_starts_with_tab;
 1550|  76.9k|            previous_line_more_indented = current_line_more_indented;
 1551|       |
 1552|       |            // Read line content
 1553|  5.12M|            while (it != end && *it != '\n' && *it != '\r') {
  ------------------
  |  Branch (1553:20): [True: 5.11M, False: 9.18k]
  |  Branch (1553:33): [True: 5.08M, False: 30.3k]
  |  Branch (1553:48): [True: 5.04M, False: 36.9k]
  ------------------
 1554|  5.04M|               if (forbidden_control_table[uint8_t(*it)]) [[unlikely]] {
  ------------------
  |  Branch (1554:20): [True: 488, False: 5.04M]
  ------------------
 1555|       |                  // Block scalars have no escape mechanism, so the byte cannot be valid here.
 1556|    488|                  ctx.error = error_code::invalid_control_character;
 1557|    488|                  return;
 1558|    488|               }
 1559|  5.04M|               value.push_back(*it);
 1560|  5.04M|               ++it;
 1561|  5.04M|            }
 1562|       |
 1563|  76.4k|            trailing_newlines.push_back('\n');
 1564|  76.4k|            skip_newline(it, end);
 1565|  76.4k|         }
 1566|       |
 1567|       |         // Apply chomping
 1568|  43.4k|         if (chomping == '-') {
  ------------------
  |  Branch (1568:14): [True: 1.31k, False: 42.1k]
  ------------------
 1569|       |            // Strip: remove all trailing newlines
 1570|  1.31k|         }
 1571|  42.1k|         else if (chomping == '+') {
  ------------------
  |  Branch (1571:19): [True: 3.32k, False: 38.8k]
  ------------------
 1572|       |            // Keep: preserve all trailing newlines
 1573|  3.32k|            value += trailing_newlines;
 1574|  3.32k|         }
 1575|  38.8k|         else {
 1576|       |            // Clip: single trailing newline
 1577|  38.8k|            if (!value.empty()) {
  ------------------
  |  Branch (1577:17): [True: 17.4k, False: 21.4k]
  ------------------
 1578|  17.4k|               value.push_back('\n');
 1579|  17.4k|            }
 1580|  38.8k|         }
 1581|  43.4k|      }
_ZN3glz4yaml30plain_scalar_starts_collectionIPKcS3_EEbT_T0_:
 1967|  3.42M|      {
 1968|  3.42M|         if (it == end) return false;
  ------------------
  |  Branch (1968:14): [True: 0, False: 3.42M]
  ------------------
 1969|  3.42M|         const char c = *it;
 1970|  3.42M|         if (c == '[' || c == '{') return true;
  ------------------
  |  Branch (1970:14): [True: 124, False: 3.42M]
  |  Branch (1970:26): [True: 120, False: 3.42M]
  ------------------
 1971|  3.42M|         if (c == '-' || c == '?') {
  ------------------
  |  Branch (1971:14): [True: 129k, False: 3.29M]
  |  Branch (1971:26): [True: 98.8k, False: 3.19M]
  ------------------
 1972|   228k|            ++it;
 1973|   228k|            return it == end || whitespace_or_line_end_table[static_cast<uint8_t>(*it)];
  ------------------
  |  Branch (1973:20): [True: 166, False: 228k]
  |  Branch (1973:33): [True: 164, False: 228k]
  ------------------
 1974|   228k|         }
 1975|  3.19M|         return false;
 1976|  3.42M|      }
_ZN3glz4yaml18parse_plain_scalarINS0_12yaml_contextEPKcS4_EEvRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEERT_RT0_T1_b:
 1028|  2.92M|      {
 1029|  2.92M|         value.clear();
 1030|       |
 1031|  28.9M|         while (it != end) {
  ------------------
  |  Branch (1031:17): [True: 28.7M, False: 180k]
  ------------------
 1032|       |            // Copy the run of ordinary content in bulk. Only a byte the table marks
 1033|       |            // needs the dispatch below, so the control-character rejection rides on a
 1034|       |            // lookup the scan already performs rather than costing a test per byte.
 1035|  28.7M|            {
 1036|  28.7M|               const auto run_start = it;
 1037|   289M|               while (it != end && !plain_scalar_dispatch_table[uint8_t(*it)]) {
  ------------------
  |  Branch (1037:23): [True: 289M, False: 234k]
  |  Branch (1037:36): [True: 261M, False: 28.5M]
  ------------------
 1038|   261M|                  ++it;
 1039|   261M|               }
 1040|  28.7M|               if (it != run_start) {
  ------------------
  |  Branch (1040:20): [True: 27.1M, False: 1.57M]
  ------------------
 1041|  27.1M|                  value.append(run_start, it);
 1042|  27.1M|               }
 1043|  28.7M|               if (it == end) break;
  ------------------
  |  Branch (1043:20): [True: 234k, False: 28.5M]
  ------------------
 1044|  28.7M|            }
 1045|       |
 1046|  28.5M|            const char c = *it;
 1047|       |
 1048|       |            // YAML's character stream excludes these outright, so reject rather than
 1049|       |            // carry the byte into the value.
 1050|  28.5M|            if (forbidden_control_table[uint8_t(c)]) [[unlikely]] {
  ------------------
  |  Branch (1050:17): [True: 10.1k, False: 28.5M]
  ------------------
 1051|  10.1k|               ctx.error = error_code::invalid_control_character;
 1052|  10.1k|               return;
 1053|  10.1k|            }
 1054|       |
 1055|       |            // End conditions
 1056|  28.5M|            if (c == '\n' || c == '\r') {
  ------------------
  |  Branch (1056:17): [True: 663k, False: 27.8M]
  |  Branch (1056:30): [True: 2.17M, False: 25.6M]
  ------------------
 1057|  2.83M|               if (in_flow) {
  ------------------
  |  Branch (1057:20): [True: 2.77M, False: 63.2k]
  ------------------
 1058|  2.77M|                  auto continuation = it;
 1059|  2.77M|                  skip_newline(continuation, end);
 1060|  2.77M|                  bool continuation_is_comment = false;
 1061|       |
 1062|  2.77M|                  while (continuation != end) {
  ------------------
  |  Branch (1062:26): [True: 2.66M, False: 109k]
  ------------------
 1063|  4.46M|                     while (continuation != end && (*continuation == ' ' || *continuation == '\t')) {
  ------------------
  |  Branch (1063:29): [True: 4.45M, False: 6.14k]
  |  Branch (1063:53): [True: 1.75M, False: 2.69M]
  |  Branch (1063:77): [True: 40.0k, False: 2.65M]
  ------------------
 1064|  1.79M|                        ++continuation;
 1065|  1.79M|                     }
 1066|  2.66M|                     if (continuation != end && *continuation == '#') {
  ------------------
  |  Branch (1066:26): [True: 2.65M, False: 6.14k]
  |  Branch (1066:49): [True: 90.7k, False: 2.56M]
  ------------------
 1067|       |                        // Comment lines terminate plain flow scalars; the caller
 1068|       |                        // will consume comments/separators outside this scalar.
 1069|  90.7k|                        continuation_is_comment = true;
 1070|  90.7k|                        break;
 1071|  90.7k|                     }
 1072|  2.57M|                     break;
 1073|  2.66M|                  }
 1074|       |
 1075|  2.77M|                  if (continuation_is_comment || continuation == end || *continuation == ',' || *continuation == ']' ||
  ------------------
  |  Branch (1075:23): [True: 90.7k, False: 2.68M]
  |  Branch (1075:50): [True: 115k, False: 2.56M]
  |  Branch (1075:73): [True: 217k, False: 2.34M]
  |  Branch (1075:97): [True: 5.23k, False: 2.34M]
  ------------------
 1076|  2.34M|                      *continuation == '}' || *continuation == ':') {
  ------------------
  |  Branch (1076:23): [True: 15.4k, False: 2.32M]
  |  Branch (1076:47): [True: 57.2k, False: 2.27M]
  ------------------
 1077|   502k|                     break;
 1078|   502k|                  }
 1079|       |
 1080|  2.53M|                  while (!value.empty() && (value.back() == ' ' || value.back() == '\t')) {
  ------------------
  |  Branch (1080:26): [True: 2.43M, False: 92.2k]
  |  Branch (1080:45): [True: 232k, False: 2.20M]
  |  Branch (1080:68): [True: 27.2k, False: 2.17M]
  ------------------
 1081|   259k|                     value.pop_back();
 1082|   259k|                  }
 1083|  2.27M|                  if (!value.empty()) {
  ------------------
  |  Branch (1083:23): [True: 2.17M, False: 92.2k]
  ------------------
 1084|  2.17M|                     value.push_back(' ');
 1085|  2.17M|                  }
 1086|  2.27M|                  it = continuation;
 1087|  2.27M|                  continue;
 1088|  2.77M|               }
 1089|  63.2k|               break;
 1090|  2.83M|            }
 1091|       |
 1092|       |            // Per YAML spec: # only starts a comment when preceded by whitespace
 1093|       |            // "foo#bar" is a valid plain scalar, but "foo #bar" has a comment
 1094|  25.6M|            if (c == '#') {
  ------------------
  |  Branch (1094:17): [True: 999k, False: 24.6M]
  ------------------
 1095|       |               // Check if preceded by whitespace (comment indicator)
 1096|   999k|               if (value.empty() || value.back() == ' ' || value.back() == '\t') {
  ------------------
  |  Branch (1096:20): [True: 83.4k, False: 916k]
  |  Branch (1096:37): [True: 77.6k, False: 838k]
  |  Branch (1096:60): [True: 2.54k, False: 835k]
  ------------------
 1097|   163k|                  break; // This is a comment
 1098|   163k|               }
 1099|       |               // Otherwise # is part of the scalar value
 1100|   999k|            }
 1101|       |
 1102|       |            // Flow indicators end plain scalars in flow context
 1103|  25.5M|            if (in_flow && (c == ',' || c == ']' || c == '}')) break;
  ------------------
  |  Branch (1103:17): [True: 25.4M, False: 63.4k]
  |  Branch (1103:29): [True: 1.17M, False: 24.2M]
  |  Branch (1103:41): [True: 130k, False: 24.1M]
  |  Branch (1103:53): [True: 240k, False: 23.9M]
  ------------------
 1104|       |
 1105|       |            // Colon followed by space/newline ends plain scalar
 1106|  23.9M|            if (c == ':') {
  ------------------
  |  Branch (1106:17): [True: 23.1M, False: 846k]
  ------------------
 1107|  23.1M|               if ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\t' || *(it + 1) == '\n' || *(it + 1) == '\r') {
  ------------------
  |  Branch (1107:20): [True: 20.3k, False: 23.0M]
  |  Branch (1107:39): [True: 109k, False: 22.9M]
  |  Branch (1107:59): [True: 8.04k, False: 22.9M]
  |  Branch (1107:80): [True: 27.5k, False: 22.9M]
  |  Branch (1107:101): [True: 21.6k, False: 22.9M]
  ------------------
 1108|   187k|                  break;
 1109|   187k|               }
 1110|  22.9M|               if (in_flow && (*(it + 1) == ',' || *(it + 1) == ']' || *(it + 1) == '}')) {
  ------------------
  |  Branch (1110:20): [True: 22.9M, False: 9.61k]
  |  Branch (1110:32): [True: 32.2k, False: 22.8M]
  |  Branch (1110:52): [True: 3.24k, False: 22.8M]
  |  Branch (1110:72): [True: 1.90k, False: 22.8M]
  ------------------
 1111|  37.3k|                  break;
 1112|  37.3k|               }
 1113|  22.9M|            }
 1114|       |
 1115|  23.7M|            value.push_back(c);
 1116|  23.7M|            ++it;
 1117|  23.7M|         }
 1118|       |
 1119|       |         // Trim trailing whitespace
 1120|  4.13M|         while (!value.empty() && (value.back() == ' ' || value.back() == '\t')) {
  ------------------
  |  Branch (1120:17): [True: 3.46M, False: 670k]
  |  Branch (1120:36): [True: 1.06M, False: 2.39M]
  |  Branch (1120:59): [True: 155k, False: 2.24M]
  ------------------
 1121|  1.22M|            value.pop_back();
 1122|  1.22M|         }
 1123|       |
 1124|  2.91M|         if (in_flow && (value == "---" || value == "..." || value == "-")) {
  ------------------
  |  Branch (1124:14): [True: 2.74M, False: 164k]
  |  Branch (1124:26): [True: 8, False: 2.74M]
  |  Branch (1124:44): [True: 10, False: 2.74M]
  |  Branch (1124:62): [True: 64, False: 2.74M]
  ------------------
 1125|     82|            ctx.error = error_code::syntax_error;
 1126|     82|         }
 1127|  2.91M|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_19is_yaml_variant_numEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   572k|      {
 5356|   572k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   572k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   572k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   572k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   572k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 572k, False: 0]
  ------------------
 5366|   572k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   572k|      }
_ZN3glz4fromILj450EdE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRdTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_:
 2149|   575k|      {
 2150|   575k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2150:14): [True: 0, False: 575k]
  ------------------
 2151|      0|            return;
 2152|       |
 2153|   575k|         yaml::node_preamble_state preamble{};
 2154|   575k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble, [](yaml::yaml_tag tag) {
  ------------------
  |  Branch (2154:14): [True: 7.14k, False: 568k]
  ------------------
 2155|   575k|                if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2156|   575k|                   return yaml::tag_valid_for_float(tag);
 2157|   575k|                }
 2158|   575k|                else {
 2159|   575k|                   return yaml::tag_valid_for_int(tag);
 2160|   575k|                }
 2161|   575k|             }))
 2162|  7.14k|            return;
 2163|       |
 2164|   568k|         auto finalize = [&] { yaml::finalize_node_anchor(preamble.node_props, ctx, it); };
 2165|       |
 2166|       |         // Check for special float values
 2167|   568k|         if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2168|   568k|            auto start = it;
 2169|       |
 2170|       |            // Check for .inf, .nan, -.inf, etc.
 2171|   568k|            if (*it == '.') {
  ------------------
  |  Branch (2171:17): [True: 17.2k, False: 551k]
  ------------------
 2172|  17.2k|               ++it;
 2173|  17.2k|               if (it + 3 <= end && (std::string_view(it, 3) == "inf" || std::string_view(it, 3) == "Inf" ||
  ------------------
  |  Branch (2173:20): [True: 16.1k, False: 1.11k]
  |  Branch (2173:38): [True: 596, False: 15.5k]
  |  Branch (2173:74): [True: 416, False: 15.1k]
  ------------------
 2174|  15.1k|                                     std::string_view(it, 3) == "INF")) {
  ------------------
  |  Branch (2174:38): [True: 410, False: 14.7k]
  ------------------
 2175|  1.42k|                  value = std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2176|  1.42k|                  it += 3;
 2177|  1.42k|                  finalize();
 2178|  1.42k|                  return;
 2179|  1.42k|               }
 2180|  15.8k|               if (it + 3 <= end && (std::string_view(it, 3) == "nan" || std::string_view(it, 3) == "NaN" ||
  ------------------
  |  Branch (2180:20): [True: 14.7k, False: 1.11k]
  |  Branch (2180:38): [True: 279, False: 14.4k]
  |  Branch (2180:74): [True: 258, False: 14.1k]
  ------------------
 2181|  14.1k|                                     std::string_view(it, 3) == "NAN")) {
  ------------------
  |  Branch (2181:38): [True: 1.02k, False: 13.1k]
  ------------------
 2182|  1.56k|                  value = std::numeric_limits<std::remove_cvref_t<T>>::quiet_NaN();
 2183|  1.56k|                  it += 3;
 2184|  1.56k|                  finalize();
 2185|  1.56k|                  return;
 2186|  1.56k|               }
 2187|  14.2k|               it = start;
 2188|  14.2k|            }
 2189|       |
 2190|   565k|            if (*it == '-' || *it == '+') {
  ------------------
  |  Branch (2190:17): [True: 3.29k, False: 562k]
  |  Branch (2190:31): [True: 7.10k, False: 554k]
  ------------------
 2191|  10.3k|               const char sign = *it;
 2192|  10.3k|               ++it;
 2193|  10.3k|               if (it != end && *it == '.') {
  ------------------
  |  Branch (2193:20): [True: 10.0k, False: 341]
  |  Branch (2193:33): [True: 2.61k, False: 7.44k]
  ------------------
 2194|  2.61k|                  ++it;
 2195|  2.61k|                  if (it + 3 <= end && (std::string_view(it, 3) == "inf" || std::string_view(it, 3) == "Inf" ||
  ------------------
  |  Branch (2195:23): [True: 2.30k, False: 314]
  |  Branch (2195:41): [True: 746, False: 1.55k]
  |  Branch (2195:77): [True: 596, False: 958]
  ------------------
 2196|  1.67k|                                        std::string_view(it, 3) == "INF")) {
  ------------------
  |  Branch (2196:41): [True: 335, False: 623]
  ------------------
 2197|  1.67k|                     if (sign == '-') {
  ------------------
  |  Branch (2197:26): [True: 1.19k, False: 481]
  ------------------
 2198|  1.19k|                        value = -std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2199|  1.19k|                     }
 2200|    481|                     else {
 2201|    481|                        value = std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2202|    481|                     }
 2203|  1.67k|                     it += 3;
 2204|  1.67k|                     finalize();
 2205|  1.67k|                     return;
 2206|  1.67k|                  }
 2207|  2.61k|               }
 2208|  8.71k|               it = start;
 2209|  8.71k|            }
 2210|   565k|         }
 2211|       |
 2212|       |         // Parse as plain scalar and convert
 2213|   563k|         auto start = it;
 2214|       |
 2215|       |         // Find end of number - use same rules as plain scalar for colons
 2216|  40.9M|         while (it != end) {
  ------------------
  |  Branch (2216:17): [True: 40.8M, False: 8.15k]
  ------------------
 2217|  40.8M|            const char c = *it;
 2218|  40.8M|            if (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == ',' || c == ']' || c == '}' || c == '#') {
  ------------------
  |  Branch (2218:17): [True: 16.1k, False: 40.8M]
  |  Branch (2218:29): [True: 5.59k, False: 40.8M]
  |  Branch (2218:42): [True: 5.49k, False: 40.8M]
  |  Branch (2218:55): [True: 2.49k, False: 40.8M]
  |  Branch (2218:68): [True: 513k, False: 40.3M]
  |  Branch (2218:80): [True: 2.63k, False: 40.3M]
  |  Branch (2218:92): [True: 1.49k, False: 40.3M]
  |  Branch (2218:104): [True: 8.64k, False: 40.3M]
  ------------------
 2219|   555k|               break;
 2220|   555k|            }
 2221|       |            // Colon only ends number if followed by space/tab/newline/end (YAML mapping indicator)
 2222|  40.3M|            if (c == ':') {
  ------------------
  |  Branch (2222:17): [True: 157k, False: 40.1M]
  ------------------
 2223|   157k|               if ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\t' || *(it + 1) == '\n' || *(it + 1) == '\r') {
  ------------------
  |  Branch (2223:20): [True: 387, False: 157k]
  |  Branch (2223:39): [True: 1.59k, False: 155k]
  |  Branch (2223:59): [True: 553, False: 155k]
  |  Branch (2223:80): [True: 593, False: 154k]
  |  Branch (2223:101): [True: 1.53k, False: 153k]
  ------------------
 2224|  4.66k|                  break;
 2225|  4.66k|               }
 2226|   157k|            }
 2227|  40.3M|            ++it;
 2228|  40.3M|         }
 2229|       |
 2230|   568k|         const std::string_view num_str(&*start, static_cast<size_t>(it - start));
 2231|       |
 2232|   568k|         if (num_str.empty()) {
  ------------------
  |  Branch (2232:14): [True: 1.14k, False: 567k]
  ------------------
 2233|  1.14k|            ctx.error = error_code::parse_number_failure;
 2234|  1.14k|            return;
 2235|  1.14k|         }
 2236|       |
 2237|       |         // Handle hex, octal, binary
 2238|       |         if constexpr (std::integral<std::remove_cvref_t<T>>) {
 2239|       |            if (num_str.size() > 2 && num_str[0] == '0') {
 2240|       |               int base = 10;
 2241|       |               size_t offset = 0;
 2242|       |
 2243|       |               if (num_str[1] == 'x' || num_str[1] == 'X') {
 2244|       |                  base = 16;
 2245|       |                  offset = 2;
 2246|       |               }
 2247|       |               else if (num_str[1] == 'o' || num_str[1] == 'O') {
 2248|       |                  base = 8;
 2249|       |                  offset = 2;
 2250|       |               }
 2251|       |               else if (num_str[1] == 'b' || num_str[1] == 'B') {
 2252|       |                  base = 2;
 2253|       |                  offset = 2;
 2254|       |               }
 2255|       |
 2256|       |               if (base != 10) {
 2257|       |                  const auto digits = num_str.substr(offset);
 2258|       |                  const bool has_underscores = (digits.find('_') != std::string_view::npos);
 2259|       |
 2260|       |                  std::string clean_storage;
 2261|       |                  std::string_view clean_view;
 2262|       |
 2263|       |                  if (has_underscores) {
 2264|       |                     clean_storage.reserve(digits.size());
 2265|       |                     for (char c : digits) {
 2266|       |                        if (c != '_') {
 2267|       |                           clean_storage.push_back(c);
 2268|       |                        }
 2269|       |                     }
 2270|       |                     clean_view = clean_storage;
 2271|       |                  }
 2272|       |                  else {
 2273|       |                     clean_view = digits;
 2274|       |                  }
 2275|       |
 2276|       |                  auto [ptr, ec] =
 2277|       |                     std::from_chars(clean_view.data(), clean_view.data() + clean_view.size(), value, base);
 2278|       |                  if (ec != std::errc{}) {
 2279|       |                     ctx.error = error_code::parse_number_failure;
 2280|       |                  }
 2281|       |                  finalize();
 2282|       |                  return;
 2283|       |               }
 2284|       |            }
 2285|       |         }
 2286|   567k|         else if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2287|   567k|            bool negative = false;
 2288|   567k|            std::string_view digits = num_str;
 2289|       |
 2290|   567k|            if (!digits.empty() && (digits.front() == '+' || digits.front() == '-')) {
  ------------------
  |  Branch (2290:17): [True: 562k, False: 4.66k]
  |  Branch (2290:37): [True: 6.62k, False: 555k]
  |  Branch (2290:62): [True: 2.09k, False: 553k]
  ------------------
 2291|  8.71k|               negative = (digits.front() == '-');
 2292|  8.71k|               digits.remove_prefix(1);
 2293|  8.71k|            }
 2294|       |
 2295|   567k|            if (digits.size() > 2 && digits[0] == '0') {
  ------------------
  |  Branch (2295:17): [True: 75.1k, False: 492k]
  |  Branch (2295:38): [True: 14.5k, False: 60.5k]
  ------------------
 2296|  14.5k|               int base = 10;
 2297|  14.5k|               size_t offset = 0;
 2298|       |
 2299|  14.5k|               if (digits[1] == 'x' || digits[1] == 'X') {
  ------------------
  |  Branch (2299:20): [True: 2.01k, False: 12.5k]
  |  Branch (2299:40): [True: 794, False: 11.7k]
  ------------------
 2300|  2.80k|                  base = 16;
 2301|  2.80k|                  offset = 2;
 2302|  2.80k|               }
 2303|  11.7k|               else if (digits[1] == 'o' || digits[1] == 'O') {
  ------------------
  |  Branch (2303:25): [True: 297, False: 11.4k]
  |  Branch (2303:45): [True: 365, False: 11.1k]
  ------------------
 2304|    662|                  base = 8;
 2305|    662|                  offset = 2;
 2306|    662|               }
 2307|  11.1k|               else if (digits[1] == 'b' || digits[1] == 'B') {
  ------------------
  |  Branch (2307:25): [True: 2.54k, False: 8.59k]
  |  Branch (2307:45): [True: 332, False: 8.25k]
  ------------------
 2308|  2.87k|                  base = 2;
 2309|  2.87k|                  offset = 2;
 2310|  2.87k|               }
 2311|       |
 2312|  14.5k|               if (base != 10) {
  ------------------
  |  Branch (2312:20): [True: 6.34k, False: 8.25k]
  ------------------
 2313|  6.34k|                  auto raw_digits = digits.substr(offset);
 2314|  6.34k|                  const bool has_underscores = (raw_digits.find('_') != std::string_view::npos);
 2315|       |
 2316|  6.34k|                  std::string clean_storage;
 2317|  6.34k|                  std::string_view clean_view;
 2318|  6.34k|                  if (has_underscores) {
  ------------------
  |  Branch (2318:23): [True: 3.07k, False: 3.26k]
  ------------------
 2319|  3.07k|                     clean_storage.reserve(raw_digits.size());
 2320|  5.03M|                     for (char c : raw_digits) {
  ------------------
  |  Branch (2320:34): [True: 5.03M, False: 3.07k]
  ------------------
 2321|  5.03M|                        if (c != '_') {
  ------------------
  |  Branch (2321:29): [True: 5.02M, False: 8.51k]
  ------------------
 2322|  5.02M|                           clean_storage.push_back(c);
 2323|  5.02M|                        }
 2324|  5.03M|                     }
 2325|  3.07k|                     clean_view = clean_storage;
 2326|  3.07k|                  }
 2327|  3.26k|                  else {
 2328|  3.26k|                     clean_view = raw_digits;
 2329|  3.26k|                  }
 2330|       |
 2331|  6.34k|                  uint64_t parsed_int{};
 2332|  6.34k|                  auto [ptr, ec] =
 2333|  6.34k|                     std::from_chars(clean_view.data(), clean_view.data() + clean_view.size(), parsed_int, base);
 2334|  6.34k|                  if (ec != std::errc{} || ptr != (clean_view.data() + clean_view.size())) {
  ------------------
  |  Branch (2334:23): [True: 3.93k, False: 2.40k]
  |  Branch (2334:44): [True: 928, False: 1.47k]
  ------------------
 2335|  4.86k|                     ctx.error = error_code::parse_number_failure;
 2336|  4.86k|                     finalize();
 2337|  4.86k|                     return;
 2338|  4.86k|                  }
 2339|       |
 2340|  1.47k|                  const auto as_float = static_cast<std::remove_cvref_t<T>>(parsed_int);
 2341|  1.47k|                  value = negative ? -as_float : as_float;
  ------------------
  |  Branch (2341:27): [True: 568, False: 906]
  ------------------
 2342|  1.47k|                  finalize();
 2343|  1.47k|                  return;
 2344|  6.34k|               }
 2345|  14.5k|            }
 2346|   567k|         }
 2347|       |
 2348|       |         // Standard number parsing - only allocate if underscores present
 2349|   560k|         const bool has_underscores = (num_str.find('_') != std::string_view::npos);
 2350|       |
 2351|   567k|         std::string clean_storage;
 2352|   567k|         std::string_view clean_view;
 2353|       |
 2354|   567k|         if (has_underscores) {
  ------------------
  |  Branch (2354:14): [True: 2.84k, False: 564k]
  ------------------
 2355|  2.84k|            clean_storage.reserve(num_str.size());
 2356|  23.4M|            for (char c : num_str) {
  ------------------
  |  Branch (2356:25): [True: 23.4M, False: 2.84k]
  ------------------
 2357|  23.4M|               if (c != '_') {
  ------------------
  |  Branch (2357:20): [True: 23.4M, False: 4.71k]
  ------------------
 2358|  23.4M|                  clean_storage.push_back(c);
 2359|  23.4M|               }
 2360|  23.4M|            }
 2361|  2.84k|            clean_view = clean_storage;
 2362|  2.84k|         }
 2363|   564k|         else {
 2364|   564k|            clean_view = num_str;
 2365|   564k|         }
 2366|       |
 2367|       |         // YAML allows leading '+' for positive numbers, but C++ from_chars doesn't
 2368|       |         // Strip leading '+' if present
 2369|   567k|         auto parse_view = clean_view;
 2370|   567k|         if (!parse_view.empty() && parse_view.front() == '+') {
  ------------------
  |  Branch (2370:14): [True: 556k, False: 11.1k]
  |  Branch (2370:37): [True: 6.62k, False: 549k]
  ------------------
 2371|  6.62k|            parse_view.remove_prefix(1);
 2372|  6.62k|            if (parse_view.empty()) {
  ------------------
  |  Branch (2372:17): [True: 2.79k, False: 3.82k]
  ------------------
 2373|  2.79k|               ctx.error = error_code::parse_number_failure;
 2374|  2.79k|               return;
 2375|  2.79k|            }
 2376|  6.62k|         }
 2377|       |
 2378|   564k|         if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2379|   564k|            auto result = glz::fast_float::from_chars(parse_view.data(), parse_view.data() + parse_view.size(), value);
 2380|       |            // Check both for errors and that all input was consumed (e.g., "12:30" is not a valid number)
 2381|   564k|            if (result.ec != std::errc{} || result.ptr != parse_view.data() + parse_view.size()) {
  ------------------
  |  Branch (2381:17): [True: 29.1k, False: 535k]
  |  Branch (2381:45): [True: 21.8k, False: 513k]
  ------------------
 2382|  40.0k|               ctx.error = error_code::parse_number_failure;
 2383|  40.0k|            }
 2384|       |         }
 2385|       |         else {
 2386|       |            auto [ptr, ec] = std::from_chars(parse_view.data(), parse_view.data() + parse_view.size(), value);
 2387|       |            // Check both for errors and that all input was consumed
 2388|       |            if (ec != std::errc{} || ptr != parse_view.data() + parse_view.size()) {
 2389|       |               ctx.error = error_code::parse_number_failure;
 2390|       |            }
 2391|       |         }
 2392|       |
 2393|   564k|         finalize();
 2394|   564k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEELb0ERdNS0_12yaml_contextEPKcS7_ZNS_4fromILj450EdE2opITnDaXtlS2_Lj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERS7_S4_TkNS_10is_contextERS5_S7_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSG_RSJ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   575k|      {
  475|   575k|         skip_inline_ws(it, end);
  476|       |
  477|   575k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 346, False: 575k]
  ------------------
  478|    346|            if constexpr (!AllowEmptyInput) {
  479|    346|               ctx.error = error_code::unexpected_end;
  480|    346|            }
  481|    346|            return true;
  482|    346|         }
  483|       |
  484|   575k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   575k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 146, False: 575k]
  ------------------
  486|    146|            ctx.error = error_code::syntax_error;
  487|    146|            return true;
  488|    146|         }
  489|   575k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 135, False: 574k]
  ------------------
  490|    135|            ctx.error = error_code::syntax_error;
  491|    135|            return true;
  492|    135|         }
  493|       |
  494|   574k|         skip_inline_ws(it, end);
  495|       |
  496|   574k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 162, False: 574k]
  ------------------
  497|    162|            if constexpr (!AllowEmptyInput) {
  498|    162|               ctx.error = error_code::unexpected_end;
  499|    162|            }
  500|    162|            return true;
  501|    162|         }
  502|       |
  503|   574k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 6.35k, False: 568k]
  ------------------
  504|  6.35k|            return true;
  505|  6.35k|         }
  506|       |
  507|   568k|         return false;
  508|   574k|      }
_ZZN3glz4fromILj450EdE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRdTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_ENKUlNS8_8yaml_tagEE_clESI_:
 2154|   575k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble, [](yaml::yaml_tag tag) {
 2155|   575k|                if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2156|   575k|                   return yaml::tag_valid_for_float(tag);
 2157|       |                }
 2158|       |                else {
 2159|       |                   return yaml::tag_valid_for_int(tag);
 2160|       |                }
 2161|   575k|             }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEERdNS0_12yaml_contextEPKcS7_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   574k|      {
  418|   574k|         state.has_anchor = false;
  419|   574k|         state.anchor_name.clear();
  420|   574k|         state.anchor_start = nullptr;
  421|   574k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   574k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|   574k|            else {
  430|   574k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 5.86k, False: 568k]
  ------------------
  431|   574k|            }
  432|   574k|         }
  433|       |
  434|   574k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 568k, False: 5.86k]
  |  Branch (434:27): [True: 3.64k, False: 565k]
  ------------------
  435|  3.64k|            ++it;
  436|  3.64k|            auto name = parse_anchor_name(it, end);
  437|  3.64k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 241, False: 3.40k]
  ------------------
  438|    241|               ctx.error = error_code::syntax_error;
  439|    241|               return true;
  440|    241|            }
  441|  3.40k|            skip_inline_ws(it, end);
  442|  3.40k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 253, False: 3.14k]
  ------------------
  443|    253|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|    253|                  ctx.error = error_code::unexpected_end;
  445|    253|               }
  446|    253|               return true;
  447|    253|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  3.14k|            state.has_anchor = true;
  455|  3.14k|            state.anchor_name = std::string(name);
  456|  3.14k|            state.anchor_start = &*it;
  457|  3.14k|         }
  458|       |
  459|   574k|         return false;
  460|   574k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERdNS0_12yaml_contextEPKcS6_EEbOT0_RT1_RT2_T3_:
  309|   574k|      {
  310|   574k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 574k]
  |  Branch (310:27): [True: 568k, False: 5.86k]
  ------------------
  311|       |
  312|  5.86k|         ++it; // skip '*'
  313|  5.86k|         auto name = parse_anchor_name(it, end);
  314|  5.86k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 291, False: 5.57k]
  ------------------
  315|    291|            ctx.error = error_code::syntax_error;
  316|    291|            return true;
  317|    291|         }
  318|       |
  319|  5.57k|         auto anchor_it = ctx.anchors.find(name);
  320|  5.57k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 882, False: 4.68k]
  ------------------
  321|    882|            ctx.error = error_code::syntax_error; // undefined alias
  322|    882|            return true;
  323|    882|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  4.68k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  4.68k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 1.32k, False: 3.36k]
  ------------------
  331|  1.32k|            return true;
  332|  1.32k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  3.36k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 123, False: 3.23k]
  ------------------
  338|    123|            ctx.error = error_code::syntax_error; // cyclic alias
  339|    123|            return true;
  340|    123|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  3.23k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  3.23k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 2, False: 3.23k]
  ------------------
  348|      2|            return true;
  349|       |
  350|  3.23k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 12, False: 3.22k]
  ------------------
  351|     12|            ctx.error = error_code::exceeded_max_expansion;
  352|     12|            ctx.custom_error_message = "alias expansion";
  353|     12|            return true;
  354|     12|         }
  355|       |
  356|  3.22k|         auto replay_it = span.begin;
  357|  3.22k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  3.22k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  3.22k|         ctx.indent_stack.clear();
  362|  3.22k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 661, False: 2.56k]
  ------------------
  363|    661|            ctx.push_indent(span.base_indent - 1);
  364|    661|         }
  365|       |
  366|  3.22k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  3.22k|         using V = std::remove_cvref_t<T>;
  369|  3.22k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  3.22k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  3.22k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  3.22k|         return true;
  376|  3.23k|      }
_ZZN3glz4fromILj450EdE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRdTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_ENKUlvE_clEv:
 2164|   564k|         auto finalize = [&] { yaml::finalize_node_anchor(preamble.node_props, ctx, it); };
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_20is_yaml_variant_boolEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|  18.3k|      {
 5356|  18.3k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|  18.3k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|  18.3k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|  18.3k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|  18.3k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 18.3k, False: 0]
  ------------------
 5366|  18.3k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|  18.3k|      }
_ZN3glz4fromILj450EbE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRbTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_:
 2114|  23.5k|      {
 2115|  23.5k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2115:14): [True: 0, False: 23.5k]
  ------------------
 2116|      0|            return;
 2117|       |
 2118|  23.5k|         yaml::node_preamble_state preamble{};
 2119|  23.5k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble,
  ------------------
  |  Branch (2119:14): [True: 6.43k, False: 17.1k]
  ------------------
 2120|  23.5k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_bool(tag); }))
 2121|  6.43k|            return;
 2122|       |
 2123|       |         // Parse as plain scalar first
 2124|  17.1k|         std::string str;
 2125|  17.1k|         yaml::parse_plain_scalar(str, ctx, it, end, yaml::check_flow_context(Opts));
 2126|       |
 2127|  17.1k|         if (str == "true" || str == "True" || str == "TRUE" || str == "yes" || str == "Yes" || str == "YES" ||
  ------------------
  |  Branch (2127:14): [True: 1.85k, False: 15.2k]
  |  Branch (2127:31): [True: 699, False: 14.5k]
  |  Branch (2127:48): [True: 872, False: 13.6k]
  |  Branch (2127:65): [True: 343, False: 13.3k]
  |  Branch (2127:81): [True: 291, False: 13.0k]
  |  Branch (2127:97): [True: 501, False: 12.5k]
  ------------------
 2128|  12.5k|             str == "on" || str == "On" || str == "ON") {
  ------------------
  |  Branch (2128:14): [True: 344, False: 12.2k]
  |  Branch (2128:29): [True: 255, False: 11.9k]
  |  Branch (2128:44): [True: 294, False: 11.6k]
  ------------------
 2129|  5.45k|            value = true;
 2130|  5.45k|         }
 2131|  11.6k|         else if (str == "false" || str == "False" || str == "FALSE" || str == "no" || str == "No" || str == "NO" ||
  ------------------
  |  Branch (2131:19): [True: 2.43k, False: 9.21k]
  |  Branch (2131:37): [True: 1.27k, False: 7.94k]
  |  Branch (2131:55): [True: 918, False: 7.02k]
  |  Branch (2131:73): [True: 400, False: 6.62k]
  |  Branch (2131:88): [True: 5.00k, False: 1.62k]
  |  Branch (2131:103): [True: 282, False: 1.33k]
  ------------------
 2132|  11.5k|                  str == "off" || str == "Off" || str == "OFF") {
  ------------------
  |  Branch (2132:19): [True: 438, False: 900]
  |  Branch (2132:35): [True: 329, False: 571]
  |  Branch (2132:51): [True: 442, False: 129]
  ------------------
 2133|  11.5k|            value = false;
 2134|  11.5k|         }
 2135|    129|         else {
 2136|    129|            ctx.error = error_code::expected_true_or_false;
 2137|    129|         }
 2138|       |
 2139|  17.1k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 2140|  17.1k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEELb0ERbNS0_12yaml_contextEPKcS7_ZNS_4fromILj450EbE2opITnDaXtlS2_Lj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERS7_S4_TkNS_10is_contextERS5_S7_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSG_RSJ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|  23.5k|      {
  475|  23.5k|         skip_inline_ws(it, end);
  476|       |
  477|  23.5k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 10, False: 23.5k]
  ------------------
  478|     10|            if constexpr (!AllowEmptyInput) {
  479|     10|               ctx.error = error_code::unexpected_end;
  480|     10|            }
  481|     10|            return true;
  482|     10|         }
  483|       |
  484|  23.5k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|  23.5k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 7, False: 23.5k]
  ------------------
  486|      7|            ctx.error = error_code::syntax_error;
  487|      7|            return true;
  488|      7|         }
  489|  23.5k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 2, False: 23.5k]
  ------------------
  490|      2|            ctx.error = error_code::syntax_error;
  491|      2|            return true;
  492|      2|         }
  493|       |
  494|  23.5k|         skip_inline_ws(it, end);
  495|       |
  496|  23.5k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 3, False: 23.5k]
  ------------------
  497|      3|            if constexpr (!AllowEmptyInput) {
  498|      3|               ctx.error = error_code::unexpected_end;
  499|      3|            }
  500|      3|            return true;
  501|      3|         }
  502|       |
  503|  23.5k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 6.41k, False: 17.1k]
  ------------------
  504|  6.41k|            return true;
  505|  6.41k|         }
  506|       |
  507|  17.1k|         return false;
  508|  23.5k|      }
_ZZN3glz4fromILj450EbE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRbTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_ENKUlNS8_8yaml_tagEE_clESI_:
 2120|  23.5k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_bool(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEERbNS0_12yaml_contextEPKcS7_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|  23.5k|      {
  418|  23.5k|         state.has_anchor = false;
  419|  23.5k|         state.anchor_name.clear();
  420|  23.5k|         state.anchor_start = nullptr;
  421|  23.5k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|  23.5k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|  23.5k|            else {
  430|  23.5k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 6.38k, False: 17.1k]
  ------------------
  431|  23.5k|            }
  432|  23.5k|         }
  433|       |
  434|  23.5k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 17.1k, False: 6.38k]
  |  Branch (434:27): [True: 4.59k, False: 12.5k]
  ------------------
  435|  4.59k|            ++it;
  436|  4.59k|            auto name = parse_anchor_name(it, end);
  437|  4.59k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 9, False: 4.58k]
  ------------------
  438|      9|               ctx.error = error_code::syntax_error;
  439|      9|               return true;
  440|      9|            }
  441|  4.58k|            skip_inline_ws(it, end);
  442|  4.58k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 23, False: 4.56k]
  ------------------
  443|     23|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     23|                  ctx.error = error_code::unexpected_end;
  445|     23|               }
  446|     23|               return true;
  447|     23|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  4.56k|            state.has_anchor = true;
  455|  4.56k|            state.anchor_name = std::string(name);
  456|  4.56k|            state.anchor_start = &*it;
  457|  4.56k|         }
  458|       |
  459|  23.4k|         return false;
  460|  23.5k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERbNS0_12yaml_contextEPKcS6_EEbOT0_RT1_RT2_T3_:
  309|  23.5k|      {
  310|  23.5k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 23.5k]
  |  Branch (310:27): [True: 17.1k, False: 6.38k]
  ------------------
  311|       |
  312|  6.38k|         ++it; // skip '*'
  313|  6.38k|         auto name = parse_anchor_name(it, end);
  314|  6.38k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 9, False: 6.37k]
  ------------------
  315|      9|            ctx.error = error_code::syntax_error;
  316|      9|            return true;
  317|      9|         }
  318|       |
  319|  6.37k|         auto anchor_it = ctx.anchors.find(name);
  320|  6.37k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 32, False: 6.34k]
  ------------------
  321|     32|            ctx.error = error_code::syntax_error; // undefined alias
  322|     32|            return true;
  323|     32|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  6.34k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  6.34k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 1.15k, False: 5.18k]
  ------------------
  331|  1.15k|            return true;
  332|  1.15k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  5.18k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 5, False: 5.18k]
  ------------------
  338|      5|            ctx.error = error_code::syntax_error; // cyclic alias
  339|      5|            return true;
  340|      5|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  5.18k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  5.18k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 1, False: 5.18k]
  ------------------
  348|      1|            return true;
  349|       |
  350|  5.18k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 4, False: 5.17k]
  ------------------
  351|      4|            ctx.error = error_code::exceeded_max_expansion;
  352|      4|            ctx.custom_error_message = "alias expansion";
  353|      4|            return true;
  354|      4|         }
  355|       |
  356|  5.17k|         auto replay_it = span.begin;
  357|  5.17k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  5.17k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  5.17k|         ctx.indent_stack.clear();
  362|  5.17k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 1.36k, False: 3.81k]
  ------------------
  363|  1.36k|            ctx.push_indent(span.base_indent - 1);
  364|  1.36k|         }
  365|       |
  366|  5.17k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  5.17k|         using V = std::remove_cvref_t<T>;
  369|  5.17k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  5.17k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  5.17k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  5.17k|         return true;
  376|  5.18k|      }
_ZN3glz4fromILj450EDnE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRDnTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_:
 2500|  5.58k|      {
 2501|  5.58k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2501:14): [True: 0, False: 5.58k]
  ------------------
 2502|      0|            return;
 2503|       |
 2504|  5.58k|         yaml::skip_inline_ws(it, end);
 2505|       |
 2506|  5.58k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2506:14): [True: 13, False: 5.57k]
  ------------------
 2507|     13|            ctx.error = error_code::unexpected_end;
 2508|     13|            return;
 2509|     13|         }
 2510|       |
 2511|       |         // Check for null values: null, Null, NULL, ~
 2512|  5.57k|         if (*it == '~') {
  ------------------
  |  Branch (2512:14): [True: 1.89k, False: 3.67k]
  ------------------
 2513|  1.89k|            ++it;
 2514|  1.89k|            return;
 2515|  1.89k|         }
 2516|       |
 2517|       |         // Parse as plain scalar and check if it's a null keyword
 2518|  3.67k|         auto start = it;
 2519|  17.0k|         while (it != end && !yaml::plain_scalar_end_or_control_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (2519:17): [True: 16.8k, False: 284]
  |  Branch (2519:30): [True: 13.4k, False: 3.39k]
  ------------------
 2520|  13.4k|            ++it;
 2521|  13.4k|         }
 2522|       |
 2523|  3.67k|         std::string_view str{start, static_cast<size_t>(it - start)};
 2524|  3.67k|         if (!yaml::is_yaml_null(str)) {
  ------------------
  |  Branch (2524:14): [True: 36, False: 3.63k]
  ------------------
 2525|     36|            ctx.error = error_code::syntax_error;
 2526|     36|         }
 2527|  3.67k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_22is_yaml_variant_objectEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   645k|      {
 5356|   645k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   645k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   645k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   645k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   645k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 645k, False: 0]
  ------------------
 5366|   645k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   645k|      }
_ZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_:
 4660|   653k|      {
 4661|   653k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4661:14): [True: 0, False: 653k]
  ------------------
 4662|      0|            return;
 4663|       |
 4664|   653k|         yaml::node_preamble_state preamble{};
 4665|   653k|         if (yaml::parse_node_preamble<Opts, yaml::node_property_policy{true, true, false, false}>(
  ------------------
  |  Branch (4665:14): [True: 9.84k, False: 644k]
  ------------------
 4666|   653k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_map(tag); }))
 4667|  9.84k|            return;
 4668|       |
 4669|   644k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 4670|   644k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (4670:14): [True: 10, False: 644k]
  ------------------
 4671|     10|            return;
 4672|       |
 4673|   644k|         using key_t = typename std::remove_cvref_t<T>::key_type;
 4674|   644k|         using val_t = typename std::remove_cvref_t<T>::mapped_type;
 4675|       |
 4676|       |         // Reading a YAML mapping MERGES into the target: an entry overwrites the
 4677|       |         // value of a key that existed before the read and adds new keys, while
 4678|       |         // pre-existing keys the document does not mention are preserved (like a
 4679|       |         // struct/object read, and like json/read.hpp's per-key value[key]).
 4680|       |         // Within a single document a repeated key keeps its FIRST value -- YAML
 4681|       |         // mappings disallow duplicate keys and the conformance suite expects
 4682|       |         // first-wins, which falls out of emplace into an empty map. Any
 4683|       |         // pre-existing entry the document leaves untouched is restored on scope
 4684|       |         // exit (including error paths). When the target starts empty (the common
 4685|       |         // case) this is a no-op with negligible cost.
 4686|   644k|         std::remove_cvref_t<T> preexisting_entries;
 4687|   644k|         if (!value.empty()) {
  ------------------
  |  Branch (4687:14): [True: 0, False: 644k]
  ------------------
 4688|      0|            preexisting_entries = std::move(value);
 4689|      0|            value.clear();
 4690|      0|         }
 4691|   644k|         struct merge_restore_guard
 4692|   644k|         {
 4693|   644k|            std::remove_cvref_t<T>& target;
 4694|   644k|            std::remove_cvref_t<T>& saved;
 4695|   644k|            ~merge_restore_guard()
 4696|   644k|            {
 4697|       |               // emplace is a no-op for keys the document already wrote, so only
 4698|       |               // untouched pre-existing entries are put back.
 4699|   644k|               for (auto& entry : saved) {
 4700|   644k|                  target.emplace(entry.first, std::move(entry.second));
 4701|   644k|               }
 4702|   644k|            }
 4703|   644k|         } merge_restore{value, preexisting_entries};
 4704|       |
 4705|   644k|         const bool treat_as_block_mapping =
 4706|   644k|            !yaml::check_flow_context(Opts) && *it == '{' && yaml::inline_value_has_plain_mapping_indicator(it, end);
  ------------------
  |  Branch (4706:13): [Folded, False: 644k]
  |  Branch (4706:48): [True: 0, False: 0]
  |  Branch (4706:62): [True: 0, False: 0]
  ------------------
 4707|       |
 4708|   644k|         if (*it == '{' && !treat_as_block_mapping) {
  ------------------
  |  Branch (4708:14): [True: 390k, False: 253k]
  |  Branch (4708:28): [True: 0, Folded]
  ------------------
 4709|       |            // Flow mapping
 4710|   390k|            ++it;
 4711|       |            // Skip whitespace and newlines after opening brace
 4712|   390k|            yaml::skip_ws_and_newlines(it, end);
 4713|       |
 4714|   390k|            if (it != end && *it == '}') {
  ------------------
  |  Branch (4714:17): [True: 388k, False: 1.71k]
  |  Branch (4714:30): [True: 7.02k, False: 381k]
  ------------------
 4715|  7.02k|               ++it;
 4716|  7.02k|               yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4717|  7.02k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4717:20): [True: 11, False: 7.01k]
  ------------------
 4718|     11|                  return;
 4719|  7.01k|               yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 4720|  7.01k|               return;
 4721|  7.02k|            }
 4722|       |
 4723|  1.12M|            while (it != end) {
  ------------------
  |  Branch (4723:20): [True: 1.11M, False: 4.72k]
  ------------------
 4724|       |               // Skip whitespace and newlines at start of each iteration
 4725|  1.11M|               yaml::skip_ws_and_newlines(it, end);
 4726|       |
 4727|  1.11M|               if (it != end && *it == '}') {
  ------------------
  |  Branch (4727:20): [True: 1.11M, False: 0]
  |  Branch (4727:33): [True: 13.0k, False: 1.10M]
  ------------------
 4728|  13.0k|                  ++it;
 4729|  13.0k|                  yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4730|  13.0k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4730:23): [True: 11, False: 13.0k]
  ------------------
 4731|     11|                     return;
 4732|  13.0k|                  break;
 4733|  13.0k|               }
 4734|       |
 4735|  1.10M|               bool explicit_flow_key = false;
 4736|  1.10M|               auto explicit_probe = it;
 4737|  1.10M|               yaml::skip_inline_ws(explicit_probe, end);
 4738|  1.10M|               if (explicit_probe != end && *explicit_probe == '?') {
  ------------------
  |  Branch (4738:20): [True: 1.10M, False: 0]
  |  Branch (4738:45): [True: 15.6k, False: 1.08M]
  ------------------
 4739|  15.6k|                  const auto after_q = explicit_probe + 1;
 4740|  15.6k|                  if (after_q == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_q)] ||
  ------------------
  |  Branch (4740:23): [True: 7, False: 15.6k]
  |  Branch (4740:41): [True: 9.84k, False: 5.83k]
  ------------------
 4741|  11.3k|                      *after_q == ',' || *after_q == '}') {
  ------------------
  |  Branch (4741:23): [True: 1.02k, False: 4.81k]
  |  Branch (4741:42): [True: 502, False: 4.30k]
  ------------------
 4742|  11.3k|                     explicit_flow_key = true;
 4743|  11.3k|                     it = explicit_probe + 1;
 4744|  11.3k|                     yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4745|  11.3k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4745:26): [True: 2, False: 11.3k]
  ------------------
 4746|      2|                        return;
 4747|  11.3k|                  }
 4748|  15.6k|               }
 4749|       |               // Parse key
 4750|  1.10M|               key_t key{};
 4751|  1.10M|               if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 4752|  1.10M|                  if (explicit_flow_key && it != end && (*it == ':' || *it == ',' || *it == '}')) {
  ------------------
  |  Branch (4752:23): [True: 11.3k, False: 1.09M]
  |  Branch (4752:44): [True: 11.3k, False: 14]
  |  Branch (4752:58): [True: 1.30k, False: 10.0k]
  |  Branch (4752:72): [True: 3.41k, False: 6.63k]
  |  Branch (4752:86): [True: 817, False: 5.82k]
  ------------------
 4753|  5.53k|                     key.clear();
 4754|  5.53k|                  }
 4755|  1.09M|                  else {
 4756|  1.09M|                     auto key_probe = it;
 4757|  1.09M|                     yaml::skip_inline_ws(key_probe, end);
 4758|       |
 4759|       |                     // Use full node parsing only for structurally complex flow keys.
 4760|       |                     // Plain/quoted/alias keys stay on parse_yaml_key() for compatibility.
 4761|  1.09M|                     bool parse_complex_flow_key = false;
 4762|  1.09M|                     if (key_probe != end) {
  ------------------
  |  Branch (4762:26): [True: 1.09M, False: 14]
  ------------------
 4763|  1.09M|                        if (*key_probe == '[' || *key_probe == '{') {
  ------------------
  |  Branch (4763:29): [True: 4.88k, False: 1.09M]
  |  Branch (4763:50): [True: 19.2k, False: 1.07M]
  ------------------
 4764|  24.0k|                           parse_complex_flow_key = true;
 4765|  24.0k|                        }
 4766|  1.07M|                        else if (*key_probe == '&') {
  ------------------
  |  Branch (4766:34): [True: 347k, False: 728k]
  ------------------
 4767|   347k|                           ++key_probe;
 4768|   347k|                           yaml::parse_anchor_name(key_probe, end);
 4769|   347k|                           yaml::skip_inline_ws(key_probe, end);
 4770|   347k|                           if (key_probe != end && (*key_probe == '[' || *key_probe == '{')) {
  ------------------
  |  Branch (4770:32): [True: 346k, False: 74]
  |  Branch (4770:53): [True: 5.41k, False: 341k]
  |  Branch (4770:74): [True: 195k, False: 146k]
  ------------------
 4771|   200k|                              parse_complex_flow_key = true;
 4772|   200k|                           }
 4773|   347k|                        }
 4774|  1.09M|                     }
 4775|       |
 4776|  1.09M|                     if (parse_complex_flow_key) {
  ------------------
  |  Branch (4776:26): [True: 224k, False: 874k]
  ------------------
 4777|   224k|                        glz::generic key_node{};
 4778|   224k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 4779|   224k|                        if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4779:29): [True: 8.85k, False: 215k]
  ------------------
 4780|  8.85k|                           return;
 4781|   215k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (4781:29): [True: 28, False: 215k]
  ------------------
 4782|     28|                           return;
 4783|   215k|                     }
 4784|   874k|                     else {
 4785|   874k|                        if (!yaml::parse_yaml_key(key, ctx, it, end, true)) {
  ------------------
  |  Branch (4785:29): [True: 3.86k, False: 870k]
  ------------------
 4786|  3.86k|                           return;
 4787|  3.86k|                        }
 4788|   874k|                     }
 4789|  1.09M|                  }
 4790|       |               }
 4791|       |               else {
 4792|       |                  if (explicit_flow_key && it != end && (*it == ':' || *it == ',' || *it == '}')) {
 4793|       |                     ctx.error = error_code::syntax_error;
 4794|       |                     return;
 4795|       |                  }
 4796|       |                  from<YAML, key_t>::template op<yaml::flow_context_on<Opts>()>(key, ctx, it, end);
 4797|       |                  if (bool(ctx.error)) [[unlikely]]
 4798|       |                     return;
 4799|       |               }
 4800|       |
 4801|       |               // Separation between flow key and ':' may include comments/newlines.
 4802|       |               // In flow context, newlines are allowed between key and ':'.
 4803|  1.09M|               yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4804|  1.10M|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4804:20): [True: 17, False: 1.10M]
  ------------------
 4805|     17|                  return;
 4806|       |
 4807|  1.10M|               auto parse_implicit_null = [&](val_t& val) -> bool {
 4808|  1.10M|                  if constexpr (nullable_like<std::remove_cvref_t<val_t>>) {
 4809|  1.10M|                     val = {};
 4810|  1.10M|                     return true;
 4811|  1.10M|                  }
 4812|  1.10M|                  else if constexpr (std::same_as<std::remove_cvref_t<val_t>, glz::generic>) {
 4813|  1.10M|                     val = glz::generic{};
 4814|  1.10M|                     return true;
 4815|  1.10M|                  }
 4816|  1.10M|                  else {
 4817|  1.10M|                     static constexpr std::string_view null_value{"null"};
 4818|  1.10M|                     auto null_it = null_value.data();
 4819|  1.10M|                     const yaml::yaml_context::scoped_stream literal_stream{ctx, null_value.data()};
 4820|  1.10M|                     from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(
 4821|  1.10M|                        val, ctx, null_it, null_value.data() + null_value.size());
 4822|  1.10M|                     return !bool(ctx.error);
 4823|  1.10M|                  }
 4824|  1.10M|               };
 4825|       |
 4826|  1.10M|               if (it != end && (*it == ',' || *it == '}')) {
  ------------------
  |  Branch (4826:20): [True: 1.09M, False: 14.4k]
  |  Branch (4826:34): [True: 439k, False: 650k]
  |  Branch (4826:48): [True: 119k, False: 530k]
  ------------------
 4827|   559k|                  val_t val{};
 4828|   559k|                  if (!parse_implicit_null(val)) [[unlikely]]
  ------------------
  |  Branch (4828:23): [True: 0, False: 559k]
  ------------------
 4829|      0|                     return;
 4830|       |
 4831|   559k|                  value.emplace(std::move(key), std::move(val));
 4832|       |
 4833|   559k|                  if (*it == '}') {
  ------------------
  |  Branch (4833:23): [True: 119k, False: 439k]
  ------------------
 4834|   119k|                     ++it;
 4835|   119k|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4836|   119k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4836:26): [True: 198, False: 119k]
  ------------------
 4837|    198|                        return;
 4838|   119k|                     break;
 4839|   119k|                  }
 4840|       |
 4841|   439k|                  ++it; // skip comma
 4842|   439k|                  yaml::skip_ws_and_newlines(it, end);
 4843|   439k|                  continue;
 4844|   559k|               }
 4845|       |
 4846|   545k|               if (it == end || *it != ':') {
  ------------------
  |  Branch (4846:20): [True: 14.4k, False: 530k]
  |  Branch (4846:33): [True: 655, False: 530k]
  ------------------
 4847|  2.40k|                  ctx.error = error_code::syntax_error;
 4848|  2.40k|                  return;
 4849|  2.40k|               }
 4850|   542k|               ++it;
 4851|       |
 4852|   542k|               yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4853|   542k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4853:20): [True: 4, False: 542k]
  ------------------
 4854|      4|                  return;
 4855|       |
 4856|       |               // Omitted value after an explicit ':' maps to an implicit null.
 4857|   542k|               if (it != end && (*it == ',' || *it == '}')) {
  ------------------
  |  Branch (4857:20): [True: 530k, False: 12.8k]
  |  Branch (4857:34): [True: 27.0k, False: 503k]
  |  Branch (4857:48): [True: 12.3k, False: 490k]
  ------------------
 4858|  39.4k|                  val_t val{};
 4859|  39.4k|                  if (!parse_implicit_null(val)) [[unlikely]]
  ------------------
  |  Branch (4859:23): [True: 0, False: 39.4k]
  ------------------
 4860|      0|                     return;
 4861|       |
 4862|  39.4k|                  value.emplace(std::move(key), std::move(val));
 4863|       |
 4864|  39.4k|                  if (*it == '}') {
  ------------------
  |  Branch (4864:23): [True: 12.3k, False: 27.0k]
  ------------------
 4865|  12.3k|                     ++it;
 4866|  12.3k|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4867|  12.3k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4867:26): [True: 14, False: 12.3k]
  ------------------
 4868|     14|                        return;
 4869|  12.3k|                     break;
 4870|  12.3k|                  }
 4871|       |
 4872|  27.0k|                  ++it; // skip comma
 4873|  27.0k|                  yaml::skip_ws_and_newlines(it, end);
 4874|  27.0k|                  continue;
 4875|  39.4k|               }
 4876|       |
 4877|       |               // Parse value
 4878|   503k|               val_t val{};
 4879|   503k|               from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(val, ctx, it, end);
 4880|   503k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4880:20): [True: 2.84k, False: 500k]
  ------------------
 4881|  2.84k|                  return;
 4882|       |
 4883|   500k|               value.emplace(std::move(key), std::move(val));
 4884|       |
 4885|   500k|               yaml::skip_inline_ws(it, end);
 4886|       |
 4887|   500k|               if (it != end && *it == '}') {
  ------------------
  |  Branch (4887:20): [True: 487k, False: 13.1k]
  |  Branch (4887:33): [True: 210k, False: 277k]
  ------------------
 4888|   210k|                  ++it;
 4889|   210k|                  yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4890|   210k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4890:23): [True: 217, False: 210k]
  ------------------
 4891|    217|                     return;
 4892|   210k|                  break;
 4893|   210k|               }
 4894|   290k|               else if (it != end && *it == ',') {
  ------------------
  |  Branch (4894:25): [True: 277k, False: 13.1k]
  |  Branch (4894:38): [True: 260k, False: 16.3k]
  ------------------
 4895|   260k|                  ++it;
 4896|       |                  // Skip whitespace and newlines after comma
 4897|   260k|                  yaml::skip_ws_and_newlines(it, end);
 4898|   260k|               }
 4899|  29.4k|               else if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (4899:25): [True: 16.3k, False: 13.1k]
  |  Branch (4899:39): [True: 9.05k, False: 7.26k]
  |  Branch (4899:54): [True: 6.96k, False: 295]
  ------------------
 4900|       |                  // Newlines may precede either the closing brace or the
 4901|       |                  // separator comma for the next entry.
 4902|  16.0k|                  yaml::skip_ws_and_newlines(it, end);
 4903|  16.0k|                  if (it != end && *it == '}') {
  ------------------
  |  Branch (4903:23): [True: 15.9k, False: 51]
  |  Branch (4903:36): [True: 4.53k, False: 11.4k]
  ------------------
 4904|  4.53k|                     ++it;
 4905|  4.53k|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4906|  4.53k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4906:26): [True: 2, False: 4.53k]
  ------------------
 4907|      2|                        return;
 4908|  4.53k|                     break;
 4909|  4.53k|                  }
 4910|  11.4k|                  if (it != end && *it == ',') {
  ------------------
  |  Branch (4910:23): [True: 11.4k, False: 51]
  |  Branch (4910:36): [True: 11.3k, False: 74]
  ------------------
 4911|  11.3k|                     ++it;
 4912|  11.3k|                     yaml::skip_ws_and_newlines(it, end);
 4913|  11.3k|                     continue;
 4914|  11.3k|                  }
 4915|    125|                  ctx.error = error_code::syntax_error;
 4916|    125|                  return;
 4917|  11.4k|               }
 4918|  13.4k|               else {
 4919|  13.4k|                  ctx.error = error_code::syntax_error;
 4920|  13.4k|                  return;
 4921|  13.4k|               }
 4922|   500k|            }
 4923|   383k|         }
 4924|   253k|         else {
 4925|       |            // Block mapping - use shared loop with map-specific callback
 4926|   253k|            yaml::parse_block_mapping_loop<Opts>(
 4927|   253k|               ctx, it, end, int32_t(-1), [&](auto& ctx, auto& it, auto end, int32_t line_indent) -> bool {
 4928|   253k|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|   253k|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 4930|   253k|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|   253k|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|   253k|                           if (ctx.stream_begin) {
 4938|   253k|                              auto is_line_content_start = [&](auto pos) {
 4939|   253k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   253k|                              };
 4941|       |
 4942|   253k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   253k|                                 const char* line = ctx.line_begin_of(pos);
 4944|   253k|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|   253k|                                 return line != end && *line == ':';
 4946|   253k|                              };
 4947|       |
 4948|   253k|                              if (!is_line_content_start(it) &&
 4949|   253k|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
 4950|   253k|                                  !line_has_explicit_value_indicator(it)) {
 4951|   253k|                                 ctx.error = error_code::syntax_error;
 4952|   253k|                                 return false;
 4953|   253k|                              }
 4954|   253k|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|   253k|                           }
 4956|   253k|                        }
 4957|       |
 4958|   253k|                        if (*it == '-' &&
 4959|   253k|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
 4960|   253k|                            !line_starts_with_explicit_value_indicator) {
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|   253k|                           ctx.error = error_code::syntax_error;
 4963|   253k|                           return false;
 4964|   253k|                        }
 4965|       |
 4966|   253k|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 4967|   253k|                           return false;
 4968|   253k|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|   253k|                        ctx.pop_indent();
 4970|   253k|                     }
 4971|   253k|                     else {
 4972|   253k|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|   253k|                        if (nested_indent >= 0) {
 4974|   253k|                           yaml::skip_to_content(it, end);
 4975|   253k|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
 4976|   253k|                              ctx.error = error_code::syntax_error;
 4977|   253k|                              return false;
 4978|   253k|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|   253k|                           const int32_t value_indent =
 4982|   253k|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
 4983|   253k|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
 4984|   253k|                              return false;
 4985|   253k|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|   253k|                           ctx.pop_indent();
 4987|   253k|                        }
 4988|   253k|                     }
 4989|   253k|                     return !bool(ctx.error);
 4990|   253k|                  };
 4991|       |
 4992|       |                  // Explicit key entry form:
 4993|       |                  // ? key
 4994|       |                  // : value
 4995|   253k|                  if (*it == '?' && ((it + 1) != end) && *(it + 1) == '\t') {
 4996|   253k|                     ctx.error = error_code::syntax_error;
 4997|   253k|                     return false;
 4998|   253k|                  }
 4999|   253k|                  if (*it == '?' && ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\n' || *(it + 1) == '\r')) {
 5000|   253k|                     ++it; // skip '?'
 5001|   253k|                     yaml::skip_inline_ws(it, end);
 5002|       |
 5003|   253k|                     const int32_t explicit_value_indicator_indent =
 5004|   253k|                        (ctx.current_indent() < 0) ? 0 : (ctx.current_indent() + 1);
 5005|       |
 5006|   253k|                     key_t key{};
 5007|   253k|                     if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5008|   253k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   253k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   253k|                        };
 5011|       |
 5012|   253k|                        auto key_it = it;
 5013|   253k|                        yaml::skip_inline_ws(key_it, end);
 5014|       |
 5015|   253k|                        auto content = key_it;
 5016|   253k|                        yaml::skip_to_content(content, end);
 5017|   253k|                        bool handled_anchor_only_empty_key = false;
 5018|       |
 5019|       |                        // Anchor on an empty explicit key node:
 5020|       |                        //   ? &a
 5021|       |                        //   : value
 5022|   253k|                        if (content != end && *content == '&') {
 5023|   253k|                           auto anchor_probe = content + 1;
 5024|   253k|                           auto anchor_name = yaml::parse_anchor_name(anchor_probe, end);
 5025|   253k|                           if (!anchor_name.empty()) {
 5026|   253k|                              auto after_anchor = anchor_probe;
 5027|   253k|                              yaml::skip_inline_ws(after_anchor, end);
 5028|       |
 5029|   253k|                              auto value_indicator = after_anchor;
 5030|   253k|                              if (value_indicator != end && *value_indicator == ':') {
 5031|   253k|                                 key.clear();
 5032|   253k|                                 ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5033|   253k|                                 it = value_indicator;
 5034|   253k|                                 handled_anchor_only_empty_key = true;
 5035|   253k|                              }
 5036|   253k|                              else {
 5037|   253k|                                 if (value_indicator != end && *value_indicator == '#') {
 5038|   253k|                                    yaml::skip_comment(value_indicator, end);
 5039|   253k|                                 }
 5040|   253k|                                 if (value_indicator != end && (*value_indicator == '\n' || *value_indicator == '\r')) {
 5041|   253k|                                    yaml::skip_newline(value_indicator, end);
 5042|   253k|                                    auto value_line = value_indicator;
 5043|   253k|                                    int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5044|   253k|                                    if (bool(ctx.error)) [[unlikely]]
 5045|   253k|                                       return false;
 5046|   253k|                                    if (value_line != end && *value_line == ':' &&
 5047|   253k|                                        value_indent == explicit_value_indicator_indent) {
 5048|   253k|                                       key.clear();
 5049|   253k|                                       ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5050|   253k|                                       it = value_line;
 5051|   253k|                                       handled_anchor_only_empty_key = true;
 5052|   253k|                                    }
 5053|   253k|                                    else if (value_line != end && *value_line == ':') {
 5054|       |                                       // In explicit-key form ("? &a"), a following ':'
 5055|       |                                       // starts the outer value indicator only at the same
 5056|       |                                       // indentation. A deeper-indented ': value' is malformed.
 5057|   253k|                                       ctx.error = error_code::syntax_error;
 5058|   253k|                                       return false;
 5059|   253k|                                    }
 5060|   253k|                                 }
 5061|   253k|                              }
 5062|   253k|                           }
 5063|   253k|                        }
 5064|       |
 5065|   253k|                        const bool key_content_spans_lines = [&] {
 5066|   253k|                           auto scan = key_it;
 5067|   253k|                           while (scan != content && scan != end) {
 5068|   253k|                              if (*scan == '\n' || *scan == '\r') return true;
 5069|   253k|                              ++scan;
 5070|   253k|                           }
 5071|   253k|                           return false;
 5072|   253k|                        }();
 5073|       |
 5074|   253k|                        if (handled_anchor_only_empty_key) {
 5075|       |                           // 'it' already points to the explicit value indicator ':'
 5076|   253k|                        }
 5077|   253k|                        else if (content == end || (*content == ':' && key_content_spans_lines)) {
 5078|   253k|                           key.clear();
 5079|   253k|                           it = content;
 5080|   253k|                        }
 5081|   253k|                        else {
 5082|       |                           // Explicit mapping keys ('? key-node') are full YAML nodes.
 5083|       |                           // Parse the key node structurally (not via plain-key scanning)
 5084|       |                           // so inputs like '? []: x' and '? JSON: like' are interpreted
 5085|       |                           // as complex keys, not split into implicit key/value pairs.
 5086|   253k|                           auto key_node_it = content;
 5087|   253k|                           auto key_node_end = end;
 5088|   253k|                           if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 5089|       |                              // In explicit-key form, a following standalone ':'
 5090|       |                              // line (same or lower indentation) belongs to the
 5091|       |                              // outer mapping value, not the key node itself.
 5092|   253k|                              auto scan = content;
 5093|   253k|                              while (scan != end) {
 5094|   253k|                                 while (scan != end && *scan != '\n' && *scan != '\r') {
 5095|   253k|                                    ++scan;
 5096|   253k|                                 }
 5097|   253k|                                 if (scan == end) {
 5098|   253k|                                    break;
 5099|   253k|                                 }
 5100|       |
 5101|   253k|                                 yaml::skip_newline(scan, end);
 5102|   253k|                                 auto line_start = scan;
 5103|       |
 5104|   253k|                                 int32_t indicator_indent = 0;
 5105|   253k|                                 while (scan != end && *scan == ' ') {
 5106|   253k|                                    ++indicator_indent;
 5107|   253k|                                    ++scan;
 5108|   253k|                                 }
 5109|       |
 5110|   253k|                                 if (scan != end && *scan == ':') {
 5111|   253k|                                    const auto after_colon = scan + 1;
 5112|   253k|                                    if ((after_colon == end ||
 5113|   253k|                                         yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
 5114|   253k|                                        indicator_indent <= line_indent) {
 5115|   253k|                                       key_node_end = line_start;
 5116|   253k|                                       break;
 5117|   253k|                                    }
 5118|   253k|                                 }
 5119|   253k|                              }
 5120|   253k|                           }
 5121|       |
 5122|   253k|                           glz::generic key_node{};
 5123|   253k|                           const bool prev_explicit_mapping_key_context = ctx.explicit_mapping_key_context;
 5124|   253k|                           ctx.explicit_mapping_key_context = true;
 5125|   253k|                           from<YAML, glz::generic>::template op<Opts>(key_node, ctx, key_node_it, key_node_end);
 5126|   253k|                           ctx.explicit_mapping_key_context = prev_explicit_mapping_key_context;
 5127|   253k|                           if (bool(ctx.error)) [[unlikely]]
 5128|   253k|                              return false;
 5129|   253k|                           it = key_node_it;
 5130|   253k|                           if (!to_string_key(key_node)) [[unlikely]]
 5131|   253k|                              return false;
 5132|   253k|                        }
 5133|   253k|                     }
 5134|   253k|                     else {
 5135|   253k|                        if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 5136|   253k|                           from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5137|   253k|                           if (bool(ctx.error)) [[unlikely]]
 5138|   253k|                              return false;
 5139|   253k|                        }
 5140|   253k|                     }
 5141|       |
 5142|   253k|                     yaml::skip_inline_ws(it, end);
 5143|   253k|                     yaml::skip_comment(it, end);
 5144|       |
 5145|       |                     // Value indicator may appear on the next line at the same indent.
 5146|   253k|                     if (it != end && (*it == '\n' || *it == '\r')) {
 5147|   253k|                        auto probe = it;
 5148|   253k|                        bool found_value_indicator = false;
 5149|       |
 5150|   253k|                        while (probe != end && (*probe == '\n' || *probe == '\r')) {
 5151|   253k|                           yaml::skip_newline(probe, end);
 5152|       |
 5153|   253k|                           auto value_line = probe;
 5154|   253k|                           int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5155|   253k|                           if (bool(ctx.error)) [[unlikely]]
 5156|   253k|                              return false;
 5157|       |
 5158|   253k|                           if (value_line == end || *value_line == '\n' || *value_line == '\r') {
 5159|   253k|                              probe = value_line;
 5160|   253k|                              continue; // blank line
 5161|   253k|                           }
 5162|   253k|                           if (*value_line == '#') {
 5163|   253k|                              yaml::skip_comment(value_line, end);
 5164|   253k|                              probe = value_line;
 5165|   253k|                              continue; // comment-only line
 5166|   253k|                           }
 5167|   253k|                           if (*value_line == ':' && value_indent == explicit_value_indicator_indent) {
 5168|   253k|                              it = value_line;
 5169|   253k|                              found_value_indicator = true;
 5170|   253k|                           }
 5171|   253k|                           break;
 5172|   253k|                        }
 5173|       |
 5174|   253k|                        if (found_value_indicator) {
 5175|   253k|                           yaml::skip_inline_ws(it, end);
 5176|   253k|                        }
 5177|   253k|                     }
 5178|       |
 5179|   253k|                     val_t val{};
 5180|   253k|                     if (it != end && *it == ':') {
 5181|   253k|                        ++it;
 5182|   253k|                        if (it != end && *it == '\t') {
 5183|   253k|                           ctx.error = error_code::syntax_error;
 5184|   253k|                           return false;
 5185|   253k|                        }
 5186|   253k|                        if (it != end && (*it == '\n' || *it == '\r')) {
 5187|   253k|                           auto probe = it;
 5188|   253k|                           yaml::skip_newline(probe, end);
 5189|   253k|                           while (probe != end && *probe == ' ') ++probe;
 5190|   253k|                           if (probe != end && *probe == ':' && ((probe + 1) != end) && *(probe + 1) == '\t') {
 5191|   253k|                              ctx.error = error_code::syntax_error;
 5192|   253k|                              return false;
 5193|   253k|                           }
 5194|   253k|                        }
 5195|   253k|                        yaml::skip_inline_ws(it, end);
 5196|   253k|                        if (!parse_map_value(val)) [[unlikely]]
 5197|   253k|                           return false;
 5198|   253k|                     }
 5199|       |
 5200|   253k|                     value.emplace(std::move(key), std::move(val));
 5201|   253k|                     return true;
 5202|   253k|                  }
 5203|       |
 5204|   253k|                  key_t key{};
 5205|   253k|                  if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5206|   253k|                     auto key_probe = it;
 5207|   253k|                     yaml::skip_inline_ws(key_probe, end);
 5208|   253k|                     const bool complex_flow_key = (key_probe != end && (*key_probe == '[' || *key_probe == '{'));
 5209|   253k|                     if (complex_flow_key) {
 5210|   253k|                        glz::generic key_node{};
 5211|   253k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 5212|   253k|                        if (bool(ctx.error)) [[unlikely]]
 5213|   253k|                           return false;
 5214|   253k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
 5215|   253k|                           return false;
 5216|   253k|                     }
 5217|   253k|                     else {
 5218|   253k|                        if (!yaml::parse_yaml_key(key, ctx, it, end, false)) {
 5219|   253k|                           return false;
 5220|   253k|                        }
 5221|   253k|                     }
 5222|   253k|                  }
 5223|   253k|                  else {
 5224|   253k|                     from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5225|   253k|                     if (bool(ctx.error)) [[unlikely]]
 5226|   253k|                        return false;
 5227|   253k|                  }
 5228|       |
 5229|   253k|                  yaml::skip_inline_ws(it, end);
 5230|       |
 5231|   253k|                  if (it == end || *it != ':') {
 5232|   253k|                     ctx.error = error_code::syntax_error;
 5233|   253k|                     return false;
 5234|   253k|                  }
 5235|   253k|                  ++it;
 5236|   253k|                  yaml::skip_inline_ws(it, end);
 5237|       |
 5238|   253k|                  val_t val{};
 5239|   253k|                  if (!parse_map_value(val)) [[unlikely]]
 5240|   253k|                     return false;
 5241|       |
 5242|   253k|                  value.emplace(std::move(key), std::move(val));
 5243|   253k|                  return true;
 5244|   253k|               });
 5245|   253k|         }
 5246|       |
 5247|   617k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 5248|   617k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1ELb1EEELb0ERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES4_EEEENS0_12yaml_contextEPKcSC_ZNS_4fromILj450ES8_E2opITnDaXtlS2_Lj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERSC_S9_TkNS_10is_contextERSA_SC_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSL_RSO_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   653k|      {
  475|   653k|         skip_inline_ws(it, end);
  476|       |
  477|   653k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 11, False: 653k]
  ------------------
  478|     11|            if constexpr (!AllowEmptyInput) {
  479|     11|               ctx.error = error_code::unexpected_end;
  480|     11|            }
  481|     11|            return true;
  482|     11|         }
  483|       |
  484|   653k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   653k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 2, False: 653k]
  ------------------
  486|      2|            ctx.error = error_code::syntax_error;
  487|      2|            return true;
  488|      2|         }
  489|   653k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 2, False: 653k]
  ------------------
  490|      2|            ctx.error = error_code::syntax_error;
  491|      2|            return true;
  492|      2|         }
  493|       |
  494|   653k|         skip_inline_ws(it, end);
  495|       |
  496|   653k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 3, False: 653k]
  ------------------
  497|      3|            if constexpr (!AllowEmptyInput) {
  498|      3|               ctx.error = error_code::unexpected_end;
  499|      3|            }
  500|      3|            return true;
  501|      3|         }
  502|       |
  503|   653k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 9.82k, False: 644k]
  ------------------
  504|  9.82k|            return true;
  505|  9.82k|         }
  506|       |
  507|   644k|         return false;
  508|   653k|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlNSD_8yaml_tagEE_clESN_:
 4666|   653k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_map(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1ELb1EEERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES4_EEEENS0_12yaml_contextEPKcSC_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   653k|      {
  418|   653k|         state.has_anchor = false;
  419|   653k|         state.anchor_name.clear();
  420|   653k|         state.anchor_start = nullptr;
  421|   653k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   653k|         if constexpr (Policy.allow_alias) {
  424|   653k|            if constexpr (Policy.alias_can_be_mapping_key) {
  425|   653k|               if (!alias_token_is_mapping_key(it, end)) {
  ------------------
  |  Branch (425:20): [True: 653k, False: 696]
  ------------------
  426|   653k|                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (426:23): [True: 9.79k, False: 643k]
  ------------------
  427|   653k|               }
  428|       |            }
  429|       |            else {
  430|       |               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  431|       |            }
  432|   653k|         }
  433|       |
  434|   653k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 644k, False: 9.79k]
  |  Branch (434:27): [True: 8.66k, False: 635k]
  ------------------
  435|  8.66k|            ++it;
  436|  8.66k|            auto name = parse_anchor_name(it, end);
  437|  8.66k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 9, False: 8.65k]
  ------------------
  438|      9|               ctx.error = error_code::syntax_error;
  439|      9|               return true;
  440|      9|            }
  441|  8.65k|            skip_inline_ws(it, end);
  442|  8.65k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 22, False: 8.63k]
  ------------------
  443|     22|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     22|                  ctx.error = error_code::unexpected_end;
  445|     22|               }
  446|     22|               return true;
  447|     22|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  8.63k|            state.has_anchor = true;
  455|  8.63k|            state.anchor_name = std::string(name);
  456|  8.63k|            state.anchor_start = &*it;
  457|  8.63k|         }
  458|       |
  459|   653k|         return false;
  460|   653k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES3_EEEENS0_12yaml_contextEPKcSB_EEbOT0_RT1_RT2_T3_:
  309|   653k|      {
  310|   653k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 653k]
  |  Branch (310:27): [True: 643k, False: 9.79k]
  ------------------
  311|       |
  312|  9.79k|         ++it; // skip '*'
  313|  9.79k|         auto name = parse_anchor_name(it, end);
  314|  9.79k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 10, False: 9.78k]
  ------------------
  315|     10|            ctx.error = error_code::syntax_error;
  316|     10|            return true;
  317|     10|         }
  318|       |
  319|  9.78k|         auto anchor_it = ctx.anchors.find(name);
  320|  9.78k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 65, False: 9.71k]
  ------------------
  321|     65|            ctx.error = error_code::syntax_error; // undefined alias
  322|     65|            return true;
  323|     65|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  9.71k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  9.71k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 1.39k, False: 8.32k]
  ------------------
  331|  1.39k|            return true;
  332|  1.39k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  8.32k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 9, False: 8.31k]
  ------------------
  338|      9|            ctx.error = error_code::syntax_error; // cyclic alias
  339|      9|            return true;
  340|      9|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  8.31k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  8.31k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 2, False: 8.31k]
  ------------------
  348|      2|            return true;
  349|       |
  350|  8.31k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 10, False: 8.30k]
  ------------------
  351|     10|            ctx.error = error_code::exceeded_max_expansion;
  352|     10|            ctx.custom_error_message = "alias expansion";
  353|     10|            return true;
  354|     10|         }
  355|       |
  356|  8.30k|         auto replay_it = span.begin;
  357|  8.30k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  8.30k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  8.30k|         ctx.indent_stack.clear();
  362|  8.30k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 607, False: 7.69k]
  ------------------
  363|    607|            ctx.push_indent(span.base_indent - 1);
  364|    607|         }
  365|       |
  366|  8.30k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  8.30k|         using V = std::remove_cvref_t<T>;
  369|  8.30k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  8.30k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  8.30k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  8.30k|         return true;
  376|  8.31k|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRS4_E_clESN_:
 4807|   598k|               auto parse_implicit_null = [&](val_t& val) -> bool {
 4808|       |                  if constexpr (nullable_like<std::remove_cvref_t<val_t>>) {
 4809|       |                     val = {};
 4810|       |                     return true;
 4811|       |                  }
 4812|   598k|                  else if constexpr (std::same_as<std::remove_cvref_t<val_t>, glz::generic>) {
 4813|   598k|                     val = glz::generic{};
 4814|   598k|                     return true;
 4815|       |                  }
 4816|       |                  else {
 4817|       |                     static constexpr std::string_view null_value{"null"};
 4818|       |                     auto null_it = null_value.data();
 4819|       |                     const yaml::yaml_context::scoped_stream literal_stream{ctx, null_value.data()};
 4820|       |                     from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(
 4821|       |                        val, ctx, null_it, null_value.data() + null_value.size());
 4822|       |                     return !bool(ctx.error);
 4823|       |                  }
 4824|   598k|               };
_ZN3glz4yaml24parse_block_mapping_loopITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEENS0_12yaml_contextEPKcS5_ZNS_4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES7_EEEEE2opITnDaXtlS2_Lj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERS5_RSB_TkNS_10is_contextERS3_S5_EEvOT1_OT2_OT0_T3_EUlRT_RSL_SH_iE_EEvSQ_RSH_SJ_iOSN_:
 3736|   253k|      {
 3737|       |         // A tagged-variant custom alternative hands its body (at the variant's own column) to a
 3738|       |         // discover-mode reader. Honor the known indent it published so continuation/dedent are
 3739|       |         // judged against the outer parent, not the body itself. One-shot: reset on observation.
 3740|   253k|         if (ctx.forced_block_mapping_indent >= 0) {
  ------------------
  |  Branch (3740:14): [True: 0, False: 253k]
  ------------------
 3741|      0|            if (mapping_indent < 0) {
  ------------------
  |  Branch (3741:17): [True: 0, False: 0]
  ------------------
 3742|      0|               mapping_indent = ctx.forced_block_mapping_indent;
 3743|      0|            }
 3744|      0|            ctx.forced_block_mapping_indent = -1;
 3745|      0|         }
 3746|   253k|         const int32_t parent_indent = ctx.current_indent();
 3747|   253k|         const bool discover_indent = (mapping_indent < 0);
 3748|   253k|         bool first_key = !discover_indent;
 3749|   253k|         bool discovered_first_key_mid_line = false;
 3750|   253k|         int32_t discovered_first_key_visual_indent = 0;
 3751|       |
 3752|   743k|         while (it != end) {
  ------------------
  |  Branch (3752:17): [True: 529k, False: 214k]
  ------------------
 3753|   529k|            auto line_start = it;
 3754|   529k|            int32_t line_indent = first_key ? mapping_indent : 0;
  ------------------
  |  Branch (3754:35): [True: 0, False: 529k]
  ------------------
 3755|       |
 3756|       |            // Skip blank lines and comments, measure indent
 3757|   667k|            while (it != end) {
  ------------------
  |  Branch (3757:20): [True: 662k, False: 4.66k]
  ------------------
 3758|   662k|               if (*it == '#') {
  ------------------
  |  Branch (3758:20): [True: 10.0k, False: 652k]
  ------------------
 3759|  10.0k|                  skip_comment(it, end);
 3760|  10.0k|                  skip_newline(it, end);
 3761|  10.0k|                  first_key = false;
 3762|  10.0k|                  line_indent = 0;
 3763|  10.0k|               }
 3764|   652k|               else if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3764:25): [True: 21.1k, False: 631k]
  |  Branch (3764:40): [True: 91.6k, False: 539k]
  ------------------
 3765|   112k|                  skip_newline(it, end);
 3766|   112k|                  first_key = false;
 3767|   112k|                  line_indent = 0;
 3768|   112k|               }
 3769|   539k|               else if (*it == ' ') {
  ------------------
  |  Branch (3769:25): [True: 58.5k, False: 481k]
  ------------------
 3770|  58.5k|                  line_start = it;
 3771|  58.5k|                  line_indent = 0;
 3772|  3.65M|                  while (it != end && *it == ' ') {
  ------------------
  |  Branch (3772:26): [True: 3.65M, False: 1.78k]
  |  Branch (3772:39): [True: 3.60M, False: 56.7k]
  ------------------
 3773|  3.60M|                     ++line_indent;
 3774|  3.60M|                     ++it;
 3775|  3.60M|                  }
 3776|       |
 3777|  58.5k|                  bool saw_tab = false;
 3778|  61.2k|                  while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3778:26): [True: 59.1k, False: 2.10k]
  |  Branch (3778:40): [True: 1.66k, False: 57.5k]
  |  Branch (3778:54): [True: 1.10k, False: 56.4k]
  ------------------
 3779|  2.77k|                     saw_tab = saw_tab || (*it == '\t');
  ------------------
  |  Branch (3779:32): [True: 2.04k, False: 732]
  |  Branch (3779:43): [True: 732, False: 0]
  ------------------
 3780|  2.77k|                     ++it;
 3781|  2.77k|                  }
 3782|       |
 3783|  58.5k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3783:23): [True: 2.10k, False: 56.4k]
  |  Branch (3783:36): [True: 1.61k, False: 54.7k]
  |  Branch (3783:51): [True: 1.46k, False: 53.3k]
  |  Branch (3783:66): [True: 1.02k, False: 52.2k]
  ------------------
 3784|  6.21k|                     first_key = false;
 3785|  6.21k|                     line_indent = 0;
 3786|  6.21k|                     continue; // Blank or comment line
 3787|  6.21k|                  }
 3788|       |
 3789|  52.2k|                  if (saw_tab) {
  ------------------
  |  Branch (3789:23): [True: 25, False: 52.2k]
  ------------------
 3790|     25|                     ctx.error = error_code::syntax_error;
 3791|     25|                     return;
 3792|     25|                  }
 3793|       |
 3794|       |                  // Early dedent check
 3795|  52.2k|                  if (mapping_indent >= 0 && line_indent < mapping_indent) {
  ------------------
  |  Branch (3795:23): [True: 50.5k, False: 1.69k]
  |  Branch (3795:46): [True: 285, False: 50.2k]
  ------------------
 3796|    285|                     it = line_start;
 3797|    285|                     return;
 3798|    285|                  }
 3799|       |
 3800|  51.9k|                  first_key = false;
 3801|  51.9k|                  break; // Found content
 3802|  52.2k|               }
 3803|   481k|               else if (*it == '\t') {
  ------------------
  |  Branch (3803:25): [True: 9.15k, False: 472k]
  ------------------
 3804|  9.15k|                  line_start = it;
 3805|  21.0k|                  while (it != end && (*it == ' ' || *it == '\t')) ++it;
  ------------------
  |  Branch (3805:26): [True: 20.7k, False: 289]
  |  Branch (3805:40): [True: 1.37k, False: 19.3k]
  |  Branch (3805:54): [True: 10.4k, False: 8.87k]
  ------------------
 3806|  9.15k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3806:23): [True: 289, False: 8.87k]
  |  Branch (3806:36): [True: 2.00k, False: 6.86k]
  |  Branch (3806:51): [True: 6.44k, False: 419]
  |  Branch (3806:66): [True: 378, False: 41]
  ------------------
 3807|  9.11k|                     first_key = false;
 3808|  9.11k|                     line_indent = 0;
 3809|  9.11k|                     continue; // Blank or comment-only line with tab indentation
 3810|  9.11k|                  }
 3811|     41|                  ctx.error = error_code::syntax_error;
 3812|     41|                  return;
 3813|  9.15k|               }
 3814|   472k|               else {
 3815|   472k|                  line_start = it;
 3816|   472k|                  break; // Content at column 0
 3817|   472k|               }
 3818|   662k|            }
 3819|       |
 3820|   528k|            if (it == end) break;
  ------------------
  |  Branch (3820:17): [True: 4.66k, False: 524k]
  ------------------
 3821|       |
 3822|       |            // Document boundaries terminate the current mapping in both discovered
 3823|       |            // and fixed-indent modes.
 3824|   524k|            if (at_document_end(it, end) || at_document_start(it, end)) break;
  ------------------
  |  Branch (3824:17): [True: 1.19k, False: 523k]
  |  Branch (3824:45): [True: 1.29k, False: 521k]
  ------------------
 3825|       |
 3826|       |            // Dedent checks (skip on first key for struct case)
 3827|       |            // Must check BEFORE establishing mapping_indent so the first discovered key
 3828|       |            // isn't rejected by the parent_indent check (mapping_indent is still -1).
 3829|   521k|            if (!first_key) {
  ------------------
  |  Branch (3829:17): [True: 521k, False: 0]
  ------------------
 3830|       |               // Parent indent check for nested maps (only after mapping_indent established)
 3831|   521k|               if (discover_indent && mapping_indent >= 0 && parent_indent >= 0 && line_indent <= parent_indent) {
  ------------------
  |  Branch (3831:20): [True: 521k, False: 0]
  |  Branch (3831:39): [True: 268k, False: 253k]
  |  Branch (3831:62): [True: 26.3k, False: 242k]
  |  Branch (3831:84): [True: 18.9k, False: 7.39k]
  ------------------
 3832|  18.9k|                  it = line_start;
 3833|  18.9k|                  return;
 3834|  18.9k|               }
 3835|   502k|               if (mapping_indent >= 0 && line_indent < mapping_indent) {
  ------------------
  |  Branch (3835:20): [True: 249k, False: 253k]
  |  Branch (3835:43): [True: 250, False: 249k]
  ------------------
 3836|    250|                  it = line_start;
 3837|    250|                  return;
 3838|    250|               }
 3839|   502k|            }
 3840|       |
 3841|       |            // Establish mapping indent from first key (map case)
 3842|   502k|            bool established_mapping_indent_this_line = false;
 3843|   502k|            if (mapping_indent < 0) {
  ------------------
  |  Branch (3843:17): [True: 253k, False: 249k]
  ------------------
 3844|   253k|               mapping_indent = line_indent;
 3845|   253k|               established_mapping_indent_this_line = true;
 3846|   253k|               discovered_first_key_visual_indent = line_indent;
 3847|   253k|               if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3848|   253k|                  if (ctx.stream_begin && line_start > ctx.stream_begin) {
  ------------------
  |  Branch (3848:23): [True: 253k, False: 0]
  |  Branch (3848:43): [True: 253k, False: 0]
  ------------------
 3849|   253k|                     const auto prefix = ctx.line_prefix_before(line_start);
 3850|   253k|                     if (prefix.has_tab) {
  ------------------
  |  Branch (3850:26): [True: 100, False: 253k]
  ------------------
 3851|    100|                        ctx.error = error_code::syntax_error;
 3852|    100|                        return;
 3853|    100|                     }
 3854|       |
 3855|   253k|                     discovered_first_key_mid_line = prefix.has_content;
 3856|   253k|                     if (mapping_indent == 0 && prefix.column > 0) {
  ------------------
  |  Branch (3856:26): [True: 251k, False: 1.69k]
  |  Branch (3856:49): [True: 192k, False: 59.3k]
  ------------------
 3857|   192k|                        discovered_first_key_visual_indent = prefix.column;
 3858|   192k|                     }
 3859|   253k|                  }
 3860|   253k|               }
 3861|   253k|            }
 3862|       |
 3863|       |            // In discovered-indent block mappings, sibling keys must stay at the same
 3864|       |            // indent level, except when the first key started mid-line (e.g. "--- k: v").
 3865|   502k|            if (discover_indent && mapping_indent >= 0 && !established_mapping_indent_this_line &&
  ------------------
  |  Branch (3865:17): [True: 502k, False: 100]
  |  Branch (3865:36): [True: 502k, False: 0]
  |  Branch (3865:59): [True: 249k, False: 253k]
  ------------------
 3866|   249k|                !discovered_first_key_mid_line) {
  ------------------
  |  Branch (3866:17): [True: 193k, False: 55.8k]
  ------------------
 3867|   193k|               if (mapping_indent == 0 && discovered_first_key_visual_indent > 0) {
  ------------------
  |  Branch (3867:20): [True: 193k, False: 338]
  |  Branch (3867:43): [True: 21.4k, False: 171k]
  ------------------
 3868|  21.4k|                  if (line_indent > discovered_first_key_visual_indent) {
  ------------------
  |  Branch (3868:23): [True: 27, False: 21.3k]
  ------------------
 3869|     27|                     ctx.error = error_code::syntax_error;
 3870|     27|                     return;
 3871|     27|                  }
 3872|  21.3k|                  if (line_indent < discovered_first_key_visual_indent) {
  ------------------
  |  Branch (3872:23): [True: 1.20k, False: 20.1k]
  ------------------
 3873|  1.20k|                     it = line_start;
 3874|  1.20k|                     return;
 3875|  1.20k|                  }
 3876|  21.3k|               }
 3877|   172k|               else if (line_indent > mapping_indent &&
  ------------------
  |  Branch (3877:25): [True: 539, False: 171k]
  ------------------
 3878|    539|                        (parent_indent < 0 || mapping_indent > 0 ||
  ------------------
  |  Branch (3878:26): [True: 27, False: 512]
  |  Branch (3878:47): [True: 2, False: 510]
  ------------------
 3879|    510|                         (parent_indent >= 0 && mapping_indent == 0 && line_indent > (parent_indent + 1)))) {
  ------------------
  |  Branch (3879:27): [True: 510, False: 0]
  |  Branch (3879:49): [True: 510, False: 0]
  |  Branch (3879:72): [True: 12, False: 498]
  ------------------
 3880|     41|                  ctx.error = error_code::syntax_error;
 3881|     41|                  return;
 3882|     41|               }
 3883|   193k|            }
 3884|       |
 3885|       |            // Sequence indicator check (struct case only - map parser lets key parsing
 3886|       |            // handle '- ' which produces appropriate errors for misindented items)
 3887|   501k|            if (!discover_indent && *it == '-' &&
  ------------------
  |  Branch (3887:17): [True: 0, False: 501k]
  |  Branch (3887:37): [True: 0, False: 0]
  ------------------
 3888|      0|                ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\t' || *(it + 1) == '\n')) {
  ------------------
  |  Branch (3888:18): [True: 0, False: 0]
  |  Branch (3888:37): [True: 0, False: 0]
  |  Branch (3888:57): [True: 0, False: 0]
  |  Branch (3888:78): [True: 0, False: 0]
  ------------------
 3889|      0|               it = line_start;
 3890|      0|               return;
 3891|      0|            }
 3892|       |
 3893|       |            // Skip indented comment lines
 3894|   501k|            if (*it == '#') {
  ------------------
  |  Branch (3894:17): [True: 0, False: 501k]
  ------------------
 3895|      0|               skip_comment(it, end);
 3896|      0|               first_key = false;
 3897|      0|               continue;
 3898|      0|            }
 3899|       |
 3900|       |            // Skip blank/empty lines after indent
 3901|   501k|            if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3901:17): [True: 100, False: 501k]
  |  Branch (3901:32): [True: 0, False: 501k]
  ------------------
 3902|      0|               first_key = false;
 3903|      0|               continue;
 3904|      0|            }
 3905|       |
 3906|       |            // While parsing an explicit mapping key node ('? key-node'),
 3907|       |            // a subsequent standalone ':' at the same indentation starts
 3908|       |            // the outer value indicator and must terminate this key-node map.
 3909|       |            // Keep same-line ': x' on the first key-node line valid.
 3910|   501k|            if (ctx.explicit_mapping_key_context && !established_mapping_indent_this_line && *it == ':') {
  ------------------
  |  Branch (3910:17): [True: 116k, False: 384k]
  |  Branch (3910:53): [True: 31.1k, False: 85.2k]
  |  Branch (3910:94): [True: 10.1k, False: 21.0k]
  ------------------
 3911|  10.1k|               const auto after_colon = it + 1;
 3912|  10.1k|               const int32_t explicit_value_indicator_indent = (parent_indent < 0) ? 0 : (parent_indent + 1);
  ------------------
  |  Branch (3912:64): [True: 9.47k, False: 634]
  ------------------
 3913|  10.1k|               if ((after_colon == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
  ------------------
  |  Branch (3913:21): [True: 499, False: 9.61k]
  |  Branch (3913:43): [True: 8.23k, False: 1.37k]
  ------------------
 3914|  8.73k|                   line_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (3914:20): [True: 1.01k, False: 7.71k]
  ------------------
 3915|  1.01k|                  it = line_start;
 3916|  1.01k|                  return;
 3917|  1.01k|               }
 3918|  10.1k|            }
 3919|       |
 3920|       |            // Process this mapping entry (key + colon + value)
 3921|   500k|            int32_t effective_line_indent = line_indent;
 3922|   500k|            if (discover_indent && established_mapping_indent_this_line &&
  ------------------
  |  Branch (3922:17): [True: 500k, False: 100]
  |  Branch (3922:36): [True: 253k, False: 246k]
  ------------------
 3923|   253k|                discovered_first_key_visual_indent > effective_line_indent &&
  ------------------
  |  Branch (3923:17): [True: 192k, False: 61.0k]
  ------------------
 3924|   192k|                !(discovered_first_key_mid_line && parent_indent < 0)) {
  ------------------
  |  Branch (3924:19): [True: 142k, False: 49.8k]
  |  Branch (3924:52): [True: 89.7k, False: 52.6k]
  ------------------
 3925|       |               // The first discovered key has no indentation of its own left to measure: it may
 3926|       |               // begin mid-line (a sequence entry's "- key: value"), or the caller may have already
 3927|       |               // consumed the line's indentation before handing the mapping over. Pass its visual
 3928|       |               // column so the entry judges its value against the key's real indent -- otherwise a
 3929|       |               // key with an empty value takes the following sibling line for nested content
 3930|       |               // (issue #2827) and same-line block scalars compute the wrong indentation.
 3931|       |               // The exception is a ROOT mapping whose first key begins mid-line, which means node
 3932|       |               // properties sit ahead of it (`!!str &a1 "foo":`): those belong to the document node
 3933|       |               // rather than to the key's column, so the measured indent stands. Conformance tests
 3934|       |               // 7FWL and HMQ5 pin that case.
 3935|   102k|               effective_line_indent = discovered_first_key_visual_indent;
 3936|   102k|            }
 3937|       |
 3938|   500k|            if (!process_entry(ctx, it, end, effective_line_indent)) {
  ------------------
  |  Branch (3938:17): [True: 10.4k, False: 489k]
  ------------------
 3939|  10.4k|               return;
 3940|  10.4k|            }
 3941|   489k|            first_key = false;
 3942|       |
 3943|   489k|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3943:17): [True: 0, False: 489k]
  ------------------
 3944|      0|               return;
 3945|       |
 3946|   489k|            if constexpr (yaml::check_flow_context(Opts)) {
 3947|       |               // In flow context, an implicit "key: value" pair used as a sequence entry
 3948|       |               // ends at ',', ']', or '}'. Let the enclosing flow parser consume it.
 3949|   489k|               auto flow_end = it;
 3950|   489k|               skip_flow_ws_and_newlines(ctx, flow_end, end);
 3951|   489k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3951:20): [True: 22, False: 489k]
  ------------------
 3952|     22|                  return;
 3953|   489k|               if (flow_end != end && (*flow_end == ',' || *flow_end == ']' || *flow_end == '}')) {
  ------------------
  |  Branch (3953:20): [True: 413k, False: 76.0k]
  |  Branch (3953:40): [True: 100k, False: 313k]
  |  Branch (3953:60): [True: 7.36k, False: 306k]
  |  Branch (3953:80): [True: 34.5k, False: 271k]
  ------------------
 3954|   142k|                  it = flow_end;
 3955|   142k|                  return;
 3956|   142k|               }
 3957|   489k|            }
 3958|       |
 3959|       |            // Trailing whitespace handling (peek-ahead pattern).
 3960|       |            // After parsing, iterator may be at leading indent of next line.
 3961|       |            // Don't consume it - let the outer loop handle indent measurement.
 3962|   489k|            if (it != end) {
  ------------------
  |  Branch (3962:17): [True: 282k, False: 207k]
  ------------------
 3963|   282k|               if (*it == ' ' || *it == '\t') {
  ------------------
  |  Branch (3963:20): [True: 27.0k, False: 255k]
  |  Branch (3963:34): [True: 2.18k, False: 253k]
  ------------------
 3964|  29.2k|                  auto peek = it;
 3965|  29.2k|                  skip_inline_ws(peek, end);
 3966|  29.2k|                  if (peek != end && *peek != '\n' && *peek != '\r' && *peek != '#') {
  ------------------
  |  Branch (3966:23): [True: 27.2k, False: 1.91k]
  |  Branch (3966:38): [True: 25.4k, False: 1.80k]
  |  Branch (3966:55): [True: 24.3k, False: 1.13k]
  |  Branch (3966:72): [True: 22.5k, False: 1.82k]
  ------------------
 3967|  22.5k|                     continue; // At leading indent of new line
 3968|  22.5k|                  }
 3969|  29.2k|               }
 3970|   260k|               skip_inline_ws(it, end);
 3971|   260k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (3971:20): [True: 258k, False: 1.91k]
  |  Branch (3971:33): [True: 9.29k, False: 248k]
  ------------------
 3972|  9.29k|                  if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3973|  9.29k|                     if (it > line_start) {
  ------------------
  |  Branch (3973:26): [True: 9.29k, False: 0]
  ------------------
 3974|  9.29k|                        const char prev = *(it - 1);
 3975|  9.29k|                        if (prev != ' ' && prev != '\t' && prev != '\n' && prev != '\r') {
  ------------------
  |  Branch (3975:29): [True: 5.07k, False: 4.22k]
  |  Branch (3975:44): [True: 3.14k, False: 1.92k]
  |  Branch (3975:60): [True: 2.18k, False: 957]
  |  Branch (3975:76): [True: 3, False: 2.18k]
  ------------------
 3976|      3|                           ctx.error = error_code::syntax_error;
 3977|      3|                           return;
 3978|      3|                        }
 3979|  9.29k|                     }
 3980|  9.29k|                  }
 3981|  9.29k|               }
 3982|  9.29k|               skip_comment(it, end);
 3983|   260k|               if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (3983:20): [True: 257k, False: 2.18k]
  |  Branch (3983:34): [True: 24.7k, False: 233k]
  |  Branch (3983:49): [True: 36.3k, False: 196k]
  ------------------
 3984|  61.0k|                  skip_newline(it, end);
 3985|  61.0k|               }
 3986|   199k|               else if (it != end) {
  ------------------
  |  Branch (3986:25): [True: 196k, False: 2.18k]
  ------------------
 3987|       |                  // The entry stopped part way along its line with something other than
 3988|       |                  // whitespace or a comment after it -- a ':' its value could not take as a
 3989|       |                  // separator, say. The next pass measures indent as though this were the start
 3990|       |                  // of a line, so what is left of the real one is lost; reject it instead.
 3991|   196k|                  if constexpr (requires { ctx.line_prefix_before(it); }) {
 3992|   196k|                     if (ctx.line_prefix_before(it).has_content) {
  ------------------
  |  Branch (3992:26): [True: 107, False: 196k]
  ------------------
 3993|    107|                        ctx.error = error_code::syntax_error;
 3994|    107|                        return;
 3995|    107|                     }
 3996|   196k|                  }
 3997|   196k|               }
 3998|   260k|            }
 3999|   489k|         }
 4000|   253k|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_i:
 4927|   500k|               ctx, it, end, int32_t(-1), [&](auto& ctx, auto& it, auto end, int32_t line_indent) -> bool {
 4928|   500k|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|   500k|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 4930|   500k|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|   500k|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|   500k|                           if (ctx.stream_begin) {
 4938|   500k|                              auto is_line_content_start = [&](auto pos) {
 4939|   500k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   500k|                              };
 4941|       |
 4942|   500k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   500k|                                 const char* line = ctx.line_begin_of(pos);
 4944|   500k|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|   500k|                                 return line != end && *line == ':';
 4946|   500k|                              };
 4947|       |
 4948|   500k|                              if (!is_line_content_start(it) &&
 4949|   500k|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
 4950|   500k|                                  !line_has_explicit_value_indicator(it)) {
 4951|   500k|                                 ctx.error = error_code::syntax_error;
 4952|   500k|                                 return false;
 4953|   500k|                              }
 4954|   500k|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|   500k|                           }
 4956|   500k|                        }
 4957|       |
 4958|   500k|                        if (*it == '-' &&
 4959|   500k|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
 4960|   500k|                            !line_starts_with_explicit_value_indicator) {
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|   500k|                           ctx.error = error_code::syntax_error;
 4963|   500k|                           return false;
 4964|   500k|                        }
 4965|       |
 4966|   500k|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 4967|   500k|                           return false;
 4968|   500k|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|   500k|                        ctx.pop_indent();
 4970|   500k|                     }
 4971|   500k|                     else {
 4972|   500k|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|   500k|                        if (nested_indent >= 0) {
 4974|   500k|                           yaml::skip_to_content(it, end);
 4975|   500k|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
 4976|   500k|                              ctx.error = error_code::syntax_error;
 4977|   500k|                              return false;
 4978|   500k|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|   500k|                           const int32_t value_indent =
 4982|   500k|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
 4983|   500k|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
 4984|   500k|                              return false;
 4985|   500k|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|   500k|                           ctx.pop_indent();
 4987|   500k|                        }
 4988|   500k|                     }
 4989|   500k|                     return !bool(ctx.error);
 4990|   500k|                  };
 4991|       |
 4992|       |                  // Explicit key entry form:
 4993|       |                  // ? key
 4994|       |                  // : value
 4995|   500k|                  if (*it == '?' && ((it + 1) != end) && *(it + 1) == '\t') {
  ------------------
  |  Branch (4995:23): [True: 253k, False: 246k]
  |  Branch (4995:37): [True: 253k, False: 299]
  |  Branch (4995:58): [True: 2, False: 253k]
  ------------------
 4996|      2|                     ctx.error = error_code::syntax_error;
 4997|      2|                     return false;
 4998|      2|                  }
 4999|   500k|                  if (*it == '?' && ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\n' || *(it + 1) == '\r')) {
  ------------------
  |  Branch (4999:23): [True: 253k, False: 246k]
  |  Branch (4999:38): [True: 299, False: 253k]
  |  Branch (4999:57): [True: 37.2k, False: 216k]
  |  Branch (4999:77): [True: 52.3k, False: 163k]
  |  Branch (4999:98): [True: 158k, False: 5.63k]
  ------------------
 5000|   247k|                     ++it; // skip '?'
 5001|   247k|                     yaml::skip_inline_ws(it, end);
 5002|       |
 5003|   247k|                     const int32_t explicit_value_indicator_indent =
 5004|   247k|                        (ctx.current_indent() < 0) ? 0 : (ctx.current_indent() + 1);
  ------------------
  |  Branch (5004:25): [True: 210k, False: 37.4k]
  ------------------
 5005|       |
 5006|   247k|                     key_t key{};
 5007|   247k|                     if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5008|   247k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   247k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   247k|                        };
 5011|       |
 5012|   247k|                        auto key_it = it;
 5013|   247k|                        yaml::skip_inline_ws(key_it, end);
 5014|       |
 5015|   247k|                        auto content = key_it;
 5016|   247k|                        yaml::skip_to_content(content, end);
 5017|   247k|                        bool handled_anchor_only_empty_key = false;
 5018|       |
 5019|       |                        // Anchor on an empty explicit key node:
 5020|       |                        //   ? &a
 5021|       |                        //   : value
 5022|   247k|                        if (content != end && *content == '&') {
  ------------------
  |  Branch (5022:29): [True: 235k, False: 12.0k]
  |  Branch (5022:47): [True: 28.2k, False: 207k]
  ------------------
 5023|  28.2k|                           auto anchor_probe = content + 1;
 5024|  28.2k|                           auto anchor_name = yaml::parse_anchor_name(anchor_probe, end);
 5025|  28.2k|                           if (!anchor_name.empty()) {
  ------------------
  |  Branch (5025:32): [True: 28.1k, False: 23]
  ------------------
 5026|  28.1k|                              auto after_anchor = anchor_probe;
 5027|  28.1k|                              yaml::skip_inline_ws(after_anchor, end);
 5028|       |
 5029|  28.1k|                              auto value_indicator = after_anchor;
 5030|  28.1k|                              if (value_indicator != end && *value_indicator == ':') {
  ------------------
  |  Branch (5030:35): [True: 26.1k, False: 2.02k]
  |  Branch (5030:61): [True: 1.79k, False: 24.3k]
  ------------------
 5031|  1.79k|                                 key.clear();
 5032|  1.79k|                                 ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5033|  1.79k|                                 it = value_indicator;
 5034|  1.79k|                                 handled_anchor_only_empty_key = true;
 5035|  1.79k|                              }
 5036|  26.3k|                              else {
 5037|  26.3k|                                 if (value_indicator != end && *value_indicator == '#') {
  ------------------
  |  Branch (5037:38): [True: 24.3k, False: 2.02k]
  |  Branch (5037:64): [True: 1.95k, False: 22.4k]
  ------------------
 5038|  1.95k|                                    yaml::skip_comment(value_indicator, end);
 5039|  1.95k|                                 }
 5040|  26.3k|                                 if (value_indicator != end && (*value_indicator == '\n' || *value_indicator == '\r')) {
  ------------------
  |  Branch (5040:38): [True: 24.0k, False: 2.32k]
  |  Branch (5040:65): [True: 3.62k, False: 20.4k]
  |  Branch (5040:93): [True: 7.09k, False: 13.3k]
  ------------------
 5041|  10.7k|                                    yaml::skip_newline(value_indicator, end);
 5042|  10.7k|                                    auto value_line = value_indicator;
 5043|  10.7k|                                    int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5044|  10.7k|                                    if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5044:41): [True: 2, False: 10.7k]
  ------------------
 5045|      2|                                       return false;
 5046|  10.7k|                                    if (value_line != end && *value_line == ':' &&
  ------------------
  |  Branch (5046:41): [True: 9.68k, False: 1.03k]
  |  Branch (5046:62): [True: 1.34k, False: 8.33k]
  ------------------
 5047|  1.34k|                                        value_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (5047:41): [True: 1.33k, False: 8]
  ------------------
 5048|  1.33k|                                       key.clear();
 5049|  1.33k|                                       ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5050|  1.33k|                                       it = value_line;
 5051|  1.33k|                                       handled_anchor_only_empty_key = true;
 5052|  1.33k|                                    }
 5053|  9.38k|                                    else if (value_line != end && *value_line == ':') {
  ------------------
  |  Branch (5053:46): [True: 8.34k, False: 1.03k]
  |  Branch (5053:67): [True: 8, False: 8.33k]
  ------------------
 5054|       |                                       // In explicit-key form ("? &a"), a following ':'
 5055|       |                                       // starts the outer value indicator only at the same
 5056|       |                                       // indentation. A deeper-indented ': value' is malformed.
 5057|      8|                                       ctx.error = error_code::syntax_error;
 5058|      8|                                       return false;
 5059|      8|                                    }
 5060|  10.7k|                                 }
 5061|  26.3k|                              }
 5062|  28.1k|                           }
 5063|  28.2k|                        }
 5064|       |
 5065|   247k|                        const bool key_content_spans_lines = [&] {
 5066|   247k|                           auto scan = key_it;
 5067|   247k|                           while (scan != content && scan != end) {
 5068|   247k|                              if (*scan == '\n' || *scan == '\r') return true;
 5069|   247k|                              ++scan;
 5070|   247k|                           }
 5071|   247k|                           return false;
 5072|   247k|                        }();
 5073|       |
 5074|   247k|                        if (handled_anchor_only_empty_key) {
  ------------------
  |  Branch (5074:29): [True: 3.13k, False: 244k]
  ------------------
 5075|       |                           // 'it' already points to the explicit value indicator ':'
 5076|  3.13k|                        }
 5077|   244k|                        else if (content == end || (*content == ':' && key_content_spans_lines)) {
  ------------------
  |  Branch (5077:34): [True: 12.0k, False: 232k]
  |  Branch (5077:53): [True: 108k, False: 124k]
  |  Branch (5077:72): [True: 106k, False: 1.98k]
  ------------------
 5078|   118k|                           key.clear();
 5079|   118k|                           it = content;
 5080|   118k|                        }
 5081|   126k|                        else {
 5082|       |                           // Explicit mapping keys ('? key-node') are full YAML nodes.
 5083|       |                           // Parse the key node structurally (not via plain-key scanning)
 5084|       |                           // so inputs like '? []: x' and '? JSON: like' are interpreted
 5085|       |                           // as complex keys, not split into implicit key/value pairs.
 5086|   126k|                           auto key_node_it = content;
 5087|   126k|                           auto key_node_end = end;
 5088|   126k|                           if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 5089|       |                              // In explicit-key form, a following standalone ':'
 5090|       |                              // line (same or lower indentation) belongs to the
 5091|       |                              // outer mapping value, not the key node itself.
 5092|   126k|                              auto scan = content;
 5093|   676k|                              while (scan != end) {
  ------------------
  |  Branch (5093:38): [True: 662k, False: 14.0k]
  ------------------
 5094|  57.0M|                                 while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (5094:41): [True: 56.9M, False: 70.8k]
  |  Branch (5094:56): [True: 56.6M, False: 289k]
  |  Branch (5094:73): [True: 56.3M, False: 302k]
  ------------------
 5095|  56.3M|                                    ++scan;
 5096|  56.3M|                                 }
 5097|   662k|                                 if (scan == end) {
  ------------------
  |  Branch (5097:38): [True: 70.8k, False: 591k]
  ------------------
 5098|  70.8k|                                    break;
 5099|  70.8k|                                 }
 5100|       |
 5101|   591k|                                 yaml::skip_newline(scan, end);
 5102|   591k|                                 auto line_start = scan;
 5103|       |
 5104|   591k|                                 int32_t indicator_indent = 0;
 5105|  1.42M|                                 while (scan != end && *scan == ' ') {
  ------------------
  |  Branch (5105:41): [True: 1.40M, False: 14.0k]
  |  Branch (5105:56): [True: 831k, False: 577k]
  ------------------
 5106|   831k|                                    ++indicator_indent;
 5107|   831k|                                    ++scan;
 5108|   831k|                                 }
 5109|       |
 5110|   591k|                                 if (scan != end && *scan == ':') {
  ------------------
  |  Branch (5110:38): [True: 577k, False: 14.0k]
  |  Branch (5110:53): [True: 71.7k, False: 506k]
  ------------------
 5111|  71.7k|                                    const auto after_colon = scan + 1;
 5112|  71.7k|                                    if ((after_colon == end ||
  ------------------
  |  Branch (5112:42): [True: 1.06k, False: 70.6k]
  ------------------
 5113|  70.6k|                                         yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
  ------------------
  |  Branch (5113:42): [True: 55.2k, False: 15.3k]
  ------------------
 5114|  56.3k|                                        indicator_indent <= line_indent) {
  ------------------
  |  Branch (5114:41): [True: 41.1k, False: 15.1k]
  ------------------
 5115|  41.1k|                                       key_node_end = line_start;
 5116|  41.1k|                                       break;
 5117|  41.1k|                                    }
 5118|  71.7k|                                 }
 5119|   591k|                              }
 5120|   126k|                           }
 5121|       |
 5122|   126k|                           glz::generic key_node{};
 5123|   126k|                           const bool prev_explicit_mapping_key_context = ctx.explicit_mapping_key_context;
 5124|   126k|                           ctx.explicit_mapping_key_context = true;
 5125|   126k|                           from<YAML, glz::generic>::template op<Opts>(key_node, ctx, key_node_it, key_node_end);
 5126|   126k|                           ctx.explicit_mapping_key_context = prev_explicit_mapping_key_context;
 5127|   126k|                           if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5127:32): [True: 1.02k, False: 125k]
  ------------------
 5128|  1.02k|                              return false;
 5129|   125k|                           it = key_node_it;
 5130|   125k|                           if (!to_string_key(key_node)) [[unlikely]]
  ------------------
  |  Branch (5130:32): [True: 8, False: 125k]
  ------------------
 5131|      8|                              return false;
 5132|   125k|                        }
 5133|       |                     }
 5134|       |                     else {
 5135|       |                        if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 5136|       |                           from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5137|       |                           if (bool(ctx.error)) [[unlikely]]
 5138|       |                              return false;
 5139|       |                        }
 5140|       |                     }
 5141|       |
 5142|   246k|                     yaml::skip_inline_ws(it, end);
 5143|   247k|                     yaml::skip_comment(it, end);
 5144|       |
 5145|       |                     // Value indicator may appear on the next line at the same indent.
 5146|   247k|                     if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (5146:26): [True: 212k, False: 35.4k]
  |  Branch (5146:40): [True: 11.8k, False: 200k]
  |  Branch (5146:55): [True: 24.2k, False: 176k]
  ------------------
 5147|  36.0k|                        auto probe = it;
 5148|  36.0k|                        bool found_value_indicator = false;
 5149|       |
 5150|  46.3k|                        while (probe != end && (*probe == '\n' || *probe == '\r')) {
  ------------------
  |  Branch (5150:32): [True: 42.6k, False: 3.69k]
  |  Branch (5150:49): [True: 14.3k, False: 28.2k]
  |  Branch (5150:67): [True: 28.2k, False: 1]
  ------------------
 5151|  42.6k|                           yaml::skip_newline(probe, end);
 5152|       |
 5153|  42.6k|                           auto value_line = probe;
 5154|  42.6k|                           int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5155|  42.6k|                           if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5155:32): [True: 5, False: 42.6k]
  ------------------
 5156|      5|                              return false;
 5157|       |
 5158|  42.6k|                           if (value_line == end || *value_line == '\n' || *value_line == '\r') {
  ------------------
  |  Branch (5158:32): [True: 3.22k, False: 39.4k]
  |  Branch (5158:53): [True: 1.11k, False: 38.3k]
  |  Branch (5158:76): [True: 2.58k, False: 35.7k]
  ------------------
 5159|  6.92k|                              probe = value_line;
 5160|  6.92k|                              continue; // blank line
 5161|  6.92k|                           }
 5162|  35.7k|                           if (*value_line == '#') {
  ------------------
  |  Branch (5162:32): [True: 3.35k, False: 32.3k]
  ------------------
 5163|  3.35k|                              yaml::skip_comment(value_line, end);
 5164|  3.35k|                              probe = value_line;
 5165|  3.35k|                              continue; // comment-only line
 5166|  3.35k|                           }
 5167|  32.3k|                           if (*value_line == ':' && value_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (5167:32): [True: 19.2k, False: 13.0k]
  |  Branch (5167:54): [True: 12.0k, False: 7.21k]
  ------------------
 5168|  12.0k|                              it = value_line;
 5169|  12.0k|                              found_value_indicator = true;
 5170|  12.0k|                           }
 5171|  32.3k|                           break;
 5172|  35.7k|                        }
 5173|       |
 5174|  36.0k|                        if (found_value_indicator) {
  ------------------
  |  Branch (5174:29): [True: 12.0k, False: 23.9k]
  ------------------
 5175|  12.0k|                           yaml::skip_inline_ws(it, end);
 5176|  12.0k|                        }
 5177|  36.0k|                     }
 5178|       |
 5179|   247k|                     val_t val{};
 5180|   247k|                     if (it != end && *it == ':') {
  ------------------
  |  Branch (5180:26): [True: 212k, False: 35.4k]
  |  Branch (5180:39): [True: 155k, False: 57.4k]
  ------------------
 5181|   155k|                        ++it;
 5182|   155k|                        if (it != end && *it == '\t') {
  ------------------
  |  Branch (5182:29): [True: 154k, False: 513]
  |  Branch (5182:42): [True: 2, False: 154k]
  ------------------
 5183|      2|                           ctx.error = error_code::syntax_error;
 5184|      2|                           return false;
 5185|      2|                        }
 5186|   155k|                        if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (5186:29): [True: 154k, False: 513]
  |  Branch (5186:43): [True: 2.59k, False: 151k]
  |  Branch (5186:58): [True: 118k, False: 32.9k]
  ------------------
 5187|   121k|                           auto probe = it;
 5188|   121k|                           yaml::skip_newline(probe, end);
 5189|   168k|                           while (probe != end && *probe == ' ') ++probe;
  ------------------
  |  Branch (5189:35): [True: 166k, False: 1.88k]
  |  Branch (5189:51): [True: 47.1k, False: 119k]
  ------------------
 5190|   121k|                           if (probe != end && *probe == ':' && ((probe + 1) != end) && *(probe + 1) == '\t') {
  ------------------
  |  Branch (5190:32): [True: 119k, False: 1.88k]
  |  Branch (5190:48): [True: 36.8k, False: 82.8k]
  |  Branch (5190:65): [True: 36.3k, False: 558]
  |  Branch (5190:89): [True: 2, False: 36.3k]
  ------------------
 5191|      2|                              ctx.error = error_code::syntax_error;
 5192|      2|                              return false;
 5193|      2|                           }
 5194|   121k|                        }
 5195|   155k|                        yaml::skip_inline_ws(it, end);
 5196|   155k|                        if (!parse_map_value(val)) [[unlikely]]
  ------------------
  |  Branch (5196:29): [True: 242, False: 154k]
  ------------------
 5197|    242|                           return false;
 5198|   155k|                     }
 5199|       |
 5200|   247k|                     value.emplace(std::move(key), std::move(val));
 5201|   247k|                     return true;
 5202|   247k|                  }
 5203|       |
 5204|   252k|                  key_t key{};
 5205|   252k|                  if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5206|   252k|                     auto key_probe = it;
 5207|   252k|                     yaml::skip_inline_ws(key_probe, end);
 5208|   252k|                     const bool complex_flow_key = (key_probe != end && (*key_probe == '[' || *key_probe == '{'));
  ------------------
  |  Branch (5208:53): [True: 252k, False: 0]
  |  Branch (5208:74): [True: 1.45k, False: 250k]
  |  Branch (5208:95): [True: 522, False: 250k]
  ------------------
 5209|   252k|                     if (complex_flow_key) {
  ------------------
  |  Branch (5209:26): [True: 1.97k, False: 250k]
  ------------------
 5210|  1.97k|                        glz::generic key_node{};
 5211|  1.97k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 5212|  1.97k|                        if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5212:29): [True: 702, False: 1.27k]
  ------------------
 5213|    702|                           return false;
 5214|  1.27k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (5214:29): [True: 2, False: 1.27k]
  ------------------
 5215|      2|                           return false;
 5216|  1.27k|                     }
 5217|   250k|                     else {
 5218|   250k|                        if (!yaml::parse_yaml_key(key, ctx, it, end, false)) {
  ------------------
  |  Branch (5218:29): [True: 318, False: 250k]
  ------------------
 5219|    318|                           return false;
 5220|    318|                        }
 5221|   250k|                     }
 5222|       |                  }
 5223|       |                  else {
 5224|       |                     from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5225|       |                     if (bool(ctx.error)) [[unlikely]]
 5226|       |                        return false;
 5227|       |                  }
 5228|       |
 5229|   251k|                  yaml::skip_inline_ws(it, end);
 5230|       |
 5231|   252k|                  if (it == end || *it != ':') {
  ------------------
  |  Branch (5231:23): [True: 1.20k, False: 251k]
  |  Branch (5231:36): [True: 189, False: 250k]
  ------------------
 5232|    373|                     ctx.error = error_code::syntax_error;
 5233|    373|                     return false;
 5234|    373|                  }
 5235|   251k|                  ++it;
 5236|   251k|                  yaml::skip_inline_ws(it, end);
 5237|       |
 5238|   251k|                  val_t val{};
 5239|   251k|                  if (!parse_map_value(val)) [[unlikely]]
  ------------------
  |  Branch (5239:23): [True: 7.72k, False: 244k]
  ------------------
 5240|  7.72k|                     return false;
 5241|       |
 5242|   244k|                  value.emplace(std::move(key), std::move(val));
 5243|   244k|                  return true;
 5244|   251k|               });
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlvE_clEv:
 5065|   247k|                        const bool key_content_spans_lines = [&] {
 5066|   247k|                           auto scan = key_it;
 5067|   259k|                           while (scan != content && scan != end) {
  ------------------
  |  Branch (5067:35): [True: 226k, False: 33.9k]
  |  Branch (5067:54): [True: 226k, False: 0]
  ------------------
 5068|   226k|                              if (*scan == '\n' || *scan == '\r') return true;
  ------------------
  |  Branch (5068:35): [True: 54.1k, False: 171k]
  |  Branch (5068:52): [True: 159k, False: 12.0k]
  ------------------
 5069|  12.0k|                              ++scan;
 5070|  12.0k|                           }
 5071|  33.9k|                           return false;
 5072|   247k|                        }();
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E0_clESS_:
 5008|   125k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   125k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   125k|                        };
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E_clESS_:
 4928|   405k|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|   405k|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (4929:26): [True: 400k, False: 5.25k]
  |  Branch (4929:39): [True: 183k, False: 216k]
  ------------------
 4930|   183k|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|   183k|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|   183k|                           if (ctx.stream_begin) {
  ------------------
  |  Branch (4937:32): [True: 183k, False: 0]
  ------------------
 4938|   183k|                              auto is_line_content_start = [&](auto pos) {
 4939|   183k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   183k|                              };
 4941|       |
 4942|   183k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   183k|                                 const char* line = ctx.line_begin_of(pos);
 4944|   183k|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|   183k|                                 return line != end && *line == ':';
 4946|   183k|                              };
 4947|       |
 4948|   183k|                              if (!is_line_content_start(it) &&
  ------------------
  |  Branch (4948:35): [True: 183k, False: 0]
  ------------------
 4949|   183k|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
  ------------------
  |  Branch (4949:35): [True: 19.0k, False: 164k]
  ------------------
 4950|  19.0k|                                  !line_has_explicit_value_indicator(it)) {
  ------------------
  |  Branch (4950:35): [True: 516, False: 18.5k]
  ------------------
 4951|    516|                                 ctx.error = error_code::syntax_error;
 4952|    516|                                 return false;
 4953|    516|                              }
 4954|   183k|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|   183k|                           }
 4956|   183k|                        }
 4957|       |
 4958|   183k|                        if (*it == '-' &&
  ------------------
  |  Branch (4958:29): [True: 4.72k, False: 179k]
  ------------------
 4959|  4.72k|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
  ------------------
  |  Branch (4959:30): [True: 306, False: 4.42k]
  |  Branch (4959:49): [True: 2.44k, False: 1.98k]
  ------------------
 4960|  2.74k|                            !line_starts_with_explicit_value_indicator) {
  ------------------
  |  Branch (4960:29): [True: 14, False: 2.73k]
  ------------------
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|     14|                           ctx.error = error_code::syntax_error;
 4963|     14|                           return false;
 4964|     14|                        }
 4965|       |
 4966|   183k|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
  ------------------
  |  Branch (4966:29): [True: 0, False: 183k]
  ------------------
 4967|      0|                           return false;
 4968|   183k|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|   183k|                        ctx.pop_indent();
 4970|   183k|                     }
 4971|   221k|                     else {
 4972|   221k|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|   221k|                        if (nested_indent >= 0) {
  ------------------
  |  Branch (4973:29): [True: 26.6k, False: 195k]
  ------------------
 4974|  26.6k|                           yaml::skip_to_content(it, end);
 4975|  26.6k|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
  ------------------
  |  Branch (4975:32): [True: 26.6k, False: 0]
  |  Branch (4975:45): [True: 0, False: 26.6k]
  |  Branch (4975:59): [True: 0, False: 0]
  |  Branch (4975:78): [True: 0, False: 0]
  ------------------
 4976|      0|                              ctx.error = error_code::syntax_error;
 4977|      0|                              return false;
 4978|      0|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|  26.6k|                           const int32_t value_indent =
 4982|  26.6k|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
  ------------------
  |  Branch (4982:31): [Folded, False: 26.6k]
  ------------------
 4983|  26.6k|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
  ------------------
  |  Branch (4983:32): [True: 0, False: 26.6k]
  ------------------
 4984|      0|                              return false;
 4985|  26.6k|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|  26.6k|                           ctx.pop_indent();
 4987|  26.6k|                        }
 4988|   221k|                     }
 4989|   405k|                     return !bool(ctx.error);
 4990|   405k|                  };
_ZZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E_clESS_ENKUlSN_E_clISA_EEDaSN_:
 4938|   183k|                              auto is_line_content_start = [&](auto pos) {
 4939|   183k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   183k|                              };
_ZZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E_clESS_ENKUlSN_E0_clISA_EEDaSN_:
 4942|   202k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   202k|                                 const char* line = ctx.line_begin_of(pos);
 4944|   462k|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
  ------------------
  |  Branch (4944:41): [True: 462k, False: 0]
  |  Branch (4944:57): [True: 258k, False: 203k]
  |  Branch (4944:73): [True: 586, False: 202k]
  ------------------
 4945|   202k|                                 return line != end && *line == ':';
  ------------------
  |  Branch (4945:41): [True: 202k, False: 0]
  |  Branch (4945:56): [True: 119k, False: 82.7k]
  ------------------
 4946|   202k|                              };
_ZN3glz4yaml26detect_nested_value_indentINS0_12yaml_contextEPKcS4_EEiRT_RT0_T1_i:
 3521|  1.79M|      {
 3522|  1.79M|         skip_ws_and_comment(it, end);
 3523|  1.79M|         if (it == end || (*it != '\n' && *it != '\r')) {
  ------------------
  |  Branch (3523:14): [True: 104k, False: 1.68M]
  |  Branch (3523:28): [True: 1.25M, False: 438k]
  |  Branch (3523:43): [True: 144, False: 1.25M]
  ------------------
 3524|   104k|            return -1;
 3525|   104k|         }
 3526|  1.68M|         skip_newline(it, end);
 3527|  1.68M|         auto content_start = it;
 3528|       |
 3529|       |         // Peek ahead to find the first content line (skip blank/comment lines)
 3530|  1.68M|         auto peek = it;
 3531|  2.04M|         while (peek != end) {
  ------------------
  |  Branch (3531:17): [True: 1.94M, False: 99.3k]
  ------------------
 3532|  1.94M|            if (*peek == '\n' || *peek == '\r') {
  ------------------
  |  Branch (3532:17): [True: 66.1k, False: 1.88M]
  |  Branch (3532:34): [True: 110k, False: 1.77M]
  ------------------
 3533|   176k|               skip_newline(peek, end);
 3534|   176k|            }
 3535|  1.77M|            else if (*peek == '#') {
  ------------------
  |  Branch (3535:22): [True: 52.8k, False: 1.71M]
  ------------------
 3536|  52.8k|               skip_comment(peek, end);
 3537|  52.8k|            }
 3538|  1.71M|            else if (*peek == ' ') {
  ------------------
  |  Branch (3538:22): [True: 630k, False: 1.08M]
  ------------------
 3539|   630k|               auto line_start = peek;
 3540|  4.77M|               while (peek != end && *peek == ' ') ++peek;
  ------------------
  |  Branch (3540:23): [True: 4.75M, False: 12.8k]
  |  Branch (3540:38): [True: 4.14M, False: 617k]
  ------------------
 3541|   630k|               if (peek == end || *peek == '\n' || *peek == '\r') {
  ------------------
  |  Branch (3541:20): [True: 12.8k, False: 617k]
  |  Branch (3541:35): [True: 9.89k, False: 607k]
  |  Branch (3541:52): [True: 15.5k, False: 591k]
  ------------------
 3542|  38.3k|                  continue; // blank line with trailing spaces
 3543|  38.3k|               }
 3544|   591k|               if (*peek == '#') {
  ------------------
  |  Branch (3544:20): [True: 17.5k, False: 574k]
  ------------------
 3545|  17.5k|                  skip_comment(peek, end);
 3546|  17.5k|                  continue; // comment-only line
 3547|  17.5k|               }
 3548|       |               // YAML allows node properties to appear on standalone lines before the
 3549|       |               // actual node value, for example:
 3550|       |               //   key:
 3551|       |               //     !tag
 3552|       |               //     &anchor
 3553|       |               //     actual: value
 3554|       |               // This loop recognizes chains of properties (`!tag`, `&anchor`, optional
 3555|       |               // inline spaces/comments) and treats those lines as non-content so they do
 3556|       |               // not incorrectly define nested indentation.
 3557|   574k|               {
 3558|   574k|                  auto prop = peek;
 3559|   574k|                  bool saw_property = false;
 3560|   759k|                  while (prop != end) {
  ------------------
  |  Branch (3560:26): [True: 758k, False: 906]
  ------------------
 3561|   758k|                     if (*prop == '!') {
  ------------------
  |  Branch (3561:26): [True: 19.9k, False: 738k]
  ------------------
 3562|  19.9k|                        const auto tag = parse_yaml_tag(prop, end, ctx);
 3563|  19.9k|                        if (tag == yaml_tag::unknown) break;
  ------------------
  |  Branch (3563:29): [True: 318, False: 19.5k]
  ------------------
 3564|  19.5k|                        saw_property = true;
 3565|  19.5k|                        skip_inline_ws(prop, end);
 3566|  19.5k|                        continue;
 3567|  19.9k|                     }
 3568|   738k|                     if (*prop == '&') {
  ------------------
  |  Branch (3568:26): [True: 168k, False: 570k]
  ------------------
 3569|   168k|                        ++prop;
 3570|   168k|                        auto aname = parse_anchor_name(prop, end);
 3571|   168k|                        if (aname.empty()) break;
  ------------------
  |  Branch (3571:29): [True: 2.24k, False: 165k]
  ------------------
 3572|   165k|                        saw_property = true;
 3573|   165k|                        skip_inline_ws(prop, end);
 3574|   165k|                        continue;
 3575|   168k|                     }
 3576|   570k|                     break;
 3577|   738k|                  }
 3578|   574k|                  if (saw_property) {
  ------------------
  |  Branch (3578:23): [True: 91.6k, False: 482k]
  ------------------
 3579|  91.6k|                     auto tail = prop;
 3580|  91.6k|                     skip_inline_ws(tail, end);
 3581|  91.6k|                     if (tail == end || *tail == '\n' || *tail == '\r' || *tail == '#') {
  ------------------
  |  Branch (3581:26): [True: 1.13k, False: 90.5k]
  |  Branch (3581:41): [True: 31.0k, False: 59.4k]
  |  Branch (3581:58): [True: 36.7k, False: 22.7k]
  |  Branch (3581:75): [True: 3.54k, False: 19.1k]
  ------------------
 3582|  72.4k|                        if (tail != end && *tail == '#') {
  ------------------
  |  Branch (3582:29): [True: 71.3k, False: 1.13k]
  |  Branch (3582:44): [True: 3.54k, False: 67.8k]
  ------------------
 3583|  3.54k|                           skip_comment(tail, end);
 3584|  3.54k|                        }
 3585|  72.4k|                        if (tail != end && (*tail == '\n' || *tail == '\r')) {
  ------------------
  |  Branch (3585:29): [True: 71.1k, False: 1.35k]
  |  Branch (3585:45): [True: 33.1k, False: 38.0k]
  |  Branch (3585:62): [True: 37.6k, False: 414]
  ------------------
 3586|  70.7k|                           skip_newline(tail, end);
 3587|  70.7k|                        }
 3588|  72.4k|                        peek = tail;
 3589|  72.4k|                        continue;
 3590|  72.4k|                     }
 3591|  91.6k|                  }
 3592|   574k|               }
 3593|   501k|               peek = line_start; // content found, restore to measure properly
 3594|   501k|               break;
 3595|   574k|            }
 3596|  1.08M|            else {
 3597|  1.08M|               break; // content at column 0
 3598|  1.08M|            }
 3599|  1.94M|         }
 3600|       |
 3601|       |         // Measure indent of the content line
 3602|  1.68M|         int32_t content_indent = measure_indent<false>(peek, end, ctx);
 3603|  1.68M|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3603:14): [True: 238, False: 1.68M]
  ------------------
 3604|    238|            return -1;
 3605|       |
 3606|       |         // Tabs in indentation-like positions are only allowed when they are plain
 3607|       |         // scalar content. Structural lines (mapping keys/entries) remain errors.
 3608|  1.68M|         if (peek != end && *peek == '\t') {
  ------------------
  |  Branch (3608:14): [True: 1.58M, False: 99.3k]
  |  Branch (3608:29): [True: 15.0k, False: 1.57M]
  ------------------
 3609|  15.0k|            auto probe = peek;
 3610|  52.6k|            while (probe != end && (*probe == ' ' || *probe == '\t')) ++probe;
  ------------------
  |  Branch (3610:20): [True: 52.3k, False: 286]
  |  Branch (3610:37): [True: 7.48k, False: 44.8k]
  |  Branch (3610:54): [True: 30.0k, False: 14.7k]
  ------------------
 3611|  15.0k|            if (probe != end && *probe != '\n' && *probe != '\r' && *probe != '#') {
  ------------------
  |  Branch (3611:17): [True: 14.7k, False: 286]
  |  Branch (3611:33): [True: 13.1k, False: 1.57k]
  |  Branch (3611:51): [True: 12.1k, False: 1.06k]
  |  Branch (3611:69): [True: 5.21k, False: 6.90k]
  ------------------
 3612|  5.21k|               const bool looks_sequence_entry =
 3613|  5.21k|                  (*probe == '-') &&
  ------------------
  |  Branch (3613:19): [True: 828, False: 4.38k]
  ------------------
 3614|    828|                  ((probe + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(probe + 1))]);
  ------------------
  |  Branch (3614:20): [True: 6, False: 822]
  |  Branch (3614:42): [True: 4, False: 818]
  ------------------
 3615|  5.21k|               const bool looks_explicit_entry =
 3616|  5.21k|                  (*probe == '?' || *probe == ':') &&
  ------------------
  |  Branch (3616:20): [True: 374, False: 4.84k]
  |  Branch (3616:37): [True: 380, False: 4.46k]
  ------------------
 3617|    754|                  ((probe + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(probe + 1))]);
  ------------------
  |  Branch (3617:20): [True: 20, False: 734]
  |  Branch (3617:42): [True: 8, False: 726]
  ------------------
 3618|  5.21k|               bool looks_mapping_key = false;
 3619|  5.21k|               auto scan = probe;
 3620|   543k|               while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (3620:23): [True: 540k, False: 2.59k]
  |  Branch (3620:38): [True: 539k, False: 890]
  |  Branch (3620:55): [True: 538k, False: 1.64k]
  ------------------
 3621|   538k|                  if (*scan == ':') {
  ------------------
  |  Branch (3621:23): [True: 1.45k, False: 536k]
  ------------------
 3622|  1.45k|                     const auto after = scan + 1;
 3623|  1.45k|                     if (after == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after)]) {
  ------------------
  |  Branch (3623:26): [True: 66, False: 1.38k]
  |  Branch (3623:42): [True: 22, False: 1.36k]
  ------------------
 3624|     88|                        looks_mapping_key = true;
 3625|     88|                        break;
 3626|     88|                     }
 3627|  1.45k|                  }
 3628|   538k|                  ++scan;
 3629|   538k|               }
 3630|  5.21k|               if (looks_sequence_entry || looks_explicit_entry || looks_mapping_key) {
  ------------------
  |  Branch (3630:20): [True: 10, False: 5.20k]
  |  Branch (3630:44): [True: 28, False: 5.17k]
  |  Branch (3630:68): [True: 64, False: 5.11k]
  ------------------
 3631|    102|                  ctx.error = error_code::syntax_error;
 3632|    102|                  return -1;
 3633|    102|               }
 3634|  5.21k|            }
 3635|  15.0k|         }
 3636|       |
 3637|  1.68M|         const int32_t effective_line_indent = (line_indent < 0) ? 0 : line_indent;
  ------------------
  |  Branch (3637:48): [True: 0, False: 1.68M]
  ------------------
 3638|  1.68M|         if (content_indent > effective_line_indent && peek != end && *peek != '\n' && *peek != '\r') {
  ------------------
  |  Branch (3638:14): [True: 354k, False: 1.33M]
  |  Branch (3638:56): [True: 354k, False: 0]
  |  Branch (3638:71): [True: 354k, False: 0]
  |  Branch (3638:88): [True: 354k, False: 0]
  ------------------
 3639|   354k|            it = content_start;
 3640|   354k|            return content_indent;
 3641|   354k|         }
 3642|       |
 3643|       |         // YAML allows "indentless sequences" as mapping values:
 3644|       |         // key:
 3645|       |         // - item
 3646|  1.33M|         if (content_indent == effective_line_indent && peek != end && *peek == '-') {
  ------------------
  |  Branch (3646:14): [True: 1.06M, False: 267k]
  |  Branch (3646:57): [True: 1.02M, False: 46.1k]
  |  Branch (3646:72): [True: 24.0k, False: 997k]
  ------------------
 3647|  24.0k|            const auto after_dash = peek + 1;
 3648|  24.0k|            if (after_dash == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_dash)]) {
  ------------------
  |  Branch (3648:17): [True: 320, False: 23.6k]
  |  Branch (3648:38): [True: 19.9k, False: 3.71k]
  ------------------
 3649|  20.3k|               it = content_start;
 3650|  20.3k|               return content_indent;
 3651|  20.3k|            }
 3652|  24.0k|         }
 3653|       |
 3654|  1.31M|         it = content_start;
 3655|  1.31M|         return -1;
 3656|  1.33M|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_EN19merge_restore_guardD2Ev:
 4696|   644k|            {
 4697|       |               // emplace is a no-op for keys the document already wrote, so only
 4698|       |               // untouched pre-existing entries are put back.
 4699|   644k|               for (auto& entry : saved) {
  ------------------
  |  Branch (4699:33): [True: 0, False: 644k]
  ------------------
 4700|      0|                  target.emplace(entry.first, std::move(entry.second));
 4701|      0|               }
 4702|   644k|            }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_21is_yaml_variant_arrayEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   119k|      {
 5356|   119k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   119k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   119k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   119k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   119k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 119k, False: 0]
  ------------------
 5366|   119k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   119k|      }
_ZN3glz4fromILj450ENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS1_9allocatorIS6_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS9_TkNS_10is_contextERNS_4yaml12yaml_contextESE_EEvOT1_OT2_OT0_T3_:
 4207|   123k|      {
 4208|   123k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4208:14): [True: 0, False: 123k]
  ------------------
 4209|      0|            return;
 4210|       |
 4211|       |         // Peek ahead to check for tag (don't consume indentation for block sequences)
 4212|   123k|         auto peek = it;
 4213|   123k|         yaml::node_preamble_state preamble{};
 4214|   123k|         if (yaml::parse_node_preamble<Opts>(value, ctx, peek, end, preamble,
  ------------------
  |  Branch (4214:14): [True: 6.94k, False: 117k]
  ------------------
 4215|   123k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_seq(tag); })) {
 4216|  6.94k|            it = peek;
 4217|  6.94k|            return;
 4218|  6.94k|         }
 4219|       |
 4220|       |         // A level of nesting, taken past the preamble as for sets above.
 4221|   117k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 4222|   117k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (4222:14): [True: 7, False: 117k]
  ------------------
 4223|      7|            return;
 4224|       |
 4225|   117k|         if (*peek == '[') {
  ------------------
  |  Branch (4225:14): [True: 48.4k, False: 68.5k]
  ------------------
 4226|       |            // Flow sequence - consume whitespace and parse
 4227|  48.4k|            it = peek;
 4228|  48.4k|            yaml::parse_flow_sequence<Opts>(value, ctx, it, end);
 4229|  48.4k|         }
 4230|  68.5k|         else if (*peek == '-') {
  ------------------
  |  Branch (4230:19): [True: 68.4k, False: 81]
  ------------------
 4231|       |            // Block sequence - don't consume leading whitespace, let parse_block_sequence handle it
 4232|       |            // But if there was a tag, we need to advance past it
 4233|  68.4k|            if (preamble.tag != yaml::yaml_tag::none || preamble.node_props.has_anchor) {
  ------------------
  |  Branch (4233:17): [True: 330, False: 68.1k]
  |  Branch (4233:57): [True: 1.27k, False: 66.8k]
  ------------------
 4234|  1.60k|               it = peek;
 4235|  1.60k|            }
 4236|  68.4k|            int32_t seq_indent = ctx.current_indent();
 4237|  68.4k|            if (*it == '-' && ctx.current_indent() >= 0) {
  ------------------
  |  Branch (4237:17): [True: 67.8k, False: 588]
  |  Branch (4237:31): [True: 34.4k, False: 33.4k]
  ------------------
 4238|  34.4k|               seq_indent = ctx.allow_indentless_sequence ? (ctx.current_indent() > 0 ? (ctx.current_indent() - 1) : 0)
  ------------------
  |  Branch (4238:29): [True: 6.64k, False: 27.8k]
  |  Branch (4238:62): [True: 5.50k, False: 1.14k]
  ------------------
 4239|  34.4k|                                                          : (ctx.current_indent() + 1);
 4240|  34.4k|            }
 4241|  68.4k|            yaml::parse_block_sequence<Opts>(value, ctx, it, end, seq_indent);
 4242|  68.4k|         }
 4243|     81|         else {
 4244|     81|            ctx.error = error_code::syntax_error;
 4245|     81|         }
 4246|       |
 4247|   117k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 4248|   117k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEELb0ERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS4_9allocatorIS9_EEEENS0_12yaml_contextEPKcSG_ZNS_4fromILj450ESC_E2opITnDaXtlS2_Lj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERSG_SD_TkNS_10is_contextERSE_SG_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSP_RSS_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   123k|      {
  475|   123k|         skip_inline_ws(it, end);
  476|       |
  477|   123k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 12, False: 123k]
  ------------------
  478|     12|            if constexpr (!AllowEmptyInput) {
  479|     12|               ctx.error = error_code::unexpected_end;
  480|     12|            }
  481|     12|            return true;
  482|     12|         }
  483|       |
  484|   123k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   123k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 2, False: 123k]
  ------------------
  486|      2|            ctx.error = error_code::syntax_error;
  487|      2|            return true;
  488|      2|         }
  489|   123k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 2, False: 123k]
  ------------------
  490|      2|            ctx.error = error_code::syntax_error;
  491|      2|            return true;
  492|      2|         }
  493|       |
  494|   123k|         skip_inline_ws(it, end);
  495|       |
  496|   123k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 5, False: 123k]
  ------------------
  497|      5|            if constexpr (!AllowEmptyInput) {
  498|      5|               ctx.error = error_code::unexpected_end;
  499|      5|            }
  500|      5|            return true;
  501|      5|         }
  502|       |
  503|   123k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 6.91k, False: 117k]
  ------------------
  504|  6.91k|            return true;
  505|  6.91k|         }
  506|       |
  507|   117k|         return false;
  508|   123k|      }
_ZZN3glz4fromILj450ENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS1_9allocatorIS6_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS9_TkNS_10is_contextERNS_4yaml12yaml_contextESE_EEvOT1_OT2_OT0_T3_ENKUlNSH_8yaml_tagEE_clESR_:
 4215|   123k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_seq(tag); })) {
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS4_9allocatorIS9_EEEENS0_12yaml_contextEPKcSG_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   123k|      {
  418|   123k|         state.has_anchor = false;
  419|   123k|         state.anchor_name.clear();
  420|   123k|         state.anchor_start = nullptr;
  421|   123k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   123k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|   123k|            else {
  430|   123k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 6.88k, False: 117k]
  ------------------
  431|   123k|            }
  432|   123k|         }
  433|       |
  434|   123k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 117k, False: 6.88k]
  |  Branch (434:27): [True: 2.56k, False: 114k]
  ------------------
  435|  2.56k|            ++it;
  436|  2.56k|            auto name = parse_anchor_name(it, end);
  437|  2.56k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 5, False: 2.55k]
  ------------------
  438|      5|               ctx.error = error_code::syntax_error;
  439|      5|               return true;
  440|      5|            }
  441|  2.55k|            skip_inline_ws(it, end);
  442|  2.55k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 25, False: 2.53k]
  ------------------
  443|     25|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     25|                  ctx.error = error_code::unexpected_end;
  445|     25|               }
  446|     25|               return true;
  447|     25|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  2.53k|            state.has_anchor = true;
  455|  2.53k|            state.anchor_name = std::string(name);
  456|  2.53k|            state.anchor_start = &*it;
  457|  2.53k|         }
  458|       |
  459|   123k|         return false;
  460|   123k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEbOT0_RT1_RT2_T3_:
  309|   123k|      {
  310|   123k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 123k]
  |  Branch (310:27): [True: 117k, False: 6.88k]
  ------------------
  311|       |
  312|  6.88k|         ++it; // skip '*'
  313|  6.88k|         auto name = parse_anchor_name(it, end);
  314|  6.88k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 12, False: 6.87k]
  ------------------
  315|     12|            ctx.error = error_code::syntax_error;
  316|     12|            return true;
  317|     12|         }
  318|       |
  319|  6.87k|         auto anchor_it = ctx.anchors.find(name);
  320|  6.87k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 19, False: 6.85k]
  ------------------
  321|     19|            ctx.error = error_code::syntax_error; // undefined alias
  322|     19|            return true;
  323|     19|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  6.85k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  6.85k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 1.86k, False: 4.99k]
  ------------------
  331|  1.86k|            return true;
  332|  1.86k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  4.99k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 7, False: 4.99k]
  ------------------
  338|      7|            ctx.error = error_code::syntax_error; // cyclic alias
  339|      7|            return true;
  340|      7|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  4.99k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  4.99k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 2, False: 4.98k]
  ------------------
  348|      2|            return true;
  349|       |
  350|  4.98k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 6, False: 4.98k]
  ------------------
  351|      6|            ctx.error = error_code::exceeded_max_expansion;
  352|      6|            ctx.custom_error_message = "alias expansion";
  353|      6|            return true;
  354|      6|         }
  355|       |
  356|  4.98k|         auto replay_it = span.begin;
  357|  4.98k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  4.98k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  4.98k|         ctx.indent_stack.clear();
  362|  4.98k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 1.59k, False: 3.38k]
  ------------------
  363|  1.59k|            ctx.push_indent(span.base_indent - 1);
  364|  1.59k|         }
  365|       |
  366|  4.98k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  4.98k|         using V = std::remove_cvref_t<T>;
  369|  4.98k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  4.98k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  4.98k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  4.98k|         return true;
  376|  4.98k|      }
_ZN3glz4yaml19parse_flow_sequenceITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_:
 2698|  48.4k|      {
 2699|  48.4k|         using V = std::remove_cvref_t<T>;
 2700|  48.4k|         using value_type = typename V::value_type;
 2701|       |
 2702|  48.4k|         struct sequence_container_adapter
 2703|  48.4k|         {
 2704|  48.4k|            size_t index = 0;
 2705|       |
 2706|  48.4k|            inline bool fixed_capacity_reached(const V& container) const noexcept
 2707|  48.4k|            {
 2708|  48.4k|               if constexpr (!resizable<V>) {
 2709|  48.4k|                  return index >= container.size();
 2710|  48.4k|               }
 2711|  48.4k|               else {
 2712|  48.4k|                  (void)container;
 2713|  48.4k|                  return false;
 2714|  48.4k|               }
 2715|  48.4k|            }
 2716|       |
 2717|  48.4k|            inline void commit_fixed_slot() noexcept { ++index; }
 2718|       |
 2719|  48.4k|            inline void append(V& container, value_type&& element) noexcept
 2720|  48.4k|            {
 2721|  48.4k|               if constexpr (emplace_backable<V>) {
 2722|  48.4k|                  container.emplace_back(std::move(element));
 2723|  48.4k|               }
 2724|  48.4k|               else if constexpr (emplaceable<V>) {
 2725|  48.4k|                  container.emplace(std::move(element));
 2726|  48.4k|               }
 2727|  48.4k|            }
 2728|  48.4k|         };
 2729|       |
 2730|  48.4k|         if (it == end || *it != '[') [[unlikely]] {
  ------------------
  |  Branch (2730:14): [True: 0, False: 48.4k]
  |  Branch (2730:27): [True: 0, False: 48.4k]
  ------------------
 2731|      0|            ctx.error = error_code::syntax_error;
 2732|      0|            return;
 2733|      0|         }
 2734|       |
 2735|       |         // Overwrite (do not append to) any pre-existing contents. Must happen
 2736|       |         // before the empty-array early return below so that `[]` also clears.
 2737|  48.4k|         clear_sequence_before_read<Opts>(value);
 2738|       |
 2739|  48.4k|         ++it; // Skip '['
 2740|       |         // Skip whitespace and newlines after opening bracket (YAML allows multi-line flow sequences)
 2741|  48.4k|         skip_flow_ws_and_newlines(ctx, it, end);
 2742|  48.4k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2742:14): [True: 15, False: 48.4k]
  ------------------
 2743|     15|            return;
 2744|       |
 2745|       |         // Handle empty array
 2746|  48.4k|         if (it != end && *it == ']') {
  ------------------
  |  Branch (2746:14): [True: 47.7k, False: 749]
  |  Branch (2746:27): [True: 11.2k, False: 36.4k]
  ------------------
 2747|  11.2k|            ++it;
 2748|  11.2k|            validate_flow_node_adjacent_tail(ctx, it, end);
 2749|  11.2k|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2749:17): [True: 26, False: 11.2k]
  ------------------
 2750|     26|               return;
 2751|       |            if constexpr (!yaml::check_flow_context(Opts)) {
 2752|       |               if (ctx.current_indent() < 0) {
 2753|       |                  validate_root_flow_tail_after_close(ctx, it, end);
 2754|       |               }
 2755|       |            }
 2756|  11.2k|            return;
 2757|  11.2k|         }
 2758|       |
 2759|  37.2k|         bool just_saw_comma = false;
 2760|  37.2k|         sequence_container_adapter adapter{};
 2761|       |
 2762|  37.2k|         if constexpr (emplace_backable<V> || emplaceable<V>) {
 2763|       |            // Dynamic containers append items (vector-like and set-like)
 2764|  62.8k|            while (it != end) {
  ------------------
  |  Branch (2764:20): [True: 61.9k, False: 875]
  ------------------
 2765|  61.9k|               skip_flow_ws_and_newlines(ctx, it, end);
 2766|  61.9k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2766:20): [True: 0, False: 61.9k]
  ------------------
 2767|      0|                  return;
 2768|       |
 2769|  61.9k|               if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2769:20): [True: 0, False: 61.9k]
  ------------------
 2770|      0|                  ctx.error = error_code::unexpected_end;
 2771|      0|                  return;
 2772|      0|               }
 2773|       |
 2774|  61.9k|               if (*it == ']') {
  ------------------
  |  Branch (2774:20): [True: 7.55k, False: 54.3k]
  ------------------
 2775|  7.55k|                  if (just_saw_comma) {
  ------------------
  |  Branch (2775:23): [True: 7.55k, False: 0]
  ------------------
 2776|  7.55k|                     ++it;
 2777|  7.55k|                     validate_flow_node_adjacent_tail(ctx, it, end);
 2778|  7.55k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2778:26): [True: 4, False: 7.54k]
  ------------------
 2779|      4|                        return;
 2780|       |                     if constexpr (!yaml::check_flow_context(Opts)) {
 2781|       |                        if (ctx.current_indent() < 0) {
 2782|       |                           validate_root_flow_tail_after_close(ctx, it, end);
 2783|       |                        }
 2784|       |                     }
 2785|  7.54k|                     return;
 2786|  7.55k|                  }
 2787|      0|                  ctx.error = error_code::syntax_error;
 2788|      0|                  return;
 2789|  7.55k|               }
 2790|       |
 2791|  54.3k|               if (*it == ',' || *it == '#') {
  ------------------
  |  Branch (2791:20): [True: 26, False: 54.3k]
  |  Branch (2791:34): [True: 16, False: 54.3k]
  ------------------
 2792|     42|                  ctx.error = error_code::syntax_error;
 2793|     42|                  return;
 2794|     42|               }
 2795|  54.3k|               just_saw_comma = false;
 2796|       |
 2797|  54.3k|               value_type element{};
 2798|  54.3k|               from<YAML, value_type>::template op<flow_context_on<Opts>()>(element, ctx, it, end);
 2799|       |
 2800|  54.3k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2800:20): [True: 6.71k, False: 47.6k]
  ------------------
 2801|  6.71k|                  return;
 2802|       |
 2803|  47.6k|               bool saw_line_break_before_separator = false;
 2804|  47.6k|               skip_flow_ws_and_newlines(ctx, it, end, &saw_line_break_before_separator);
 2805|  47.6k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2805:20): [True: 10, False: 47.6k]
  ------------------
 2806|     10|                  return;
 2807|       |
 2808|  47.6k|               if (it != end && *it == ':') {
  ------------------
  |  Branch (2808:20): [True: 46.8k, False: 760]
  |  Branch (2808:33): [True: 8.15k, False: 38.7k]
  ------------------
 2809|       |                  // In flow sequences, implicit key-value pairs must be on a single line.
 2810|  8.15k|                  if (saw_line_break_before_separator) {
  ------------------
  |  Branch (2810:23): [True: 16, False: 8.13k]
  ------------------
 2811|     16|                     ctx.error = error_code::syntax_error;
 2812|     16|                     return;
 2813|     16|                  }
 2814|  8.13k|                  if constexpr (std::same_as<std::remove_cvref_t<value_type>, glz::generic>) {
 2815|  8.13k|                     glz::generic key_node = std::move(element);
 2816|  8.13k|                     ++it;
 2817|  8.13k|                     skip_inline_ws(it, end);
 2818|       |
 2819|  8.13k|                     glz::generic mapped{};
 2820|  8.13k|                     from<YAML, glz::generic>::template op<flow_context_on<Opts>()>(mapped, ctx, it, end);
 2821|  8.13k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2821:26): [True: 477, False: 7.65k]
  ------------------
 2822|    477|                        return;
 2823|       |
 2824|  7.65k|                     std::string key;
 2825|  7.65k|                     if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (2825:26): [True: 2, False: 7.65k]
  ------------------
 2826|      2|                        return;
 2827|       |
 2828|  7.65k|                     glz::generic pair{};
 2829|  7.65k|                     pair[key] = std::move(mapped);
 2830|  7.65k|                     element = std::move(pair);
 2831|       |
 2832|  7.65k|                     skip_flow_ws_and_newlines(ctx, it, end);
 2833|  7.65k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2833:26): [True: 0, False: 7.65k]
  ------------------
 2834|      0|                        return;
 2835|       |                  }
 2836|       |                  else {
 2837|       |                     ctx.error = error_code::syntax_error;
 2838|       |                     return;
 2839|       |                  }
 2840|  8.13k|               }
 2841|       |
 2842|  47.6k|               adapter.append(value, std::move(element));
 2843|       |
 2844|  47.6k|               if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2844:20): [True: 795, False: 46.8k]
  ------------------
 2845|    795|                  ctx.error = error_code::unexpected_end;
 2846|    795|                  return;
 2847|    795|               }
 2848|       |
 2849|  46.8k|               if (*it == ']') {
  ------------------
  |  Branch (2849:20): [True: 20.3k, False: 26.5k]
  ------------------
 2850|  20.3k|                  ++it;
 2851|  20.3k|                  validate_flow_node_adjacent_tail(ctx, it, end);
 2852|  20.3k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2852:23): [True: 18, False: 20.2k]
  ------------------
 2853|     18|                     return;
 2854|       |                  if constexpr (!yaml::check_flow_context(Opts)) {
 2855|       |                     if (ctx.current_indent() < 0) {
 2856|       |                        validate_root_flow_tail_after_close(ctx, it, end);
 2857|       |                     }
 2858|       |                  }
 2859|  20.2k|                  return;
 2860|  20.3k|               }
 2861|  26.5k|               else if (*it == ',') {
  ------------------
  |  Branch (2861:25): [True: 25.6k, False: 905]
  ------------------
 2862|  25.6k|                  ++it;
 2863|  25.6k|                  just_saw_comma = true;
 2864|  25.6k|                  skip_flow_ws_and_newlines(ctx, it, end);
 2865|  25.6k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2865:23): [True: 5, False: 25.6k]
  ------------------
 2866|      5|                     return;
 2867|  25.6k|               }
 2868|    905|               else {
 2869|    905|                  ctx.error = error_code::syntax_error;
 2870|    905|                  return;
 2871|    905|               }
 2872|  46.8k|            }
 2873|       |         }
 2874|       |         else if constexpr (!resizable<V>) {
 2875|       |            // Fixed-size containers (std::array)
 2876|       |            while (it != end) {
 2877|       |               skip_flow_ws_and_newlines(ctx, it, end);
 2878|       |               if (bool(ctx.error)) [[unlikely]]
 2879|       |                  return;
 2880|       |
 2881|       |               if (it == end) [[unlikely]] {
 2882|       |                  ctx.error = error_code::unexpected_end;
 2883|       |                  return;
 2884|       |               }
 2885|       |
 2886|       |               if (*it == ']') {
 2887|       |                  if (just_saw_comma) {
 2888|       |                     ++it;
 2889|       |                     validate_flow_node_adjacent_tail(ctx, it, end);
 2890|       |                     if (bool(ctx.error)) [[unlikely]]
 2891|       |                        return;
 2892|       |                     if constexpr (!yaml::check_flow_context(Opts)) {
 2893|       |                        if (ctx.current_indent() < 0) {
 2894|       |                           validate_root_flow_tail_after_close(ctx, it, end);
 2895|       |                        }
 2896|       |                     }
 2897|       |                     return;
 2898|       |                  }
 2899|       |                  ctx.error = error_code::syntax_error;
 2900|       |                  return;
 2901|       |               }
 2902|       |
 2903|       |               if (*it == ',' || *it == '#') {
 2904|       |                  ctx.error = error_code::syntax_error;
 2905|       |                  return;
 2906|       |               }
 2907|       |               just_saw_comma = false;
 2908|       |
 2909|       |               // An item beyond the last slot is an error, as in JSON.
 2910|       |               if (adapter.fixed_capacity_reached(value)) [[unlikely]] {
 2911|       |                  ctx.error = error_code::exceeded_static_array_size;
 2912|       |                  return;
 2913|       |               }
 2914|       |
 2915|       |               from<YAML, value_type>::template op<flow_context_on<Opts>()>(value[adapter.index], ctx, it, end);
 2916|       |
 2917|       |               if (bool(ctx.error)) [[unlikely]]
 2918|       |                  return;
 2919|       |
 2920|       |               adapter.commit_fixed_slot();
 2921|       |               skip_flow_ws_and_newlines(ctx, it, end);
 2922|       |               if (bool(ctx.error)) [[unlikely]]
 2923|       |                  return;
 2924|       |
 2925|       |               if (it == end) [[unlikely]] {
 2926|       |                  ctx.error = error_code::unexpected_end;
 2927|       |                  return;
 2928|       |               }
 2929|       |
 2930|       |               if (*it == ']') {
 2931|       |                  ++it;
 2932|       |                  validate_flow_node_adjacent_tail(ctx, it, end);
 2933|       |                  if (bool(ctx.error)) [[unlikely]]
 2934|       |                     return;
 2935|       |                  if constexpr (!yaml::check_flow_context(Opts)) {
 2936|       |                     if (ctx.current_indent() < 0) {
 2937|       |                        validate_root_flow_tail_after_close(ctx, it, end);
 2938|       |                     }
 2939|       |                  }
 2940|       |                  return;
 2941|       |               }
 2942|       |               else if (*it == ',') {
 2943|       |                  ++it;
 2944|       |                  just_saw_comma = true;
 2945|       |                  skip_flow_ws_and_newlines(ctx, it, end);
 2946|       |                  if (bool(ctx.error)) [[unlikely]]
 2947|       |                     return;
 2948|       |               }
 2949|       |               else {
 2950|       |                  ctx.error = error_code::syntax_error;
 2951|       |                  return;
 2952|       |               }
 2953|       |            }
 2954|       |         }
 2955|       |         else {
 2956|       |            ctx.error = error_code::syntax_error;
 2957|       |            return;
 2958|       |         }
 2959|  37.2k|      }
_ZN3glz4yaml26clear_sequence_before_readITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEEEEvRT0_:
 2682|   116k|      {
 2683|   116k|         if constexpr (emplace_backable<V> && requires { value.clear(); }) {
 2684|       |            // vector-like: honor the append_arrays option, matching json/read.hpp
 2685|   116k|            if constexpr (!check_append_arrays(Opts)) {
 2686|   116k|               value.clear();
 2687|   116k|            }
 2688|       |         }
 2689|       |         else if constexpr (emplaceable<V> && requires { value.clear(); }) {
 2690|       |            // set-like: json/read.hpp clears unconditionally; append_arrays does not apply
 2691|       |            value.clear();
 2692|       |         }
 2693|   116k|      }
_ZZN3glz4yaml19parse_flow_sequenceITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_EN26sequence_container_adapter6appendESC_OS8_:
 2720|  47.1k|            {
 2721|  47.1k|               if constexpr (emplace_backable<V>) {
 2722|  47.1k|                  container.emplace_back(std::move(element));
 2723|       |               }
 2724|       |               else if constexpr (emplaceable<V>) {
 2725|       |                  container.emplace(std::move(element));
 2726|       |               }
 2727|  47.1k|            }
_ZN3glz4yaml20parse_block_sequenceITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_i:
 3186|  68.4k|      {
 3187|  68.4k|         using V = std::remove_cvref_t<T>;
 3188|  68.4k|         using value_type = typename V::value_type;
 3189|       |
 3190|  68.4k|         struct sequence_container_adapter
 3191|  68.4k|         {
 3192|  68.4k|            size_t index = 0;
 3193|       |
 3194|  68.4k|            inline bool fixed_capacity_reached(const V& container) const noexcept
 3195|  68.4k|            {
 3196|  68.4k|               if constexpr (!resizable<V>) {
 3197|  68.4k|                  return index >= container.size();
 3198|  68.4k|               }
 3199|  68.4k|               else {
 3200|  68.4k|                  (void)container;
 3201|  68.4k|                  return false;
 3202|  68.4k|               }
 3203|  68.4k|            }
 3204|       |
 3205|  68.4k|            inline void commit_fixed_slot() noexcept { ++index; }
 3206|       |
 3207|  68.4k|            inline void append(V& container, value_type&& element) noexcept
 3208|  68.4k|            {
 3209|  68.4k|               if constexpr (emplace_backable<V>) {
 3210|  68.4k|                  container.emplace_back(std::move(element));
 3211|  68.4k|               }
 3212|  68.4k|               else if constexpr (emplaceable<V>) {
 3213|  68.4k|                  container.emplace(std::move(element));
 3214|  68.4k|               }
 3215|  68.4k|            }
 3216|  68.4k|         };
 3217|       |
 3218|       |         // Overwrite (do not append to) any pre-existing contents. A block
 3219|       |         // sequence is only entered once a '-' item is confirmed, so clearing
 3220|       |         // up front correctly (re)assigns the container to the parsed sequence.
 3221|  68.4k|         clear_sequence_before_read<Opts>(value);
 3222|       |
 3223|  68.4k|         sequence_container_adapter adapter{};
 3224|       |
 3225|       |         // Track if this is the first item (for handling whitespace-consumed case)
 3226|  68.4k|         bool first_item = true;
 3227|  68.4k|         bool has_pending_item_anchor = false;
 3228|  68.4k|         std::string pending_item_anchor_name{};
 3229|  68.4k|         int32_t pending_item_anchor_indent = sequence_indent;
 3230|       |
 3231|   183k|         while (it != end) {
  ------------------
  |  Branch (3231:17): [True: 164k, False: 19.1k]
  ------------------
 3232|       |            // Skip blank lines and comments, track indent
 3233|   164k|            int32_t line_indent = 0;
 3234|   164k|            int32_t dash_col = -1; // actual column of the '-' on the line
 3235|   164k|            auto line_start = it;
 3236|       |
 3237|   232k|            while (it != end) {
  ------------------
  |  Branch (3237:20): [True: 224k, False: 8.11k]
  ------------------
 3238|   224k|               if (*it == '#') {
  ------------------
  |  Branch (3238:20): [True: 13.6k, False: 210k]
  ------------------
 3239|  13.6k|                  skip_comment(it, end);
 3240|  13.6k|                  skip_newline(it, end);
 3241|  13.6k|                  line_start = it;
 3242|  13.6k|                  line_indent = 0;
 3243|  13.6k|               }
 3244|   210k|               else if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3244:25): [True: 19.1k, False: 191k]
  |  Branch (3244:40): [True: 19.9k, False: 171k]
  ------------------
 3245|  39.1k|                  skip_newline(it, end);
 3246|  39.1k|                  line_start = it;
 3247|  39.1k|                  line_indent = 0;
 3248|  39.1k|               }
 3249|   171k|               else if (*it == ' ') {
  ------------------
  |  Branch (3249:25): [True: 17.3k, False: 154k]
  ------------------
 3250|  17.3k|                  line_start = it;
 3251|  17.3k|                  line_indent = 0;
 3252|   383k|                  while (it != end && *it == ' ') {
  ------------------
  |  Branch (3252:26): [True: 382k, False: 733]
  |  Branch (3252:39): [True: 365k, False: 16.5k]
  ------------------
 3253|   365k|                     ++line_indent;
 3254|   365k|                     ++it;
 3255|   365k|                  }
 3256|       |
 3257|  17.3k|                  bool saw_tab = false;
 3258|  21.8k|                  while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3258:26): [True: 20.7k, False: 1.12k]
  |  Branch (3258:40): [True: 2.62k, False: 18.0k]
  |  Branch (3258:54): [True: 1.90k, False: 16.1k]
  ------------------
 3259|  4.52k|                     saw_tab = saw_tab || (*it == '\t');
  ------------------
  |  Branch (3259:32): [True: 2.89k, False: 1.62k]
  |  Branch (3259:43): [True: 1.62k, False: 0]
  ------------------
 3260|  4.52k|                     ++it;
 3261|  4.52k|                  }
 3262|       |
 3263|  17.3k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3263:23): [True: 1.12k, False: 16.1k]
  |  Branch (3263:36): [True: 3.77k, False: 12.3k]
  |  Branch (3263:51): [True: 3.43k, False: 8.96k]
  |  Branch (3263:66): [True: 1.82k, False: 7.14k]
  ------------------
 3264|       |                     // Blank or comment line - continue to next line
 3265|  10.1k|                     if (it != end && *it == '#') {
  ------------------
  |  Branch (3265:26): [True: 9.03k, False: 1.12k]
  |  Branch (3265:39): [True: 1.82k, False: 7.21k]
  ------------------
 3266|  1.82k|                        skip_comment(it, end);
 3267|  1.82k|                     }
 3268|  10.1k|                     line_indent = 0;
 3269|  10.1k|                     continue;
 3270|  10.1k|                  }
 3271|       |
 3272|  7.14k|                  if (saw_tab) {
  ------------------
  |  Branch (3272:23): [True: 7, False: 7.13k]
  ------------------
 3273|      7|                     ctx.error = error_code::syntax_error;
 3274|      7|                     return;
 3275|      7|                  }
 3276|  7.13k|                  break; // Found content
 3277|  7.14k|               }
 3278|   154k|               else if (*it == '\t') {
  ------------------
  |  Branch (3278:25): [True: 5.33k, False: 148k]
  ------------------
 3279|  5.33k|                  line_start = it;
 3280|  13.5k|                  while (it != end && (*it == ' ' || *it == '\t')) ++it;
  ------------------
  |  Branch (3280:26): [True: 12.2k, False: 1.27k]
  |  Branch (3280:40): [True: 968, False: 11.3k]
  |  Branch (3280:54): [True: 7.24k, False: 4.05k]
  ------------------
 3281|  5.33k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3281:23): [True: 1.27k, False: 4.05k]
  |  Branch (3281:36): [True: 867, False: 3.19k]
  |  Branch (3281:51): [True: 1.33k, False: 1.85k]
  |  Branch (3281:66): [True: 1.84k, False: 12]
  ------------------
 3282|  5.32k|                     if (it != end && *it == '#') {
  ------------------
  |  Branch (3282:26): [True: 4.04k, False: 1.27k]
  |  Branch (3282:39): [True: 1.84k, False: 2.20k]
  ------------------
 3283|  1.84k|                        skip_comment(it, end);
 3284|  1.84k|                     }
 3285|  5.32k|                     line_indent = 0;
 3286|  5.32k|                     continue;
 3287|  5.32k|                  }
 3288|     12|                  ctx.error = error_code::syntax_error;
 3289|     12|                  return;
 3290|  5.33k|               }
 3291|   148k|               else {
 3292|       |                  // At content (no leading space on this line)
 3293|       |                  // If first item and at '-', whitespace was consumed by caller;
 3294|       |                  // treat as having correct indentation
 3295|   148k|                  if (first_item && *it == '-') {
  ------------------
  |  Branch (3295:23): [True: 68.4k, False: 80.3k]
  |  Branch (3295:37): [True: 67.8k, False: 587]
  ------------------
 3296|  67.8k|                     line_indent = sequence_indent;
 3297|  67.8k|                     if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3298|  67.8k|                        if (ctx.stream_begin && it > ctx.stream_begin) {
  ------------------
  |  Branch (3298:29): [True: 67.8k, False: 0]
  |  Branch (3298:49): [True: 67.8k, False: 0]
  ------------------
 3299|  67.8k|                           auto probe = it;
 3300|  67.8k|                           int32_t leading_ws = 0;
 3301|  67.8k|                           bool saw_tab = false;
 3302|   165k|                           while (probe > ctx.stream_begin && (*(probe - 1) == ' ' || *(probe - 1) == '\t')) {
  ------------------
  |  Branch (3302:35): [True: 165k, False: 0]
  |  Branch (3302:64): [True: 89.9k, False: 75.4k]
  |  Branch (3302:87): [True: 7.62k, False: 67.8k]
  ------------------
 3303|  97.6k|                              --probe;
 3304|  97.6k|                              ++leading_ws;
 3305|  97.6k|                              saw_tab = saw_tab || (*probe == '\t');
  ------------------
  |  Branch (3305:41): [True: 781, False: 96.8k]
  |  Branch (3305:52): [True: 7.08k, False: 89.7k]
  ------------------
 3306|  97.6k|                           }
 3307|  67.8k|                           if (probe == ctx.stream_begin || *(probe - 1) == '\n' || *(probe - 1) == '\r') {
  ------------------
  |  Branch (3307:32): [True: 0, False: 67.8k]
  |  Branch (3307:61): [True: 4.07k, False: 63.8k]
  |  Branch (3307:85): [True: 16.7k, False: 47.0k]
  ------------------
 3308|  20.8k|                              if (saw_tab) {
  ------------------
  |  Branch (3308:35): [True: 2, False: 20.8k]
  ------------------
 3309|      2|                                 ctx.error = error_code::syntax_error;
 3310|      2|                                 return;
 3311|      2|                              }
 3312|  20.8k|                              line_indent = (std::max)(line_indent, leading_ws);
 3313|  20.8k|                           }
 3314|  67.8k|                        }
 3315|  67.8k|                     }
 3316|  67.8k|                  }
 3317|  67.8k|                  break;
 3318|   148k|               }
 3319|   224k|            }
 3320|       |
 3321|   164k|            if (it == end) break;
  ------------------
  |  Branch (3321:17): [True: 8.11k, False: 155k]
  ------------------
 3322|       |
 3323|       |            // Check for document end marker
 3324|   155k|            if (at_document_end(it, end)) break;
  ------------------
  |  Branch (3324:17): [True: 2.65k, False: 153k]
  ------------------
 3325|       |
 3326|       |            // Check for dedent
 3327|   153k|            if (line_indent < sequence_indent) {
  ------------------
  |  Branch (3327:17): [True: 15.3k, False: 137k]
  ------------------
 3328|  15.3k|               it = line_start;
 3329|  15.3k|               return;
 3330|  15.3k|            }
 3331|       |
 3332|   137k|            if (*it == '&') {
  ------------------
  |  Branch (3332:17): [True: 5.27k, False: 132k]
  ------------------
 3333|       |               // Standalone anchor lines before "- item" are only supported for
 3334|       |               // indentless mapping values. At top-level block sequences these are
 3335|       |               // malformed in yaml-test-suite cases.
 3336|  5.27k|               if (!ctx.allow_indentless_sequence) {
  ------------------
  |  Branch (3336:20): [True: 6, False: 5.26k]
  ------------------
 3337|      6|                  ctx.error = error_code::syntax_error;
 3338|      6|                  return;
 3339|      6|               }
 3340|       |
 3341|  5.26k|               ++it;
 3342|  5.26k|               auto pending_name = parse_anchor_name(it, end);
 3343|  5.26k|               if (pending_name.empty()) {
  ------------------
  |  Branch (3343:20): [True: 17, False: 5.24k]
  ------------------
 3344|     17|                  ctx.error = error_code::syntax_error;
 3345|     17|                  return;
 3346|     17|               }
 3347|  5.24k|               skip_inline_ws(it, end);
 3348|  5.24k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (3348:20): [True: 5.21k, False: 36]
  |  Branch (3348:33): [True: 705, False: 4.50k]
  ------------------
 3349|    705|                  skip_comment(it, end);
 3350|    705|               }
 3351|       |
 3352|  5.24k|               has_pending_item_anchor = true;
 3353|  5.24k|               pending_item_anchor_name = std::string(pending_name);
 3354|  5.24k|               pending_item_anchor_indent = line_indent;
 3355|       |
 3356|  5.24k|               if (it == end || (*it != '\n' && *it != '\r')) {
  ------------------
  |  Branch (3356:20): [True: 48, False: 5.19k]
  |  Branch (3356:34): [True: 3.06k, False: 2.13k]
  |  Branch (3356:49): [True: 25, False: 3.03k]
  ------------------
 3357|     73|                  ctx.error = error_code::syntax_error;
 3358|     73|                  return;
 3359|     73|               }
 3360|       |
 3361|  5.17k|               skip_newline(it, end);
 3362|  5.17k|               continue;
 3363|  5.24k|            }
 3364|       |
 3365|       |            // Expect dash for sequence item
 3366|   132k|            if (*it != '-') {
  ------------------
  |  Branch (3366:17): [True: 18.8k, False: 113k]
  ------------------
 3367|  18.8k|               it = line_start;
 3368|  18.8k|               return;
 3369|  18.8k|            }
 3370|       |
 3371|       |            // Compute the actual column of this sequence dash.
 3372|       |            // This is needed by plain-scalar multiline folding to distinguish
 3373|       |            // sibling "- item" entries from deeper "- " continuation content.
 3374|   113k|            dash_col = line_indent;
 3375|   113k|            if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3376|   113k|               if (ctx.stream_begin) {
  ------------------
  |  Branch (3376:20): [True: 113k, False: 2]
  ------------------
 3377|   113k|                  dash_col = ctx.line_prefix_before(&*it).column;
 3378|   113k|               }
 3379|   113k|            }
 3380|       |
 3381|   113k|            ++it; // Skip '-'
 3382|       |
 3383|       |            // Check for valid sequence item indicator (- followed by space or newline)
 3384|   113k|            if (it != end && !yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (3384:17): [True: 111k, False: 2.64k]
  |  Branch (3384:30): [True: 3.66k, False: 107k]
  ------------------
 3385|       |               // Not a sequence item (could be a number like -5)
 3386|  3.66k|               it = line_start;
 3387|  3.66k|               return;
 3388|  3.66k|            }
 3389|       |
 3390|   110k|            bool saw_tab_after_dash = false;
 3391|   246k|            while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3391:20): [True: 243k, False: 3.32k]
  |  Branch (3391:34): [True: 125k, False: 117k]
  |  Branch (3391:48): [True: 10.6k, False: 106k]
  ------------------
 3392|   136k|               saw_tab_after_dash = saw_tab_after_dash || (*it == '\t');
  ------------------
  |  Branch (3392:37): [True: 1.54k, False: 134k]
  |  Branch (3392:59): [True: 10.1k, False: 124k]
  ------------------
 3393|   136k|               ++it;
 3394|   136k|            }
 3395|       |            // A tab-separated nested "- " marker is not valid block indentation.
 3396|   110k|            if (saw_tab_after_dash && it != end && *it == '-') {
  ------------------
  |  Branch (3396:17): [True: 10.1k, False: 100k]
  |  Branch (3396:39): [True: 9.70k, False: 413]
  |  Branch (3396:52): [True: 272, False: 9.43k]
  ------------------
 3397|    272|               const auto after_dash = it + 1;
 3398|    272|               if (after_dash == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_dash)]) {
  ------------------
  |  Branch (3398:20): [True: 3, False: 269]
  |  Branch (3398:41): [True: 2, False: 267]
  ------------------
 3399|      5|                  ctx.error = error_code::syntax_error;
 3400|      5|                  return;
 3401|      5|               }
 3402|    272|            }
 3403|       |
 3404|       |            // Get reference to element to parse into
 3405|   110k|            auto parse_element = [&](auto& element) {
 3406|   110k|               const char* element_start = (it != end) ? &*it : nullptr;
 3407|       |
 3408|       |               // Check what follows
 3409|   110k|               if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 3410|       |                  // Content on same line as dash - set indent to one less than content column
 3411|       |                  // This allows nested block mappings to continue parsing keys at the content indent
 3412|       |                  // For "- key: val", if dash is at column 0, content is at column 2
 3413|       |                  // We set parent indent to 1 so keys at column 2 pass the "indent > parent" check
 3414|   110k|                  if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 3415|   110k|                     return;
 3416|   110k|                  const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3417|   110k|                  const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3418|   110k|                  ctx.sequence_item_value_context = true;
 3419|   110k|                  ctx.sequence_dash_indent = dash_col;
 3420|   110k|                  from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3421|   110k|                  ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3422|   110k|                  ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3423|   110k|                  ctx.pop_indent();
 3424|   110k|               }
 3425|   110k|               else {
 3426|       |                  // Value on next line - nested block
 3427|   110k|                  skip_ws_and_comment(it, end);
 3428|   110k|                  skip_newline(it, end);
 3429|       |
 3430|       |                  // Get indent of nested content
 3431|   110k|                  auto nested_start = it;
 3432|   110k|                  int32_t nested_indent = measure_indent(it, end, ctx);
 3433|   110k|                  if (bool(ctx.error)) [[unlikely]]
 3434|   110k|                     return;
 3435|   110k|                  it = nested_start;
 3436|       |
 3437|       |                  // Content is nested only if indented more than the current line.
 3438|       |                  // When line_indent is negative (root level), use 0 as the baseline.
 3439|       |                  // This prevents content at column 0 from being treated as nested.
 3440|   110k|                  const int32_t effective_line_indent = (line_indent < 0) ? 0 : line_indent;
 3441|   110k|                  if (nested_indent > effective_line_indent) {
 3442|       |                     // Save and set indent for nested parsing.
 3443|       |                     // A struct element reads the pushed indent as its own key column; every
 3444|       |                     // other element type reads it as the enclosing baseline, so it gets one
 3445|       |                     // less than the content indent and its content passes "indent > parent".
 3446|   110k|                     const int32_t element_indent =
 3447|   110k|                        receives_block_mapping_column<value_type>() ? nested_indent : nested_indent - 1;
 3448|   110k|                     if (!ctx.push_indent(element_indent)) [[unlikely]]
 3449|   110k|                        return;
 3450|   110k|                     const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3451|   110k|                     const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3452|   110k|                     ctx.sequence_item_value_context = true;
 3453|   110k|                     ctx.sequence_dash_indent = dash_col;
 3454|   110k|                     from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3455|   110k|                     ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3456|   110k|                     ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3457|   110k|                     ctx.pop_indent();
 3458|   110k|                  }
 3459|       |                  // else: empty element (default constructed)
 3460|   110k|               }
 3461|       |
 3462|   110k|               if (has_pending_item_anchor && !bool(ctx.error)) {
 3463|   110k|                  const char* element_end = (it != end) ? &*it : element_start;
 3464|   110k|                  ctx.anchors[std::move(pending_item_anchor_name)] = {element_start, element_end,
 3465|   110k|                                                                      pending_item_anchor_indent};
 3466|   110k|                  has_pending_item_anchor = false;
 3467|   110k|               }
 3468|   110k|            };
 3469|       |
 3470|   110k|            if constexpr (emplace_backable<V>) {
 3471|   110k|               auto& element = value.emplace_back();
 3472|   110k|               parse_element(element);
 3473|       |            }
 3474|       |            else if constexpr (emplaceable<V>) {
 3475|       |               value_type element{};
 3476|       |               parse_element(element);
 3477|       |               if (!bool(ctx.error)) {
 3478|       |                  adapter.append(value, std::move(element));
 3479|       |               }
 3480|       |            }
 3481|       |            else if constexpr (!resizable<V>) {
 3482|       |               // Fixed-size (e.g. std::array): an item beyond the last slot is an error, as in JSON.
 3483|       |               // Checked only once another item is confirmed, so a full container still ends cleanly.
 3484|       |               if (adapter.fixed_capacity_reached(value)) [[unlikely]] {
 3485|       |                  ctx.error = error_code::exceeded_static_array_size;
 3486|       |                  return;
 3487|       |               }
 3488|       |               parse_element(value[adapter.index]);
 3489|       |               adapter.commit_fixed_slot();
 3490|       |            }
 3491|       |            else {
 3492|       |               ctx.error = error_code::syntax_error;
 3493|       |               return;
 3494|       |            }
 3495|       |
 3496|   110k|            first_item = false;
 3497|       |
 3498|   110k|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3498:17): [True: 545, False: 109k]
  ------------------
 3499|    545|               return;
 3500|       |
 3501|       |            // Note: after parsing nested block content, iterator may already be
 3502|       |            // at the start of the next line. The outer loop will handle it.
 3503|   110k|         }
 3504|  68.4k|      }
_ZZN3glz4yaml20parse_block_sequenceITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_iENKUlRT_E_clIS8_EEDaSO_:
 3405|   110k|            auto parse_element = [&](auto& element) {
 3406|   110k|               const char* element_start = (it != end) ? &*it : nullptr;
  ------------------
  |  Branch (3406:44): [True: 106k, False: 3.31k]
  ------------------
 3407|       |
 3408|       |               // Check what follows
 3409|   110k|               if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (3409:20): [True: 106k, False: 3.31k]
  |  Branch (3409:33): [True: 52.6k, False: 54.1k]
  ------------------
 3410|       |                  // Content on same line as dash - set indent to one less than content column
 3411|       |                  // This allows nested block mappings to continue parsing keys at the content indent
 3412|       |                  // For "- key: val", if dash is at column 0, content is at column 2
 3413|       |                  // We set parent indent to 1 so keys at column 2 pass the "indent > parent" check
 3414|  52.6k|                  if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
  ------------------
  |  Branch (3414:23): [True: 0, False: 52.6k]
  ------------------
 3415|      0|                     return;
 3416|  52.6k|                  const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3417|  52.6k|                  const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3418|  52.6k|                  ctx.sequence_item_value_context = true;
 3419|  52.6k|                  ctx.sequence_dash_indent = dash_col;
 3420|  52.6k|                  from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3421|  52.6k|                  ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3422|  52.6k|                  ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3423|  52.6k|                  ctx.pop_indent();
 3424|  52.6k|               }
 3425|  57.4k|               else {
 3426|       |                  // Value on next line - nested block
 3427|  57.4k|                  skip_ws_and_comment(it, end);
 3428|  57.4k|                  skip_newline(it, end);
 3429|       |
 3430|       |                  // Get indent of nested content
 3431|  57.4k|                  auto nested_start = it;
 3432|  57.4k|                  int32_t nested_indent = measure_indent(it, end, ctx);
 3433|  57.4k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3433:23): [True: 3, False: 57.4k]
  ------------------
 3434|      3|                     return;
 3435|  57.4k|                  it = nested_start;
 3436|       |
 3437|       |                  // Content is nested only if indented more than the current line.
 3438|       |                  // When line_indent is negative (root level), use 0 as the baseline.
 3439|       |                  // This prevents content at column 0 from being treated as nested.
 3440|  57.4k|                  const int32_t effective_line_indent = (line_indent < 0) ? 0 : line_indent;
  ------------------
  |  Branch (3440:57): [True: 2.51k, False: 54.9k]
  ------------------
 3441|  57.4k|                  if (nested_indent > effective_line_indent) {
  ------------------
  |  Branch (3441:23): [True: 5.28k, False: 52.2k]
  ------------------
 3442|       |                     // Save and set indent for nested parsing.
 3443|       |                     // A struct element reads the pushed indent as its own key column; every
 3444|       |                     // other element type reads it as the enclosing baseline, so it gets one
 3445|       |                     // less than the content indent and its content passes "indent > parent".
 3446|  5.28k|                     const int32_t element_indent =
 3447|  5.28k|                        receives_block_mapping_column<value_type>() ? nested_indent : nested_indent - 1;
  ------------------
  |  Branch (3447:25): [Folded, False: 5.28k]
  ------------------
 3448|  5.28k|                     if (!ctx.push_indent(element_indent)) [[unlikely]]
  ------------------
  |  Branch (3448:26): [True: 0, False: 5.28k]
  ------------------
 3449|      0|                        return;
 3450|  5.28k|                     const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3451|  5.28k|                     const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3452|  5.28k|                     ctx.sequence_item_value_context = true;
 3453|  5.28k|                     ctx.sequence_dash_indent = dash_col;
 3454|  5.28k|                     from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3455|  5.28k|                     ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3456|  5.28k|                     ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3457|  5.28k|                     ctx.pop_indent();
 3458|  5.28k|                  }
 3459|       |                  // else: empty element (default constructed)
 3460|  57.4k|               }
 3461|       |
 3462|   110k|               if (has_pending_item_anchor && !bool(ctx.error)) {
  ------------------
  |  Branch (3462:20): [True: 926, False: 109k]
  |  Branch (3462:47): [True: 799, False: 127]
  ------------------
 3463|    799|                  const char* element_end = (it != end) ? &*it : element_start;
  ------------------
  |  Branch (3463:45): [True: 530, False: 269]
  ------------------
 3464|    799|                  ctx.anchors[std::move(pending_item_anchor_name)] = {element_start, element_end,
 3465|    799|                                                                      pending_item_anchor_indent};
 3466|    799|                  has_pending_item_anchor = false;
 3467|    799|               }
 3468|   110k|            };
_ZN3glz29parse_block_mapping_or_stringINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_RNS_4yaml12yaml_contextERPKcSO_EEvOT1_OT2_OT3_T4_:
 5575|   344k|   {
 5576|   344k|      if constexpr (yaml::check_flow_context(Opts)) {
 5577|       |         // In flow context, only treat plain content as an implicit "key: value"
 5578|       |         // when a mapping separator appears before the next top-level flow delimiter.
 5579|   344k|         auto could_be_implicit_flow_pair = [&](auto pos) {
 5580|       |            // Bounded by the longest implicit key the spec allows: unbounded, this probe runs
 5581|       |            // once per entry per nesting level over the whole remaining flow collection.
 5582|   344k|            const auto stop = yaml::implicit_key_scan_end(pos, end);
 5583|       |            // See `line_could_be_block_mapping` for why a quote is an indicator only where a node
 5584|       |            // can begin. Brackets need no such guard here: ns-plain-safe-in keeps them out of a
 5585|       |            // flow-context plain scalar, so every one of them is an indicator.
 5586|   344k|            bool at_node_start = true;
 5587|   344k|            int depth = 0;
 5588|   344k|            while (pos != stop) {
 5589|   344k|               const char c = *pos;
 5590|   344k|               if (c == ' ' || c == '\t') {
 5591|   344k|                  ++pos;
 5592|   344k|                  continue;
 5593|   344k|               }
 5594|   344k|               const bool node_start = std::exchange(at_node_start, false);
 5595|       |
 5596|   344k|               if ((c == '"' || c == '\'') && node_start) {
 5597|   344k|                  if (not yaml::skip_probe_quoted_scalar(pos, stop)) return false;
 5598|   344k|                  continue;
 5599|   344k|               }
 5600|   344k|               if (c == '[' || c == '{') {
 5601|   344k|                  ++depth;
 5602|   344k|                  at_node_start = true;
 5603|   344k|                  ++pos;
 5604|   344k|                  continue;
 5605|   344k|               }
 5606|   344k|               if (c == ']' || c == '}') {
 5607|   344k|                  if (depth == 0) return false;
 5608|   344k|                  --depth;
 5609|   344k|                  ++pos;
 5610|   344k|                  continue;
 5611|   344k|               }
 5612|   344k|               if (c == ',' && depth == 0) return false;
 5613|   344k|               if (c == ':' && depth == 0) {
 5614|   344k|                  auto next = pos + 1;
 5615|   344k|                  return next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
 5616|   344k|               }
 5617|       |               // Inside a nested collection ',' separates entries and ':' ends a key.
 5618|   344k|               if (c == ',' || c == ':') {
 5619|   344k|                  at_node_start = true;
 5620|   344k|                  ++pos;
 5621|   344k|                  continue;
 5622|   344k|               }
 5623|   344k|               if (node_start && yaml::skip_probe_node_property(pos, stop)) {
 5624|   344k|                  at_node_start = true;
 5625|   344k|                  continue;
 5626|   344k|               }
 5627|   344k|               ++pos;
 5628|   344k|            }
 5629|   344k|            return false;
 5630|   344k|         };
 5631|       |
 5632|   344k|         if (could_be_implicit_flow_pair(it) || line_could_be_flow_mapping(it, end)) {
  ------------------
  |  Branch (5632:14): [True: 152k, False: 191k]
  |  Branch (5632:49): [True: 3.92k, False: 187k]
  ------------------
 5633|   156k|            if (try_parse_block_mapping_into_variant<Variant, Opts>(value, ctx, it, end)) {
  ------------------
  |  Branch (5633:17): [True: 133k, False: 22.8k]
  ------------------
 5634|   133k|               return;
 5635|   133k|            }
 5636|  22.8k|            if (bool(ctx.error)) {
  ------------------
  |  Branch (5636:17): [True: 3.80k, False: 19.0k]
  ------------------
 5637|  3.80k|               return;
 5638|  3.80k|            }
 5639|  22.8k|         }
 5640|       |
 5641|   206k|         process_yaml_variant_alternatives<Variant, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 5642|   206k|         return;
 5643|   344k|      }
 5644|       |
 5645|   344k|      if (try_parse_block_mapping_into_variant<Variant, Opts>(value, ctx, it, end)) {
  ------------------
  |  Branch (5645:11): [True: 0, False: 344k]
  ------------------
 5646|      0|         return;
 5647|      0|      }
 5648|       |      // If an error was set (e.g., malformed flow collection in value), don't try to parse as string
 5649|   344k|      if (bool(ctx.error)) {
  ------------------
  |  Branch (5649:11): [True: 0, False: 344k]
  ------------------
 5650|      0|         return;
 5651|      0|      }
 5652|   344k|      process_yaml_variant_alternatives<Variant, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 5653|   344k|   }
_ZZN3glz29parse_block_mapping_or_stringINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_RNS_4yaml12yaml_contextERPKcSO_EEvOT1_OT2_OT3_T4_ENKUlT_E_clISO_EEDaSX_:
 5579|   344k|         auto could_be_implicit_flow_pair = [&](auto pos) {
 5580|       |            // Bounded by the longest implicit key the spec allows: unbounded, this probe runs
 5581|       |            // once per entry per nesting level over the whole remaining flow collection.
 5582|   344k|            const auto stop = yaml::implicit_key_scan_end(pos, end);
 5583|       |            // See `line_could_be_block_mapping` for why a quote is an indicator only where a node
 5584|       |            // can begin. Brackets need no such guard here: ns-plain-safe-in keeps them out of a
 5585|       |            // flow-context plain scalar, so every one of them is an indicator.
 5586|   344k|            bool at_node_start = true;
 5587|   344k|            int depth = 0;
 5588|  5.06M|            while (pos != stop) {
  ------------------
  |  Branch (5588:20): [True: 5.02M, False: 36.8k]
  ------------------
 5589|  5.02M|               const char c = *pos;
 5590|  5.02M|               if (c == ' ' || c == '\t') {
  ------------------
  |  Branch (5590:20): [True: 807k, False: 4.21M]
  |  Branch (5590:32): [True: 79.6k, False: 4.13M]
  ------------------
 5591|   887k|                  ++pos;
 5592|   887k|                  continue;
 5593|   887k|               }
 5594|  4.13M|               const bool node_start = std::exchange(at_node_start, false);
 5595|       |
 5596|  4.13M|               if ((c == '"' || c == '\'') && node_start) {
  ------------------
  |  Branch (5596:21): [True: 40.9k, False: 4.09M]
  |  Branch (5596:33): [True: 9.39k, False: 4.08M]
  |  Branch (5596:47): [True: 25.2k, False: 25.0k]
  ------------------
 5597|  25.2k|                  if (not yaml::skip_probe_quoted_scalar(pos, stop)) return false;
  ------------------
  |  Branch (5597:23): [True: 5.43k, False: 19.8k]
  ------------------
 5598|  19.8k|                  continue;
 5599|  25.2k|               }
 5600|  4.11M|               if (c == '[' || c == '{') {
  ------------------
  |  Branch (5600:20): [True: 136k, False: 3.97M]
  |  Branch (5600:32): [True: 41.4k, False: 3.93M]
  ------------------
 5601|   177k|                  ++depth;
 5602|   177k|                  at_node_start = true;
 5603|   177k|                  ++pos;
 5604|   177k|                  continue;
 5605|   177k|               }
 5606|  3.93M|               if (c == ']' || c == '}') {
  ------------------
  |  Branch (5606:20): [True: 46.3k, False: 3.88M]
  |  Branch (5606:32): [True: 36.2k, False: 3.85M]
  ------------------
 5607|  82.5k|                  if (depth == 0) return false;
  ------------------
  |  Branch (5607:23): [True: 31.7k, False: 50.8k]
  ------------------
 5608|  50.8k|                  --depth;
 5609|  50.8k|                  ++pos;
 5610|  50.8k|                  continue;
 5611|  82.5k|               }
 5612|  3.85M|               if (c == ',' && depth == 0) return false;
  ------------------
  |  Branch (5612:20): [True: 219k, False: 3.63M]
  |  Branch (5612:32): [True: 79.9k, False: 139k]
  ------------------
 5613|  3.77M|               if (c == ':' && depth == 0) {
  ------------------
  |  Branch (5613:20): [True: 261k, False: 3.50M]
  |  Branch (5613:32): [True: 190k, False: 71.6k]
  ------------------
 5614|   190k|                  auto next = pos + 1;
 5615|   190k|                  return next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
  ------------------
  |  Branch (5615:26): [True: 2.40k, False: 187k]
  |  Branch (5615:41): [True: 96.0k, False: 91.8k]
  |  Branch (5615:57): [True: 12.4k, False: 79.3k]
  |  Branch (5615:74): [True: 9.38k, False: 69.9k]
  |  Branch (5615:91): [True: 32.2k, False: 37.7k]
  ------------------
 5616|   190k|               }
 5617|       |               // Inside a nested collection ',' separates entries and ':' ends a key.
 5618|  3.58M|               if (c == ',' || c == ':') {
  ------------------
  |  Branch (5618:20): [True: 139k, False: 3.44M]
  |  Branch (5618:32): [True: 71.6k, False: 3.36M]
  ------------------
 5619|   211k|                  at_node_start = true;
 5620|   211k|                  ++pos;
 5621|   211k|                  continue;
 5622|   211k|               }
 5623|  3.36M|               if (node_start && yaml::skip_probe_node_property(pos, stop)) {
  ------------------
  |  Branch (5623:20): [True: 504k, False: 2.86M]
  |  Branch (5623:34): [True: 39.4k, False: 464k]
  ------------------
 5624|  39.4k|                  at_node_start = true;
 5625|  39.4k|                  continue;
 5626|  39.4k|               }
 5627|  3.33M|               ++pos;
 5628|  3.33M|            }
 5629|  36.8k|            return false;
 5630|   344k|         };
_ZN3glz26line_could_be_flow_mappingIPKcS2_EEbT_T0_:
 5443|  5.97M|   {
 5444|  5.97M|      const auto stop = yaml::implicit_key_scan_end(it, end);
 5445|  5.97M|      int flow_depth = 0;
 5446|       |      // See `line_could_be_block_mapping` for why the quote guard is the state of the node rather
 5447|       |      // than the preceding character.
 5448|  5.97M|      bool at_node_start = true;
 5449|  5.97M|      bool prev_was_whitespace = true;
 5450|  5.97M|      bool key_supports_adjacent_value = false;
 5451|       |
 5452|  60.2M|      while (it != stop) {
  ------------------
  |  Branch (5452:14): [True: 60.1M, False: 123k]
  ------------------
 5453|  60.1M|         const char c = *it;
 5454|  60.1M|         if (c == '\n' || c == '\r') {
  ------------------
  |  Branch (5454:14): [True: 398k, False: 59.7M]
  |  Branch (5454:27): [True: 307k, False: 59.4M]
  ------------------
 5455|   705k|            return false;
 5456|   705k|         }
 5457|  59.4M|         if (c == ' ' || c == '\t') {
  ------------------
  |  Branch (5457:14): [True: 2.34M, False: 57.1M]
  |  Branch (5457:26): [True: 312k, False: 56.7M]
  ------------------
 5458|  2.65M|            prev_was_whitespace = true;
 5459|  2.65M|            key_supports_adjacent_value = false; // "Adjacent" admits no separation at all
 5460|  2.65M|            ++it;
 5461|  2.65M|            continue;
 5462|  2.65M|         }
 5463|  56.7M|         if (flow_depth == 0 && (c == ',' || c == ']' || c == '}')) {
  ------------------
  |  Branch (5463:14): [True: 47.6M, False: 9.12M]
  |  Branch (5463:34): [True: 3.19M, False: 44.4M]
  |  Branch (5463:46): [True: 93.1k, False: 44.3M]
  |  Branch (5463:58): [True: 144k, False: 44.2M]
  ------------------
 5464|  3.42M|            return false;
 5465|  3.42M|         }
 5466|       |         // As in `line_could_be_block_mapping`, content clears both flags and a branch opts back in.
 5467|  53.3M|         const bool after_whitespace = std::exchange(prev_was_whitespace, false);
 5468|  53.3M|         const bool node_start = std::exchange(at_node_start, false);
 5469|  53.3M|         const bool adjacent_value_ok = std::exchange(key_supports_adjacent_value, false);
 5470|       |
 5471|  53.3M|         if (c == '#' && flow_depth == 0 && after_whitespace) {
  ------------------
  |  Branch (5471:14): [True: 500k, False: 52.8M]
  |  Branch (5471:26): [True: 472k, False: 27.7k]
  |  Branch (5471:45): [True: 127k, False: 344k]
  ------------------
 5472|   127k|            return false;
 5473|   127k|         }
 5474|  53.2M|         if ((c == '"' || c == '\'') && node_start) {
  ------------------
  |  Branch (5474:15): [True: 960k, False: 52.2M]
  |  Branch (5474:27): [True: 73.2k, False: 52.1M]
  |  Branch (5474:41): [True: 692k, False: 341k]
  ------------------
 5475|   692k|            if (not yaml::skip_probe_quoted_scalar(it, stop)) {
  ------------------
  |  Branch (5475:17): [True: 46.7k, False: 646k]
  ------------------
 5476|  46.7k|               return false;
 5477|  46.7k|            }
 5478|   646k|            key_supports_adjacent_value = true;
 5479|   646k|            continue;
 5480|   692k|         }
 5481|  52.5M|         if (c == '[' || c == '{') {
  ------------------
  |  Branch (5481:14): [True: 318k, False: 52.2M]
  |  Branch (5481:26): [True: 188k, False: 52.0M]
  ------------------
 5482|   507k|            ++flow_depth;
 5483|   507k|            at_node_start = true;
 5484|   507k|            ++it;
 5485|   507k|            continue;
 5486|   507k|         }
 5487|  52.0M|         if (c == ']' || c == '}') {
  ------------------
  |  Branch (5487:14): [True: 89.3k, False: 51.9M]
  |  Branch (5487:26): [True: 45.6k, False: 51.8M]
  ------------------
 5488|   134k|            --flow_depth; // Depth zero returned above, so this closes a collection we opened
 5489|   134k|            if (flow_depth == 0) {
  ------------------
  |  Branch (5489:17): [True: 97.4k, False: 37.5k]
  ------------------
 5490|  97.4k|               key_supports_adjacent_value = true;
 5491|  97.4k|            }
 5492|   134k|            ++it;
 5493|   134k|            continue;
 5494|   134k|         }
 5495|  51.8M|         if (c == ':' && flow_depth == 0) {
  ------------------
  |  Branch (5495:14): [True: 2.42M, False: 49.4M]
  |  Branch (5495:26): [True: 1.54M, False: 880k]
  ------------------
 5496|  1.54M|            const auto next = it + 1;
 5497|  1.54M|            if (next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r') {
  ------------------
  |  Branch (5497:17): [True: 12.3k, False: 1.53M]
  |  Branch (5497:32): [True: 852k, False: 677k]
  |  Branch (5497:48): [True: 136k, False: 540k]
  |  Branch (5497:65): [True: 75.9k, False: 464k]
  |  Branch (5497:82): [True: 164k, False: 300k]
  ------------------
 5498|  1.24M|               return true;
 5499|  1.24M|            }
 5500|       |            // A ':' run together with its key is a separator only after a JSON-like key.
 5501|   300k|            return adjacent_value_ok;
 5502|  1.54M|         }
 5503|       |         // Inside a flow collection ',' separates entries and ':' ends a key, so a node begins
 5504|       |         // after either.
 5505|  50.3M|         if (c == ',' || c == ':') {
  ------------------
  |  Branch (5505:14): [True: 760k, False: 49.5M]
  |  Branch (5505:26): [True: 880k, False: 48.7M]
  ------------------
 5506|  1.64M|            at_node_start = true;
 5507|  1.64M|            ++it;
 5508|  1.64M|            continue;
 5509|  1.64M|         }
 5510|  48.7M|         if (node_start && yaml::skip_probe_node_property(it, stop)) {
  ------------------
  |  Branch (5510:14): [True: 5.97M, False: 42.7M]
  |  Branch (5510:28): [True: 152k, False: 5.82M]
  ------------------
 5511|   152k|            at_node_start = true;
 5512|   152k|            continue;
 5513|   152k|         }
 5514|  48.5M|         ++it;
 5515|  48.5M|      }
 5516|       |
 5517|   123k|      return false;
 5518|  5.97M|   }
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_ENKUlT_E0_clISM_EEDaSZ_:
 6007|  35.7k|            auto is_word_boundary = [&](const auto ptr) {
 6008|  35.7k|               if (ptr == end) {
  ------------------
  |  Branch (6008:20): [True: 1.12k, False: 34.6k]
  ------------------
 6009|  1.12k|                  return true;
 6010|  1.12k|               }
 6011|  34.6k|               if (*ptr == ':') {
  ------------------
  |  Branch (6011:20): [True: 24.8k, False: 9.81k]
  ------------------
 6012|  24.8k|                  auto next = ptr + 1;
 6013|  24.8k|                  return (next == end) || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
  ------------------
  |  Branch (6013:26): [True: 1.17k, False: 23.6k]
  |  Branch (6013:43): [True: 11.9k, False: 11.7k]
  |  Branch (6013:59): [True: 7.70k, False: 4.04k]
  |  Branch (6013:76): [True: 1.08k, False: 2.96k]
  |  Branch (6013:93): [True: 2.27k, False: 681]
  ------------------
 6014|  24.8k|               }
 6015|  9.81k|               return is_plain_scalar_boundary(*ptr);
 6016|  34.6k|            };
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_ENKUlcE_clEc:
 5933|  9.81k|            auto is_plain_scalar_boundary = [](const char ch) {
 5934|  9.81k|               switch (ch) {
 5935|  1.35k|               case ' ':
  ------------------
  |  Branch (5935:16): [True: 1.35k, False: 8.46k]
  ------------------
 5936|  1.80k|               case '\t':
  ------------------
  |  Branch (5936:16): [True: 447, False: 9.37k]
  ------------------
 5937|  2.22k|               case '\n':
  ------------------
  |  Branch (5937:16): [True: 423, False: 9.39k]
  ------------------
 5938|  4.24k|               case '\r':
  ------------------
  |  Branch (5938:16): [True: 2.01k, False: 7.79k]
  ------------------
 5939|  5.58k|               case ',':
  ------------------
  |  Branch (5939:16): [True: 1.33k, False: 8.48k]
  ------------------
 5940|  6.35k|               case ']':
  ------------------
  |  Branch (5940:16): [True: 777, False: 9.04k]
  ------------------
 5941|  7.00k|               case '}':
  ------------------
  |  Branch (5941:16): [True: 652, False: 9.16k]
  ------------------
 5942|  7.00k|                  return true;
 5943|  2.80k|               default:
  ------------------
  |  Branch (5943:16): [True: 2.80k, False: 7.00k]
  ------------------
 5944|  2.80k|                  return false;
 5945|  9.81k|               }
 5946|  9.81k|            };
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_ENKUlT_E_clISM_EEDaSZ_:
 5948|  32.3k|            auto has_indented_block_continuation = [&](auto word_end) {
 5949|  32.3k|               if constexpr (yaml::check_flow_context(Opts)) {
 5950|  32.3k|                  return false;
 5951|  32.3k|               }
 5952|  32.3k|               if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (5952:20): [True: 0, False: 32.3k]
  ------------------
 5953|      0|                  return false;
 5954|      0|               }
 5955|  32.3k|               if (word_end == end || (*word_end != '\n' && *word_end != '\r')) {
  ------------------
  |  Branch (5955:20): [True: 32.3k, False: 0]
  |  Branch (5955:40): [True: 0, False: 0]
  |  Branch (5955:61): [True: 0, False: 0]
  ------------------
 5956|      0|                  return false;
 5957|      0|               }
 5958|       |
 5959|  32.3k|               auto look = word_end;
 5960|  32.3k|               yaml::skip_newline(look, end);
 5961|  32.3k|               while (look != end) {
  ------------------
  |  Branch (5961:23): [True: 0, False: 32.3k]
  ------------------
 5962|      0|                  int32_t line_indent = 0;
 5963|      0|                  while (look != end && *look == ' ') {
  ------------------
  |  Branch (5963:26): [True: 0, False: 0]
  |  Branch (5963:41): [True: 0, False: 0]
  ------------------
 5964|      0|                     ++line_indent;
 5965|      0|                     ++look;
 5966|      0|                  }
 5967|      0|                  if (look != end && *look == '\t') {
  ------------------
  |  Branch (5967:23): [True: 0, False: 0]
  |  Branch (5967:38): [True: 0, False: 0]
  ------------------
 5968|      0|                     return false;
 5969|      0|                  }
 5970|      0|                  if (look == end || *look == '\n' || *look == '\r') {
  ------------------
  |  Branch (5970:23): [True: 0, False: 0]
  |  Branch (5970:38): [True: 0, False: 0]
  |  Branch (5970:55): [True: 0, False: 0]
  ------------------
 5971|      0|                     if (look != end) {
  ------------------
  |  Branch (5971:26): [True: 0, False: 0]
  ------------------
 5972|      0|                        yaml::skip_newline(look, end);
 5973|      0|                        continue;
 5974|      0|                     }
 5975|      0|                     return false;
 5976|      0|                  }
 5977|      0|                  if (*look == '#') {
  ------------------
  |  Branch (5977:23): [True: 0, False: 0]
  ------------------
 5978|      0|                     yaml::skip_comment(look, end);
 5979|      0|                     if (look != end && (*look == '\n' || *look == '\r')) {
  ------------------
  |  Branch (5979:26): [True: 0, False: 0]
  |  Branch (5979:42): [True: 0, False: 0]
  |  Branch (5979:59): [True: 0, False: 0]
  ------------------
 5980|      0|                        yaml::skip_newline(look, end);
 5981|      0|                        continue;
 5982|      0|                     }
 5983|      0|                     return false;
 5984|      0|                  }
 5985|       |
 5986|       |                  // If the next non-empty line is an implicit mapping entry,
 5987|       |                  // don't treat it as scalar continuation for auto-deduced
 5988|       |                  // booleans/nulls.
 5989|      0|                  {
 5990|      0|                     auto scan = look;
 5991|      0|                     while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (5991:29): [True: 0, False: 0]
  |  Branch (5991:44): [True: 0, False: 0]
  |  Branch (5991:61): [True: 0, False: 0]
  ------------------
 5992|      0|                        if (*scan == ':') {
  ------------------
  |  Branch (5992:29): [True: 0, False: 0]
  ------------------
 5993|      0|                           auto after_colon = scan + 1;
 5994|      0|                           if (after_colon == end || *after_colon == ' ' || *after_colon == '\t' ||
  ------------------
  |  Branch (5994:32): [True: 0, False: 0]
  |  Branch (5994:54): [True: 0, False: 0]
  |  Branch (5994:77): [True: 0, False: 0]
  ------------------
 5995|      0|                               *after_colon == '\n' || *after_colon == '\r') {
  ------------------
  |  Branch (5995:32): [True: 0, False: 0]
  |  Branch (5995:56): [True: 0, False: 0]
  ------------------
 5996|      0|                              return false;
 5997|      0|                           }
 5998|      0|                        }
 5999|      0|                        ++scan;
 6000|      0|                     }
 6001|      0|                  }
 6002|       |
 6003|      0|                  return line_indent > ctx.current_indent();
 6004|      0|               }
 6005|  32.3k|               return false;
 6006|  32.3k|            };
_ZN3glz36try_parse_block_mapping_into_variantINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_RNS_4yaml12yaml_contextERPKcSO_EEbOT1_OT2_OT3_T4_:
 5529|   700k|   {
 5530|   700k|      using counts = yaml_variant_type_count<Variant>;
 5531|       |      if constexpr (counts::n_object == 0) {
 5532|       |         return false;
 5533|       |      }
 5534|   700k|      else {
 5535|       |         // Quick check: if no viable mapping separator in the current span,
 5536|       |         // avoid expensive speculative parse.
 5537|   700k|         const bool could_be_mapping = [&] {
 5538|   700k|            if constexpr (yaml::check_flow_context(Opts)) {
 5539|   700k|               return line_could_be_flow_mapping(it, end);
 5540|   700k|            }
 5541|   700k|            else {
 5542|   700k|               return yaml::line_could_be_block_mapping(it, end);
 5543|   700k|            }
 5544|   700k|         }();
 5545|   700k|         if (!could_be_mapping) {
  ------------------
  |  Branch (5545:14): [True: 554k, False: 146k]
  ------------------
 5546|   554k|            return false;
 5547|   554k|         }
 5548|       |         // Full parse attempt - use a temporary context that inherits indent from parent
 5549|   146k|         auto temp_ctx = ctx.make_speculative();
 5550|   146k|         process_yaml_variant_alternatives<Variant, is_yaml_variant_object>::template op<Opts>(value, temp_ctx, it,
 5551|   146k|                                                                                               end);
 5552|   146k|         ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 5553|   146k|         ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5554|   146k|         if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (5554:14): [True: 137k, False: 8.99k]
  ------------------
 5555|   137k|            ctx.anchors = std::move(temp_ctx.anchors);
 5556|   137k|            return true;
 5557|   137k|         }
 5558|       |         // The line matched "key: value" pattern but parsing failed.
 5559|       |         // This indicates malformed content (e.g., unclosed flow collection),
 5560|       |         // so propagate the error rather than silently falling back to string.
 5561|  8.99k|         ctx.error = temp_ctx.error;
 5562|  8.99k|         ctx.custom_error_message = temp_ctx.custom_error_message;
 5563|  8.99k|         return false;
 5564|   146k|      }
 5565|   700k|   }
_ZZN3glz36try_parse_block_mapping_into_variantINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_RNS_4yaml12yaml_contextERPKcSO_EEbOT1_OT2_OT3_T4_ENKUlvE_clEv:
 5537|   700k|         const bool could_be_mapping = [&] {
 5538|   700k|            if constexpr (yaml::check_flow_context(Opts)) {
 5539|   700k|               return line_could_be_flow_mapping(it, end);
 5540|       |            }
 5541|       |            else {
 5542|       |               return yaml::line_could_be_block_mapping(it, end);
 5543|       |            }
 5544|   700k|         }();
_ZN3glz4yaml15materialize_keyILb1ENS0_12yaml_contextEEEbRNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEERT0_:
   39|  4.23M|   {
   40|  4.23M|      if constexpr (empty_on_null) {
   41|  4.23M|         if (key_node.is_null()) {
  ------------------
  |  Branch (41:14): [True: 133k, False: 4.10M]
  ------------------
   42|   133k|            key.clear();
   43|   133k|            return true;
   44|   133k|         }
   45|  4.23M|      }
   46|  4.23M|      if (auto* s = key_node.template get_if<std::string>()) {
  ------------------
  |  Branch (46:17): [True: 737k, False: 3.49M]
  ------------------
   47|   737k|         key = *s;
   48|   737k|         return true;
   49|   737k|      }
   50|  3.49M|      key.clear();
   51|  3.49M|      (void)glz::write_json(key_node, key);
   52|  3.49M|      if constexpr (requires { ctx.charge_key_expansion(size_t{}); }) {
   53|  3.49M|         if (!ctx.charge_key_expansion(key.size())) [[unlikely]] {
  ------------------
  |  Branch (53:14): [True: 330, False: 3.49M]
  ------------------
   54|    330|            ctx.error = error_code::exceeded_max_expansion;
   55|    330|            ctx.custom_error_message = "complex key expansion";
   56|    330|            return false;
   57|    330|         }
   58|  3.49M|      }
   59|  3.49M|      return true;
   60|  4.23M|   }
_ZN3glz4yaml14parse_yaml_keyINS0_12yaml_contextEPKcS4_EEbRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEERT_RT0_T1_b:
 1586|  15.3M|      {
 1587|  15.3M|         key.clear();
 1588|  15.3M|         skip_inline_ws(it, end);
 1589|       |
 1590|  15.3M|         if (it == end) {
  ------------------
  |  Branch (1590:14): [True: 114, False: 15.3M]
  ------------------
 1591|    114|            ctx.error = error_code::unexpected_end;
 1592|    114|            return false;
 1593|    114|         }
 1594|       |
 1595|  15.3M|         auto validate_key_tag = [&](const yaml_tag tag) {
 1596|  15.3M|            if (tag == yaml_tag::unknown) {
 1597|  15.3M|               ctx.error = error_code::syntax_error;
 1598|  15.3M|               return false;
 1599|  15.3M|            }
 1600|  15.3M|            if (!tag_valid_for_string(tag)) {
 1601|  15.3M|               ctx.error = error_code::syntax_error;
 1602|  15.3M|               return false;
 1603|  15.3M|            }
 1604|  15.3M|            return true;
 1605|  15.3M|         };
 1606|       |
 1607|       |         // Tags on keys (e.g. "!!str : value")
 1608|  15.3M|         auto key_tag = parse_yaml_tag(it, end, ctx);
 1609|  15.3M|         if (!validate_key_tag(key_tag)) {
  ------------------
  |  Branch (1609:14): [True: 106, False: 15.3M]
  ------------------
 1610|    106|            return false;
 1611|    106|         }
 1612|  15.3M|         skip_inline_ws(it, end);
 1613|  15.3M|         if (it == end) {
  ------------------
  |  Branch (1613:14): [True: 138, False: 15.3M]
  ------------------
 1614|    138|            ctx.error = error_code::unexpected_end;
 1615|    138|            return false;
 1616|    138|         }
 1617|       |
 1618|       |         // Handle alias as key (*name resolves to anchor value)
 1619|  15.3M|         if (*it == '*') {
  ------------------
  |  Branch (1619:14): [True: 2.24M, False: 13.0M]
  ------------------
 1620|  2.24M|            ++it;
 1621|  2.24M|            auto name = parse_anchor_name(it, end);
 1622|  2.24M|            if (name.empty()) {
  ------------------
  |  Branch (1622:17): [True: 686, False: 2.24M]
  ------------------
 1623|    686|               ctx.error = error_code::syntax_error;
 1624|    686|               return false;
 1625|    686|            }
 1626|  2.24M|            auto anchor_it = ctx.anchors.find(name);
 1627|  2.24M|            if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (1627:17): [True: 8.68k, False: 2.23M]
  ------------------
 1628|  8.68k|               ctx.error = error_code::syntax_error; // undefined alias
 1629|  8.68k|               return false;
 1630|  8.68k|            }
 1631|  2.23M|            auto& span = anchor_it->second;
 1632|  2.23M|            if (span.begin == span.end) {
  ------------------
  |  Branch (1632:17): [True: 88.2k, False: 2.14M]
  ------------------
 1633|  88.2k|               key.clear(); // empty anchor
 1634|  88.2k|            }
 1635|  2.14M|            else if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (1635:22): [True: 46, False: 2.14M]
  ------------------
 1636|       |               // A key alias replays its anchor the same way a value alias does, and a complex
 1637|       |               // key hands the span to the full reader, so it is charged the same way.
 1638|     46|               ctx.error = error_code::exceeded_max_expansion;
 1639|     46|               ctx.custom_error_message = "alias expansion";
 1640|     46|               return false;
 1641|     46|            }
 1642|  2.14M|            else {
 1643|       |               // Replay the anchor span to extract the key string
 1644|  2.14M|               auto replay_it = span.begin;
 1645|  2.14M|               auto replay_end = span.end;
 1646|  2.14M|               if (*replay_it == '"') {
  ------------------
  |  Branch (1646:20): [True: 976, False: 2.14M]
  ------------------
 1647|    976|                  parse_double_quoted_string(key, ctx, replay_it, replay_end);
 1648|    976|               }
 1649|  2.14M|               else if (*replay_it == '\'') {
  ------------------
  |  Branch (1649:25): [True: 1.21k, False: 2.14M]
  ------------------
 1650|  1.21k|                  parse_single_quoted_string(key, ctx, replay_it, replay_end);
 1651|  1.21k|               }
 1652|  2.14M|               else if (*replay_it == '[' || *replay_it == '{') {
  ------------------
  |  Branch (1652:25): [True: 8.84k, False: 2.13M]
  |  Branch (1652:46): [True: 1.22M, False: 910k]
  ------------------
 1653|       |                  // Canonicalize complex alias keys (flow seq/map) to a stable string form.
 1654|  1.23M|                  glz::generic key_node{};
 1655|  1.23M|                  auto temp_ctx = ctx.make_speculative();
 1656|  1.23M|                  from<YAML, glz::generic>::template op<flow_context_on<opts{.error_on_unknown_keys = false}>()>(
 1657|  1.23M|                     key_node, temp_ctx, replay_it, replay_end);
 1658|  1.23M|                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 1659|  1.23M|                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 1660|  1.23M|                  if (bool(temp_ctx.error)) [[unlikely]] {
  ------------------
  |  Branch (1660:23): [True: 79.2k, False: 1.15M]
  ------------------
 1661|  79.2k|                     ctx.error = temp_ctx.error;
 1662|  79.2k|                     ctx.custom_error_message = temp_ctx.custom_error_message;
 1663|  79.2k|                     return false;
 1664|  79.2k|                  }
 1665|  1.15M|                  ctx.anchors = std::move(temp_ctx.anchors);
 1666|       |
 1667|  1.15M|                  if (!yaml::materialize_key<false>(key, key_node, ctx)) [[unlikely]] {
  ------------------
  |  Branch (1667:23): [True: 42, False: 1.15M]
  ------------------
 1668|     42|                     return false;
 1669|     42|                  }
 1670|  1.15M|               }
 1671|   910k|               else {
 1672|   910k|                  bool parse_structured_alias_key = false;
 1673|   910k|                  if (*replay_it == '-' &&
  ------------------
  |  Branch (1673:23): [True: 128k, False: 781k]
  ------------------
 1674|   128k|                      ((replay_it + 1) == replay_end ||
  ------------------
  |  Branch (1674:24): [True: 6.59k, False: 122k]
  ------------------
 1675|   122k|                       yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(replay_it + 1))])) {
  ------------------
  |  Branch (1675:24): [True: 100k, False: 22.1k]
  ------------------
 1676|   106k|                     parse_structured_alias_key = true;
 1677|   106k|                  }
 1678|   803k|                  else {
 1679|   803k|                     auto scan = replay_it;
 1680|   594M|                     while (scan != replay_end) {
  ------------------
  |  Branch (1680:29): [True: 594M, False: 54.7k]
  ------------------
 1681|   594M|                        if (*scan == ':') {
  ------------------
  |  Branch (1681:29): [True: 635k, False: 594M]
  ------------------
 1682|   635k|                           const auto after_colon = scan + 1;
 1683|   635k|                           if (after_colon == replay_end ||
  ------------------
  |  Branch (1683:32): [True: 45.7k, False: 589k]
  ------------------
 1684|   589k|                               yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) {
  ------------------
  |  Branch (1684:32): [True: 299k, False: 289k]
  ------------------
 1685|   345k|                              parse_structured_alias_key = true;
 1686|   345k|                              break;
 1687|   345k|                           }
 1688|   635k|                        }
 1689|   594M|                        if (*scan == '\n' || *scan == '\r') {
  ------------------
  |  Branch (1689:29): [True: 215k, False: 594M]
  |  Branch (1689:46): [True: 188k, False: 593M]
  ------------------
 1690|   403k|                           break;
 1691|   403k|                        }
 1692|   593M|                        ++scan;
 1693|   593M|                     }
 1694|   803k|                  }
 1695|   910k|                  if (!parse_structured_alias_key) {
  ------------------
  |  Branch (1695:23): [True: 458k, False: 452k]
  ------------------
 1696|   490M|                     for (auto p = replay_it; p != replay_end; ++p) {
  ------------------
  |  Branch (1696:47): [True: 490M, False: 54.7k]
  ------------------
 1697|   490M|                        if (*p == '\n' || *p == '\r') {
  ------------------
  |  Branch (1697:29): [True: 215k, False: 490M]
  |  Branch (1697:43): [True: 188k, False: 490M]
  ------------------
 1698|   403k|                           parse_structured_alias_key = true;
 1699|   403k|                           break;
 1700|   403k|                        }
 1701|   490M|                     }
 1702|   458k|                  }
 1703|       |
 1704|   910k|                  if (parse_structured_alias_key) {
  ------------------
  |  Branch (1704:23): [True: 855k, False: 54.7k]
  ------------------
 1705|   855k|                     glz::generic key_node{};
 1706|   855k|                     auto temp_ctx = ctx.make_speculative();
 1707|   855k|                     from<YAML, glz::generic>::template op<opts{.error_on_unknown_keys = false}>(key_node, temp_ctx,
 1708|   855k|                                                                                                 replay_it, replay_end);
 1709|   855k|                     ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 1710|   855k|                     ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 1711|   855k|                     if (bool(temp_ctx.error)) [[unlikely]] {
  ------------------
  |  Branch (1711:26): [True: 223k, False: 632k]
  ------------------
 1712|   223k|                        ctx.error = temp_ctx.error;
 1713|   223k|                        ctx.custom_error_message = temp_ctx.custom_error_message;
 1714|   223k|                        return false;
 1715|   223k|                     }
 1716|   632k|                     ctx.anchors = std::move(temp_ctx.anchors);
 1717|       |
 1718|   632k|                     if (!yaml::materialize_key<false>(key, key_node, ctx)) [[unlikely]] {
  ------------------
  |  Branch (1718:26): [True: 28, False: 632k]
  ------------------
 1719|     28|                        return false;
 1720|     28|                     }
 1721|   632k|                  }
 1722|  54.7k|                  else {
 1723|  54.7k|                     parse_plain_scalar(key, ctx, replay_it, replay_end, false);
 1724|  54.7k|                  }
 1725|   910k|               }
 1726|  2.14M|            }
 1727|  1.93M|            return !bool(ctx.error);
 1728|  2.23M|         }
 1729|       |
 1730|       |         // Handle anchor on key (&name before key text)
 1731|  13.0M|         bool has_key_anchor = false;
 1732|  13.0M|         std::string key_anchor_name;
 1733|  13.0M|         if (*it == '&') {
  ------------------
  |  Branch (1733:14): [True: 2.20M, False: 10.8M]
  ------------------
 1734|  2.20M|            ++it;
 1735|  2.20M|            auto name = parse_anchor_name(it, end);
 1736|  2.20M|            if (name.empty()) {
  ------------------
  |  Branch (1736:17): [True: 582, False: 2.20M]
  ------------------
 1737|    582|               ctx.error = error_code::syntax_error;
 1738|    582|               return false;
 1739|    582|            }
 1740|  2.20M|            skip_inline_ws(it, end);
 1741|  2.20M|            if (it == end) {
  ------------------
  |  Branch (1741:17): [True: 572, False: 2.20M]
  ------------------
 1742|    572|               ctx.error = error_code::unexpected_end;
 1743|    572|               return false;
 1744|    572|            }
 1745|       |            // Anchor on alias is invalid per YAML spec
 1746|  2.20M|            if (*it == '*') {
  ------------------
  |  Branch (1746:17): [True: 92, False: 2.20M]
  ------------------
 1747|     92|               ctx.error = error_code::syntax_error;
 1748|     92|               return false;
 1749|     92|            }
 1750|  2.20M|            has_key_anchor = true;
 1751|  2.20M|            key_anchor_name = std::string(name);
 1752|  2.20M|         }
 1753|       |
 1754|       |         // Allow node-property order "&anchor !!str key: value" for mapping keys.
 1755|  13.0M|         if (*it == '!') {
  ------------------
  |  Branch (1755:14): [True: 273k, False: 12.8M]
  ------------------
 1756|   273k|            if (key_tag != yaml_tag::none) {
  ------------------
  |  Branch (1756:17): [True: 6, False: 273k]
  ------------------
 1757|       |               // Duplicate tag properties on the same key node are malformed.
 1758|      6|               ctx.error = error_code::syntax_error;
 1759|      6|               return false;
 1760|      6|            }
 1761|   273k|            key_tag = parse_yaml_tag(it, end, ctx);
 1762|   273k|            if (!validate_key_tag(key_tag)) {
  ------------------
  |  Branch (1762:17): [True: 54, False: 273k]
  ------------------
 1763|     54|               return false;
 1764|     54|            }
 1765|   273k|            skip_inline_ws(it, end);
 1766|   273k|            if (it == end) {
  ------------------
  |  Branch (1766:17): [True: 20, False: 273k]
  ------------------
 1767|     20|               ctx.error = error_code::unexpected_end;
 1768|     20|               return false;
 1769|     20|            }
 1770|   273k|         }
 1771|       |
 1772|  13.0M|         const char* key_start = &*it;
 1773|  13.0M|         bool quoted_key_spans_lines = false;
 1774|       |
 1775|  13.0M|         if (*it == '"') {
  ------------------
  |  Branch (1775:14): [True: 1.12M, False: 11.9M]
  ------------------
 1776|  1.12M|            auto quoted_start = it;
 1777|  1.12M|            parse_double_quoted_string(key, ctx, it, end);
 1778|  1.12M|            if (!bool(ctx.error)) {
  ------------------
  |  Branch (1778:17): [True: 1.12M, False: 400]
  ------------------
 1779|  6.53M|               for (auto p = quoted_start; p != it; ++p) {
  ------------------
  |  Branch (1779:44): [True: 5.42M, False: 1.10M]
  ------------------
 1780|  5.42M|                  if (*p == '\n' || *p == '\r') {
  ------------------
  |  Branch (1780:23): [True: 3.00k, False: 5.42M]
  |  Branch (1780:37): [True: 12.5k, False: 5.40M]
  ------------------
 1781|  15.5k|                     quoted_key_spans_lines = true;
 1782|  15.5k|                     break;
 1783|  15.5k|                  }
 1784|  5.42M|               }
 1785|  1.12M|            }
 1786|  1.12M|         }
 1787|  11.9M|         else if (*it == '\'') {
  ------------------
  |  Branch (1787:19): [True: 16.0k, False: 11.9M]
  ------------------
 1788|  16.0k|            auto quoted_start = it;
 1789|  16.0k|            parse_single_quoted_string(key, ctx, it, end);
 1790|  16.0k|            if (!bool(ctx.error)) {
  ------------------
  |  Branch (1790:17): [True: 15.7k, False: 252]
  ------------------
 1791|  82.4k|               for (auto p = quoted_start; p != it; ++p) {
  ------------------
  |  Branch (1791:44): [True: 68.7k, False: 13.6k]
  ------------------
 1792|  68.7k|                  if (*p == '\n' || *p == '\r') {
  ------------------
  |  Branch (1792:23): [True: 1.42k, False: 67.3k]
  |  Branch (1792:37): [True: 686, False: 66.6k]
  ------------------
 1793|  2.10k|                     quoted_key_spans_lines = true;
 1794|  2.10k|                     break;
 1795|  2.10k|                  }
 1796|  68.7k|               }
 1797|  15.7k|            }
 1798|  16.0k|         }
 1799|  11.9M|         else {
 1800|       |            // Plain key - read until colon
 1801|  46.9M|            while (it != end) {
  ------------------
  |  Branch (1801:20): [True: 46.9M, False: 754]
  ------------------
 1802|       |               // Bulk-copy the ordinary run; only dispatch bytes need the checks below.
 1803|  46.9M|               {
 1804|  46.9M|                  const auto run_start = it;
 1805|   276M|                  while (it != end && !plain_scalar_dispatch_table[uint8_t(*it)]) {
  ------------------
  |  Branch (1805:26): [True: 276M, False: 3.06k]
  |  Branch (1805:39): [True: 229M, False: 46.8M]
  ------------------
 1806|   229M|                     ++it;
 1807|   229M|                  }
 1808|  46.9M|                  if (it != run_start) {
  ------------------
  |  Branch (1808:23): [True: 38.3M, False: 8.54M]
  ------------------
 1809|  38.3M|                     key.append(run_start, it);
 1810|  38.3M|                  }
 1811|  46.9M|                  if (it == end) break;
  ------------------
  |  Branch (1811:23): [True: 3.06k, False: 46.8M]
  ------------------
 1812|  46.9M|               }
 1813|       |
 1814|  46.8M|               const char c = *it;
 1815|  46.8M|               if (c == ':') {
  ------------------
  |  Branch (1815:20): [True: 35.6M, False: 11.2M]
  ------------------
 1816|       |                  // Check if this ends the key
 1817|  35.6M|                  if ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\t' || *(it + 1) == '\n' ||
  ------------------
  |  Branch (1817:23): [True: 63.0k, False: 35.5M]
  |  Branch (1817:42): [True: 3.89M, False: 31.6M]
  |  Branch (1817:62): [True: 332k, False: 31.3M]
  |  Branch (1817:83): [True: 384k, False: 30.9M]
  ------------------
 1818|  30.9M|                      *(it + 1) == '\r') {
  ------------------
  |  Branch (1818:23): [True: 1.83M, False: 29.1M]
  ------------------
 1819|  6.50M|                     break;
 1820|  6.50M|                  }
 1821|  29.1M|                  if (in_flow && (*(it + 1) == ',' || *(it + 1) == ']' || *(it + 1) == '}')) {
  ------------------
  |  Branch (1821:23): [True: 28.3M, False: 752k]
  |  Branch (1821:35): [True: 138k, False: 28.2M]
  |  Branch (1821:55): [True: 42, False: 28.2M]
  |  Branch (1821:75): [True: 57.9k, False: 28.1M]
  ------------------
 1822|   196k|                     break;
 1823|   196k|                  }
 1824|  29.1M|               }
 1825|  40.1M|               if (c == '\n' || c == '\r') {
  ------------------
  |  Branch (1825:20): [True: 1.79M, False: 38.4M]
  |  Branch (1825:33): [True: 1.38M, False: 37.0M]
  ------------------
 1826|  3.17M|                  if (!in_flow) break;
  ------------------
  |  Branch (1826:23): [True: 1.82k, False: 3.17M]
  ------------------
 1827|       |
 1828|  3.17M|                  auto continuation = it;
 1829|  3.17M|                  skip_newline(continuation, end);
 1830|  3.17M|                  int32_t continuation_indent = 0;
 1831|  6.18M|                  while (continuation != end && (*continuation == ' ' || *continuation == '\t')) {
  ------------------
  |  Branch (1831:26): [True: 6.18M, False: 400]
  |  Branch (1831:50): [True: 2.85M, False: 3.32M]
  |  Branch (1831:74): [True: 148k, False: 3.17M]
  ------------------
 1832|  3.00M|                     if (*continuation == ' ') ++continuation_indent;
  ------------------
  |  Branch (1832:26): [True: 2.85M, False: 148k]
  ------------------
 1833|  3.00M|                     ++continuation;
 1834|  3.00M|                  }
 1835|       |
 1836|  3.17M|                  if (continuation == end) {
  ------------------
  |  Branch (1836:23): [True: 400, False: 3.17M]
  ------------------
 1837|    400|                     break;
 1838|    400|                  }
 1839|       |
 1840|  3.17M|                  if (*continuation == '#') {
  ------------------
  |  Branch (1840:23): [True: 156k, False: 3.01M]
  ------------------
 1841|   156k|                     it = continuation;
 1842|   156k|                     skip_comment(it, end);
 1843|   156k|                     if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (1843:26): [True: 156k, False: 28]
  |  Branch (1843:40): [True: 108k, False: 48.6k]
  |  Branch (1843:55): [True: 48.6k, False: 56]
  ------------------
 1844|   156k|                        skip_newline(it, end);
 1845|   156k|                        continue;
 1846|   156k|                     }
 1847|     84|                     break;
 1848|   156k|                  }
 1849|       |
 1850|       |                  // A continuation line starting with flow terminators or ':' does
 1851|       |                  // not belong to the key content.
 1852|  3.01M|                  if (*continuation == ',' || *continuation == ']' || *continuation == '}' || *continuation == ':') {
  ------------------
  |  Branch (1852:23): [True: 153k, False: 2.86M]
  |  Branch (1852:47): [True: 10, False: 2.86M]
  |  Branch (1852:71): [True: 16.0k, False: 2.84M]
  |  Branch (1852:95): [True: 220k, False: 2.62M]
  ------------------
 1853|   390k|                     break;
 1854|   390k|                  }
 1855|       |
 1856|  2.62M|                  if (ctx.explicit_mapping_key_context) {
  ------------------
  |  Branch (1856:23): [True: 11.3k, False: 2.61M]
  ------------------
 1857|  11.3k|                     if (*continuation == '?' || *continuation == ':') {
  ------------------
  |  Branch (1857:26): [True: 1.38k, False: 9.99k]
  |  Branch (1857:50): [True: 0, False: 9.99k]
  ------------------
 1858|  1.38k|                        auto after = continuation + 1;
 1859|  1.38k|                        if (after == end || *after == ' ' || *after == '\t' || *after == '\n' || *after == '\r') {
  ------------------
  |  Branch (1859:29): [True: 6, False: 1.38k]
  |  Branch (1859:45): [True: 6, False: 1.37k]
  |  Branch (1859:62): [True: 6, False: 1.37k]
  |  Branch (1859:80): [True: 6, False: 1.36k]
  |  Branch (1859:98): [True: 8, False: 1.35k]
  ------------------
 1860|     32|                           break;
 1861|     32|                        }
 1862|  1.38k|                     }
 1863|       |
 1864|  11.3k|                     if (*continuation == '&' || *continuation == '*' || *continuation == '!') {
  ------------------
  |  Branch (1864:26): [True: 6, False: 11.3k]
  |  Branch (1864:50): [True: 12, False: 11.3k]
  |  Branch (1864:74): [True: 6, False: 11.3k]
  ------------------
 1865|     24|                        break;
 1866|     24|                     }
 1867|       |
 1868|  11.3k|                     if (*continuation == '-') {
  ------------------
  |  Branch (1868:26): [True: 622, False: 10.7k]
  ------------------
 1869|    622|                        auto after = continuation + 1;
 1870|    622|                        if (after == end || *after == ' ' || *after == '\t' || *after == '\n' || *after == '\r') {
  ------------------
  |  Branch (1870:29): [True: 10, False: 612]
  |  Branch (1870:45): [True: 6, False: 606]
  |  Branch (1870:62): [True: 6, False: 600]
  |  Branch (1870:80): [True: 10, False: 590]
  |  Branch (1870:98): [True: 6, False: 584]
  ------------------
 1871|     38|                           break;
 1872|     38|                        }
 1873|    622|                     }
 1874|       |
 1875|  11.2k|                     if (ctx.current_indent() >= 0 && continuation_indent <= ctx.current_indent()) {
  ------------------
  |  Branch (1875:26): [True: 1.39k, False: 9.89k]
  |  Branch (1875:55): [True: 650, False: 742]
  ------------------
 1876|    650|                        break;
 1877|    650|                     }
 1878|       |
 1879|       |                     // A continuation line that contains an implicit mapping-key
 1880|       |                     // indicator (": " / ":\n") starts a new entry, not key text.
 1881|  10.6k|                     {
 1882|  10.6k|                        auto scan = continuation;
 1883|   120k|                        while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (1883:32): [True: 119k, False: 1.77k]
  |  Branch (1883:47): [True: 117k, False: 1.69k]
  |  Branch (1883:64): [True: 110k, False: 7.11k]
  ------------------
 1884|   110k|                           if (*scan == ':') {
  ------------------
  |  Branch (1884:32): [True: 13.6k, False: 96.7k]
  ------------------
 1885|  13.6k|                              auto after_colon = scan + 1;
 1886|  13.6k|                              const bool tight_key_colon =
 1887|  13.6k|                                 (scan == continuation) || (*(scan - 1) != ' ' && *(scan - 1) != '\t');
  ------------------
  |  Branch (1887:34): [True: 0, False: 13.6k]
  |  Branch (1887:61): [True: 12.3k, False: 1.31k]
  |  Branch (1887:83): [True: 12.2k, False: 52]
  ------------------
 1888|  13.6k|                              if (tight_key_colon &&
  ------------------
  |  Branch (1888:35): [True: 12.2k, False: 1.37k]
  ------------------
 1889|  12.2k|                                  (after_colon == end || *after_colon == ' ' || *after_colon == '\t' ||
  ------------------
  |  Branch (1889:36): [True: 18, False: 12.2k]
  |  Branch (1889:58): [True: 18, False: 12.2k]
  |  Branch (1889:81): [True: 6, False: 12.2k]
  ------------------
 1890|  12.2k|                                   *after_colon == '\n' || *after_colon == '\r')) {
  ------------------
  |  Branch (1890:36): [True: 6, False: 12.2k]
  |  Branch (1890:60): [True: 6, False: 12.2k]
  ------------------
 1891|     54|                                 break;
 1892|     54|                              }
 1893|  13.6k|                           }
 1894|   110k|                           ++scan;
 1895|   110k|                        }
 1896|  10.6k|                        if (scan != end && *scan == ':') {
  ------------------
  |  Branch (1896:29): [True: 8.86k, False: 1.77k]
  |  Branch (1896:44): [True: 54, False: 8.80k]
  ------------------
 1897|     54|                           break;
 1898|     54|                        }
 1899|  10.6k|                     }
 1900|  10.6k|                  }
 1901|       |
 1902|  2.62M|                  if (!key.empty() && key.back() != ' ') {
  ------------------
  |  Branch (1902:23): [True: 1.80M, False: 822k]
  |  Branch (1902:39): [True: 1.23M, False: 567k]
  ------------------
 1903|  1.23M|                     key.push_back(' ');
 1904|  1.23M|                  }
 1905|  2.62M|                  it = continuation;
 1906|  2.62M|                  continue;
 1907|  2.62M|               }
 1908|  37.0M|               if (in_flow && (c == ',' || c == ']' || c == '}')) break;
  ------------------
  |  Branch (1908:20): [True: 35.4M, False: 1.55M]
  |  Branch (1908:32): [True: 3.51M, False: 31.9M]
  |  Branch (1908:44): [True: 228, False: 31.9M]
  |  Branch (1908:56): [True: 1.27M, False: 30.6M]
  ------------------
 1909|  32.2M|               if (c == '#') {
  ------------------
  |  Branch (1909:20): [True: 2.83M, False: 29.3M]
  ------------------
 1910|  2.83M|                  if (key.empty() || key.back() == ' ' || key.back() == '\t') break;
  ------------------
  |  Branch (1910:23): [True: 7.19k, False: 2.82M]
  |  Branch (1910:38): [True: 18.1k, False: 2.81M]
  |  Branch (1910:59): [True: 2.43k, False: 2.80M]
  ------------------
 1911|  2.83M|               }
 1912|       |
 1913|  32.1M|               if (forbidden_control_table[uint8_t(c)]) [[unlikely]] {
  ------------------
  |  Branch (1913:20): [True: 14.0k, False: 32.1M]
  ------------------
 1914|  14.0k|                  ctx.error = error_code::invalid_control_character;
 1915|  14.0k|                  return false;
 1916|  14.0k|               }
 1917|  32.1M|               key.push_back(c);
 1918|  32.1M|               ++it;
 1919|  32.1M|            }
 1920|       |
 1921|       |            // Trim trailing whitespace from key
 1922|  13.5M|            while (!key.empty() && (key.back() == ' ' || key.back() == '\t')) {
  ------------------
  |  Branch (1922:20): [True: 10.2M, False: 3.32M]
  |  Branch (1922:37): [True: 1.44M, False: 8.77M]
  |  Branch (1922:58): [True: 171k, False: 8.60M]
  ------------------
 1923|  1.61M|               key.pop_back();
 1924|  1.61M|            }
 1925|       |
 1926|       |            // Empty keys are valid YAML (":" in block or flow mappings).
 1927|  11.9M|         }
 1928|       |
 1929|  13.0M|         if (bool(ctx.error)) return false;
  ------------------
  |  Branch (1929:14): [True: 652, False: 13.0M]
  ------------------
 1930|       |
 1931|       |         // Implicit mapping keys must be single-line in both block and flow styles.
 1932|  13.0M|         if (quoted_key_spans_lines && !in_flow) {
  ------------------
  |  Branch (1932:14): [True: 17.7k, False: 13.0M]
  |  Branch (1932:40): [True: 42, False: 17.6k]
  ------------------
 1933|     42|            ctx.error = error_code::syntax_error;
 1934|     42|            return false;
 1935|     42|         }
 1936|       |
 1937|       |         // Store anchor on key if present
 1938|  13.0M|         if (has_key_anchor) {
  ------------------
  |  Branch (1938:14): [True: 2.20M, False: 10.8M]
  ------------------
 1939|  2.20M|            ctx.anchors[std::move(key_anchor_name)] = {key_start, &*it, ctx.current_indent()};
 1940|  2.20M|         }
 1941|       |
 1942|  13.0M|         return true;
 1943|  13.0M|      }
_ZZN3glz4yaml14parse_yaml_keyINS0_12yaml_contextEPKcS4_EEbRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEERT_RT0_T1_bENKUlNS0_8yaml_tagEE_clESI_:
 1595|  15.5M|         auto validate_key_tag = [&](const yaml_tag tag) {
 1596|  15.5M|            if (tag == yaml_tag::unknown) {
  ------------------
  |  Branch (1596:17): [True: 80, False: 15.5M]
  ------------------
 1597|     80|               ctx.error = error_code::syntax_error;
 1598|     80|               return false;
 1599|     80|            }
 1600|  15.5M|            if (!tag_valid_for_string(tag)) {
  ------------------
  |  Branch (1600:17): [True: 80, False: 15.5M]
  ------------------
 1601|     80|               ctx.error = error_code::syntax_error;
 1602|     80|               return false;
 1603|     80|            }
 1604|  15.5M|            return true;
 1605|  15.5M|         };
_ZN3glz4fromILj450ENS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERS4_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSD_EEvOT0_OT1_OT2_T3_:
  283|  7.25M|      {
  284|  7.25M|         using V = std::decay_t<decltype(get_member(std::declval<Value>(), meta_wrapper_v<T>))>;
  285|  7.25M|         from<YAML, V>::template op<Opts>(get_member(std::forward<Value>(value), meta_wrapper_v<T>),
  286|  7.25M|                                          std::forward<Ctx>(ctx), std::forward<It0>(it), end);
  287|  7.25M|      }
_ZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_:
 5797|  10.7M|      {
 5798|       |         // Inside op() rather than at class scope: read_supported is `requires { from<Format, T>{}; }`,
 5799|       |         // so a class-scope assert turns that feature probe into a hard error instead of `false`.
 5800|  10.7M|         static_assert(content_v<std::remove_cvref_t<T>>.empty(),
 5801|  10.7M|                       "Adjacent variant tagging (glz::meta `content`) is implemented for JSON and "
 5802|  10.7M|                       "BEVE but not yet for YAML. Reading this variant as YAML would silently expect "
 5803|  10.7M|                       "the internally tagged shape, so it is rejected here instead.");
 5804|  10.7M|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5804:14): [True: 0, False: 10.7M]
  ------------------
 5805|      0|            return;
 5806|       |
 5807|       |         // No depth is taken here: the sequence and mapping readers this dispatches to count the
 5808|       |         // levels, so a scalar at the bottom of a document costs nothing, as in JSON. The one way
 5809|       |         // back into this reader that opens no collection is `redispatch`, which counts itself.
 5810|       |
 5811|       |         // At root level (indent == -1), skip leading whitespace, newlines, and comments
 5812|       |         // For nested values, only skip inline whitespace to preserve block structure
 5813|  10.7M|         if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (5813:14): [True: 9.02M, False: 1.71M]
  ------------------
 5814|  9.02M|            yaml::skip_ws_newlines_comments(it, end);
 5815|  9.02M|         }
 5816|  1.71M|         else {
 5817|  1.71M|            yaml::skip_inline_ws(it, end);
 5818|  1.71M|         }
 5819|       |
 5820|  10.7M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (5820:14): [True: 100, False: 10.7M]
  ------------------
 5821|    100|            ctx.error = error_code::unexpected_end;
 5822|    100|            return;
 5823|    100|         }
 5824|       |
 5825|       |         // Tagged variants: a discriminator key (meta::tag) selects the alternative, with the
 5826|       |         // matching meta::ids entry naming each type. This mirrors the JSON behavior so the
 5827|       |         // same variant definitions round-trip across both formats.
 5828|       |         if constexpr (not tag_v<std::remove_cvref_t<T>>.empty()) {
 5829|       |            using V = std::remove_cvref_t<T>;
 5830|       |            const bool value_is_mapping =
 5831|       |               (*it == '{') || (!yaml::check_flow_context(Opts) && yaml::line_could_be_block_mapping(it, end));
 5832|       |            if (value_is_mapping) {
 5833|       |               // The mapping's keys sit at the column of `it`. Recover that column from the buffer:
 5834|       |               // the indent stack carries the parent context's indent (a struct member, a sequence
 5835|       |               // item, etc. each push a different offset), not this mapping's true column (see helper).
 5836|       |               const int32_t mapping_column = tagged_mapping_visual_indent(ctx, it, ctx.current_indent() + 1);
 5837|       |               auto tag_ctx = ctx.make_speculative();
 5838|       |               const size_t index = scan_variant_tag_index<V, Opts>(tag_ctx, it, end, mapping_column);
 5839|       |               ctx.alias_expansion_budget = tag_ctx.alias_expansion_budget; // charged even if no tag matched
 5840|       |               ctx.key_expansion_budget = tag_ctx.key_expansion_budget;
 5841|       |               if (index < ids_v<V>.size()) {
 5842|       |                  static constexpr auto tag_literal = string_literal_from_view<tag_v<V>.size()>(tag_v<V>);
 5843|       |                  emplace_runtime_variant(value, index);
 5844|       |                  // Establish the mapping's true column on the indent stack for the alternative parse.
 5845|       |                  // The chosen object is then parsed - and the discriminator's inline value skipped -
 5846|       |                  // at a consistent indent in every context, so a tag on the first key does not fold
 5847|       |                  // the following sibling entries into its value (no special-casing needed downstream).
 5848|       |                  if (!ctx.push_indent(mapping_column)) [[unlikely]] {
 5849|       |                     ctx.error = error_code::exceeded_max_recursive_depth;
 5850|       |                     return;
 5851|       |                  }
 5852|       |                  std::visit(
 5853|       |                     [&](auto&& alt) {
 5854|       |                        using Alt = std::remove_cvref_t<decltype(alt)>;
 5855|       |                        if constexpr ((glaze_object_t<Alt> || reflectable<Alt>) && not custom_read<Alt>) {
 5856|       |                           // Parse the mapping into the resolved struct; the tag key is skipped.
 5857|       |                           from<YAML, Alt>::template op<Opts, tag_literal>(alt, ctx, it, end);
 5858|       |                        }
 5859|       |                        else if constexpr (custom_read<Alt>) {
 5860|       |                           // Custom alternatives read the mapping body themselves and cannot skip an
 5861|       |                           // interior tag key the way reflected objects do, so the tag must be the
 5862|       |                           // first key (glaze always writes it first). Consume that leading "tag: id"
 5863|       |                           // entry, then hand the remaining mapping to the custom handler.
 5864|       |                           if constexpr (yaml::check_flow_context(Opts)) {
 5865|       |                              ctx.error = error_code::feature_not_supported;
 5866|       |                              ctx.custom_error_message =
 5867|       |                                 "custom variant alternatives are not supported in YAML flow style";
 5868|       |                           }
 5869|       |                           else {
 5870|       |                              ctx.scratch.clear();
 5871|       |                              if (yaml::parse_yaml_key(ctx.scratch, ctx, it, end, false)) {
 5872|       |                                 if (std::string_view{ctx.scratch} != tag_v<V>) {
 5873|       |                                    ctx.error = error_code::feature_not_supported;
 5874|       |                                    ctx.custom_error_message =
 5875|       |                                       "the tag must be the first key for a custom variant alternative";
 5876|       |                                 }
 5877|       |                                 else {
 5878|       |                                    yaml::skip_inline_ws(it, end);
 5879|       |                                    if (it == end || *it != ':') {
 5880|       |                                       ctx.error = error_code::syntax_error;
 5881|       |                                    }
 5882|       |                                    else {
 5883|       |                                       ++it;
 5884|       |                                       yaml::skip_inline_ws(it, end);
 5885|       |                                       yaml::skip_unknown_block_value<Opts>(ctx, it, end, mapping_column);
 5886|       |                                       if (!bool(ctx.error)) {
 5887|       |                                          // If nothing but trailing whitespace/comments remains, the tag
 5888|       |                                          // was the whole mapping: leave the alternative default.
 5889|       |                                          auto probe = it;
 5890|       |                                          yaml::skip_ws_newlines_comments(probe, end);
 5891|       |                                          if (probe == end) {
 5892|       |                                             it = probe;
 5893|       |                                          }
 5894|       |                                          else {
 5895|       |                                             // Publish the mapping's column so the custom handler's block
 5896|       |                                             // mapping (which would otherwise discover its own indent) reads
 5897|       |                                             // the remaining entries at the variant's indent and dedents
 5898|       |                                             // correctly in every context (root, sequence, nested).
 5899|       |                                             ctx.forced_block_mapping_indent = mapping_column;
 5900|       |                                             from<YAML, Alt>::template op<Opts>(alt, ctx, it, end);
 5901|       |                                             ctx.forced_block_mapping_indent = -1;
 5902|       |                                          }
 5903|       |                                       }
 5904|       |                                    }
 5905|       |                                 }
 5906|       |                              }
 5907|       |                           }
 5908|       |                        }
 5909|       |                        else {
 5910|       |                           // Non-object alternative (e.g. std::monostate): the emplaced default is
 5911|       |                           // the value, but the mapping must still be consumed.
 5912|       |                           walk_tagged_mapping<Opts>(
 5913|       |                              ctx, it, end, tag_v<V>, mapping_column,
 5914|       |                              [&](auto&& c, auto&& i, auto&& e, int32_t line_indent, bool in_flow) {
 5915|       |                                 yaml::skip_yaml_value<Opts>(c, i, e, in_flow ? 0 : line_indent, in_flow);
 5916|       |                              });
 5917|       |                        }
 5918|       |                     },
 5919|       |                     value);
 5920|       |                  ctx.pop_indent();
 5921|       |                  return;
 5922|       |               }
 5923|       |               // No resolvable tag key was found. Fall through to structural deduction:
 5924|       |               // if the alternatives are distinguishable by their fields this still succeeds,
 5925|       |               // otherwise the deduction path reports no_matching_variant_type.
 5926|       |            }
 5927|       |         }
 5928|       |
 5929|  10.7M|         if constexpr (yaml_variant_is_auto_deducible<std::remove_cvref_t<T>>()) {
 5930|  10.7M|            using V = std::remove_cvref_t<T>;
 5931|  10.7M|            using counts = yaml_variant_type_count<V>;
 5932|  10.7M|            const char c = *it;
 5933|  10.7M|            auto is_plain_scalar_boundary = [](const char ch) {
 5934|  10.7M|               switch (ch) {
 5935|  10.7M|               case ' ':
 5936|  10.7M|               case '\t':
 5937|  10.7M|               case '\n':
 5938|  10.7M|               case '\r':
 5939|  10.7M|               case ',':
 5940|  10.7M|               case ']':
 5941|  10.7M|               case '}':
 5942|  10.7M|                  return true;
 5943|  10.7M|               default:
 5944|  10.7M|                  return false;
 5945|  10.7M|               }
 5946|  10.7M|            };
 5947|       |
 5948|  10.7M|            auto has_indented_block_continuation = [&](auto word_end) {
 5949|  10.7M|               if constexpr (yaml::check_flow_context(Opts)) {
 5950|  10.7M|                  return false;
 5951|  10.7M|               }
 5952|  10.7M|               if (ctx.current_indent() < 0) {
 5953|  10.7M|                  return false;
 5954|  10.7M|               }
 5955|  10.7M|               if (word_end == end || (*word_end != '\n' && *word_end != '\r')) {
 5956|  10.7M|                  return false;
 5957|  10.7M|               }
 5958|       |
 5959|  10.7M|               auto look = word_end;
 5960|  10.7M|               yaml::skip_newline(look, end);
 5961|  10.7M|               while (look != end) {
 5962|  10.7M|                  int32_t line_indent = 0;
 5963|  10.7M|                  while (look != end && *look == ' ') {
 5964|  10.7M|                     ++line_indent;
 5965|  10.7M|                     ++look;
 5966|  10.7M|                  }
 5967|  10.7M|                  if (look != end && *look == '\t') {
 5968|  10.7M|                     return false;
 5969|  10.7M|                  }
 5970|  10.7M|                  if (look == end || *look == '\n' || *look == '\r') {
 5971|  10.7M|                     if (look != end) {
 5972|  10.7M|                        yaml::skip_newline(look, end);
 5973|  10.7M|                        continue;
 5974|  10.7M|                     }
 5975|  10.7M|                     return false;
 5976|  10.7M|                  }
 5977|  10.7M|                  if (*look == '#') {
 5978|  10.7M|                     yaml::skip_comment(look, end);
 5979|  10.7M|                     if (look != end && (*look == '\n' || *look == '\r')) {
 5980|  10.7M|                        yaml::skip_newline(look, end);
 5981|  10.7M|                        continue;
 5982|  10.7M|                     }
 5983|  10.7M|                     return false;
 5984|  10.7M|                  }
 5985|       |
 5986|       |                  // If the next non-empty line is an implicit mapping entry,
 5987|       |                  // don't treat it as scalar continuation for auto-deduced
 5988|       |                  // booleans/nulls.
 5989|  10.7M|                  {
 5990|  10.7M|                     auto scan = look;
 5991|  10.7M|                     while (scan != end && *scan != '\n' && *scan != '\r') {
 5992|  10.7M|                        if (*scan == ':') {
 5993|  10.7M|                           auto after_colon = scan + 1;
 5994|  10.7M|                           if (after_colon == end || *after_colon == ' ' || *after_colon == '\t' ||
 5995|  10.7M|                               *after_colon == '\n' || *after_colon == '\r') {
 5996|  10.7M|                              return false;
 5997|  10.7M|                           }
 5998|  10.7M|                        }
 5999|  10.7M|                        ++scan;
 6000|  10.7M|                     }
 6001|  10.7M|                  }
 6002|       |
 6003|  10.7M|                  return line_indent > ctx.current_indent();
 6004|  10.7M|               }
 6005|  10.7M|               return false;
 6006|  10.7M|            };
 6007|  10.7M|            auto is_word_boundary = [&](const auto ptr) {
 6008|  10.7M|               if (ptr == end) {
 6009|  10.7M|                  return true;
 6010|  10.7M|               }
 6011|  10.7M|               if (*ptr == ':') {
 6012|  10.7M|                  auto next = ptr + 1;
 6013|  10.7M|                  return (next == end) || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
 6014|  10.7M|               }
 6015|  10.7M|               return is_plain_scalar_boundary(*ptr);
 6016|  10.7M|            };
 6017|       |
 6018|  10.7M|            switch (c) {
 6019|  2.91M|            case '&': {
  ------------------
  |  Branch (6019:13): [True: 2.91M, False: 7.83M]
  ------------------
 6020|       |               // Anchor before value: parse name, then re-dispatch
 6021|  2.91M|               ++it;
 6022|  2.91M|               auto aname = yaml::parse_anchor_name(it, end);
 6023|  2.91M|               if (aname.empty()) {
  ------------------
  |  Branch (6023:20): [True: 72, False: 2.91M]
  ------------------
 6024|     72|                  ctx.error = error_code::syntax_error;
 6025|     72|                  return;
 6026|     72|               }
 6027|  2.91M|               yaml::skip_inline_ws(it, end);
 6028|  2.91M|               bool anchor_on_same_line = true;
 6029|  2.91M|               bool value_is_indentless_sequence = false;
 6030|  2.91M|               if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (6030:20): [True: 34.6k, False: 2.88M]
  |  Branch (6030:33): [True: 198k, False: 2.68M]
  |  Branch (6030:48): [True: 97.7k, False: 2.58M]
  |  Branch (6030:63): [True: 23.1k, False: 2.56M]
  ------------------
 6031|       |                  // Anchor followed by end-of-line. Check if the value continues on the
 6032|       |                  // next line (indented past current context) or if this is an empty node.
 6033|   353k|                  bool value_on_next_line = false;
 6034|   353k|                  if (it != end) {
  ------------------
  |  Branch (6034:23): [True: 319k, False: 34.6k]
  ------------------
 6035|   319k|                     auto peek = it;
 6036|       |                     // Skip comment if present
 6037|   319k|                     if (*peek == '#') {
  ------------------
  |  Branch (6037:26): [True: 23.1k, False: 296k]
  ------------------
 6038|   183k|                        while (peek != end && *peek != '\n' && *peek != '\r') ++peek;
  ------------------
  |  Branch (6038:32): [True: 183k, False: 508]
  |  Branch (6038:47): [True: 165k, False: 17.3k]
  |  Branch (6038:64): [True: 160k, False: 5.31k]
  ------------------
 6039|  23.1k|                     }
 6040|       |                     // Skip newline
 6041|   319k|                     if (peek != end && (*peek == '\n' || *peek == '\r')) {
  ------------------
  |  Branch (6041:26): [True: 318k, False: 508]
  |  Branch (6041:42): [True: 215k, False: 103k]
  |  Branch (6041:59): [True: 103k, False: 0]
  ------------------
 6042|   318k|                        yaml::skip_newline(peek, end);
 6043|       |                        // Skip blank lines
 6044|   451k|                        while (peek != end && (*peek == '\n' || *peek == '\r')) {
  ------------------
  |  Branch (6044:32): [True: 430k, False: 21.0k]
  |  Branch (6044:48): [True: 41.0k, False: 389k]
  |  Branch (6044:65): [True: 91.3k, False: 297k]
  ------------------
 6045|   132k|                           yaml::skip_newline(peek, end);
 6046|   132k|                        }
 6047|       |                        // Measure indent of next content line
 6048|   318k|                        int32_t next_indent = 0;
 6049|   717k|                        while (peek != end && *peek == ' ') {
  ------------------
  |  Branch (6049:32): [True: 694k, False: 23.2k]
  |  Branch (6049:47): [True: 399k, False: 295k]
  ------------------
 6050|   399k|                           ++next_indent;
 6051|   399k|                           ++peek;
 6052|   399k|                        }
 6053|   318k|                        if (peek != end && *peek != '\n' && *peek != '\r') {
  ------------------
  |  Branch (6053:29): [True: 295k, False: 23.2k]
  |  Branch (6053:44): [True: 291k, False: 3.98k]
  |  Branch (6053:61): [True: 289k, False: 2.31k]
  ------------------
 6054|   289k|                           const bool indentless_sequence =
 6055|   289k|                              (!ctx.sequence_item_value_context) && (*peek == '-') &&
  ------------------
  |  Branch (6055:31): [True: 286k, False: 2.25k]
  |  Branch (6055:69): [True: 45.7k, False: 241k]
  ------------------
 6056|  45.7k|                              ((peek + 1) == end ||
  ------------------
  |  Branch (6056:32): [True: 2.05k, False: 43.7k]
  ------------------
 6057|  43.7k|                               yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(peek + 1))]) &&
  ------------------
  |  Branch (6057:32): [True: 42.5k, False: 1.16k]
  ------------------
 6058|  44.6k|                              (next_indent == ctx.current_indent() ||
  ------------------
  |  Branch (6058:32): [True: 15.1k, False: 29.4k]
  ------------------
 6059|  29.4k|                               (ctx.current_indent() > 0 && (next_indent + 1) == ctx.current_indent()));
  ------------------
  |  Branch (6059:33): [True: 17.6k, False: 11.8k]
  |  Branch (6059:61): [True: 17.0k, False: 600]
  ------------------
 6060|   289k|                           value_is_indentless_sequence = indentless_sequence;
 6061|   289k|                           const bool same_indent_property_node =
 6062|   289k|                              (next_indent == ctx.current_indent()) &&
  ------------------
  |  Branch (6062:31): [True: 27.8k, False: 261k]
  ------------------
 6063|  27.8k|                              (*peek == '!' || *peek == '&' || *peek == '*' || *peek == '[' || *peek == '{' ||
  ------------------
  |  Branch (6063:32): [True: 976, False: 26.8k]
  |  Branch (6063:48): [True: 2.81k, False: 24.0k]
  |  Branch (6063:64): [True: 214, False: 23.8k]
  |  Branch (6063:80): [True: 516, False: 23.3k]
  |  Branch (6063:96): [True: 1.97k, False: 21.3k]
  ------------------
 6064|  21.3k|                               *peek == '"' || *peek == '\'' || *peek == '|' || *peek == '>');
  ------------------
  |  Branch (6064:32): [True: 1.48k, False: 19.8k]
  |  Branch (6064:48): [True: 1.87k, False: 17.9k]
  |  Branch (6064:65): [True: 302, False: 17.6k]
  |  Branch (6064:81): [True: 536, False: 17.1k]
  ------------------
 6065|   289k|                           value_on_next_line =
 6066|   289k|                              (next_indent > ctx.current_indent()) || indentless_sequence || same_indent_property_node;
  ------------------
  |  Branch (6066:31): [True: 233k, False: 55.6k]
  |  Branch (6066:71): [True: 32.1k, False: 23.4k]
  |  Branch (6066:94): [True: 10.6k, False: 12.7k]
  ------------------
 6067|   289k|                        }
 6068|   318k|                     }
 6069|   319k|                  }
 6070|   353k|                  if (!value_on_next_line) {
  ------------------
  |  Branch (6070:23): [True: 77.4k, False: 276k]
  ------------------
 6071|       |                     // Anchor on empty/null node — store empty span, leave value as default
 6072|  77.4k|                     ctx.anchors[std::string(aname)] = {&*it, &*it, ctx.current_indent()};
 6073|  77.4k|                     return;
 6074|  77.4k|                  }
 6075|       |                  // Value is on next line — advance past newline/blank lines to the content
 6076|   276k|                  if (*it == '#') {
  ------------------
  |  Branch (6076:23): [True: 20.0k, False: 256k]
  ------------------
 6077|   148k|                     while (it != end && *it != '\n' && *it != '\r') ++it;
  ------------------
  |  Branch (6077:29): [True: 148k, False: 0]
  |  Branch (6077:42): [True: 131k, False: 16.8k]
  |  Branch (6077:57): [True: 128k, False: 3.21k]
  ------------------
 6078|  20.0k|                  }
 6079|   276k|                  if (it != end) yaml::skip_newline(it, end);
  ------------------
  |  Branch (6079:23): [True: 276k, False: 0]
  ------------------
 6080|   373k|                  while (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (6080:26): [True: 373k, False: 0]
  |  Branch (6080:40): [True: 29.5k, False: 343k]
  |  Branch (6080:55): [True: 67.3k, False: 276k]
  ------------------
 6081|  96.8k|                     yaml::skip_newline(it, end);
 6082|  96.8k|                  }
 6083|   276k|                  yaml::skip_inline_ws(it, end);
 6084|   276k|                  anchor_on_same_line = false;
 6085|   276k|               }
 6086|       |
 6087|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6088|       |                  if (anchor_on_same_line && *it == '-' &&
 6089|       |                      ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))])) {
 6090|       |                     // "&anchor - item" is malformed in block context.
 6091|       |                     ctx.error = error_code::syntax_error;
 6092|       |                     return;
 6093|       |                  }
 6094|       |               }
 6095|       |
 6096|       |               // Anchor on alias (&anchor *alias) is invalid per YAML spec.
 6097|       |               // But alias-as-key (&anchor *alias : value) is valid.
 6098|  2.83M|               if (it != end && *it == '*' && !yaml::alias_token_is_mapping_key(it, end)) {
  ------------------
  |  Branch (6098:20): [True: 2.83M, False: 6]
  |  Branch (6098:33): [True: 1.95k, False: 2.83M]
  |  Branch (6098:47): [True: 24, False: 1.93k]
  ------------------
 6099|     24|                  ctx.error = error_code::syntax_error;
 6100|     24|                  return;
 6101|     24|               }
 6102|       |
 6103|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6104|       |                  if (!anchor_on_same_line && it != end && *it == '&') {
 6105|       |                     auto probe = it + 1;
 6106|       |                     auto nested_anchor_name = yaml::parse_anchor_name(probe, end);
 6107|       |                     if (nested_anchor_name.empty()) {
 6108|       |                        ctx.error = error_code::syntax_error;
 6109|       |                        return;
 6110|       |                     }
 6111|       |                     yaml::skip_inline_ws(probe, end);
 6112|       |                     // Allow nested anchor usage only when it clearly starts a
 6113|       |                     // nested mapping entry ("&k key: value"). Otherwise this is
 6114|       |                     // a second anchor on the same node (4JVG-style), which is invalid.
 6115|       |                     if (!yaml::line_could_be_block_mapping(probe, end)) {
 6116|       |                        ctx.error = error_code::syntax_error;
 6117|       |                        return;
 6118|       |                     }
 6119|       |                  }
 6120|       |               }
 6121|       |
 6122|  2.83M|               const char* anchor_start = &*it;
 6123|  2.83M|               const int32_t anchor_indent = ctx.current_indent();
 6124|       |
 6125|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6126|       |                  // Check if the anchor is on a block-mapping key (&name key: value).
 6127|       |                  // Only when the anchor and key are on the SAME line — if the value was on the
 6128|       |                  // next line, the anchor applies to the entire next-line content.
 6129|       |                  if (anchor_on_same_line && yaml::line_could_be_block_mapping(it, end)) {
 6130|       |                     auto key_start = it;
 6131|       |                     if (*key_start == '!') {
 6132|       |                        const auto key_tag = yaml::parse_yaml_tag(key_start, end, ctx);
 6133|       |                        if (key_tag == yaml::yaml_tag::unknown || !yaml::tag_valid_for_string(key_tag)) {
 6134|       |                           ctx.error = error_code::syntax_error;
 6135|       |                           return;
 6136|       |                        }
 6137|       |                        yaml::skip_inline_ws(key_start, end);
 6138|       |                        if (key_start == end) {
 6139|       |                           ctx.error = error_code::unexpected_end;
 6140|       |                           return;
 6141|       |                        }
 6142|       |                        if (*key_start == '\n' || *key_start == '\r') {
 6143|       |                           ctx.error = error_code::syntax_error;
 6144|       |                           return;
 6145|       |                        }
 6146|       |
 6147|       |                        // Re-apply the anchor-on-alias rule now that the tag is consumed. The
 6148|       |                        // check above ran before the tag, so "&anchor !tag *alias" reached the
 6149|       |                        // key-span registration below while the untagged spelling was rejected;
 6150|       |                        // an alias node carries no other properties either way.
 6151|       |                        if (*key_start == '*' && !yaml::alias_token_is_mapping_key(key_start, end)) {
 6152|       |                           ctx.error = error_code::syntax_error;
 6153|       |                           return;
 6154|       |                        }
 6155|       |                     }
 6156|       |
 6157|       |                     // Find the key span by scanning to the key-value separator
 6158|       |                     auto key_scan = key_start;
 6159|       |                     auto key_end = key_start;
 6160|       |                     if (*key_scan == '"' || *key_scan == '\'') {
 6161|       |                        // Quoted key: skip to closing quote
 6162|       |                        const char quote = *key_scan;
 6163|       |                        ++key_scan;
 6164|       |                        while (key_scan != end && *key_scan != quote) {
 6165|       |                           if (*key_scan == '\\' && quote == '"') {
 6166|       |                              ++key_scan;
 6167|       |                              if (key_scan != end) ++key_scan;
 6168|       |                           }
 6169|       |                           else {
 6170|       |                              ++key_scan;
 6171|       |                           }
 6172|       |                        }
 6173|       |                        if (key_scan == end) {
 6174|       |                           ctx.error = error_code::syntax_error;
 6175|       |                           return;
 6176|       |                        }
 6177|       |                        ++key_scan; // past closing quote
 6178|       |                        key_end = key_scan;
 6179|       |                        yaml::skip_inline_ws(key_scan, end);
 6180|       |                     }
 6181|       |                     else {
 6182|       |                        // Plain key: scan to ':'
 6183|       |                        while (key_scan != end) {
 6184|       |                           if (*key_scan == ':') {
 6185|       |                              auto next = key_scan + 1;
 6186|       |                              if (next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r') {
 6187|       |                                 break;
 6188|       |                              }
 6189|       |                           }
 6190|       |                           ++key_scan;
 6191|       |                        }
 6192|       |                        key_end = key_scan;
 6193|       |                        while (key_end != key_start && (*(key_end - 1) == ' ' || *(key_end - 1) == '\t')) {
 6194|       |                           --key_end;
 6195|       |                        }
 6196|       |                     }
 6197|       |                     if (key_scan == end || *key_scan != ':') {
 6198|       |                        ctx.error = error_code::syntax_error;
 6199|       |                        return;
 6200|       |                     }
 6201|       |                     // Store anchor with just the key text span
 6202|       |                     ctx.anchors[std::string(aname)] = {&*key_start, &*key_end, anchor_indent};
 6203|       |                     it = key_start;
 6204|       |                     // Parse as an object alternative so complex keys (e.g. flow collections) stay in mapping context.
 6205|       |                     if constexpr (counts::n_object > 0) {
 6206|       |                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6207|       |                                                                                                        end);
 6208|       |                     }
 6209|       |                     else {
 6210|       |                        redispatch<Opts>(value, ctx, it, end);
 6211|       |                     }
 6212|       |                     return;
 6213|       |                  }
 6214|       |               }
 6215|       |
 6216|  2.83M|               const bool prev_allow_indentless_sequence = ctx.allow_indentless_sequence;
 6217|  2.83M|               ctx.allow_indentless_sequence = value_is_indentless_sequence;
 6218|  2.83M|               redispatch<Opts>(value, ctx, it, end);
 6219|  2.83M|               ctx.allow_indentless_sequence = prev_allow_indentless_sequence;
 6220|  2.83M|               if (!bool(ctx.error)) {
  ------------------
  |  Branch (6220:20): [True: 2.83M, False: 5.90k]
  ------------------
 6221|  2.83M|                  ctx.anchors[std::string(aname)] = {anchor_start, &*it, anchor_indent};
 6222|  2.83M|               }
 6223|  2.83M|               return;
 6224|  2.83M|            }
 6225|   596k|            case '*': {
  ------------------
  |  Branch (6225:13): [True: 596k, False: 10.1M]
  ------------------
 6226|       |               // In block context, "*alias : value" starts a mapping with an alias key.
 6227|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6228|       |                  if (yaml::alias_token_is_mapping_key(it, end)) {
 6229|       |                     if constexpr (counts::n_object > 0) {
 6230|       |                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6231|       |                                                                                                        end);
 6232|       |                        return;
 6233|       |                     }
 6234|       |                     else {
 6235|       |                        ctx.error = error_code::syntax_error;
 6236|       |                        return;
 6237|       |                     }
 6238|       |                  }
 6239|       |               }
 6240|       |
 6241|       |               // Alias value: look up anchor and replay
 6242|   596k|               yaml::handle_alias<Opts>(value, ctx, it, end);
 6243|   596k|               return;
 6244|  2.83M|            }
 6245|   923k|            case '!': {
  ------------------
  |  Branch (6245:13): [True: 923k, False: 9.82M]
  ------------------
 6246|       |               // Tag - parse it and dispatch based on tag type
 6247|   923k|               const auto tag = yaml::parse_yaml_tag(it, end, ctx);
 6248|   923k|               if (tag == yaml::yaml_tag::unknown) {
  ------------------
  |  Branch (6248:20): [True: 16, False: 923k]
  ------------------
 6249|     16|                  ctx.error = error_code::syntax_error;
 6250|     16|                  return;
 6251|     16|               }
 6252|   923k|               yaml::skip_inline_ws(it, end);
 6253|   923k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (6253:20): [True: 919k, False: 3.45k]
  |  Branch (6253:33): [True: 37.4k, False: 882k]
  ------------------
 6254|  37.4k|                  yaml::skip_comment(it, end);
 6255|  37.4k|               }
 6256|   923k|               if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (6256:20): [True: 918k, False: 4.66k]
  |  Branch (6256:34): [True: 57.0k, False: 861k]
  |  Branch (6256:49): [True: 66.2k, False: 795k]
  ------------------
 6257|   123k|                  auto content = it;
 6258|   123k|                  yaml::skip_newline(content, end);
 6259|   123k|                  yaml::skip_to_content(content, end);
 6260|       |
 6261|   123k|                  bool consume_following_content = false;
 6262|   123k|                  auto content_token = content;
 6263|   123k|                  if (content != end) {
  ------------------
  |  Branch (6263:23): [True: 112k, False: 10.6k]
  ------------------
 6264|   112k|                     auto indent_probe = content;
 6265|   112k|                     const int32_t content_indent = yaml::measure_indent<false>(indent_probe, end, ctx);
 6266|   112k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (6266:26): [True: 6, False: 112k]
  ------------------
 6267|      6|                        return;
 6268|   112k|                     content_token = indent_probe;
 6269|       |
 6270|       |                     // A tag at the end of a sequence/map entry has an empty value
 6271|       |                     // unless the next non-empty content is nested under the current node.
 6272|   112k|                     bool tagged_indentless_sequence = false;
 6273|   112k|                     if (tag == yaml::yaml_tag::seq && indent_probe != end && *indent_probe == '-') {
  ------------------
  |  Branch (6273:26): [True: 16.7k, False: 95.8k]
  |  Branch (6273:56): [True: 16.7k, False: 0]
  |  Branch (6273:79): [True: 4.38k, False: 12.3k]
  ------------------
 6274|  4.38k|                        const auto after_dash = indent_probe + 1;
 6275|  4.38k|                        if (after_dash == end ||
  ------------------
  |  Branch (6275:29): [True: 778, False: 3.60k]
  ------------------
 6276|  4.10k|                            yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_dash)]) {
  ------------------
  |  Branch (6276:29): [True: 3.32k, False: 282]
  ------------------
 6277|  4.10k|                           tagged_indentless_sequence =
 6278|  4.10k|                              (content_indent == ctx.current_indent()) ||
  ------------------
  |  Branch (6278:31): [True: 696, False: 3.40k]
  ------------------
 6279|  3.40k|                              (ctx.current_indent() > 0 && (content_indent + 1) == ctx.current_indent());
  ------------------
  |  Branch (6279:32): [True: 1.10k, False: 2.30k]
  |  Branch (6279:60): [True: 572, False: 534]
  ------------------
 6280|  4.10k|                        }
 6281|  4.38k|                     }
 6282|       |
 6283|   112k|                     consume_following_content = (ctx.current_indent() < 0) ||
  ------------------
  |  Branch (6283:50): [True: 61.1k, False: 51.5k]
  ------------------
 6284|  51.5k|                                                 (content_indent > ctx.current_indent()) || tagged_indentless_sequence;
  ------------------
  |  Branch (6284:50): [True: 11.0k, False: 40.4k]
  |  Branch (6284:93): [True: 1.26k, False: 39.1k]
  ------------------
 6285|   112k|                  }
 6286|       |
 6287|   123k|                  if (consume_following_content) {
  ------------------
  |  Branch (6287:23): [True: 73.4k, False: 49.8k]
  ------------------
 6288|  73.4k|                     it = content_token;
 6289|  73.4k|                  }
 6290|  49.8k|                  else {
 6291|  49.8k|                     if (tag == yaml::yaml_tag::str) {
  ------------------
  |  Branch (6291:26): [True: 538, False: 49.3k]
  ------------------
 6292|    538|                        if constexpr (counts::n_str > 0) {
 6293|    538|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_str>;
 6294|    538|                           using StrType = std::variant_alternative_t<first_idx, V>;
 6295|    538|                           value = StrType{};
 6296|    538|                           return;
 6297|    538|                        }
 6298|    538|                     }
 6299|  49.8k|                     if (tag == yaml::yaml_tag::null_tag) {
  ------------------
  |  Branch (6299:26): [True: 994, False: 48.8k]
  ------------------
 6300|    994|                        if constexpr (counts::n_null > 0) {
 6301|    994|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6302|    994|                           using NullType = std::variant_alternative_t<first_idx, V>;
 6303|    994|                           if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6303:32): [True: 0, False: 994]
  ------------------
 6304|    994|                           return;
 6305|    994|                        }
 6306|    994|                     }
 6307|  49.8k|                     if (tag == yaml::yaml_tag::none) {
  ------------------
  |  Branch (6307:26): [True: 42.7k, False: 7.08k]
  ------------------
 6308|  42.7k|                        if constexpr (counts::n_null > 0) {
 6309|  42.7k|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6310|  42.7k|                           using NullType = std::variant_alternative_t<first_idx, V>;
 6311|  42.7k|                           if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6311:32): [True: 0, False: 42.7k]
  ------------------
 6312|  42.7k|                           return;
 6313|  42.7k|                        }
 6314|  42.7k|                     }
 6315|  49.8k|                  }
 6316|   123k|               }
 6317|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6318|       |                  // In block context, a comma immediately after a tag token is malformed
 6319|       |                  // (e.g., "!!str, value"). Flow context has legitimate ", ] }" usage.
 6320|       |                  if (it != end && *it == ',') {
 6321|       |                     ctx.error = error_code::syntax_error;
 6322|       |                     return;
 6323|       |                  }
 6324|       |                  if constexpr (counts::n_object > 0) {
 6325|       |                     // Tagged keys like "!!str key: value" must parse as mappings.
 6326|       |                     const bool starts_block_sequence_entry =
 6327|       |                        (it != end && *it == '-') &&
 6328|       |                        ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
 6329|       |                     if (!starts_block_sequence_entry && yaml::line_could_be_block_mapping(it, end)) {
 6330|       |                        // Re-dispatch from the post-tag token so '&key key: val' is
 6331|       |                        // handled by the anchor-aware key path, not as a map-level anchor.
 6332|       |                        redispatch<Opts>(value, ctx, it, end);
 6333|       |                        return;
 6334|       |                     }
 6335|       |                  }
 6336|       |               }
 6337|   923k|               if (it == end) {
  ------------------
  |  Branch (6337:20): [True: 4.66k, False: 918k]
  ------------------
 6338|  4.66k|                  if (tag == yaml::yaml_tag::str) {
  ------------------
  |  Branch (6338:23): [True: 1.31k, False: 3.34k]
  ------------------
 6339|  1.31k|                     if constexpr (counts::n_str > 0) {
 6340|  1.31k|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_str>;
 6341|  1.31k|                        using StrType = std::variant_alternative_t<first_idx, V>;
 6342|  1.31k|                        value = StrType{};
 6343|  1.31k|                        return;
 6344|  1.31k|                     }
 6345|  1.31k|                  }
 6346|  4.66k|                  if (tag == yaml::yaml_tag::none) {
  ------------------
  |  Branch (6346:23): [True: 3.33k, False: 1.32k]
  ------------------
 6347|  3.33k|                     if constexpr (counts::n_null > 0) {
 6348|  3.33k|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6349|  3.33k|                        using NullType = std::variant_alternative_t<first_idx, V>;
 6350|  3.33k|                        if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6350:29): [True: 0, False: 3.33k]
  ------------------
 6351|  3.33k|                        return;
 6352|  3.33k|                     }
 6353|  3.33k|                  }
 6354|      0|                  ctx.error = error_code::unexpected_end;
 6355|  4.66k|                  return;
 6356|  4.66k|               }
 6357|   918k|               switch (tag) {
 6358|  1.55k|               case yaml::yaml_tag::str:
  ------------------
  |  Branch (6358:16): [True: 1.55k, False: 917k]
  ------------------
 6359|  1.55k|                  process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6360|  1.55k|                  return;
 6361|  9.39k|               case yaml::yaml_tag::int_tag:
  ------------------
  |  Branch (6361:16): [True: 9.39k, False: 909k]
  ------------------
 6362|  15.4k|               case yaml::yaml_tag::float_tag:
  ------------------
  |  Branch (6362:16): [True: 6.08k, False: 912k]
  ------------------
 6363|  15.4k|                  if constexpr (counts::n_num > 0) {
 6364|  15.4k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, ctx, it, end);
 6365|  15.4k|                     return;
 6366|       |                  }
 6367|       |                  else { // else used to fix MSVC unreachable code warning
 6368|       |                     ctx.error = error_code::syntax_error;
 6369|       |                     return;
 6370|       |                  }
 6371|  53.8k|               case yaml::yaml_tag::bool_tag:
  ------------------
  |  Branch (6371:16): [True: 38.3k, False: 880k]
  ------------------
 6372|  53.8k|                  if constexpr (counts::n_bool > 0) {
 6373|  53.8k|                     process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it, end);
 6374|  53.8k|                     return;
 6375|       |                  }
 6376|       |                  else { // else used to fix MSVC unreachable code warning
 6377|       |                     ctx.error = error_code::syntax_error;
 6378|       |                     return;
 6379|       |                  }
 6380|  54.7k|               case yaml::yaml_tag::null_tag:
  ------------------
  |  Branch (6380:16): [True: 932, False: 917k]
  ------------------
 6381|  54.7k|                  if constexpr (counts::n_null > 0) {
 6382|  54.7k|                     constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6383|  54.7k|                     using NullType = std::variant_alternative_t<first_idx, V>;
 6384|  54.7k|                     if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6384:26): [True: 0, False: 54.7k]
  ------------------
 6385|  54.7k|                     from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6386|  54.7k|                     return;
 6387|       |                  }
 6388|       |                  else { // else used to fix MSVC unreachable code warning
 6389|       |                     ctx.error = error_code::syntax_error;
 6390|       |                     return;
 6391|       |                  }
 6392|   217k|               case yaml::yaml_tag::map:
  ------------------
  |  Branch (6392:16): [True: 162k, False: 756k]
  ------------------
 6393|   217k|                  if constexpr (counts::n_object > 0) {
 6394|   217k|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6395|   217k|                                                                                                     end);
 6396|   217k|                     return;
 6397|       |                  }
 6398|       |                  else { // else used to fix MSVC unreachable code warning
 6399|       |                     ctx.error = error_code::syntax_error;
 6400|       |                     return;
 6401|       |                  }
 6402|   253k|               case yaml::yaml_tag::seq:
  ------------------
  |  Branch (6402:16): [True: 36.2k, False: 882k]
  ------------------
 6403|   253k|                  if constexpr (counts::n_array > 0) {
 6404|   253k|                     const bool prev_allow_indentless_sequence = ctx.allow_indentless_sequence;
 6405|       |                     if constexpr (!yaml::check_flow_context(Opts)) {
 6406|       |                        if (it != end && *it == '-') {
 6407|       |                           ctx.allow_indentless_sequence = true;
 6408|       |                        }
 6409|       |                     }
 6410|   253k|                     process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6411|   253k|                                                                                                    end);
 6412|   253k|                     ctx.allow_indentless_sequence = prev_allow_indentless_sequence;
 6413|   253k|                     return;
 6414|       |                  }
 6415|       |                  else { // else used to fix MSVC unreachable code warning
 6416|       |                     ctx.error = error_code::syntax_error;
 6417|       |                     return;
 6418|       |                  }
 6419|   872k|               default: {
  ------------------
  |  Branch (6419:16): [True: 619k, False: 299k]
  ------------------
 6420|       |                  // Explicit unknown/non-core tags disable implicit scalar resolution.
 6421|       |                  // Preserve collection kinds, otherwise treat as string content.
 6422|   872k|                  if (it != end && *it == '*') {
  ------------------
  |  Branch (6422:23): [True: 619k, False: 253k]
  |  Branch (6422:36): [True: 148k, False: 471k]
  ------------------
 6423|   148k|                     yaml::handle_alias<Opts>(value, ctx, it, end);
 6424|   148k|                     return;
 6425|   148k|                  }
 6426|       |
 6427|   724k|                  if constexpr (counts::n_array > 0) {
 6428|   724k|                     if (it != end && *it == '[') {
  ------------------
  |  Branch (6428:26): [True: 471k, False: 253k]
  |  Branch (6428:39): [True: 8.62k, False: 462k]
  ------------------
 6429|  8.62k|                        process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6430|  8.62k|                                                                                                       end);
 6431|  8.62k|                        return;
 6432|  8.62k|                     }
 6433|   724k|                  }
 6434|   724k|                  if constexpr (counts::n_object > 0) {
 6435|   724k|                     if (it != end && *it == '{') {
  ------------------
  |  Branch (6435:26): [True: 462k, False: 262k]
  |  Branch (6435:39): [True: 2.88k, False: 459k]
  ------------------
 6436|  2.88k|                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6437|  2.88k|                                                                                                        end);
 6438|  2.88k|                        return;
 6439|  2.88k|                     }
 6440|   724k|                  }
 6441|       |
 6442|       |                  if constexpr (!yaml::check_flow_context(Opts)) {
 6443|       |                     if constexpr (counts::n_array > 0) {
 6444|       |                        const bool starts_block_sequence_entry =
 6445|       |                           (it != end && *it == '-') &&
 6446|       |                           ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
 6447|       |                        if (starts_block_sequence_entry) {
 6448|       |                           process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx,
 6449|       |                                                                                                          it, end);
 6450|       |                           return;
 6451|       |                        }
 6452|       |                     }
 6453|       |                     if constexpr (counts::n_object > 0) {
 6454|       |                        const bool starts_explicit_mapping_indicator =
 6455|       |                           (it != end && (*it == '?' || *it == ':')) &&
 6456|       |                           ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
 6457|       |                        if (starts_explicit_mapping_indicator) {
 6458|       |                           process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx,
 6459|       |                                                                                                           it, end);
 6460|       |                           return;
 6461|       |                        }
 6462|       |                        if (yaml::line_could_be_block_mapping(it, end)) {
 6463|       |                           process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx,
 6464|       |                                                                                                           it, end);
 6465|       |                           return;
 6466|       |                        }
 6467|       |                     }
 6468|       |                  }
 6469|       |
 6470|   724k|                  if constexpr (counts::n_str > 0) {
 6471|   724k|                     process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6472|   724k|                     return;
 6473|   724k|                  }
 6474|       |
 6475|       |                  // Fall back if no string alternative exists.
 6476|      0|                  redispatch<Opts>(value, ctx, it, end);
 6477|   724k|                  return;
 6478|   872k|               }
 6479|   918k|               }
 6480|      0|               return;
 6481|   918k|            }
 6482|  3.10M|            case '{':
  ------------------
  |  Branch (6482:13): [True: 3.10M, False: 7.63M]
  ------------------
 6483|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6484|       |                  // In block context, "{...}: value" can be a complex mapping key.
 6485|       |                  if (ctx.current_indent() < 0 && yaml::line_could_be_block_mapping(it, end)) {
 6486|       |                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6487|       |                                                                                                     end);
 6488|       |                     return;
 6489|       |                  }
 6490|       |               }
 6491|       |               // Flow mapping - object type
 6492|  3.10M|               process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it, end);
 6493|  3.10M|               return;
 6494|   147k|            case '[':
  ------------------
  |  Branch (6494:13): [True: 147k, False: 10.5M]
  ------------------
 6495|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6496|       |                  // In block context, "[...]: value" can be a complex mapping key.
 6497|       |                  if (ctx.current_indent() < 0 && yaml::line_could_be_block_mapping(it, end)) {
 6498|       |                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6499|       |                                                                                                     end);
 6500|       |                     return;
 6501|       |                  }
 6502|       |               }
 6503|       |               // Flow sequence - array type
 6504|   147k|               process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it, end);
 6505|   147k|               return;
 6506|   363k|            case '?':
  ------------------
  |  Branch (6506:13): [True: 363k, False: 10.3M]
  ------------------
 6507|       |               // Explicit mapping key indicator ("? key")
 6508|   363k|               if ((end - it >= 2) && it[1] == '\t') {
  ------------------
  |  Branch (6508:20): [True: 363k, False: 12]
  |  Branch (6508:39): [True: 6, False: 363k]
  ------------------
 6509|      6|                  ctx.error = error_code::syntax_error;
 6510|      6|                  return;
 6511|      6|               }
 6512|   363k|               if ((end - it >= 2) && (it[1] == ' ' || it[1] == '\n' || it[1] == '\r')) {
  ------------------
  |  Branch (6512:20): [True: 363k, False: 12]
  |  Branch (6512:40): [True: 98.9k, False: 264k]
  |  Branch (6512:56): [True: 158k, False: 105k]
  |  Branch (6512:73): [True: 71.4k, False: 34.4k]
  ------------------
 6513|   328k|                  if constexpr (counts::n_object > 0) {
 6514|   328k|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6515|   328k|                                                                                                     end);
 6516|   328k|                     return;
 6517|   328k|                  }
 6518|   328k|               }
 6519|      0|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6520|   363k|               return;
 6521|     14|            case '%':
  ------------------
  |  Branch (6521:13): [True: 14, False: 10.7M]
  ------------------
 6522|       |               // Reserved directive indicator is not a plain scalar start.
 6523|     14|               ctx.error = error_code::syntax_error;
 6524|     14|               return;
 6525|  22.1k|            case '"':
  ------------------
  |  Branch (6525:13): [True: 22.1k, False: 10.7M]
  ------------------
 6526|  28.8k|            case '\'':
  ------------------
  |  Branch (6526:13): [True: 6.69k, False: 10.7M]
  ------------------
 6527|       |               // Could be a quoted string OR a quoted key in a block mapping
 6528|       |               // Try block mapping first (e.g., "key": value), then fall back to string
 6529|  28.8k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6530|  28.8k|               return;
 6531|  29.1k|            case 't':
  ------------------
  |  Branch (6531:13): [True: 29.1k, False: 10.7M]
  ------------------
 6532|   278k|            case 'T':
  ------------------
  |  Branch (6532:13): [True: 248k, False: 10.4M]
  ------------------
 6533|       |               // Could be "true", "True", "TRUE", or a key/string starting with t/T
 6534|   278k|               if constexpr (counts::n_bool > 0) {
 6535|   278k|                  if ((end - it >= 4) && ((it[1] == 'r' && it[2] == 'u' && it[3] == 'e') ||
  ------------------
  |  Branch (6535:23): [True: 276k, False: 1.15k]
  |  Branch (6535:44): [True: 250k, False: 26.0k]
  |  Branch (6535:60): [True: 249k, False: 1.45k]
  |  Branch (6535:76): [True: 181k, False: 67.5k]
  ------------------
 6536|   185k|                                          (it[1] == 'R' && it[2] == 'U' && it[3] == 'E'))) {
  ------------------
  |  Branch (6536:44): [True: 7.89k, False: 87.1k]
  |  Branch (6536:60): [True: 5.54k, False: 2.35k]
  |  Branch (6536:76): [True: 4.14k, False: 1.39k]
  ------------------
 6537|       |                     // Check what follows the word "true"
 6538|   185k|                     const auto after_true = it + 4;
 6539|   185k|                     const bool at_word_boundary = is_word_boundary(after_true);
 6540|       |
 6541|   185k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6541:26): [True: 183k, False: 2.73k]
  ------------------
 6542|   183k|                        if (has_indented_block_continuation(after_true)) {
  ------------------
  |  Branch (6542:29): [True: 0, False: 183k]
  ------------------
 6543|      0|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6544|      0|                           return;
 6545|      0|                        }
 6546|       |                        // Check if this is a key (followed by ": ") rather than a boolean value
 6547|       |                        // "true: value" should parse as {true: value}, not as the boolean true
 6548|   183k|                        if ((end - it > 4) && it[4] == ':' &&
  ------------------
  |  Branch (6548:29): [True: 182k, False: 474]
  |  Branch (6548:47): [True: 169k, False: 13.0k]
  ------------------
 6549|   169k|                            (end - it == 5 || it[5] == ' ' || it[5] == '\t' || it[5] == '\n' || it[5] == '\r')) {
  ------------------
  |  Branch (6549:30): [True: 964, False: 168k]
  |  Branch (6549:47): [True: 162k, False: 6.37k]
  |  Branch (6549:63): [True: 2.19k, False: 4.18k]
  |  Branch (6549:80): [True: 2.44k, False: 1.73k]
  |  Branch (6549:97): [True: 1.73k, False: 0]
  ------------------
 6550|       |                           // This is "true:" followed by space/tab/newline/end - treat as key
 6551|   169k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6552|   169k|                           return;
 6553|   169k|                        }
 6554|  13.5k|                        process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it,
 6555|  13.5k|                                                                                                      end);
 6556|  13.5k|                        return;
 6557|   183k|                     }
 6558|       |                     // "true" is followed by more characters (e.g., "True\b") - treat as string
 6559|   185k|                  }
 6560|   278k|               }
 6561|  94.7k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6562|   278k|               return;
 6563|  82.0k|            case 'f':
  ------------------
  |  Branch (6563:13): [True: 82.0k, False: 10.6M]
  ------------------
 6564|   109k|            case 'F':
  ------------------
  |  Branch (6564:13): [True: 27.6k, False: 10.7M]
  ------------------
 6565|       |               // Could be "false", "False", "FALSE", or a key/string starting with f/F
 6566|   109k|               if constexpr (counts::n_bool > 0) {
 6567|   109k|                  if ((end - it >= 5) && ((it[1] == 'a' && it[2] == 'l' && it[3] == 's' && it[4] == 'e') ||
  ------------------
  |  Branch (6567:23): [True: 108k, False: 1.64k]
  |  Branch (6567:44): [True: 45.0k, False: 63.0k]
  |  Branch (6567:60): [True: 26.5k, False: 18.4k]
  |  Branch (6567:76): [True: 25.0k, False: 1.47k]
  |  Branch (6567:92): [True: 24.0k, False: 1.08k]
  ------------------
 6568|  84.0k|                                          (it[1] == 'A' && it[2] == 'L' && it[3] == 'S' && it[4] == 'E'))) {
  ------------------
  |  Branch (6568:44): [True: 5.98k, False: 78.1k]
  |  Branch (6568:60): [True: 4.65k, False: 1.32k]
  |  Branch (6568:76): [True: 3.13k, False: 1.51k]
  |  Branch (6568:92): [True: 1.51k, False: 1.62k]
  ------------------
 6569|       |                     // Check what follows the word "false"
 6570|  25.5k|                     const auto after_false = it + 5;
 6571|  25.5k|                     const bool at_word_boundary = is_word_boundary(after_false);
 6572|       |
 6573|  25.5k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6573:26): [True: 23.3k, False: 2.20k]
  ------------------
 6574|  23.3k|                        if (has_indented_block_continuation(after_false)) {
  ------------------
  |  Branch (6574:29): [True: 0, False: 23.3k]
  ------------------
 6575|      0|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6576|      0|                           return;
 6577|      0|                        }
 6578|       |                        // Check if this is a key (followed by ": ") rather than a boolean value
 6579|       |                        // "false: value" should parse as {false: value}, not as the boolean false
 6580|  23.3k|                        if ((end - it > 5) && it[5] == ':' &&
  ------------------
  |  Branch (6580:29): [True: 22.6k, False: 630]
  |  Branch (6580:47): [True: 18.5k, False: 4.14k]
  ------------------
 6581|  18.5k|                            (end - it == 6 || it[6] == ' ' || it[6] == '\t' || it[6] == '\n' || it[6] == '\r')) {
  ------------------
  |  Branch (6581:30): [True: 1.28k, False: 17.2k]
  |  Branch (6581:47): [True: 8.60k, False: 8.65k]
  |  Branch (6581:63): [True: 4.83k, False: 3.81k]
  |  Branch (6581:80): [True: 1.81k, False: 2.00k]
  |  Branch (6581:97): [True: 2.00k, False: 0]
  ------------------
 6582|       |                           // This is "false:" followed by space/tab/newline/end - treat as key
 6583|  18.5k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6584|  18.5k|                           return;
 6585|  18.5k|                        }
 6586|  4.77k|                        process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it,
 6587|  4.77k|                                                                                                      end);
 6588|  4.77k|                        return;
 6589|  23.3k|                     }
 6590|       |                     // "false" is followed by more characters (e.g., "False\b") - treat as string
 6591|  25.5k|                  }
 6592|   109k|               }
 6593|  86.4k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6594|   109k|               return;
 6595|   119k|            case 'n':
  ------------------
  |  Branch (6595:13): [True: 119k, False: 10.6M]
  ------------------
 6596|   131k|            case 'N':
  ------------------
  |  Branch (6596:13): [True: 12.1k, False: 10.7M]
  ------------------
 6597|       |               // Could be "null", "Null", "NULL", or a key/string starting with n/N
 6598|   131k|               if constexpr (counts::n_null > 0) {
 6599|   131k|                  if ((end - it >= 4) && ((it[1] == 'u' && it[2] == 'l' && it[3] == 'l') ||
  ------------------
  |  Branch (6599:23): [True: 130k, False: 1.04k]
  |  Branch (6599:44): [True: 112k, False: 18.2k]
  |  Branch (6599:60): [True: 80.0k, False: 32.3k]
  |  Branch (6599:76): [True: 76.6k, False: 3.37k]
  ------------------
 6600|  77.9k|                                          (it[1] == 'U' && it[2] == 'L' && it[3] == 'L'))) {
  ------------------
  |  Branch (6600:44): [True: 2.83k, False: 51.1k]
  |  Branch (6600:60): [True: 2.04k, False: 792]
  |  Branch (6600:76): [True: 1.29k, False: 744]
  ------------------
 6601|       |                     // Check what follows the word "null"
 6602|  77.9k|                     const auto after_null = it + 4;
 6603|  77.9k|                     const bool at_word_boundary = is_word_boundary(after_null);
 6604|       |
 6605|  77.9k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6605:26): [True: 74.1k, False: 3.79k]
  ------------------
 6606|  74.1k|                        if (has_indented_block_continuation(after_null)) {
  ------------------
  |  Branch (6606:29): [True: 0, False: 74.1k]
  ------------------
 6607|      0|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6608|      0|                           return;
 6609|      0|                        }
 6610|       |                        // Check if this is a key (followed by ": ") rather than a null value
 6611|       |                        // "null: value" should parse as {null: value}, not as the null type
 6612|  74.1k|                        if ((end - it > 4) && it[4] == ':' &&
  ------------------
  |  Branch (6612:29): [True: 73.8k, False: 296]
  |  Branch (6612:47): [True: 62.3k, False: 11.4k]
  ------------------
 6613|  62.3k|                            (end - it == 5 || it[5] == ' ' || it[5] == '\t' || it[5] == '\n' || it[5] == '\r')) {
  ------------------
  |  Branch (6613:30): [True: 314, False: 62.0k]
  |  Branch (6613:47): [True: 938, False: 61.1k]
  |  Branch (6613:63): [True: 60.0k, False: 1.08k]
  |  Branch (6613:80): [True: 570, False: 510]
  |  Branch (6613:97): [True: 510, False: 0]
  ------------------
 6614|       |                           // This is "null:" followed by space/tab/newline/end - treat as key
 6615|  62.3k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6616|  62.3k|                           return;
 6617|  62.3k|                        }
 6618|  11.7k|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6619|  11.7k|                        using NullType = std::variant_alternative_t<first_idx, V>;
 6620|  11.7k|                        if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6620:29): [True: 0, False: 11.7k]
  ------------------
 6621|  11.7k|                        from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6622|  11.7k|                        return;
 6623|  74.1k|                     }
 6624|       |                     // "null" is followed by more characters (e.g., "Null\b") - treat as string
 6625|  77.9k|                  }
 6626|   131k|               }
 6627|  57.5k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6628|   131k|               return;
 6629|  2.71k|            case '~':
  ------------------
  |  Branch (6629:13): [True: 2.71k, False: 10.7M]
  ------------------
 6630|       |               // Null indicator
 6631|  2.71k|               if constexpr (counts::n_null > 0) {
 6632|  2.71k|                  constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6633|  2.71k|                  using NullType = std::variant_alternative_t<first_idx, V>;
 6634|  2.71k|                  if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6634:23): [True: 0, False: 2.71k]
  ------------------
 6635|  2.71k|                  from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6636|  2.71k|                  return;
 6637|  2.71k|               }
 6638|      0|               break; // Fall through to try other types
 6639|   325k|            case '-':
  ------------------
  |  Branch (6639:13): [True: 325k, False: 10.4M]
  ------------------
 6640|       |               // Could be negative number or block sequence indicator
 6641|   325k|               if (((it + 1) == end) || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(it[1])]) {
  ------------------
  |  Branch (6641:20): [True: 4.17k, False: 321k]
  |  Branch (6641:41): [True: 266k, False: 54.7k]
  ------------------
 6642|       |                  // Block sequence indicator "- "
 6643|   270k|                  if constexpr (counts::n_array > 0) {
 6644|   270k|                     process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6645|   270k|                                                                                                    end);
 6646|   270k|                     return;
 6647|   270k|                  }
 6648|   270k|               }
 6649|   325k|               if constexpr (counts::n_num > 0) {
 6650|   325k|                  if ((end - it >= 2) && (std::isdigit(static_cast<unsigned char>(it[1])) || it[1] == '.')) {
  ------------------
  |  Branch (6650:23): [True: 54.7k, False: 270k]
  |  Branch (6650:43): [True: 3.90k, False: 50.8k]
  |  Branch (6650:94): [True: 6.63k, False: 44.2k]
  ------------------
 6651|  10.5k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, ctx, it, end);
 6652|  10.5k|                     return;
 6653|  10.5k|                  }
 6654|   325k|               }
 6655|   314k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6656|   325k|               return;
 6657|  35.4k|            case '+':
  ------------------
  |  Branch (6657:13): [True: 35.4k, False: 10.7M]
  ------------------
 6658|  83.4k|            case '.':
  ------------------
  |  Branch (6658:13): [True: 47.9k, False: 10.6M]
  ------------------
 6659|       |               // Could be a number (.5, +5, .inf, etc.) or a string (.c, .cpp, +name, etc.)
 6660|       |               // Try parsing as number speculatively, fall back to string on failure
 6661|  83.4k|               if constexpr (counts::n_num > 0) {
 6662|  83.4k|                  auto start_it = it;
 6663|  83.4k|                  auto temp_ctx = ctx.make_speculative();
 6664|  83.4k|                  process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, temp_ctx, it,
 6665|  83.4k|                                                                                               end);
 6666|  83.4k|                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6667|  83.4k|                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6668|  83.4k|                  if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (6668:23): [True: 12.2k, False: 71.1k]
  ------------------
 6669|  12.2k|                     ctx.anchors = std::move(temp_ctx.anchors);
 6670|  12.2k|                     return; // Successfully parsed as number
 6671|  12.2k|                  }
 6672|  71.1k|                  it = start_it; // Restore and fall through to string
 6673|  71.1k|               }
 6674|      0|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6675|  83.4k|               return;
 6676|  1.73M|            default:
  ------------------
  |  Branch (6676:13): [True: 1.73M, False: 9.01M]
  ------------------
 6677|       |               // Check for digit (0-9) - numeric or block mapping key starting with digit
 6678|  1.73M|               if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (6678:20): [True: 1.15M, False: 579k]
  |  Branch (6678:32): [True: 762k, False: 391k]
  ------------------
 6679|       |                  // Try block mapping first (e.g., "123key: value")
 6680|   762k|                  if (try_parse_block_mapping_into_variant<V, Opts>(value, ctx, it, end)) {
  ------------------
  |  Branch (6680:23): [True: 18.5k, False: 743k]
  ------------------
 6681|  18.5k|                     return;
 6682|  18.5k|                  }
 6683|       |                  // Try numeric value speculatively - values like "12:30" look numeric but aren't
 6684|   743k|                  if constexpr (counts::n_num > 0) {
 6685|   743k|                     auto start_it = it;
 6686|   743k|                     auto temp_ctx = ctx.make_speculative();
 6687|   743k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, temp_ctx, it,
 6688|   743k|                                                                                                  end);
 6689|   743k|                     ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6690|   743k|                     ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6691|   743k|                     if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (6691:26): [True: 612k, False: 130k]
  ------------------
 6692|   612k|                        ctx.anchors = std::move(temp_ctx.anchors);
 6693|   612k|                        return; // Successfully parsed as number
 6694|   612k|                     }
 6695|   130k|                     it = start_it; // Restore and fall through to string
 6696|   130k|                  }
 6697|       |                  // Fall through to string
 6698|      0|                  process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6699|   743k|                  return;
 6700|   762k|               }
 6701|       |               // Plain scalar - try block mapping, then string
 6702|   971k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6703|   971k|               return;
 6704|  10.7M|            }
 6705|  10.7M|         }
 6706|       |
 6707|       |         // For non-auto-deducible variants or fallback, try each type until one succeeds
 6708|      0|         constexpr auto N = std::variant_size_v<std::remove_cvref_t<T>>;
 6709|       |
 6710|       |         // This fold discards each alternative's error and reports only that nothing fit, which
 6711|       |         // misdiagnoses a document that exhausted an expansion budget as merely the wrong shape.
 6712|       |         // Kept aside and used only if no alternative parsed, so a later one that does parse
 6713|       |         // (possible under a latched budget if it materializes no key text) is unaffected.
 6714|  10.7M|         error_code expansion_error{};
 6715|  10.7M|         std::string_view expansion_message{};
 6716|       |
 6717|  10.7M|         auto try_parse = [&]<size_t I>() -> bool {
 6718|  10.7M|            using V = std::variant_alternative_t<I, std::remove_cvref_t<T>>;
 6719|  10.7M|            auto start = it;
 6720|       |
 6721|  10.7M|            V v{};
 6722|  10.7M|            auto temp_ctx = ctx.make_speculative();
 6723|  10.7M|            from<YAML, V>::template op<Opts>(v, temp_ctx, it, end);
 6724|  10.7M|            ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6725|  10.7M|            ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6726|       |
 6727|  10.7M|            if (!bool(temp_ctx.error)) {
 6728|  10.7M|               value = std::move(v);
 6729|  10.7M|               ctx.anchors = std::move(temp_ctx.anchors);
 6730|  10.7M|               return true;
 6731|  10.7M|            }
 6732|       |
 6733|  10.7M|            if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 6734|  10.7M|               expansion_error = temp_ctx.error;
 6735|  10.7M|               expansion_message = temp_ctx.custom_error_message;
 6736|  10.7M|            }
 6737|  10.7M|            it = start;
 6738|  10.7M|            return false;
 6739|  10.7M|         };
 6740|       |
 6741|  10.7M|         bool parsed = false;
 6742|  10.7M|         [&]<size_t... Is>(std::index_sequence<Is...>) {
 6743|  10.7M|            ((parsed = parsed || try_parse.template operator()<Is>()), ...);
 6744|  10.7M|         }(std::make_index_sequence<N>{});
 6745|       |
 6746|  10.7M|         if (!parsed) {
  ------------------
  |  Branch (6746:14): [True: 0, False: 10.7M]
  ------------------
 6747|      0|            if (expansion_error != error_code::none) {
  ------------------
  |  Branch (6747:17): [True: 0, False: 0]
  ------------------
 6748|      0|               ctx.error = expansion_error;
 6749|      0|               ctx.custom_error_message = expansion_message;
 6750|      0|            }
 6751|      0|            else {
 6752|      0|               ctx.error = error_code::no_matching_variant_type;
 6753|      0|            }
 6754|      0|         }
 6755|  10.7M|      }
_ZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE10redispatchITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_:
 6762|  2.83M|      {
 6763|  2.83M|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 6764|  2.83M|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (6764:14): [True: 446, False: 2.83M]
  ------------------
 6765|    446|            return;
 6766|  2.83M|         op<Opts>(value, ctx, it, end);
 6767|  2.83M|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERNSt3__17variantIJDndNS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbNS3_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS8_ISF_EEEENSE_ISF_EEEEENS0_12yaml_contextEPKcSN_EEbOT0_RT1_RT2_T3_:
  309|   744k|      {
  310|   744k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 744k]
  |  Branch (310:27): [True: 0, False: 744k]
  ------------------
  311|       |
  312|   744k|         ++it; // skip '*'
  313|   744k|         auto name = parse_anchor_name(it, end);
  314|   744k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 38, False: 744k]
  ------------------
  315|     38|            ctx.error = error_code::syntax_error;
  316|     38|            return true;
  317|     38|         }
  318|       |
  319|   744k|         auto anchor_it = ctx.anchors.find(name);
  320|   744k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 54, False: 744k]
  ------------------
  321|     54|            ctx.error = error_code::syntax_error; // undefined alias
  322|     54|            return true;
  323|     54|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|   744k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|   744k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 91.0k, False: 653k]
  ------------------
  331|  91.0k|            return true;
  332|  91.0k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|   653k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 494, False: 652k]
  ------------------
  338|    494|            ctx.error = error_code::syntax_error; // cyclic alias
  339|    494|            return true;
  340|    494|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|   652k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|   652k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 6, False: 652k]
  ------------------
  348|      6|            return true;
  349|       |
  350|   652k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 66, False: 652k]
  ------------------
  351|     66|            ctx.error = error_code::exceeded_max_expansion;
  352|     66|            ctx.custom_error_message = "alias expansion";
  353|     66|            return true;
  354|     66|         }
  355|       |
  356|   652k|         auto replay_it = span.begin;
  357|   652k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|   652k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|   652k|         ctx.indent_stack.clear();
  362|   652k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 30.2k, False: 622k]
  ------------------
  363|  30.2k|            ctx.push_indent(span.base_indent - 1);
  364|  30.2k|         }
  365|       |
  366|   652k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|   652k|         using V = std::remove_cvref_t<T>;
  369|   652k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|   652k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|   652k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|   652k|         return true;
  376|   652k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_19is_yaml_variant_strEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|  1.56M|      {
 5356|  1.56M|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|  1.56M|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|  1.56M|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|  1.56M|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|  1.56M|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 1.56M, False: 0]
  ------------------
 5366|  1.56M|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|  1.56M|      }
_ZN3glz4fromILj450ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS7_TkNS_10is_contextERNS_4yaml12yaml_contextESC_EEvOT1_OT2_OT0_T3_:
 1987|  1.58M|      {
 1988|  1.58M|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (1988:14): [True: 4.46k, False: 1.57M]
  ------------------
 1989|  4.46k|            return;
 1990|       |
 1991|  1.57M|         yaml::node_preamble_state preamble{};
 1992|  1.57M|         if (yaml::parse_node_preamble<Opts, yaml::node_property_policy{true, false, false, true}>(
  ------------------
  |  Branch (1992:14): [True: 24.0k, False: 1.55M]
  ------------------
 1993|  1.57M|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_string(tag); }))
 1994|  24.0k|            return;
 1995|       |
 1996|  1.55M|         std::string str;
 1997|  1.55M|         const auto style = yaml::detect_scalar_style(*it);
 1998|       |
 1999|  1.55M|         switch (style) {
  ------------------
  |  Branch (1999:18): [True: 1.55M, False: 0]
  ------------------
 2000|  16.7k|         case yaml::scalar_style::double_quoted:
  ------------------
  |  Branch (2000:10): [True: 16.7k, False: 1.53M]
  ------------------
 2001|  16.7k|            yaml::parse_double_quoted_string(str, ctx, it, end);
 2002|  16.7k|            break;
 2003|  3.61k|         case yaml::scalar_style::single_quoted:
  ------------------
  |  Branch (2003:10): [True: 3.61k, False: 1.55M]
  ------------------
 2004|  3.61k|            yaml::parse_single_quoted_string(str, ctx, it, end);
 2005|  3.61k|            break;
 2006|  2.69k|         case yaml::scalar_style::literal_block:
  ------------------
  |  Branch (2006:10): [True: 2.69k, False: 1.55M]
  ------------------
 2007|  11.5k|         case yaml::scalar_style::folded_block:
  ------------------
  |  Branch (2007:10): [True: 8.80k, False: 1.54M]
  ------------------
 2008|       |            // For same-line mapping/sequence values, parsing context is typically pushed
 2009|       |            // one column past the key/item indicator; block scalar indentation is relative
 2010|       |            // to the parent line indent.
 2011|  11.5k|            yaml::parse_block_scalar(str, ctx, it, end,
 2012|  11.5k|                                     ctx.current_indent() > 0 ? (ctx.current_indent() - 1) : ctx.current_indent());
  ------------------
  |  Branch (2012:38): [True: 3.77k, False: 7.72k]
  ------------------
 2013|  11.5k|            break;
 2014|  1.52M|         case yaml::scalar_style::plain:
  ------------------
  |  Branch (2014:10): [True: 1.52M, False: 31.8k]
  ------------------
 2015|       |            // A collection where a string is expected is a type mismatch. Reading it as a
 2016|       |            // plain scalar would store its source text, and for a block sequence only the
 2017|       |            // first entry, as the value.
 2018|  1.52M|            if (yaml::plain_scalar_starts_collection(it, end)) [[unlikely]] {
  ------------------
  |  Branch (2018:17): [True: 40, False: 1.52M]
  ------------------
 2019|     40|               ctx.error = error_code::syntax_error;
 2020|     40|               return;
 2021|     40|            }
 2022|       |            // In block context with known indent, use multiline parsing to support
 2023|       |            // plain scalars that span multiple lines (folding behavior)
 2024|       |            if constexpr (!yaml::check_flow_context(Opts)) {
 2025|       |               if (ctx.current_indent() >= 0) {
 2026|       |                  yaml::parse_plain_scalar_multiline(str, ctx, it, end, ctx.current_indent());
 2027|       |               }
 2028|       |               else {
 2029|       |                  // Top-level plain scalars may continue on same-indent or indented lines.
 2030|       |                  yaml::parse_plain_scalar_multiline(str, ctx, it, end, int32_t(0));
 2031|       |               }
 2032|       |            }
 2033|  1.52M|            else {
 2034|  1.52M|               yaml::parse_plain_scalar(str, ctx, it, end, true);
 2035|  1.52M|            }
 2036|  1.52M|            break;
 2037|  1.55M|         }
 2038|       |
 2039|  1.55M|         if (!bool(ctx.error)) {
  ------------------
  |  Branch (2039:14): [True: 1.55M, False: 168]
  ------------------
 2040|  1.55M|            value = std::move(str);
 2041|  1.55M|            yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 2042|  1.55M|         }
 2043|  1.55M|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1ELb0ELb0ELb1EEELb0ERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_12yaml_contextEPKcSE_ZNS_4fromILj450ESA_E2opITnDaXtlS2_Lj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERSE_SB_TkNS_10is_contextERSC_SE_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSN_RSQ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|  1.57M|      {
  475|  1.57M|         skip_inline_ws(it, end);
  476|       |
  477|  1.57M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 8, False: 1.57M]
  ------------------
  478|      8|            if constexpr (!AllowEmptyInput) {
  479|      8|               ctx.error = error_code::unexpected_end;
  480|      8|            }
  481|      8|            return true;
  482|      8|         }
  483|       |
  484|  1.57M|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|  1.57M|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 6, False: 1.57M]
  ------------------
  486|      6|            ctx.error = error_code::syntax_error;
  487|      6|            return true;
  488|      6|         }
  489|  1.57M|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 6, False: 1.57M]
  ------------------
  490|      6|            ctx.error = error_code::syntax_error;
  491|      6|            return true;
  492|      6|         }
  493|       |
  494|  1.57M|         skip_inline_ws(it, end);
  495|       |
  496|  1.57M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 6, False: 1.57M]
  ------------------
  497|      6|            if constexpr (!AllowEmptyInput) {
  498|      6|               ctx.error = error_code::unexpected_end;
  499|      6|            }
  500|      6|            return true;
  501|      6|         }
  502|       |
  503|  1.57M|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 24.0k, False: 1.55M]
  ------------------
  504|  24.0k|            return true;
  505|  24.0k|         }
  506|       |
  507|  1.55M|         return false;
  508|  1.57M|      }
_ZZN3glz4fromILj450ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS7_TkNS_10is_contextERNS_4yaml12yaml_contextESC_EEvOT1_OT2_OT0_T3_ENKUlNSF_8yaml_tagEE_clESP_:
 1993|  1.57M|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_string(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1ELb0ELb0ELb1EEERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_12yaml_contextEPKcSE_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|  1.57M|      {
  418|  1.57M|         state.has_anchor = false;
  419|  1.57M|         state.anchor_name.clear();
  420|  1.57M|         state.anchor_start = nullptr;
  421|  1.57M|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|  1.57M|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|  1.57M|            else {
  430|  1.57M|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 23.9k, False: 1.55M]
  ------------------
  431|  1.57M|            }
  432|  1.57M|         }
  433|       |
  434|  1.57M|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 1.55M, False: 23.9k]
  |  Branch (434:27): [True: 74.7k, False: 1.48M]
  ------------------
  435|  74.7k|            ++it;
  436|  74.7k|            auto name = parse_anchor_name(it, end);
  437|  74.7k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 32, False: 74.7k]
  ------------------
  438|     32|               ctx.error = error_code::syntax_error;
  439|     32|               return true;
  440|     32|            }
  441|  74.7k|            skip_inline_ws(it, end);
  442|  74.7k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 26, False: 74.7k]
  ------------------
  443|     26|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     26|                  ctx.error = error_code::unexpected_end;
  445|     26|               }
  446|     26|               return true;
  447|     26|            }
  448|  74.7k|            if constexpr (Policy.disallow_anchor_on_alias) {
  449|  74.7k|               if (*it == '*') {
  ------------------
  |  Branch (449:20): [True: 8, False: 74.7k]
  ------------------
  450|      8|                  ctx.error = error_code::syntax_error;
  451|      8|                  return true;
  452|      8|               }
  453|  74.7k|            }
  454|  74.7k|            state.has_anchor = true;
  455|  74.7k|            state.anchor_name = std::string(name);
  456|  74.7k|            state.anchor_start = &*it;
  457|  74.7k|         }
  458|       |
  459|  1.57M|         return false;
  460|  1.57M|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS0_12yaml_contextEPKcSD_EEbOT0_RT1_RT2_T3_:
  309|  1.57M|      {
  310|  1.57M|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 1.57M]
  |  Branch (310:27): [True: 1.55M, False: 23.9k]
  ------------------
  311|       |
  312|  23.9k|         ++it; // skip '*'
  313|  23.9k|         auto name = parse_anchor_name(it, end);
  314|  23.9k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 18, False: 23.9k]
  ------------------
  315|     18|            ctx.error = error_code::syntax_error;
  316|     18|            return true;
  317|     18|         }
  318|       |
  319|  23.9k|         auto anchor_it = ctx.anchors.find(name);
  320|  23.9k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 30, False: 23.9k]
  ------------------
  321|     30|            ctx.error = error_code::syntax_error; // undefined alias
  322|     30|            return true;
  323|     30|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  23.9k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  23.9k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 4.11k, False: 19.8k]
  ------------------
  331|  4.11k|            return true;
  332|  4.11k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  19.8k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 6, False: 19.8k]
  ------------------
  338|      6|            ctx.error = error_code::syntax_error; // cyclic alias
  339|      6|            return true;
  340|      6|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  19.8k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  19.8k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 6, False: 19.8k]
  ------------------
  348|      6|            return true;
  349|       |
  350|  19.8k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 4, False: 19.8k]
  ------------------
  351|      4|            ctx.error = error_code::exceeded_max_expansion;
  352|      4|            ctx.custom_error_message = "alias expansion";
  353|      4|            return true;
  354|      4|         }
  355|       |
  356|  19.8k|         auto replay_it = span.begin;
  357|  19.8k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  19.8k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  19.8k|         ctx.indent_stack.clear();
  362|  19.8k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 2.67k, False: 17.1k]
  ------------------
  363|  2.67k|            ctx.push_indent(span.base_indent - 1);
  364|  2.67k|         }
  365|       |
  366|  19.8k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  19.8k|         using V = std::remove_cvref_t<T>;
  369|  19.8k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  19.8k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  19.8k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  19.8k|         return true;
  376|  19.8k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_19is_yaml_variant_numEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   853k|      {
 5356|   853k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   853k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   853k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   853k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   853k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 853k, False: 0]
  ------------------
 5366|   853k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   853k|      }
_ZN3glz4fromILj450EdE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRdTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_:
 2149|   858k|      {
 2150|   858k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2150:14): [True: 0, False: 858k]
  ------------------
 2151|      0|            return;
 2152|       |
 2153|   858k|         yaml::node_preamble_state preamble{};
 2154|   858k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble, [](yaml::yaml_tag tag) {
  ------------------
  |  Branch (2154:14): [True: 10.6k, False: 848k]
  ------------------
 2155|   858k|                if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2156|   858k|                   return yaml::tag_valid_for_float(tag);
 2157|   858k|                }
 2158|   858k|                else {
 2159|   858k|                   return yaml::tag_valid_for_int(tag);
 2160|   858k|                }
 2161|   858k|             }))
 2162|  10.6k|            return;
 2163|       |
 2164|   848k|         auto finalize = [&] { yaml::finalize_node_anchor(preamble.node_props, ctx, it); };
 2165|       |
 2166|       |         // Check for special float values
 2167|   848k|         if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2168|   848k|            auto start = it;
 2169|       |
 2170|       |            // Check for .inf, .nan, -.inf, etc.
 2171|   848k|            if (*it == '.') {
  ------------------
  |  Branch (2171:17): [True: 53.3k, False: 794k]
  ------------------
 2172|  53.3k|               ++it;
 2173|  53.3k|               if (it + 3 <= end && (std::string_view(it, 3) == "inf" || std::string_view(it, 3) == "Inf" ||
  ------------------
  |  Branch (2173:20): [True: 51.2k, False: 2.08k]
  |  Branch (2173:38): [True: 1.35k, False: 49.9k]
  |  Branch (2173:74): [True: 2.46k, False: 47.4k]
  ------------------
 2174|  47.4k|                                     std::string_view(it, 3) == "INF")) {
  ------------------
  |  Branch (2174:38): [True: 1.37k, False: 46.0k]
  ------------------
 2175|  5.19k|                  value = std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2176|  5.19k|                  it += 3;
 2177|  5.19k|                  finalize();
 2178|  5.19k|                  return;
 2179|  5.19k|               }
 2180|  48.1k|               if (it + 3 <= end && (std::string_view(it, 3) == "nan" || std::string_view(it, 3) == "NaN" ||
  ------------------
  |  Branch (2180:20): [True: 46.0k, False: 2.08k]
  |  Branch (2180:38): [True: 884, False: 45.2k]
  |  Branch (2180:74): [True: 1.27k, False: 43.9k]
  ------------------
 2181|  43.9k|                                     std::string_view(it, 3) == "NAN")) {
  ------------------
  |  Branch (2181:38): [True: 4.62k, False: 39.3k]
  ------------------
 2182|  6.77k|                  value = std::numeric_limits<std::remove_cvref_t<T>>::quiet_NaN();
 2183|  6.77k|                  it += 3;
 2184|  6.77k|                  finalize();
 2185|  6.77k|                  return;
 2186|  6.77k|               }
 2187|  41.4k|               it = start;
 2188|  41.4k|            }
 2189|       |
 2190|   836k|            if (*it == '-' || *it == '+') {
  ------------------
  |  Branch (2190:17): [True: 10.7k, False: 825k]
  |  Branch (2190:31): [True: 35.4k, False: 790k]
  ------------------
 2191|  46.2k|               const char sign = *it;
 2192|  46.2k|               ++it;
 2193|  46.2k|               if (it != end && *it == '.') {
  ------------------
  |  Branch (2193:20): [True: 44.0k, False: 2.13k]
  |  Branch (2193:33): [True: 16.5k, False: 27.5k]
  ------------------
 2194|  16.5k|                  ++it;
 2195|  16.5k|                  if (it + 3 <= end && (std::string_view(it, 3) == "inf" || std::string_view(it, 3) == "Inf" ||
  ------------------
  |  Branch (2195:23): [True: 11.4k, False: 5.09k]
  |  Branch (2195:41): [True: 4.61k, False: 6.82k]
  |  Branch (2195:77): [True: 1.57k, False: 5.25k]
  ------------------
 2196|  9.73k|                                        std::string_view(it, 3) == "INF")) {
  ------------------
  |  Branch (2196:41): [True: 3.54k, False: 1.70k]
  ------------------
 2197|  9.73k|                     if (sign == '-') {
  ------------------
  |  Branch (2197:26): [True: 5.66k, False: 4.06k]
  ------------------
 2198|  5.66k|                        value = -std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2199|  5.66k|                     }
 2200|  4.06k|                     else {
 2201|  4.06k|                        value = std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2202|  4.06k|                     }
 2203|  9.73k|                     it += 3;
 2204|  9.73k|                     finalize();
 2205|  9.73k|                     return;
 2206|  9.73k|                  }
 2207|  16.5k|               }
 2208|  36.4k|               it = start;
 2209|  36.4k|            }
 2210|   836k|         }
 2211|       |
 2212|       |         // Parse as plain scalar and convert
 2213|   826k|         auto start = it;
 2214|       |
 2215|       |         // Find end of number - use same rules as plain scalar for colons
 2216|   123M|         while (it != end) {
  ------------------
  |  Branch (2216:17): [True: 123M, False: 29.2k]
  ------------------
 2217|   123M|            const char c = *it;
 2218|   123M|            if (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == ',' || c == ']' || c == '}' || c == '#') {
  ------------------
  |  Branch (2218:17): [True: 51.2k, False: 123M]
  |  Branch (2218:29): [True: 24.4k, False: 123M]
  |  Branch (2218:42): [True: 26.2k, False: 123M]
  |  Branch (2218:55): [True: 9.32k, False: 123M]
  |  Branch (2218:68): [True: 651k, False: 123M]
  |  Branch (2218:80): [True: 9.00k, False: 123M]
  |  Branch (2218:92): [True: 2.54k, False: 123M]
  |  Branch (2218:104): [True: 31.2k, False: 123M]
  ------------------
 2219|   805k|               break;
 2220|   805k|            }
 2221|       |            // Colon only ends number if followed by space/tab/newline/end (YAML mapping indicator)
 2222|   123M|            if (c == ':') {
  ------------------
  |  Branch (2222:17): [True: 21.8M, False: 101M]
  ------------------
 2223|  21.8M|               if ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\t' || *(it + 1) == '\n' || *(it + 1) == '\r') {
  ------------------
  |  Branch (2223:20): [True: 950, False: 21.8M]
  |  Branch (2223:39): [True: 4.84k, False: 21.8M]
  |  Branch (2223:59): [True: 1.13k, False: 21.8M]
  |  Branch (2223:80): [True: 698, False: 21.8M]
  |  Branch (2223:101): [True: 6.07k, False: 21.8M]
  ------------------
 2224|  13.6k|                  break;
 2225|  13.6k|               }
 2226|  21.8M|            }
 2227|   123M|            ++it;
 2228|   123M|         }
 2229|       |
 2230|   848k|         const std::string_view num_str(&*start, static_cast<size_t>(it - start));
 2231|       |
 2232|   848k|         if (num_str.empty()) {
  ------------------
  |  Branch (2232:14): [True: 1.18k, False: 847k]
  ------------------
 2233|  1.18k|            ctx.error = error_code::parse_number_failure;
 2234|  1.18k|            return;
 2235|  1.18k|         }
 2236|       |
 2237|       |         // Handle hex, octal, binary
 2238|       |         if constexpr (std::integral<std::remove_cvref_t<T>>) {
 2239|       |            if (num_str.size() > 2 && num_str[0] == '0') {
 2240|       |               int base = 10;
 2241|       |               size_t offset = 0;
 2242|       |
 2243|       |               if (num_str[1] == 'x' || num_str[1] == 'X') {
 2244|       |                  base = 16;
 2245|       |                  offset = 2;
 2246|       |               }
 2247|       |               else if (num_str[1] == 'o' || num_str[1] == 'O') {
 2248|       |                  base = 8;
 2249|       |                  offset = 2;
 2250|       |               }
 2251|       |               else if (num_str[1] == 'b' || num_str[1] == 'B') {
 2252|       |                  base = 2;
 2253|       |                  offset = 2;
 2254|       |               }
 2255|       |
 2256|       |               if (base != 10) {
 2257|       |                  const auto digits = num_str.substr(offset);
 2258|       |                  const bool has_underscores = (digits.find('_') != std::string_view::npos);
 2259|       |
 2260|       |                  std::string clean_storage;
 2261|       |                  std::string_view clean_view;
 2262|       |
 2263|       |                  if (has_underscores) {
 2264|       |                     clean_storage.reserve(digits.size());
 2265|       |                     for (char c : digits) {
 2266|       |                        if (c != '_') {
 2267|       |                           clean_storage.push_back(c);
 2268|       |                        }
 2269|       |                     }
 2270|       |                     clean_view = clean_storage;
 2271|       |                  }
 2272|       |                  else {
 2273|       |                     clean_view = digits;
 2274|       |                  }
 2275|       |
 2276|       |                  auto [ptr, ec] =
 2277|       |                     std::from_chars(clean_view.data(), clean_view.data() + clean_view.size(), value, base);
 2278|       |                  if (ec != std::errc{}) {
 2279|       |                     ctx.error = error_code::parse_number_failure;
 2280|       |                  }
 2281|       |                  finalize();
 2282|       |                  return;
 2283|       |               }
 2284|       |            }
 2285|       |         }
 2286|   847k|         else if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2287|   847k|            bool negative = false;
 2288|   847k|            std::string_view digits = num_str;
 2289|       |
 2290|   847k|            if (!digits.empty() && (digits.front() == '+' || digits.front() == '-')) {
  ------------------
  |  Branch (2290:17): [True: 825k, False: 21.7k]
  |  Branch (2290:37): [True: 31.3k, False: 793k]
  |  Branch (2290:62): [True: 5.10k, False: 788k]
  ------------------
 2291|  36.4k|               negative = (digits.front() == '-');
 2292|  36.4k|               digits.remove_prefix(1);
 2293|  36.4k|            }
 2294|       |
 2295|   847k|            if (digits.size() > 2 && digits[0] == '0') {
  ------------------
  |  Branch (2295:17): [True: 167k, False: 679k]
  |  Branch (2295:38): [True: 62.9k, False: 104k]
  ------------------
 2296|  62.9k|               int base = 10;
 2297|  62.9k|               size_t offset = 0;
 2298|       |
 2299|  62.9k|               if (digits[1] == 'x' || digits[1] == 'X') {
  ------------------
  |  Branch (2299:20): [True: 4.26k, False: 58.6k]
  |  Branch (2299:40): [True: 5.51k, False: 53.1k]
  ------------------
 2300|  9.77k|                  base = 16;
 2301|  9.77k|                  offset = 2;
 2302|  9.77k|               }
 2303|  53.1k|               else if (digits[1] == 'o' || digits[1] == 'O') {
  ------------------
  |  Branch (2303:25): [True: 1.46k, False: 51.6k]
  |  Branch (2303:45): [True: 974, False: 50.7k]
  ------------------
 2304|  2.43k|                  base = 8;
 2305|  2.43k|                  offset = 2;
 2306|  2.43k|               }
 2307|  50.7k|               else if (digits[1] == 'b' || digits[1] == 'B') {
  ------------------
  |  Branch (2307:25): [True: 6.24k, False: 44.4k]
  |  Branch (2307:45): [True: 1.08k, False: 43.3k]
  ------------------
 2308|  7.33k|                  base = 2;
 2309|  7.33k|                  offset = 2;
 2310|  7.33k|               }
 2311|       |
 2312|  62.9k|               if (base != 10) {
  ------------------
  |  Branch (2312:20): [True: 19.5k, False: 43.3k]
  ------------------
 2313|  19.5k|                  auto raw_digits = digits.substr(offset);
 2314|  19.5k|                  const bool has_underscores = (raw_digits.find('_') != std::string_view::npos);
 2315|       |
 2316|  19.5k|                  std::string clean_storage;
 2317|  19.5k|                  std::string_view clean_view;
 2318|  19.5k|                  if (has_underscores) {
  ------------------
  |  Branch (2318:23): [True: 7.87k, False: 11.6k]
  ------------------
 2319|  7.87k|                     clean_storage.reserve(raw_digits.size());
 2320|  5.66M|                     for (char c : raw_digits) {
  ------------------
  |  Branch (2320:34): [True: 5.66M, False: 7.87k]
  ------------------
 2321|  5.66M|                        if (c != '_') {
  ------------------
  |  Branch (2321:29): [True: 5.64M, False: 19.2k]
  ------------------
 2322|  5.64M|                           clean_storage.push_back(c);
 2323|  5.64M|                        }
 2324|  5.66M|                     }
 2325|  7.87k|                     clean_view = clean_storage;
 2326|  7.87k|                  }
 2327|  11.6k|                  else {
 2328|  11.6k|                     clean_view = raw_digits;
 2329|  11.6k|                  }
 2330|       |
 2331|  19.5k|                  uint64_t parsed_int{};
 2332|  19.5k|                  auto [ptr, ec] =
 2333|  19.5k|                     std::from_chars(clean_view.data(), clean_view.data() + clean_view.size(), parsed_int, base);
 2334|  19.5k|                  if (ec != std::errc{} || ptr != (clean_view.data() + clean_view.size())) {
  ------------------
  |  Branch (2334:23): [True: 12.7k, False: 6.76k]
  |  Branch (2334:44): [True: 1.52k, False: 5.24k]
  ------------------
 2335|  14.3k|                     ctx.error = error_code::parse_number_failure;
 2336|  14.3k|                     finalize();
 2337|  14.3k|                     return;
 2338|  14.3k|                  }
 2339|       |
 2340|  5.24k|                  const auto as_float = static_cast<std::remove_cvref_t<T>>(parsed_int);
 2341|  5.24k|                  value = negative ? -as_float : as_float;
  ------------------
  |  Branch (2341:27): [True: 1.32k, False: 3.91k]
  ------------------
 2342|  5.24k|                  finalize();
 2343|  5.24k|                  return;
 2344|  19.5k|               }
 2345|  62.9k|            }
 2346|   847k|         }
 2347|       |
 2348|       |         // Standard number parsing - only allocate if underscores present
 2349|   827k|         const bool has_underscores = (num_str.find('_') != std::string_view::npos);
 2350|       |
 2351|   847k|         std::string clean_storage;
 2352|   847k|         std::string_view clean_view;
 2353|       |
 2354|   847k|         if (has_underscores) {
  ------------------
  |  Branch (2354:14): [True: 6.71k, False: 840k]
  ------------------
 2355|  6.71k|            clean_storage.reserve(num_str.size());
 2356|  81.8M|            for (char c : num_str) {
  ------------------
  |  Branch (2356:25): [True: 81.8M, False: 6.71k]
  ------------------
 2357|  81.8M|               if (c != '_') {
  ------------------
  |  Branch (2357:20): [True: 81.8M, False: 15.2k]
  ------------------
 2358|  81.8M|                  clean_storage.push_back(c);
 2359|  81.8M|               }
 2360|  81.8M|            }
 2361|  6.71k|            clean_view = clean_storage;
 2362|  6.71k|         }
 2363|   840k|         else {
 2364|   840k|            clean_view = num_str;
 2365|   840k|         }
 2366|       |
 2367|       |         // YAML allows leading '+' for positive numbers, but C++ from_chars doesn't
 2368|       |         // Strip leading '+' if present
 2369|   847k|         auto parse_view = clean_view;
 2370|   847k|         if (!parse_view.empty() && parse_view.front() == '+') {
  ------------------
  |  Branch (2370:14): [True: 805k, False: 41.3k]
  |  Branch (2370:37): [True: 31.3k, False: 774k]
  ------------------
 2371|  31.3k|            parse_view.remove_prefix(1);
 2372|  31.3k|            if (parse_view.empty()) {
  ------------------
  |  Branch (2372:17): [True: 10.1k, False: 21.2k]
  ------------------
 2373|  10.1k|               ctx.error = error_code::parse_number_failure;
 2374|  10.1k|               return;
 2375|  10.1k|            }
 2376|  31.3k|         }
 2377|       |
 2378|   836k|         if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2379|   836k|            auto result = glz::fast_float::from_chars(parse_view.data(), parse_view.data() + parse_view.size(), value);
 2380|       |            // Check both for errors and that all input was consumed (e.g., "12:30" is not a valid number)
 2381|   836k|            if (result.ec != std::errc{} || result.ptr != parse_view.data() + parse_view.size()) {
  ------------------
  |  Branch (2381:17): [True: 99.7k, False: 737k]
  |  Branch (2381:45): [True: 115k, False: 621k]
  ------------------
 2382|   174k|               ctx.error = error_code::parse_number_failure;
 2383|   174k|            }
 2384|       |         }
 2385|       |         else {
 2386|       |            auto [ptr, ec] = std::from_chars(parse_view.data(), parse_view.data() + parse_view.size(), value);
 2387|       |            // Check both for errors and that all input was consumed
 2388|       |            if (ec != std::errc{} || ptr != parse_view.data() + parse_view.size()) {
 2389|       |               ctx.error = error_code::parse_number_failure;
 2390|       |            }
 2391|       |         }
 2392|       |
 2393|   836k|         finalize();
 2394|   836k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEELb0ERdNS0_12yaml_contextEPKcS7_ZNS_4fromILj450EdE2opITnDaXtlS2_Lj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERS7_S4_TkNS_10is_contextERS5_S7_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSG_RSJ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   858k|      {
  475|   858k|         skip_inline_ws(it, end);
  476|       |
  477|   858k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 94, False: 858k]
  ------------------
  478|     94|            if constexpr (!AllowEmptyInput) {
  479|     94|               ctx.error = error_code::unexpected_end;
  480|     94|            }
  481|     94|            return true;
  482|     94|         }
  483|       |
  484|   858k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   858k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 154, False: 858k]
  ------------------
  486|    154|            ctx.error = error_code::syntax_error;
  487|    154|            return true;
  488|    154|         }
  489|   858k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 62, False: 858k]
  ------------------
  490|     62|            ctx.error = error_code::syntax_error;
  491|     62|            return true;
  492|     62|         }
  493|       |
  494|   858k|         skip_inline_ws(it, end);
  495|       |
  496|   858k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 148, False: 858k]
  ------------------
  497|    148|            if constexpr (!AllowEmptyInput) {
  498|    148|               ctx.error = error_code::unexpected_end;
  499|    148|            }
  500|    148|            return true;
  501|    148|         }
  502|       |
  503|   858k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 10.1k, False: 848k]
  ------------------
  504|  10.1k|            return true;
  505|  10.1k|         }
  506|       |
  507|   848k|         return false;
  508|   858k|      }
_ZZN3glz4fromILj450EdE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRdTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_ENKUlNS8_8yaml_tagEE_clESI_:
 2154|   858k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble, [](yaml::yaml_tag tag) {
 2155|   858k|                if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2156|   858k|                   return yaml::tag_valid_for_float(tag);
 2157|       |                }
 2158|       |                else {
 2159|       |                   return yaml::tag_valid_for_int(tag);
 2160|       |                }
 2161|   858k|             }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEERdNS0_12yaml_contextEPKcS7_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   858k|      {
  418|   858k|         state.has_anchor = false;
  419|   858k|         state.anchor_name.clear();
  420|   858k|         state.anchor_start = nullptr;
  421|   858k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   858k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|   858k|            else {
  430|   858k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 9.57k, False: 848k]
  ------------------
  431|   858k|            }
  432|   858k|         }
  433|       |
  434|   858k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 848k, False: 9.57k]
  |  Branch (434:27): [True: 10.1k, False: 838k]
  ------------------
  435|  10.1k|            ++it;
  436|  10.1k|            auto name = parse_anchor_name(it, end);
  437|  10.1k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 300, False: 9.80k]
  ------------------
  438|    300|               ctx.error = error_code::syntax_error;
  439|    300|               return true;
  440|    300|            }
  441|  9.80k|            skip_inline_ws(it, end);
  442|  9.80k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 286, False: 9.51k]
  ------------------
  443|    286|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|    286|                  ctx.error = error_code::unexpected_end;
  445|    286|               }
  446|    286|               return true;
  447|    286|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  9.51k|            state.has_anchor = true;
  455|  9.51k|            state.anchor_name = std::string(name);
  456|  9.51k|            state.anchor_start = &*it;
  457|  9.51k|         }
  458|       |
  459|   857k|         return false;
  460|   858k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERdNS0_12yaml_contextEPKcS6_EEbOT0_RT1_RT2_T3_:
  309|   858k|      {
  310|   858k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 858k]
  |  Branch (310:27): [True: 848k, False: 9.57k]
  ------------------
  311|       |
  312|  9.57k|         ++it; // skip '*'
  313|  9.57k|         auto name = parse_anchor_name(it, end);
  314|  9.57k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 282, False: 9.28k]
  ------------------
  315|    282|            ctx.error = error_code::syntax_error;
  316|    282|            return true;
  317|    282|         }
  318|       |
  319|  9.28k|         auto anchor_it = ctx.anchors.find(name);
  320|  9.28k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 794, False: 8.49k]
  ------------------
  321|    794|            ctx.error = error_code::syntax_error; // undefined alias
  322|    794|            return true;
  323|    794|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  8.49k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  8.49k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 2.55k, False: 5.94k]
  ------------------
  331|  2.55k|            return true;
  332|  2.55k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  5.94k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 164, False: 5.78k]
  ------------------
  338|    164|            ctx.error = error_code::syntax_error; // cyclic alias
  339|    164|            return true;
  340|    164|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  5.78k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  5.78k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 6, False: 5.77k]
  ------------------
  348|      6|            return true;
  349|       |
  350|  5.77k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 0, False: 5.77k]
  ------------------
  351|      0|            ctx.error = error_code::exceeded_max_expansion;
  352|      0|            ctx.custom_error_message = "alias expansion";
  353|      0|            return true;
  354|      0|         }
  355|       |
  356|  5.77k|         auto replay_it = span.begin;
  357|  5.77k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  5.77k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  5.77k|         ctx.indent_stack.clear();
  362|  5.77k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 234, False: 5.54k]
  ------------------
  363|    234|            ctx.push_indent(span.base_indent - 1);
  364|    234|         }
  365|       |
  366|  5.77k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  5.77k|         using V = std::remove_cvref_t<T>;
  369|  5.77k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  5.77k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  5.77k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  5.77k|         return true;
  376|  5.77k|      }
_ZZN3glz4fromILj450EdE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRdTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_ENKUlvE_clEv:
 2164|   836k|         auto finalize = [&] { yaml::finalize_node_anchor(preamble.node_props, ctx, it); };
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_20is_yaml_variant_boolEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|  56.6k|      {
 5356|  56.6k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|  56.6k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|  56.6k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|  56.6k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|  56.6k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 56.6k, False: 0]
  ------------------
 5366|  56.6k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|  56.6k|      }
_ZN3glz4fromILj450EbE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRbTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_:
 2114|  72.2k|      {
 2115|  72.2k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2115:14): [True: 0, False: 72.2k]
  ------------------
 2116|      0|            return;
 2117|       |
 2118|  72.2k|         yaml::node_preamble_state preamble{};
 2119|  72.2k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble,
  ------------------
  |  Branch (2119:14): [True: 24.9k, False: 47.2k]
  ------------------
 2120|  72.2k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_bool(tag); }))
 2121|  24.9k|            return;
 2122|       |
 2123|       |         // Parse as plain scalar first
 2124|  47.2k|         std::string str;
 2125|  47.2k|         yaml::parse_plain_scalar(str, ctx, it, end, yaml::check_flow_context(Opts));
 2126|       |
 2127|  47.2k|         if (str == "true" || str == "True" || str == "TRUE" || str == "yes" || str == "Yes" || str == "YES" ||
  ------------------
  |  Branch (2127:14): [True: 6.38k, False: 40.9k]
  |  Branch (2127:31): [True: 3.67k, False: 37.2k]
  |  Branch (2127:48): [True: 3.48k, False: 33.7k]
  |  Branch (2127:65): [True: 1.46k, False: 32.2k]
  |  Branch (2127:81): [True: 646, False: 31.6k]
  |  Branch (2127:97): [True: 362, False: 31.2k]
  ------------------
 2128|  31.2k|             str == "on" || str == "On" || str == "ON") {
  ------------------
  |  Branch (2128:14): [True: 456, False: 30.8k]
  |  Branch (2128:29): [True: 1.09k, False: 29.7k]
  |  Branch (2128:44): [True: 236, False: 29.4k]
  ------------------
 2129|  17.7k|            value = true;
 2130|  17.7k|         }
 2131|  29.4k|         else if (str == "false" || str == "False" || str == "FALSE" || str == "no" || str == "No" || str == "NO" ||
  ------------------
  |  Branch (2131:19): [True: 8.24k, False: 21.2k]
  |  Branch (2131:37): [True: 5.69k, False: 15.5k]
  |  Branch (2131:55): [True: 2.09k, False: 13.4k]
  |  Branch (2131:73): [True: 798, False: 12.6k]
  |  Branch (2131:88): [True: 8.87k, False: 3.79k]
  |  Branch (2131:103): [True: 462, False: 3.33k]
  ------------------
 2132|  29.3k|                  str == "off" || str == "Off" || str == "OFF") {
  ------------------
  |  Branch (2132:19): [True: 1.82k, False: 1.50k]
  |  Branch (2132:35): [True: 454, False: 1.05k]
  |  Branch (2132:51): [True: 914, False: 140]
  ------------------
 2133|  29.3k|            value = false;
 2134|  29.3k|         }
 2135|    140|         else {
 2136|    140|            ctx.error = error_code::expected_true_or_false;
 2137|    140|         }
 2138|       |
 2139|  47.2k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 2140|  47.2k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEELb0ERbNS0_12yaml_contextEPKcS7_ZNS_4fromILj450EbE2opITnDaXtlS2_Lj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERS7_S4_TkNS_10is_contextERS5_S7_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSG_RSJ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|  72.2k|      {
  475|  72.2k|         skip_inline_ws(it, end);
  476|       |
  477|  72.2k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 10, False: 72.2k]
  ------------------
  478|     10|            if constexpr (!AllowEmptyInput) {
  479|     10|               ctx.error = error_code::unexpected_end;
  480|     10|            }
  481|     10|            return true;
  482|     10|         }
  483|       |
  484|  72.2k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|  72.2k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 6, False: 72.1k]
  ------------------
  486|      6|            ctx.error = error_code::syntax_error;
  487|      6|            return true;
  488|      6|         }
  489|  72.1k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 6, False: 72.1k]
  ------------------
  490|      6|            ctx.error = error_code::syntax_error;
  491|      6|            return true;
  492|      6|         }
  493|       |
  494|  72.1k|         skip_inline_ws(it, end);
  495|       |
  496|  72.1k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 6, False: 72.1k]
  ------------------
  497|      6|            if constexpr (!AllowEmptyInput) {
  498|      6|               ctx.error = error_code::unexpected_end;
  499|      6|            }
  500|      6|            return true;
  501|      6|         }
  502|       |
  503|  72.1k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 24.8k, False: 47.2k]
  ------------------
  504|  24.8k|            return true;
  505|  24.8k|         }
  506|       |
  507|  47.2k|         return false;
  508|  72.1k|      }
_ZZN3glz4fromILj450EbE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRbTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_ENKUlNS8_8yaml_tagEE_clESI_:
 2120|  72.1k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_bool(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEERbNS0_12yaml_contextEPKcS7_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|  72.1k|      {
  418|  72.1k|         state.has_anchor = false;
  419|  72.1k|         state.anchor_name.clear();
  420|  72.1k|         state.anchor_start = nullptr;
  421|  72.1k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|  72.1k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|  72.1k|            else {
  430|  72.1k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 24.8k, False: 47.3k]
  ------------------
  431|  72.1k|            }
  432|  72.1k|         }
  433|       |
  434|  72.1k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 47.3k, False: 24.8k]
  |  Branch (434:27): [True: 13.3k, False: 33.9k]
  ------------------
  435|  13.3k|            ++it;
  436|  13.3k|            auto name = parse_anchor_name(it, end);
  437|  13.3k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 10, False: 13.3k]
  ------------------
  438|     10|               ctx.error = error_code::syntax_error;
  439|     10|               return true;
  440|     10|            }
  441|  13.3k|            skip_inline_ws(it, end);
  442|  13.3k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 22, False: 13.3k]
  ------------------
  443|     22|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     22|                  ctx.error = error_code::unexpected_end;
  445|     22|               }
  446|     22|               return true;
  447|     22|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  13.3k|            state.has_anchor = true;
  455|  13.3k|            state.anchor_name = std::string(name);
  456|  13.3k|            state.anchor_start = &*it;
  457|  13.3k|         }
  458|       |
  459|  72.1k|         return false;
  460|  72.1k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERbNS0_12yaml_contextEPKcS6_EEbOT0_RT1_RT2_T3_:
  309|  72.1k|      {
  310|  72.1k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 72.1k]
  |  Branch (310:27): [True: 47.3k, False: 24.8k]
  ------------------
  311|       |
  312|  24.8k|         ++it; // skip '*'
  313|  24.8k|         auto name = parse_anchor_name(it, end);
  314|  24.8k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 18, False: 24.8k]
  ------------------
  315|     18|            ctx.error = error_code::syntax_error;
  316|     18|            return true;
  317|     18|         }
  318|       |
  319|  24.8k|         auto anchor_it = ctx.anchors.find(name);
  320|  24.8k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 40, False: 24.8k]
  ------------------
  321|     40|            ctx.error = error_code::syntax_error; // undefined alias
  322|     40|            return true;
  323|     40|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  24.8k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  24.8k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 9.24k, False: 15.5k]
  ------------------
  331|  9.24k|            return true;
  332|  9.24k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  15.5k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 0, False: 15.5k]
  ------------------
  338|      0|            ctx.error = error_code::syntax_error; // cyclic alias
  339|      0|            return true;
  340|      0|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  15.5k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  15.5k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 0, False: 15.5k]
  ------------------
  348|      0|            return true;
  349|       |
  350|  15.5k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 20, False: 15.5k]
  ------------------
  351|     20|            ctx.error = error_code::exceeded_max_expansion;
  352|     20|            ctx.custom_error_message = "alias expansion";
  353|     20|            return true;
  354|     20|         }
  355|       |
  356|  15.5k|         auto replay_it = span.begin;
  357|  15.5k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  15.5k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  15.5k|         ctx.indent_stack.clear();
  362|  15.5k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 2.15k, False: 13.3k]
  ------------------
  363|  2.15k|            ctx.push_indent(span.base_indent - 1);
  364|  2.15k|         }
  365|       |
  366|  15.5k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  15.5k|         using V = std::remove_cvref_t<T>;
  369|  15.5k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  15.5k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  15.5k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  15.5k|         return true;
  376|  15.5k|      }
_ZN3glz4fromILj450EDnE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRDnTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_:
 2500|  15.4k|      {
 2501|  15.4k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2501:14): [True: 0, False: 15.4k]
  ------------------
 2502|      0|            return;
 2503|       |
 2504|  15.4k|         yaml::skip_inline_ws(it, end);
 2505|       |
 2506|  15.4k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2506:14): [True: 14, False: 15.4k]
  ------------------
 2507|     14|            ctx.error = error_code::unexpected_end;
 2508|     14|            return;
 2509|     14|         }
 2510|       |
 2511|       |         // Check for null values: null, Null, NULL, ~
 2512|  15.4k|         if (*it == '~') {
  ------------------
  |  Branch (2512:14): [True: 2.71k, False: 12.7k]
  ------------------
 2513|  2.71k|            ++it;
 2514|  2.71k|            return;
 2515|  2.71k|         }
 2516|       |
 2517|       |         // Parse as plain scalar and check if it's a null keyword
 2518|  12.7k|         auto start = it;
 2519|  59.9k|         while (it != end && !yaml::plain_scalar_end_or_control_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (2519:17): [True: 59.6k, False: 304]
  |  Branch (2519:30): [True: 47.2k, False: 12.3k]
  ------------------
 2520|  47.2k|            ++it;
 2521|  47.2k|         }
 2522|       |
 2523|  12.7k|         std::string_view str{start, static_cast<size_t>(it - start)};
 2524|  12.7k|         if (!yaml::is_yaml_null(str)) {
  ------------------
  |  Branch (2524:14): [True: 30, False: 12.6k]
  ------------------
 2525|     30|            ctx.error = error_code::syntax_error;
 2526|     30|         }
 2527|  12.7k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_22is_yaml_variant_objectEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|  4.29M|      {
 5356|  4.29M|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|  4.29M|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|  4.29M|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|  4.29M|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|  4.29M|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 4.29M, False: 0]
  ------------------
 5366|  4.29M|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|  4.29M|      }
_ZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_:
 4660|  4.42M|      {
 4661|  4.42M|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4661:14): [True: 0, False: 4.42M]
  ------------------
 4662|      0|            return;
 4663|       |
 4664|  4.42M|         yaml::node_preamble_state preamble{};
 4665|  4.42M|         if (yaml::parse_node_preamble<Opts, yaml::node_property_policy{true, true, false, false}>(
  ------------------
  |  Branch (4665:14): [True: 133k, False: 4.28M]
  ------------------
 4666|  4.42M|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_map(tag); }))
 4667|   133k|            return;
 4668|       |
 4669|  4.28M|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 4670|  4.28M|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (4670:14): [True: 1.72k, False: 4.28M]
  ------------------
 4671|  1.72k|            return;
 4672|       |
 4673|  4.28M|         using key_t = typename std::remove_cvref_t<T>::key_type;
 4674|  4.28M|         using val_t = typename std::remove_cvref_t<T>::mapped_type;
 4675|       |
 4676|       |         // Reading a YAML mapping MERGES into the target: an entry overwrites the
 4677|       |         // value of a key that existed before the read and adds new keys, while
 4678|       |         // pre-existing keys the document does not mention are preserved (like a
 4679|       |         // struct/object read, and like json/read.hpp's per-key value[key]).
 4680|       |         // Within a single document a repeated key keeps its FIRST value -- YAML
 4681|       |         // mappings disallow duplicate keys and the conformance suite expects
 4682|       |         // first-wins, which falls out of emplace into an empty map. Any
 4683|       |         // pre-existing entry the document leaves untouched is restored on scope
 4684|       |         // exit (including error paths). When the target starts empty (the common
 4685|       |         // case) this is a no-op with negligible cost.
 4686|  4.28M|         std::remove_cvref_t<T> preexisting_entries;
 4687|  4.28M|         if (!value.empty()) {
  ------------------
  |  Branch (4687:14): [True: 0, False: 4.28M]
  ------------------
 4688|      0|            preexisting_entries = std::move(value);
 4689|      0|            value.clear();
 4690|      0|         }
 4691|  4.28M|         struct merge_restore_guard
 4692|  4.28M|         {
 4693|  4.28M|            std::remove_cvref_t<T>& target;
 4694|  4.28M|            std::remove_cvref_t<T>& saved;
 4695|  4.28M|            ~merge_restore_guard()
 4696|  4.28M|            {
 4697|       |               // emplace is a no-op for keys the document already wrote, so only
 4698|       |               // untouched pre-existing entries are put back.
 4699|  4.28M|               for (auto& entry : saved) {
 4700|  4.28M|                  target.emplace(entry.first, std::move(entry.second));
 4701|  4.28M|               }
 4702|  4.28M|            }
 4703|  4.28M|         } merge_restore{value, preexisting_entries};
 4704|       |
 4705|  4.28M|         const bool treat_as_block_mapping =
 4706|  4.28M|            !yaml::check_flow_context(Opts) && *it == '{' && yaml::inline_value_has_plain_mapping_indicator(it, end);
  ------------------
  |  Branch (4706:13): [Folded, False: 4.28M]
  |  Branch (4706:48): [True: 0, False: 0]
  |  Branch (4706:62): [True: 0, False: 0]
  ------------------
 4707|       |
 4708|  4.28M|         if (*it == '{' && !treat_as_block_mapping) {
  ------------------
  |  Branch (4708:14): [True: 3.13M, False: 1.15M]
  |  Branch (4708:28): [True: 0, Folded]
  ------------------
 4709|       |            // Flow mapping
 4710|  3.13M|            ++it;
 4711|       |            // Skip whitespace and newlines after opening brace
 4712|  3.13M|            yaml::skip_ws_and_newlines(it, end);
 4713|       |
 4714|  3.13M|            if (it != end && *it == '}') {
  ------------------
  |  Branch (4714:17): [True: 3.11M, False: 18.1k]
  |  Branch (4714:30): [True: 23.4k, False: 3.08M]
  ------------------
 4715|  23.4k|               ++it;
 4716|  23.4k|               yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4717|  23.4k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4717:20): [True: 6, False: 23.4k]
  ------------------
 4718|      6|                  return;
 4719|  23.4k|               yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 4720|  23.4k|               return;
 4721|  23.4k|            }
 4722|       |
 4723|  8.44M|            while (it != end) {
  ------------------
  |  Branch (4723:20): [True: 8.40M, False: 42.2k]
  ------------------
 4724|       |               // Skip whitespace and newlines at start of each iteration
 4725|  8.40M|               yaml::skip_ws_and_newlines(it, end);
 4726|       |
 4727|  8.40M|               if (it != end && *it == '}') {
  ------------------
  |  Branch (4727:20): [True: 8.40M, False: 0]
  |  Branch (4727:33): [True: 55.4k, False: 8.34M]
  ------------------
 4728|  55.4k|                  ++it;
 4729|  55.4k|                  yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4730|  55.4k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4730:23): [True: 6, False: 55.4k]
  ------------------
 4731|      6|                     return;
 4732|  55.4k|                  break;
 4733|  55.4k|               }
 4734|       |
 4735|  8.34M|               bool explicit_flow_key = false;
 4736|  8.34M|               auto explicit_probe = it;
 4737|  8.34M|               yaml::skip_inline_ws(explicit_probe, end);
 4738|  8.34M|               if (explicit_probe != end && *explicit_probe == '?') {
  ------------------
  |  Branch (4738:20): [True: 8.34M, False: 0]
  |  Branch (4738:45): [True: 71.5k, False: 8.27M]
  ------------------
 4739|  71.5k|                  const auto after_q = explicit_probe + 1;
 4740|  71.5k|                  if (after_q == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_q)] ||
  ------------------
  |  Branch (4740:23): [True: 8, False: 71.5k]
  |  Branch (4740:41): [True: 42.3k, False: 29.2k]
  ------------------
 4741|  48.5k|                      *after_q == ',' || *after_q == '}') {
  ------------------
  |  Branch (4741:23): [True: 4.97k, False: 24.2k]
  |  Branch (4741:42): [True: 1.20k, False: 23.0k]
  ------------------
 4742|  48.5k|                     explicit_flow_key = true;
 4743|  48.5k|                     it = explicit_probe + 1;
 4744|  48.5k|                     yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4745|  48.5k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4745:26): [True: 6, False: 48.5k]
  ------------------
 4746|      6|                        return;
 4747|  48.5k|                  }
 4748|  71.5k|               }
 4749|       |               // Parse key
 4750|  8.34M|               key_t key{};
 4751|  8.34M|               if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 4752|  8.34M|                  if (explicit_flow_key && it != end && (*it == ':' || *it == ',' || *it == '}')) {
  ------------------
  |  Branch (4752:23): [True: 48.5k, False: 8.29M]
  |  Branch (4752:44): [True: 48.5k, False: 20]
  |  Branch (4752:58): [True: 13.9k, False: 34.5k]
  |  Branch (4752:72): [True: 14.2k, False: 20.3k]
  |  Branch (4752:86): [True: 2.28k, False: 18.0k]
  ------------------
 4753|  30.4k|                     key.clear();
 4754|  30.4k|                  }
 4755|  8.31M|                  else {
 4756|  8.31M|                     auto key_probe = it;
 4757|  8.31M|                     yaml::skip_inline_ws(key_probe, end);
 4758|       |
 4759|       |                     // Use full node parsing only for structurally complex flow keys.
 4760|       |                     // Plain/quoted/alias keys stay on parse_yaml_key() for compatibility.
 4761|  8.31M|                     bool parse_complex_flow_key = false;
 4762|  8.31M|                     if (key_probe != end) {
  ------------------
  |  Branch (4762:26): [True: 8.31M, False: 20]
  ------------------
 4763|  8.31M|                        if (*key_probe == '[' || *key_probe == '{') {
  ------------------
  |  Branch (4763:29): [True: 13.7k, False: 8.30M]
  |  Branch (4763:50): [True: 53.2k, False: 8.24M]
  ------------------
 4764|  66.9k|                           parse_complex_flow_key = true;
 4765|  66.9k|                        }
 4766|  8.24M|                        else if (*key_probe == '&') {
  ------------------
  |  Branch (4766:34): [True: 2.88M, False: 5.36M]
  ------------------
 4767|  2.88M|                           ++key_probe;
 4768|  2.88M|                           yaml::parse_anchor_name(key_probe, end);
 4769|  2.88M|                           yaml::skip_inline_ws(key_probe, end);
 4770|  2.88M|                           if (key_probe != end && (*key_probe == '[' || *key_probe == '{')) {
  ------------------
  |  Branch (4770:32): [True: 2.88M, False: 20]
  |  Branch (4770:53): [True: 17.8k, False: 2.86M]
  |  Branch (4770:74): [True: 1.38M, False: 1.47M]
  ------------------
 4771|  1.40M|                              parse_complex_flow_key = true;
 4772|  1.40M|                           }
 4773|  2.88M|                        }
 4774|  8.31M|                     }
 4775|       |
 4776|  8.31M|                     if (parse_complex_flow_key) {
  ------------------
  |  Branch (4776:26): [True: 1.47M, False: 6.84M]
  ------------------
 4777|  1.47M|                        glz::generic key_node{};
 4778|  1.47M|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 4779|  1.47M|                        if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4779:29): [True: 3.78k, False: 1.47M]
  ------------------
 4780|  3.78k|                           return;
 4781|  1.47M|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (4781:29): [True: 18, False: 1.47M]
  ------------------
 4782|     18|                           return;
 4783|  1.47M|                     }
 4784|  6.84M|                     else {
 4785|  6.84M|                        if (!yaml::parse_yaml_key(key, ctx, it, end, true)) {
  ------------------
  |  Branch (4785:29): [True: 82.4k, False: 6.75M]
  ------------------
 4786|  82.4k|                           return;
 4787|  82.4k|                        }
 4788|  6.84M|                     }
 4789|  8.31M|                  }
 4790|       |               }
 4791|       |               else {
 4792|       |                  if (explicit_flow_key && it != end && (*it == ':' || *it == ',' || *it == '}')) {
 4793|       |                     ctx.error = error_code::syntax_error;
 4794|       |                     return;
 4795|       |                  }
 4796|       |                  from<YAML, key_t>::template op<yaml::flow_context_on<Opts>()>(key, ctx, it, end);
 4797|       |                  if (bool(ctx.error)) [[unlikely]]
 4798|       |                     return;
 4799|       |               }
 4800|       |
 4801|       |               // Separation between flow key and ':' may include comments/newlines.
 4802|       |               // In flow context, newlines are allowed between key and ':'.
 4803|  8.26M|               yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4804|  8.34M|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4804:20): [True: 6, False: 8.34M]
  ------------------
 4805|      6|                  return;
 4806|       |
 4807|  8.34M|               auto parse_implicit_null = [&](val_t& val) -> bool {
 4808|  8.34M|                  if constexpr (nullable_like<std::remove_cvref_t<val_t>>) {
 4809|  8.34M|                     val = {};
 4810|  8.34M|                     return true;
 4811|  8.34M|                  }
 4812|  8.34M|                  else if constexpr (std::same_as<std::remove_cvref_t<val_t>, glz::generic>) {
 4813|  8.34M|                     val = glz::generic{};
 4814|  8.34M|                     return true;
 4815|  8.34M|                  }
 4816|  8.34M|                  else {
 4817|  8.34M|                     static constexpr std::string_view null_value{"null"};
 4818|  8.34M|                     auto null_it = null_value.data();
 4819|  8.34M|                     const yaml::yaml_context::scoped_stream literal_stream{ctx, null_value.data()};
 4820|  8.34M|                     from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(
 4821|  8.34M|                        val, ctx, null_it, null_value.data() + null_value.size());
 4822|  8.34M|                     return !bool(ctx.error);
 4823|  8.34M|                  }
 4824|  8.34M|               };
 4825|       |
 4826|  8.34M|               if (it != end && (*it == ',' || *it == '}')) {
  ------------------
  |  Branch (4826:20): [True: 8.26M, False: 86.2k]
  |  Branch (4826:34): [True: 3.88M, False: 4.37M]
  |  Branch (4826:48): [True: 2.24M, False: 2.12M]
  ------------------
 4827|  6.13M|                  val_t val{};
 4828|  6.13M|                  if (!parse_implicit_null(val)) [[unlikely]]
  ------------------
  |  Branch (4828:23): [True: 0, False: 6.13M]
  ------------------
 4829|      0|                     return;
 4830|       |
 4831|  6.13M|                  value.emplace(std::move(key), std::move(val));
 4832|       |
 4833|  6.13M|                  if (*it == '}') {
  ------------------
  |  Branch (4833:23): [True: 2.24M, False: 3.88M]
  ------------------
 4834|  2.24M|                     ++it;
 4835|  2.24M|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4836|  2.24M|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4836:26): [True: 6, False: 2.24M]
  ------------------
 4837|      6|                        return;
 4838|  2.24M|                     break;
 4839|  2.24M|                  }
 4840|       |
 4841|  3.88M|                  ++it; // skip comma
 4842|  3.88M|                  yaml::skip_ws_and_newlines(it, end);
 4843|  3.88M|                  continue;
 4844|  6.13M|               }
 4845|       |
 4846|  2.20M|               if (it == end || *it != ':') {
  ------------------
  |  Branch (4846:20): [True: 86.2k, False: 2.12M]
  |  Branch (4846:33): [True: 30, False: 2.12M]
  ------------------
 4847|    118|                  ctx.error = error_code::syntax_error;
 4848|    118|                  return;
 4849|    118|               }
 4850|  2.20M|               ++it;
 4851|       |
 4852|  2.20M|               yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4853|  2.20M|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4853:20): [True: 6, False: 2.20M]
  ------------------
 4854|      6|                  return;
 4855|       |
 4856|       |               // Omitted value after an explicit ':' maps to an implicit null.
 4857|  2.20M|               if (it != end && (*it == ',' || *it == '}')) {
  ------------------
  |  Branch (4857:20): [True: 2.12M, False: 86.2k]
  |  Branch (4857:34): [True: 91.2k, False: 2.03M]
  |  Branch (4857:48): [True: 29.5k, False: 2.00M]
  ------------------
 4858|   120k|                  val_t val{};
 4859|   120k|                  if (!parse_implicit_null(val)) [[unlikely]]
  ------------------
  |  Branch (4859:23): [True: 0, False: 120k]
  ------------------
 4860|      0|                     return;
 4861|       |
 4862|   120k|                  value.emplace(std::move(key), std::move(val));
 4863|       |
 4864|   120k|                  if (*it == '}') {
  ------------------
  |  Branch (4864:23): [True: 29.5k, False: 91.2k]
  ------------------
 4865|  29.5k|                     ++it;
 4866|  29.5k|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4867|  29.5k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4867:26): [True: 10, False: 29.4k]
  ------------------
 4868|     10|                        return;
 4869|  29.4k|                     break;
 4870|  29.5k|                  }
 4871|       |
 4872|  91.2k|                  ++it; // skip comma
 4873|  91.2k|                  yaml::skip_ws_and_newlines(it, end);
 4874|  91.2k|                  continue;
 4875|   120k|               }
 4876|       |
 4877|       |               // Parse value
 4878|  2.08M|               val_t val{};
 4879|  2.08M|               from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(val, ctx, it, end);
 4880|  2.08M|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4880:20): [True: 3.06k, False: 2.08M]
  ------------------
 4881|  3.06k|                  return;
 4882|       |
 4883|  2.08M|               value.emplace(std::move(key), std::move(val));
 4884|       |
 4885|  2.08M|               yaml::skip_inline_ws(it, end);
 4886|       |
 4887|  2.08M|               if (it != end && *it == '}') {
  ------------------
  |  Branch (4887:20): [True: 1.99M, False: 86.2k]
  |  Branch (4887:33): [True: 625k, False: 1.37M]
  ------------------
 4888|   625k|                  ++it;
 4889|   625k|                  yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4890|   625k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4890:23): [True: 6, False: 625k]
  ------------------
 4891|      6|                     return;
 4892|   625k|                  break;
 4893|   625k|               }
 4894|  1.45M|               else if (it != end && *it == ',') {
  ------------------
  |  Branch (4894:25): [True: 1.37M, False: 86.2k]
  |  Branch (4894:38): [True: 1.17M, False: 195k]
  ------------------
 4895|  1.17M|                  ++it;
 4896|       |                  // Skip whitespace and newlines after comma
 4897|  1.17M|                  yaml::skip_ws_and_newlines(it, end);
 4898|  1.17M|               }
 4899|   282k|               else if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (4899:25): [True: 195k, False: 86.2k]
  |  Branch (4899:39): [True: 160k, False: 35.6k]
  |  Branch (4899:54): [True: 35.5k, False: 14]
  ------------------
 4900|       |                  // Newlines may precede either the closing brace or the
 4901|       |                  // separator comma for the next entry.
 4902|   195k|                  yaml::skip_ws_and_newlines(it, end);
 4903|   195k|                  if (it != end && *it == '}') {
  ------------------
  |  Branch (4903:23): [True: 195k, False: 26]
  |  Branch (4903:36): [True: 17.2k, False: 178k]
  ------------------
 4904|  17.2k|                     ++it;
 4905|  17.2k|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4906|  17.2k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4906:26): [True: 6, False: 17.2k]
  ------------------
 4907|      6|                        return;
 4908|  17.2k|                     break;
 4909|  17.2k|                  }
 4910|   178k|                  if (it != end && *it == ',') {
  ------------------
  |  Branch (4910:23): [True: 178k, False: 26]
  |  Branch (4910:36): [True: 178k, False: 12]
  ------------------
 4911|   178k|                     ++it;
 4912|   178k|                     yaml::skip_ws_and_newlines(it, end);
 4913|   178k|                     continue;
 4914|   178k|                  }
 4915|     38|                  ctx.error = error_code::syntax_error;
 4916|     38|                  return;
 4917|   178k|               }
 4918|  86.2k|               else {
 4919|  86.2k|                  ctx.error = error_code::syntax_error;
 4920|  86.2k|                  return;
 4921|  86.2k|               }
 4922|  2.08M|            }
 4923|  3.10M|         }
 4924|  1.15M|         else {
 4925|       |            // Block mapping - use shared loop with map-specific callback
 4926|  1.15M|            yaml::parse_block_mapping_loop<Opts>(
 4927|  1.15M|               ctx, it, end, int32_t(-1), [&](auto& ctx, auto& it, auto end, int32_t line_indent) -> bool {
 4928|  1.15M|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|  1.15M|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 4930|  1.15M|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|  1.15M|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|  1.15M|                           if (ctx.stream_begin) {
 4938|  1.15M|                              auto is_line_content_start = [&](auto pos) {
 4939|  1.15M|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|  1.15M|                              };
 4941|       |
 4942|  1.15M|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|  1.15M|                                 const char* line = ctx.line_begin_of(pos);
 4944|  1.15M|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|  1.15M|                                 return line != end && *line == ':';
 4946|  1.15M|                              };
 4947|       |
 4948|  1.15M|                              if (!is_line_content_start(it) &&
 4949|  1.15M|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
 4950|  1.15M|                                  !line_has_explicit_value_indicator(it)) {
 4951|  1.15M|                                 ctx.error = error_code::syntax_error;
 4952|  1.15M|                                 return false;
 4953|  1.15M|                              }
 4954|  1.15M|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|  1.15M|                           }
 4956|  1.15M|                        }
 4957|       |
 4958|  1.15M|                        if (*it == '-' &&
 4959|  1.15M|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
 4960|  1.15M|                            !line_starts_with_explicit_value_indicator) {
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|  1.15M|                           ctx.error = error_code::syntax_error;
 4963|  1.15M|                           return false;
 4964|  1.15M|                        }
 4965|       |
 4966|  1.15M|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 4967|  1.15M|                           return false;
 4968|  1.15M|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|  1.15M|                        ctx.pop_indent();
 4970|  1.15M|                     }
 4971|  1.15M|                     else {
 4972|  1.15M|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|  1.15M|                        if (nested_indent >= 0) {
 4974|  1.15M|                           yaml::skip_to_content(it, end);
 4975|  1.15M|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
 4976|  1.15M|                              ctx.error = error_code::syntax_error;
 4977|  1.15M|                              return false;
 4978|  1.15M|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|  1.15M|                           const int32_t value_indent =
 4982|  1.15M|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
 4983|  1.15M|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
 4984|  1.15M|                              return false;
 4985|  1.15M|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|  1.15M|                           ctx.pop_indent();
 4987|  1.15M|                        }
 4988|  1.15M|                     }
 4989|  1.15M|                     return !bool(ctx.error);
 4990|  1.15M|                  };
 4991|       |
 4992|       |                  // Explicit key entry form:
 4993|       |                  // ? key
 4994|       |                  // : value
 4995|  1.15M|                  if (*it == '?' && ((it + 1) != end) && *(it + 1) == '\t') {
 4996|  1.15M|                     ctx.error = error_code::syntax_error;
 4997|  1.15M|                     return false;
 4998|  1.15M|                  }
 4999|  1.15M|                  if (*it == '?' && ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\n' || *(it + 1) == '\r')) {
 5000|  1.15M|                     ++it; // skip '?'
 5001|  1.15M|                     yaml::skip_inline_ws(it, end);
 5002|       |
 5003|  1.15M|                     const int32_t explicit_value_indicator_indent =
 5004|  1.15M|                        (ctx.current_indent() < 0) ? 0 : (ctx.current_indent() + 1);
 5005|       |
 5006|  1.15M|                     key_t key{};
 5007|  1.15M|                     if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5008|  1.15M|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|  1.15M|                           return yaml::materialize_key(key, key_node, ctx);
 5010|  1.15M|                        };
 5011|       |
 5012|  1.15M|                        auto key_it = it;
 5013|  1.15M|                        yaml::skip_inline_ws(key_it, end);
 5014|       |
 5015|  1.15M|                        auto content = key_it;
 5016|  1.15M|                        yaml::skip_to_content(content, end);
 5017|  1.15M|                        bool handled_anchor_only_empty_key = false;
 5018|       |
 5019|       |                        // Anchor on an empty explicit key node:
 5020|       |                        //   ? &a
 5021|       |                        //   : value
 5022|  1.15M|                        if (content != end && *content == '&') {
 5023|  1.15M|                           auto anchor_probe = content + 1;
 5024|  1.15M|                           auto anchor_name = yaml::parse_anchor_name(anchor_probe, end);
 5025|  1.15M|                           if (!anchor_name.empty()) {
 5026|  1.15M|                              auto after_anchor = anchor_probe;
 5027|  1.15M|                              yaml::skip_inline_ws(after_anchor, end);
 5028|       |
 5029|  1.15M|                              auto value_indicator = after_anchor;
 5030|  1.15M|                              if (value_indicator != end && *value_indicator == ':') {
 5031|  1.15M|                                 key.clear();
 5032|  1.15M|                                 ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5033|  1.15M|                                 it = value_indicator;
 5034|  1.15M|                                 handled_anchor_only_empty_key = true;
 5035|  1.15M|                              }
 5036|  1.15M|                              else {
 5037|  1.15M|                                 if (value_indicator != end && *value_indicator == '#') {
 5038|  1.15M|                                    yaml::skip_comment(value_indicator, end);
 5039|  1.15M|                                 }
 5040|  1.15M|                                 if (value_indicator != end && (*value_indicator == '\n' || *value_indicator == '\r')) {
 5041|  1.15M|                                    yaml::skip_newline(value_indicator, end);
 5042|  1.15M|                                    auto value_line = value_indicator;
 5043|  1.15M|                                    int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5044|  1.15M|                                    if (bool(ctx.error)) [[unlikely]]
 5045|  1.15M|                                       return false;
 5046|  1.15M|                                    if (value_line != end && *value_line == ':' &&
 5047|  1.15M|                                        value_indent == explicit_value_indicator_indent) {
 5048|  1.15M|                                       key.clear();
 5049|  1.15M|                                       ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5050|  1.15M|                                       it = value_line;
 5051|  1.15M|                                       handled_anchor_only_empty_key = true;
 5052|  1.15M|                                    }
 5053|  1.15M|                                    else if (value_line != end && *value_line == ':') {
 5054|       |                                       // In explicit-key form ("? &a"), a following ':'
 5055|       |                                       // starts the outer value indicator only at the same
 5056|       |                                       // indentation. A deeper-indented ': value' is malformed.
 5057|  1.15M|                                       ctx.error = error_code::syntax_error;
 5058|  1.15M|                                       return false;
 5059|  1.15M|                                    }
 5060|  1.15M|                                 }
 5061|  1.15M|                              }
 5062|  1.15M|                           }
 5063|  1.15M|                        }
 5064|       |
 5065|  1.15M|                        const bool key_content_spans_lines = [&] {
 5066|  1.15M|                           auto scan = key_it;
 5067|  1.15M|                           while (scan != content && scan != end) {
 5068|  1.15M|                              if (*scan == '\n' || *scan == '\r') return true;
 5069|  1.15M|                              ++scan;
 5070|  1.15M|                           }
 5071|  1.15M|                           return false;
 5072|  1.15M|                        }();
 5073|       |
 5074|  1.15M|                        if (handled_anchor_only_empty_key) {
 5075|       |                           // 'it' already points to the explicit value indicator ':'
 5076|  1.15M|                        }
 5077|  1.15M|                        else if (content == end || (*content == ':' && key_content_spans_lines)) {
 5078|  1.15M|                           key.clear();
 5079|  1.15M|                           it = content;
 5080|  1.15M|                        }
 5081|  1.15M|                        else {
 5082|       |                           // Explicit mapping keys ('? key-node') are full YAML nodes.
 5083|       |                           // Parse the key node structurally (not via plain-key scanning)
 5084|       |                           // so inputs like '? []: x' and '? JSON: like' are interpreted
 5085|       |                           // as complex keys, not split into implicit key/value pairs.
 5086|  1.15M|                           auto key_node_it = content;
 5087|  1.15M|                           auto key_node_end = end;
 5088|  1.15M|                           if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 5089|       |                              // In explicit-key form, a following standalone ':'
 5090|       |                              // line (same or lower indentation) belongs to the
 5091|       |                              // outer mapping value, not the key node itself.
 5092|  1.15M|                              auto scan = content;
 5093|  1.15M|                              while (scan != end) {
 5094|  1.15M|                                 while (scan != end && *scan != '\n' && *scan != '\r') {
 5095|  1.15M|                                    ++scan;
 5096|  1.15M|                                 }
 5097|  1.15M|                                 if (scan == end) {
 5098|  1.15M|                                    break;
 5099|  1.15M|                                 }
 5100|       |
 5101|  1.15M|                                 yaml::skip_newline(scan, end);
 5102|  1.15M|                                 auto line_start = scan;
 5103|       |
 5104|  1.15M|                                 int32_t indicator_indent = 0;
 5105|  1.15M|                                 while (scan != end && *scan == ' ') {
 5106|  1.15M|                                    ++indicator_indent;
 5107|  1.15M|                                    ++scan;
 5108|  1.15M|                                 }
 5109|       |
 5110|  1.15M|                                 if (scan != end && *scan == ':') {
 5111|  1.15M|                                    const auto after_colon = scan + 1;
 5112|  1.15M|                                    if ((after_colon == end ||
 5113|  1.15M|                                         yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
 5114|  1.15M|                                        indicator_indent <= line_indent) {
 5115|  1.15M|                                       key_node_end = line_start;
 5116|  1.15M|                                       break;
 5117|  1.15M|                                    }
 5118|  1.15M|                                 }
 5119|  1.15M|                              }
 5120|  1.15M|                           }
 5121|       |
 5122|  1.15M|                           glz::generic key_node{};
 5123|  1.15M|                           const bool prev_explicit_mapping_key_context = ctx.explicit_mapping_key_context;
 5124|  1.15M|                           ctx.explicit_mapping_key_context = true;
 5125|  1.15M|                           from<YAML, glz::generic>::template op<Opts>(key_node, ctx, key_node_it, key_node_end);
 5126|  1.15M|                           ctx.explicit_mapping_key_context = prev_explicit_mapping_key_context;
 5127|  1.15M|                           if (bool(ctx.error)) [[unlikely]]
 5128|  1.15M|                              return false;
 5129|  1.15M|                           it = key_node_it;
 5130|  1.15M|                           if (!to_string_key(key_node)) [[unlikely]]
 5131|  1.15M|                              return false;
 5132|  1.15M|                        }
 5133|  1.15M|                     }
 5134|  1.15M|                     else {
 5135|  1.15M|                        if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 5136|  1.15M|                           from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5137|  1.15M|                           if (bool(ctx.error)) [[unlikely]]
 5138|  1.15M|                              return false;
 5139|  1.15M|                        }
 5140|  1.15M|                     }
 5141|       |
 5142|  1.15M|                     yaml::skip_inline_ws(it, end);
 5143|  1.15M|                     yaml::skip_comment(it, end);
 5144|       |
 5145|       |                     // Value indicator may appear on the next line at the same indent.
 5146|  1.15M|                     if (it != end && (*it == '\n' || *it == '\r')) {
 5147|  1.15M|                        auto probe = it;
 5148|  1.15M|                        bool found_value_indicator = false;
 5149|       |
 5150|  1.15M|                        while (probe != end && (*probe == '\n' || *probe == '\r')) {
 5151|  1.15M|                           yaml::skip_newline(probe, end);
 5152|       |
 5153|  1.15M|                           auto value_line = probe;
 5154|  1.15M|                           int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5155|  1.15M|                           if (bool(ctx.error)) [[unlikely]]
 5156|  1.15M|                              return false;
 5157|       |
 5158|  1.15M|                           if (value_line == end || *value_line == '\n' || *value_line == '\r') {
 5159|  1.15M|                              probe = value_line;
 5160|  1.15M|                              continue; // blank line
 5161|  1.15M|                           }
 5162|  1.15M|                           if (*value_line == '#') {
 5163|  1.15M|                              yaml::skip_comment(value_line, end);
 5164|  1.15M|                              probe = value_line;
 5165|  1.15M|                              continue; // comment-only line
 5166|  1.15M|                           }
 5167|  1.15M|                           if (*value_line == ':' && value_indent == explicit_value_indicator_indent) {
 5168|  1.15M|                              it = value_line;
 5169|  1.15M|                              found_value_indicator = true;
 5170|  1.15M|                           }
 5171|  1.15M|                           break;
 5172|  1.15M|                        }
 5173|       |
 5174|  1.15M|                        if (found_value_indicator) {
 5175|  1.15M|                           yaml::skip_inline_ws(it, end);
 5176|  1.15M|                        }
 5177|  1.15M|                     }
 5178|       |
 5179|  1.15M|                     val_t val{};
 5180|  1.15M|                     if (it != end && *it == ':') {
 5181|  1.15M|                        ++it;
 5182|  1.15M|                        if (it != end && *it == '\t') {
 5183|  1.15M|                           ctx.error = error_code::syntax_error;
 5184|  1.15M|                           return false;
 5185|  1.15M|                        }
 5186|  1.15M|                        if (it != end && (*it == '\n' || *it == '\r')) {
 5187|  1.15M|                           auto probe = it;
 5188|  1.15M|                           yaml::skip_newline(probe, end);
 5189|  1.15M|                           while (probe != end && *probe == ' ') ++probe;
 5190|  1.15M|                           if (probe != end && *probe == ':' && ((probe + 1) != end) && *(probe + 1) == '\t') {
 5191|  1.15M|                              ctx.error = error_code::syntax_error;
 5192|  1.15M|                              return false;
 5193|  1.15M|                           }
 5194|  1.15M|                        }
 5195|  1.15M|                        yaml::skip_inline_ws(it, end);
 5196|  1.15M|                        if (!parse_map_value(val)) [[unlikely]]
 5197|  1.15M|                           return false;
 5198|  1.15M|                     }
 5199|       |
 5200|  1.15M|                     value.emplace(std::move(key), std::move(val));
 5201|  1.15M|                     return true;
 5202|  1.15M|                  }
 5203|       |
 5204|  1.15M|                  key_t key{};
 5205|  1.15M|                  if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5206|  1.15M|                     auto key_probe = it;
 5207|  1.15M|                     yaml::skip_inline_ws(key_probe, end);
 5208|  1.15M|                     const bool complex_flow_key = (key_probe != end && (*key_probe == '[' || *key_probe == '{'));
 5209|  1.15M|                     if (complex_flow_key) {
 5210|  1.15M|                        glz::generic key_node{};
 5211|  1.15M|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 5212|  1.15M|                        if (bool(ctx.error)) [[unlikely]]
 5213|  1.15M|                           return false;
 5214|  1.15M|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
 5215|  1.15M|                           return false;
 5216|  1.15M|                     }
 5217|  1.15M|                     else {
 5218|  1.15M|                        if (!yaml::parse_yaml_key(key, ctx, it, end, false)) {
 5219|  1.15M|                           return false;
 5220|  1.15M|                        }
 5221|  1.15M|                     }
 5222|  1.15M|                  }
 5223|  1.15M|                  else {
 5224|  1.15M|                     from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5225|  1.15M|                     if (bool(ctx.error)) [[unlikely]]
 5226|  1.15M|                        return false;
 5227|  1.15M|                  }
 5228|       |
 5229|  1.15M|                  yaml::skip_inline_ws(it, end);
 5230|       |
 5231|  1.15M|                  if (it == end || *it != ':') {
 5232|  1.15M|                     ctx.error = error_code::syntax_error;
 5233|  1.15M|                     return false;
 5234|  1.15M|                  }
 5235|  1.15M|                  ++it;
 5236|  1.15M|                  yaml::skip_inline_ws(it, end);
 5237|       |
 5238|  1.15M|                  val_t val{};
 5239|  1.15M|                  if (!parse_map_value(val)) [[unlikely]]
 5240|  1.15M|                     return false;
 5241|       |
 5242|  1.15M|                  value.emplace(std::move(key), std::move(val));
 5243|  1.15M|                  return true;
 5244|  1.15M|               });
 5245|  1.15M|         }
 5246|       |
 5247|  4.17M|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 5248|  4.17M|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1ELb1EEELb0ERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES4_EEEENS0_12yaml_contextEPKcSC_ZNS_4fromILj450ES8_E2opITnDaXtlS2_Lj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERSC_S9_TkNS_10is_contextERSA_SC_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSL_RSO_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|  4.42M|      {
  475|  4.42M|         skip_inline_ws(it, end);
  476|       |
  477|  4.42M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 10, False: 4.42M]
  ------------------
  478|     10|            if constexpr (!AllowEmptyInput) {
  479|     10|               ctx.error = error_code::unexpected_end;
  480|     10|            }
  481|     10|            return true;
  482|     10|         }
  483|       |
  484|  4.42M|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|  4.42M|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 6, False: 4.42M]
  ------------------
  486|      6|            ctx.error = error_code::syntax_error;
  487|      6|            return true;
  488|      6|         }
  489|  4.42M|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 6, False: 4.42M]
  ------------------
  490|      6|            ctx.error = error_code::syntax_error;
  491|      6|            return true;
  492|      6|         }
  493|       |
  494|  4.42M|         skip_inline_ws(it, end);
  495|       |
  496|  4.42M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 6, False: 4.42M]
  ------------------
  497|      6|            if constexpr (!AllowEmptyInput) {
  498|      6|               ctx.error = error_code::unexpected_end;
  499|      6|            }
  500|      6|            return true;
  501|      6|         }
  502|       |
  503|  4.42M|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 133k, False: 4.28M]
  ------------------
  504|   133k|            return true;
  505|   133k|         }
  506|       |
  507|  4.28M|         return false;
  508|  4.42M|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlNSD_8yaml_tagEE_clESN_:
 4666|  4.42M|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_map(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1ELb1EEERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES4_EEEENS0_12yaml_contextEPKcSC_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|  4.42M|      {
  418|  4.42M|         state.has_anchor = false;
  419|  4.42M|         state.anchor_name.clear();
  420|  4.42M|         state.anchor_start = nullptr;
  421|  4.42M|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|  4.42M|         if constexpr (Policy.allow_alias) {
  424|  4.42M|            if constexpr (Policy.alias_can_be_mapping_key) {
  425|  4.42M|               if (!alias_token_is_mapping_key(it, end)) {
  ------------------
  |  Branch (425:20): [True: 4.41M, False: 2.62k]
  ------------------
  426|  4.41M|                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (426:23): [True: 133k, False: 4.28M]
  ------------------
  427|  4.41M|               }
  428|       |            }
  429|       |            else {
  430|       |               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  431|       |            }
  432|  4.42M|         }
  433|       |
  434|  4.42M|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 4.28M, False: 133k]
  |  Branch (434:27): [True: 134k, False: 4.15M]
  ------------------
  435|   134k|            ++it;
  436|   134k|            auto name = parse_anchor_name(it, end);
  437|   134k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 20, False: 134k]
  ------------------
  438|     20|               ctx.error = error_code::syntax_error;
  439|     20|               return true;
  440|     20|            }
  441|   134k|            skip_inline_ws(it, end);
  442|   134k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 14, False: 134k]
  ------------------
  443|     14|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     14|                  ctx.error = error_code::unexpected_end;
  445|     14|               }
  446|     14|               return true;
  447|     14|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|   134k|            state.has_anchor = true;
  455|   134k|            state.anchor_name = std::string(name);
  456|   134k|            state.anchor_start = &*it;
  457|   134k|         }
  458|       |
  459|  4.42M|         return false;
  460|  4.42M|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES3_EEEENS0_12yaml_contextEPKcSB_EEbOT0_RT1_RT2_T3_:
  309|  4.41M|      {
  310|  4.41M|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 4.41M]
  |  Branch (310:27): [True: 4.28M, False: 133k]
  ------------------
  311|       |
  312|   133k|         ++it; // skip '*'
  313|   133k|         auto name = parse_anchor_name(it, end);
  314|   133k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 14, False: 133k]
  ------------------
  315|     14|            ctx.error = error_code::syntax_error;
  316|     14|            return true;
  317|     14|         }
  318|       |
  319|   133k|         auto anchor_it = ctx.anchors.find(name);
  320|   133k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 48, False: 133k]
  ------------------
  321|     48|            ctx.error = error_code::syntax_error; // undefined alias
  322|     48|            return true;
  323|     48|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|   133k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|   133k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 3.36k, False: 129k]
  ------------------
  331|  3.36k|            return true;
  332|  3.36k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|   129k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 50, False: 129k]
  ------------------
  338|     50|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     50|            return true;
  340|     50|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|   129k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|   129k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 6, False: 129k]
  ------------------
  348|      6|            return true;
  349|       |
  350|   129k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 40, False: 129k]
  ------------------
  351|     40|            ctx.error = error_code::exceeded_max_expansion;
  352|     40|            ctx.custom_error_message = "alias expansion";
  353|     40|            return true;
  354|     40|         }
  355|       |
  356|   129k|         auto replay_it = span.begin;
  357|   129k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|   129k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|   129k|         ctx.indent_stack.clear();
  362|   129k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 1.25k, False: 128k]
  ------------------
  363|  1.25k|            ctx.push_indent(span.base_indent - 1);
  364|  1.25k|         }
  365|       |
  366|   129k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|   129k|         using V = std::remove_cvref_t<T>;
  369|   129k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|   129k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|   129k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|   129k|         return true;
  376|   129k|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRS4_E_clESN_:
 4807|  6.25M|               auto parse_implicit_null = [&](val_t& val) -> bool {
 4808|       |                  if constexpr (nullable_like<std::remove_cvref_t<val_t>>) {
 4809|       |                     val = {};
 4810|       |                     return true;
 4811|       |                  }
 4812|  6.25M|                  else if constexpr (std::same_as<std::remove_cvref_t<val_t>, glz::generic>) {
 4813|  6.25M|                     val = glz::generic{};
 4814|  6.25M|                     return true;
 4815|       |                  }
 4816|       |                  else {
 4817|       |                     static constexpr std::string_view null_value{"null"};
 4818|       |                     auto null_it = null_value.data();
 4819|       |                     const yaml::yaml_context::scoped_stream literal_stream{ctx, null_value.data()};
 4820|       |                     from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(
 4821|       |                        val, ctx, null_it, null_value.data() + null_value.size());
 4822|       |                     return !bool(ctx.error);
 4823|       |                  }
 4824|  6.25M|               };
_ZN3glz4yaml24parse_block_mapping_loopITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEENS0_12yaml_contextEPKcS5_ZNS_4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES7_EEEEE2opITnDaXtlS2_Lj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERS5_RSB_TkNS_10is_contextERS3_S5_EEvOT1_OT2_OT0_T3_EUlRT_RSL_SH_iE_EEvSQ_RSH_SJ_iOSN_:
 3736|  1.15M|      {
 3737|       |         // A tagged-variant custom alternative hands its body (at the variant's own column) to a
 3738|       |         // discover-mode reader. Honor the known indent it published so continuation/dedent are
 3739|       |         // judged against the outer parent, not the body itself. One-shot: reset on observation.
 3740|  1.15M|         if (ctx.forced_block_mapping_indent >= 0) {
  ------------------
  |  Branch (3740:14): [True: 0, False: 1.15M]
  ------------------
 3741|      0|            if (mapping_indent < 0) {
  ------------------
  |  Branch (3741:17): [True: 0, False: 0]
  ------------------
 3742|      0|               mapping_indent = ctx.forced_block_mapping_indent;
 3743|      0|            }
 3744|      0|            ctx.forced_block_mapping_indent = -1;
 3745|      0|         }
 3746|  1.15M|         const int32_t parent_indent = ctx.current_indent();
 3747|  1.15M|         const bool discover_indent = (mapping_indent < 0);
 3748|  1.15M|         bool first_key = !discover_indent;
 3749|  1.15M|         bool discovered_first_key_mid_line = false;
 3750|  1.15M|         int32_t discovered_first_key_visual_indent = 0;
 3751|       |
 3752|  2.58M|         while (it != end) {
  ------------------
  |  Branch (3752:17): [True: 1.63M, False: 954k]
  ------------------
 3753|  1.63M|            auto line_start = it;
 3754|  1.63M|            int32_t line_indent = first_key ? mapping_indent : 0;
  ------------------
  |  Branch (3754:35): [True: 0, False: 1.63M]
  ------------------
 3755|       |
 3756|       |            // Skip blank lines and comments, measure indent
 3757|  2.52M|            while (it != end) {
  ------------------
  |  Branch (3757:20): [True: 2.41M, False: 109k]
  ------------------
 3758|  2.41M|               if (*it == '#') {
  ------------------
  |  Branch (3758:20): [True: 27.9k, False: 2.38M]
  ------------------
 3759|  27.9k|                  skip_comment(it, end);
 3760|  27.9k|                  skip_newline(it, end);
 3761|  27.9k|                  first_key = false;
 3762|  27.9k|                  line_indent = 0;
 3763|  27.9k|               }
 3764|  2.38M|               else if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3764:25): [True: 146k, False: 2.23M]
  |  Branch (3764:40): [True: 646k, False: 1.59M]
  ------------------
 3765|   792k|                  skip_newline(it, end);
 3766|   792k|                  first_key = false;
 3767|   792k|                  line_indent = 0;
 3768|   792k|               }
 3769|  1.59M|               else if (*it == ' ') {
  ------------------
  |  Branch (3769:25): [True: 237k, False: 1.35M]
  ------------------
 3770|   237k|                  line_start = it;
 3771|   237k|                  line_indent = 0;
 3772|  1.18M|                  while (it != end && *it == ' ') {
  ------------------
  |  Branch (3772:26): [True: 1.18M, False: 5.70k]
  |  Branch (3772:39): [True: 948k, False: 232k]
  ------------------
 3773|   948k|                     ++line_indent;
 3774|   948k|                     ++it;
 3775|   948k|                  }
 3776|       |
 3777|   237k|                  bool saw_tab = false;
 3778|   250k|                  while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3778:26): [True: 242k, False: 7.68k]
  |  Branch (3778:40): [True: 6.29k, False: 236k]
  |  Branch (3778:54): [True: 5.98k, False: 230k]
  ------------------
 3779|  12.2k|                     saw_tab = saw_tab || (*it == '\t');
  ------------------
  |  Branch (3779:32): [True: 7.61k, False: 4.66k]
  |  Branch (3779:43): [True: 4.66k, False: 0]
  ------------------
 3780|  12.2k|                     ++it;
 3781|  12.2k|                  }
 3782|       |
 3783|   237k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3783:23): [True: 7.68k, False: 230k]
  |  Branch (3783:36): [True: 5.28k, False: 224k]
  |  Branch (3783:51): [True: 3.84k, False: 220k]
  |  Branch (3783:66): [True: 3.08k, False: 217k]
  ------------------
 3784|  19.9k|                     first_key = false;
 3785|  19.9k|                     line_indent = 0;
 3786|  19.9k|                     continue; // Blank or comment line
 3787|  19.9k|                  }
 3788|       |
 3789|   217k|                  if (saw_tab) {
  ------------------
  |  Branch (3789:23): [True: 18, False: 217k]
  ------------------
 3790|     18|                     ctx.error = error_code::syntax_error;
 3791|     18|                     return;
 3792|     18|                  }
 3793|       |
 3794|       |                  // Early dedent check
 3795|   217k|                  if (mapping_indent >= 0 && line_indent < mapping_indent) {
  ------------------
  |  Branch (3795:23): [True: 212k, False: 5.02k]
  |  Branch (3795:46): [True: 2.32k, False: 210k]
  ------------------
 3796|  2.32k|                     it = line_start;
 3797|  2.32k|                     return;
 3798|  2.32k|                  }
 3799|       |
 3800|   215k|                  first_key = false;
 3801|   215k|                  break; // Found content
 3802|   217k|               }
 3803|  1.35M|               else if (*it == '\t') {
  ------------------
  |  Branch (3803:25): [True: 51.8k, False: 1.30M]
  ------------------
 3804|  51.8k|                  line_start = it;
 3805|   113k|                  while (it != end && (*it == ' ' || *it == '\t')) ++it;
  ------------------
  |  Branch (3805:26): [True: 113k, False: 516]
  |  Branch (3805:40): [True: 7.73k, False: 105k]
  |  Branch (3805:54): [True: 54.1k, False: 51.3k]
  ------------------
 3806|  51.8k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3806:23): [True: 516, False: 51.3k]
  |  Branch (3806:36): [True: 5.36k, False: 45.9k]
  |  Branch (3806:51): [True: 44.7k, False: 1.14k]
  |  Branch (3806:66): [True: 1.12k, False: 20]
  ------------------
 3807|  51.8k|                     first_key = false;
 3808|  51.8k|                     line_indent = 0;
 3809|  51.8k|                     continue; // Blank or comment-only line with tab indentation
 3810|  51.8k|                  }
 3811|     20|                  ctx.error = error_code::syntax_error;
 3812|     20|                  return;
 3813|  51.8k|               }
 3814|  1.30M|               else {
 3815|  1.30M|                  line_start = it;
 3816|  1.30M|                  break; // Content at column 0
 3817|  1.30M|               }
 3818|  2.41M|            }
 3819|       |
 3820|  1.62M|            if (it == end) break;
  ------------------
  |  Branch (3820:17): [True: 109k, False: 1.51M]
  ------------------
 3821|       |
 3822|       |            // Document boundaries terminate the current mapping in both discovered
 3823|       |            // and fixed-indent modes.
 3824|  1.51M|            if (at_document_end(it, end) || at_document_start(it, end)) break;
  ------------------
  |  Branch (3824:17): [True: 2.67k, False: 1.51M]
  |  Branch (3824:45): [True: 2.77k, False: 1.51M]
  ------------------
 3825|       |
 3826|       |            // Dedent checks (skip on first key for struct case)
 3827|       |            // Must check BEFORE establishing mapping_indent so the first discovered key
 3828|       |            // isn't rejected by the parent_indent check (mapping_indent is still -1).
 3829|  1.51M|            if (!first_key) {
  ------------------
  |  Branch (3829:17): [True: 1.51M, False: 0]
  ------------------
 3830|       |               // Parent indent check for nested maps (only after mapping_indent established)
 3831|  1.51M|               if (discover_indent && mapping_indent >= 0 && parent_indent >= 0 && line_indent <= parent_indent) {
  ------------------
  |  Branch (3831:20): [True: 1.51M, False: 0]
  |  Branch (3831:39): [True: 454k, False: 1.05M]
  |  Branch (3831:62): [True: 70.0k, False: 384k]
  |  Branch (3831:84): [True: 49.0k, False: 21.0k]
  ------------------
 3832|  49.0k|                  it = line_start;
 3833|  49.0k|                  return;
 3834|  49.0k|               }
 3835|  1.46M|               if (mapping_indent >= 0 && line_indent < mapping_indent) {
  ------------------
  |  Branch (3835:20): [True: 405k, False: 1.05M]
  |  Branch (3835:43): [True: 370, False: 405k]
  ------------------
 3836|    370|                  it = line_start;
 3837|    370|                  return;
 3838|    370|               }
 3839|  1.46M|            }
 3840|       |
 3841|       |            // Establish mapping indent from first key (map case)
 3842|  1.46M|            bool established_mapping_indent_this_line = false;
 3843|  1.46M|            if (mapping_indent < 0) {
  ------------------
  |  Branch (3843:17): [True: 1.05M, False: 405k]
  ------------------
 3844|  1.05M|               mapping_indent = line_indent;
 3845|  1.05M|               established_mapping_indent_this_line = true;
 3846|  1.05M|               discovered_first_key_visual_indent = line_indent;
 3847|  1.05M|               if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3848|  1.05M|                  if (ctx.stream_begin && line_start > ctx.stream_begin) {
  ------------------
  |  Branch (3848:23): [True: 1.05M, False: 0]
  |  Branch (3848:43): [True: 1.05M, False: 0]
  ------------------
 3849|  1.05M|                     const auto prefix = ctx.line_prefix_before(line_start);
 3850|  1.05M|                     if (prefix.has_tab) {
  ------------------
  |  Branch (3850:26): [True: 64, False: 1.05M]
  ------------------
 3851|     64|                        ctx.error = error_code::syntax_error;
 3852|     64|                        return;
 3853|     64|                     }
 3854|       |
 3855|  1.05M|                     discovered_first_key_mid_line = prefix.has_content;
 3856|  1.05M|                     if (mapping_indent == 0 && prefix.column > 0) {
  ------------------
  |  Branch (3856:26): [True: 1.05M, False: 5.02k]
  |  Branch (3856:49): [True: 850k, False: 202k]
  ------------------
 3857|   850k|                        discovered_first_key_visual_indent = prefix.column;
 3858|   850k|                     }
 3859|  1.05M|                  }
 3860|  1.05M|               }
 3861|  1.05M|            }
 3862|       |
 3863|       |            // In discovered-indent block mappings, sibling keys must stay at the same
 3864|       |            // indent level, except when the first key started mid-line (e.g. "--- k: v").
 3865|  1.46M|            if (discover_indent && mapping_indent >= 0 && !established_mapping_indent_this_line &&
  ------------------
  |  Branch (3865:17): [True: 1.46M, False: 64]
  |  Branch (3865:36): [True: 1.46M, False: 0]
  |  Branch (3865:59): [True: 405k, False: 1.05M]
  ------------------
 3866|   405k|                !discovered_first_key_mid_line) {
  ------------------
  |  Branch (3866:17): [True: 217k, False: 188k]
  ------------------
 3867|   217k|               if (mapping_indent == 0 && discovered_first_key_visual_indent > 0) {
  ------------------
  |  Branch (3867:20): [True: 216k, False: 692]
  |  Branch (3867:43): [True: 133k, False: 83.3k]
  ------------------
 3868|   133k|                  if (line_indent > discovered_first_key_visual_indent) {
  ------------------
  |  Branch (3868:23): [True: 42, False: 133k]
  ------------------
 3869|     42|                     ctx.error = error_code::syntax_error;
 3870|     42|                     return;
 3871|     42|                  }
 3872|   133k|                  if (line_indent < discovered_first_key_visual_indent) {
  ------------------
  |  Branch (3872:23): [True: 2.52k, False: 130k]
  ------------------
 3873|  2.52k|                     it = line_start;
 3874|  2.52k|                     return;
 3875|  2.52k|                  }
 3876|   133k|               }
 3877|  84.0k|               else if (line_indent > mapping_indent &&
  ------------------
  |  Branch (3877:25): [True: 1.50k, False: 82.5k]
  ------------------
 3878|  1.50k|                        (parent_indent < 0 || mapping_indent > 0 ||
  ------------------
  |  Branch (3878:26): [True: 10, False: 1.49k]
  |  Branch (3878:47): [True: 0, False: 1.49k]
  ------------------
 3879|  1.49k|                         (parent_indent >= 0 && mapping_indent == 0 && line_indent > (parent_indent + 1)))) {
  ------------------
  |  Branch (3879:27): [True: 1.49k, False: 0]
  |  Branch (3879:49): [True: 1.49k, False: 0]
  |  Branch (3879:72): [True: 6, False: 1.49k]
  ------------------
 3880|     16|                  ctx.error = error_code::syntax_error;
 3881|     16|                  return;
 3882|     16|               }
 3883|   217k|            }
 3884|       |
 3885|       |            // Sequence indicator check (struct case only - map parser lets key parsing
 3886|       |            // handle '- ' which produces appropriate errors for misindented items)
 3887|  1.46M|            if (!discover_indent && *it == '-' &&
  ------------------
  |  Branch (3887:17): [True: 0, False: 1.46M]
  |  Branch (3887:37): [True: 0, False: 0]
  ------------------
 3888|      0|                ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\t' || *(it + 1) == '\n')) {
  ------------------
  |  Branch (3888:18): [True: 0, False: 0]
  |  Branch (3888:37): [True: 0, False: 0]
  |  Branch (3888:57): [True: 0, False: 0]
  |  Branch (3888:78): [True: 0, False: 0]
  ------------------
 3889|      0|               it = line_start;
 3890|      0|               return;
 3891|      0|            }
 3892|       |
 3893|       |            // Skip indented comment lines
 3894|  1.46M|            if (*it == '#') {
  ------------------
  |  Branch (3894:17): [True: 0, False: 1.46M]
  ------------------
 3895|      0|               skip_comment(it, end);
 3896|      0|               first_key = false;
 3897|      0|               continue;
 3898|      0|            }
 3899|       |
 3900|       |            // Skip blank/empty lines after indent
 3901|  1.46M|            if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3901:17): [True: 64, False: 1.46M]
  |  Branch (3901:32): [True: 0, False: 1.46M]
  ------------------
 3902|      0|               first_key = false;
 3903|      0|               continue;
 3904|      0|            }
 3905|       |
 3906|       |            // While parsing an explicit mapping key node ('? key-node'),
 3907|       |            // a subsequent standalone ':' at the same indentation starts
 3908|       |            // the outer value indicator and must terminate this key-node map.
 3909|       |            // Keep same-line ': x' on the first key-node line valid.
 3910|  1.46M|            if (ctx.explicit_mapping_key_context && !established_mapping_indent_this_line && *it == ':') {
  ------------------
  |  Branch (3910:17): [True: 656k, False: 804k]
  |  Branch (3910:53): [True: 161k, False: 494k]
  |  Branch (3910:94): [True: 79.9k, False: 82.0k]
  ------------------
 3911|  79.9k|               const auto after_colon = it + 1;
 3912|  79.9k|               const int32_t explicit_value_indicator_indent = (parent_indent < 0) ? 0 : (parent_indent + 1);
  ------------------
  |  Branch (3912:64): [True: 78.0k, False: 1.85k]
  ------------------
 3913|  79.9k|               if ((after_colon == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
  ------------------
  |  Branch (3913:21): [True: 3.12k, False: 76.7k]
  |  Branch (3913:43): [True: 53.8k, False: 22.9k]
  ------------------
 3914|  56.9k|                   line_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (3914:20): [True: 4.67k, False: 52.2k]
  ------------------
 3915|  4.67k|                  it = line_start;
 3916|  4.67k|                  return;
 3917|  4.67k|               }
 3918|  79.9k|            }
 3919|       |
 3920|       |            // Process this mapping entry (key + colon + value)
 3921|  1.45M|            int32_t effective_line_indent = line_indent;
 3922|  1.45M|            if (discover_indent && established_mapping_indent_this_line &&
  ------------------
  |  Branch (3922:17): [True: 1.45M, False: 64]
  |  Branch (3922:36): [True: 1.05M, False: 398k]
  ------------------
 3923|  1.05M|                discovered_first_key_visual_indent > effective_line_indent &&
  ------------------
  |  Branch (3923:17): [True: 850k, False: 207k]
  ------------------
 3924|   850k|                !(discovered_first_key_mid_line && parent_indent < 0)) {
  ------------------
  |  Branch (3924:19): [True: 609k, False: 240k]
  |  Branch (3924:52): [True: 486k, False: 123k]
  ------------------
 3925|       |               // The first discovered key has no indentation of its own left to measure: it may
 3926|       |               // begin mid-line (a sequence entry's "- key: value"), or the caller may have already
 3927|       |               // consumed the line's indentation before handing the mapping over. Pass its visual
 3928|       |               // column so the entry judges its value against the key's real indent -- otherwise a
 3929|       |               // key with an empty value takes the following sibling line for nested content
 3930|       |               // (issue #2827) and same-line block scalars compute the wrong indentation.
 3931|       |               // The exception is a ROOT mapping whose first key begins mid-line, which means node
 3932|       |               // properties sit ahead of it (`!!str &a1 "foo":`): those belong to the document node
 3933|       |               // rather than to the key's column, so the measured indent stands. Conformance tests
 3934|       |               // 7FWL and HMQ5 pin that case.
 3935|   364k|               effective_line_indent = discovered_first_key_visual_indent;
 3936|   364k|            }
 3937|       |
 3938|  1.45M|            if (!process_entry(ctx, it, end, effective_line_indent)) {
  ------------------
  |  Branch (3938:17): [True: 26.7k, False: 1.42M]
  ------------------
 3939|  26.7k|               return;
 3940|  26.7k|            }
 3941|  1.42M|            first_key = false;
 3942|       |
 3943|  1.42M|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3943:17): [True: 0, False: 1.42M]
  ------------------
 3944|      0|               return;
 3945|       |
 3946|  1.42M|            if constexpr (yaml::check_flow_context(Opts)) {
 3947|       |               // In flow context, an implicit "key: value" pair used as a sequence entry
 3948|       |               // ends at ',', ']', or '}'. Let the enclosing flow parser consume it.
 3949|  1.42M|               auto flow_end = it;
 3950|  1.42M|               skip_flow_ws_and_newlines(ctx, flow_end, end);
 3951|  1.42M|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3951:20): [True: 12, False: 1.42M]
  ------------------
 3952|     12|                  return;
 3953|  1.42M|               if (flow_end != end && (*flow_end == ',' || *flow_end == ']' || *flow_end == '}')) {
  ------------------
  |  Branch (3953:20): [True: 1.12M, False: 301k]
  |  Branch (3953:40): [True: 556k, False: 571k]
  |  Branch (3953:60): [True: 27.0k, False: 544k]
  |  Branch (3953:80): [True: 82.6k, False: 462k]
  ------------------
 3954|   665k|                  it = flow_end;
 3955|   665k|                  return;
 3956|   665k|               }
 3957|  1.42M|            }
 3958|       |
 3959|       |            // Trailing whitespace handling (peek-ahead pattern).
 3960|       |            // After parsing, iterator may be at leading indent of next line.
 3961|       |            // Don't consume it - let the outer loop handle indent measurement.
 3962|  1.42M|            if (it != end) {
  ------------------
  |  Branch (3962:17): [True: 491k, False: 938k]
  ------------------
 3963|   491k|               if (*it == ' ' || *it == '\t') {
  ------------------
  |  Branch (3963:20): [True: 90.9k, False: 400k]
  |  Branch (3963:34): [True: 7.69k, False: 392k]
  ------------------
 3964|  98.6k|                  auto peek = it;
 3965|  98.6k|                  skip_inline_ws(peek, end);
 3966|  98.6k|                  if (peek != end && *peek != '\n' && *peek != '\r' && *peek != '#') {
  ------------------
  |  Branch (3966:23): [True: 94.9k, False: 3.66k]
  |  Branch (3966:38): [True: 87.4k, False: 7.47k]
  |  Branch (3966:55): [True: 85.1k, False: 2.39k]
  |  Branch (3966:72): [True: 78.5k, False: 6.58k]
  ------------------
 3967|  78.5k|                     continue; // At leading indent of new line
 3968|  78.5k|                  }
 3969|  98.6k|               }
 3970|   412k|               skip_inline_ws(it, end);
 3971|   412k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (3971:20): [True: 409k, False: 3.66k]
  |  Branch (3971:33): [True: 33.4k, False: 375k]
  ------------------
 3972|  33.4k|                  if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3973|  33.4k|                     if (it > line_start) {
  ------------------
  |  Branch (3973:26): [True: 33.4k, False: 0]
  ------------------
 3974|  33.4k|                        const char prev = *(it - 1);
 3975|  33.4k|                        if (prev != ' ' && prev != '\t' && prev != '\n' && prev != '\r') {
  ------------------
  |  Branch (3975:29): [True: 8.07k, False: 25.3k]
  |  Branch (3975:44): [True: 3.13k, False: 4.94k]
  |  Branch (3975:60): [True: 2.12k, False: 1.00k]
  |  Branch (3975:76): [True: 6, False: 2.11k]
  ------------------
 3976|      6|                           ctx.error = error_code::syntax_error;
 3977|      6|                           return;
 3978|      6|                        }
 3979|  33.4k|                     }
 3980|  33.4k|                  }
 3981|  33.4k|               }
 3982|  33.4k|               skip_comment(it, end);
 3983|   412k|               if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (3983:20): [True: 409k, False: 3.67k]
  |  Branch (3983:34): [True: 107k, False: 301k]
  |  Branch (3983:49): [True: 148k, False: 152k]
  ------------------
 3984|   256k|                  skip_newline(it, end);
 3985|   256k|               }
 3986|   156k|               else if (it != end) {
  ------------------
  |  Branch (3986:25): [True: 152k, False: 3.67k]
  ------------------
 3987|       |                  // The entry stopped part way along its line with something other than
 3988|       |                  // whitespace or a comment after it -- a ':' its value could not take as a
 3989|       |                  // separator, say. The next pass measures indent as though this were the start
 3990|       |                  // of a line, so what is left of the real one is lost; reject it instead.
 3991|   152k|                  if constexpr (requires { ctx.line_prefix_before(it); }) {
 3992|   152k|                     if (ctx.line_prefix_before(it).has_content) {
  ------------------
  |  Branch (3992:26): [True: 40, False: 152k]
  ------------------
 3993|     40|                        ctx.error = error_code::syntax_error;
 3994|     40|                        return;
 3995|     40|                     }
 3996|   152k|                  }
 3997|   152k|               }
 3998|   412k|            }
 3999|  1.42M|         }
 4000|  1.15M|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_i:
 4927|  1.45M|               ctx, it, end, int32_t(-1), [&](auto& ctx, auto& it, auto end, int32_t line_indent) -> bool {
 4928|  1.45M|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|  1.45M|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 4930|  1.45M|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|  1.45M|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|  1.45M|                           if (ctx.stream_begin) {
 4938|  1.45M|                              auto is_line_content_start = [&](auto pos) {
 4939|  1.45M|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|  1.45M|                              };
 4941|       |
 4942|  1.45M|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|  1.45M|                                 const char* line = ctx.line_begin_of(pos);
 4944|  1.45M|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|  1.45M|                                 return line != end && *line == ':';
 4946|  1.45M|                              };
 4947|       |
 4948|  1.45M|                              if (!is_line_content_start(it) &&
 4949|  1.45M|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
 4950|  1.45M|                                  !line_has_explicit_value_indicator(it)) {
 4951|  1.45M|                                 ctx.error = error_code::syntax_error;
 4952|  1.45M|                                 return false;
 4953|  1.45M|                              }
 4954|  1.45M|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|  1.45M|                           }
 4956|  1.45M|                        }
 4957|       |
 4958|  1.45M|                        if (*it == '-' &&
 4959|  1.45M|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
 4960|  1.45M|                            !line_starts_with_explicit_value_indicator) {
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|  1.45M|                           ctx.error = error_code::syntax_error;
 4963|  1.45M|                           return false;
 4964|  1.45M|                        }
 4965|       |
 4966|  1.45M|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 4967|  1.45M|                           return false;
 4968|  1.45M|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|  1.45M|                        ctx.pop_indent();
 4970|  1.45M|                     }
 4971|  1.45M|                     else {
 4972|  1.45M|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|  1.45M|                        if (nested_indent >= 0) {
 4974|  1.45M|                           yaml::skip_to_content(it, end);
 4975|  1.45M|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
 4976|  1.45M|                              ctx.error = error_code::syntax_error;
 4977|  1.45M|                              return false;
 4978|  1.45M|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|  1.45M|                           const int32_t value_indent =
 4982|  1.45M|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
 4983|  1.45M|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
 4984|  1.45M|                              return false;
 4985|  1.45M|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|  1.45M|                           ctx.pop_indent();
 4987|  1.45M|                        }
 4988|  1.45M|                     }
 4989|  1.45M|                     return !bool(ctx.error);
 4990|  1.45M|                  };
 4991|       |
 4992|       |                  // Explicit key entry form:
 4993|       |                  // ? key
 4994|       |                  // : value
 4995|  1.45M|                  if (*it == '?' && ((it + 1) != end) && *(it + 1) == '\t') {
  ------------------
  |  Branch (4995:23): [True: 486k, False: 970k]
  |  Branch (4995:37): [True: 485k, False: 1.10k]
  |  Branch (4995:58): [True: 6, False: 485k]
  ------------------
 4996|      6|                     ctx.error = error_code::syntax_error;
 4997|      6|                     return false;
 4998|      6|                  }
 4999|  1.45M|                  if (*it == '?' && ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\n' || *(it + 1) == '\r')) {
  ------------------
  |  Branch (4999:23): [True: 486k, False: 970k]
  |  Branch (4999:38): [True: 1.10k, False: 485k]
  |  Branch (4999:57): [True: 153k, False: 331k]
  |  Branch (4999:77): [True: 181k, False: 150k]
  |  Branch (4999:98): [True: 132k, False: 17.3k]
  ------------------
 5000|   468k|                     ++it; // skip '?'
 5001|   468k|                     yaml::skip_inline_ws(it, end);
 5002|       |
 5003|   468k|                     const int32_t explicit_value_indicator_indent =
 5004|   468k|                        (ctx.current_indent() < 0) ? 0 : (ctx.current_indent() + 1);
  ------------------
  |  Branch (5004:25): [True: 358k, False: 110k]
  ------------------
 5005|       |
 5006|   468k|                     key_t key{};
 5007|   468k|                     if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5008|   468k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   468k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   468k|                        };
 5011|       |
 5012|   468k|                        auto key_it = it;
 5013|   468k|                        yaml::skip_inline_ws(key_it, end);
 5014|       |
 5015|   468k|                        auto content = key_it;
 5016|   468k|                        yaml::skip_to_content(content, end);
 5017|   468k|                        bool handled_anchor_only_empty_key = false;
 5018|       |
 5019|       |                        // Anchor on an empty explicit key node:
 5020|       |                        //   ? &a
 5021|       |                        //   : value
 5022|   468k|                        if (content != end && *content == '&') {
  ------------------
  |  Branch (5022:29): [True: 463k, False: 5.25k]
  |  Branch (5022:47): [True: 123k, False: 340k]
  ------------------
 5023|   123k|                           auto anchor_probe = content + 1;
 5024|   123k|                           auto anchor_name = yaml::parse_anchor_name(anchor_probe, end);
 5025|   123k|                           if (!anchor_name.empty()) {
  ------------------
  |  Branch (5025:32): [True: 123k, False: 30]
  ------------------
 5026|   123k|                              auto after_anchor = anchor_probe;
 5027|   123k|                              yaml::skip_inline_ws(after_anchor, end);
 5028|       |
 5029|   123k|                              auto value_indicator = after_anchor;
 5030|   123k|                              if (value_indicator != end && *value_indicator == ':') {
  ------------------
  |  Branch (5030:35): [True: 121k, False: 1.64k]
  |  Branch (5030:61): [True: 4.17k, False: 117k]
  ------------------
 5031|  4.17k|                                 key.clear();
 5032|  4.17k|                                 ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5033|  4.17k|                                 it = value_indicator;
 5034|  4.17k|                                 handled_anchor_only_empty_key = true;
 5035|  4.17k|                              }
 5036|   118k|                              else {
 5037|   118k|                                 if (value_indicator != end && *value_indicator == '#') {
  ------------------
  |  Branch (5037:38): [True: 117k, False: 1.64k]
  |  Branch (5037:64): [True: 15.8k, False: 101k]
  ------------------
 5038|  15.8k|                                    yaml::skip_comment(value_indicator, end);
 5039|  15.8k|                                 }
 5040|   118k|                                 if (value_indicator != end && (*value_indicator == '\n' || *value_indicator == '\r')) {
  ------------------
  |  Branch (5040:38): [True: 117k, False: 1.65k]
  |  Branch (5040:65): [True: 35.9k, False: 81.3k]
  |  Branch (5040:93): [True: 25.8k, False: 55.5k]
  ------------------
 5041|  61.7k|                                    yaml::skip_newline(value_indicator, end);
 5042|  61.7k|                                    auto value_line = value_indicator;
 5043|  61.7k|                                    int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5044|  61.7k|                                    if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5044:41): [True: 6, False: 61.6k]
  ------------------
 5045|      6|                                       return false;
 5046|  61.6k|                                    if (value_line != end && *value_line == ':' &&
  ------------------
  |  Branch (5046:41): [True: 59.6k, False: 2.03k]
  |  Branch (5046:62): [True: 4.11k, False: 55.5k]
  ------------------
 5047|  4.11k|                                        value_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (5047:41): [True: 4.11k, False: 6]
  ------------------
 5048|  4.11k|                                       key.clear();
 5049|  4.11k|                                       ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5050|  4.11k|                                       it = value_line;
 5051|  4.11k|                                       handled_anchor_only_empty_key = true;
 5052|  4.11k|                                    }
 5053|  57.5k|                                    else if (value_line != end && *value_line == ':') {
  ------------------
  |  Branch (5053:46): [True: 55.5k, False: 2.03k]
  |  Branch (5053:67): [True: 6, False: 55.5k]
  ------------------
 5054|       |                                       // In explicit-key form ("? &a"), a following ':'
 5055|       |                                       // starts the outer value indicator only at the same
 5056|       |                                       // indentation. A deeper-indented ': value' is malformed.
 5057|      6|                                       ctx.error = error_code::syntax_error;
 5058|      6|                                       return false;
 5059|      6|                                    }
 5060|  61.6k|                                 }
 5061|   118k|                              }
 5062|   123k|                           }
 5063|   123k|                        }
 5064|       |
 5065|   468k|                        const bool key_content_spans_lines = [&] {
 5066|   468k|                           auto scan = key_it;
 5067|   468k|                           while (scan != content && scan != end) {
 5068|   468k|                              if (*scan == '\n' || *scan == '\r') return true;
 5069|   468k|                              ++scan;
 5070|   468k|                           }
 5071|   468k|                           return false;
 5072|   468k|                        }();
 5073|       |
 5074|   468k|                        if (handled_anchor_only_empty_key) {
  ------------------
  |  Branch (5074:29): [True: 8.28k, False: 460k]
  ------------------
 5075|       |                           // 'it' already points to the explicit value indicator ':'
 5076|  8.28k|                        }
 5077|   460k|                        else if (content == end || (*content == ':' && key_content_spans_lines)) {
  ------------------
  |  Branch (5077:34): [True: 5.25k, False: 455k]
  |  Branch (5077:53): [True: 22.4k, False: 432k]
  |  Branch (5077:72): [True: 14.7k, False: 7.67k]
  ------------------
 5078|  19.9k|                           key.clear();
 5079|  19.9k|                           it = content;
 5080|  19.9k|                        }
 5081|   440k|                        else {
 5082|       |                           // Explicit mapping keys ('? key-node') are full YAML nodes.
 5083|       |                           // Parse the key node structurally (not via plain-key scanning)
 5084|       |                           // so inputs like '? []: x' and '? JSON: like' are interpreted
 5085|       |                           // as complex keys, not split into implicit key/value pairs.
 5086|   440k|                           auto key_node_it = content;
 5087|   440k|                           auto key_node_end = end;
 5088|   440k|                           if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 5089|       |                              // In explicit-key form, a following standalone ':'
 5090|       |                              // line (same or lower indentation) belongs to the
 5091|       |                              // outer mapping value, not the key node itself.
 5092|   440k|                              auto scan = content;
 5093|  2.36M|                              while (scan != end) {
  ------------------
  |  Branch (5093:38): [True: 2.30M, False: 62.7k]
  ------------------
 5094|   113M|                                 while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (5094:41): [True: 113M, False: 264k]
  |  Branch (5094:56): [True: 112M, False: 1.00M]
  |  Branch (5094:73): [True: 111M, False: 1.03M]
  ------------------
 5095|   111M|                                    ++scan;
 5096|   111M|                                 }
 5097|  2.30M|                                 if (scan == end) {
  ------------------
  |  Branch (5097:38): [True: 264k, False: 2.03M]
  ------------------
 5098|   264k|                                    break;
 5099|   264k|                                 }
 5100|       |
 5101|  2.03M|                                 yaml::skip_newline(scan, end);
 5102|  2.03M|                                 auto line_start = scan;
 5103|       |
 5104|  2.03M|                                 int32_t indicator_indent = 0;
 5105|  3.67M|                                 while (scan != end && *scan == ' ') {
  ------------------
  |  Branch (5105:41): [True: 3.61M, False: 62.7k]
  |  Branch (5105:56): [True: 1.64M, False: 1.97M]
  ------------------
 5106|  1.64M|                                    ++indicator_indent;
 5107|  1.64M|                                    ++scan;
 5108|  1.64M|                                 }
 5109|       |
 5110|  2.03M|                                 if (scan != end && *scan == ':') {
  ------------------
  |  Branch (5110:38): [True: 1.97M, False: 62.7k]
  |  Branch (5110:53): [True: 168k, False: 1.80M]
  ------------------
 5111|   168k|                                    const auto after_colon = scan + 1;
 5112|   168k|                                    if ((after_colon == end ||
  ------------------
  |  Branch (5112:42): [True: 4.84k, False: 163k]
  ------------------
 5113|   163k|                                         yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
  ------------------
  |  Branch (5113:42): [True: 135k, False: 28.5k]
  ------------------
 5114|   140k|                                        indicator_indent <= line_indent) {
  ------------------
  |  Branch (5114:41): [True: 113k, False: 26.7k]
  ------------------
 5115|   113k|                                       key_node_end = line_start;
 5116|   113k|                                       break;
 5117|   113k|                                    }
 5118|   168k|                                 }
 5119|  2.03M|                              }
 5120|   440k|                           }
 5121|       |
 5122|   440k|                           glz::generic key_node{};
 5123|   440k|                           const bool prev_explicit_mapping_key_context = ctx.explicit_mapping_key_context;
 5124|   440k|                           ctx.explicit_mapping_key_context = true;
 5125|   440k|                           from<YAML, glz::generic>::template op<Opts>(key_node, ctx, key_node_it, key_node_end);
 5126|   440k|                           ctx.explicit_mapping_key_context = prev_explicit_mapping_key_context;
 5127|   440k|                           if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5127:32): [True: 4.26k, False: 436k]
  ------------------
 5128|  4.26k|                              return false;
 5129|   436k|                           it = key_node_it;
 5130|   436k|                           if (!to_string_key(key_node)) [[unlikely]]
  ------------------
  |  Branch (5130:32): [True: 12, False: 436k]
  ------------------
 5131|     12|                              return false;
 5132|   436k|                        }
 5133|       |                     }
 5134|       |                     else {
 5135|       |                        if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 5136|       |                           from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5137|       |                           if (bool(ctx.error)) [[unlikely]]
 5138|       |                              return false;
 5139|       |                        }
 5140|       |                     }
 5141|       |
 5142|   464k|                     yaml::skip_inline_ws(it, end);
 5143|   468k|                     yaml::skip_comment(it, end);
 5144|       |
 5145|       |                     // Value indicator may appear on the next line at the same indent.
 5146|   468k|                     if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (5146:26): [True: 384k, False: 84.1k]
  |  Branch (5146:40): [True: 62.2k, False: 322k]
  |  Branch (5146:55): [True: 85.8k, False: 236k]
  ------------------
 5147|   148k|                        auto probe = it;
 5148|   148k|                        bool found_value_indicator = false;
 5149|       |
 5150|   189k|                        while (probe != end && (*probe == '\n' || *probe == '\r')) {
  ------------------
  |  Branch (5150:32): [True: 178k, False: 10.8k]
  |  Branch (5150:49): [True: 71.3k, False: 106k]
  |  Branch (5150:67): [True: 106k, False: 0]
  ------------------
 5151|   178k|                           yaml::skip_newline(probe, end);
 5152|       |
 5153|   178k|                           auto value_line = probe;
 5154|   178k|                           int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5155|   178k|                           if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5155:32): [True: 8, False: 178k]
  ------------------
 5156|      8|                              return false;
 5157|       |
 5158|   178k|                           if (value_line == end || *value_line == '\n' || *value_line == '\r') {
  ------------------
  |  Branch (5158:32): [True: 9.27k, False: 168k]
  |  Branch (5158:53): [True: 4.88k, False: 164k]
  |  Branch (5158:76): [True: 12.8k, False: 151k]
  ------------------
 5159|  26.9k|                              probe = value_line;
 5160|  26.9k|                              continue; // blank line
 5161|  26.9k|                           }
 5162|   151k|                           if (*value_line == '#') {
  ------------------
  |  Branch (5162:32): [True: 13.9k, False: 137k]
  ------------------
 5163|  13.9k|                              yaml::skip_comment(value_line, end);
 5164|  13.9k|                              probe = value_line;
 5165|  13.9k|                              continue; // comment-only line
 5166|  13.9k|                           }
 5167|   137k|                           if (*value_line == ':' && value_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (5167:32): [True: 68.5k, False: 68.7k]
  |  Branch (5167:54): [True: 20.5k, False: 47.9k]
  ------------------
 5168|  20.5k|                              it = value_line;
 5169|  20.5k|                              found_value_indicator = true;
 5170|  20.5k|                           }
 5171|   137k|                           break;
 5172|   151k|                        }
 5173|       |
 5174|   148k|                        if (found_value_indicator) {
  ------------------
  |  Branch (5174:29): [True: 20.5k, False: 127k]
  ------------------
 5175|  20.5k|                           yaml::skip_inline_ws(it, end);
 5176|  20.5k|                        }
 5177|   148k|                     }
 5178|       |
 5179|   468k|                     val_t val{};
 5180|   468k|                     if (it != end && *it == ':') {
  ------------------
  |  Branch (5180:26): [True: 384k, False: 84.1k]
  |  Branch (5180:39): [True: 134k, False: 250k]
  ------------------
 5181|   134k|                        ++it;
 5182|   134k|                        if (it != end && *it == '\t') {
  ------------------
  |  Branch (5182:29): [True: 133k, False: 792]
  |  Branch (5182:42): [True: 6, False: 133k]
  ------------------
 5183|      6|                           ctx.error = error_code::syntax_error;
 5184|      6|                           return false;
 5185|      6|                        }
 5186|   134k|                        if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (5186:29): [True: 133k, False: 792]
  |  Branch (5186:43): [True: 18.9k, False: 114k]
  |  Branch (5186:58): [True: 37.0k, False: 77.7k]
  ------------------
 5187|  56.0k|                           auto probe = it;
 5188|  56.0k|                           yaml::skip_newline(probe, end);
 5189|  83.8k|                           while (probe != end && *probe == ' ') ++probe;
  ------------------
  |  Branch (5189:35): [True: 70.3k, False: 13.4k]
  |  Branch (5189:51): [True: 27.8k, False: 42.5k]
  ------------------
 5190|  56.0k|                           if (probe != end && *probe == ':' && ((probe + 1) != end) && *(probe + 1) == '\t') {
  ------------------
  |  Branch (5190:32): [True: 42.5k, False: 13.4k]
  |  Branch (5190:48): [True: 8.26k, False: 34.2k]
  |  Branch (5190:65): [True: 4.13k, False: 4.13k]
  |  Branch (5190:89): [True: 6, False: 4.13k]
  ------------------
 5191|      6|                              ctx.error = error_code::syntax_error;
 5192|      6|                              return false;
 5193|      6|                           }
 5194|  56.0k|                        }
 5195|   134k|                        yaml::skip_inline_ws(it, end);
 5196|   134k|                        if (!parse_map_value(val)) [[unlikely]]
  ------------------
  |  Branch (5196:29): [True: 294, False: 134k]
  ------------------
 5197|    294|                           return false;
 5198|   134k|                     }
 5199|       |
 5200|   468k|                     value.emplace(std::move(key), std::move(val));
 5201|   468k|                     return true;
 5202|   468k|                  }
 5203|       |
 5204|   987k|                  key_t key{};
 5205|   987k|                  if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5206|   987k|                     auto key_probe = it;
 5207|   987k|                     yaml::skip_inline_ws(key_probe, end);
 5208|   987k|                     const bool complex_flow_key = (key_probe != end && (*key_probe == '[' || *key_probe == '{'));
  ------------------
  |  Branch (5208:53): [True: 987k, False: 0]
  |  Branch (5208:74): [True: 19.0k, False: 968k]
  |  Branch (5208:95): [True: 6.27k, False: 962k]
  ------------------
 5209|   987k|                     if (complex_flow_key) {
  ------------------
  |  Branch (5209:26): [True: 25.2k, False: 962k]
  ------------------
 5210|  25.2k|                        glz::generic key_node{};
 5211|  25.2k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 5212|  25.2k|                        if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5212:29): [True: 972, False: 24.3k]
  ------------------
 5213|    972|                           return false;
 5214|  24.3k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (5214:29): [True: 6, False: 24.3k]
  ------------------
 5215|      6|                           return false;
 5216|  24.3k|                     }
 5217|   962k|                     else {
 5218|   962k|                        if (!yaml::parse_yaml_key(key, ctx, it, end, false)) {
  ------------------
  |  Branch (5218:29): [True: 19.0k, False: 943k]
  ------------------
 5219|  19.0k|                           return false;
 5220|  19.0k|                        }
 5221|   962k|                     }
 5222|       |                  }
 5223|       |                  else {
 5224|       |                     from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5225|       |                     if (bool(ctx.error)) [[unlikely]]
 5226|       |                        return false;
 5227|       |                  }
 5228|       |
 5229|   967k|                  yaml::skip_inline_ws(it, end);
 5230|       |
 5231|   987k|                  if (it == end || *it != ':') {
  ------------------
  |  Branch (5231:23): [True: 20.1k, False: 967k]
  |  Branch (5231:36): [True: 82, False: 967k]
  ------------------
 5232|    202|                     ctx.error = error_code::syntax_error;
 5233|    202|                     return false;
 5234|    202|                  }
 5235|   987k|                  ++it;
 5236|   987k|                  yaml::skip_inline_ws(it, end);
 5237|       |
 5238|   987k|                  val_t val{};
 5239|   987k|                  if (!parse_map_value(val)) [[unlikely]]
  ------------------
  |  Branch (5239:23): [True: 1.86k, False: 985k]
  ------------------
 5240|  1.86k|                     return false;
 5241|       |
 5242|   985k|                  value.emplace(std::move(key), std::move(val));
 5243|   985k|                  return true;
 5244|   987k|               });
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlvE_clEv:
 5065|   468k|                        const bool key_content_spans_lines = [&] {
 5066|   468k|                           auto scan = key_it;
 5067|   480k|                           while (scan != content && scan != end) {
  ------------------
  |  Branch (5067:35): [True: 334k, False: 146k]
  |  Branch (5067:54): [True: 334k, False: 0]
  ------------------
 5068|   334k|                              if (*scan == '\n' || *scan == '\r') return true;
  ------------------
  |  Branch (5068:35): [True: 186k, False: 147k]
  |  Branch (5068:52): [True: 135k, False: 11.7k]
  ------------------
 5069|  11.7k|                              ++scan;
 5070|  11.7k|                           }
 5071|   146k|                           return false;
 5072|   468k|                        }();
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E0_clESS_:
 5008|   436k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   436k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   436k|                        };
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E_clESS_:
 4928|  1.10M|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|  1.10M|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (4929:26): [True: 1.08M, False: 12.4k]
  |  Branch (4929:39): [True: 876k, False: 212k]
  ------------------
 4930|   876k|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|   876k|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|   876k|                           if (ctx.stream_begin) {
  ------------------
  |  Branch (4937:32): [True: 876k, False: 0]
  ------------------
 4938|   876k|                              auto is_line_content_start = [&](auto pos) {
 4939|   876k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   876k|                              };
 4941|       |
 4942|   876k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   876k|                                 const char* line = ctx.line_begin_of(pos);
 4944|   876k|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|   876k|                                 return line != end && *line == ':';
 4946|   876k|                              };
 4947|       |
 4948|   876k|                              if (!is_line_content_start(it) &&
  ------------------
  |  Branch (4948:35): [True: 876k, False: 0]
  ------------------
 4949|   876k|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
  ------------------
  |  Branch (4949:35): [True: 43.7k, False: 833k]
  ------------------
 4950|  43.7k|                                  !line_has_explicit_value_indicator(it)) {
  ------------------
  |  Branch (4950:35): [True: 54, False: 43.6k]
  ------------------
 4951|     54|                                 ctx.error = error_code::syntax_error;
 4952|     54|                                 return false;
 4953|     54|                              }
 4954|   876k|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|   876k|                           }
 4956|   876k|                        }
 4957|       |
 4958|   876k|                        if (*it == '-' &&
  ------------------
  |  Branch (4958:29): [True: 24.0k, False: 852k]
  ------------------
 4959|  24.0k|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
  ------------------
  |  Branch (4959:30): [True: 1.05k, False: 22.9k]
  |  Branch (4959:49): [True: 15.6k, False: 7.34k]
  ------------------
 4960|  16.6k|                            !line_starts_with_explicit_value_indicator) {
  ------------------
  |  Branch (4960:29): [True: 12, False: 16.6k]
  ------------------
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|     12|                           ctx.error = error_code::syntax_error;
 4963|     12|                           return false;
 4964|     12|                        }
 4965|       |
 4966|   876k|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
  ------------------
  |  Branch (4966:29): [True: 0, False: 876k]
  ------------------
 4967|      0|                           return false;
 4968|   876k|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|   876k|                        ctx.pop_indent();
 4970|   876k|                     }
 4971|   225k|                     else {
 4972|   225k|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|   225k|                        if (nested_indent >= 0) {
  ------------------
  |  Branch (4973:29): [True: 69.3k, False: 155k]
  ------------------
 4974|  69.3k|                           yaml::skip_to_content(it, end);
 4975|  69.3k|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
  ------------------
  |  Branch (4975:32): [True: 69.3k, False: 0]
  |  Branch (4975:45): [True: 0, False: 69.3k]
  |  Branch (4975:59): [True: 0, False: 0]
  |  Branch (4975:78): [True: 0, False: 0]
  ------------------
 4976|      0|                              ctx.error = error_code::syntax_error;
 4977|      0|                              return false;
 4978|      0|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|  69.3k|                           const int32_t value_indent =
 4982|  69.3k|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
  ------------------
  |  Branch (4982:31): [Folded, False: 69.3k]
  ------------------
 4983|  69.3k|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
  ------------------
  |  Branch (4983:32): [True: 0, False: 69.3k]
  ------------------
 4984|      0|                              return false;
 4985|  69.3k|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|  69.3k|                           ctx.pop_indent();
 4987|  69.3k|                        }
 4988|   225k|                     }
 4989|  1.10M|                     return !bool(ctx.error);
 4990|  1.10M|                  };
_ZZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E_clESS_ENKUlSN_E_clISA_EEDaSN_:
 4938|   876k|                              auto is_line_content_start = [&](auto pos) {
 4939|   876k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   876k|                              };
_ZZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E_clESS_ENKUlSN_E0_clISA_EEDaSN_:
 4942|   920k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   920k|                                 const char* line = ctx.line_begin_of(pos);
 4944|  1.54M|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
  ------------------
  |  Branch (4944:41): [True: 1.54M, False: 0]
  |  Branch (4944:57): [True: 622k, False: 921k]
  |  Branch (4944:73): [True: 550, False: 920k]
  ------------------
 4945|   920k|                                 return line != end && *line == ':';
  ------------------
  |  Branch (4945:41): [True: 920k, False: 0]
  |  Branch (4945:56): [True: 423k, False: 496k]
  ------------------
 4946|   920k|                              };
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_EN19merge_restore_guardD2Ev:
 4696|  4.28M|            {
 4697|       |               // emplace is a no-op for keys the document already wrote, so only
 4698|       |               // untouched pre-existing entries are put back.
 4699|  4.28M|               for (auto& entry : saved) {
  ------------------
  |  Branch (4699:33): [True: 0, False: 4.28M]
  ------------------
 4700|      0|                  target.emplace(entry.first, std::move(entry.second));
 4701|      0|               }
 4702|  4.28M|            }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_21is_yaml_variant_arrayEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   462k|      {
 5356|   462k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   462k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   462k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   462k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   462k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 462k, False: 0]
  ------------------
 5366|   462k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   462k|      }
_ZN3glz4fromILj450ENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS1_9allocatorIS6_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS9_TkNS_10is_contextERNS_4yaml12yaml_contextESE_EEvOT1_OT2_OT0_T3_:
 4207|   476k|      {
 4208|   476k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4208:14): [True: 0, False: 476k]
  ------------------
 4209|      0|            return;
 4210|       |
 4211|       |         // Peek ahead to check for tag (don't consume indentation for block sequences)
 4212|   476k|         auto peek = it;
 4213|   476k|         yaml::node_preamble_state preamble{};
 4214|   476k|         if (yaml::parse_node_preamble<Opts>(value, ctx, peek, end, preamble,
  ------------------
  |  Branch (4214:14): [True: 26.3k, False: 450k]
  ------------------
 4215|   476k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_seq(tag); })) {
 4216|  26.3k|            it = peek;
 4217|  26.3k|            return;
 4218|  26.3k|         }
 4219|       |
 4220|       |         // A level of nesting, taken past the preamble as for sets above.
 4221|   450k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 4222|   450k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (4222:14): [True: 452, False: 449k]
  ------------------
 4223|    452|            return;
 4224|       |
 4225|   449k|         if (*peek == '[') {
  ------------------
  |  Branch (4225:14): [True: 160k, False: 289k]
  ------------------
 4226|       |            // Flow sequence - consume whitespace and parse
 4227|   160k|            it = peek;
 4228|   160k|            yaml::parse_flow_sequence<Opts>(value, ctx, it, end);
 4229|   160k|         }
 4230|   289k|         else if (*peek == '-') {
  ------------------
  |  Branch (4230:19): [True: 289k, False: 94]
  ------------------
 4231|       |            // Block sequence - don't consume leading whitespace, let parse_block_sequence handle it
 4232|       |            // But if there was a tag, we need to advance past it
 4233|   289k|            if (preamble.tag != yaml::yaml_tag::none || preamble.node_props.has_anchor) {
  ------------------
  |  Branch (4233:17): [True: 230, False: 289k]
  |  Branch (4233:57): [True: 2.82k, False: 286k]
  ------------------
 4234|  3.05k|               it = peek;
 4235|  3.05k|            }
 4236|   289k|            int32_t seq_indent = ctx.current_indent();
 4237|   289k|            if (*it == '-' && ctx.current_indent() >= 0) {
  ------------------
  |  Branch (4237:17): [True: 286k, False: 2.27k]
  |  Branch (4237:31): [True: 179k, False: 107k]
  ------------------
 4238|   179k|               seq_indent = ctx.allow_indentless_sequence ? (ctx.current_indent() > 0 ? (ctx.current_indent() - 1) : 0)
  ------------------
  |  Branch (4238:29): [True: 60.0k, False: 119k]
  |  Branch (4238:62): [True: 47.1k, False: 12.8k]
  ------------------
 4239|   179k|                                                          : (ctx.current_indent() + 1);
 4240|   179k|            }
 4241|   289k|            yaml::parse_block_sequence<Opts>(value, ctx, it, end, seq_indent);
 4242|   289k|         }
 4243|     94|         else {
 4244|     94|            ctx.error = error_code::syntax_error;
 4245|     94|         }
 4246|       |
 4247|   449k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 4248|   449k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEELb0ERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS4_9allocatorIS9_EEEENS0_12yaml_contextEPKcSG_ZNS_4fromILj450ESC_E2opITnDaXtlS2_Lj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERSG_SD_TkNS_10is_contextERSE_SG_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSP_RSS_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   476k|      {
  475|   476k|         skip_inline_ws(it, end);
  476|       |
  477|   476k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 8, False: 476k]
  ------------------
  478|      8|            if constexpr (!AllowEmptyInput) {
  479|      8|               ctx.error = error_code::unexpected_end;
  480|      8|            }
  481|      8|            return true;
  482|      8|         }
  483|       |
  484|   476k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   476k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 6, False: 476k]
  ------------------
  486|      6|            ctx.error = error_code::syntax_error;
  487|      6|            return true;
  488|      6|         }
  489|   476k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 6, False: 476k]
  ------------------
  490|      6|            ctx.error = error_code::syntax_error;
  491|      6|            return true;
  492|      6|         }
  493|       |
  494|   476k|         skip_inline_ws(it, end);
  495|       |
  496|   476k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 6, False: 476k]
  ------------------
  497|      6|            if constexpr (!AllowEmptyInput) {
  498|      6|               ctx.error = error_code::unexpected_end;
  499|      6|            }
  500|      6|            return true;
  501|      6|         }
  502|       |
  503|   476k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 26.3k, False: 450k]
  ------------------
  504|  26.3k|            return true;
  505|  26.3k|         }
  506|       |
  507|   450k|         return false;
  508|   476k|      }
_ZZN3glz4fromILj450ENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS1_9allocatorIS6_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRS9_TkNS_10is_contextERNS_4yaml12yaml_contextESE_EEvOT1_OT2_OT0_T3_ENKUlNSH_8yaml_tagEE_clESR_:
 4215|   476k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_seq(tag); })) {
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS4_9allocatorIS9_EEEENS0_12yaml_contextEPKcSG_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   476k|      {
  418|   476k|         state.has_anchor = false;
  419|   476k|         state.anchor_name.clear();
  420|   476k|         state.anchor_start = nullptr;
  421|   476k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   476k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|   476k|            else {
  430|   476k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 26.2k, False: 450k]
  ------------------
  431|   476k|            }
  432|   476k|         }
  433|       |
  434|   476k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 450k, False: 26.2k]
  |  Branch (434:27): [True: 6.95k, False: 443k]
  ------------------
  435|  6.95k|            ++it;
  436|  6.95k|            auto name = parse_anchor_name(it, end);
  437|  6.95k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 24, False: 6.92k]
  ------------------
  438|     24|               ctx.error = error_code::syntax_error;
  439|     24|               return true;
  440|     24|            }
  441|  6.92k|            skip_inline_ws(it, end);
  442|  6.92k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 26, False: 6.90k]
  ------------------
  443|     26|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     26|                  ctx.error = error_code::unexpected_end;
  445|     26|               }
  446|     26|               return true;
  447|     26|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  6.90k|            state.has_anchor = true;
  455|  6.90k|            state.anchor_name = std::string(name);
  456|  6.90k|            state.anchor_start = &*it;
  457|  6.90k|         }
  458|       |
  459|   476k|         return false;
  460|   476k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEbOT0_RT1_RT2_T3_:
  309|   476k|      {
  310|   476k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 476k]
  |  Branch (310:27): [True: 450k, False: 26.2k]
  ------------------
  311|       |
  312|  26.2k|         ++it; // skip '*'
  313|  26.2k|         auto name = parse_anchor_name(it, end);
  314|  26.2k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 18, False: 26.2k]
  ------------------
  315|     18|            ctx.error = error_code::syntax_error;
  316|     18|            return true;
  317|     18|         }
  318|       |
  319|  26.2k|         auto anchor_it = ctx.anchors.find(name);
  320|  26.2k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 40, False: 26.2k]
  ------------------
  321|     40|            ctx.error = error_code::syntax_error; // undefined alias
  322|     40|            return true;
  323|     40|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  26.2k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  26.2k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 12.3k, False: 13.8k]
  ------------------
  331|  12.3k|            return true;
  332|  12.3k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  13.8k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 44, False: 13.7k]
  ------------------
  338|     44|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     44|            return true;
  340|     44|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  13.7k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  13.7k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 6, False: 13.7k]
  ------------------
  348|      6|            return true;
  349|       |
  350|  13.7k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 8, False: 13.7k]
  ------------------
  351|      8|            ctx.error = error_code::exceeded_max_expansion;
  352|      8|            ctx.custom_error_message = "alias expansion";
  353|      8|            return true;
  354|      8|         }
  355|       |
  356|  13.7k|         auto replay_it = span.begin;
  357|  13.7k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  13.7k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  13.7k|         ctx.indent_stack.clear();
  362|  13.7k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 5.16k, False: 8.61k]
  ------------------
  363|  5.16k|            ctx.push_indent(span.base_indent - 1);
  364|  5.16k|         }
  365|       |
  366|  13.7k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  13.7k|         using V = std::remove_cvref_t<T>;
  369|  13.7k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  13.7k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  13.7k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  13.7k|         return true;
  376|  13.7k|      }
_ZN3glz4yaml19parse_flow_sequenceITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_:
 2698|   160k|      {
 2699|   160k|         using V = std::remove_cvref_t<T>;
 2700|   160k|         using value_type = typename V::value_type;
 2701|       |
 2702|   160k|         struct sequence_container_adapter
 2703|   160k|         {
 2704|   160k|            size_t index = 0;
 2705|       |
 2706|   160k|            inline bool fixed_capacity_reached(const V& container) const noexcept
 2707|   160k|            {
 2708|   160k|               if constexpr (!resizable<V>) {
 2709|   160k|                  return index >= container.size();
 2710|   160k|               }
 2711|   160k|               else {
 2712|   160k|                  (void)container;
 2713|   160k|                  return false;
 2714|   160k|               }
 2715|   160k|            }
 2716|       |
 2717|   160k|            inline void commit_fixed_slot() noexcept { ++index; }
 2718|       |
 2719|   160k|            inline void append(V& container, value_type&& element) noexcept
 2720|   160k|            {
 2721|   160k|               if constexpr (emplace_backable<V>) {
 2722|   160k|                  container.emplace_back(std::move(element));
 2723|   160k|               }
 2724|   160k|               else if constexpr (emplaceable<V>) {
 2725|   160k|                  container.emplace(std::move(element));
 2726|   160k|               }
 2727|   160k|            }
 2728|   160k|         };
 2729|       |
 2730|   160k|         if (it == end || *it != '[') [[unlikely]] {
  ------------------
  |  Branch (2730:14): [True: 0, False: 160k]
  |  Branch (2730:27): [True: 0, False: 160k]
  ------------------
 2731|      0|            ctx.error = error_code::syntax_error;
 2732|      0|            return;
 2733|      0|         }
 2734|       |
 2735|       |         // Overwrite (do not append to) any pre-existing contents. Must happen
 2736|       |         // before the empty-array early return below so that `[]` also clears.
 2737|   160k|         clear_sequence_before_read<Opts>(value);
 2738|       |
 2739|   160k|         ++it; // Skip '['
 2740|       |         // Skip whitespace and newlines after opening bracket (YAML allows multi-line flow sequences)
 2741|   160k|         skip_flow_ws_and_newlines(ctx, it, end);
 2742|   160k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2742:14): [True: 14, False: 160k]
  ------------------
 2743|     14|            return;
 2744|       |
 2745|       |         // Handle empty array
 2746|   160k|         if (it != end && *it == ']') {
  ------------------
  |  Branch (2746:14): [True: 157k, False: 2.60k]
  |  Branch (2746:27): [True: 56.2k, False: 101k]
  ------------------
 2747|  56.2k|            ++it;
 2748|  56.2k|            validate_flow_node_adjacent_tail(ctx, it, end);
 2749|  56.2k|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2749:17): [True: 6, False: 56.2k]
  ------------------
 2750|      6|               return;
 2751|       |            if constexpr (!yaml::check_flow_context(Opts)) {
 2752|       |               if (ctx.current_indent() < 0) {
 2753|       |                  validate_root_flow_tail_after_close(ctx, it, end);
 2754|       |               }
 2755|       |            }
 2756|  56.2k|            return;
 2757|  56.2k|         }
 2758|       |
 2759|   103k|         bool just_saw_comma = false;
 2760|   103k|         sequence_container_adapter adapter{};
 2761|       |
 2762|   103k|         if constexpr (emplace_backable<V> || emplaceable<V>) {
 2763|       |            // Dynamic containers append items (vector-like and set-like)
 2764|   172k|            while (it != end) {
  ------------------
  |  Branch (2764:20): [True: 169k, False: 3.10k]
  ------------------
 2765|   169k|               skip_flow_ws_and_newlines(ctx, it, end);
 2766|   169k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2766:20): [True: 0, False: 169k]
  ------------------
 2767|      0|                  return;
 2768|       |
 2769|   169k|               if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2769:20): [True: 0, False: 169k]
  ------------------
 2770|      0|                  ctx.error = error_code::unexpected_end;
 2771|      0|                  return;
 2772|      0|               }
 2773|       |
 2774|   169k|               if (*it == ']') {
  ------------------
  |  Branch (2774:20): [True: 28.6k, False: 141k]
  ------------------
 2775|  28.6k|                  if (just_saw_comma) {
  ------------------
  |  Branch (2775:23): [True: 28.6k, False: 0]
  ------------------
 2776|  28.6k|                     ++it;
 2777|  28.6k|                     validate_flow_node_adjacent_tail(ctx, it, end);
 2778|  28.6k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2778:26): [True: 6, False: 28.6k]
  ------------------
 2779|      6|                        return;
 2780|       |                     if constexpr (!yaml::check_flow_context(Opts)) {
 2781|       |                        if (ctx.current_indent() < 0) {
 2782|       |                           validate_root_flow_tail_after_close(ctx, it, end);
 2783|       |                        }
 2784|       |                     }
 2785|  28.6k|                     return;
 2786|  28.6k|                  }
 2787|      0|                  ctx.error = error_code::syntax_error;
 2788|      0|                  return;
 2789|  28.6k|               }
 2790|       |
 2791|   141k|               if (*it == ',' || *it == '#') {
  ------------------
  |  Branch (2791:20): [True: 6, False: 141k]
  |  Branch (2791:34): [True: 14, False: 141k]
  ------------------
 2792|     20|                  ctx.error = error_code::syntax_error;
 2793|     20|                  return;
 2794|     20|               }
 2795|   141k|               just_saw_comma = false;
 2796|       |
 2797|   141k|               value_type element{};
 2798|   141k|               from<YAML, value_type>::template op<flow_context_on<Opts>()>(element, ctx, it, end);
 2799|       |
 2800|   141k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2800:20): [True: 5.07k, False: 136k]
  ------------------
 2801|  5.07k|                  return;
 2802|       |
 2803|   136k|               bool saw_line_break_before_separator = false;
 2804|   136k|               skip_flow_ws_and_newlines(ctx, it, end, &saw_line_break_before_separator);
 2805|   136k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2805:20): [True: 6, False: 136k]
  ------------------
 2806|      6|                  return;
 2807|       |
 2808|   136k|               if (it != end && *it == ':') {
  ------------------
  |  Branch (2808:20): [True: 135k, False: 158]
  |  Branch (2808:33): [True: 24.7k, False: 111k]
  ------------------
 2809|       |                  // In flow sequences, implicit key-value pairs must be on a single line.
 2810|  24.7k|                  if (saw_line_break_before_separator) {
  ------------------
  |  Branch (2810:23): [True: 6, False: 24.7k]
  ------------------
 2811|      6|                     ctx.error = error_code::syntax_error;
 2812|      6|                     return;
 2813|      6|                  }
 2814|  24.7k|                  if constexpr (std::same_as<std::remove_cvref_t<value_type>, glz::generic>) {
 2815|  24.7k|                     glz::generic key_node = std::move(element);
 2816|  24.7k|                     ++it;
 2817|  24.7k|                     skip_inline_ws(it, end);
 2818|       |
 2819|  24.7k|                     glz::generic mapped{};
 2820|  24.7k|                     from<YAML, glz::generic>::template op<flow_context_on<Opts>()>(mapped, ctx, it, end);
 2821|  24.7k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2821:26): [True: 226, False: 24.5k]
  ------------------
 2822|    226|                        return;
 2823|       |
 2824|  24.5k|                     std::string key;
 2825|  24.5k|                     if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (2825:26): [True: 4, False: 24.5k]
  ------------------
 2826|      4|                        return;
 2827|       |
 2828|  24.5k|                     glz::generic pair{};
 2829|  24.5k|                     pair[key] = std::move(mapped);
 2830|  24.5k|                     element = std::move(pair);
 2831|       |
 2832|  24.5k|                     skip_flow_ws_and_newlines(ctx, it, end);
 2833|  24.5k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2833:26): [True: 0, False: 24.5k]
  ------------------
 2834|      0|                        return;
 2835|       |                  }
 2836|       |                  else {
 2837|       |                     ctx.error = error_code::syntax_error;
 2838|       |                     return;
 2839|       |                  }
 2840|  24.7k|               }
 2841|       |
 2842|   136k|               adapter.append(value, std::move(element));
 2843|       |
 2844|   136k|               if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2844:20): [True: 160, False: 135k]
  ------------------
 2845|    160|                  ctx.error = error_code::unexpected_end;
 2846|    160|                  return;
 2847|    160|               }
 2848|       |
 2849|   135k|               if (*it == ']') {
  ------------------
  |  Branch (2849:20): [True: 66.7k, False: 69.2k]
  ------------------
 2850|  66.7k|                  ++it;
 2851|  66.7k|                  validate_flow_node_adjacent_tail(ctx, it, end);
 2852|  66.7k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2852:23): [True: 10, False: 66.6k]
  ------------------
 2853|     10|                     return;
 2854|       |                  if constexpr (!yaml::check_flow_context(Opts)) {
 2855|       |                     if (ctx.current_indent() < 0) {
 2856|       |                        validate_root_flow_tail_after_close(ctx, it, end);
 2857|       |                     }
 2858|       |                  }
 2859|  66.6k|                  return;
 2860|  66.7k|               }
 2861|  69.2k|               else if (*it == ',') {
  ------------------
  |  Branch (2861:25): [True: 68.9k, False: 284]
  ------------------
 2862|  68.9k|                  ++it;
 2863|  68.9k|                  just_saw_comma = true;
 2864|  68.9k|                  skip_flow_ws_and_newlines(ctx, it, end);
 2865|  68.9k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2865:23): [True: 6, False: 68.9k]
  ------------------
 2866|      6|                     return;
 2867|  68.9k|               }
 2868|    284|               else {
 2869|    284|                  ctx.error = error_code::syntax_error;
 2870|    284|                  return;
 2871|    284|               }
 2872|   135k|            }
 2873|       |         }
 2874|       |         else if constexpr (!resizable<V>) {
 2875|       |            // Fixed-size containers (std::array)
 2876|       |            while (it != end) {
 2877|       |               skip_flow_ws_and_newlines(ctx, it, end);
 2878|       |               if (bool(ctx.error)) [[unlikely]]
 2879|       |                  return;
 2880|       |
 2881|       |               if (it == end) [[unlikely]] {
 2882|       |                  ctx.error = error_code::unexpected_end;
 2883|       |                  return;
 2884|       |               }
 2885|       |
 2886|       |               if (*it == ']') {
 2887|       |                  if (just_saw_comma) {
 2888|       |                     ++it;
 2889|       |                     validate_flow_node_adjacent_tail(ctx, it, end);
 2890|       |                     if (bool(ctx.error)) [[unlikely]]
 2891|       |                        return;
 2892|       |                     if constexpr (!yaml::check_flow_context(Opts)) {
 2893|       |                        if (ctx.current_indent() < 0) {
 2894|       |                           validate_root_flow_tail_after_close(ctx, it, end);
 2895|       |                        }
 2896|       |                     }
 2897|       |                     return;
 2898|       |                  }
 2899|       |                  ctx.error = error_code::syntax_error;
 2900|       |                  return;
 2901|       |               }
 2902|       |
 2903|       |               if (*it == ',' || *it == '#') {
 2904|       |                  ctx.error = error_code::syntax_error;
 2905|       |                  return;
 2906|       |               }
 2907|       |               just_saw_comma = false;
 2908|       |
 2909|       |               // An item beyond the last slot is an error, as in JSON.
 2910|       |               if (adapter.fixed_capacity_reached(value)) [[unlikely]] {
 2911|       |                  ctx.error = error_code::exceeded_static_array_size;
 2912|       |                  return;
 2913|       |               }
 2914|       |
 2915|       |               from<YAML, value_type>::template op<flow_context_on<Opts>()>(value[adapter.index], ctx, it, end);
 2916|       |
 2917|       |               if (bool(ctx.error)) [[unlikely]]
 2918|       |                  return;
 2919|       |
 2920|       |               adapter.commit_fixed_slot();
 2921|       |               skip_flow_ws_and_newlines(ctx, it, end);
 2922|       |               if (bool(ctx.error)) [[unlikely]]
 2923|       |                  return;
 2924|       |
 2925|       |               if (it == end) [[unlikely]] {
 2926|       |                  ctx.error = error_code::unexpected_end;
 2927|       |                  return;
 2928|       |               }
 2929|       |
 2930|       |               if (*it == ']') {
 2931|       |                  ++it;
 2932|       |                  validate_flow_node_adjacent_tail(ctx, it, end);
 2933|       |                  if (bool(ctx.error)) [[unlikely]]
 2934|       |                     return;
 2935|       |                  if constexpr (!yaml::check_flow_context(Opts)) {
 2936|       |                     if (ctx.current_indent() < 0) {
 2937|       |                        validate_root_flow_tail_after_close(ctx, it, end);
 2938|       |                     }
 2939|       |                  }
 2940|       |                  return;
 2941|       |               }
 2942|       |               else if (*it == ',') {
 2943|       |                  ++it;
 2944|       |                  just_saw_comma = true;
 2945|       |                  skip_flow_ws_and_newlines(ctx, it, end);
 2946|       |                  if (bool(ctx.error)) [[unlikely]]
 2947|       |                     return;
 2948|       |               }
 2949|       |               else {
 2950|       |                  ctx.error = error_code::syntax_error;
 2951|       |                  return;
 2952|       |               }
 2953|       |            }
 2954|       |         }
 2955|       |         else {
 2956|       |            ctx.error = error_code::syntax_error;
 2957|       |            return;
 2958|       |         }
 2959|   103k|      }
_ZN3glz4yaml26clear_sequence_before_readITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEEEEvRT0_:
 2682|   449k|      {
 2683|   449k|         if constexpr (emplace_backable<V> && requires { value.clear(); }) {
 2684|       |            // vector-like: honor the append_arrays option, matching json/read.hpp
 2685|   449k|            if constexpr (!check_append_arrays(Opts)) {
 2686|   449k|               value.clear();
 2687|   449k|            }
 2688|       |         }
 2689|       |         else if constexpr (emplaceable<V> && requires { value.clear(); }) {
 2690|       |            // set-like: json/read.hpp clears unconditionally; append_arrays does not apply
 2691|       |            value.clear();
 2692|       |         }
 2693|   449k|      }
_ZZN3glz4yaml19parse_flow_sequenceITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_EN26sequence_container_adapter6appendESC_OS8_:
 2720|   135k|            {
 2721|   135k|               if constexpr (emplace_backable<V>) {
 2722|   135k|                  container.emplace_back(std::move(element));
 2723|       |               }
 2724|       |               else if constexpr (emplaceable<V>) {
 2725|       |                  container.emplace(std::move(element));
 2726|       |               }
 2727|   135k|            }
_ZN3glz4yaml20parse_block_sequenceITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_i:
 3186|   289k|      {
 3187|   289k|         using V = std::remove_cvref_t<T>;
 3188|   289k|         using value_type = typename V::value_type;
 3189|       |
 3190|   289k|         struct sequence_container_adapter
 3191|   289k|         {
 3192|   289k|            size_t index = 0;
 3193|       |
 3194|   289k|            inline bool fixed_capacity_reached(const V& container) const noexcept
 3195|   289k|            {
 3196|   289k|               if constexpr (!resizable<V>) {
 3197|   289k|                  return index >= container.size();
 3198|   289k|               }
 3199|   289k|               else {
 3200|   289k|                  (void)container;
 3201|   289k|                  return false;
 3202|   289k|               }
 3203|   289k|            }
 3204|       |
 3205|   289k|            inline void commit_fixed_slot() noexcept { ++index; }
 3206|       |
 3207|   289k|            inline void append(V& container, value_type&& element) noexcept
 3208|   289k|            {
 3209|   289k|               if constexpr (emplace_backable<V>) {
 3210|   289k|                  container.emplace_back(std::move(element));
 3211|   289k|               }
 3212|   289k|               else if constexpr (emplaceable<V>) {
 3213|   289k|                  container.emplace(std::move(element));
 3214|   289k|               }
 3215|   289k|            }
 3216|   289k|         };
 3217|       |
 3218|       |         // Overwrite (do not append to) any pre-existing contents. A block
 3219|       |         // sequence is only entered once a '-' item is confirmed, so clearing
 3220|       |         // up front correctly (re)assigns the container to the parsed sequence.
 3221|   289k|         clear_sequence_before_read<Opts>(value);
 3222|       |
 3223|   289k|         sequence_container_adapter adapter{};
 3224|       |
 3225|       |         // Track if this is the first item (for handling whitespace-consumed case)
 3226|   289k|         bool first_item = true;
 3227|   289k|         bool has_pending_item_anchor = false;
 3228|   289k|         std::string pending_item_anchor_name{};
 3229|   289k|         int32_t pending_item_anchor_indent = sequence_indent;
 3230|       |
 3231|   714k|         while (it != end) {
  ------------------
  |  Branch (3231:17): [True: 654k, False: 59.7k]
  ------------------
 3232|       |            // Skip blank lines and comments, track indent
 3233|   654k|            int32_t line_indent = 0;
 3234|   654k|            int32_t dash_col = -1; // actual column of the '-' on the line
 3235|   654k|            auto line_start = it;
 3236|       |
 3237|  1.47M|            while (it != end) {
  ------------------
  |  Branch (3237:20): [True: 1.44M, False: 28.5k]
  ------------------
 3238|  1.44M|               if (*it == '#') {
  ------------------
  |  Branch (3238:20): [True: 175k, False: 1.26M]
  ------------------
 3239|   175k|                  skip_comment(it, end);
 3240|   175k|                  skip_newline(it, end);
 3241|   175k|                  line_start = it;
 3242|   175k|                  line_indent = 0;
 3243|   175k|               }
 3244|  1.26M|               else if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3244:25): [True: 153k, False: 1.11M]
  |  Branch (3244:40): [True: 290k, False: 822k]
  ------------------
 3245|   444k|                  skip_newline(it, end);
 3246|   444k|                  line_start = it;
 3247|   444k|                  line_indent = 0;
 3248|   444k|               }
 3249|   822k|               else if (*it == ' ') {
  ------------------
  |  Branch (3249:25): [True: 159k, False: 662k]
  ------------------
 3250|   159k|                  line_start = it;
 3251|   159k|                  line_indent = 0;
 3252|  1.33M|                  while (it != end && *it == ' ') {
  ------------------
  |  Branch (3252:26): [True: 1.33M, False: 1.05k]
  |  Branch (3252:39): [True: 1.17M, False: 158k]
  ------------------
 3253|  1.17M|                     ++line_indent;
 3254|  1.17M|                     ++it;
 3255|  1.17M|                  }
 3256|       |
 3257|   159k|                  bool saw_tab = false;
 3258|   204k|                  while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3258:26): [True: 202k, False: 2.22k]
  |  Branch (3258:40): [True: 6.86k, False: 195k]
  |  Branch (3258:54): [True: 37.9k, False: 157k]
  ------------------
 3259|  44.8k|                     saw_tab = saw_tab || (*it == '\t');
  ------------------
  |  Branch (3259:32): [True: 7.56k, False: 37.2k]
  |  Branch (3259:43): [True: 37.2k, False: 0]
  ------------------
 3260|  44.8k|                     ++it;
 3261|  44.8k|                  }
 3262|       |
 3263|   159k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3263:23): [True: 2.22k, False: 157k]
  |  Branch (3263:36): [True: 24.4k, False: 132k]
  |  Branch (3263:51): [True: 68.5k, False: 64.2k]
  |  Branch (3263:66): [True: 27.1k, False: 37.0k]
  ------------------
 3264|       |                     // Blank or comment line - continue to next line
 3265|   122k|                     if (it != end && *it == '#') {
  ------------------
  |  Branch (3265:26): [True: 120k, False: 2.22k]
  |  Branch (3265:39): [True: 27.1k, False: 93.0k]
  ------------------
 3266|  27.1k|                        skip_comment(it, end);
 3267|  27.1k|                     }
 3268|   122k|                     line_indent = 0;
 3269|   122k|                     continue;
 3270|   122k|                  }
 3271|       |
 3272|  37.0k|                  if (saw_tab) {
  ------------------
  |  Branch (3272:23): [True: 8, False: 37.0k]
  ------------------
 3273|      8|                     ctx.error = error_code::syntax_error;
 3274|      8|                     return;
 3275|      8|                  }
 3276|  37.0k|                  break; // Found content
 3277|  37.0k|               }
 3278|   662k|               else if (*it == '\t') {
  ------------------
  |  Branch (3278:25): [True: 73.6k, False: 588k]
  ------------------
 3279|  73.6k|                  line_start = it;
 3280|   215k|                  while (it != end && (*it == ' ' || *it == '\t')) ++it;
  ------------------
  |  Branch (3280:26): [True: 212k, False: 3.12k]
  |  Branch (3280:40): [True: 2.90k, False: 209k]
  |  Branch (3280:54): [True: 138k, False: 70.5k]
  ------------------
 3281|  73.6k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3281:23): [True: 3.12k, False: 70.5k]
  |  Branch (3281:36): [True: 32.5k, False: 38.0k]
  |  Branch (3281:51): [True: 3.07k, False: 34.9k]
  |  Branch (3281:66): [True: 34.9k, False: 22]
  ------------------
 3282|  73.6k|                     if (it != end && *it == '#') {
  ------------------
  |  Branch (3282:26): [True: 70.5k, False: 3.12k]
  |  Branch (3282:39): [True: 34.9k, False: 35.5k]
  ------------------
 3283|  34.9k|                        skip_comment(it, end);
 3284|  34.9k|                     }
 3285|  73.6k|                     line_indent = 0;
 3286|  73.6k|                     continue;
 3287|  73.6k|                  }
 3288|     22|                  ctx.error = error_code::syntax_error;
 3289|     22|                  return;
 3290|  73.6k|               }
 3291|   588k|               else {
 3292|       |                  // At content (no leading space on this line)
 3293|       |                  // If first item and at '-', whitespace was consumed by caller;
 3294|       |                  // treat as having correct indentation
 3295|   588k|                  if (first_item && *it == '-') {
  ------------------
  |  Branch (3295:23): [True: 289k, False: 299k]
  |  Branch (3295:37): [True: 286k, False: 2.27k]
  ------------------
 3296|   286k|                     line_indent = sequence_indent;
 3297|   286k|                     if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3298|   286k|                        if (ctx.stream_begin && it > ctx.stream_begin) {
  ------------------
  |  Branch (3298:29): [True: 286k, False: 0]
  |  Branch (3298:49): [True: 286k, False: 0]
  ------------------
 3299|   286k|                           auto probe = it;
 3300|   286k|                           int32_t leading_ws = 0;
 3301|   286k|                           bool saw_tab = false;
 3302|   590k|                           while (probe > ctx.stream_begin && (*(probe - 1) == ' ' || *(probe - 1) == '\t')) {
  ------------------
  |  Branch (3302:35): [True: 590k, False: 0]
  |  Branch (3302:64): [True: 261k, False: 329k]
  |  Branch (3302:87): [True: 42.0k, False: 286k]
  ------------------
 3303|   303k|                              --probe;
 3304|   303k|                              ++leading_ws;
 3305|   303k|                              saw_tab = saw_tab || (*probe == '\t');
  ------------------
  |  Branch (3305:41): [True: 654, False: 303k]
  |  Branch (3305:52): [True: 41.8k, False: 261k]
  ------------------
 3306|   303k|                           }
 3307|   286k|                           if (probe == ctx.stream_begin || *(probe - 1) == '\n' || *(probe - 1) == '\r') {
  ------------------
  |  Branch (3307:32): [True: 0, False: 286k]
  |  Branch (3307:61): [True: 11.9k, False: 275k]
  |  Branch (3307:85): [True: 58.7k, False: 216k]
  ------------------
 3308|  70.6k|                              if (saw_tab) {
  ------------------
  |  Branch (3308:35): [True: 8, False: 70.6k]
  ------------------
 3309|      8|                                 ctx.error = error_code::syntax_error;
 3310|      8|                                 return;
 3311|      8|                              }
 3312|  70.6k|                              line_indent = (std::max)(line_indent, leading_ws);
 3313|  70.6k|                           }
 3314|   286k|                        }
 3315|   286k|                     }
 3316|   286k|                  }
 3317|   286k|                  break;
 3318|   588k|               }
 3319|  1.44M|            }
 3320|       |
 3321|   654k|            if (it == end) break;
  ------------------
  |  Branch (3321:17): [True: 28.5k, False: 626k]
  ------------------
 3322|       |
 3323|       |            // Check for document end marker
 3324|   626k|            if (at_document_end(it, end)) break;
  ------------------
  |  Branch (3324:17): [True: 3.67k, False: 622k]
  ------------------
 3325|       |
 3326|       |            // Check for dedent
 3327|   622k|            if (line_indent < sequence_indent) {
  ------------------
  |  Branch (3327:17): [True: 92.5k, False: 529k]
  ------------------
 3328|  92.5k|               it = line_start;
 3329|  92.5k|               return;
 3330|  92.5k|            }
 3331|       |
 3332|   529k|            if (*it == '&') {
  ------------------
  |  Branch (3332:17): [True: 11.3k, False: 518k]
  ------------------
 3333|       |               // Standalone anchor lines before "- item" are only supported for
 3334|       |               // indentless mapping values. At top-level block sequences these are
 3335|       |               // malformed in yaml-test-suite cases.
 3336|  11.3k|               if (!ctx.allow_indentless_sequence) {
  ------------------
  |  Branch (3336:20): [True: 32, False: 11.2k]
  ------------------
 3337|     32|                  ctx.error = error_code::syntax_error;
 3338|     32|                  return;
 3339|     32|               }
 3340|       |
 3341|  11.2k|               ++it;
 3342|  11.2k|               auto pending_name = parse_anchor_name(it, end);
 3343|  11.2k|               if (pending_name.empty()) {
  ------------------
  |  Branch (3343:20): [True: 22, False: 11.2k]
  ------------------
 3344|     22|                  ctx.error = error_code::syntax_error;
 3345|     22|                  return;
 3346|     22|               }
 3347|  11.2k|               skip_inline_ws(it, end);
 3348|  11.2k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (3348:20): [True: 11.2k, False: 24]
  |  Branch (3348:33): [True: 1.67k, False: 9.57k]
  ------------------
 3349|  1.67k|                  skip_comment(it, end);
 3350|  1.67k|               }
 3351|       |
 3352|  11.2k|               has_pending_item_anchor = true;
 3353|  11.2k|               pending_item_anchor_name = std::string(pending_name);
 3354|  11.2k|               pending_item_anchor_indent = line_indent;
 3355|       |
 3356|  11.2k|               if (it == end || (*it != '\n' && *it != '\r')) {
  ------------------
  |  Branch (3356:20): [True: 24, False: 11.2k]
  |  Branch (3356:34): [True: 6.79k, False: 4.46k]
  |  Branch (3356:49): [True: 26, False: 6.76k]
  ------------------
 3357|     50|                  ctx.error = error_code::syntax_error;
 3358|     50|                  return;
 3359|     50|               }
 3360|       |
 3361|  11.2k|               skip_newline(it, end);
 3362|  11.2k|               continue;
 3363|  11.2k|            }
 3364|       |
 3365|       |            // Expect dash for sequence item
 3366|   518k|            if (*it != '-') {
  ------------------
  |  Branch (3366:17): [True: 95.8k, False: 422k]
  ------------------
 3367|  95.8k|               it = line_start;
 3368|  95.8k|               return;
 3369|  95.8k|            }
 3370|       |
 3371|       |            // Compute the actual column of this sequence dash.
 3372|       |            // This is needed by plain-scalar multiline folding to distinguish
 3373|       |            // sibling "- item" entries from deeper "- " continuation content.
 3374|   422k|            dash_col = line_indent;
 3375|   422k|            if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3376|   422k|               if (ctx.stream_begin) {
  ------------------
  |  Branch (3376:20): [True: 422k, False: 8]
  ------------------
 3377|   422k|                  dash_col = ctx.line_prefix_before(&*it).column;
 3378|   422k|               }
 3379|   422k|            }
 3380|       |
 3381|   422k|            ++it; // Skip '-'
 3382|       |
 3383|       |            // Check for valid sequence item indicator (- followed by space or newline)
 3384|   422k|            if (it != end && !yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (3384:17): [True: 417k, False: 5.07k]
  |  Branch (3384:30): [True: 8.06k, False: 409k]
  ------------------
 3385|       |               // Not a sequence item (could be a number like -5)
 3386|  8.06k|               it = line_start;
 3387|  8.06k|               return;
 3388|  8.06k|            }
 3389|       |
 3390|   414k|            bool saw_tab_after_dash = false;
 3391|   755k|            while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3391:20): [True: 749k, False: 5.93k]
  |  Branch (3391:34): [True: 310k, False: 438k]
  |  Branch (3391:48): [True: 30.2k, False: 408k]
  ------------------
 3392|   341k|               saw_tab_after_dash = saw_tab_after_dash || (*it == '\t');
  ------------------
  |  Branch (3392:37): [True: 3.97k, False: 337k]
  |  Branch (3392:59): [True: 28.5k, False: 308k]
  ------------------
 3393|   341k|               ++it;
 3394|   341k|            }
 3395|       |            // A tab-separated nested "- " marker is not valid block indentation.
 3396|   414k|            if (saw_tab_after_dash && it != end && *it == '-') {
  ------------------
  |  Branch (3396:17): [True: 28.5k, False: 385k]
  |  Branch (3396:39): [True: 28.1k, False: 416]
  |  Branch (3396:52): [True: 582, False: 27.5k]
  ------------------
 3397|    582|               const auto after_dash = it + 1;
 3398|    582|               if (after_dash == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_dash)]) {
  ------------------
  |  Branch (3398:20): [True: 6, False: 576]
  |  Branch (3398:41): [True: 6, False: 570]
  ------------------
 3399|     12|                  ctx.error = error_code::syntax_error;
 3400|     12|                  return;
 3401|     12|               }
 3402|    582|            }
 3403|       |
 3404|       |            // Get reference to element to parse into
 3405|   414k|            auto parse_element = [&](auto& element) {
 3406|   414k|               const char* element_start = (it != end) ? &*it : nullptr;
 3407|       |
 3408|       |               // Check what follows
 3409|   414k|               if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 3410|       |                  // Content on same line as dash - set indent to one less than content column
 3411|       |                  // This allows nested block mappings to continue parsing keys at the content indent
 3412|       |                  // For "- key: val", if dash is at column 0, content is at column 2
 3413|       |                  // We set parent indent to 1 so keys at column 2 pass the "indent > parent" check
 3414|   414k|                  if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 3415|   414k|                     return;
 3416|   414k|                  const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3417|   414k|                  const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3418|   414k|                  ctx.sequence_item_value_context = true;
 3419|   414k|                  ctx.sequence_dash_indent = dash_col;
 3420|   414k|                  from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3421|   414k|                  ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3422|   414k|                  ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3423|   414k|                  ctx.pop_indent();
 3424|   414k|               }
 3425|   414k|               else {
 3426|       |                  // Value on next line - nested block
 3427|   414k|                  skip_ws_and_comment(it, end);
 3428|   414k|                  skip_newline(it, end);
 3429|       |
 3430|       |                  // Get indent of nested content
 3431|   414k|                  auto nested_start = it;
 3432|   414k|                  int32_t nested_indent = measure_indent(it, end, ctx);
 3433|   414k|                  if (bool(ctx.error)) [[unlikely]]
 3434|   414k|                     return;
 3435|   414k|                  it = nested_start;
 3436|       |
 3437|       |                  // Content is nested only if indented more than the current line.
 3438|       |                  // When line_indent is negative (root level), use 0 as the baseline.
 3439|       |                  // This prevents content at column 0 from being treated as nested.
 3440|   414k|                  const int32_t effective_line_indent = (line_indent < 0) ? 0 : line_indent;
 3441|   414k|                  if (nested_indent > effective_line_indent) {
 3442|       |                     // Save and set indent for nested parsing.
 3443|       |                     // A struct element reads the pushed indent as its own key column; every
 3444|       |                     // other element type reads it as the enclosing baseline, so it gets one
 3445|       |                     // less than the content indent and its content passes "indent > parent".
 3446|   414k|                     const int32_t element_indent =
 3447|   414k|                        receives_block_mapping_column<value_type>() ? nested_indent : nested_indent - 1;
 3448|   414k|                     if (!ctx.push_indent(element_indent)) [[unlikely]]
 3449|   414k|                        return;
 3450|   414k|                     const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3451|   414k|                     const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3452|   414k|                     ctx.sequence_item_value_context = true;
 3453|   414k|                     ctx.sequence_dash_indent = dash_col;
 3454|   414k|                     from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3455|   414k|                     ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3456|   414k|                     ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3457|   414k|                     ctx.pop_indent();
 3458|   414k|                  }
 3459|       |                  // else: empty element (default constructed)
 3460|   414k|               }
 3461|       |
 3462|   414k|               if (has_pending_item_anchor && !bool(ctx.error)) {
 3463|   414k|                  const char* element_end = (it != end) ? &*it : element_start;
 3464|   414k|                  ctx.anchors[std::move(pending_item_anchor_name)] = {element_start, element_end,
 3465|   414k|                                                                      pending_item_anchor_indent};
 3466|   414k|                  has_pending_item_anchor = false;
 3467|   414k|               }
 3468|   414k|            };
 3469|       |
 3470|   414k|            if constexpr (emplace_backable<V>) {
 3471|   414k|               auto& element = value.emplace_back();
 3472|   414k|               parse_element(element);
 3473|       |            }
 3474|       |            else if constexpr (emplaceable<V>) {
 3475|       |               value_type element{};
 3476|       |               parse_element(element);
 3477|       |               if (!bool(ctx.error)) {
 3478|       |                  adapter.append(value, std::move(element));
 3479|       |               }
 3480|       |            }
 3481|       |            else if constexpr (!resizable<V>) {
 3482|       |               // Fixed-size (e.g. std::array): an item beyond the last slot is an error, as in JSON.
 3483|       |               // Checked only once another item is confirmed, so a full container still ends cleanly.
 3484|       |               if (adapter.fixed_capacity_reached(value)) [[unlikely]] {
 3485|       |                  ctx.error = error_code::exceeded_static_array_size;
 3486|       |                  return;
 3487|       |               }
 3488|       |               parse_element(value[adapter.index]);
 3489|       |               adapter.commit_fixed_slot();
 3490|       |            }
 3491|       |            else {
 3492|       |               ctx.error = error_code::syntax_error;
 3493|       |               return;
 3494|       |            }
 3495|       |
 3496|   414k|            first_item = false;
 3497|       |
 3498|   414k|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3498:17): [True: 672, False: 413k]
  ------------------
 3499|    672|               return;
 3500|       |
 3501|       |            // Note: after parsing nested block content, iterator may already be
 3502|       |            // at the start of the next line. The outer loop will handle it.
 3503|   414k|         }
 3504|   289k|      }
_ZZN3glz4yaml20parse_block_sequenceITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_iENKUlRT_E_clIS8_EEDaSO_:
 3405|   414k|            auto parse_element = [&](auto& element) {
 3406|   414k|               const char* element_start = (it != end) ? &*it : nullptr;
  ------------------
  |  Branch (3406:44): [True: 408k, False: 5.92k]
  ------------------
 3407|       |
 3408|       |               // Check what follows
 3409|   414k|               if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (3409:20): [True: 408k, False: 5.92k]
  |  Branch (3409:33): [True: 241k, False: 167k]
  ------------------
 3410|       |                  // Content on same line as dash - set indent to one less than content column
 3411|       |                  // This allows nested block mappings to continue parsing keys at the content indent
 3412|       |                  // For "- key: val", if dash is at column 0, content is at column 2
 3413|       |                  // We set parent indent to 1 so keys at column 2 pass the "indent > parent" check
 3414|   241k|                  if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
  ------------------
  |  Branch (3414:23): [True: 0, False: 241k]
  ------------------
 3415|      0|                     return;
 3416|   241k|                  const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3417|   241k|                  const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3418|   241k|                  ctx.sequence_item_value_context = true;
 3419|   241k|                  ctx.sequence_dash_indent = dash_col;
 3420|   241k|                  from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3421|   241k|                  ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3422|   241k|                  ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3423|   241k|                  ctx.pop_indent();
 3424|   241k|               }
 3425|   173k|               else {
 3426|       |                  // Value on next line - nested block
 3427|   173k|                  skip_ws_and_comment(it, end);
 3428|   173k|                  skip_newline(it, end);
 3429|       |
 3430|       |                  // Get indent of nested content
 3431|   173k|                  auto nested_start = it;
 3432|   173k|                  int32_t nested_indent = measure_indent(it, end, ctx);
 3433|   173k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3433:23): [True: 6, False: 173k]
  ------------------
 3434|      6|                     return;
 3435|   173k|                  it = nested_start;
 3436|       |
 3437|       |                  // Content is nested only if indented more than the current line.
 3438|       |                  // When line_indent is negative (root level), use 0 as the baseline.
 3439|       |                  // This prevents content at column 0 from being treated as nested.
 3440|   173k|                  const int32_t effective_line_indent = (line_indent < 0) ? 0 : line_indent;
  ------------------
  |  Branch (3440:57): [True: 4.96k, False: 168k]
  ------------------
 3441|   173k|                  if (nested_indent > effective_line_indent) {
  ------------------
  |  Branch (3441:23): [True: 86.4k, False: 86.8k]
  ------------------
 3442|       |                     // Save and set indent for nested parsing.
 3443|       |                     // A struct element reads the pushed indent as its own key column; every
 3444|       |                     // other element type reads it as the enclosing baseline, so it gets one
 3445|       |                     // less than the content indent and its content passes "indent > parent".
 3446|  86.4k|                     const int32_t element_indent =
 3447|  86.4k|                        receives_block_mapping_column<value_type>() ? nested_indent : nested_indent - 1;
  ------------------
  |  Branch (3447:25): [Folded, False: 86.4k]
  ------------------
 3448|  86.4k|                     if (!ctx.push_indent(element_indent)) [[unlikely]]
  ------------------
  |  Branch (3448:26): [True: 0, False: 86.4k]
  ------------------
 3449|      0|                        return;
 3450|  86.4k|                     const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3451|  86.4k|                     const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3452|  86.4k|                     ctx.sequence_item_value_context = true;
 3453|  86.4k|                     ctx.sequence_dash_indent = dash_col;
 3454|  86.4k|                     from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3455|  86.4k|                     ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3456|  86.4k|                     ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3457|  86.4k|                     ctx.pop_indent();
 3458|  86.4k|                  }
 3459|       |                  // else: empty element (default constructed)
 3460|   173k|               }
 3461|       |
 3462|   414k|               if (has_pending_item_anchor && !bool(ctx.error)) {
  ------------------
  |  Branch (3462:20): [True: 3.41k, False: 411k]
  |  Branch (3462:47): [True: 3.37k, False: 38]
  ------------------
 3463|  3.37k|                  const char* element_end = (it != end) ? &*it : element_start;
  ------------------
  |  Branch (3463:45): [True: 3.05k, False: 318]
  ------------------
 3464|  3.37k|                  ctx.anchors[std::move(pending_item_anchor_name)] = {element_start, element_end,
 3465|  3.37k|                                                                      pending_item_anchor_indent};
 3466|  3.37k|                  has_pending_item_anchor = false;
 3467|  3.37k|               }
 3468|   414k|            };
_ZN3glz29parse_block_mapping_or_stringINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_RNS_4yaml12yaml_contextERPKcSO_EEvOT1_OT2_OT3_T4_:
 5575|  1.63M|   {
 5576|  1.63M|      if constexpr (yaml::check_flow_context(Opts)) {
 5577|       |         // In flow context, only treat plain content as an implicit "key: value"
 5578|       |         // when a mapping separator appears before the next top-level flow delimiter.
 5579|  1.63M|         auto could_be_implicit_flow_pair = [&](auto pos) {
 5580|       |            // Bounded by the longest implicit key the spec allows: unbounded, this probe runs
 5581|       |            // once per entry per nesting level over the whole remaining flow collection.
 5582|  1.63M|            const auto stop = yaml::implicit_key_scan_end(pos, end);
 5583|       |            // See `line_could_be_block_mapping` for why a quote is an indicator only where a node
 5584|       |            // can begin. Brackets need no such guard here: ns-plain-safe-in keeps them out of a
 5585|       |            // flow-context plain scalar, so every one of them is an indicator.
 5586|  1.63M|            bool at_node_start = true;
 5587|  1.63M|            int depth = 0;
 5588|  1.63M|            while (pos != stop) {
 5589|  1.63M|               const char c = *pos;
 5590|  1.63M|               if (c == ' ' || c == '\t') {
 5591|  1.63M|                  ++pos;
 5592|  1.63M|                  continue;
 5593|  1.63M|               }
 5594|  1.63M|               const bool node_start = std::exchange(at_node_start, false);
 5595|       |
 5596|  1.63M|               if ((c == '"' || c == '\'') && node_start) {
 5597|  1.63M|                  if (not yaml::skip_probe_quoted_scalar(pos, stop)) return false;
 5598|  1.63M|                  continue;
 5599|  1.63M|               }
 5600|  1.63M|               if (c == '[' || c == '{') {
 5601|  1.63M|                  ++depth;
 5602|  1.63M|                  at_node_start = true;
 5603|  1.63M|                  ++pos;
 5604|  1.63M|                  continue;
 5605|  1.63M|               }
 5606|  1.63M|               if (c == ']' || c == '}') {
 5607|  1.63M|                  if (depth == 0) return false;
 5608|  1.63M|                  --depth;
 5609|  1.63M|                  ++pos;
 5610|  1.63M|                  continue;
 5611|  1.63M|               }
 5612|  1.63M|               if (c == ',' && depth == 0) return false;
 5613|  1.63M|               if (c == ':' && depth == 0) {
 5614|  1.63M|                  auto next = pos + 1;
 5615|  1.63M|                  return next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
 5616|  1.63M|               }
 5617|       |               // Inside a nested collection ',' separates entries and ':' ends a key.
 5618|  1.63M|               if (c == ',' || c == ':') {
 5619|  1.63M|                  at_node_start = true;
 5620|  1.63M|                  ++pos;
 5621|  1.63M|                  continue;
 5622|  1.63M|               }
 5623|  1.63M|               if (node_start && yaml::skip_probe_node_property(pos, stop)) {
 5624|  1.63M|                  at_node_start = true;
 5625|  1.63M|                  continue;
 5626|  1.63M|               }
 5627|  1.63M|               ++pos;
 5628|  1.63M|            }
 5629|  1.63M|            return false;
 5630|  1.63M|         };
 5631|       |
 5632|  1.63M|         if (could_be_implicit_flow_pair(it) || line_could_be_flow_mapping(it, end)) {
  ------------------
  |  Branch (5632:14): [True: 781k, False: 858k]
  |  Branch (5632:49): [True: 11.8k, False: 846k]
  ------------------
 5633|   793k|            if (try_parse_block_mapping_into_variant<Variant, Opts>(value, ctx, it, end)) {
  ------------------
  |  Branch (5633:17): [True: 664k, False: 128k]
  ------------------
 5634|   664k|               return;
 5635|   664k|            }
 5636|   128k|            if (bool(ctx.error)) {
  ------------------
  |  Branch (5636:17): [True: 2.75k, False: 126k]
  ------------------
 5637|  2.75k|               return;
 5638|  2.75k|            }
 5639|   128k|         }
 5640|       |
 5641|   972k|         process_yaml_variant_alternatives<Variant, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 5642|   972k|         return;
 5643|  1.63M|      }
 5644|       |
 5645|  1.63M|      if (try_parse_block_mapping_into_variant<Variant, Opts>(value, ctx, it, end)) {
  ------------------
  |  Branch (5645:11): [True: 0, False: 1.63M]
  ------------------
 5646|      0|         return;
 5647|      0|      }
 5648|       |      // If an error was set (e.g., malformed flow collection in value), don't try to parse as string
 5649|  1.63M|      if (bool(ctx.error)) {
  ------------------
  |  Branch (5649:11): [True: 0, False: 1.63M]
  ------------------
 5650|      0|         return;
 5651|      0|      }
 5652|  1.63M|      process_yaml_variant_alternatives<Variant, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 5653|  1.63M|   }
_ZZN3glz29parse_block_mapping_or_stringINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_RNS_4yaml12yaml_contextERPKcSO_EEvOT1_OT2_OT3_T4_ENKUlT_E_clISO_EEDaSX_:
 5579|  1.63M|         auto could_be_implicit_flow_pair = [&](auto pos) {
 5580|       |            // Bounded by the longest implicit key the spec allows: unbounded, this probe runs
 5581|       |            // once per entry per nesting level over the whole remaining flow collection.
 5582|  1.63M|            const auto stop = yaml::implicit_key_scan_end(pos, end);
 5583|       |            // See `line_could_be_block_mapping` for why a quote is an indicator only where a node
 5584|       |            // can begin. Brackets need no such guard here: ns-plain-safe-in keeps them out of a
 5585|       |            // flow-context plain scalar, so every one of them is an indicator.
 5586|  1.63M|            bool at_node_start = true;
 5587|  1.63M|            int depth = 0;
 5588|  28.8M|            while (pos != stop) {
  ------------------
  |  Branch (5588:20): [True: 28.6M, False: 142k]
  ------------------
 5589|  28.6M|               const char c = *pos;
 5590|  28.6M|               if (c == ' ' || c == '\t') {
  ------------------
  |  Branch (5590:20): [True: 2.71M, False: 25.9M]
  |  Branch (5590:32): [True: 646k, False: 25.3M]
  ------------------
 5591|  3.36M|                  ++pos;
 5592|  3.36M|                  continue;
 5593|  3.36M|               }
 5594|  25.3M|               const bool node_start = std::exchange(at_node_start, false);
 5595|       |
 5596|  25.3M|               if ((c == '"' || c == '\'') && node_start) {
  ------------------
  |  Branch (5596:21): [True: 115k, False: 25.1M]
  |  Branch (5596:33): [True: 48.5k, False: 25.1M]
  |  Branch (5596:47): [True: 65.7k, False: 98.2k]
  ------------------
 5597|  65.7k|                  if (not yaml::skip_probe_quoted_scalar(pos, stop)) return false;
  ------------------
  |  Branch (5597:23): [True: 23.1k, False: 42.5k]
  ------------------
 5598|  42.5k|                  continue;
 5599|  65.7k|               }
 5600|  25.2M|               if (c == '[' || c == '{') {
  ------------------
  |  Branch (5600:20): [True: 192k, False: 25.0M]
  |  Branch (5600:32): [True: 234k, False: 24.8M]
  ------------------
 5601|   427k|                  ++depth;
 5602|   427k|                  at_node_start = true;
 5603|   427k|                  ++pos;
 5604|   427k|                  continue;
 5605|   427k|               }
 5606|  24.8M|               if (c == ']' || c == '}') {
  ------------------
  |  Branch (5606:20): [True: 125k, False: 24.6M]
  |  Branch (5606:32): [True: 149k, False: 24.5M]
  ------------------
 5607|   274k|                  if (depth == 0) return false;
  ------------------
  |  Branch (5607:23): [True: 104k, False: 170k]
  ------------------
 5608|   170k|                  --depth;
 5609|   170k|                  ++pos;
 5610|   170k|                  continue;
 5611|   274k|               }
 5612|  24.5M|               if (c == ',' && depth == 0) return false;
  ------------------
  |  Branch (5612:20): [True: 937k, False: 23.5M]
  |  Branch (5612:32): [True: 453k, False: 483k]
  ------------------
 5613|  24.0M|               if (c == ':' && depth == 0) {
  ------------------
  |  Branch (5613:20): [True: 1.20M, False: 22.8M]
  |  Branch (5613:32): [True: 915k, False: 289k]
  ------------------
 5614|   915k|                  auto next = pos + 1;
 5615|   915k|                  return next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
  ------------------
  |  Branch (5615:26): [True: 3.87k, False: 911k]
  |  Branch (5615:41): [True: 586k, False: 325k]
  |  Branch (5615:57): [True: 88.3k, False: 237k]
  |  Branch (5615:74): [True: 46.0k, False: 191k]
  |  Branch (5615:91): [True: 56.6k, False: 134k]
  ------------------
 5616|   915k|               }
 5617|       |               // Inside a nested collection ',' separates entries and ':' ends a key.
 5618|  23.1M|               if (c == ',' || c == ':') {
  ------------------
  |  Branch (5618:20): [True: 483k, False: 22.6M]
  |  Branch (5618:32): [True: 289k, False: 22.3M]
  ------------------
 5619|   773k|                  at_node_start = true;
 5620|   773k|                  ++pos;
 5621|   773k|                  continue;
 5622|   773k|               }
 5623|  22.3M|               if (node_start && yaml::skip_probe_node_property(pos, stop)) {
  ------------------
  |  Branch (5623:20): [True: 2.07M, False: 20.3M]
  |  Branch (5623:34): [True: 246k, False: 1.82M]
  ------------------
 5624|   246k|                  at_node_start = true;
 5625|   246k|                  continue;
 5626|   246k|               }
 5627|  22.1M|               ++pos;
 5628|  22.1M|            }
 5629|   142k|            return false;
 5630|  1.63M|         };
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_ENKUlT_E0_clISM_EEDaSZ_:
 6007|   289k|            auto is_word_boundary = [&](const auto ptr) {
 6008|   289k|               if (ptr == end) {
  ------------------
  |  Branch (6008:20): [True: 1.40k, False: 288k]
  ------------------
 6009|  1.40k|                  return true;
 6010|  1.40k|               }
 6011|   288k|               if (*ptr == ':') {
  ------------------
  |  Branch (6011:20): [True: 251k, False: 36.3k]
  ------------------
 6012|   251k|                  auto next = ptr + 1;
 6013|   251k|                  return (next == end) || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
  ------------------
  |  Branch (6013:26): [True: 2.56k, False: 249k]
  |  Branch (6013:43): [True: 171k, False: 77.2k]
  |  Branch (6013:59): [True: 67.0k, False: 10.1k]
  |  Branch (6013:76): [True: 4.82k, False: 5.34k]
  |  Branch (6013:93): [True: 4.24k, False: 1.09k]
  ------------------
 6014|   251k|               }
 6015|  36.3k|               return is_plain_scalar_boundary(*ptr);
 6016|   288k|            };
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_ENKUlcE_clEc:
 5933|  36.3k|            auto is_plain_scalar_boundary = [](const char ch) {
 5934|  36.3k|               switch (ch) {
 5935|  7.47k|               case ' ':
  ------------------
  |  Branch (5935:16): [True: 7.47k, False: 28.8k]
  ------------------
 5936|  9.54k|               case '\t':
  ------------------
  |  Branch (5936:16): [True: 2.07k, False: 34.2k]
  ------------------
 5937|  11.7k|               case '\n':
  ------------------
  |  Branch (5937:16): [True: 2.20k, False: 34.1k]
  ------------------
 5938|  17.3k|               case '\r':
  ------------------
  |  Branch (5938:16): [True: 5.58k, False: 30.7k]
  ------------------
 5939|  25.1k|               case ',':
  ------------------
  |  Branch (5939:16): [True: 7.77k, False: 28.5k]
  ------------------
 5940|  26.8k|               case ']':
  ------------------
  |  Branch (5940:16): [True: 1.75k, False: 34.5k]
  ------------------
 5941|  28.6k|               case '}':
  ------------------
  |  Branch (5941:16): [True: 1.83k, False: 34.5k]
  ------------------
 5942|  28.6k|                  return true;
 5943|  7.63k|               default:
  ------------------
  |  Branch (5943:16): [True: 7.63k, False: 28.6k]
  ------------------
 5944|  7.63k|                  return false;
 5945|  36.3k|               }
 5946|  36.3k|            };
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_ENKUlT_E_clISM_EEDaSZ_:
 5948|   280k|            auto has_indented_block_continuation = [&](auto word_end) {
 5949|   280k|               if constexpr (yaml::check_flow_context(Opts)) {
 5950|   280k|                  return false;
 5951|   280k|               }
 5952|   280k|               if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (5952:20): [True: 0, False: 280k]
  ------------------
 5953|      0|                  return false;
 5954|      0|               }
 5955|   280k|               if (word_end == end || (*word_end != '\n' && *word_end != '\r')) {
  ------------------
  |  Branch (5955:20): [True: 280k, False: 0]
  |  Branch (5955:40): [True: 0, False: 0]
  |  Branch (5955:61): [True: 0, False: 0]
  ------------------
 5956|      0|                  return false;
 5957|      0|               }
 5958|       |
 5959|   280k|               auto look = word_end;
 5960|   280k|               yaml::skip_newline(look, end);
 5961|   280k|               while (look != end) {
  ------------------
  |  Branch (5961:23): [True: 0, False: 280k]
  ------------------
 5962|      0|                  int32_t line_indent = 0;
 5963|      0|                  while (look != end && *look == ' ') {
  ------------------
  |  Branch (5963:26): [True: 0, False: 0]
  |  Branch (5963:41): [True: 0, False: 0]
  ------------------
 5964|      0|                     ++line_indent;
 5965|      0|                     ++look;
 5966|      0|                  }
 5967|      0|                  if (look != end && *look == '\t') {
  ------------------
  |  Branch (5967:23): [True: 0, False: 0]
  |  Branch (5967:38): [True: 0, False: 0]
  ------------------
 5968|      0|                     return false;
 5969|      0|                  }
 5970|      0|                  if (look == end || *look == '\n' || *look == '\r') {
  ------------------
  |  Branch (5970:23): [True: 0, False: 0]
  |  Branch (5970:38): [True: 0, False: 0]
  |  Branch (5970:55): [True: 0, False: 0]
  ------------------
 5971|      0|                     if (look != end) {
  ------------------
  |  Branch (5971:26): [True: 0, False: 0]
  ------------------
 5972|      0|                        yaml::skip_newline(look, end);
 5973|      0|                        continue;
 5974|      0|                     }
 5975|      0|                     return false;
 5976|      0|                  }
 5977|      0|                  if (*look == '#') {
  ------------------
  |  Branch (5977:23): [True: 0, False: 0]
  ------------------
 5978|      0|                     yaml::skip_comment(look, end);
 5979|      0|                     if (look != end && (*look == '\n' || *look == '\r')) {
  ------------------
  |  Branch (5979:26): [True: 0, False: 0]
  |  Branch (5979:42): [True: 0, False: 0]
  |  Branch (5979:59): [True: 0, False: 0]
  ------------------
 5980|      0|                        yaml::skip_newline(look, end);
 5981|      0|                        continue;
 5982|      0|                     }
 5983|      0|                     return false;
 5984|      0|                  }
 5985|       |
 5986|       |                  // If the next non-empty line is an implicit mapping entry,
 5987|       |                  // don't treat it as scalar continuation for auto-deduced
 5988|       |                  // booleans/nulls.
 5989|      0|                  {
 5990|      0|                     auto scan = look;
 5991|      0|                     while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (5991:29): [True: 0, False: 0]
  |  Branch (5991:44): [True: 0, False: 0]
  |  Branch (5991:61): [True: 0, False: 0]
  ------------------
 5992|      0|                        if (*scan == ':') {
  ------------------
  |  Branch (5992:29): [True: 0, False: 0]
  ------------------
 5993|      0|                           auto after_colon = scan + 1;
 5994|      0|                           if (after_colon == end || *after_colon == ' ' || *after_colon == '\t' ||
  ------------------
  |  Branch (5994:32): [True: 0, False: 0]
  |  Branch (5994:54): [True: 0, False: 0]
  |  Branch (5994:77): [True: 0, False: 0]
  ------------------
 5995|      0|                               *after_colon == '\n' || *after_colon == '\r') {
  ------------------
  |  Branch (5995:32): [True: 0, False: 0]
  |  Branch (5995:56): [True: 0, False: 0]
  ------------------
 5996|      0|                              return false;
 5997|      0|                           }
 5998|      0|                        }
 5999|      0|                        ++scan;
 6000|      0|                     }
 6001|      0|                  }
 6002|       |
 6003|      0|                  return line_indent > ctx.current_indent();
 6004|      0|               }
 6005|   280k|               return false;
 6006|   280k|            };
_ZN3glz36try_parse_block_mapping_into_variantINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_RNS_4yaml12yaml_contextERPKcSO_EEbOT1_OT2_OT3_T4_:
 5529|  1.55M|   {
 5530|  1.55M|      using counts = yaml_variant_type_count<Variant>;
 5531|       |      if constexpr (counts::n_object == 0) {
 5532|       |         return false;
 5533|       |      }
 5534|  1.55M|      else {
 5535|       |         // Quick check: if no viable mapping separator in the current span,
 5536|       |         // avoid expensive speculative parse.
 5537|  1.55M|         const bool could_be_mapping = [&] {
 5538|  1.55M|            if constexpr (yaml::check_flow_context(Opts)) {
 5539|  1.55M|               return line_could_be_flow_mapping(it, end);
 5540|  1.55M|            }
 5541|  1.55M|            else {
 5542|  1.55M|               return yaml::line_could_be_block_mapping(it, end);
 5543|  1.55M|            }
 5544|  1.55M|         }();
 5545|  1.55M|         if (!could_be_mapping) {
  ------------------
  |  Branch (5545:14): [True: 865k, False: 690k]
  ------------------
 5546|   865k|            return false;
 5547|   865k|         }
 5548|       |         // Full parse attempt - use a temporary context that inherits indent from parent
 5549|   690k|         auto temp_ctx = ctx.make_speculative();
 5550|   690k|         process_yaml_variant_alternatives<Variant, is_yaml_variant_object>::template op<Opts>(value, temp_ctx, it,
 5551|   690k|                                                                                               end);
 5552|   690k|         ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 5553|   690k|         ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5554|   690k|         if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (5554:14): [True: 682k, False: 7.41k]
  ------------------
 5555|   682k|            ctx.anchors = std::move(temp_ctx.anchors);
 5556|   682k|            return true;
 5557|   682k|         }
 5558|       |         // The line matched "key: value" pattern but parsing failed.
 5559|       |         // This indicates malformed content (e.g., unclosed flow collection),
 5560|       |         // so propagate the error rather than silently falling back to string.
 5561|  7.41k|         ctx.error = temp_ctx.error;
 5562|  7.41k|         ctx.custom_error_message = temp_ctx.custom_error_message;
 5563|  7.41k|         return false;
 5564|   690k|      }
 5565|  1.55M|   }
_ZZN3glz36try_parse_block_mapping_into_variantINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1ELb0ELb0ELb0ELb0ELj1EEERSH_RNS_4yaml12yaml_contextERPKcSO_EEbOT1_OT2_OT3_T4_ENKUlvE_clEv:
 5537|  1.55M|         const bool could_be_mapping = [&] {
 5538|  1.55M|            if constexpr (yaml::check_flow_context(Opts)) {
 5539|  1.55M|               return line_could_be_flow_mapping(it, end);
 5540|       |            }
 5541|       |            else {
 5542|       |               return yaml::line_could_be_block_mapping(it, end);
 5543|       |            }
 5544|  1.55M|         }();
_ZN3glz4yaml15materialize_keyILb0ENS0_12yaml_contextEEEbRNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEERT0_:
   39|  1.78M|   {
   40|       |      if constexpr (empty_on_null) {
   41|       |         if (key_node.is_null()) {
   42|       |            key.clear();
   43|       |            return true;
   44|       |         }
   45|       |      }
   46|  1.78M|      if (auto* s = key_node.template get_if<std::string>()) {
  ------------------
  |  Branch (46:17): [True: 37.2k, False: 1.75M]
  ------------------
   47|  37.2k|         key = *s;
   48|  37.2k|         return true;
   49|  37.2k|      }
   50|  1.75M|      key.clear();
   51|  1.75M|      (void)glz::write_json(key_node, key);
   52|  1.75M|      if constexpr (requires { ctx.charge_key_expansion(size_t{}); }) {
   53|  1.75M|         if (!ctx.charge_key_expansion(key.size())) [[unlikely]] {
  ------------------
  |  Branch (53:14): [True: 70, False: 1.75M]
  ------------------
   54|     70|            ctx.error = error_code::exceeded_max_expansion;
   55|     70|            ctx.custom_error_message = "complex key expansion";
   56|     70|            return false;
   57|     70|         }
   58|  1.75M|      }
   59|  1.75M|      return true;
   60|  1.78M|   }
_ZN3glz4fromILj450ENS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERS4_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSD_EEvOT0_OT1_OT2_T3_:
  283|  2.11M|      {
  284|  2.11M|         using V = std::decay_t<decltype(get_member(std::declval<Value>(), meta_wrapper_v<T>))>;
  285|  2.11M|         from<YAML, V>::template op<Opts>(get_member(std::forward<Value>(value), meta_wrapper_v<T>),
  286|  2.11M|                                          std::forward<Ctx>(ctx), std::forward<It0>(it), end);
  287|  2.11M|      }
_ZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_:
 5797|  2.59M|      {
 5798|       |         // Inside op() rather than at class scope: read_supported is `requires { from<Format, T>{}; }`,
 5799|       |         // so a class-scope assert turns that feature probe into a hard error instead of `false`.
 5800|  2.59M|         static_assert(content_v<std::remove_cvref_t<T>>.empty(),
 5801|  2.59M|                       "Adjacent variant tagging (glz::meta `content`) is implemented for JSON and "
 5802|  2.59M|                       "BEVE but not yet for YAML. Reading this variant as YAML would silently expect "
 5803|  2.59M|                       "the internally tagged shape, so it is rejected here instead.");
 5804|  2.59M|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5804:14): [True: 0, False: 2.59M]
  ------------------
 5805|      0|            return;
 5806|       |
 5807|       |         // No depth is taken here: the sequence and mapping readers this dispatches to count the
 5808|       |         // levels, so a scalar at the bottom of a document costs nothing, as in JSON. The one way
 5809|       |         // back into this reader that opens no collection is `redispatch`, which counts itself.
 5810|       |
 5811|       |         // At root level (indent == -1), skip leading whitespace, newlines, and comments
 5812|       |         // For nested values, only skip inline whitespace to preserve block structure
 5813|  2.59M|         if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (5813:14): [True: 1.47M, False: 1.12M]
  ------------------
 5814|  1.47M|            yaml::skip_ws_newlines_comments(it, end);
 5815|  1.47M|         }
 5816|  1.12M|         else {
 5817|  1.12M|            yaml::skip_inline_ws(it, end);
 5818|  1.12M|         }
 5819|       |
 5820|  2.59M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (5820:14): [True: 74, False: 2.59M]
  ------------------
 5821|     74|            ctx.error = error_code::unexpected_end;
 5822|     74|            return;
 5823|     74|         }
 5824|       |
 5825|       |         // Tagged variants: a discriminator key (meta::tag) selects the alternative, with the
 5826|       |         // matching meta::ids entry naming each type. This mirrors the JSON behavior so the
 5827|       |         // same variant definitions round-trip across both formats.
 5828|       |         if constexpr (not tag_v<std::remove_cvref_t<T>>.empty()) {
 5829|       |            using V = std::remove_cvref_t<T>;
 5830|       |            const bool value_is_mapping =
 5831|       |               (*it == '{') || (!yaml::check_flow_context(Opts) && yaml::line_could_be_block_mapping(it, end));
 5832|       |            if (value_is_mapping) {
 5833|       |               // The mapping's keys sit at the column of `it`. Recover that column from the buffer:
 5834|       |               // the indent stack carries the parent context's indent (a struct member, a sequence
 5835|       |               // item, etc. each push a different offset), not this mapping's true column (see helper).
 5836|       |               const int32_t mapping_column = tagged_mapping_visual_indent(ctx, it, ctx.current_indent() + 1);
 5837|       |               auto tag_ctx = ctx.make_speculative();
 5838|       |               const size_t index = scan_variant_tag_index<V, Opts>(tag_ctx, it, end, mapping_column);
 5839|       |               ctx.alias_expansion_budget = tag_ctx.alias_expansion_budget; // charged even if no tag matched
 5840|       |               ctx.key_expansion_budget = tag_ctx.key_expansion_budget;
 5841|       |               if (index < ids_v<V>.size()) {
 5842|       |                  static constexpr auto tag_literal = string_literal_from_view<tag_v<V>.size()>(tag_v<V>);
 5843|       |                  emplace_runtime_variant(value, index);
 5844|       |                  // Establish the mapping's true column on the indent stack for the alternative parse.
 5845|       |                  // The chosen object is then parsed - and the discriminator's inline value skipped -
 5846|       |                  // at a consistent indent in every context, so a tag on the first key does not fold
 5847|       |                  // the following sibling entries into its value (no special-casing needed downstream).
 5848|       |                  if (!ctx.push_indent(mapping_column)) [[unlikely]] {
 5849|       |                     ctx.error = error_code::exceeded_max_recursive_depth;
 5850|       |                     return;
 5851|       |                  }
 5852|       |                  std::visit(
 5853|       |                     [&](auto&& alt) {
 5854|       |                        using Alt = std::remove_cvref_t<decltype(alt)>;
 5855|       |                        if constexpr ((glaze_object_t<Alt> || reflectable<Alt>) && not custom_read<Alt>) {
 5856|       |                           // Parse the mapping into the resolved struct; the tag key is skipped.
 5857|       |                           from<YAML, Alt>::template op<Opts, tag_literal>(alt, ctx, it, end);
 5858|       |                        }
 5859|       |                        else if constexpr (custom_read<Alt>) {
 5860|       |                           // Custom alternatives read the mapping body themselves and cannot skip an
 5861|       |                           // interior tag key the way reflected objects do, so the tag must be the
 5862|       |                           // first key (glaze always writes it first). Consume that leading "tag: id"
 5863|       |                           // entry, then hand the remaining mapping to the custom handler.
 5864|       |                           if constexpr (yaml::check_flow_context(Opts)) {
 5865|       |                              ctx.error = error_code::feature_not_supported;
 5866|       |                              ctx.custom_error_message =
 5867|       |                                 "custom variant alternatives are not supported in YAML flow style";
 5868|       |                           }
 5869|       |                           else {
 5870|       |                              ctx.scratch.clear();
 5871|       |                              if (yaml::parse_yaml_key(ctx.scratch, ctx, it, end, false)) {
 5872|       |                                 if (std::string_view{ctx.scratch} != tag_v<V>) {
 5873|       |                                    ctx.error = error_code::feature_not_supported;
 5874|       |                                    ctx.custom_error_message =
 5875|       |                                       "the tag must be the first key for a custom variant alternative";
 5876|       |                                 }
 5877|       |                                 else {
 5878|       |                                    yaml::skip_inline_ws(it, end);
 5879|       |                                    if (it == end || *it != ':') {
 5880|       |                                       ctx.error = error_code::syntax_error;
 5881|       |                                    }
 5882|       |                                    else {
 5883|       |                                       ++it;
 5884|       |                                       yaml::skip_inline_ws(it, end);
 5885|       |                                       yaml::skip_unknown_block_value<Opts>(ctx, it, end, mapping_column);
 5886|       |                                       if (!bool(ctx.error)) {
 5887|       |                                          // If nothing but trailing whitespace/comments remains, the tag
 5888|       |                                          // was the whole mapping: leave the alternative default.
 5889|       |                                          auto probe = it;
 5890|       |                                          yaml::skip_ws_newlines_comments(probe, end);
 5891|       |                                          if (probe == end) {
 5892|       |                                             it = probe;
 5893|       |                                          }
 5894|       |                                          else {
 5895|       |                                             // Publish the mapping's column so the custom handler's block
 5896|       |                                             // mapping (which would otherwise discover its own indent) reads
 5897|       |                                             // the remaining entries at the variant's indent and dedents
 5898|       |                                             // correctly in every context (root, sequence, nested).
 5899|       |                                             ctx.forced_block_mapping_indent = mapping_column;
 5900|       |                                             from<YAML, Alt>::template op<Opts>(alt, ctx, it, end);
 5901|       |                                             ctx.forced_block_mapping_indent = -1;
 5902|       |                                          }
 5903|       |                                       }
 5904|       |                                    }
 5905|       |                                 }
 5906|       |                              }
 5907|       |                           }
 5908|       |                        }
 5909|       |                        else {
 5910|       |                           // Non-object alternative (e.g. std::monostate): the emplaced default is
 5911|       |                           // the value, but the mapping must still be consumed.
 5912|       |                           walk_tagged_mapping<Opts>(
 5913|       |                              ctx, it, end, tag_v<V>, mapping_column,
 5914|       |                              [&](auto&& c, auto&& i, auto&& e, int32_t line_indent, bool in_flow) {
 5915|       |                                 yaml::skip_yaml_value<Opts>(c, i, e, in_flow ? 0 : line_indent, in_flow);
 5916|       |                              });
 5917|       |                        }
 5918|       |                     },
 5919|       |                     value);
 5920|       |                  ctx.pop_indent();
 5921|       |                  return;
 5922|       |               }
 5923|       |               // No resolvable tag key was found. Fall through to structural deduction:
 5924|       |               // if the alternatives are distinguishable by their fields this still succeeds,
 5925|       |               // otherwise the deduction path reports no_matching_variant_type.
 5926|       |            }
 5927|       |         }
 5928|       |
 5929|  2.59M|         if constexpr (yaml_variant_is_auto_deducible<std::remove_cvref_t<T>>()) {
 5930|  2.59M|            using V = std::remove_cvref_t<T>;
 5931|  2.59M|            using counts = yaml_variant_type_count<V>;
 5932|  2.59M|            const char c = *it;
 5933|  2.59M|            auto is_plain_scalar_boundary = [](const char ch) {
 5934|  2.59M|               switch (ch) {
 5935|  2.59M|               case ' ':
 5936|  2.59M|               case '\t':
 5937|  2.59M|               case '\n':
 5938|  2.59M|               case '\r':
 5939|  2.59M|               case ',':
 5940|  2.59M|               case ']':
 5941|  2.59M|               case '}':
 5942|  2.59M|                  return true;
 5943|  2.59M|               default:
 5944|  2.59M|                  return false;
 5945|  2.59M|               }
 5946|  2.59M|            };
 5947|       |
 5948|  2.59M|            auto has_indented_block_continuation = [&](auto word_end) {
 5949|  2.59M|               if constexpr (yaml::check_flow_context(Opts)) {
 5950|  2.59M|                  return false;
 5951|  2.59M|               }
 5952|  2.59M|               if (ctx.current_indent() < 0) {
 5953|  2.59M|                  return false;
 5954|  2.59M|               }
 5955|  2.59M|               if (word_end == end || (*word_end != '\n' && *word_end != '\r')) {
 5956|  2.59M|                  return false;
 5957|  2.59M|               }
 5958|       |
 5959|  2.59M|               auto look = word_end;
 5960|  2.59M|               yaml::skip_newline(look, end);
 5961|  2.59M|               while (look != end) {
 5962|  2.59M|                  int32_t line_indent = 0;
 5963|  2.59M|                  while (look != end && *look == ' ') {
 5964|  2.59M|                     ++line_indent;
 5965|  2.59M|                     ++look;
 5966|  2.59M|                  }
 5967|  2.59M|                  if (look != end && *look == '\t') {
 5968|  2.59M|                     return false;
 5969|  2.59M|                  }
 5970|  2.59M|                  if (look == end || *look == '\n' || *look == '\r') {
 5971|  2.59M|                     if (look != end) {
 5972|  2.59M|                        yaml::skip_newline(look, end);
 5973|  2.59M|                        continue;
 5974|  2.59M|                     }
 5975|  2.59M|                     return false;
 5976|  2.59M|                  }
 5977|  2.59M|                  if (*look == '#') {
 5978|  2.59M|                     yaml::skip_comment(look, end);
 5979|  2.59M|                     if (look != end && (*look == '\n' || *look == '\r')) {
 5980|  2.59M|                        yaml::skip_newline(look, end);
 5981|  2.59M|                        continue;
 5982|  2.59M|                     }
 5983|  2.59M|                     return false;
 5984|  2.59M|                  }
 5985|       |
 5986|       |                  // If the next non-empty line is an implicit mapping entry,
 5987|       |                  // don't treat it as scalar continuation for auto-deduced
 5988|       |                  // booleans/nulls.
 5989|  2.59M|                  {
 5990|  2.59M|                     auto scan = look;
 5991|  2.59M|                     while (scan != end && *scan != '\n' && *scan != '\r') {
 5992|  2.59M|                        if (*scan == ':') {
 5993|  2.59M|                           auto after_colon = scan + 1;
 5994|  2.59M|                           if (after_colon == end || *after_colon == ' ' || *after_colon == '\t' ||
 5995|  2.59M|                               *after_colon == '\n' || *after_colon == '\r') {
 5996|  2.59M|                              return false;
 5997|  2.59M|                           }
 5998|  2.59M|                        }
 5999|  2.59M|                        ++scan;
 6000|  2.59M|                     }
 6001|  2.59M|                  }
 6002|       |
 6003|  2.59M|                  return line_indent > ctx.current_indent();
 6004|  2.59M|               }
 6005|  2.59M|               return false;
 6006|  2.59M|            };
 6007|  2.59M|            auto is_word_boundary = [&](const auto ptr) {
 6008|  2.59M|               if (ptr == end) {
 6009|  2.59M|                  return true;
 6010|  2.59M|               }
 6011|  2.59M|               if (*ptr == ':') {
 6012|  2.59M|                  auto next = ptr + 1;
 6013|  2.59M|                  return (next == end) || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
 6014|  2.59M|               }
 6015|  2.59M|               return is_plain_scalar_boundary(*ptr);
 6016|  2.59M|            };
 6017|       |
 6018|  2.59M|            switch (c) {
 6019|   677k|            case '&': {
  ------------------
  |  Branch (6019:13): [True: 677k, False: 1.91M]
  ------------------
 6020|       |               // Anchor before value: parse name, then re-dispatch
 6021|   677k|               ++it;
 6022|   677k|               auto aname = yaml::parse_anchor_name(it, end);
 6023|   677k|               if (aname.empty()) {
  ------------------
  |  Branch (6023:20): [True: 52, False: 677k]
  ------------------
 6024|     52|                  ctx.error = error_code::syntax_error;
 6025|     52|                  return;
 6026|     52|               }
 6027|   677k|               yaml::skip_inline_ws(it, end);
 6028|   677k|               bool anchor_on_same_line = true;
 6029|   677k|               bool value_is_indentless_sequence = false;
 6030|   677k|               if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (6030:20): [True: 9.88k, False: 667k]
  |  Branch (6030:33): [True: 210k, False: 457k]
  |  Branch (6030:48): [True: 91.0k, False: 366k]
  |  Branch (6030:63): [True: 20.1k, False: 345k]
  ------------------
 6031|       |                  // Anchor followed by end-of-line. Check if the value continues on the
 6032|       |                  // next line (indented past current context) or if this is an empty node.
 6033|   331k|                  bool value_on_next_line = false;
 6034|   331k|                  if (it != end) {
  ------------------
  |  Branch (6034:23): [True: 321k, False: 9.88k]
  ------------------
 6035|   321k|                     auto peek = it;
 6036|       |                     // Skip comment if present
 6037|   321k|                     if (*peek == '#') {
  ------------------
  |  Branch (6037:26): [True: 20.1k, False: 301k]
  ------------------
 6038|   173k|                        while (peek != end && *peek != '\n' && *peek != '\r') ++peek;
  ------------------
  |  Branch (6038:32): [True: 172k, False: 1.24k]
  |  Branch (6038:47): [True: 161k, False: 11.3k]
  |  Branch (6038:64): [True: 153k, False: 7.52k]
  ------------------
 6039|  20.1k|                     }
 6040|       |                     // Skip newline
 6041|   321k|                     if (peek != end && (*peek == '\n' || *peek == '\r')) {
  ------------------
  |  Branch (6041:26): [True: 320k, False: 1.24k]
  |  Branch (6041:42): [True: 222k, False: 98.5k]
  |  Branch (6041:59): [True: 98.5k, False: 0]
  ------------------
 6042|   320k|                        yaml::skip_newline(peek, end);
 6043|       |                        // Skip blank lines
 6044|   389k|                        while (peek != end && (*peek == '\n' || *peek == '\r')) {
  ------------------
  |  Branch (6044:32): [True: 282k, False: 106k]
  |  Branch (6044:48): [True: 24.5k, False: 257k]
  |  Branch (6044:65): [True: 43.8k, False: 214k]
  ------------------
 6045|  68.4k|                           yaml::skip_newline(peek, end);
 6046|  68.4k|                        }
 6047|       |                        // Measure indent of next content line
 6048|   320k|                        int32_t next_indent = 0;
 6049|   528k|                        while (peek != end && *peek == ' ') {
  ------------------
  |  Branch (6049:32): [True: 418k, False: 109k]
  |  Branch (6049:47): [True: 207k, False: 211k]
  ------------------
 6050|   207k|                           ++next_indent;
 6051|   207k|                           ++peek;
 6052|   207k|                        }
 6053|   320k|                        if (peek != end && *peek != '\n' && *peek != '\r') {
  ------------------
  |  Branch (6053:29): [True: 211k, False: 109k]
  |  Branch (6053:44): [True: 209k, False: 1.74k]
  |  Branch (6053:61): [True: 208k, False: 1.36k]
  ------------------
 6054|   208k|                           const bool indentless_sequence =
 6055|   208k|                              (!ctx.sequence_item_value_context) && (*peek == '-') &&
  ------------------
  |  Branch (6055:31): [True: 204k, False: 3.89k]
  |  Branch (6055:69): [True: 40.4k, False: 163k]
  ------------------
 6056|  40.4k|                              ((peek + 1) == end ||
  ------------------
  |  Branch (6056:32): [True: 484, False: 39.9k]
  ------------------
 6057|  39.9k|                               yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(peek + 1))]) &&
  ------------------
  |  Branch (6057:32): [True: 35.6k, False: 4.34k]
  ------------------
 6058|  36.0k|                              (next_indent == ctx.current_indent() ||
  ------------------
  |  Branch (6058:32): [True: 3.92k, False: 32.1k]
  ------------------
 6059|  32.1k|                               (ctx.current_indent() > 0 && (next_indent + 1) == ctx.current_indent()));
  ------------------
  |  Branch (6059:33): [True: 14.6k, False: 17.4k]
  |  Branch (6059:61): [True: 14.2k, False: 402]
  ------------------
 6060|   208k|                           value_is_indentless_sequence = indentless_sequence;
 6061|   208k|                           const bool same_indent_property_node =
 6062|   208k|                              (next_indent == ctx.current_indent()) &&
  ------------------
  |  Branch (6062:31): [True: 19.5k, False: 188k]
  ------------------
 6063|  19.5k|                              (*peek == '!' || *peek == '&' || *peek == '*' || *peek == '[' || *peek == '{' ||
  ------------------
  |  Branch (6063:32): [True: 1.36k, False: 18.1k]
  |  Branch (6063:48): [True: 4.03k, False: 14.1k]
  |  Branch (6063:64): [True: 754, False: 13.4k]
  |  Branch (6063:80): [True: 1.83k, False: 11.5k]
  |  Branch (6063:96): [True: 1.40k, False: 10.1k]
  ------------------
 6064|  10.1k|                               *peek == '"' || *peek == '\'' || *peek == '|' || *peek == '>');
  ------------------
  |  Branch (6064:32): [True: 1.58k, False: 8.58k]
  |  Branch (6064:48): [True: 782, False: 7.79k]
  |  Branch (6064:65): [True: 1.24k, False: 6.55k]
  |  Branch (6064:81): [True: 524, False: 6.02k]
  ------------------
 6065|   208k|                           value_on_next_line =
 6066|   208k|                              (next_indent > ctx.current_indent()) || indentless_sequence || same_indent_property_node;
  ------------------
  |  Branch (6066:31): [True: 163k, False: 44.5k]
  |  Branch (6066:71): [True: 18.2k, False: 26.3k]
  |  Branch (6066:94): [True: 13.5k, False: 12.8k]
  ------------------
 6067|   208k|                        }
 6068|   320k|                     }
 6069|   321k|                  }
 6070|   331k|                  if (!value_on_next_line) {
  ------------------
  |  Branch (6070:23): [True: 136k, False: 195k]
  ------------------
 6071|       |                     // Anchor on empty/null node — store empty span, leave value as default
 6072|   136k|                     ctx.anchors[std::string(aname)] = {&*it, &*it, ctx.current_indent()};
 6073|   136k|                     return;
 6074|   136k|                  }
 6075|       |                  // Value is on next line — advance past newline/blank lines to the content
 6076|   195k|                  if (*it == '#') {
  ------------------
  |  Branch (6076:23): [True: 13.0k, False: 182k]
  ------------------
 6077|   100k|                     while (it != end && *it != '\n' && *it != '\r') ++it;
  ------------------
  |  Branch (6077:29): [True: 100k, False: 0]
  |  Branch (6077:42): [True: 91.4k, False: 9.39k]
  |  Branch (6077:57): [True: 87.7k, False: 3.68k]
  ------------------
 6078|  13.0k|                  }
 6079|   195k|                  if (it != end) yaml::skip_newline(it, end);
  ------------------
  |  Branch (6079:23): [True: 195k, False: 0]
  ------------------
 6080|   250k|                  while (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (6080:26): [True: 250k, False: 0]
  |  Branch (6080:40): [True: 15.6k, False: 235k]
  |  Branch (6080:55): [True: 39.7k, False: 195k]
  ------------------
 6081|  55.3k|                     yaml::skip_newline(it, end);
 6082|  55.3k|                  }
 6083|   195k|                  yaml::skip_inline_ws(it, end);
 6084|   195k|                  anchor_on_same_line = false;
 6085|   195k|               }
 6086|       |
 6087|   541k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6088|   541k|                  if (anchor_on_same_line && *it == '-' &&
  ------------------
  |  Branch (6088:23): [True: 345k, False: 195k]
  |  Branch (6088:46): [True: 9.06k, False: 336k]
  ------------------
 6089|  9.06k|                      ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))])) {
  ------------------
  |  Branch (6089:24): [True: 6, False: 9.06k]
  |  Branch (6089:43): [True: 10, False: 9.05k]
  ------------------
 6090|       |                     // "&anchor - item" is malformed in block context.
 6091|     16|                     ctx.error = error_code::syntax_error;
 6092|     16|                     return;
 6093|     16|                  }
 6094|   541k|               }
 6095|       |
 6096|       |               // Anchor on alias (&anchor *alias) is invalid per YAML spec.
 6097|       |               // But alias-as-key (&anchor *alias : value) is valid.
 6098|   541k|               if (it != end && *it == '*' && !yaml::alias_token_is_mapping_key(it, end)) {
  ------------------
  |  Branch (6098:20): [True: 541k, False: 30]
  |  Branch (6098:33): [True: 3.53k, False: 537k]
  |  Branch (6098:47): [True: 22, False: 3.51k]
  ------------------
 6099|     22|                  ctx.error = error_code::syntax_error;
 6100|     22|                  return;
 6101|     22|               }
 6102|       |
 6103|   541k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6104|   541k|                  if (!anchor_on_same_line && it != end && *it == '&') {
  ------------------
  |  Branch (6104:23): [True: 195k, False: 345k]
  |  Branch (6104:47): [True: 195k, False: 14]
  |  Branch (6104:60): [True: 8.85k, False: 186k]
  ------------------
 6105|  8.85k|                     auto probe = it + 1;
 6106|  8.85k|                     auto nested_anchor_name = yaml::parse_anchor_name(probe, end);
 6107|  8.85k|                     if (nested_anchor_name.empty()) {
  ------------------
  |  Branch (6107:26): [True: 18, False: 8.83k]
  ------------------
 6108|     18|                        ctx.error = error_code::syntax_error;
 6109|     18|                        return;
 6110|     18|                     }
 6111|  8.83k|                     yaml::skip_inline_ws(probe, end);
 6112|       |                     // Allow nested anchor usage only when it clearly starts a
 6113|       |                     // nested mapping entry ("&k key: value"). Otherwise this is
 6114|       |                     // a second anchor on the same node (4JVG-style), which is invalid.
 6115|  8.83k|                     if (!yaml::line_could_be_block_mapping(probe, end)) {
  ------------------
  |  Branch (6115:26): [True: 48, False: 8.78k]
  ------------------
 6116|     48|                        ctx.error = error_code::syntax_error;
 6117|     48|                        return;
 6118|     48|                     }
 6119|  8.83k|                  }
 6120|   541k|               }
 6121|       |
 6122|   541k|               const char* anchor_start = &*it;
 6123|   541k|               const int32_t anchor_indent = ctx.current_indent();
 6124|       |
 6125|   541k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6126|       |                  // Check if the anchor is on a block-mapping key (&name key: value).
 6127|       |                  // Only when the anchor and key are on the SAME line — if the value was on the
 6128|       |                  // next line, the anchor applies to the entire next-line content.
 6129|   541k|                  if (anchor_on_same_line && yaml::line_could_be_block_mapping(it, end)) {
  ------------------
  |  Branch (6129:23): [True: 345k, False: 195k]
  |  Branch (6129:46): [True: 115k, False: 230k]
  ------------------
 6130|   115k|                     auto key_start = it;
 6131|   115k|                     if (*key_start == '!') {
  ------------------
  |  Branch (6131:26): [True: 1.75k, False: 113k]
  ------------------
 6132|  1.75k|                        const auto key_tag = yaml::parse_yaml_tag(key_start, end, ctx);
 6133|  1.75k|                        if (key_tag == yaml::yaml_tag::unknown || !yaml::tag_valid_for_string(key_tag)) {
  ------------------
  |  Branch (6133:29): [True: 6, False: 1.74k]
  |  Branch (6133:67): [True: 6, False: 1.74k]
  ------------------
 6134|     12|                           ctx.error = error_code::syntax_error;
 6135|     12|                           return;
 6136|     12|                        }
 6137|  1.74k|                        yaml::skip_inline_ws(key_start, end);
 6138|  1.74k|                        if (key_start == end) {
  ------------------
  |  Branch (6138:29): [True: 12, False: 1.73k]
  ------------------
 6139|     12|                           ctx.error = error_code::unexpected_end;
 6140|     12|                           return;
 6141|     12|                        }
 6142|  1.73k|                        if (*key_start == '\n' || *key_start == '\r') {
  ------------------
  |  Branch (6142:29): [True: 6, False: 1.72k]
  |  Branch (6142:51): [True: 6, False: 1.71k]
  ------------------
 6143|     12|                           ctx.error = error_code::syntax_error;
 6144|     12|                           return;
 6145|     12|                        }
 6146|       |
 6147|       |                        // Re-apply the anchor-on-alias rule now that the tag is consumed. The
 6148|       |                        // check above ran before the tag, so "&anchor !tag *alias" reached the
 6149|       |                        // key-span registration below while the untagged spelling was rejected;
 6150|       |                        // an alias node carries no other properties either way.
 6151|  1.71k|                        if (*key_start == '*' && !yaml::alias_token_is_mapping_key(key_start, end)) {
  ------------------
  |  Branch (6151:29): [True: 1.37k, False: 340]
  |  Branch (6151:50): [True: 6, False: 1.37k]
  ------------------
 6152|      6|                           ctx.error = error_code::syntax_error;
 6153|      6|                           return;
 6154|      6|                        }
 6155|  1.71k|                     }
 6156|       |
 6157|       |                     // Find the key span by scanning to the key-value separator
 6158|   115k|                     auto key_scan = key_start;
 6159|   115k|                     auto key_end = key_start;
 6160|   115k|                     if (*key_scan == '"' || *key_scan == '\'') {
  ------------------
  |  Branch (6160:26): [True: 2.05k, False: 113k]
  |  Branch (6160:46): [True: 896, False: 112k]
  ------------------
 6161|       |                        // Quoted key: skip to closing quote
 6162|  2.95k|                        const char quote = *key_scan;
 6163|  2.95k|                        ++key_scan;
 6164|  11.8k|                        while (key_scan != end && *key_scan != quote) {
  ------------------
  |  Branch (6164:32): [True: 11.8k, False: 0]
  |  Branch (6164:51): [True: 8.88k, False: 2.95k]
  ------------------
 6165|  8.88k|                           if (*key_scan == '\\' && quote == '"') {
  ------------------
  |  Branch (6165:32): [True: 296, False: 8.58k]
  |  Branch (6165:53): [True: 198, False: 98]
  ------------------
 6166|    198|                              ++key_scan;
 6167|    198|                              if (key_scan != end) ++key_scan;
  ------------------
  |  Branch (6167:35): [True: 198, False: 0]
  ------------------
 6168|    198|                           }
 6169|  8.68k|                           else {
 6170|  8.68k|                              ++key_scan;
 6171|  8.68k|                           }
 6172|  8.88k|                        }
 6173|  2.95k|                        if (key_scan == end) {
  ------------------
  |  Branch (6173:29): [True: 0, False: 2.95k]
  ------------------
 6174|      0|                           ctx.error = error_code::syntax_error;
 6175|      0|                           return;
 6176|      0|                        }
 6177|  2.95k|                        ++key_scan; // past closing quote
 6178|  2.95k|                        key_end = key_scan;
 6179|  2.95k|                        yaml::skip_inline_ws(key_scan, end);
 6180|  2.95k|                     }
 6181|   112k|                     else {
 6182|       |                        // Plain key: scan to ':'
 6183|  1.63M|                        while (key_scan != end) {
  ------------------
  |  Branch (6183:32): [True: 1.63M, False: 6]
  ------------------
 6184|  1.63M|                           if (*key_scan == ':') {
  ------------------
  |  Branch (6184:32): [True: 152k, False: 1.48M]
  ------------------
 6185|   152k|                              auto next = key_scan + 1;
 6186|   152k|                              if (next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r') {
  ------------------
  |  Branch (6186:35): [True: 25.4k, False: 127k]
  |  Branch (6186:50): [True: 61.1k, False: 66.1k]
  |  Branch (6186:66): [True: 9.23k, False: 56.9k]
  |  Branch (6186:83): [True: 12.0k, False: 44.8k]
  |  Branch (6186:100): [True: 4.34k, False: 40.5k]
  ------------------
 6187|   112k|                                 break;
 6188|   112k|                              }
 6189|   152k|                           }
 6190|  1.52M|                           ++key_scan;
 6191|  1.52M|                        }
 6192|   112k|                        key_end = key_scan;
 6193|   128k|                        while (key_end != key_start && (*(key_end - 1) == ' ' || *(key_end - 1) == '\t')) {
  ------------------
  |  Branch (6193:32): [True: 105k, False: 23.3k]
  |  Branch (6193:57): [True: 15.0k, False: 90.3k]
  |  Branch (6193:82): [True: 1.44k, False: 88.9k]
  ------------------
 6194|  16.4k|                           --key_end;
 6195|  16.4k|                        }
 6196|   112k|                     }
 6197|   115k|                     if (key_scan == end || *key_scan != ':') {
  ------------------
  |  Branch (6197:26): [True: 12, False: 115k]
  |  Branch (6197:45): [True: 50, False: 115k]
  ------------------
 6198|     62|                        ctx.error = error_code::syntax_error;
 6199|     62|                        return;
 6200|     62|                     }
 6201|       |                     // Store anchor with just the key text span
 6202|   115k|                     ctx.anchors[std::string(aname)] = {&*key_start, &*key_end, anchor_indent};
 6203|   115k|                     it = key_start;
 6204|       |                     // Parse as an object alternative so complex keys (e.g. flow collections) stay in mapping context.
 6205|   115k|                     if constexpr (counts::n_object > 0) {
 6206|   115k|                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6207|   115k|                                                                                                        end);
 6208|       |                     }
 6209|       |                     else {
 6210|       |                        redispatch<Opts>(value, ctx, it, end);
 6211|       |                     }
 6212|   115k|                     return;
 6213|   115k|                  }
 6214|   541k|               }
 6215|       |
 6216|   426k|               const bool prev_allow_indentless_sequence = ctx.allow_indentless_sequence;
 6217|   541k|               ctx.allow_indentless_sequence = value_is_indentless_sequence;
 6218|   541k|               redispatch<Opts>(value, ctx, it, end);
 6219|   541k|               ctx.allow_indentless_sequence = prev_allow_indentless_sequence;
 6220|   541k|               if (!bool(ctx.error)) {
  ------------------
  |  Branch (6220:20): [True: 396k, False: 144k]
  ------------------
 6221|   396k|                  ctx.anchors[std::string(aname)] = {anchor_start, &*it, anchor_indent};
 6222|   396k|               }
 6223|   541k|               return;
 6224|   541k|            }
 6225|  32.8k|            case '*': {
  ------------------
  |  Branch (6225:13): [True: 32.8k, False: 2.56M]
  ------------------
 6226|       |               // In block context, "*alias : value" starts a mapping with an alias key.
 6227|  32.8k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6228|  32.8k|                  if (yaml::alias_token_is_mapping_key(it, end)) {
  ------------------
  |  Branch (6228:23): [True: 6.12k, False: 26.7k]
  ------------------
 6229|  6.12k|                     if constexpr (counts::n_object > 0) {
 6230|  6.12k|                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6231|  6.12k|                                                                                                        end);
 6232|  6.12k|                        return;
 6233|       |                     }
 6234|       |                     else {
 6235|       |                        ctx.error = error_code::syntax_error;
 6236|       |                        return;
 6237|       |                     }
 6238|  6.12k|                  }
 6239|  32.8k|               }
 6240|       |
 6241|       |               // Alias value: look up anchor and replay
 6242|      0|               yaml::handle_alias<Opts>(value, ctx, it, end);
 6243|  32.8k|               return;
 6244|   541k|            }
 6245|   291k|            case '!': {
  ------------------
  |  Branch (6245:13): [True: 291k, False: 2.30M]
  ------------------
 6246|       |               // Tag - parse it and dispatch based on tag type
 6247|   291k|               const auto tag = yaml::parse_yaml_tag(it, end, ctx);
 6248|   291k|               if (tag == yaml::yaml_tag::unknown) {
  ------------------
  |  Branch (6248:20): [True: 22, False: 291k]
  ------------------
 6249|     22|                  ctx.error = error_code::syntax_error;
 6250|     22|                  return;
 6251|     22|               }
 6252|   291k|               yaml::skip_inline_ws(it, end);
 6253|   291k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (6253:20): [True: 284k, False: 6.42k]
  |  Branch (6253:33): [True: 29.4k, False: 255k]
  ------------------
 6254|  29.4k|                  yaml::skip_comment(it, end);
 6255|  29.4k|               }
 6256|   291k|               if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (6256:20): [True: 283k, False: 7.78k]
  |  Branch (6256:34): [True: 34.9k, False: 248k]
  |  Branch (6256:49): [True: 92.7k, False: 155k]
  ------------------
 6257|   127k|                  auto content = it;
 6258|   127k|                  yaml::skip_newline(content, end);
 6259|   127k|                  yaml::skip_to_content(content, end);
 6260|       |
 6261|   127k|                  bool consume_following_content = false;
 6262|   127k|                  auto content_token = content;
 6263|   127k|                  if (content != end) {
  ------------------
  |  Branch (6263:23): [True: 120k, False: 7.65k]
  ------------------
 6264|   120k|                     auto indent_probe = content;
 6265|   120k|                     const int32_t content_indent = yaml::measure_indent<false>(indent_probe, end, ctx);
 6266|   120k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (6266:26): [True: 10, False: 120k]
  ------------------
 6267|     10|                        return;
 6268|   120k|                     content_token = indent_probe;
 6269|       |
 6270|       |                     // A tag at the end of a sequence/map entry has an empty value
 6271|       |                     // unless the next non-empty content is nested under the current node.
 6272|   120k|                     bool tagged_indentless_sequence = false;
 6273|   120k|                     if (tag == yaml::yaml_tag::seq && indent_probe != end && *indent_probe == '-') {
  ------------------
  |  Branch (6273:26): [True: 26.3k, False: 93.6k]
  |  Branch (6273:56): [True: 26.3k, False: 0]
  |  Branch (6273:79): [True: 11.1k, False: 15.1k]
  ------------------
 6274|  11.1k|                        const auto after_dash = indent_probe + 1;
 6275|  11.1k|                        if (after_dash == end ||
  ------------------
  |  Branch (6275:29): [True: 3.31k, False: 7.87k]
  ------------------
 6276|  10.1k|                            yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_dash)]) {
  ------------------
  |  Branch (6276:29): [True: 6.79k, False: 1.07k]
  ------------------
 6277|  10.1k|                           tagged_indentless_sequence =
 6278|  10.1k|                              (content_indent == ctx.current_indent()) ||
  ------------------
  |  Branch (6278:31): [True: 2.31k, False: 7.78k]
  ------------------
 6279|  7.78k|                              (ctx.current_indent() > 0 && (content_indent + 1) == ctx.current_indent());
  ------------------
  |  Branch (6279:32): [True: 2.79k, False: 4.99k]
  |  Branch (6279:60): [True: 1.38k, False: 1.41k]
  ------------------
 6280|  10.1k|                        }
 6281|  11.1k|                     }
 6282|       |
 6283|   120k|                     consume_following_content = (ctx.current_indent() < 0) ||
  ------------------
  |  Branch (6283:50): [True: 76.1k, False: 43.8k]
  ------------------
 6284|  43.8k|                                                 (content_indent > ctx.current_indent()) || tagged_indentless_sequence;
  ------------------
  |  Branch (6284:50): [True: 11.7k, False: 32.1k]
  |  Branch (6284:93): [True: 3.69k, False: 28.4k]
  ------------------
 6285|   120k|                  }
 6286|       |
 6287|   127k|                  if (consume_following_content) {
  ------------------
  |  Branch (6287:23): [True: 91.6k, False: 36.0k]
  ------------------
 6288|  91.6k|                     it = content_token;
 6289|  91.6k|                  }
 6290|  36.0k|                  else {
 6291|  36.0k|                     if (tag == yaml::yaml_tag::str) {
  ------------------
  |  Branch (6291:26): [True: 6.32k, False: 29.7k]
  ------------------
 6292|  6.32k|                        if constexpr (counts::n_str > 0) {
 6293|  6.32k|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_str>;
 6294|  6.32k|                           using StrType = std::variant_alternative_t<first_idx, V>;
 6295|  6.32k|                           value = StrType{};
 6296|  6.32k|                           return;
 6297|  6.32k|                        }
 6298|  6.32k|                     }
 6299|  36.0k|                     if (tag == yaml::yaml_tag::null_tag) {
  ------------------
  |  Branch (6299:26): [True: 550, False: 35.5k]
  ------------------
 6300|    550|                        if constexpr (counts::n_null > 0) {
 6301|    550|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6302|    550|                           using NullType = std::variant_alternative_t<first_idx, V>;
 6303|    550|                           if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6303:32): [True: 0, False: 550]
  ------------------
 6304|    550|                           return;
 6305|    550|                        }
 6306|    550|                     }
 6307|  36.0k|                     if (tag == yaml::yaml_tag::none) {
  ------------------
  |  Branch (6307:26): [True: 26.0k, False: 10.0k]
  ------------------
 6308|  26.0k|                        if constexpr (counts::n_null > 0) {
 6309|  26.0k|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6310|  26.0k|                           using NullType = std::variant_alternative_t<first_idx, V>;
 6311|  26.0k|                           if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6311:32): [True: 0, False: 26.0k]
  ------------------
 6312|  26.0k|                           return;
 6313|  26.0k|                        }
 6314|  26.0k|                     }
 6315|  36.0k|                  }
 6316|   127k|               }
 6317|   291k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6318|       |                  // In block context, a comma immediately after a tag token is malformed
 6319|       |                  // (e.g., "!!str, value"). Flow context has legitimate ", ] }" usage.
 6320|   291k|                  if (it != end && *it == ',') {
  ------------------
  |  Branch (6320:23): [True: 250k, False: 40.6k]
  |  Branch (6320:36): [True: 6, False: 250k]
  ------------------
 6321|      6|                     ctx.error = error_code::syntax_error;
 6322|      6|                     return;
 6323|      6|                  }
 6324|   291k|                  if constexpr (counts::n_object > 0) {
 6325|       |                     // Tagged keys like "!!str key: value" must parse as mappings.
 6326|   291k|                     const bool starts_block_sequence_entry =
 6327|   291k|                        (it != end && *it == '-') &&
  ------------------
  |  Branch (6327:26): [True: 250k, False: 40.6k]
  |  Branch (6327:39): [True: 14.6k, False: 235k]
  ------------------
 6328|  14.6k|                        ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
  ------------------
  |  Branch (6328:26): [True: 4.20k, False: 10.4k]
  |  Branch (6328:45): [True: 8.77k, False: 1.63k]
  ------------------
 6329|   291k|                     if (!starts_block_sequence_entry && yaml::line_could_be_block_mapping(it, end)) {
  ------------------
  |  Branch (6329:26): [True: 245k, False: 45.8k]
  |  Branch (6329:58): [True: 24.5k, False: 220k]
  ------------------
 6330|       |                        // Re-dispatch from the post-tag token so '&key key: val' is
 6331|       |                        // handled by the anchor-aware key path, not as a map-level anchor.
 6332|  24.5k|                        redispatch<Opts>(value, ctx, it, end);
 6333|  24.5k|                        return;
 6334|  24.5k|                     }
 6335|   291k|                  }
 6336|   291k|               }
 6337|   291k|               if (it == end) {
  ------------------
  |  Branch (6337:20): [True: 7.78k, False: 283k]
  ------------------
 6338|  7.78k|                  if (tag == yaml::yaml_tag::str) {
  ------------------
  |  Branch (6338:23): [True: 700, False: 7.08k]
  ------------------
 6339|    700|                     if constexpr (counts::n_str > 0) {
 6340|    700|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_str>;
 6341|    700|                        using StrType = std::variant_alternative_t<first_idx, V>;
 6342|    700|                        value = StrType{};
 6343|    700|                        return;
 6344|    700|                     }
 6345|    700|                  }
 6346|  7.78k|                  if (tag == yaml::yaml_tag::none) {
  ------------------
  |  Branch (6346:23): [True: 7.08k, False: 708]
  ------------------
 6347|  7.08k|                     if constexpr (counts::n_null > 0) {
 6348|  7.08k|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6349|  7.08k|                        using NullType = std::variant_alternative_t<first_idx, V>;
 6350|  7.08k|                        if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6350:29): [True: 0, False: 7.08k]
  ------------------
 6351|  7.08k|                        return;
 6352|  7.08k|                     }
 6353|  7.08k|                  }
 6354|      0|                  ctx.error = error_code::unexpected_end;
 6355|  7.78k|                  return;
 6356|  7.78k|               }
 6357|   283k|               switch (tag) {
 6358|  3.09k|               case yaml::yaml_tag::str:
  ------------------
  |  Branch (6358:16): [True: 3.09k, False: 280k]
  ------------------
 6359|  3.09k|                  process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6360|  3.09k|                  return;
 6361|  13.5k|               case yaml::yaml_tag::int_tag:
  ------------------
  |  Branch (6361:16): [True: 13.5k, False: 269k]
  ------------------
 6362|  13.7k|               case yaml::yaml_tag::float_tag:
  ------------------
  |  Branch (6362:16): [True: 216, False: 283k]
  ------------------
 6363|  13.7k|                  if constexpr (counts::n_num > 0) {
 6364|  13.7k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, ctx, it, end);
 6365|  13.7k|                     return;
 6366|       |                  }
 6367|       |                  else { // else used to fix MSVC unreachable code warning
 6368|       |                     ctx.error = error_code::syntax_error;
 6369|       |                     return;
 6370|       |                  }
 6371|  63.2k|               case yaml::yaml_tag::bool_tag:
  ------------------
  |  Branch (6371:16): [True: 49.4k, False: 233k]
  ------------------
 6372|  63.2k|                  if constexpr (counts::n_bool > 0) {
 6373|  63.2k|                     process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it, end);
 6374|  63.2k|                     return;
 6375|       |                  }
 6376|       |                  else { // else used to fix MSVC unreachable code warning
 6377|       |                     ctx.error = error_code::syntax_error;
 6378|       |                     return;
 6379|       |                  }
 6380|  63.6k|               case yaml::yaml_tag::null_tag:
  ------------------
  |  Branch (6380:16): [True: 434, False: 282k]
  ------------------
 6381|  63.6k|                  if constexpr (counts::n_null > 0) {
 6382|  63.6k|                     constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6383|  63.6k|                     using NullType = std::variant_alternative_t<first_idx, V>;
 6384|  63.6k|                     if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6384:26): [True: 0, False: 63.6k]
  ------------------
 6385|  63.6k|                     from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6386|  63.6k|                     return;
 6387|       |                  }
 6388|       |                  else { // else used to fix MSVC unreachable code warning
 6389|       |                     ctx.error = error_code::syntax_error;
 6390|       |                     return;
 6391|       |                  }
 6392|  86.4k|               case yaml::yaml_tag::map:
  ------------------
  |  Branch (6392:16): [True: 22.7k, False: 260k]
  ------------------
 6393|  86.4k|                  if constexpr (counts::n_object > 0) {
 6394|  86.4k|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6395|  86.4k|                                                                                                     end);
 6396|  86.4k|                     return;
 6397|       |                  }
 6398|       |                  else { // else used to fix MSVC unreachable code warning
 6399|       |                     ctx.error = error_code::syntax_error;
 6400|       |                     return;
 6401|       |                  }
 6402|   124k|               case yaml::yaml_tag::seq:
  ------------------
  |  Branch (6402:16): [True: 38.5k, False: 244k]
  ------------------
 6403|   124k|                  if constexpr (counts::n_array > 0) {
 6404|   124k|                     const bool prev_allow_indentless_sequence = ctx.allow_indentless_sequence;
 6405|   124k|                     if constexpr (!yaml::check_flow_context(Opts)) {
 6406|   124k|                        if (it != end && *it == '-') {
  ------------------
  |  Branch (6406:29): [True: 38.5k, False: 86.4k]
  |  Branch (6406:42): [True: 11.1k, False: 27.3k]
  ------------------
 6407|  11.1k|                           ctx.allow_indentless_sequence = true;
 6408|  11.1k|                        }
 6409|   124k|                     }
 6410|   124k|                     process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6411|   124k|                                                                                                    end);
 6412|   124k|                     ctx.allow_indentless_sequence = prev_allow_indentless_sequence;
 6413|   124k|                     return;
 6414|       |                  }
 6415|       |                  else { // else used to fix MSVC unreachable code warning
 6416|       |                     ctx.error = error_code::syntax_error;
 6417|       |                     return;
 6418|       |                  }
 6419|   222k|               default: {
  ------------------
  |  Branch (6419:16): [True: 97.8k, False: 185k]
  ------------------
 6420|       |                  // Explicit unknown/non-core tags disable implicit scalar resolution.
 6421|       |                  // Preserve collection kinds, otherwise treat as string content.
 6422|   222k|                  if (it != end && *it == '*') {
  ------------------
  |  Branch (6422:23): [True: 97.8k, False: 124k]
  |  Branch (6422:36): [True: 9.28k, False: 88.5k]
  ------------------
 6423|  9.28k|                     yaml::handle_alias<Opts>(value, ctx, it, end);
 6424|  9.28k|                     return;
 6425|  9.28k|                  }
 6426|       |
 6427|   213k|                  if constexpr (counts::n_array > 0) {
 6428|   213k|                     if (it != end && *it == '[') {
  ------------------
  |  Branch (6428:26): [True: 88.5k, False: 124k]
  |  Branch (6428:39): [True: 10.8k, False: 77.7k]
  ------------------
 6429|  10.8k|                        process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6430|  10.8k|                                                                                                       end);
 6431|  10.8k|                        return;
 6432|  10.8k|                     }
 6433|   213k|                  }
 6434|   213k|                  if constexpr (counts::n_object > 0) {
 6435|   213k|                     if (it != end && *it == '{') {
  ------------------
  |  Branch (6435:26): [True: 77.7k, False: 135k]
  |  Branch (6435:39): [True: 3.74k, False: 74.0k]
  ------------------
 6436|  3.74k|                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6437|  3.74k|                                                                                                        end);
 6438|  3.74k|                        return;
 6439|  3.74k|                     }
 6440|   213k|                  }
 6441|       |
 6442|   213k|                  if constexpr (!yaml::check_flow_context(Opts)) {
 6443|   213k|                     if constexpr (counts::n_array > 0) {
 6444|   213k|                        const bool starts_block_sequence_entry =
 6445|   213k|                           (it != end && *it == '-') &&
  ------------------
  |  Branch (6445:29): [True: 74.0k, False: 139k]
  |  Branch (6445:42): [True: 3.14k, False: 70.8k]
  ------------------
 6446|  3.14k|                           ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
  ------------------
  |  Branch (6446:29): [True: 888, False: 2.25k]
  |  Branch (6446:48): [True: 1.72k, False: 534]
  ------------------
 6447|   213k|                        if (starts_block_sequence_entry) {
  ------------------
  |  Branch (6447:29): [True: 2.61k, False: 210k]
  ------------------
 6448|  2.61k|                           process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx,
 6449|  2.61k|                                                                                                          it, end);
 6450|  2.61k|                           return;
 6451|  2.61k|                        }
 6452|   213k|                     }
 6453|   213k|                     if constexpr (counts::n_object > 0) {
 6454|   213k|                        const bool starts_explicit_mapping_indicator =
 6455|   213k|                           (it != end && (*it == '?' || *it == ':')) &&
  ------------------
  |  Branch (6455:29): [True: 71.4k, False: 142k]
  |  Branch (6455:43): [True: 1.81k, False: 69.5k]
  |  Branch (6455:57): [True: 1.31k, False: 68.2k]
  ------------------
 6456|  3.12k|                           ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
  ------------------
  |  Branch (6456:29): [True: 72, False: 3.05k]
  |  Branch (6456:48): [True: 962, False: 2.09k]
  ------------------
 6457|   213k|                        if (starts_explicit_mapping_indicator) {
  ------------------
  |  Branch (6457:29): [True: 1.03k, False: 212k]
  ------------------
 6458|  1.03k|                           process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx,
 6459|  1.03k|                                                                                                           it, end);
 6460|  1.03k|                           return;
 6461|  1.03k|                        }
 6462|   212k|                        if (yaml::line_could_be_block_mapping(it, end)) {
  ------------------
  |  Branch (6462:29): [True: 0, False: 212k]
  ------------------
 6463|      0|                           process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx,
 6464|      0|                                                                                                           it, end);
 6465|      0|                           return;
 6466|      0|                        }
 6467|   212k|                     }
 6468|   213k|                  }
 6469|       |
 6470|   213k|                  if constexpr (counts::n_str > 0) {
 6471|   213k|                     process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6472|   213k|                     return;
 6473|   213k|                  }
 6474|       |
 6475|       |                  // Fall back if no string alternative exists.
 6476|      0|                  redispatch<Opts>(value, ctx, it, end);
 6477|   213k|                  return;
 6478|   222k|               }
 6479|   283k|               }
 6480|      0|               return;
 6481|   283k|            }
 6482|   112k|            case '{':
  ------------------
  |  Branch (6482:13): [True: 112k, False: 2.48M]
  ------------------
 6483|   112k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6484|       |                  // In block context, "{...}: value" can be a complex mapping key.
 6485|   112k|                  if (ctx.current_indent() < 0 && yaml::line_could_be_block_mapping(it, end)) {
  ------------------
  |  Branch (6485:23): [True: 85.1k, False: 27.7k]
  |  Branch (6485:51): [True: 12.4k, False: 72.6k]
  ------------------
 6486|  12.4k|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6487|  12.4k|                                                                                                     end);
 6488|  12.4k|                     return;
 6489|  12.4k|                  }
 6490|   112k|               }
 6491|       |               // Flow mapping - object type
 6492|   100k|               process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it, end);
 6493|   112k|               return;
 6494|  94.1k|            case '[':
  ------------------
  |  Branch (6494:13): [True: 94.1k, False: 2.50M]
  ------------------
 6495|  94.1k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6496|       |                  // In block context, "[...]: value" can be a complex mapping key.
 6497|  94.1k|                  if (ctx.current_indent() < 0 && yaml::line_could_be_block_mapping(it, end)) {
  ------------------
  |  Branch (6497:23): [True: 46.2k, False: 47.9k]
  |  Branch (6497:51): [True: 924, False: 45.2k]
  ------------------
 6498|    924|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6499|    924|                                                                                                     end);
 6500|    924|                     return;
 6501|    924|                  }
 6502|  94.1k|               }
 6503|       |               // Flow sequence - array type
 6504|  93.2k|               process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it, end);
 6505|  94.1k|               return;
 6506|   409k|            case '?':
  ------------------
  |  Branch (6506:13): [True: 409k, False: 2.18M]
  ------------------
 6507|       |               // Explicit mapping key indicator ("? key")
 6508|   409k|               if ((end - it >= 2) && it[1] == '\t') {
  ------------------
  |  Branch (6508:20): [True: 409k, False: 14]
  |  Branch (6508:39): [True: 8, False: 409k]
  ------------------
 6509|      8|                  ctx.error = error_code::syntax_error;
 6510|      8|                  return;
 6511|      8|               }
 6512|   409k|               if ((end - it >= 2) && (it[1] == ' ' || it[1] == '\n' || it[1] == '\r')) {
  ------------------
  |  Branch (6512:20): [True: 409k, False: 14]
  |  Branch (6512:40): [True: 148k, False: 261k]
  |  Branch (6512:56): [True: 153k, False: 107k]
  |  Branch (6512:73): [True: 85.9k, False: 21.6k]
  ------------------
 6513|   388k|                  if constexpr (counts::n_object > 0) {
 6514|   388k|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6515|   388k|                                                                                                     end);
 6516|   388k|                     return;
 6517|   388k|                  }
 6518|   388k|               }
 6519|      0|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6520|   409k|               return;
 6521|     18|            case '%':
  ------------------
  |  Branch (6521:13): [True: 18, False: 2.59M]
  ------------------
 6522|       |               // Reserved directive indicator is not a plain scalar start.
 6523|     18|               ctx.error = error_code::syntax_error;
 6524|     18|               return;
 6525|  11.3k|            case '"':
  ------------------
  |  Branch (6525:13): [True: 11.3k, False: 2.58M]
  ------------------
 6526|  19.5k|            case '\'':
  ------------------
  |  Branch (6526:13): [True: 8.16k, False: 2.58M]
  ------------------
 6527|       |               // Could be a quoted string OR a quoted key in a block mapping
 6528|       |               // Try block mapping first (e.g., "key": value), then fall back to string
 6529|  19.5k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6530|  19.5k|               return;
 6531|  24.6k|            case 't':
  ------------------
  |  Branch (6531:13): [True: 24.6k, False: 2.57M]
  ------------------
 6532|  52.1k|            case 'T':
  ------------------
  |  Branch (6532:13): [True: 27.4k, False: 2.56M]
  ------------------
 6533|       |               // Could be "true", "True", "TRUE", or a key/string starting with t/T
 6534|  52.1k|               if constexpr (counts::n_bool > 0) {
 6535|  52.1k|                  if ((end - it >= 4) && ((it[1] == 'r' && it[2] == 'u' && it[3] == 'e') ||
  ------------------
  |  Branch (6535:23): [True: 47.2k, False: 4.83k]
  |  Branch (6535:44): [True: 23.1k, False: 24.0k]
  |  Branch (6535:60): [True: 21.3k, False: 1.88k]
  |  Branch (6535:76): [True: 18.5k, False: 2.75k]
  ------------------
 6536|  28.7k|                                          (it[1] == 'R' && it[2] == 'U' && it[3] == 'E'))) {
  ------------------
  |  Branch (6536:44): [True: 9.38k, False: 19.3k]
  |  Branch (6536:60): [True: 6.54k, False: 2.83k]
  |  Branch (6536:76): [True: 6.01k, False: 530]
  ------------------
 6537|       |                     // Check what follows the word "true"
 6538|  24.5k|                     const auto after_true = it + 4;
 6539|  24.5k|                     const bool at_word_boundary = is_word_boundary(after_true);
 6540|       |
 6541|  24.5k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6541:26): [True: 23.1k, False: 1.45k]
  ------------------
 6542|  23.1k|                        if (has_indented_block_continuation(after_true)) {
  ------------------
  |  Branch (6542:29): [True: 578, False: 22.5k]
  ------------------
 6543|    578|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6544|    578|                           return;
 6545|    578|                        }
 6546|       |                        // Check if this is a key (followed by ": ") rather than a boolean value
 6547|       |                        // "true: value" should parse as {true: value}, not as the boolean true
 6548|  22.5k|                        if ((end - it > 4) && it[4] == ':' &&
  ------------------
  |  Branch (6548:29): [True: 21.7k, False: 798]
  |  Branch (6548:47): [True: 7.99k, False: 13.7k]
  ------------------
 6549|  7.99k|                            (end - it == 5 || it[5] == ' ' || it[5] == '\t' || it[5] == '\n' || it[5] == '\r')) {
  ------------------
  |  Branch (6549:30): [True: 4.10k, False: 3.88k]
  |  Branch (6549:47): [True: 1.15k, False: 2.73k]
  |  Branch (6549:63): [True: 1.37k, False: 1.36k]
  |  Branch (6549:80): [True: 682, False: 678]
  |  Branch (6549:97): [True: 678, False: 0]
  ------------------
 6550|       |                           // This is "true:" followed by space/tab/newline/end - treat as key
 6551|  7.99k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6552|  7.99k|                           return;
 6553|  7.99k|                        }
 6554|  14.5k|                        process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it,
 6555|  14.5k|                                                                                                      end);
 6556|  14.5k|                        return;
 6557|  22.5k|                     }
 6558|       |                     // "true" is followed by more characters (e.g., "True\b") - treat as string
 6559|  24.5k|                  }
 6560|  52.1k|               }
 6561|  28.9k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6562|  52.1k|               return;
 6563|  58.2k|            case 'f':
  ------------------
  |  Branch (6563:13): [True: 58.2k, False: 2.53M]
  ------------------
 6564|  66.1k|            case 'F':
  ------------------
  |  Branch (6564:13): [True: 7.96k, False: 2.58M]
  ------------------
 6565|       |               // Could be "false", "False", "FALSE", or a key/string starting with f/F
 6566|  66.1k|               if constexpr (counts::n_bool > 0) {
 6567|  66.1k|                  if ((end - it >= 5) && ((it[1] == 'a' && it[2] == 'l' && it[3] == 's' && it[4] == 'e') ||
  ------------------
  |  Branch (6567:23): [True: 63.1k, False: 3.04k]
  |  Branch (6567:44): [True: 28.6k, False: 34.4k]
  |  Branch (6567:60): [True: 18.7k, False: 9.90k]
  |  Branch (6567:76): [True: 17.2k, False: 1.46k]
  |  Branch (6567:92): [True: 15.5k, False: 1.69k]
  ------------------
 6568|  47.5k|                                          (it[1] == 'A' && it[2] == 'L' && it[3] == 'S' && it[4] == 'E'))) {
  ------------------
  |  Branch (6568:44): [True: 3.73k, False: 43.8k]
  |  Branch (6568:60): [True: 1.49k, False: 2.23k]
  |  Branch (6568:76): [True: 1.29k, False: 196]
  |  Branch (6568:92): [True: 644, False: 654]
  ------------------
 6569|       |                     // Check what follows the word "false"
 6570|  16.2k|                     const auto after_false = it + 5;
 6571|  16.2k|                     const bool at_word_boundary = is_word_boundary(after_false);
 6572|       |
 6573|  16.2k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6573:26): [True: 14.6k, False: 1.53k]
  ------------------
 6574|  14.6k|                        if (has_indented_block_continuation(after_false)) {
  ------------------
  |  Branch (6574:29): [True: 254, False: 14.4k]
  ------------------
 6575|    254|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6576|    254|                           return;
 6577|    254|                        }
 6578|       |                        // Check if this is a key (followed by ": ") rather than a boolean value
 6579|       |                        // "false: value" should parse as {false: value}, not as the boolean false
 6580|  14.4k|                        if ((end - it > 5) && it[5] == ':' &&
  ------------------
  |  Branch (6580:29): [True: 13.5k, False: 926]
  |  Branch (6580:47): [True: 7.75k, False: 5.76k]
  ------------------
 6581|  7.75k|                            (end - it == 6 || it[6] == ' ' || it[6] == '\t' || it[6] == '\n' || it[6] == '\r')) {
  ------------------
  |  Branch (6581:30): [True: 1.01k, False: 6.73k]
  |  Branch (6581:47): [True: 1.67k, False: 5.05k]
  |  Branch (6581:63): [True: 3.73k, False: 1.32k]
  |  Branch (6581:80): [True: 834, False: 492]
  |  Branch (6581:97): [True: 492, False: 0]
  ------------------
 6582|       |                           // This is "false:" followed by space/tab/newline/end - treat as key
 6583|  7.75k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6584|  7.75k|                           return;
 6585|  7.75k|                        }
 6586|  6.68k|                        process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it,
 6587|  6.68k|                                                                                                      end);
 6588|  6.68k|                        return;
 6589|  14.4k|                     }
 6590|       |                     // "false" is followed by more characters (e.g., "False\b") - treat as string
 6591|  16.2k|                  }
 6592|  66.1k|               }
 6593|  51.4k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6594|  66.1k|               return;
 6595|  23.0k|            case 'n':
  ------------------
  |  Branch (6595:13): [True: 23.0k, False: 2.57M]
  ------------------
 6596|  48.2k|            case 'N':
  ------------------
  |  Branch (6596:13): [True: 25.2k, False: 2.57M]
  ------------------
 6597|       |               // Could be "null", "Null", "NULL", or a key/string starting with n/N
 6598|  48.2k|               if constexpr (counts::n_null > 0) {
 6599|  48.2k|                  if ((end - it >= 4) && ((it[1] == 'u' && it[2] == 'l' && it[3] == 'l') ||
  ------------------
  |  Branch (6599:23): [True: 45.9k, False: 2.35k]
  |  Branch (6599:44): [True: 21.0k, False: 24.9k]
  |  Branch (6599:60): [True: 18.8k, False: 2.19k]
  |  Branch (6599:76): [True: 17.7k, False: 1.04k]
  ------------------
 6600|  30.1k|                                          (it[1] == 'U' && it[2] == 'L' && it[3] == 'L'))) {
  ------------------
  |  Branch (6600:44): [True: 14.8k, False: 13.2k]
  |  Branch (6600:60): [True: 13.3k, False: 1.51k]
  |  Branch (6600:76): [True: 12.4k, False: 934]
  ------------------
 6601|       |                     // Check what follows the word "null"
 6602|  30.1k|                     const auto after_null = it + 4;
 6603|  30.1k|                     const bool at_word_boundary = is_word_boundary(after_null);
 6604|       |
 6605|  30.1k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6605:26): [True: 27.8k, False: 2.33k]
  ------------------
 6606|  27.8k|                        if (has_indented_block_continuation(after_null)) {
  ------------------
  |  Branch (6606:29): [True: 1.27k, False: 26.5k]
  ------------------
 6607|  1.27k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6608|  1.27k|                           return;
 6609|  1.27k|                        }
 6610|       |                        // Check if this is a key (followed by ": ") rather than a null value
 6611|       |                        // "null: value" should parse as {null: value}, not as the null type
 6612|  26.5k|                        if ((end - it > 4) && it[4] == ':' &&
  ------------------
  |  Branch (6612:29): [True: 24.9k, False: 1.61k]
  |  Branch (6612:47): [True: 5.04k, False: 19.9k]
  ------------------
 6613|  5.04k|                            (end - it == 5 || it[5] == ' ' || it[5] == '\t' || it[5] == '\n' || it[5] == '\r')) {
  ------------------
  |  Branch (6613:30): [True: 894, False: 4.15k]
  |  Branch (6613:47): [True: 2.38k, False: 1.77k]
  |  Branch (6613:63): [True: 396, False: 1.37k]
  |  Branch (6613:80): [True: 504, False: 870]
  |  Branch (6613:97): [True: 870, False: 0]
  ------------------
 6614|       |                           // This is "null:" followed by space/tab/newline/end - treat as key
 6615|  5.04k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6616|  5.04k|                           return;
 6617|  5.04k|                        }
 6618|  21.5k|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6619|  21.5k|                        using NullType = std::variant_alternative_t<first_idx, V>;
 6620|  21.5k|                        if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6620:29): [True: 0, False: 21.5k]
  ------------------
 6621|  21.5k|                        from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6622|  21.5k|                        return;
 6623|  26.5k|                     }
 6624|       |                     // "null" is followed by more characters (e.g., "Null\b") - treat as string
 6625|  30.1k|                  }
 6626|  48.2k|               }
 6627|  20.4k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6628|  48.2k|               return;
 6629|  3.83k|            case '~':
  ------------------
  |  Branch (6629:13): [True: 3.83k, False: 2.59M]
  ------------------
 6630|       |               // Null indicator
 6631|  3.83k|               if constexpr (counts::n_null > 0) {
 6632|  3.83k|                  constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6633|  3.83k|                  using NullType = std::variant_alternative_t<first_idx, V>;
 6634|  3.83k|                  if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6634:23): [True: 0, False: 3.83k]
  ------------------
 6635|  3.83k|                  from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6636|  3.83k|                  return;
 6637|  3.83k|               }
 6638|      0|               break; // Fall through to try other types
 6639|   294k|            case '-':
  ------------------
  |  Branch (6639:13): [True: 294k, False: 2.30M]
  ------------------
 6640|       |               // Could be negative number or block sequence indicator
 6641|   294k|               if (((it + 1) == end) || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(it[1])]) {
  ------------------
  |  Branch (6641:20): [True: 7.86k, False: 286k]
  |  Branch (6641:41): [True: 239k, False: 47.1k]
  ------------------
 6642|       |                  // Block sequence indicator "- "
 6643|   247k|                  if constexpr (counts::n_array > 0) {
 6644|   247k|                     process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6645|   247k|                                                                                                    end);
 6646|   247k|                     return;
 6647|   247k|                  }
 6648|   247k|               }
 6649|   294k|               if constexpr (counts::n_num > 0) {
 6650|   294k|                  if ((end - it >= 2) && (std::isdigit(static_cast<unsigned char>(it[1])) || it[1] == '.')) {
  ------------------
  |  Branch (6650:23): [True: 47.1k, False: 247k]
  |  Branch (6650:43): [True: 2.79k, False: 44.3k]
  |  Branch (6650:94): [True: 6.95k, False: 37.4k]
  ------------------
 6651|  9.74k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, ctx, it, end);
 6652|  9.74k|                     return;
 6653|  9.74k|                  }
 6654|   294k|               }
 6655|   284k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6656|   294k|               return;
 6657|  18.3k|            case '+':
  ------------------
  |  Branch (6657:13): [True: 18.3k, False: 2.57M]
  ------------------
 6658|  45.5k|            case '.':
  ------------------
  |  Branch (6658:13): [True: 27.1k, False: 2.56M]
  ------------------
 6659|       |               // Could be a number (.5, +5, .inf, etc.) or a string (.c, .cpp, +name, etc.)
 6660|       |               // Try parsing as number speculatively, fall back to string on failure
 6661|  45.5k|               if constexpr (counts::n_num > 0) {
 6662|  45.5k|                  auto start_it = it;
 6663|  45.5k|                  auto temp_ctx = ctx.make_speculative();
 6664|  45.5k|                  process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, temp_ctx, it,
 6665|  45.5k|                                                                                               end);
 6666|  45.5k|                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6667|  45.5k|                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6668|  45.5k|                  if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (6668:23): [True: 8.43k, False: 37.0k]
  ------------------
 6669|  8.43k|                     ctx.anchors = std::move(temp_ctx.anchors);
 6670|  8.43k|                     return; // Successfully parsed as number
 6671|  8.43k|                  }
 6672|  37.0k|                  it = start_it; // Restore and fall through to string
 6673|  37.0k|               }
 6674|      0|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6675|  45.5k|               return;
 6676|   447k|            default:
  ------------------
  |  Branch (6676:13): [True: 447k, False: 2.14M]
  ------------------
 6677|       |               // Check for digit (0-9) - numeric or block mapping key starting with digit
 6678|   447k|               if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (6678:20): [True: 276k, False: 170k]
  |  Branch (6678:32): [True: 89.7k, False: 186k]
  ------------------
 6679|       |                  // Try block mapping first (e.g., "123key: value")
 6680|  89.7k|                  if (try_parse_block_mapping_into_variant<V, Opts>(value, ctx, it, end)) {
  ------------------
  |  Branch (6680:23): [True: 7.61k, False: 82.1k]
  ------------------
 6681|  7.61k|                     return;
 6682|  7.61k|                  }
 6683|       |                  // Try numeric value speculatively - values like "12:30" look numeric but aren't
 6684|  82.1k|                  if constexpr (counts::n_num > 0) {
 6685|  82.1k|                     auto start_it = it;
 6686|  82.1k|                     auto temp_ctx = ctx.make_speculative();
 6687|  82.1k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, temp_ctx, it,
 6688|  82.1k|                                                                                                  end);
 6689|  82.1k|                     ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6690|  82.1k|                     ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6691|  82.1k|                     if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (6691:26): [True: 20.1k, False: 62.0k]
  ------------------
 6692|  20.1k|                        ctx.anchors = std::move(temp_ctx.anchors);
 6693|  20.1k|                        return; // Successfully parsed as number
 6694|  20.1k|                     }
 6695|  62.0k|                     it = start_it; // Restore and fall through to string
 6696|  62.0k|                  }
 6697|       |                  // Fall through to string
 6698|      0|                  process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6699|  82.1k|                  return;
 6700|  89.7k|               }
 6701|       |               // Plain scalar - try block mapping, then string
 6702|   357k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6703|   357k|               return;
 6704|  2.59M|            }
 6705|  2.59M|         }
 6706|       |
 6707|       |         // For non-auto-deducible variants or fallback, try each type until one succeeds
 6708|      0|         constexpr auto N = std::variant_size_v<std::remove_cvref_t<T>>;
 6709|       |
 6710|       |         // This fold discards each alternative's error and reports only that nothing fit, which
 6711|       |         // misdiagnoses a document that exhausted an expansion budget as merely the wrong shape.
 6712|       |         // Kept aside and used only if no alternative parsed, so a later one that does parse
 6713|       |         // (possible under a latched budget if it materializes no key text) is unaffected.
 6714|  2.59M|         error_code expansion_error{};
 6715|  2.59M|         std::string_view expansion_message{};
 6716|       |
 6717|  2.59M|         auto try_parse = [&]<size_t I>() -> bool {
 6718|  2.59M|            using V = std::variant_alternative_t<I, std::remove_cvref_t<T>>;
 6719|  2.59M|            auto start = it;
 6720|       |
 6721|  2.59M|            V v{};
 6722|  2.59M|            auto temp_ctx = ctx.make_speculative();
 6723|  2.59M|            from<YAML, V>::template op<Opts>(v, temp_ctx, it, end);
 6724|  2.59M|            ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6725|  2.59M|            ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6726|       |
 6727|  2.59M|            if (!bool(temp_ctx.error)) {
 6728|  2.59M|               value = std::move(v);
 6729|  2.59M|               ctx.anchors = std::move(temp_ctx.anchors);
 6730|  2.59M|               return true;
 6731|  2.59M|            }
 6732|       |
 6733|  2.59M|            if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 6734|  2.59M|               expansion_error = temp_ctx.error;
 6735|  2.59M|               expansion_message = temp_ctx.custom_error_message;
 6736|  2.59M|            }
 6737|  2.59M|            it = start;
 6738|  2.59M|            return false;
 6739|  2.59M|         };
 6740|       |
 6741|  2.59M|         bool parsed = false;
 6742|  2.59M|         [&]<size_t... Is>(std::index_sequence<Is...>) {
 6743|  2.59M|            ((parsed = parsed || try_parse.template operator()<Is>()), ...);
 6744|  2.59M|         }(std::make_index_sequence<N>{});
 6745|       |
 6746|  2.59M|         if (!parsed) {
  ------------------
  |  Branch (6746:14): [True: 0, False: 2.59M]
  ------------------
 6747|      0|            if (expansion_error != error_code::none) {
  ------------------
  |  Branch (6747:17): [True: 0, False: 0]
  ------------------
 6748|      0|               ctx.error = expansion_error;
 6749|      0|               ctx.custom_error_message = expansion_message;
 6750|      0|            }
 6751|      0|            else {
 6752|      0|               ctx.error = error_code::no_matching_variant_type;
 6753|      0|            }
 6754|      0|         }
 6755|  2.59M|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_22is_yaml_variant_objectEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   905k|      {
 5356|   905k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   905k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   905k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   905k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   905k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 905k, False: 0]
  ------------------
 5366|   905k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   905k|      }
_ZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_:
 4660|   912k|      {
 4661|   912k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4661:14): [True: 0, False: 912k]
  ------------------
 4662|      0|            return;
 4663|       |
 4664|   912k|         yaml::node_preamble_state preamble{};
 4665|   912k|         if (yaml::parse_node_preamble<Opts, yaml::node_property_policy{true, true, false, false}>(
  ------------------
  |  Branch (4665:14): [True: 14.9k, False: 897k]
  ------------------
 4666|   912k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_map(tag); }))
 4667|  14.9k|            return;
 4668|       |
 4669|   897k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 4670|   897k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (4670:14): [True: 2.71k, False: 894k]
  ------------------
 4671|  2.71k|            return;
 4672|       |
 4673|   894k|         using key_t = typename std::remove_cvref_t<T>::key_type;
 4674|   894k|         using val_t = typename std::remove_cvref_t<T>::mapped_type;
 4675|       |
 4676|       |         // Reading a YAML mapping MERGES into the target: an entry overwrites the
 4677|       |         // value of a key that existed before the read and adds new keys, while
 4678|       |         // pre-existing keys the document does not mention are preserved (like a
 4679|       |         // struct/object read, and like json/read.hpp's per-key value[key]).
 4680|       |         // Within a single document a repeated key keeps its FIRST value -- YAML
 4681|       |         // mappings disallow duplicate keys and the conformance suite expects
 4682|       |         // first-wins, which falls out of emplace into an empty map. Any
 4683|       |         // pre-existing entry the document leaves untouched is restored on scope
 4684|       |         // exit (including error paths). When the target starts empty (the common
 4685|       |         // case) this is a no-op with negligible cost.
 4686|   894k|         std::remove_cvref_t<T> preexisting_entries;
 4687|   894k|         if (!value.empty()) {
  ------------------
  |  Branch (4687:14): [True: 0, False: 894k]
  ------------------
 4688|      0|            preexisting_entries = std::move(value);
 4689|      0|            value.clear();
 4690|      0|         }
 4691|   894k|         struct merge_restore_guard
 4692|   894k|         {
 4693|   894k|            std::remove_cvref_t<T>& target;
 4694|   894k|            std::remove_cvref_t<T>& saved;
 4695|   894k|            ~merge_restore_guard()
 4696|   894k|            {
 4697|       |               // emplace is a no-op for keys the document already wrote, so only
 4698|       |               // untouched pre-existing entries are put back.
 4699|   894k|               for (auto& entry : saved) {
 4700|   894k|                  target.emplace(entry.first, std::move(entry.second));
 4701|   894k|               }
 4702|   894k|            }
 4703|   894k|         } merge_restore{value, preexisting_entries};
 4704|       |
 4705|   894k|         const bool treat_as_block_mapping =
 4706|   894k|            !yaml::check_flow_context(Opts) && *it == '{' && yaml::inline_value_has_plain_mapping_indicator(it, end);
  ------------------
  |  Branch (4706:13): [True: 894k, Folded]
  |  Branch (4706:48): [True: 129k, False: 765k]
  |  Branch (4706:62): [True: 1.56k, False: 128k]
  ------------------
 4707|       |
 4708|   894k|         if (*it == '{' && !treat_as_block_mapping) {
  ------------------
  |  Branch (4708:14): [True: 129k, False: 765k]
  |  Branch (4708:28): [True: 128k, False: 1.56k]
  ------------------
 4709|       |            // Flow mapping
 4710|   128k|            ++it;
 4711|       |            // Skip whitespace and newlines after opening brace
 4712|   128k|            yaml::skip_ws_and_newlines(it, end);
 4713|       |
 4714|   128k|            if (it != end && *it == '}') {
  ------------------
  |  Branch (4714:17): [True: 122k, False: 6.08k]
  |  Branch (4714:30): [True: 8.29k, False: 113k]
  ------------------
 4715|  8.29k|               ++it;
 4716|  8.29k|               yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4717|  8.29k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4717:20): [True: 6, False: 8.29k]
  ------------------
 4718|      6|                  return;
 4719|  8.29k|               yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 4720|  8.29k|               return;
 4721|  8.29k|            }
 4722|       |
 4723|   898k|            while (it != end) {
  ------------------
  |  Branch (4723:20): [True: 886k, False: 11.8k]
  ------------------
 4724|       |               // Skip whitespace and newlines at start of each iteration
 4725|   886k|               yaml::skip_ws_and_newlines(it, end);
 4726|       |
 4727|   886k|               if (it != end && *it == '}') {
  ------------------
  |  Branch (4727:20): [True: 886k, False: 0]
  |  Branch (4727:33): [True: 13.6k, False: 872k]
  ------------------
 4728|  13.6k|                  ++it;
 4729|  13.6k|                  yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4730|  13.6k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4730:23): [True: 6, False: 13.6k]
  ------------------
 4731|      6|                     return;
 4732|  13.6k|                  break;
 4733|  13.6k|               }
 4734|       |
 4735|   872k|               bool explicit_flow_key = false;
 4736|   872k|               auto explicit_probe = it;
 4737|   872k|               yaml::skip_inline_ws(explicit_probe, end);
 4738|   872k|               if (explicit_probe != end && *explicit_probe == '?') {
  ------------------
  |  Branch (4738:20): [True: 872k, False: 0]
  |  Branch (4738:45): [True: 23.2k, False: 849k]
  ------------------
 4739|  23.2k|                  const auto after_q = explicit_probe + 1;
 4740|  23.2k|                  if (after_q == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_q)] ||
  ------------------
  |  Branch (4740:23): [True: 12, False: 23.2k]
  |  Branch (4740:41): [True: 17.2k, False: 5.99k]
  ------------------
 4741|  18.2k|                      *after_q == ',' || *after_q == '}') {
  ------------------
  |  Branch (4741:23): [True: 724, False: 5.26k]
  |  Branch (4741:42): [True: 228, False: 5.03k]
  ------------------
 4742|  18.2k|                     explicit_flow_key = true;
 4743|  18.2k|                     it = explicit_probe + 1;
 4744|  18.2k|                     yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4745|  18.2k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4745:26): [True: 6, False: 18.2k]
  ------------------
 4746|      6|                        return;
 4747|  18.2k|                  }
 4748|  23.2k|               }
 4749|       |               // Parse key
 4750|   872k|               key_t key{};
 4751|   872k|               if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 4752|   872k|                  if (explicit_flow_key && it != end && (*it == ':' || *it == ',' || *it == '}')) {
  ------------------
  |  Branch (4752:23): [True: 18.2k, False: 854k]
  |  Branch (4752:44): [True: 18.2k, False: 14]
  |  Branch (4752:58): [True: 9.51k, False: 8.70k]
  |  Branch (4752:72): [True: 1.31k, False: 7.38k]
  |  Branch (4752:86): [True: 240, False: 7.14k]
  ------------------
 4753|  11.0k|                     key.clear();
 4754|  11.0k|                  }
 4755|   861k|                  else {
 4756|   861k|                     auto key_probe = it;
 4757|   861k|                     yaml::skip_inline_ws(key_probe, end);
 4758|       |
 4759|       |                     // Use full node parsing only for structurally complex flow keys.
 4760|       |                     // Plain/quoted/alias keys stay on parse_yaml_key() for compatibility.
 4761|   861k|                     bool parse_complex_flow_key = false;
 4762|   861k|                     if (key_probe != end) {
  ------------------
  |  Branch (4762:26): [True: 861k, False: 14]
  ------------------
 4763|   861k|                        if (*key_probe == '[' || *key_probe == '{') {
  ------------------
  |  Branch (4763:29): [True: 798, False: 860k]
  |  Branch (4763:50): [True: 4.63k, False: 856k]
  ------------------
 4764|  5.43k|                           parse_complex_flow_key = true;
 4765|  5.43k|                        }
 4766|   856k|                        else if (*key_probe == '&') {
  ------------------
  |  Branch (4766:34): [True: 47.4k, False: 808k]
  ------------------
 4767|  47.4k|                           ++key_probe;
 4768|  47.4k|                           yaml::parse_anchor_name(key_probe, end);
 4769|  47.4k|                           yaml::skip_inline_ws(key_probe, end);
 4770|  47.4k|                           if (key_probe != end && (*key_probe == '[' || *key_probe == '{')) {
  ------------------
  |  Branch (4770:32): [True: 47.4k, False: 46]
  |  Branch (4770:53): [True: 286, False: 47.1k]
  |  Branch (4770:74): [True: 18.6k, False: 28.5k]
  ------------------
 4771|  18.8k|                              parse_complex_flow_key = true;
 4772|  18.8k|                           }
 4773|  47.4k|                        }
 4774|   861k|                     }
 4775|       |
 4776|   861k|                     if (parse_complex_flow_key) {
  ------------------
  |  Branch (4776:26): [True: 24.3k, False: 837k]
  ------------------
 4777|  24.3k|                        glz::generic key_node{};
 4778|  24.3k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 4779|  24.3k|                        if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4779:29): [True: 1.96k, False: 22.3k]
  ------------------
 4780|  1.96k|                           return;
 4781|  22.3k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (4781:29): [True: 6, False: 22.3k]
  ------------------
 4782|      6|                           return;
 4783|  22.3k|                     }
 4784|   837k|                     else {
 4785|   837k|                        if (!yaml::parse_yaml_key(key, ctx, it, end, true)) {
  ------------------
  |  Branch (4785:29): [True: 24.6k, False: 812k]
  ------------------
 4786|  24.6k|                           return;
 4787|  24.6k|                        }
 4788|   837k|                     }
 4789|   861k|                  }
 4790|       |               }
 4791|       |               else {
 4792|       |                  if (explicit_flow_key && it != end && (*it == ':' || *it == ',' || *it == '}')) {
 4793|       |                     ctx.error = error_code::syntax_error;
 4794|       |                     return;
 4795|       |                  }
 4796|       |                  from<YAML, key_t>::template op<yaml::flow_context_on<Opts>()>(key, ctx, it, end);
 4797|       |                  if (bool(ctx.error)) [[unlikely]]
 4798|       |                     return;
 4799|       |               }
 4800|       |
 4801|       |               // Separation between flow key and ':' may include comments/newlines.
 4802|       |               // In flow context, newlines are allowed between key and ':'.
 4803|   846k|               yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4804|   872k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4804:20): [True: 6, False: 872k]
  ------------------
 4805|      6|                  return;
 4806|       |
 4807|   872k|               auto parse_implicit_null = [&](val_t& val) -> bool {
 4808|   872k|                  if constexpr (nullable_like<std::remove_cvref_t<val_t>>) {
 4809|   872k|                     val = {};
 4810|   872k|                     return true;
 4811|   872k|                  }
 4812|   872k|                  else if constexpr (std::same_as<std::remove_cvref_t<val_t>, glz::generic>) {
 4813|   872k|                     val = glz::generic{};
 4814|   872k|                     return true;
 4815|   872k|                  }
 4816|   872k|                  else {
 4817|   872k|                     static constexpr std::string_view null_value{"null"};
 4818|   872k|                     auto null_it = null_value.data();
 4819|   872k|                     const yaml::yaml_context::scoped_stream literal_stream{ctx, null_value.data()};
 4820|   872k|                     from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(
 4821|   872k|                        val, ctx, null_it, null_value.data() + null_value.size());
 4822|   872k|                     return !bool(ctx.error);
 4823|   872k|                  }
 4824|   872k|               };
 4825|       |
 4826|   872k|               if (it != end && (*it == ',' || *it == '}')) {
  ------------------
  |  Branch (4826:20): [True: 845k, False: 26.8k]
  |  Branch (4826:34): [True: 289k, False: 555k]
  |  Branch (4826:48): [True: 25.3k, False: 530k]
  ------------------
 4827|   315k|                  val_t val{};
 4828|   315k|                  if (!parse_implicit_null(val)) [[unlikely]]
  ------------------
  |  Branch (4828:23): [True: 0, False: 315k]
  ------------------
 4829|      0|                     return;
 4830|       |
 4831|   315k|                  value.emplace(std::move(key), std::move(val));
 4832|       |
 4833|   315k|                  if (*it == '}') {
  ------------------
  |  Branch (4833:23): [True: 25.3k, False: 289k]
  ------------------
 4834|  25.3k|                     ++it;
 4835|  25.3k|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4836|  25.3k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4836:26): [True: 6, False: 25.3k]
  ------------------
 4837|      6|                        return;
 4838|  25.3k|                     break;
 4839|  25.3k|                  }
 4840|       |
 4841|   289k|                  ++it; // skip comma
 4842|   289k|                  yaml::skip_ws_and_newlines(it, end);
 4843|   289k|                  continue;
 4844|   315k|               }
 4845|       |
 4846|   557k|               if (it == end || *it != ':') {
  ------------------
  |  Branch (4846:20): [True: 26.8k, False: 530k]
  |  Branch (4846:33): [True: 54, False: 530k]
  ------------------
 4847|    196|                  ctx.error = error_code::syntax_error;
 4848|    196|                  return;
 4849|    196|               }
 4850|   557k|               ++it;
 4851|       |
 4852|   557k|               yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4853|   557k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4853:20): [True: 6, False: 557k]
  ------------------
 4854|      6|                  return;
 4855|       |
 4856|       |               // Omitted value after an explicit ':' maps to an implicit null.
 4857|   557k|               if (it != end && (*it == ',' || *it == '}')) {
  ------------------
  |  Branch (4857:20): [True: 530k, False: 26.6k]
  |  Branch (4857:34): [True: 13.7k, False: 516k]
  |  Branch (4857:48): [True: 10.2k, False: 506k]
  ------------------
 4858|  23.9k|                  val_t val{};
 4859|  23.9k|                  if (!parse_implicit_null(val)) [[unlikely]]
  ------------------
  |  Branch (4859:23): [True: 0, False: 23.9k]
  ------------------
 4860|      0|                     return;
 4861|       |
 4862|  23.9k|                  value.emplace(std::move(key), std::move(val));
 4863|       |
 4864|  23.9k|                  if (*it == '}') {
  ------------------
  |  Branch (4864:23): [True: 10.2k, False: 13.7k]
  ------------------
 4865|  10.2k|                     ++it;
 4866|  10.2k|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4867|  10.2k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4867:26): [True: 10, False: 10.2k]
  ------------------
 4868|     10|                        return;
 4869|  10.2k|                     break;
 4870|  10.2k|                  }
 4871|       |
 4872|  13.7k|                  ++it; // skip comma
 4873|  13.7k|                  yaml::skip_ws_and_newlines(it, end);
 4874|  13.7k|                  continue;
 4875|  23.9k|               }
 4876|       |
 4877|       |               // Parse value
 4878|   533k|               val_t val{};
 4879|   533k|               from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(val, ctx, it, end);
 4880|   533k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4880:20): [True: 816, False: 532k]
  ------------------
 4881|    816|                  return;
 4882|       |
 4883|   532k|               value.emplace(std::move(key), std::move(val));
 4884|       |
 4885|   532k|               yaml::skip_inline_ws(it, end);
 4886|       |
 4887|   532k|               if (it != end && *it == '}') {
  ------------------
  |  Branch (4887:20): [True: 505k, False: 26.7k]
  |  Branch (4887:33): [True: 29.3k, False: 476k]
  ------------------
 4888|  29.3k|                  ++it;
 4889|  29.3k|                  yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4890|  29.3k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4890:23): [True: 6, False: 29.3k]
  ------------------
 4891|      6|                     return;
 4892|  29.3k|                  break;
 4893|  29.3k|               }
 4894|   502k|               else if (it != end && *it == ',') {
  ------------------
  |  Branch (4894:25): [True: 476k, False: 26.7k]
  |  Branch (4894:38): [True: 467k, False: 8.82k]
  ------------------
 4895|   467k|                  ++it;
 4896|       |                  // Skip whitespace and newlines after comma
 4897|   467k|                  yaml::skip_ws_and_newlines(it, end);
 4898|   467k|               }
 4899|  35.5k|               else if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (4899:25): [True: 8.82k, False: 26.7k]
  |  Branch (4899:39): [True: 2.86k, False: 5.95k]
  |  Branch (4899:54): [True: 5.94k, False: 14]
  ------------------
 4900|       |                  // Newlines may precede either the closing brace or the
 4901|       |                  // separator comma for the next entry.
 4902|  8.80k|                  yaml::skip_ws_and_newlines(it, end);
 4903|  8.80k|                  if (it != end && *it == '}') {
  ------------------
  |  Branch (4903:23): [True: 8.78k, False: 28]
  |  Branch (4903:36): [True: 1.61k, False: 7.16k]
  ------------------
 4904|  1.61k|                     ++it;
 4905|  1.61k|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4906|  1.61k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4906:26): [True: 6, False: 1.61k]
  ------------------
 4907|      6|                        return;
 4908|  1.61k|                     break;
 4909|  1.61k|                  }
 4910|  7.19k|                  if (it != end && *it == ',') {
  ------------------
  |  Branch (4910:23): [True: 7.16k, False: 28]
  |  Branch (4910:36): [True: 7.14k, False: 20]
  ------------------
 4911|  7.14k|                     ++it;
 4912|  7.14k|                     yaml::skip_ws_and_newlines(it, end);
 4913|  7.14k|                     continue;
 4914|  7.14k|                  }
 4915|     48|                  ctx.error = error_code::syntax_error;
 4916|     48|                  return;
 4917|  7.19k|               }
 4918|  26.7k|               else {
 4919|  26.7k|                  ctx.error = error_code::syntax_error;
 4920|  26.7k|                  return;
 4921|  26.7k|               }
 4922|   532k|            }
 4923|   119k|         }
 4924|   766k|         else {
 4925|       |            // Block mapping - use shared loop with map-specific callback
 4926|   766k|            yaml::parse_block_mapping_loop<Opts>(
 4927|   766k|               ctx, it, end, int32_t(-1), [&](auto& ctx, auto& it, auto end, int32_t line_indent) -> bool {
 4928|   766k|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|   766k|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 4930|   766k|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|   766k|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|   766k|                           if (ctx.stream_begin) {
 4938|   766k|                              auto is_line_content_start = [&](auto pos) {
 4939|   766k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   766k|                              };
 4941|       |
 4942|   766k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   766k|                                 const char* line = ctx.line_begin_of(pos);
 4944|   766k|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|   766k|                                 return line != end && *line == ':';
 4946|   766k|                              };
 4947|       |
 4948|   766k|                              if (!is_line_content_start(it) &&
 4949|   766k|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
 4950|   766k|                                  !line_has_explicit_value_indicator(it)) {
 4951|   766k|                                 ctx.error = error_code::syntax_error;
 4952|   766k|                                 return false;
 4953|   766k|                              }
 4954|   766k|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|   766k|                           }
 4956|   766k|                        }
 4957|       |
 4958|   766k|                        if (*it == '-' &&
 4959|   766k|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
 4960|   766k|                            !line_starts_with_explicit_value_indicator) {
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|   766k|                           ctx.error = error_code::syntax_error;
 4963|   766k|                           return false;
 4964|   766k|                        }
 4965|       |
 4966|   766k|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 4967|   766k|                           return false;
 4968|   766k|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|   766k|                        ctx.pop_indent();
 4970|   766k|                     }
 4971|   766k|                     else {
 4972|   766k|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|   766k|                        if (nested_indent >= 0) {
 4974|   766k|                           yaml::skip_to_content(it, end);
 4975|   766k|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
 4976|   766k|                              ctx.error = error_code::syntax_error;
 4977|   766k|                              return false;
 4978|   766k|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|   766k|                           const int32_t value_indent =
 4982|   766k|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
 4983|   766k|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
 4984|   766k|                              return false;
 4985|   766k|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|   766k|                           ctx.pop_indent();
 4987|   766k|                        }
 4988|   766k|                     }
 4989|   766k|                     return !bool(ctx.error);
 4990|   766k|                  };
 4991|       |
 4992|       |                  // Explicit key entry form:
 4993|       |                  // ? key
 4994|       |                  // : value
 4995|   766k|                  if (*it == '?' && ((it + 1) != end) && *(it + 1) == '\t') {
 4996|   766k|                     ctx.error = error_code::syntax_error;
 4997|   766k|                     return false;
 4998|   766k|                  }
 4999|   766k|                  if (*it == '?' && ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\n' || *(it + 1) == '\r')) {
 5000|   766k|                     ++it; // skip '?'
 5001|   766k|                     yaml::skip_inline_ws(it, end);
 5002|       |
 5003|   766k|                     const int32_t explicit_value_indicator_indent =
 5004|   766k|                        (ctx.current_indent() < 0) ? 0 : (ctx.current_indent() + 1);
 5005|       |
 5006|   766k|                     key_t key{};
 5007|   766k|                     if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5008|   766k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   766k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   766k|                        };
 5011|       |
 5012|   766k|                        auto key_it = it;
 5013|   766k|                        yaml::skip_inline_ws(key_it, end);
 5014|       |
 5015|   766k|                        auto content = key_it;
 5016|   766k|                        yaml::skip_to_content(content, end);
 5017|   766k|                        bool handled_anchor_only_empty_key = false;
 5018|       |
 5019|       |                        // Anchor on an empty explicit key node:
 5020|       |                        //   ? &a
 5021|       |                        //   : value
 5022|   766k|                        if (content != end && *content == '&') {
 5023|   766k|                           auto anchor_probe = content + 1;
 5024|   766k|                           auto anchor_name = yaml::parse_anchor_name(anchor_probe, end);
 5025|   766k|                           if (!anchor_name.empty()) {
 5026|   766k|                              auto after_anchor = anchor_probe;
 5027|   766k|                              yaml::skip_inline_ws(after_anchor, end);
 5028|       |
 5029|   766k|                              auto value_indicator = after_anchor;
 5030|   766k|                              if (value_indicator != end && *value_indicator == ':') {
 5031|   766k|                                 key.clear();
 5032|   766k|                                 ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5033|   766k|                                 it = value_indicator;
 5034|   766k|                                 handled_anchor_only_empty_key = true;
 5035|   766k|                              }
 5036|   766k|                              else {
 5037|   766k|                                 if (value_indicator != end && *value_indicator == '#') {
 5038|   766k|                                    yaml::skip_comment(value_indicator, end);
 5039|   766k|                                 }
 5040|   766k|                                 if (value_indicator != end && (*value_indicator == '\n' || *value_indicator == '\r')) {
 5041|   766k|                                    yaml::skip_newline(value_indicator, end);
 5042|   766k|                                    auto value_line = value_indicator;
 5043|   766k|                                    int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5044|   766k|                                    if (bool(ctx.error)) [[unlikely]]
 5045|   766k|                                       return false;
 5046|   766k|                                    if (value_line != end && *value_line == ':' &&
 5047|   766k|                                        value_indent == explicit_value_indicator_indent) {
 5048|   766k|                                       key.clear();
 5049|   766k|                                       ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5050|   766k|                                       it = value_line;
 5051|   766k|                                       handled_anchor_only_empty_key = true;
 5052|   766k|                                    }
 5053|   766k|                                    else if (value_line != end && *value_line == ':') {
 5054|       |                                       // In explicit-key form ("? &a"), a following ':'
 5055|       |                                       // starts the outer value indicator only at the same
 5056|       |                                       // indentation. A deeper-indented ': value' is malformed.
 5057|   766k|                                       ctx.error = error_code::syntax_error;
 5058|   766k|                                       return false;
 5059|   766k|                                    }
 5060|   766k|                                 }
 5061|   766k|                              }
 5062|   766k|                           }
 5063|   766k|                        }
 5064|       |
 5065|   766k|                        const bool key_content_spans_lines = [&] {
 5066|   766k|                           auto scan = key_it;
 5067|   766k|                           while (scan != content && scan != end) {
 5068|   766k|                              if (*scan == '\n' || *scan == '\r') return true;
 5069|   766k|                              ++scan;
 5070|   766k|                           }
 5071|   766k|                           return false;
 5072|   766k|                        }();
 5073|       |
 5074|   766k|                        if (handled_anchor_only_empty_key) {
 5075|       |                           // 'it' already points to the explicit value indicator ':'
 5076|   766k|                        }
 5077|   766k|                        else if (content == end || (*content == ':' && key_content_spans_lines)) {
 5078|   766k|                           key.clear();
 5079|   766k|                           it = content;
 5080|   766k|                        }
 5081|   766k|                        else {
 5082|       |                           // Explicit mapping keys ('? key-node') are full YAML nodes.
 5083|       |                           // Parse the key node structurally (not via plain-key scanning)
 5084|       |                           // so inputs like '? []: x' and '? JSON: like' are interpreted
 5085|       |                           // as complex keys, not split into implicit key/value pairs.
 5086|   766k|                           auto key_node_it = content;
 5087|   766k|                           auto key_node_end = end;
 5088|   766k|                           if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 5089|       |                              // In explicit-key form, a following standalone ':'
 5090|       |                              // line (same or lower indentation) belongs to the
 5091|       |                              // outer mapping value, not the key node itself.
 5092|   766k|                              auto scan = content;
 5093|   766k|                              while (scan != end) {
 5094|   766k|                                 while (scan != end && *scan != '\n' && *scan != '\r') {
 5095|   766k|                                    ++scan;
 5096|   766k|                                 }
 5097|   766k|                                 if (scan == end) {
 5098|   766k|                                    break;
 5099|   766k|                                 }
 5100|       |
 5101|   766k|                                 yaml::skip_newline(scan, end);
 5102|   766k|                                 auto line_start = scan;
 5103|       |
 5104|   766k|                                 int32_t indicator_indent = 0;
 5105|   766k|                                 while (scan != end && *scan == ' ') {
 5106|   766k|                                    ++indicator_indent;
 5107|   766k|                                    ++scan;
 5108|   766k|                                 }
 5109|       |
 5110|   766k|                                 if (scan != end && *scan == ':') {
 5111|   766k|                                    const auto after_colon = scan + 1;
 5112|   766k|                                    if ((after_colon == end ||
 5113|   766k|                                         yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
 5114|   766k|                                        indicator_indent <= line_indent) {
 5115|   766k|                                       key_node_end = line_start;
 5116|   766k|                                       break;
 5117|   766k|                                    }
 5118|   766k|                                 }
 5119|   766k|                              }
 5120|   766k|                           }
 5121|       |
 5122|   766k|                           glz::generic key_node{};
 5123|   766k|                           const bool prev_explicit_mapping_key_context = ctx.explicit_mapping_key_context;
 5124|   766k|                           ctx.explicit_mapping_key_context = true;
 5125|   766k|                           from<YAML, glz::generic>::template op<Opts>(key_node, ctx, key_node_it, key_node_end);
 5126|   766k|                           ctx.explicit_mapping_key_context = prev_explicit_mapping_key_context;
 5127|   766k|                           if (bool(ctx.error)) [[unlikely]]
 5128|   766k|                              return false;
 5129|   766k|                           it = key_node_it;
 5130|   766k|                           if (!to_string_key(key_node)) [[unlikely]]
 5131|   766k|                              return false;
 5132|   766k|                        }
 5133|   766k|                     }
 5134|   766k|                     else {
 5135|   766k|                        if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 5136|   766k|                           from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5137|   766k|                           if (bool(ctx.error)) [[unlikely]]
 5138|   766k|                              return false;
 5139|   766k|                        }
 5140|   766k|                     }
 5141|       |
 5142|   766k|                     yaml::skip_inline_ws(it, end);
 5143|   766k|                     yaml::skip_comment(it, end);
 5144|       |
 5145|       |                     // Value indicator may appear on the next line at the same indent.
 5146|   766k|                     if (it != end && (*it == '\n' || *it == '\r')) {
 5147|   766k|                        auto probe = it;
 5148|   766k|                        bool found_value_indicator = false;
 5149|       |
 5150|   766k|                        while (probe != end && (*probe == '\n' || *probe == '\r')) {
 5151|   766k|                           yaml::skip_newline(probe, end);
 5152|       |
 5153|   766k|                           auto value_line = probe;
 5154|   766k|                           int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5155|   766k|                           if (bool(ctx.error)) [[unlikely]]
 5156|   766k|                              return false;
 5157|       |
 5158|   766k|                           if (value_line == end || *value_line == '\n' || *value_line == '\r') {
 5159|   766k|                              probe = value_line;
 5160|   766k|                              continue; // blank line
 5161|   766k|                           }
 5162|   766k|                           if (*value_line == '#') {
 5163|   766k|                              yaml::skip_comment(value_line, end);
 5164|   766k|                              probe = value_line;
 5165|   766k|                              continue; // comment-only line
 5166|   766k|                           }
 5167|   766k|                           if (*value_line == ':' && value_indent == explicit_value_indicator_indent) {
 5168|   766k|                              it = value_line;
 5169|   766k|                              found_value_indicator = true;
 5170|   766k|                           }
 5171|   766k|                           break;
 5172|   766k|                        }
 5173|       |
 5174|   766k|                        if (found_value_indicator) {
 5175|   766k|                           yaml::skip_inline_ws(it, end);
 5176|   766k|                        }
 5177|   766k|                     }
 5178|       |
 5179|   766k|                     val_t val{};
 5180|   766k|                     if (it != end && *it == ':') {
 5181|   766k|                        ++it;
 5182|   766k|                        if (it != end && *it == '\t') {
 5183|   766k|                           ctx.error = error_code::syntax_error;
 5184|   766k|                           return false;
 5185|   766k|                        }
 5186|   766k|                        if (it != end && (*it == '\n' || *it == '\r')) {
 5187|   766k|                           auto probe = it;
 5188|   766k|                           yaml::skip_newline(probe, end);
 5189|   766k|                           while (probe != end && *probe == ' ') ++probe;
 5190|   766k|                           if (probe != end && *probe == ':' && ((probe + 1) != end) && *(probe + 1) == '\t') {
 5191|   766k|                              ctx.error = error_code::syntax_error;
 5192|   766k|                              return false;
 5193|   766k|                           }
 5194|   766k|                        }
 5195|   766k|                        yaml::skip_inline_ws(it, end);
 5196|   766k|                        if (!parse_map_value(val)) [[unlikely]]
 5197|   766k|                           return false;
 5198|   766k|                     }
 5199|       |
 5200|   766k|                     value.emplace(std::move(key), std::move(val));
 5201|   766k|                     return true;
 5202|   766k|                  }
 5203|       |
 5204|   766k|                  key_t key{};
 5205|   766k|                  if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5206|   766k|                     auto key_probe = it;
 5207|   766k|                     yaml::skip_inline_ws(key_probe, end);
 5208|   766k|                     const bool complex_flow_key = (key_probe != end && (*key_probe == '[' || *key_probe == '{'));
 5209|   766k|                     if (complex_flow_key) {
 5210|   766k|                        glz::generic key_node{};
 5211|   766k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 5212|   766k|                        if (bool(ctx.error)) [[unlikely]]
 5213|   766k|                           return false;
 5214|   766k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
 5215|   766k|                           return false;
 5216|   766k|                     }
 5217|   766k|                     else {
 5218|   766k|                        if (!yaml::parse_yaml_key(key, ctx, it, end, false)) {
 5219|   766k|                           return false;
 5220|   766k|                        }
 5221|   766k|                     }
 5222|   766k|                  }
 5223|   766k|                  else {
 5224|   766k|                     from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5225|   766k|                     if (bool(ctx.error)) [[unlikely]]
 5226|   766k|                        return false;
 5227|   766k|                  }
 5228|       |
 5229|   766k|                  yaml::skip_inline_ws(it, end);
 5230|       |
 5231|   766k|                  if (it == end || *it != ':') {
 5232|   766k|                     ctx.error = error_code::syntax_error;
 5233|   766k|                     return false;
 5234|   766k|                  }
 5235|   766k|                  ++it;
 5236|   766k|                  yaml::skip_inline_ws(it, end);
 5237|       |
 5238|   766k|                  val_t val{};
 5239|   766k|                  if (!parse_map_value(val)) [[unlikely]]
 5240|   766k|                     return false;
 5241|       |
 5242|   766k|                  value.emplace(std::move(key), std::move(val));
 5243|   766k|                  return true;
 5244|   766k|               });
 5245|   766k|         }
 5246|       |
 5247|   858k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 5248|   858k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEEXtlNS0_20node_property_policyELb1ELb1EEELb0ERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES4_EEEENS0_12yaml_contextEPKcSC_ZNS_4fromILj450ES8_E2opITnDaXtlS2_Lj10ELb1ELb0ELb0ELb1EEERSC_S9_TkNS_10is_contextERSA_SC_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSL_RSO_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   912k|      {
  475|   912k|         skip_inline_ws(it, end);
  476|       |
  477|   912k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 10, False: 912k]
  ------------------
  478|     10|            if constexpr (!AllowEmptyInput) {
  479|     10|               ctx.error = error_code::unexpected_end;
  480|     10|            }
  481|     10|            return true;
  482|     10|         }
  483|       |
  484|   912k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   912k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 6, False: 912k]
  ------------------
  486|      6|            ctx.error = error_code::syntax_error;
  487|      6|            return true;
  488|      6|         }
  489|   912k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 6, False: 912k]
  ------------------
  490|      6|            ctx.error = error_code::syntax_error;
  491|      6|            return true;
  492|      6|         }
  493|       |
  494|   912k|         skip_inline_ws(it, end);
  495|       |
  496|   912k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 6, False: 912k]
  ------------------
  497|      6|            if constexpr (!AllowEmptyInput) {
  498|      6|               ctx.error = error_code::unexpected_end;
  499|      6|            }
  500|      6|            return true;
  501|      6|         }
  502|       |
  503|   912k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 14.9k, False: 897k]
  ------------------
  504|  14.9k|            return true;
  505|  14.9k|         }
  506|       |
  507|   897k|         return false;
  508|   912k|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlNSD_8yaml_tagEE_clESN_:
 4666|   912k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_map(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEEXtlNS0_20node_property_policyELb1ELb1EEERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES4_EEEENS0_12yaml_contextEPKcSC_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   912k|      {
  418|   912k|         state.has_anchor = false;
  419|   912k|         state.anchor_name.clear();
  420|   912k|         state.anchor_start = nullptr;
  421|   912k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   912k|         if constexpr (Policy.allow_alias) {
  424|   912k|            if constexpr (Policy.alias_can_be_mapping_key) {
  425|   912k|               if (!alias_token_is_mapping_key(it, end)) {
  ------------------
  |  Branch (425:20): [True: 902k, False: 10.2k]
  ------------------
  426|   902k|                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (426:23): [True: 14.9k, False: 887k]
  ------------------
  427|   902k|               }
  428|       |            }
  429|       |            else {
  430|       |               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  431|       |            }
  432|   912k|         }
  433|       |
  434|   912k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 897k, False: 14.9k]
  |  Branch (434:27): [True: 38.1k, False: 859k]
  ------------------
  435|  38.1k|            ++it;
  436|  38.1k|            auto name = parse_anchor_name(it, end);
  437|  38.1k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 20, False: 38.1k]
  ------------------
  438|     20|               ctx.error = error_code::syntax_error;
  439|     20|               return true;
  440|     20|            }
  441|  38.1k|            skip_inline_ws(it, end);
  442|  38.1k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 16, False: 38.1k]
  ------------------
  443|     16|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     16|                  ctx.error = error_code::unexpected_end;
  445|     16|               }
  446|     16|               return true;
  447|     16|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  38.1k|            state.has_anchor = true;
  455|  38.1k|            state.anchor_name = std::string(name);
  456|  38.1k|            state.anchor_start = &*it;
  457|  38.1k|         }
  458|       |
  459|   912k|         return false;
  460|   912k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES3_EEEENS0_12yaml_contextEPKcSB_EEbOT0_RT1_RT2_T3_:
  309|   902k|      {
  310|   902k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 902k]
  |  Branch (310:27): [True: 887k, False: 14.9k]
  ------------------
  311|       |
  312|  14.9k|         ++it; // skip '*'
  313|  14.9k|         auto name = parse_anchor_name(it, end);
  314|  14.9k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 20, False: 14.8k]
  ------------------
  315|     20|            ctx.error = error_code::syntax_error;
  316|     20|            return true;
  317|     20|         }
  318|       |
  319|  14.8k|         auto anchor_it = ctx.anchors.find(name);
  320|  14.8k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 40, False: 14.8k]
  ------------------
  321|     40|            ctx.error = error_code::syntax_error; // undefined alias
  322|     40|            return true;
  323|     40|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  14.8k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  14.8k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 7.65k, False: 7.19k]
  ------------------
  331|  7.65k|            return true;
  332|  7.65k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  7.19k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 66, False: 7.12k]
  ------------------
  338|     66|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     66|            return true;
  340|     66|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  7.12k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  7.12k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 10, False: 7.11k]
  ------------------
  348|     10|            return true;
  349|       |
  350|  7.11k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 0, False: 7.11k]
  ------------------
  351|      0|            ctx.error = error_code::exceeded_max_expansion;
  352|      0|            ctx.custom_error_message = "alias expansion";
  353|      0|            return true;
  354|      0|         }
  355|       |
  356|  7.11k|         auto replay_it = span.begin;
  357|  7.11k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  7.11k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  7.11k|         ctx.indent_stack.clear();
  362|  7.11k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 3.59k, False: 3.52k]
  ------------------
  363|  3.59k|            ctx.push_indent(span.base_indent - 1);
  364|  3.59k|         }
  365|       |
  366|  7.11k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  7.11k|         using V = std::remove_cvref_t<T>;
  369|  7.11k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  7.11k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  7.11k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  7.11k|         return true;
  376|  7.11k|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRS4_E_clESN_:
 4807|   339k|               auto parse_implicit_null = [&](val_t& val) -> bool {
 4808|       |                  if constexpr (nullable_like<std::remove_cvref_t<val_t>>) {
 4809|       |                     val = {};
 4810|       |                     return true;
 4811|       |                  }
 4812|   339k|                  else if constexpr (std::same_as<std::remove_cvref_t<val_t>, glz::generic>) {
 4813|   339k|                     val = glz::generic{};
 4814|   339k|                     return true;
 4815|       |                  }
 4816|       |                  else {
 4817|       |                     static constexpr std::string_view null_value{"null"};
 4818|       |                     auto null_it = null_value.data();
 4819|       |                     const yaml::yaml_context::scoped_stream literal_stream{ctx, null_value.data()};
 4820|       |                     from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(
 4821|       |                        val, ctx, null_it, null_value.data() + null_value.size());
 4822|       |                     return !bool(ctx.error);
 4823|       |                  }
 4824|   339k|               };
_ZN3glz4yaml24parse_block_mapping_loopITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEENS0_12yaml_contextEPKcS5_ZNS_4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES7_EEEEE2opITnDaXtlS2_Lj10ELb1ELb0ELb0ELb1EEERS5_RSB_TkNS_10is_contextERS3_S5_EEvOT1_OT2_OT0_T3_EUlRT_RSL_SH_iE_EEvSQ_RSH_SJ_iOSN_:
 3736|   766k|      {
 3737|       |         // A tagged-variant custom alternative hands its body (at the variant's own column) to a
 3738|       |         // discover-mode reader. Honor the known indent it published so continuation/dedent are
 3739|       |         // judged against the outer parent, not the body itself. One-shot: reset on observation.
 3740|   766k|         if (ctx.forced_block_mapping_indent >= 0) {
  ------------------
  |  Branch (3740:14): [True: 0, False: 766k]
  ------------------
 3741|      0|            if (mapping_indent < 0) {
  ------------------
  |  Branch (3741:17): [True: 0, False: 0]
  ------------------
 3742|      0|               mapping_indent = ctx.forced_block_mapping_indent;
 3743|      0|            }
 3744|      0|            ctx.forced_block_mapping_indent = -1;
 3745|      0|         }
 3746|   766k|         const int32_t parent_indent = ctx.current_indent();
 3747|   766k|         const bool discover_indent = (mapping_indent < 0);
 3748|   766k|         bool first_key = !discover_indent;
 3749|   766k|         bool discovered_first_key_mid_line = false;
 3750|   766k|         int32_t discovered_first_key_visual_indent = 0;
 3751|       |
 3752|  1.79M|         while (it != end) {
  ------------------
  |  Branch (3752:17): [True: 1.38M, False: 416k]
  ------------------
 3753|  1.38M|            auto line_start = it;
 3754|  1.38M|            int32_t line_indent = first_key ? mapping_indent : 0;
  ------------------
  |  Branch (3754:35): [True: 0, False: 1.38M]
  ------------------
 3755|       |
 3756|       |            // Skip blank lines and comments, measure indent
 3757|  1.73M|            while (it != end) {
  ------------------
  |  Branch (3757:20): [True: 1.68M, False: 51.3k]
  ------------------
 3758|  1.68M|               if (*it == '#') {
  ------------------
  |  Branch (3758:20): [True: 48.7k, False: 1.63M]
  ------------------
 3759|  48.7k|                  skip_comment(it, end);
 3760|  48.7k|                  skip_newline(it, end);
 3761|  48.7k|                  first_key = false;
 3762|  48.7k|                  line_indent = 0;
 3763|  48.7k|               }
 3764|  1.63M|               else if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3764:25): [True: 168k, False: 1.46M]
  |  Branch (3764:40): [True: 59.1k, False: 1.40M]
  ------------------
 3765|   227k|                  skip_newline(it, end);
 3766|   227k|                  first_key = false;
 3767|   227k|                  line_indent = 0;
 3768|   227k|               }
 3769|  1.40M|               else if (*it == ' ') {
  ------------------
  |  Branch (3769:25): [True: 165k, False: 1.24M]
  ------------------
 3770|   165k|                  line_start = it;
 3771|   165k|                  line_indent = 0;
 3772|  1.37M|                  while (it != end && *it == ' ') {
  ------------------
  |  Branch (3772:26): [True: 1.35M, False: 22.1k]
  |  Branch (3772:39): [True: 1.21M, False: 143k]
  ------------------
 3773|  1.21M|                     ++line_indent;
 3774|  1.21M|                     ++it;
 3775|  1.21M|                  }
 3776|       |
 3777|   165k|                  bool saw_tab = false;
 3778|   186k|                  while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3778:26): [True: 159k, False: 26.6k]
  |  Branch (3778:40): [True: 11.0k, False: 148k]
  |  Branch (3778:54): [True: 9.90k, False: 138k]
  ------------------
 3779|  20.9k|                     saw_tab = saw_tab || (*it == '\t');
  ------------------
  |  Branch (3779:32): [True: 11.9k, False: 8.96k]
  |  Branch (3779:43): [True: 8.96k, False: 0]
  ------------------
 3780|  20.9k|                     ++it;
 3781|  20.9k|                  }
 3782|       |
 3783|   165k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3783:23): [True: 26.6k, False: 138k]
  |  Branch (3783:36): [True: 6.95k, False: 131k]
  |  Branch (3783:51): [True: 4.49k, False: 127k]
  |  Branch (3783:66): [True: 12.1k, False: 115k]
  ------------------
 3784|  50.2k|                     first_key = false;
 3785|  50.2k|                     line_indent = 0;
 3786|  50.2k|                     continue; // Blank or comment line
 3787|  50.2k|                  }
 3788|       |
 3789|   115k|                  if (saw_tab) {
  ------------------
  |  Branch (3789:23): [True: 10, False: 115k]
  ------------------
 3790|     10|                     ctx.error = error_code::syntax_error;
 3791|     10|                     return;
 3792|     10|                  }
 3793|       |
 3794|       |                  // Early dedent check
 3795|   115k|                  if (mapping_indent >= 0 && line_indent < mapping_indent) {
  ------------------
  |  Branch (3795:23): [True: 112k, False: 2.87k]
  |  Branch (3795:46): [True: 398, False: 111k]
  ------------------
 3796|    398|                     it = line_start;
 3797|    398|                     return;
 3798|    398|                  }
 3799|       |
 3800|   114k|                  first_key = false;
 3801|   114k|                  break; // Found content
 3802|   115k|               }
 3803|  1.24M|               else if (*it == '\t') {
  ------------------
  |  Branch (3803:25): [True: 27.9k, False: 1.21M]
  ------------------
 3804|  27.9k|                  line_start = it;
 3805|  87.7k|                  while (it != end && (*it == ' ' || *it == '\t')) ++it;
  ------------------
  |  Branch (3805:26): [True: 84.7k, False: 3.03k]
  |  Branch (3805:40): [True: 23.9k, False: 60.7k]
  |  Branch (3805:54): [True: 35.8k, False: 24.8k]
  ------------------
 3806|  27.9k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3806:23): [True: 3.03k, False: 24.8k]
  |  Branch (3806:36): [True: 19.4k, False: 5.47k]
  |  Branch (3806:51): [True: 2.37k, False: 3.10k]
  |  Branch (3806:66): [True: 3.09k, False: 14]
  ------------------
 3807|  27.9k|                     first_key = false;
 3808|  27.9k|                     line_indent = 0;
 3809|  27.9k|                     continue; // Blank or comment-only line with tab indentation
 3810|  27.9k|                  }
 3811|     14|                  ctx.error = error_code::syntax_error;
 3812|     14|                  return;
 3813|  27.9k|               }
 3814|  1.21M|               else {
 3815|  1.21M|                  line_start = it;
 3816|  1.21M|                  break; // Content at column 0
 3817|  1.21M|               }
 3818|  1.68M|            }
 3819|       |
 3820|  1.38M|            if (it == end) break;
  ------------------
  |  Branch (3820:17): [True: 51.3k, False: 1.32M]
  ------------------
 3821|       |
 3822|       |            // Document boundaries terminate the current mapping in both discovered
 3823|       |            // and fixed-indent modes.
 3824|  1.32M|            if (at_document_end(it, end) || at_document_start(it, end)) break;
  ------------------
  |  Branch (3824:17): [True: 6.31k, False: 1.32M]
  |  Branch (3824:45): [True: 3.59k, False: 1.31M]
  ------------------
 3825|       |
 3826|       |            // Dedent checks (skip on first key for struct case)
 3827|       |            // Must check BEFORE establishing mapping_indent so the first discovered key
 3828|       |            // isn't rejected by the parent_indent check (mapping_indent is still -1).
 3829|  1.31M|            if (!first_key) {
  ------------------
  |  Branch (3829:17): [True: 1.31M, False: 0]
  ------------------
 3830|       |               // Parent indent check for nested maps (only after mapping_indent established)
 3831|  1.31M|               if (discover_indent && mapping_indent >= 0 && parent_indent >= 0 && line_indent <= parent_indent) {
  ------------------
  |  Branch (3831:20): [True: 1.31M, False: 0]
  |  Branch (3831:39): [True: 553k, False: 766k]
  |  Branch (3831:62): [True: 117k, False: 436k]
  |  Branch (3831:84): [True: 83.7k, False: 33.4k]
  ------------------
 3832|  83.7k|                  it = line_start;
 3833|  83.7k|                  return;
 3834|  83.7k|               }
 3835|  1.23M|               if (mapping_indent >= 0 && line_indent < mapping_indent) {
  ------------------
  |  Branch (3835:20): [True: 469k, False: 766k]
  |  Branch (3835:43): [True: 438, False: 469k]
  ------------------
 3836|    438|                  it = line_start;
 3837|    438|                  return;
 3838|    438|               }
 3839|  1.23M|            }
 3840|       |
 3841|       |            // Establish mapping indent from first key (map case)
 3842|  1.23M|            bool established_mapping_indent_this_line = false;
 3843|  1.23M|            if (mapping_indent < 0) {
  ------------------
  |  Branch (3843:17): [True: 766k, False: 469k]
  ------------------
 3844|   766k|               mapping_indent = line_indent;
 3845|   766k|               established_mapping_indent_this_line = true;
 3846|   766k|               discovered_first_key_visual_indent = line_indent;
 3847|   766k|               if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3848|   766k|                  if (ctx.stream_begin && line_start > ctx.stream_begin) {
  ------------------
  |  Branch (3848:23): [True: 766k, False: 0]
  |  Branch (3848:43): [True: 766k, False: 0]
  ------------------
 3849|   766k|                     const auto prefix = ctx.line_prefix_before(line_start);
 3850|   766k|                     if (prefix.has_tab) {
  ------------------
  |  Branch (3850:26): [True: 78, False: 766k]
  ------------------
 3851|     78|                        ctx.error = error_code::syntax_error;
 3852|     78|                        return;
 3853|     78|                     }
 3854|       |
 3855|   766k|                     discovered_first_key_mid_line = prefix.has_content;
 3856|   766k|                     if (mapping_indent == 0 && prefix.column > 0) {
  ------------------
  |  Branch (3856:26): [True: 763k, False: 2.87k]
  |  Branch (3856:49): [True: 583k, False: 179k]
  ------------------
 3857|   583k|                        discovered_first_key_visual_indent = prefix.column;
 3858|   583k|                     }
 3859|   766k|                  }
 3860|   766k|               }
 3861|   766k|            }
 3862|       |
 3863|       |            // In discovered-indent block mappings, sibling keys must stay at the same
 3864|       |            // indent level, except when the first key started mid-line (e.g. "--- k: v").
 3865|  1.23M|            if (discover_indent && mapping_indent >= 0 && !established_mapping_indent_this_line &&
  ------------------
  |  Branch (3865:17): [True: 1.23M, False: 78]
  |  Branch (3865:36): [True: 1.23M, False: 0]
  |  Branch (3865:59): [True: 469k, False: 766k]
  ------------------
 3866|   469k|                !discovered_first_key_mid_line) {
  ------------------
  |  Branch (3866:17): [True: 156k, False: 312k]
  ------------------
 3867|   156k|               if (mapping_indent == 0 && discovered_first_key_visual_indent > 0) {
  ------------------
  |  Branch (3867:20): [True: 156k, False: 286]
  |  Branch (3867:43): [True: 15.5k, False: 140k]
  ------------------
 3868|  15.5k|                  if (line_indent > discovered_first_key_visual_indent) {
  ------------------
  |  Branch (3868:23): [True: 62, False: 15.5k]
  ------------------
 3869|     62|                     ctx.error = error_code::syntax_error;
 3870|     62|                     return;
 3871|     62|                  }
 3872|  15.5k|                  if (line_indent < discovered_first_key_visual_indent) {
  ------------------
  |  Branch (3872:23): [True: 4.41k, False: 11.0k]
  ------------------
 3873|  4.41k|                     it = line_start;
 3874|  4.41k|                     return;
 3875|  4.41k|                  }
 3876|  15.5k|               }
 3877|   140k|               else if (line_indent > mapping_indent &&
  ------------------
  |  Branch (3877:25): [True: 1.33k, False: 139k]
  ------------------
 3878|  1.33k|                        (parent_indent < 0 || mapping_indent > 0 ||
  ------------------
  |  Branch (3878:26): [True: 42, False: 1.29k]
  |  Branch (3878:47): [True: 6, False: 1.28k]
  ------------------
 3879|  1.28k|                         (parent_indent >= 0 && mapping_indent == 0 && line_indent > (parent_indent + 1)))) {
  ------------------
  |  Branch (3879:27): [True: 1.28k, False: 0]
  |  Branch (3879:49): [True: 1.28k, False: 0]
  |  Branch (3879:72): [True: 6, False: 1.28k]
  ------------------
 3880|     54|                  ctx.error = error_code::syntax_error;
 3881|     54|                  return;
 3882|     54|               }
 3883|   156k|            }
 3884|       |
 3885|       |            // Sequence indicator check (struct case only - map parser lets key parsing
 3886|       |            // handle '- ' which produces appropriate errors for misindented items)
 3887|  1.23M|            if (!discover_indent && *it == '-' &&
  ------------------
  |  Branch (3887:17): [True: 0, False: 1.23M]
  |  Branch (3887:37): [True: 0, False: 0]
  ------------------
 3888|      0|                ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\t' || *(it + 1) == '\n')) {
  ------------------
  |  Branch (3888:18): [True: 0, False: 0]
  |  Branch (3888:37): [True: 0, False: 0]
  |  Branch (3888:57): [True: 0, False: 0]
  |  Branch (3888:78): [True: 0, False: 0]
  ------------------
 3889|      0|               it = line_start;
 3890|      0|               return;
 3891|      0|            }
 3892|       |
 3893|       |            // Skip indented comment lines
 3894|  1.23M|            if (*it == '#') {
  ------------------
  |  Branch (3894:17): [True: 0, False: 1.23M]
  ------------------
 3895|      0|               skip_comment(it, end);
 3896|      0|               first_key = false;
 3897|      0|               continue;
 3898|      0|            }
 3899|       |
 3900|       |            // Skip blank/empty lines after indent
 3901|  1.23M|            if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3901:17): [True: 78, False: 1.23M]
  |  Branch (3901:32): [True: 0, False: 1.23M]
  ------------------
 3902|      0|               first_key = false;
 3903|      0|               continue;
 3904|      0|            }
 3905|       |
 3906|       |            // While parsing an explicit mapping key node ('? key-node'),
 3907|       |            // a subsequent standalone ':' at the same indentation starts
 3908|       |            // the outer value indicator and must terminate this key-node map.
 3909|       |            // Keep same-line ': x' on the first key-node line valid.
 3910|  1.23M|            if (ctx.explicit_mapping_key_context && !established_mapping_indent_this_line && *it == ':') {
  ------------------
  |  Branch (3910:17): [True: 320k, False: 910k]
  |  Branch (3910:53): [True: 75.3k, False: 245k]
  |  Branch (3910:94): [True: 10.8k, False: 64.4k]
  ------------------
 3911|  10.8k|               const auto after_colon = it + 1;
 3912|  10.8k|               const int32_t explicit_value_indicator_indent = (parent_indent < 0) ? 0 : (parent_indent + 1);
  ------------------
  |  Branch (3912:64): [True: 8.51k, False: 2.37k]
  ------------------
 3913|  10.8k|               if ((after_colon == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
  ------------------
  |  Branch (3913:21): [True: 3.29k, False: 7.58k]
  |  Branch (3913:43): [True: 5.03k, False: 2.55k]
  ------------------
 3914|  8.32k|                   line_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (3914:20): [True: 4.15k, False: 4.17k]
  ------------------
 3915|  4.15k|                  it = line_start;
 3916|  4.15k|                  return;
 3917|  4.15k|               }
 3918|  10.8k|            }
 3919|       |
 3920|       |            // Process this mapping entry (key + colon + value)
 3921|  1.22M|            int32_t effective_line_indent = line_indent;
 3922|  1.22M|            if (discover_indent && established_mapping_indent_this_line &&
  ------------------
  |  Branch (3922:17): [True: 1.22M, False: 78]
  |  Branch (3922:36): [True: 766k, False: 460k]
  ------------------
 3923|   766k|                discovered_first_key_visual_indent > effective_line_indent &&
  ------------------
  |  Branch (3923:17): [True: 583k, False: 182k]
  ------------------
 3924|   583k|                !(discovered_first_key_mid_line && parent_indent < 0)) {
  ------------------
  |  Branch (3924:19): [True: 512k, False: 70.8k]
  |  Branch (3924:52): [True: 315k, False: 197k]
  ------------------
 3925|       |               // The first discovered key has no indentation of its own left to measure: it may
 3926|       |               // begin mid-line (a sequence entry's "- key: value"), or the caller may have already
 3927|       |               // consumed the line's indentation before handing the mapping over. Pass its visual
 3928|       |               // column so the entry judges its value against the key's real indent -- otherwise a
 3929|       |               // key with an empty value takes the following sibling line for nested content
 3930|       |               // (issue #2827) and same-line block scalars compute the wrong indentation.
 3931|       |               // The exception is a ROOT mapping whose first key begins mid-line, which means node
 3932|       |               // properties sit ahead of it (`!!str &a1 "foo":`): those belong to the document node
 3933|       |               // rather than to the key's column, so the measured indent stands. Conformance tests
 3934|       |               // 7FWL and HMQ5 pin that case.
 3935|   268k|               effective_line_indent = discovered_first_key_visual_indent;
 3936|   268k|            }
 3937|       |
 3938|  1.22M|            if (!process_entry(ctx, it, end, effective_line_indent)) {
  ------------------
  |  Branch (3938:17): [True: 195k, False: 1.03M]
  ------------------
 3939|   195k|               return;
 3940|   195k|            }
 3941|  1.03M|            first_key = false;
 3942|       |
 3943|  1.03M|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3943:17): [True: 0, False: 1.03M]
  ------------------
 3944|      0|               return;
 3945|       |
 3946|       |            if constexpr (yaml::check_flow_context(Opts)) {
 3947|       |               // In flow context, an implicit "key: value" pair used as a sequence entry
 3948|       |               // ends at ',', ']', or '}'. Let the enclosing flow parser consume it.
 3949|       |               auto flow_end = it;
 3950|       |               skip_flow_ws_and_newlines(ctx, flow_end, end);
 3951|       |               if (bool(ctx.error)) [[unlikely]]
 3952|       |                  return;
 3953|       |               if (flow_end != end && (*flow_end == ',' || *flow_end == ']' || *flow_end == '}')) {
 3954|       |                  it = flow_end;
 3955|       |                  return;
 3956|       |               }
 3957|       |            }
 3958|       |
 3959|       |            // Trailing whitespace handling (peek-ahead pattern).
 3960|       |            // After parsing, iterator may be at leading indent of next line.
 3961|       |            // Don't consume it - let the outer loop handle indent measurement.
 3962|  1.03M|            if (it != end) {
  ------------------
  |  Branch (3962:17): [True: 696k, False: 335k]
  ------------------
 3963|   696k|               if (*it == ' ' || *it == '\t') {
  ------------------
  |  Branch (3963:20): [True: 78.4k, False: 618k]
  |  Branch (3963:34): [True: 7.42k, False: 610k]
  ------------------
 3964|  85.8k|                  auto peek = it;
 3965|  85.8k|                  skip_inline_ws(peek, end);
 3966|  85.8k|                  if (peek != end && *peek != '\n' && *peek != '\r' && *peek != '#') {
  ------------------
  |  Branch (3966:23): [True: 80.1k, False: 5.75k]
  |  Branch (3966:38): [True: 67.7k, False: 12.3k]
  |  Branch (3966:55): [True: 63.1k, False: 4.57k]
  |  Branch (3966:72): [True: 59.9k, False: 3.19k]
  ------------------
 3967|  59.9k|                     continue; // At leading indent of new line
 3968|  59.9k|                  }
 3969|  85.8k|               }
 3970|   636k|               skip_inline_ws(it, end);
 3971|   636k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (3971:20): [True: 630k, False: 5.75k]
  |  Branch (3971:33): [True: 29.3k, False: 601k]
  ------------------
 3972|  29.3k|                  if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3973|  29.3k|                     if (it > line_start) {
  ------------------
  |  Branch (3973:26): [True: 29.3k, False: 0]
  ------------------
 3974|  29.3k|                        const char prev = *(it - 1);
 3975|  29.3k|                        if (prev != ' ' && prev != '\t' && prev != '\n' && prev != '\r') {
  ------------------
  |  Branch (3975:29): [True: 13.0k, False: 16.2k]
  |  Branch (3975:44): [True: 6.92k, False: 6.11k]
  |  Branch (3975:60): [True: 1.82k, False: 5.09k]
  |  Branch (3975:76): [True: 8, False: 1.81k]
  ------------------
 3976|      8|                           ctx.error = error_code::syntax_error;
 3977|      8|                           return;
 3978|      8|                        }
 3979|  29.3k|                     }
 3980|  29.3k|                  }
 3981|  29.3k|               }
 3982|  29.3k|               skip_comment(it, end);
 3983|   636k|               if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (3983:20): [True: 629k, False: 6.99k]
  |  Branch (3983:34): [True: 188k, False: 441k]
  |  Branch (3983:49): [True: 239k, False: 202k]
  ------------------
 3984|   427k|                  skip_newline(it, end);
 3985|   427k|               }
 3986|   209k|               else if (it != end) {
  ------------------
  |  Branch (3986:25): [True: 202k, False: 6.99k]
  ------------------
 3987|       |                  // The entry stopped part way along its line with something other than
 3988|       |                  // whitespace or a comment after it -- a ':' its value could not take as a
 3989|       |                  // separator, say. The next pass measures indent as though this were the start
 3990|       |                  // of a line, so what is left of the real one is lost; reject it instead.
 3991|   202k|                  if constexpr (requires { ctx.line_prefix_before(it); }) {
 3992|   202k|                     if (ctx.line_prefix_before(it).has_content) {
  ------------------
  |  Branch (3992:26): [True: 30, False: 202k]
  ------------------
 3993|     30|                        ctx.error = error_code::syntax_error;
 3994|     30|                        return;
 3995|     30|                     }
 3996|   202k|                  }
 3997|   202k|               }
 3998|   636k|            }
 3999|  1.03M|         }
 4000|   766k|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_i:
 4927|  1.22M|               ctx, it, end, int32_t(-1), [&](auto& ctx, auto& it, auto end, int32_t line_indent) -> bool {
 4928|  1.22M|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|  1.22M|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 4930|  1.22M|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|  1.22M|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|  1.22M|                           if (ctx.stream_begin) {
 4938|  1.22M|                              auto is_line_content_start = [&](auto pos) {
 4939|  1.22M|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|  1.22M|                              };
 4941|       |
 4942|  1.22M|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|  1.22M|                                 const char* line = ctx.line_begin_of(pos);
 4944|  1.22M|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|  1.22M|                                 return line != end && *line == ':';
 4946|  1.22M|                              };
 4947|       |
 4948|  1.22M|                              if (!is_line_content_start(it) &&
 4949|  1.22M|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
 4950|  1.22M|                                  !line_has_explicit_value_indicator(it)) {
 4951|  1.22M|                                 ctx.error = error_code::syntax_error;
 4952|  1.22M|                                 return false;
 4953|  1.22M|                              }
 4954|  1.22M|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|  1.22M|                           }
 4956|  1.22M|                        }
 4957|       |
 4958|  1.22M|                        if (*it == '-' &&
 4959|  1.22M|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
 4960|  1.22M|                            !line_starts_with_explicit_value_indicator) {
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|  1.22M|                           ctx.error = error_code::syntax_error;
 4963|  1.22M|                           return false;
 4964|  1.22M|                        }
 4965|       |
 4966|  1.22M|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 4967|  1.22M|                           return false;
 4968|  1.22M|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|  1.22M|                        ctx.pop_indent();
 4970|  1.22M|                     }
 4971|  1.22M|                     else {
 4972|  1.22M|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|  1.22M|                        if (nested_indent >= 0) {
 4974|  1.22M|                           yaml::skip_to_content(it, end);
 4975|  1.22M|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
 4976|  1.22M|                              ctx.error = error_code::syntax_error;
 4977|  1.22M|                              return false;
 4978|  1.22M|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|  1.22M|                           const int32_t value_indent =
 4982|  1.22M|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
 4983|  1.22M|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
 4984|  1.22M|                              return false;
 4985|  1.22M|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|  1.22M|                           ctx.pop_indent();
 4987|  1.22M|                        }
 4988|  1.22M|                     }
 4989|  1.22M|                     return !bool(ctx.error);
 4990|  1.22M|                  };
 4991|       |
 4992|       |                  // Explicit key entry form:
 4993|       |                  // ? key
 4994|       |                  // : value
 4995|  1.22M|                  if (*it == '?' && ((it + 1) != end) && *(it + 1) == '\t') {
  ------------------
  |  Branch (4995:23): [True: 535k, False: 691k]
  |  Branch (4995:37): [True: 533k, False: 1.67k]
  |  Branch (4995:58): [True: 8, False: 533k]
  ------------------
 4996|      8|                     ctx.error = error_code::syntax_error;
 4997|      8|                     return false;
 4998|      8|                  }
 4999|  1.22M|                  if (*it == '?' && ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\n' || *(it + 1) == '\r')) {
  ------------------
  |  Branch (4999:23): [True: 535k, False: 691k]
  |  Branch (4999:38): [True: 1.67k, False: 533k]
  |  Branch (4999:57): [True: 218k, False: 314k]
  |  Branch (4999:77): [True: 181k, False: 133k]
  |  Branch (4999:98): [True: 112k, False: 20.7k]
  ------------------
 5000|   514k|                     ++it; // skip '?'
 5001|   514k|                     yaml::skip_inline_ws(it, end);
 5002|       |
 5003|   514k|                     const int32_t explicit_value_indicator_indent =
 5004|   514k|                        (ctx.current_indent() < 0) ? 0 : (ctx.current_indent() + 1);
  ------------------
  |  Branch (5004:25): [True: 362k, False: 151k]
  ------------------
 5005|       |
 5006|   514k|                     key_t key{};
 5007|   514k|                     if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5008|   514k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   514k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   514k|                        };
 5011|       |
 5012|   514k|                        auto key_it = it;
 5013|   514k|                        yaml::skip_inline_ws(key_it, end);
 5014|       |
 5015|   514k|                        auto content = key_it;
 5016|   514k|                        yaml::skip_to_content(content, end);
 5017|   514k|                        bool handled_anchor_only_empty_key = false;
 5018|       |
 5019|       |                        // Anchor on an empty explicit key node:
 5020|       |                        //   ? &a
 5021|       |                        //   : value
 5022|   514k|                        if (content != end && *content == '&') {
  ------------------
  |  Branch (5022:29): [True: 506k, False: 8.34k]
  |  Branch (5022:47): [True: 107k, False: 398k]
  ------------------
 5023|   107k|                           auto anchor_probe = content + 1;
 5024|   107k|                           auto anchor_name = yaml::parse_anchor_name(anchor_probe, end);
 5025|   107k|                           if (!anchor_name.empty()) {
  ------------------
  |  Branch (5025:32): [True: 107k, False: 26]
  ------------------
 5026|   107k|                              auto after_anchor = anchor_probe;
 5027|   107k|                              yaml::skip_inline_ws(after_anchor, end);
 5028|       |
 5029|   107k|                              auto value_indicator = after_anchor;
 5030|   107k|                              if (value_indicator != end && *value_indicator == ':') {
  ------------------
  |  Branch (5030:35): [True: 101k, False: 6.24k]
  |  Branch (5030:61): [True: 7.25k, False: 93.9k]
  ------------------
 5031|  7.25k|                                 key.clear();
 5032|  7.25k|                                 ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5033|  7.25k|                                 it = value_indicator;
 5034|  7.25k|                                 handled_anchor_only_empty_key = true;
 5035|  7.25k|                              }
 5036|   100k|                              else {
 5037|   100k|                                 if (value_indicator != end && *value_indicator == '#') {
  ------------------
  |  Branch (5037:38): [True: 93.9k, False: 6.24k]
  |  Branch (5037:64): [True: 11.4k, False: 82.4k]
  ------------------
 5038|  11.4k|                                    yaml::skip_comment(value_indicator, end);
 5039|  11.4k|                                 }
 5040|   100k|                                 if (value_indicator != end && (*value_indicator == '\n' || *value_indicator == '\r')) {
  ------------------
  |  Branch (5040:38): [True: 93.4k, False: 6.72k]
  |  Branch (5040:65): [True: 20.6k, False: 72.8k]
  |  Branch (5040:93): [True: 27.5k, False: 45.2k]
  ------------------
 5041|  48.1k|                                    yaml::skip_newline(value_indicator, end);
 5042|  48.1k|                                    auto value_line = value_indicator;
 5043|  48.1k|                                    int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5044|  48.1k|                                    if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5044:41): [True: 6, False: 48.1k]
  ------------------
 5045|      6|                                       return false;
 5046|  48.1k|                                    if (value_line != end && *value_line == ':' &&
  ------------------
  |  Branch (5046:41): [True: 45.3k, False: 2.80k]
  |  Branch (5046:62): [True: 2.13k, False: 43.2k]
  ------------------
 5047|  2.13k|                                        value_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (5047:41): [True: 2.13k, False: 6]
  ------------------
 5048|  2.13k|                                       key.clear();
 5049|  2.13k|                                       ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5050|  2.13k|                                       it = value_line;
 5051|  2.13k|                                       handled_anchor_only_empty_key = true;
 5052|  2.13k|                                    }
 5053|  46.0k|                                    else if (value_line != end && *value_line == ':') {
  ------------------
  |  Branch (5053:46): [True: 43.2k, False: 2.80k]
  |  Branch (5053:67): [True: 6, False: 43.2k]
  ------------------
 5054|       |                                       // In explicit-key form ("? &a"), a following ':'
 5055|       |                                       // starts the outer value indicator only at the same
 5056|       |                                       // indentation. A deeper-indented ': value' is malformed.
 5057|      6|                                       ctx.error = error_code::syntax_error;
 5058|      6|                                       return false;
 5059|      6|                                    }
 5060|  48.1k|                                 }
 5061|   100k|                              }
 5062|   107k|                           }
 5063|   107k|                        }
 5064|       |
 5065|   514k|                        const bool key_content_spans_lines = [&] {
 5066|   514k|                           auto scan = key_it;
 5067|   514k|                           while (scan != content && scan != end) {
 5068|   514k|                              if (*scan == '\n' || *scan == '\r') return true;
 5069|   514k|                              ++scan;
 5070|   514k|                           }
 5071|   514k|                           return false;
 5072|   514k|                        }();
 5073|       |
 5074|   514k|                        if (handled_anchor_only_empty_key) {
  ------------------
  |  Branch (5074:29): [True: 9.38k, False: 505k]
  ------------------
 5075|       |                           // 'it' already points to the explicit value indicator ':'
 5076|  9.38k|                        }
 5077|   505k|                        else if (content == end || (*content == ':' && key_content_spans_lines)) {
  ------------------
  |  Branch (5077:34): [True: 8.34k, False: 496k]
  |  Branch (5077:53): [True: 29.4k, False: 467k]
  |  Branch (5077:72): [True: 24.4k, False: 5.07k]
  ------------------
 5078|  32.7k|                           key.clear();
 5079|  32.7k|                           it = content;
 5080|  32.7k|                        }
 5081|   472k|                        else {
 5082|       |                           // Explicit mapping keys ('? key-node') are full YAML nodes.
 5083|       |                           // Parse the key node structurally (not via plain-key scanning)
 5084|       |                           // so inputs like '? []: x' and '? JSON: like' are interpreted
 5085|       |                           // as complex keys, not split into implicit key/value pairs.
 5086|   472k|                           auto key_node_it = content;
 5087|   472k|                           auto key_node_end = end;
 5088|   472k|                           if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 5089|       |                              // In explicit-key form, a following standalone ':'
 5090|       |                              // line (same or lower indentation) belongs to the
 5091|       |                              // outer mapping value, not the key node itself.
 5092|   472k|                              auto scan = content;
 5093|  3.43M|                              while (scan != end) {
  ------------------
  |  Branch (5093:38): [True: 3.27M, False: 158k]
  ------------------
 5094|   151M|                                 while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (5094:41): [True: 151M, False: 249k]
  |  Branch (5094:56): [True: 149M, False: 1.50M]
  |  Branch (5094:73): [True: 148M, False: 1.51M]
  ------------------
 5095|   148M|                                    ++scan;
 5096|   148M|                                 }
 5097|  3.27M|                                 if (scan == end) {
  ------------------
  |  Branch (5097:38): [True: 249k, False: 3.02M]
  ------------------
 5098|   249k|                                    break;
 5099|   249k|                                 }
 5100|       |
 5101|  3.02M|                                 yaml::skip_newline(scan, end);
 5102|  3.02M|                                 auto line_start = scan;
 5103|       |
 5104|  3.02M|                                 int32_t indicator_indent = 0;
 5105|  5.47M|                                 while (scan != end && *scan == ' ') {
  ------------------
  |  Branch (5105:41): [True: 5.31M, False: 158k]
  |  Branch (5105:56): [True: 2.44M, False: 2.86M]
  ------------------
 5106|  2.44M|                                    ++indicator_indent;
 5107|  2.44M|                                    ++scan;
 5108|  2.44M|                                 }
 5109|       |
 5110|  3.02M|                                 if (scan != end && *scan == ':') {
  ------------------
  |  Branch (5110:38): [True: 2.86M, False: 158k]
  |  Branch (5110:53): [True: 124k, False: 2.74M]
  ------------------
 5111|   124k|                                    const auto after_colon = scan + 1;
 5112|   124k|                                    if ((after_colon == end ||
  ------------------
  |  Branch (5112:42): [True: 4.20k, False: 120k]
  ------------------
 5113|   120k|                                         yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
  ------------------
  |  Branch (5113:42): [True: 78.1k, False: 42.0k]
  ------------------
 5114|  82.3k|                                        indicator_indent <= line_indent) {
  ------------------
  |  Branch (5114:41): [True: 64.8k, False: 17.5k]
  ------------------
 5115|  64.8k|                                       key_node_end = line_start;
 5116|  64.8k|                                       break;
 5117|  64.8k|                                    }
 5118|   124k|                                 }
 5119|  3.02M|                              }
 5120|   472k|                           }
 5121|       |
 5122|   472k|                           glz::generic key_node{};
 5123|   472k|                           const bool prev_explicit_mapping_key_context = ctx.explicit_mapping_key_context;
 5124|   472k|                           ctx.explicit_mapping_key_context = true;
 5125|   472k|                           from<YAML, glz::generic>::template op<Opts>(key_node, ctx, key_node_it, key_node_end);
 5126|   472k|                           ctx.explicit_mapping_key_context = prev_explicit_mapping_key_context;
 5127|   472k|                           if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5127:32): [True: 23.3k, False: 449k]
  ------------------
 5128|  23.3k|                              return false;
 5129|   449k|                           it = key_node_it;
 5130|   449k|                           if (!to_string_key(key_node)) [[unlikely]]
  ------------------
  |  Branch (5130:32): [True: 6, False: 449k]
  ------------------
 5131|      6|                              return false;
 5132|   449k|                        }
 5133|       |                     }
 5134|       |                     else {
 5135|       |                        if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 5136|       |                           from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5137|       |                           if (bool(ctx.error)) [[unlikely]]
 5138|       |                              return false;
 5139|       |                        }
 5140|       |                     }
 5141|       |
 5142|   491k|                     yaml::skip_inline_ws(it, end);
 5143|   514k|                     yaml::skip_comment(it, end);
 5144|       |
 5145|       |                     // Value indicator may appear on the next line at the same indent.
 5146|   514k|                     if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (5146:26): [True: 379k, False: 134k]
  |  Branch (5146:40): [True: 92.8k, False: 287k]
  |  Branch (5146:55): [True: 135k, False: 151k]
  ------------------
 5147|   228k|                        auto probe = it;
 5148|   228k|                        bool found_value_indicator = false;
 5149|       |
 5150|   330k|                        while (probe != end && (*probe == '\n' || *probe == '\r')) {
  ------------------
  |  Branch (5150:32): [True: 279k, False: 51.4k]
  |  Branch (5150:49): [True: 111k, False: 168k]
  |  Branch (5150:67): [True: 168k, False: 0]
  ------------------
 5151|   279k|                           yaml::skip_newline(probe, end);
 5152|       |
 5153|   279k|                           auto value_line = probe;
 5154|   279k|                           int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5155|   279k|                           if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5155:32): [True: 6, False: 279k]
  ------------------
 5156|      6|                              return false;
 5157|       |
 5158|   279k|                           if (value_line == end || *value_line == '\n' || *value_line == '\r') {
  ------------------
  |  Branch (5158:32): [True: 50.2k, False: 229k]
  |  Branch (5158:53): [True: 10.3k, False: 218k]
  |  Branch (5158:76): [True: 26.1k, False: 192k]
  ------------------
 5159|  86.6k|                              probe = value_line;
 5160|  86.6k|                              continue; // blank line
 5161|  86.6k|                           }
 5162|   192k|                           if (*value_line == '#') {
  ------------------
  |  Branch (5162:32): [True: 15.5k, False: 177k]
  ------------------
 5163|  15.5k|                              yaml::skip_comment(value_line, end);
 5164|  15.5k|                              probe = value_line;
 5165|  15.5k|                              continue; // comment-only line
 5166|  15.5k|                           }
 5167|   177k|                           if (*value_line == ':' && value_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (5167:32): [True: 27.7k, False: 149k]
  |  Branch (5167:54): [True: 24.1k, False: 3.55k]
  ------------------
 5168|  24.1k|                              it = value_line;
 5169|  24.1k|                              found_value_indicator = true;
 5170|  24.1k|                           }
 5171|   177k|                           break;
 5172|   192k|                        }
 5173|       |
 5174|   228k|                        if (found_value_indicator) {
  ------------------
  |  Branch (5174:29): [True: 24.1k, False: 204k]
  ------------------
 5175|  24.1k|                           yaml::skip_inline_ws(it, end);
 5176|  24.1k|                        }
 5177|   228k|                     }
 5178|       |
 5179|   514k|                     val_t val{};
 5180|   514k|                     if (it != end && *it == ':') {
  ------------------
  |  Branch (5180:26): [True: 379k, False: 134k]
  |  Branch (5180:39): [True: 128k, False: 251k]
  ------------------
 5181|   128k|                        ++it;
 5182|   128k|                        if (it != end && *it == '\t') {
  ------------------
  |  Branch (5182:29): [True: 127k, False: 1.21k]
  |  Branch (5182:42): [True: 10, False: 127k]
  ------------------
 5183|     10|                           ctx.error = error_code::syntax_error;
 5184|     10|                           return false;
 5185|     10|                        }
 5186|   128k|                        if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (5186:29): [True: 127k, False: 1.21k]
  |  Branch (5186:43): [True: 15.4k, False: 111k]
  |  Branch (5186:58): [True: 23.1k, False: 88.7k]
  ------------------
 5187|  38.6k|                           auto probe = it;
 5188|  38.6k|                           yaml::skip_newline(probe, end);
 5189|   100k|                           while (probe != end && *probe == ' ') ++probe;
  ------------------
  |  Branch (5189:35): [True: 96.7k, False: 3.74k]
  |  Branch (5189:51): [True: 61.8k, False: 34.8k]
  ------------------
 5190|  38.6k|                           if (probe != end && *probe == ':' && ((probe + 1) != end) && *(probe + 1) == '\t') {
  ------------------
  |  Branch (5190:32): [True: 34.8k, False: 3.74k]
  |  Branch (5190:48): [True: 6.09k, False: 28.8k]
  |  Branch (5190:65): [True: 2.74k, False: 3.34k]
  |  Branch (5190:89): [True: 6, False: 2.74k]
  ------------------
 5191|      6|                              ctx.error = error_code::syntax_error;
 5192|      6|                              return false;
 5193|      6|                           }
 5194|  38.6k|                        }
 5195|   128k|                        yaml::skip_inline_ws(it, end);
 5196|   128k|                        if (!parse_map_value(val)) [[unlikely]]
  ------------------
  |  Branch (5196:29): [True: 1.79k, False: 126k]
  ------------------
 5197|  1.79k|                           return false;
 5198|   128k|                     }
 5199|       |
 5200|   512k|                     value.emplace(std::move(key), std::move(val));
 5201|   512k|                     return true;
 5202|   514k|                  }
 5203|       |
 5204|   712k|                  key_t key{};
 5205|   712k|                  if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5206|   712k|                     auto key_probe = it;
 5207|   712k|                     yaml::skip_inline_ws(key_probe, end);
 5208|   712k|                     const bool complex_flow_key = (key_probe != end && (*key_probe == '[' || *key_probe == '{'));
  ------------------
  |  Branch (5208:53): [True: 712k, False: 0]
  |  Branch (5208:74): [True: 9.33k, False: 703k]
  |  Branch (5208:95): [True: 6.49k, False: 696k]
  ------------------
 5209|   712k|                     if (complex_flow_key) {
  ------------------
  |  Branch (5209:26): [True: 15.8k, False: 696k]
  ------------------
 5210|  15.8k|                        glz::generic key_node{};
 5211|  15.8k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 5212|  15.8k|                        if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5212:29): [True: 958, False: 14.8k]
  ------------------
 5213|    958|                           return false;
 5214|  14.8k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (5214:29): [True: 6, False: 14.8k]
  ------------------
 5215|      6|                           return false;
 5216|  14.8k|                     }
 5217|   696k|                     else {
 5218|   696k|                        if (!yaml::parse_yaml_key(key, ctx, it, end, false)) {
  ------------------
  |  Branch (5218:29): [True: 160k, False: 535k]
  ------------------
 5219|   160k|                           return false;
 5220|   160k|                        }
 5221|   696k|                     }
 5222|       |                  }
 5223|       |                  else {
 5224|       |                     from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5225|       |                     if (bool(ctx.error)) [[unlikely]]
 5226|       |                        return false;
 5227|       |                  }
 5228|       |
 5229|   550k|                  yaml::skip_inline_ws(it, end);
 5230|       |
 5231|   712k|                  if (it == end || *it != ':') {
  ------------------
  |  Branch (5231:23): [True: 161k, False: 550k]
  |  Branch (5231:36): [True: 42, False: 550k]
  ------------------
 5232|    164|                     ctx.error = error_code::syntax_error;
 5233|    164|                     return false;
 5234|    164|                  }
 5235|   712k|                  ++it;
 5236|   712k|                  yaml::skip_inline_ws(it, end);
 5237|       |
 5238|   712k|                  val_t val{};
 5239|   712k|                  if (!parse_map_value(val)) [[unlikely]]
  ------------------
  |  Branch (5239:23): [True: 8.42k, False: 703k]
  ------------------
 5240|  8.42k|                     return false;
 5241|       |
 5242|   703k|                  value.emplace(std::move(key), std::move(val));
 5243|   703k|                  return true;
 5244|   712k|               });
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlvE_clEv:
 5065|   514k|                        const bool key_content_spans_lines = [&] {
 5066|   514k|                           auto scan = key_it;
 5067|   540k|                           while (scan != content && scan != end) {
  ------------------
  |  Branch (5067:35): [True: 334k, False: 205k]
  |  Branch (5067:54): [True: 334k, False: 0]
  ------------------
 5068|   334k|                              if (*scan == '\n' || *scan == '\r') return true;
  ------------------
  |  Branch (5068:35): [True: 185k, False: 149k]
  |  Branch (5068:52): [True: 123k, False: 25.6k]
  ------------------
 5069|  25.6k|                              ++scan;
 5070|  25.6k|                           }
 5071|   205k|                           return false;
 5072|   514k|                        }();
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E0_clESS_:
 5008|   449k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   449k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   449k|                        };
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E_clESS_:
 4928|   679k|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|   679k|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (4929:26): [True: 637k, False: 41.9k]
  |  Branch (4929:39): [True: 411k, False: 225k]
  ------------------
 4930|   411k|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|   411k|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|   411k|                           if (ctx.stream_begin) {
  ------------------
  |  Branch (4937:32): [True: 411k, False: 0]
  ------------------
 4938|   411k|                              auto is_line_content_start = [&](auto pos) {
 4939|   411k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   411k|                              };
 4941|       |
 4942|   411k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   411k|                                 const char* line = ctx.line_begin_of(pos);
 4944|   411k|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|   411k|                                 return line != end && *line == ':';
 4946|   411k|                              };
 4947|       |
 4948|   411k|                              if (!is_line_content_start(it) &&
  ------------------
  |  Branch (4948:35): [True: 411k, False: 0]
  ------------------
 4949|   411k|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
  ------------------
  |  Branch (4949:35): [True: 23.1k, False: 388k]
  ------------------
 4950|  23.1k|                                  !line_has_explicit_value_indicator(it)) {
  ------------------
  |  Branch (4950:35): [True: 26, False: 23.1k]
  ------------------
 4951|     26|                                 ctx.error = error_code::syntax_error;
 4952|     26|                                 return false;
 4953|     26|                              }
 4954|   411k|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|   411k|                           }
 4956|   411k|                        }
 4957|       |
 4958|   411k|                        if (*it == '-' &&
  ------------------
  |  Branch (4958:29): [True: 16.2k, False: 395k]
  ------------------
 4959|  16.2k|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
  ------------------
  |  Branch (4959:30): [True: 562, False: 15.7k]
  |  Branch (4959:49): [True: 4.90k, False: 10.7k]
  ------------------
 4960|  5.47k|                            !line_starts_with_explicit_value_indicator) {
  ------------------
  |  Branch (4960:29): [True: 18, False: 5.45k]
  ------------------
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|     18|                           ctx.error = error_code::syntax_error;
 4963|     18|                           return false;
 4964|     18|                        }
 4965|       |
 4966|   411k|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
  ------------------
  |  Branch (4966:29): [True: 0, False: 411k]
  ------------------
 4967|      0|                           return false;
 4968|   411k|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|   411k|                        ctx.pop_indent();
 4970|   411k|                     }
 4971|   267k|                     else {
 4972|   267k|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|   267k|                        if (nested_indent >= 0) {
  ------------------
  |  Branch (4973:29): [True: 60.0k, False: 207k]
  ------------------
 4974|  60.0k|                           yaml::skip_to_content(it, end);
 4975|  60.0k|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
  ------------------
  |  Branch (4975:32): [True: 60.0k, False: 0]
  |  Branch (4975:45): [True: 0, False: 60.0k]
  |  Branch (4975:59): [True: 0, False: 0]
  |  Branch (4975:78): [True: 0, False: 0]
  ------------------
 4976|      0|                              ctx.error = error_code::syntax_error;
 4977|      0|                              return false;
 4978|      0|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|  60.0k|                           const int32_t value_indent =
 4982|  60.0k|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
  ------------------
  |  Branch (4982:31): [Folded, False: 60.0k]
  ------------------
 4983|  60.0k|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
  ------------------
  |  Branch (4983:32): [True: 0, False: 60.0k]
  ------------------
 4984|      0|                              return false;
 4985|  60.0k|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|  60.0k|                           ctx.pop_indent();
 4987|  60.0k|                        }
 4988|   267k|                     }
 4989|   679k|                     return !bool(ctx.error);
 4990|   679k|                  };
_ZZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E_clESS_ENKUlSN_E_clISA_EEDaSN_:
 4938|   411k|                              auto is_line_content_start = [&](auto pos) {
 4939|   411k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   411k|                              };
_ZZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E_clESS_ENKUlSN_E0_clISA_EEDaSN_:
 4942|   434k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   434k|                                 const char* line = ctx.line_begin_of(pos);
 4944|  1.00M|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
  ------------------
  |  Branch (4944:41): [True: 1.00M, False: 0]
  |  Branch (4944:57): [True: 567k, False: 436k]
  |  Branch (4944:73): [True: 1.24k, False: 434k]
  ------------------
 4945|   434k|                                 return line != end && *line == ':';
  ------------------
  |  Branch (4945:41): [True: 434k, False: 0]
  |  Branch (4945:56): [True: 200k, False: 234k]
  ------------------
 4946|   434k|                              };
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_EN19merge_restore_guardD2Ev:
 4696|   894k|            {
 4697|       |               // emplace is a no-op for keys the document already wrote, so only
 4698|       |               // untouched pre-existing entries are put back.
 4699|   894k|               for (auto& entry : saved) {
  ------------------
  |  Branch (4699:33): [True: 0, False: 894k]
  ------------------
 4700|      0|                  target.emplace(entry.first, std::move(entry.second));
 4701|      0|               }
 4702|   894k|            }
_ZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE10redispatchITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_:
 6762|   450k|      {
 6763|   450k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 6764|   450k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (6764:14): [True: 444, False: 450k]
  ------------------
 6765|    444|            return;
 6766|   450k|         op<Opts>(value, ctx, it, end);
 6767|   450k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERNSt3__17variantIJDndNS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbNS3_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS8_ISF_EEEENSE_ISF_EEEEENS0_12yaml_contextEPKcSN_EEbOT0_RT1_RT2_T3_:
  309|  36.0k|      {
  310|  36.0k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 36.0k]
  |  Branch (310:27): [True: 0, False: 36.0k]
  ------------------
  311|       |
  312|  36.0k|         ++it; // skip '*'
  313|  36.0k|         auto name = parse_anchor_name(it, end);
  314|  36.0k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 32, False: 35.9k]
  ------------------
  315|     32|            ctx.error = error_code::syntax_error;
  316|     32|            return true;
  317|     32|         }
  318|       |
  319|  35.9k|         auto anchor_it = ctx.anchors.find(name);
  320|  35.9k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 46, False: 35.9k]
  ------------------
  321|     46|            ctx.error = error_code::syntax_error; // undefined alias
  322|     46|            return true;
  323|     46|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  35.9k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  35.9k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 3.31k, False: 32.6k]
  ------------------
  331|  3.31k|            return true;
  332|  3.31k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  32.6k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 696, False: 31.9k]
  ------------------
  338|    696|            ctx.error = error_code::syntax_error; // cyclic alias
  339|    696|            return true;
  340|    696|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  31.9k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  31.9k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 6, False: 31.9k]
  ------------------
  348|      6|            return true;
  349|       |
  350|  31.9k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 6, False: 31.9k]
  ------------------
  351|      6|            ctx.error = error_code::exceeded_max_expansion;
  352|      6|            ctx.custom_error_message = "alias expansion";
  353|      6|            return true;
  354|      6|         }
  355|       |
  356|  31.9k|         auto replay_it = span.begin;
  357|  31.9k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  31.9k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  31.9k|         ctx.indent_stack.clear();
  362|  31.9k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 12.6k, False: 19.2k]
  ------------------
  363|  12.6k|            ctx.push_indent(span.base_indent - 1);
  364|  12.6k|         }
  365|       |
  366|  31.9k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  31.9k|         using V = std::remove_cvref_t<T>;
  369|  31.9k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  31.9k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  31.9k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  31.9k|         return true;
  376|  31.9k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_19is_yaml_variant_strEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   505k|      {
 5356|   505k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   505k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   505k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   505k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   505k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 505k, False: 0]
  ------------------
 5366|   505k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   505k|      }
_ZN3glz4fromILj450ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRS7_TkNS_10is_contextERNS_4yaml12yaml_contextESC_EEvOT1_OT2_OT0_T3_:
 1987|   532k|      {
 1988|   532k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (1988:14): [True: 17.4k, False: 515k]
  ------------------
 1989|  17.4k|            return;
 1990|       |
 1991|   515k|         yaml::node_preamble_state preamble{};
 1992|   515k|         if (yaml::parse_node_preamble<Opts, yaml::node_property_policy{true, false, false, true}>(
  ------------------
  |  Branch (1992:14): [True: 34.8k, False: 480k]
  ------------------
 1993|   515k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_string(tag); }))
 1994|  34.8k|            return;
 1995|       |
 1996|   480k|         std::string str;
 1997|   480k|         const auto style = yaml::detect_scalar_style(*it);
 1998|       |
 1999|   480k|         switch (style) {
  ------------------
  |  Branch (1999:18): [True: 480k, False: 0]
  ------------------
 2000|  9.68k|         case yaml::scalar_style::double_quoted:
  ------------------
  |  Branch (2000:10): [True: 9.68k, False: 470k]
  ------------------
 2001|  9.68k|            yaml::parse_double_quoted_string(str, ctx, it, end);
 2002|  9.68k|            break;
 2003|  7.11k|         case yaml::scalar_style::single_quoted:
  ------------------
  |  Branch (2003:10): [True: 7.11k, False: 473k]
  ------------------
 2004|  7.11k|            yaml::parse_single_quoted_string(str, ctx, it, end);
 2005|  7.11k|            break;
 2006|  3.99k|         case yaml::scalar_style::literal_block:
  ------------------
  |  Branch (2006:10): [True: 3.99k, False: 476k]
  ------------------
 2007|  14.9k|         case yaml::scalar_style::folded_block:
  ------------------
  |  Branch (2007:10): [True: 10.9k, False: 469k]
  ------------------
 2008|       |            // For same-line mapping/sequence values, parsing context is typically pushed
 2009|       |            // one column past the key/item indicator; block scalar indentation is relative
 2010|       |            // to the parent line indent.
 2011|  14.9k|            yaml::parse_block_scalar(str, ctx, it, end,
 2012|  14.9k|                                     ctx.current_indent() > 0 ? (ctx.current_indent() - 1) : ctx.current_indent());
  ------------------
  |  Branch (2012:38): [True: 5.48k, False: 9.45k]
  ------------------
 2013|  14.9k|            break;
 2014|   448k|         case yaml::scalar_style::plain:
  ------------------
  |  Branch (2014:10): [True: 448k, False: 31.7k]
  ------------------
 2015|       |            // A collection where a string is expected is a type mismatch. Reading it as a
 2016|       |            // plain scalar would store its source text, and for a block sequence only the
 2017|       |            // first entry, as the value.
 2018|   448k|            if (yaml::plain_scalar_starts_collection(it, end)) [[unlikely]] {
  ------------------
  |  Branch (2018:17): [True: 56, False: 448k]
  ------------------
 2019|     56|               ctx.error = error_code::syntax_error;
 2020|     56|               return;
 2021|     56|            }
 2022|       |            // In block context with known indent, use multiline parsing to support
 2023|       |            // plain scalars that span multiple lines (folding behavior)
 2024|   448k|            if constexpr (!yaml::check_flow_context(Opts)) {
 2025|   448k|               if (ctx.current_indent() >= 0) {
  ------------------
  |  Branch (2025:20): [True: 262k, False: 186k]
  ------------------
 2026|   262k|                  yaml::parse_plain_scalar_multiline(str, ctx, it, end, ctx.current_indent());
 2027|   262k|               }
 2028|   186k|               else {
 2029|       |                  // Top-level plain scalars may continue on same-indent or indented lines.
 2030|   186k|                  yaml::parse_plain_scalar_multiline(str, ctx, it, end, int32_t(0));
 2031|   186k|               }
 2032|       |            }
 2033|       |            else {
 2034|       |               yaml::parse_plain_scalar(str, ctx, it, end, true);
 2035|       |            }
 2036|   448k|            break;
 2037|   480k|         }
 2038|       |
 2039|   480k|         if (!bool(ctx.error)) {
  ------------------
  |  Branch (2039:14): [True: 480k, False: 178]
  ------------------
 2040|   480k|            value = std::move(str);
 2041|   480k|            yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 2042|   480k|         }
 2043|   480k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEEXtlNS0_20node_property_policyELb1ELb0ELb0ELb1EEELb0ERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_12yaml_contextEPKcSE_ZNS_4fromILj450ESA_E2opITnDaXtlS2_Lj10ELb1ELb0ELb0ELb1EEERSE_SB_TkNS_10is_contextERSC_SE_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSN_RSQ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   515k|      {
  475|   515k|         skip_inline_ws(it, end);
  476|       |
  477|   515k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 14, False: 515k]
  ------------------
  478|     14|            if constexpr (!AllowEmptyInput) {
  479|     14|               ctx.error = error_code::unexpected_end;
  480|     14|            }
  481|     14|            return true;
  482|     14|         }
  483|       |
  484|   515k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   515k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 6, False: 515k]
  ------------------
  486|      6|            ctx.error = error_code::syntax_error;
  487|      6|            return true;
  488|      6|         }
  489|   515k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 6, False: 515k]
  ------------------
  490|      6|            ctx.error = error_code::syntax_error;
  491|      6|            return true;
  492|      6|         }
  493|       |
  494|   515k|         skip_inline_ws(it, end);
  495|       |
  496|   515k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 6, False: 515k]
  ------------------
  497|      6|            if constexpr (!AllowEmptyInput) {
  498|      6|               ctx.error = error_code::unexpected_end;
  499|      6|            }
  500|      6|            return true;
  501|      6|         }
  502|       |
  503|   515k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 34.8k, False: 480k]
  ------------------
  504|  34.8k|            return true;
  505|  34.8k|         }
  506|       |
  507|   480k|         return false;
  508|   515k|      }
_ZZN3glz4fromILj450ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRS7_TkNS_10is_contextERNS_4yaml12yaml_contextESC_EEvOT1_OT2_OT0_T3_ENKUlNSF_8yaml_tagEE_clESP_:
 1993|   515k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_string(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEEXtlNS0_20node_property_policyELb1ELb0ELb0ELb1EEERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_12yaml_contextEPKcSE_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   515k|      {
  418|   515k|         state.has_anchor = false;
  419|   515k|         state.anchor_name.clear();
  420|   515k|         state.anchor_start = nullptr;
  421|   515k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   515k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|   515k|            else {
  430|   515k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 34.7k, False: 480k]
  ------------------
  431|   515k|            }
  432|   515k|         }
  433|       |
  434|   515k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 480k, False: 34.7k]
  |  Branch (434:27): [True: 12.8k, False: 467k]
  ------------------
  435|  12.8k|            ++it;
  436|  12.8k|            auto name = parse_anchor_name(it, end);
  437|  12.8k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 30, False: 12.8k]
  ------------------
  438|     30|               ctx.error = error_code::syntax_error;
  439|     30|               return true;
  440|     30|            }
  441|  12.8k|            skip_inline_ws(it, end);
  442|  12.8k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 20, False: 12.7k]
  ------------------
  443|     20|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     20|                  ctx.error = error_code::unexpected_end;
  445|     20|               }
  446|     20|               return true;
  447|     20|            }
  448|  12.7k|            if constexpr (Policy.disallow_anchor_on_alias) {
  449|  12.7k|               if (*it == '*') {
  ------------------
  |  Branch (449:20): [True: 6, False: 12.7k]
  ------------------
  450|      6|                  ctx.error = error_code::syntax_error;
  451|      6|                  return true;
  452|      6|               }
  453|  12.7k|            }
  454|  12.7k|            state.has_anchor = true;
  455|  12.7k|            state.anchor_name = std::string(name);
  456|  12.7k|            state.anchor_start = &*it;
  457|  12.7k|         }
  458|       |
  459|   515k|         return false;
  460|   515k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS0_12yaml_contextEPKcSD_EEbOT0_RT1_RT2_T3_:
  309|   515k|      {
  310|   515k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 515k]
  |  Branch (310:27): [True: 480k, False: 34.7k]
  ------------------
  311|       |
  312|  34.7k|         ++it; // skip '*'
  313|  34.7k|         auto name = parse_anchor_name(it, end);
  314|  34.7k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 14, False: 34.7k]
  ------------------
  315|     14|            ctx.error = error_code::syntax_error;
  316|     14|            return true;
  317|     14|         }
  318|       |
  319|  34.7k|         auto anchor_it = ctx.anchors.find(name);
  320|  34.7k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 56, False: 34.7k]
  ------------------
  321|     56|            ctx.error = error_code::syntax_error; // undefined alias
  322|     56|            return true;
  323|     56|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  34.7k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  34.7k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 7.67k, False: 27.0k]
  ------------------
  331|  7.67k|            return true;
  332|  7.67k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  27.0k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 8, False: 27.0k]
  ------------------
  338|      8|            ctx.error = error_code::syntax_error; // cyclic alias
  339|      8|            return true;
  340|      8|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  27.0k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  27.0k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 8, False: 27.0k]
  ------------------
  348|      8|            return true;
  349|       |
  350|  27.0k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 36, False: 26.9k]
  ------------------
  351|     36|            ctx.error = error_code::exceeded_max_expansion;
  352|     36|            ctx.custom_error_message = "alias expansion";
  353|     36|            return true;
  354|     36|         }
  355|       |
  356|  26.9k|         auto replay_it = span.begin;
  357|  26.9k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  26.9k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  26.9k|         ctx.indent_stack.clear();
  362|  26.9k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 3.82k, False: 23.1k]
  ------------------
  363|  3.82k|            ctx.push_indent(span.base_indent - 1);
  364|  3.82k|         }
  365|       |
  366|  26.9k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  26.9k|         using V = std::remove_cvref_t<T>;
  369|  26.9k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  26.9k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  26.9k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  26.9k|         return true;
  376|  27.0k|      }
_ZN3glz4yaml28parse_plain_scalar_multilineINS0_12yaml_contextEPKcS4_EEvRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEERT_RT0_T1_i:
 1187|   778k|      {
 1188|   778k|         value.clear();
 1189|       |
 1190|  2.30M|         while (it != end) {
  ------------------
  |  Branch (1190:17): [True: 2.29M, False: 15.6k]
  ------------------
 1191|  2.29M|            {
 1192|  2.29M|               const auto run_start = it;
 1193|   177M|               while (it != end && !plain_scalar_block_dispatch_table[uint8_t(*it)]) {
  ------------------
  |  Branch (1193:23): [True: 177M, False: 117k]
  |  Branch (1193:36): [True: 175M, False: 2.17M]
  ------------------
 1194|   175M|                  ++it;
 1195|   175M|               }
 1196|  2.29M|               if (it != run_start) {
  ------------------
  |  Branch (1196:20): [True: 2.01M, False: 276k]
  ------------------
 1197|  2.01M|                  value.append(run_start, it);
 1198|  2.01M|               }
 1199|  2.29M|               if (it == end) break;
  ------------------
  |  Branch (1199:20): [True: 117k, False: 2.17M]
  ------------------
 1200|  2.29M|            }
 1201|       |
 1202|  2.17M|            const char c = *it;
 1203|       |
 1204|  2.17M|            if (forbidden_control_table[uint8_t(c)]) [[unlikely]] {
  ------------------
  |  Branch (1204:17): [True: 12.0k, False: 2.16M]
  ------------------
 1205|  12.0k|               ctx.error = error_code::invalid_control_character;
 1206|  12.0k|               return;
 1207|  12.0k|            }
 1208|       |
 1209|       |            // Check for newline - potential continuation
 1210|  2.16M|            if (c == '\n' || c == '\r') {
  ------------------
  |  Branch (1210:17): [True: 388k, False: 1.77M]
  |  Branch (1210:30): [True: 370k, False: 1.40M]
  ------------------
 1211|       |               // Trim trailing whitespace from current line
 1212|  1.19M|               while (!value.empty() && (value.back() == ' ' || value.back() == '\t')) {
  ------------------
  |  Branch (1212:23): [True: 1.09M, False: 104k]
  |  Branch (1212:42): [True: 376k, False: 714k]
  |  Branch (1212:65): [True: 59.4k, False: 655k]
  ------------------
 1213|   435k|                  value.pop_back();
 1214|   435k|               }
 1215|       |
 1216|       |               // Count consecutive blank lines
 1217|   759k|               int blank_lines = 0;
 1218|   759k|               auto lookahead = it;
 1219|       |
 1220|  1.35M|               while (lookahead != end) {
  ------------------
  |  Branch (1220:23): [True: 1.27M, False: 82.0k]
  ------------------
 1221|       |                  // Skip the newline
 1222|  1.27M|                  if (*lookahead == '\r' && (lookahead + 1) != end && *(lookahead + 1) == '\n') {
  ------------------
  |  Branch (1222:23): [True: 507k, False: 766k]
  |  Branch (1222:45): [True: 472k, False: 34.7k]
  |  Branch (1222:71): [True: 54.1k, False: 418k]
  ------------------
 1223|  54.1k|                     ++lookahead;
 1224|  54.1k|                  }
 1225|  1.27M|                  if (lookahead != end && (*lookahead == '\n' || *lookahead == '\r')) {
  ------------------
  |  Branch (1225:23): [True: 1.27M, False: 0]
  |  Branch (1225:44): [True: 821k, False: 453k]
  |  Branch (1225:66): [True: 453k, False: 0]
  ------------------
 1226|  1.27M|                     ++lookahead;
 1227|  1.27M|                  }
 1228|      0|                  else {
 1229|      0|                     break;
 1230|      0|                  }
 1231|       |
 1232|       |                  // Check if this is a blank line or comment-only line
 1233|  1.27M|                  int32_t line_indent = 0;
 1234|       |
 1235|  5.78M|                  while (lookahead != end && (*lookahead == ' ' || *lookahead == '\t')) {
  ------------------
  |  Branch (1235:26): [True: 5.69M, False: 82.0k]
  |  Branch (1235:47): [True: 4.46M, False: 1.23M]
  |  Branch (1235:68): [True: 38.0k, False: 1.19M]
  ------------------
 1236|  4.50M|                     ++line_indent;
 1237|  4.50M|                     ++lookahead;
 1238|  4.50M|                  }
 1239|       |
 1240|  1.27M|                  if (lookahead == end || *lookahead == '\n' || *lookahead == '\r') {
  ------------------
  |  Branch (1240:23): [True: 82.0k, False: 1.19M]
  |  Branch (1240:43): [True: 378k, False: 813k]
  |  Branch (1240:65): [True: 136k, False: 676k]
  ------------------
 1241|       |                     // Blank line
 1242|   597k|                     ++blank_lines;
 1243|   597k|                     continue;
 1244|   597k|                  }
 1245|       |
 1246|   676k|                  if (*lookahead == '#') {
  ------------------
  |  Branch (1246:23): [True: 57.6k, False: 619k]
  ------------------
 1247|       |                     // Comments end plain scalars per YAML spec
 1248|  57.6k|                     return;
 1249|  57.6k|                  }
 1250|       |
 1251|       |                  // Found content - check indentation
 1252|       |                  // Continuation lines must not dedent below the parent block.
 1253|   619k|                  if (line_indent < base_indent) {
  ------------------
  |  Branch (1253:23): [True: 136k, False: 483k]
  ------------------
 1254|       |                     // Dedented - end of scalar
 1255|   136k|                     return;
 1256|   136k|                  }
 1257|       |
 1258|       |                  // Document boundary markers at column 0 start/stop documents and
 1259|       |                  // must terminate a top-level plain scalar continuation.
 1260|   483k|                  if (line_indent == 0 && (at_document_start(lookahead, end) || at_document_end(lookahead, end))) {
  ------------------
  |  Branch (1260:23): [True: 324k, False: 158k]
  |  Branch (1260:44): [True: 1.10k, False: 322k]
  |  Branch (1260:81): [True: 1.26k, False: 321k]
  ------------------
 1261|  2.37k|                     return;
 1262|  2.37k|                  }
 1263|       |
 1264|       |                  // Sequence indicator (- followed by space/newline/end).
 1265|       |                  // Terminates the scalar when the dash is at or above the
 1266|       |                  // enclosing sequence's indicator column, meaning it starts
 1267|       |                  // a sibling entry.  A dash deeper than the indicator is
 1268|       |                  // plain content (yaml-test-suite AB8U). Outside a sequence
 1269|       |                  // the line has already passed the dedent check above, so it
 1270|       |                  // is a continuation: "k: a\n  - b" reads as "a - b", since a
 1271|       |                  // node that began as a scalar cannot turn into a sequence.
 1272|   480k|                  if (*lookahead == '-' && ctx.sequence_dash_indent >= 0 && line_indent <= ctx.sequence_dash_indent) {
  ------------------
  |  Branch (1272:23): [True: 115k, False: 364k]
  |  Branch (1272:44): [True: 103k, False: 12.2k]
  |  Branch (1272:77): [True: 98.5k, False: 5.09k]
  ------------------
 1273|  98.5k|                     auto after_dash = lookahead + 1;
 1274|  98.5k|                     if (after_dash == end || *after_dash == ' ' || *after_dash == '\t' || *after_dash == '\n' ||
  ------------------
  |  Branch (1274:26): [True: 234, False: 98.3k]
  |  Branch (1274:47): [True: 4.94k, False: 93.3k]
  |  Branch (1274:69): [True: 2.86k, False: 90.5k]
  |  Branch (1274:92): [True: 81.2k, False: 9.26k]
  ------------------
 1275|  91.6k|                         *after_dash == '\r') {
  ------------------
  |  Branch (1275:26): [True: 2.39k, False: 6.87k]
  ------------------
 1276|  91.6k|                        return;
 1277|  91.6k|                     }
 1278|  98.5k|                  }
 1279|       |
 1280|   389k|                  if (ctx.explicit_mapping_key_context) {
  ------------------
  |  Branch (1280:23): [True: 192k, False: 196k]
  ------------------
 1281|       |                     // In explicit mapping keys ("? key"), a following explicit
 1282|       |                     // key/value indicator starts a new mapping entry.
 1283|   192k|                     if (*lookahead == '?' || *lookahead == ':') {
  ------------------
  |  Branch (1283:26): [True: 46.8k, False: 145k]
  |  Branch (1283:47): [True: 13.4k, False: 131k]
  ------------------
 1284|  60.3k|                        auto after = lookahead + 1;
 1285|  60.3k|                        if (after == end || *after == ' ' || *after == '\t' || *after == '\n' || *after == '\r') {
  ------------------
  |  Branch (1285:29): [True: 2.81k, False: 57.5k]
  |  Branch (1285:45): [True: 13.2k, False: 44.3k]
  |  Branch (1285:62): [True: 632, False: 43.6k]
  |  Branch (1285:80): [True: 11.3k, False: 32.3k]
  |  Branch (1285:98): [True: 13.2k, False: 19.0k]
  ------------------
 1286|  41.2k|                           return;
 1287|  41.2k|                        }
 1288|  60.3k|                     }
 1289|       |
 1290|       |                     // Node-property indicators at the start of a continuation
 1291|       |                     // line begin a new key node in explicit-key context.
 1292|   150k|                     if (*lookahead == '&' || *lookahead == '*' || *lookahead == '!') {
  ------------------
  |  Branch (1292:26): [True: 2.39k, False: 148k]
  |  Branch (1292:47): [True: 67.7k, False: 80.5k]
  |  Branch (1292:68): [True: 1.91k, False: 78.6k]
  ------------------
 1293|  72.0k|                        return;
 1294|  72.0k|                     }
 1295|   150k|                  }
 1296|       |
 1297|       |                  // In a "- item" value context, an anchor/tag/alias at the start
 1298|       |                  // of a continuation candidate starts a new node, not scalar content.
 1299|   275k|                  if (ctx.sequence_item_value_context &&
  ------------------
  |  Branch (1299:23): [True: 53.4k, False: 222k]
  ------------------
 1300|  53.4k|                      (*lookahead == '&' || *lookahead == '*' || *lookahead == '!')) {
  ------------------
  |  Branch (1300:24): [True: 1.79k, False: 51.6k]
  |  Branch (1300:45): [True: 1.28k, False: 50.4k]
  |  Branch (1300:66): [True: 574, False: 49.8k]
  ------------------
 1301|  3.66k|                     return;
 1302|  3.66k|                  }
 1303|       |
 1304|       |                  // Check for mapping key indicator (content followed by : and space)
 1305|       |                  // This is a heuristic - we look for ": " pattern which indicates a mapping key
 1306|   271k|                  {
 1307|   271k|                     auto scan = lookahead;
 1308|  15.2M|                     while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (1308:29): [True: 15.2M, False: 16.8k]
  |  Branch (1308:44): [True: 15.0M, False: 165k]
  |  Branch (1308:61): [True: 15.0M, False: 48.5k]
  ------------------
 1309|  15.0M|                        if (*scan == ':') {
  ------------------
  |  Branch (1309:29): [True: 128k, False: 14.9M]
  ------------------
 1310|   128k|                           auto after_colon = scan + 1;
 1311|   128k|                           if (after_colon == end || *after_colon == ' ' || *after_colon == '\t' ||
  ------------------
  |  Branch (1311:32): [True: 1.35k, False: 127k]
  |  Branch (1311:54): [True: 24.2k, False: 102k]
  |  Branch (1311:77): [True: 358, False: 102k]
  ------------------
 1312|   102k|                               *after_colon == '\n' || *after_colon == '\r') {
  ------------------
  |  Branch (1312:32): [True: 9.32k, False: 93.1k]
  |  Branch (1312:56): [True: 5.74k, False: 87.3k]
  ------------------
 1313|       |                              // This looks like a mapping key - end the scalar
 1314|  41.0k|                              return;
 1315|  41.0k|                           }
 1316|   128k|                        }
 1317|  14.9M|                        ++scan;
 1318|  14.9M|                     }
 1319|   271k|                  }
 1320|       |
 1321|       |                  // This is a continuation line
 1322|       |                  // Add appropriate line breaks for blank lines
 1323|   406k|                  for (int i = 0; i < blank_lines; ++i) {
  ------------------
  |  Branch (1323:35): [True: 175k, False: 230k]
  ------------------
 1324|   175k|                     value.push_back('\n');
 1325|   175k|                  }
 1326|       |
 1327|       |                  // Add a space to fold the newline (unless we added literal newlines for blank lines)
 1328|   230k|                  if (blank_lines == 0 && !value.empty()) {
  ------------------
  |  Branch (1328:23): [True: 202k, False: 28.0k]
  |  Branch (1328:43): [True: 174k, False: 28.7k]
  ------------------
 1329|   174k|                     value.push_back(' ');
 1330|   174k|                  }
 1331|       |
 1332|       |                  // Move iterator to the content position
 1333|   230k|                  it = lookahead;
 1334|   230k|                  break;
 1335|   271k|               }
 1336|       |
 1337|       |               // If we exhausted the lookahead, we're done
 1338|   313k|               if (lookahead == end) {
  ------------------
  |  Branch (1338:20): [True: 82.0k, False: 230k]
  ------------------
 1339|  82.0k|                  return;
 1340|  82.0k|               }
 1341|       |
 1342|   230k|               continue; // Process the character at the new position
 1343|   313k|            }
 1344|       |
 1345|       |            // Per YAML spec: # only starts a comment when preceded by whitespace
 1346|  1.40M|            if (c == '#') {
  ------------------
  |  Branch (1346:17): [True: 288k, False: 1.11M]
  ------------------
 1347|   288k|               if (value.empty() || value.back() == ' ' || value.back() == '\t') {
  ------------------
  |  Branch (1347:20): [True: 49.1k, False: 239k]
  |  Branch (1347:37): [True: 40.6k, False: 198k]
  |  Branch (1347:60): [True: 4.60k, False: 194k]
  ------------------
 1348|  94.3k|                  break; // This is a comment
 1349|  94.3k|               }
 1350|   288k|            }
 1351|       |
 1352|       |            // Colon followed by space/newline ends plain scalar (potential nested mapping)
 1353|  1.30M|            if (c == ':') {
  ------------------
  |  Branch (1353:17): [True: 1.11M, False: 194k]
  ------------------
 1354|  1.11M|               if ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\t' || *(it + 1) == '\n' || *(it + 1) == '\r') {
  ------------------
  |  Branch (1354:20): [True: 3.01k, False: 1.11M]
  |  Branch (1354:39): [True: 1.40k, False: 1.11M]
  |  Branch (1354:59): [True: 232, False: 1.11M]
  |  Branch (1354:80): [True: 4.74k, False: 1.10M]
  |  Branch (1354:101): [True: 1.10k, False: 1.10M]
  ------------------
 1355|  10.4k|                  break;
 1356|  10.4k|               }
 1357|  1.11M|            }
 1358|       |
 1359|  1.29M|            value.push_back(c);
 1360|  1.29M|            ++it;
 1361|  1.29M|         }
 1362|       |
 1363|       |         // Trim trailing whitespace
 1364|   505k|         while (!value.empty() && (value.back() == ' ' || value.back() == '\t')) {
  ------------------
  |  Branch (1364:17): [True: 455k, False: 50.2k]
  |  Branch (1364:36): [True: 245k, False: 210k]
  |  Branch (1364:59): [True: 22.0k, False: 188k]
  ------------------
 1365|   267k|            value.pop_back();
 1366|   267k|         }
 1367|   238k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_19is_yaml_variant_numEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   151k|      {
 5356|   151k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   151k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   151k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   151k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   151k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 151k, False: 0]
  ------------------
 5366|   151k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   151k|      }
_ZN3glz4fromILj450EdE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRdTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_:
 2149|   153k|      {
 2150|   153k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2150:14): [True: 0, False: 153k]
  ------------------
 2151|      0|            return;
 2152|       |
 2153|   153k|         yaml::node_preamble_state preamble{};
 2154|   153k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble, [](yaml::yaml_tag tag) {
  ------------------
  |  Branch (2154:14): [True: 18.5k, False: 135k]
  ------------------
 2155|   153k|                if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2156|   153k|                   return yaml::tag_valid_for_float(tag);
 2157|   153k|                }
 2158|   153k|                else {
 2159|   153k|                   return yaml::tag_valid_for_int(tag);
 2160|   153k|                }
 2161|   153k|             }))
 2162|  18.5k|            return;
 2163|       |
 2164|   135k|         auto finalize = [&] { yaml::finalize_node_anchor(preamble.node_props, ctx, it); };
 2165|       |
 2166|       |         // Check for special float values
 2167|   135k|         if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2168|   135k|            auto start = it;
 2169|       |
 2170|       |            // Check for .inf, .nan, -.inf, etc.
 2171|   135k|            if (*it == '.') {
  ------------------
  |  Branch (2171:17): [True: 32.2k, False: 102k]
  ------------------
 2172|  32.2k|               ++it;
 2173|  32.2k|               if (it + 3 <= end && (std::string_view(it, 3) == "inf" || std::string_view(it, 3) == "Inf" ||
  ------------------
  |  Branch (2173:20): [True: 30.7k, False: 1.46k]
  |  Branch (2173:38): [True: 516, False: 30.2k]
  |  Branch (2173:74): [True: 1.06k, False: 29.1k]
  ------------------
 2174|  29.1k|                                     std::string_view(it, 3) == "INF")) {
  ------------------
  |  Branch (2174:38): [True: 1.78k, False: 27.4k]
  ------------------
 2175|  3.36k|                  value = std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2176|  3.36k|                  it += 3;
 2177|  3.36k|                  finalize();
 2178|  3.36k|                  return;
 2179|  3.36k|               }
 2180|  28.8k|               if (it + 3 <= end && (std::string_view(it, 3) == "nan" || std::string_view(it, 3) == "NaN" ||
  ------------------
  |  Branch (2180:20): [True: 27.4k, False: 1.46k]
  |  Branch (2180:38): [True: 1.66k, False: 25.7k]
  |  Branch (2180:74): [True: 446, False: 25.3k]
  ------------------
 2181|  25.3k|                                     std::string_view(it, 3) == "NAN")) {
  ------------------
  |  Branch (2181:38): [True: 5.17k, False: 20.1k]
  ------------------
 2182|  7.28k|                  value = std::numeric_limits<std::remove_cvref_t<T>>::quiet_NaN();
 2183|  7.28k|                  it += 3;
 2184|  7.28k|                  finalize();
 2185|  7.28k|                  return;
 2186|  7.28k|               }
 2187|  21.5k|               it = start;
 2188|  21.5k|            }
 2189|       |
 2190|   124k|            if (*it == '-' || *it == '+') {
  ------------------
  |  Branch (2190:17): [True: 10.5k, False: 113k]
  |  Branch (2190:31): [True: 18.4k, False: 95.4k]
  ------------------
 2191|  28.9k|               const char sign = *it;
 2192|  28.9k|               ++it;
 2193|  28.9k|               if (it != end && *it == '.') {
  ------------------
  |  Branch (2193:20): [True: 28.4k, False: 548]
  |  Branch (2193:33): [True: 11.3k, False: 17.0k]
  ------------------
 2194|  11.3k|                  ++it;
 2195|  11.3k|                  if (it + 3 <= end && (std::string_view(it, 3) == "inf" || std::string_view(it, 3) == "Inf" ||
  ------------------
  |  Branch (2195:23): [True: 9.84k, False: 1.48k]
  |  Branch (2195:41): [True: 2.75k, False: 7.09k]
  |  Branch (2195:77): [True: 1.43k, False: 5.66k]
  ------------------
 2196|  8.88k|                                        std::string_view(it, 3) == "INF")) {
  ------------------
  |  Branch (2196:41): [True: 4.70k, False: 956]
  ------------------
 2197|  8.88k|                     if (sign == '-') {
  ------------------
  |  Branch (2197:26): [True: 7.30k, False: 1.58k]
  ------------------
 2198|  7.30k|                        value = -std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2199|  7.30k|                     }
 2200|  1.58k|                     else {
 2201|  1.58k|                        value = std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2202|  1.58k|                     }
 2203|  8.88k|                     it += 3;
 2204|  8.88k|                     finalize();
 2205|  8.88k|                     return;
 2206|  8.88k|                  }
 2207|  11.3k|               }
 2208|  20.0k|               it = start;
 2209|  20.0k|            }
 2210|   124k|         }
 2211|       |
 2212|       |         // Parse as plain scalar and convert
 2213|   115k|         auto start = it;
 2214|       |
 2215|       |         // Find end of number - use same rules as plain scalar for colons
 2216|   116M|         while (it != end) {
  ------------------
  |  Branch (2216:17): [True: 116M, False: 31.2k]
  ------------------
 2217|   116M|            const char c = *it;
 2218|   116M|            if (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == ',' || c == ']' || c == '}' || c == '#') {
  ------------------
  |  Branch (2218:17): [True: 32.4k, False: 116M]
  |  Branch (2218:29): [True: 6.75k, False: 116M]
  |  Branch (2218:42): [True: 17.1k, False: 116M]
  |  Branch (2218:55): [True: 22.7k, False: 116M]
  |  Branch (2218:68): [True: 1.78k, False: 116M]
  |  Branch (2218:80): [True: 920, False: 116M]
  |  Branch (2218:92): [True: 1.15k, False: 116M]
  |  Branch (2218:104): [True: 14.0k, False: 116M]
  ------------------
 2219|  96.9k|               break;
 2220|  96.9k|            }
 2221|       |            // Colon only ends number if followed by space/tab/newline/end (YAML mapping indicator)
 2222|   116M|            if (c == ':') {
  ------------------
  |  Branch (2222:17): [True: 21.2k, False: 116M]
  ------------------
 2223|  21.2k|               if ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\t' || *(it + 1) == '\n' || *(it + 1) == '\r') {
  ------------------
  |  Branch (2223:20): [True: 618, False: 20.6k]
  |  Branch (2223:39): [True: 2.92k, False: 17.7k]
  |  Branch (2223:59): [True: 876, False: 16.8k]
  |  Branch (2223:80): [True: 1.28k, False: 15.5k]
  |  Branch (2223:101): [True: 1.20k, False: 14.3k]
  ------------------
 2224|  6.91k|                  break;
 2225|  6.91k|               }
 2226|  21.2k|            }
 2227|   116M|            ++it;
 2228|   116M|         }
 2229|       |
 2230|   135k|         const std::string_view num_str(&*start, static_cast<size_t>(it - start));
 2231|       |
 2232|   135k|         if (num_str.empty()) {
  ------------------
  |  Branch (2232:14): [True: 4.05k, False: 131k]
  ------------------
 2233|  4.05k|            ctx.error = error_code::parse_number_failure;
 2234|  4.05k|            return;
 2235|  4.05k|         }
 2236|       |
 2237|       |         // Handle hex, octal, binary
 2238|       |         if constexpr (std::integral<std::remove_cvref_t<T>>) {
 2239|       |            if (num_str.size() > 2 && num_str[0] == '0') {
 2240|       |               int base = 10;
 2241|       |               size_t offset = 0;
 2242|       |
 2243|       |               if (num_str[1] == 'x' || num_str[1] == 'X') {
 2244|       |                  base = 16;
 2245|       |                  offset = 2;
 2246|       |               }
 2247|       |               else if (num_str[1] == 'o' || num_str[1] == 'O') {
 2248|       |                  base = 8;
 2249|       |                  offset = 2;
 2250|       |               }
 2251|       |               else if (num_str[1] == 'b' || num_str[1] == 'B') {
 2252|       |                  base = 2;
 2253|       |                  offset = 2;
 2254|       |               }
 2255|       |
 2256|       |               if (base != 10) {
 2257|       |                  const auto digits = num_str.substr(offset);
 2258|       |                  const bool has_underscores = (digits.find('_') != std::string_view::npos);
 2259|       |
 2260|       |                  std::string clean_storage;
 2261|       |                  std::string_view clean_view;
 2262|       |
 2263|       |                  if (has_underscores) {
 2264|       |                     clean_storage.reserve(digits.size());
 2265|       |                     for (char c : digits) {
 2266|       |                        if (c != '_') {
 2267|       |                           clean_storage.push_back(c);
 2268|       |                        }
 2269|       |                     }
 2270|       |                     clean_view = clean_storage;
 2271|       |                  }
 2272|       |                  else {
 2273|       |                     clean_view = digits;
 2274|       |                  }
 2275|       |
 2276|       |                  auto [ptr, ec] =
 2277|       |                     std::from_chars(clean_view.data(), clean_view.data() + clean_view.size(), value, base);
 2278|       |                  if (ec != std::errc{}) {
 2279|       |                     ctx.error = error_code::parse_number_failure;
 2280|       |                  }
 2281|       |                  finalize();
 2282|       |                  return;
 2283|       |               }
 2284|       |            }
 2285|       |         }
 2286|   131k|         else if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2287|   131k|            bool negative = false;
 2288|   131k|            std::string_view digits = num_str;
 2289|       |
 2290|   131k|            if (!digits.empty() && (digits.front() == '+' || digits.front() == '-')) {
  ------------------
  |  Branch (2290:17): [True: 111k, False: 19.5k]
  |  Branch (2290:37): [True: 16.8k, False: 94.6k]
  |  Branch (2290:62): [True: 3.25k, False: 91.3k]
  ------------------
 2291|  20.0k|               negative = (digits.front() == '-');
 2292|  20.0k|               digits.remove_prefix(1);
 2293|  20.0k|            }
 2294|       |
 2295|   131k|            if (digits.size() > 2 && digits[0] == '0') {
  ------------------
  |  Branch (2295:17): [True: 72.6k, False: 58.3k]
  |  Branch (2295:38): [True: 28.7k, False: 43.8k]
  ------------------
 2296|  28.7k|               int base = 10;
 2297|  28.7k|               size_t offset = 0;
 2298|       |
 2299|  28.7k|               if (digits[1] == 'x' || digits[1] == 'X') {
  ------------------
  |  Branch (2299:20): [True: 6.19k, False: 22.5k]
  |  Branch (2299:40): [True: 1.66k, False: 20.9k]
  ------------------
 2300|  7.86k|                  base = 16;
 2301|  7.86k|                  offset = 2;
 2302|  7.86k|               }
 2303|  20.9k|               else if (digits[1] == 'o' || digits[1] == 'O') {
  ------------------
  |  Branch (2303:25): [True: 2.45k, False: 18.4k]
  |  Branch (2303:45): [True: 1.83k, False: 16.6k]
  ------------------
 2304|  4.28k|                  base = 8;
 2305|  4.28k|                  offset = 2;
 2306|  4.28k|               }
 2307|  16.6k|               else if (digits[1] == 'b' || digits[1] == 'B') {
  ------------------
  |  Branch (2307:25): [True: 2.24k, False: 14.3k]
  |  Branch (2307:45): [True: 2.93k, False: 11.4k]
  ------------------
 2308|  5.17k|                  base = 2;
 2309|  5.17k|                  offset = 2;
 2310|  5.17k|               }
 2311|       |
 2312|  28.7k|               if (base != 10) {
  ------------------
  |  Branch (2312:20): [True: 17.3k, False: 11.4k]
  ------------------
 2313|  17.3k|                  auto raw_digits = digits.substr(offset);
 2314|  17.3k|                  const bool has_underscores = (raw_digits.find('_') != std::string_view::npos);
 2315|       |
 2316|  17.3k|                  std::string clean_storage;
 2317|  17.3k|                  std::string_view clean_view;
 2318|  17.3k|                  if (has_underscores) {
  ------------------
  |  Branch (2318:23): [True: 4.97k, False: 12.3k]
  ------------------
 2319|  4.97k|                     clean_storage.reserve(raw_digits.size());
 2320|  30.4M|                     for (char c : raw_digits) {
  ------------------
  |  Branch (2320:34): [True: 30.4M, False: 4.97k]
  ------------------
 2321|  30.4M|                        if (c != '_') {
  ------------------
  |  Branch (2321:29): [True: 30.4M, False: 5.48k]
  ------------------
 2322|  30.4M|                           clean_storage.push_back(c);
 2323|  30.4M|                        }
 2324|  30.4M|                     }
 2325|  4.97k|                     clean_view = clean_storage;
 2326|  4.97k|                  }
 2327|  12.3k|                  else {
 2328|  12.3k|                     clean_view = raw_digits;
 2329|  12.3k|                  }
 2330|       |
 2331|  17.3k|                  uint64_t parsed_int{};
 2332|  17.3k|                  auto [ptr, ec] =
 2333|  17.3k|                     std::from_chars(clean_view.data(), clean_view.data() + clean_view.size(), parsed_int, base);
 2334|  17.3k|                  if (ec != std::errc{} || ptr != (clean_view.data() + clean_view.size())) {
  ------------------
  |  Branch (2334:23): [True: 9.85k, False: 7.47k]
  |  Branch (2334:44): [True: 3.35k, False: 4.11k]
  ------------------
 2335|  13.2k|                     ctx.error = error_code::parse_number_failure;
 2336|  13.2k|                     finalize();
 2337|  13.2k|                     return;
 2338|  13.2k|                  }
 2339|       |
 2340|  4.11k|                  const auto as_float = static_cast<std::remove_cvref_t<T>>(parsed_int);
 2341|  4.11k|                  value = negative ? -as_float : as_float;
  ------------------
  |  Branch (2341:27): [True: 1.25k, False: 2.86k]
  ------------------
 2342|  4.11k|                  finalize();
 2343|  4.11k|                  return;
 2344|  17.3k|               }
 2345|  28.7k|            }
 2346|   131k|         }
 2347|       |
 2348|       |         // Standard number parsing - only allocate if underscores present
 2349|   113k|         const bool has_underscores = (num_str.find('_') != std::string_view::npos);
 2350|       |
 2351|   131k|         std::string clean_storage;
 2352|   131k|         std::string_view clean_view;
 2353|       |
 2354|   131k|         if (has_underscores) {
  ------------------
  |  Branch (2354:14): [True: 5.33k, False: 125k]
  ------------------
 2355|  5.33k|            clean_storage.reserve(num_str.size());
 2356|  62.6M|            for (char c : num_str) {
  ------------------
  |  Branch (2356:25): [True: 62.6M, False: 5.33k]
  ------------------
 2357|  62.6M|               if (c != '_') {
  ------------------
  |  Branch (2357:20): [True: 62.6M, False: 10.5k]
  ------------------
 2358|  62.6M|                  clean_storage.push_back(c);
 2359|  62.6M|               }
 2360|  62.6M|            }
 2361|  5.33k|            clean_view = clean_storage;
 2362|  5.33k|         }
 2363|   125k|         else {
 2364|   125k|            clean_view = num_str;
 2365|   125k|         }
 2366|       |
 2367|       |         // YAML allows leading '+' for positive numbers, but C++ from_chars doesn't
 2368|       |         // Strip leading '+' if present
 2369|   131k|         auto parse_view = clean_view;
 2370|   131k|         if (!parse_view.empty() && parse_view.front() == '+') {
  ------------------
  |  Branch (2370:14): [True: 93.7k, False: 37.2k]
  |  Branch (2370:37): [True: 16.8k, False: 76.9k]
  ------------------
 2371|  16.8k|            parse_view.remove_prefix(1);
 2372|  16.8k|            if (parse_view.empty()) {
  ------------------
  |  Branch (2372:17): [True: 2.27k, False: 14.5k]
  ------------------
 2373|  2.27k|               ctx.error = error_code::parse_number_failure;
 2374|  2.27k|               return;
 2375|  2.27k|            }
 2376|  16.8k|         }
 2377|       |
 2378|   128k|         if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2379|   128k|            auto result = glz::fast_float::from_chars(parse_view.data(), parse_view.data() + parse_view.size(), value);
 2380|       |            // Check both for errors and that all input was consumed (e.g., "12:30" is not a valid number)
 2381|   128k|            if (result.ec != std::errc{} || result.ptr != parse_view.data() + parse_view.size()) {
  ------------------
  |  Branch (2381:17): [True: 71.7k, False: 56.9k]
  |  Branch (2381:45): [True: 35.1k, False: 21.8k]
  ------------------
 2382|  70.0k|               ctx.error = error_code::parse_number_failure;
 2383|  70.0k|            }
 2384|       |         }
 2385|       |         else {
 2386|       |            auto [ptr, ec] = std::from_chars(parse_view.data(), parse_view.data() + parse_view.size(), value);
 2387|       |            // Check both for errors and that all input was consumed
 2388|       |            if (ec != std::errc{} || ptr != parse_view.data() + parse_view.size()) {
 2389|       |               ctx.error = error_code::parse_number_failure;
 2390|       |            }
 2391|       |         }
 2392|       |
 2393|   128k|         finalize();
 2394|   128k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEEXtlNS0_20node_property_policyELb1EEELb0ERdNS0_12yaml_contextEPKcS7_ZNS_4fromILj450EdE2opITnDaXtlS2_Lj10ELb1ELb0ELb0ELb1EEERS7_S4_TkNS_10is_contextERS5_S7_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSG_RSJ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   153k|      {
  475|   153k|         skip_inline_ws(it, end);
  476|       |
  477|   153k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 4.22k, False: 149k]
  ------------------
  478|  4.22k|            if constexpr (!AllowEmptyInput) {
  479|  4.22k|               ctx.error = error_code::unexpected_end;
  480|  4.22k|            }
  481|  4.22k|            return true;
  482|  4.22k|         }
  483|       |
  484|   149k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   149k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 1.20k, False: 148k]
  ------------------
  486|  1.20k|            ctx.error = error_code::syntax_error;
  487|  1.20k|            return true;
  488|  1.20k|         }
  489|   148k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 336, False: 147k]
  ------------------
  490|    336|            ctx.error = error_code::syntax_error;
  491|    336|            return true;
  492|    336|         }
  493|       |
  494|   147k|         skip_inline_ws(it, end);
  495|       |
  496|   147k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 656, False: 147k]
  ------------------
  497|    656|            if constexpr (!AllowEmptyInput) {
  498|    656|               ctx.error = error_code::unexpected_end;
  499|    656|            }
  500|    656|            return true;
  501|    656|         }
  502|       |
  503|   147k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 12.0k, False: 135k]
  ------------------
  504|  12.0k|            return true;
  505|  12.0k|         }
  506|       |
  507|   135k|         return false;
  508|   147k|      }
_ZZN3glz4fromILj450EdE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRdTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_ENKUlNS8_8yaml_tagEE_clESI_:
 2154|   148k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble, [](yaml::yaml_tag tag) {
 2155|   148k|                if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2156|   148k|                   return yaml::tag_valid_for_float(tag);
 2157|       |                }
 2158|       |                else {
 2159|       |                   return yaml::tag_valid_for_int(tag);
 2160|       |                }
 2161|   148k|             }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEEXtlNS0_20node_property_policyELb1EEERdNS0_12yaml_contextEPKcS7_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   147k|      {
  418|   147k|         state.has_anchor = false;
  419|   147k|         state.anchor_name.clear();
  420|   147k|         state.anchor_start = nullptr;
  421|   147k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   147k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|   147k|            else {
  430|   147k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 11.2k, False: 135k]
  ------------------
  431|   147k|            }
  432|   147k|         }
  433|       |
  434|   147k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 135k, False: 11.2k]
  |  Branch (434:27): [True: 14.5k, False: 121k]
  ------------------
  435|  14.5k|            ++it;
  436|  14.5k|            auto name = parse_anchor_name(it, end);
  437|  14.5k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 420, False: 14.1k]
  ------------------
  438|    420|               ctx.error = error_code::syntax_error;
  439|    420|               return true;
  440|    420|            }
  441|  14.1k|            skip_inline_ws(it, end);
  442|  14.1k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 436, False: 13.6k]
  ------------------
  443|    436|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|    436|                  ctx.error = error_code::unexpected_end;
  445|    436|               }
  446|    436|               return true;
  447|    436|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  13.6k|            state.has_anchor = true;
  455|  13.6k|            state.anchor_name = std::string(name);
  456|  13.6k|            state.anchor_start = &*it;
  457|  13.6k|         }
  458|       |
  459|   146k|         return false;
  460|   147k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERdNS0_12yaml_contextEPKcS6_EEbOT0_RT1_RT2_T3_:
  309|   147k|      {
  310|   147k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 147k]
  |  Branch (310:27): [True: 135k, False: 11.2k]
  ------------------
  311|       |
  312|  11.2k|         ++it; // skip '*'
  313|  11.2k|         auto name = parse_anchor_name(it, end);
  314|  11.2k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 612, False: 10.6k]
  ------------------
  315|    612|            ctx.error = error_code::syntax_error;
  316|    612|            return true;
  317|    612|         }
  318|       |
  319|  10.6k|         auto anchor_it = ctx.anchors.find(name);
  320|  10.6k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 1.80k, False: 8.81k]
  ------------------
  321|  1.80k|            ctx.error = error_code::syntax_error; // undefined alias
  322|  1.80k|            return true;
  323|  1.80k|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  8.81k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  8.81k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 6.36k, False: 2.44k]
  ------------------
  331|  6.36k|            return true;
  332|  6.36k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  2.44k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 62, False: 2.38k]
  ------------------
  338|     62|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     62|            return true;
  340|     62|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  2.38k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  2.38k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 6, False: 2.38k]
  ------------------
  348|      6|            return true;
  349|       |
  350|  2.38k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 0, False: 2.38k]
  ------------------
  351|      0|            ctx.error = error_code::exceeded_max_expansion;
  352|      0|            ctx.custom_error_message = "alias expansion";
  353|      0|            return true;
  354|      0|         }
  355|       |
  356|  2.38k|         auto replay_it = span.begin;
  357|  2.38k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  2.38k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  2.38k|         ctx.indent_stack.clear();
  362|  2.38k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 418, False: 1.96k]
  ------------------
  363|    418|            ctx.push_indent(span.base_indent - 1);
  364|    418|         }
  365|       |
  366|  2.38k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  2.38k|         using V = std::remove_cvref_t<T>;
  369|  2.38k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  2.38k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  2.38k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  2.38k|         return true;
  376|  2.38k|      }
_ZZN3glz4fromILj450EdE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRdTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_ENKUlvE_clEv:
 2164|   128k|         auto finalize = [&] { yaml::finalize_node_anchor(preamble.node_props, ctx, it); };
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_20is_yaml_variant_boolEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|  70.7k|      {
 5356|  70.7k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|  70.7k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|  70.7k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|  70.7k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|  70.7k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 70.7k, False: 0]
  ------------------
 5366|  70.7k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|  70.7k|      }
_ZN3glz4fromILj450EbE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRbTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_:
 2114|  75.0k|      {
 2115|  75.0k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2115:14): [True: 0, False: 75.0k]
  ------------------
 2116|      0|            return;
 2117|       |
 2118|  75.0k|         yaml::node_preamble_state preamble{};
 2119|  75.0k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble,
  ------------------
  |  Branch (2119:14): [True: 29.6k, False: 45.4k]
  ------------------
 2120|  75.0k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_bool(tag); }))
 2121|  29.6k|            return;
 2122|       |
 2123|       |         // Parse as plain scalar first
 2124|  45.4k|         std::string str;
 2125|  45.4k|         yaml::parse_plain_scalar(str, ctx, it, end, yaml::check_flow_context(Opts));
 2126|       |
 2127|  45.4k|         if (str == "true" || str == "True" || str == "TRUE" || str == "yes" || str == "Yes" || str == "YES" ||
  ------------------
  |  Branch (2127:14): [True: 4.97k, False: 40.4k]
  |  Branch (2127:31): [True: 4.50k, False: 35.9k]
  |  Branch (2127:48): [True: 5.08k, False: 30.9k]
  |  Branch (2127:65): [True: 1.10k, False: 29.7k]
  |  Branch (2127:81): [True: 814, False: 28.9k]
  |  Branch (2127:97): [True: 1.10k, False: 27.8k]
  ------------------
 2128|  27.8k|             str == "on" || str == "On" || str == "ON") {
  ------------------
  |  Branch (2128:14): [True: 234, False: 27.6k]
  |  Branch (2128:29): [True: 398, False: 27.2k]
  |  Branch (2128:44): [True: 1.01k, False: 26.2k]
  ------------------
 2129|  19.2k|            value = true;
 2130|  19.2k|         }
 2131|  26.2k|         else if (str == "false" || str == "False" || str == "FALSE" || str == "no" || str == "No" || str == "NO" ||
  ------------------
  |  Branch (2131:19): [True: 3.59k, False: 22.6k]
  |  Branch (2131:37): [True: 2.88k, False: 19.7k]
  |  Branch (2131:55): [True: 794, False: 18.9k]
  |  Branch (2131:73): [True: 2.89k, False: 16.0k]
  |  Branch (2131:88): [True: 10.1k, False: 5.86k]
  |  Branch (2131:103): [True: 1.01k, False: 4.85k]
  ------------------
 2132|  26.0k|                  str == "off" || str == "Off" || str == "OFF") {
  ------------------
  |  Branch (2132:19): [True: 1.89k, False: 2.95k]
  |  Branch (2132:35): [True: 1.73k, False: 1.22k]
  |  Branch (2132:51): [True: 1.06k, False: 162]
  ------------------
 2133|  26.0k|            value = false;
 2134|  26.0k|         }
 2135|    162|         else {
 2136|    162|            ctx.error = error_code::expected_true_or_false;
 2137|    162|         }
 2138|       |
 2139|  45.4k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 2140|  45.4k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEEXtlNS0_20node_property_policyELb1EEELb0ERbNS0_12yaml_contextEPKcS7_ZNS_4fromILj450EbE2opITnDaXtlS2_Lj10ELb1ELb0ELb0ELb1EEERS7_S4_TkNS_10is_contextERS5_S7_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSG_RSJ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|  75.0k|      {
  475|  75.0k|         skip_inline_ws(it, end);
  476|       |
  477|  75.0k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 16, False: 75.0k]
  ------------------
  478|     16|            if constexpr (!AllowEmptyInput) {
  479|     16|               ctx.error = error_code::unexpected_end;
  480|     16|            }
  481|     16|            return true;
  482|     16|         }
  483|       |
  484|  75.0k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|  75.0k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 8, False: 75.0k]
  ------------------
  486|      8|            ctx.error = error_code::syntax_error;
  487|      8|            return true;
  488|      8|         }
  489|  75.0k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 6, False: 75.0k]
  ------------------
  490|      6|            ctx.error = error_code::syntax_error;
  491|      6|            return true;
  492|      6|         }
  493|       |
  494|  75.0k|         skip_inline_ws(it, end);
  495|       |
  496|  75.0k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 10, False: 75.0k]
  ------------------
  497|     10|            if constexpr (!AllowEmptyInput) {
  498|     10|               ctx.error = error_code::unexpected_end;
  499|     10|            }
  500|     10|            return true;
  501|     10|         }
  502|       |
  503|  75.0k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 29.5k, False: 45.4k]
  ------------------
  504|  29.5k|            return true;
  505|  29.5k|         }
  506|       |
  507|  45.4k|         return false;
  508|  75.0k|      }
_ZZN3glz4fromILj450EbE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRbTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_ENKUlNS8_8yaml_tagEE_clESI_:
 2120|  75.0k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_bool(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEEXtlNS0_20node_property_policyELb1EEERbNS0_12yaml_contextEPKcS7_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|  75.0k|      {
  418|  75.0k|         state.has_anchor = false;
  419|  75.0k|         state.anchor_name.clear();
  420|  75.0k|         state.anchor_start = nullptr;
  421|  75.0k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|  75.0k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|  75.0k|            else {
  430|  75.0k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 29.5k, False: 45.4k]
  ------------------
  431|  75.0k|            }
  432|  75.0k|         }
  433|       |
  434|  75.0k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 45.4k, False: 29.5k]
  |  Branch (434:27): [True: 8.26k, False: 37.2k]
  ------------------
  435|  8.26k|            ++it;
  436|  8.26k|            auto name = parse_anchor_name(it, end);
  437|  8.26k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 6, False: 8.25k]
  ------------------
  438|      6|               ctx.error = error_code::syntax_error;
  439|      6|               return true;
  440|      6|            }
  441|  8.25k|            skip_inline_ws(it, end);
  442|  8.25k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 18, False: 8.23k]
  ------------------
  443|     18|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     18|                  ctx.error = error_code::unexpected_end;
  445|     18|               }
  446|     18|               return true;
  447|     18|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  8.23k|            state.has_anchor = true;
  455|  8.23k|            state.anchor_name = std::string(name);
  456|  8.23k|            state.anchor_start = &*it;
  457|  8.23k|         }
  458|       |
  459|  75.0k|         return false;
  460|  75.0k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERbNS0_12yaml_contextEPKcS6_EEbOT0_RT1_RT2_T3_:
  309|  75.0k|      {
  310|  75.0k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 75.0k]
  |  Branch (310:27): [True: 45.4k, False: 29.5k]
  ------------------
  311|       |
  312|  29.5k|         ++it; // skip '*'
  313|  29.5k|         auto name = parse_anchor_name(it, end);
  314|  29.5k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 14, False: 29.5k]
  ------------------
  315|     14|            ctx.error = error_code::syntax_error;
  316|     14|            return true;
  317|     14|         }
  318|       |
  319|  29.5k|         auto anchor_it = ctx.anchors.find(name);
  320|  29.5k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 60, False: 29.4k]
  ------------------
  321|     60|            ctx.error = error_code::syntax_error; // undefined alias
  322|     60|            return true;
  323|     60|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  29.4k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  29.4k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 25.1k, False: 4.36k]
  ------------------
  331|  25.1k|            return true;
  332|  25.1k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  4.36k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 28, False: 4.33k]
  ------------------
  338|     28|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     28|            return true;
  340|     28|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  4.33k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  4.33k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 0, False: 4.33k]
  ------------------
  348|      0|            return true;
  349|       |
  350|  4.33k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 0, False: 4.33k]
  ------------------
  351|      0|            ctx.error = error_code::exceeded_max_expansion;
  352|      0|            ctx.custom_error_message = "alias expansion";
  353|      0|            return true;
  354|      0|         }
  355|       |
  356|  4.33k|         auto replay_it = span.begin;
  357|  4.33k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  4.33k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  4.33k|         ctx.indent_stack.clear();
  362|  4.33k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 1.26k, False: 3.06k]
  ------------------
  363|  1.26k|            ctx.push_indent(span.base_indent - 1);
  364|  1.26k|         }
  365|       |
  366|  4.33k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  4.33k|         using V = std::remove_cvref_t<T>;
  369|  4.33k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  4.33k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  4.33k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  4.33k|         return true;
  376|  4.33k|      }
_ZN3glz4fromILj450EDnE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRDnTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_:
 2500|  25.8k|      {
 2501|  25.8k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2501:14): [True: 0, False: 25.8k]
  ------------------
 2502|      0|            return;
 2503|       |
 2504|  25.8k|         yaml::skip_inline_ws(it, end);
 2505|       |
 2506|  25.8k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2506:14): [True: 6, False: 25.8k]
  ------------------
 2507|      6|            ctx.error = error_code::unexpected_end;
 2508|      6|            return;
 2509|      6|         }
 2510|       |
 2511|       |         // Check for null values: null, Null, NULL, ~
 2512|  25.8k|         if (*it == '~') {
  ------------------
  |  Branch (2512:14): [True: 3.83k, False: 21.9k]
  ------------------
 2513|  3.83k|            ++it;
 2514|  3.83k|            return;
 2515|  3.83k|         }
 2516|       |
 2517|       |         // Parse as plain scalar and check if it's a null keyword
 2518|  21.9k|         auto start = it;
 2519|   108k|         while (it != end && !yaml::plain_scalar_end_or_control_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (2519:17): [True: 106k, False: 1.63k]
  |  Branch (2519:30): [True: 86.2k, False: 20.3k]
  ------------------
 2520|  86.2k|            ++it;
 2521|  86.2k|         }
 2522|       |
 2523|  21.9k|         std::string_view str{start, static_cast<size_t>(it - start)};
 2524|  21.9k|         if (!yaml::is_yaml_null(str)) {
  ------------------
  |  Branch (2524:14): [True: 32, False: 21.9k]
  ------------------
 2525|     32|            ctx.error = error_code::syntax_error;
 2526|     32|         }
 2527|  21.9k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_21is_yaml_variant_arrayEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   392k|      {
 5356|   392k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   392k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   392k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   392k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   392k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 392k, False: 0]
  ------------------
 5366|   392k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   392k|      }
_ZN3glz4fromILj450ENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS1_9allocatorIS6_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRS9_TkNS_10is_contextERNS_4yaml12yaml_contextESE_EEvOT1_OT2_OT0_T3_:
 4207|   396k|      {
 4208|   396k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4208:14): [True: 0, False: 396k]
  ------------------
 4209|      0|            return;
 4210|       |
 4211|       |         // Peek ahead to check for tag (don't consume indentation for block sequences)
 4212|   396k|         auto peek = it;
 4213|   396k|         yaml::node_preamble_state preamble{};
 4214|   396k|         if (yaml::parse_node_preamble<Opts>(value, ctx, peek, end, preamble,
  ------------------
  |  Branch (4214:14): [True: 17.2k, False: 379k]
  ------------------
 4215|   396k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_seq(tag); })) {
 4216|  17.2k|            it = peek;
 4217|  17.2k|            return;
 4218|  17.2k|         }
 4219|       |
 4220|       |         // A level of nesting, taken past the preamble as for sets above.
 4221|   379k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 4222|   379k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (4222:14): [True: 630, False: 378k]
  ------------------
 4223|    630|            return;
 4224|       |
 4225|   378k|         if (*peek == '[') {
  ------------------
  |  Branch (4225:14): [True: 104k, False: 274k]
  ------------------
 4226|       |            // Flow sequence - consume whitespace and parse
 4227|   104k|            it = peek;
 4228|   104k|            yaml::parse_flow_sequence<Opts>(value, ctx, it, end);
 4229|   104k|         }
 4230|   274k|         else if (*peek == '-') {
  ------------------
  |  Branch (4230:19): [True: 274k, False: 86]
  ------------------
 4231|       |            // Block sequence - don't consume leading whitespace, let parse_block_sequence handle it
 4232|       |            // But if there was a tag, we need to advance past it
 4233|   274k|            if (preamble.tag != yaml::yaml_tag::none || preamble.node_props.has_anchor) {
  ------------------
  |  Branch (4233:17): [True: 1.01k, False: 273k]
  |  Branch (4233:57): [True: 7.34k, False: 265k]
  ------------------
 4234|  8.36k|               it = peek;
 4235|  8.36k|            }
 4236|   274k|            int32_t seq_indent = ctx.current_indent();
 4237|   274k|            if (*it == '-' && ctx.current_indent() >= 0) {
  ------------------
  |  Branch (4237:17): [True: 272k, False: 2.05k]
  |  Branch (4237:31): [True: 121k, False: 150k]
  ------------------
 4238|   121k|               seq_indent = ctx.allow_indentless_sequence ? (ctx.current_indent() > 0 ? (ctx.current_indent() - 1) : 0)
  ------------------
  |  Branch (4238:29): [True: 34.6k, False: 86.9k]
  |  Branch (4238:62): [True: 27.6k, False: 6.98k]
  ------------------
 4239|   121k|                                                          : (ctx.current_indent() + 1);
 4240|   121k|            }
 4241|   274k|            yaml::parse_block_sequence<Opts>(value, ctx, it, end, seq_indent);
 4242|   274k|         }
 4243|     86|         else {
 4244|     86|            ctx.error = error_code::syntax_error;
 4245|     86|         }
 4246|       |
 4247|   378k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 4248|   378k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEEXtlNS0_20node_property_policyELb1EEELb0ERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS4_9allocatorIS9_EEEENS0_12yaml_contextEPKcSG_ZNS_4fromILj450ESC_E2opITnDaXtlS2_Lj10ELb1ELb0ELb0ELb1EEERSG_SD_TkNS_10is_contextERSE_SG_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSP_RSS_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   396k|      {
  475|   396k|         skip_inline_ws(it, end);
  476|       |
  477|   396k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 10, False: 396k]
  ------------------
  478|     10|            if constexpr (!AllowEmptyInput) {
  479|     10|               ctx.error = error_code::unexpected_end;
  480|     10|            }
  481|     10|            return true;
  482|     10|         }
  483|       |
  484|   396k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   396k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 6, False: 396k]
  ------------------
  486|      6|            ctx.error = error_code::syntax_error;
  487|      6|            return true;
  488|      6|         }
  489|   396k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 6, False: 396k]
  ------------------
  490|      6|            ctx.error = error_code::syntax_error;
  491|      6|            return true;
  492|      6|         }
  493|       |
  494|   396k|         skip_inline_ws(it, end);
  495|       |
  496|   396k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 6, False: 396k]
  ------------------
  497|      6|            if constexpr (!AllowEmptyInput) {
  498|      6|               ctx.error = error_code::unexpected_end;
  499|      6|            }
  500|      6|            return true;
  501|      6|         }
  502|       |
  503|   396k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 17.2k, False: 379k]
  ------------------
  504|  17.2k|            return true;
  505|  17.2k|         }
  506|       |
  507|   379k|         return false;
  508|   396k|      }
_ZZN3glz4fromILj450ENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS1_9allocatorIS6_EEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRS9_TkNS_10is_contextERNS_4yaml12yaml_contextESE_EEvOT1_OT2_OT0_T3_ENKUlNSH_8yaml_tagEE_clESR_:
 4215|   396k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_seq(tag); })) {
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEEXtlNS0_20node_property_policyELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS4_9allocatorIS9_EEEENS0_12yaml_contextEPKcSG_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   396k|      {
  418|   396k|         state.has_anchor = false;
  419|   396k|         state.anchor_name.clear();
  420|   396k|         state.anchor_start = nullptr;
  421|   396k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   396k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|   396k|            else {
  430|   396k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 17.1k, False: 379k]
  ------------------
  431|   396k|            }
  432|   396k|         }
  433|       |
  434|   396k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 379k, False: 17.1k]
  |  Branch (434:27): [True: 7.86k, False: 371k]
  ------------------
  435|  7.86k|            ++it;
  436|  7.86k|            auto name = parse_anchor_name(it, end);
  437|  7.86k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 22, False: 7.84k]
  ------------------
  438|     22|               ctx.error = error_code::syntax_error;
  439|     22|               return true;
  440|     22|            }
  441|  7.84k|            skip_inline_ws(it, end);
  442|  7.84k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 24, False: 7.82k]
  ------------------
  443|     24|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     24|                  ctx.error = error_code::unexpected_end;
  445|     24|               }
  446|     24|               return true;
  447|     24|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  7.82k|            state.has_anchor = true;
  455|  7.82k|            state.anchor_name = std::string(name);
  456|  7.82k|            state.anchor_start = &*it;
  457|  7.82k|         }
  458|       |
  459|   396k|         return false;
  460|   396k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEbOT0_RT1_RT2_T3_:
  309|   396k|      {
  310|   396k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 396k]
  |  Branch (310:27): [True: 379k, False: 17.1k]
  ------------------
  311|       |
  312|  17.1k|         ++it; // skip '*'
  313|  17.1k|         auto name = parse_anchor_name(it, end);
  314|  17.1k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 24, False: 17.1k]
  ------------------
  315|     24|            ctx.error = error_code::syntax_error;
  316|     24|            return true;
  317|     24|         }
  318|       |
  319|  17.1k|         auto anchor_it = ctx.anchors.find(name);
  320|  17.1k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 36, False: 17.1k]
  ------------------
  321|     36|            ctx.error = error_code::syntax_error; // undefined alias
  322|     36|            return true;
  323|     36|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  17.1k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  17.1k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 13.3k, False: 3.83k]
  ------------------
  331|  13.3k|            return true;
  332|  13.3k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  3.83k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 46, False: 3.78k]
  ------------------
  338|     46|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     46|            return true;
  340|     46|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  3.78k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  3.78k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 8, False: 3.78k]
  ------------------
  348|      8|            return true;
  349|       |
  350|  3.78k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 0, False: 3.78k]
  ------------------
  351|      0|            ctx.error = error_code::exceeded_max_expansion;
  352|      0|            ctx.custom_error_message = "alias expansion";
  353|      0|            return true;
  354|      0|         }
  355|       |
  356|  3.78k|         auto replay_it = span.begin;
  357|  3.78k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  3.78k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  3.78k|         ctx.indent_stack.clear();
  362|  3.78k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 272, False: 3.50k]
  ------------------
  363|    272|            ctx.push_indent(span.base_indent - 1);
  364|    272|         }
  365|       |
  366|  3.78k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  3.78k|         using V = std::remove_cvref_t<T>;
  369|  3.78k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  3.78k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  3.78k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  3.78k|         return true;
  376|  3.78k|      }
_ZN3glz4yaml19parse_flow_sequenceITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_:
 2698|   104k|      {
 2699|   104k|         using V = std::remove_cvref_t<T>;
 2700|   104k|         using value_type = typename V::value_type;
 2701|       |
 2702|   104k|         struct sequence_container_adapter
 2703|   104k|         {
 2704|   104k|            size_t index = 0;
 2705|       |
 2706|   104k|            inline bool fixed_capacity_reached(const V& container) const noexcept
 2707|   104k|            {
 2708|   104k|               if constexpr (!resizable<V>) {
 2709|   104k|                  return index >= container.size();
 2710|   104k|               }
 2711|   104k|               else {
 2712|   104k|                  (void)container;
 2713|   104k|                  return false;
 2714|   104k|               }
 2715|   104k|            }
 2716|       |
 2717|   104k|            inline void commit_fixed_slot() noexcept { ++index; }
 2718|       |
 2719|   104k|            inline void append(V& container, value_type&& element) noexcept
 2720|   104k|            {
 2721|   104k|               if constexpr (emplace_backable<V>) {
 2722|   104k|                  container.emplace_back(std::move(element));
 2723|   104k|               }
 2724|   104k|               else if constexpr (emplaceable<V>) {
 2725|   104k|                  container.emplace(std::move(element));
 2726|   104k|               }
 2727|   104k|            }
 2728|   104k|         };
 2729|       |
 2730|   104k|         if (it == end || *it != '[') [[unlikely]] {
  ------------------
  |  Branch (2730:14): [True: 0, False: 104k]
  |  Branch (2730:27): [True: 0, False: 104k]
  ------------------
 2731|      0|            ctx.error = error_code::syntax_error;
 2732|      0|            return;
 2733|      0|         }
 2734|       |
 2735|       |         // Overwrite (do not append to) any pre-existing contents. Must happen
 2736|       |         // before the empty-array early return below so that `[]` also clears.
 2737|   104k|         clear_sequence_before_read<Opts>(value);
 2738|       |
 2739|   104k|         ++it; // Skip '['
 2740|       |         // Skip whitespace and newlines after opening bracket (YAML allows multi-line flow sequences)
 2741|   104k|         skip_flow_ws_and_newlines(ctx, it, end);
 2742|   104k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2742:14): [True: 6, False: 104k]
  ------------------
 2743|      6|            return;
 2744|       |
 2745|       |         // Handle empty array
 2746|   104k|         if (it != end && *it == ']') {
  ------------------
  |  Branch (2746:14): [True: 102k, False: 1.50k]
  |  Branch (2746:27): [True: 38.0k, False: 64.8k]
  ------------------
 2747|  38.0k|            ++it;
 2748|  38.0k|            validate_flow_node_adjacent_tail(ctx, it, end);
 2749|  38.0k|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2749:17): [True: 6, False: 38.0k]
  ------------------
 2750|      6|               return;
 2751|  38.0k|            if constexpr (!yaml::check_flow_context(Opts)) {
 2752|  38.0k|               if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (2752:20): [True: 1.90k, False: 36.1k]
  ------------------
 2753|  1.90k|                  validate_root_flow_tail_after_close(ctx, it, end);
 2754|  1.90k|               }
 2755|  38.0k|            }
 2756|  38.0k|            return;
 2757|  38.0k|         }
 2758|       |
 2759|  66.3k|         bool just_saw_comma = false;
 2760|  66.3k|         sequence_container_adapter adapter{};
 2761|       |
 2762|  66.3k|         if constexpr (emplace_backable<V> || emplaceable<V>) {
 2763|       |            // Dynamic containers append items (vector-like and set-like)
 2764|   102k|            while (it != end) {
  ------------------
  |  Branch (2764:20): [True: 100k, False: 1.82k]
  ------------------
 2765|   100k|               skip_flow_ws_and_newlines(ctx, it, end);
 2766|   100k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2766:20): [True: 0, False: 100k]
  ------------------
 2767|      0|                  return;
 2768|       |
 2769|   100k|               if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2769:20): [True: 0, False: 100k]
  ------------------
 2770|      0|                  ctx.error = error_code::unexpected_end;
 2771|      0|                  return;
 2772|      0|               }
 2773|       |
 2774|   100k|               if (*it == ']') {
  ------------------
  |  Branch (2774:20): [True: 21.7k, False: 79.0k]
  ------------------
 2775|  21.7k|                  if (just_saw_comma) {
  ------------------
  |  Branch (2775:23): [True: 21.7k, False: 0]
  ------------------
 2776|  21.7k|                     ++it;
 2777|  21.7k|                     validate_flow_node_adjacent_tail(ctx, it, end);
 2778|  21.7k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2778:26): [True: 6, False: 21.7k]
  ------------------
 2779|      6|                        return;
 2780|  21.7k|                     if constexpr (!yaml::check_flow_context(Opts)) {
 2781|  21.7k|                        if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (2781:29): [True: 9.68k, False: 12.0k]
  ------------------
 2782|  9.68k|                           validate_root_flow_tail_after_close(ctx, it, end);
 2783|  9.68k|                        }
 2784|  21.7k|                     }
 2785|  21.7k|                     return;
 2786|  21.7k|                  }
 2787|      0|                  ctx.error = error_code::syntax_error;
 2788|      0|                  return;
 2789|  21.7k|               }
 2790|       |
 2791|  79.0k|               if (*it == ',' || *it == '#') {
  ------------------
  |  Branch (2791:20): [True: 10, False: 79.0k]
  |  Branch (2791:34): [True: 10, False: 79.0k]
  ------------------
 2792|     20|                  ctx.error = error_code::syntax_error;
 2793|     20|                  return;
 2794|     20|               }
 2795|  79.0k|               just_saw_comma = false;
 2796|       |
 2797|  79.0k|               value_type element{};
 2798|  79.0k|               from<YAML, value_type>::template op<flow_context_on<Opts>()>(element, ctx, it, end);
 2799|       |
 2800|  79.0k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2800:20): [True: 24.4k, False: 54.6k]
  ------------------
 2801|  24.4k|                  return;
 2802|       |
 2803|  54.6k|               bool saw_line_break_before_separator = false;
 2804|  54.6k|               skip_flow_ws_and_newlines(ctx, it, end, &saw_line_break_before_separator);
 2805|  54.6k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2805:20): [True: 16, False: 54.5k]
  ------------------
 2806|     16|                  return;
 2807|       |
 2808|  54.5k|               if (it != end && *it == ':') {
  ------------------
  |  Branch (2808:20): [True: 53.0k, False: 1.50k]
  |  Branch (2808:33): [True: 13.5k, False: 39.5k]
  ------------------
 2809|       |                  // In flow sequences, implicit key-value pairs must be on a single line.
 2810|  13.5k|                  if (saw_line_break_before_separator) {
  ------------------
  |  Branch (2810:23): [True: 12, False: 13.5k]
  ------------------
 2811|     12|                     ctx.error = error_code::syntax_error;
 2812|     12|                     return;
 2813|     12|                  }
 2814|  13.5k|                  if constexpr (std::same_as<std::remove_cvref_t<value_type>, glz::generic>) {
 2815|  13.5k|                     glz::generic key_node = std::move(element);
 2816|  13.5k|                     ++it;
 2817|  13.5k|                     skip_inline_ws(it, end);
 2818|       |
 2819|  13.5k|                     glz::generic mapped{};
 2820|  13.5k|                     from<YAML, glz::generic>::template op<flow_context_on<Opts>()>(mapped, ctx, it, end);
 2821|  13.5k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2821:26): [True: 294, False: 13.2k]
  ------------------
 2822|    294|                        return;
 2823|       |
 2824|  13.2k|                     std::string key;
 2825|  13.2k|                     if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (2825:26): [True: 0, False: 13.2k]
  ------------------
 2826|      0|                        return;
 2827|       |
 2828|  13.2k|                     glz::generic pair{};
 2829|  13.2k|                     pair[key] = std::move(mapped);
 2830|  13.2k|                     element = std::move(pair);
 2831|       |
 2832|  13.2k|                     skip_flow_ws_and_newlines(ctx, it, end);
 2833|  13.2k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2833:26): [True: 4, False: 13.2k]
  ------------------
 2834|      4|                        return;
 2835|       |                  }
 2836|       |                  else {
 2837|       |                     ctx.error = error_code::syntax_error;
 2838|       |                     return;
 2839|       |                  }
 2840|  13.5k|               }
 2841|       |
 2842|  54.5k|               adapter.append(value, std::move(element));
 2843|       |
 2844|  54.5k|               if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2844:20): [True: 1.53k, False: 53.0k]
  ------------------
 2845|  1.53k|                  ctx.error = error_code::unexpected_end;
 2846|  1.53k|                  return;
 2847|  1.53k|               }
 2848|       |
 2849|  53.0k|               if (*it == ']') {
  ------------------
  |  Branch (2849:20): [True: 16.0k, False: 37.0k]
  ------------------
 2850|  16.0k|                  ++it;
 2851|  16.0k|                  validate_flow_node_adjacent_tail(ctx, it, end);
 2852|  16.0k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2852:23): [True: 6, False: 16.0k]
  ------------------
 2853|      6|                     return;
 2854|  16.0k|                  if constexpr (!yaml::check_flow_context(Opts)) {
 2855|  16.0k|                     if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (2855:26): [True: 8.25k, False: 7.78k]
  ------------------
 2856|  8.25k|                        validate_root_flow_tail_after_close(ctx, it, end);
 2857|  8.25k|                     }
 2858|  16.0k|                  }
 2859|  16.0k|                  return;
 2860|  16.0k|               }
 2861|  37.0k|               else if (*it == ',') {
  ------------------
  |  Branch (2861:25): [True: 36.2k, False: 756]
  ------------------
 2862|  36.2k|                  ++it;
 2863|  36.2k|                  just_saw_comma = true;
 2864|  36.2k|                  skip_flow_ws_and_newlines(ctx, it, end);
 2865|  36.2k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2865:23): [True: 6, False: 36.2k]
  ------------------
 2866|      6|                     return;
 2867|  36.2k|               }
 2868|    756|               else {
 2869|    756|                  ctx.error = error_code::syntax_error;
 2870|    756|                  return;
 2871|    756|               }
 2872|  53.0k|            }
 2873|       |         }
 2874|       |         else if constexpr (!resizable<V>) {
 2875|       |            // Fixed-size containers (std::array)
 2876|       |            while (it != end) {
 2877|       |               skip_flow_ws_and_newlines(ctx, it, end);
 2878|       |               if (bool(ctx.error)) [[unlikely]]
 2879|       |                  return;
 2880|       |
 2881|       |               if (it == end) [[unlikely]] {
 2882|       |                  ctx.error = error_code::unexpected_end;
 2883|       |                  return;
 2884|       |               }
 2885|       |
 2886|       |               if (*it == ']') {
 2887|       |                  if (just_saw_comma) {
 2888|       |                     ++it;
 2889|       |                     validate_flow_node_adjacent_tail(ctx, it, end);
 2890|       |                     if (bool(ctx.error)) [[unlikely]]
 2891|       |                        return;
 2892|       |                     if constexpr (!yaml::check_flow_context(Opts)) {
 2893|       |                        if (ctx.current_indent() < 0) {
 2894|       |                           validate_root_flow_tail_after_close(ctx, it, end);
 2895|       |                        }
 2896|       |                     }
 2897|       |                     return;
 2898|       |                  }
 2899|       |                  ctx.error = error_code::syntax_error;
 2900|       |                  return;
 2901|       |               }
 2902|       |
 2903|       |               if (*it == ',' || *it == '#') {
 2904|       |                  ctx.error = error_code::syntax_error;
 2905|       |                  return;
 2906|       |               }
 2907|       |               just_saw_comma = false;
 2908|       |
 2909|       |               // An item beyond the last slot is an error, as in JSON.
 2910|       |               if (adapter.fixed_capacity_reached(value)) [[unlikely]] {
 2911|       |                  ctx.error = error_code::exceeded_static_array_size;
 2912|       |                  return;
 2913|       |               }
 2914|       |
 2915|       |               from<YAML, value_type>::template op<flow_context_on<Opts>()>(value[adapter.index], ctx, it, end);
 2916|       |
 2917|       |               if (bool(ctx.error)) [[unlikely]]
 2918|       |                  return;
 2919|       |
 2920|       |               adapter.commit_fixed_slot();
 2921|       |               skip_flow_ws_and_newlines(ctx, it, end);
 2922|       |               if (bool(ctx.error)) [[unlikely]]
 2923|       |                  return;
 2924|       |
 2925|       |               if (it == end) [[unlikely]] {
 2926|       |                  ctx.error = error_code::unexpected_end;
 2927|       |                  return;
 2928|       |               }
 2929|       |
 2930|       |               if (*it == ']') {
 2931|       |                  ++it;
 2932|       |                  validate_flow_node_adjacent_tail(ctx, it, end);
 2933|       |                  if (bool(ctx.error)) [[unlikely]]
 2934|       |                     return;
 2935|       |                  if constexpr (!yaml::check_flow_context(Opts)) {
 2936|       |                     if (ctx.current_indent() < 0) {
 2937|       |                        validate_root_flow_tail_after_close(ctx, it, end);
 2938|       |                     }
 2939|       |                  }
 2940|       |                  return;
 2941|       |               }
 2942|       |               else if (*it == ',') {
 2943|       |                  ++it;
 2944|       |                  just_saw_comma = true;
 2945|       |                  skip_flow_ws_and_newlines(ctx, it, end);
 2946|       |                  if (bool(ctx.error)) [[unlikely]]
 2947|       |                     return;
 2948|       |               }
 2949|       |               else {
 2950|       |                  ctx.error = error_code::syntax_error;
 2951|       |                  return;
 2952|       |               }
 2953|       |            }
 2954|       |         }
 2955|       |         else {
 2956|       |            ctx.error = error_code::syntax_error;
 2957|       |            return;
 2958|       |         }
 2959|  66.3k|      }
_ZN3glz4yaml26clear_sequence_before_readITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEEEEvRT0_:
 2682|   378k|      {
 2683|   378k|         if constexpr (emplace_backable<V> && requires { value.clear(); }) {
 2684|       |            // vector-like: honor the append_arrays option, matching json/read.hpp
 2685|   378k|            if constexpr (!check_append_arrays(Opts)) {
 2686|   378k|               value.clear();
 2687|   378k|            }
 2688|       |         }
 2689|       |         else if constexpr (emplaceable<V> && requires { value.clear(); }) {
 2690|       |            // set-like: json/read.hpp clears unconditionally; append_arrays does not apply
 2691|       |            value.clear();
 2692|       |         }
 2693|   378k|      }
_ZN3glz4yaml35validate_root_flow_tail_after_closeINS0_12yaml_contextEPKcS4_EEvRT_RT0_T1_:
  974|  26.0k|      {
  975|  26.0k|         auto is_document_start = [&](auto pos) {
  976|  26.0k|            if (end - pos >= 3 && pos[0] == '-' && pos[1] == '-' && pos[2] == '-') {
  977|  26.0k|               auto after = pos + 3;
  978|  26.0k|               return after == end || *after == ' ' || *after == '\t' || *after == '\n' || *after == '\r' ||
  979|  26.0k|                      *after == '#';
  980|  26.0k|            }
  981|  26.0k|            return false;
  982|  26.0k|         };
  983|       |
  984|  26.0k|         bool at_line_start = false;
  985|  26.0k|         auto tail = it;
  986|  48.8k|         while (tail != end) {
  ------------------
  |  Branch (986:17): [True: 26.8k, False: 22.0k]
  ------------------
  987|  26.8k|            auto line = tail;
  988|  26.8k|            skip_inline_ws(line, end);
  989|       |
  990|  26.8k|            if (line == end) {
  ------------------
  |  Branch (990:17): [True: 1.14k, False: 25.7k]
  ------------------
  991|  1.14k|               return;
  992|  1.14k|            }
  993|       |
  994|  25.7k|            if (*line == '\n' || *line == '\r') {
  ------------------
  |  Branch (994:17): [True: 8.05k, False: 17.6k]
  |  Branch (994:34): [True: 9.50k, False: 8.17k]
  ------------------
  995|  17.5k|               tail = line;
  996|  17.5k|               skip_newline(tail, end);
  997|  17.5k|               at_line_start = true;
  998|  17.5k|               continue;
  999|  17.5k|            }
 1000|       |
 1001|  8.17k|            if (*line == '#') {
  ------------------
  |  Branch (1001:17): [True: 5.39k, False: 2.78k]
  ------------------
 1002|  5.39k|               if (!at_line_start && line == it) {
  ------------------
  |  Branch (1002:20): [True: 2.15k, False: 3.23k]
  |  Branch (1002:38): [True: 26, False: 2.12k]
  ------------------
 1003|     26|                  ctx.error = error_code::syntax_error;
 1004|     26|                  return;
 1005|     26|               }
 1006|  5.36k|               tail = line;
 1007|  5.36k|               skip_comment(tail, end);
 1008|  5.36k|               if (tail != end && (*tail == '\n' || *tail == '\r')) {
  ------------------
  |  Branch (1008:20): [True: 5.29k, False: 74]
  |  Branch (1008:36): [True: 3.93k, False: 1.36k]
  |  Branch (1008:53): [True: 1.33k, False: 22]
  ------------------
 1009|  5.27k|                  skip_newline(tail, end);
 1010|  5.27k|                  at_line_start = true;
 1011|  5.27k|                  continue;
 1012|  5.27k|               }
 1013|     96|               return;
 1014|  5.36k|            }
 1015|       |
 1016|  2.78k|            if (at_line_start && (at_document_end(line, end) || is_document_start(line))) {
  ------------------
  |  Branch (1016:17): [True: 2.19k, False: 588]
  |  Branch (1016:35): [True: 826, False: 1.36k]
  |  Branch (1016:65): [True: 1.15k, False: 216]
  ------------------
 1017|  1.97k|               return;
 1018|  1.97k|            }
 1019|       |
 1020|    804|            ctx.error = error_code::syntax_error;
 1021|    804|            return;
 1022|  2.78k|         }
 1023|  26.0k|      }
_ZZN3glz4yaml35validate_root_flow_tail_after_closeINS0_12yaml_contextEPKcS4_EEvRT_RT0_T1_ENKUlS5_E_clIS4_EEDaS5_:
  975|  1.36k|         auto is_document_start = [&](auto pos) {
  976|  1.36k|            if (end - pos >= 3 && pos[0] == '-' && pos[1] == '-' && pos[2] == '-') {
  ------------------
  |  Branch (976:17): [True: 1.27k, False: 98]
  |  Branch (976:35): [True: 1.17k, False: 96]
  |  Branch (976:52): [True: 1.16k, False: 14]
  |  Branch (976:69): [True: 1.15k, False: 6]
  ------------------
  977|  1.15k|               auto after = pos + 3;
  978|  1.15k|               return after == end || *after == ' ' || *after == '\t' || *after == '\n' || *after == '\r' ||
  ------------------
  |  Branch (978:23): [True: 196, False: 958]
  |  Branch (978:39): [True: 190, False: 768]
  |  Branch (978:56): [True: 194, False: 574]
  |  Branch (978:74): [True: 194, False: 380]
  |  Branch (978:92): [True: 190, False: 190]
  ------------------
  979|    190|                      *after == '#';
  ------------------
  |  Branch (979:23): [True: 188, False: 2]
  ------------------
  980|  1.15k|            }
  981|    214|            return false;
  982|  1.36k|         };
_ZZN3glz4yaml19parse_flow_sequenceITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_EN26sequence_container_adapter6appendESC_OS8_:
 2720|  54.2k|            {
 2721|  54.2k|               if constexpr (emplace_backable<V>) {
 2722|  54.2k|                  container.emplace_back(std::move(element));
 2723|       |               }
 2724|       |               else if constexpr (emplaceable<V>) {
 2725|       |                  container.emplace(std::move(element));
 2726|       |               }
 2727|  54.2k|            }
_ZN3glz4yaml20parse_block_sequenceITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_i:
 3186|   274k|      {
 3187|   274k|         using V = std::remove_cvref_t<T>;
 3188|   274k|         using value_type = typename V::value_type;
 3189|       |
 3190|   274k|         struct sequence_container_adapter
 3191|   274k|         {
 3192|   274k|            size_t index = 0;
 3193|       |
 3194|   274k|            inline bool fixed_capacity_reached(const V& container) const noexcept
 3195|   274k|            {
 3196|   274k|               if constexpr (!resizable<V>) {
 3197|   274k|                  return index >= container.size();
 3198|   274k|               }
 3199|   274k|               else {
 3200|   274k|                  (void)container;
 3201|   274k|                  return false;
 3202|   274k|               }
 3203|   274k|            }
 3204|       |
 3205|   274k|            inline void commit_fixed_slot() noexcept { ++index; }
 3206|       |
 3207|   274k|            inline void append(V& container, value_type&& element) noexcept
 3208|   274k|            {
 3209|   274k|               if constexpr (emplace_backable<V>) {
 3210|   274k|                  container.emplace_back(std::move(element));
 3211|   274k|               }
 3212|   274k|               else if constexpr (emplaceable<V>) {
 3213|   274k|                  container.emplace(std::move(element));
 3214|   274k|               }
 3215|   274k|            }
 3216|   274k|         };
 3217|       |
 3218|       |         // Overwrite (do not append to) any pre-existing contents. A block
 3219|       |         // sequence is only entered once a '-' item is confirmed, so clearing
 3220|       |         // up front correctly (re)assigns the container to the parsed sequence.
 3221|   274k|         clear_sequence_before_read<Opts>(value);
 3222|       |
 3223|   274k|         sequence_container_adapter adapter{};
 3224|       |
 3225|       |         // Track if this is the first item (for handling whitespace-consumed case)
 3226|   274k|         bool first_item = true;
 3227|   274k|         bool has_pending_item_anchor = false;
 3228|   274k|         std::string pending_item_anchor_name{};
 3229|   274k|         int32_t pending_item_anchor_indent = sequence_indent;
 3230|       |
 3231|   759k|         while (it != end) {
  ------------------
  |  Branch (3231:17): [True: 676k, False: 83.5k]
  ------------------
 3232|       |            // Skip blank lines and comments, track indent
 3233|   676k|            int32_t line_indent = 0;
 3234|   676k|            int32_t dash_col = -1; // actual column of the '-' on the line
 3235|   676k|            auto line_start = it;
 3236|       |
 3237|  1.40M|            while (it != end) {
  ------------------
  |  Branch (3237:20): [True: 1.36M, False: 37.1k]
  ------------------
 3238|  1.36M|               if (*it == '#') {
  ------------------
  |  Branch (3238:20): [True: 165k, False: 1.19M]
  ------------------
 3239|   165k|                  skip_comment(it, end);
 3240|   165k|                  skip_newline(it, end);
 3241|   165k|                  line_start = it;
 3242|   165k|                  line_indent = 0;
 3243|   165k|               }
 3244|  1.19M|               else if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3244:25): [True: 229k, False: 969k]
  |  Branch (3244:40): [True: 182k, False: 787k]
  ------------------
 3245|   411k|                  skip_newline(it, end);
 3246|   411k|                  line_start = it;
 3247|   411k|                  line_indent = 0;
 3248|   411k|               }
 3249|   787k|               else if (*it == ' ') {
  ------------------
  |  Branch (3249:25): [True: 160k, False: 626k]
  ------------------
 3250|   160k|                  line_start = it;
 3251|   160k|                  line_indent = 0;
 3252|   858k|                  while (it != end && *it == ' ') {
  ------------------
  |  Branch (3252:26): [True: 854k, False: 4.10k]
  |  Branch (3252:39): [True: 698k, False: 156k]
  ------------------
 3253|   698k|                     ++line_indent;
 3254|   698k|                     ++it;
 3255|   698k|                  }
 3256|       |
 3257|   160k|                  bool saw_tab = false;
 3258|   231k|                  while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3258:26): [True: 225k, False: 6.09k]
  |  Branch (3258:40): [True: 9.51k, False: 216k]
  |  Branch (3258:54): [True: 62.0k, False: 154k]
  ------------------
 3259|  71.5k|                     saw_tab = saw_tab || (*it == '\t');
  ------------------
  |  Branch (3259:32): [True: 12.5k, False: 58.9k]
  |  Branch (3259:43): [True: 58.9k, False: 0]
  ------------------
 3260|  71.5k|                     ++it;
 3261|  71.5k|                  }
 3262|       |
 3263|   160k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3263:23): [True: 6.09k, False: 154k]
  |  Branch (3263:36): [True: 39.2k, False: 114k]
  |  Branch (3263:51): [True: 35.8k, False: 79.0k]
  |  Branch (3263:66): [True: 32.8k, False: 46.2k]
  ------------------
 3264|       |                     // Blank or comment line - continue to next line
 3265|   114k|                     if (it != end && *it == '#') {
  ------------------
  |  Branch (3265:26): [True: 107k, False: 6.09k]
  |  Branch (3265:39): [True: 32.8k, False: 75.0k]
  ------------------
 3266|  32.8k|                        skip_comment(it, end);
 3267|  32.8k|                     }
 3268|   114k|                     line_indent = 0;
 3269|   114k|                     continue;
 3270|   114k|                  }
 3271|       |
 3272|  46.2k|                  if (saw_tab) {
  ------------------
  |  Branch (3272:23): [True: 24, False: 46.2k]
  ------------------
 3273|     24|                     ctx.error = error_code::syntax_error;
 3274|     24|                     return;
 3275|     24|                  }
 3276|  46.2k|                  break; // Found content
 3277|  46.2k|               }
 3278|   626k|               else if (*it == '\t') {
  ------------------
  |  Branch (3278:25): [True: 34.0k, False: 592k]
  ------------------
 3279|  34.0k|                  line_start = it;
 3280|  96.9k|                  while (it != end && (*it == ' ' || *it == '\t')) ++it;
  ------------------
  |  Branch (3280:26): [True: 95.7k, False: 1.19k]
  |  Branch (3280:40): [True: 2.05k, False: 93.7k]
  |  Branch (3280:54): [True: 60.8k, False: 32.8k]
  ------------------
 3281|  34.0k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3281:23): [True: 1.19k, False: 32.8k]
  |  Branch (3281:36): [True: 13.2k, False: 19.6k]
  |  Branch (3281:51): [True: 3.55k, False: 16.1k]
  |  Branch (3281:66): [True: 16.0k, False: 42]
  ------------------
 3282|  34.0k|                     if (it != end && *it == '#') {
  ------------------
  |  Branch (3282:26): [True: 32.8k, False: 1.19k]
  |  Branch (3282:39): [True: 16.0k, False: 16.7k]
  ------------------
 3283|  16.0k|                        skip_comment(it, end);
 3284|  16.0k|                     }
 3285|  34.0k|                     line_indent = 0;
 3286|  34.0k|                     continue;
 3287|  34.0k|                  }
 3288|     42|                  ctx.error = error_code::syntax_error;
 3289|     42|                  return;
 3290|  34.0k|               }
 3291|   592k|               else {
 3292|       |                  // At content (no leading space on this line)
 3293|       |                  // If first item and at '-', whitespace was consumed by caller;
 3294|       |                  // treat as having correct indentation
 3295|   592k|                  if (first_item && *it == '-') {
  ------------------
  |  Branch (3295:23): [True: 274k, False: 318k]
  |  Branch (3295:37): [True: 272k, False: 2.05k]
  ------------------
 3296|   272k|                     line_indent = sequence_indent;
 3297|   272k|                     if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3298|   272k|                        if (ctx.stream_begin && it > ctx.stream_begin) {
  ------------------
  |  Branch (3298:29): [True: 272k, False: 0]
  |  Branch (3298:49): [True: 272k, False: 0]
  ------------------
 3299|   272k|                           auto probe = it;
 3300|   272k|                           int32_t leading_ws = 0;
 3301|   272k|                           bool saw_tab = false;
 3302|   595k|                           while (probe > ctx.stream_begin && (*(probe - 1) == ' ' || *(probe - 1) == '\t')) {
  ------------------
  |  Branch (3302:35): [True: 595k, False: 0]
  |  Branch (3302:64): [True: 315k, False: 280k]
  |  Branch (3302:87): [True: 7.92k, False: 272k]
  ------------------
 3303|   323k|                              --probe;
 3304|   323k|                              ++leading_ws;
 3305|   323k|                              saw_tab = saw_tab || (*probe == '\t');
  ------------------
  |  Branch (3305:41): [True: 378, False: 323k]
  |  Branch (3305:52): [True: 7.89k, False: 315k]
  ------------------
 3306|   323k|                           }
 3307|   272k|                           if (probe == ctx.stream_begin || *(probe - 1) == '\n' || *(probe - 1) == '\r') {
  ------------------
  |  Branch (3307:32): [True: 0, False: 272k]
  |  Branch (3307:61): [True: 19.9k, False: 252k]
  |  Branch (3307:85): [True: 62.7k, False: 189k]
  ------------------
 3308|  82.6k|                              if (saw_tab) {
  ------------------
  |  Branch (3308:35): [True: 14, False: 82.6k]
  ------------------
 3309|     14|                                 ctx.error = error_code::syntax_error;
 3310|     14|                                 return;
 3311|     14|                              }
 3312|  82.6k|                              line_indent = (std::max)(line_indent, leading_ws);
 3313|  82.6k|                           }
 3314|   272k|                        }
 3315|   272k|                     }
 3316|   272k|                  }
 3317|   272k|                  break;
 3318|   592k|               }
 3319|  1.36M|            }
 3320|       |
 3321|   676k|            if (it == end) break;
  ------------------
  |  Branch (3321:17): [True: 37.1k, False: 639k]
  ------------------
 3322|       |
 3323|       |            // Check for document end marker
 3324|   639k|            if (at_document_end(it, end)) break;
  ------------------
  |  Branch (3324:17): [True: 5.68k, False: 633k]
  ------------------
 3325|       |
 3326|       |            // Check for dedent
 3327|   633k|            if (line_indent < sequence_indent) {
  ------------------
  |  Branch (3327:17): [True: 48.6k, False: 584k]
  ------------------
 3328|  48.6k|               it = line_start;
 3329|  48.6k|               return;
 3330|  48.6k|            }
 3331|       |
 3332|   584k|            if (*it == '&') {
  ------------------
  |  Branch (3332:17): [True: 12.7k, False: 571k]
  ------------------
 3333|       |               // Standalone anchor lines before "- item" are only supported for
 3334|       |               // indentless mapping values. At top-level block sequences these are
 3335|       |               // malformed in yaml-test-suite cases.
 3336|  12.7k|               if (!ctx.allow_indentless_sequence) {
  ------------------
  |  Branch (3336:20): [True: 42, False: 12.6k]
  ------------------
 3337|     42|                  ctx.error = error_code::syntax_error;
 3338|     42|                  return;
 3339|     42|               }
 3340|       |
 3341|  12.6k|               ++it;
 3342|  12.6k|               auto pending_name = parse_anchor_name(it, end);
 3343|  12.6k|               if (pending_name.empty()) {
  ------------------
  |  Branch (3343:20): [True: 16, False: 12.6k]
  ------------------
 3344|     16|                  ctx.error = error_code::syntax_error;
 3345|     16|                  return;
 3346|     16|               }
 3347|  12.6k|               skip_inline_ws(it, end);
 3348|  12.6k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (3348:20): [True: 12.6k, False: 30]
  |  Branch (3348:33): [True: 2.20k, False: 10.4k]
  ------------------
 3349|  2.20k|                  skip_comment(it, end);
 3350|  2.20k|               }
 3351|       |
 3352|  12.6k|               has_pending_item_anchor = true;
 3353|  12.6k|               pending_item_anchor_name = std::string(pending_name);
 3354|  12.6k|               pending_item_anchor_indent = line_indent;
 3355|       |
 3356|  12.6k|               if (it == end || (*it != '\n' && *it != '\r')) {
  ------------------
  |  Branch (3356:20): [True: 30, False: 12.6k]
  |  Branch (3356:34): [True: 7.06k, False: 5.56k]
  |  Branch (3356:49): [True: 22, False: 7.04k]
  ------------------
 3357|     52|                  ctx.error = error_code::syntax_error;
 3358|     52|                  return;
 3359|     52|               }
 3360|       |
 3361|  12.6k|               skip_newline(it, end);
 3362|  12.6k|               continue;
 3363|  12.6k|            }
 3364|       |
 3365|       |            // Expect dash for sequence item
 3366|   571k|            if (*it != '-') {
  ------------------
  |  Branch (3366:17): [True: 88.8k, False: 483k]
  ------------------
 3367|  88.8k|               it = line_start;
 3368|  88.8k|               return;
 3369|  88.8k|            }
 3370|       |
 3371|       |            // Compute the actual column of this sequence dash.
 3372|       |            // This is needed by plain-scalar multiline folding to distinguish
 3373|       |            // sibling "- item" entries from deeper "- " continuation content.
 3374|   483k|            dash_col = line_indent;
 3375|   483k|            if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3376|   483k|               if (ctx.stream_begin) {
  ------------------
  |  Branch (3376:20): [True: 483k, False: 14]
  ------------------
 3377|   483k|                  dash_col = ctx.line_prefix_before(&*it).column;
 3378|   483k|               }
 3379|   483k|            }
 3380|       |
 3381|   483k|            ++it; // Skip '-'
 3382|       |
 3383|       |            // Check for valid sequence item indicator (- followed by space or newline)
 3384|   483k|            if (it != end && !yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (3384:17): [True: 470k, False: 12.3k]
  |  Branch (3384:30): [True: 5.79k, False: 464k]
  ------------------
 3385|       |               // Not a sequence item (could be a number like -5)
 3386|  5.79k|               it = line_start;
 3387|  5.79k|               return;
 3388|  5.79k|            }
 3389|       |
 3390|   477k|            bool saw_tab_after_dash = false;
 3391|   885k|            while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3391:20): [True: 871k, False: 14.1k]
  |  Branch (3391:34): [True: 367k, False: 503k]
  |  Branch (3391:48): [True: 40.8k, False: 463k]
  ------------------
 3392|   408k|               saw_tab_after_dash = saw_tab_after_dash || (*it == '\t');
  ------------------
  |  Branch (3392:37): [True: 7.36k, False: 401k]
  |  Branch (3392:59): [True: 36.8k, False: 364k]
  ------------------
 3393|   408k|               ++it;
 3394|   408k|            }
 3395|       |            // A tab-separated nested "- " marker is not valid block indentation.
 3396|   477k|            if (saw_tab_after_dash && it != end && *it == '-') {
  ------------------
  |  Branch (3396:17): [True: 36.8k, False: 440k]
  |  Branch (3396:39): [True: 35.9k, False: 856]
  |  Branch (3396:52): [True: 712, False: 35.2k]
  ------------------
 3397|    712|               const auto after_dash = it + 1;
 3398|    712|               if (after_dash == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_dash)]) {
  ------------------
  |  Branch (3398:20): [True: 6, False: 706]
  |  Branch (3398:41): [True: 6, False: 700]
  ------------------
 3399|     12|                  ctx.error = error_code::syntax_error;
 3400|     12|                  return;
 3401|     12|               }
 3402|    712|            }
 3403|       |
 3404|       |            // Get reference to element to parse into
 3405|   477k|            auto parse_element = [&](auto& element) {
 3406|   477k|               const char* element_start = (it != end) ? &*it : nullptr;
 3407|       |
 3408|       |               // Check what follows
 3409|   477k|               if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 3410|       |                  // Content on same line as dash - set indent to one less than content column
 3411|       |                  // This allows nested block mappings to continue parsing keys at the content indent
 3412|       |                  // For "- key: val", if dash is at column 0, content is at column 2
 3413|       |                  // We set parent indent to 1 so keys at column 2 pass the "indent > parent" check
 3414|   477k|                  if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 3415|   477k|                     return;
 3416|   477k|                  const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3417|   477k|                  const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3418|   477k|                  ctx.sequence_item_value_context = true;
 3419|   477k|                  ctx.sequence_dash_indent = dash_col;
 3420|   477k|                  from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3421|   477k|                  ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3422|   477k|                  ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3423|   477k|                  ctx.pop_indent();
 3424|   477k|               }
 3425|   477k|               else {
 3426|       |                  // Value on next line - nested block
 3427|   477k|                  skip_ws_and_comment(it, end);
 3428|   477k|                  skip_newline(it, end);
 3429|       |
 3430|       |                  // Get indent of nested content
 3431|   477k|                  auto nested_start = it;
 3432|   477k|                  int32_t nested_indent = measure_indent(it, end, ctx);
 3433|   477k|                  if (bool(ctx.error)) [[unlikely]]
 3434|   477k|                     return;
 3435|   477k|                  it = nested_start;
 3436|       |
 3437|       |                  // Content is nested only if indented more than the current line.
 3438|       |                  // When line_indent is negative (root level), use 0 as the baseline.
 3439|       |                  // This prevents content at column 0 from being treated as nested.
 3440|   477k|                  const int32_t effective_line_indent = (line_indent < 0) ? 0 : line_indent;
 3441|   477k|                  if (nested_indent > effective_line_indent) {
 3442|       |                     // Save and set indent for nested parsing.
 3443|       |                     // A struct element reads the pushed indent as its own key column; every
 3444|       |                     // other element type reads it as the enclosing baseline, so it gets one
 3445|       |                     // less than the content indent and its content passes "indent > parent".
 3446|   477k|                     const int32_t element_indent =
 3447|   477k|                        receives_block_mapping_column<value_type>() ? nested_indent : nested_indent - 1;
 3448|   477k|                     if (!ctx.push_indent(element_indent)) [[unlikely]]
 3449|   477k|                        return;
 3450|   477k|                     const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3451|   477k|                     const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3452|   477k|                     ctx.sequence_item_value_context = true;
 3453|   477k|                     ctx.sequence_dash_indent = dash_col;
 3454|   477k|                     from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3455|   477k|                     ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3456|   477k|                     ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3457|   477k|                     ctx.pop_indent();
 3458|   477k|                  }
 3459|       |                  // else: empty element (default constructed)
 3460|   477k|               }
 3461|       |
 3462|   477k|               if (has_pending_item_anchor && !bool(ctx.error)) {
 3463|   477k|                  const char* element_end = (it != end) ? &*it : element_start;
 3464|   477k|                  ctx.anchors[std::move(pending_item_anchor_name)] = {element_start, element_end,
 3465|   477k|                                                                      pending_item_anchor_indent};
 3466|   477k|                  has_pending_item_anchor = false;
 3467|   477k|               }
 3468|   477k|            };
 3469|       |
 3470|   477k|            if constexpr (emplace_backable<V>) {
 3471|   477k|               auto& element = value.emplace_back();
 3472|   477k|               parse_element(element);
 3473|       |            }
 3474|       |            else if constexpr (emplaceable<V>) {
 3475|       |               value_type element{};
 3476|       |               parse_element(element);
 3477|       |               if (!bool(ctx.error)) {
 3478|       |                  adapter.append(value, std::move(element));
 3479|       |               }
 3480|       |            }
 3481|       |            else if constexpr (!resizable<V>) {
 3482|       |               // Fixed-size (e.g. std::array): an item beyond the last slot is an error, as in JSON.
 3483|       |               // Checked only once another item is confirmed, so a full container still ends cleanly.
 3484|       |               if (adapter.fixed_capacity_reached(value)) [[unlikely]] {
 3485|       |                  ctx.error = error_code::exceeded_static_array_size;
 3486|       |                  return;
 3487|       |               }
 3488|       |               parse_element(value[adapter.index]);
 3489|       |               adapter.commit_fixed_slot();
 3490|       |            }
 3491|       |            else {
 3492|       |               ctx.error = error_code::syntax_error;
 3493|       |               return;
 3494|       |            }
 3495|       |
 3496|   477k|            first_item = false;
 3497|       |
 3498|   477k|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3498:17): [True: 4.19k, False: 473k]
  ------------------
 3499|  4.19k|               return;
 3500|       |
 3501|       |            // Note: after parsing nested block content, iterator may already be
 3502|       |            // at the start of the next line. The outer loop will handle it.
 3503|   477k|         }
 3504|   274k|      }
_ZZN3glz4yaml20parse_block_sequenceITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_iENKUlRT_E_clIS8_EEDaSO_:
 3405|   477k|            auto parse_element = [&](auto& element) {
 3406|   477k|               const char* element_start = (it != end) ? &*it : nullptr;
  ------------------
  |  Branch (3406:44): [True: 463k, False: 14.1k]
  ------------------
 3407|       |
 3408|       |               // Check what follows
 3409|   477k|               if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (3409:20): [True: 463k, False: 14.1k]
  |  Branch (3409:33): [True: 241k, False: 221k]
  ------------------
 3410|       |                  // Content on same line as dash - set indent to one less than content column
 3411|       |                  // This allows nested block mappings to continue parsing keys at the content indent
 3412|       |                  // For "- key: val", if dash is at column 0, content is at column 2
 3413|       |                  // We set parent indent to 1 so keys at column 2 pass the "indent > parent" check
 3414|   241k|                  if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
  ------------------
  |  Branch (3414:23): [True: 0, False: 241k]
  ------------------
 3415|      0|                     return;
 3416|   241k|                  const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3417|   241k|                  const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3418|   241k|                  ctx.sequence_item_value_context = true;
 3419|   241k|                  ctx.sequence_dash_indent = dash_col;
 3420|   241k|                  from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3421|   241k|                  ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3422|   241k|                  ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3423|   241k|                  ctx.pop_indent();
 3424|   241k|               }
 3425|   235k|               else {
 3426|       |                  // Value on next line - nested block
 3427|   235k|                  skip_ws_and_comment(it, end);
 3428|   235k|                  skip_newline(it, end);
 3429|       |
 3430|       |                  // Get indent of nested content
 3431|   235k|                  auto nested_start = it;
 3432|   235k|                  int32_t nested_indent = measure_indent(it, end, ctx);
 3433|   235k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3433:23): [True: 6, False: 235k]
  ------------------
 3434|      6|                     return;
 3435|   235k|                  it = nested_start;
 3436|       |
 3437|       |                  // Content is nested only if indented more than the current line.
 3438|       |                  // When line_indent is negative (root level), use 0 as the baseline.
 3439|       |                  // This prevents content at column 0 from being treated as nested.
 3440|   235k|                  const int32_t effective_line_indent = (line_indent < 0) ? 0 : line_indent;
  ------------------
  |  Branch (3440:57): [True: 13.4k, False: 222k]
  ------------------
 3441|   235k|                  if (nested_indent > effective_line_indent) {
  ------------------
  |  Branch (3441:23): [True: 72.7k, False: 162k]
  ------------------
 3442|       |                     // Save and set indent for nested parsing.
 3443|       |                     // A struct element reads the pushed indent as its own key column; every
 3444|       |                     // other element type reads it as the enclosing baseline, so it gets one
 3445|       |                     // less than the content indent and its content passes "indent > parent".
 3446|  72.7k|                     const int32_t element_indent =
 3447|  72.7k|                        receives_block_mapping_column<value_type>() ? nested_indent : nested_indent - 1;
  ------------------
  |  Branch (3447:25): [Folded, False: 72.7k]
  ------------------
 3448|  72.7k|                     if (!ctx.push_indent(element_indent)) [[unlikely]]
  ------------------
  |  Branch (3448:26): [True: 0, False: 72.7k]
  ------------------
 3449|      0|                        return;
 3450|  72.7k|                     const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3451|  72.7k|                     const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3452|  72.7k|                     ctx.sequence_item_value_context = true;
 3453|  72.7k|                     ctx.sequence_dash_indent = dash_col;
 3454|  72.7k|                     from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3455|  72.7k|                     ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3456|  72.7k|                     ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3457|  72.7k|                     ctx.pop_indent();
 3458|  72.7k|                  }
 3459|       |                  // else: empty element (default constructed)
 3460|   235k|               }
 3461|       |
 3462|   477k|               if (has_pending_item_anchor && !bool(ctx.error)) {
  ------------------
  |  Branch (3462:20): [True: 2.25k, False: 475k]
  |  Branch (3462:47): [True: 2.18k, False: 62]
  ------------------
 3463|  2.18k|                  const char* element_end = (it != end) ? &*it : element_start;
  ------------------
  |  Branch (3463:45): [True: 1.37k, False: 810]
  ------------------
 3464|  2.18k|                  ctx.anchors[std::move(pending_item_anchor_name)] = {element_start, element_end,
 3465|  2.18k|                                                                      pending_item_anchor_indent};
 3466|  2.18k|                  has_pending_item_anchor = false;
 3467|  2.18k|               }
 3468|   477k|            };
_ZN3glz29parse_block_mapping_or_stringINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERSH_RNS_4yaml12yaml_contextERPKcSO_EEvOT1_OT2_OT3_T4_:
 5575|   596k|   {
 5576|       |      if constexpr (yaml::check_flow_context(Opts)) {
 5577|       |         // In flow context, only treat plain content as an implicit "key: value"
 5578|       |         // when a mapping separator appears before the next top-level flow delimiter.
 5579|       |         auto could_be_implicit_flow_pair = [&](auto pos) {
 5580|       |            // Bounded by the longest implicit key the spec allows: unbounded, this probe runs
 5581|       |            // once per entry per nesting level over the whole remaining flow collection.
 5582|       |            const auto stop = yaml::implicit_key_scan_end(pos, end);
 5583|       |            // See `line_could_be_block_mapping` for why a quote is an indicator only where a node
 5584|       |            // can begin. Brackets need no such guard here: ns-plain-safe-in keeps them out of a
 5585|       |            // flow-context plain scalar, so every one of them is an indicator.
 5586|       |            bool at_node_start = true;
 5587|       |            int depth = 0;
 5588|       |            while (pos != stop) {
 5589|       |               const char c = *pos;
 5590|       |               if (c == ' ' || c == '\t') {
 5591|       |                  ++pos;
 5592|       |                  continue;
 5593|       |               }
 5594|       |               const bool node_start = std::exchange(at_node_start, false);
 5595|       |
 5596|       |               if ((c == '"' || c == '\'') && node_start) {
 5597|       |                  if (not yaml::skip_probe_quoted_scalar(pos, stop)) return false;
 5598|       |                  continue;
 5599|       |               }
 5600|       |               if (c == '[' || c == '{') {
 5601|       |                  ++depth;
 5602|       |                  at_node_start = true;
 5603|       |                  ++pos;
 5604|       |                  continue;
 5605|       |               }
 5606|       |               if (c == ']' || c == '}') {
 5607|       |                  if (depth == 0) return false;
 5608|       |                  --depth;
 5609|       |                  ++pos;
 5610|       |                  continue;
 5611|       |               }
 5612|       |               if (c == ',' && depth == 0) return false;
 5613|       |               if (c == ':' && depth == 0) {
 5614|       |                  auto next = pos + 1;
 5615|       |                  return next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
 5616|       |               }
 5617|       |               // Inside a nested collection ',' separates entries and ':' ends a key.
 5618|       |               if (c == ',' || c == ':') {
 5619|       |                  at_node_start = true;
 5620|       |                  ++pos;
 5621|       |                  continue;
 5622|       |               }
 5623|       |               if (node_start && yaml::skip_probe_node_property(pos, stop)) {
 5624|       |                  at_node_start = true;
 5625|       |                  continue;
 5626|       |               }
 5627|       |               ++pos;
 5628|       |            }
 5629|       |            return false;
 5630|       |         };
 5631|       |
 5632|       |         if (could_be_implicit_flow_pair(it) || line_could_be_flow_mapping(it, end)) {
 5633|       |            if (try_parse_block_mapping_into_variant<Variant, Opts>(value, ctx, it, end)) {
 5634|       |               return;
 5635|       |            }
 5636|       |            if (bool(ctx.error)) {
 5637|       |               return;
 5638|       |            }
 5639|       |         }
 5640|       |
 5641|       |         process_yaml_variant_alternatives<Variant, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 5642|       |         return;
 5643|       |      }
 5644|       |
 5645|   596k|      if (try_parse_block_mapping_into_variant<Variant, Opts>(value, ctx, it, end)) {
  ------------------
  |  Branch (5645:11): [True: 169k, False: 427k]
  ------------------
 5646|   169k|         return;
 5647|   169k|      }
 5648|       |      // If an error was set (e.g., malformed flow collection in value), don't try to parse as string
 5649|   427k|      if (bool(ctx.error)) {
  ------------------
  |  Branch (5649:11): [True: 56.6k, False: 370k]
  ------------------
 5650|  56.6k|         return;
 5651|  56.6k|      }
 5652|   370k|      process_yaml_variant_alternatives<Variant, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 5653|   370k|   }
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_ENKUlT_E0_clISM_EEDaSZ_:
 6007|  70.9k|            auto is_word_boundary = [&](const auto ptr) {
 6008|  70.9k|               if (ptr == end) {
  ------------------
  |  Branch (6008:20): [True: 3.33k, False: 67.6k]
  ------------------
 6009|  3.33k|                  return true;
 6010|  3.33k|               }
 6011|  67.6k|               if (*ptr == ':') {
  ------------------
  |  Branch (6011:20): [True: 21.3k, False: 46.2k]
  ------------------
 6012|  21.3k|                  auto next = ptr + 1;
 6013|  21.3k|                  return (next == end) || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
  ------------------
  |  Branch (6013:26): [True: 6.01k, False: 15.3k]
  |  Branch (6013:43): [True: 5.21k, False: 10.1k]
  |  Branch (6013:59): [True: 5.49k, False: 4.65k]
  |  Branch (6013:76): [True: 2.02k, False: 2.63k]
  |  Branch (6013:93): [True: 2.04k, False: 590]
  ------------------
 6014|  21.3k|               }
 6015|  46.2k|               return is_plain_scalar_boundary(*ptr);
 6016|  67.6k|            };
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_ENKUlcE_clEc:
 5933|  46.2k|            auto is_plain_scalar_boundary = [](const char ch) {
 5934|  46.2k|               switch (ch) {
 5935|  3.98k|               case ' ':
  ------------------
  |  Branch (5935:16): [True: 3.98k, False: 42.2k]
  ------------------
 5936|  4.95k|               case '\t':
  ------------------
  |  Branch (5936:16): [True: 966, False: 45.3k]
  ------------------
 5937|  18.4k|               case '\n':
  ------------------
  |  Branch (5937:16): [True: 13.4k, False: 32.7k]
  ------------------
 5938|  40.6k|               case '\r':
  ------------------
  |  Branch (5938:16): [True: 22.1k, False: 24.1k]
  ------------------
 5939|  40.7k|               case ',':
  ------------------
  |  Branch (5939:16): [True: 198, False: 46.0k]
  ------------------
 5940|  41.0k|               case ']':
  ------------------
  |  Branch (5940:16): [True: 228, False: 46.0k]
  ------------------
 5941|  41.5k|               case '}':
  ------------------
  |  Branch (5941:16): [True: 522, False: 45.7k]
  ------------------
 5942|  41.5k|                  return true;
 5943|  4.73k|               default:
  ------------------
  |  Branch (5943:16): [True: 4.73k, False: 41.5k]
  ------------------
 5944|  4.73k|                  return false;
 5945|  46.2k|               }
 5946|  46.2k|            };
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_ENKUlT_E_clISM_EEDaSZ_:
 5948|  65.6k|            auto has_indented_block_continuation = [&](auto word_end) {
 5949|       |               if constexpr (yaml::check_flow_context(Opts)) {
 5950|       |                  return false;
 5951|       |               }
 5952|  65.6k|               if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (5952:20): [True: 24.4k, False: 41.1k]
  ------------------
 5953|  24.4k|                  return false;
 5954|  24.4k|               }
 5955|  41.1k|               if (word_end == end || (*word_end != '\n' && *word_end != '\r')) {
  ------------------
  |  Branch (5955:20): [True: 2.45k, False: 38.7k]
  |  Branch (5955:40): [True: 26.4k, False: 12.2k]
  |  Branch (5955:61): [True: 6.05k, False: 20.4k]
  ------------------
 5956|  8.51k|                  return false;
 5957|  8.51k|               }
 5958|       |
 5959|  32.6k|               auto look = word_end;
 5960|  32.6k|               yaml::skip_newline(look, end);
 5961|   149k|               while (look != end) {
  ------------------
  |  Branch (5961:23): [True: 136k, False: 12.8k]
  ------------------
 5962|   136k|                  int32_t line_indent = 0;
 5963|   596k|                  while (look != end && *look == ' ') {
  ------------------
  |  Branch (5963:26): [True: 596k, False: 460]
  |  Branch (5963:41): [True: 460k, False: 136k]
  ------------------
 5964|   460k|                     ++line_indent;
 5965|   460k|                     ++look;
 5966|   460k|                  }
 5967|   136k|                  if (look != end && *look == '\t') {
  ------------------
  |  Branch (5967:23): [True: 136k, False: 460]
  |  Branch (5967:38): [True: 2.05k, False: 133k]
  ------------------
 5968|  2.05k|                     return false;
 5969|  2.05k|                  }
 5970|   134k|                  if (look == end || *look == '\n' || *look == '\r') {
  ------------------
  |  Branch (5970:23): [True: 460, False: 133k]
  |  Branch (5970:38): [True: 92.6k, False: 41.3k]
  |  Branch (5970:55): [True: 12.2k, False: 29.0k]
  ------------------
 5971|   105k|                     if (look != end) {
  ------------------
  |  Branch (5971:26): [True: 104k, False: 460]
  ------------------
 5972|   104k|                        yaml::skip_newline(look, end);
 5973|   104k|                        continue;
 5974|   104k|                     }
 5975|    460|                     return false;
 5976|   105k|                  }
 5977|  29.0k|                  if (*look == '#') {
  ------------------
  |  Branch (5977:23): [True: 12.6k, False: 16.4k]
  ------------------
 5978|  12.6k|                     yaml::skip_comment(look, end);
 5979|  12.6k|                     if (look != end && (*look == '\n' || *look == '\r')) {
  ------------------
  |  Branch (5979:26): [True: 11.7k, False: 920]
  |  Branch (5979:42): [True: 6.12k, False: 5.60k]
  |  Branch (5979:59): [True: 5.60k, False: 0]
  ------------------
 5980|  11.7k|                        yaml::skip_newline(look, end);
 5981|  11.7k|                        continue;
 5982|  11.7k|                     }
 5983|    920|                     return false;
 5984|  12.6k|                  }
 5985|       |
 5986|       |                  // If the next non-empty line is an implicit mapping entry,
 5987|       |                  // don't treat it as scalar continuation for auto-deduced
 5988|       |                  // booleans/nulls.
 5989|  16.4k|                  {
 5990|  16.4k|                     auto scan = look;
 5991|   506k|                     while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (5991:29): [True: 504k, False: 1.38k]
  |  Branch (5991:44): [True: 498k, False: 6.19k]
  |  Branch (5991:61): [True: 497k, False: 1.43k]
  ------------------
 5992|   497k|                        if (*scan == ':') {
  ------------------
  |  Branch (5992:29): [True: 9.60k, False: 487k]
  ------------------
 5993|  9.60k|                           auto after_colon = scan + 1;
 5994|  9.60k|                           if (after_colon == end || *after_colon == ' ' || *after_colon == '\t' ||
  ------------------
  |  Branch (5994:32): [True: 1.07k, False: 8.52k]
  |  Branch (5994:54): [True: 3.35k, False: 5.17k]
  |  Branch (5994:77): [True: 350, False: 4.82k]
  ------------------
 5995|  7.40k|                               *after_colon == '\n' || *after_colon == '\r') {
  ------------------
  |  Branch (5995:32): [True: 1.81k, False: 3.01k]
  |  Branch (5995:56): [True: 806, False: 2.20k]
  ------------------
 5996|  7.40k|                              return false;
 5997|  7.40k|                           }
 5998|  9.60k|                        }
 5999|   489k|                        ++scan;
 6000|   489k|                     }
 6001|  16.4k|                  }
 6002|       |
 6003|  9.01k|                  return line_indent > ctx.current_indent();
 6004|  16.4k|               }
 6005|  12.8k|               return false;
 6006|  32.6k|            };
_ZN3glz36try_parse_block_mapping_into_variantINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERSH_RNS_4yaml12yaml_contextERPKcSO_EEbOT1_OT2_OT3_T4_:
 5529|   686k|   {
 5530|   686k|      using counts = yaml_variant_type_count<Variant>;
 5531|       |      if constexpr (counts::n_object == 0) {
 5532|       |         return false;
 5533|       |      }
 5534|   686k|      else {
 5535|       |         // Quick check: if no viable mapping separator in the current span,
 5536|       |         // avoid expensive speculative parse.
 5537|   686k|         const bool could_be_mapping = [&] {
 5538|   686k|            if constexpr (yaml::check_flow_context(Opts)) {
 5539|   686k|               return line_could_be_flow_mapping(it, end);
 5540|   686k|            }
 5541|   686k|            else {
 5542|   686k|               return yaml::line_could_be_block_mapping(it, end);
 5543|   686k|            }
 5544|   686k|         }();
 5545|   686k|         if (!could_be_mapping) {
  ------------------
  |  Branch (5545:14): [True: 431k, False: 254k]
  ------------------
 5546|   431k|            return false;
 5547|   431k|         }
 5548|       |         // Full parse attempt - use a temporary context that inherits indent from parent
 5549|   254k|         auto temp_ctx = ctx.make_speculative();
 5550|   254k|         process_yaml_variant_alternatives<Variant, is_yaml_variant_object>::template op<Opts>(value, temp_ctx, it,
 5551|   254k|                                                                                               end);
 5552|   254k|         ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 5553|   254k|         ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5554|   254k|         if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (5554:14): [True: 177k, False: 77.2k]
  ------------------
 5555|   177k|            ctx.anchors = std::move(temp_ctx.anchors);
 5556|   177k|            return true;
 5557|   177k|         }
 5558|       |         // The line matched "key: value" pattern but parsing failed.
 5559|       |         // This indicates malformed content (e.g., unclosed flow collection),
 5560|       |         // so propagate the error rather than silently falling back to string.
 5561|  77.2k|         ctx.error = temp_ctx.error;
 5562|  77.2k|         ctx.custom_error_message = temp_ctx.custom_error_message;
 5563|  77.2k|         return false;
 5564|   254k|      }
 5565|   686k|   }
_ZZN3glz36try_parse_block_mapping_into_variantINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4optsELj10ELb1ELb0ELb0ELb1EEERSH_RNS_4yaml12yaml_contextERPKcSO_EEbOT1_OT2_OT3_T4_ENKUlvE_clEv:
 5537|   686k|         const bool could_be_mapping = [&] {
 5538|       |            if constexpr (yaml::check_flow_context(Opts)) {
 5539|       |               return line_could_be_flow_mapping(it, end);
 5540|       |            }
 5541|   686k|            else {
 5542|   686k|               return yaml::line_could_be_block_mapping(it, end);
 5543|   686k|            }
 5544|   686k|         }();
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRS4_E_clESN_:
 4807|  51.7k|               auto parse_implicit_null = [&](val_t& val) -> bool {
 4808|       |                  if constexpr (nullable_like<std::remove_cvref_t<val_t>>) {
 4809|       |                     val = {};
 4810|       |                     return true;
 4811|       |                  }
 4812|  51.7k|                  else if constexpr (std::same_as<std::remove_cvref_t<val_t>, glz::generic>) {
 4813|  51.7k|                     val = glz::generic{};
 4814|  51.7k|                     return true;
 4815|       |                  }
 4816|       |                  else {
 4817|       |                     static constexpr std::string_view null_value{"null"};
 4818|       |                     auto null_it = null_value.data();
 4819|       |                     const yaml::yaml_context::scoped_stream literal_stream{ctx, null_value.data()};
 4820|       |                     from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(
 4821|       |                        val, ctx, null_it, null_value.data() + null_value.size());
 4822|       |                     return !bool(ctx.error);
 4823|       |                  }
 4824|  51.7k|               };
_ZN3glz4yaml24parse_block_mapping_loopITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEENS0_12yaml_contextEPKcS5_ZNS_4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES7_EEEEE2opITnDaXtlS2_Lj450ELb0ELb0ELb1ELb1EEERS5_RSB_TkNS_10is_contextERS3_S5_EEvOT1_OT2_OT0_T3_EUlRT_RSL_SH_iE_EEvSQ_RSH_SJ_iOSN_:
 3736|   247k|      {
 3737|       |         // A tagged-variant custom alternative hands its body (at the variant's own column) to a
 3738|       |         // discover-mode reader. Honor the known indent it published so continuation/dedent are
 3739|       |         // judged against the outer parent, not the body itself. One-shot: reset on observation.
 3740|   247k|         if (ctx.forced_block_mapping_indent >= 0) {
  ------------------
  |  Branch (3740:14): [True: 0, False: 247k]
  ------------------
 3741|      0|            if (mapping_indent < 0) {
  ------------------
  |  Branch (3741:17): [True: 0, False: 0]
  ------------------
 3742|      0|               mapping_indent = ctx.forced_block_mapping_indent;
 3743|      0|            }
 3744|      0|            ctx.forced_block_mapping_indent = -1;
 3745|      0|         }
 3746|   247k|         const int32_t parent_indent = ctx.current_indent();
 3747|   247k|         const bool discover_indent = (mapping_indent < 0);
 3748|   247k|         bool first_key = !discover_indent;
 3749|   247k|         bool discovered_first_key_mid_line = false;
 3750|   247k|         int32_t discovered_first_key_visual_indent = 0;
 3751|       |
 3752|   655k|         while (it != end) {
  ------------------
  |  Branch (3752:17): [True: 555k, False: 99.9k]
  ------------------
 3753|   555k|            auto line_start = it;
 3754|   555k|            int32_t line_indent = first_key ? mapping_indent : 0;
  ------------------
  |  Branch (3754:35): [True: 0, False: 555k]
  ------------------
 3755|       |
 3756|       |            // Skip blank lines and comments, measure indent
 3757|   655k|            while (it != end) {
  ------------------
  |  Branch (3757:20): [True: 648k, False: 7.08k]
  ------------------
 3758|   648k|               if (*it == '#') {
  ------------------
  |  Branch (3758:20): [True: 11.6k, False: 637k]
  ------------------
 3759|  11.6k|                  skip_comment(it, end);
 3760|  11.6k|                  skip_newline(it, end);
 3761|  11.6k|                  first_key = false;
 3762|  11.6k|                  line_indent = 0;
 3763|  11.6k|               }
 3764|   637k|               else if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3764:25): [True: 52.6k, False: 584k]
  |  Branch (3764:40): [True: 20.9k, False: 563k]
  ------------------
 3765|  73.6k|                  skip_newline(it, end);
 3766|  73.6k|                  first_key = false;
 3767|  73.6k|                  line_indent = 0;
 3768|  73.6k|               }
 3769|   563k|               else if (*it == ' ') {
  ------------------
  |  Branch (3769:25): [True: 197k, False: 366k]
  ------------------
 3770|   197k|                  line_start = it;
 3771|   197k|                  line_indent = 0;
 3772|  3.29M|                  while (it != end && *it == ' ') {
  ------------------
  |  Branch (3772:26): [True: 3.29M, False: 1.26k]
  |  Branch (3772:39): [True: 3.09M, False: 195k]
  ------------------
 3773|  3.09M|                     ++line_indent;
 3774|  3.09M|                     ++it;
 3775|  3.09M|                  }
 3776|       |
 3777|   197k|                  bool saw_tab = false;
 3778|   200k|                  while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3778:26): [True: 199k, False: 1.50k]
  |  Branch (3778:40): [True: 358, False: 198k]
  |  Branch (3778:54): [True: 3.15k, False: 195k]
  ------------------
 3779|  3.51k|                     saw_tab = saw_tab || (*it == '\t');
  ------------------
  |  Branch (3779:32): [True: 2.40k, False: 1.11k]
  |  Branch (3779:43): [True: 1.11k, False: 0]
  ------------------
 3780|  3.51k|                     ++it;
 3781|  3.51k|                  }
 3782|       |
 3783|   197k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3783:23): [True: 1.50k, False: 195k]
  |  Branch (3783:36): [True: 3.84k, False: 191k]
  |  Branch (3783:51): [True: 2.94k, False: 188k]
  |  Branch (3783:66): [True: 4.03k, False: 184k]
  ------------------
 3784|  12.3k|                     first_key = false;
 3785|  12.3k|                     line_indent = 0;
 3786|  12.3k|                     continue; // Blank or comment line
 3787|  12.3k|                  }
 3788|       |
 3789|   184k|                  if (saw_tab) {
  ------------------
  |  Branch (3789:23): [True: 35, False: 184k]
  ------------------
 3790|     35|                     ctx.error = error_code::syntax_error;
 3791|     35|                     return;
 3792|     35|                  }
 3793|       |
 3794|       |                  // Early dedent check
 3795|   184k|                  if (mapping_indent >= 0 && line_indent < mapping_indent) {
  ------------------
  |  Branch (3795:23): [True: 183k, False: 1.27k]
  |  Branch (3795:46): [True: 487, False: 182k]
  ------------------
 3796|    487|                     it = line_start;
 3797|    487|                     return;
 3798|    487|                  }
 3799|       |
 3800|   184k|                  first_key = false;
 3801|   184k|                  break; // Found content
 3802|   184k|               }
 3803|   366k|               else if (*it == '\t') {
  ------------------
  |  Branch (3803:25): [True: 3.01k, False: 363k]
  ------------------
 3804|  3.01k|                  line_start = it;
 3805|  8.13k|                  while (it != end && (*it == ' ' || *it == '\t')) ++it;
  ------------------
  |  Branch (3805:26): [True: 7.87k, False: 256]
  |  Branch (3805:40): [True: 1.39k, False: 6.48k]
  |  Branch (3805:54): [True: 3.72k, False: 2.75k]
  ------------------
 3806|  3.01k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3806:23): [True: 256, False: 2.75k]
  |  Branch (3806:36): [True: 762, False: 1.99k]
  |  Branch (3806:51): [True: 1.22k, False: 772]
  |  Branch (3806:66): [True: 671, False: 101]
  ------------------
 3807|  2.91k|                     first_key = false;
 3808|  2.91k|                     line_indent = 0;
 3809|  2.91k|                     continue; // Blank or comment-only line with tab indentation
 3810|  2.91k|                  }
 3811|    101|                  ctx.error = error_code::syntax_error;
 3812|    101|                  return;
 3813|  3.01k|               }
 3814|   363k|               else {
 3815|   363k|                  line_start = it;
 3816|   363k|                  break; // Content at column 0
 3817|   363k|               }
 3818|   648k|            }
 3819|       |
 3820|   554k|            if (it == end) break;
  ------------------
  |  Branch (3820:17): [True: 7.08k, False: 547k]
  ------------------
 3821|       |
 3822|       |            // Document boundaries terminate the current mapping in both discovered
 3823|       |            // and fixed-indent modes.
 3824|   547k|            if (at_document_end(it, end) || at_document_start(it, end)) break;
  ------------------
  |  Branch (3824:17): [True: 2.48k, False: 545k]
  |  Branch (3824:45): [True: 1.01k, False: 544k]
  ------------------
 3825|       |
 3826|       |            // Dedent checks (skip on first key for struct case)
 3827|       |            // Must check BEFORE establishing mapping_indent so the first discovered key
 3828|       |            // isn't rejected by the parent_indent check (mapping_indent is still -1).
 3829|   544k|            if (!first_key) {
  ------------------
  |  Branch (3829:17): [True: 544k, False: 0]
  ------------------
 3830|       |               // Parent indent check for nested maps (only after mapping_indent established)
 3831|   544k|               if (discover_indent && mapping_indent >= 0 && parent_indent >= 0 && line_indent <= parent_indent) {
  ------------------
  |  Branch (3831:20): [True: 544k, False: 0]
  |  Branch (3831:39): [True: 297k, False: 246k]
  |  Branch (3831:62): [True: 152k, False: 144k]
  |  Branch (3831:84): [True: 108k, False: 44.7k]
  ------------------
 3832|   108k|                  it = line_start;
 3833|   108k|                  return;
 3834|   108k|               }
 3835|   435k|               if (mapping_indent >= 0 && line_indent < mapping_indent) {
  ------------------
  |  Branch (3835:20): [True: 189k, False: 246k]
  |  Branch (3835:43): [True: 166, False: 189k]
  ------------------
 3836|    166|                  it = line_start;
 3837|    166|                  return;
 3838|    166|               }
 3839|   435k|            }
 3840|       |
 3841|       |            // Establish mapping indent from first key (map case)
 3842|   435k|            bool established_mapping_indent_this_line = false;
 3843|   435k|            if (mapping_indent < 0) {
  ------------------
  |  Branch (3843:17): [True: 246k, False: 189k]
  ------------------
 3844|   246k|               mapping_indent = line_indent;
 3845|   246k|               established_mapping_indent_this_line = true;
 3846|   246k|               discovered_first_key_visual_indent = line_indent;
 3847|   246k|               if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3848|   246k|                  if (ctx.stream_begin && line_start > ctx.stream_begin) {
  ------------------
  |  Branch (3848:23): [True: 246k, False: 0]
  |  Branch (3848:43): [True: 240k, False: 5.84k]
  ------------------
 3849|   240k|                     const auto prefix = ctx.line_prefix_before(line_start);
 3850|   240k|                     if (prefix.has_tab) {
  ------------------
  |  Branch (3850:26): [True: 306, False: 240k]
  ------------------
 3851|    306|                        ctx.error = error_code::syntax_error;
 3852|    306|                        return;
 3853|    306|                     }
 3854|       |
 3855|   240k|                     discovered_first_key_mid_line = prefix.has_content;
 3856|   240k|                     if (mapping_indent == 0 && prefix.column > 0) {
  ------------------
  |  Branch (3856:26): [True: 239k, False: 1.27k]
  |  Branch (3856:49): [True: 216k, False: 22.1k]
  ------------------
 3857|   216k|                        discovered_first_key_visual_indent = prefix.column;
 3858|   216k|                     }
 3859|   240k|                  }
 3860|   246k|               }
 3861|   246k|            }
 3862|       |
 3863|       |            // In discovered-indent block mappings, sibling keys must stay at the same
 3864|       |            // indent level, except when the first key started mid-line (e.g. "--- k: v").
 3865|   435k|            if (discover_indent && mapping_indent >= 0 && !established_mapping_indent_this_line &&
  ------------------
  |  Branch (3865:17): [True: 435k, False: 306]
  |  Branch (3865:36): [True: 435k, False: 0]
  |  Branch (3865:59): [True: 189k, False: 246k]
  ------------------
 3866|   189k|                !discovered_first_key_mid_line) {
  ------------------
  |  Branch (3866:17): [True: 59.7k, False: 129k]
  ------------------
 3867|  59.7k|               if (mapping_indent == 0 && discovered_first_key_visual_indent > 0) {
  ------------------
  |  Branch (3867:20): [True: 59.3k, False: 412]
  |  Branch (3867:43): [True: 22.8k, False: 36.4k]
  ------------------
 3868|  22.8k|                  if (line_indent > discovered_first_key_visual_indent) {
  ------------------
  |  Branch (3868:23): [True: 25, False: 22.8k]
  ------------------
 3869|     25|                     ctx.error = error_code::syntax_error;
 3870|     25|                     return;
 3871|     25|                  }
 3872|  22.8k|                  if (line_indent < discovered_first_key_visual_indent) {
  ------------------
  |  Branch (3872:23): [True: 1.38k, False: 21.4k]
  ------------------
 3873|  1.38k|                     it = line_start;
 3874|  1.38k|                     return;
 3875|  1.38k|                  }
 3876|  22.8k|               }
 3877|  36.8k|               else if (line_indent > mapping_indent &&
  ------------------
  |  Branch (3877:25): [True: 598, False: 36.2k]
  ------------------
 3878|    598|                        (parent_indent < 0 || mapping_indent > 0 ||
  ------------------
  |  Branch (3878:26): [True: 233, False: 365]
  |  Branch (3878:47): [True: 2, False: 363]
  ------------------
 3879|    363|                         (parent_indent >= 0 && mapping_indent == 0 && line_indent > (parent_indent + 1)))) {
  ------------------
  |  Branch (3879:27): [True: 363, False: 0]
  |  Branch (3879:49): [True: 363, False: 0]
  |  Branch (3879:72): [True: 12, False: 351]
  ------------------
 3880|    247|                  ctx.error = error_code::syntax_error;
 3881|    247|                  return;
 3882|    247|               }
 3883|  59.7k|            }
 3884|       |
 3885|       |            // Sequence indicator check (struct case only - map parser lets key parsing
 3886|       |            // handle '- ' which produces appropriate errors for misindented items)
 3887|   434k|            if (!discover_indent && *it == '-' &&
  ------------------
  |  Branch (3887:17): [True: 0, False: 434k]
  |  Branch (3887:37): [True: 0, False: 0]
  ------------------
 3888|      0|                ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\t' || *(it + 1) == '\n')) {
  ------------------
  |  Branch (3888:18): [True: 0, False: 0]
  |  Branch (3888:37): [True: 0, False: 0]
  |  Branch (3888:57): [True: 0, False: 0]
  |  Branch (3888:78): [True: 0, False: 0]
  ------------------
 3889|      0|               it = line_start;
 3890|      0|               return;
 3891|      0|            }
 3892|       |
 3893|       |            // Skip indented comment lines
 3894|   434k|            if (*it == '#') {
  ------------------
  |  Branch (3894:17): [True: 0, False: 434k]
  ------------------
 3895|      0|               skip_comment(it, end);
 3896|      0|               first_key = false;
 3897|      0|               continue;
 3898|      0|            }
 3899|       |
 3900|       |            // Skip blank/empty lines after indent
 3901|   434k|            if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3901:17): [True: 306, False: 433k]
  |  Branch (3901:32): [True: 0, False: 433k]
  ------------------
 3902|      0|               first_key = false;
 3903|      0|               continue;
 3904|      0|            }
 3905|       |
 3906|       |            // While parsing an explicit mapping key node ('? key-node'),
 3907|       |            // a subsequent standalone ':' at the same indentation starts
 3908|       |            // the outer value indicator and must terminate this key-node map.
 3909|       |            // Keep same-line ': x' on the first key-node line valid.
 3910|   434k|            if (ctx.explicit_mapping_key_context && !established_mapping_indent_this_line && *it == ':') {
  ------------------
  |  Branch (3910:17): [True: 104k, False: 329k]
  |  Branch (3910:53): [True: 26.6k, False: 78.2k]
  |  Branch (3910:94): [True: 9.03k, False: 17.6k]
  ------------------
 3911|  9.03k|               const auto after_colon = it + 1;
 3912|  9.03k|               const int32_t explicit_value_indicator_indent = (parent_indent < 0) ? 0 : (parent_indent + 1);
  ------------------
  |  Branch (3912:64): [True: 6.21k, False: 2.81k]
  ------------------
 3913|  9.03k|               if ((after_colon == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
  ------------------
  |  Branch (3913:21): [True: 552, False: 8.47k]
  |  Branch (3913:43): [True: 5.46k, False: 3.01k]
  ------------------
 3914|  6.01k|                   line_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (3914:20): [True: 888, False: 5.12k]
  ------------------
 3915|    888|                  it = line_start;
 3916|    888|                  return;
 3917|    888|               }
 3918|  9.03k|            }
 3919|       |
 3920|       |            // Process this mapping entry (key + colon + value)
 3921|   433k|            int32_t effective_line_indent = line_indent;
 3922|   433k|            if (discover_indent && established_mapping_indent_this_line &&
  ------------------
  |  Branch (3922:17): [True: 432k, False: 306]
  |  Branch (3922:36): [True: 246k, False: 186k]
  ------------------
 3923|   246k|                discovered_first_key_visual_indent > effective_line_indent &&
  ------------------
  |  Branch (3923:17): [True: 216k, False: 29.2k]
  ------------------
 3924|   216k|                !(discovered_first_key_mid_line && parent_indent < 0)) {
  ------------------
  |  Branch (3924:19): [True: 172k, False: 44.6k]
  |  Branch (3924:52): [True: 22.4k, False: 149k]
  ------------------
 3925|       |               // The first discovered key has no indentation of its own left to measure: it may
 3926|       |               // begin mid-line (a sequence entry's "- key: value"), or the caller may have already
 3927|       |               // consumed the line's indentation before handing the mapping over. Pass its visual
 3928|       |               // column so the entry judges its value against the key's real indent -- otherwise a
 3929|       |               // key with an empty value takes the following sibling line for nested content
 3930|       |               // (issue #2827) and same-line block scalars compute the wrong indentation.
 3931|       |               // The exception is a ROOT mapping whose first key begins mid-line, which means node
 3932|       |               // properties sit ahead of it (`!!str &a1 "foo":`): those belong to the document node
 3933|       |               // rather than to the key's column, so the measured indent stands. Conformance tests
 3934|       |               // 7FWL and HMQ5 pin that case.
 3935|   194k|               effective_line_indent = discovered_first_key_visual_indent;
 3936|   194k|            }
 3937|       |
 3938|   433k|            if (!process_entry(ctx, it, end, effective_line_indent)) {
  ------------------
  |  Branch (3938:17): [True: 25.0k, False: 408k]
  ------------------
 3939|  25.0k|               return;
 3940|  25.0k|            }
 3941|   408k|            first_key = false;
 3942|       |
 3943|   408k|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3943:17): [True: 0, False: 408k]
  ------------------
 3944|      0|               return;
 3945|       |
 3946|       |            if constexpr (yaml::check_flow_context(Opts)) {
 3947|       |               // In flow context, an implicit "key: value" pair used as a sequence entry
 3948|       |               // ends at ',', ']', or '}'. Let the enclosing flow parser consume it.
 3949|       |               auto flow_end = it;
 3950|       |               skip_flow_ws_and_newlines(ctx, flow_end, end);
 3951|       |               if (bool(ctx.error)) [[unlikely]]
 3952|       |                  return;
 3953|       |               if (flow_end != end && (*flow_end == ',' || *flow_end == ']' || *flow_end == '}')) {
 3954|       |                  it = flow_end;
 3955|       |                  return;
 3956|       |               }
 3957|       |            }
 3958|       |
 3959|       |            // Trailing whitespace handling (peek-ahead pattern).
 3960|       |            // After parsing, iterator may be at leading indent of next line.
 3961|       |            // Don't consume it - let the outer loop handle indent measurement.
 3962|   408k|            if (it != end) {
  ------------------
  |  Branch (3962:17): [True: 330k, False: 77.1k]
  ------------------
 3963|   330k|               if (*it == ' ' || *it == '\t') {
  ------------------
  |  Branch (3963:20): [True: 133k, False: 197k]
  |  Branch (3963:34): [True: 3.76k, False: 194k]
  ------------------
 3964|   136k|                  auto peek = it;
 3965|   136k|                  skip_inline_ws(peek, end);
 3966|   136k|                  if (peek != end && *peek != '\n' && *peek != '\r' && *peek != '#') {
  ------------------
  |  Branch (3966:23): [True: 135k, False: 1.04k]
  |  Branch (3966:38): [True: 132k, False: 3.24k]
  |  Branch (3966:55): [True: 126k, False: 6.33k]
  |  Branch (3966:72): [True: 123k, False: 2.62k]
  ------------------
 3967|   123k|                     continue; // At leading indent of new line
 3968|   123k|                  }
 3969|   136k|               }
 3970|   207k|               skip_inline_ws(it, end);
 3971|   207k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (3971:20): [True: 206k, False: 1.04k]
  |  Branch (3971:33): [True: 8.12k, False: 198k]
  ------------------
 3972|  8.12k|                  if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3973|  8.12k|                     if (it > line_start) {
  ------------------
  |  Branch (3973:26): [True: 8.12k, False: 0]
  ------------------
 3974|  8.12k|                        const char prev = *(it - 1);
 3975|  8.12k|                        if (prev != ' ' && prev != '\t' && prev != '\n' && prev != '\r') {
  ------------------
  |  Branch (3975:29): [True: 3.19k, False: 4.93k]
  |  Branch (3975:44): [True: 1.81k, False: 1.38k]
  |  Branch (3975:60): [True: 1.03k, False: 784]
  |  Branch (3975:76): [True: 12, False: 1.02k]
  ------------------
 3976|     12|                           ctx.error = error_code::syntax_error;
 3977|     12|                           return;
 3978|     12|                        }
 3979|  8.12k|                     }
 3980|  8.12k|                  }
 3981|  8.12k|               }
 3982|  8.11k|               skip_comment(it, end);
 3983|   207k|               if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (3983:20): [True: 205k, False: 1.40k]
  |  Branch (3983:34): [True: 76.5k, False: 129k]
  |  Branch (3983:49): [True: 57.1k, False: 72.2k]
  ------------------
 3984|   133k|                  skip_newline(it, end);
 3985|   133k|               }
 3986|  73.6k|               else if (it != end) {
  ------------------
  |  Branch (3986:25): [True: 72.2k, False: 1.40k]
  ------------------
 3987|       |                  // The entry stopped part way along its line with something other than
 3988|       |                  // whitespace or a comment after it -- a ':' its value could not take as a
 3989|       |                  // separator, say. The next pass measures indent as though this were the start
 3990|       |                  // of a line, so what is left of the real one is lost; reject it instead.
 3991|  72.2k|                  if constexpr (requires { ctx.line_prefix_before(it); }) {
 3992|  72.2k|                     if (ctx.line_prefix_before(it).has_content) {
  ------------------
  |  Branch (3992:26): [True: 261, False: 71.9k]
  ------------------
 3993|    261|                        ctx.error = error_code::syntax_error;
 3994|    261|                        return;
 3995|    261|                     }
 3996|  72.2k|                  }
 3997|  72.2k|               }
 3998|   207k|            }
 3999|   408k|         }
 4000|   247k|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_i:
 4927|   432k|               ctx, it, end, int32_t(-1), [&](auto& ctx, auto& it, auto end, int32_t line_indent) -> bool {
 4928|   432k|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|   432k|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 4930|   432k|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|   432k|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|   432k|                           if (ctx.stream_begin) {
 4938|   432k|                              auto is_line_content_start = [&](auto pos) {
 4939|   432k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   432k|                              };
 4941|       |
 4942|   432k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   432k|                                 const char* line = ctx.line_begin_of(pos);
 4944|   432k|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|   432k|                                 return line != end && *line == ':';
 4946|   432k|                              };
 4947|       |
 4948|   432k|                              if (!is_line_content_start(it) &&
 4949|   432k|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
 4950|   432k|                                  !line_has_explicit_value_indicator(it)) {
 4951|   432k|                                 ctx.error = error_code::syntax_error;
 4952|   432k|                                 return false;
 4953|   432k|                              }
 4954|   432k|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|   432k|                           }
 4956|   432k|                        }
 4957|       |
 4958|   432k|                        if (*it == '-' &&
 4959|   432k|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
 4960|   432k|                            !line_starts_with_explicit_value_indicator) {
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|   432k|                           ctx.error = error_code::syntax_error;
 4963|   432k|                           return false;
 4964|   432k|                        }
 4965|       |
 4966|   432k|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 4967|   432k|                           return false;
 4968|   432k|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|   432k|                        ctx.pop_indent();
 4970|   432k|                     }
 4971|   432k|                     else {
 4972|   432k|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|   432k|                        if (nested_indent >= 0) {
 4974|   432k|                           yaml::skip_to_content(it, end);
 4975|   432k|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
 4976|   432k|                              ctx.error = error_code::syntax_error;
 4977|   432k|                              return false;
 4978|   432k|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|   432k|                           const int32_t value_indent =
 4982|   432k|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
 4983|   432k|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
 4984|   432k|                              return false;
 4985|   432k|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|   432k|                           ctx.pop_indent();
 4987|   432k|                        }
 4988|   432k|                     }
 4989|   432k|                     return !bool(ctx.error);
 4990|   432k|                  };
 4991|       |
 4992|       |                  // Explicit key entry form:
 4993|       |                  // ? key
 4994|       |                  // : value
 4995|   432k|                  if (*it == '?' && ((it + 1) != end) && *(it + 1) == '\t') {
  ------------------
  |  Branch (4995:23): [True: 118k, False: 314k]
  |  Branch (4995:37): [True: 117k, False: 676]
  |  Branch (4995:58): [True: 3, False: 117k]
  ------------------
 4996|      3|                     ctx.error = error_code::syntax_error;
 4997|      3|                     return false;
 4998|      3|                  }
 4999|   432k|                  if (*it == '?' && ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\n' || *(it + 1) == '\r')) {
  ------------------
  |  Branch (4999:23): [True: 118k, False: 314k]
  |  Branch (4999:38): [True: 676, False: 117k]
  |  Branch (4999:57): [True: 38.8k, False: 78.8k]
  |  Branch (4999:77): [True: 37.8k, False: 40.9k]
  |  Branch (4999:98): [True: 37.9k, False: 3.00k]
  ------------------
 5000|   115k|                     ++it; // skip '?'
 5001|   115k|                     yaml::skip_inline_ws(it, end);
 5002|       |
 5003|   115k|                     const int32_t explicit_value_indicator_indent =
 5004|   115k|                        (ctx.current_indent() < 0) ? 0 : (ctx.current_indent() + 1);
  ------------------
  |  Branch (5004:25): [True: 50.4k, False: 64.8k]
  ------------------
 5005|       |
 5006|   115k|                     key_t key{};
 5007|   115k|                     if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5008|   115k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   115k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   115k|                        };
 5011|       |
 5012|   115k|                        auto key_it = it;
 5013|   115k|                        yaml::skip_inline_ws(key_it, end);
 5014|       |
 5015|   115k|                        auto content = key_it;
 5016|   115k|                        yaml::skip_to_content(content, end);
 5017|   115k|                        bool handled_anchor_only_empty_key = false;
 5018|       |
 5019|       |                        // Anchor on an empty explicit key node:
 5020|       |                        //   ? &a
 5021|       |                        //   : value
 5022|   115k|                        if (content != end && *content == '&') {
  ------------------
  |  Branch (5022:29): [True: 111k, False: 4.37k]
  |  Branch (5022:47): [True: 20.5k, False: 90.4k]
  ------------------
 5023|  20.5k|                           auto anchor_probe = content + 1;
 5024|  20.5k|                           auto anchor_name = yaml::parse_anchor_name(anchor_probe, end);
 5025|  20.5k|                           if (!anchor_name.empty()) {
  ------------------
  |  Branch (5025:32): [True: 20.5k, False: 19]
  ------------------
 5026|  20.5k|                              auto after_anchor = anchor_probe;
 5027|  20.5k|                              yaml::skip_inline_ws(after_anchor, end);
 5028|       |
 5029|  20.5k|                              auto value_indicator = after_anchor;
 5030|  20.5k|                              if (value_indicator != end && *value_indicator == ':') {
  ------------------
  |  Branch (5030:35): [True: 20.0k, False: 503]
  |  Branch (5030:61): [True: 1.86k, False: 18.1k]
  ------------------
 5031|  1.86k|                                 key.clear();
 5032|  1.86k|                                 ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5033|  1.86k|                                 it = value_indicator;
 5034|  1.86k|                                 handled_anchor_only_empty_key = true;
 5035|  1.86k|                              }
 5036|  18.6k|                              else {
 5037|  18.6k|                                 if (value_indicator != end && *value_indicator == '#') {
  ------------------
  |  Branch (5037:38): [True: 18.1k, False: 503]
  |  Branch (5037:64): [True: 770, False: 17.3k]
  ------------------
 5038|    770|                                    yaml::skip_comment(value_indicator, end);
 5039|    770|                                 }
 5040|  18.6k|                                 if (value_indicator != end && (*value_indicator == '\n' || *value_indicator == '\r')) {
  ------------------
  |  Branch (5040:38): [True: 17.9k, False: 665]
  |  Branch (5040:65): [True: 3.79k, False: 14.1k]
  |  Branch (5040:93): [True: 3.88k, False: 10.3k]
  ------------------
 5041|  7.67k|                                    yaml::skip_newline(value_indicator, end);
 5042|  7.67k|                                    auto value_line = value_indicator;
 5043|  7.67k|                                    int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5044|  7.67k|                                    if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5044:41): [True: 2, False: 7.67k]
  ------------------
 5045|      2|                                       return false;
 5046|  7.67k|                                    if (value_line != end && *value_line == ':' &&
  ------------------
  |  Branch (5046:41): [True: 6.82k, False: 846]
  |  Branch (5046:62): [True: 1.01k, False: 5.81k]
  ------------------
 5047|  1.01k|                                        value_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (5047:41): [True: 1.00k, False: 13]
  ------------------
 5048|  1.00k|                                       key.clear();
 5049|  1.00k|                                       ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5050|  1.00k|                                       it = value_line;
 5051|  1.00k|                                       handled_anchor_only_empty_key = true;
 5052|  1.00k|                                    }
 5053|  6.67k|                                    else if (value_line != end && *value_line == ':') {
  ------------------
  |  Branch (5053:46): [True: 5.82k, False: 846]
  |  Branch (5053:67): [True: 13, False: 5.81k]
  ------------------
 5054|       |                                       // In explicit-key form ("? &a"), a following ':'
 5055|       |                                       // starts the outer value indicator only at the same
 5056|       |                                       // indentation. A deeper-indented ': value' is malformed.
 5057|     13|                                       ctx.error = error_code::syntax_error;
 5058|     13|                                       return false;
 5059|     13|                                    }
 5060|  7.67k|                                 }
 5061|  18.6k|                              }
 5062|  20.5k|                           }
 5063|  20.5k|                        }
 5064|       |
 5065|   115k|                        const bool key_content_spans_lines = [&] {
 5066|   115k|                           auto scan = key_it;
 5067|   115k|                           while (scan != content && scan != end) {
 5068|   115k|                              if (*scan == '\n' || *scan == '\r') return true;
 5069|   115k|                              ++scan;
 5070|   115k|                           }
 5071|   115k|                           return false;
 5072|   115k|                        }();
 5073|       |
 5074|   115k|                        if (handled_anchor_only_empty_key) {
  ------------------
  |  Branch (5074:29): [True: 2.86k, False: 112k]
  ------------------
 5075|       |                           // 'it' already points to the explicit value indicator ':'
 5076|  2.86k|                        }
 5077|   112k|                        else if (content == end || (*content == ':' && key_content_spans_lines)) {
  ------------------
  |  Branch (5077:34): [True: 4.37k, False: 108k]
  |  Branch (5077:53): [True: 17.6k, False: 90.4k]
  |  Branch (5077:72): [True: 16.6k, False: 1.01k]
  ------------------
 5078|  21.0k|                           key.clear();
 5079|  21.0k|                           it = content;
 5080|  21.0k|                        }
 5081|  91.4k|                        else {
 5082|       |                           // Explicit mapping keys ('? key-node') are full YAML nodes.
 5083|       |                           // Parse the key node structurally (not via plain-key scanning)
 5084|       |                           // so inputs like '? []: x' and '? JSON: like' are interpreted
 5085|       |                           // as complex keys, not split into implicit key/value pairs.
 5086|  91.4k|                           auto key_node_it = content;
 5087|  91.4k|                           auto key_node_end = end;
 5088|  91.4k|                           if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 5089|       |                              // In explicit-key form, a following standalone ':'
 5090|       |                              // line (same or lower indentation) belongs to the
 5091|       |                              // outer mapping value, not the key node itself.
 5092|  91.4k|                              auto scan = content;
 5093|  2.08M|                              while (scan != end) {
  ------------------
  |  Branch (5093:38): [True: 2.02M, False: 52.6k]
  ------------------
 5094|  31.6M|                                 while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (5094:41): [True: 31.6M, False: 22.4k]
  |  Branch (5094:56): [True: 30.6M, False: 1.01M]
  |  Branch (5094:73): [True: 29.6M, False: 995k]
  ------------------
 5095|  29.6M|                                    ++scan;
 5096|  29.6M|                                 }
 5097|  2.02M|                                 if (scan == end) {
  ------------------
  |  Branch (5097:38): [True: 22.4k, False: 2.00M]
  ------------------
 5098|  22.4k|                                    break;
 5099|  22.4k|                                 }
 5100|       |
 5101|  2.00M|                                 yaml::skip_newline(scan, end);
 5102|  2.00M|                                 auto line_start = scan;
 5103|       |
 5104|  2.00M|                                 int32_t indicator_indent = 0;
 5105|  5.02M|                                 while (scan != end && *scan == ' ') {
  ------------------
  |  Branch (5105:41): [True: 4.97M, False: 52.6k]
  |  Branch (5105:56): [True: 3.02M, False: 1.95M]
  ------------------
 5106|  3.02M|                                    ++indicator_indent;
 5107|  3.02M|                                    ++scan;
 5108|  3.02M|                                 }
 5109|       |
 5110|  2.00M|                                 if (scan != end && *scan == ':') {
  ------------------
  |  Branch (5110:38): [True: 1.95M, False: 52.6k]
  |  Branch (5110:53): [True: 72.0k, False: 1.88M]
  ------------------
 5111|  72.0k|                                    const auto after_colon = scan + 1;
 5112|  72.0k|                                    if ((after_colon == end ||
  ------------------
  |  Branch (5112:42): [True: 659, False: 71.4k]
  ------------------
 5113|  71.4k|                                         yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
  ------------------
  |  Branch (5113:42): [True: 47.3k, False: 24.0k]
  ------------------
 5114|  47.9k|                                        indicator_indent <= line_indent) {
  ------------------
  |  Branch (5114:41): [True: 16.3k, False: 31.6k]
  ------------------
 5115|  16.3k|                                       key_node_end = line_start;
 5116|  16.3k|                                       break;
 5117|  16.3k|                                    }
 5118|  72.0k|                                 }
 5119|  2.00M|                              }
 5120|  91.4k|                           }
 5121|       |
 5122|  91.4k|                           glz::generic key_node{};
 5123|  91.4k|                           const bool prev_explicit_mapping_key_context = ctx.explicit_mapping_key_context;
 5124|  91.4k|                           ctx.explicit_mapping_key_context = true;
 5125|  91.4k|                           from<YAML, glz::generic>::template op<Opts>(key_node, ctx, key_node_it, key_node_end);
 5126|  91.4k|                           ctx.explicit_mapping_key_context = prev_explicit_mapping_key_context;
 5127|  91.4k|                           if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5127:32): [True: 4.48k, False: 86.9k]
  ------------------
 5128|  4.48k|                              return false;
 5129|  86.9k|                           it = key_node_it;
 5130|  86.9k|                           if (!to_string_key(key_node)) [[unlikely]]
  ------------------
  |  Branch (5130:32): [True: 38, False: 86.9k]
  ------------------
 5131|     38|                              return false;
 5132|  86.9k|                        }
 5133|       |                     }
 5134|       |                     else {
 5135|       |                        if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 5136|       |                           from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5137|       |                           if (bool(ctx.error)) [[unlikely]]
 5138|       |                              return false;
 5139|       |                        }
 5140|       |                     }
 5141|       |
 5142|   110k|                     yaml::skip_inline_ws(it, end);
 5143|   115k|                     yaml::skip_comment(it, end);
 5144|       |
 5145|       |                     // Value indicator may appear on the next line at the same indent.
 5146|   115k|                     if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (5146:26): [True: 82.4k, False: 32.9k]
  |  Branch (5146:40): [True: 17.6k, False: 64.7k]
  |  Branch (5146:55): [True: 19.4k, False: 45.3k]
  ------------------
 5147|  37.0k|                        auto probe = it;
 5148|  37.0k|                        bool found_value_indicator = false;
 5149|       |
 5150|  60.2k|                        while (probe != end && (*probe == '\n' || *probe == '\r')) {
  ------------------
  |  Branch (5150:32): [True: 45.5k, False: 14.7k]
  |  Branch (5150:49): [True: 20.4k, False: 25.1k]
  |  Branch (5150:67): [True: 25.1k, False: 4]
  ------------------
 5151|  45.5k|                           yaml::skip_newline(probe, end);
 5152|       |
 5153|  45.5k|                           auto value_line = probe;
 5154|  45.5k|                           int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5155|  45.5k|                           if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5155:32): [True: 4, False: 45.5k]
  ------------------
 5156|      4|                              return false;
 5157|       |
 5158|  45.5k|                           if (value_line == end || *value_line == '\n' || *value_line == '\r') {
  ------------------
  |  Branch (5158:32): [True: 14.4k, False: 31.1k]
  |  Branch (5158:53): [True: 1.71k, False: 29.3k]
  |  Branch (5158:76): [True: 4.70k, False: 24.6k]
  ------------------
 5159|  20.8k|                              probe = value_line;
 5160|  20.8k|                              continue; // blank line
 5161|  20.8k|                           }
 5162|  24.6k|                           if (*value_line == '#') {
  ------------------
  |  Branch (5162:32): [True: 2.31k, False: 22.3k]
  ------------------
 5163|  2.31k|                              yaml::skip_comment(value_line, end);
 5164|  2.31k|                              probe = value_line;
 5165|  2.31k|                              continue; // comment-only line
 5166|  2.31k|                           }
 5167|  22.3k|                           if (*value_line == ':' && value_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (5167:32): [True: 4.06k, False: 18.3k]
  |  Branch (5167:54): [True: 2.08k, False: 1.98k]
  ------------------
 5168|  2.08k|                              it = value_line;
 5169|  2.08k|                              found_value_indicator = true;
 5170|  2.08k|                           }
 5171|  22.3k|                           break;
 5172|  24.6k|                        }
 5173|       |
 5174|  37.0k|                        if (found_value_indicator) {
  ------------------
  |  Branch (5174:29): [True: 2.08k, False: 35.0k]
  ------------------
 5175|  2.08k|                           yaml::skip_inline_ws(it, end);
 5176|  2.08k|                        }
 5177|  37.0k|                     }
 5178|       |
 5179|   115k|                     val_t val{};
 5180|   115k|                     if (it != end && *it == ':') {
  ------------------
  |  Branch (5180:26): [True: 82.4k, False: 32.9k]
  |  Branch (5180:39): [True: 39.8k, False: 42.6k]
  ------------------
 5181|  39.8k|                        ++it;
 5182|  39.8k|                        if (it != end && *it == '\t') {
  ------------------
  |  Branch (5182:29): [True: 39.5k, False: 308]
  |  Branch (5182:42): [True: 6, False: 39.5k]
  ------------------
 5183|      6|                           ctx.error = error_code::syntax_error;
 5184|      6|                           return false;
 5185|      6|                        }
 5186|  39.8k|                        if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (5186:29): [True: 39.5k, False: 308]
  |  Branch (5186:43): [True: 1.84k, False: 37.6k]
  |  Branch (5186:58): [True: 16.7k, False: 20.9k]
  ------------------
 5187|  18.5k|                           auto probe = it;
 5188|  18.5k|                           yaml::skip_newline(probe, end);
 5189|  48.6k|                           while (probe != end && *probe == ' ') ++probe;
  ------------------
  |  Branch (5189:35): [True: 47.6k, False: 990]
  |  Branch (5189:51): [True: 30.0k, False: 17.5k]
  ------------------
 5190|  18.5k|                           if (probe != end && *probe == ':' && ((probe + 1) != end) && *(probe + 1) == '\t') {
  ------------------
  |  Branch (5190:32): [True: 17.5k, False: 990]
  |  Branch (5190:48): [True: 5.48k, False: 12.0k]
  |  Branch (5190:65): [True: 5.22k, False: 258]
  |  Branch (5190:89): [True: 2, False: 5.22k]
  ------------------
 5191|      2|                              ctx.error = error_code::syntax_error;
 5192|      2|                              return false;
 5193|      2|                           }
 5194|  18.5k|                        }
 5195|  39.8k|                        yaml::skip_inline_ws(it, end);
 5196|  39.8k|                        if (!parse_map_value(val)) [[unlikely]]
  ------------------
  |  Branch (5196:29): [True: 354, False: 39.4k]
  ------------------
 5197|    354|                           return false;
 5198|  39.8k|                     }
 5199|       |
 5200|   115k|                     value.emplace(std::move(key), std::move(val));
 5201|   115k|                     return true;
 5202|   115k|                  }
 5203|       |
 5204|   317k|                  key_t key{};
 5205|   317k|                  if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5206|   317k|                     auto key_probe = it;
 5207|   317k|                     yaml::skip_inline_ws(key_probe, end);
 5208|   317k|                     const bool complex_flow_key = (key_probe != end && (*key_probe == '[' || *key_probe == '{'));
  ------------------
  |  Branch (5208:53): [True: 317k, False: 0]
  |  Branch (5208:74): [True: 1.98k, False: 315k]
  |  Branch (5208:95): [True: 822, False: 314k]
  ------------------
 5209|   317k|                     if (complex_flow_key) {
  ------------------
  |  Branch (5209:26): [True: 2.80k, False: 314k]
  ------------------
 5210|  2.80k|                        glz::generic key_node{};
 5211|  2.80k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 5212|  2.80k|                        if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5212:29): [True: 552, False: 2.25k]
  ------------------
 5213|    552|                           return false;
 5214|  2.25k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (5214:29): [True: 2, False: 2.25k]
  ------------------
 5215|      2|                           return false;
 5216|  2.25k|                     }
 5217|   314k|                     else {
 5218|   314k|                        if (!yaml::parse_yaml_key(key, ctx, it, end, false)) {
  ------------------
  |  Branch (5218:29): [True: 1.76k, False: 312k]
  ------------------
 5219|  1.76k|                           return false;
 5220|  1.76k|                        }
 5221|   314k|                     }
 5222|       |                  }
 5223|       |                  else {
 5224|       |                     from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5225|       |                     if (bool(ctx.error)) [[unlikely]]
 5226|       |                        return false;
 5227|       |                  }
 5228|       |
 5229|   315k|                  yaml::skip_inline_ws(it, end);
 5230|       |
 5231|   317k|                  if (it == end || *it != ':') {
  ------------------
  |  Branch (5231:23): [True: 3.10k, False: 314k]
  |  Branch (5231:36): [True: 789, False: 313k]
  ------------------
 5232|  1.57k|                     ctx.error = error_code::syntax_error;
 5233|  1.57k|                     return false;
 5234|  1.57k|                  }
 5235|   315k|                  ++it;
 5236|   315k|                  yaml::skip_inline_ws(it, end);
 5237|       |
 5238|   315k|                  val_t val{};
 5239|   315k|                  if (!parse_map_value(val)) [[unlikely]]
  ------------------
  |  Branch (5239:23): [True: 16.2k, False: 299k]
  ------------------
 5240|  16.2k|                     return false;
 5241|       |
 5242|   299k|                  value.emplace(std::move(key), std::move(val));
 5243|   299k|                  return true;
 5244|   315k|               });
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlvE_clEv:
 5065|   115k|                        const bool key_content_spans_lines = [&] {
 5066|   115k|                           auto scan = key_it;
 5067|   121k|                           while (scan != content && scan != end) {
  ------------------
  |  Branch (5067:35): [True: 83.7k, False: 38.2k]
  |  Branch (5067:54): [True: 83.7k, False: 0]
  ------------------
 5068|  83.7k|                              if (*scan == '\n' || *scan == '\r') return true;
  ------------------
  |  Branch (5068:35): [True: 38.4k, False: 45.3k]
  |  Branch (5068:52): [True: 38.6k, False: 6.60k]
  ------------------
 5069|  6.60k|                              ++scan;
 5070|  6.60k|                           }
 5071|  38.2k|                           return false;
 5072|   115k|                        }();
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E0_clESS_:
 5008|  86.9k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|  86.9k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|  86.9k|                        };
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E_clESS_:
 4928|   353k|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|   353k|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (4929:26): [True: 345k, False: 8.23k]
  |  Branch (4929:39): [True: 248k, False: 96.5k]
  ------------------
 4930|   248k|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|   248k|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|   248k|                           if (ctx.stream_begin) {
  ------------------
  |  Branch (4937:32): [True: 248k, False: 0]
  ------------------
 4938|   248k|                              auto is_line_content_start = [&](auto pos) {
 4939|   248k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   248k|                              };
 4941|       |
 4942|   248k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   248k|                                 const char* line = ctx.line_begin_of(pos);
 4944|   248k|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|   248k|                                 return line != end && *line == ':';
 4946|   248k|                              };
 4947|       |
 4948|   248k|                              if (!is_line_content_start(it) &&
  ------------------
  |  Branch (4948:35): [True: 248k, False: 0]
  ------------------
 4949|   248k|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
  ------------------
  |  Branch (4949:35): [True: 42.4k, False: 206k]
  ------------------
 4950|  42.4k|                                  !line_has_explicit_value_indicator(it)) {
  ------------------
  |  Branch (4950:35): [True: 337, False: 42.0k]
  ------------------
 4951|    337|                                 ctx.error = error_code::syntax_error;
 4952|    337|                                 return false;
 4953|    337|                              }
 4954|   248k|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|   248k|                           }
 4956|   248k|                        }
 4957|       |
 4958|   248k|                        if (*it == '-' &&
  ------------------
  |  Branch (4958:29): [True: 3.57k, False: 244k]
  ------------------
 4959|  3.57k|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
  ------------------
  |  Branch (4959:30): [True: 104, False: 3.46k]
  |  Branch (4959:49): [True: 458, False: 3.00k]
  ------------------
 4960|    562|                            !line_starts_with_explicit_value_indicator) {
  ------------------
  |  Branch (4960:29): [True: 15, False: 547]
  ------------------
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|     15|                           ctx.error = error_code::syntax_error;
 4963|     15|                           return false;
 4964|     15|                        }
 4965|       |
 4966|   248k|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
  ------------------
  |  Branch (4966:29): [True: 0, False: 248k]
  ------------------
 4967|      0|                           return false;
 4968|   248k|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|   248k|                        ctx.pop_indent();
 4970|   248k|                     }
 4971|   104k|                     else {
 4972|   104k|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|   104k|                        if (nested_indent >= 0) {
  ------------------
  |  Branch (4973:29): [True: 34.7k, False: 70.0k]
  ------------------
 4974|  34.7k|                           yaml::skip_to_content(it, end);
 4975|  34.7k|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
  ------------------
  |  Branch (4975:32): [True: 34.7k, False: 0]
  |  Branch (4975:45): [True: 0, False: 34.7k]
  |  Branch (4975:59): [True: 0, False: 0]
  |  Branch (4975:78): [True: 0, False: 0]
  ------------------
 4976|      0|                              ctx.error = error_code::syntax_error;
 4977|      0|                              return false;
 4978|      0|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|  34.7k|                           const int32_t value_indent =
 4982|  34.7k|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
  ------------------
  |  Branch (4982:31): [Folded, False: 34.7k]
  ------------------
 4983|  34.7k|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
  ------------------
  |  Branch (4983:32): [True: 0, False: 34.7k]
  ------------------
 4984|      0|                              return false;
 4985|  34.7k|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|  34.7k|                           ctx.pop_indent();
 4987|  34.7k|                        }
 4988|   104k|                     }
 4989|   353k|                     return !bool(ctx.error);
 4990|   353k|                  };
_ZZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E_clESS_ENKUlSN_E_clISA_EEDaSN_:
 4938|   248k|                              auto is_line_content_start = [&](auto pos) {
 4939|   248k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   248k|                              };
_ZZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SA_SA_EEbSO_SP_SG_iENKUlRS4_E_clESS_ENKUlSN_E0_clISA_EEDaSN_:
 4942|   290k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   290k|                                 const char* line = ctx.line_begin_of(pos);
 4944|  1.26M|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
  ------------------
  |  Branch (4944:41): [True: 1.26M, False: 0]
  |  Branch (4944:57): [True: 973k, False: 291k]
  |  Branch (4944:73): [True: 499, False: 290k]
  ------------------
 4945|   290k|                                 return line != end && *line == ':';
  ------------------
  |  Branch (4945:41): [True: 290k, False: 0]
  |  Branch (4945:56): [True: 206k, False: 84.2k]
  ------------------
 4946|   290k|                              };
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRS5_TkNS_10is_contextERNS_4yaml12yaml_contextESA_EEvOT1_OT2_OT0_T3_EN19merge_restore_guardD2Ev:
 4696|   272k|            {
 4697|       |               // emplace is a no-op for keys the document already wrote, so only
 4698|       |               // untouched pre-existing entries are put back.
 4699|   272k|               for (auto& entry : saved) {
  ------------------
  |  Branch (4699:33): [True: 0, False: 272k]
  ------------------
 4700|      0|                  target.emplace(entry.first, std::move(entry.second));
 4701|      0|               }
 4702|   272k|            }
_ZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE10redispatchITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_:
 6762|  85.5k|      {
 6763|  85.5k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 6764|  85.5k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (6764:14): [True: 3, False: 85.5k]
  ------------------
 6765|      3|            return;
 6766|  85.5k|         op<Opts>(value, ctx, it, end);
 6767|  85.5k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERNSt3__17variantIJDndNS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbNS3_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS8_ISF_EEEENSE_ISF_EEEEENS0_12yaml_contextEPKcSN_EEbOT0_RT1_RT2_T3_:
  309|  83.6k|      {
  310|  83.6k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 83.6k]
  |  Branch (310:27): [True: 0, False: 83.6k]
  ------------------
  311|       |
  312|  83.6k|         ++it; // skip '*'
  313|  83.6k|         auto name = parse_anchor_name(it, end);
  314|  83.6k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 179, False: 83.4k]
  ------------------
  315|    179|            ctx.error = error_code::syntax_error;
  316|    179|            return true;
  317|    179|         }
  318|       |
  319|  83.4k|         auto anchor_it = ctx.anchors.find(name);
  320|  83.4k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 405, False: 83.0k]
  ------------------
  321|    405|            ctx.error = error_code::syntax_error; // undefined alias
  322|    405|            return true;
  323|    405|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  83.0k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  83.0k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 1.10k, False: 81.9k]
  ------------------
  331|  1.10k|            return true;
  332|  1.10k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  81.9k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 55, False: 81.8k]
  ------------------
  338|     55|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     55|            return true;
  340|     55|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  81.8k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  81.8k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 2, False: 81.8k]
  ------------------
  348|      2|            return true;
  349|       |
  350|  81.8k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 6, False: 81.8k]
  ------------------
  351|      6|            ctx.error = error_code::exceeded_max_expansion;
  352|      6|            ctx.custom_error_message = "alias expansion";
  353|      6|            return true;
  354|      6|         }
  355|       |
  356|  81.8k|         auto replay_it = span.begin;
  357|  81.8k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  81.8k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  81.8k|         ctx.indent_stack.clear();
  362|  81.8k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 49.6k, False: 32.2k]
  ------------------
  363|  49.6k|            ctx.push_indent(span.base_indent - 1);
  364|  49.6k|         }
  365|       |
  366|  81.8k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  81.8k|         using V = std::remove_cvref_t<T>;
  369|  81.8k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  81.8k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  81.8k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  81.8k|         return true;
  376|  81.8k|      }
_ZN3glz4yaml15skip_to_contentIPKcS3_EEvRT_T0_:
 3662|  3.27M|      {
 3663|  5.84M|         while (it != end) {
  ------------------
  |  Branch (3663:17): [True: 5.73M, False: 110k]
  ------------------
 3664|  5.73M|            if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3664:17): [True: 901k, False: 4.83M]
  |  Branch (3664:32): [True: 1.52M, False: 3.30M]
  ------------------
 3665|  2.42M|               skip_newline(it, end);
 3666|  2.42M|            }
 3667|  3.30M|            else if (*it == '#') {
  ------------------
  |  Branch (3667:22): [True: 54.6k, False: 3.25M]
  ------------------
 3668|  54.6k|               skip_comment(it, end);
 3669|  54.6k|            }
 3670|  3.25M|            else if (*it == ' ') {
  ------------------
  |  Branch (3670:22): [True: 950k, False: 2.30M]
  ------------------
 3671|   950k|               auto line_start = it;
 3672|  5.89M|               while (it != end && *it == ' ') ++it;
  ------------------
  |  Branch (3672:23): [True: 5.88M, False: 7.24k]
  |  Branch (3672:36): [True: 4.94M, False: 943k]
  ------------------
 3673|   950k|               if (it == end || *it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3673:20): [True: 7.24k, False: 943k]
  |  Branch (3673:33): [True: 27.3k, False: 916k]
  |  Branch (3673:48): [True: 30.7k, False: 885k]
  ------------------
 3674|  65.2k|                  continue; // blank line with trailing spaces
 3675|  65.2k|               }
 3676|   885k|               if (*it == '#') {
  ------------------
  |  Branch (3676:20): [True: 26.9k, False: 858k]
  ------------------
 3677|  26.9k|                  skip_comment(it, end);
 3678|  26.9k|                  continue; // comment-only line
 3679|  26.9k|               }
 3680|   858k|               it = line_start; // content found, restore to start of indent
 3681|   858k|               return;
 3682|   885k|            }
 3683|  2.30M|            else {
 3684|  2.30M|               return; // content at column 0
 3685|  2.30M|            }
 3686|  5.73M|         }
 3687|  3.27M|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_19is_yaml_variant_strEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|  94.1k|      {
 5356|  94.1k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|  94.1k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|  94.1k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|  94.1k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|  94.1k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 94.1k, False: 0]
  ------------------
 5366|  94.1k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|  94.1k|      }
_ZN3glz4fromILj450ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRS7_TkNS_10is_contextERNS_4yaml12yaml_contextESC_EEvOT1_OT2_OT0_T3_:
 1987|  97.4k|      {
 1988|  97.4k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (1988:14): [True: 8.68k, False: 88.7k]
  ------------------
 1989|  8.68k|            return;
 1990|       |
 1991|  88.7k|         yaml::node_preamble_state preamble{};
 1992|  88.7k|         if (yaml::parse_node_preamble<Opts, yaml::node_property_policy{true, false, false, true}>(
  ------------------
  |  Branch (1992:14): [True: 3.93k, False: 84.7k]
  ------------------
 1993|  88.7k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_string(tag); }))
 1994|  3.93k|            return;
 1995|       |
 1996|  84.7k|         std::string str;
 1997|  84.7k|         const auto style = yaml::detect_scalar_style(*it);
 1998|       |
 1999|  84.7k|         switch (style) {
  ------------------
  |  Branch (1999:18): [True: 84.7k, False: 0]
  ------------------
 2000|  1.27k|         case yaml::scalar_style::double_quoted:
  ------------------
  |  Branch (2000:10): [True: 1.27k, False: 83.5k]
  ------------------
 2001|  1.27k|            yaml::parse_double_quoted_string(str, ctx, it, end);
 2002|  1.27k|            break;
 2003|    665|         case yaml::scalar_style::single_quoted:
  ------------------
  |  Branch (2003:10): [True: 665, False: 84.1k]
  ------------------
 2004|    665|            yaml::parse_single_quoted_string(str, ctx, it, end);
 2005|    665|            break;
 2006|    371|         case yaml::scalar_style::literal_block:
  ------------------
  |  Branch (2006:10): [True: 371, False: 84.4k]
  ------------------
 2007|  1.60k|         case yaml::scalar_style::folded_block:
  ------------------
  |  Branch (2007:10): [True: 1.23k, False: 83.5k]
  ------------------
 2008|       |            // For same-line mapping/sequence values, parsing context is typically pushed
 2009|       |            // one column past the key/item indicator; block scalar indentation is relative
 2010|       |            // to the parent line indent.
 2011|  1.60k|            yaml::parse_block_scalar(str, ctx, it, end,
 2012|  1.60k|                                     ctx.current_indent() > 0 ? (ctx.current_indent() - 1) : ctx.current_indent());
  ------------------
  |  Branch (2012:38): [True: 593, False: 1.01k]
  ------------------
 2013|  1.60k|            break;
 2014|  81.2k|         case yaml::scalar_style::plain:
  ------------------
  |  Branch (2014:10): [True: 81.2k, False: 3.55k]
  ------------------
 2015|       |            // A collection where a string is expected is a type mismatch. Reading it as a
 2016|       |            // plain scalar would store its source text, and for a block sequence only the
 2017|       |            // first entry, as the value.
 2018|  81.2k|            if (yaml::plain_scalar_starts_collection(it, end)) [[unlikely]] {
  ------------------
  |  Branch (2018:17): [True: 49, False: 81.1k]
  ------------------
 2019|     49|               ctx.error = error_code::syntax_error;
 2020|     49|               return;
 2021|     49|            }
 2022|       |            // In block context with known indent, use multiline parsing to support
 2023|       |            // plain scalars that span multiple lines (folding behavior)
 2024|  81.1k|            if constexpr (!yaml::check_flow_context(Opts)) {
 2025|  81.1k|               if (ctx.current_indent() >= 0) {
  ------------------
  |  Branch (2025:20): [True: 67.6k, False: 13.5k]
  ------------------
 2026|  67.6k|                  yaml::parse_plain_scalar_multiline(str, ctx, it, end, ctx.current_indent());
 2027|  67.6k|               }
 2028|  13.5k|               else {
 2029|       |                  // Top-level plain scalars may continue on same-indent or indented lines.
 2030|  13.5k|                  yaml::parse_plain_scalar_multiline(str, ctx, it, end, int32_t(0));
 2031|  13.5k|               }
 2032|       |            }
 2033|       |            else {
 2034|       |               yaml::parse_plain_scalar(str, ctx, it, end, true);
 2035|       |            }
 2036|  81.1k|            break;
 2037|  84.7k|         }
 2038|       |
 2039|  84.7k|         if (!bool(ctx.error)) {
  ------------------
  |  Branch (2039:14): [True: 83.7k, False: 1.02k]
  ------------------
 2040|  83.7k|            value = std::move(str);
 2041|  83.7k|            yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 2042|  83.7k|         }
 2043|  84.7k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEEXtlNS0_20node_property_policyELb1ELb0ELb0ELb1EEELb0ERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_12yaml_contextEPKcSE_ZNS_4fromILj450ESA_E2opITnDaXtlS2_Lj450ELb0ELb0ELb1ELb1EEERSE_SB_TkNS_10is_contextERSC_SE_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSN_RSQ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|  88.7k|      {
  475|  88.7k|         skip_inline_ws(it, end);
  476|       |
  477|  88.7k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 17, False: 88.7k]
  ------------------
  478|     17|            if constexpr (!AllowEmptyInput) {
  479|     17|               ctx.error = error_code::unexpected_end;
  480|     17|            }
  481|     17|            return true;
  482|     17|         }
  483|       |
  484|  88.7k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|  88.7k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 11, False: 88.7k]
  ------------------
  486|     11|            ctx.error = error_code::syntax_error;
  487|     11|            return true;
  488|     11|         }
  489|  88.7k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 7, False: 88.7k]
  ------------------
  490|      7|            ctx.error = error_code::syntax_error;
  491|      7|            return true;
  492|      7|         }
  493|       |
  494|  88.7k|         skip_inline_ws(it, end);
  495|       |
  496|  88.7k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 9, False: 88.6k]
  ------------------
  497|      9|            if constexpr (!AllowEmptyInput) {
  498|      9|               ctx.error = error_code::unexpected_end;
  499|      9|            }
  500|      9|            return true;
  501|      9|         }
  502|       |
  503|  88.6k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 3.89k, False: 84.7k]
  ------------------
  504|  3.89k|            return true;
  505|  3.89k|         }
  506|       |
  507|  84.7k|         return false;
  508|  88.6k|      }
_ZZN3glz4fromILj450ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRS7_TkNS_10is_contextERNS_4yaml12yaml_contextESC_EEvOT1_OT2_OT0_T3_ENKUlNSF_8yaml_tagEE_clESP_:
 1993|  88.7k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_string(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEEXtlNS0_20node_property_policyELb1ELb0ELb0ELb1EEERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_12yaml_contextEPKcSE_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|  88.6k|      {
  418|  88.6k|         state.has_anchor = false;
  419|  88.6k|         state.anchor_name.clear();
  420|  88.6k|         state.anchor_start = nullptr;
  421|  88.6k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|  88.6k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|  88.6k|            else {
  430|  88.6k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 3.83k, False: 84.8k]
  ------------------
  431|  88.6k|            }
  432|  88.6k|         }
  433|       |
  434|  88.6k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 84.8k, False: 3.83k]
  |  Branch (434:27): [True: 3.14k, False: 81.7k]
  ------------------
  435|  3.14k|            ++it;
  436|  3.14k|            auto name = parse_anchor_name(it, end);
  437|  3.14k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 15, False: 3.13k]
  ------------------
  438|     15|               ctx.error = error_code::syntax_error;
  439|     15|               return true;
  440|     15|            }
  441|  3.13k|            skip_inline_ws(it, end);
  442|  3.13k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 38, False: 3.09k]
  ------------------
  443|     38|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     38|                  ctx.error = error_code::unexpected_end;
  445|     38|               }
  446|     38|               return true;
  447|     38|            }
  448|  3.09k|            if constexpr (Policy.disallow_anchor_on_alias) {
  449|  3.09k|               if (*it == '*') {
  ------------------
  |  Branch (449:20): [True: 2, False: 3.09k]
  ------------------
  450|      2|                  ctx.error = error_code::syntax_error;
  451|      2|                  return true;
  452|      2|               }
  453|  3.09k|            }
  454|  3.09k|            state.has_anchor = true;
  455|  3.09k|            state.anchor_name = std::string(name);
  456|  3.09k|            state.anchor_start = &*it;
  457|  3.09k|         }
  458|       |
  459|  88.6k|         return false;
  460|  88.6k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS0_12yaml_contextEPKcSD_EEbOT0_RT1_RT2_T3_:
  309|  88.6k|      {
  310|  88.6k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 88.6k]
  |  Branch (310:27): [True: 84.8k, False: 3.83k]
  ------------------
  311|       |
  312|  3.83k|         ++it; // skip '*'
  313|  3.83k|         auto name = parse_anchor_name(it, end);
  314|  3.83k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 13, False: 3.82k]
  ------------------
  315|     13|            ctx.error = error_code::syntax_error;
  316|     13|            return true;
  317|     13|         }
  318|       |
  319|  3.82k|         auto anchor_it = ctx.anchors.find(name);
  320|  3.82k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 24, False: 3.80k]
  ------------------
  321|     24|            ctx.error = error_code::syntax_error; // undefined alias
  322|     24|            return true;
  323|     24|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  3.80k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  3.80k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 492, False: 3.31k]
  ------------------
  331|    492|            return true;
  332|    492|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  3.31k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 10, False: 3.30k]
  ------------------
  338|     10|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     10|            return true;
  340|     10|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  3.30k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  3.30k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 2, False: 3.29k]
  ------------------
  348|      2|            return true;
  349|       |
  350|  3.29k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 0, False: 3.29k]
  ------------------
  351|      0|            ctx.error = error_code::exceeded_max_expansion;
  352|      0|            ctx.custom_error_message = "alias expansion";
  353|      0|            return true;
  354|      0|         }
  355|       |
  356|  3.29k|         auto replay_it = span.begin;
  357|  3.29k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  3.29k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  3.29k|         ctx.indent_stack.clear();
  362|  3.29k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 2.15k, False: 1.14k]
  ------------------
  363|  2.15k|            ctx.push_indent(span.base_indent - 1);
  364|  2.15k|         }
  365|       |
  366|  3.29k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  3.29k|         using V = std::remove_cvref_t<T>;
  369|  3.29k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  3.29k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  3.29k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  3.29k|         return true;
  376|  3.29k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_19is_yaml_variant_numEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|  35.4k|      {
 5356|  35.4k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|  35.4k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|  35.4k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|  35.4k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|  35.4k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 35.4k, False: 0]
  ------------------
 5366|  35.4k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|  35.4k|      }
_ZN3glz4fromILj450EdE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRdTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_:
 2149|  39.0k|      {
 2150|  39.0k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2150:14): [True: 0, False: 39.0k]
  ------------------
 2151|      0|            return;
 2152|       |
 2153|  39.0k|         yaml::node_preamble_state preamble{};
 2154|  39.0k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble, [](yaml::yaml_tag tag) {
  ------------------
  |  Branch (2154:14): [True: 7.27k, False: 31.7k]
  ------------------
 2155|  39.0k|                if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2156|  39.0k|                   return yaml::tag_valid_for_float(tag);
 2157|  39.0k|                }
 2158|  39.0k|                else {
 2159|  39.0k|                   return yaml::tag_valid_for_int(tag);
 2160|  39.0k|                }
 2161|  39.0k|             }))
 2162|  7.27k|            return;
 2163|       |
 2164|  31.7k|         auto finalize = [&] { yaml::finalize_node_anchor(preamble.node_props, ctx, it); };
 2165|       |
 2166|       |         // Check for special float values
 2167|  31.7k|         if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2168|  31.7k|            auto start = it;
 2169|       |
 2170|       |            // Check for .inf, .nan, -.inf, etc.
 2171|  31.7k|            if (*it == '.') {
  ------------------
  |  Branch (2171:17): [True: 6.86k, False: 24.8k]
  ------------------
 2172|  6.86k|               ++it;
 2173|  6.86k|               if (it + 3 <= end && (std::string_view(it, 3) == "inf" || std::string_view(it, 3) == "Inf" ||
  ------------------
  |  Branch (2173:20): [True: 6.46k, False: 404]
  |  Branch (2173:38): [True: 821, False: 5.64k]
  |  Branch (2173:74): [True: 297, False: 5.34k]
  ------------------
 2174|  5.34k|                                     std::string_view(it, 3) == "INF")) {
  ------------------
  |  Branch (2174:38): [True: 399, False: 4.94k]
  ------------------
 2175|  1.51k|                  value = std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2176|  1.51k|                  it += 3;
 2177|  1.51k|                  finalize();
 2178|  1.51k|                  return;
 2179|  1.51k|               }
 2180|  5.34k|               if (it + 3 <= end && (std::string_view(it, 3) == "nan" || std::string_view(it, 3) == "NaN" ||
  ------------------
  |  Branch (2180:20): [True: 4.94k, False: 404]
  |  Branch (2180:38): [True: 918, False: 4.02k]
  |  Branch (2180:74): [True: 218, False: 3.80k]
  ------------------
 2181|  3.80k|                                     std::string_view(it, 3) == "NAN")) {
  ------------------
  |  Branch (2181:38): [True: 344, False: 3.46k]
  ------------------
 2182|  1.48k|                  value = std::numeric_limits<std::remove_cvref_t<T>>::quiet_NaN();
 2183|  1.48k|                  it += 3;
 2184|  1.48k|                  finalize();
 2185|  1.48k|                  return;
 2186|  1.48k|               }
 2187|  3.86k|               it = start;
 2188|  3.86k|            }
 2189|       |
 2190|  28.7k|            if (*it == '-' || *it == '+') {
  ------------------
  |  Branch (2190:17): [True: 3.78k, False: 24.9k]
  |  Branch (2190:31): [True: 3.50k, False: 21.4k]
  ------------------
 2191|  7.28k|               const char sign = *it;
 2192|  7.28k|               ++it;
 2193|  7.28k|               if (it != end && *it == '.') {
  ------------------
  |  Branch (2193:20): [True: 6.97k, False: 313]
  |  Branch (2193:33): [True: 2.63k, False: 4.33k]
  ------------------
 2194|  2.63k|                  ++it;
 2195|  2.63k|                  if (it + 3 <= end && (std::string_view(it, 3) == "inf" || std::string_view(it, 3) == "Inf" ||
  ------------------
  |  Branch (2195:23): [True: 2.21k, False: 423]
  |  Branch (2195:41): [True: 985, False: 1.22k]
  |  Branch (2195:77): [True: 132, False: 1.09k]
  ------------------
 2196|  1.25k|                                        std::string_view(it, 3) == "INF")) {
  ------------------
  |  Branch (2196:41): [True: 140, False: 954]
  ------------------
 2197|  1.25k|                     if (sign == '-') {
  ------------------
  |  Branch (2197:26): [True: 886, False: 371]
  ------------------
 2198|    886|                        value = -std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2199|    886|                     }
 2200|    371|                     else {
 2201|    371|                        value = std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2202|    371|                     }
 2203|  1.25k|                     it += 3;
 2204|  1.25k|                     finalize();
 2205|  1.25k|                     return;
 2206|  1.25k|                  }
 2207|  2.63k|               }
 2208|  6.02k|               it = start;
 2209|  6.02k|            }
 2210|  28.7k|         }
 2211|       |
 2212|       |         // Parse as plain scalar and convert
 2213|  27.5k|         auto start = it;
 2214|       |
 2215|       |         // Find end of number - use same rules as plain scalar for colons
 2216|  17.7M|         while (it != end) {
  ------------------
  |  Branch (2216:17): [True: 17.7M, False: 10.1k]
  ------------------
 2217|  17.7M|            const char c = *it;
 2218|  17.7M|            if (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == ',' || c == ']' || c == '}' || c == '#') {
  ------------------
  |  Branch (2218:17): [True: 8.20k, False: 17.7M]
  |  Branch (2218:29): [True: 1.35k, False: 17.7M]
  |  Branch (2218:42): [True: 2.75k, False: 17.7M]
  |  Branch (2218:55): [True: 1.89k, False: 17.7M]
  |  Branch (2218:68): [True: 1.26k, False: 17.7M]
  |  Branch (2218:80): [True: 551, False: 17.7M]
  |  Branch (2218:92): [True: 570, False: 17.7M]
  |  Branch (2218:104): [True: 1.58k, False: 17.7M]
  ------------------
 2219|  18.1k|               break;
 2220|  18.1k|            }
 2221|       |            // Colon only ends number if followed by space/tab/newline/end (YAML mapping indicator)
 2222|  17.7M|            if (c == ':') {
  ------------------
  |  Branch (2222:17): [True: 6.82k, False: 17.7M]
  ------------------
 2223|  6.82k|               if ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\t' || *(it + 1) == '\n' || *(it + 1) == '\r') {
  ------------------
  |  Branch (2223:20): [True: 526, False: 6.29k]
  |  Branch (2223:39): [True: 1.81k, False: 4.48k]
  |  Branch (2223:59): [True: 130, False: 4.35k]
  |  Branch (2223:80): [True: 478, False: 3.87k]
  |  Branch (2223:101): [True: 432, False: 3.44k]
  ------------------
 2224|  3.37k|                  break;
 2225|  3.37k|               }
 2226|  6.82k|            }
 2227|  17.7M|            ++it;
 2228|  17.7M|         }
 2229|       |
 2230|  31.7k|         const std::string_view num_str(&*start, static_cast<size_t>(it - start));
 2231|       |
 2232|  31.7k|         if (num_str.empty()) {
  ------------------
  |  Branch (2232:14): [True: 1.64k, False: 30.1k]
  ------------------
 2233|  1.64k|            ctx.error = error_code::parse_number_failure;
 2234|  1.64k|            return;
 2235|  1.64k|         }
 2236|       |
 2237|       |         // Handle hex, octal, binary
 2238|       |         if constexpr (std::integral<std::remove_cvref_t<T>>) {
 2239|       |            if (num_str.size() > 2 && num_str[0] == '0') {
 2240|       |               int base = 10;
 2241|       |               size_t offset = 0;
 2242|       |
 2243|       |               if (num_str[1] == 'x' || num_str[1] == 'X') {
 2244|       |                  base = 16;
 2245|       |                  offset = 2;
 2246|       |               }
 2247|       |               else if (num_str[1] == 'o' || num_str[1] == 'O') {
 2248|       |                  base = 8;
 2249|       |                  offset = 2;
 2250|       |               }
 2251|       |               else if (num_str[1] == 'b' || num_str[1] == 'B') {
 2252|       |                  base = 2;
 2253|       |                  offset = 2;
 2254|       |               }
 2255|       |
 2256|       |               if (base != 10) {
 2257|       |                  const auto digits = num_str.substr(offset);
 2258|       |                  const bool has_underscores = (digits.find('_') != std::string_view::npos);
 2259|       |
 2260|       |                  std::string clean_storage;
 2261|       |                  std::string_view clean_view;
 2262|       |
 2263|       |                  if (has_underscores) {
 2264|       |                     clean_storage.reserve(digits.size());
 2265|       |                     for (char c : digits) {
 2266|       |                        if (c != '_') {
 2267|       |                           clean_storage.push_back(c);
 2268|       |                        }
 2269|       |                     }
 2270|       |                     clean_view = clean_storage;
 2271|       |                  }
 2272|       |                  else {
 2273|       |                     clean_view = digits;
 2274|       |                  }
 2275|       |
 2276|       |                  auto [ptr, ec] =
 2277|       |                     std::from_chars(clean_view.data(), clean_view.data() + clean_view.size(), value, base);
 2278|       |                  if (ec != std::errc{}) {
 2279|       |                     ctx.error = error_code::parse_number_failure;
 2280|       |                  }
 2281|       |                  finalize();
 2282|       |                  return;
 2283|       |               }
 2284|       |            }
 2285|       |         }
 2286|  30.1k|         else if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2287|  30.1k|            bool negative = false;
 2288|  30.1k|            std::string_view digits = num_str;
 2289|       |
 2290|  30.1k|            if (!digits.empty() && (digits.front() == '+' || digits.front() == '-')) {
  ------------------
  |  Branch (2290:17): [True: 25.8k, False: 4.25k]
  |  Branch (2290:37): [True: 3.13k, False: 22.7k]
  |  Branch (2290:62): [True: 2.89k, False: 19.8k]
  ------------------
 2291|  6.02k|               negative = (digits.front() == '-');
 2292|  6.02k|               digits.remove_prefix(1);
 2293|  6.02k|            }
 2294|       |
 2295|  30.1k|            if (digits.size() > 2 && digits[0] == '0') {
  ------------------
  |  Branch (2295:17): [True: 17.0k, False: 13.0k]
  |  Branch (2295:38): [True: 8.38k, False: 8.66k]
  ------------------
 2296|  8.38k|               int base = 10;
 2297|  8.38k|               size_t offset = 0;
 2298|       |
 2299|  8.38k|               if (digits[1] == 'x' || digits[1] == 'X') {
  ------------------
  |  Branch (2299:20): [True: 2.10k, False: 6.27k]
  |  Branch (2299:40): [True: 251, False: 6.02k]
  ------------------
 2300|  2.35k|                  base = 16;
 2301|  2.35k|                  offset = 2;
 2302|  2.35k|               }
 2303|  6.02k|               else if (digits[1] == 'o' || digits[1] == 'O') {
  ------------------
  |  Branch (2303:25): [True: 235, False: 5.79k]
  |  Branch (2303:45): [True: 336, False: 5.45k]
  ------------------
 2304|    571|                  base = 8;
 2305|    571|                  offset = 2;
 2306|    571|               }
 2307|  5.45k|               else if (digits[1] == 'b' || digits[1] == 'B') {
  ------------------
  |  Branch (2307:25): [True: 319, False: 5.13k]
  |  Branch (2307:45): [True: 286, False: 4.85k]
  ------------------
 2308|    605|                  base = 2;
 2309|    605|                  offset = 2;
 2310|    605|               }
 2311|       |
 2312|  8.38k|               if (base != 10) {
  ------------------
  |  Branch (2312:20): [True: 3.53k, False: 4.85k]
  ------------------
 2313|  3.53k|                  auto raw_digits = digits.substr(offset);
 2314|  3.53k|                  const bool has_underscores = (raw_digits.find('_') != std::string_view::npos);
 2315|       |
 2316|  3.53k|                  std::string clean_storage;
 2317|  3.53k|                  std::string_view clean_view;
 2318|  3.53k|                  if (has_underscores) {
  ------------------
  |  Branch (2318:23): [True: 1.11k, False: 2.41k]
  ------------------
 2319|  1.11k|                     clean_storage.reserve(raw_digits.size());
 2320|   984k|                     for (char c : raw_digits) {
  ------------------
  |  Branch (2320:34): [True: 984k, False: 1.11k]
  ------------------
 2321|   984k|                        if (c != '_') {
  ------------------
  |  Branch (2321:29): [True: 982k, False: 2.10k]
  ------------------
 2322|   982k|                           clean_storage.push_back(c);
 2323|   982k|                        }
 2324|   984k|                     }
 2325|  1.11k|                     clean_view = clean_storage;
 2326|  1.11k|                  }
 2327|  2.41k|                  else {
 2328|  2.41k|                     clean_view = raw_digits;
 2329|  2.41k|                  }
 2330|       |
 2331|  3.53k|                  uint64_t parsed_int{};
 2332|  3.53k|                  auto [ptr, ec] =
 2333|  3.53k|                     std::from_chars(clean_view.data(), clean_view.data() + clean_view.size(), parsed_int, base);
 2334|  3.53k|                  if (ec != std::errc{} || ptr != (clean_view.data() + clean_view.size())) {
  ------------------
  |  Branch (2334:23): [True: 1.31k, False: 2.21k]
  |  Branch (2334:44): [True: 880, False: 1.33k]
  ------------------
 2335|  2.19k|                     ctx.error = error_code::parse_number_failure;
 2336|  2.19k|                     finalize();
 2337|  2.19k|                     return;
 2338|  2.19k|                  }
 2339|       |
 2340|  1.33k|                  const auto as_float = static_cast<std::remove_cvref_t<T>>(parsed_int);
 2341|  1.33k|                  value = negative ? -as_float : as_float;
  ------------------
  |  Branch (2341:27): [True: 257, False: 1.08k]
  ------------------
 2342|  1.33k|                  finalize();
 2343|  1.33k|                  return;
 2344|  3.53k|               }
 2345|  8.38k|            }
 2346|  30.1k|         }
 2347|       |
 2348|       |         // Standard number parsing - only allocate if underscores present
 2349|  26.5k|         const bool has_underscores = (num_str.find('_') != std::string_view::npos);
 2350|       |
 2351|  30.1k|         std::string clean_storage;
 2352|  30.1k|         std::string_view clean_view;
 2353|       |
 2354|  30.1k|         if (has_underscores) {
  ------------------
  |  Branch (2354:14): [True: 4.36k, False: 25.7k]
  ------------------
 2355|  4.36k|            clean_storage.reserve(num_str.size());
 2356|  8.97M|            for (char c : num_str) {
  ------------------
  |  Branch (2356:25): [True: 8.97M, False: 4.36k]
  ------------------
 2357|  8.97M|               if (c != '_') {
  ------------------
  |  Branch (2357:20): [True: 8.96M, False: 6.81k]
  ------------------
 2358|  8.96M|                  clean_storage.push_back(c);
 2359|  8.96M|               }
 2360|  8.97M|            }
 2361|  4.36k|            clean_view = clean_storage;
 2362|  4.36k|         }
 2363|  25.7k|         else {
 2364|  25.7k|            clean_view = num_str;
 2365|  25.7k|         }
 2366|       |
 2367|       |         // YAML allows leading '+' for positive numbers, but C++ from_chars doesn't
 2368|       |         // Strip leading '+' if present
 2369|  30.1k|         auto parse_view = clean_view;
 2370|  30.1k|         if (!parse_view.empty() && parse_view.front() == '+') {
  ------------------
  |  Branch (2370:14): [True: 22.1k, False: 7.93k]
  |  Branch (2370:37): [True: 3.13k, False: 19.0k]
  ------------------
 2371|  3.13k|            parse_view.remove_prefix(1);
 2372|  3.13k|            if (parse_view.empty()) {
  ------------------
  |  Branch (2372:17): [True: 847, False: 2.28k]
  ------------------
 2373|    847|               ctx.error = error_code::parse_number_failure;
 2374|    847|               return;
 2375|    847|            }
 2376|  3.13k|         }
 2377|       |
 2378|  29.2k|         if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2379|  29.2k|            auto result = glz::fast_float::from_chars(parse_view.data(), parse_view.data() + parse_view.size(), value);
 2380|       |            // Check both for errors and that all input was consumed (e.g., "12:30" is not a valid number)
 2381|  29.2k|            if (result.ec != std::errc{} || result.ptr != parse_view.data() + parse_view.size()) {
  ------------------
  |  Branch (2381:17): [True: 16.3k, False: 12.8k]
  |  Branch (2381:45): [True: 7.11k, False: 5.77k]
  ------------------
 2382|  15.6k|               ctx.error = error_code::parse_number_failure;
 2383|  15.6k|            }
 2384|       |         }
 2385|       |         else {
 2386|       |            auto [ptr, ec] = std::from_chars(parse_view.data(), parse_view.data() + parse_view.size(), value);
 2387|       |            // Check both for errors and that all input was consumed
 2388|       |            if (ec != std::errc{} || ptr != parse_view.data() + parse_view.size()) {
 2389|       |               ctx.error = error_code::parse_number_failure;
 2390|       |            }
 2391|       |         }
 2392|       |
 2393|  29.2k|         finalize();
 2394|  29.2k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEEXtlNS0_20node_property_policyELb1EEELb0ERdNS0_12yaml_contextEPKcS7_ZNS_4fromILj450EdE2opITnDaXtlS2_Lj450ELb0ELb0ELb1ELb1EEERS7_S4_TkNS_10is_contextERS5_S7_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSG_RSJ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|  39.0k|      {
  475|  39.0k|         skip_inline_ws(it, end);
  476|       |
  477|  39.0k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 275, False: 38.7k]
  ------------------
  478|    275|            if constexpr (!AllowEmptyInput) {
  479|    275|               ctx.error = error_code::unexpected_end;
  480|    275|            }
  481|    275|            return true;
  482|    275|         }
  483|       |
  484|  38.7k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|  38.7k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 338, False: 38.4k]
  ------------------
  486|    338|            ctx.error = error_code::syntax_error;
  487|    338|            return true;
  488|    338|         }
  489|  38.4k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 190, False: 38.2k]
  ------------------
  490|    190|            ctx.error = error_code::syntax_error;
  491|    190|            return true;
  492|    190|         }
  493|       |
  494|  38.2k|         skip_inline_ws(it, end);
  495|       |
  496|  38.2k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 158, False: 38.0k]
  ------------------
  497|    158|            if constexpr (!AllowEmptyInput) {
  498|    158|               ctx.error = error_code::unexpected_end;
  499|    158|            }
  500|    158|            return true;
  501|    158|         }
  502|       |
  503|  38.0k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 6.30k, False: 31.7k]
  ------------------
  504|  6.30k|            return true;
  505|  6.30k|         }
  506|       |
  507|  31.7k|         return false;
  508|  38.0k|      }
_ZZN3glz4fromILj450EdE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRdTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_ENKUlNS8_8yaml_tagEE_clESI_:
 2154|  38.4k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble, [](yaml::yaml_tag tag) {
 2155|  38.4k|                if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2156|  38.4k|                   return yaml::tag_valid_for_float(tag);
 2157|       |                }
 2158|       |                else {
 2159|       |                   return yaml::tag_valid_for_int(tag);
 2160|       |                }
 2161|  38.4k|             }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEEXtlNS0_20node_property_policyELb1EEERdNS0_12yaml_contextEPKcS7_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|  38.0k|      {
  418|  38.0k|         state.has_anchor = false;
  419|  38.0k|         state.anchor_name.clear();
  420|  38.0k|         state.anchor_start = nullptr;
  421|  38.0k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|  38.0k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|  38.0k|            else {
  430|  38.0k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 5.69k, False: 32.3k]
  ------------------
  431|  38.0k|            }
  432|  38.0k|         }
  433|       |
  434|  38.0k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 32.3k, False: 5.69k]
  |  Branch (434:27): [True: 3.64k, False: 28.7k]
  ------------------
  435|  3.64k|            ++it;
  436|  3.64k|            auto name = parse_anchor_name(it, end);
  437|  3.64k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 365, False: 3.28k]
  ------------------
  438|    365|               ctx.error = error_code::syntax_error;
  439|    365|               return true;
  440|    365|            }
  441|  3.28k|            skip_inline_ws(it, end);
  442|  3.28k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 246, False: 3.03k]
  ------------------
  443|    246|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|    246|                  ctx.error = error_code::unexpected_end;
  445|    246|               }
  446|    246|               return true;
  447|    246|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  3.03k|            state.has_anchor = true;
  455|  3.03k|            state.anchor_name = std::string(name);
  456|  3.03k|            state.anchor_start = &*it;
  457|  3.03k|         }
  458|       |
  459|  37.4k|         return false;
  460|  38.0k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERdNS0_12yaml_contextEPKcS6_EEbOT0_RT1_RT2_T3_:
  309|  38.0k|      {
  310|  38.0k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 38.0k]
  |  Branch (310:27): [True: 32.3k, False: 5.69k]
  ------------------
  311|       |
  312|  5.69k|         ++it; // skip '*'
  313|  5.69k|         auto name = parse_anchor_name(it, end);
  314|  5.69k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 453, False: 5.24k]
  ------------------
  315|    453|            ctx.error = error_code::syntax_error;
  316|    453|            return true;
  317|    453|         }
  318|       |
  319|  5.24k|         auto anchor_it = ctx.anchors.find(name);
  320|  5.24k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 1.04k, False: 4.20k]
  ------------------
  321|  1.04k|            ctx.error = error_code::syntax_error; // undefined alias
  322|  1.04k|            return true;
  323|  1.04k|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  4.20k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  4.20k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 462, False: 3.74k]
  ------------------
  331|    462|            return true;
  332|    462|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  3.74k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 163, False: 3.57k]
  ------------------
  338|    163|            ctx.error = error_code::syntax_error; // cyclic alias
  339|    163|            return true;
  340|    163|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  3.57k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  3.57k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 2, False: 3.57k]
  ------------------
  348|      2|            return true;
  349|       |
  350|  3.57k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 0, False: 3.57k]
  ------------------
  351|      0|            ctx.error = error_code::exceeded_max_expansion;
  352|      0|            ctx.custom_error_message = "alias expansion";
  353|      0|            return true;
  354|      0|         }
  355|       |
  356|  3.57k|         auto replay_it = span.begin;
  357|  3.57k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  3.57k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  3.57k|         ctx.indent_stack.clear();
  362|  3.57k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 2.15k, False: 1.41k]
  ------------------
  363|  2.15k|            ctx.push_indent(span.base_indent - 1);
  364|  2.15k|         }
  365|       |
  366|  3.57k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  3.57k|         using V = std::remove_cvref_t<T>;
  369|  3.57k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  3.57k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  3.57k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  3.57k|         return true;
  376|  3.57k|      }
_ZZN3glz4fromILj450EdE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRdTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_ENKUlvE_clEv:
 2164|  29.2k|         auto finalize = [&] { yaml::finalize_node_anchor(preamble.node_props, ctx, it); };
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_20is_yaml_variant_boolEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|  16.8k|      {
 5356|  16.8k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|  16.8k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|  16.8k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|  16.8k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|  16.8k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 16.8k, False: 0]
  ------------------
 5366|  16.8k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|  16.8k|      }
_ZN3glz4fromILj450EbE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRbTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_:
 2114|  21.7k|      {
 2115|  21.7k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2115:14): [True: 0, False: 21.7k]
  ------------------
 2116|      0|            return;
 2117|       |
 2118|  21.7k|         yaml::node_preamble_state preamble{};
 2119|  21.7k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble,
  ------------------
  |  Branch (2119:14): [True: 5.42k, False: 16.3k]
  ------------------
 2120|  21.7k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_bool(tag); }))
 2121|  5.42k|            return;
 2122|       |
 2123|       |         // Parse as plain scalar first
 2124|  16.3k|         std::string str;
 2125|  16.3k|         yaml::parse_plain_scalar(str, ctx, it, end, yaml::check_flow_context(Opts));
 2126|       |
 2127|  16.3k|         if (str == "true" || str == "True" || str == "TRUE" || str == "yes" || str == "Yes" || str == "YES" ||
  ------------------
  |  Branch (2127:14): [True: 3.95k, False: 12.3k]
  |  Branch (2127:31): [True: 3.95k, False: 8.40k]
  |  Branch (2127:48): [True: 917, False: 7.48k]
  |  Branch (2127:65): [True: 251, False: 7.23k]
  |  Branch (2127:81): [True: 273, False: 6.96k]
  |  Branch (2127:97): [True: 496, False: 6.46k]
  ------------------
 2128|  10.8k|             str == "on" || str == "On" || str == "ON") {
  ------------------
  |  Branch (2128:14): [True: 270, False: 6.19k]
  |  Branch (2128:29): [True: 396, False: 5.79k]
  |  Branch (2128:44): [True: 309, False: 5.48k]
  ------------------
 2129|  10.8k|            value = true;
 2130|  10.8k|         }
 2131|  5.48k|         else if (str == "false" || str == "False" || str == "FALSE" || str == "no" || str == "No" || str == "NO" ||
  ------------------
  |  Branch (2131:19): [True: 1.25k, False: 4.23k]
  |  Branch (2131:37): [True: 1.73k, False: 2.50k]
  |  Branch (2131:55): [True: 521, False: 1.98k]
  |  Branch (2131:73): [True: 301, False: 1.68k]
  |  Branch (2131:88): [True: 463, False: 1.21k]
  |  Branch (2131:103): [True: 289, False: 929]
  ------------------
 2132|  5.35k|                  str == "off" || str == "Off" || str == "OFF") {
  ------------------
  |  Branch (2132:19): [True: 256, False: 673]
  |  Branch (2132:35): [True: 277, False: 396]
  |  Branch (2132:51): [True: 264, False: 132]
  ------------------
 2133|  5.35k|            value = false;
 2134|  5.35k|         }
 2135|    132|         else {
 2136|    132|            ctx.error = error_code::expected_true_or_false;
 2137|    132|         }
 2138|       |
 2139|  16.3k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 2140|  16.3k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEEXtlNS0_20node_property_policyELb1EEELb0ERbNS0_12yaml_contextEPKcS7_ZNS_4fromILj450EbE2opITnDaXtlS2_Lj450ELb0ELb0ELb1ELb1EEERS7_S4_TkNS_10is_contextERS5_S7_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSG_RSJ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|  21.7k|      {
  475|  21.7k|         skip_inline_ws(it, end);
  476|       |
  477|  21.7k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 12, False: 21.7k]
  ------------------
  478|     12|            if constexpr (!AllowEmptyInput) {
  479|     12|               ctx.error = error_code::unexpected_end;
  480|     12|            }
  481|     12|            return true;
  482|     12|         }
  483|       |
  484|  21.7k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|  21.7k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 2, False: 21.7k]
  ------------------
  486|      2|            ctx.error = error_code::syntax_error;
  487|      2|            return true;
  488|      2|         }
  489|  21.7k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 2, False: 21.7k]
  ------------------
  490|      2|            ctx.error = error_code::syntax_error;
  491|      2|            return true;
  492|      2|         }
  493|       |
  494|  21.7k|         skip_inline_ws(it, end);
  495|       |
  496|  21.7k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 5, False: 21.7k]
  ------------------
  497|      5|            if constexpr (!AllowEmptyInput) {
  498|      5|               ctx.error = error_code::unexpected_end;
  499|      5|            }
  500|      5|            return true;
  501|      5|         }
  502|       |
  503|  21.7k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 5.40k, False: 16.3k]
  ------------------
  504|  5.40k|            return true;
  505|  5.40k|         }
  506|       |
  507|  16.3k|         return false;
  508|  21.7k|      }
_ZZN3glz4fromILj450EbE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRbTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_ENKUlNS8_8yaml_tagEE_clESI_:
 2120|  21.7k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_bool(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEEXtlNS0_20node_property_policyELb1EEERbNS0_12yaml_contextEPKcS7_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|  21.7k|      {
  418|  21.7k|         state.has_anchor = false;
  419|  21.7k|         state.anchor_name.clear();
  420|  21.7k|         state.anchor_start = nullptr;
  421|  21.7k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|  21.7k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|  21.7k|            else {
  430|  21.7k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 5.37k, False: 16.3k]
  ------------------
  431|  21.7k|            }
  432|  21.7k|         }
  433|       |
  434|  21.7k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 16.3k, False: 5.37k]
  |  Branch (434:27): [True: 3.98k, False: 12.3k]
  ------------------
  435|  3.98k|            ++it;
  436|  3.98k|            auto name = parse_anchor_name(it, end);
  437|  3.98k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 6, False: 3.97k]
  ------------------
  438|      6|               ctx.error = error_code::syntax_error;
  439|      6|               return true;
  440|      6|            }
  441|  3.97k|            skip_inline_ws(it, end);
  442|  3.97k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 22, False: 3.95k]
  ------------------
  443|     22|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     22|                  ctx.error = error_code::unexpected_end;
  445|     22|               }
  446|     22|               return true;
  447|     22|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  3.95k|            state.has_anchor = true;
  455|  3.95k|            state.anchor_name = std::string(name);
  456|  3.95k|            state.anchor_start = &*it;
  457|  3.95k|         }
  458|       |
  459|  21.6k|         return false;
  460|  21.7k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERbNS0_12yaml_contextEPKcS6_EEbOT0_RT1_RT2_T3_:
  309|  21.7k|      {
  310|  21.7k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 21.7k]
  |  Branch (310:27): [True: 16.3k, False: 5.37k]
  ------------------
  311|       |
  312|  5.37k|         ++it; // skip '*'
  313|  5.37k|         auto name = parse_anchor_name(it, end);
  314|  5.37k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 10, False: 5.36k]
  ------------------
  315|     10|            ctx.error = error_code::syntax_error;
  316|     10|            return true;
  317|     10|         }
  318|       |
  319|  5.36k|         auto anchor_it = ctx.anchors.find(name);
  320|  5.36k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 36, False: 5.33k]
  ------------------
  321|     36|            ctx.error = error_code::syntax_error; // undefined alias
  322|     36|            return true;
  323|     36|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  5.33k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  5.33k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 399, False: 4.93k]
  ------------------
  331|    399|            return true;
  332|    399|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  4.93k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 5, False: 4.92k]
  ------------------
  338|      5|            ctx.error = error_code::syntax_error; // cyclic alias
  339|      5|            return true;
  340|      5|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  4.92k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  4.92k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 1, False: 4.92k]
  ------------------
  348|      1|            return true;
  349|       |
  350|  4.92k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 0, False: 4.92k]
  ------------------
  351|      0|            ctx.error = error_code::exceeded_max_expansion;
  352|      0|            ctx.custom_error_message = "alias expansion";
  353|      0|            return true;
  354|      0|         }
  355|       |
  356|  4.92k|         auto replay_it = span.begin;
  357|  4.92k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  4.92k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  4.92k|         ctx.indent_stack.clear();
  362|  4.92k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 671, False: 4.25k]
  ------------------
  363|    671|            ctx.push_indent(span.base_indent - 1);
  364|    671|         }
  365|       |
  366|  4.92k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  4.92k|         using V = std::remove_cvref_t<T>;
  369|  4.92k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  4.92k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  4.92k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  4.92k|         return true;
  376|  4.92k|      }
_ZN3glz4fromILj450EDnE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRDnTkNS_10is_contextERNS_4yaml12yaml_contextES5_EEvOT1_OT2_OT0_T3_:
 2500|  10.0k|      {
 2501|  10.0k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2501:14): [True: 0, False: 10.0k]
  ------------------
 2502|      0|            return;
 2503|       |
 2504|  10.0k|         yaml::skip_inline_ws(it, end);
 2505|       |
 2506|  10.0k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2506:14): [True: 13, False: 10.0k]
  ------------------
 2507|     13|            ctx.error = error_code::unexpected_end;
 2508|     13|            return;
 2509|     13|         }
 2510|       |
 2511|       |         // Check for null values: null, Null, NULL, ~
 2512|  10.0k|         if (*it == '~') {
  ------------------
  |  Branch (2512:14): [True: 1.50k, False: 8.50k]
  ------------------
 2513|  1.50k|            ++it;
 2514|  1.50k|            return;
 2515|  1.50k|         }
 2516|       |
 2517|       |         // Parse as plain scalar and check if it's a null keyword
 2518|  8.50k|         auto start = it;
 2519|  41.6k|         while (it != end && !yaml::plain_scalar_end_or_control_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (2519:17): [True: 41.2k, False: 393]
  |  Branch (2519:30): [True: 33.1k, False: 8.11k]
  ------------------
 2520|  33.1k|            ++it;
 2521|  33.1k|         }
 2522|       |
 2523|  8.50k|         std::string_view str{start, static_cast<size_t>(it - start)};
 2524|  8.50k|         if (!yaml::is_yaml_null(str)) {
  ------------------
  |  Branch (2524:14): [True: 27, False: 8.48k]
  ------------------
 2525|     27|            ctx.error = error_code::syntax_error;
 2526|     27|         }
 2527|  8.50k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_21is_yaml_variant_arrayEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERSH_TkNS_10is_contextERNS_4yaml12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|  72.2k|      {
 5356|  72.2k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|  72.2k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|  72.2k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|  72.2k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|  72.2k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 72.2k, False: 0]
  ------------------
 5366|  72.2k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|  72.2k|      }
_ZN3glz4fromILj450ENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS1_9allocatorIS6_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRS9_TkNS_10is_contextERNS_4yaml12yaml_contextESE_EEvOT1_OT2_OT0_T3_:
 4207|  78.1k|      {
 4208|  78.1k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4208:14): [True: 0, False: 78.1k]
  ------------------
 4209|      0|            return;
 4210|       |
 4211|       |         // Peek ahead to check for tag (don't consume indentation for block sequences)
 4212|  78.1k|         auto peek = it;
 4213|  78.1k|         yaml::node_preamble_state preamble{};
 4214|  78.1k|         if (yaml::parse_node_preamble<Opts>(value, ctx, peek, end, preamble,
  ------------------
  |  Branch (4214:14): [True: 6.68k, False: 71.4k]
  ------------------
 4215|  78.1k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_seq(tag); })) {
 4216|  6.68k|            it = peek;
 4217|  6.68k|            return;
 4218|  6.68k|         }
 4219|       |
 4220|       |         // A level of nesting, taken past the preamble as for sets above.
 4221|  71.4k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 4222|  71.4k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (4222:14): [True: 2, False: 71.4k]
  ------------------
 4223|      2|            return;
 4224|       |
 4225|  71.4k|         if (*peek == '[') {
  ------------------
  |  Branch (4225:14): [True: 27.2k, False: 44.2k]
  ------------------
 4226|       |            // Flow sequence - consume whitespace and parse
 4227|  27.2k|            it = peek;
 4228|  27.2k|            yaml::parse_flow_sequence<Opts>(value, ctx, it, end);
 4229|  27.2k|         }
 4230|  44.2k|         else if (*peek == '-') {
  ------------------
  |  Branch (4230:19): [True: 44.1k, False: 75]
  ------------------
 4231|       |            // Block sequence - don't consume leading whitespace, let parse_block_sequence handle it
 4232|       |            // But if there was a tag, we need to advance past it
 4233|  44.1k|            if (preamble.tag != yaml::yaml_tag::none || preamble.node_props.has_anchor) {
  ------------------
  |  Branch (4233:17): [True: 263, False: 43.8k]
  |  Branch (4233:57): [True: 1.81k, False: 42.0k]
  ------------------
 4234|  2.08k|               it = peek;
 4235|  2.08k|            }
 4236|  44.1k|            int32_t seq_indent = ctx.current_indent();
 4237|  44.1k|            if (*it == '-' && ctx.current_indent() >= 0) {
  ------------------
  |  Branch (4237:17): [True: 43.9k, False: 213]
  |  Branch (4237:31): [True: 31.3k, False: 12.5k]
  ------------------
 4238|  31.3k|               seq_indent = ctx.allow_indentless_sequence ? (ctx.current_indent() > 0 ? (ctx.current_indent() - 1) : 0)
  ------------------
  |  Branch (4238:29): [True: 14.8k, False: 16.5k]
  |  Branch (4238:62): [True: 8.81k, False: 5.99k]
  ------------------
 4239|  31.3k|                                                          : (ctx.current_indent() + 1);
 4240|  31.3k|            }
 4241|  44.1k|            yaml::parse_block_sequence<Opts>(value, ctx, it, end, seq_indent);
 4242|  44.1k|         }
 4243|     75|         else {
 4244|     75|            ctx.error = error_code::syntax_error;
 4245|     75|         }
 4246|       |
 4247|  71.4k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 4248|  71.4k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEEXtlNS0_20node_property_policyELb1EEELb0ERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS4_9allocatorIS9_EEEENS0_12yaml_contextEPKcSG_ZNS_4fromILj450ESC_E2opITnDaXtlS2_Lj450ELb0ELb0ELb1ELb1EEERSG_SD_TkNS_10is_contextERSE_SG_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSP_RSS_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|  78.1k|      {
  475|  78.1k|         skip_inline_ws(it, end);
  476|       |
  477|  78.1k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 12, False: 78.1k]
  ------------------
  478|     12|            if constexpr (!AllowEmptyInput) {
  479|     12|               ctx.error = error_code::unexpected_end;
  480|     12|            }
  481|     12|            return true;
  482|     12|         }
  483|       |
  484|  78.1k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|  78.1k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 3, False: 78.1k]
  ------------------
  486|      3|            ctx.error = error_code::syntax_error;
  487|      3|            return true;
  488|      3|         }
  489|  78.1k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 2, False: 78.1k]
  ------------------
  490|      2|            ctx.error = error_code::syntax_error;
  491|      2|            return true;
  492|      2|         }
  493|       |
  494|  78.1k|         skip_inline_ws(it, end);
  495|       |
  496|  78.1k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 4, False: 78.1k]
  ------------------
  497|      4|            if constexpr (!AllowEmptyInput) {
  498|      4|               ctx.error = error_code::unexpected_end;
  499|      4|            }
  500|      4|            return true;
  501|      4|         }
  502|       |
  503|  78.1k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 6.66k, False: 71.4k]
  ------------------
  504|  6.66k|            return true;
  505|  6.66k|         }
  506|       |
  507|  71.4k|         return false;
  508|  78.1k|      }
_ZZN3glz4fromILj450ENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS1_9allocatorIS6_EEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRS9_TkNS_10is_contextERNS_4yaml12yaml_contextESE_EEvOT1_OT2_OT0_T3_ENKUlNSH_8yaml_tagEE_clESR_:
 4215|  78.1k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_seq(tag); })) {
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEEXtlNS0_20node_property_policyELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS4_9allocatorIS9_EEEENS0_12yaml_contextEPKcSG_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|  78.1k|      {
  418|  78.1k|         state.has_anchor = false;
  419|  78.1k|         state.anchor_name.clear();
  420|  78.1k|         state.anchor_start = nullptr;
  421|  78.1k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|  78.1k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|  78.1k|            else {
  430|  78.1k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 6.63k, False: 71.5k]
  ------------------
  431|  78.1k|            }
  432|  78.1k|         }
  433|       |
  434|  78.1k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 71.5k, False: 6.63k]
  |  Branch (434:27): [True: 2.16k, False: 69.3k]
  ------------------
  435|  2.16k|            ++it;
  436|  2.16k|            auto name = parse_anchor_name(it, end);
  437|  2.16k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 8, False: 2.15k]
  ------------------
  438|      8|               ctx.error = error_code::syntax_error;
  439|      8|               return true;
  440|      8|            }
  441|  2.15k|            skip_inline_ws(it, end);
  442|  2.15k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 29, False: 2.12k]
  ------------------
  443|     29|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     29|                  ctx.error = error_code::unexpected_end;
  445|     29|               }
  446|     29|               return true;
  447|     29|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  2.12k|            state.has_anchor = true;
  455|  2.12k|            state.anchor_name = std::string(name);
  456|  2.12k|            state.anchor_start = &*it;
  457|  2.12k|         }
  458|       |
  459|  78.1k|         return false;
  460|  78.1k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEbOT0_RT1_RT2_T3_:
  309|  78.1k|      {
  310|  78.1k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 78.1k]
  |  Branch (310:27): [True: 71.5k, False: 6.63k]
  ------------------
  311|       |
  312|  6.63k|         ++it; // skip '*'
  313|  6.63k|         auto name = parse_anchor_name(it, end);
  314|  6.63k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 9, False: 6.62k]
  ------------------
  315|      9|            ctx.error = error_code::syntax_error;
  316|      9|            return true;
  317|      9|         }
  318|       |
  319|  6.62k|         auto anchor_it = ctx.anchors.find(name);
  320|  6.62k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 23, False: 6.59k]
  ------------------
  321|     23|            ctx.error = error_code::syntax_error; // undefined alias
  322|     23|            return true;
  323|     23|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  6.59k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  6.59k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 672, False: 5.92k]
  ------------------
  331|    672|            return true;
  332|    672|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  5.92k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 39, False: 5.88k]
  ------------------
  338|     39|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     39|            return true;
  340|     39|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  5.88k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  5.88k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 2, False: 5.88k]
  ------------------
  348|      2|            return true;
  349|       |
  350|  5.88k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 0, False: 5.88k]
  ------------------
  351|      0|            ctx.error = error_code::exceeded_max_expansion;
  352|      0|            ctx.custom_error_message = "alias expansion";
  353|      0|            return true;
  354|      0|         }
  355|       |
  356|  5.88k|         auto replay_it = span.begin;
  357|  5.88k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  5.88k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  5.88k|         ctx.indent_stack.clear();
  362|  5.88k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 4.57k, False: 1.31k]
  ------------------
  363|  4.57k|            ctx.push_indent(span.base_indent - 1);
  364|  4.57k|         }
  365|       |
  366|  5.88k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  5.88k|         using V = std::remove_cvref_t<T>;
  369|  5.88k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  5.88k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  5.88k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  5.88k|         return true;
  376|  5.88k|      }
_ZN3glz4yaml19parse_flow_sequenceITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_:
 2698|  27.2k|      {
 2699|  27.2k|         using V = std::remove_cvref_t<T>;
 2700|  27.2k|         using value_type = typename V::value_type;
 2701|       |
 2702|  27.2k|         struct sequence_container_adapter
 2703|  27.2k|         {
 2704|  27.2k|            size_t index = 0;
 2705|       |
 2706|  27.2k|            inline bool fixed_capacity_reached(const V& container) const noexcept
 2707|  27.2k|            {
 2708|  27.2k|               if constexpr (!resizable<V>) {
 2709|  27.2k|                  return index >= container.size();
 2710|  27.2k|               }
 2711|  27.2k|               else {
 2712|  27.2k|                  (void)container;
 2713|  27.2k|                  return false;
 2714|  27.2k|               }
 2715|  27.2k|            }
 2716|       |
 2717|  27.2k|            inline void commit_fixed_slot() noexcept { ++index; }
 2718|       |
 2719|  27.2k|            inline void append(V& container, value_type&& element) noexcept
 2720|  27.2k|            {
 2721|  27.2k|               if constexpr (emplace_backable<V>) {
 2722|  27.2k|                  container.emplace_back(std::move(element));
 2723|  27.2k|               }
 2724|  27.2k|               else if constexpr (emplaceable<V>) {
 2725|  27.2k|                  container.emplace(std::move(element));
 2726|  27.2k|               }
 2727|  27.2k|            }
 2728|  27.2k|         };
 2729|       |
 2730|  27.2k|         if (it == end || *it != '[') [[unlikely]] {
  ------------------
  |  Branch (2730:14): [True: 0, False: 27.2k]
  |  Branch (2730:27): [True: 0, False: 27.2k]
  ------------------
 2731|      0|            ctx.error = error_code::syntax_error;
 2732|      0|            return;
 2733|      0|         }
 2734|       |
 2735|       |         // Overwrite (do not append to) any pre-existing contents. Must happen
 2736|       |         // before the empty-array early return below so that `[]` also clears.
 2737|  27.2k|         clear_sequence_before_read<Opts>(value);
 2738|       |
 2739|  27.2k|         ++it; // Skip '['
 2740|       |         // Skip whitespace and newlines after opening bracket (YAML allows multi-line flow sequences)
 2741|  27.2k|         skip_flow_ws_and_newlines(ctx, it, end);
 2742|  27.2k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2742:14): [True: 14, False: 27.2k]
  ------------------
 2743|     14|            return;
 2744|       |
 2745|       |         // Handle empty array
 2746|  27.2k|         if (it != end && *it == ']') {
  ------------------
  |  Branch (2746:14): [True: 26.5k, False: 739]
  |  Branch (2746:27): [True: 3.03k, False: 23.4k]
  ------------------
 2747|  3.03k|            ++it;
 2748|  3.03k|            validate_flow_node_adjacent_tail(ctx, it, end);
 2749|  3.03k|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2749:17): [True: 15, False: 3.02k]
  ------------------
 2750|     15|               return;
 2751|  3.02k|            if constexpr (!yaml::check_flow_context(Opts)) {
 2752|  3.02k|               if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (2752:20): [True: 461, False: 2.56k]
  ------------------
 2753|    461|                  validate_root_flow_tail_after_close(ctx, it, end);
 2754|    461|               }
 2755|  3.02k|            }
 2756|  3.02k|            return;
 2757|  3.03k|         }
 2758|       |
 2759|  24.2k|         bool just_saw_comma = false;
 2760|  24.2k|         sequence_container_adapter adapter{};
 2761|       |
 2762|  24.2k|         if constexpr (emplace_backable<V> || emplaceable<V>) {
 2763|       |            // Dynamic containers append items (vector-like and set-like)
 2764|   451k|            while (it != end) {
  ------------------
  |  Branch (2764:20): [True: 450k, False: 1.23k]
  ------------------
 2765|   450k|               skip_flow_ws_and_newlines(ctx, it, end);
 2766|   450k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2766:20): [True: 0, False: 450k]
  ------------------
 2767|      0|                  return;
 2768|       |
 2769|   450k|               if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2769:20): [True: 0, False: 450k]
  ------------------
 2770|      0|                  ctx.error = error_code::unexpected_end;
 2771|      0|                  return;
 2772|      0|               }
 2773|       |
 2774|   450k|               if (*it == ']') {
  ------------------
  |  Branch (2774:20): [True: 3.26k, False: 447k]
  ------------------
 2775|  3.26k|                  if (just_saw_comma) {
  ------------------
  |  Branch (2775:23): [True: 3.26k, False: 0]
  ------------------
 2776|  3.26k|                     ++it;
 2777|  3.26k|                     validate_flow_node_adjacent_tail(ctx, it, end);
 2778|  3.26k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2778:26): [True: 2, False: 3.26k]
  ------------------
 2779|      2|                        return;
 2780|  3.26k|                     if constexpr (!yaml::check_flow_context(Opts)) {
 2781|  3.26k|                        if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (2781:29): [True: 571, False: 2.69k]
  ------------------
 2782|    571|                           validate_root_flow_tail_after_close(ctx, it, end);
 2783|    571|                        }
 2784|  3.26k|                     }
 2785|  3.26k|                     return;
 2786|  3.26k|                  }
 2787|      0|                  ctx.error = error_code::syntax_error;
 2788|      0|                  return;
 2789|  3.26k|               }
 2790|       |
 2791|   447k|               if (*it == ',' || *it == '#') {
  ------------------
  |  Branch (2791:20): [True: 94, False: 447k]
  |  Branch (2791:34): [True: 39, False: 447k]
  ------------------
 2792|    133|                  ctx.error = error_code::syntax_error;
 2793|    133|                  return;
 2794|    133|               }
 2795|   447k|               just_saw_comma = false;
 2796|       |
 2797|   447k|               value_type element{};
 2798|   447k|               from<YAML, value_type>::template op<flow_context_on<Opts>()>(element, ctx, it, end);
 2799|       |
 2800|   447k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2800:20): [True: 11.7k, False: 435k]
  ------------------
 2801|  11.7k|                  return;
 2802|       |
 2803|   435k|               bool saw_line_break_before_separator = false;
 2804|   435k|               skip_flow_ws_and_newlines(ctx, it, end, &saw_line_break_before_separator);
 2805|   435k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2805:20): [True: 8, False: 435k]
  ------------------
 2806|      8|                  return;
 2807|       |
 2808|   435k|               if (it != end && *it == ':') {
  ------------------
  |  Branch (2808:20): [True: 432k, False: 2.71k]
  |  Branch (2808:33): [True: 7.74k, False: 425k]
  ------------------
 2809|       |                  // In flow sequences, implicit key-value pairs must be on a single line.
 2810|  7.74k|                  if (saw_line_break_before_separator) {
  ------------------
  |  Branch (2810:23): [True: 44, False: 7.69k]
  ------------------
 2811|     44|                     ctx.error = error_code::syntax_error;
 2812|     44|                     return;
 2813|     44|                  }
 2814|  7.69k|                  if constexpr (std::same_as<std::remove_cvref_t<value_type>, glz::generic>) {
 2815|  7.69k|                     glz::generic key_node = std::move(element);
 2816|  7.69k|                     ++it;
 2817|  7.69k|                     skip_inline_ws(it, end);
 2818|       |
 2819|  7.69k|                     glz::generic mapped{};
 2820|  7.69k|                     from<YAML, glz::generic>::template op<flow_context_on<Opts>()>(mapped, ctx, it, end);
 2821|  7.69k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2821:26): [True: 306, False: 7.39k]
  ------------------
 2822|    306|                        return;
 2823|       |
 2824|  7.39k|                     std::string key;
 2825|  7.39k|                     if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (2825:26): [True: 2, False: 7.38k]
  ------------------
 2826|      2|                        return;
 2827|       |
 2828|  7.38k|                     glz::generic pair{};
 2829|  7.38k|                     pair[key] = std::move(mapped);
 2830|  7.38k|                     element = std::move(pair);
 2831|       |
 2832|  7.38k|                     skip_flow_ws_and_newlines(ctx, it, end);
 2833|  7.38k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2833:26): [True: 0, False: 7.38k]
  ------------------
 2834|      0|                        return;
 2835|       |                  }
 2836|       |                  else {
 2837|       |                     ctx.error = error_code::syntax_error;
 2838|       |                     return;
 2839|       |                  }
 2840|  7.69k|               }
 2841|       |
 2842|   435k|               adapter.append(value, std::move(element));
 2843|       |
 2844|   435k|               if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2844:20): [True: 2.83k, False: 432k]
  ------------------
 2845|  2.83k|                  ctx.error = error_code::unexpected_end;
 2846|  2.83k|                  return;
 2847|  2.83k|               }
 2848|       |
 2849|   432k|               if (*it == ']') {
  ------------------
  |  Branch (2849:20): [True: 3.54k, False: 429k]
  ------------------
 2850|  3.54k|                  ++it;
 2851|  3.54k|                  validate_flow_node_adjacent_tail(ctx, it, end);
 2852|  3.54k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2852:23): [True: 22, False: 3.51k]
  ------------------
 2853|     22|                     return;
 2854|  3.51k|                  if constexpr (!yaml::check_flow_context(Opts)) {
 2855|  3.51k|                     if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (2855:26): [True: 452, False: 3.06k]
  ------------------
 2856|    452|                        validate_root_flow_tail_after_close(ctx, it, end);
 2857|    452|                     }
 2858|  3.51k|                  }
 2859|  3.51k|                  return;
 2860|  3.54k|               }
 2861|   429k|               else if (*it == ',') {
  ------------------
  |  Branch (2861:25): [True: 427k, False: 1.42k]
  ------------------
 2862|   427k|                  ++it;
 2863|   427k|                  just_saw_comma = true;
 2864|   427k|                  skip_flow_ws_and_newlines(ctx, it, end);
 2865|   427k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2865:23): [True: 3, False: 427k]
  ------------------
 2866|      3|                     return;
 2867|   427k|               }
 2868|  1.42k|               else {
 2869|  1.42k|                  ctx.error = error_code::syntax_error;
 2870|  1.42k|                  return;
 2871|  1.42k|               }
 2872|   432k|            }
 2873|       |         }
 2874|       |         else if constexpr (!resizable<V>) {
 2875|       |            // Fixed-size containers (std::array)
 2876|       |            while (it != end) {
 2877|       |               skip_flow_ws_and_newlines(ctx, it, end);
 2878|       |               if (bool(ctx.error)) [[unlikely]]
 2879|       |                  return;
 2880|       |
 2881|       |               if (it == end) [[unlikely]] {
 2882|       |                  ctx.error = error_code::unexpected_end;
 2883|       |                  return;
 2884|       |               }
 2885|       |
 2886|       |               if (*it == ']') {
 2887|       |                  if (just_saw_comma) {
 2888|       |                     ++it;
 2889|       |                     validate_flow_node_adjacent_tail(ctx, it, end);
 2890|       |                     if (bool(ctx.error)) [[unlikely]]
 2891|       |                        return;
 2892|       |                     if constexpr (!yaml::check_flow_context(Opts)) {
 2893|       |                        if (ctx.current_indent() < 0) {
 2894|       |                           validate_root_flow_tail_after_close(ctx, it, end);
 2895|       |                        }
 2896|       |                     }
 2897|       |                     return;
 2898|       |                  }
 2899|       |                  ctx.error = error_code::syntax_error;
 2900|       |                  return;
 2901|       |               }
 2902|       |
 2903|       |               if (*it == ',' || *it == '#') {
 2904|       |                  ctx.error = error_code::syntax_error;
 2905|       |                  return;
 2906|       |               }
 2907|       |               just_saw_comma = false;
 2908|       |
 2909|       |               // An item beyond the last slot is an error, as in JSON.
 2910|       |               if (adapter.fixed_capacity_reached(value)) [[unlikely]] {
 2911|       |                  ctx.error = error_code::exceeded_static_array_size;
 2912|       |                  return;
 2913|       |               }
 2914|       |
 2915|       |               from<YAML, value_type>::template op<flow_context_on<Opts>()>(value[adapter.index], ctx, it, end);
 2916|       |
 2917|       |               if (bool(ctx.error)) [[unlikely]]
 2918|       |                  return;
 2919|       |
 2920|       |               adapter.commit_fixed_slot();
 2921|       |               skip_flow_ws_and_newlines(ctx, it, end);
 2922|       |               if (bool(ctx.error)) [[unlikely]]
 2923|       |                  return;
 2924|       |
 2925|       |               if (it == end) [[unlikely]] {
 2926|       |                  ctx.error = error_code::unexpected_end;
 2927|       |                  return;
 2928|       |               }
 2929|       |
 2930|       |               if (*it == ']') {
 2931|       |                  ++it;
 2932|       |                  validate_flow_node_adjacent_tail(ctx, it, end);
 2933|       |                  if (bool(ctx.error)) [[unlikely]]
 2934|       |                     return;
 2935|       |                  if constexpr (!yaml::check_flow_context(Opts)) {
 2936|       |                     if (ctx.current_indent() < 0) {
 2937|       |                        validate_root_flow_tail_after_close(ctx, it, end);
 2938|       |                     }
 2939|       |                  }
 2940|       |                  return;
 2941|       |               }
 2942|       |               else if (*it == ',') {
 2943|       |                  ++it;
 2944|       |                  just_saw_comma = true;
 2945|       |                  skip_flow_ws_and_newlines(ctx, it, end);
 2946|       |                  if (bool(ctx.error)) [[unlikely]]
 2947|       |                     return;
 2948|       |               }
 2949|       |               else {
 2950|       |                  ctx.error = error_code::syntax_error;
 2951|       |                  return;
 2952|       |               }
 2953|       |            }
 2954|       |         }
 2955|       |         else {
 2956|       |            ctx.error = error_code::syntax_error;
 2957|       |            return;
 2958|       |         }
 2959|  24.2k|      }
_ZN3glz4yaml26clear_sequence_before_readITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEEEEvRT0_:
 2682|  71.4k|      {
 2683|  71.4k|         if constexpr (emplace_backable<V> && requires { value.clear(); }) {
 2684|       |            // vector-like: honor the append_arrays option, matching json/read.hpp
 2685|  71.4k|            if constexpr (!check_append_arrays(Opts)) {
 2686|  71.4k|               value.clear();
 2687|  71.4k|            }
 2688|       |         }
 2689|       |         else if constexpr (emplaceable<V> && requires { value.clear(); }) {
 2690|       |            // set-like: json/read.hpp clears unconditionally; append_arrays does not apply
 2691|       |            value.clear();
 2692|       |         }
 2693|  71.4k|      }
_ZZN3glz4yaml19parse_flow_sequenceITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_EN26sequence_container_adapter6appendESC_OS8_:
 2720|   435k|            {
 2721|   435k|               if constexpr (emplace_backable<V>) {
 2722|   435k|                  container.emplace_back(std::move(element));
 2723|       |               }
 2724|       |               else if constexpr (emplaceable<V>) {
 2725|       |                  container.emplace(std::move(element));
 2726|       |               }
 2727|   435k|            }
_ZN3glz4yaml20parse_block_sequenceITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_i:
 3186|  44.1k|      {
 3187|  44.1k|         using V = std::remove_cvref_t<T>;
 3188|  44.1k|         using value_type = typename V::value_type;
 3189|       |
 3190|  44.1k|         struct sequence_container_adapter
 3191|  44.1k|         {
 3192|  44.1k|            size_t index = 0;
 3193|       |
 3194|  44.1k|            inline bool fixed_capacity_reached(const V& container) const noexcept
 3195|  44.1k|            {
 3196|  44.1k|               if constexpr (!resizable<V>) {
 3197|  44.1k|                  return index >= container.size();
 3198|  44.1k|               }
 3199|  44.1k|               else {
 3200|  44.1k|                  (void)container;
 3201|  44.1k|                  return false;
 3202|  44.1k|               }
 3203|  44.1k|            }
 3204|       |
 3205|  44.1k|            inline void commit_fixed_slot() noexcept { ++index; }
 3206|       |
 3207|  44.1k|            inline void append(V& container, value_type&& element) noexcept
 3208|  44.1k|            {
 3209|  44.1k|               if constexpr (emplace_backable<V>) {
 3210|  44.1k|                  container.emplace_back(std::move(element));
 3211|  44.1k|               }
 3212|  44.1k|               else if constexpr (emplaceable<V>) {
 3213|  44.1k|                  container.emplace(std::move(element));
 3214|  44.1k|               }
 3215|  44.1k|            }
 3216|  44.1k|         };
 3217|       |
 3218|       |         // Overwrite (do not append to) any pre-existing contents. A block
 3219|       |         // sequence is only entered once a '-' item is confirmed, so clearing
 3220|       |         // up front correctly (re)assigns the container to the parsed sequence.
 3221|  44.1k|         clear_sequence_before_read<Opts>(value);
 3222|       |
 3223|  44.1k|         sequence_container_adapter adapter{};
 3224|       |
 3225|       |         // Track if this is the first item (for handling whitespace-consumed case)
 3226|  44.1k|         bool first_item = true;
 3227|  44.1k|         bool has_pending_item_anchor = false;
 3228|  44.1k|         std::string pending_item_anchor_name{};
 3229|  44.1k|         int32_t pending_item_anchor_indent = sequence_indent;
 3230|       |
 3231|   145k|         while (it != end) {
  ------------------
  |  Branch (3231:17): [True: 127k, False: 18.0k]
  ------------------
 3232|       |            // Skip blank lines and comments, track indent
 3233|   127k|            int32_t line_indent = 0;
 3234|   127k|            int32_t dash_col = -1; // actual column of the '-' on the line
 3235|   127k|            auto line_start = it;
 3236|       |
 3237|   217k|            while (it != end) {
  ------------------
  |  Branch (3237:20): [True: 208k, False: 8.76k]
  ------------------
 3238|   208k|               if (*it == '#') {
  ------------------
  |  Branch (3238:20): [True: 10.2k, False: 198k]
  ------------------
 3239|  10.2k|                  skip_comment(it, end);
 3240|  10.2k|                  skip_newline(it, end);
 3241|  10.2k|                  line_start = it;
 3242|  10.2k|                  line_indent = 0;
 3243|  10.2k|               }
 3244|   198k|               else if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3244:25): [True: 26.2k, False: 171k]
  |  Branch (3244:40): [True: 41.0k, False: 130k]
  ------------------
 3245|  67.3k|                  skip_newline(it, end);
 3246|  67.3k|                  line_start = it;
 3247|  67.3k|                  line_indent = 0;
 3248|  67.3k|               }
 3249|   130k|               else if (*it == ' ') {
  ------------------
  |  Branch (3249:25): [True: 14.0k, False: 116k]
  ------------------
 3250|  14.0k|                  line_start = it;
 3251|  14.0k|                  line_indent = 0;
 3252|   657k|                  while (it != end && *it == ' ') {
  ------------------
  |  Branch (3252:26): [True: 656k, False: 428]
  |  Branch (3252:39): [True: 643k, False: 13.6k]
  ------------------
 3253|   643k|                     ++line_indent;
 3254|   643k|                     ++it;
 3255|   643k|                  }
 3256|       |
 3257|  14.0k|                  bool saw_tab = false;
 3258|  16.6k|                  while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3258:26): [True: 15.9k, False: 687]
  |  Branch (3258:40): [True: 1.03k, False: 14.9k]
  |  Branch (3258:54): [True: 1.52k, False: 13.3k]
  ------------------
 3259|  2.56k|                     saw_tab = saw_tab || (*it == '\t');
  ------------------
  |  Branch (3259:32): [True: 1.89k, False: 670]
  |  Branch (3259:43): [True: 670, False: 0]
  ------------------
 3260|  2.56k|                     ++it;
 3261|  2.56k|                  }
 3262|       |
 3263|  14.0k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3263:23): [True: 687, False: 13.3k]
  |  Branch (3263:36): [True: 903, False: 12.4k]
  |  Branch (3263:51): [True: 6.58k, False: 5.88k]
  |  Branch (3263:66): [True: 1.76k, False: 4.12k]
  ------------------
 3264|       |                     // Blank or comment line - continue to next line
 3265|  9.93k|                     if (it != end && *it == '#') {
  ------------------
  |  Branch (3265:26): [True: 9.25k, False: 687]
  |  Branch (3265:39): [True: 1.76k, False: 7.49k]
  ------------------
 3266|  1.76k|                        skip_comment(it, end);
 3267|  1.76k|                     }
 3268|  9.93k|                     line_indent = 0;
 3269|  9.93k|                     continue;
 3270|  9.93k|                  }
 3271|       |
 3272|  4.12k|                  if (saw_tab) {
  ------------------
  |  Branch (3272:23): [True: 10, False: 4.11k]
  ------------------
 3273|     10|                     ctx.error = error_code::syntax_error;
 3274|     10|                     return;
 3275|     10|                  }
 3276|  4.11k|                  break; // Found content
 3277|  4.12k|               }
 3278|   116k|               else if (*it == '\t') {
  ------------------
  |  Branch (3278:25): [True: 1.94k, False: 114k]
  ------------------
 3279|  1.94k|                  line_start = it;
 3280|  5.53k|                  while (it != end && (*it == ' ' || *it == '\t')) ++it;
  ------------------
  |  Branch (3280:26): [True: 5.38k, False: 149]
  |  Branch (3280:40): [True: 294, False: 5.08k]
  |  Branch (3280:54): [True: 3.29k, False: 1.79k]
  ------------------
 3281|  1.94k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3281:23): [True: 149, False: 1.79k]
  |  Branch (3281:36): [True: 296, False: 1.49k]
  |  Branch (3281:51): [True: 705, False: 790]
  |  Branch (3281:66): [True: 780, False: 10]
  ------------------
 3282|  1.93k|                     if (it != end && *it == '#') {
  ------------------
  |  Branch (3282:26): [True: 1.78k, False: 149]
  |  Branch (3282:39): [True: 780, False: 1.00k]
  ------------------
 3283|    780|                        skip_comment(it, end);
 3284|    780|                     }
 3285|  1.93k|                     line_indent = 0;
 3286|  1.93k|                     continue;
 3287|  1.93k|                  }
 3288|     10|                  ctx.error = error_code::syntax_error;
 3289|     10|                  return;
 3290|  1.94k|               }
 3291|   114k|               else {
 3292|       |                  // At content (no leading space on this line)
 3293|       |                  // If first item and at '-', whitespace was consumed by caller;
 3294|       |                  // treat as having correct indentation
 3295|   114k|                  if (first_item && *it == '-') {
  ------------------
  |  Branch (3295:23): [True: 44.1k, False: 70.6k]
  |  Branch (3295:37): [True: 43.9k, False: 213]
  ------------------
 3296|  43.9k|                     line_indent = sequence_indent;
 3297|  43.9k|                     if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3298|  43.9k|                        if (ctx.stream_begin && it > ctx.stream_begin) {
  ------------------
  |  Branch (3298:29): [True: 43.9k, False: 0]
  |  Branch (3298:49): [True: 43.2k, False: 681]
  ------------------
 3299|  43.2k|                           auto probe = it;
 3300|  43.2k|                           int32_t leading_ws = 0;
 3301|  43.2k|                           bool saw_tab = false;
 3302|   996k|                           while (probe > ctx.stream_begin && (*(probe - 1) == ' ' || *(probe - 1) == '\t')) {
  ------------------
  |  Branch (3302:35): [True: 996k, False: 100]
  |  Branch (3302:64): [True: 950k, False: 45.5k]
  |  Branch (3302:87): [True: 2.46k, False: 43.1k]
  ------------------
 3303|   953k|                              --probe;
 3304|   953k|                              ++leading_ws;
 3305|   953k|                              saw_tab = saw_tab || (*probe == '\t');
  ------------------
  |  Branch (3305:41): [True: 411, False: 952k]
  |  Branch (3305:52): [True: 2.09k, False: 950k]
  ------------------
 3306|   953k|                           }
 3307|  43.2k|                           if (probe == ctx.stream_begin || *(probe - 1) == '\n' || *(probe - 1) == '\r') {
  ------------------
  |  Branch (3307:32): [True: 100, False: 43.1k]
  |  Branch (3307:61): [True: 8.77k, False: 34.3k]
  |  Branch (3307:85): [True: 10.3k, False: 24.0k]
  ------------------
 3308|  19.1k|                              if (saw_tab) {
  ------------------
  |  Branch (3308:35): [True: 22, False: 19.1k]
  ------------------
 3309|     22|                                 ctx.error = error_code::syntax_error;
 3310|     22|                                 return;
 3311|     22|                              }
 3312|  19.1k|                              line_indent = (std::max)(line_indent, leading_ws);
 3313|  19.1k|                           }
 3314|  43.2k|                        }
 3315|  43.9k|                     }
 3316|  43.9k|                  }
 3317|  43.8k|                  break;
 3318|   114k|               }
 3319|   208k|            }
 3320|       |
 3321|   127k|            if (it == end) break;
  ------------------
  |  Branch (3321:17): [True: 8.76k, False: 118k]
  ------------------
 3322|       |
 3323|       |            // Check for document end marker
 3324|   118k|            if (at_document_end(it, end)) break;
  ------------------
  |  Branch (3324:17): [True: 1.09k, False: 117k]
  ------------------
 3325|       |
 3326|       |            // Check for dedent
 3327|   117k|            if (line_indent < sequence_indent) {
  ------------------
  |  Branch (3327:17): [True: 3.86k, False: 113k]
  ------------------
 3328|  3.86k|               it = line_start;
 3329|  3.86k|               return;
 3330|  3.86k|            }
 3331|       |
 3332|   113k|            if (*it == '&') {
  ------------------
  |  Branch (3332:17): [True: 5.05k, False: 108k]
  ------------------
 3333|       |               // Standalone anchor lines before "- item" are only supported for
 3334|       |               // indentless mapping values. At top-level block sequences these are
 3335|       |               // malformed in yaml-test-suite cases.
 3336|  5.05k|               if (!ctx.allow_indentless_sequence) {
  ------------------
  |  Branch (3336:20): [True: 7, False: 5.05k]
  ------------------
 3337|      7|                  ctx.error = error_code::syntax_error;
 3338|      7|                  return;
 3339|      7|               }
 3340|       |
 3341|  5.05k|               ++it;
 3342|  5.05k|               auto pending_name = parse_anchor_name(it, end);
 3343|  5.05k|               if (pending_name.empty()) {
  ------------------
  |  Branch (3343:20): [True: 8, False: 5.04k]
  ------------------
 3344|      8|                  ctx.error = error_code::syntax_error;
 3345|      8|                  return;
 3346|      8|               }
 3347|  5.04k|               skip_inline_ws(it, end);
 3348|  5.04k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (3348:20): [True: 4.99k, False: 47]
  |  Branch (3348:33): [True: 484, False: 4.51k]
  ------------------
 3349|    484|                  skip_comment(it, end);
 3350|    484|               }
 3351|       |
 3352|  5.04k|               has_pending_item_anchor = true;
 3353|  5.04k|               pending_item_anchor_name = std::string(pending_name);
 3354|  5.04k|               pending_item_anchor_indent = line_indent;
 3355|       |
 3356|  5.04k|               if (it == end || (*it != '\n' && *it != '\r')) {
  ------------------
  |  Branch (3356:20): [True: 58, False: 4.98k]
  |  Branch (3356:34): [True: 3.01k, False: 1.97k]
  |  Branch (3356:49): [True: 25, False: 2.98k]
  ------------------
 3357|     83|                  ctx.error = error_code::syntax_error;
 3358|     83|                  return;
 3359|     83|               }
 3360|       |
 3361|  4.95k|               skip_newline(it, end);
 3362|  4.95k|               continue;
 3363|  5.04k|            }
 3364|       |
 3365|       |            // Expect dash for sequence item
 3366|   108k|            if (*it != '-') {
  ------------------
  |  Branch (3366:17): [True: 5.86k, False: 103k]
  ------------------
 3367|  5.86k|               it = line_start;
 3368|  5.86k|               return;
 3369|  5.86k|            }
 3370|       |
 3371|       |            // Compute the actual column of this sequence dash.
 3372|       |            // This is needed by plain-scalar multiline folding to distinguish
 3373|       |            // sibling "- item" entries from deeper "- " continuation content.
 3374|   103k|            dash_col = line_indent;
 3375|   103k|            if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3376|   103k|               if (ctx.stream_begin) {
  ------------------
  |  Branch (3376:20): [True: 103k, False: 22]
  ------------------
 3377|   103k|                  dash_col = ctx.line_prefix_before(&*it).column;
 3378|   103k|               }
 3379|   103k|            }
 3380|       |
 3381|   103k|            ++it; // Skip '-'
 3382|       |
 3383|       |            // Check for valid sequence item indicator (- followed by space or newline)
 3384|   103k|            if (it != end && !yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (3384:17): [True: 101k, False: 1.37k]
  |  Branch (3384:30): [True: 5.52k, False: 96.1k]
  ------------------
 3385|       |               // Not a sequence item (could be a number like -5)
 3386|  5.52k|               it = line_start;
 3387|  5.52k|               return;
 3388|  5.52k|            }
 3389|       |
 3390|  97.5k|            bool saw_tab_after_dash = false;
 3391|   248k|            while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3391:20): [True: 246k, False: 2.01k]
  |  Branch (3391:34): [True: 136k, False: 110k]
  |  Branch (3391:48): [True: 14.8k, False: 95.5k]
  ------------------
 3392|   150k|               saw_tab_after_dash = saw_tab_after_dash || (*it == '\t');
  ------------------
  |  Branch (3392:37): [True: 2.02k, False: 148k]
  |  Branch (3392:59): [True: 13.3k, False: 135k]
  ------------------
 3393|   150k|               ++it;
 3394|   150k|            }
 3395|       |            // A tab-separated nested "- " marker is not valid block indentation.
 3396|  97.5k|            if (saw_tab_after_dash && it != end && *it == '-') {
  ------------------
  |  Branch (3396:17): [True: 13.3k, False: 84.1k]
  |  Branch (3396:39): [True: 13.0k, False: 270]
  |  Branch (3396:52): [True: 411, False: 12.6k]
  ------------------
 3397|    411|               const auto after_dash = it + 1;
 3398|    411|               if (after_dash == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_dash)]) {
  ------------------
  |  Branch (3398:20): [True: 8, False: 403]
  |  Branch (3398:41): [True: 5, False: 398]
  ------------------
 3399|     13|                  ctx.error = error_code::syntax_error;
 3400|     13|                  return;
 3401|     13|               }
 3402|    411|            }
 3403|       |
 3404|       |            // Get reference to element to parse into
 3405|  97.4k|            auto parse_element = [&](auto& element) {
 3406|  97.4k|               const char* element_start = (it != end) ? &*it : nullptr;
 3407|       |
 3408|       |               // Check what follows
 3409|  97.4k|               if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 3410|       |                  // Content on same line as dash - set indent to one less than content column
 3411|       |                  // This allows nested block mappings to continue parsing keys at the content indent
 3412|       |                  // For "- key: val", if dash is at column 0, content is at column 2
 3413|       |                  // We set parent indent to 1 so keys at column 2 pass the "indent > parent" check
 3414|  97.4k|                  if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 3415|  97.4k|                     return;
 3416|  97.4k|                  const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3417|  97.4k|                  const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3418|  97.4k|                  ctx.sequence_item_value_context = true;
 3419|  97.4k|                  ctx.sequence_dash_indent = dash_col;
 3420|  97.4k|                  from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3421|  97.4k|                  ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3422|  97.4k|                  ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3423|  97.4k|                  ctx.pop_indent();
 3424|  97.4k|               }
 3425|  97.4k|               else {
 3426|       |                  // Value on next line - nested block
 3427|  97.4k|                  skip_ws_and_comment(it, end);
 3428|  97.4k|                  skip_newline(it, end);
 3429|       |
 3430|       |                  // Get indent of nested content
 3431|  97.4k|                  auto nested_start = it;
 3432|  97.4k|                  int32_t nested_indent = measure_indent(it, end, ctx);
 3433|  97.4k|                  if (bool(ctx.error)) [[unlikely]]
 3434|  97.4k|                     return;
 3435|  97.4k|                  it = nested_start;
 3436|       |
 3437|       |                  // Content is nested only if indented more than the current line.
 3438|       |                  // When line_indent is negative (root level), use 0 as the baseline.
 3439|       |                  // This prevents content at column 0 from being treated as nested.
 3440|  97.4k|                  const int32_t effective_line_indent = (line_indent < 0) ? 0 : line_indent;
 3441|  97.4k|                  if (nested_indent > effective_line_indent) {
 3442|       |                     // Save and set indent for nested parsing.
 3443|       |                     // A struct element reads the pushed indent as its own key column; every
 3444|       |                     // other element type reads it as the enclosing baseline, so it gets one
 3445|       |                     // less than the content indent and its content passes "indent > parent".
 3446|  97.4k|                     const int32_t element_indent =
 3447|  97.4k|                        receives_block_mapping_column<value_type>() ? nested_indent : nested_indent - 1;
 3448|  97.4k|                     if (!ctx.push_indent(element_indent)) [[unlikely]]
 3449|  97.4k|                        return;
 3450|  97.4k|                     const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3451|  97.4k|                     const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3452|  97.4k|                     ctx.sequence_item_value_context = true;
 3453|  97.4k|                     ctx.sequence_dash_indent = dash_col;
 3454|  97.4k|                     from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3455|  97.4k|                     ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3456|  97.4k|                     ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3457|  97.4k|                     ctx.pop_indent();
 3458|  97.4k|                  }
 3459|       |                  // else: empty element (default constructed)
 3460|  97.4k|               }
 3461|       |
 3462|  97.4k|               if (has_pending_item_anchor && !bool(ctx.error)) {
 3463|  97.4k|                  const char* element_end = (it != end) ? &*it : element_start;
 3464|  97.4k|                  ctx.anchors[std::move(pending_item_anchor_name)] = {element_start, element_end,
 3465|  97.4k|                                                                      pending_item_anchor_indent};
 3466|  97.4k|                  has_pending_item_anchor = false;
 3467|  97.4k|               }
 3468|  97.4k|            };
 3469|       |
 3470|  97.4k|            if constexpr (emplace_backable<V>) {
 3471|  97.4k|               auto& element = value.emplace_back();
 3472|  97.4k|               parse_element(element);
 3473|       |            }
 3474|       |            else if constexpr (emplaceable<V>) {
 3475|       |               value_type element{};
 3476|       |               parse_element(element);
 3477|       |               if (!bool(ctx.error)) {
 3478|       |                  adapter.append(value, std::move(element));
 3479|       |               }
 3480|       |            }
 3481|       |            else if constexpr (!resizable<V>) {
 3482|       |               // Fixed-size (e.g. std::array): an item beyond the last slot is an error, as in JSON.
 3483|       |               // Checked only once another item is confirmed, so a full container still ends cleanly.
 3484|       |               if (adapter.fixed_capacity_reached(value)) [[unlikely]] {
 3485|       |                  ctx.error = error_code::exceeded_static_array_size;
 3486|       |                  return;
 3487|       |               }
 3488|       |               parse_element(value[adapter.index]);
 3489|       |               adapter.commit_fixed_slot();
 3490|       |            }
 3491|       |            else {
 3492|       |               ctx.error = error_code::syntax_error;
 3493|       |               return;
 3494|       |            }
 3495|       |
 3496|  97.4k|            first_item = false;
 3497|       |
 3498|  97.4k|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3498:17): [True: 845, False: 96.6k]
  ------------------
 3499|    845|               return;
 3500|       |
 3501|       |            // Note: after parsing nested block content, iterator may already be
 3502|       |            // at the start of the next line. The outer loop will handle it.
 3503|  97.4k|         }
 3504|  44.1k|      }
_ZZN3glz4yaml20parse_block_sequenceITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_iENKUlRT_E_clIS8_EEDaSO_:
 3405|  97.4k|            auto parse_element = [&](auto& element) {
 3406|  97.4k|               const char* element_start = (it != end) ? &*it : nullptr;
  ------------------
  |  Branch (3406:44): [True: 95.4k, False: 1.98k]
  ------------------
 3407|       |
 3408|       |               // Check what follows
 3409|  97.4k|               if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (3409:20): [True: 95.4k, False: 1.98k]
  |  Branch (3409:33): [True: 54.9k, False: 40.5k]
  ------------------
 3410|       |                  // Content on same line as dash - set indent to one less than content column
 3411|       |                  // This allows nested block mappings to continue parsing keys at the content indent
 3412|       |                  // For "- key: val", if dash is at column 0, content is at column 2
 3413|       |                  // We set parent indent to 1 so keys at column 2 pass the "indent > parent" check
 3414|  54.9k|                  if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
  ------------------
  |  Branch (3414:23): [True: 0, False: 54.9k]
  ------------------
 3415|      0|                     return;
 3416|  54.9k|                  const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3417|  54.9k|                  const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3418|  54.9k|                  ctx.sequence_item_value_context = true;
 3419|  54.9k|                  ctx.sequence_dash_indent = dash_col;
 3420|  54.9k|                  from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3421|  54.9k|                  ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3422|  54.9k|                  ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3423|  54.9k|                  ctx.pop_indent();
 3424|  54.9k|               }
 3425|  42.5k|               else {
 3426|       |                  // Value on next line - nested block
 3427|  42.5k|                  skip_ws_and_comment(it, end);
 3428|  42.5k|                  skip_newline(it, end);
 3429|       |
 3430|       |                  // Get indent of nested content
 3431|  42.5k|                  auto nested_start = it;
 3432|  42.5k|                  int32_t nested_indent = measure_indent(it, end, ctx);
 3433|  42.5k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3433:23): [True: 3, False: 42.5k]
  ------------------
 3434|      3|                     return;
 3435|  42.5k|                  it = nested_start;
 3436|       |
 3437|       |                  // Content is nested only if indented more than the current line.
 3438|       |                  // When line_indent is negative (root level), use 0 as the baseline.
 3439|       |                  // This prevents content at column 0 from being treated as nested.
 3440|  42.5k|                  const int32_t effective_line_indent = (line_indent < 0) ? 0 : line_indent;
  ------------------
  |  Branch (3440:57): [True: 1.77k, False: 40.7k]
  ------------------
 3441|  42.5k|                  if (nested_indent > effective_line_indent) {
  ------------------
  |  Branch (3441:23): [True: 29.6k, False: 12.8k]
  ------------------
 3442|       |                     // Save and set indent for nested parsing.
 3443|       |                     // A struct element reads the pushed indent as its own key column; every
 3444|       |                     // other element type reads it as the enclosing baseline, so it gets one
 3445|       |                     // less than the content indent and its content passes "indent > parent".
 3446|  29.6k|                     const int32_t element_indent =
 3447|  29.6k|                        receives_block_mapping_column<value_type>() ? nested_indent : nested_indent - 1;
  ------------------
  |  Branch (3447:25): [Folded, False: 29.6k]
  ------------------
 3448|  29.6k|                     if (!ctx.push_indent(element_indent)) [[unlikely]]
  ------------------
  |  Branch (3448:26): [True: 0, False: 29.6k]
  ------------------
 3449|      0|                        return;
 3450|  29.6k|                     const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3451|  29.6k|                     const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3452|  29.6k|                     ctx.sequence_item_value_context = true;
 3453|  29.6k|                     ctx.sequence_dash_indent = dash_col;
 3454|  29.6k|                     from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3455|  29.6k|                     ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3456|  29.6k|                     ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3457|  29.6k|                     ctx.pop_indent();
 3458|  29.6k|                  }
 3459|       |                  // else: empty element (default constructed)
 3460|  42.5k|               }
 3461|       |
 3462|  97.4k|               if (has_pending_item_anchor && !bool(ctx.error)) {
  ------------------
  |  Branch (3462:20): [True: 1.77k, False: 95.6k]
  |  Branch (3462:47): [True: 1.64k, False: 133]
  ------------------
 3463|  1.64k|                  const char* element_end = (it != end) ? &*it : element_start;
  ------------------
  |  Branch (3463:45): [True: 822, False: 820]
  ------------------
 3464|  1.64k|                  ctx.anchors[std::move(pending_item_anchor_name)] = {element_start, element_end,
 3465|  1.64k|                                                                      pending_item_anchor_indent};
 3466|  1.64k|                  has_pending_item_anchor = false;
 3467|  1.64k|               }
 3468|  97.4k|            };
_ZN3glz29parse_block_mapping_or_stringINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERSH_RNS_4yaml12yaml_contextERPKcSO_EEvOT1_OT2_OT3_T4_:
 5575|   172k|   {
 5576|       |      if constexpr (yaml::check_flow_context(Opts)) {
 5577|       |         // In flow context, only treat plain content as an implicit "key: value"
 5578|       |         // when a mapping separator appears before the next top-level flow delimiter.
 5579|       |         auto could_be_implicit_flow_pair = [&](auto pos) {
 5580|       |            // Bounded by the longest implicit key the spec allows: unbounded, this probe runs
 5581|       |            // once per entry per nesting level over the whole remaining flow collection.
 5582|       |            const auto stop = yaml::implicit_key_scan_end(pos, end);
 5583|       |            // See `line_could_be_block_mapping` for why a quote is an indicator only where a node
 5584|       |            // can begin. Brackets need no such guard here: ns-plain-safe-in keeps them out of a
 5585|       |            // flow-context plain scalar, so every one of them is an indicator.
 5586|       |            bool at_node_start = true;
 5587|       |            int depth = 0;
 5588|       |            while (pos != stop) {
 5589|       |               const char c = *pos;
 5590|       |               if (c == ' ' || c == '\t') {
 5591|       |                  ++pos;
 5592|       |                  continue;
 5593|       |               }
 5594|       |               const bool node_start = std::exchange(at_node_start, false);
 5595|       |
 5596|       |               if ((c == '"' || c == '\'') && node_start) {
 5597|       |                  if (not yaml::skip_probe_quoted_scalar(pos, stop)) return false;
 5598|       |                  continue;
 5599|       |               }
 5600|       |               if (c == '[' || c == '{') {
 5601|       |                  ++depth;
 5602|       |                  at_node_start = true;
 5603|       |                  ++pos;
 5604|       |                  continue;
 5605|       |               }
 5606|       |               if (c == ']' || c == '}') {
 5607|       |                  if (depth == 0) return false;
 5608|       |                  --depth;
 5609|       |                  ++pos;
 5610|       |                  continue;
 5611|       |               }
 5612|       |               if (c == ',' && depth == 0) return false;
 5613|       |               if (c == ':' && depth == 0) {
 5614|       |                  auto next = pos + 1;
 5615|       |                  return next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
 5616|       |               }
 5617|       |               // Inside a nested collection ',' separates entries and ':' ends a key.
 5618|       |               if (c == ',' || c == ':') {
 5619|       |                  at_node_start = true;
 5620|       |                  ++pos;
 5621|       |                  continue;
 5622|       |               }
 5623|       |               if (node_start && yaml::skip_probe_node_property(pos, stop)) {
 5624|       |                  at_node_start = true;
 5625|       |                  continue;
 5626|       |               }
 5627|       |               ++pos;
 5628|       |            }
 5629|       |            return false;
 5630|       |         };
 5631|       |
 5632|       |         if (could_be_implicit_flow_pair(it) || line_could_be_flow_mapping(it, end)) {
 5633|       |            if (try_parse_block_mapping_into_variant<Variant, Opts>(value, ctx, it, end)) {
 5634|       |               return;
 5635|       |            }
 5636|       |            if (bool(ctx.error)) {
 5637|       |               return;
 5638|       |            }
 5639|       |         }
 5640|       |
 5641|       |         process_yaml_variant_alternatives<Variant, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 5642|       |         return;
 5643|       |      }
 5644|       |
 5645|   172k|      if (try_parse_block_mapping_into_variant<Variant, Opts>(value, ctx, it, end)) {
  ------------------
  |  Branch (5645:11): [True: 99.4k, False: 72.8k]
  ------------------
 5646|  99.4k|         return;
 5647|  99.4k|      }
 5648|       |      // If an error was set (e.g., malformed flow collection in value), don't try to parse as string
 5649|  72.8k|      if (bool(ctx.error)) {
  ------------------
  |  Branch (5649:11): [True: 6.54k, False: 66.3k]
  ------------------
 5650|  6.54k|         return;
 5651|  6.54k|      }
 5652|  66.3k|      process_yaml_variant_alternatives<Variant, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 5653|  66.3k|   }
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_ENKUlT_E0_clISM_EEDaSZ_:
 6007|  24.3k|            auto is_word_boundary = [&](const auto ptr) {
 6008|  24.3k|               if (ptr == end) {
  ------------------
  |  Branch (6008:20): [True: 1.28k, False: 23.0k]
  ------------------
 6009|  1.28k|                  return true;
 6010|  1.28k|               }
 6011|  23.0k|               if (*ptr == ':') {
  ------------------
  |  Branch (6011:20): [True: 5.82k, False: 17.2k]
  ------------------
 6012|  5.82k|                  auto next = ptr + 1;
 6013|  5.82k|                  return (next == end) || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
  ------------------
  |  Branch (6013:26): [True: 1.30k, False: 4.51k]
  |  Branch (6013:43): [True: 988, False: 3.52k]
  |  Branch (6013:59): [True: 752, False: 2.77k]
  |  Branch (6013:76): [True: 987, False: 1.79k]
  |  Branch (6013:93): [True: 1.18k, False: 604]
  ------------------
 6014|  5.82k|               }
 6015|  17.2k|               return is_plain_scalar_boundary(*ptr);
 6016|  23.0k|            };
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_ENKUlcE_clEc:
 5933|  17.2k|            auto is_plain_scalar_boundary = [](const char ch) {
 5934|  17.2k|               switch (ch) {
 5935|    510|               case ' ':
  ------------------
  |  Branch (5935:16): [True: 510, False: 16.7k]
  ------------------
 5936|    994|               case '\t':
  ------------------
  |  Branch (5936:16): [True: 484, False: 16.7k]
  ------------------
 5937|  5.79k|               case '\n':
  ------------------
  |  Branch (5937:16): [True: 4.80k, False: 12.4k]
  ------------------
 5938|  14.6k|               case '\r':
  ------------------
  |  Branch (5938:16): [True: 8.88k, False: 8.33k]
  ------------------
 5939|  14.9k|               case ',':
  ------------------
  |  Branch (5939:16): [True: 288, False: 16.9k]
  ------------------
 5940|  15.2k|               case ']':
  ------------------
  |  Branch (5940:16): [True: 301, False: 16.9k]
  ------------------
 5941|  15.5k|               case '}':
  ------------------
  |  Branch (5941:16): [True: 255, False: 16.9k]
  ------------------
 5942|  15.5k|                  return true;
 5943|  1.70k|               default:
  ------------------
  |  Branch (5943:16): [True: 1.70k, False: 15.5k]
  ------------------
 5944|  1.70k|                  return false;
 5945|  17.2k|               }
 5946|  17.2k|            };
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERPKcRSH_TkNS_10is_contextERNS_4yaml12yaml_contextESM_EEvOT1_OT2_OT0_T3_ENKUlT_E_clISM_EEDaSZ_:
 5948|  22.0k|            auto has_indented_block_continuation = [&](auto word_end) {
 5949|       |               if constexpr (yaml::check_flow_context(Opts)) {
 5950|       |                  return false;
 5951|       |               }
 5952|  22.0k|               if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (5952:20): [True: 1.90k, False: 20.1k]
  ------------------
 5953|  1.90k|                  return false;
 5954|  1.90k|               }
 5955|  20.1k|               if (word_end == end || (*word_end != '\n' && *word_end != '\r')) {
  ------------------
  |  Branch (5955:20): [True: 832, False: 19.2k]
  |  Branch (5955:40): [True: 14.5k, False: 4.79k]
  |  Branch (5955:61): [True: 5.70k, False: 8.79k]
  ------------------
 5956|  6.54k|                  return false;
 5957|  6.54k|               }
 5958|       |
 5959|  13.5k|               auto look = word_end;
 5960|  13.5k|               yaml::skip_newline(look, end);
 5961|  49.5k|               while (look != end) {
  ------------------
  |  Branch (5961:23): [True: 43.9k, False: 5.61k]
  ------------------
 5962|  43.9k|                  int32_t line_indent = 0;
 5963|   193k|                  while (look != end && *look == ' ') {
  ------------------
  |  Branch (5963:26): [True: 193k, False: 233]
  |  Branch (5963:41): [True: 149k, False: 43.6k]
  ------------------
 5964|   149k|                     ++line_indent;
 5965|   149k|                     ++look;
 5966|   149k|                  }
 5967|  43.9k|                  if (look != end && *look == '\t') {
  ------------------
  |  Branch (5967:23): [True: 43.6k, False: 233]
  |  Branch (5967:38): [True: 504, False: 43.1k]
  ------------------
 5968|    504|                     return false;
 5969|    504|                  }
 5970|  43.4k|                  if (look == end || *look == '\n' || *look == '\r') {
  ------------------
  |  Branch (5970:23): [True: 233, False: 43.1k]
  |  Branch (5970:38): [True: 29.1k, False: 13.9k]
  |  Branch (5970:55): [True: 3.67k, False: 10.3k]
  ------------------
 5971|  33.0k|                     if (look != end) {
  ------------------
  |  Branch (5971:26): [True: 32.8k, False: 233]
  ------------------
 5972|  32.8k|                        yaml::skip_newline(look, end);
 5973|  32.8k|                        continue;
 5974|  32.8k|                     }
 5975|    233|                     return false;
 5976|  33.0k|                  }
 5977|  10.3k|                  if (*look == '#') {
  ------------------
  |  Branch (5977:23): [True: 3.35k, False: 6.96k]
  ------------------
 5978|  3.35k|                     yaml::skip_comment(look, end);
 5979|  3.35k|                     if (look != end && (*look == '\n' || *look == '\r')) {
  ------------------
  |  Branch (5979:26): [True: 3.09k, False: 265]
  |  Branch (5979:42): [True: 1.84k, False: 1.25k]
  |  Branch (5979:59): [True: 1.24k, False: 5]
  ------------------
 5980|  3.08k|                        yaml::skip_newline(look, end);
 5981|  3.08k|                        continue;
 5982|  3.08k|                     }
 5983|    270|                     return false;
 5984|  3.35k|                  }
 5985|       |
 5986|       |                  // If the next non-empty line is an implicit mapping entry,
 5987|       |                  // don't treat it as scalar continuation for auto-deduced
 5988|       |                  // booleans/nulls.
 5989|  6.96k|                  {
 5990|  6.96k|                     auto scan = look;
 5991|   160k|                     while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (5991:29): [True: 159k, False: 384]
  |  Branch (5991:44): [True: 156k, False: 3.12k]
  |  Branch (5991:61): [True: 155k, False: 633]
  ------------------
 5992|   155k|                        if (*scan == ':') {
  ------------------
  |  Branch (5992:29): [True: 4.01k, False: 151k]
  ------------------
 5993|  4.01k|                           auto after_colon = scan + 1;
 5994|  4.01k|                           if (after_colon == end || *after_colon == ' ' || *after_colon == '\t' ||
  ------------------
  |  Branch (5994:32): [True: 299, False: 3.71k]
  |  Branch (5994:54): [True: 1.04k, False: 2.67k]
  |  Branch (5994:77): [True: 642, False: 2.03k]
  ------------------
 5995|  2.83k|                               *after_colon == '\n' || *after_colon == '\r') {
  ------------------
  |  Branch (5995:32): [True: 366, False: 1.66k]
  |  Branch (5995:56): [True: 482, False: 1.18k]
  ------------------
 5996|  2.83k|                              return false;
 5997|  2.83k|                           }
 5998|  4.01k|                        }
 5999|   153k|                        ++scan;
 6000|   153k|                     }
 6001|  6.96k|                  }
 6002|       |
 6003|  4.13k|                  return line_indent > ctx.current_indent();
 6004|  6.96k|               }
 6005|  5.61k|               return false;
 6006|  13.5k|            };
_ZN3glz36try_parse_block_mapping_into_variantINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERSH_RNS_4yaml12yaml_contextERPKcSO_EEbOT1_OT2_OT3_T4_:
 5529|   203k|   {
 5530|   203k|      using counts = yaml_variant_type_count<Variant>;
 5531|       |      if constexpr (counts::n_object == 0) {
 5532|       |         return false;
 5533|       |      }
 5534|   203k|      else {
 5535|       |         // Quick check: if no viable mapping separator in the current span,
 5536|       |         // avoid expensive speculative parse.
 5537|   203k|         const bool could_be_mapping = [&] {
 5538|   203k|            if constexpr (yaml::check_flow_context(Opts)) {
 5539|   203k|               return line_could_be_flow_mapping(it, end);
 5540|   203k|            }
 5541|   203k|            else {
 5542|   203k|               return yaml::line_could_be_block_mapping(it, end);
 5543|   203k|            }
 5544|   203k|         }();
 5545|   203k|         if (!could_be_mapping) {
  ------------------
  |  Branch (5545:14): [True: 78.3k, False: 124k]
  ------------------
 5546|  78.3k|            return false;
 5547|  78.3k|         }
 5548|       |         // Full parse attempt - use a temporary context that inherits indent from parent
 5549|   124k|         auto temp_ctx = ctx.make_speculative();
 5550|   124k|         process_yaml_variant_alternatives<Variant, is_yaml_variant_object>::template op<Opts>(value, temp_ctx, it,
 5551|   124k|                                                                                               end);
 5552|   124k|         ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 5553|   124k|         ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5554|   124k|         if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (5554:14): [True: 109k, False: 15.3k]
  ------------------
 5555|   109k|            ctx.anchors = std::move(temp_ctx.anchors);
 5556|   109k|            return true;
 5557|   109k|         }
 5558|       |         // The line matched "key: value" pattern but parsing failed.
 5559|       |         // This indicates malformed content (e.g., unclosed flow collection),
 5560|       |         // so propagate the error rather than silently falling back to string.
 5561|  15.3k|         ctx.error = temp_ctx.error;
 5562|  15.3k|         ctx.custom_error_message = temp_ctx.custom_error_message;
 5563|  15.3k|         return false;
 5564|   124k|      }
 5565|   203k|   }
_ZZN3glz36try_parse_block_mapping_into_variantINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERSH_RNS_4yaml12yaml_contextERPKcSO_EEbOT1_OT2_OT3_T4_ENKUlvE_clEv:
 5537|   203k|         const bool could_be_mapping = [&] {
 5538|       |            if constexpr (yaml::check_flow_context(Opts)) {
 5539|       |               return line_could_be_flow_mapping(it, end);
 5540|       |            }
 5541|   203k|            else {
 5542|   203k|               return yaml::line_could_be_block_mapping(it, end);
 5543|   203k|            }
 5544|   203k|         }();
_ZZN3glz5parseILj450EE2opITnDaXtlNS_4optsELj450ELb0ELb0ELb1ELb1EEERNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_10is_contextERNS_4yaml12yaml_contextERPKcSD_EEvOT0_OT1_OT2_T3_ENKUlT_E_clISD_EEDaSM_:
  146|    412|               auto is_document_start = [&](auto pos) {
  147|    412|                  if (end - pos >= 3 && pos[0] == '-' && pos[1] == '-' && pos[2] == '-') {
  ------------------
  |  Branch (147:23): [True: 310, False: 102]
  |  Branch (147:41): [True: 155, False: 155]
  |  Branch (147:58): [True: 139, False: 16]
  |  Branch (147:75): [True: 133, False: 6]
  ------------------
  148|    133|                     auto after = pos + 3;
  149|    133|                     return after == end || *after == ' ' || *after == '\t' || *after == '\n' || *after == '\r' ||
  ------------------
  |  Branch (149:29): [True: 16, False: 117]
  |  Branch (149:45): [True: 39, False: 78]
  |  Branch (149:62): [True: 49, False: 29]
  |  Branch (149:80): [True: 14, False: 15]
  |  Branch (149:98): [True: 12, False: 3]
  ------------------
  150|      3|                            *after == '#';
  ------------------
  |  Branch (150:29): [True: 1, False: 2]
  ------------------
  151|    133|                  }
  152|    279|                  return false;
  153|    412|               };
_ZN3glz9read_yamlITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_10contiguousERKNSt3__16vectorIcNS8_9allocatorIcEEEEEENS_9error_ctxEOT0_OT1_:
 6777|  79.9k|   {
 6778|  79.9k|      if (buffer.size() == 0) {
  ------------------
  |  Branch (6778:11): [True: 0, False: 79.9k]
  ------------------
 6779|      0|         using V = std::remove_cvref_t<T>;
 6780|      0|         if constexpr (requires { value = nullptr; }) {
 6781|      0|            value = nullptr;
 6782|      0|            return {};
 6783|       |         }
 6784|       |         else if constexpr (nullable_like<V>) {
 6785|       |            value = {};
 6786|       |            return {};
 6787|       |         }
 6788|      0|      }
 6789|      0|      yaml::yaml_context ctx{};
 6790|  79.9k|      return read<set_yaml<Opts>()>(std::forward<T>(value), std::forward<Buffer>(buffer), ctx);
 6791|  79.9k|   }
_ZN3glz5parseILj450EE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_10is_contextERNS3_12yaml_contextERPKcSD_EEvOT0_OT1_OT2_T3_:
   70|   119k|      {
   71|   119k|         if constexpr (requires { ctx.stream_begin; }) {
   72|   119k|            if (!ctx.stream_begin && it != end) {
  ------------------
  |  Branch (72:17): [True: 119k, False: 0]
  |  Branch (72:38): [True: 119k, False: 0]
  ------------------
   73|   119k|               ctx.stream_begin = &*it;
   74|       |               // Anchors and the line memo hold pointers into whatever buffer filled them, so a
   75|       |               // reused context must not carry a previous read's into this one.
   76|   119k|               if constexpr (requires { ctx.reset_read_state(); }) {
   77|   119k|                  ctx.reset_read_state();
   78|   119k|               }
   79|       |               // Seed the alias replay budget from the document this read was handed. Done here
   80|       |               // rather than in glz::read so every YAML entry point is covered, and only on the
   81|       |               // outermost parse so a nested document does not hand itself a fresh budget.
   82|   119k|               if constexpr (requires { ctx.alias_expansion_budget; } && requires { size_t(end - it); }) {
   83|   119k|                  const size_t scaled = size_t(end - it) * yaml::max_alias_expansion_factor;
   84|   119k|                  ctx.alias_expansion_budget =
   85|   119k|                     scaled > yaml::min_alias_expansion_bytes ? scaled : yaml::min_alias_expansion_bytes;
  ------------------
  |  Branch (85:22): [True: 1.02k, False: 118k]
  ------------------
   86|   119k|               }
   87|       |               // Same treatment for the text complex keys materialize, seeded on its own budget so
   88|       |               // exhausting one reports which of the two ran away.
   89|   119k|               if constexpr (requires { ctx.key_expansion_budget; } && requires { size_t(end - it); }) {
   90|   119k|                  const size_t scaled = size_t(end - it) * yaml::max_key_expansion_factor;
   91|   119k|                  ctx.key_expansion_budget =
   92|   119k|                     scaled > yaml::min_key_expansion_bytes ? scaled : yaml::min_key_expansion_bytes;
  ------------------
  |  Branch (92:22): [True: 1.02k, False: 118k]
  ------------------
   93|   119k|               }
   94|   119k|            }
   95|   119k|         }
   96|       |         // Skip YAML directives and document start marker (---) if present
   97|   119k|         yaml::skip_document_start(it, end, ctx);
   98|   119k|         if (bool(ctx.error)) [[unlikely]] {
  ------------------
  |  Branch (98:14): [True: 755, False: 119k]
  ------------------
   99|    755|            return;
  100|    755|         }
  101|       |
  102|   119k|         using V = std::remove_cvref_t<T>;
  103|   119k|         if (it == end) {
  ------------------
  |  Branch (103:14): [True: 60, False: 119k]
  ------------------
  104|       |            // An empty document is a valid YAML null document.
  105|     60|            if constexpr (requires { value = nullptr; }) {
  106|     60|               value = nullptr;
  107|     60|               return;
  108|       |            }
  109|       |            else if constexpr (nullable_like<V>) {
  110|       |               value = {};
  111|       |               return;
  112|       |            }
  113|       |            else {
  114|       |               ctx.error = error_code::unexpected_end;
  115|       |               return;
  116|       |            }
  117|     60|         }
  118|       |
  119|       |         // A bare document boundary marker at root denotes an empty document.
  120|       |         // Examples: "---\n---\n", "# comment\n...\n"
  121|   119k|         if (yaml::at_document_start(it, end) || yaml::at_document_end(it, end)) {
  ------------------
  |  Branch (121:14): [True: 74, False: 119k]
  |  Branch (121:50): [True: 29, False: 119k]
  ------------------
  122|     43|            if constexpr (requires { value = nullptr; }) {
  123|     43|               value = nullptr;
  124|     43|               return;
  125|       |            }
  126|       |            else if constexpr (nullable_like<V>) {
  127|       |               value = {};
  128|       |               return;
  129|       |            }
  130|       |            else {
  131|       |               ctx.error = error_code::unexpected_end;
  132|       |               return;
  133|       |            }
  134|     43|         }
  135|       |
  136|      0|         from<YAML, V>::template op<Opts>(std::forward<T>(value), std::forward<Ctx>(ctx), std::forward<It0>(it), end);
  137|       |
  138|       |         // A directive line (%YAML/%TAG/...) is only valid in the document prefix.
  139|       |         // If parsing stopped before the end and we encounter a directive in the
  140|       |         // remaining tail, treat it as malformed stream structure. This is a document-level
  141|       |         // concern, so only enforce it at the document root: a nested call (e.g. a tagged
  142|       |         // variant handing a custom alternative its body) is mid-document and its tail
  143|       |         // belongs to an enclosing node, not this value.
  144|   119k|         if constexpr (!check_partial_read(Opts)) {
  145|   119k|            if (!bool(ctx.error) && ctx.current_indent() < 0) {
  ------------------
  |  Branch (145:17): [True: 13.5k, False: 105k]
  |  Branch (145:37): [True: 13.5k, False: 0]
  ------------------
  146|  13.5k|               auto is_document_start = [&](auto pos) {
  147|  13.5k|                  if (end - pos >= 3 && pos[0] == '-' && pos[1] == '-' && pos[2] == '-') {
  148|  13.5k|                     auto after = pos + 3;
  149|  13.5k|                     return after == end || *after == ' ' || *after == '\t' || *after == '\n' || *after == '\r' ||
  150|  13.5k|                            *after == '#';
  151|  13.5k|                  }
  152|  13.5k|                  return false;
  153|  13.5k|               };
  154|       |
  155|       |               // The scan below reads the tail a line at a time, which only means anything if the
  156|       |               // tail starts at one. A root node can stop mid-line -- a plain scalar ends at a
  157|       |               // ':' it is not allowed to take as a separator, a flow collection ends at its
  158|       |               // bracket -- and what sits after it there is leftover content on that line, not
  159|       |               // the opening of a new one. Only inline whitespace and a comment may follow. Let
  160|       |               // the line scan see anything else and it misreads it: a leftover ':' passes as an
  161|       |               // explicit-key continuation and the remainder of the document falls on the floor.
  162|  13.5k|               if constexpr (requires { ctx.line_prefix_before(it); }) {
  163|  13.5k|                  if (it != end && ctx.line_prefix_before(it).has_content) {
  ------------------
  |  Branch (163:23): [True: 5.28k, False: 8.21k]
  |  Branch (163:23): [True: 3.50k, False: 9.99k]
  |  Branch (163:36): [True: 3.50k, False: 1.78k]
  ------------------
  164|  3.50k|                     auto rest = it;
  165|  11.0k|                     while (rest != end && (*rest == ' ' || *rest == '\t')) ++rest;
  ------------------
  |  Branch (165:29): [True: 10.9k, False: 49]
  |  Branch (165:45): [True: 6.31k, False: 4.66k]
  |  Branch (165:61): [True: 1.20k, False: 3.45k]
  ------------------
  166|  3.50k|                     if (rest != end && *rest != '\n' && *rest != '\r' && *rest != '#') {
  ------------------
  |  Branch (166:26): [True: 3.45k, False: 49]
  |  Branch (166:41): [True: 3.05k, False: 400]
  |  Branch (166:58): [True: 2.38k, False: 670]
  |  Branch (166:75): [True: 2.10k, False: 288]
  ------------------
  167|  2.10k|                        ctx.error = error_code::syntax_error;
  168|  2.10k|                        return;
  169|  2.10k|                     }
  170|  3.50k|                  }
  171|  13.5k|               }
  172|       |
  173|  11.4k|               auto tail_scan = it;
  174|  13.5k|               bool seen_document_end_marker = false;
  175|   128k|               while (tail_scan != end) {
  ------------------
  |  Branch (175:23): [True: 117k, False: 11.1k]
  ------------------
  176|   117k|                  auto line = tail_scan;
  177|   150k|                  while (line != end && (*line == ' ' || *line == '\t')) ++line;
  ------------------
  |  Branch (177:26): [True: 150k, False: 81]
  |  Branch (177:42): [True: 31.7k, False: 119k]
  |  Branch (177:58): [True: 1.46k, False: 117k]
  ------------------
  178|   117k|                  if (line != tail_scan && line != end && *line != '\n' && *line != '\r' && *line != '#') {
  ------------------
  |  Branch (178:23): [True: 3.43k, False: 114k]
  |  Branch (178:44): [True: 3.35k, False: 81]
  |  Branch (178:59): [True: 2.59k, False: 755]
  |  Branch (178:76): [True: 1.81k, False: 787]
  |  Branch (178:93): [True: 405, False: 1.40k]
  ------------------
  179|       |                     // Indented tail usually belongs to continuation content.
  180|       |                     // But a plain "key: value" pattern here indicates malformed
  181|       |                     // trailing mapping content after a completed root node.
  182|    405|                     const char first = *line;
  183|       |                     // A block sequence entry here has nothing it can belong to: every node
  184|       |                     // that could own it has returned, so accepting it would drop it and every
  185|       |                     // line after it from the document.
  186|    405|                     if (first == '-' &&
  ------------------
  |  Branch (186:26): [True: 53, False: 352]
  ------------------
  187|     53|                         ((line + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(line + 1))])) {
  ------------------
  |  Branch (187:27): [True: 4, False: 49]
  |  Branch (187:48): [True: 4, False: 45]
  ------------------
  188|      8|                        ctx.error = error_code::syntax_error;
  189|      8|                        return;
  190|      8|                     }
  191|    397|                     const bool explicit_or_structural_start =
  192|    397|                        (first == ':' || first == '?' || first == '!' || first == '&' || first == '*' || first == '[' ||
  ------------------
  |  Branch (192:26): [True: 29, False: 368]
  |  Branch (192:42): [True: 11, False: 357]
  |  Branch (192:58): [True: 6, False: 351]
  |  Branch (192:74): [True: 6, False: 345]
  |  Branch (192:90): [True: 10, False: 335]
  |  Branch (192:106): [True: 11, False: 324]
  ------------------
  193|    324|                         first == '{' || first == '"' || first == '\'' || first == '-');
  ------------------
  |  Branch (193:26): [True: 4, False: 320]
  |  Branch (193:42): [True: 4, False: 316]
  |  Branch (193:58): [True: 7, False: 309]
  |  Branch (193:75): [True: 45, False: 264]
  ------------------
  194|    397|                     if (!explicit_or_structural_start) {
  ------------------
  |  Branch (194:26): [True: 264, False: 133]
  ------------------
  195|    264|                        auto scan = line;
  196|  7.44k|                        while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (196:32): [True: 7.26k, False: 181]
  |  Branch (196:47): [True: 7.23k, False: 25]
  |  Branch (196:64): [True: 7.22k, False: 11]
  ------------------
  197|  7.22k|                           if (*scan == ':') {
  ------------------
  |  Branch (197:32): [True: 746, False: 6.48k]
  ------------------
  198|    746|                              auto after = scan + 1;
  199|    746|                              if (after == end || *after == ' ' || *after == '\t' || *after == '\n' || *after == '\r') {
  ------------------
  |  Branch (199:35): [True: 17, False: 729]
  |  Branch (199:51): [True: 15, False: 714]
  |  Branch (199:68): [True: 6, False: 708]
  |  Branch (199:86): [True: 3, False: 705]
  |  Branch (199:104): [True: 6, False: 699]
  ------------------
  200|     47|                                 ctx.error = error_code::syntax_error;
  201|     47|                                 return;
  202|     47|                              }
  203|    746|                           }
  204|  7.18k|                           ++scan;
  205|  7.18k|                        }
  206|    264|                     }
  207|    350|                     return;
  208|    397|                  }
  209|   117k|                  if (line == end) {
  ------------------
  |  Branch (209:23): [True: 81, False: 117k]
  ------------------
  210|     81|                     return;
  211|     81|                  }
  212|   117k|                  if (*line == ':' || *line == '?') {
  ------------------
  |  Branch (212:23): [True: 52, False: 117k]
  |  Branch (212:39): [True: 46, False: 117k]
  ------------------
  213|     98|                     return; // Explicit key/value continuation.
  214|     98|                  }
  215|   117k|                  if (*line == '\n' || *line == '\r') {
  ------------------
  |  Branch (215:23): [True: 81.9k, False: 35.2k]
  |  Branch (215:40): [True: 10.0k, False: 25.1k]
  ------------------
  216|  92.0k|                     tail_scan = line;
  217|  92.0k|                     yaml::skip_newline(tail_scan, end);
  218|  92.0k|                     continue;
  219|  92.0k|                  }
  220|  25.1k|                  if (*line == '#') {
  ------------------
  |  Branch (220:23): [True: 17.7k, False: 7.36k]
  ------------------
  221|   124k|                     while (tail_scan != end && *tail_scan != '\n' && *tail_scan != '\r') ++tail_scan;
  ------------------
  |  Branch (221:29): [True: 124k, False: 408]
  |  Branch (221:49): [True: 119k, False: 4.28k]
  |  Branch (221:71): [True: 106k, False: 13.1k]
  ------------------
  222|  17.7k|                     yaml::skip_newline(tail_scan, end);
  223|  17.7k|                     continue;
  224|  17.7k|                  }
  225|  7.36k|                  if (yaml::at_document_end(line, end)) {
  ------------------
  |  Branch (225:23): [True: 5.56k, False: 1.79k]
  ------------------
  226|  5.56k|                     seen_document_end_marker = true;
  227|  40.3k|                     while (tail_scan != end && *tail_scan != '\n' && *tail_scan != '\r') ++tail_scan;
  ------------------
  |  Branch (227:29): [True: 40.1k, False: 157]
  |  Branch (227:49): [True: 36.8k, False: 3.28k]
  |  Branch (227:71): [True: 34.7k, False: 2.12k]
  ------------------
  228|  5.56k|                     yaml::skip_newline(tail_scan, end);
  229|  5.56k|                     continue;
  230|  5.56k|                  }
  231|  1.79k|                  if (is_document_start(line)) {
  ------------------
  |  Branch (231:23): [True: 341, False: 1.45k]
  ------------------
  232|       |                     // Additional documents are accepted, but document-start lines
  233|       |                     // that use non-standard tag handles (e.g. !prefix!Type) are
  234|       |                     // malformed in this single-document reader unless re-declared
  235|       |                     // for that document. Reject this shape in the stream tail.
  236|    341|                     auto header = line + 3;
  237|  2.28k|                     while (header != end && (*header == ' ' || *header == '\t')) ++header;
  ------------------
  |  Branch (237:29): [True: 2.25k, False: 34]
  |  Branch (237:47): [True: 954, False: 1.29k]
  |  Branch (237:65): [True: 992, False: 307]
  ------------------
  238|    341|                     if (header != end && *header == '!') {
  ------------------
  |  Branch (238:26): [True: 307, False: 34]
  |  Branch (238:43): [True: 134, False: 173]
  ------------------
  239|    134|                        auto tag_end = header + 1;
  240|  1.78M|                        while (tag_end != end && *tag_end != ' ' && *tag_end != '\t' && *tag_end != '\n' &&
  ------------------
  |  Branch (240:32): [True: 1.78M, False: 60]
  |  Branch (240:50): [True: 1.78M, False: 43]
  |  Branch (240:69): [True: 1.78M, False: 4]
  |  Branch (240:89): [True: 1.78M, False: 3]
  ------------------
  241|  1.78M|                               *tag_end != '\r' && *tag_end != '#') {
  ------------------
  |  Branch (241:32): [True: 1.78M, False: 9]
  |  Branch (241:52): [True: 1.78M, False: 15]
  ------------------
  242|  1.78M|                           ++tag_end;
  243|  1.78M|                        }
  244|    134|                        std::string_view tag_token(header, static_cast<size_t>(tag_end - header));
  245|    134|                        const auto second_bang = tag_token.find('!', 1);
  246|    134|                        if (second_bang != std::string_view::npos) {
  ------------------
  |  Branch (246:29): [True: 86, False: 48]
  ------------------
  247|     86|                           std::string_view handle = tag_token.substr(0, second_bang + 1);
  248|     86|                           if (handle != "!" && handle != "!!") {
  ------------------
  |  Branch (248:32): [True: 86, False: 0]
  |  Branch (248:49): [True: 79, False: 7]
  ------------------
  249|     79|                              ctx.error = error_code::syntax_error;
  250|     79|                              return;
  251|     79|                           }
  252|     86|                        }
  253|    134|                     }
  254|    262|                     return; // Additional documents are allowed in the stream tail.
  255|    341|                  }
  256|  1.45k|                  if (line != end && *line == '%') {
  ------------------
  |  Branch (256:23): [True: 1.45k, False: 0]
  |  Branch (256:38): [True: 17, False: 1.44k]
  ------------------
  257|       |                     // YAML directives are only valid in document prefixes. A directive
  258|       |                     // encountered mid-document (without a prior ...) is malformed.
  259|     17|                     if (!seen_document_end_marker) {
  ------------------
  |  Branch (259:26): [True: 13, False: 4]
  ------------------
  260|     13|                        ctx.error = error_code::syntax_error;
  261|     13|                        return;
  262|     13|                     }
  263|      4|                     return;
  264|     17|                  }
  265|  1.44k|                  if (seen_document_end_marker) {
  ------------------
  |  Branch (265:23): [True: 168, False: 1.27k]
  ------------------
  266|    168|                     return; // Implicit next document after explicit document end marker.
  267|    168|                  }
  268|  1.27k|                  ctx.error = error_code::syntax_error;
  269|  1.27k|                  return;
  270|  1.44k|               }
  271|  13.5k|            }
  272|   119k|         }
  273|   119k|      }
_ZN3glz4fromILj450ENS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERS4_TkNS_10is_contextERNS7_12yaml_contextERPKcSD_EEvOT0_OT1_OT2_T3_:
  283|  1.49M|      {
  284|  1.49M|         using V = std::decay_t<decltype(get_member(std::declval<Value>(), meta_wrapper_v<T>))>;
  285|  1.49M|         from<YAML, V>::template op<Opts>(get_member(std::forward<Value>(value), meta_wrapper_v<T>),
  286|  1.49M|                                          std::forward<Ctx>(ctx), std::forward<It0>(it), end);
  287|  1.49M|      }
_ZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRSH_TkNS_10is_contextERNSK_12yaml_contextESN_EEvOT1_OT2_OT0_T3_:
 5797|  1.99M|      {
 5798|       |         // Inside op() rather than at class scope: read_supported is `requires { from<Format, T>{}; }`,
 5799|       |         // so a class-scope assert turns that feature probe into a hard error instead of `false`.
 5800|  1.99M|         static_assert(content_v<std::remove_cvref_t<T>>.empty(),
 5801|  1.99M|                       "Adjacent variant tagging (glz::meta `content`) is implemented for JSON and "
 5802|  1.99M|                       "BEVE but not yet for YAML. Reading this variant as YAML would silently expect "
 5803|  1.99M|                       "the internally tagged shape, so it is rejected here instead.");
 5804|  1.99M|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5804:14): [True: 0, False: 1.99M]
  ------------------
 5805|      0|            return;
 5806|       |
 5807|       |         // No depth is taken here: the sequence and mapping readers this dispatches to count the
 5808|       |         // levels, so a scalar at the bottom of a document costs nothing, as in JSON. The one way
 5809|       |         // back into this reader that opens no collection is `redispatch`, which counts itself.
 5810|       |
 5811|       |         // At root level (indent == -1), skip leading whitespace, newlines, and comments
 5812|       |         // For nested values, only skip inline whitespace to preserve block structure
 5813|  1.99M|         if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (5813:14): [True: 353k, False: 1.64M]
  ------------------
 5814|   353k|            yaml::skip_ws_newlines_comments(it, end);
 5815|   353k|         }
 5816|  1.64M|         else {
 5817|  1.64M|            yaml::skip_inline_ws(it, end);
 5818|  1.64M|         }
 5819|       |
 5820|  1.99M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (5820:14): [True: 133, False: 1.99M]
  ------------------
 5821|    133|            ctx.error = error_code::unexpected_end;
 5822|    133|            return;
 5823|    133|         }
 5824|       |
 5825|       |         // Tagged variants: a discriminator key (meta::tag) selects the alternative, with the
 5826|       |         // matching meta::ids entry naming each type. This mirrors the JSON behavior so the
 5827|       |         // same variant definitions round-trip across both formats.
 5828|       |         if constexpr (not tag_v<std::remove_cvref_t<T>>.empty()) {
 5829|       |            using V = std::remove_cvref_t<T>;
 5830|       |            const bool value_is_mapping =
 5831|       |               (*it == '{') || (!yaml::check_flow_context(Opts) && yaml::line_could_be_block_mapping(it, end));
 5832|       |            if (value_is_mapping) {
 5833|       |               // The mapping's keys sit at the column of `it`. Recover that column from the buffer:
 5834|       |               // the indent stack carries the parent context's indent (a struct member, a sequence
 5835|       |               // item, etc. each push a different offset), not this mapping's true column (see helper).
 5836|       |               const int32_t mapping_column = tagged_mapping_visual_indent(ctx, it, ctx.current_indent() + 1);
 5837|       |               auto tag_ctx = ctx.make_speculative();
 5838|       |               const size_t index = scan_variant_tag_index<V, Opts>(tag_ctx, it, end, mapping_column);
 5839|       |               ctx.alias_expansion_budget = tag_ctx.alias_expansion_budget; // charged even if no tag matched
 5840|       |               ctx.key_expansion_budget = tag_ctx.key_expansion_budget;
 5841|       |               if (index < ids_v<V>.size()) {
 5842|       |                  static constexpr auto tag_literal = string_literal_from_view<tag_v<V>.size()>(tag_v<V>);
 5843|       |                  emplace_runtime_variant(value, index);
 5844|       |                  // Establish the mapping's true column on the indent stack for the alternative parse.
 5845|       |                  // The chosen object is then parsed - and the discriminator's inline value skipped -
 5846|       |                  // at a consistent indent in every context, so a tag on the first key does not fold
 5847|       |                  // the following sibling entries into its value (no special-casing needed downstream).
 5848|       |                  if (!ctx.push_indent(mapping_column)) [[unlikely]] {
 5849|       |                     ctx.error = error_code::exceeded_max_recursive_depth;
 5850|       |                     return;
 5851|       |                  }
 5852|       |                  std::visit(
 5853|       |                     [&](auto&& alt) {
 5854|       |                        using Alt = std::remove_cvref_t<decltype(alt)>;
 5855|       |                        if constexpr ((glaze_object_t<Alt> || reflectable<Alt>) && not custom_read<Alt>) {
 5856|       |                           // Parse the mapping into the resolved struct; the tag key is skipped.
 5857|       |                           from<YAML, Alt>::template op<Opts, tag_literal>(alt, ctx, it, end);
 5858|       |                        }
 5859|       |                        else if constexpr (custom_read<Alt>) {
 5860|       |                           // Custom alternatives read the mapping body themselves and cannot skip an
 5861|       |                           // interior tag key the way reflected objects do, so the tag must be the
 5862|       |                           // first key (glaze always writes it first). Consume that leading "tag: id"
 5863|       |                           // entry, then hand the remaining mapping to the custom handler.
 5864|       |                           if constexpr (yaml::check_flow_context(Opts)) {
 5865|       |                              ctx.error = error_code::feature_not_supported;
 5866|       |                              ctx.custom_error_message =
 5867|       |                                 "custom variant alternatives are not supported in YAML flow style";
 5868|       |                           }
 5869|       |                           else {
 5870|       |                              ctx.scratch.clear();
 5871|       |                              if (yaml::parse_yaml_key(ctx.scratch, ctx, it, end, false)) {
 5872|       |                                 if (std::string_view{ctx.scratch} != tag_v<V>) {
 5873|       |                                    ctx.error = error_code::feature_not_supported;
 5874|       |                                    ctx.custom_error_message =
 5875|       |                                       "the tag must be the first key for a custom variant alternative";
 5876|       |                                 }
 5877|       |                                 else {
 5878|       |                                    yaml::skip_inline_ws(it, end);
 5879|       |                                    if (it == end || *it != ':') {
 5880|       |                                       ctx.error = error_code::syntax_error;
 5881|       |                                    }
 5882|       |                                    else {
 5883|       |                                       ++it;
 5884|       |                                       yaml::skip_inline_ws(it, end);
 5885|       |                                       yaml::skip_unknown_block_value<Opts>(ctx, it, end, mapping_column);
 5886|       |                                       if (!bool(ctx.error)) {
 5887|       |                                          // If nothing but trailing whitespace/comments remains, the tag
 5888|       |                                          // was the whole mapping: leave the alternative default.
 5889|       |                                          auto probe = it;
 5890|       |                                          yaml::skip_ws_newlines_comments(probe, end);
 5891|       |                                          if (probe == end) {
 5892|       |                                             it = probe;
 5893|       |                                          }
 5894|       |                                          else {
 5895|       |                                             // Publish the mapping's column so the custom handler's block
 5896|       |                                             // mapping (which would otherwise discover its own indent) reads
 5897|       |                                             // the remaining entries at the variant's indent and dedents
 5898|       |                                             // correctly in every context (root, sequence, nested).
 5899|       |                                             ctx.forced_block_mapping_indent = mapping_column;
 5900|       |                                             from<YAML, Alt>::template op<Opts>(alt, ctx, it, end);
 5901|       |                                             ctx.forced_block_mapping_indent = -1;
 5902|       |                                          }
 5903|       |                                       }
 5904|       |                                    }
 5905|       |                                 }
 5906|       |                              }
 5907|       |                           }
 5908|       |                        }
 5909|       |                        else {
 5910|       |                           // Non-object alternative (e.g. std::monostate): the emplaced default is
 5911|       |                           // the value, but the mapping must still be consumed.
 5912|       |                           walk_tagged_mapping<Opts>(
 5913|       |                              ctx, it, end, tag_v<V>, mapping_column,
 5914|       |                              [&](auto&& c, auto&& i, auto&& e, int32_t line_indent, bool in_flow) {
 5915|       |                                 yaml::skip_yaml_value<Opts>(c, i, e, in_flow ? 0 : line_indent, in_flow);
 5916|       |                              });
 5917|       |                        }
 5918|       |                     },
 5919|       |                     value);
 5920|       |                  ctx.pop_indent();
 5921|       |                  return;
 5922|       |               }
 5923|       |               // No resolvable tag key was found. Fall through to structural deduction:
 5924|       |               // if the alternatives are distinguishable by their fields this still succeeds,
 5925|       |               // otherwise the deduction path reports no_matching_variant_type.
 5926|       |            }
 5927|       |         }
 5928|       |
 5929|  1.99M|         if constexpr (yaml_variant_is_auto_deducible<std::remove_cvref_t<T>>()) {
 5930|  1.99M|            using V = std::remove_cvref_t<T>;
 5931|  1.99M|            using counts = yaml_variant_type_count<V>;
 5932|  1.99M|            const char c = *it;
 5933|  1.99M|            auto is_plain_scalar_boundary = [](const char ch) {
 5934|  1.99M|               switch (ch) {
 5935|  1.99M|               case ' ':
 5936|  1.99M|               case '\t':
 5937|  1.99M|               case '\n':
 5938|  1.99M|               case '\r':
 5939|  1.99M|               case ',':
 5940|  1.99M|               case ']':
 5941|  1.99M|               case '}':
 5942|  1.99M|                  return true;
 5943|  1.99M|               default:
 5944|  1.99M|                  return false;
 5945|  1.99M|               }
 5946|  1.99M|            };
 5947|       |
 5948|  1.99M|            auto has_indented_block_continuation = [&](auto word_end) {
 5949|  1.99M|               if constexpr (yaml::check_flow_context(Opts)) {
 5950|  1.99M|                  return false;
 5951|  1.99M|               }
 5952|  1.99M|               if (ctx.current_indent() < 0) {
 5953|  1.99M|                  return false;
 5954|  1.99M|               }
 5955|  1.99M|               if (word_end == end || (*word_end != '\n' && *word_end != '\r')) {
 5956|  1.99M|                  return false;
 5957|  1.99M|               }
 5958|       |
 5959|  1.99M|               auto look = word_end;
 5960|  1.99M|               yaml::skip_newline(look, end);
 5961|  1.99M|               while (look != end) {
 5962|  1.99M|                  int32_t line_indent = 0;
 5963|  1.99M|                  while (look != end && *look == ' ') {
 5964|  1.99M|                     ++line_indent;
 5965|  1.99M|                     ++look;
 5966|  1.99M|                  }
 5967|  1.99M|                  if (look != end && *look == '\t') {
 5968|  1.99M|                     return false;
 5969|  1.99M|                  }
 5970|  1.99M|                  if (look == end || *look == '\n' || *look == '\r') {
 5971|  1.99M|                     if (look != end) {
 5972|  1.99M|                        yaml::skip_newline(look, end);
 5973|  1.99M|                        continue;
 5974|  1.99M|                     }
 5975|  1.99M|                     return false;
 5976|  1.99M|                  }
 5977|  1.99M|                  if (*look == '#') {
 5978|  1.99M|                     yaml::skip_comment(look, end);
 5979|  1.99M|                     if (look != end && (*look == '\n' || *look == '\r')) {
 5980|  1.99M|                        yaml::skip_newline(look, end);
 5981|  1.99M|                        continue;
 5982|  1.99M|                     }
 5983|  1.99M|                     return false;
 5984|  1.99M|                  }
 5985|       |
 5986|       |                  // If the next non-empty line is an implicit mapping entry,
 5987|       |                  // don't treat it as scalar continuation for auto-deduced
 5988|       |                  // booleans/nulls.
 5989|  1.99M|                  {
 5990|  1.99M|                     auto scan = look;
 5991|  1.99M|                     while (scan != end && *scan != '\n' && *scan != '\r') {
 5992|  1.99M|                        if (*scan == ':') {
 5993|  1.99M|                           auto after_colon = scan + 1;
 5994|  1.99M|                           if (after_colon == end || *after_colon == ' ' || *after_colon == '\t' ||
 5995|  1.99M|                               *after_colon == '\n' || *after_colon == '\r') {
 5996|  1.99M|                              return false;
 5997|  1.99M|                           }
 5998|  1.99M|                        }
 5999|  1.99M|                        ++scan;
 6000|  1.99M|                     }
 6001|  1.99M|                  }
 6002|       |
 6003|  1.99M|                  return line_indent > ctx.current_indent();
 6004|  1.99M|               }
 6005|  1.99M|               return false;
 6006|  1.99M|            };
 6007|  1.99M|            auto is_word_boundary = [&](const auto ptr) {
 6008|  1.99M|               if (ptr == end) {
 6009|  1.99M|                  return true;
 6010|  1.99M|               }
 6011|  1.99M|               if (*ptr == ':') {
 6012|  1.99M|                  auto next = ptr + 1;
 6013|  1.99M|                  return (next == end) || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
 6014|  1.99M|               }
 6015|  1.99M|               return is_plain_scalar_boundary(*ptr);
 6016|  1.99M|            };
 6017|       |
 6018|  1.99M|            switch (c) {
 6019|   354k|            case '&': {
  ------------------
  |  Branch (6019:13): [True: 354k, False: 1.63M]
  ------------------
 6020|       |               // Anchor before value: parse name, then re-dispatch
 6021|   354k|               ++it;
 6022|   354k|               auto aname = yaml::parse_anchor_name(it, end);
 6023|   354k|               if (aname.empty()) {
  ------------------
  |  Branch (6023:20): [True: 325, False: 354k]
  ------------------
 6024|    325|                  ctx.error = error_code::syntax_error;
 6025|    325|                  return;
 6026|    325|               }
 6027|   354k|               yaml::skip_inline_ws(it, end);
 6028|   354k|               bool anchor_on_same_line = true;
 6029|   354k|               bool value_is_indentless_sequence = false;
 6030|   354k|               if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (6030:20): [True: 3.66k, False: 350k]
  |  Branch (6030:33): [True: 25.5k, False: 325k]
  |  Branch (6030:48): [True: 39.9k, False: 285k]
  |  Branch (6030:63): [True: 17.1k, False: 268k]
  ------------------
 6031|       |                  // Anchor followed by end-of-line. Check if the value continues on the
 6032|       |                  // next line (indented past current context) or if this is an empty node.
 6033|  86.3k|                  bool value_on_next_line = false;
 6034|  86.3k|                  if (it != end) {
  ------------------
  |  Branch (6034:23): [True: 82.6k, False: 3.66k]
  ------------------
 6035|  82.6k|                     auto peek = it;
 6036|       |                     // Skip comment if present
 6037|  82.6k|                     if (*peek == '#') {
  ------------------
  |  Branch (6037:26): [True: 17.1k, False: 65.4k]
  ------------------
 6038|   212k|                        while (peek != end && *peek != '\n' && *peek != '\r') ++peek;
  ------------------
  |  Branch (6038:32): [True: 211k, False: 1.32k]
  |  Branch (6038:47): [True: 205k, False: 6.19k]
  |  Branch (6038:64): [True: 195k, False: 9.63k]
  ------------------
 6039|  17.1k|                     }
 6040|       |                     // Skip newline
 6041|  82.6k|                     if (peek != end && (*peek == '\n' || *peek == '\r')) {
  ------------------
  |  Branch (6041:26): [True: 81.3k, False: 1.32k]
  |  Branch (6041:42): [True: 31.7k, False: 49.5k]
  |  Branch (6041:59): [True: 49.5k, False: 0]
  ------------------
 6042|  81.3k|                        yaml::skip_newline(peek, end);
 6043|       |                        // Skip blank lines
 6044|   132k|                        while (peek != end && (*peek == '\n' || *peek == '\r')) {
  ------------------
  |  Branch (6044:32): [True: 126k, False: 5.69k]
  |  Branch (6044:48): [True: 37.4k, False: 89.0k]
  |  Branch (6044:65): [True: 13.3k, False: 75.6k]
  ------------------
 6045|  50.8k|                           yaml::skip_newline(peek, end);
 6046|  50.8k|                        }
 6047|       |                        // Measure indent of next content line
 6048|  81.3k|                        int32_t next_indent = 0;
 6049|   505k|                        while (peek != end && *peek == ' ') {
  ------------------
  |  Branch (6049:32): [True: 498k, False: 6.77k]
  |  Branch (6049:47): [True: 423k, False: 74.5k]
  ------------------
 6050|   423k|                           ++next_indent;
 6051|   423k|                           ++peek;
 6052|   423k|                        }
 6053|  81.3k|                        if (peek != end && *peek != '\n' && *peek != '\r') {
  ------------------
  |  Branch (6053:29): [True: 74.5k, False: 6.77k]
  |  Branch (6053:44): [True: 73.0k, False: 1.45k]
  |  Branch (6053:61): [True: 69.9k, False: 3.10k]
  ------------------
 6054|  69.9k|                           const bool indentless_sequence =
 6055|  69.9k|                              (!ctx.sequence_item_value_context) && (*peek == '-') &&
  ------------------
  |  Branch (6055:31): [True: 60.3k, False: 9.68k]
  |  Branch (6055:69): [True: 30.8k, False: 29.4k]
  ------------------
 6056|  30.8k|                              ((peek + 1) == end ||
  ------------------
  |  Branch (6056:32): [True: 814, False: 30.0k]
  ------------------
 6057|  30.0k|                               yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(peek + 1))]) &&
  ------------------
  |  Branch (6057:32): [True: 28.6k, False: 1.40k]
  ------------------
 6058|  29.4k|                              (next_indent == ctx.current_indent() ||
  ------------------
  |  Branch (6058:32): [True: 15.2k, False: 14.2k]
  ------------------
 6059|  14.2k|                               (ctx.current_indent() > 0 && (next_indent + 1) == ctx.current_indent()));
  ------------------
  |  Branch (6059:33): [True: 10.5k, False: 3.64k]
  |  Branch (6059:61): [True: 3.80k, False: 6.76k]
  ------------------
 6060|  69.9k|                           value_is_indentless_sequence = indentless_sequence;
 6061|  69.9k|                           const bool same_indent_property_node =
 6062|  69.9k|                              (next_indent == ctx.current_indent()) &&
  ------------------
  |  Branch (6062:31): [True: 25.9k, False: 44.0k]
  ------------------
 6063|  25.9k|                              (*peek == '!' || *peek == '&' || *peek == '*' || *peek == '[' || *peek == '{' ||
  ------------------
  |  Branch (6063:32): [True: 2.87k, False: 23.0k]
  |  Branch (6063:48): [True: 2.32k, False: 20.7k]
  |  Branch (6063:64): [True: 768, False: 19.9k]
  |  Branch (6063:80): [True: 796, False: 19.1k]
  |  Branch (6063:96): [True: 918, False: 18.2k]
  ------------------
 6064|  18.2k|                               *peek == '"' || *peek == '\'' || *peek == '|' || *peek == '>');
  ------------------
  |  Branch (6064:32): [True: 816, False: 17.4k]
  |  Branch (6064:48): [True: 507, False: 16.9k]
  |  Branch (6064:65): [True: 675, False: 16.2k]
  |  Branch (6064:81): [True: 162, False: 16.1k]
  ------------------
 6065|  69.9k|                           value_on_next_line =
 6066|  69.9k|                              (next_indent > ctx.current_indent()) || indentless_sequence || same_indent_property_node;
  ------------------
  |  Branch (6066:31): [True: 29.1k, False: 40.8k]
  |  Branch (6066:71): [True: 19.0k, False: 21.8k]
  |  Branch (6066:94): [True: 9.84k, False: 12.0k]
  ------------------
 6067|  69.9k|                        }
 6068|  81.3k|                     }
 6069|  82.6k|                  }
 6070|  86.3k|                  if (!value_on_next_line) {
  ------------------
  |  Branch (6070:23): [True: 28.3k, False: 57.9k]
  ------------------
 6071|       |                     // Anchor on empty/null node — store empty span, leave value as default
 6072|  28.3k|                     ctx.anchors[std::string(aname)] = {&*it, &*it, ctx.current_indent()};
 6073|  28.3k|                     return;
 6074|  28.3k|                  }
 6075|       |                  // Value is on next line — advance past newline/blank lines to the content
 6076|  57.9k|                  if (*it == '#') {
  ------------------
  |  Branch (6076:23): [True: 11.6k, False: 46.3k]
  ------------------
 6077|   126k|                     while (it != end && *it != '\n' && *it != '\r') ++it;
  ------------------
  |  Branch (6077:29): [True: 126k, False: 0]
  |  Branch (6077:42): [True: 122k, False: 3.74k]
  |  Branch (6077:57): [True: 115k, False: 7.91k]
  ------------------
 6078|  11.6k|                  }
 6079|  57.9k|                  if (it != end) yaml::skip_newline(it, end);
  ------------------
  |  Branch (6079:23): [True: 57.9k, False: 0]
  ------------------
 6080|   102k|                  while (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (6080:26): [True: 102k, False: 0]
  |  Branch (6080:40): [True: 36.2k, False: 66.7k]
  |  Branch (6080:55): [True: 8.73k, False: 57.9k]
  ------------------
 6081|  45.0k|                     yaml::skip_newline(it, end);
 6082|  45.0k|                  }
 6083|  57.9k|                  yaml::skip_inline_ws(it, end);
 6084|  57.9k|                  anchor_on_same_line = false;
 6085|  57.9k|               }
 6086|       |
 6087|   326k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6088|   326k|                  if (anchor_on_same_line && *it == '-' &&
  ------------------
  |  Branch (6088:23): [True: 268k, False: 57.9k]
  |  Branch (6088:46): [True: 24.4k, False: 243k]
  ------------------
 6089|  24.4k|                      ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))])) {
  ------------------
  |  Branch (6089:24): [True: 7, False: 24.4k]
  |  Branch (6089:43): [True: 10, False: 24.4k]
  ------------------
 6090|       |                     // "&anchor - item" is malformed in block context.
 6091|     17|                     ctx.error = error_code::syntax_error;
 6092|     17|                     return;
 6093|     17|                  }
 6094|   326k|               }
 6095|       |
 6096|       |               // Anchor on alias (&anchor *alias) is invalid per YAML spec.
 6097|       |               // But alias-as-key (&anchor *alias : value) is valid.
 6098|   326k|               if (it != end && *it == '*' && !yaml::alias_token_is_mapping_key(it, end)) {
  ------------------
  |  Branch (6098:20): [True: 326k, False: 37]
  |  Branch (6098:33): [True: 1.77k, False: 324k]
  |  Branch (6098:47): [True: 285, False: 1.48k]
  ------------------
 6099|    285|                  ctx.error = error_code::syntax_error;
 6100|    285|                  return;
 6101|    285|               }
 6102|       |
 6103|   325k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6104|   325k|                  if (!anchor_on_same_line && it != end && *it == '&') {
  ------------------
  |  Branch (6104:23): [True: 57.9k, False: 267k]
  |  Branch (6104:47): [True: 57.9k, False: 20]
  |  Branch (6104:60): [True: 3.95k, False: 53.9k]
  ------------------
 6105|  3.95k|                     auto probe = it + 1;
 6106|  3.95k|                     auto nested_anchor_name = yaml::parse_anchor_name(probe, end);
 6107|  3.95k|                     if (nested_anchor_name.empty()) {
  ------------------
  |  Branch (6107:26): [True: 49, False: 3.90k]
  ------------------
 6108|     49|                        ctx.error = error_code::syntax_error;
 6109|     49|                        return;
 6110|     49|                     }
 6111|  3.90k|                     yaml::skip_inline_ws(probe, end);
 6112|       |                     // Allow nested anchor usage only when it clearly starts a
 6113|       |                     // nested mapping entry ("&k key: value"). Otherwise this is
 6114|       |                     // a second anchor on the same node (4JVG-style), which is invalid.
 6115|  3.90k|                     if (!yaml::line_could_be_block_mapping(probe, end)) {
  ------------------
  |  Branch (6115:26): [True: 216, False: 3.69k]
  ------------------
 6116|    216|                        ctx.error = error_code::syntax_error;
 6117|    216|                        return;
 6118|    216|                     }
 6119|  3.90k|                  }
 6120|   325k|               }
 6121|       |
 6122|   325k|               const char* anchor_start = &*it;
 6123|   325k|               const int32_t anchor_indent = ctx.current_indent();
 6124|       |
 6125|   325k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6126|       |                  // Check if the anchor is on a block-mapping key (&name key: value).
 6127|       |                  // Only when the anchor and key are on the SAME line — if the value was on the
 6128|       |                  // next line, the anchor applies to the entire next-line content.
 6129|   325k|                  if (anchor_on_same_line && yaml::line_could_be_block_mapping(it, end)) {
  ------------------
  |  Branch (6129:23): [True: 267k, False: 57.9k]
  |  Branch (6129:46): [True: 122k, False: 145k]
  ------------------
 6130|   122k|                     auto key_start = it;
 6131|   122k|                     if (*key_start == '!') {
  ------------------
  |  Branch (6131:26): [True: 4.38k, False: 118k]
  ------------------
 6132|  4.38k|                        const auto key_tag = yaml::parse_yaml_tag(key_start, end, ctx);
 6133|  4.38k|                        if (key_tag == yaml::yaml_tag::unknown || !yaml::tag_valid_for_string(key_tag)) {
  ------------------
  |  Branch (6133:29): [True: 10, False: 4.37k]
  |  Branch (6133:67): [True: 20, False: 4.35k]
  ------------------
 6134|     30|                           ctx.error = error_code::syntax_error;
 6135|     30|                           return;
 6136|     30|                        }
 6137|  4.35k|                        yaml::skip_inline_ws(key_start, end);
 6138|  4.35k|                        if (key_start == end) {
  ------------------
  |  Branch (6138:29): [True: 7, False: 4.34k]
  ------------------
 6139|      7|                           ctx.error = error_code::unexpected_end;
 6140|      7|                           return;
 6141|      7|                        }
 6142|  4.34k|                        if (*key_start == '\n' || *key_start == '\r') {
  ------------------
  |  Branch (6142:29): [True: 6, False: 4.33k]
  |  Branch (6142:51): [True: 9, False: 4.32k]
  ------------------
 6143|     15|                           ctx.error = error_code::syntax_error;
 6144|     15|                           return;
 6145|     15|                        }
 6146|       |
 6147|       |                        // Re-apply the anchor-on-alias rule now that the tag is consumed. The
 6148|       |                        // check above ran before the tag, so "&anchor !tag *alias" reached the
 6149|       |                        // key-span registration below while the untagged spelling was rejected;
 6150|       |                        // an alias node carries no other properties either way.
 6151|  4.32k|                        if (*key_start == '*' && !yaml::alias_token_is_mapping_key(key_start, end)) {
  ------------------
  |  Branch (6151:29): [True: 573, False: 3.75k]
  |  Branch (6151:50): [True: 14, False: 559]
  ------------------
 6152|     14|                           ctx.error = error_code::syntax_error;
 6153|     14|                           return;
 6154|     14|                        }
 6155|  4.32k|                     }
 6156|       |
 6157|       |                     // Find the key span by scanning to the key-value separator
 6158|   122k|                     auto key_scan = key_start;
 6159|   122k|                     auto key_end = key_start;
 6160|   122k|                     if (*key_scan == '"' || *key_scan == '\'') {
  ------------------
  |  Branch (6160:26): [True: 1.59k, False: 121k]
  |  Branch (6160:46): [True: 942, False: 120k]
  ------------------
 6161|       |                        // Quoted key: skip to closing quote
 6162|  2.53k|                        const char quote = *key_scan;
 6163|  2.53k|                        ++key_scan;
 6164|  18.5k|                        while (key_scan != end && *key_scan != quote) {
  ------------------
  |  Branch (6164:32): [True: 18.5k, False: 4]
  |  Branch (6164:51): [True: 16.0k, False: 2.53k]
  ------------------
 6165|  16.0k|                           if (*key_scan == '\\' && quote == '"') {
  ------------------
  |  Branch (6165:32): [True: 1.52k, False: 14.4k]
  |  Branch (6165:53): [True: 668, False: 855]
  ------------------
 6166|    668|                              ++key_scan;
 6167|    668|                              if (key_scan != end) ++key_scan;
  ------------------
  |  Branch (6167:35): [True: 668, False: 0]
  ------------------
 6168|    668|                           }
 6169|  15.3k|                           else {
 6170|  15.3k|                              ++key_scan;
 6171|  15.3k|                           }
 6172|  16.0k|                        }
 6173|  2.53k|                        if (key_scan == end) {
  ------------------
  |  Branch (6173:29): [True: 4, False: 2.53k]
  ------------------
 6174|      4|                           ctx.error = error_code::syntax_error;
 6175|      4|                           return;
 6176|      4|                        }
 6177|  2.53k|                        ++key_scan; // past closing quote
 6178|  2.53k|                        key_end = key_scan;
 6179|  2.53k|                        yaml::skip_inline_ws(key_scan, end);
 6180|  2.53k|                     }
 6181|   120k|                     else {
 6182|       |                        // Plain key: scan to ':'
 6183|  1.75M|                        while (key_scan != end) {
  ------------------
  |  Branch (6183:32): [True: 1.75M, False: 36]
  ------------------
 6184|  1.75M|                           if (*key_scan == ':') {
  ------------------
  |  Branch (6184:32): [True: 211k, False: 1.54M]
  ------------------
 6185|   211k|                              auto next = key_scan + 1;
 6186|   211k|                              if (next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r') {
  ------------------
  |  Branch (6186:35): [True: 17.5k, False: 194k]
  |  Branch (6186:50): [True: 85.1k, False: 109k]
  |  Branch (6186:66): [True: 4.48k, False: 104k]
  |  Branch (6186:83): [True: 7.57k, False: 97.0k]
  |  Branch (6186:100): [True: 5.39k, False: 91.6k]
  ------------------
 6187|   120k|                                 break;
 6188|   120k|                              }
 6189|   211k|                           }
 6190|  1.63M|                           ++key_scan;
 6191|  1.63M|                        }
 6192|   120k|                        key_end = key_scan;
 6193|   141k|                        while (key_end != key_start && (*(key_end - 1) == ' ' || *(key_end - 1) == '\t')) {
  ------------------
  |  Branch (6193:32): [True: 134k, False: 6.71k]
  |  Branch (6193:57): [True: 19.7k, False: 115k]
  |  Branch (6193:82): [True: 1.60k, False: 113k]
  ------------------
 6194|  21.3k|                           --key_end;
 6195|  21.3k|                        }
 6196|   120k|                     }
 6197|   122k|                     if (key_scan == end || *key_scan != ':') {
  ------------------
  |  Branch (6197:26): [True: 37, False: 122k]
  |  Branch (6197:45): [True: 62, False: 122k]
  ------------------
 6198|     99|                        ctx.error = error_code::syntax_error;
 6199|     99|                        return;
 6200|     99|                     }
 6201|       |                     // Store anchor with just the key text span
 6202|   122k|                     ctx.anchors[std::string(aname)] = {&*key_start, &*key_end, anchor_indent};
 6203|   122k|                     it = key_start;
 6204|       |                     // Parse as an object alternative so complex keys (e.g. flow collections) stay in mapping context.
 6205|   122k|                     if constexpr (counts::n_object > 0) {
 6206|   122k|                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6207|   122k|                                                                                                        end);
 6208|       |                     }
 6209|       |                     else {
 6210|       |                        redispatch<Opts>(value, ctx, it, end);
 6211|       |                     }
 6212|   122k|                     return;
 6213|   122k|                  }
 6214|   325k|               }
 6215|       |
 6216|   203k|               const bool prev_allow_indentless_sequence = ctx.allow_indentless_sequence;
 6217|   325k|               ctx.allow_indentless_sequence = value_is_indentless_sequence;
 6218|   325k|               redispatch<Opts>(value, ctx, it, end);
 6219|   325k|               ctx.allow_indentless_sequence = prev_allow_indentless_sequence;
 6220|   325k|               if (!bool(ctx.error)) {
  ------------------
  |  Branch (6220:20): [True: 191k, False: 134k]
  ------------------
 6221|   191k|                  ctx.anchors[std::string(aname)] = {anchor_start, &*it, anchor_indent};
 6222|   191k|               }
 6223|   325k|               return;
 6224|   326k|            }
 6225|   258k|            case '*': {
  ------------------
  |  Branch (6225:13): [True: 258k, False: 1.73M]
  ------------------
 6226|       |               // In block context, "*alias : value" starts a mapping with an alias key.
 6227|   258k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6228|   258k|                  if (yaml::alias_token_is_mapping_key(it, end)) {
  ------------------
  |  Branch (6228:23): [True: 15.7k, False: 243k]
  ------------------
 6229|  15.7k|                     if constexpr (counts::n_object > 0) {
 6230|  15.7k|                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6231|  15.7k|                                                                                                        end);
 6232|  15.7k|                        return;
 6233|       |                     }
 6234|       |                     else {
 6235|       |                        ctx.error = error_code::syntax_error;
 6236|       |                        return;
 6237|       |                     }
 6238|  15.7k|                  }
 6239|   258k|               }
 6240|       |
 6241|       |               // Alias value: look up anchor and replay
 6242|      0|               yaml::handle_alias<Opts>(value, ctx, it, end);
 6243|   258k|               return;
 6244|   326k|            }
 6245|   236k|            case '!': {
  ------------------
  |  Branch (6245:13): [True: 236k, False: 1.75M]
  ------------------
 6246|       |               // Tag - parse it and dispatch based on tag type
 6247|   236k|               const auto tag = yaml::parse_yaml_tag(it, end, ctx);
 6248|   236k|               if (tag == yaml::yaml_tag::unknown) {
  ------------------
  |  Branch (6248:20): [True: 367, False: 236k]
  ------------------
 6249|    367|                  ctx.error = error_code::syntax_error;
 6250|    367|                  return;
 6251|    367|               }
 6252|   236k|               yaml::skip_inline_ws(it, end);
 6253|   236k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (6253:20): [True: 234k, False: 1.73k]
  |  Branch (6253:33): [True: 33.5k, False: 201k]
  ------------------
 6254|  33.5k|                  yaml::skip_comment(it, end);
 6255|  33.5k|               }
 6256|   236k|               if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (6256:20): [True: 233k, False: 2.72k]
  |  Branch (6256:34): [True: 40.6k, False: 193k]
  |  Branch (6256:49): [True: 29.7k, False: 163k]
  ------------------
 6257|  70.4k|                  auto content = it;
 6258|  70.4k|                  yaml::skip_newline(content, end);
 6259|  70.4k|                  yaml::skip_to_content(content, end);
 6260|       |
 6261|  70.4k|                  bool consume_following_content = false;
 6262|  70.4k|                  auto content_token = content;
 6263|  70.4k|                  if (content != end) {
  ------------------
  |  Branch (6263:23): [True: 66.4k, False: 3.99k]
  ------------------
 6264|  66.4k|                     auto indent_probe = content;
 6265|  66.4k|                     const int32_t content_indent = yaml::measure_indent<false>(indent_probe, end, ctx);
 6266|  66.4k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (6266:26): [True: 12, False: 66.4k]
  ------------------
 6267|     12|                        return;
 6268|  66.4k|                     content_token = indent_probe;
 6269|       |
 6270|       |                     // A tag at the end of a sequence/map entry has an empty value
 6271|       |                     // unless the next non-empty content is nested under the current node.
 6272|  66.4k|                     bool tagged_indentless_sequence = false;
 6273|  66.4k|                     if (tag == yaml::yaml_tag::seq && indent_probe != end && *indent_probe == '-') {
  ------------------
  |  Branch (6273:26): [True: 7.70k, False: 58.7k]
  |  Branch (6273:56): [True: 7.70k, False: 0]
  |  Branch (6273:79): [True: 6.62k, False: 1.08k]
  ------------------
 6274|  6.62k|                        const auto after_dash = indent_probe + 1;
 6275|  6.62k|                        if (after_dash == end ||
  ------------------
  |  Branch (6275:29): [True: 741, False: 5.87k]
  ------------------
 6276|  5.87k|                            yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_dash)]) {
  ------------------
  |  Branch (6276:29): [True: 4.60k, False: 1.27k]
  ------------------
 6277|  5.34k|                           tagged_indentless_sequence =
 6278|  5.34k|                              (content_indent == ctx.current_indent()) ||
  ------------------
  |  Branch (6278:31): [True: 1.64k, False: 3.69k]
  ------------------
 6279|  3.69k|                              (ctx.current_indent() > 0 && (content_indent + 1) == ctx.current_indent());
  ------------------
  |  Branch (6279:32): [True: 1.67k, False: 2.02k]
  |  Branch (6279:60): [True: 1.42k, False: 247]
  ------------------
 6280|  5.34k|                        }
 6281|  6.62k|                     }
 6282|       |
 6283|  66.4k|                     consume_following_content = (ctx.current_indent() < 0) ||
  ------------------
  |  Branch (6283:50): [True: 4.16k, False: 62.2k]
  ------------------
 6284|  62.2k|                                                 (content_indent > ctx.current_indent()) || tagged_indentless_sequence;
  ------------------
  |  Branch (6284:50): [True: 15.0k, False: 47.1k]
  |  Branch (6284:93): [True: 3.07k, False: 44.0k]
  ------------------
 6285|  66.4k|                  }
 6286|       |
 6287|  70.4k|                  if (consume_following_content) {
  ------------------
  |  Branch (6287:23): [True: 22.3k, False: 48.0k]
  ------------------
 6288|  22.3k|                     it = content_token;
 6289|  22.3k|                  }
 6290|  48.0k|                  else {
 6291|  48.0k|                     if (tag == yaml::yaml_tag::str) {
  ------------------
  |  Branch (6291:26): [True: 6.17k, False: 41.8k]
  ------------------
 6292|  6.17k|                        if constexpr (counts::n_str > 0) {
 6293|  6.17k|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_str>;
 6294|  6.17k|                           using StrType = std::variant_alternative_t<first_idx, V>;
 6295|  6.17k|                           value = StrType{};
 6296|  6.17k|                           return;
 6297|  6.17k|                        }
 6298|  6.17k|                     }
 6299|  48.0k|                     if (tag == yaml::yaml_tag::null_tag) {
  ------------------
  |  Branch (6299:26): [True: 1.03k, False: 47.0k]
  ------------------
 6300|  1.03k|                        if constexpr (counts::n_null > 0) {
 6301|  1.03k|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6302|  1.03k|                           using NullType = std::variant_alternative_t<first_idx, V>;
 6303|  1.03k|                           if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6303:32): [True: 0, False: 1.03k]
  ------------------
 6304|  1.03k|                           return;
 6305|  1.03k|                        }
 6306|  1.03k|                     }
 6307|  48.0k|                     if (tag == yaml::yaml_tag::none) {
  ------------------
  |  Branch (6307:26): [True: 39.9k, False: 8.15k]
  ------------------
 6308|  39.9k|                        if constexpr (counts::n_null > 0) {
 6309|  39.9k|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6310|  39.9k|                           using NullType = std::variant_alternative_t<first_idx, V>;
 6311|  39.9k|                           if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6311:32): [True: 0, False: 39.9k]
  ------------------
 6312|  39.9k|                           return;
 6313|  39.9k|                        }
 6314|  39.9k|                     }
 6315|  48.0k|                  }
 6316|  70.4k|               }
 6317|   236k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6318|       |                  // In block context, a comma immediately after a tag token is malformed
 6319|       |                  // (e.g., "!!str, value"). Flow context has legitimate ", ] }" usage.
 6320|   236k|                  if (it != end && *it == ',') {
  ------------------
  |  Branch (6320:23): [True: 186k, False: 49.8k]
  |  Branch (6320:36): [True: 50, False: 186k]
  ------------------
 6321|     50|                     ctx.error = error_code::syntax_error;
 6322|     50|                     return;
 6323|     50|                  }
 6324|   236k|                  if constexpr (counts::n_object > 0) {
 6325|       |                     // Tagged keys like "!!str key: value" must parse as mappings.
 6326|   236k|                     const bool starts_block_sequence_entry =
 6327|   236k|                        (it != end && *it == '-') &&
  ------------------
  |  Branch (6327:26): [True: 186k, False: 49.8k]
  |  Branch (6327:39): [True: 10.8k, False: 175k]
  ------------------
 6328|  10.8k|                        ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
  ------------------
  |  Branch (6328:26): [True: 1.55k, False: 9.29k]
  |  Branch (6328:45): [True: 6.91k, False: 2.38k]
  ------------------
 6329|   236k|                     if (!starts_block_sequence_entry && yaml::line_could_be_block_mapping(it, end)) {
  ------------------
  |  Branch (6329:26): [True: 180k, False: 55.5k]
  |  Branch (6329:58): [True: 53.0k, False: 127k]
  ------------------
 6330|       |                        // Re-dispatch from the post-tag token so '&key key: val' is
 6331|       |                        // handled by the anchor-aware key path, not as a map-level anchor.
 6332|  53.0k|                        redispatch<Opts>(value, ctx, it, end);
 6333|  53.0k|                        return;
 6334|  53.0k|                     }
 6335|   236k|                  }
 6336|   236k|               }
 6337|   236k|               if (it == end) {
  ------------------
  |  Branch (6337:20): [True: 2.72k, False: 233k]
  ------------------
 6338|  2.72k|                  if (tag == yaml::yaml_tag::str) {
  ------------------
  |  Branch (6338:23): [True: 918, False: 1.80k]
  ------------------
 6339|    918|                     if constexpr (counts::n_str > 0) {
 6340|    918|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_str>;
 6341|    918|                        using StrType = std::variant_alternative_t<first_idx, V>;
 6342|    918|                        value = StrType{};
 6343|    918|                        return;
 6344|    918|                     }
 6345|    918|                  }
 6346|  2.72k|                  if (tag == yaml::yaml_tag::none) {
  ------------------
  |  Branch (6346:23): [True: 1.77k, False: 947]
  ------------------
 6347|  1.77k|                     if constexpr (counts::n_null > 0) {
 6348|  1.77k|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6349|  1.77k|                        using NullType = std::variant_alternative_t<first_idx, V>;
 6350|  1.77k|                        if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6350:29): [True: 0, False: 1.77k]
  ------------------
 6351|  1.77k|                        return;
 6352|  1.77k|                     }
 6353|  1.77k|                  }
 6354|      0|                  ctx.error = error_code::unexpected_end;
 6355|  2.72k|                  return;
 6356|  2.72k|               }
 6357|   233k|               switch (tag) {
 6358|  3.32k|               case yaml::yaml_tag::str:
  ------------------
  |  Branch (6358:16): [True: 3.32k, False: 230k]
  ------------------
 6359|  3.32k|                  process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6360|  3.32k|                  return;
 6361|  9.85k|               case yaml::yaml_tag::int_tag:
  ------------------
  |  Branch (6361:16): [True: 9.85k, False: 223k]
  ------------------
 6362|  10.2k|               case yaml::yaml_tag::float_tag:
  ------------------
  |  Branch (6362:16): [True: 382, False: 233k]
  ------------------
 6363|  10.2k|                  if constexpr (counts::n_num > 0) {
 6364|  10.2k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, ctx, it, end);
 6365|  10.2k|                     return;
 6366|       |                  }
 6367|       |                  else { // else used to fix MSVC unreachable code warning
 6368|       |                     ctx.error = error_code::syntax_error;
 6369|       |                     return;
 6370|       |                  }
 6371|  37.8k|               case yaml::yaml_tag::bool_tag:
  ------------------
  |  Branch (6371:16): [True: 27.6k, False: 206k]
  ------------------
 6372|  37.8k|                  if constexpr (counts::n_bool > 0) {
 6373|  37.8k|                     process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it, end);
 6374|  37.8k|                     return;
 6375|       |                  }
 6376|       |                  else { // else used to fix MSVC unreachable code warning
 6377|       |                     ctx.error = error_code::syntax_error;
 6378|       |                     return;
 6379|       |                  }
 6380|  38.7k|               case yaml::yaml_tag::null_tag:
  ------------------
  |  Branch (6380:16): [True: 900, False: 232k]
  ------------------
 6381|  38.7k|                  if constexpr (counts::n_null > 0) {
 6382|  38.7k|                     constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6383|  38.7k|                     using NullType = std::variant_alternative_t<first_idx, V>;
 6384|  38.7k|                     if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6384:26): [True: 0, False: 38.7k]
  ------------------
 6385|  38.7k|                     from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6386|  38.7k|                     return;
 6387|       |                  }
 6388|       |                  else { // else used to fix MSVC unreachable code warning
 6389|       |                     ctx.error = error_code::syntax_error;
 6390|       |                     return;
 6391|       |                  }
 6392|  52.0k|               case yaml::yaml_tag::map:
  ------------------
  |  Branch (6392:16): [True: 13.2k, False: 220k]
  ------------------
 6393|  52.0k|                  if constexpr (counts::n_object > 0) {
 6394|  52.0k|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6395|  52.0k|                                                                                                     end);
 6396|  52.0k|                     return;
 6397|       |                  }
 6398|       |                  else { // else used to fix MSVC unreachable code warning
 6399|       |                     ctx.error = error_code::syntax_error;
 6400|       |                     return;
 6401|       |                  }
 6402|  83.3k|               case yaml::yaml_tag::seq:
  ------------------
  |  Branch (6402:16): [True: 31.2k, False: 202k]
  ------------------
 6403|  83.3k|                  if constexpr (counts::n_array > 0) {
 6404|  83.3k|                     const bool prev_allow_indentless_sequence = ctx.allow_indentless_sequence;
 6405|  83.3k|                     if constexpr (!yaml::check_flow_context(Opts)) {
 6406|  83.3k|                        if (it != end && *it == '-') {
  ------------------
  |  Branch (6406:29): [True: 31.2k, False: 52.0k]
  |  Branch (6406:42): [True: 5.66k, False: 25.5k]
  ------------------
 6407|  5.66k|                           ctx.allow_indentless_sequence = true;
 6408|  5.66k|                        }
 6409|  83.3k|                     }
 6410|  83.3k|                     process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6411|  83.3k|                                                                                                    end);
 6412|  83.3k|                     ctx.allow_indentless_sequence = prev_allow_indentless_sequence;
 6413|  83.3k|                     return;
 6414|       |                  }
 6415|       |                  else { // else used to fix MSVC unreachable code warning
 6416|       |                     ctx.error = error_code::syntax_error;
 6417|       |                     return;
 6418|       |                  }
 6419|   130k|               default: {
  ------------------
  |  Branch (6419:16): [True: 46.8k, False: 186k]
  ------------------
 6420|       |                  // Explicit unknown/non-core tags disable implicit scalar resolution.
 6421|       |                  // Preserve collection kinds, otherwise treat as string content.
 6422|   130k|                  if (it != end && *it == '*') {
  ------------------
  |  Branch (6422:23): [True: 46.8k, False: 83.3k]
  |  Branch (6422:36): [True: 8.64k, False: 38.2k]
  ------------------
 6423|  8.64k|                     yaml::handle_alias<Opts>(value, ctx, it, end);
 6424|  8.64k|                     return;
 6425|  8.64k|                  }
 6426|       |
 6427|   121k|                  if constexpr (counts::n_array > 0) {
 6428|   121k|                     if (it != end && *it == '[') {
  ------------------
  |  Branch (6428:26): [True: 38.2k, False: 83.3k]
  |  Branch (6428:39): [True: 911, False: 37.3k]
  ------------------
 6429|    911|                        process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6430|    911|                                                                                                       end);
 6431|    911|                        return;
 6432|    911|                     }
 6433|   121k|                  }
 6434|   121k|                  if constexpr (counts::n_object > 0) {
 6435|   121k|                     if (it != end && *it == '{') {
  ------------------
  |  Branch (6435:26): [True: 37.3k, False: 84.2k]
  |  Branch (6435:39): [True: 995, False: 36.3k]
  ------------------
 6436|    995|                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6437|    995|                                                                                                        end);
 6438|    995|                        return;
 6439|    995|                     }
 6440|   121k|                  }
 6441|       |
 6442|   121k|                  if constexpr (!yaml::check_flow_context(Opts)) {
 6443|   121k|                     if constexpr (counts::n_array > 0) {
 6444|   121k|                        const bool starts_block_sequence_entry =
 6445|   121k|                           (it != end && *it == '-') &&
  ------------------
  |  Branch (6445:29): [True: 36.3k, False: 85.2k]
  |  Branch (6445:42): [True: 4.10k, False: 32.2k]
  ------------------
 6446|  4.10k|                           ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
  ------------------
  |  Branch (6446:29): [True: 818, False: 3.28k]
  |  Branch (6446:48): [True: 2.27k, False: 1.01k]
  ------------------
 6447|   121k|                        if (starts_block_sequence_entry) {
  ------------------
  |  Branch (6447:29): [True: 3.09k, False: 118k]
  ------------------
 6448|  3.09k|                           process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx,
 6449|  3.09k|                                                                                                          it, end);
 6450|  3.09k|                           return;
 6451|  3.09k|                        }
 6452|   121k|                     }
 6453|   121k|                     if constexpr (counts::n_object > 0) {
 6454|   121k|                        const bool starts_explicit_mapping_indicator =
 6455|   121k|                           (it != end && (*it == '?' || *it == ':')) &&
  ------------------
  |  Branch (6455:29): [True: 33.2k, False: 88.3k]
  |  Branch (6455:43): [True: 2.81k, False: 30.4k]
  |  Branch (6455:57): [True: 2.18k, False: 28.2k]
  ------------------
 6456|  5.00k|                           ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
  ------------------
  |  Branch (6456:29): [True: 982, False: 4.02k]
  |  Branch (6456:48): [True: 1.77k, False: 2.24k]
  ------------------
 6457|   121k|                        if (starts_explicit_mapping_indicator) {
  ------------------
  |  Branch (6457:29): [True: 2.76k, False: 118k]
  ------------------
 6458|  2.76k|                           process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx,
 6459|  2.76k|                                                                                                           it, end);
 6460|  2.76k|                           return;
 6461|  2.76k|                        }
 6462|   118k|                        if (yaml::line_could_be_block_mapping(it, end)) {
  ------------------
  |  Branch (6462:29): [True: 0, False: 118k]
  ------------------
 6463|      0|                           process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx,
 6464|      0|                                                                                                           it, end);
 6465|      0|                           return;
 6466|      0|                        }
 6467|   118k|                     }
 6468|   121k|                  }
 6469|       |
 6470|   121k|                  if constexpr (counts::n_str > 0) {
 6471|   121k|                     process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6472|   121k|                     return;
 6473|   121k|                  }
 6474|       |
 6475|       |                  // Fall back if no string alternative exists.
 6476|      0|                  redispatch<Opts>(value, ctx, it, end);
 6477|   121k|                  return;
 6478|   130k|               }
 6479|   233k|               }
 6480|      0|               return;
 6481|   233k|            }
 6482|  68.3k|            case '{':
  ------------------
  |  Branch (6482:13): [True: 68.3k, False: 1.92M]
  ------------------
 6483|  68.3k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6484|       |                  // In block context, "{...}: value" can be a complex mapping key.
 6485|  68.3k|                  if (ctx.current_indent() < 0 && yaml::line_could_be_block_mapping(it, end)) {
  ------------------
  |  Branch (6485:23): [True: 29.0k, False: 39.2k]
  |  Branch (6485:51): [True: 2.39k, False: 26.6k]
  ------------------
 6486|  2.39k|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6487|  2.39k|                                                                                                     end);
 6488|  2.39k|                     return;
 6489|  2.39k|                  }
 6490|  68.3k|               }
 6491|       |               // Flow mapping - object type
 6492|  65.9k|               process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it, end);
 6493|  68.3k|               return;
 6494|  82.8k|            case '[':
  ------------------
  |  Branch (6494:13): [True: 82.8k, False: 1.91M]
  ------------------
 6495|  82.8k|               if constexpr (!yaml::check_flow_context(Opts)) {
 6496|       |                  // In block context, "[...]: value" can be a complex mapping key.
 6497|  82.8k|                  if (ctx.current_indent() < 0 && yaml::line_could_be_block_mapping(it, end)) {
  ------------------
  |  Branch (6497:23): [True: 54.8k, False: 28.0k]
  |  Branch (6497:51): [True: 2.30k, False: 52.5k]
  ------------------
 6498|  2.30k|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6499|  2.30k|                                                                                                     end);
 6500|  2.30k|                     return;
 6501|  2.30k|                  }
 6502|  82.8k|               }
 6503|       |               // Flow sequence - array type
 6504|  80.5k|               process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it, end);
 6505|  82.8k|               return;
 6506|   232k|            case '?':
  ------------------
  |  Branch (6506:13): [True: 232k, False: 1.76M]
  ------------------
 6507|       |               // Explicit mapping key indicator ("? key")
 6508|   232k|               if ((end - it >= 2) && it[1] == '\t') {
  ------------------
  |  Branch (6508:20): [True: 232k, False: 33]
  |  Branch (6508:39): [True: 6, False: 232k]
  ------------------
 6509|      6|                  ctx.error = error_code::syntax_error;
 6510|      6|                  return;
 6511|      6|               }
 6512|   232k|               if ((end - it >= 2) && (it[1] == ' ' || it[1] == '\n' || it[1] == '\r')) {
  ------------------
  |  Branch (6512:20): [True: 232k, False: 33]
  |  Branch (6512:40): [True: 82.8k, False: 149k]
  |  Branch (6512:56): [True: 85.0k, False: 64.3k]
  |  Branch (6512:73): [True: 49.2k, False: 15.1k]
  ------------------
 6513|   217k|                  if constexpr (counts::n_object > 0) {
 6514|   217k|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6515|   217k|                                                                                                     end);
 6516|   217k|                     return;
 6517|   217k|                  }
 6518|   217k|               }
 6519|      0|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6520|   232k|               return;
 6521|     36|            case '%':
  ------------------
  |  Branch (6521:13): [True: 36, False: 1.99M]
  ------------------
 6522|       |               // Reserved directive indicator is not a plain scalar start.
 6523|     36|               ctx.error = error_code::syntax_error;
 6524|     36|               return;
 6525|  6.29k|            case '"':
  ------------------
  |  Branch (6525:13): [True: 6.29k, False: 1.98M]
  ------------------
 6526|  9.32k|            case '\'':
  ------------------
  |  Branch (6526:13): [True: 3.03k, False: 1.99M]
  ------------------
 6527|       |               // Could be a quoted string OR a quoted key in a block mapping
 6528|       |               // Try block mapping first (e.g., "key": value), then fall back to string
 6529|  9.32k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6530|  9.32k|               return;
 6531|  22.6k|            case 't':
  ------------------
  |  Branch (6531:13): [True: 22.6k, False: 1.97M]
  ------------------
 6532|  33.5k|            case 'T':
  ------------------
  |  Branch (6532:13): [True: 10.9k, False: 1.98M]
  ------------------
 6533|       |               // Could be "true", "True", "TRUE", or a key/string starting with t/T
 6534|  33.5k|               if constexpr (counts::n_bool > 0) {
 6535|  33.5k|                  if ((end - it >= 4) && ((it[1] == 'r' && it[2] == 'u' && it[3] == 'e') ||
  ------------------
  |  Branch (6535:23): [True: 30.8k, False: 2.75k]
  |  Branch (6535:44): [True: 23.6k, False: 7.12k]
  |  Branch (6535:60): [True: 21.2k, False: 2.45k]
  |  Branch (6535:76): [True: 18.9k, False: 2.28k]
  ------------------
 6536|  20.9k|                                          (it[1] == 'R' && it[2] == 'U' && it[3] == 'E'))) {
  ------------------
  |  Branch (6536:44): [True: 3.64k, False: 8.22k]
  |  Branch (6536:60): [True: 2.81k, False: 828]
  |  Branch (6536:76): [True: 2.00k, False: 807]
  ------------------
 6537|       |                     // Check what follows the word "true"
 6538|  20.9k|                     const auto after_true = it + 4;
 6539|  20.9k|                     const bool at_word_boundary = is_word_boundary(after_true);
 6540|       |
 6541|  20.9k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6541:26): [True: 20.1k, False: 763]
  ------------------
 6542|  20.1k|                        if (has_indented_block_continuation(after_true)) {
  ------------------
  |  Branch (6542:29): [True: 919, False: 19.2k]
  ------------------
 6543|    919|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6544|    919|                           return;
 6545|    919|                        }
 6546|       |                        // Check if this is a key (followed by ": ") rather than a boolean value
 6547|       |                        // "true: value" should parse as {true: value}, not as the boolean true
 6548|  19.2k|                        if ((end - it > 4) && it[4] == ':' &&
  ------------------
  |  Branch (6548:29): [True: 17.4k, False: 1.82k]
  |  Branch (6548:47): [True: 6.93k, False: 10.5k]
  ------------------
 6549|  6.93k|                            (end - it == 5 || it[5] == ' ' || it[5] == '\t' || it[5] == '\n' || it[5] == '\r')) {
  ------------------
  |  Branch (6549:30): [True: 2.71k, False: 4.22k]
  |  Branch (6549:47): [True: 1.52k, False: 2.70k]
  |  Branch (6549:63): [True: 774, False: 1.92k]
  |  Branch (6549:80): [True: 1.13k, False: 798]
  |  Branch (6549:97): [True: 798, False: 0]
  ------------------
 6550|       |                           // This is "true:" followed by space/tab/newline/end - treat as key
 6551|  6.93k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6552|  6.93k|                           return;
 6553|  6.93k|                        }
 6554|  12.3k|                        process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it,
 6555|  12.3k|                                                                                                      end);
 6556|  12.3k|                        return;
 6557|  19.2k|                     }
 6558|       |                     // "true" is followed by more characters (e.g., "True\b") - treat as string
 6559|  20.9k|                  }
 6560|  33.5k|               }
 6561|  13.3k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6562|  33.5k|               return;
 6563|  25.4k|            case 'f':
  ------------------
  |  Branch (6563:13): [True: 25.4k, False: 1.96M]
  ------------------
 6564|  41.5k|            case 'F':
  ------------------
  |  Branch (6564:13): [True: 16.1k, False: 1.97M]
  ------------------
 6565|       |               // Could be "false", "False", "FALSE", or a key/string starting with f/F
 6566|  41.5k|               if constexpr (counts::n_bool > 0) {
 6567|  41.5k|                  if ((end - it >= 5) && ((it[1] == 'a' && it[2] == 'l' && it[3] == 's' && it[4] == 'e') ||
  ------------------
  |  Branch (6567:23): [True: 40.6k, False: 869]
  |  Branch (6567:44): [True: 26.2k, False: 14.4k]
  |  Branch (6567:60): [True: 24.0k, False: 2.15k]
  |  Branch (6567:76): [True: 17.7k, False: 6.33k]
  |  Branch (6567:92): [True: 16.2k, False: 1.44k]
  ------------------
 6568|  24.4k|                                          (it[1] == 'A' && it[2] == 'L' && it[3] == 'S' && it[4] == 'E'))) {
  ------------------
  |  Branch (6568:44): [True: 4.30k, False: 20.1k]
  |  Branch (6568:60): [True: 3.53k, False: 774]
  |  Branch (6568:76): [True: 2.75k, False: 777]
  |  Branch (6568:92): [True: 1.83k, False: 920]
  ------------------
 6569|       |                     // Check what follows the word "false"
 6570|  18.1k|                     const auto after_false = it + 5;
 6571|  18.1k|                     const bool at_word_boundary = is_word_boundary(after_false);
 6572|       |
 6573|  18.1k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6573:26): [True: 16.2k, False: 1.83k]
  ------------------
 6574|  16.2k|                        if (has_indented_block_continuation(after_false)) {
  ------------------
  |  Branch (6574:29): [True: 1.06k, False: 15.2k]
  ------------------
 6575|  1.06k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6576|  1.06k|                           return;
 6577|  1.06k|                        }
 6578|       |                        // Check if this is a key (followed by ": ") rather than a boolean value
 6579|       |                        // "false: value" should parse as {false: value}, not as the boolean false
 6580|  15.2k|                        if ((end - it > 5) && it[5] == ':' &&
  ------------------
  |  Branch (6580:29): [True: 14.3k, False: 860]
  |  Branch (6580:47): [True: 4.74k, False: 9.59k]
  ------------------
 6581|  4.74k|                            (end - it == 6 || it[6] == ' ' || it[6] == '\t' || it[6] == '\n' || it[6] == '\r')) {
  ------------------
  |  Branch (6581:30): [True: 428, False: 4.32k]
  |  Branch (6581:47): [True: 693, False: 3.62k]
  |  Branch (6581:63): [True: 827, False: 2.80k]
  |  Branch (6581:80): [True: 758, False: 2.04k]
  |  Branch (6581:97): [True: 2.04k, False: 0]
  ------------------
 6582|       |                           // This is "false:" followed by space/tab/newline/end - treat as key
 6583|  4.74k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6584|  4.74k|                           return;
 6585|  4.74k|                        }
 6586|  10.4k|                        process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it,
 6587|  10.4k|                                                                                                      end);
 6588|  10.4k|                        return;
 6589|  15.2k|                     }
 6590|       |                     // "false" is followed by more characters (e.g., "False\b") - treat as string
 6591|  18.1k|                  }
 6592|  41.5k|               }
 6593|  25.2k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6594|  41.5k|               return;
 6595|  28.6k|            case 'n':
  ------------------
  |  Branch (6595:13): [True: 28.6k, False: 1.96M]
  ------------------
 6596|  58.9k|            case 'N':
  ------------------
  |  Branch (6596:13): [True: 30.3k, False: 1.96M]
  ------------------
 6597|       |               // Could be "null", "Null", "NULL", or a key/string starting with n/N
 6598|  58.9k|               if constexpr (counts::n_null > 0) {
 6599|  58.9k|                  if ((end - it >= 4) && ((it[1] == 'u' && it[2] == 'l' && it[3] == 'l') ||
  ------------------
  |  Branch (6599:23): [True: 58.2k, False: 721]
  |  Branch (6599:44): [True: 34.2k, False: 24.0k]
  |  Branch (6599:60): [True: 30.3k, False: 3.81k]
  |  Branch (6599:76): [True: 14.3k, False: 16.0k]
  ------------------
 6600|  43.9k|                                          (it[1] == 'U' && it[2] == 'L' && it[3] == 'L'))) {
  ------------------
  |  Branch (6600:44): [True: 21.6k, False: 22.3k]
  |  Branch (6600:60): [True: 19.9k, False: 1.69k]
  |  Branch (6600:76): [True: 18.9k, False: 948]
  ------------------
 6601|       |                     // Check what follows the word "null"
 6602|  33.3k|                     const auto after_null = it + 4;
 6603|  33.3k|                     const bool at_word_boundary = is_word_boundary(after_null);
 6604|       |
 6605|  33.3k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6605:26): [True: 28.9k, False: 4.34k]
  ------------------
 6606|  28.9k|                        if (has_indented_block_continuation(after_null)) {
  ------------------
  |  Branch (6606:29): [True: 935, False: 28.0k]
  ------------------
 6607|    935|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6608|    935|                           return;
 6609|    935|                        }
 6610|       |                        // Check if this is a key (followed by ": ") rather than a null value
 6611|       |                        // "null: value" should parse as {null: value}, not as the null type
 6612|  28.0k|                        if ((end - it > 4) && it[4] == ':' &&
  ------------------
  |  Branch (6612:29): [True: 26.9k, False: 1.14k]
  |  Branch (6612:47): [True: 3.91k, False: 22.9k]
  ------------------
 6613|  3.91k|                            (end - it == 5 || it[5] == ' ' || it[5] == '\t' || it[5] == '\n' || it[5] == '\r')) {
  ------------------
  |  Branch (6613:30): [True: 763, False: 3.15k]
  |  Branch (6613:47): [True: 745, False: 2.40k]
  |  Branch (6613:63): [True: 657, False: 1.74k]
  |  Branch (6613:80): [True: 1.05k, False: 697]
  |  Branch (6613:97): [True: 697, False: 0]
  ------------------
 6614|       |                           // This is "null:" followed by space/tab/newline/end - treat as key
 6615|  3.91k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6616|  3.91k|                           return;
 6617|  3.91k|                        }
 6618|  24.1k|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6619|  24.1k|                        using NullType = std::variant_alternative_t<first_idx, V>;
 6620|  24.1k|                        if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6620:29): [True: 0, False: 24.1k]
  ------------------
 6621|  24.1k|                        from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6622|  24.1k|                        return;
 6623|  28.0k|                     }
 6624|       |                     // "null" is followed by more characters (e.g., "Null\b") - treat as string
 6625|  33.3k|                  }
 6626|  58.9k|               }
 6627|  30.0k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6628|  58.9k|               return;
 6629|  4.51k|            case '~':
  ------------------
  |  Branch (6629:13): [True: 4.51k, False: 1.98M]
  ------------------
 6630|       |               // Null indicator
 6631|  4.51k|               if constexpr (counts::n_null > 0) {
 6632|  4.51k|                  constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6633|  4.51k|                  using NullType = std::variant_alternative_t<first_idx, V>;
 6634|  4.51k|                  if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6634:23): [True: 0, False: 4.51k]
  ------------------
 6635|  4.51k|                  from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6636|  4.51k|                  return;
 6637|  4.51k|               }
 6638|      0|               break; // Fall through to try other types
 6639|   128k|            case '-':
  ------------------
  |  Branch (6639:13): [True: 128k, False: 1.86M]
  ------------------
 6640|       |               // Could be negative number or block sequence indicator
 6641|   128k|               if (((it + 1) == end) || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(it[1])]) {
  ------------------
  |  Branch (6641:20): [True: 1.36k, False: 126k]
  |  Branch (6641:41): [True: 99.9k, False: 26.9k]
  ------------------
 6642|       |                  // Block sequence indicator "- "
 6643|   101k|                  if constexpr (counts::n_array > 0) {
 6644|   101k|                     process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6645|   101k|                                                                                                    end);
 6646|   101k|                     return;
 6647|   101k|                  }
 6648|   101k|               }
 6649|   128k|               if constexpr (counts::n_num > 0) {
 6650|   128k|                  if ((end - it >= 2) && (std::isdigit(static_cast<unsigned char>(it[1])) || it[1] == '.')) {
  ------------------
  |  Branch (6650:23): [True: 26.9k, False: 101k]
  |  Branch (6650:43): [True: 2.17k, False: 24.7k]
  |  Branch (6650:94): [True: 2.48k, False: 22.3k]
  ------------------
 6651|  4.65k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, ctx, it, end);
 6652|  4.65k|                     return;
 6653|  4.65k|                  }
 6654|   128k|               }
 6655|   123k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6656|   128k|               return;
 6657|  10.4k|            case '+':
  ------------------
  |  Branch (6657:13): [True: 10.4k, False: 1.98M]
  ------------------
 6658|  28.9k|            case '.':
  ------------------
  |  Branch (6658:13): [True: 18.4k, False: 1.97M]
  ------------------
 6659|       |               // Could be a number (.5, +5, .inf, etc.) or a string (.c, .cpp, +name, etc.)
 6660|       |               // Try parsing as number speculatively, fall back to string on failure
 6661|  28.9k|               if constexpr (counts::n_num > 0) {
 6662|  28.9k|                  auto start_it = it;
 6663|  28.9k|                  auto temp_ctx = ctx.make_speculative();
 6664|  28.9k|                  process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, temp_ctx, it,
 6665|  28.9k|                                                                                               end);
 6666|  28.9k|                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6667|  28.9k|                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6668|  28.9k|                  if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (6668:23): [True: 8.45k, False: 20.5k]
  ------------------
 6669|  8.45k|                     ctx.anchors = std::move(temp_ctx.anchors);
 6670|  8.45k|                     return; // Successfully parsed as number
 6671|  8.45k|                  }
 6672|  20.5k|                  it = start_it; // Restore and fall through to string
 6673|  20.5k|               }
 6674|      0|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6675|  28.9k|               return;
 6676|   454k|            default:
  ------------------
  |  Branch (6676:13): [True: 454k, False: 1.53M]
  ------------------
 6677|       |               // Check for digit (0-9) - numeric or block mapping key starting with digit
 6678|   454k|               if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (6678:20): [True: 316k, False: 138k]
  |  Branch (6678:32): [True: 91.9k, False: 224k]
  ------------------
 6679|       |                  // Try block mapping first (e.g., "123key: value")
 6680|  91.9k|                  if (try_parse_block_mapping_into_variant<V, Opts>(value, ctx, it, end)) {
  ------------------
  |  Branch (6680:23): [True: 28.6k, False: 63.2k]
  ------------------
 6681|  28.6k|                     return;
 6682|  28.6k|                  }
 6683|       |                  // Try numeric value speculatively - values like "12:30" look numeric but aren't
 6684|  63.2k|                  if constexpr (counts::n_num > 0) {
 6685|  63.2k|                     auto start_it = it;
 6686|  63.2k|                     auto temp_ctx = ctx.make_speculative();
 6687|  63.2k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, temp_ctx, it,
 6688|  63.2k|                                                                                                  end);
 6689|  63.2k|                     ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6690|  63.2k|                     ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6691|  63.2k|                     if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (6691:26): [True: 10.6k, False: 52.6k]
  ------------------
 6692|  10.6k|                        ctx.anchors = std::move(temp_ctx.anchors);
 6693|  10.6k|                        return; // Successfully parsed as number
 6694|  10.6k|                     }
 6695|  52.6k|                     it = start_it; // Restore and fall through to string
 6696|  52.6k|                  }
 6697|       |                  // Fall through to string
 6698|      0|                  process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6699|  63.2k|                  return;
 6700|  91.9k|               }
 6701|       |               // Plain scalar - try block mapping, then string
 6702|   362k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6703|   362k|               return;
 6704|  1.99M|            }
 6705|  1.99M|         }
 6706|       |
 6707|       |         // For non-auto-deducible variants or fallback, try each type until one succeeds
 6708|      0|         constexpr auto N = std::variant_size_v<std::remove_cvref_t<T>>;
 6709|       |
 6710|       |         // This fold discards each alternative's error and reports only that nothing fit, which
 6711|       |         // misdiagnoses a document that exhausted an expansion budget as merely the wrong shape.
 6712|       |         // Kept aside and used only if no alternative parsed, so a later one that does parse
 6713|       |         // (possible under a latched budget if it materializes no key text) is unaffected.
 6714|  1.99M|         error_code expansion_error{};
 6715|  1.99M|         std::string_view expansion_message{};
 6716|       |
 6717|  1.99M|         auto try_parse = [&]<size_t I>() -> bool {
 6718|  1.99M|            using V = std::variant_alternative_t<I, std::remove_cvref_t<T>>;
 6719|  1.99M|            auto start = it;
 6720|       |
 6721|  1.99M|            V v{};
 6722|  1.99M|            auto temp_ctx = ctx.make_speculative();
 6723|  1.99M|            from<YAML, V>::template op<Opts>(v, temp_ctx, it, end);
 6724|  1.99M|            ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6725|  1.99M|            ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6726|       |
 6727|  1.99M|            if (!bool(temp_ctx.error)) {
 6728|  1.99M|               value = std::move(v);
 6729|  1.99M|               ctx.anchors = std::move(temp_ctx.anchors);
 6730|  1.99M|               return true;
 6731|  1.99M|            }
 6732|       |
 6733|  1.99M|            if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 6734|  1.99M|               expansion_error = temp_ctx.error;
 6735|  1.99M|               expansion_message = temp_ctx.custom_error_message;
 6736|  1.99M|            }
 6737|  1.99M|            it = start;
 6738|  1.99M|            return false;
 6739|  1.99M|         };
 6740|       |
 6741|  1.99M|         bool parsed = false;
 6742|  1.99M|         [&]<size_t... Is>(std::index_sequence<Is...>) {
 6743|  1.99M|            ((parsed = parsed || try_parse.template operator()<Is>()), ...);
 6744|  1.99M|         }(std::make_index_sequence<N>{});
 6745|       |
 6746|  1.99M|         if (!parsed) {
  ------------------
  |  Branch (6746:14): [True: 0, False: 1.99M]
  ------------------
 6747|      0|            if (expansion_error != error_code::none) {
  ------------------
  |  Branch (6747:17): [True: 0, False: 0]
  ------------------
 6748|      0|               ctx.error = expansion_error;
 6749|      0|               ctx.custom_error_message = expansion_message;
 6750|      0|            }
 6751|      0|            else {
 6752|      0|               ctx.error = error_code::no_matching_variant_type;
 6753|      0|            }
 6754|      0|         }
 6755|  1.99M|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_22is_yaml_variant_objectEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERSH_TkNS_10is_contextERNSL_12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   814k|      {
 5356|   814k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   814k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   814k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   814k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   814k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 814k, False: 0]
  ------------------
 5366|   814k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   814k|      }
_ZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_:
 4660|   822k|      {
 4661|   822k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4661:14): [True: 0, False: 822k]
  ------------------
 4662|      0|            return;
 4663|       |
 4664|   822k|         yaml::node_preamble_state preamble{};
 4665|   822k|         if (yaml::parse_node_preamble<Opts, yaml::node_property_policy{true, true, false, false}>(
  ------------------
  |  Branch (4665:14): [True: 10.8k, False: 812k]
  ------------------
 4666|   822k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_map(tag); }))
 4667|  10.8k|            return;
 4668|       |
 4669|   812k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 4670|   812k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (4670:14): [True: 24, False: 812k]
  ------------------
 4671|     24|            return;
 4672|       |
 4673|   812k|         using key_t = typename std::remove_cvref_t<T>::key_type;
 4674|   812k|         using val_t = typename std::remove_cvref_t<T>::mapped_type;
 4675|       |
 4676|       |         // Reading a YAML mapping MERGES into the target: an entry overwrites the
 4677|       |         // value of a key that existed before the read and adds new keys, while
 4678|       |         // pre-existing keys the document does not mention are preserved (like a
 4679|       |         // struct/object read, and like json/read.hpp's per-key value[key]).
 4680|       |         // Within a single document a repeated key keeps its FIRST value -- YAML
 4681|       |         // mappings disallow duplicate keys and the conformance suite expects
 4682|       |         // first-wins, which falls out of emplace into an empty map. Any
 4683|       |         // pre-existing entry the document leaves untouched is restored on scope
 4684|       |         // exit (including error paths). When the target starts empty (the common
 4685|       |         // case) this is a no-op with negligible cost.
 4686|   812k|         std::remove_cvref_t<T> preexisting_entries;
 4687|   812k|         if (!value.empty()) {
  ------------------
  |  Branch (4687:14): [True: 0, False: 812k]
  ------------------
 4688|      0|            preexisting_entries = std::move(value);
 4689|      0|            value.clear();
 4690|      0|         }
 4691|   812k|         struct merge_restore_guard
 4692|   812k|         {
 4693|   812k|            std::remove_cvref_t<T>& target;
 4694|   812k|            std::remove_cvref_t<T>& saved;
 4695|   812k|            ~merge_restore_guard()
 4696|   812k|            {
 4697|       |               // emplace is a no-op for keys the document already wrote, so only
 4698|       |               // untouched pre-existing entries are put back.
 4699|   812k|               for (auto& entry : saved) {
 4700|   812k|                  target.emplace(entry.first, std::move(entry.second));
 4701|   812k|               }
 4702|   812k|            }
 4703|   812k|         } merge_restore{value, preexisting_entries};
 4704|       |
 4705|   812k|         const bool treat_as_block_mapping =
 4706|   812k|            !yaml::check_flow_context(Opts) && *it == '{' && yaml::inline_value_has_plain_mapping_indicator(it, end);
  ------------------
  |  Branch (4706:13): [True: 812k, Folded]
  |  Branch (4706:48): [True: 78.9k, False: 733k]
  |  Branch (4706:62): [True: 1.23k, False: 77.6k]
  ------------------
 4707|       |
 4708|   812k|         if (*it == '{' && !treat_as_block_mapping) {
  ------------------
  |  Branch (4708:14): [True: 78.9k, False: 733k]
  |  Branch (4708:28): [True: 77.6k, False: 1.23k]
  ------------------
 4709|       |            // Flow mapping
 4710|  77.6k|            ++it;
 4711|       |            // Skip whitespace and newlines after opening brace
 4712|  77.6k|            yaml::skip_ws_and_newlines(it, end);
 4713|       |
 4714|  77.6k|            if (it != end && *it == '}') {
  ------------------
  |  Branch (4714:17): [True: 76.4k, False: 1.21k]
  |  Branch (4714:30): [True: 11.1k, False: 65.2k]
  ------------------
 4715|  11.1k|               ++it;
 4716|  11.1k|               yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4717|  11.1k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4717:20): [True: 62, False: 11.1k]
  ------------------
 4718|     62|                  return;
 4719|  11.1k|               yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 4720|  11.1k|               return;
 4721|  11.1k|            }
 4722|       |
 4723|   215k|            while (it != end) {
  ------------------
  |  Branch (4723:20): [True: 210k, False: 5.66k]
  ------------------
 4724|       |               // Skip whitespace and newlines at start of each iteration
 4725|   210k|               yaml::skip_ws_and_newlines(it, end);
 4726|       |
 4727|   210k|               if (it != end && *it == '}') {
  ------------------
  |  Branch (4727:20): [True: 210k, False: 0]
  |  Branch (4727:33): [True: 8.71k, False: 201k]
  ------------------
 4728|  8.71k|                  ++it;
 4729|  8.71k|                  yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4730|  8.71k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4730:23): [True: 38, False: 8.67k]
  ------------------
 4731|     38|                     return;
 4732|  8.67k|                  break;
 4733|  8.71k|               }
 4734|       |
 4735|   201k|               bool explicit_flow_key = false;
 4736|   201k|               auto explicit_probe = it;
 4737|   201k|               yaml::skip_inline_ws(explicit_probe, end);
 4738|   201k|               if (explicit_probe != end && *explicit_probe == '?') {
  ------------------
  |  Branch (4738:20): [True: 201k, False: 0]
  |  Branch (4738:45): [True: 8.51k, False: 192k]
  ------------------
 4739|  8.51k|                  const auto after_q = explicit_probe + 1;
 4740|  8.51k|                  if (after_q == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_q)] ||
  ------------------
  |  Branch (4740:23): [True: 14, False: 8.50k]
  |  Branch (4740:41): [True: 3.42k, False: 5.07k]
  ------------------
 4741|  5.83k|                      *after_q == ',' || *after_q == '}') {
  ------------------
  |  Branch (4741:23): [True: 1.27k, False: 3.80k]
  |  Branch (4741:42): [True: 1.12k, False: 2.68k]
  ------------------
 4742|  5.83k|                     explicit_flow_key = true;
 4743|  5.83k|                     it = explicit_probe + 1;
 4744|  5.83k|                     yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4745|  5.83k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4745:26): [True: 6, False: 5.82k]
  ------------------
 4746|      6|                        return;
 4747|  5.83k|                  }
 4748|  8.51k|               }
 4749|       |               // Parse key
 4750|   201k|               key_t key{};
 4751|   201k|               if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 4752|   201k|                  if (explicit_flow_key && it != end && (*it == ':' || *it == ',' || *it == '}')) {
  ------------------
  |  Branch (4752:23): [True: 5.82k, False: 195k]
  |  Branch (4752:44): [True: 5.80k, False: 27]
  |  Branch (4752:58): [True: 1.24k, False: 4.55k]
  |  Branch (4752:72): [True: 1.95k, False: 2.59k]
  |  Branch (4752:86): [True: 1.12k, False: 1.47k]
  ------------------
 4753|  4.32k|                     key.clear();
 4754|  4.32k|                  }
 4755|   197k|                  else {
 4756|   197k|                     auto key_probe = it;
 4757|   197k|                     yaml::skip_inline_ws(key_probe, end);
 4758|       |
 4759|       |                     // Use full node parsing only for structurally complex flow keys.
 4760|       |                     // Plain/quoted/alias keys stay on parse_yaml_key() for compatibility.
 4761|   197k|                     bool parse_complex_flow_key = false;
 4762|   197k|                     if (key_probe != end) {
  ------------------
  |  Branch (4762:26): [True: 197k, False: 27]
  ------------------
 4763|   197k|                        if (*key_probe == '[' || *key_probe == '{') {
  ------------------
  |  Branch (4763:29): [True: 1.92k, False: 195k]
  |  Branch (4763:50): [True: 6.47k, False: 188k]
  ------------------
 4764|  8.40k|                           parse_complex_flow_key = true;
 4765|  8.40k|                        }
 4766|   188k|                        else if (*key_probe == '&') {
  ------------------
  |  Branch (4766:34): [True: 21.4k, False: 167k]
  ------------------
 4767|  21.4k|                           ++key_probe;
 4768|  21.4k|                           yaml::parse_anchor_name(key_probe, end);
 4769|  21.4k|                           yaml::skip_inline_ws(key_probe, end);
 4770|  21.4k|                           if (key_probe != end && (*key_probe == '[' || *key_probe == '{')) {
  ------------------
  |  Branch (4770:32): [True: 21.2k, False: 154]
  |  Branch (4770:53): [True: 1.40k, False: 19.8k]
  |  Branch (4770:74): [True: 2.38k, False: 17.4k]
  ------------------
 4771|  3.78k|                              parse_complex_flow_key = true;
 4772|  3.78k|                           }
 4773|  21.4k|                        }
 4774|   197k|                     }
 4775|       |
 4776|   197k|                     if (parse_complex_flow_key) {
  ------------------
  |  Branch (4776:26): [True: 12.1k, False: 184k]
  ------------------
 4777|  12.1k|                        glz::generic key_node{};
 4778|  12.1k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 4779|  12.1k|                        if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4779:29): [True: 3.19k, False: 8.99k]
  ------------------
 4780|  3.19k|                           return;
 4781|  8.99k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (4781:29): [True: 12, False: 8.98k]
  ------------------
 4782|     12|                           return;
 4783|  8.99k|                     }
 4784|   184k|                     else {
 4785|   184k|                        if (!yaml::parse_yaml_key(key, ctx, it, end, true)) {
  ------------------
  |  Branch (4785:29): [True: 8.96k, False: 175k]
  ------------------
 4786|  8.96k|                           return;
 4787|  8.96k|                        }
 4788|   184k|                     }
 4789|   197k|                  }
 4790|       |               }
 4791|       |               else {
 4792|       |                  if (explicit_flow_key && it != end && (*it == ':' || *it == ',' || *it == '}')) {
 4793|       |                     ctx.error = error_code::syntax_error;
 4794|       |                     return;
 4795|       |                  }
 4796|       |                  from<YAML, key_t>::template op<yaml::flow_context_on<Opts>()>(key, ctx, it, end);
 4797|       |                  if (bool(ctx.error)) [[unlikely]]
 4798|       |                     return;
 4799|       |               }
 4800|       |
 4801|       |               // Separation between flow key and ':' may include comments/newlines.
 4802|       |               // In flow context, newlines are allowed between key and ':'.
 4803|   189k|               yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4804|   201k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4804:20): [True: 13, False: 201k]
  ------------------
 4805|     13|                  return;
 4806|       |
 4807|   201k|               auto parse_implicit_null = [&](val_t& val) -> bool {
 4808|   201k|                  if constexpr (nullable_like<std::remove_cvref_t<val_t>>) {
 4809|   201k|                     val = {};
 4810|   201k|                     return true;
 4811|   201k|                  }
 4812|   201k|                  else if constexpr (std::same_as<std::remove_cvref_t<val_t>, glz::generic>) {
 4813|   201k|                     val = glz::generic{};
 4814|   201k|                     return true;
 4815|   201k|                  }
 4816|   201k|                  else {
 4817|   201k|                     static constexpr std::string_view null_value{"null"};
 4818|   201k|                     auto null_it = null_value.data();
 4819|   201k|                     const yaml::yaml_context::scoped_stream literal_stream{ctx, null_value.data()};
 4820|   201k|                     from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(
 4821|   201k|                        val, ctx, null_it, null_value.data() + null_value.size());
 4822|   201k|                     return !bool(ctx.error);
 4823|   201k|                  }
 4824|   201k|               };
 4825|       |
 4826|   201k|               if (it != end && (*it == ',' || *it == '}')) {
  ------------------
  |  Branch (4826:20): [True: 187k, False: 13.5k]
  |  Branch (4826:34): [True: 118k, False: 69.6k]
  |  Branch (4826:48): [True: 20.1k, False: 49.4k]
  ------------------
 4827|   138k|                  val_t val{};
 4828|   138k|                  if (!parse_implicit_null(val)) [[unlikely]]
  ------------------
  |  Branch (4828:23): [True: 0, False: 138k]
  ------------------
 4829|      0|                     return;
 4830|       |
 4831|   138k|                  value.emplace(std::move(key), std::move(val));
 4832|       |
 4833|   138k|                  if (*it == '}') {
  ------------------
  |  Branch (4833:23): [True: 20.1k, False: 118k]
  ------------------
 4834|  20.1k|                     ++it;
 4835|  20.1k|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4836|  20.1k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4836:26): [True: 121, False: 20.0k]
  ------------------
 4837|    121|                        return;
 4838|  20.0k|                     break;
 4839|  20.1k|                  }
 4840|       |
 4841|   118k|                  ++it; // skip comma
 4842|   118k|                  yaml::skip_ws_and_newlines(it, end);
 4843|   118k|                  continue;
 4844|   138k|               }
 4845|       |
 4846|  63.0k|               if (it == end || *it != ':') {
  ------------------
  |  Branch (4846:20): [True: 13.5k, False: 49.4k]
  |  Branch (4846:33): [True: 1.23k, False: 48.2k]
  ------------------
 4847|  2.65k|                  ctx.error = error_code::syntax_error;
 4848|  2.65k|                  return;
 4849|  2.65k|               }
 4850|  60.3k|               ++it;
 4851|       |
 4852|  60.3k|               yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4853|  60.3k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4853:20): [True: 9, False: 60.3k]
  ------------------
 4854|      9|                  return;
 4855|       |
 4856|       |               // Omitted value after an explicit ':' maps to an implicit null.
 4857|  60.3k|               if (it != end && (*it == ',' || *it == '}')) {
  ------------------
  |  Branch (4857:20): [True: 48.1k, False: 12.2k]
  |  Branch (4857:34): [True: 7.52k, False: 40.5k]
  |  Branch (4857:48): [True: 9.81k, False: 30.7k]
  ------------------
 4858|  17.3k|                  val_t val{};
 4859|  17.3k|                  if (!parse_implicit_null(val)) [[unlikely]]
  ------------------
  |  Branch (4859:23): [True: 0, False: 17.3k]
  ------------------
 4860|      0|                     return;
 4861|       |
 4862|  17.3k|                  value.emplace(std::move(key), std::move(val));
 4863|       |
 4864|  17.3k|                  if (*it == '}') {
  ------------------
  |  Branch (4864:23): [True: 9.81k, False: 7.52k]
  ------------------
 4865|  9.81k|                     ++it;
 4866|  9.81k|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4867|  9.81k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4867:26): [True: 14, False: 9.80k]
  ------------------
 4868|     14|                        return;
 4869|  9.80k|                     break;
 4870|  9.81k|                  }
 4871|       |
 4872|  7.52k|                  ++it; // skip comma
 4873|  7.52k|                  yaml::skip_ws_and_newlines(it, end);
 4874|  7.52k|                  continue;
 4875|  17.3k|               }
 4876|       |
 4877|       |               // Parse value
 4878|  43.0k|               val_t val{};
 4879|  43.0k|               from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(val, ctx, it, end);
 4880|  43.0k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4880:20): [True: 1.73k, False: 41.3k]
  ------------------
 4881|  1.73k|                  return;
 4882|       |
 4883|  41.3k|               value.emplace(std::move(key), std::move(val));
 4884|       |
 4885|  41.3k|               yaml::skip_inline_ws(it, end);
 4886|       |
 4887|  41.3k|               if (it != end && *it == '}') {
  ------------------
  |  Branch (4887:20): [True: 28.7k, False: 12.5k]
  |  Branch (4887:33): [True: 3.88k, False: 24.8k]
  ------------------
 4888|  3.88k|                  ++it;
 4889|  3.88k|                  yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4890|  3.88k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4890:23): [True: 64, False: 3.82k]
  ------------------
 4891|     64|                     return;
 4892|  3.82k|                  break;
 4893|  3.88k|               }
 4894|  37.4k|               else if (it != end && *it == ',') {
  ------------------
  |  Branch (4894:25): [True: 24.8k, False: 12.5k]
  |  Branch (4894:38): [True: 20.3k, False: 4.53k]
  ------------------
 4895|  20.3k|                  ++it;
 4896|       |                  // Skip whitespace and newlines after comma
 4897|  20.3k|                  yaml::skip_ws_and_newlines(it, end);
 4898|  20.3k|               }
 4899|  17.0k|               else if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (4899:25): [True: 4.53k, False: 12.5k]
  |  Branch (4899:39): [True: 1.55k, False: 2.97k]
  |  Branch (4899:54): [True: 2.74k, False: 230]
  ------------------
 4900|       |                  // Newlines may precede either the closing brace or the
 4901|       |                  // separator comma for the next entry.
 4902|  4.30k|                  yaml::skip_ws_and_newlines(it, end);
 4903|  4.30k|                  if (it != end && *it == '}') {
  ------------------
  |  Branch (4903:23): [True: 4.23k, False: 70]
  |  Branch (4903:36): [True: 884, False: 3.35k]
  ------------------
 4904|    884|                     ++it;
 4905|    884|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4906|    884|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4906:26): [True: 8, False: 876]
  ------------------
 4907|      8|                        return;
 4908|    876|                     break;
 4909|    884|                  }
 4910|  3.42k|                  if (it != end && *it == ',') {
  ------------------
  |  Branch (4910:23): [True: 3.35k, False: 70]
  |  Branch (4910:36): [True: 3.25k, False: 99]
  ------------------
 4911|  3.25k|                     ++it;
 4912|  3.25k|                     yaml::skip_ws_and_newlines(it, end);
 4913|  3.25k|                     continue;
 4914|  3.25k|                  }
 4915|    169|                  ctx.error = error_code::syntax_error;
 4916|    169|                  return;
 4917|  3.42k|               }
 4918|  12.7k|               else {
 4919|  12.7k|                  ctx.error = error_code::syntax_error;
 4920|  12.7k|                  return;
 4921|  12.7k|               }
 4922|  41.3k|            }
 4923|  66.4k|         }
 4924|   734k|         else {
 4925|       |            // Block mapping - use shared loop with map-specific callback
 4926|   734k|            yaml::parse_block_mapping_loop<Opts>(
 4927|   734k|               ctx, it, end, int32_t(-1), [&](auto& ctx, auto& it, auto end, int32_t line_indent) -> bool {
 4928|   734k|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|   734k|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 4930|   734k|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|   734k|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|   734k|                           if (ctx.stream_begin) {
 4938|   734k|                              auto is_line_content_start = [&](auto pos) {
 4939|   734k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   734k|                              };
 4941|       |
 4942|   734k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   734k|                                 const char* line = ctx.line_begin_of(pos);
 4944|   734k|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|   734k|                                 return line != end && *line == ':';
 4946|   734k|                              };
 4947|       |
 4948|   734k|                              if (!is_line_content_start(it) &&
 4949|   734k|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
 4950|   734k|                                  !line_has_explicit_value_indicator(it)) {
 4951|   734k|                                 ctx.error = error_code::syntax_error;
 4952|   734k|                                 return false;
 4953|   734k|                              }
 4954|   734k|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|   734k|                           }
 4956|   734k|                        }
 4957|       |
 4958|   734k|                        if (*it == '-' &&
 4959|   734k|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
 4960|   734k|                            !line_starts_with_explicit_value_indicator) {
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|   734k|                           ctx.error = error_code::syntax_error;
 4963|   734k|                           return false;
 4964|   734k|                        }
 4965|       |
 4966|   734k|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 4967|   734k|                           return false;
 4968|   734k|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|   734k|                        ctx.pop_indent();
 4970|   734k|                     }
 4971|   734k|                     else {
 4972|   734k|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|   734k|                        if (nested_indent >= 0) {
 4974|   734k|                           yaml::skip_to_content(it, end);
 4975|   734k|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
 4976|   734k|                              ctx.error = error_code::syntax_error;
 4977|   734k|                              return false;
 4978|   734k|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|   734k|                           const int32_t value_indent =
 4982|   734k|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
 4983|   734k|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
 4984|   734k|                              return false;
 4985|   734k|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|   734k|                           ctx.pop_indent();
 4987|   734k|                        }
 4988|   734k|                     }
 4989|   734k|                     return !bool(ctx.error);
 4990|   734k|                  };
 4991|       |
 4992|       |                  // Explicit key entry form:
 4993|       |                  // ? key
 4994|       |                  // : value
 4995|   734k|                  if (*it == '?' && ((it + 1) != end) && *(it + 1) == '\t') {
 4996|   734k|                     ctx.error = error_code::syntax_error;
 4997|   734k|                     return false;
 4998|   734k|                  }
 4999|   734k|                  if (*it == '?' && ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\n' || *(it + 1) == '\r')) {
 5000|   734k|                     ++it; // skip '?'
 5001|   734k|                     yaml::skip_inline_ws(it, end);
 5002|       |
 5003|   734k|                     const int32_t explicit_value_indicator_indent =
 5004|   734k|                        (ctx.current_indent() < 0) ? 0 : (ctx.current_indent() + 1);
 5005|       |
 5006|   734k|                     key_t key{};
 5007|   734k|                     if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5008|   734k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   734k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   734k|                        };
 5011|       |
 5012|   734k|                        auto key_it = it;
 5013|   734k|                        yaml::skip_inline_ws(key_it, end);
 5014|       |
 5015|   734k|                        auto content = key_it;
 5016|   734k|                        yaml::skip_to_content(content, end);
 5017|   734k|                        bool handled_anchor_only_empty_key = false;
 5018|       |
 5019|       |                        // Anchor on an empty explicit key node:
 5020|       |                        //   ? &a
 5021|       |                        //   : value
 5022|   734k|                        if (content != end && *content == '&') {
 5023|   734k|                           auto anchor_probe = content + 1;
 5024|   734k|                           auto anchor_name = yaml::parse_anchor_name(anchor_probe, end);
 5025|   734k|                           if (!anchor_name.empty()) {
 5026|   734k|                              auto after_anchor = anchor_probe;
 5027|   734k|                              yaml::skip_inline_ws(after_anchor, end);
 5028|       |
 5029|   734k|                              auto value_indicator = after_anchor;
 5030|   734k|                              if (value_indicator != end && *value_indicator == ':') {
 5031|   734k|                                 key.clear();
 5032|   734k|                                 ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5033|   734k|                                 it = value_indicator;
 5034|   734k|                                 handled_anchor_only_empty_key = true;
 5035|   734k|                              }
 5036|   734k|                              else {
 5037|   734k|                                 if (value_indicator != end && *value_indicator == '#') {
 5038|   734k|                                    yaml::skip_comment(value_indicator, end);
 5039|   734k|                                 }
 5040|   734k|                                 if (value_indicator != end && (*value_indicator == '\n' || *value_indicator == '\r')) {
 5041|   734k|                                    yaml::skip_newline(value_indicator, end);
 5042|   734k|                                    auto value_line = value_indicator;
 5043|   734k|                                    int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5044|   734k|                                    if (bool(ctx.error)) [[unlikely]]
 5045|   734k|                                       return false;
 5046|   734k|                                    if (value_line != end && *value_line == ':' &&
 5047|   734k|                                        value_indent == explicit_value_indicator_indent) {
 5048|   734k|                                       key.clear();
 5049|   734k|                                       ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5050|   734k|                                       it = value_line;
 5051|   734k|                                       handled_anchor_only_empty_key = true;
 5052|   734k|                                    }
 5053|   734k|                                    else if (value_line != end && *value_line == ':') {
 5054|       |                                       // In explicit-key form ("? &a"), a following ':'
 5055|       |                                       // starts the outer value indicator only at the same
 5056|       |                                       // indentation. A deeper-indented ': value' is malformed.
 5057|   734k|                                       ctx.error = error_code::syntax_error;
 5058|   734k|                                       return false;
 5059|   734k|                                    }
 5060|   734k|                                 }
 5061|   734k|                              }
 5062|   734k|                           }
 5063|   734k|                        }
 5064|       |
 5065|   734k|                        const bool key_content_spans_lines = [&] {
 5066|   734k|                           auto scan = key_it;
 5067|   734k|                           while (scan != content && scan != end) {
 5068|   734k|                              if (*scan == '\n' || *scan == '\r') return true;
 5069|   734k|                              ++scan;
 5070|   734k|                           }
 5071|   734k|                           return false;
 5072|   734k|                        }();
 5073|       |
 5074|   734k|                        if (handled_anchor_only_empty_key) {
 5075|       |                           // 'it' already points to the explicit value indicator ':'
 5076|   734k|                        }
 5077|   734k|                        else if (content == end || (*content == ':' && key_content_spans_lines)) {
 5078|   734k|                           key.clear();
 5079|   734k|                           it = content;
 5080|   734k|                        }
 5081|   734k|                        else {
 5082|       |                           // Explicit mapping keys ('? key-node') are full YAML nodes.
 5083|       |                           // Parse the key node structurally (not via plain-key scanning)
 5084|       |                           // so inputs like '? []: x' and '? JSON: like' are interpreted
 5085|       |                           // as complex keys, not split into implicit key/value pairs.
 5086|   734k|                           auto key_node_it = content;
 5087|   734k|                           auto key_node_end = end;
 5088|   734k|                           if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 5089|       |                              // In explicit-key form, a following standalone ':'
 5090|       |                              // line (same or lower indentation) belongs to the
 5091|       |                              // outer mapping value, not the key node itself.
 5092|   734k|                              auto scan = content;
 5093|   734k|                              while (scan != end) {
 5094|   734k|                                 while (scan != end && *scan != '\n' && *scan != '\r') {
 5095|   734k|                                    ++scan;
 5096|   734k|                                 }
 5097|   734k|                                 if (scan == end) {
 5098|   734k|                                    break;
 5099|   734k|                                 }
 5100|       |
 5101|   734k|                                 yaml::skip_newline(scan, end);
 5102|   734k|                                 auto line_start = scan;
 5103|       |
 5104|   734k|                                 int32_t indicator_indent = 0;
 5105|   734k|                                 while (scan != end && *scan == ' ') {
 5106|   734k|                                    ++indicator_indent;
 5107|   734k|                                    ++scan;
 5108|   734k|                                 }
 5109|       |
 5110|   734k|                                 if (scan != end && *scan == ':') {
 5111|   734k|                                    const auto after_colon = scan + 1;
 5112|   734k|                                    if ((after_colon == end ||
 5113|   734k|                                         yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
 5114|   734k|                                        indicator_indent <= line_indent) {
 5115|   734k|                                       key_node_end = line_start;
 5116|   734k|                                       break;
 5117|   734k|                                    }
 5118|   734k|                                 }
 5119|   734k|                              }
 5120|   734k|                           }
 5121|       |
 5122|   734k|                           glz::generic key_node{};
 5123|   734k|                           const bool prev_explicit_mapping_key_context = ctx.explicit_mapping_key_context;
 5124|   734k|                           ctx.explicit_mapping_key_context = true;
 5125|   734k|                           from<YAML, glz::generic>::template op<Opts>(key_node, ctx, key_node_it, key_node_end);
 5126|   734k|                           ctx.explicit_mapping_key_context = prev_explicit_mapping_key_context;
 5127|   734k|                           if (bool(ctx.error)) [[unlikely]]
 5128|   734k|                              return false;
 5129|   734k|                           it = key_node_it;
 5130|   734k|                           if (!to_string_key(key_node)) [[unlikely]]
 5131|   734k|                              return false;
 5132|   734k|                        }
 5133|   734k|                     }
 5134|   734k|                     else {
 5135|   734k|                        if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 5136|   734k|                           from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5137|   734k|                           if (bool(ctx.error)) [[unlikely]]
 5138|   734k|                              return false;
 5139|   734k|                        }
 5140|   734k|                     }
 5141|       |
 5142|   734k|                     yaml::skip_inline_ws(it, end);
 5143|   734k|                     yaml::skip_comment(it, end);
 5144|       |
 5145|       |                     // Value indicator may appear on the next line at the same indent.
 5146|   734k|                     if (it != end && (*it == '\n' || *it == '\r')) {
 5147|   734k|                        auto probe = it;
 5148|   734k|                        bool found_value_indicator = false;
 5149|       |
 5150|   734k|                        while (probe != end && (*probe == '\n' || *probe == '\r')) {
 5151|   734k|                           yaml::skip_newline(probe, end);
 5152|       |
 5153|   734k|                           auto value_line = probe;
 5154|   734k|                           int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5155|   734k|                           if (bool(ctx.error)) [[unlikely]]
 5156|   734k|                              return false;
 5157|       |
 5158|   734k|                           if (value_line == end || *value_line == '\n' || *value_line == '\r') {
 5159|   734k|                              probe = value_line;
 5160|   734k|                              continue; // blank line
 5161|   734k|                           }
 5162|   734k|                           if (*value_line == '#') {
 5163|   734k|                              yaml::skip_comment(value_line, end);
 5164|   734k|                              probe = value_line;
 5165|   734k|                              continue; // comment-only line
 5166|   734k|                           }
 5167|   734k|                           if (*value_line == ':' && value_indent == explicit_value_indicator_indent) {
 5168|   734k|                              it = value_line;
 5169|   734k|                              found_value_indicator = true;
 5170|   734k|                           }
 5171|   734k|                           break;
 5172|   734k|                        }
 5173|       |
 5174|   734k|                        if (found_value_indicator) {
 5175|   734k|                           yaml::skip_inline_ws(it, end);
 5176|   734k|                        }
 5177|   734k|                     }
 5178|       |
 5179|   734k|                     val_t val{};
 5180|   734k|                     if (it != end && *it == ':') {
 5181|   734k|                        ++it;
 5182|   734k|                        if (it != end && *it == '\t') {
 5183|   734k|                           ctx.error = error_code::syntax_error;
 5184|   734k|                           return false;
 5185|   734k|                        }
 5186|   734k|                        if (it != end && (*it == '\n' || *it == '\r')) {
 5187|   734k|                           auto probe = it;
 5188|   734k|                           yaml::skip_newline(probe, end);
 5189|   734k|                           while (probe != end && *probe == ' ') ++probe;
 5190|   734k|                           if (probe != end && *probe == ':' && ((probe + 1) != end) && *(probe + 1) == '\t') {
 5191|   734k|                              ctx.error = error_code::syntax_error;
 5192|   734k|                              return false;
 5193|   734k|                           }
 5194|   734k|                        }
 5195|   734k|                        yaml::skip_inline_ws(it, end);
 5196|   734k|                        if (!parse_map_value(val)) [[unlikely]]
 5197|   734k|                           return false;
 5198|   734k|                     }
 5199|       |
 5200|   734k|                     value.emplace(std::move(key), std::move(val));
 5201|   734k|                     return true;
 5202|   734k|                  }
 5203|       |
 5204|   734k|                  key_t key{};
 5205|   734k|                  if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5206|   734k|                     auto key_probe = it;
 5207|   734k|                     yaml::skip_inline_ws(key_probe, end);
 5208|   734k|                     const bool complex_flow_key = (key_probe != end && (*key_probe == '[' || *key_probe == '{'));
 5209|   734k|                     if (complex_flow_key) {
 5210|   734k|                        glz::generic key_node{};
 5211|   734k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 5212|   734k|                        if (bool(ctx.error)) [[unlikely]]
 5213|   734k|                           return false;
 5214|   734k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
 5215|   734k|                           return false;
 5216|   734k|                     }
 5217|   734k|                     else {
 5218|   734k|                        if (!yaml::parse_yaml_key(key, ctx, it, end, false)) {
 5219|   734k|                           return false;
 5220|   734k|                        }
 5221|   734k|                     }
 5222|   734k|                  }
 5223|   734k|                  else {
 5224|   734k|                     from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5225|   734k|                     if (bool(ctx.error)) [[unlikely]]
 5226|   734k|                        return false;
 5227|   734k|                  }
 5228|       |
 5229|   734k|                  yaml::skip_inline_ws(it, end);
 5230|       |
 5231|   734k|                  if (it == end || *it != ':') {
 5232|   734k|                     ctx.error = error_code::syntax_error;
 5233|   734k|                     return false;
 5234|   734k|                  }
 5235|   734k|                  ++it;
 5236|   734k|                  yaml::skip_inline_ws(it, end);
 5237|       |
 5238|   734k|                  val_t val{};
 5239|   734k|                  if (!parse_map_value(val)) [[unlikely]]
 5240|   734k|                     return false;
 5241|       |
 5242|   734k|                  value.emplace(std::move(key), std::move(val));
 5243|   734k|                  return true;
 5244|   734k|               });
 5245|   734k|         }
 5246|       |
 5247|   783k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 5248|   783k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEEXtlNS0_20node_property_policyELb1ELb1EEELb0ERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES4_EEEENS0_12yaml_contextEPKcSC_ZNS_4fromILj450ES8_E2opITnDaXtlS2_Lj450ELb1ELb0ELb1ELh2EEERSC_S9_TkNS_10is_contextERSA_SC_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSL_RSO_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   822k|      {
  475|   822k|         skip_inline_ws(it, end);
  476|       |
  477|   822k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 7, False: 822k]
  ------------------
  478|      7|            if constexpr (!AllowEmptyInput) {
  479|      7|               ctx.error = error_code::unexpected_end;
  480|      7|            }
  481|      7|            return true;
  482|      7|         }
  483|       |
  484|   822k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   822k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 8, False: 822k]
  ------------------
  486|      8|            ctx.error = error_code::syntax_error;
  487|      8|            return true;
  488|      8|         }
  489|   822k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 6, False: 822k]
  ------------------
  490|      6|            ctx.error = error_code::syntax_error;
  491|      6|            return true;
  492|      6|         }
  493|       |
  494|   822k|         skip_inline_ws(it, end);
  495|       |
  496|   822k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 19, False: 822k]
  ------------------
  497|     19|            if constexpr (!AllowEmptyInput) {
  498|     19|               ctx.error = error_code::unexpected_end;
  499|     19|            }
  500|     19|            return true;
  501|     19|         }
  502|       |
  503|   822k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 10.7k, False: 812k]
  ------------------
  504|  10.7k|            return true;
  505|  10.7k|         }
  506|       |
  507|   812k|         return false;
  508|   822k|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlNS8_8yaml_tagEE_clESN_:
 4666|   822k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_map(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEEXtlNS0_20node_property_policyELb1ELb1EEERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES4_EEEENS0_12yaml_contextEPKcSC_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   822k|      {
  418|   822k|         state.has_anchor = false;
  419|   822k|         state.anchor_name.clear();
  420|   822k|         state.anchor_start = nullptr;
  421|   822k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   822k|         if constexpr (Policy.allow_alias) {
  424|   822k|            if constexpr (Policy.alias_can_be_mapping_key) {
  425|   822k|               if (!alias_token_is_mapping_key(it, end)) {
  ------------------
  |  Branch (425:20): [True: 805k, False: 16.9k]
  ------------------
  426|   805k|                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (426:23): [True: 10.7k, False: 795k]
  ------------------
  427|   805k|               }
  428|       |            }
  429|       |            else {
  430|       |               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  431|       |            }
  432|   822k|         }
  433|       |
  434|   822k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 812k, False: 10.7k]
  |  Branch (434:27): [True: 53.6k, False: 758k]
  ------------------
  435|  53.6k|            ++it;
  436|  53.6k|            auto name = parse_anchor_name(it, end);
  437|  53.6k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 41, False: 53.6k]
  ------------------
  438|     41|               ctx.error = error_code::syntax_error;
  439|     41|               return true;
  440|     41|            }
  441|  53.6k|            skip_inline_ws(it, end);
  442|  53.6k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 21, False: 53.6k]
  ------------------
  443|     21|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     21|                  ctx.error = error_code::unexpected_end;
  445|     21|               }
  446|     21|               return true;
  447|     21|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  53.6k|            state.has_anchor = true;
  455|  53.6k|            state.anchor_name = std::string(name);
  456|  53.6k|            state.anchor_start = &*it;
  457|  53.6k|         }
  458|       |
  459|   822k|         return false;
  460|   822k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES3_EEEENS0_12yaml_contextEPKcSB_EEbOT0_RT1_RT2_T3_:
  309|   805k|      {
  310|   805k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 805k]
  |  Branch (310:27): [True: 795k, False: 10.7k]
  ------------------
  311|       |
  312|  10.7k|         ++it; // skip '*'
  313|  10.7k|         auto name = parse_anchor_name(it, end);
  314|  10.7k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 38, False: 10.6k]
  ------------------
  315|     38|            ctx.error = error_code::syntax_error;
  316|     38|            return true;
  317|     38|         }
  318|       |
  319|  10.6k|         auto anchor_it = ctx.anchors.find(name);
  320|  10.6k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 83, False: 10.6k]
  ------------------
  321|     83|            ctx.error = error_code::syntax_error; // undefined alias
  322|     83|            return true;
  323|     83|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  10.6k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  10.6k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 2.10k, False: 8.51k]
  ------------------
  331|  2.10k|            return true;
  332|  2.10k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  8.51k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 52, False: 8.46k]
  ------------------
  338|     52|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     52|            return true;
  340|     52|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  8.46k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  8.46k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 6, False: 8.45k]
  ------------------
  348|      6|            return true;
  349|       |
  350|  8.45k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 0, False: 8.45k]
  ------------------
  351|      0|            ctx.error = error_code::exceeded_max_expansion;
  352|      0|            ctx.custom_error_message = "alias expansion";
  353|      0|            return true;
  354|      0|         }
  355|       |
  356|  8.45k|         auto replay_it = span.begin;
  357|  8.45k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  8.45k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  8.45k|         ctx.indent_stack.clear();
  362|  8.45k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 5.93k, False: 2.52k]
  ------------------
  363|  5.93k|            ctx.push_indent(span.base_indent - 1);
  364|  5.93k|         }
  365|       |
  366|  8.45k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  8.45k|         using V = std::remove_cvref_t<T>;
  369|  8.45k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  8.45k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  8.45k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  8.45k|         return true;
  376|  8.45k|      }
_ZN3glz4fromILj450ENS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERS4_TkNS_10is_contextERNS7_12yaml_contextERPKcSD_EEvOT0_OT1_OT2_T3_:
  283|  4.91M|      {
  284|  4.91M|         using V = std::decay_t<decltype(get_member(std::declval<Value>(), meta_wrapper_v<T>))>;
  285|  4.91M|         from<YAML, V>::template op<Opts>(get_member(std::forward<Value>(value), meta_wrapper_v<T>),
  286|  4.91M|                                          std::forward<Ctx>(ctx), std::forward<It0>(it), end);
  287|  4.91M|      }
_ZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRSH_TkNS_10is_contextERNSK_12yaml_contextESN_EEvOT1_OT2_OT0_T3_:
 5797|  6.92M|      {
 5798|       |         // Inside op() rather than at class scope: read_supported is `requires { from<Format, T>{}; }`,
 5799|       |         // so a class-scope assert turns that feature probe into a hard error instead of `false`.
 5800|  6.92M|         static_assert(content_v<std::remove_cvref_t<T>>.empty(),
 5801|  6.92M|                       "Adjacent variant tagging (glz::meta `content`) is implemented for JSON and "
 5802|  6.92M|                       "BEVE but not yet for YAML. Reading this variant as YAML would silently expect "
 5803|  6.92M|                       "the internally tagged shape, so it is rejected here instead.");
 5804|  6.92M|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5804:14): [True: 0, False: 6.92M]
  ------------------
 5805|      0|            return;
 5806|       |
 5807|       |         // No depth is taken here: the sequence and mapping readers this dispatches to count the
 5808|       |         // levels, so a scalar at the bottom of a document costs nothing, as in JSON. The one way
 5809|       |         // back into this reader that opens no collection is `redispatch`, which counts itself.
 5810|       |
 5811|       |         // At root level (indent == -1), skip leading whitespace, newlines, and comments
 5812|       |         // For nested values, only skip inline whitespace to preserve block structure
 5813|  6.92M|         if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (5813:14): [True: 5.70M, False: 1.22M]
  ------------------
 5814|  5.70M|            yaml::skip_ws_newlines_comments(it, end);
 5815|  5.70M|         }
 5816|  1.22M|         else {
 5817|  1.22M|            yaml::skip_inline_ws(it, end);
 5818|  1.22M|         }
 5819|       |
 5820|  6.92M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (5820:14): [True: 448, False: 6.92M]
  ------------------
 5821|    448|            ctx.error = error_code::unexpected_end;
 5822|    448|            return;
 5823|    448|         }
 5824|       |
 5825|       |         // Tagged variants: a discriminator key (meta::tag) selects the alternative, with the
 5826|       |         // matching meta::ids entry naming each type. This mirrors the JSON behavior so the
 5827|       |         // same variant definitions round-trip across both formats.
 5828|       |         if constexpr (not tag_v<std::remove_cvref_t<T>>.empty()) {
 5829|       |            using V = std::remove_cvref_t<T>;
 5830|       |            const bool value_is_mapping =
 5831|       |               (*it == '{') || (!yaml::check_flow_context(Opts) && yaml::line_could_be_block_mapping(it, end));
 5832|       |            if (value_is_mapping) {
 5833|       |               // The mapping's keys sit at the column of `it`. Recover that column from the buffer:
 5834|       |               // the indent stack carries the parent context's indent (a struct member, a sequence
 5835|       |               // item, etc. each push a different offset), not this mapping's true column (see helper).
 5836|       |               const int32_t mapping_column = tagged_mapping_visual_indent(ctx, it, ctx.current_indent() + 1);
 5837|       |               auto tag_ctx = ctx.make_speculative();
 5838|       |               const size_t index = scan_variant_tag_index<V, Opts>(tag_ctx, it, end, mapping_column);
 5839|       |               ctx.alias_expansion_budget = tag_ctx.alias_expansion_budget; // charged even if no tag matched
 5840|       |               ctx.key_expansion_budget = tag_ctx.key_expansion_budget;
 5841|       |               if (index < ids_v<V>.size()) {
 5842|       |                  static constexpr auto tag_literal = string_literal_from_view<tag_v<V>.size()>(tag_v<V>);
 5843|       |                  emplace_runtime_variant(value, index);
 5844|       |                  // Establish the mapping's true column on the indent stack for the alternative parse.
 5845|       |                  // The chosen object is then parsed - and the discriminator's inline value skipped -
 5846|       |                  // at a consistent indent in every context, so a tag on the first key does not fold
 5847|       |                  // the following sibling entries into its value (no special-casing needed downstream).
 5848|       |                  if (!ctx.push_indent(mapping_column)) [[unlikely]] {
 5849|       |                     ctx.error = error_code::exceeded_max_recursive_depth;
 5850|       |                     return;
 5851|       |                  }
 5852|       |                  std::visit(
 5853|       |                     [&](auto&& alt) {
 5854|       |                        using Alt = std::remove_cvref_t<decltype(alt)>;
 5855|       |                        if constexpr ((glaze_object_t<Alt> || reflectable<Alt>) && not custom_read<Alt>) {
 5856|       |                           // Parse the mapping into the resolved struct; the tag key is skipped.
 5857|       |                           from<YAML, Alt>::template op<Opts, tag_literal>(alt, ctx, it, end);
 5858|       |                        }
 5859|       |                        else if constexpr (custom_read<Alt>) {
 5860|       |                           // Custom alternatives read the mapping body themselves and cannot skip an
 5861|       |                           // interior tag key the way reflected objects do, so the tag must be the
 5862|       |                           // first key (glaze always writes it first). Consume that leading "tag: id"
 5863|       |                           // entry, then hand the remaining mapping to the custom handler.
 5864|       |                           if constexpr (yaml::check_flow_context(Opts)) {
 5865|       |                              ctx.error = error_code::feature_not_supported;
 5866|       |                              ctx.custom_error_message =
 5867|       |                                 "custom variant alternatives are not supported in YAML flow style";
 5868|       |                           }
 5869|       |                           else {
 5870|       |                              ctx.scratch.clear();
 5871|       |                              if (yaml::parse_yaml_key(ctx.scratch, ctx, it, end, false)) {
 5872|       |                                 if (std::string_view{ctx.scratch} != tag_v<V>) {
 5873|       |                                    ctx.error = error_code::feature_not_supported;
 5874|       |                                    ctx.custom_error_message =
 5875|       |                                       "the tag must be the first key for a custom variant alternative";
 5876|       |                                 }
 5877|       |                                 else {
 5878|       |                                    yaml::skip_inline_ws(it, end);
 5879|       |                                    if (it == end || *it != ':') {
 5880|       |                                       ctx.error = error_code::syntax_error;
 5881|       |                                    }
 5882|       |                                    else {
 5883|       |                                       ++it;
 5884|       |                                       yaml::skip_inline_ws(it, end);
 5885|       |                                       yaml::skip_unknown_block_value<Opts>(ctx, it, end, mapping_column);
 5886|       |                                       if (!bool(ctx.error)) {
 5887|       |                                          // If nothing but trailing whitespace/comments remains, the tag
 5888|       |                                          // was the whole mapping: leave the alternative default.
 5889|       |                                          auto probe = it;
 5890|       |                                          yaml::skip_ws_newlines_comments(probe, end);
 5891|       |                                          if (probe == end) {
 5892|       |                                             it = probe;
 5893|       |                                          }
 5894|       |                                          else {
 5895|       |                                             // Publish the mapping's column so the custom handler's block
 5896|       |                                             // mapping (which would otherwise discover its own indent) reads
 5897|       |                                             // the remaining entries at the variant's indent and dedents
 5898|       |                                             // correctly in every context (root, sequence, nested).
 5899|       |                                             ctx.forced_block_mapping_indent = mapping_column;
 5900|       |                                             from<YAML, Alt>::template op<Opts>(alt, ctx, it, end);
 5901|       |                                             ctx.forced_block_mapping_indent = -1;
 5902|       |                                          }
 5903|       |                                       }
 5904|       |                                    }
 5905|       |                                 }
 5906|       |                              }
 5907|       |                           }
 5908|       |                        }
 5909|       |                        else {
 5910|       |                           // Non-object alternative (e.g. std::monostate): the emplaced default is
 5911|       |                           // the value, but the mapping must still be consumed.
 5912|       |                           walk_tagged_mapping<Opts>(
 5913|       |                              ctx, it, end, tag_v<V>, mapping_column,
 5914|       |                              [&](auto&& c, auto&& i, auto&& e, int32_t line_indent, bool in_flow) {
 5915|       |                                 yaml::skip_yaml_value<Opts>(c, i, e, in_flow ? 0 : line_indent, in_flow);
 5916|       |                              });
 5917|       |                        }
 5918|       |                     },
 5919|       |                     value);
 5920|       |                  ctx.pop_indent();
 5921|       |                  return;
 5922|       |               }
 5923|       |               // No resolvable tag key was found. Fall through to structural deduction:
 5924|       |               // if the alternatives are distinguishable by their fields this still succeeds,
 5925|       |               // otherwise the deduction path reports no_matching_variant_type.
 5926|       |            }
 5927|       |         }
 5928|       |
 5929|  6.92M|         if constexpr (yaml_variant_is_auto_deducible<std::remove_cvref_t<T>>()) {
 5930|  6.92M|            using V = std::remove_cvref_t<T>;
 5931|  6.92M|            using counts = yaml_variant_type_count<V>;
 5932|  6.92M|            const char c = *it;
 5933|  6.92M|            auto is_plain_scalar_boundary = [](const char ch) {
 5934|  6.92M|               switch (ch) {
 5935|  6.92M|               case ' ':
 5936|  6.92M|               case '\t':
 5937|  6.92M|               case '\n':
 5938|  6.92M|               case '\r':
 5939|  6.92M|               case ',':
 5940|  6.92M|               case ']':
 5941|  6.92M|               case '}':
 5942|  6.92M|                  return true;
 5943|  6.92M|               default:
 5944|  6.92M|                  return false;
 5945|  6.92M|               }
 5946|  6.92M|            };
 5947|       |
 5948|  6.92M|            auto has_indented_block_continuation = [&](auto word_end) {
 5949|  6.92M|               if constexpr (yaml::check_flow_context(Opts)) {
 5950|  6.92M|                  return false;
 5951|  6.92M|               }
 5952|  6.92M|               if (ctx.current_indent() < 0) {
 5953|  6.92M|                  return false;
 5954|  6.92M|               }
 5955|  6.92M|               if (word_end == end || (*word_end != '\n' && *word_end != '\r')) {
 5956|  6.92M|                  return false;
 5957|  6.92M|               }
 5958|       |
 5959|  6.92M|               auto look = word_end;
 5960|  6.92M|               yaml::skip_newline(look, end);
 5961|  6.92M|               while (look != end) {
 5962|  6.92M|                  int32_t line_indent = 0;
 5963|  6.92M|                  while (look != end && *look == ' ') {
 5964|  6.92M|                     ++line_indent;
 5965|  6.92M|                     ++look;
 5966|  6.92M|                  }
 5967|  6.92M|                  if (look != end && *look == '\t') {
 5968|  6.92M|                     return false;
 5969|  6.92M|                  }
 5970|  6.92M|                  if (look == end || *look == '\n' || *look == '\r') {
 5971|  6.92M|                     if (look != end) {
 5972|  6.92M|                        yaml::skip_newline(look, end);
 5973|  6.92M|                        continue;
 5974|  6.92M|                     }
 5975|  6.92M|                     return false;
 5976|  6.92M|                  }
 5977|  6.92M|                  if (*look == '#') {
 5978|  6.92M|                     yaml::skip_comment(look, end);
 5979|  6.92M|                     if (look != end && (*look == '\n' || *look == '\r')) {
 5980|  6.92M|                        yaml::skip_newline(look, end);
 5981|  6.92M|                        continue;
 5982|  6.92M|                     }
 5983|  6.92M|                     return false;
 5984|  6.92M|                  }
 5985|       |
 5986|       |                  // If the next non-empty line is an implicit mapping entry,
 5987|       |                  // don't treat it as scalar continuation for auto-deduced
 5988|       |                  // booleans/nulls.
 5989|  6.92M|                  {
 5990|  6.92M|                     auto scan = look;
 5991|  6.92M|                     while (scan != end && *scan != '\n' && *scan != '\r') {
 5992|  6.92M|                        if (*scan == ':') {
 5993|  6.92M|                           auto after_colon = scan + 1;
 5994|  6.92M|                           if (after_colon == end || *after_colon == ' ' || *after_colon == '\t' ||
 5995|  6.92M|                               *after_colon == '\n' || *after_colon == '\r') {
 5996|  6.92M|                              return false;
 5997|  6.92M|                           }
 5998|  6.92M|                        }
 5999|  6.92M|                        ++scan;
 6000|  6.92M|                     }
 6001|  6.92M|                  }
 6002|       |
 6003|  6.92M|                  return line_indent > ctx.current_indent();
 6004|  6.92M|               }
 6005|  6.92M|               return false;
 6006|  6.92M|            };
 6007|  6.92M|            auto is_word_boundary = [&](const auto ptr) {
 6008|  6.92M|               if (ptr == end) {
 6009|  6.92M|                  return true;
 6010|  6.92M|               }
 6011|  6.92M|               if (*ptr == ':') {
 6012|  6.92M|                  auto next = ptr + 1;
 6013|  6.92M|                  return (next == end) || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
 6014|  6.92M|               }
 6015|  6.92M|               return is_plain_scalar_boundary(*ptr);
 6016|  6.92M|            };
 6017|       |
 6018|  6.92M|            switch (c) {
 6019|  1.46M|            case '&': {
  ------------------
  |  Branch (6019:13): [True: 1.46M, False: 5.46M]
  ------------------
 6020|       |               // Anchor before value: parse name, then re-dispatch
 6021|  1.46M|               ++it;
 6022|  1.46M|               auto aname = yaml::parse_anchor_name(it, end);
 6023|  1.46M|               if (aname.empty()) {
  ------------------
  |  Branch (6023:20): [True: 445, False: 1.46M]
  ------------------
 6024|    445|                  ctx.error = error_code::syntax_error;
 6025|    445|                  return;
 6026|    445|               }
 6027|  1.46M|               yaml::skip_inline_ws(it, end);
 6028|  1.46M|               bool anchor_on_same_line = true;
 6029|  1.46M|               bool value_is_indentless_sequence = false;
 6030|  1.46M|               if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (6030:20): [True: 15.6k, False: 1.44M]
  |  Branch (6030:33): [True: 70.9k, False: 1.37M]
  |  Branch (6030:48): [True: 84.5k, False: 1.29M]
  |  Branch (6030:63): [True: 15.4k, False: 1.27M]
  ------------------
 6031|       |                  // Anchor followed by end-of-line. Check if the value continues on the
 6032|       |                  // next line (indented past current context) or if this is an empty node.
 6033|   186k|                  bool value_on_next_line = false;
 6034|   186k|                  if (it != end) {
  ------------------
  |  Branch (6034:23): [True: 170k, False: 15.6k]
  ------------------
 6035|   170k|                     auto peek = it;
 6036|       |                     // Skip comment if present
 6037|   170k|                     if (*peek == '#') {
  ------------------
  |  Branch (6037:26): [True: 15.4k, False: 155k]
  ------------------
 6038|   615k|                        while (peek != end && *peek != '\n' && *peek != '\r') ++peek;
  ------------------
  |  Branch (6038:32): [True: 613k, False: 2.04k]
  |  Branch (6038:47): [True: 606k, False: 6.93k]
  |  Branch (6038:64): [True: 600k, False: 6.50k]
  ------------------
 6039|  15.4k|                     }
 6040|       |                     // Skip newline
 6041|   170k|                     if (peek != end && (*peek == '\n' || *peek == '\r')) {
  ------------------
  |  Branch (6041:26): [True: 168k, False: 2.04k]
  |  Branch (6041:42): [True: 77.8k, False: 91.0k]
  |  Branch (6041:59): [True: 91.0k, False: 0]
  ------------------
 6042|   168k|                        yaml::skip_newline(peek, end);
 6043|       |                        // Skip blank lines
 6044|   288k|                        while (peek != end && (*peek == '\n' || *peek == '\r')) {
  ------------------
  |  Branch (6044:32): [True: 278k, False: 9.47k]
  |  Branch (6044:48): [True: 61.9k, False: 216k]
  |  Branch (6044:65): [True: 57.5k, False: 159k]
  ------------------
 6045|   119k|                           yaml::skip_newline(peek, end);
 6046|   119k|                        }
 6047|       |                        // Measure indent of next content line
 6048|   168k|                        int32_t next_indent = 0;
 6049|   500k|                        while (peek != end && *peek == ' ') {
  ------------------
  |  Branch (6049:32): [True: 488k, False: 12.0k]
  |  Branch (6049:47): [True: 331k, False: 156k]
  ------------------
 6050|   331k|                           ++next_indent;
 6051|   331k|                           ++peek;
 6052|   331k|                        }
 6053|   168k|                        if (peek != end && *peek != '\n' && *peek != '\r') {
  ------------------
  |  Branch (6053:29): [True: 156k, False: 12.0k]
  |  Branch (6053:44): [True: 153k, False: 2.96k]
  |  Branch (6053:61): [True: 151k, False: 2.53k]
  ------------------
 6054|   151k|                           const bool indentless_sequence =
 6055|   151k|                              (!ctx.sequence_item_value_context) && (*peek == '-') &&
  ------------------
  |  Branch (6055:31): [True: 148k, False: 3.05k]
  |  Branch (6055:69): [True: 33.9k, False: 114k]
  ------------------
 6056|  33.9k|                              ((peek + 1) == end ||
  ------------------
  |  Branch (6056:32): [True: 1.62k, False: 32.3k]
  ------------------
 6057|  32.3k|                               yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(peek + 1))]) &&
  ------------------
  |  Branch (6057:32): [True: 30.2k, False: 2.14k]
  ------------------
 6058|  31.8k|                              (next_indent == ctx.current_indent() ||
  ------------------
  |  Branch (6058:32): [True: 4.22k, False: 27.6k]
  ------------------
 6059|  27.6k|                               (ctx.current_indent() > 0 && (next_indent + 1) == ctx.current_indent()));
  ------------------
  |  Branch (6059:33): [True: 11.7k, False: 15.8k]
  |  Branch (6059:61): [True: 10.8k, False: 887]
  ------------------
 6060|   151k|                           value_is_indentless_sequence = indentless_sequence;
 6061|   151k|                           const bool same_indent_property_node =
 6062|   151k|                              (next_indent == ctx.current_indent()) &&
  ------------------
  |  Branch (6062:31): [True: 19.7k, False: 131k]
  ------------------
 6063|  19.7k|                              (*peek == '!' || *peek == '&' || *peek == '*' || *peek == '[' || *peek == '{' ||
  ------------------
  |  Branch (6063:32): [True: 1.13k, False: 18.5k]
  |  Branch (6063:48): [True: 3.57k, False: 14.9k]
  |  Branch (6063:64): [True: 861, False: 14.1k]
  |  Branch (6063:80): [True: 1.15k, False: 12.9k]
  |  Branch (6063:96): [True: 1.49k, False: 11.4k]
  ------------------
 6064|  11.4k|                               *peek == '"' || *peek == '\'' || *peek == '|' || *peek == '>');
  ------------------
  |  Branch (6064:32): [True: 863, False: 10.6k]
  |  Branch (6064:48): [True: 1.53k, False: 9.09k]
  |  Branch (6064:65): [True: 1.06k, False: 8.03k]
  |  Branch (6064:81): [True: 1.04k, False: 6.99k]
  ------------------
 6065|   151k|                           value_on_next_line =
 6066|   151k|                              (next_indent > ctx.current_indent()) || indentless_sequence || same_indent_property_node;
  ------------------
  |  Branch (6066:31): [True: 105k, False: 46.1k]
  |  Branch (6066:71): [True: 15.1k, False: 31.0k]
  |  Branch (6066:94): [True: 12.7k, False: 18.3k]
  ------------------
 6067|   151k|                        }
 6068|   168k|                     }
 6069|   170k|                  }
 6070|   186k|                  if (!value_on_next_line) {
  ------------------
  |  Branch (6070:23): [True: 53.6k, False: 132k]
  ------------------
 6071|       |                     // Anchor on empty/null node — store empty span, leave value as default
 6072|  53.6k|                     ctx.anchors[std::string(aname)] = {&*it, &*it, ctx.current_indent()};
 6073|  53.6k|                     return;
 6074|  53.6k|                  }
 6075|       |                  // Value is on next line — advance past newline/blank lines to the content
 6076|   132k|                  if (*it == '#') {
  ------------------
  |  Branch (6076:23): [True: 9.63k, False: 123k]
  ------------------
 6077|   522k|                     while (it != end && *it != '\n' && *it != '\r') ++it;
  ------------------
  |  Branch (6077:29): [True: 522k, False: 0]
  |  Branch (6077:42): [True: 516k, False: 6.21k]
  |  Branch (6077:57): [True: 512k, False: 3.42k]
  ------------------
 6078|  9.63k|                  }
 6079|   132k|                  if (it != end) yaml::skip_newline(it, end);
  ------------------
  |  Branch (6079:23): [True: 132k, False: 0]
  ------------------
 6080|   213k|                  while (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (6080:26): [True: 213k, False: 0]
  |  Branch (6080:40): [True: 30.4k, False: 183k]
  |  Branch (6080:55): [True: 50.1k, False: 132k]
  ------------------
 6081|  80.5k|                     yaml::skip_newline(it, end);
 6082|  80.5k|                  }
 6083|   132k|                  yaml::skip_inline_ws(it, end);
 6084|   132k|                  anchor_on_same_line = false;
 6085|   132k|               }
 6086|       |
 6087|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6088|       |                  if (anchor_on_same_line && *it == '-' &&
 6089|       |                      ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))])) {
 6090|       |                     // "&anchor - item" is malformed in block context.
 6091|       |                     ctx.error = error_code::syntax_error;
 6092|       |                     return;
 6093|       |                  }
 6094|       |               }
 6095|       |
 6096|       |               // Anchor on alias (&anchor *alias) is invalid per YAML spec.
 6097|       |               // But alias-as-key (&anchor *alias : value) is valid.
 6098|  1.41M|               if (it != end && *it == '*' && !yaml::alias_token_is_mapping_key(it, end)) {
  ------------------
  |  Branch (6098:20): [True: 1.41M, False: 20]
  |  Branch (6098:33): [True: 1.75k, False: 1.40M]
  |  Branch (6098:47): [True: 181, False: 1.57k]
  ------------------
 6099|    181|                  ctx.error = error_code::syntax_error;
 6100|    181|                  return;
 6101|    181|               }
 6102|       |
 6103|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6104|       |                  if (!anchor_on_same_line && it != end && *it == '&') {
 6105|       |                     auto probe = it + 1;
 6106|       |                     auto nested_anchor_name = yaml::parse_anchor_name(probe, end);
 6107|       |                     if (nested_anchor_name.empty()) {
 6108|       |                        ctx.error = error_code::syntax_error;
 6109|       |                        return;
 6110|       |                     }
 6111|       |                     yaml::skip_inline_ws(probe, end);
 6112|       |                     // Allow nested anchor usage only when it clearly starts a
 6113|       |                     // nested mapping entry ("&k key: value"). Otherwise this is
 6114|       |                     // a second anchor on the same node (4JVG-style), which is invalid.
 6115|       |                     if (!yaml::line_could_be_block_mapping(probe, end)) {
 6116|       |                        ctx.error = error_code::syntax_error;
 6117|       |                        return;
 6118|       |                     }
 6119|       |                  }
 6120|       |               }
 6121|       |
 6122|  1.41M|               const char* anchor_start = &*it;
 6123|  1.41M|               const int32_t anchor_indent = ctx.current_indent();
 6124|       |
 6125|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6126|       |                  // Check if the anchor is on a block-mapping key (&name key: value).
 6127|       |                  // Only when the anchor and key are on the SAME line — if the value was on the
 6128|       |                  // next line, the anchor applies to the entire next-line content.
 6129|       |                  if (anchor_on_same_line && yaml::line_could_be_block_mapping(it, end)) {
 6130|       |                     auto key_start = it;
 6131|       |                     if (*key_start == '!') {
 6132|       |                        const auto key_tag = yaml::parse_yaml_tag(key_start, end, ctx);
 6133|       |                        if (key_tag == yaml::yaml_tag::unknown || !yaml::tag_valid_for_string(key_tag)) {
 6134|       |                           ctx.error = error_code::syntax_error;
 6135|       |                           return;
 6136|       |                        }
 6137|       |                        yaml::skip_inline_ws(key_start, end);
 6138|       |                        if (key_start == end) {
 6139|       |                           ctx.error = error_code::unexpected_end;
 6140|       |                           return;
 6141|       |                        }
 6142|       |                        if (*key_start == '\n' || *key_start == '\r') {
 6143|       |                           ctx.error = error_code::syntax_error;
 6144|       |                           return;
 6145|       |                        }
 6146|       |
 6147|       |                        // Re-apply the anchor-on-alias rule now that the tag is consumed. The
 6148|       |                        // check above ran before the tag, so "&anchor !tag *alias" reached the
 6149|       |                        // key-span registration below while the untagged spelling was rejected;
 6150|       |                        // an alias node carries no other properties either way.
 6151|       |                        if (*key_start == '*' && !yaml::alias_token_is_mapping_key(key_start, end)) {
 6152|       |                           ctx.error = error_code::syntax_error;
 6153|       |                           return;
 6154|       |                        }
 6155|       |                     }
 6156|       |
 6157|       |                     // Find the key span by scanning to the key-value separator
 6158|       |                     auto key_scan = key_start;
 6159|       |                     auto key_end = key_start;
 6160|       |                     if (*key_scan == '"' || *key_scan == '\'') {
 6161|       |                        // Quoted key: skip to closing quote
 6162|       |                        const char quote = *key_scan;
 6163|       |                        ++key_scan;
 6164|       |                        while (key_scan != end && *key_scan != quote) {
 6165|       |                           if (*key_scan == '\\' && quote == '"') {
 6166|       |                              ++key_scan;
 6167|       |                              if (key_scan != end) ++key_scan;
 6168|       |                           }
 6169|       |                           else {
 6170|       |                              ++key_scan;
 6171|       |                           }
 6172|       |                        }
 6173|       |                        if (key_scan == end) {
 6174|       |                           ctx.error = error_code::syntax_error;
 6175|       |                           return;
 6176|       |                        }
 6177|       |                        ++key_scan; // past closing quote
 6178|       |                        key_end = key_scan;
 6179|       |                        yaml::skip_inline_ws(key_scan, end);
 6180|       |                     }
 6181|       |                     else {
 6182|       |                        // Plain key: scan to ':'
 6183|       |                        while (key_scan != end) {
 6184|       |                           if (*key_scan == ':') {
 6185|       |                              auto next = key_scan + 1;
 6186|       |                              if (next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r') {
 6187|       |                                 break;
 6188|       |                              }
 6189|       |                           }
 6190|       |                           ++key_scan;
 6191|       |                        }
 6192|       |                        key_end = key_scan;
 6193|       |                        while (key_end != key_start && (*(key_end - 1) == ' ' || *(key_end - 1) == '\t')) {
 6194|       |                           --key_end;
 6195|       |                        }
 6196|       |                     }
 6197|       |                     if (key_scan == end || *key_scan != ':') {
 6198|       |                        ctx.error = error_code::syntax_error;
 6199|       |                        return;
 6200|       |                     }
 6201|       |                     // Store anchor with just the key text span
 6202|       |                     ctx.anchors[std::string(aname)] = {&*key_start, &*key_end, anchor_indent};
 6203|       |                     it = key_start;
 6204|       |                     // Parse as an object alternative so complex keys (e.g. flow collections) stay in mapping context.
 6205|       |                     if constexpr (counts::n_object > 0) {
 6206|       |                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6207|       |                                                                                                        end);
 6208|       |                     }
 6209|       |                     else {
 6210|       |                        redispatch<Opts>(value, ctx, it, end);
 6211|       |                     }
 6212|       |                     return;
 6213|       |                  }
 6214|       |               }
 6215|       |
 6216|  1.41M|               const bool prev_allow_indentless_sequence = ctx.allow_indentless_sequence;
 6217|  1.41M|               ctx.allow_indentless_sequence = value_is_indentless_sequence;
 6218|  1.41M|               redispatch<Opts>(value, ctx, it, end);
 6219|  1.41M|               ctx.allow_indentless_sequence = prev_allow_indentless_sequence;
 6220|  1.41M|               if (!bool(ctx.error)) {
  ------------------
  |  Branch (6220:20): [True: 1.37M, False: 31.8k]
  ------------------
 6221|  1.37M|                  ctx.anchors[std::string(aname)] = {anchor_start, &*it, anchor_indent};
 6222|  1.37M|               }
 6223|  1.41M|               return;
 6224|  1.41M|            }
 6225|   554k|            case '*': {
  ------------------
  |  Branch (6225:13): [True: 554k, False: 6.37M]
  ------------------
 6226|       |               // In block context, "*alias : value" starts a mapping with an alias key.
 6227|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6228|       |                  if (yaml::alias_token_is_mapping_key(it, end)) {
 6229|       |                     if constexpr (counts::n_object > 0) {
 6230|       |                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6231|       |                                                                                                        end);
 6232|       |                        return;
 6233|       |                     }
 6234|       |                     else {
 6235|       |                        ctx.error = error_code::syntax_error;
 6236|       |                        return;
 6237|       |                     }
 6238|       |                  }
 6239|       |               }
 6240|       |
 6241|       |               // Alias value: look up anchor and replay
 6242|   554k|               yaml::handle_alias<Opts>(value, ctx, it, end);
 6243|   554k|               return;
 6244|  1.41M|            }
 6245|   458k|            case '!': {
  ------------------
  |  Branch (6245:13): [True: 458k, False: 6.47M]
  ------------------
 6246|       |               // Tag - parse it and dispatch based on tag type
 6247|   458k|               const auto tag = yaml::parse_yaml_tag(it, end, ctx);
 6248|   458k|               if (tag == yaml::yaml_tag::unknown) {
  ------------------
  |  Branch (6248:20): [True: 75, False: 458k]
  ------------------
 6249|     75|                  ctx.error = error_code::syntax_error;
 6250|     75|                  return;
 6251|     75|               }
 6252|   458k|               yaml::skip_inline_ws(it, end);
 6253|   458k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (6253:20): [True: 454k, False: 3.35k]
  |  Branch (6253:33): [True: 22.7k, False: 431k]
  ------------------
 6254|  22.7k|                  yaml::skip_comment(it, end);
 6255|  22.7k|               }
 6256|   458k|               if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (6256:20): [True: 453k, False: 4.64k]
  |  Branch (6256:34): [True: 35.2k, False: 418k]
  |  Branch (6256:49): [True: 54.4k, False: 363k]
  ------------------
 6257|  89.7k|                  auto content = it;
 6258|  89.7k|                  yaml::skip_newline(content, end);
 6259|  89.7k|                  yaml::skip_to_content(content, end);
 6260|       |
 6261|  89.7k|                  bool consume_following_content = false;
 6262|  89.7k|                  auto content_token = content;
 6263|  89.7k|                  if (content != end) {
  ------------------
  |  Branch (6263:23): [True: 83.2k, False: 6.49k]
  ------------------
 6264|  83.2k|                     auto indent_probe = content;
 6265|  83.2k|                     const int32_t content_indent = yaml::measure_indent<false>(indent_probe, end, ctx);
 6266|  83.2k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (6266:26): [True: 6, False: 83.2k]
  ------------------
 6267|      6|                        return;
 6268|  83.2k|                     content_token = indent_probe;
 6269|       |
 6270|       |                     // A tag at the end of a sequence/map entry has an empty value
 6271|       |                     // unless the next non-empty content is nested under the current node.
 6272|  83.2k|                     bool tagged_indentless_sequence = false;
 6273|  83.2k|                     if (tag == yaml::yaml_tag::seq && indent_probe != end && *indent_probe == '-') {
  ------------------
  |  Branch (6273:26): [True: 11.6k, False: 71.6k]
  |  Branch (6273:56): [True: 11.6k, False: 0]
  |  Branch (6273:79): [True: 7.02k, False: 4.58k]
  ------------------
 6274|  7.02k|                        const auto after_dash = indent_probe + 1;
 6275|  7.02k|                        if (after_dash == end ||
  ------------------
  |  Branch (6275:29): [True: 1.57k, False: 5.44k]
  ------------------
 6276|  6.16k|                            yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_dash)]) {
  ------------------
  |  Branch (6276:29): [True: 4.59k, False: 852]
  ------------------
 6277|  6.16k|                           tagged_indentless_sequence =
 6278|  6.16k|                              (content_indent == ctx.current_indent()) ||
  ------------------
  |  Branch (6278:31): [True: 1.40k, False: 4.76k]
  ------------------
 6279|  4.76k|                              (ctx.current_indent() > 0 && (content_indent + 1) == ctx.current_indent());
  ------------------
  |  Branch (6279:32): [True: 1.88k, False: 2.88k]
  |  Branch (6279:60): [True: 391, False: 1.49k]
  ------------------
 6280|  6.16k|                        }
 6281|  7.02k|                     }
 6282|       |
 6283|  83.2k|                     consume_following_content = (ctx.current_indent() < 0) ||
  ------------------
  |  Branch (6283:50): [True: 49.2k, False: 33.9k]
  ------------------
 6284|  33.9k|                                                 (content_indent > ctx.current_indent()) || tagged_indentless_sequence;
  ------------------
  |  Branch (6284:50): [True: 11.9k, False: 22.0k]
  |  Branch (6284:93): [True: 1.79k, False: 20.2k]
  ------------------
 6285|  83.2k|                  }
 6286|       |
 6287|  89.7k|                  if (consume_following_content) {
  ------------------
  |  Branch (6287:23): [True: 62.9k, False: 26.7k]
  ------------------
 6288|  62.9k|                     it = content_token;
 6289|  62.9k|                  }
 6290|  26.7k|                  else {
 6291|  26.7k|                     if (tag == yaml::yaml_tag::str) {
  ------------------
  |  Branch (6291:26): [True: 724, False: 26.0k]
  ------------------
 6292|    724|                        if constexpr (counts::n_str > 0) {
 6293|    724|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_str>;
 6294|    724|                           using StrType = std::variant_alternative_t<first_idx, V>;
 6295|    724|                           value = StrType{};
 6296|    724|                           return;
 6297|    724|                        }
 6298|    724|                     }
 6299|  26.7k|                     if (tag == yaml::yaml_tag::null_tag) {
  ------------------
  |  Branch (6299:26): [True: 792, False: 25.9k]
  ------------------
 6300|    792|                        if constexpr (counts::n_null > 0) {
 6301|    792|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6302|    792|                           using NullType = std::variant_alternative_t<first_idx, V>;
 6303|    792|                           if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6303:32): [True: 0, False: 792]
  ------------------
 6304|    792|                           return;
 6305|    792|                        }
 6306|    792|                     }
 6307|  26.7k|                     if (tag == yaml::yaml_tag::none) {
  ------------------
  |  Branch (6307:26): [True: 18.9k, False: 7.75k]
  ------------------
 6308|  18.9k|                        if constexpr (counts::n_null > 0) {
 6309|  18.9k|                           constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6310|  18.9k|                           using NullType = std::variant_alternative_t<first_idx, V>;
 6311|  18.9k|                           if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6311:32): [True: 0, False: 18.9k]
  ------------------
 6312|  18.9k|                           return;
 6313|  18.9k|                        }
 6314|  18.9k|                     }
 6315|  26.7k|                  }
 6316|  89.7k|               }
 6317|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6318|       |                  // In block context, a comma immediately after a tag token is malformed
 6319|       |                  // (e.g., "!!str, value"). Flow context has legitimate ", ] }" usage.
 6320|       |                  if (it != end && *it == ',') {
 6321|       |                     ctx.error = error_code::syntax_error;
 6322|       |                     return;
 6323|       |                  }
 6324|       |                  if constexpr (counts::n_object > 0) {
 6325|       |                     // Tagged keys like "!!str key: value" must parse as mappings.
 6326|       |                     const bool starts_block_sequence_entry =
 6327|       |                        (it != end && *it == '-') &&
 6328|       |                        ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
 6329|       |                     if (!starts_block_sequence_entry && yaml::line_could_be_block_mapping(it, end)) {
 6330|       |                        // Re-dispatch from the post-tag token so '&key key: val' is
 6331|       |                        // handled by the anchor-aware key path, not as a map-level anchor.
 6332|       |                        redispatch<Opts>(value, ctx, it, end);
 6333|       |                        return;
 6334|       |                     }
 6335|       |                  }
 6336|       |               }
 6337|   458k|               if (it == end) {
  ------------------
  |  Branch (6337:20): [True: 4.64k, False: 453k]
  ------------------
 6338|  4.64k|                  if (tag == yaml::yaml_tag::str) {
  ------------------
  |  Branch (6338:23): [True: 868, False: 3.78k]
  ------------------
 6339|    868|                     if constexpr (counts::n_str > 0) {
 6340|    868|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_str>;
 6341|    868|                        using StrType = std::variant_alternative_t<first_idx, V>;
 6342|    868|                        value = StrType{};
 6343|    868|                        return;
 6344|    868|                     }
 6345|    868|                  }
 6346|  4.64k|                  if (tag == yaml::yaml_tag::none) {
  ------------------
  |  Branch (6346:23): [True: 3.76k, False: 884]
  ------------------
 6347|  3.76k|                     if constexpr (counts::n_null > 0) {
 6348|  3.76k|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6349|  3.76k|                        using NullType = std::variant_alternative_t<first_idx, V>;
 6350|  3.76k|                        if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6350:29): [True: 0, False: 3.76k]
  ------------------
 6351|  3.76k|                        return;
 6352|  3.76k|                     }
 6353|  3.76k|                  }
 6354|      0|                  ctx.error = error_code::unexpected_end;
 6355|  4.64k|                  return;
 6356|  4.64k|               }
 6357|   453k|               switch (tag) {
 6358|  1.65k|               case yaml::yaml_tag::str:
  ------------------
  |  Branch (6358:16): [True: 1.65k, False: 451k]
  ------------------
 6359|  1.65k|                  process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6360|  1.65k|                  return;
 6361|  8.50k|               case yaml::yaml_tag::int_tag:
  ------------------
  |  Branch (6361:16): [True: 8.50k, False: 444k]
  ------------------
 6362|  17.6k|               case yaml::yaml_tag::float_tag:
  ------------------
  |  Branch (6362:16): [True: 9.11k, False: 444k]
  ------------------
 6363|  17.6k|                  if constexpr (counts::n_num > 0) {
 6364|  17.6k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, ctx, it, end);
 6365|  17.6k|                     return;
 6366|       |                  }
 6367|       |                  else { // else used to fix MSVC unreachable code warning
 6368|       |                     ctx.error = error_code::syntax_error;
 6369|       |                     return;
 6370|       |                  }
 6371|  58.2k|               case yaml::yaml_tag::bool_tag:
  ------------------
  |  Branch (6371:16): [True: 40.5k, False: 412k]
  ------------------
 6372|  58.2k|                  if constexpr (counts::n_bool > 0) {
 6373|  58.2k|                     process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it, end);
 6374|  58.2k|                     return;
 6375|       |                  }
 6376|       |                  else { // else used to fix MSVC unreachable code warning
 6377|       |                     ctx.error = error_code::syntax_error;
 6378|       |                     return;
 6379|       |                  }
 6380|  59.3k|               case yaml::yaml_tag::null_tag:
  ------------------
  |  Branch (6380:16): [True: 1.11k, False: 452k]
  ------------------
 6381|  59.3k|                  if constexpr (counts::n_null > 0) {
 6382|  59.3k|                     constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6383|  59.3k|                     using NullType = std::variant_alternative_t<first_idx, V>;
 6384|  59.3k|                     if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6384:26): [True: 0, False: 59.3k]
  ------------------
 6385|  59.3k|                     from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6386|  59.3k|                     return;
 6387|       |                  }
 6388|       |                  else { // else used to fix MSVC unreachable code warning
 6389|       |                     ctx.error = error_code::syntax_error;
 6390|       |                     return;
 6391|       |                  }
 6392|   111k|               case yaml::yaml_tag::map:
  ------------------
  |  Branch (6392:16): [True: 52.2k, False: 401k]
  ------------------
 6393|   111k|                  if constexpr (counts::n_object > 0) {
 6394|   111k|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6395|   111k|                                                                                                     end);
 6396|   111k|                     return;
 6397|       |                  }
 6398|       |                  else { // else used to fix MSVC unreachable code warning
 6399|       |                     ctx.error = error_code::syntax_error;
 6400|       |                     return;
 6401|       |                  }
 6402|   145k|               case yaml::yaml_tag::seq:
  ------------------
  |  Branch (6402:16): [True: 34.2k, False: 419k]
  ------------------
 6403|   145k|                  if constexpr (counts::n_array > 0) {
 6404|   145k|                     const bool prev_allow_indentless_sequence = ctx.allow_indentless_sequence;
 6405|       |                     if constexpr (!yaml::check_flow_context(Opts)) {
 6406|       |                        if (it != end && *it == '-') {
 6407|       |                           ctx.allow_indentless_sequence = true;
 6408|       |                        }
 6409|       |                     }
 6410|   145k|                     process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6411|   145k|                                                                                                    end);
 6412|   145k|                     ctx.allow_indentless_sequence = prev_allow_indentless_sequence;
 6413|   145k|                     return;
 6414|       |                  }
 6415|       |                  else { // else used to fix MSVC unreachable code warning
 6416|       |                     ctx.error = error_code::syntax_error;
 6417|       |                     return;
 6418|       |                  }
 6419|   431k|               default: {
  ------------------
  |  Branch (6419:16): [True: 285k, False: 167k]
  ------------------
 6420|       |                  // Explicit unknown/non-core tags disable implicit scalar resolution.
 6421|       |                  // Preserve collection kinds, otherwise treat as string content.
 6422|   431k|                  if (it != end && *it == '*') {
  ------------------
  |  Branch (6422:23): [True: 285k, False: 145k]
  |  Branch (6422:36): [True: 110k, False: 175k]
  ------------------
 6423|   110k|                     yaml::handle_alias<Opts>(value, ctx, it, end);
 6424|   110k|                     return;
 6425|   110k|                  }
 6426|       |
 6427|   321k|                  if constexpr (counts::n_array > 0) {
 6428|   321k|                     if (it != end && *it == '[') {
  ------------------
  |  Branch (6428:26): [True: 175k, False: 145k]
  |  Branch (6428:39): [True: 3.74k, False: 171k]
  ------------------
 6429|  3.74k|                        process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6430|  3.74k|                                                                                                       end);
 6431|  3.74k|                        return;
 6432|  3.74k|                     }
 6433|   321k|                  }
 6434|   321k|                  if constexpr (counts::n_object > 0) {
 6435|   321k|                     if (it != end && *it == '{') {
  ------------------
  |  Branch (6435:26): [True: 171k, False: 149k]
  |  Branch (6435:39): [True: 2.50k, False: 169k]
  ------------------
 6436|  2.50k|                        process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6437|  2.50k|                                                                                                        end);
 6438|  2.50k|                        return;
 6439|  2.50k|                     }
 6440|   321k|                  }
 6441|       |
 6442|       |                  if constexpr (!yaml::check_flow_context(Opts)) {
 6443|       |                     if constexpr (counts::n_array > 0) {
 6444|       |                        const bool starts_block_sequence_entry =
 6445|       |                           (it != end && *it == '-') &&
 6446|       |                           ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
 6447|       |                        if (starts_block_sequence_entry) {
 6448|       |                           process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx,
 6449|       |                                                                                                          it, end);
 6450|       |                           return;
 6451|       |                        }
 6452|       |                     }
 6453|       |                     if constexpr (counts::n_object > 0) {
 6454|       |                        const bool starts_explicit_mapping_indicator =
 6455|       |                           (it != end && (*it == '?' || *it == ':')) &&
 6456|       |                           ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]);
 6457|       |                        if (starts_explicit_mapping_indicator) {
 6458|       |                           process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx,
 6459|       |                                                                                                           it, end);
 6460|       |                           return;
 6461|       |                        }
 6462|       |                        if (yaml::line_could_be_block_mapping(it, end)) {
 6463|       |                           process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx,
 6464|       |                                                                                                           it, end);
 6465|       |                           return;
 6466|       |                        }
 6467|       |                     }
 6468|       |                  }
 6469|       |
 6470|   321k|                  if constexpr (counts::n_str > 0) {
 6471|   321k|                     process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6472|   321k|                     return;
 6473|   321k|                  }
 6474|       |
 6475|       |                  // Fall back if no string alternative exists.
 6476|      0|                  redispatch<Opts>(value, ctx, it, end);
 6477|   321k|                  return;
 6478|   431k|               }
 6479|   453k|               }
 6480|      0|               return;
 6481|   453k|            }
 6482|  1.14M|            case '{':
  ------------------
  |  Branch (6482:13): [True: 1.14M, False: 5.78M]
  ------------------
 6483|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6484|       |                  // In block context, "{...}: value" can be a complex mapping key.
 6485|       |                  if (ctx.current_indent() < 0 && yaml::line_could_be_block_mapping(it, end)) {
 6486|       |                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6487|       |                                                                                                     end);
 6488|       |                     return;
 6489|       |                  }
 6490|       |               }
 6491|       |               // Flow mapping - object type
 6492|  1.14M|               process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it, end);
 6493|  1.14M|               return;
 6494|   135k|            case '[':
  ------------------
  |  Branch (6494:13): [True: 135k, False: 6.79M]
  ------------------
 6495|       |               if constexpr (!yaml::check_flow_context(Opts)) {
 6496|       |                  // In block context, "[...]: value" can be a complex mapping key.
 6497|       |                  if (ctx.current_indent() < 0 && yaml::line_could_be_block_mapping(it, end)) {
 6498|       |                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6499|       |                                                                                                     end);
 6500|       |                     return;
 6501|       |                  }
 6502|       |               }
 6503|       |               // Flow sequence - array type
 6504|   135k|               process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it, end);
 6505|   135k|               return;
 6506|   326k|            case '?':
  ------------------
  |  Branch (6506:13): [True: 326k, False: 6.60M]
  ------------------
 6507|       |               // Explicit mapping key indicator ("? key")
 6508|   326k|               if ((end - it >= 2) && it[1] == '\t') {
  ------------------
  |  Branch (6508:20): [True: 326k, False: 31]
  |  Branch (6508:39): [True: 11, False: 326k]
  ------------------
 6509|     11|                  ctx.error = error_code::syntax_error;
 6510|     11|                  return;
 6511|     11|               }
 6512|   326k|               if ((end - it >= 2) && (it[1] == ' ' || it[1] == '\n' || it[1] == '\r')) {
  ------------------
  |  Branch (6512:20): [True: 326k, False: 31]
  |  Branch (6512:40): [True: 81.4k, False: 244k]
  |  Branch (6512:56): [True: 136k, False: 108k]
  |  Branch (6512:73): [True: 72.1k, False: 36.3k]
  ------------------
 6513|   289k|                  if constexpr (counts::n_object > 0) {
 6514|   289k|                     process_yaml_variant_alternatives<V, is_yaml_variant_object>::template op<Opts>(value, ctx, it,
 6515|   289k|                                                                                                     end);
 6516|   289k|                     return;
 6517|   289k|                  }
 6518|   289k|               }
 6519|      0|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6520|   326k|               return;
 6521|     48|            case '%':
  ------------------
  |  Branch (6521:13): [True: 48, False: 6.92M]
  ------------------
 6522|       |               // Reserved directive indicator is not a plain scalar start.
 6523|     48|               ctx.error = error_code::syntax_error;
 6524|     48|               return;
 6525|  12.8k|            case '"':
  ------------------
  |  Branch (6525:13): [True: 12.8k, False: 6.91M]
  ------------------
 6526|  19.8k|            case '\'':
  ------------------
  |  Branch (6526:13): [True: 6.99k, False: 6.92M]
  ------------------
 6527|       |               // Could be a quoted string OR a quoted key in a block mapping
 6528|       |               // Try block mapping first (e.g., "key": value), then fall back to string
 6529|  19.8k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6530|  19.8k|               return;
 6531|  29.1k|            case 't':
  ------------------
  |  Branch (6531:13): [True: 29.1k, False: 6.89M]
  ------------------
 6532|  82.0k|            case 'T':
  ------------------
  |  Branch (6532:13): [True: 52.9k, False: 6.87M]
  ------------------
 6533|       |               // Could be "true", "True", "TRUE", or a key/string starting with t/T
 6534|  82.0k|               if constexpr (counts::n_bool > 0) {
 6535|  82.0k|                  if ((end - it >= 4) && ((it[1] == 'r' && it[2] == 'u' && it[3] == 'e') ||
  ------------------
  |  Branch (6535:23): [True: 80.3k, False: 1.72k]
  |  Branch (6535:44): [True: 58.6k, False: 21.7k]
  |  Branch (6535:60): [True: 57.0k, False: 1.65k]
  |  Branch (6535:76): [True: 44.0k, False: 12.9k]
  ------------------
 6536|  47.3k|                                          (it[1] == 'R' && it[2] == 'U' && it[3] == 'E'))) {
  ------------------
  |  Branch (6536:44): [True: 6.60k, False: 29.7k]
  |  Branch (6536:60): [True: 4.32k, False: 2.28k]
  |  Branch (6536:76): [True: 3.34k, False: 982]
  ------------------
 6537|       |                     // Check what follows the word "true"
 6538|  47.3k|                     const auto after_true = it + 4;
 6539|  47.3k|                     const bool at_word_boundary = is_word_boundary(after_true);
 6540|       |
 6541|  47.3k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6541:26): [True: 44.9k, False: 2.43k]
  ------------------
 6542|  44.9k|                        if (has_indented_block_continuation(after_true)) {
  ------------------
  |  Branch (6542:29): [True: 0, False: 44.9k]
  ------------------
 6543|      0|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6544|      0|                           return;
 6545|      0|                        }
 6546|       |                        // Check if this is a key (followed by ": ") rather than a boolean value
 6547|       |                        // "true: value" should parse as {true: value}, not as the boolean true
 6548|  44.9k|                        if ((end - it > 4) && it[4] == ':' &&
  ------------------
  |  Branch (6548:29): [True: 43.7k, False: 1.22k]
  |  Branch (6548:47): [True: 34.6k, False: 9.05k]
  ------------------
 6549|  34.6k|                            (end - it == 5 || it[5] == ' ' || it[5] == '\t' || it[5] == '\n' || it[5] == '\r')) {
  ------------------
  |  Branch (6549:30): [True: 1.53k, False: 33.1k]
  |  Branch (6549:47): [True: 27.0k, False: 6.09k]
  |  Branch (6549:63): [True: 3.86k, False: 2.22k]
  |  Branch (6549:80): [True: 1.26k, False: 962]
  |  Branch (6549:97): [True: 962, False: 0]
  ------------------
 6550|       |                           // This is "true:" followed by space/tab/newline/end - treat as key
 6551|  34.6k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6552|  34.6k|                           return;
 6553|  34.6k|                        }
 6554|  10.2k|                        process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it,
 6555|  10.2k|                                                                                                      end);
 6556|  10.2k|                        return;
 6557|  44.9k|                     }
 6558|       |                     // "true" is followed by more characters (e.g., "True\b") - treat as string
 6559|  47.3k|                  }
 6560|  82.0k|               }
 6561|  37.1k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6562|  82.0k|               return;
 6563|  51.0k|            case 'f':
  ------------------
  |  Branch (6563:13): [True: 51.0k, False: 6.87M]
  ------------------
 6564|  78.0k|            case 'F':
  ------------------
  |  Branch (6564:13): [True: 27.0k, False: 6.90M]
  ------------------
 6565|       |               // Could be "false", "False", "FALSE", or a key/string starting with f/F
 6566|  78.0k|               if constexpr (counts::n_bool > 0) {
 6567|  78.0k|                  if ((end - it >= 5) && ((it[1] == 'a' && it[2] == 'l' && it[3] == 's' && it[4] == 'e') ||
  ------------------
  |  Branch (6567:23): [True: 76.0k, False: 1.98k]
  |  Branch (6567:44): [True: 34.7k, False: 41.3k]
  |  Branch (6567:60): [True: 25.0k, False: 9.69k]
  |  Branch (6567:76): [True: 23.5k, False: 1.49k]
  |  Branch (6567:92): [True: 22.2k, False: 1.29k]
  ------------------
 6568|  53.7k|                                          (it[1] == 'A' && it[2] == 'L' && it[3] == 'S' && it[4] == 'E'))) {
  ------------------
  |  Branch (6568:44): [True: 9.80k, False: 43.9k]
  |  Branch (6568:60): [True: 5.69k, False: 4.11k]
  |  Branch (6568:76): [True: 4.43k, False: 1.25k]
  |  Branch (6568:92): [True: 2.06k, False: 2.37k]
  ------------------
 6569|       |                     // Check what follows the word "false"
 6570|  24.3k|                     const auto after_false = it + 5;
 6571|  24.3k|                     const bool at_word_boundary = is_word_boundary(after_false);
 6572|       |
 6573|  24.3k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6573:26): [True: 21.6k, False: 2.62k]
  ------------------
 6574|  21.6k|                        if (has_indented_block_continuation(after_false)) {
  ------------------
  |  Branch (6574:29): [True: 0, False: 21.6k]
  ------------------
 6575|      0|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6576|      0|                           return;
 6577|      0|                        }
 6578|       |                        // Check if this is a key (followed by ": ") rather than a boolean value
 6579|       |                        // "false: value" should parse as {false: value}, not as the boolean false
 6580|  21.6k|                        if ((end - it > 5) && it[5] == ':' &&
  ------------------
  |  Branch (6580:29): [True: 20.3k, False: 1.32k]
  |  Branch (6580:47): [True: 17.5k, False: 2.78k]
  ------------------
 6581|  17.5k|                            (end - it == 6 || it[6] == ' ' || it[6] == '\t' || it[6] == '\n' || it[6] == '\r')) {
  ------------------
  |  Branch (6581:30): [True: 1.00k, False: 16.5k]
  |  Branch (6581:47): [True: 7.47k, False: 9.09k]
  |  Branch (6581:63): [True: 2.89k, False: 6.19k]
  |  Branch (6581:80): [True: 1.24k, False: 4.95k]
  |  Branch (6581:97): [True: 4.95k, False: 0]
  ------------------
 6582|       |                           // This is "false:" followed by space/tab/newline/end - treat as key
 6583|  17.5k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6584|  17.5k|                           return;
 6585|  17.5k|                        }
 6586|  4.11k|                        process_yaml_variant_alternatives<V, is_yaml_variant_bool>::template op<Opts>(value, ctx, it,
 6587|  4.11k|                                                                                                      end);
 6588|  4.11k|                        return;
 6589|  21.6k|                     }
 6590|       |                     // "false" is followed by more characters (e.g., "False\b") - treat as string
 6591|  24.3k|                  }
 6592|  78.0k|               }
 6593|  56.3k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6594|  78.0k|               return;
 6595|  52.3k|            case 'n':
  ------------------
  |  Branch (6595:13): [True: 52.3k, False: 6.87M]
  ------------------
 6596|  68.1k|            case 'N':
  ------------------
  |  Branch (6596:13): [True: 15.7k, False: 6.91M]
  ------------------
 6597|       |               // Could be "null", "Null", "NULL", or a key/string starting with n/N
 6598|  68.1k|               if constexpr (counts::n_null > 0) {
 6599|  68.1k|                  if ((end - it >= 4) && ((it[1] == 'u' && it[2] == 'l' && it[3] == 'l') ||
  ------------------
  |  Branch (6599:23): [True: 67.1k, False: 971]
  |  Branch (6599:44): [True: 44.7k, False: 22.4k]
  |  Branch (6599:60): [True: 35.3k, False: 9.39k]
  |  Branch (6599:76): [True: 33.7k, False: 1.56k]
  ------------------
 6600|  35.5k|                                          (it[1] == 'U' && it[2] == 'L' && it[3] == 'L'))) {
  ------------------
  |  Branch (6600:44): [True: 5.25k, False: 28.1k]
  |  Branch (6600:60): [True: 3.71k, False: 1.53k]
  |  Branch (6600:76): [True: 1.81k, False: 1.90k]
  ------------------
 6601|       |                     // Check what follows the word "null"
 6602|  35.5k|                     const auto after_null = it + 4;
 6603|  35.5k|                     const bool at_word_boundary = is_word_boundary(after_null);
 6604|       |
 6605|  35.5k|                     if (at_word_boundary) {
  ------------------
  |  Branch (6605:26): [True: 30.1k, False: 5.43k]
  ------------------
 6606|  30.1k|                        if (has_indented_block_continuation(after_null)) {
  ------------------
  |  Branch (6606:29): [True: 0, False: 30.1k]
  ------------------
 6607|      0|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6608|      0|                           return;
 6609|      0|                        }
 6610|       |                        // Check if this is a key (followed by ": ") rather than a null value
 6611|       |                        // "null: value" should parse as {null: value}, not as the null type
 6612|  30.1k|                        if ((end - it > 4) && it[4] == ':' &&
  ------------------
  |  Branch (6612:29): [True: 29.3k, False: 794]
  |  Branch (6612:47): [True: 20.2k, False: 9.14k]
  ------------------
 6613|  20.2k|                            (end - it == 5 || it[5] == ' ' || it[5] == '\t' || it[5] == '\n' || it[5] == '\r')) {
  ------------------
  |  Branch (6613:30): [True: 985, False: 19.2k]
  |  Branch (6613:47): [True: 1.24k, False: 17.9k]
  |  Branch (6613:63): [True: 16.3k, False: 1.63k]
  |  Branch (6613:80): [True: 729, False: 908]
  |  Branch (6613:97): [True: 908, False: 0]
  ------------------
 6614|       |                           // This is "null:" followed by space/tab/newline/end - treat as key
 6615|  20.2k|                           parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6616|  20.2k|                           return;
 6617|  20.2k|                        }
 6618|  9.94k|                        constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6619|  9.94k|                        using NullType = std::variant_alternative_t<first_idx, V>;
 6620|  9.94k|                        if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6620:29): [True: 0, False: 9.94k]
  ------------------
 6621|  9.94k|                        from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6622|  9.94k|                        return;
 6623|  30.1k|                     }
 6624|       |                     // "null" is followed by more characters (e.g., "Null\b") - treat as string
 6625|  35.5k|                  }
 6626|  68.1k|               }
 6627|  37.9k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6628|  68.1k|               return;
 6629|  5.70k|            case '~':
  ------------------
  |  Branch (6629:13): [True: 5.70k, False: 6.92M]
  ------------------
 6630|       |               // Null indicator
 6631|  5.70k|               if constexpr (counts::n_null > 0) {
 6632|  5.70k|                  constexpr auto first_idx = yaml_variant_first_index_v<V, is_yaml_variant_null>;
 6633|  5.70k|                  using NullType = std::variant_alternative_t<first_idx, V>;
 6634|  5.70k|                  if (!std::holds_alternative<NullType>(value)) value = NullType{};
  ------------------
  |  Branch (6634:23): [True: 0, False: 5.70k]
  ------------------
 6635|  5.70k|                  from<YAML, NullType>::template op<Opts>(std::get<NullType>(value), ctx, it, end);
 6636|  5.70k|                  return;
 6637|  5.70k|               }
 6638|      0|               break; // Fall through to try other types
 6639|   234k|            case '-':
  ------------------
  |  Branch (6639:13): [True: 234k, False: 6.69M]
  ------------------
 6640|       |               // Could be negative number or block sequence indicator
 6641|   234k|               if (((it + 1) == end) || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(it[1])]) {
  ------------------
  |  Branch (6641:20): [True: 5.66k, False: 228k]
  |  Branch (6641:41): [True: 173k, False: 55.1k]
  ------------------
 6642|       |                  // Block sequence indicator "- "
 6643|   179k|                  if constexpr (counts::n_array > 0) {
 6644|   179k|                     process_yaml_variant_alternatives<V, is_yaml_variant_array>::template op<Opts>(value, ctx, it,
 6645|   179k|                                                                                                    end);
 6646|   179k|                     return;
 6647|   179k|                  }
 6648|   179k|               }
 6649|   234k|               if constexpr (counts::n_num > 0) {
 6650|   234k|                  if ((end - it >= 2) && (std::isdigit(static_cast<unsigned char>(it[1])) || it[1] == '.')) {
  ------------------
  |  Branch (6650:23): [True: 55.1k, False: 179k]
  |  Branch (6650:43): [True: 4.48k, False: 50.7k]
  |  Branch (6650:94): [True: 3.87k, False: 46.8k]
  ------------------
 6651|  8.35k|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, ctx, it, end);
 6652|  8.35k|                     return;
 6653|  8.35k|                  }
 6654|   234k|               }
 6655|   226k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6656|   234k|               return;
 6657|  21.2k|            case '+':
  ------------------
  |  Branch (6657:13): [True: 21.2k, False: 6.90M]
  ------------------
 6658|  68.3k|            case '.':
  ------------------
  |  Branch (6658:13): [True: 47.0k, False: 6.88M]
  ------------------
 6659|       |               // Could be a number (.5, +5, .inf, etc.) or a string (.c, .cpp, +name, etc.)
 6660|       |               // Try parsing as number speculatively, fall back to string on failure
 6661|  68.3k|               if constexpr (counts::n_num > 0) {
 6662|  68.3k|                  auto start_it = it;
 6663|  68.3k|                  auto temp_ctx = ctx.make_speculative();
 6664|  68.3k|                  process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, temp_ctx, it,
 6665|  68.3k|                                                                                               end);
 6666|  68.3k|                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6667|  68.3k|                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6668|  68.3k|                  if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (6668:23): [True: 8.40k, False: 59.9k]
  ------------------
 6669|  8.40k|                     ctx.anchors = std::move(temp_ctx.anchors);
 6670|  8.40k|                     return; // Successfully parsed as number
 6671|  8.40k|                  }
 6672|  59.9k|                  it = start_it; // Restore and fall through to string
 6673|  59.9k|               }
 6674|      0|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6675|  68.3k|               return;
 6676|  2.28M|            default:
  ------------------
  |  Branch (6676:13): [True: 2.28M, False: 4.63M]
  ------------------
 6677|       |               // Check for digit (0-9) - numeric or block mapping key starting with digit
 6678|  2.28M|               if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (6678:20): [True: 1.99M, False: 290k]
  |  Branch (6678:32): [True: 1.63M, False: 368k]
  ------------------
 6679|       |                  // Try block mapping first (e.g., "123key: value")
 6680|  1.63M|                  if (try_parse_block_mapping_into_variant<V, Opts>(value, ctx, it, end)) {
  ------------------
  |  Branch (6680:23): [True: 10.6k, False: 1.61M]
  ------------------
 6681|  10.6k|                     return;
 6682|  10.6k|                  }
 6683|       |                  // Try numeric value speculatively - values like "12:30" look numeric but aren't
 6684|  1.61M|                  if constexpr (counts::n_num > 0) {
 6685|  1.61M|                     auto start_it = it;
 6686|  1.61M|                     auto temp_ctx = ctx.make_speculative();
 6687|  1.61M|                     process_yaml_variant_alternatives<V, is_yaml_variant_num>::template op<Opts>(value, temp_ctx, it,
 6688|  1.61M|                                                                                                  end);
 6689|  1.61M|                     ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6690|  1.61M|                     ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6691|  1.61M|                     if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (6691:26): [True: 1.52M, False: 92.8k]
  ------------------
 6692|  1.52M|                        ctx.anchors = std::move(temp_ctx.anchors);
 6693|  1.52M|                        return; // Successfully parsed as number
 6694|  1.52M|                     }
 6695|  92.8k|                     it = start_it; // Restore and fall through to string
 6696|  92.8k|                  }
 6697|       |                  // Fall through to string
 6698|      0|                  process_yaml_variant_alternatives<V, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 6699|  1.61M|                  return;
 6700|  1.63M|               }
 6701|       |               // Plain scalar - try block mapping, then string
 6702|   659k|               parse_block_mapping_or_string<V, Opts>(value, ctx, it, end);
 6703|   659k|               return;
 6704|  6.92M|            }
 6705|  6.92M|         }
 6706|       |
 6707|       |         // For non-auto-deducible variants or fallback, try each type until one succeeds
 6708|      0|         constexpr auto N = std::variant_size_v<std::remove_cvref_t<T>>;
 6709|       |
 6710|       |         // This fold discards each alternative's error and reports only that nothing fit, which
 6711|       |         // misdiagnoses a document that exhausted an expansion budget as merely the wrong shape.
 6712|       |         // Kept aside and used only if no alternative parsed, so a later one that does parse
 6713|       |         // (possible under a latched budget if it materializes no key text) is unaffected.
 6714|  6.92M|         error_code expansion_error{};
 6715|  6.92M|         std::string_view expansion_message{};
 6716|       |
 6717|  6.92M|         auto try_parse = [&]<size_t I>() -> bool {
 6718|  6.92M|            using V = std::variant_alternative_t<I, std::remove_cvref_t<T>>;
 6719|  6.92M|            auto start = it;
 6720|       |
 6721|  6.92M|            V v{};
 6722|  6.92M|            auto temp_ctx = ctx.make_speculative();
 6723|  6.92M|            from<YAML, V>::template op<Opts>(v, temp_ctx, it, end);
 6724|  6.92M|            ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 6725|  6.92M|            ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 6726|       |
 6727|  6.92M|            if (!bool(temp_ctx.error)) {
 6728|  6.92M|               value = std::move(v);
 6729|  6.92M|               ctx.anchors = std::move(temp_ctx.anchors);
 6730|  6.92M|               return true;
 6731|  6.92M|            }
 6732|       |
 6733|  6.92M|            if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 6734|  6.92M|               expansion_error = temp_ctx.error;
 6735|  6.92M|               expansion_message = temp_ctx.custom_error_message;
 6736|  6.92M|            }
 6737|  6.92M|            it = start;
 6738|  6.92M|            return false;
 6739|  6.92M|         };
 6740|       |
 6741|  6.92M|         bool parsed = false;
 6742|  6.92M|         [&]<size_t... Is>(std::index_sequence<Is...>) {
 6743|  6.92M|            ((parsed = parsed || try_parse.template operator()<Is>()), ...);
 6744|  6.92M|         }(std::make_index_sequence<N>{});
 6745|       |
 6746|  6.92M|         if (!parsed) {
  ------------------
  |  Branch (6746:14): [True: 0, False: 6.92M]
  ------------------
 6747|      0|            if (expansion_error != error_code::none) {
  ------------------
  |  Branch (6747:17): [True: 0, False: 0]
  ------------------
 6748|      0|               ctx.error = expansion_error;
 6749|      0|               ctx.custom_error_message = expansion_message;
 6750|      0|            }
 6751|      0|            else {
 6752|      0|               ctx.error = error_code::no_matching_variant_type;
 6753|      0|            }
 6754|      0|         }
 6755|  6.92M|      }
_ZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE10redispatchITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRSH_TkNS_10is_contextERNSK_12yaml_contextESN_EEvOT1_OT2_OT0_T3_:
 6762|  1.41M|      {
 6763|  1.41M|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 6764|  1.41M|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (6764:14): [True: 33, False: 1.41M]
  ------------------
 6765|     33|            return;
 6766|  1.41M|         op<Opts>(value, ctx, it, end);
 6767|  1.41M|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERNSt3__17variantIJDndNS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbNS3_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS8_ISF_EEEENSE_ISF_EEEEENS0_12yaml_contextEPKcSN_EEbOT0_RT1_RT2_T3_:
  309|   664k|      {
  310|   664k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 664k]
  |  Branch (310:27): [True: 0, False: 664k]
  ------------------
  311|       |
  312|   664k|         ++it; // skip '*'
  313|   664k|         auto name = parse_anchor_name(it, end);
  314|   664k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 393, False: 664k]
  ------------------
  315|    393|            ctx.error = error_code::syntax_error;
  316|    393|            return true;
  317|    393|         }
  318|       |
  319|   664k|         auto anchor_it = ctx.anchors.find(name);
  320|   664k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 2.89k, False: 661k]
  ------------------
  321|  2.89k|            ctx.error = error_code::syntax_error; // undefined alias
  322|  2.89k|            return true;
  323|  2.89k|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|   661k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|   661k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 56.5k, False: 604k]
  ------------------
  331|  56.5k|            return true;
  332|  56.5k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|   604k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 39, False: 604k]
  ------------------
  338|     39|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     39|            return true;
  340|     39|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|   604k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|   604k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 6, False: 604k]
  ------------------
  348|      6|            return true;
  349|       |
  350|   604k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 37, False: 604k]
  ------------------
  351|     37|            ctx.error = error_code::exceeded_max_expansion;
  352|     37|            ctx.custom_error_message = "alias expansion";
  353|     37|            return true;
  354|     37|         }
  355|       |
  356|   604k|         auto replay_it = span.begin;
  357|   604k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|   604k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|   604k|         ctx.indent_stack.clear();
  362|   604k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 27.4k, False: 577k]
  ------------------
  363|  27.4k|            ctx.push_indent(span.base_indent - 1);
  364|  27.4k|         }
  365|       |
  366|   604k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|   604k|         using V = std::remove_cvref_t<T>;
  369|   604k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|   604k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|   604k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|   604k|         return true;
  376|   604k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_19is_yaml_variant_strEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERSH_TkNS_10is_contextERNSL_12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   881k|      {
 5356|   881k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   881k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   881k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   881k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   881k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 881k, False: 0]
  ------------------
 5366|   881k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   881k|      }
_ZN3glz4fromILj450ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRS7_TkNS_10is_contextERNSA_12yaml_contextESD_EEvOT1_OT2_OT0_T3_:
 1987|   900k|      {
 1988|   900k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (1988:14): [True: 15.4k, False: 884k]
  ------------------
 1989|  15.4k|            return;
 1990|       |
 1991|   884k|         yaml::node_preamble_state preamble{};
 1992|   884k|         if (yaml::parse_node_preamble<Opts, yaml::node_property_policy{true, false, false, true}>(
  ------------------
  |  Branch (1992:14): [True: 24.5k, False: 860k]
  ------------------
 1993|   884k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_string(tag); }))
 1994|  24.5k|            return;
 1995|       |
 1996|   860k|         std::string str;
 1997|   860k|         const auto style = yaml::detect_scalar_style(*it);
 1998|       |
 1999|   860k|         switch (style) {
  ------------------
  |  Branch (1999:18): [True: 860k, False: 0]
  ------------------
 2000|  9.10k|         case yaml::scalar_style::double_quoted:
  ------------------
  |  Branch (2000:10): [True: 9.10k, False: 851k]
  ------------------
 2001|  9.10k|            yaml::parse_double_quoted_string(str, ctx, it, end);
 2002|  9.10k|            break;
 2003|  3.79k|         case yaml::scalar_style::single_quoted:
  ------------------
  |  Branch (2003:10): [True: 3.79k, False: 856k]
  ------------------
 2004|  3.79k|            yaml::parse_single_quoted_string(str, ctx, it, end);
 2005|  3.79k|            break;
 2006|  1.37k|         case yaml::scalar_style::literal_block:
  ------------------
  |  Branch (2006:10): [True: 1.37k, False: 858k]
  ------------------
 2007|  9.87k|         case yaml::scalar_style::folded_block:
  ------------------
  |  Branch (2007:10): [True: 8.49k, False: 851k]
  ------------------
 2008|       |            // For same-line mapping/sequence values, parsing context is typically pushed
 2009|       |            // one column past the key/item indicator; block scalar indentation is relative
 2010|       |            // to the parent line indent.
 2011|  9.87k|            yaml::parse_block_scalar(str, ctx, it, end,
 2012|  9.87k|                                     ctx.current_indent() > 0 ? (ctx.current_indent() - 1) : ctx.current_indent());
  ------------------
  |  Branch (2012:38): [True: 2.46k, False: 7.40k]
  ------------------
 2013|  9.87k|            break;
 2014|   837k|         case yaml::scalar_style::plain:
  ------------------
  |  Branch (2014:10): [True: 837k, False: 22.7k]
  ------------------
 2015|       |            // A collection where a string is expected is a type mismatch. Reading it as a
 2016|       |            // plain scalar would store its source text, and for a block sequence only the
 2017|       |            // first entry, as the value.
 2018|   837k|            if (yaml::plain_scalar_starts_collection(it, end)) [[unlikely]] {
  ------------------
  |  Branch (2018:17): [True: 168, False: 837k]
  ------------------
 2019|    168|               ctx.error = error_code::syntax_error;
 2020|    168|               return;
 2021|    168|            }
 2022|       |            // In block context with known indent, use multiline parsing to support
 2023|       |            // plain scalars that span multiple lines (folding behavior)
 2024|       |            if constexpr (!yaml::check_flow_context(Opts)) {
 2025|       |               if (ctx.current_indent() >= 0) {
 2026|       |                  yaml::parse_plain_scalar_multiline(str, ctx, it, end, ctx.current_indent());
 2027|       |               }
 2028|       |               else {
 2029|       |                  // Top-level plain scalars may continue on same-indent or indented lines.
 2030|       |                  yaml::parse_plain_scalar_multiline(str, ctx, it, end, int32_t(0));
 2031|       |               }
 2032|       |            }
 2033|   837k|            else {
 2034|   837k|               yaml::parse_plain_scalar(str, ctx, it, end, true);
 2035|   837k|            }
 2036|   837k|            break;
 2037|   860k|         }
 2038|       |
 2039|   860k|         if (!bool(ctx.error)) {
  ------------------
  |  Branch (2039:14): [True: 850k, False: 9.38k]
  ------------------
 2040|   850k|            value = std::move(str);
 2041|   850k|            yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 2042|   850k|         }
 2043|   860k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEEXtlNS0_20node_property_policyELb1ELb0ELb0ELb1EEELb0ERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_12yaml_contextEPKcSE_ZNS_4fromILj450ESA_E2opITnDaXtlS2_Lj450ELb1ELb0ELb1ELh2ELb0ELj1EEERSE_SB_TkNS_10is_contextERSC_SE_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSN_RSQ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   884k|      {
  475|   884k|         skip_inline_ws(it, end);
  476|       |
  477|   884k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 17, False: 884k]
  ------------------
  478|     17|            if constexpr (!AllowEmptyInput) {
  479|     17|               ctx.error = error_code::unexpected_end;
  480|     17|            }
  481|     17|            return true;
  482|     17|         }
  483|       |
  484|   884k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   884k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 23, False: 884k]
  ------------------
  486|     23|            ctx.error = error_code::syntax_error;
  487|     23|            return true;
  488|     23|         }
  489|   884k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 9, False: 884k]
  ------------------
  490|      9|            ctx.error = error_code::syntax_error;
  491|      9|            return true;
  492|      9|         }
  493|       |
  494|   884k|         skip_inline_ws(it, end);
  495|       |
  496|   884k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 29, False: 884k]
  ------------------
  497|     29|            if constexpr (!AllowEmptyInput) {
  498|     29|               ctx.error = error_code::unexpected_end;
  499|     29|            }
  500|     29|            return true;
  501|     29|         }
  502|       |
  503|   884k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 24.4k, False: 860k]
  ------------------
  504|  24.4k|            return true;
  505|  24.4k|         }
  506|       |
  507|   860k|         return false;
  508|   884k|      }
_ZZN3glz4fromILj450ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRS7_TkNS_10is_contextERNSA_12yaml_contextESD_EEvOT1_OT2_OT0_T3_ENKUlNSA_8yaml_tagEE_clESP_:
 1993|   884k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_string(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEEXtlNS0_20node_property_policyELb1ELb0ELb0ELb1EEERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_12yaml_contextEPKcSE_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   884k|      {
  418|   884k|         state.has_anchor = false;
  419|   884k|         state.anchor_name.clear();
  420|   884k|         state.anchor_start = nullptr;
  421|   884k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   884k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|   884k|            else {
  430|   884k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 24.3k, False: 860k]
  ------------------
  431|   884k|            }
  432|   884k|         }
  433|       |
  434|   884k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 860k, False: 24.3k]
  |  Branch (434:27): [True: 37.5k, False: 822k]
  ------------------
  435|  37.5k|            ++it;
  436|  37.5k|            auto name = parse_anchor_name(it, end);
  437|  37.5k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 34, False: 37.4k]
  ------------------
  438|     34|               ctx.error = error_code::syntax_error;
  439|     34|               return true;
  440|     34|            }
  441|  37.4k|            skip_inline_ws(it, end);
  442|  37.4k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 52, False: 37.4k]
  ------------------
  443|     52|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     52|                  ctx.error = error_code::unexpected_end;
  445|     52|               }
  446|     52|               return true;
  447|     52|            }
  448|  37.4k|            if constexpr (Policy.disallow_anchor_on_alias) {
  449|  37.4k|               if (*it == '*') {
  ------------------
  |  Branch (449:20): [True: 10, False: 37.4k]
  ------------------
  450|     10|                  ctx.error = error_code::syntax_error;
  451|     10|                  return true;
  452|     10|               }
  453|  37.4k|            }
  454|  37.4k|            state.has_anchor = true;
  455|  37.4k|            state.anchor_name = std::string(name);
  456|  37.4k|            state.anchor_start = &*it;
  457|  37.4k|         }
  458|       |
  459|   884k|         return false;
  460|   884k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS0_12yaml_contextEPKcSD_EEbOT0_RT1_RT2_T3_:
  309|   884k|      {
  310|   884k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 884k]
  |  Branch (310:27): [True: 860k, False: 24.3k]
  ------------------
  311|       |
  312|  24.3k|         ++it; // skip '*'
  313|  24.3k|         auto name = parse_anchor_name(it, end);
  314|  24.3k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 40, False: 24.3k]
  ------------------
  315|     40|            ctx.error = error_code::syntax_error;
  316|     40|            return true;
  317|     40|         }
  318|       |
  319|  24.3k|         auto anchor_it = ctx.anchors.find(name);
  320|  24.3k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 85, False: 24.2k]
  ------------------
  321|     85|            ctx.error = error_code::syntax_error; // undefined alias
  322|     85|            return true;
  323|     85|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  24.2k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  24.2k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 5.69k, False: 18.5k]
  ------------------
  331|  5.69k|            return true;
  332|  5.69k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  18.5k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 19, False: 18.5k]
  ------------------
  338|     19|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     19|            return true;
  340|     19|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  18.5k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  18.5k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 6, False: 18.5k]
  ------------------
  348|      6|            return true;
  349|       |
  350|  18.5k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 24, False: 18.4k]
  ------------------
  351|     24|            ctx.error = error_code::exceeded_max_expansion;
  352|     24|            ctx.custom_error_message = "alias expansion";
  353|     24|            return true;
  354|     24|         }
  355|       |
  356|  18.4k|         auto replay_it = span.begin;
  357|  18.4k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  18.4k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  18.4k|         ctx.indent_stack.clear();
  362|  18.4k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 2.48k, False: 16.0k]
  ------------------
  363|  2.48k|            ctx.push_indent(span.base_indent - 1);
  364|  2.48k|         }
  365|       |
  366|  18.4k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  18.4k|         using V = std::remove_cvref_t<T>;
  369|  18.4k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  18.4k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  18.4k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  18.4k|         return true;
  376|  18.5k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_19is_yaml_variant_numEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERSH_TkNS_10is_contextERNSL_12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|  1.71M|      {
 5356|  1.71M|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|  1.71M|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|  1.71M|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|  1.71M|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|  1.71M|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 1.71M, False: 0]
  ------------------
 5366|  1.71M|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|  1.71M|      }
_ZN3glz4fromILj450EdE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRdTkNS_10is_contextERNS3_12yaml_contextES6_EEvOT1_OT2_OT0_T3_:
 2149|  1.72M|      {
 2150|  1.72M|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2150:14): [True: 0, False: 1.72M]
  ------------------
 2151|      0|            return;
 2152|       |
 2153|  1.72M|         yaml::node_preamble_state preamble{};
 2154|  1.72M|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble, [](yaml::yaml_tag tag) {
  ------------------
  |  Branch (2154:14): [True: 20.6k, False: 1.70M]
  ------------------
 2155|  1.72M|                if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2156|  1.72M|                   return yaml::tag_valid_for_float(tag);
 2157|  1.72M|                }
 2158|  1.72M|                else {
 2159|  1.72M|                   return yaml::tag_valid_for_int(tag);
 2160|  1.72M|                }
 2161|  1.72M|             }))
 2162|  20.6k|            return;
 2163|       |
 2164|  1.70M|         auto finalize = [&] { yaml::finalize_node_anchor(preamble.node_props, ctx, it); };
 2165|       |
 2166|       |         // Check for special float values
 2167|  1.70M|         if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2168|  1.70M|            auto start = it;
 2169|       |
 2170|       |            // Check for .inf, .nan, -.inf, etc.
 2171|  1.70M|            if (*it == '.') {
  ------------------
  |  Branch (2171:17): [True: 50.6k, False: 1.65M]
  ------------------
 2172|  50.6k|               ++it;
 2173|  50.6k|               if (it + 3 <= end && (std::string_view(it, 3) == "inf" || std::string_view(it, 3) == "Inf" ||
  ------------------
  |  Branch (2173:20): [True: 47.5k, False: 3.05k]
  |  Branch (2173:38): [True: 1.78k, False: 45.7k]
  |  Branch (2173:74): [True: 1.25k, False: 44.5k]
  ------------------
 2174|  44.5k|                                     std::string_view(it, 3) == "INF")) {
  ------------------
  |  Branch (2174:38): [True: 1.23k, False: 43.2k]
  ------------------
 2175|  4.26k|                  value = std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2176|  4.26k|                  it += 3;
 2177|  4.26k|                  finalize();
 2178|  4.26k|                  return;
 2179|  4.26k|               }
 2180|  46.3k|               if (it + 3 <= end && (std::string_view(it, 3) == "nan" || std::string_view(it, 3) == "NaN" ||
  ------------------
  |  Branch (2180:20): [True: 43.2k, False: 3.05k]
  |  Branch (2180:38): [True: 837, False: 42.4k]
  |  Branch (2180:74): [True: 774, False: 41.6k]
  ------------------
 2181|  41.6k|                                     std::string_view(it, 3) == "NAN")) {
  ------------------
  |  Branch (2181:38): [True: 3.07k, False: 38.5k]
  ------------------
 2182|  4.68k|                  value = std::numeric_limits<std::remove_cvref_t<T>>::quiet_NaN();
 2183|  4.68k|                  it += 3;
 2184|  4.68k|                  finalize();
 2185|  4.68k|                  return;
 2186|  4.68k|               }
 2187|  41.6k|               it = start;
 2188|  41.6k|            }
 2189|       |
 2190|  1.69M|            if (*it == '-' || *it == '+') {
  ------------------
  |  Branch (2190:17): [True: 9.62k, False: 1.68M]
  |  Branch (2190:31): [True: 21.2k, False: 1.66M]
  ------------------
 2191|  30.9k|               const char sign = *it;
 2192|  30.9k|               ++it;
 2193|  30.9k|               if (it != end && *it == '.') {
  ------------------
  |  Branch (2193:20): [True: 29.9k, False: 959]
  |  Branch (2193:33): [True: 7.78k, False: 22.1k]
  ------------------
 2194|  7.78k|                  ++it;
 2195|  7.78k|                  if (it + 3 <= end && (std::string_view(it, 3) == "inf" || std::string_view(it, 3) == "Inf" ||
  ------------------
  |  Branch (2195:23): [True: 6.86k, False: 916]
  |  Branch (2195:41): [True: 2.20k, False: 4.66k]
  |  Branch (2195:77): [True: 1.78k, False: 2.87k]
  ------------------
 2196|  4.99k|                                        std::string_view(it, 3) == "INF")) {
  ------------------
  |  Branch (2196:41): [True: 1.00k, False: 1.87k]
  ------------------
 2197|  4.99k|                     if (sign == '-') {
  ------------------
  |  Branch (2197:26): [True: 3.55k, False: 1.43k]
  ------------------
 2198|  3.55k|                        value = -std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2199|  3.55k|                     }
 2200|  1.43k|                     else {
 2201|  1.43k|                        value = std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2202|  1.43k|                     }
 2203|  4.99k|                     it += 3;
 2204|  4.99k|                     finalize();
 2205|  4.99k|                     return;
 2206|  4.99k|                  }
 2207|  7.78k|               }
 2208|  25.9k|               it = start;
 2209|  25.9k|            }
 2210|  1.69M|         }
 2211|       |
 2212|       |         // Parse as plain scalar and convert
 2213|  1.68M|         auto start = it;
 2214|       |
 2215|       |         // Find end of number - use same rules as plain scalar for colons
 2216|   122M|         while (it != end) {
  ------------------
  |  Branch (2216:17): [True: 122M, False: 25.4k]
  ------------------
 2217|   122M|            const char c = *it;
 2218|   122M|            if (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == ',' || c == ']' || c == '}' || c == '#') {
  ------------------
  |  Branch (2218:17): [True: 47.0k, False: 122M]
  |  Branch (2218:29): [True: 16.7k, False: 122M]
  |  Branch (2218:42): [True: 16.4k, False: 122M]
  |  Branch (2218:55): [True: 7.47k, False: 122M]
  |  Branch (2218:68): [True: 1.53M, False: 121M]
  |  Branch (2218:80): [True: 7.60k, False: 121M]
  |  Branch (2218:92): [True: 4.47k, False: 121M]
  |  Branch (2218:104): [True: 25.6k, False: 121M]
  ------------------
 2219|  1.66M|               break;
 2220|  1.66M|            }
 2221|       |            // Colon only ends number if followed by space/tab/newline/end (YAML mapping indicator)
 2222|   121M|            if (c == ':') {
  ------------------
  |  Branch (2222:17): [True: 472k, False: 120M]
  ------------------
 2223|   472k|               if ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\t' || *(it + 1) == '\n' || *(it + 1) == '\r') {
  ------------------
  |  Branch (2223:20): [True: 853, False: 472k]
  |  Branch (2223:39): [True: 4.74k, False: 467k]
  |  Branch (2223:59): [True: 1.65k, False: 465k]
  |  Branch (2223:80): [True: 1.68k, False: 464k]
  |  Branch (2223:101): [True: 4.60k, False: 459k]
  ------------------
 2224|  13.5k|                  break;
 2225|  13.5k|               }
 2226|   472k|            }
 2227|   121M|            ++it;
 2228|   121M|         }
 2229|       |
 2230|  1.70M|         const std::string_view num_str(&*start, static_cast<size_t>(it - start));
 2231|       |
 2232|  1.70M|         if (num_str.empty()) {
  ------------------
  |  Branch (2232:14): [True: 3.37k, False: 1.69M]
  ------------------
 2233|  3.37k|            ctx.error = error_code::parse_number_failure;
 2234|  3.37k|            return;
 2235|  3.37k|         }
 2236|       |
 2237|       |         // Handle hex, octal, binary
 2238|       |         if constexpr (std::integral<std::remove_cvref_t<T>>) {
 2239|       |            if (num_str.size() > 2 && num_str[0] == '0') {
 2240|       |               int base = 10;
 2241|       |               size_t offset = 0;
 2242|       |
 2243|       |               if (num_str[1] == 'x' || num_str[1] == 'X') {
 2244|       |                  base = 16;
 2245|       |                  offset = 2;
 2246|       |               }
 2247|       |               else if (num_str[1] == 'o' || num_str[1] == 'O') {
 2248|       |                  base = 8;
 2249|       |                  offset = 2;
 2250|       |               }
 2251|       |               else if (num_str[1] == 'b' || num_str[1] == 'B') {
 2252|       |                  base = 2;
 2253|       |                  offset = 2;
 2254|       |               }
 2255|       |
 2256|       |               if (base != 10) {
 2257|       |                  const auto digits = num_str.substr(offset);
 2258|       |                  const bool has_underscores = (digits.find('_') != std::string_view::npos);
 2259|       |
 2260|       |                  std::string clean_storage;
 2261|       |                  std::string_view clean_view;
 2262|       |
 2263|       |                  if (has_underscores) {
 2264|       |                     clean_storage.reserve(digits.size());
 2265|       |                     for (char c : digits) {
 2266|       |                        if (c != '_') {
 2267|       |                           clean_storage.push_back(c);
 2268|       |                        }
 2269|       |                     }
 2270|       |                     clean_view = clean_storage;
 2271|       |                  }
 2272|       |                  else {
 2273|       |                     clean_view = digits;
 2274|       |                  }
 2275|       |
 2276|       |                  auto [ptr, ec] =
 2277|       |                     std::from_chars(clean_view.data(), clean_view.data() + clean_view.size(), value, base);
 2278|       |                  if (ec != std::errc{}) {
 2279|       |                     ctx.error = error_code::parse_number_failure;
 2280|       |                  }
 2281|       |                  finalize();
 2282|       |                  return;
 2283|       |               }
 2284|       |            }
 2285|       |         }
 2286|  1.69M|         else if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2287|  1.69M|            bool negative = false;
 2288|  1.69M|            std::string_view digits = num_str;
 2289|       |
 2290|  1.69M|            if (!digits.empty() && (digits.front() == '+' || digits.front() == '-')) {
  ------------------
  |  Branch (2290:17): [True: 1.68M, False: 13.9k]
  |  Branch (2290:37): [True: 19.8k, False: 1.66M]
  |  Branch (2290:62): [True: 6.06k, False: 1.65M]
  ------------------
 2291|  25.9k|               negative = (digits.front() == '-');
 2292|  25.9k|               digits.remove_prefix(1);
 2293|  25.9k|            }
 2294|       |
 2295|  1.69M|            if (digits.size() > 2 && digits[0] == '0') {
  ------------------
  |  Branch (2295:17): [True: 223k, False: 1.47M]
  |  Branch (2295:38): [True: 43.5k, False: 180k]
  ------------------
 2296|  43.5k|               int base = 10;
 2297|  43.5k|               size_t offset = 0;
 2298|       |
 2299|  43.5k|               if (digits[1] == 'x' || digits[1] == 'X') {
  ------------------
  |  Branch (2299:20): [True: 6.02k, False: 37.5k]
  |  Branch (2299:40): [True: 2.38k, False: 35.1k]
  ------------------
 2300|  8.40k|                  base = 16;
 2301|  8.40k|                  offset = 2;
 2302|  8.40k|               }
 2303|  35.1k|               else if (digits[1] == 'o' || digits[1] == 'O') {
  ------------------
  |  Branch (2303:25): [True: 895, False: 34.2k]
  |  Branch (2303:45): [True: 1.09k, False: 33.1k]
  ------------------
 2304|  1.99k|                  base = 8;
 2305|  1.99k|                  offset = 2;
 2306|  1.99k|               }
 2307|  33.1k|               else if (digits[1] == 'b' || digits[1] == 'B') {
  ------------------
  |  Branch (2307:25): [True: 7.35k, False: 25.7k]
  |  Branch (2307:45): [True: 994, False: 24.7k]
  ------------------
 2308|  8.35k|                  base = 2;
 2309|  8.35k|                  offset = 2;
 2310|  8.35k|               }
 2311|       |
 2312|  43.5k|               if (base != 10) {
  ------------------
  |  Branch (2312:20): [True: 18.7k, False: 24.7k]
  ------------------
 2313|  18.7k|                  auto raw_digits = digits.substr(offset);
 2314|  18.7k|                  const bool has_underscores = (raw_digits.find('_') != std::string_view::npos);
 2315|       |
 2316|  18.7k|                  std::string clean_storage;
 2317|  18.7k|                  std::string_view clean_view;
 2318|  18.7k|                  if (has_underscores) {
  ------------------
  |  Branch (2318:23): [True: 8.94k, False: 9.79k]
  ------------------
 2319|  8.94k|                     clean_storage.reserve(raw_digits.size());
 2320|  15.1M|                     for (char c : raw_digits) {
  ------------------
  |  Branch (2320:34): [True: 15.1M, False: 8.94k]
  ------------------
 2321|  15.1M|                        if (c != '_') {
  ------------------
  |  Branch (2321:29): [True: 15.0M, False: 24.9k]
  ------------------
 2322|  15.0M|                           clean_storage.push_back(c);
 2323|  15.0M|                        }
 2324|  15.1M|                     }
 2325|  8.94k|                     clean_view = clean_storage;
 2326|  8.94k|                  }
 2327|  9.79k|                  else {
 2328|  9.79k|                     clean_view = raw_digits;
 2329|  9.79k|                  }
 2330|       |
 2331|  18.7k|                  uint64_t parsed_int{};
 2332|  18.7k|                  auto [ptr, ec] =
 2333|  18.7k|                     std::from_chars(clean_view.data(), clean_view.data() + clean_view.size(), parsed_int, base);
 2334|  18.7k|                  if (ec != std::errc{} || ptr != (clean_view.data() + clean_view.size())) {
  ------------------
  |  Branch (2334:23): [True: 11.5k, False: 7.19k]
  |  Branch (2334:44): [True: 2.78k, False: 4.40k]
  ------------------
 2335|  14.3k|                     ctx.error = error_code::parse_number_failure;
 2336|  14.3k|                     finalize();
 2337|  14.3k|                     return;
 2338|  14.3k|                  }
 2339|       |
 2340|  4.40k|                  const auto as_float = static_cast<std::remove_cvref_t<T>>(parsed_int);
 2341|  4.40k|                  value = negative ? -as_float : as_float;
  ------------------
  |  Branch (2341:27): [True: 1.70k, False: 2.70k]
  ------------------
 2342|  4.40k|                  finalize();
 2343|  4.40k|                  return;
 2344|  18.7k|               }
 2345|  43.5k|            }
 2346|  1.69M|         }
 2347|       |
 2348|       |         // Standard number parsing - only allocate if underscores present
 2349|  1.68M|         const bool has_underscores = (num_str.find('_') != std::string_view::npos);
 2350|       |
 2351|  1.69M|         std::string clean_storage;
 2352|  1.69M|         std::string_view clean_view;
 2353|       |
 2354|  1.69M|         if (has_underscores) {
  ------------------
  |  Branch (2354:14): [True: 8.49k, False: 1.69M]
  ------------------
 2355|  8.49k|            clean_storage.reserve(num_str.size());
 2356|  70.3M|            for (char c : num_str) {
  ------------------
  |  Branch (2356:25): [True: 70.3M, False: 8.49k]
  ------------------
 2357|  70.3M|               if (c != '_') {
  ------------------
  |  Branch (2357:20): [True: 70.2M, False: 14.0k]
  ------------------
 2358|  70.2M|                  clean_storage.push_back(c);
 2359|  70.2M|               }
 2360|  70.3M|            }
 2361|  8.49k|            clean_view = clean_storage;
 2362|  8.49k|         }
 2363|  1.69M|         else {
 2364|  1.69M|            clean_view = num_str;
 2365|  1.69M|         }
 2366|       |
 2367|       |         // YAML allows leading '+' for positive numbers, but C++ from_chars doesn't
 2368|       |         // Strip leading '+' if present
 2369|  1.69M|         auto parse_view = clean_view;
 2370|  1.69M|         if (!parse_view.empty() && parse_view.front() == '+') {
  ------------------
  |  Branch (2370:14): [True: 1.66M, False: 33.0k]
  |  Branch (2370:37): [True: 19.8k, False: 1.64M]
  ------------------
 2371|  19.8k|            parse_view.remove_prefix(1);
 2372|  19.8k|            if (parse_view.empty()) {
  ------------------
  |  Branch (2372:17): [True: 8.36k, False: 11.4k]
  ------------------
 2373|  8.36k|               ctx.error = error_code::parse_number_failure;
 2374|  8.36k|               return;
 2375|  8.36k|            }
 2376|  19.8k|         }
 2377|       |
 2378|  1.69M|         if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2379|  1.69M|            auto result = glz::fast_float::from_chars(parse_view.data(), parse_view.data() + parse_view.size(), value);
 2380|       |            // Check both for errors and that all input was consumed (e.g., "12:30" is not a valid number)
 2381|  1.69M|            if (result.ec != std::errc{} || result.ptr != parse_view.data() + parse_view.size()) {
  ------------------
  |  Branch (2381:17): [True: 87.0k, False: 1.60M]
  |  Branch (2381:45): [True: 65.5k, False: 1.53M]
  ------------------
 2382|   119k|               ctx.error = error_code::parse_number_failure;
 2383|   119k|            }
 2384|       |         }
 2385|       |         else {
 2386|       |            auto [ptr, ec] = std::from_chars(parse_view.data(), parse_view.data() + parse_view.size(), value);
 2387|       |            // Check both for errors and that all input was consumed
 2388|       |            if (ec != std::errc{} || ptr != parse_view.data() + parse_view.size()) {
 2389|       |               ctx.error = error_code::parse_number_failure;
 2390|       |            }
 2391|       |         }
 2392|       |
 2393|  1.69M|         finalize();
 2394|  1.69M|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEELb0ERdNS0_12yaml_contextEPKcS7_ZNS_4fromILj450EdE2opITnDaXtlS2_Lj450ELb1ELb0ELb1ELh2ELb0ELj1EEERS7_S4_TkNS_10is_contextERS5_S7_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSG_RSJ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|  1.72M|      {
  475|  1.72M|         skip_inline_ws(it, end);
  476|       |
  477|  1.72M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 646, False: 1.72M]
  ------------------
  478|    646|            if constexpr (!AllowEmptyInput) {
  479|    646|               ctx.error = error_code::unexpected_end;
  480|    646|            }
  481|    646|            return true;
  482|    646|         }
  483|       |
  484|  1.72M|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|  1.72M|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 444, False: 1.72M]
  ------------------
  486|    444|            ctx.error = error_code::syntax_error;
  487|    444|            return true;
  488|    444|         }
  489|  1.72M|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 379, False: 1.72M]
  ------------------
  490|    379|            ctx.error = error_code::syntax_error;
  491|    379|            return true;
  492|    379|         }
  493|       |
  494|  1.72M|         skip_inline_ws(it, end);
  495|       |
  496|  1.72M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 438, False: 1.72M]
  ------------------
  497|    438|            if constexpr (!AllowEmptyInput) {
  498|    438|               ctx.error = error_code::unexpected_end;
  499|    438|            }
  500|    438|            return true;
  501|    438|         }
  502|       |
  503|  1.72M|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 18.7k, False: 1.70M]
  ------------------
  504|  18.7k|            return true;
  505|  18.7k|         }
  506|       |
  507|  1.70M|         return false;
  508|  1.72M|      }
_ZZN3glz4fromILj450EdE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRdTkNS_10is_contextERNS3_12yaml_contextES6_EEvOT1_OT2_OT0_T3_ENKUlNS3_8yaml_tagEE_clESI_:
 2154|  1.72M|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble, [](yaml::yaml_tag tag) {
 2155|  1.72M|                if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2156|  1.72M|                   return yaml::tag_valid_for_float(tag);
 2157|       |                }
 2158|       |                else {
 2159|       |                   return yaml::tag_valid_for_int(tag);
 2160|       |                }
 2161|  1.72M|             }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEERdNS0_12yaml_contextEPKcS7_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|  1.72M|      {
  418|  1.72M|         state.has_anchor = false;
  419|  1.72M|         state.anchor_name.clear();
  420|  1.72M|         state.anchor_start = nullptr;
  421|  1.72M|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|  1.72M|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|  1.72M|            else {
  430|  1.72M|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 17.5k, False: 1.70M]
  ------------------
  431|  1.72M|            }
  432|  1.72M|         }
  433|       |
  434|  1.72M|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 1.70M, False: 17.5k]
  |  Branch (434:27): [True: 10.7k, False: 1.69M]
  ------------------
  435|  10.7k|            ++it;
  436|  10.7k|            auto name = parse_anchor_name(it, end);
  437|  10.7k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 559, False: 10.1k]
  ------------------
  438|    559|               ctx.error = error_code::syntax_error;
  439|    559|               return true;
  440|    559|            }
  441|  10.1k|            skip_inline_ws(it, end);
  442|  10.1k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 653, False: 9.53k]
  ------------------
  443|    653|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|    653|                  ctx.error = error_code::unexpected_end;
  445|    653|               }
  446|    653|               return true;
  447|    653|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  9.53k|            state.has_anchor = true;
  455|  9.53k|            state.anchor_name = std::string(name);
  456|  9.53k|            state.anchor_start = &*it;
  457|  9.53k|         }
  458|       |
  459|  1.72M|         return false;
  460|  1.72M|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERdNS0_12yaml_contextEPKcS6_EEbOT0_RT1_RT2_T3_:
  309|  1.72M|      {
  310|  1.72M|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 1.72M]
  |  Branch (310:27): [True: 1.70M, False: 17.5k]
  ------------------
  311|       |
  312|  17.5k|         ++it; // skip '*'
  313|  17.5k|         auto name = parse_anchor_name(it, end);
  314|  17.5k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 729, False: 16.7k]
  ------------------
  315|    729|            ctx.error = error_code::syntax_error;
  316|    729|            return true;
  317|    729|         }
  318|       |
  319|  16.7k|         auto anchor_it = ctx.anchors.find(name);
  320|  16.7k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 2.80k, False: 13.9k]
  ------------------
  321|  2.80k|            ctx.error = error_code::syntax_error; // undefined alias
  322|  2.80k|            return true;
  323|  2.80k|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  13.9k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  13.9k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 3.98k, False: 9.98k]
  ------------------
  331|  3.98k|            return true;
  332|  3.98k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  9.98k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 343, False: 9.64k]
  ------------------
  338|    343|            ctx.error = error_code::syntax_error; // cyclic alias
  339|    343|            return true;
  340|    343|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  9.64k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  9.64k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 6, False: 9.63k]
  ------------------
  348|      6|            return true;
  349|       |
  350|  9.63k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 36, False: 9.60k]
  ------------------
  351|     36|            ctx.error = error_code::exceeded_max_expansion;
  352|     36|            ctx.custom_error_message = "alias expansion";
  353|     36|            return true;
  354|     36|         }
  355|       |
  356|  9.60k|         auto replay_it = span.begin;
  357|  9.60k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  9.60k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  9.60k|         ctx.indent_stack.clear();
  362|  9.60k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 1.95k, False: 7.64k]
  ------------------
  363|  1.95k|            ctx.push_indent(span.base_indent - 1);
  364|  1.95k|         }
  365|       |
  366|  9.60k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  9.60k|         using V = std::remove_cvref_t<T>;
  369|  9.60k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  9.60k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  9.60k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  9.60k|         return true;
  376|  9.63k|      }
_ZZN3glz4fromILj450EdE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRdTkNS_10is_contextERNS3_12yaml_contextES6_EEvOT1_OT2_OT0_T3_ENKUlvE_clEv:
 2164|  1.69M|         auto finalize = [&] { yaml::finalize_node_anchor(preamble.node_props, ctx, it); };
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_20is_yaml_variant_boolEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERSH_TkNS_10is_contextERNSL_12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|  54.9k|      {
 5356|  54.9k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|  54.9k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|  54.9k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|  54.9k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|  54.9k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 54.9k, False: 0]
  ------------------
 5366|  54.9k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|  54.9k|      }
_ZN3glz4fromILj450EbE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRbTkNS_10is_contextERNS3_12yaml_contextES6_EEvOT1_OT2_OT0_T3_:
 2114|  70.4k|      {
 2115|  70.4k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2115:14): [True: 0, False: 70.4k]
  ------------------
 2116|      0|            return;
 2117|       |
 2118|  70.4k|         yaml::node_preamble_state preamble{};
 2119|  70.4k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble,
  ------------------
  |  Branch (2119:14): [True: 19.2k, False: 51.2k]
  ------------------
 2120|  70.4k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_bool(tag); }))
 2121|  19.2k|            return;
 2122|       |
 2123|       |         // Parse as plain scalar first
 2124|  51.2k|         std::string str;
 2125|  51.2k|         yaml::parse_plain_scalar(str, ctx, it, end, yaml::check_flow_context(Opts));
 2126|       |
 2127|  51.2k|         if (str == "true" || str == "True" || str == "TRUE" || str == "yes" || str == "Yes" || str == "YES" ||
  ------------------
  |  Branch (2127:14): [True: 5.55k, False: 45.7k]
  |  Branch (2127:31): [True: 2.08k, False: 43.6k]
  |  Branch (2127:48): [True: 2.60k, False: 41.0k]
  |  Branch (2127:65): [True: 1.02k, False: 40.0k]
  |  Branch (2127:81): [True: 869, False: 39.1k]
  |  Branch (2127:97): [True: 1.49k, False: 37.6k]
  ------------------
 2128|  37.6k|             str == "on" || str == "On" || str == "ON") {
  ------------------
  |  Branch (2128:14): [True: 1.02k, False: 36.6k]
  |  Branch (2128:29): [True: 765, False: 35.8k]
  |  Branch (2128:44): [True: 882, False: 34.9k]
  ------------------
 2129|  16.3k|            value = true;
 2130|  16.3k|         }
 2131|  34.9k|         else if (str == "false" || str == "False" || str == "FALSE" || str == "no" || str == "No" || str == "NO" ||
  ------------------
  |  Branch (2131:19): [True: 7.28k, False: 27.7k]
  |  Branch (2131:37): [True: 3.81k, False: 23.8k]
  |  Branch (2131:55): [True: 2.75k, False: 21.1k]
  |  Branch (2131:73): [True: 1.19k, False: 19.9k]
  |  Branch (2131:88): [True: 15.0k, False: 4.93k]
  |  Branch (2131:103): [True: 842, False: 4.09k]
  ------------------
 2132|  34.5k|                  str == "off" || str == "Off" || str == "OFF") {
  ------------------
  |  Branch (2132:19): [True: 1.31k, False: 2.77k]
  |  Branch (2132:35): [True: 987, False: 1.79k]
  |  Branch (2132:51): [True: 1.32k, False: 463]
  ------------------
 2133|  34.5k|            value = false;
 2134|  34.5k|         }
 2135|    463|         else {
 2136|    463|            ctx.error = error_code::expected_true_or_false;
 2137|    463|         }
 2138|       |
 2139|  51.2k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 2140|  51.2k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEELb0ERbNS0_12yaml_contextEPKcS7_ZNS_4fromILj450EbE2opITnDaXtlS2_Lj450ELb1ELb0ELb1ELh2ELb0ELj1EEERS7_S4_TkNS_10is_contextERS5_S7_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSG_RSJ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|  70.4k|      {
  475|  70.4k|         skip_inline_ws(it, end);
  476|       |
  477|  70.4k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 14, False: 70.4k]
  ------------------
  478|     14|            if constexpr (!AllowEmptyInput) {
  479|     14|               ctx.error = error_code::unexpected_end;
  480|     14|            }
  481|     14|            return true;
  482|     14|         }
  483|       |
  484|  70.4k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|  70.4k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 19, False: 70.4k]
  ------------------
  486|     19|            ctx.error = error_code::syntax_error;
  487|     19|            return true;
  488|     19|         }
  489|  70.4k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 6, False: 70.4k]
  ------------------
  490|      6|            ctx.error = error_code::syntax_error;
  491|      6|            return true;
  492|      6|         }
  493|       |
  494|  70.4k|         skip_inline_ws(it, end);
  495|       |
  496|  70.4k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 11, False: 70.4k]
  ------------------
  497|     11|            if constexpr (!AllowEmptyInput) {
  498|     11|               ctx.error = error_code::unexpected_end;
  499|     11|            }
  500|     11|            return true;
  501|     11|         }
  502|       |
  503|  70.4k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 19.1k, False: 51.2k]
  ------------------
  504|  19.1k|            return true;
  505|  19.1k|         }
  506|       |
  507|  51.2k|         return false;
  508|  70.4k|      }
_ZZN3glz4fromILj450EbE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRbTkNS_10is_contextERNS3_12yaml_contextES6_EEvOT1_OT2_OT0_T3_ENKUlNS3_8yaml_tagEE_clESI_:
 2120|  70.4k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_bool(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEERbNS0_12yaml_contextEPKcS7_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|  70.4k|      {
  418|  70.4k|         state.has_anchor = false;
  419|  70.4k|         state.anchor_name.clear();
  420|  70.4k|         state.anchor_start = nullptr;
  421|  70.4k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|  70.4k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|  70.4k|            else {
  430|  70.4k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 19.0k, False: 51.3k]
  ------------------
  431|  70.4k|            }
  432|  70.4k|         }
  433|       |
  434|  70.4k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 51.3k, False: 19.0k]
  |  Branch (434:27): [True: 13.7k, False: 37.5k]
  ------------------
  435|  13.7k|            ++it;
  436|  13.7k|            auto name = parse_anchor_name(it, end);
  437|  13.7k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 29, False: 13.7k]
  ------------------
  438|     29|               ctx.error = error_code::syntax_error;
  439|     29|               return true;
  440|     29|            }
  441|  13.7k|            skip_inline_ws(it, end);
  442|  13.7k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 43, False: 13.6k]
  ------------------
  443|     43|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     43|                  ctx.error = error_code::unexpected_end;
  445|     43|               }
  446|     43|               return true;
  447|     43|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  13.6k|            state.has_anchor = true;
  455|  13.6k|            state.anchor_name = std::string(name);
  456|  13.6k|            state.anchor_start = &*it;
  457|  13.6k|         }
  458|       |
  459|  70.3k|         return false;
  460|  70.4k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERbNS0_12yaml_contextEPKcS6_EEbOT0_RT1_RT2_T3_:
  309|  70.4k|      {
  310|  70.4k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 70.4k]
  |  Branch (310:27): [True: 51.3k, False: 19.0k]
  ------------------
  311|       |
  312|  19.0k|         ++it; // skip '*'
  313|  19.0k|         auto name = parse_anchor_name(it, end);
  314|  19.0k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 29, False: 19.0k]
  ------------------
  315|     29|            ctx.error = error_code::syntax_error;
  316|     29|            return true;
  317|     29|         }
  318|       |
  319|  19.0k|         auto anchor_it = ctx.anchors.find(name);
  320|  19.0k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 100, False: 18.9k]
  ------------------
  321|    100|            ctx.error = error_code::syntax_error; // undefined alias
  322|    100|            return true;
  323|    100|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  18.9k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  18.9k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 3.41k, False: 15.5k]
  ------------------
  331|  3.41k|            return true;
  332|  3.41k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  15.5k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 9, False: 15.5k]
  ------------------
  338|      9|            ctx.error = error_code::syntax_error; // cyclic alias
  339|      9|            return true;
  340|      9|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  15.5k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  15.5k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 3, False: 15.5k]
  ------------------
  348|      3|            return true;
  349|       |
  350|  15.5k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 12, False: 15.5k]
  ------------------
  351|     12|            ctx.error = error_code::exceeded_max_expansion;
  352|     12|            ctx.custom_error_message = "alias expansion";
  353|     12|            return true;
  354|     12|         }
  355|       |
  356|  15.5k|         auto replay_it = span.begin;
  357|  15.5k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  15.5k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  15.5k|         ctx.indent_stack.clear();
  362|  15.5k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 4.08k, False: 11.4k]
  ------------------
  363|  4.08k|            ctx.push_indent(span.base_indent - 1);
  364|  4.08k|         }
  365|       |
  366|  15.5k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  15.5k|         using V = std::remove_cvref_t<T>;
  369|  15.5k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  15.5k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  15.5k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  15.5k|         return true;
  376|  15.5k|      }
_ZN3glz4fromILj450EDnE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRDnTkNS_10is_contextERNS3_12yaml_contextES6_EEvOT1_OT2_OT0_T3_:
 2500|  16.7k|      {
 2501|  16.7k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2501:14): [True: 0, False: 16.7k]
  ------------------
 2502|      0|            return;
 2503|       |
 2504|  16.7k|         yaml::skip_inline_ws(it, end);
 2505|       |
 2506|  16.7k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2506:14): [True: 17, False: 16.7k]
  ------------------
 2507|     17|            ctx.error = error_code::unexpected_end;
 2508|     17|            return;
 2509|     17|         }
 2510|       |
 2511|       |         // Check for null values: null, Null, NULL, ~
 2512|  16.7k|         if (*it == '~') {
  ------------------
  |  Branch (2512:14): [True: 5.70k, False: 11.0k]
  ------------------
 2513|  5.70k|            ++it;
 2514|  5.70k|            return;
 2515|  5.70k|         }
 2516|       |
 2517|       |         // Parse as plain scalar and check if it's a null keyword
 2518|  11.0k|         auto start = it;
 2519|  51.2k|         while (it != end && !yaml::plain_scalar_end_or_control_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (2519:17): [True: 50.4k, False: 810]
  |  Branch (2519:30): [True: 40.2k, False: 10.2k]
  ------------------
 2520|  40.2k|            ++it;
 2521|  40.2k|         }
 2522|       |
 2523|  11.0k|         std::string_view str{start, static_cast<size_t>(it - start)};
 2524|  11.0k|         if (!yaml::is_yaml_null(str)) {
  ------------------
  |  Branch (2524:14): [True: 104, False: 10.9k]
  ------------------
 2525|    104|            ctx.error = error_code::syntax_error;
 2526|    104|         }
 2527|  11.0k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_22is_yaml_variant_objectEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERSH_TkNS_10is_contextERNSL_12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|  1.92M|      {
 5356|  1.92M|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|  1.92M|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|  1.92M|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|  1.92M|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|  1.92M|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 1.92M, False: 0]
  ------------------
 5366|  1.92M|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|  1.92M|      }
_ZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_:
 4660|  1.94M|      {
 4661|  1.94M|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4661:14): [True: 0, False: 1.94M]
  ------------------
 4662|      0|            return;
 4663|       |
 4664|  1.94M|         yaml::node_preamble_state preamble{};
 4665|  1.94M|         if (yaml::parse_node_preamble<Opts, yaml::node_property_policy{true, true, false, false}>(
  ------------------
  |  Branch (4665:14): [True: 29.3k, False: 1.91M]
  ------------------
 4666|  1.94M|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_map(tag); }))
 4667|  29.3k|            return;
 4668|       |
 4669|  1.91M|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 4670|  1.91M|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (4670:14): [True: 28, False: 1.91M]
  ------------------
 4671|     28|            return;
 4672|       |
 4673|  1.91M|         using key_t = typename std::remove_cvref_t<T>::key_type;
 4674|  1.91M|         using val_t = typename std::remove_cvref_t<T>::mapped_type;
 4675|       |
 4676|       |         // Reading a YAML mapping MERGES into the target: an entry overwrites the
 4677|       |         // value of a key that existed before the read and adds new keys, while
 4678|       |         // pre-existing keys the document does not mention are preserved (like a
 4679|       |         // struct/object read, and like json/read.hpp's per-key value[key]).
 4680|       |         // Within a single document a repeated key keeps its FIRST value -- YAML
 4681|       |         // mappings disallow duplicate keys and the conformance suite expects
 4682|       |         // first-wins, which falls out of emplace into an empty map. Any
 4683|       |         // pre-existing entry the document leaves untouched is restored on scope
 4684|       |         // exit (including error paths). When the target starts empty (the common
 4685|       |         // case) this is a no-op with negligible cost.
 4686|  1.91M|         std::remove_cvref_t<T> preexisting_entries;
 4687|  1.91M|         if (!value.empty()) {
  ------------------
  |  Branch (4687:14): [True: 0, False: 1.91M]
  ------------------
 4688|      0|            preexisting_entries = std::move(value);
 4689|      0|            value.clear();
 4690|      0|         }
 4691|  1.91M|         struct merge_restore_guard
 4692|  1.91M|         {
 4693|  1.91M|            std::remove_cvref_t<T>& target;
 4694|  1.91M|            std::remove_cvref_t<T>& saved;
 4695|  1.91M|            ~merge_restore_guard()
 4696|  1.91M|            {
 4697|       |               // emplace is a no-op for keys the document already wrote, so only
 4698|       |               // untouched pre-existing entries are put back.
 4699|  1.91M|               for (auto& entry : saved) {
 4700|  1.91M|                  target.emplace(entry.first, std::move(entry.second));
 4701|  1.91M|               }
 4702|  1.91M|            }
 4703|  1.91M|         } merge_restore{value, preexisting_entries};
 4704|       |
 4705|  1.91M|         const bool treat_as_block_mapping =
 4706|  1.91M|            !yaml::check_flow_context(Opts) && *it == '{' && yaml::inline_value_has_plain_mapping_indicator(it, end);
  ------------------
  |  Branch (4706:13): [Folded, False: 1.91M]
  |  Branch (4706:48): [True: 0, False: 0]
  |  Branch (4706:62): [True: 0, False: 0]
  ------------------
 4707|       |
 4708|  1.91M|         if (*it == '{' && !treat_as_block_mapping) {
  ------------------
  |  Branch (4708:14): [True: 1.16M, False: 754k]
  |  Branch (4708:28): [True: 0, Folded]
  ------------------
 4709|       |            // Flow mapping
 4710|  1.16M|            ++it;
 4711|       |            // Skip whitespace and newlines after opening brace
 4712|  1.16M|            yaml::skip_ws_and_newlines(it, end);
 4713|       |
 4714|  1.16M|            if (it != end && *it == '}') {
  ------------------
  |  Branch (4714:17): [True: 1.15M, False: 4.94k]
  |  Branch (4714:30): [True: 21.0k, False: 1.13M]
  ------------------
 4715|  21.0k|               ++it;
 4716|  21.0k|               yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4717|  21.0k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4717:20): [True: 35, False: 20.9k]
  ------------------
 4718|     35|                  return;
 4719|  20.9k|               yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 4720|  20.9k|               return;
 4721|  21.0k|            }
 4722|       |
 4723|  3.35M|            while (it != end) {
  ------------------
  |  Branch (4723:20): [True: 3.33M, False: 13.3k]
  ------------------
 4724|       |               // Skip whitespace and newlines at start of each iteration
 4725|  3.33M|               yaml::skip_ws_and_newlines(it, end);
 4726|       |
 4727|  3.33M|               if (it != end && *it == '}') {
  ------------------
  |  Branch (4727:20): [True: 3.33M, False: 0]
  |  Branch (4727:33): [True: 38.9k, False: 3.29M]
  ------------------
 4728|  38.9k|                  ++it;
 4729|  38.9k|                  yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4730|  38.9k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4730:23): [True: 45, False: 38.8k]
  ------------------
 4731|     45|                     return;
 4732|  38.8k|                  break;
 4733|  38.9k|               }
 4734|       |
 4735|  3.29M|               bool explicit_flow_key = false;
 4736|  3.29M|               auto explicit_probe = it;
 4737|  3.29M|               yaml::skip_inline_ws(explicit_probe, end);
 4738|  3.29M|               if (explicit_probe != end && *explicit_probe == '?') {
  ------------------
  |  Branch (4738:20): [True: 3.29M, False: 0]
  |  Branch (4738:45): [True: 46.8k, False: 3.25M]
  ------------------
 4739|  46.8k|                  const auto after_q = explicit_probe + 1;
 4740|  46.8k|                  if (after_q == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_q)] ||
  ------------------
  |  Branch (4740:23): [True: 11, False: 46.8k]
  |  Branch (4740:41): [True: 29.3k, False: 17.4k]
  ------------------
 4741|  33.9k|                      *after_q == ',' || *after_q == '}') {
  ------------------
  |  Branch (4741:23): [True: 3.05k, False: 14.4k]
  |  Branch (4741:42): [True: 1.50k, False: 12.9k]
  ------------------
 4742|  33.9k|                     explicit_flow_key = true;
 4743|  33.9k|                     it = explicit_probe + 1;
 4744|  33.9k|                     yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4745|  33.9k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4745:26): [True: 8, False: 33.9k]
  ------------------
 4746|      8|                        return;
 4747|  33.9k|                  }
 4748|  46.8k|               }
 4749|       |               // Parse key
 4750|  3.29M|               key_t key{};
 4751|  3.29M|               if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 4752|  3.29M|                  if (explicit_flow_key && it != end && (*it == ':' || *it == ',' || *it == '}')) {
  ------------------
  |  Branch (4752:23): [True: 33.9k, False: 3.26M]
  |  Branch (4752:44): [True: 33.9k, False: 18]
  |  Branch (4752:58): [True: 3.92k, False: 30.0k]
  |  Branch (4752:72): [True: 10.2k, False: 19.7k]
  |  Branch (4752:86): [True: 2.44k, False: 17.3k]
  ------------------
 4753|  16.5k|                     key.clear();
 4754|  16.5k|                  }
 4755|  3.28M|                  else {
 4756|  3.28M|                     auto key_probe = it;
 4757|  3.28M|                     yaml::skip_inline_ws(key_probe, end);
 4758|       |
 4759|       |                     // Use full node parsing only for structurally complex flow keys.
 4760|       |                     // Plain/quoted/alias keys stay on parse_yaml_key() for compatibility.
 4761|  3.28M|                     bool parse_complex_flow_key = false;
 4762|  3.28M|                     if (key_probe != end) {
  ------------------
  |  Branch (4762:26): [True: 3.28M, False: 18]
  ------------------
 4763|  3.28M|                        if (*key_probe == '[' || *key_probe == '{') {
  ------------------
  |  Branch (4763:29): [True: 14.6k, False: 3.26M]
  |  Branch (4763:50): [True: 57.5k, False: 3.20M]
  ------------------
 4764|  72.2k|                           parse_complex_flow_key = true;
 4765|  72.2k|                        }
 4766|  3.20M|                        else if (*key_probe == '&') {
  ------------------
  |  Branch (4766:34): [True: 1.03M, False: 2.17M]
  ------------------
 4767|  1.03M|                           ++key_probe;
 4768|  1.03M|                           yaml::parse_anchor_name(key_probe, end);
 4769|  1.03M|                           yaml::skip_inline_ws(key_probe, end);
 4770|  1.03M|                           if (key_probe != end && (*key_probe == '[' || *key_probe == '{')) {
  ------------------
  |  Branch (4770:32): [True: 1.03M, False: 186]
  |  Branch (4770:53): [True: 16.0k, False: 1.01M]
  |  Branch (4770:74): [True: 581k, False: 436k]
  ------------------
 4771|   597k|                              parse_complex_flow_key = true;
 4772|   597k|                           }
 4773|  1.03M|                        }
 4774|  3.28M|                     }
 4775|       |
 4776|  3.28M|                     if (parse_complex_flow_key) {
  ------------------
  |  Branch (4776:26): [True: 669k, False: 2.61M]
  ------------------
 4777|   669k|                        glz::generic key_node{};
 4778|   669k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 4779|   669k|                        if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4779:29): [True: 26.9k, False: 642k]
  ------------------
 4780|  26.9k|                           return;
 4781|   642k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (4781:29): [True: 84, False: 642k]
  ------------------
 4782|     84|                           return;
 4783|   642k|                     }
 4784|  2.61M|                     else {
 4785|  2.61M|                        if (!yaml::parse_yaml_key(key, ctx, it, end, true)) {
  ------------------
  |  Branch (4785:29): [True: 14.9k, False: 2.59M]
  ------------------
 4786|  14.9k|                           return;
 4787|  14.9k|                        }
 4788|  2.61M|                     }
 4789|  3.28M|                  }
 4790|       |               }
 4791|       |               else {
 4792|       |                  if (explicit_flow_key && it != end && (*it == ':' || *it == ',' || *it == '}')) {
 4793|       |                     ctx.error = error_code::syntax_error;
 4794|       |                     return;
 4795|       |                  }
 4796|       |                  from<YAML, key_t>::template op<yaml::flow_context_on<Opts>()>(key, ctx, it, end);
 4797|       |                  if (bool(ctx.error)) [[unlikely]]
 4798|       |                     return;
 4799|       |               }
 4800|       |
 4801|       |               // Separation between flow key and ':' may include comments/newlines.
 4802|       |               // In flow context, newlines are allowed between key and ':'.
 4803|  3.25M|               yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4804|  3.29M|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4804:20): [True: 57, False: 3.29M]
  ------------------
 4805|     57|                  return;
 4806|       |
 4807|  3.29M|               auto parse_implicit_null = [&](val_t& val) -> bool {
 4808|  3.29M|                  if constexpr (nullable_like<std::remove_cvref_t<val_t>>) {
 4809|  3.29M|                     val = {};
 4810|  3.29M|                     return true;
 4811|  3.29M|                  }
 4812|  3.29M|                  else if constexpr (std::same_as<std::remove_cvref_t<val_t>, glz::generic>) {
 4813|  3.29M|                     val = glz::generic{};
 4814|  3.29M|                     return true;
 4815|  3.29M|                  }
 4816|  3.29M|                  else {
 4817|  3.29M|                     static constexpr std::string_view null_value{"null"};
 4818|  3.29M|                     auto null_it = null_value.data();
 4819|  3.29M|                     const yaml::yaml_context::scoped_stream literal_stream{ctx, null_value.data()};
 4820|  3.29M|                     from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(
 4821|  3.29M|                        val, ctx, null_it, null_value.data() + null_value.size());
 4822|  3.29M|                     return !bool(ctx.error);
 4823|  3.29M|                  }
 4824|  3.29M|               };
 4825|       |
 4826|  3.29M|               if (it != end && (*it == ',' || *it == '}')) {
  ------------------
  |  Branch (4826:20): [True: 3.25M, False: 43.8k]
  |  Branch (4826:34): [True: 1.31M, False: 1.94M]
  |  Branch (4826:48): [True: 356k, False: 1.58M]
  ------------------
 4827|  1.67M|                  val_t val{};
 4828|  1.67M|                  if (!parse_implicit_null(val)) [[unlikely]]
  ------------------
  |  Branch (4828:23): [True: 0, False: 1.67M]
  ------------------
 4829|      0|                     return;
 4830|       |
 4831|  1.67M|                  value.emplace(std::move(key), std::move(val));
 4832|       |
 4833|  1.67M|                  if (*it == '}') {
  ------------------
  |  Branch (4833:23): [True: 356k, False: 1.31M]
  ------------------
 4834|   356k|                     ++it;
 4835|   356k|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4836|   356k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4836:26): [True: 700, False: 356k]
  ------------------
 4837|    700|                        return;
 4838|   356k|                     break;
 4839|   356k|                  }
 4840|       |
 4841|  1.31M|                  ++it; // skip comma
 4842|  1.31M|                  yaml::skip_ws_and_newlines(it, end);
 4843|  1.31M|                  continue;
 4844|  1.67M|               }
 4845|       |
 4846|  1.62M|               if (it == end || *it != ':') {
  ------------------
  |  Branch (4846:20): [True: 43.8k, False: 1.58M]
  |  Branch (4846:33): [True: 2.40k, False: 1.58M]
  ------------------
 4847|  4.18k|                  ctx.error = error_code::syntax_error;
 4848|  4.18k|                  return;
 4849|  4.18k|               }
 4850|  1.62M|               ++it;
 4851|       |
 4852|  1.62M|               yaml::skip_flow_ws_and_newlines(ctx, it, end);
 4853|  1.62M|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4853:20): [True: 14, False: 1.62M]
  ------------------
 4854|     14|                  return;
 4855|       |
 4856|       |               // Omitted value after an explicit ':' maps to an implicit null.
 4857|  1.62M|               if (it != end && (*it == ',' || *it == '}')) {
  ------------------
  |  Branch (4857:20): [True: 1.58M, False: 42.1k]
  |  Branch (4857:34): [True: 80.8k, False: 1.50M]
  |  Branch (4857:48): [True: 36.7k, False: 1.46M]
  ------------------
 4858|   117k|                  val_t val{};
 4859|   117k|                  if (!parse_implicit_null(val)) [[unlikely]]
  ------------------
  |  Branch (4859:23): [True: 0, False: 117k]
  ------------------
 4860|      0|                     return;
 4861|       |
 4862|   117k|                  value.emplace(std::move(key), std::move(val));
 4863|       |
 4864|   117k|                  if (*it == '}') {
  ------------------
  |  Branch (4864:23): [True: 36.7k, False: 80.8k]
  ------------------
 4865|  36.7k|                     ++it;
 4866|  36.7k|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4867|  36.7k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4867:26): [True: 48, False: 36.6k]
  ------------------
 4868|     48|                        return;
 4869|  36.6k|                     break;
 4870|  36.7k|                  }
 4871|       |
 4872|  80.8k|                  ++it; // skip comma
 4873|  80.8k|                  yaml::skip_ws_and_newlines(it, end);
 4874|  80.8k|                  continue;
 4875|   117k|               }
 4876|       |
 4877|       |               // Parse value
 4878|  1.50M|               val_t val{};
 4879|  1.50M|               from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(val, ctx, it, end);
 4880|  1.50M|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4880:20): [True: 9.07k, False: 1.49M]
  ------------------
 4881|  9.07k|                  return;
 4882|       |
 4883|  1.49M|               value.emplace(std::move(key), std::move(val));
 4884|       |
 4885|  1.49M|               yaml::skip_inline_ws(it, end);
 4886|       |
 4887|  1.49M|               if (it != end && *it == '}') {
  ------------------
  |  Branch (4887:20): [True: 1.45M, False: 42.5k]
  |  Branch (4887:33): [True: 625k, False: 828k]
  ------------------
 4888|   625k|                  ++it;
 4889|   625k|                  yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4890|   625k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4890:23): [True: 881, False: 625k]
  ------------------
 4891|    881|                     return;
 4892|   625k|                  break;
 4893|   625k|               }
 4894|   870k|               else if (it != end && *it == ',') {
  ------------------
  |  Branch (4894:25): [True: 828k, False: 42.5k]
  |  Branch (4894:38): [True: 779k, False: 48.7k]
  ------------------
 4895|   779k|                  ++it;
 4896|       |                  // Skip whitespace and newlines after comma
 4897|   779k|                  yaml::skip_ws_and_newlines(it, end);
 4898|   779k|               }
 4899|  91.2k|               else if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (4899:25): [True: 48.7k, False: 42.5k]
  |  Branch (4899:39): [True: 27.0k, False: 21.7k]
  |  Branch (4899:54): [True: 20.7k, False: 933]
  ------------------
 4900|       |                  // Newlines may precede either the closing brace or the
 4901|       |                  // separator comma for the next entry.
 4902|  47.8k|                  yaml::skip_ws_and_newlines(it, end);
 4903|  47.8k|                  if (it != end && *it == '}') {
  ------------------
  |  Branch (4903:23): [True: 47.7k, False: 75]
  |  Branch (4903:36): [True: 13.5k, False: 34.2k]
  ------------------
 4904|  13.5k|                     ++it;
 4905|  13.5k|                     yaml::validate_flow_node_adjacent_tail(ctx, it, end);
 4906|  13.5k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4906:26): [True: 10, False: 13.5k]
  ------------------
 4907|     10|                        return;
 4908|  13.5k|                     break;
 4909|  13.5k|                  }
 4910|  34.2k|                  if (it != end && *it == ',') {
  ------------------
  |  Branch (4910:23): [True: 34.2k, False: 75]
  |  Branch (4910:36): [True: 33.9k, False: 272]
  ------------------
 4911|  33.9k|                     ++it;
 4912|  33.9k|                     yaml::skip_ws_and_newlines(it, end);
 4913|  33.9k|                     continue;
 4914|  33.9k|                  }
 4915|    347|                  ctx.error = error_code::syntax_error;
 4916|    347|                  return;
 4917|  34.2k|               }
 4918|  43.4k|               else {
 4919|  43.4k|                  ctx.error = error_code::syntax_error;
 4920|  43.4k|                  return;
 4921|  43.4k|               }
 4922|  1.49M|            }
 4923|  1.14M|         }
 4924|   754k|         else {
 4925|       |            // Block mapping - use shared loop with map-specific callback
 4926|   754k|            yaml::parse_block_mapping_loop<Opts>(
 4927|   754k|               ctx, it, end, int32_t(-1), [&](auto& ctx, auto& it, auto end, int32_t line_indent) -> bool {
 4928|   754k|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|   754k|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 4930|   754k|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|   754k|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|   754k|                           if (ctx.stream_begin) {
 4938|   754k|                              auto is_line_content_start = [&](auto pos) {
 4939|   754k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   754k|                              };
 4941|       |
 4942|   754k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   754k|                                 const char* line = ctx.line_begin_of(pos);
 4944|   754k|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|   754k|                                 return line != end && *line == ':';
 4946|   754k|                              };
 4947|       |
 4948|   754k|                              if (!is_line_content_start(it) &&
 4949|   754k|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
 4950|   754k|                                  !line_has_explicit_value_indicator(it)) {
 4951|   754k|                                 ctx.error = error_code::syntax_error;
 4952|   754k|                                 return false;
 4953|   754k|                              }
 4954|   754k|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|   754k|                           }
 4956|   754k|                        }
 4957|       |
 4958|   754k|                        if (*it == '-' &&
 4959|   754k|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
 4960|   754k|                            !line_starts_with_explicit_value_indicator) {
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|   754k|                           ctx.error = error_code::syntax_error;
 4963|   754k|                           return false;
 4964|   754k|                        }
 4965|       |
 4966|   754k|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 4967|   754k|                           return false;
 4968|   754k|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|   754k|                        ctx.pop_indent();
 4970|   754k|                     }
 4971|   754k|                     else {
 4972|   754k|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|   754k|                        if (nested_indent >= 0) {
 4974|   754k|                           yaml::skip_to_content(it, end);
 4975|   754k|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
 4976|   754k|                              ctx.error = error_code::syntax_error;
 4977|   754k|                              return false;
 4978|   754k|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|   754k|                           const int32_t value_indent =
 4982|   754k|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
 4983|   754k|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
 4984|   754k|                              return false;
 4985|   754k|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|   754k|                           ctx.pop_indent();
 4987|   754k|                        }
 4988|   754k|                     }
 4989|   754k|                     return !bool(ctx.error);
 4990|   754k|                  };
 4991|       |
 4992|       |                  // Explicit key entry form:
 4993|       |                  // ? key
 4994|       |                  // : value
 4995|   754k|                  if (*it == '?' && ((it + 1) != end) && *(it + 1) == '\t') {
 4996|   754k|                     ctx.error = error_code::syntax_error;
 4997|   754k|                     return false;
 4998|   754k|                  }
 4999|   754k|                  if (*it == '?' && ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\n' || *(it + 1) == '\r')) {
 5000|   754k|                     ++it; // skip '?'
 5001|   754k|                     yaml::skip_inline_ws(it, end);
 5002|       |
 5003|   754k|                     const int32_t explicit_value_indicator_indent =
 5004|   754k|                        (ctx.current_indent() < 0) ? 0 : (ctx.current_indent() + 1);
 5005|       |
 5006|   754k|                     key_t key{};
 5007|   754k|                     if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5008|   754k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   754k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   754k|                        };
 5011|       |
 5012|   754k|                        auto key_it = it;
 5013|   754k|                        yaml::skip_inline_ws(key_it, end);
 5014|       |
 5015|   754k|                        auto content = key_it;
 5016|   754k|                        yaml::skip_to_content(content, end);
 5017|   754k|                        bool handled_anchor_only_empty_key = false;
 5018|       |
 5019|       |                        // Anchor on an empty explicit key node:
 5020|       |                        //   ? &a
 5021|       |                        //   : value
 5022|   754k|                        if (content != end && *content == '&') {
 5023|   754k|                           auto anchor_probe = content + 1;
 5024|   754k|                           auto anchor_name = yaml::parse_anchor_name(anchor_probe, end);
 5025|   754k|                           if (!anchor_name.empty()) {
 5026|   754k|                              auto after_anchor = anchor_probe;
 5027|   754k|                              yaml::skip_inline_ws(after_anchor, end);
 5028|       |
 5029|   754k|                              auto value_indicator = after_anchor;
 5030|   754k|                              if (value_indicator != end && *value_indicator == ':') {
 5031|   754k|                                 key.clear();
 5032|   754k|                                 ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5033|   754k|                                 it = value_indicator;
 5034|   754k|                                 handled_anchor_only_empty_key = true;
 5035|   754k|                              }
 5036|   754k|                              else {
 5037|   754k|                                 if (value_indicator != end && *value_indicator == '#') {
 5038|   754k|                                    yaml::skip_comment(value_indicator, end);
 5039|   754k|                                 }
 5040|   754k|                                 if (value_indicator != end && (*value_indicator == '\n' || *value_indicator == '\r')) {
 5041|   754k|                                    yaml::skip_newline(value_indicator, end);
 5042|   754k|                                    auto value_line = value_indicator;
 5043|   754k|                                    int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5044|   754k|                                    if (bool(ctx.error)) [[unlikely]]
 5045|   754k|                                       return false;
 5046|   754k|                                    if (value_line != end && *value_line == ':' &&
 5047|   754k|                                        value_indent == explicit_value_indicator_indent) {
 5048|   754k|                                       key.clear();
 5049|   754k|                                       ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5050|   754k|                                       it = value_line;
 5051|   754k|                                       handled_anchor_only_empty_key = true;
 5052|   754k|                                    }
 5053|   754k|                                    else if (value_line != end && *value_line == ':') {
 5054|       |                                       // In explicit-key form ("? &a"), a following ':'
 5055|       |                                       // starts the outer value indicator only at the same
 5056|       |                                       // indentation. A deeper-indented ': value' is malformed.
 5057|   754k|                                       ctx.error = error_code::syntax_error;
 5058|   754k|                                       return false;
 5059|   754k|                                    }
 5060|   754k|                                 }
 5061|   754k|                              }
 5062|   754k|                           }
 5063|   754k|                        }
 5064|       |
 5065|   754k|                        const bool key_content_spans_lines = [&] {
 5066|   754k|                           auto scan = key_it;
 5067|   754k|                           while (scan != content && scan != end) {
 5068|   754k|                              if (*scan == '\n' || *scan == '\r') return true;
 5069|   754k|                              ++scan;
 5070|   754k|                           }
 5071|   754k|                           return false;
 5072|   754k|                        }();
 5073|       |
 5074|   754k|                        if (handled_anchor_only_empty_key) {
 5075|       |                           // 'it' already points to the explicit value indicator ':'
 5076|   754k|                        }
 5077|   754k|                        else if (content == end || (*content == ':' && key_content_spans_lines)) {
 5078|   754k|                           key.clear();
 5079|   754k|                           it = content;
 5080|   754k|                        }
 5081|   754k|                        else {
 5082|       |                           // Explicit mapping keys ('? key-node') are full YAML nodes.
 5083|       |                           // Parse the key node structurally (not via plain-key scanning)
 5084|       |                           // so inputs like '? []: x' and '? JSON: like' are interpreted
 5085|       |                           // as complex keys, not split into implicit key/value pairs.
 5086|   754k|                           auto key_node_it = content;
 5087|   754k|                           auto key_node_end = end;
 5088|   754k|                           if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 5089|       |                              // In explicit-key form, a following standalone ':'
 5090|       |                              // line (same or lower indentation) belongs to the
 5091|       |                              // outer mapping value, not the key node itself.
 5092|   754k|                              auto scan = content;
 5093|   754k|                              while (scan != end) {
 5094|   754k|                                 while (scan != end && *scan != '\n' && *scan != '\r') {
 5095|   754k|                                    ++scan;
 5096|   754k|                                 }
 5097|   754k|                                 if (scan == end) {
 5098|   754k|                                    break;
 5099|   754k|                                 }
 5100|       |
 5101|   754k|                                 yaml::skip_newline(scan, end);
 5102|   754k|                                 auto line_start = scan;
 5103|       |
 5104|   754k|                                 int32_t indicator_indent = 0;
 5105|   754k|                                 while (scan != end && *scan == ' ') {
 5106|   754k|                                    ++indicator_indent;
 5107|   754k|                                    ++scan;
 5108|   754k|                                 }
 5109|       |
 5110|   754k|                                 if (scan != end && *scan == ':') {
 5111|   754k|                                    const auto after_colon = scan + 1;
 5112|   754k|                                    if ((after_colon == end ||
 5113|   754k|                                         yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
 5114|   754k|                                        indicator_indent <= line_indent) {
 5115|   754k|                                       key_node_end = line_start;
 5116|   754k|                                       break;
 5117|   754k|                                    }
 5118|   754k|                                 }
 5119|   754k|                              }
 5120|   754k|                           }
 5121|       |
 5122|   754k|                           glz::generic key_node{};
 5123|   754k|                           const bool prev_explicit_mapping_key_context = ctx.explicit_mapping_key_context;
 5124|   754k|                           ctx.explicit_mapping_key_context = true;
 5125|   754k|                           from<YAML, glz::generic>::template op<Opts>(key_node, ctx, key_node_it, key_node_end);
 5126|   754k|                           ctx.explicit_mapping_key_context = prev_explicit_mapping_key_context;
 5127|   754k|                           if (bool(ctx.error)) [[unlikely]]
 5128|   754k|                              return false;
 5129|   754k|                           it = key_node_it;
 5130|   754k|                           if (!to_string_key(key_node)) [[unlikely]]
 5131|   754k|                              return false;
 5132|   754k|                        }
 5133|   754k|                     }
 5134|   754k|                     else {
 5135|   754k|                        if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 5136|   754k|                           from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5137|   754k|                           if (bool(ctx.error)) [[unlikely]]
 5138|   754k|                              return false;
 5139|   754k|                        }
 5140|   754k|                     }
 5141|       |
 5142|   754k|                     yaml::skip_inline_ws(it, end);
 5143|   754k|                     yaml::skip_comment(it, end);
 5144|       |
 5145|       |                     // Value indicator may appear on the next line at the same indent.
 5146|   754k|                     if (it != end && (*it == '\n' || *it == '\r')) {
 5147|   754k|                        auto probe = it;
 5148|   754k|                        bool found_value_indicator = false;
 5149|       |
 5150|   754k|                        while (probe != end && (*probe == '\n' || *probe == '\r')) {
 5151|   754k|                           yaml::skip_newline(probe, end);
 5152|       |
 5153|   754k|                           auto value_line = probe;
 5154|   754k|                           int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5155|   754k|                           if (bool(ctx.error)) [[unlikely]]
 5156|   754k|                              return false;
 5157|       |
 5158|   754k|                           if (value_line == end || *value_line == '\n' || *value_line == '\r') {
 5159|   754k|                              probe = value_line;
 5160|   754k|                              continue; // blank line
 5161|   754k|                           }
 5162|   754k|                           if (*value_line == '#') {
 5163|   754k|                              yaml::skip_comment(value_line, end);
 5164|   754k|                              probe = value_line;
 5165|   754k|                              continue; // comment-only line
 5166|   754k|                           }
 5167|   754k|                           if (*value_line == ':' && value_indent == explicit_value_indicator_indent) {
 5168|   754k|                              it = value_line;
 5169|   754k|                              found_value_indicator = true;
 5170|   754k|                           }
 5171|   754k|                           break;
 5172|   754k|                        }
 5173|       |
 5174|   754k|                        if (found_value_indicator) {
 5175|   754k|                           yaml::skip_inline_ws(it, end);
 5176|   754k|                        }
 5177|   754k|                     }
 5178|       |
 5179|   754k|                     val_t val{};
 5180|   754k|                     if (it != end && *it == ':') {
 5181|   754k|                        ++it;
 5182|   754k|                        if (it != end && *it == '\t') {
 5183|   754k|                           ctx.error = error_code::syntax_error;
 5184|   754k|                           return false;
 5185|   754k|                        }
 5186|   754k|                        if (it != end && (*it == '\n' || *it == '\r')) {
 5187|   754k|                           auto probe = it;
 5188|   754k|                           yaml::skip_newline(probe, end);
 5189|   754k|                           while (probe != end && *probe == ' ') ++probe;
 5190|   754k|                           if (probe != end && *probe == ':' && ((probe + 1) != end) && *(probe + 1) == '\t') {
 5191|   754k|                              ctx.error = error_code::syntax_error;
 5192|   754k|                              return false;
 5193|   754k|                           }
 5194|   754k|                        }
 5195|   754k|                        yaml::skip_inline_ws(it, end);
 5196|   754k|                        if (!parse_map_value(val)) [[unlikely]]
 5197|   754k|                           return false;
 5198|   754k|                     }
 5199|       |
 5200|   754k|                     value.emplace(std::move(key), std::move(val));
 5201|   754k|                     return true;
 5202|   754k|                  }
 5203|       |
 5204|   754k|                  key_t key{};
 5205|   754k|                  if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5206|   754k|                     auto key_probe = it;
 5207|   754k|                     yaml::skip_inline_ws(key_probe, end);
 5208|   754k|                     const bool complex_flow_key = (key_probe != end && (*key_probe == '[' || *key_probe == '{'));
 5209|   754k|                     if (complex_flow_key) {
 5210|   754k|                        glz::generic key_node{};
 5211|   754k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 5212|   754k|                        if (bool(ctx.error)) [[unlikely]]
 5213|   754k|                           return false;
 5214|   754k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
 5215|   754k|                           return false;
 5216|   754k|                     }
 5217|   754k|                     else {
 5218|   754k|                        if (!yaml::parse_yaml_key(key, ctx, it, end, false)) {
 5219|   754k|                           return false;
 5220|   754k|                        }
 5221|   754k|                     }
 5222|   754k|                  }
 5223|   754k|                  else {
 5224|   754k|                     from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5225|   754k|                     if (bool(ctx.error)) [[unlikely]]
 5226|   754k|                        return false;
 5227|   754k|                  }
 5228|       |
 5229|   754k|                  yaml::skip_inline_ws(it, end);
 5230|       |
 5231|   754k|                  if (it == end || *it != ':') {
 5232|   754k|                     ctx.error = error_code::syntax_error;
 5233|   754k|                     return false;
 5234|   754k|                  }
 5235|   754k|                  ++it;
 5236|   754k|                  yaml::skip_inline_ws(it, end);
 5237|       |
 5238|   754k|                  val_t val{};
 5239|   754k|                  if (!parse_map_value(val)) [[unlikely]]
 5240|   754k|                     return false;
 5241|       |
 5242|   754k|                  value.emplace(std::move(key), std::move(val));
 5243|   754k|                  return true;
 5244|   754k|               });
 5245|   754k|         }
 5246|       |
 5247|  1.83M|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 5248|  1.83M|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEEXtlNS0_20node_property_policyELb1ELb1EEELb0ERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES4_EEEENS0_12yaml_contextEPKcSC_ZNS_4fromILj450ES8_E2opITnDaXtlS2_Lj450ELb1ELb0ELb1ELh2ELb0ELj1EEERSC_S9_TkNS_10is_contextERSA_SC_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSL_RSO_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|  1.94M|      {
  475|  1.94M|         skip_inline_ws(it, end);
  476|       |
  477|  1.94M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 15, False: 1.94M]
  ------------------
  478|     15|            if constexpr (!AllowEmptyInput) {
  479|     15|               ctx.error = error_code::unexpected_end;
  480|     15|            }
  481|     15|            return true;
  482|     15|         }
  483|       |
  484|  1.94M|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|  1.94M|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 6, False: 1.94M]
  ------------------
  486|      6|            ctx.error = error_code::syntax_error;
  487|      6|            return true;
  488|      6|         }
  489|  1.94M|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 6, False: 1.94M]
  ------------------
  490|      6|            ctx.error = error_code::syntax_error;
  491|      6|            return true;
  492|      6|         }
  493|       |
  494|  1.94M|         skip_inline_ws(it, end);
  495|       |
  496|  1.94M|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 9, False: 1.94M]
  ------------------
  497|      9|            if constexpr (!AllowEmptyInput) {
  498|      9|               ctx.error = error_code::unexpected_end;
  499|      9|            }
  500|      9|            return true;
  501|      9|         }
  502|       |
  503|  1.94M|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 29.2k, False: 1.91M]
  ------------------
  504|  29.2k|            return true;
  505|  29.2k|         }
  506|       |
  507|  1.91M|         return false;
  508|  1.94M|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlNS8_8yaml_tagEE_clESN_:
 4666|  1.94M|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_map(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEEXtlNS0_20node_property_policyELb1ELb1EEERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES4_EEEENS0_12yaml_contextEPKcSC_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|  1.94M|      {
  418|  1.94M|         state.has_anchor = false;
  419|  1.94M|         state.anchor_name.clear();
  420|  1.94M|         state.anchor_start = nullptr;
  421|  1.94M|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|  1.94M|         if constexpr (Policy.allow_alias) {
  424|  1.94M|            if constexpr (Policy.alias_can_be_mapping_key) {
  425|  1.94M|               if (!alias_token_is_mapping_key(it, end)) {
  ------------------
  |  Branch (425:20): [True: 1.94M, False: 2.07k]
  ------------------
  426|  1.94M|                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (426:23): [True: 29.2k, False: 1.91M]
  ------------------
  427|  1.94M|               }
  428|       |            }
  429|       |            else {
  430|       |               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  431|       |            }
  432|  1.94M|         }
  433|       |
  434|  1.94M|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 1.91M, False: 29.2k]
  |  Branch (434:27): [True: 25.8k, False: 1.89M]
  ------------------
  435|  25.8k|            ++it;
  436|  25.8k|            auto name = parse_anchor_name(it, end);
  437|  25.8k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 25, False: 25.7k]
  ------------------
  438|     25|               ctx.error = error_code::syntax_error;
  439|     25|               return true;
  440|     25|            }
  441|  25.7k|            skip_inline_ws(it, end);
  442|  25.7k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 42, False: 25.7k]
  ------------------
  443|     42|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     42|                  ctx.error = error_code::unexpected_end;
  445|     42|               }
  446|     42|               return true;
  447|     42|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  25.7k|            state.has_anchor = true;
  455|  25.7k|            state.anchor_name = std::string(name);
  456|  25.7k|            state.anchor_start = &*it;
  457|  25.7k|         }
  458|       |
  459|  1.94M|         return false;
  460|  1.94M|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERNS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES3_EEEENS0_12yaml_contextEPKcSB_EEbOT0_RT1_RT2_T3_:
  309|  1.94M|      {
  310|  1.94M|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 1.94M]
  |  Branch (310:27): [True: 1.91M, False: 29.2k]
  ------------------
  311|       |
  312|  29.2k|         ++it; // skip '*'
  313|  29.2k|         auto name = parse_anchor_name(it, end);
  314|  29.2k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 32, False: 29.1k]
  ------------------
  315|     32|            ctx.error = error_code::syntax_error;
  316|     32|            return true;
  317|     32|         }
  318|       |
  319|  29.1k|         auto anchor_it = ctx.anchors.find(name);
  320|  29.1k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 233, False: 28.9k]
  ------------------
  321|    233|            ctx.error = error_code::syntax_error; // undefined alias
  322|    233|            return true;
  323|    233|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  28.9k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  28.9k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 4.03k, False: 24.9k]
  ------------------
  331|  4.03k|            return true;
  332|  4.03k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  24.9k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 23, False: 24.8k]
  ------------------
  338|     23|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     23|            return true;
  340|     23|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  24.8k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  24.8k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 6, False: 24.8k]
  ------------------
  348|      6|            return true;
  349|       |
  350|  24.8k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 30, False: 24.8k]
  ------------------
  351|     30|            ctx.error = error_code::exceeded_max_expansion;
  352|     30|            ctx.custom_error_message = "alias expansion";
  353|     30|            return true;
  354|     30|         }
  355|       |
  356|  24.8k|         auto replay_it = span.begin;
  357|  24.8k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  24.8k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  24.8k|         ctx.indent_stack.clear();
  362|  24.8k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 1.80k, False: 23.0k]
  ------------------
  363|  1.80k|            ctx.push_indent(span.base_indent - 1);
  364|  1.80k|         }
  365|       |
  366|  24.8k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  24.8k|         using V = std::remove_cvref_t<T>;
  369|  24.8k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  24.8k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  24.8k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  24.8k|         return true;
  376|  24.8k|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlRS4_E_clESN_:
 4807|  1.78M|               auto parse_implicit_null = [&](val_t& val) -> bool {
 4808|       |                  if constexpr (nullable_like<std::remove_cvref_t<val_t>>) {
 4809|       |                     val = {};
 4810|       |                     return true;
 4811|       |                  }
 4812|  1.78M|                  else if constexpr (std::same_as<std::remove_cvref_t<val_t>, glz::generic>) {
 4813|  1.78M|                     val = glz::generic{};
 4814|  1.78M|                     return true;
 4815|       |                  }
 4816|       |                  else {
 4817|       |                     static constexpr std::string_view null_value{"null"};
 4818|       |                     auto null_it = null_value.data();
 4819|       |                     const yaml::yaml_context::scoped_stream literal_stream{ctx, null_value.data()};
 4820|       |                     from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(
 4821|       |                        val, ctx, null_it, null_value.data() + null_value.size());
 4822|       |                     return !bool(ctx.error);
 4823|       |                  }
 4824|  1.78M|               };
_ZN3glz4yaml24parse_block_mapping_loopITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEENS0_12yaml_contextEPKcS5_ZNS_4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES7_EEEEE2opITnDaXtlS2_Lj450ELb1ELb0ELb1ELh2ELb0ELj1EEERS5_RSB_TkNS_10is_contextERS3_S5_EEvOT1_OT2_OT0_T3_EUlRT_RSL_SH_iE_EEvSQ_RSH_SJ_iOSN_:
 3736|   754k|      {
 3737|       |         // A tagged-variant custom alternative hands its body (at the variant's own column) to a
 3738|       |         // discover-mode reader. Honor the known indent it published so continuation/dedent are
 3739|       |         // judged against the outer parent, not the body itself. One-shot: reset on observation.
 3740|   754k|         if (ctx.forced_block_mapping_indent >= 0) {
  ------------------
  |  Branch (3740:14): [True: 0, False: 754k]
  ------------------
 3741|      0|            if (mapping_indent < 0) {
  ------------------
  |  Branch (3741:17): [True: 0, False: 0]
  ------------------
 3742|      0|               mapping_indent = ctx.forced_block_mapping_indent;
 3743|      0|            }
 3744|      0|            ctx.forced_block_mapping_indent = -1;
 3745|      0|         }
 3746|   754k|         const int32_t parent_indent = ctx.current_indent();
 3747|   754k|         const bool discover_indent = (mapping_indent < 0);
 3748|   754k|         bool first_key = !discover_indent;
 3749|   754k|         bool discovered_first_key_mid_line = false;
 3750|   754k|         int32_t discovered_first_key_visual_indent = 0;
 3751|       |
 3752|  2.21M|         while (it != end) {
  ------------------
  |  Branch (3752:17): [True: 1.58M, False: 635k]
  ------------------
 3753|  1.58M|            auto line_start = it;
 3754|  1.58M|            int32_t line_indent = first_key ? mapping_indent : 0;
  ------------------
  |  Branch (3754:35): [True: 0, False: 1.58M]
  ------------------
 3755|       |
 3756|       |            // Skip blank lines and comments, measure indent
 3757|  1.99M|            while (it != end) {
  ------------------
  |  Branch (3757:20): [True: 1.98M, False: 13.4k]
  ------------------
 3758|  1.98M|               if (*it == '#') {
  ------------------
  |  Branch (3758:20): [True: 30.0k, False: 1.95M]
  ------------------
 3759|  30.0k|                  skip_comment(it, end);
 3760|  30.0k|                  skip_newline(it, end);
 3761|  30.0k|                  first_key = false;
 3762|  30.0k|                  line_indent = 0;
 3763|  30.0k|               }
 3764|  1.95M|               else if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3764:25): [True: 63.3k, False: 1.88M]
  |  Branch (3764:40): [True: 274k, False: 1.61M]
  ------------------
 3765|   337k|                  skip_newline(it, end);
 3766|   337k|                  first_key = false;
 3767|   337k|                  line_indent = 0;
 3768|   337k|               }
 3769|  1.61M|               else if (*it == ' ') {
  ------------------
  |  Branch (3769:25): [True: 174k, False: 1.43M]
  ------------------
 3770|   174k|                  line_start = it;
 3771|   174k|                  line_indent = 0;
 3772|  11.0M|                  while (it != end && *it == ' ') {
  ------------------
  |  Branch (3772:26): [True: 11.0M, False: 5.09k]
  |  Branch (3772:39): [True: 10.8M, False: 169k]
  ------------------
 3773|  10.8M|                     ++line_indent;
 3774|  10.8M|                     ++it;
 3775|  10.8M|                  }
 3776|       |
 3777|   174k|                  bool saw_tab = false;
 3778|   182k|                  while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3778:26): [True: 176k, False: 6.02k]
  |  Branch (3778:40): [True: 4.98k, False: 171k]
  |  Branch (3778:54): [True: 3.31k, False: 168k]
  ------------------
 3779|  8.30k|                     saw_tab = saw_tab || (*it == '\t');
  ------------------
  |  Branch (3779:32): [True: 6.10k, False: 2.19k]
  |  Branch (3779:43): [True: 2.19k, False: 0]
  ------------------
 3780|  8.30k|                     ++it;
 3781|  8.30k|                  }
 3782|       |
 3783|   174k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3783:23): [True: 6.02k, False: 168k]
  |  Branch (3783:36): [True: 4.84k, False: 163k]
  |  Branch (3783:51): [True: 4.38k, False: 159k]
  |  Branch (3783:66): [True: 3.04k, False: 156k]
  ------------------
 3784|  18.2k|                     first_key = false;
 3785|  18.2k|                     line_indent = 0;
 3786|  18.2k|                     continue; // Blank or comment line
 3787|  18.2k|                  }
 3788|       |
 3789|   156k|                  if (saw_tab) {
  ------------------
  |  Branch (3789:23): [True: 87, False: 156k]
  ------------------
 3790|     87|                     ctx.error = error_code::syntax_error;
 3791|     87|                     return;
 3792|     87|                  }
 3793|       |
 3794|       |                  // Early dedent check
 3795|   156k|                  if (mapping_indent >= 0 && line_indent < mapping_indent) {
  ------------------
  |  Branch (3795:23): [True: 151k, False: 5.08k]
  |  Branch (3795:46): [True: 855, False: 150k]
  ------------------
 3796|    855|                     it = line_start;
 3797|    855|                     return;
 3798|    855|                  }
 3799|       |
 3800|   155k|                  first_key = false;
 3801|   155k|                  break; // Found content
 3802|   156k|               }
 3803|  1.43M|               else if (*it == '\t') {
  ------------------
  |  Branch (3803:25): [True: 27.4k, False: 1.41M]
  ------------------
 3804|  27.4k|                  line_start = it;
 3805|  63.0k|                  while (it != end && (*it == ' ' || *it == '\t')) ++it;
  ------------------
  |  Branch (3805:26): [True: 62.2k, False: 837]
  |  Branch (3805:40): [True: 4.15k, False: 58.0k]
  |  Branch (3805:54): [True: 31.4k, False: 26.6k]
  ------------------
 3806|  27.4k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3806:23): [True: 837, False: 26.6k]
  |  Branch (3806:36): [True: 5.98k, False: 20.6k]
  |  Branch (3806:51): [True: 19.3k, False: 1.28k]
  |  Branch (3806:66): [True: 1.12k, False: 155]
  ------------------
 3807|  27.2k|                     first_key = false;
 3808|  27.2k|                     line_indent = 0;
 3809|  27.2k|                     continue; // Blank or comment-only line with tab indentation
 3810|  27.2k|                  }
 3811|    155|                  ctx.error = error_code::syntax_error;
 3812|    155|                  return;
 3813|  27.4k|               }
 3814|  1.41M|               else {
 3815|  1.41M|                  line_start = it;
 3816|  1.41M|                  break; // Content at column 0
 3817|  1.41M|               }
 3818|  1.98M|            }
 3819|       |
 3820|  1.57M|            if (it == end) break;
  ------------------
  |  Branch (3820:17): [True: 13.4k, False: 1.56M]
  ------------------
 3821|       |
 3822|       |            // Document boundaries terminate the current mapping in both discovered
 3823|       |            // and fixed-indent modes.
 3824|  1.56M|            if (at_document_end(it, end) || at_document_start(it, end)) break;
  ------------------
  |  Branch (3824:17): [True: 3.46k, False: 1.56M]
  |  Branch (3824:45): [True: 3.56k, False: 1.55M]
  ------------------
 3825|       |
 3826|       |            // Dedent checks (skip on first key for struct case)
 3827|       |            // Must check BEFORE establishing mapping_indent so the first discovered key
 3828|       |            // isn't rejected by the parent_indent check (mapping_indent is still -1).
 3829|  1.55M|            if (!first_key) {
  ------------------
  |  Branch (3829:17): [True: 1.55M, False: 0]
  ------------------
 3830|       |               // Parent indent check for nested maps (only after mapping_indent established)
 3831|  1.55M|               if (discover_indent && mapping_indent >= 0 && parent_indent >= 0 && line_indent <= parent_indent) {
  ------------------
  |  Branch (3831:20): [True: 1.55M, False: 0]
  |  Branch (3831:39): [True: 804k, False: 754k]
  |  Branch (3831:62): [True: 78.7k, False: 725k]
  |  Branch (3831:84): [True: 56.6k, False: 22.0k]
  ------------------
 3832|  56.6k|                  it = line_start;
 3833|  56.6k|                  return;
 3834|  56.6k|               }
 3835|  1.50M|               if (mapping_indent >= 0 && line_indent < mapping_indent) {
  ------------------
  |  Branch (3835:20): [True: 747k, False: 754k]
  |  Branch (3835:43): [True: 750, False: 747k]
  ------------------
 3836|    750|                  it = line_start;
 3837|    750|                  return;
 3838|    750|               }
 3839|  1.50M|            }
 3840|       |
 3841|       |            // Establish mapping indent from first key (map case)
 3842|  1.50M|            bool established_mapping_indent_this_line = false;
 3843|  1.50M|            if (mapping_indent < 0) {
  ------------------
  |  Branch (3843:17): [True: 754k, False: 747k]
  ------------------
 3844|   754k|               mapping_indent = line_indent;
 3845|   754k|               established_mapping_indent_this_line = true;
 3846|   754k|               discovered_first_key_visual_indent = line_indent;
 3847|   754k|               if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3848|   754k|                  if (ctx.stream_begin && line_start > ctx.stream_begin) {
  ------------------
  |  Branch (3848:23): [True: 754k, False: 0]
  |  Branch (3848:43): [True: 754k, False: 0]
  ------------------
 3849|   754k|                     const auto prefix = ctx.line_prefix_before(line_start);
 3850|   754k|                     if (prefix.has_tab) {
  ------------------
  |  Branch (3850:26): [True: 300, False: 753k]
  ------------------
 3851|    300|                        ctx.error = error_code::syntax_error;
 3852|    300|                        return;
 3853|    300|                     }
 3854|       |
 3855|   753k|                     discovered_first_key_mid_line = prefix.has_content;
 3856|   753k|                     if (mapping_indent == 0 && prefix.column > 0) {
  ------------------
  |  Branch (3856:26): [True: 748k, False: 5.08k]
  |  Branch (3856:49): [True: 571k, False: 176k]
  ------------------
 3857|   571k|                        discovered_first_key_visual_indent = prefix.column;
 3858|   571k|                     }
 3859|   753k|                  }
 3860|   754k|               }
 3861|   754k|            }
 3862|       |
 3863|       |            // In discovered-indent block mappings, sibling keys must stay at the same
 3864|       |            // indent level, except when the first key started mid-line (e.g. "--- k: v").
 3865|  1.50M|            if (discover_indent && mapping_indent >= 0 && !established_mapping_indent_this_line &&
  ------------------
  |  Branch (3865:17): [True: 1.50M, False: 300]
  |  Branch (3865:36): [True: 1.50M, False: 0]
  |  Branch (3865:59): [True: 747k, False: 753k]
  ------------------
 3866|   747k|                !discovered_first_key_mid_line) {
  ------------------
  |  Branch (3866:17): [True: 580k, False: 166k]
  ------------------
 3867|   580k|               if (mapping_indent == 0 && discovered_first_key_visual_indent > 0) {
  ------------------
  |  Branch (3867:20): [True: 579k, False: 1.01k]
  |  Branch (3867:43): [True: 64.1k, False: 514k]
  ------------------
 3868|  64.1k|                  if (line_indent > discovered_first_key_visual_indent) {
  ------------------
  |  Branch (3868:23): [True: 83, False: 64.0k]
  ------------------
 3869|     83|                     ctx.error = error_code::syntax_error;
 3870|     83|                     return;
 3871|     83|                  }
 3872|  64.0k|                  if (line_indent < discovered_first_key_visual_indent) {
  ------------------
  |  Branch (3872:23): [True: 3.60k, False: 60.4k]
  ------------------
 3873|  3.60k|                     it = line_start;
 3874|  3.60k|                     return;
 3875|  3.60k|                  }
 3876|  64.0k|               }
 3877|   515k|               else if (line_indent > mapping_indent &&
  ------------------
  |  Branch (3877:25): [True: 1.62k, False: 514k]
  ------------------
 3878|  1.62k|                        (parent_indent < 0 || mapping_indent > 0 ||
  ------------------
  |  Branch (3878:26): [True: 85, False: 1.54k]
  |  Branch (3878:47): [True: 6, False: 1.53k]
  ------------------
 3879|  1.53k|                         (parent_indent >= 0 && mapping_indent == 0 && line_indent > (parent_indent + 1)))) {
  ------------------
  |  Branch (3879:27): [True: 1.53k, False: 0]
  |  Branch (3879:49): [True: 1.53k, False: 0]
  |  Branch (3879:72): [True: 38, False: 1.49k]
  ------------------
 3880|    129|                  ctx.error = error_code::syntax_error;
 3881|    129|                  return;
 3882|    129|               }
 3883|   580k|            }
 3884|       |
 3885|       |            // Sequence indicator check (struct case only - map parser lets key parsing
 3886|       |            // handle '- ' which produces appropriate errors for misindented items)
 3887|  1.49M|            if (!discover_indent && *it == '-' &&
  ------------------
  |  Branch (3887:17): [True: 0, False: 1.49M]
  |  Branch (3887:37): [True: 0, False: 0]
  ------------------
 3888|      0|                ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\t' || *(it + 1) == '\n')) {
  ------------------
  |  Branch (3888:18): [True: 0, False: 0]
  |  Branch (3888:37): [True: 0, False: 0]
  |  Branch (3888:57): [True: 0, False: 0]
  |  Branch (3888:78): [True: 0, False: 0]
  ------------------
 3889|      0|               it = line_start;
 3890|      0|               return;
 3891|      0|            }
 3892|       |
 3893|       |            // Skip indented comment lines
 3894|  1.49M|            if (*it == '#') {
  ------------------
  |  Branch (3894:17): [True: 0, False: 1.49M]
  ------------------
 3895|      0|               skip_comment(it, end);
 3896|      0|               first_key = false;
 3897|      0|               continue;
 3898|      0|            }
 3899|       |
 3900|       |            // Skip blank/empty lines after indent
 3901|  1.49M|            if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3901:17): [True: 300, False: 1.49M]
  |  Branch (3901:32): [True: 0, False: 1.49M]
  ------------------
 3902|      0|               first_key = false;
 3903|      0|               continue;
 3904|      0|            }
 3905|       |
 3906|       |            // While parsing an explicit mapping key node ('? key-node'),
 3907|       |            // a subsequent standalone ':' at the same indentation starts
 3908|       |            // the outer value indicator and must terminate this key-node map.
 3909|       |            // Keep same-line ': x' on the first key-node line valid.
 3910|  1.49M|            if (ctx.explicit_mapping_key_context && !established_mapping_indent_this_line && *it == ':') {
  ------------------
  |  Branch (3910:17): [True: 348k, False: 1.14M]
  |  Branch (3910:53): [True: 93.4k, False: 255k]
  |  Branch (3910:94): [True: 30.2k, False: 63.1k]
  ------------------
 3911|  30.2k|               const auto after_colon = it + 1;
 3912|  30.2k|               const int32_t explicit_value_indicator_indent = (parent_indent < 0) ? 0 : (parent_indent + 1);
  ------------------
  |  Branch (3912:64): [True: 28.4k, False: 1.87k]
  ------------------
 3913|  30.2k|               if ((after_colon == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
  ------------------
  |  Branch (3913:21): [True: 1.46k, False: 28.8k]
  |  Branch (3913:43): [True: 24.6k, False: 4.15k]
  ------------------
 3914|  26.1k|                   line_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (3914:20): [True: 3.03k, False: 23.1k]
  ------------------
 3915|  3.03k|                  it = line_start;
 3916|  3.03k|                  return;
 3917|  3.03k|               }
 3918|  30.2k|            }
 3919|       |
 3920|       |            // Process this mapping entry (key + colon + value)
 3921|  1.49M|            int32_t effective_line_indent = line_indent;
 3922|  1.49M|            if (discover_indent && established_mapping_indent_this_line &&
  ------------------
  |  Branch (3922:17): [True: 1.49M, False: 300]
  |  Branch (3922:36): [True: 753k, False: 740k]
  ------------------
 3923|   753k|                discovered_first_key_visual_indent > effective_line_indent &&
  ------------------
  |  Branch (3923:17): [True: 571k, False: 181k]
  ------------------
 3924|   571k|                !(discovered_first_key_mid_line && parent_indent < 0)) {
  ------------------
  |  Branch (3924:19): [True: 423k, False: 148k]
  |  Branch (3924:52): [True: 266k, False: 156k]
  ------------------
 3925|       |               // The first discovered key has no indentation of its own left to measure: it may
 3926|       |               // begin mid-line (a sequence entry's "- key: value"), or the caller may have already
 3927|       |               // consumed the line's indentation before handing the mapping over. Pass its visual
 3928|       |               // column so the entry judges its value against the key's real indent -- otherwise a
 3929|       |               // key with an empty value takes the following sibling line for nested content
 3930|       |               // (issue #2827) and same-line block scalars compute the wrong indentation.
 3931|       |               // The exception is a ROOT mapping whose first key begins mid-line, which means node
 3932|       |               // properties sit ahead of it (`!!str &a1 "foo":`): those belong to the document node
 3933|       |               // rather than to the key's column, so the measured indent stands. Conformance tests
 3934|       |               // 7FWL and HMQ5 pin that case.
 3935|   305k|               effective_line_indent = discovered_first_key_visual_indent;
 3936|   305k|            }
 3937|       |
 3938|  1.49M|            if (!process_entry(ctx, it, end, effective_line_indent)) {
  ------------------
  |  Branch (3938:17): [True: 33.5k, False: 1.46M]
  ------------------
 3939|  33.5k|               return;
 3940|  33.5k|            }
 3941|  1.46M|            first_key = false;
 3942|       |
 3943|  1.46M|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3943:17): [True: 0, False: 1.46M]
  ------------------
 3944|      0|               return;
 3945|       |
 3946|  1.46M|            if constexpr (yaml::check_flow_context(Opts)) {
 3947|       |               // In flow context, an implicit "key: value" pair used as a sequence entry
 3948|       |               // ends at ',', ']', or '}'. Let the enclosing flow parser consume it.
 3949|  1.46M|               auto flow_end = it;
 3950|  1.46M|               skip_flow_ws_and_newlines(ctx, flow_end, end);
 3951|  1.46M|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3951:20): [True: 98, False: 1.46M]
  ------------------
 3952|     98|                  return;
 3953|  1.46M|               if (flow_end != end && (*flow_end == ',' || *flow_end == ']' || *flow_end == '}')) {
  ------------------
  |  Branch (3953:20): [True: 1.23M, False: 223k]
  |  Branch (3953:40): [True: 299k, False: 938k]
  |  Branch (3953:60): [True: 21.2k, False: 916k]
  |  Branch (3953:80): [True: 102k, False: 813k]
  ------------------
 3954|   423k|                  it = flow_end;
 3955|   423k|                  return;
 3956|   423k|               }
 3957|  1.46M|            }
 3958|       |
 3959|       |            // Trailing whitespace handling (peek-ahead pattern).
 3960|       |            // After parsing, iterator may be at leading indent of next line.
 3961|       |            // Don't consume it - let the outer loop handle indent measurement.
 3962|  1.46M|            if (it != end) {
  ------------------
  |  Branch (3962:17): [True: 846k, False: 614k]
  ------------------
 3963|   846k|               if (*it == ' ' || *it == '\t') {
  ------------------
  |  Branch (3963:20): [True: 80.3k, False: 765k]
  |  Branch (3963:34): [True: 6.49k, False: 759k]
  ------------------
 3964|  86.8k|                  auto peek = it;
 3965|  86.8k|                  skip_inline_ws(peek, end);
 3966|  86.8k|                  if (peek != end && *peek != '\n' && *peek != '\r' && *peek != '#') {
  ------------------
  |  Branch (3966:23): [True: 81.3k, False: 5.43k]
  |  Branch (3966:38): [True: 75.9k, False: 5.41k]
  |  Branch (3966:55): [True: 72.6k, False: 3.34k]
  |  Branch (3966:72): [True: 67.2k, False: 5.39k]
  ------------------
 3967|  67.2k|                     continue; // At leading indent of new line
 3968|  67.2k|                  }
 3969|  86.8k|               }
 3970|   778k|               skip_inline_ws(it, end);
 3971|   778k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (3971:20): [True: 773k, False: 5.43k]
  |  Branch (3971:33): [True: 27.7k, False: 745k]
  ------------------
 3972|  27.7k|                  if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3973|  27.7k|                     if (it > line_start) {
  ------------------
  |  Branch (3973:26): [True: 27.7k, False: 0]
  ------------------
 3974|  27.7k|                        const char prev = *(it - 1);
 3975|  27.7k|                        if (prev != ' ' && prev != '\t' && prev != '\n' && prev != '\r') {
  ------------------
  |  Branch (3975:29): [True: 15.1k, False: 12.6k]
  |  Branch (3975:44): [True: 9.43k, False: 5.70k]
  |  Branch (3975:60): [True: 6.56k, False: 2.87k]
  |  Branch (3975:76): [True: 9, False: 6.55k]
  ------------------
 3976|      9|                           ctx.error = error_code::syntax_error;
 3977|      9|                           return;
 3978|      9|                        }
 3979|  27.7k|                     }
 3980|  27.7k|                  }
 3981|  27.7k|               }
 3982|  27.7k|               skip_comment(it, end);
 3983|   778k|               if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (3983:20): [True: 772k, False: 6.15k]
  |  Branch (3983:34): [True: 73.8k, False: 698k]
  |  Branch (3983:49): [True: 108k, False: 590k]
  ------------------
 3984|   182k|                  skip_newline(it, end);
 3985|   182k|               }
 3986|   596k|               else if (it != end) {
  ------------------
  |  Branch (3986:25): [True: 590k, False: 6.15k]
  ------------------
 3987|       |                  // The entry stopped part way along its line with something other than
 3988|       |                  // whitespace or a comment after it -- a ':' its value could not take as a
 3989|       |                  // separator, say. The next pass measures indent as though this were the start
 3990|       |                  // of a line, so what is left of the real one is lost; reject it instead.
 3991|   590k|                  if constexpr (requires { ctx.line_prefix_before(it); }) {
 3992|   590k|                     if (ctx.line_prefix_before(it).has_content) {
  ------------------
  |  Branch (3992:26): [True: 591, False: 589k]
  ------------------
 3993|    591|                        ctx.error = error_code::syntax_error;
 3994|    591|                        return;
 3995|    591|                     }
 3996|   590k|                  }
 3997|   590k|               }
 3998|   778k|            }
 3999|  1.46M|         }
 4000|   754k|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SB_SB_EEbSO_SP_SG_i:
 4927|  1.49M|               ctx, it, end, int32_t(-1), [&](auto& ctx, auto& it, auto end, int32_t line_indent) -> bool {
 4928|  1.49M|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|  1.49M|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 4930|  1.49M|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|  1.49M|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|  1.49M|                           if (ctx.stream_begin) {
 4938|  1.49M|                              auto is_line_content_start = [&](auto pos) {
 4939|  1.49M|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|  1.49M|                              };
 4941|       |
 4942|  1.49M|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|  1.49M|                                 const char* line = ctx.line_begin_of(pos);
 4944|  1.49M|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|  1.49M|                                 return line != end && *line == ':';
 4946|  1.49M|                              };
 4947|       |
 4948|  1.49M|                              if (!is_line_content_start(it) &&
 4949|  1.49M|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
 4950|  1.49M|                                  !line_has_explicit_value_indicator(it)) {
 4951|  1.49M|                                 ctx.error = error_code::syntax_error;
 4952|  1.49M|                                 return false;
 4953|  1.49M|                              }
 4954|  1.49M|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|  1.49M|                           }
 4956|  1.49M|                        }
 4957|       |
 4958|  1.49M|                        if (*it == '-' &&
 4959|  1.49M|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
 4960|  1.49M|                            !line_starts_with_explicit_value_indicator) {
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|  1.49M|                           ctx.error = error_code::syntax_error;
 4963|  1.49M|                           return false;
 4964|  1.49M|                        }
 4965|       |
 4966|  1.49M|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 4967|  1.49M|                           return false;
 4968|  1.49M|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|  1.49M|                        ctx.pop_indent();
 4970|  1.49M|                     }
 4971|  1.49M|                     else {
 4972|  1.49M|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|  1.49M|                        if (nested_indent >= 0) {
 4974|  1.49M|                           yaml::skip_to_content(it, end);
 4975|  1.49M|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
 4976|  1.49M|                              ctx.error = error_code::syntax_error;
 4977|  1.49M|                              return false;
 4978|  1.49M|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|  1.49M|                           const int32_t value_indent =
 4982|  1.49M|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
 4983|  1.49M|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
 4984|  1.49M|                              return false;
 4985|  1.49M|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|  1.49M|                           ctx.pop_indent();
 4987|  1.49M|                        }
 4988|  1.49M|                     }
 4989|  1.49M|                     return !bool(ctx.error);
 4990|  1.49M|                  };
 4991|       |
 4992|       |                  // Explicit key entry form:
 4993|       |                  // ? key
 4994|       |                  // : value
 4995|  1.49M|                  if (*it == '?' && ((it + 1) != end) && *(it + 1) == '\t') {
  ------------------
  |  Branch (4995:23): [True: 758k, False: 735k]
  |  Branch (4995:37): [True: 757k, False: 883]
  |  Branch (4995:58): [True: 6, False: 757k]
  ------------------
 4996|      6|                     ctx.error = error_code::syntax_error;
 4997|      6|                     return false;
 4998|      6|                  }
 4999|  1.49M|                  if (*it == '?' && ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\n' || *(it + 1) == '\r')) {
  ------------------
  |  Branch (4999:23): [True: 758k, False: 735k]
  |  Branch (4999:38): [True: 883, False: 757k]
  |  Branch (4999:57): [True: 111k, False: 646k]
  |  Branch (4999:77): [True: 155k, False: 490k]
  |  Branch (4999:98): [True: 473k, False: 16.8k]
  ------------------
 5000|   741k|                     ++it; // skip '?'
 5001|   741k|                     yaml::skip_inline_ws(it, end);
 5002|       |
 5003|   741k|                     const int32_t explicit_value_indicator_indent =
 5004|   741k|                        (ctx.current_indent() < 0) ? 0 : (ctx.current_indent() + 1);
  ------------------
  |  Branch (5004:25): [True: 629k, False: 111k]
  ------------------
 5005|       |
 5006|   741k|                     key_t key{};
 5007|   741k|                     if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5008|   741k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   741k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   741k|                        };
 5011|       |
 5012|   741k|                        auto key_it = it;
 5013|   741k|                        yaml::skip_inline_ws(key_it, end);
 5014|       |
 5015|   741k|                        auto content = key_it;
 5016|   741k|                        yaml::skip_to_content(content, end);
 5017|   741k|                        bool handled_anchor_only_empty_key = false;
 5018|       |
 5019|       |                        // Anchor on an empty explicit key node:
 5020|       |                        //   ? &a
 5021|       |                        //   : value
 5022|   741k|                        if (content != end && *content == '&') {
  ------------------
  |  Branch (5022:29): [True: 705k, False: 35.9k]
  |  Branch (5022:47): [True: 84.0k, False: 621k]
  ------------------
 5023|  84.0k|                           auto anchor_probe = content + 1;
 5024|  84.0k|                           auto anchor_name = yaml::parse_anchor_name(anchor_probe, end);
 5025|  84.0k|                           if (!anchor_name.empty()) {
  ------------------
  |  Branch (5025:32): [True: 84.0k, False: 51]
  ------------------
 5026|  84.0k|                              auto after_anchor = anchor_probe;
 5027|  84.0k|                              yaml::skip_inline_ws(after_anchor, end);
 5028|       |
 5029|  84.0k|                              auto value_indicator = after_anchor;
 5030|  84.0k|                              if (value_indicator != end && *value_indicator == ':') {
  ------------------
  |  Branch (5030:35): [True: 77.9k, False: 6.05k]
  |  Branch (5030:61): [True: 5.35k, False: 72.5k]
  ------------------
 5031|  5.35k|                                 key.clear();
 5032|  5.35k|                                 ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5033|  5.35k|                                 it = value_indicator;
 5034|  5.35k|                                 handled_anchor_only_empty_key = true;
 5035|  5.35k|                              }
 5036|  78.6k|                              else {
 5037|  78.6k|                                 if (value_indicator != end && *value_indicator == '#') {
  ------------------
  |  Branch (5037:38): [True: 72.5k, False: 6.05k]
  |  Branch (5037:64): [True: 5.85k, False: 66.7k]
  ------------------
 5038|  5.85k|                                    yaml::skip_comment(value_indicator, end);
 5039|  5.85k|                                 }
 5040|  78.6k|                                 if (value_indicator != end && (*value_indicator == '\n' || *value_indicator == '\r')) {
  ------------------
  |  Branch (5040:38): [True: 71.7k, False: 6.94k]
  |  Branch (5040:65): [True: 10.8k, False: 60.8k]
  |  Branch (5040:93): [True: 20.9k, False: 39.9k]
  ------------------
 5041|  31.7k|                                    yaml::skip_newline(value_indicator, end);
 5042|  31.7k|                                    auto value_line = value_indicator;
 5043|  31.7k|                                    int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5044|  31.7k|                                    if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5044:41): [True: 6, False: 31.7k]
  ------------------
 5045|      6|                                       return false;
 5046|  31.7k|                                    if (value_line != end && *value_line == ':' &&
  ------------------
  |  Branch (5046:41): [True: 28.8k, False: 2.91k]
  |  Branch (5046:62): [True: 4.02k, False: 24.8k]
  ------------------
 5047|  4.02k|                                        value_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (5047:41): [True: 3.99k, False: 26]
  ------------------
 5048|  3.99k|                                       key.clear();
 5049|  3.99k|                                       ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5050|  3.99k|                                       it = value_line;
 5051|  3.99k|                                       handled_anchor_only_empty_key = true;
 5052|  3.99k|                                    }
 5053|  27.7k|                                    else if (value_line != end && *value_line == ':') {
  ------------------
  |  Branch (5053:46): [True: 24.8k, False: 2.91k]
  |  Branch (5053:67): [True: 26, False: 24.8k]
  ------------------
 5054|       |                                       // In explicit-key form ("? &a"), a following ':'
 5055|       |                                       // starts the outer value indicator only at the same
 5056|       |                                       // indentation. A deeper-indented ': value' is malformed.
 5057|     26|                                       ctx.error = error_code::syntax_error;
 5058|     26|                                       return false;
 5059|     26|                                    }
 5060|  31.7k|                                 }
 5061|  78.6k|                              }
 5062|  84.0k|                           }
 5063|  84.0k|                        }
 5064|       |
 5065|   741k|                        const bool key_content_spans_lines = [&] {
 5066|   741k|                           auto scan = key_it;
 5067|   741k|                           while (scan != content && scan != end) {
 5068|   741k|                              if (*scan == '\n' || *scan == '\r') return true;
 5069|   741k|                              ++scan;
 5070|   741k|                           }
 5071|   741k|                           return false;
 5072|   741k|                        }();
 5073|       |
 5074|   741k|                        if (handled_anchor_only_empty_key) {
  ------------------
  |  Branch (5074:29): [True: 9.35k, False: 732k]
  ------------------
 5075|       |                           // 'it' already points to the explicit value indicator ':'
 5076|  9.35k|                        }
 5077|   732k|                        else if (content == end || (*content == ':' && key_content_spans_lines)) {
  ------------------
  |  Branch (5077:34): [True: 35.9k, False: 696k]
  |  Branch (5077:53): [True: 325k, False: 370k]
  |  Branch (5077:72): [True: 319k, False: 5.96k]
  ------------------
 5078|   355k|                           key.clear();
 5079|   355k|                           it = content;
 5080|   355k|                        }
 5081|   376k|                        else {
 5082|       |                           // Explicit mapping keys ('? key-node') are full YAML nodes.
 5083|       |                           // Parse the key node structurally (not via plain-key scanning)
 5084|       |                           // so inputs like '? []: x' and '? JSON: like' are interpreted
 5085|       |                           // as complex keys, not split into implicit key/value pairs.
 5086|   376k|                           auto key_node_it = content;
 5087|   376k|                           auto key_node_end = end;
 5088|   376k|                           if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 5089|       |                              // In explicit-key form, a following standalone ':'
 5090|       |                              // line (same or lower indentation) belongs to the
 5091|       |                              // outer mapping value, not the key node itself.
 5092|   376k|                              auto scan = content;
 5093|  2.02M|                              while (scan != end) {
  ------------------
  |  Branch (5093:38): [True: 1.98M, False: 39.8k]
  ------------------
 5094|   171M|                                 while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (5094:41): [True: 170M, False: 213k]
  |  Branch (5094:56): [True: 169M, False: 863k]
  |  Branch (5094:73): [True: 169M, False: 904k]
  ------------------
 5095|   169M|                                    ++scan;
 5096|   169M|                                 }
 5097|  1.98M|                                 if (scan == end) {
  ------------------
  |  Branch (5097:38): [True: 213k, False: 1.76M]
  ------------------
 5098|   213k|                                    break;
 5099|   213k|                                 }
 5100|       |
 5101|  1.76M|                                 yaml::skip_newline(scan, end);
 5102|  1.76M|                                 auto line_start = scan;
 5103|       |
 5104|  1.76M|                                 int32_t indicator_indent = 0;
 5105|  4.25M|                                 while (scan != end && *scan == ' ') {
  ------------------
  |  Branch (5105:41): [True: 4.21M, False: 39.8k]
  |  Branch (5105:56): [True: 2.49M, False: 1.72M]
  ------------------
 5106|  2.49M|                                    ++indicator_indent;
 5107|  2.49M|                                    ++scan;
 5108|  2.49M|                                 }
 5109|       |
 5110|  1.76M|                                 if (scan != end && *scan == ':') {
  ------------------
  |  Branch (5110:38): [True: 1.72M, False: 39.8k]
  |  Branch (5110:53): [True: 214k, False: 1.51M]
  ------------------
 5111|   214k|                                    const auto after_colon = scan + 1;
 5112|   214k|                                    if ((after_colon == end ||
  ------------------
  |  Branch (5112:42): [True: 2.84k, False: 212k]
  ------------------
 5113|   212k|                                         yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
  ------------------
  |  Branch (5113:42): [True: 165k, False: 46.4k]
  ------------------
 5114|   168k|                                        indicator_indent <= line_indent) {
  ------------------
  |  Branch (5114:41): [True: 123k, False: 45.0k]
  ------------------
 5115|   123k|                                       key_node_end = line_start;
 5116|   123k|                                       break;
 5117|   123k|                                    }
 5118|   214k|                                 }
 5119|  1.76M|                              }
 5120|   376k|                           }
 5121|       |
 5122|   376k|                           glz::generic key_node{};
 5123|   376k|                           const bool prev_explicit_mapping_key_context = ctx.explicit_mapping_key_context;
 5124|   376k|                           ctx.explicit_mapping_key_context = true;
 5125|   376k|                           from<YAML, glz::generic>::template op<Opts>(key_node, ctx, key_node_it, key_node_end);
 5126|   376k|                           ctx.explicit_mapping_key_context = prev_explicit_mapping_key_context;
 5127|   376k|                           if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5127:32): [True: 4.20k, False: 372k]
  ------------------
 5128|  4.20k|                              return false;
 5129|   372k|                           it = key_node_it;
 5130|   372k|                           if (!to_string_key(key_node)) [[unlikely]]
  ------------------
  |  Branch (5130:32): [True: 18, False: 372k]
  ------------------
 5131|     18|                              return false;
 5132|   372k|                        }
 5133|       |                     }
 5134|       |                     else {
 5135|       |                        if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 5136|       |                           from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5137|       |                           if (bool(ctx.error)) [[unlikely]]
 5138|       |                              return false;
 5139|       |                        }
 5140|       |                     }
 5141|       |
 5142|   737k|                     yaml::skip_inline_ws(it, end);
 5143|   741k|                     yaml::skip_comment(it, end);
 5144|       |
 5145|       |                     // Value indicator may appear on the next line at the same indent.
 5146|   741k|                     if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (5146:26): [True: 635k, False: 106k]
  |  Branch (5146:40): [True: 35.4k, False: 599k]
  |  Branch (5146:55): [True: 72.3k, False: 527k]
  ------------------
 5147|   107k|                        auto probe = it;
 5148|   107k|                        bool found_value_indicator = false;
 5149|       |
 5150|   138k|                        while (probe != end && (*probe == '\n' || *probe == '\r')) {
  ------------------
  |  Branch (5150:32): [True: 127k, False: 10.7k]
  |  Branch (5150:49): [True: 42.9k, False: 84.3k]
  |  Branch (5150:67): [True: 84.3k, False: 35]
  ------------------
 5151|   127k|                           yaml::skip_newline(probe, end);
 5152|       |
 5153|   127k|                           auto value_line = probe;
 5154|   127k|                           int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5155|   127k|                           if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5155:32): [True: 15, False: 127k]
  ------------------
 5156|     15|                              return false;
 5157|       |
 5158|   127k|                           if (value_line == end || *value_line == '\n' || *value_line == '\r') {
  ------------------
  |  Branch (5158:32): [True: 9.33k, False: 117k]
  |  Branch (5158:53): [True: 3.31k, False: 114k]
  |  Branch (5158:76): [True: 7.56k, False: 107k]
  ------------------
 5159|  20.2k|                              probe = value_line;
 5160|  20.2k|                              continue; // blank line
 5161|  20.2k|                           }
 5162|   107k|                           if (*value_line == '#') {
  ------------------
  |  Branch (5162:32): [True: 10.0k, False: 97.0k]
  ------------------
 5163|  10.0k|                              yaml::skip_comment(value_line, end);
 5164|  10.0k|                              probe = value_line;
 5165|  10.0k|                              continue; // comment-only line
 5166|  10.0k|                           }
 5167|  97.0k|                           if (*value_line == ':' && value_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (5167:32): [True: 57.8k, False: 39.1k]
  |  Branch (5167:54): [True: 36.1k, False: 21.6k]
  ------------------
 5168|  36.1k|                              it = value_line;
 5169|  36.1k|                              found_value_indicator = true;
 5170|  36.1k|                           }
 5171|  97.0k|                           break;
 5172|   107k|                        }
 5173|       |
 5174|   107k|                        if (found_value_indicator) {
  ------------------
  |  Branch (5174:29): [True: 36.1k, False: 71.5k]
  ------------------
 5175|  36.1k|                           yaml::skip_inline_ws(it, end);
 5176|  36.1k|                        }
 5177|   107k|                     }
 5178|       |
 5179|   741k|                     val_t val{};
 5180|   741k|                     if (it != end && *it == ':') {
  ------------------
  |  Branch (5180:26): [True: 635k, False: 106k]
  |  Branch (5180:39): [True: 464k, False: 171k]
  ------------------
 5181|   464k|                        ++it;
 5182|   464k|                        if (it != end && *it == '\t') {
  ------------------
  |  Branch (5182:29): [True: 462k, False: 1.47k]
  |  Branch (5182:42): [True: 6, False: 462k]
  ------------------
 5183|      6|                           ctx.error = error_code::syntax_error;
 5184|      6|                           return false;
 5185|      6|                        }
 5186|   463k|                        if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (5186:29): [True: 462k, False: 1.47k]
  |  Branch (5186:43): [True: 7.76k, False: 454k]
  |  Branch (5186:58): [True: 356k, False: 98.0k]
  ------------------
 5187|   364k|                           auto probe = it;
 5188|   364k|                           yaml::skip_newline(probe, end);
 5189|   505k|                           while (probe != end && *probe == ' ') ++probe;
  ------------------
  |  Branch (5189:35): [True: 499k, False: 5.62k]
  |  Branch (5189:51): [True: 140k, False: 358k]
  ------------------
 5190|   364k|                           if (probe != end && *probe == ':' && ((probe + 1) != end) && *(probe + 1) == '\t') {
  ------------------
  |  Branch (5190:32): [True: 358k, False: 5.62k]
  |  Branch (5190:48): [True: 110k, False: 248k]
  |  Branch (5190:65): [True: 108k, False: 1.66k]
  |  Branch (5190:89): [True: 4, False: 108k]
  ------------------
 5191|      4|                              ctx.error = error_code::syntax_error;
 5192|      4|                              return false;
 5193|      4|                           }
 5194|   364k|                        }
 5195|   463k|                        yaml::skip_inline_ws(it, end);
 5196|   463k|                        if (!parse_map_value(val)) [[unlikely]]
  ------------------
  |  Branch (5196:29): [True: 902, False: 463k]
  ------------------
 5197|    902|                           return false;
 5198|   463k|                     }
 5199|       |
 5200|   740k|                     value.emplace(std::move(key), std::move(val));
 5201|   740k|                     return true;
 5202|   741k|                  }
 5203|       |
 5204|   752k|                  key_t key{};
 5205|   752k|                  if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5206|   752k|                     auto key_probe = it;
 5207|   752k|                     yaml::skip_inline_ws(key_probe, end);
 5208|   752k|                     const bool complex_flow_key = (key_probe != end && (*key_probe == '[' || *key_probe == '{'));
  ------------------
  |  Branch (5208:53): [True: 752k, False: 0]
  |  Branch (5208:74): [True: 4.35k, False: 748k]
  |  Branch (5208:95): [True: 1.53k, False: 746k]
  ------------------
 5209|   752k|                     if (complex_flow_key) {
  ------------------
  |  Branch (5209:26): [True: 5.88k, False: 746k]
  ------------------
 5210|  5.88k|                        glz::generic key_node{};
 5211|  5.88k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 5212|  5.88k|                        if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5212:29): [True: 2.13k, False: 3.75k]
  ------------------
 5213|  2.13k|                           return false;
 5214|  3.75k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (5214:29): [True: 4, False: 3.75k]
  ------------------
 5215|      4|                           return false;
 5216|  3.75k|                     }
 5217|   746k|                     else {
 5218|   746k|                        if (!yaml::parse_yaml_key(key, ctx, it, end, false)) {
  ------------------
  |  Branch (5218:29): [True: 1.85k, False: 744k]
  ------------------
 5219|  1.85k|                           return false;
 5220|  1.85k|                        }
 5221|   746k|                     }
 5222|       |                  }
 5223|       |                  else {
 5224|       |                     from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5225|       |                     if (bool(ctx.error)) [[unlikely]]
 5226|       |                        return false;
 5227|       |                  }
 5228|       |
 5229|   748k|                  yaml::skip_inline_ws(it, end);
 5230|       |
 5231|   752k|                  if (it == end || *it != ':') {
  ------------------
  |  Branch (5231:23): [True: 4.19k, False: 748k]
  |  Branch (5231:36): [True: 559, False: 747k]
  ------------------
 5232|    759|                     ctx.error = error_code::syntax_error;
 5233|    759|                     return false;
 5234|    759|                  }
 5235|   751k|                  ++it;
 5236|   751k|                  yaml::skip_inline_ws(it, end);
 5237|       |
 5238|   751k|                  val_t val{};
 5239|   751k|                  if (!parse_map_value(val)) [[unlikely]]
  ------------------
  |  Branch (5239:23): [True: 23.6k, False: 728k]
  ------------------
 5240|  23.6k|                     return false;
 5241|       |
 5242|   728k|                  value.emplace(std::move(key), std::move(val));
 5243|   728k|                  return true;
 5244|   751k|               });
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SB_SB_EEbSO_SP_SG_iENKUlvE_clEv:
 5065|   741k|                        const bool key_content_spans_lines = [&] {
 5066|   741k|                           auto scan = key_it;
 5067|   777k|                           while (scan != content && scan != end) {
  ------------------
  |  Branch (5067:35): [True: 676k, False: 101k]
  |  Branch (5067:54): [True: 676k, False: 0]
  ------------------
 5068|   676k|                              if (*scan == '\n' || *scan == '\r') return true;
  ------------------
  |  Branch (5068:35): [True: 161k, False: 515k]
  |  Branch (5068:52): [True: 479k, False: 36.2k]
  ------------------
 5069|  36.2k|                              ++scan;
 5070|  36.2k|                           }
 5071|   101k|                           return false;
 5072|   741k|                        }();
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SB_SB_EEbSO_SP_SG_iENKUlRS4_E0_clESS_:
 5008|   372k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   372k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   372k|                        };
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SB_SB_EEbSO_SP_SG_iENKUlRS4_E_clESS_:
 4928|  1.21M|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|  1.21M|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (4929:26): [True: 1.19M, False: 14.7k]
  |  Branch (4929:39): [True: 548k, False: 648k]
  ------------------
 4930|   548k|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|   548k|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|   548k|                           if (ctx.stream_begin) {
  ------------------
  |  Branch (4937:32): [True: 548k, False: 0]
  ------------------
 4938|   548k|                              auto is_line_content_start = [&](auto pos) {
 4939|   548k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   548k|                              };
 4941|       |
 4942|   548k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   548k|                                 const char* line = ctx.line_begin_of(pos);
 4944|   548k|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|   548k|                                 return line != end && *line == ':';
 4946|   548k|                              };
 4947|       |
 4948|   548k|                              if (!is_line_content_start(it) &&
  ------------------
  |  Branch (4948:35): [True: 548k, False: 0]
  ------------------
 4949|   548k|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
  ------------------
  |  Branch (4949:35): [True: 55.3k, False: 492k]
  ------------------
 4950|  55.3k|                                  !line_has_explicit_value_indicator(it)) {
  ------------------
  |  Branch (4950:35): [True: 690, False: 54.6k]
  ------------------
 4951|    690|                                 ctx.error = error_code::syntax_error;
 4952|    690|                                 return false;
 4953|    690|                              }
 4954|   547k|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|   547k|                           }
 4956|   548k|                        }
 4957|       |
 4958|   548k|                        if (*it == '-' &&
  ------------------
  |  Branch (4958:29): [True: 14.0k, False: 534k]
  ------------------
 4959|  14.0k|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
  ------------------
  |  Branch (4959:30): [True: 896, False: 13.1k]
  |  Branch (4959:49): [True: 7.18k, False: 6.01k]
  ------------------
 4960|  8.07k|                            !line_starts_with_explicit_value_indicator) {
  ------------------
  |  Branch (4960:29): [True: 24, False: 8.05k]
  ------------------
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|     24|                           ctx.error = error_code::syntax_error;
 4963|     24|                           return false;
 4964|     24|                        }
 4965|       |
 4966|   548k|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
  ------------------
  |  Branch (4966:29): [True: 0, False: 548k]
  ------------------
 4967|      0|                           return false;
 4968|   548k|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|   548k|                        ctx.pop_indent();
 4970|   548k|                     }
 4971|   663k|                     else {
 4972|   663k|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|   663k|                        if (nested_indent >= 0) {
  ------------------
  |  Branch (4973:29): [True: 79.2k, False: 584k]
  ------------------
 4974|  79.2k|                           yaml::skip_to_content(it, end);
 4975|  79.2k|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
  ------------------
  |  Branch (4975:32): [True: 79.2k, False: 0]
  |  Branch (4975:45): [True: 0, False: 79.2k]
  |  Branch (4975:59): [True: 0, False: 0]
  |  Branch (4975:78): [True: 0, False: 0]
  ------------------
 4976|      0|                              ctx.error = error_code::syntax_error;
 4977|      0|                              return false;
 4978|      0|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|  79.2k|                           const int32_t value_indent =
 4982|  79.2k|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
  ------------------
  |  Branch (4982:31): [Folded, False: 79.2k]
  ------------------
 4983|  79.2k|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
  ------------------
  |  Branch (4983:32): [True: 0, False: 79.2k]
  ------------------
 4984|      0|                              return false;
 4985|  79.2k|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|  79.2k|                           ctx.pop_indent();
 4987|  79.2k|                        }
 4988|   663k|                     }
 4989|  1.21M|                     return !bool(ctx.error);
 4990|  1.21M|                  };
_ZZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SB_SB_EEbSO_SP_SG_iENKUlRS4_E_clESS_ENKUlSN_E_clISB_EEDaSN_:
 4938|   548k|                              auto is_line_content_start = [&](auto pos) {
 4939|   548k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   548k|                              };
_ZZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SB_SB_EEbSO_SP_SG_iENKUlRS4_E_clESS_ENKUlSN_E0_clISB_EEDaSN_:
 4942|   602k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   602k|                                 const char* line = ctx.line_begin_of(pos);
 4944|  1.37M|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
  ------------------
  |  Branch (4944:41): [True: 1.37M, False: 0]
  |  Branch (4944:57): [True: 774k, False: 604k]
  |  Branch (4944:73): [True: 1.74k, False: 602k]
  ------------------
 4945|   602k|                                 return line != end && *line == ':';
  ------------------
  |  Branch (4945:41): [True: 602k, False: 0]
  |  Branch (4945:56): [True: 355k, False: 247k]
  ------------------
 4946|   602k|                              };
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_EN19merge_restore_guardD2Ev:
 4696|  1.91M|            {
 4697|       |               // emplace is a no-op for keys the document already wrote, so only
 4698|       |               // untouched pre-existing entries are put back.
 4699|  1.91M|               for (auto& entry : saved) {
  ------------------
  |  Branch (4699:33): [True: 0, False: 1.91M]
  ------------------
 4700|      0|                  target.emplace(entry.first, std::move(entry.second));
 4701|      0|               }
 4702|  1.91M|            }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_21is_yaml_variant_arrayEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERSH_TkNS_10is_contextERNSL_12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   352k|      {
 5356|   352k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   352k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   352k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   352k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   352k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 352k, False: 0]
  ------------------
 5366|   352k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   352k|      }
_ZN3glz4fromILj450ENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS1_9allocatorIS6_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRS9_TkNS_10is_contextERNSC_12yaml_contextESF_EEvOT1_OT2_OT0_T3_:
 4207|   367k|      {
 4208|   367k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4208:14): [True: 0, False: 367k]
  ------------------
 4209|      0|            return;
 4210|       |
 4211|       |         // Peek ahead to check for tag (don't consume indentation for block sequences)
 4212|   367k|         auto peek = it;
 4213|   367k|         yaml::node_preamble_state preamble{};
 4214|   367k|         if (yaml::parse_node_preamble<Opts>(value, ctx, peek, end, preamble,
  ------------------
  |  Branch (4214:14): [True: 20.2k, False: 346k]
  ------------------
 4215|   367k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_seq(tag); })) {
 4216|  20.2k|            it = peek;
 4217|  20.2k|            return;
 4218|  20.2k|         }
 4219|       |
 4220|       |         // A level of nesting, taken past the preamble as for sets above.
 4221|   346k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 4222|   346k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (4222:14): [True: 19, False: 346k]
  ------------------
 4223|     19|            return;
 4224|       |
 4225|   346k|         if (*peek == '[') {
  ------------------
  |  Branch (4225:14): [True: 143k, False: 203k]
  ------------------
 4226|       |            // Flow sequence - consume whitespace and parse
 4227|   143k|            it = peek;
 4228|   143k|            yaml::parse_flow_sequence<Opts>(value, ctx, it, end);
 4229|   143k|         }
 4230|   203k|         else if (*peek == '-') {
  ------------------
  |  Branch (4230:19): [True: 203k, False: 291]
  ------------------
 4231|       |            // Block sequence - don't consume leading whitespace, let parse_block_sequence handle it
 4232|       |            // But if there was a tag, we need to advance past it
 4233|   203k|            if (preamble.tag != yaml::yaml_tag::none || preamble.node_props.has_anchor) {
  ------------------
  |  Branch (4233:17): [True: 988, False: 202k]
  |  Branch (4233:57): [True: 3.76k, False: 198k]
  ------------------
 4234|  4.75k|               it = peek;
 4235|  4.75k|            }
 4236|   203k|            int32_t seq_indent = ctx.current_indent();
 4237|   203k|            if (*it == '-' && ctx.current_indent() >= 0) {
  ------------------
  |  Branch (4237:17): [True: 201k, False: 1.76k]
  |  Branch (4237:31): [True: 102k, False: 99.3k]
  ------------------
 4238|   102k|               seq_indent = ctx.allow_indentless_sequence ? (ctx.current_indent() > 0 ? (ctx.current_indent() - 1) : 0)
  ------------------
  |  Branch (4238:29): [True: 19.4k, False: 82.7k]
  |  Branch (4238:62): [True: 16.0k, False: 3.32k]
  ------------------
 4239|   102k|                                                          : (ctx.current_indent() + 1);
 4240|   102k|            }
 4241|   203k|            yaml::parse_block_sequence<Opts>(value, ctx, it, end, seq_indent);
 4242|   203k|         }
 4243|    291|         else {
 4244|    291|            ctx.error = error_code::syntax_error;
 4245|    291|         }
 4246|       |
 4247|   346k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 4248|   346k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEELb0ERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS4_9allocatorIS9_EEEENS0_12yaml_contextEPKcSG_ZNS_4fromILj450ESC_E2opITnDaXtlS2_Lj450ELb1ELb0ELb1ELh2ELb0ELj1EEERSG_SD_TkNS_10is_contextERSE_SG_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSP_RSS_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   367k|      {
  475|   367k|         skip_inline_ws(it, end);
  476|       |
  477|   367k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 18, False: 367k]
  ------------------
  478|     18|            if constexpr (!AllowEmptyInput) {
  479|     18|               ctx.error = error_code::unexpected_end;
  480|     18|            }
  481|     18|            return true;
  482|     18|         }
  483|       |
  484|   367k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   367k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 6, False: 367k]
  ------------------
  486|      6|            ctx.error = error_code::syntax_error;
  487|      6|            return true;
  488|      6|         }
  489|   367k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 6, False: 367k]
  ------------------
  490|      6|            ctx.error = error_code::syntax_error;
  491|      6|            return true;
  492|      6|         }
  493|       |
  494|   367k|         skip_inline_ws(it, end);
  495|       |
  496|   367k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 15, False: 367k]
  ------------------
  497|     15|            if constexpr (!AllowEmptyInput) {
  498|     15|               ctx.error = error_code::unexpected_end;
  499|     15|            }
  500|     15|            return true;
  501|     15|         }
  502|       |
  503|   367k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 20.2k, False: 346k]
  ------------------
  504|  20.2k|            return true;
  505|  20.2k|         }
  506|       |
  507|   346k|         return false;
  508|   367k|      }
_ZZN3glz4fromILj450ENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS1_9allocatorIS6_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRS9_TkNS_10is_contextERNSC_12yaml_contextESF_EEvOT1_OT2_OT0_T3_ENKUlNSC_8yaml_tagEE_clESR_:
 4215|   367k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_seq(tag); })) {
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEEXtlNS0_20node_property_policyELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS4_9allocatorIS9_EEEENS0_12yaml_contextEPKcSG_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   367k|      {
  418|   367k|         state.has_anchor = false;
  419|   367k|         state.anchor_name.clear();
  420|   367k|         state.anchor_start = nullptr;
  421|   367k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   367k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|   367k|            else {
  430|   367k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 20.1k, False: 346k]
  ------------------
  431|   367k|            }
  432|   367k|         }
  433|       |
  434|   367k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 346k, False: 20.1k]
  |  Branch (434:27): [True: 7.56k, False: 339k]
  ------------------
  435|  7.56k|            ++it;
  436|  7.56k|            auto name = parse_anchor_name(it, end);
  437|  7.56k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 17, False: 7.54k]
  ------------------
  438|     17|               ctx.error = error_code::syntax_error;
  439|     17|               return true;
  440|     17|            }
  441|  7.54k|            skip_inline_ws(it, end);
  442|  7.54k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 47, False: 7.50k]
  ------------------
  443|     47|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     47|                  ctx.error = error_code::unexpected_end;
  445|     47|               }
  446|     47|               return true;
  447|     47|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  7.50k|            state.has_anchor = true;
  455|  7.50k|            state.anchor_name = std::string(name);
  456|  7.50k|            state.anchor_start = &*it;
  457|  7.50k|         }
  458|       |
  459|   367k|         return false;
  460|   367k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEbOT0_RT1_RT2_T3_:
  309|   367k|      {
  310|   367k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 367k]
  |  Branch (310:27): [True: 346k, False: 20.1k]
  ------------------
  311|       |
  312|  20.1k|         ++it; // skip '*'
  313|  20.1k|         auto name = parse_anchor_name(it, end);
  314|  20.1k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 34, False: 20.1k]
  ------------------
  315|     34|            ctx.error = error_code::syntax_error;
  316|     34|            return true;
  317|     34|         }
  318|       |
  319|  20.1k|         auto anchor_it = ctx.anchors.find(name);
  320|  20.1k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 69, False: 20.0k]
  ------------------
  321|     69|            ctx.error = error_code::syntax_error; // undefined alias
  322|     69|            return true;
  323|     69|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  20.0k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  20.0k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 5.27k, False: 14.7k]
  ------------------
  331|  5.27k|            return true;
  332|  5.27k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  14.7k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 15, False: 14.7k]
  ------------------
  338|     15|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     15|            return true;
  340|     15|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  14.7k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  14.7k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 4, False: 14.7k]
  ------------------
  348|      4|            return true;
  349|       |
  350|  14.7k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 18, False: 14.7k]
  ------------------
  351|     18|            ctx.error = error_code::exceeded_max_expansion;
  352|     18|            ctx.custom_error_message = "alias expansion";
  353|     18|            return true;
  354|     18|         }
  355|       |
  356|  14.7k|         auto replay_it = span.begin;
  357|  14.7k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  14.7k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  14.7k|         ctx.indent_stack.clear();
  362|  14.7k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 4.68k, False: 10.0k]
  ------------------
  363|  4.68k|            ctx.push_indent(span.base_indent - 1);
  364|  4.68k|         }
  365|       |
  366|  14.7k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  14.7k|         using V = std::remove_cvref_t<T>;
  369|  14.7k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  14.7k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  14.7k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  14.7k|         return true;
  376|  14.7k|      }
_ZN3glz4yaml19parse_flow_sequenceITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_:
 2698|   143k|      {
 2699|   143k|         using V = std::remove_cvref_t<T>;
 2700|   143k|         using value_type = typename V::value_type;
 2701|       |
 2702|   143k|         struct sequence_container_adapter
 2703|   143k|         {
 2704|   143k|            size_t index = 0;
 2705|       |
 2706|   143k|            inline bool fixed_capacity_reached(const V& container) const noexcept
 2707|   143k|            {
 2708|   143k|               if constexpr (!resizable<V>) {
 2709|   143k|                  return index >= container.size();
 2710|   143k|               }
 2711|   143k|               else {
 2712|   143k|                  (void)container;
 2713|   143k|                  return false;
 2714|   143k|               }
 2715|   143k|            }
 2716|       |
 2717|   143k|            inline void commit_fixed_slot() noexcept { ++index; }
 2718|       |
 2719|   143k|            inline void append(V& container, value_type&& element) noexcept
 2720|   143k|            {
 2721|   143k|               if constexpr (emplace_backable<V>) {
 2722|   143k|                  container.emplace_back(std::move(element));
 2723|   143k|               }
 2724|   143k|               else if constexpr (emplaceable<V>) {
 2725|   143k|                  container.emplace(std::move(element));
 2726|   143k|               }
 2727|   143k|            }
 2728|   143k|         };
 2729|       |
 2730|   143k|         if (it == end || *it != '[') [[unlikely]] {
  ------------------
  |  Branch (2730:14): [True: 0, False: 143k]
  |  Branch (2730:27): [True: 0, False: 143k]
  ------------------
 2731|      0|            ctx.error = error_code::syntax_error;
 2732|      0|            return;
 2733|      0|         }
 2734|       |
 2735|       |         // Overwrite (do not append to) any pre-existing contents. Must happen
 2736|       |         // before the empty-array early return below so that `[]` also clears.
 2737|   143k|         clear_sequence_before_read<Opts>(value);
 2738|       |
 2739|   143k|         ++it; // Skip '['
 2740|       |         // Skip whitespace and newlines after opening bracket (YAML allows multi-line flow sequences)
 2741|   143k|         skip_flow_ws_and_newlines(ctx, it, end);
 2742|   143k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2742:14): [True: 47, False: 143k]
  ------------------
 2743|     47|            return;
 2744|       |
 2745|       |         // Handle empty array
 2746|   143k|         if (it != end && *it == ']') {
  ------------------
  |  Branch (2746:14): [True: 141k, False: 2.06k]
  |  Branch (2746:27): [True: 33.4k, False: 107k]
  ------------------
 2747|  33.4k|            ++it;
 2748|  33.4k|            validate_flow_node_adjacent_tail(ctx, it, end);
 2749|  33.4k|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2749:17): [True: 92, False: 33.3k]
  ------------------
 2750|     92|               return;
 2751|       |            if constexpr (!yaml::check_flow_context(Opts)) {
 2752|       |               if (ctx.current_indent() < 0) {
 2753|       |                  validate_root_flow_tail_after_close(ctx, it, end);
 2754|       |               }
 2755|       |            }
 2756|  33.3k|            return;
 2757|  33.4k|         }
 2758|       |
 2759|   109k|         bool just_saw_comma = false;
 2760|   109k|         sequence_container_adapter adapter{};
 2761|       |
 2762|   109k|         if constexpr (emplace_backable<V> || emplaceable<V>) {
 2763|       |            // Dynamic containers append items (vector-like and set-like)
 2764|   184k|            while (it != end) {
  ------------------
  |  Branch (2764:20): [True: 182k, False: 2.31k]
  ------------------
 2765|   182k|               skip_flow_ws_and_newlines(ctx, it, end);
 2766|   182k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2766:20): [True: 0, False: 182k]
  ------------------
 2767|      0|                  return;
 2768|       |
 2769|   182k|               if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2769:20): [True: 0, False: 182k]
  ------------------
 2770|      0|                  ctx.error = error_code::unexpected_end;
 2771|      0|                  return;
 2772|      0|               }
 2773|       |
 2774|   182k|               if (*it == ']') {
  ------------------
  |  Branch (2774:20): [True: 22.3k, False: 159k]
  ------------------
 2775|  22.3k|                  if (just_saw_comma) {
  ------------------
  |  Branch (2775:23): [True: 22.3k, False: 0]
  ------------------
 2776|  22.3k|                     ++it;
 2777|  22.3k|                     validate_flow_node_adjacent_tail(ctx, it, end);
 2778|  22.3k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2778:26): [True: 14, False: 22.3k]
  ------------------
 2779|     14|                        return;
 2780|       |                     if constexpr (!yaml::check_flow_context(Opts)) {
 2781|       |                        if (ctx.current_indent() < 0) {
 2782|       |                           validate_root_flow_tail_after_close(ctx, it, end);
 2783|       |                        }
 2784|       |                     }
 2785|  22.3k|                     return;
 2786|  22.3k|                  }
 2787|      0|                  ctx.error = error_code::syntax_error;
 2788|      0|                  return;
 2789|  22.3k|               }
 2790|       |
 2791|   159k|               if (*it == ',' || *it == '#') {
  ------------------
  |  Branch (2791:20): [True: 80, False: 159k]
  |  Branch (2791:34): [True: 48, False: 159k]
  ------------------
 2792|    128|                  ctx.error = error_code::syntax_error;
 2793|    128|                  return;
 2794|    128|               }
 2795|   159k|               just_saw_comma = false;
 2796|       |
 2797|   159k|               value_type element{};
 2798|   159k|               from<YAML, value_type>::template op<flow_context_on<Opts>()>(element, ctx, it, end);
 2799|       |
 2800|   159k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2800:20): [True: 21.5k, False: 137k]
  ------------------
 2801|  21.5k|                  return;
 2802|       |
 2803|   137k|               bool saw_line_break_before_separator = false;
 2804|   137k|               skip_flow_ws_and_newlines(ctx, it, end, &saw_line_break_before_separator);
 2805|   137k|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2805:20): [True: 32, False: 137k]
  ------------------
 2806|     32|                  return;
 2807|       |
 2808|   137k|               if (it != end && *it == ':') {
  ------------------
  |  Branch (2808:20): [True: 137k, False: 912]
  |  Branch (2808:33): [True: 23.6k, False: 113k]
  ------------------
 2809|       |                  // In flow sequences, implicit key-value pairs must be on a single line.
 2810|  23.6k|                  if (saw_line_break_before_separator) {
  ------------------
  |  Branch (2810:23): [True: 48, False: 23.5k]
  ------------------
 2811|     48|                     ctx.error = error_code::syntax_error;
 2812|     48|                     return;
 2813|     48|                  }
 2814|  23.5k|                  if constexpr (std::same_as<std::remove_cvref_t<value_type>, glz::generic>) {
 2815|  23.5k|                     glz::generic key_node = std::move(element);
 2816|  23.5k|                     ++it;
 2817|  23.5k|                     skip_inline_ws(it, end);
 2818|       |
 2819|  23.5k|                     glz::generic mapped{};
 2820|  23.5k|                     from<YAML, glz::generic>::template op<flow_context_on<Opts>()>(mapped, ctx, it, end);
 2821|  23.5k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2821:26): [True: 1.48k, False: 22.0k]
  ------------------
 2822|  1.48k|                        return;
 2823|       |
 2824|  22.0k|                     std::string key;
 2825|  22.0k|                     if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (2825:26): [True: 4, False: 22.0k]
  ------------------
 2826|      4|                        return;
 2827|       |
 2828|  22.0k|                     glz::generic pair{};
 2829|  22.0k|                     pair[key] = std::move(mapped);
 2830|  22.0k|                     element = std::move(pair);
 2831|       |
 2832|  22.0k|                     skip_flow_ws_and_newlines(ctx, it, end);
 2833|  22.0k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2833:26): [True: 0, False: 22.0k]
  ------------------
 2834|      0|                        return;
 2835|       |                  }
 2836|       |                  else {
 2837|       |                     ctx.error = error_code::syntax_error;
 2838|       |                     return;
 2839|       |                  }
 2840|  23.5k|               }
 2841|       |
 2842|   137k|               adapter.append(value, std::move(element));
 2843|       |
 2844|   137k|               if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2844:20): [True: 953, False: 136k]
  ------------------
 2845|    953|                  ctx.error = error_code::unexpected_end;
 2846|    953|                  return;
 2847|    953|               }
 2848|       |
 2849|   136k|               if (*it == ']') {
  ------------------
  |  Branch (2849:20): [True: 59.4k, False: 77.4k]
  ------------------
 2850|  59.4k|                  ++it;
 2851|  59.4k|                  validate_flow_node_adjacent_tail(ctx, it, end);
 2852|  59.4k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2852:23): [True: 76, False: 59.4k]
  ------------------
 2853|     76|                     return;
 2854|       |                  if constexpr (!yaml::check_flow_context(Opts)) {
 2855|       |                     if (ctx.current_indent() < 0) {
 2856|       |                        validate_root_flow_tail_after_close(ctx, it, end);
 2857|       |                     }
 2858|       |                  }
 2859|  59.4k|                  return;
 2860|  59.4k|               }
 2861|  77.4k|               else if (*it == ',') {
  ------------------
  |  Branch (2861:25): [True: 74.6k, False: 2.84k]
  ------------------
 2862|  74.6k|                  ++it;
 2863|  74.6k|                  just_saw_comma = true;
 2864|  74.6k|                  skip_flow_ws_and_newlines(ctx, it, end);
 2865|  74.6k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2865:23): [True: 15, False: 74.5k]
  ------------------
 2866|     15|                     return;
 2867|  74.6k|               }
 2868|  2.84k|               else {
 2869|  2.84k|                  ctx.error = error_code::syntax_error;
 2870|  2.84k|                  return;
 2871|  2.84k|               }
 2872|   136k|            }
 2873|       |         }
 2874|       |         else if constexpr (!resizable<V>) {
 2875|       |            // Fixed-size containers (std::array)
 2876|       |            while (it != end) {
 2877|       |               skip_flow_ws_and_newlines(ctx, it, end);
 2878|       |               if (bool(ctx.error)) [[unlikely]]
 2879|       |                  return;
 2880|       |
 2881|       |               if (it == end) [[unlikely]] {
 2882|       |                  ctx.error = error_code::unexpected_end;
 2883|       |                  return;
 2884|       |               }
 2885|       |
 2886|       |               if (*it == ']') {
 2887|       |                  if (just_saw_comma) {
 2888|       |                     ++it;
 2889|       |                     validate_flow_node_adjacent_tail(ctx, it, end);
 2890|       |                     if (bool(ctx.error)) [[unlikely]]
 2891|       |                        return;
 2892|       |                     if constexpr (!yaml::check_flow_context(Opts)) {
 2893|       |                        if (ctx.current_indent() < 0) {
 2894|       |                           validate_root_flow_tail_after_close(ctx, it, end);
 2895|       |                        }
 2896|       |                     }
 2897|       |                     return;
 2898|       |                  }
 2899|       |                  ctx.error = error_code::syntax_error;
 2900|       |                  return;
 2901|       |               }
 2902|       |
 2903|       |               if (*it == ',' || *it == '#') {
 2904|       |                  ctx.error = error_code::syntax_error;
 2905|       |                  return;
 2906|       |               }
 2907|       |               just_saw_comma = false;
 2908|       |
 2909|       |               // An item beyond the last slot is an error, as in JSON.
 2910|       |               if (adapter.fixed_capacity_reached(value)) [[unlikely]] {
 2911|       |                  ctx.error = error_code::exceeded_static_array_size;
 2912|       |                  return;
 2913|       |               }
 2914|       |
 2915|       |               from<YAML, value_type>::template op<flow_context_on<Opts>()>(value[adapter.index], ctx, it, end);
 2916|       |
 2917|       |               if (bool(ctx.error)) [[unlikely]]
 2918|       |                  return;
 2919|       |
 2920|       |               adapter.commit_fixed_slot();
 2921|       |               skip_flow_ws_and_newlines(ctx, it, end);
 2922|       |               if (bool(ctx.error)) [[unlikely]]
 2923|       |                  return;
 2924|       |
 2925|       |               if (it == end) [[unlikely]] {
 2926|       |                  ctx.error = error_code::unexpected_end;
 2927|       |                  return;
 2928|       |               }
 2929|       |
 2930|       |               if (*it == ']') {
 2931|       |                  ++it;
 2932|       |                  validate_flow_node_adjacent_tail(ctx, it, end);
 2933|       |                  if (bool(ctx.error)) [[unlikely]]
 2934|       |                     return;
 2935|       |                  if constexpr (!yaml::check_flow_context(Opts)) {
 2936|       |                     if (ctx.current_indent() < 0) {
 2937|       |                        validate_root_flow_tail_after_close(ctx, it, end);
 2938|       |                     }
 2939|       |                  }
 2940|       |                  return;
 2941|       |               }
 2942|       |               else if (*it == ',') {
 2943|       |                  ++it;
 2944|       |                  just_saw_comma = true;
 2945|       |                  skip_flow_ws_and_newlines(ctx, it, end);
 2946|       |                  if (bool(ctx.error)) [[unlikely]]
 2947|       |                     return;
 2948|       |               }
 2949|       |               else {
 2950|       |                  ctx.error = error_code::syntax_error;
 2951|       |                  return;
 2952|       |               }
 2953|       |            }
 2954|       |         }
 2955|       |         else {
 2956|       |            ctx.error = error_code::syntax_error;
 2957|       |            return;
 2958|       |         }
 2959|   109k|      }
_ZN3glz4yaml26clear_sequence_before_readITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEEEEvRT0_:
 2682|   346k|      {
 2683|   346k|         if constexpr (emplace_backable<V> && requires { value.clear(); }) {
 2684|       |            // vector-like: honor the append_arrays option, matching json/read.hpp
 2685|   346k|            if constexpr (!check_append_arrays(Opts)) {
 2686|   346k|               value.clear();
 2687|   346k|            }
 2688|       |         }
 2689|       |         else if constexpr (emplaceable<V> && requires { value.clear(); }) {
 2690|       |            // set-like: json/read.hpp clears unconditionally; append_arrays does not apply
 2691|       |            value.clear();
 2692|       |         }
 2693|   346k|      }
_ZZN3glz4yaml19parse_flow_sequenceITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_EN26sequence_container_adapter6appendESC_OS8_:
 2720|   136k|            {
 2721|   136k|               if constexpr (emplace_backable<V>) {
 2722|   136k|                  container.emplace_back(std::move(element));
 2723|       |               }
 2724|       |               else if constexpr (emplaceable<V>) {
 2725|       |                  container.emplace(std::move(element));
 2726|       |               }
 2727|   136k|            }
_ZN3glz4yaml20parse_block_sequenceITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_i:
 3186|   203k|      {
 3187|   203k|         using V = std::remove_cvref_t<T>;
 3188|   203k|         using value_type = typename V::value_type;
 3189|       |
 3190|   203k|         struct sequence_container_adapter
 3191|   203k|         {
 3192|   203k|            size_t index = 0;
 3193|       |
 3194|   203k|            inline bool fixed_capacity_reached(const V& container) const noexcept
 3195|   203k|            {
 3196|   203k|               if constexpr (!resizable<V>) {
 3197|   203k|                  return index >= container.size();
 3198|   203k|               }
 3199|   203k|               else {
 3200|   203k|                  (void)container;
 3201|   203k|                  return false;
 3202|   203k|               }
 3203|   203k|            }
 3204|       |
 3205|   203k|            inline void commit_fixed_slot() noexcept { ++index; }
 3206|       |
 3207|   203k|            inline void append(V& container, value_type&& element) noexcept
 3208|   203k|            {
 3209|   203k|               if constexpr (emplace_backable<V>) {
 3210|   203k|                  container.emplace_back(std::move(element));
 3211|   203k|               }
 3212|   203k|               else if constexpr (emplaceable<V>) {
 3213|   203k|                  container.emplace(std::move(element));
 3214|   203k|               }
 3215|   203k|            }
 3216|   203k|         };
 3217|       |
 3218|       |         // Overwrite (do not append to) any pre-existing contents. A block
 3219|       |         // sequence is only entered once a '-' item is confirmed, so clearing
 3220|       |         // up front correctly (re)assigns the container to the parsed sequence.
 3221|   203k|         clear_sequence_before_read<Opts>(value);
 3222|       |
 3223|   203k|         sequence_container_adapter adapter{};
 3224|       |
 3225|       |         // Track if this is the first item (for handling whitespace-consumed case)
 3226|   203k|         bool first_item = true;
 3227|   203k|         bool has_pending_item_anchor = false;
 3228|   203k|         std::string pending_item_anchor_name{};
 3229|   203k|         int32_t pending_item_anchor_indent = sequence_indent;
 3230|       |
 3231|   544k|         while (it != end) {
  ------------------
  |  Branch (3231:17): [True: 487k, False: 56.3k]
  ------------------
 3232|       |            // Skip blank lines and comments, track indent
 3233|   487k|            int32_t line_indent = 0;
 3234|   487k|            int32_t dash_col = -1; // actual column of the '-' on the line
 3235|   487k|            auto line_start = it;
 3236|       |
 3237|   686k|            while (it != end) {
  ------------------
  |  Branch (3237:20): [True: 662k, False: 23.8k]
  ------------------
 3238|   662k|               if (*it == '#') {
  ------------------
  |  Branch (3238:20): [True: 39.9k, False: 622k]
  ------------------
 3239|  39.9k|                  skip_comment(it, end);
 3240|  39.9k|                  skip_newline(it, end);
 3241|  39.9k|                  line_start = it;
 3242|  39.9k|                  line_indent = 0;
 3243|  39.9k|               }
 3244|   622k|               else if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3244:25): [True: 56.7k, False: 565k]
  |  Branch (3244:40): [True: 56.7k, False: 508k]
  ------------------
 3245|   113k|                  skip_newline(it, end);
 3246|   113k|                  line_start = it;
 3247|   113k|                  line_indent = 0;
 3248|   113k|               }
 3249|   508k|               else if (*it == ' ') {
  ------------------
  |  Branch (3249:25): [True: 50.8k, False: 457k]
  ------------------
 3250|  50.8k|                  line_start = it;
 3251|  50.8k|                  line_indent = 0;
 3252|  1.14M|                  while (it != end && *it == ' ') {
  ------------------
  |  Branch (3252:26): [True: 1.14M, False: 2.14k]
  |  Branch (3252:39): [True: 1.09M, False: 48.6k]
  ------------------
 3253|  1.09M|                     ++line_indent;
 3254|  1.09M|                     ++it;
 3255|  1.09M|                  }
 3256|       |
 3257|  50.8k|                  bool saw_tab = false;
 3258|  64.1k|                  while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3258:26): [True: 60.8k, False: 3.30k]
  |  Branch (3258:40): [True: 7.65k, False: 53.1k]
  |  Branch (3258:54): [True: 5.64k, False: 47.5k]
  ------------------
 3259|  13.3k|                     saw_tab = saw_tab || (*it == '\t');
  ------------------
  |  Branch (3259:32): [True: 8.48k, False: 4.82k]
  |  Branch (3259:43): [True: 4.82k, False: 0]
  ------------------
 3260|  13.3k|                     ++it;
 3261|  13.3k|                  }
 3262|       |
 3263|  50.8k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3263:23): [True: 3.30k, False: 47.5k]
  |  Branch (3263:36): [True: 11.2k, False: 36.3k]
  |  Branch (3263:51): [True: 9.52k, False: 26.7k]
  |  Branch (3263:66): [True: 5.40k, False: 21.3k]
  ------------------
 3264|       |                     // Blank or comment line - continue to next line
 3265|  29.4k|                     if (it != end && *it == '#') {
  ------------------
  |  Branch (3265:26): [True: 26.1k, False: 3.30k]
  |  Branch (3265:39): [True: 5.40k, False: 20.7k]
  ------------------
 3266|  5.40k|                        skip_comment(it, end);
 3267|  5.40k|                     }
 3268|  29.4k|                     line_indent = 0;
 3269|  29.4k|                     continue;
 3270|  29.4k|                  }
 3271|       |
 3272|  21.3k|                  if (saw_tab) {
  ------------------
  |  Branch (3272:23): [True: 37, False: 21.3k]
  ------------------
 3273|     37|                     ctx.error = error_code::syntax_error;
 3274|     37|                     return;
 3275|     37|                  }
 3276|  21.3k|                  break; // Found content
 3277|  21.3k|               }
 3278|   457k|               else if (*it == '\t') {
  ------------------
  |  Branch (3278:25): [True: 15.2k, False: 442k]
  ------------------
 3279|  15.2k|                  line_start = it;
 3280|  38.5k|                  while (it != end && (*it == ' ' || *it == '\t')) ++it;
  ------------------
  |  Branch (3280:26): [True: 34.7k, False: 3.79k]
  |  Branch (3280:40): [True: 2.90k, False: 31.8k]
  |  Branch (3280:54): [True: 20.3k, False: 11.4k]
  ------------------
 3281|  15.2k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3281:23): [True: 3.79k, False: 11.4k]
  |  Branch (3281:36): [True: 2.24k, False: 9.23k]
  |  Branch (3281:51): [True: 3.99k, False: 5.23k]
  |  Branch (3281:66): [True: 5.17k, False: 58]
  ------------------
 3282|  15.2k|                     if (it != end && *it == '#') {
  ------------------
  |  Branch (3282:26): [True: 11.4k, False: 3.79k]
  |  Branch (3282:39): [True: 5.17k, False: 6.24k]
  ------------------
 3283|  5.17k|                        skip_comment(it, end);
 3284|  5.17k|                     }
 3285|  15.2k|                     line_indent = 0;
 3286|  15.2k|                     continue;
 3287|  15.2k|                  }
 3288|     58|                  ctx.error = error_code::syntax_error;
 3289|     58|                  return;
 3290|  15.2k|               }
 3291|   442k|               else {
 3292|       |                  // At content (no leading space on this line)
 3293|       |                  // If first item and at '-', whitespace was consumed by caller;
 3294|       |                  // treat as having correct indentation
 3295|   442k|                  if (first_item && *it == '-') {
  ------------------
  |  Branch (3295:23): [True: 203k, False: 239k]
  |  Branch (3295:37): [True: 201k, False: 1.76k]
  ------------------
 3296|   201k|                     line_indent = sequence_indent;
 3297|   201k|                     if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3298|   201k|                        if (ctx.stream_begin && it > ctx.stream_begin) {
  ------------------
  |  Branch (3298:29): [True: 201k, False: 0]
  |  Branch (3298:49): [True: 201k, False: 0]
  ------------------
 3299|   201k|                           auto probe = it;
 3300|   201k|                           int32_t leading_ws = 0;
 3301|   201k|                           bool saw_tab = false;
 3302|   492k|                           while (probe > ctx.stream_begin && (*(probe - 1) == ' ' || *(probe - 1) == '\t')) {
  ------------------
  |  Branch (3302:35): [True: 492k, False: 0]
  |  Branch (3302:64): [True: 268k, False: 224k]
  |  Branch (3302:87): [True: 22.5k, False: 201k]
  ------------------
 3303|   290k|                              --probe;
 3304|   290k|                              ++leading_ws;
 3305|   290k|                              saw_tab = saw_tab || (*probe == '\t');
  ------------------
  |  Branch (3305:41): [True: 2.25k, False: 288k]
  |  Branch (3305:52): [True: 21.0k, False: 267k]
  ------------------
 3306|   290k|                           }
 3307|   201k|                           if (probe == ctx.stream_begin || *(probe - 1) == '\n' || *(probe - 1) == '\r') {
  ------------------
  |  Branch (3307:32): [True: 0, False: 201k]
  |  Branch (3307:61): [True: 12.1k, False: 189k]
  |  Branch (3307:85): [True: 49.3k, False: 139k]
  ------------------
 3308|  61.5k|                              if (saw_tab) {
  ------------------
  |  Branch (3308:35): [True: 6, False: 61.5k]
  ------------------
 3309|      6|                                 ctx.error = error_code::syntax_error;
 3310|      6|                                 return;
 3311|      6|                              }
 3312|  61.5k|                              line_indent = (std::max)(line_indent, leading_ws);
 3313|  61.5k|                           }
 3314|   201k|                        }
 3315|   201k|                     }
 3316|   201k|                  }
 3317|   201k|                  break;
 3318|   442k|               }
 3319|   662k|            }
 3320|       |
 3321|   487k|            if (it == end) break;
  ------------------
  |  Branch (3321:17): [True: 23.8k, False: 464k]
  ------------------
 3322|       |
 3323|       |            // Check for document end marker
 3324|   464k|            if (at_document_end(it, end)) break;
  ------------------
  |  Branch (3324:17): [True: 7.82k, False: 456k]
  ------------------
 3325|       |
 3326|       |            // Check for dedent
 3327|   456k|            if (line_indent < sequence_indent) {
  ------------------
  |  Branch (3327:17): [True: 45.7k, False: 410k]
  ------------------
 3328|  45.7k|               it = line_start;
 3329|  45.7k|               return;
 3330|  45.7k|            }
 3331|       |
 3332|   410k|            if (*it == '&') {
  ------------------
  |  Branch (3332:17): [True: 15.7k, False: 394k]
  ------------------
 3333|       |               // Standalone anchor lines before "- item" are only supported for
 3334|       |               // indentless mapping values. At top-level block sequences these are
 3335|       |               // malformed in yaml-test-suite cases.
 3336|  15.7k|               if (!ctx.allow_indentless_sequence) {
  ------------------
  |  Branch (3336:20): [True: 18, False: 15.7k]
  ------------------
 3337|     18|                  ctx.error = error_code::syntax_error;
 3338|     18|                  return;
 3339|     18|               }
 3340|       |
 3341|  15.7k|               ++it;
 3342|  15.7k|               auto pending_name = parse_anchor_name(it, end);
 3343|  15.7k|               if (pending_name.empty()) {
  ------------------
  |  Branch (3343:20): [True: 41, False: 15.7k]
  ------------------
 3344|     41|                  ctx.error = error_code::syntax_error;
 3345|     41|                  return;
 3346|     41|               }
 3347|  15.7k|               skip_inline_ws(it, end);
 3348|  15.7k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (3348:20): [True: 15.6k, False: 98]
  |  Branch (3348:33): [True: 2.10k, False: 13.5k]
  ------------------
 3349|  2.10k|                  skip_comment(it, end);
 3350|  2.10k|               }
 3351|       |
 3352|  15.7k|               has_pending_item_anchor = true;
 3353|  15.7k|               pending_item_anchor_name = std::string(pending_name);
 3354|  15.7k|               pending_item_anchor_indent = line_indent;
 3355|       |
 3356|  15.7k|               if (it == end || (*it != '\n' && *it != '\r')) {
  ------------------
  |  Branch (3356:20): [True: 110, False: 15.5k]
  |  Branch (3356:34): [True: 9.20k, False: 6.39k]
  |  Branch (3356:49): [True: 113, False: 9.08k]
  ------------------
 3357|    223|                  ctx.error = error_code::syntax_error;
 3358|    223|                  return;
 3359|    223|               }
 3360|       |
 3361|  15.4k|               skip_newline(it, end);
 3362|  15.4k|               continue;
 3363|  15.7k|            }
 3364|       |
 3365|       |            // Expect dash for sequence item
 3366|   394k|            if (*it != '-') {
  ------------------
  |  Branch (3366:17): [True: 56.1k, False: 338k]
  ------------------
 3367|  56.1k|               it = line_start;
 3368|  56.1k|               return;
 3369|  56.1k|            }
 3370|       |
 3371|       |            // Compute the actual column of this sequence dash.
 3372|       |            // This is needed by plain-scalar multiline folding to distinguish
 3373|       |            // sibling "- item" entries from deeper "- " continuation content.
 3374|   338k|            dash_col = line_indent;
 3375|   338k|            if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3376|   338k|               if (ctx.stream_begin) {
  ------------------
  |  Branch (3376:20): [True: 338k, False: 6]
  ------------------
 3377|   338k|                  dash_col = ctx.line_prefix_before(&*it).column;
 3378|   338k|               }
 3379|   338k|            }
 3380|       |
 3381|   338k|            ++it; // Skip '-'
 3382|       |
 3383|       |            // Check for valid sequence item indicator (- followed by space or newline)
 3384|   338k|            if (it != end && !yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (3384:17): [True: 330k, False: 7.70k]
  |  Branch (3384:30): [True: 10.9k, False: 319k]
  ------------------
 3385|       |               // Not a sequence item (could be a number like -5)
 3386|  10.9k|               it = line_start;
 3387|  10.9k|               return;
 3388|  10.9k|            }
 3389|       |
 3390|   327k|            bool saw_tab_after_dash = false;
 3391|   735k|            while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3391:20): [True: 725k, False: 9.62k]
  |  Branch (3391:34): [True: 375k, False: 349k]
  |  Branch (3391:48): [True: 31.6k, False: 317k]
  ------------------
 3392|   407k|               saw_tab_after_dash = saw_tab_after_dash || (*it == '\t');
  ------------------
  |  Branch (3392:37): [True: 4.63k, False: 402k]
  |  Branch (3392:59): [True: 30.1k, False: 372k]
  ------------------
 3393|   407k|               ++it;
 3394|   407k|            }
 3395|       |            // A tab-separated nested "- " marker is not valid block indentation.
 3396|   327k|            if (saw_tab_after_dash && it != end && *it == '-') {
  ------------------
  |  Branch (3396:17): [True: 30.1k, False: 297k]
  |  Branch (3396:39): [True: 28.9k, False: 1.18k]
  |  Branch (3396:52): [True: 670, False: 28.2k]
  ------------------
 3397|    670|               const auto after_dash = it + 1;
 3398|    670|               if (after_dash == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_dash)]) {
  ------------------
  |  Branch (3398:20): [True: 5, False: 665]
  |  Branch (3398:41): [True: 6, False: 659]
  ------------------
 3399|     11|                  ctx.error = error_code::syntax_error;
 3400|     11|                  return;
 3401|     11|               }
 3402|    670|            }
 3403|       |
 3404|       |            // Get reference to element to parse into
 3405|   327k|            auto parse_element = [&](auto& element) {
 3406|   327k|               const char* element_start = (it != end) ? &*it : nullptr;
 3407|       |
 3408|       |               // Check what follows
 3409|   327k|               if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 3410|       |                  // Content on same line as dash - set indent to one less than content column
 3411|       |                  // This allows nested block mappings to continue parsing keys at the content indent
 3412|       |                  // For "- key: val", if dash is at column 0, content is at column 2
 3413|       |                  // We set parent indent to 1 so keys at column 2 pass the "indent > parent" check
 3414|   327k|                  if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 3415|   327k|                     return;
 3416|   327k|                  const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3417|   327k|                  const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3418|   327k|                  ctx.sequence_item_value_context = true;
 3419|   327k|                  ctx.sequence_dash_indent = dash_col;
 3420|   327k|                  from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3421|   327k|                  ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3422|   327k|                  ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3423|   327k|                  ctx.pop_indent();
 3424|   327k|               }
 3425|   327k|               else {
 3426|       |                  // Value on next line - nested block
 3427|   327k|                  skip_ws_and_comment(it, end);
 3428|   327k|                  skip_newline(it, end);
 3429|       |
 3430|       |                  // Get indent of nested content
 3431|   327k|                  auto nested_start = it;
 3432|   327k|                  int32_t nested_indent = measure_indent(it, end, ctx);
 3433|   327k|                  if (bool(ctx.error)) [[unlikely]]
 3434|   327k|                     return;
 3435|   327k|                  it = nested_start;
 3436|       |
 3437|       |                  // Content is nested only if indented more than the current line.
 3438|       |                  // When line_indent is negative (root level), use 0 as the baseline.
 3439|       |                  // This prevents content at column 0 from being treated as nested.
 3440|   327k|                  const int32_t effective_line_indent = (line_indent < 0) ? 0 : line_indent;
 3441|   327k|                  if (nested_indent > effective_line_indent) {
 3442|       |                     // Save and set indent for nested parsing.
 3443|       |                     // A struct element reads the pushed indent as its own key column; every
 3444|       |                     // other element type reads it as the enclosing baseline, so it gets one
 3445|       |                     // less than the content indent and its content passes "indent > parent".
 3446|   327k|                     const int32_t element_indent =
 3447|   327k|                        receives_block_mapping_column<value_type>() ? nested_indent : nested_indent - 1;
 3448|   327k|                     if (!ctx.push_indent(element_indent)) [[unlikely]]
 3449|   327k|                        return;
 3450|   327k|                     const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3451|   327k|                     const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3452|   327k|                     ctx.sequence_item_value_context = true;
 3453|   327k|                     ctx.sequence_dash_indent = dash_col;
 3454|   327k|                     from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3455|   327k|                     ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3456|   327k|                     ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3457|   327k|                     ctx.pop_indent();
 3458|   327k|                  }
 3459|       |                  // else: empty element (default constructed)
 3460|   327k|               }
 3461|       |
 3462|   327k|               if (has_pending_item_anchor && !bool(ctx.error)) {
 3463|   327k|                  const char* element_end = (it != end) ? &*it : element_start;
 3464|   327k|                  ctx.anchors[std::move(pending_item_anchor_name)] = {element_start, element_end,
 3465|   327k|                                                                      pending_item_anchor_indent};
 3466|   327k|                  has_pending_item_anchor = false;
 3467|   327k|               }
 3468|   327k|            };
 3469|       |
 3470|   327k|            if constexpr (emplace_backable<V>) {
 3471|   327k|               auto& element = value.emplace_back();
 3472|   327k|               parse_element(element);
 3473|       |            }
 3474|       |            else if constexpr (emplaceable<V>) {
 3475|       |               value_type element{};
 3476|       |               parse_element(element);
 3477|       |               if (!bool(ctx.error)) {
 3478|       |                  adapter.append(value, std::move(element));
 3479|       |               }
 3480|       |            }
 3481|       |            else if constexpr (!resizable<V>) {
 3482|       |               // Fixed-size (e.g. std::array): an item beyond the last slot is an error, as in JSON.
 3483|       |               // Checked only once another item is confirmed, so a full container still ends cleanly.
 3484|       |               if (adapter.fixed_capacity_reached(value)) [[unlikely]] {
 3485|       |                  ctx.error = error_code::exceeded_static_array_size;
 3486|       |                  return;
 3487|       |               }
 3488|       |               parse_element(value[adapter.index]);
 3489|       |               adapter.commit_fixed_slot();
 3490|       |            }
 3491|       |            else {
 3492|       |               ctx.error = error_code::syntax_error;
 3493|       |               return;
 3494|       |            }
 3495|       |
 3496|   327k|            first_item = false;
 3497|       |
 3498|   327k|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3498:17): [True: 1.99k, False: 325k]
  ------------------
 3499|  1.99k|               return;
 3500|       |
 3501|       |            // Note: after parsing nested block content, iterator may already be
 3502|       |            // at the start of the next line. The outer loop will handle it.
 3503|   327k|         }
 3504|   203k|      }
_ZZN3glz4yaml20parse_block_sequenceITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_iENKUlRT_E_clIS8_EEDaSO_:
 3405|   327k|            auto parse_element = [&](auto& element) {
 3406|   327k|               const char* element_start = (it != end) ? &*it : nullptr;
  ------------------
  |  Branch (3406:44): [True: 317k, False: 9.62k]
  ------------------
 3407|       |
 3408|       |               // Check what follows
 3409|   327k|               if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (3409:20): [True: 317k, False: 9.62k]
  |  Branch (3409:33): [True: 156k, False: 161k]
  ------------------
 3410|       |                  // Content on same line as dash - set indent to one less than content column
 3411|       |                  // This allows nested block mappings to continue parsing keys at the content indent
 3412|       |                  // For "- key: val", if dash is at column 0, content is at column 2
 3413|       |                  // We set parent indent to 1 so keys at column 2 pass the "indent > parent" check
 3414|   156k|                  if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
  ------------------
  |  Branch (3414:23): [True: 0, False: 156k]
  ------------------
 3415|      0|                     return;
 3416|   156k|                  const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3417|   156k|                  const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3418|   156k|                  ctx.sequence_item_value_context = true;
 3419|   156k|                  ctx.sequence_dash_indent = dash_col;
 3420|   156k|                  from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3421|   156k|                  ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3422|   156k|                  ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3423|   156k|                  ctx.pop_indent();
 3424|   156k|               }
 3425|   170k|               else {
 3426|       |                  // Value on next line - nested block
 3427|   170k|                  skip_ws_and_comment(it, end);
 3428|   170k|                  skip_newline(it, end);
 3429|       |
 3430|       |                  // Get indent of nested content
 3431|   170k|                  auto nested_start = it;
 3432|   170k|                  int32_t nested_indent = measure_indent(it, end, ctx);
 3433|   170k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3433:23): [True: 9, False: 170k]
  ------------------
 3434|      9|                     return;
 3435|   170k|                  it = nested_start;
 3436|       |
 3437|       |                  // Content is nested only if indented more than the current line.
 3438|       |                  // When line_indent is negative (root level), use 0 as the baseline.
 3439|       |                  // This prevents content at column 0 from being treated as nested.
 3440|   170k|                  const int32_t effective_line_indent = (line_indent < 0) ? 0 : line_indent;
  ------------------
  |  Branch (3440:57): [True: 7.39k, False: 163k]
  ------------------
 3441|   170k|                  if (nested_indent > effective_line_indent) {
  ------------------
  |  Branch (3441:23): [True: 15.0k, False: 155k]
  ------------------
 3442|       |                     // Save and set indent for nested parsing.
 3443|       |                     // A struct element reads the pushed indent as its own key column; every
 3444|       |                     // other element type reads it as the enclosing baseline, so it gets one
 3445|       |                     // less than the content indent and its content passes "indent > parent".
 3446|  15.0k|                     const int32_t element_indent =
 3447|  15.0k|                        receives_block_mapping_column<value_type>() ? nested_indent : nested_indent - 1;
  ------------------
  |  Branch (3447:25): [Folded, False: 15.0k]
  ------------------
 3448|  15.0k|                     if (!ctx.push_indent(element_indent)) [[unlikely]]
  ------------------
  |  Branch (3448:26): [True: 0, False: 15.0k]
  ------------------
 3449|      0|                        return;
 3450|  15.0k|                     const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3451|  15.0k|                     const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3452|  15.0k|                     ctx.sequence_item_value_context = true;
 3453|  15.0k|                     ctx.sequence_dash_indent = dash_col;
 3454|  15.0k|                     from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3455|  15.0k|                     ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3456|  15.0k|                     ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3457|  15.0k|                     ctx.pop_indent();
 3458|  15.0k|                  }
 3459|       |                  // else: empty element (default constructed)
 3460|   170k|               }
 3461|       |
 3462|   327k|               if (has_pending_item_anchor && !bool(ctx.error)) {
  ------------------
  |  Branch (3462:20): [True: 2.76k, False: 324k]
  |  Branch (3462:47): [True: 2.34k, False: 413]
  ------------------
 3463|  2.34k|                  const char* element_end = (it != end) ? &*it : element_start;
  ------------------
  |  Branch (3463:45): [True: 1.58k, False: 769]
  ------------------
 3464|  2.34k|                  ctx.anchors[std::move(pending_item_anchor_name)] = {element_start, element_end,
 3465|  2.34k|                                                                      pending_item_anchor_indent};
 3466|  2.34k|                  has_pending_item_anchor = false;
 3467|  2.34k|               }
 3468|   327k|            };
_ZN3glz29parse_block_mapping_or_stringINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERSH_RNSI_12yaml_contextERPKcSO_EEvOT1_OT2_OT3_T4_:
 5575|  1.02M|   {
 5576|  1.02M|      if constexpr (yaml::check_flow_context(Opts)) {
 5577|       |         // In flow context, only treat plain content as an implicit "key: value"
 5578|       |         // when a mapping separator appears before the next top-level flow delimiter.
 5579|  1.02M|         auto could_be_implicit_flow_pair = [&](auto pos) {
 5580|       |            // Bounded by the longest implicit key the spec allows: unbounded, this probe runs
 5581|       |            // once per entry per nesting level over the whole remaining flow collection.
 5582|  1.02M|            const auto stop = yaml::implicit_key_scan_end(pos, end);
 5583|       |            // See `line_could_be_block_mapping` for why a quote is an indicator only where a node
 5584|       |            // can begin. Brackets need no such guard here: ns-plain-safe-in keeps them out of a
 5585|       |            // flow-context plain scalar, so every one of them is an indicator.
 5586|  1.02M|            bool at_node_start = true;
 5587|  1.02M|            int depth = 0;
 5588|  1.02M|            while (pos != stop) {
 5589|  1.02M|               const char c = *pos;
 5590|  1.02M|               if (c == ' ' || c == '\t') {
 5591|  1.02M|                  ++pos;
 5592|  1.02M|                  continue;
 5593|  1.02M|               }
 5594|  1.02M|               const bool node_start = std::exchange(at_node_start, false);
 5595|       |
 5596|  1.02M|               if ((c == '"' || c == '\'') && node_start) {
 5597|  1.02M|                  if (not yaml::skip_probe_quoted_scalar(pos, stop)) return false;
 5598|  1.02M|                  continue;
 5599|  1.02M|               }
 5600|  1.02M|               if (c == '[' || c == '{') {
 5601|  1.02M|                  ++depth;
 5602|  1.02M|                  at_node_start = true;
 5603|  1.02M|                  ++pos;
 5604|  1.02M|                  continue;
 5605|  1.02M|               }
 5606|  1.02M|               if (c == ']' || c == '}') {
 5607|  1.02M|                  if (depth == 0) return false;
 5608|  1.02M|                  --depth;
 5609|  1.02M|                  ++pos;
 5610|  1.02M|                  continue;
 5611|  1.02M|               }
 5612|  1.02M|               if (c == ',' && depth == 0) return false;
 5613|  1.02M|               if (c == ':' && depth == 0) {
 5614|  1.02M|                  auto next = pos + 1;
 5615|  1.02M|                  return next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
 5616|  1.02M|               }
 5617|       |               // Inside a nested collection ',' separates entries and ':' ends a key.
 5618|  1.02M|               if (c == ',' || c == ':') {
 5619|  1.02M|                  at_node_start = true;
 5620|  1.02M|                  ++pos;
 5621|  1.02M|                  continue;
 5622|  1.02M|               }
 5623|  1.02M|               if (node_start && yaml::skip_probe_node_property(pos, stop)) {
 5624|  1.02M|                  at_node_start = true;
 5625|  1.02M|                  continue;
 5626|  1.02M|               }
 5627|  1.02M|               ++pos;
 5628|  1.02M|            }
 5629|  1.02M|            return false;
 5630|  1.02M|         };
 5631|       |
 5632|  1.02M|         if (could_be_implicit_flow_pair(it) || line_could_be_flow_mapping(it, end)) {
  ------------------
  |  Branch (5632:14): [True: 452k, False: 574k]
  |  Branch (5632:49): [True: 11.7k, False: 562k]
  ------------------
 5633|   463k|            if (try_parse_block_mapping_into_variant<Variant, Opts>(value, ctx, it, end)) {
  ------------------
  |  Branch (5633:17): [True: 395k, False: 68.0k]
  ------------------
 5634|   395k|               return;
 5635|   395k|            }
 5636|  68.0k|            if (bool(ctx.error)) {
  ------------------
  |  Branch (5636:17): [True: 12.5k, False: 55.4k]
  ------------------
 5637|  12.5k|               return;
 5638|  12.5k|            }
 5639|  68.0k|         }
 5640|       |
 5641|   618k|         process_yaml_variant_alternatives<Variant, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 5642|   618k|         return;
 5643|  1.02M|      }
 5644|       |
 5645|  1.02M|      if (try_parse_block_mapping_into_variant<Variant, Opts>(value, ctx, it, end)) {
  ------------------
  |  Branch (5645:11): [True: 0, False: 1.02M]
  ------------------
 5646|      0|         return;
 5647|      0|      }
 5648|       |      // If an error was set (e.g., malformed flow collection in value), don't try to parse as string
 5649|  1.02M|      if (bool(ctx.error)) {
  ------------------
  |  Branch (5649:11): [True: 0, False: 1.02M]
  ------------------
 5650|      0|         return;
 5651|      0|      }
 5652|  1.02M|      process_yaml_variant_alternatives<Variant, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 5653|  1.02M|   }
_ZZN3glz29parse_block_mapping_or_stringINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERSH_RNSI_12yaml_contextERPKcSO_EEvOT1_OT2_OT3_T4_ENKUlT_E_clISO_EEDaSX_:
 5579|  1.02M|         auto could_be_implicit_flow_pair = [&](auto pos) {
 5580|       |            // Bounded by the longest implicit key the spec allows: unbounded, this probe runs
 5581|       |            // once per entry per nesting level over the whole remaining flow collection.
 5582|  1.02M|            const auto stop = yaml::implicit_key_scan_end(pos, end);
 5583|       |            // See `line_could_be_block_mapping` for why a quote is an indicator only where a node
 5584|       |            // can begin. Brackets need no such guard here: ns-plain-safe-in keeps them out of a
 5585|       |            // flow-context plain scalar, so every one of them is an indicator.
 5586|  1.02M|            bool at_node_start = true;
 5587|  1.02M|            int depth = 0;
 5588|  15.0M|            while (pos != stop) {
  ------------------
  |  Branch (5588:20): [True: 14.9M, False: 111k]
  ------------------
 5589|  14.9M|               const char c = *pos;
 5590|  14.9M|               if (c == ' ' || c == '\t') {
  ------------------
  |  Branch (5590:20): [True: 2.41M, False: 12.5M]
  |  Branch (5590:32): [True: 234k, False: 12.3M]
  ------------------
 5591|  2.64M|                  ++pos;
 5592|  2.64M|                  continue;
 5593|  2.64M|               }
 5594|  12.3M|               const bool node_start = std::exchange(at_node_start, false);
 5595|       |
 5596|  12.3M|               if ((c == '"' || c == '\'') && node_start) {
  ------------------
  |  Branch (5596:21): [True: 122k, False: 12.2M]
  |  Branch (5596:33): [True: 28.1k, False: 12.1M]
  |  Branch (5596:47): [True: 75.6k, False: 74.9k]
  ------------------
 5597|  75.6k|                  if (not yaml::skip_probe_quoted_scalar(pos, stop)) return false;
  ------------------
  |  Branch (5597:23): [True: 16.2k, False: 59.4k]
  ------------------
 5598|  59.4k|                  continue;
 5599|  75.6k|               }
 5600|  12.2M|               if (c == '[' || c == '{') {
  ------------------
  |  Branch (5600:20): [True: 408k, False: 11.8M]
  |  Branch (5600:32): [True: 124k, False: 11.7M]
  ------------------
 5601|   532k|                  ++depth;
 5602|   532k|                  at_node_start = true;
 5603|   532k|                  ++pos;
 5604|   532k|                  continue;
 5605|   532k|               }
 5606|  11.7M|               if (c == ']' || c == '}') {
  ------------------
  |  Branch (5606:20): [True: 138k, False: 11.5M]
  |  Branch (5606:32): [True: 107k, False: 11.4M]
  ------------------
 5607|   246k|                  if (depth == 0) return false;
  ------------------
  |  Branch (5607:23): [True: 93.9k, False: 152k]
  ------------------
 5608|   152k|                  --depth;
 5609|   152k|                  ++pos;
 5610|   152k|                  continue;
 5611|   246k|               }
 5612|  11.4M|               if (c == ',' && depth == 0) return false;
  ------------------
  |  Branch (5612:20): [True: 657k, False: 10.8M]
  |  Branch (5612:32): [True: 238k, False: 419k]
  ------------------
 5613|  11.2M|               if (c == ':' && depth == 0) {
  ------------------
  |  Branch (5613:20): [True: 780k, False: 10.4M]
  |  Branch (5613:32): [True: 565k, False: 214k]
  ------------------
 5614|   565k|                  auto next = pos + 1;
 5615|   565k|                  return next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
  ------------------
  |  Branch (5615:26): [True: 6.48k, False: 559k]
  |  Branch (5615:41): [True: 284k, False: 274k]
  |  Branch (5615:57): [True: 37.4k, False: 237k]
  |  Branch (5615:74): [True: 27.3k, False: 210k]
  |  Branch (5615:91): [True: 96.3k, False: 113k]
  ------------------
 5616|   565k|               }
 5617|       |               // Inside a nested collection ',' separates entries and ':' ends a key.
 5618|  10.6M|               if (c == ',' || c == ':') {
  ------------------
  |  Branch (5618:20): [True: 419k, False: 10.2M]
  |  Branch (5618:32): [True: 214k, False: 10.0M]
  ------------------
 5619|   634k|                  at_node_start = true;
 5620|   634k|                  ++pos;
 5621|   634k|                  continue;
 5622|   634k|               }
 5623|  10.0M|               if (node_start && yaml::skip_probe_node_property(pos, stop)) {
  ------------------
  |  Branch (5623:20): [True: 1.51M, False: 8.52M]
  |  Branch (5623:34): [True: 118k, False: 1.39M]
  ------------------
 5624|   118k|                  at_node_start = true;
 5625|   118k|                  continue;
 5626|   118k|               }
 5627|  9.91M|               ++pos;
 5628|  9.91M|            }
 5629|   111k|            return false;
 5630|  1.02M|         };
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRSH_TkNS_10is_contextERNSK_12yaml_contextESN_EEvOT1_OT2_OT0_T3_ENKUlT_E0_clISN_EEDaSZ_:
 6007|   107k|            auto is_word_boundary = [&](const auto ptr) {
 6008|   107k|               if (ptr == end) {
  ------------------
  |  Branch (6008:20): [True: 3.34k, False: 103k]
  ------------------
 6009|  3.34k|                  return true;
 6010|  3.34k|               }
 6011|   103k|               if (*ptr == ':') {
  ------------------
  |  Branch (6011:20): [True: 74.5k, False: 29.4k]
  ------------------
 6012|  74.5k|                  auto next = ptr + 1;
 6013|  74.5k|                  return (next == end) || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
  ------------------
  |  Branch (6013:26): [True: 3.52k, False: 71.0k]
  |  Branch (6013:43): [True: 35.7k, False: 35.2k]
  |  Branch (6013:59): [True: 23.0k, False: 12.1k]
  |  Branch (6013:76): [True: 3.23k, False: 8.88k]
  |  Branch (6013:93): [True: 6.82k, False: 2.06k]
  ------------------
 6014|  74.5k|               }
 6015|  29.4k|               return is_plain_scalar_boundary(*ptr);
 6016|   103k|            };
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRSH_TkNS_10is_contextERNSK_12yaml_contextESN_EEvOT1_OT2_OT0_T3_ENKUlcE_clEc:
 5933|  29.4k|            auto is_plain_scalar_boundary = [](const char ch) {
 5934|  29.4k|               switch (ch) {
 5935|  4.04k|               case ' ':
  ------------------
  |  Branch (5935:16): [True: 4.04k, False: 25.3k]
  ------------------
 5936|  5.38k|               case '\t':
  ------------------
  |  Branch (5936:16): [True: 1.33k, False: 28.0k]
  ------------------
 5937|  6.64k|               case '\n':
  ------------------
  |  Branch (5937:16): [True: 1.26k, False: 28.1k]
  ------------------
 5938|  12.7k|               case '\r':
  ------------------
  |  Branch (5938:16): [True: 6.05k, False: 23.3k]
  ------------------
 5939|  16.7k|               case ',':
  ------------------
  |  Branch (5939:16): [True: 4.00k, False: 25.4k]
  ------------------
 5940|  19.0k|               case ']':
  ------------------
  |  Branch (5940:16): [True: 2.33k, False: 27.0k]
  ------------------
 5941|  20.9k|               case '}':
  ------------------
  |  Branch (5941:16): [True: 1.95k, False: 27.4k]
  ------------------
 5942|  20.9k|                  return true;
 5943|  8.43k|               default:
  ------------------
  |  Branch (5943:16): [True: 8.43k, False: 20.9k]
  ------------------
 5944|  8.43k|                  return false;
 5945|  29.4k|               }
 5946|  29.4k|            };
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERPKcRSH_TkNS_10is_contextERNSK_12yaml_contextESN_EEvOT1_OT2_OT0_T3_ENKUlT_E_clISN_EEDaSZ_:
 5948|  96.8k|            auto has_indented_block_continuation = [&](auto word_end) {
 5949|  96.8k|               if constexpr (yaml::check_flow_context(Opts)) {
 5950|  96.8k|                  return false;
 5951|  96.8k|               }
 5952|  96.8k|               if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (5952:20): [True: 0, False: 96.8k]
  ------------------
 5953|      0|                  return false;
 5954|      0|               }
 5955|  96.8k|               if (word_end == end || (*word_end != '\n' && *word_end != '\r')) {
  ------------------
  |  Branch (5955:20): [True: 96.8k, False: 0]
  |  Branch (5955:40): [True: 0, False: 0]
  |  Branch (5955:61): [True: 0, False: 0]
  ------------------
 5956|      0|                  return false;
 5957|      0|               }
 5958|       |
 5959|  96.8k|               auto look = word_end;
 5960|  96.8k|               yaml::skip_newline(look, end);
 5961|  96.8k|               while (look != end) {
  ------------------
  |  Branch (5961:23): [True: 0, False: 96.8k]
  ------------------
 5962|      0|                  int32_t line_indent = 0;
 5963|      0|                  while (look != end && *look == ' ') {
  ------------------
  |  Branch (5963:26): [True: 0, False: 0]
  |  Branch (5963:41): [True: 0, False: 0]
  ------------------
 5964|      0|                     ++line_indent;
 5965|      0|                     ++look;
 5966|      0|                  }
 5967|      0|                  if (look != end && *look == '\t') {
  ------------------
  |  Branch (5967:23): [True: 0, False: 0]
  |  Branch (5967:38): [True: 0, False: 0]
  ------------------
 5968|      0|                     return false;
 5969|      0|                  }
 5970|      0|                  if (look == end || *look == '\n' || *look == '\r') {
  ------------------
  |  Branch (5970:23): [True: 0, False: 0]
  |  Branch (5970:38): [True: 0, False: 0]
  |  Branch (5970:55): [True: 0, False: 0]
  ------------------
 5971|      0|                     if (look != end) {
  ------------------
  |  Branch (5971:26): [True: 0, False: 0]
  ------------------
 5972|      0|                        yaml::skip_newline(look, end);
 5973|      0|                        continue;
 5974|      0|                     }
 5975|      0|                     return false;
 5976|      0|                  }
 5977|      0|                  if (*look == '#') {
  ------------------
  |  Branch (5977:23): [True: 0, False: 0]
  ------------------
 5978|      0|                     yaml::skip_comment(look, end);
 5979|      0|                     if (look != end && (*look == '\n' || *look == '\r')) {
  ------------------
  |  Branch (5979:26): [True: 0, False: 0]
  |  Branch (5979:42): [True: 0, False: 0]
  |  Branch (5979:59): [True: 0, False: 0]
  ------------------
 5980|      0|                        yaml::skip_newline(look, end);
 5981|      0|                        continue;
 5982|      0|                     }
 5983|      0|                     return false;
 5984|      0|                  }
 5985|       |
 5986|       |                  // If the next non-empty line is an implicit mapping entry,
 5987|       |                  // don't treat it as scalar continuation for auto-deduced
 5988|       |                  // booleans/nulls.
 5989|      0|                  {
 5990|      0|                     auto scan = look;
 5991|      0|                     while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (5991:29): [True: 0, False: 0]
  |  Branch (5991:44): [True: 0, False: 0]
  |  Branch (5991:61): [True: 0, False: 0]
  ------------------
 5992|      0|                        if (*scan == ':') {
  ------------------
  |  Branch (5992:29): [True: 0, False: 0]
  ------------------
 5993|      0|                           auto after_colon = scan + 1;
 5994|      0|                           if (after_colon == end || *after_colon == ' ' || *after_colon == '\t' ||
  ------------------
  |  Branch (5994:32): [True: 0, False: 0]
  |  Branch (5994:54): [True: 0, False: 0]
  |  Branch (5994:77): [True: 0, False: 0]
  ------------------
 5995|      0|                               *after_colon == '\n' || *after_colon == '\r') {
  ------------------
  |  Branch (5995:32): [True: 0, False: 0]
  |  Branch (5995:56): [True: 0, False: 0]
  ------------------
 5996|      0|                              return false;
 5997|      0|                           }
 5998|      0|                        }
 5999|      0|                        ++scan;
 6000|      0|                     }
 6001|      0|                  }
 6002|       |
 6003|      0|                  return line_indent > ctx.current_indent();
 6004|      0|               }
 6005|  96.8k|               return false;
 6006|  96.8k|            };
_ZN3glz36try_parse_block_mapping_into_variantINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERSH_RNSI_12yaml_contextERPKcSO_EEbOT1_OT2_OT3_T4_:
 5529|  2.09M|   {
 5530|  2.09M|      using counts = yaml_variant_type_count<Variant>;
 5531|       |      if constexpr (counts::n_object == 0) {
 5532|       |         return false;
 5533|       |      }
 5534|  2.09M|      else {
 5535|       |         // Quick check: if no viable mapping separator in the current span,
 5536|       |         // avoid expensive speculative parse.
 5537|  2.09M|         const bool could_be_mapping = [&] {
 5538|  2.09M|            if constexpr (yaml::check_flow_context(Opts)) {
 5539|  2.09M|               return line_could_be_flow_mapping(it, end);
 5540|  2.09M|            }
 5541|  2.09M|            else {
 5542|  2.09M|               return yaml::line_could_be_block_mapping(it, end);
 5543|  2.09M|            }
 5544|  2.09M|         }();
 5545|  2.09M|         if (!could_be_mapping) {
  ------------------
  |  Branch (5545:14): [True: 1.65M, False: 434k]
  ------------------
 5546|  1.65M|            return false;
 5547|  1.65M|         }
 5548|       |         // Full parse attempt - use a temporary context that inherits indent from parent
 5549|   434k|         auto temp_ctx = ctx.make_speculative();
 5550|   434k|         process_yaml_variant_alternatives<Variant, is_yaml_variant_object>::template op<Opts>(value, temp_ctx, it,
 5551|   434k|                                                                                               end);
 5552|   434k|         ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 5553|   434k|         ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5554|   434k|         if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (5554:14): [True: 406k, False: 28.1k]
  ------------------
 5555|   406k|            ctx.anchors = std::move(temp_ctx.anchors);
 5556|   406k|            return true;
 5557|   406k|         }
 5558|       |         // The line matched "key: value" pattern but parsing failed.
 5559|       |         // This indicates malformed content (e.g., unclosed flow collection),
 5560|       |         // so propagate the error rather than silently falling back to string.
 5561|  28.1k|         ctx.error = temp_ctx.error;
 5562|  28.1k|         ctx.custom_error_message = temp_ctx.custom_error_message;
 5563|  28.1k|         return false;
 5564|   434k|      }
 5565|  2.09M|   }
_ZZN3glz36try_parse_block_mapping_into_variantINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2ELb0ELj1EEERSH_RNSI_12yaml_contextERPKcSO_EEbOT1_OT2_OT3_T4_ENKUlvE_clEv:
 5537|  2.09M|         const bool could_be_mapping = [&] {
 5538|  2.09M|            if constexpr (yaml::check_flow_context(Opts)) {
 5539|  2.09M|               return line_could_be_flow_mapping(it, end);
 5540|       |            }
 5541|       |            else {
 5542|       |               return yaml::line_could_be_block_mapping(it, end);
 5543|       |            }
 5544|  2.09M|         }();
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlRS4_E_clESN_:
 4807|   155k|               auto parse_implicit_null = [&](val_t& val) -> bool {
 4808|       |                  if constexpr (nullable_like<std::remove_cvref_t<val_t>>) {
 4809|       |                     val = {};
 4810|       |                     return true;
 4811|       |                  }
 4812|   155k|                  else if constexpr (std::same_as<std::remove_cvref_t<val_t>, glz::generic>) {
 4813|   155k|                     val = glz::generic{};
 4814|   155k|                     return true;
 4815|       |                  }
 4816|       |                  else {
 4817|       |                     static constexpr std::string_view null_value{"null"};
 4818|       |                     auto null_it = null_value.data();
 4819|       |                     const yaml::yaml_context::scoped_stream literal_stream{ctx, null_value.data()};
 4820|       |                     from<YAML, val_t>::template op<yaml::flow_context_on<Opts>()>(
 4821|       |                        val, ctx, null_it, null_value.data() + null_value.size());
 4822|       |                     return !bool(ctx.error);
 4823|       |                  }
 4824|   155k|               };
_ZN3glz4yaml24parse_block_mapping_loopITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEENS0_12yaml_contextEPKcS5_ZNS_4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES7_EEEEE2opITnDaXtlS2_Lj450ELb1ELb0ELb1ELh2EEERS5_RSB_TkNS_10is_contextERS3_S5_EEvOT1_OT2_OT0_T3_EUlRT_RSL_SH_iE_EEvSQ_RSH_SJ_iOSN_:
 3736|   734k|      {
 3737|       |         // A tagged-variant custom alternative hands its body (at the variant's own column) to a
 3738|       |         // discover-mode reader. Honor the known indent it published so continuation/dedent are
 3739|       |         // judged against the outer parent, not the body itself. One-shot: reset on observation.
 3740|   734k|         if (ctx.forced_block_mapping_indent >= 0) {
  ------------------
  |  Branch (3740:14): [True: 0, False: 734k]
  ------------------
 3741|      0|            if (mapping_indent < 0) {
  ------------------
  |  Branch (3741:17): [True: 0, False: 0]
  ------------------
 3742|      0|               mapping_indent = ctx.forced_block_mapping_indent;
 3743|      0|            }
 3744|      0|            ctx.forced_block_mapping_indent = -1;
 3745|      0|         }
 3746|   734k|         const int32_t parent_indent = ctx.current_indent();
 3747|   734k|         const bool discover_indent = (mapping_indent < 0);
 3748|   734k|         bool first_key = !discover_indent;
 3749|   734k|         bool discovered_first_key_mid_line = false;
 3750|   734k|         int32_t discovered_first_key_visual_indent = 0;
 3751|       |
 3752|  1.94M|         while (it != end) {
  ------------------
  |  Branch (3752:17): [True: 1.65M, False: 281k]
  ------------------
 3753|  1.65M|            auto line_start = it;
 3754|  1.65M|            int32_t line_indent = first_key ? mapping_indent : 0;
  ------------------
  |  Branch (3754:35): [True: 0, False: 1.65M]
  ------------------
 3755|       |
 3756|       |            // Skip blank lines and comments, measure indent
 3757|  1.95M|            while (it != end) {
  ------------------
  |  Branch (3757:20): [True: 1.93M, False: 20.3k]
  ------------------
 3758|  1.93M|               if (*it == '#') {
  ------------------
  |  Branch (3758:20): [True: 35.0k, False: 1.90M]
  ------------------
 3759|  35.0k|                  skip_comment(it, end);
 3760|  35.0k|                  skip_newline(it, end);
 3761|  35.0k|                  first_key = false;
 3762|  35.0k|                  line_indent = 0;
 3763|  35.0k|               }
 3764|  1.90M|               else if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3764:25): [True: 157k, False: 1.74M]
  |  Branch (3764:40): [True: 62.2k, False: 1.68M]
  ------------------
 3765|   219k|                  skip_newline(it, end);
 3766|   219k|                  first_key = false;
 3767|   219k|                  line_indent = 0;
 3768|   219k|               }
 3769|  1.68M|               else if (*it == ' ') {
  ------------------
  |  Branch (3769:25): [True: 590k, False: 1.09M]
  ------------------
 3770|   590k|                  line_start = it;
 3771|   590k|                  line_indent = 0;
 3772|  10.1M|                  while (it != end && *it == ' ') {
  ------------------
  |  Branch (3772:26): [True: 10.1M, False: 3.56k]
  |  Branch (3772:39): [True: 9.53M, False: 586k]
  ------------------
 3773|  9.53M|                     ++line_indent;
 3774|  9.53M|                     ++it;
 3775|  9.53M|                  }
 3776|       |
 3777|   590k|                  bool saw_tab = false;
 3778|   600k|                  while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3778:26): [True: 596k, False: 4.29k]
  |  Branch (3778:40): [True: 1.07k, False: 595k]
  |  Branch (3778:54): [True: 9.48k, False: 586k]
  ------------------
 3779|  10.5k|                     saw_tab = saw_tab || (*it == '\t');
  ------------------
  |  Branch (3779:32): [True: 7.24k, False: 3.31k]
  |  Branch (3779:43): [True: 3.31k, False: 0]
  ------------------
 3780|  10.5k|                     ++it;
 3781|  10.5k|                  }
 3782|       |
 3783|   590k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3783:23): [True: 4.29k, False: 586k]
  |  Branch (3783:36): [True: 11.2k, False: 574k]
  |  Branch (3783:51): [True: 8.79k, False: 565k]
  |  Branch (3783:66): [True: 12.0k, False: 553k]
  ------------------
 3784|  36.4k|                     first_key = false;
 3785|  36.4k|                     line_indent = 0;
 3786|  36.4k|                     continue; // Blank or comment line
 3787|  36.4k|                  }
 3788|       |
 3789|   553k|                  if (saw_tab) {
  ------------------
  |  Branch (3789:23): [True: 129, False: 553k]
  ------------------
 3790|    129|                     ctx.error = error_code::syntax_error;
 3791|    129|                     return;
 3792|    129|                  }
 3793|       |
 3794|       |                  // Early dedent check
 3795|   553k|                  if (mapping_indent >= 0 && line_indent < mapping_indent) {
  ------------------
  |  Branch (3795:23): [True: 549k, False: 3.82k]
  |  Branch (3795:46): [True: 1.46k, False: 548k]
  ------------------
 3796|  1.46k|                     it = line_start;
 3797|  1.46k|                     return;
 3798|  1.46k|                  }
 3799|       |
 3800|   552k|                  first_key = false;
 3801|   552k|                  break; // Found content
 3802|   553k|               }
 3803|  1.09M|               else if (*it == '\t') {
  ------------------
  |  Branch (3803:25): [True: 8.48k, False: 1.08M]
  ------------------
 3804|  8.48k|                  line_start = it;
 3805|  23.1k|                  while (it != end && (*it == ' ' || *it == '\t')) ++it;
  ------------------
  |  Branch (3805:26): [True: 22.3k, False: 722]
  |  Branch (3805:40): [True: 4.17k, False: 18.2k]
  |  Branch (3805:54): [True: 10.4k, False: 7.76k]
  ------------------
 3806|  8.48k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3806:23): [True: 722, False: 7.76k]
  |  Branch (3806:36): [True: 2.21k, False: 5.54k]
  |  Branch (3806:51): [True: 3.19k, False: 2.35k]
  |  Branch (3806:66): [True: 2.01k, False: 339]
  ------------------
 3807|  8.14k|                     first_key = false;
 3808|  8.14k|                     line_indent = 0;
 3809|  8.14k|                     continue; // Blank or comment-only line with tab indentation
 3810|  8.14k|                  }
 3811|    339|                  ctx.error = error_code::syntax_error;
 3812|    339|                  return;
 3813|  8.48k|               }
 3814|  1.08M|               else {
 3815|  1.08M|                  line_start = it;
 3816|  1.08M|                  break; // Content at column 0
 3817|  1.08M|               }
 3818|  1.93M|            }
 3819|       |
 3820|  1.65M|            if (it == end) break;
  ------------------
  |  Branch (3820:17): [True: 20.3k, False: 1.63M]
  ------------------
 3821|       |
 3822|       |            // Document boundaries terminate the current mapping in both discovered
 3823|       |            // and fixed-indent modes.
 3824|  1.63M|            if (at_document_end(it, end) || at_document_start(it, end)) break;
  ------------------
  |  Branch (3824:17): [True: 7.19k, False: 1.62M]
  |  Branch (3824:45): [True: 2.91k, False: 1.62M]
  ------------------
 3825|       |
 3826|       |            // Dedent checks (skip on first key for struct case)
 3827|       |            // Must check BEFORE establishing mapping_indent so the first discovered key
 3828|       |            // isn't rejected by the parent_indent check (mapping_indent is still -1).
 3829|  1.62M|            if (!first_key) {
  ------------------
  |  Branch (3829:17): [True: 1.62M, False: 0]
  ------------------
 3830|       |               // Parent indent check for nested maps (only after mapping_indent established)
 3831|  1.62M|               if (discover_indent && mapping_indent >= 0 && parent_indent >= 0 && line_indent <= parent_indent) {
  ------------------
  |  Branch (3831:20): [True: 1.62M, False: 0]
  |  Branch (3831:39): [True: 894k, False: 732k]
  |  Branch (3831:62): [True: 458k, False: 435k]
  |  Branch (3831:84): [True: 324k, False: 133k]
  ------------------
 3832|   324k|                  it = line_start;
 3833|   324k|                  return;
 3834|   324k|               }
 3835|  1.30M|               if (mapping_indent >= 0 && line_indent < mapping_indent) {
  ------------------
  |  Branch (3835:20): [True: 569k, False: 732k]
  |  Branch (3835:43): [True: 500, False: 568k]
  ------------------
 3836|    500|                  it = line_start;
 3837|    500|                  return;
 3838|    500|               }
 3839|  1.30M|            }
 3840|       |
 3841|       |            // Establish mapping indent from first key (map case)
 3842|  1.30M|            bool established_mapping_indent_this_line = false;
 3843|  1.30M|            if (mapping_indent < 0) {
  ------------------
  |  Branch (3843:17): [True: 732k, False: 568k]
  ------------------
 3844|   732k|               mapping_indent = line_indent;
 3845|   732k|               established_mapping_indent_this_line = true;
 3846|   732k|               discovered_first_key_visual_indent = line_indent;
 3847|   732k|               if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3848|   732k|                  if (ctx.stream_begin && line_start > ctx.stream_begin) {
  ------------------
  |  Branch (3848:23): [True: 732k, False: 0]
  |  Branch (3848:43): [True: 716k, False: 16.1k]
  ------------------
 3849|   716k|                     const auto prefix = ctx.line_prefix_before(line_start);
 3850|   716k|                     if (prefix.has_tab) {
  ------------------
  |  Branch (3850:26): [True: 554, False: 715k]
  ------------------
 3851|    554|                        ctx.error = error_code::syntax_error;
 3852|    554|                        return;
 3853|    554|                     }
 3854|       |
 3855|   715k|                     discovered_first_key_mid_line = prefix.has_content;
 3856|   715k|                     if (mapping_indent == 0 && prefix.column > 0) {
  ------------------
  |  Branch (3856:26): [True: 711k, False: 3.82k]
  |  Branch (3856:49): [True: 645k, False: 66.0k]
  ------------------
 3857|   645k|                        discovered_first_key_visual_indent = prefix.column;
 3858|   645k|                     }
 3859|   715k|                  }
 3860|   732k|               }
 3861|   732k|            }
 3862|       |
 3863|       |            // In discovered-indent block mappings, sibling keys must stay at the same
 3864|       |            // indent level, except when the first key started mid-line (e.g. "--- k: v").
 3865|  1.30M|            if (discover_indent && mapping_indent >= 0 && !established_mapping_indent_this_line &&
  ------------------
  |  Branch (3865:17): [True: 1.30M, False: 554]
  |  Branch (3865:36): [True: 1.30M, False: 0]
  |  Branch (3865:59): [True: 568k, False: 732k]
  ------------------
 3866|   568k|                !discovered_first_key_mid_line) {
  ------------------
  |  Branch (3866:17): [True: 180k, False: 388k]
  ------------------
 3867|   180k|               if (mapping_indent == 0 && discovered_first_key_visual_indent > 0) {
  ------------------
  |  Branch (3867:20): [True: 178k, False: 1.23k]
  |  Branch (3867:43): [True: 68.7k, False: 110k]
  ------------------
 3868|  68.7k|                  if (line_indent > discovered_first_key_visual_indent) {
  ------------------
  |  Branch (3868:23): [True: 73, False: 68.6k]
  ------------------
 3869|     73|                     ctx.error = error_code::syntax_error;
 3870|     73|                     return;
 3871|     73|                  }
 3872|  68.6k|                  if (line_indent < discovered_first_key_visual_indent) {
  ------------------
  |  Branch (3872:23): [True: 4.20k, False: 64.4k]
  ------------------
 3873|  4.20k|                     it = line_start;
 3874|  4.20k|                     return;
 3875|  4.20k|                  }
 3876|  68.6k|               }
 3877|   111k|               else if (line_indent > mapping_indent &&
  ------------------
  |  Branch (3877:25): [True: 2.00k, False: 109k]
  ------------------
 3878|  2.00k|                        (parent_indent < 0 || mapping_indent > 0 ||
  ------------------
  |  Branch (3878:26): [True: 919, False: 1.08k]
  |  Branch (3878:47): [True: 6, False: 1.08k]
  ------------------
 3879|  1.08k|                         (parent_indent >= 0 && mapping_indent == 0 && line_indent > (parent_indent + 1)))) {
  ------------------
  |  Branch (3879:27): [True: 1.08k, False: 0]
  |  Branch (3879:49): [True: 1.08k, False: 0]
  |  Branch (3879:72): [True: 36, False: 1.04k]
  ------------------
 3880|    961|                  ctx.error = error_code::syntax_error;
 3881|    961|                  return;
 3882|    961|               }
 3883|   180k|            }
 3884|       |
 3885|       |            // Sequence indicator check (struct case only - map parser lets key parsing
 3886|       |            // handle '- ' which produces appropriate errors for misindented items)
 3887|  1.29M|            if (!discover_indent && *it == '-' &&
  ------------------
  |  Branch (3887:17): [True: 0, False: 1.29M]
  |  Branch (3887:37): [True: 0, False: 0]
  ------------------
 3888|      0|                ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\t' || *(it + 1) == '\n')) {
  ------------------
  |  Branch (3888:18): [True: 0, False: 0]
  |  Branch (3888:37): [True: 0, False: 0]
  |  Branch (3888:57): [True: 0, False: 0]
  |  Branch (3888:78): [True: 0, False: 0]
  ------------------
 3889|      0|               it = line_start;
 3890|      0|               return;
 3891|      0|            }
 3892|       |
 3893|       |            // Skip indented comment lines
 3894|  1.29M|            if (*it == '#') {
  ------------------
  |  Branch (3894:17): [True: 0, False: 1.29M]
  ------------------
 3895|      0|               skip_comment(it, end);
 3896|      0|               first_key = false;
 3897|      0|               continue;
 3898|      0|            }
 3899|       |
 3900|       |            // Skip blank/empty lines after indent
 3901|  1.29M|            if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3901:17): [True: 554, False: 1.29M]
  |  Branch (3901:32): [True: 0, False: 1.29M]
  ------------------
 3902|      0|               first_key = false;
 3903|      0|               continue;
 3904|      0|            }
 3905|       |
 3906|       |            // While parsing an explicit mapping key node ('? key-node'),
 3907|       |            // a subsequent standalone ':' at the same indentation starts
 3908|       |            // the outer value indicator and must terminate this key-node map.
 3909|       |            // Keep same-line ': x' on the first key-node line valid.
 3910|  1.29M|            if (ctx.explicit_mapping_key_context && !established_mapping_indent_this_line && *it == ':') {
  ------------------
  |  Branch (3910:17): [True: 311k, False: 984k]
  |  Branch (3910:53): [True: 79.6k, False: 231k]
  |  Branch (3910:94): [True: 26.9k, False: 52.7k]
  ------------------
 3911|  26.9k|               const auto after_colon = it + 1;
 3912|  26.9k|               const int32_t explicit_value_indicator_indent = (parent_indent < 0) ? 0 : (parent_indent + 1);
  ------------------
  |  Branch (3912:64): [True: 18.5k, False: 8.38k]
  ------------------
 3913|  26.9k|               if ((after_colon == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
  ------------------
  |  Branch (3913:21): [True: 1.60k, False: 25.3k]
  |  Branch (3913:43): [True: 16.2k, False: 9.08k]
  ------------------
 3914|  17.8k|                   line_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (3914:20): [True: 2.62k, False: 15.2k]
  ------------------
 3915|  2.62k|                  it = line_start;
 3916|  2.62k|                  return;
 3917|  2.62k|               }
 3918|  26.9k|            }
 3919|       |
 3920|       |            // Process this mapping entry (key + colon + value)
 3921|  1.29M|            int32_t effective_line_indent = line_indent;
 3922|  1.29M|            if (discover_indent && established_mapping_indent_this_line &&
  ------------------
  |  Branch (3922:17): [True: 1.29M, False: 554]
  |  Branch (3922:36): [True: 732k, False: 561k]
  ------------------
 3923|   732k|                discovered_first_key_visual_indent > effective_line_indent &&
  ------------------
  |  Branch (3923:17): [True: 645k, False: 86.1k]
  ------------------
 3924|   645k|                !(discovered_first_key_mid_line && parent_indent < 0)) {
  ------------------
  |  Branch (3924:19): [True: 512k, False: 133k]
  |  Branch (3924:52): [True: 66.4k, False: 445k]
  ------------------
 3925|       |               // The first discovered key has no indentation of its own left to measure: it may
 3926|       |               // begin mid-line (a sequence entry's "- key: value"), or the caller may have already
 3927|       |               // consumed the line's indentation before handing the mapping over. Pass its visual
 3928|       |               // column so the entry judges its value against the key's real indent -- otherwise a
 3929|       |               // key with an empty value takes the following sibling line for nested content
 3930|       |               // (issue #2827) and same-line block scalars compute the wrong indentation.
 3931|       |               // The exception is a ROOT mapping whose first key begins mid-line, which means node
 3932|       |               // properties sit ahead of it (`!!str &a1 "foo":`): those belong to the document node
 3933|       |               // rather than to the key's column, so the measured indent stands. Conformance tests
 3934|       |               // 7FWL and HMQ5 pin that case.
 3935|   579k|               effective_line_indent = discovered_first_key_visual_indent;
 3936|   579k|            }
 3937|       |
 3938|  1.29M|            if (!process_entry(ctx, it, end, effective_line_indent)) {
  ------------------
  |  Branch (3938:17): [True: 87.3k, False: 1.20M]
  ------------------
 3939|  87.3k|               return;
 3940|  87.3k|            }
 3941|  1.20M|            first_key = false;
 3942|       |
 3943|  1.20M|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3943:17): [True: 0, False: 1.20M]
  ------------------
 3944|      0|               return;
 3945|       |
 3946|       |            if constexpr (yaml::check_flow_context(Opts)) {
 3947|       |               // In flow context, an implicit "key: value" pair used as a sequence entry
 3948|       |               // ends at ',', ']', or '}'. Let the enclosing flow parser consume it.
 3949|       |               auto flow_end = it;
 3950|       |               skip_flow_ws_and_newlines(ctx, flow_end, end);
 3951|       |               if (bool(ctx.error)) [[unlikely]]
 3952|       |                  return;
 3953|       |               if (flow_end != end && (*flow_end == ',' || *flow_end == ']' || *flow_end == '}')) {
 3954|       |                  it = flow_end;
 3955|       |                  return;
 3956|       |               }
 3957|       |            }
 3958|       |
 3959|       |            // Trailing whitespace handling (peek-ahead pattern).
 3960|       |            // After parsing, iterator may be at leading indent of next line.
 3961|       |            // Don't consume it - let the outer loop handle indent measurement.
 3962|  1.20M|            if (it != end) {
  ------------------
  |  Branch (3962:17): [True: 992k, False: 214k]
  ------------------
 3963|   992k|               if (*it == ' ' || *it == '\t') {
  ------------------
  |  Branch (3963:20): [True: 399k, False: 592k]
  |  Branch (3963:34): [True: 11.3k, False: 581k]
  ------------------
 3964|   410k|                  auto peek = it;
 3965|   410k|                  skip_inline_ws(peek, end);
 3966|   410k|                  if (peek != end && *peek != '\n' && *peek != '\r' && *peek != '#') {
  ------------------
  |  Branch (3966:23): [True: 407k, False: 2.78k]
  |  Branch (3966:38): [True: 398k, False: 9.72k]
  |  Branch (3966:55): [True: 379k, False: 19.0k]
  |  Branch (3966:72): [True: 371k, False: 7.88k]
  ------------------
 3967|   371k|                     continue; // At leading indent of new line
 3968|   371k|                  }
 3969|   410k|               }
 3970|   621k|               skip_inline_ws(it, end);
 3971|   621k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (3971:20): [True: 618k, False: 2.78k]
  |  Branch (3971:33): [True: 24.3k, False: 593k]
  ------------------
 3972|  24.3k|                  if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3973|  24.3k|                     if (it > line_start) {
  ------------------
  |  Branch (3973:26): [True: 24.3k, False: 0]
  ------------------
 3974|  24.3k|                        const char prev = *(it - 1);
 3975|  24.3k|                        if (prev != ' ' && prev != '\t' && prev != '\n' && prev != '\r') {
  ------------------
  |  Branch (3975:29): [True: 9.59k, False: 14.7k]
  |  Branch (3975:44): [True: 5.44k, False: 4.14k]
  |  Branch (3975:60): [True: 3.09k, False: 2.35k]
  |  Branch (3975:76): [True: 34, False: 3.05k]
  ------------------
 3976|     34|                           ctx.error = error_code::syntax_error;
 3977|     34|                           return;
 3978|     34|                        }
 3979|  24.3k|                     }
 3980|  24.3k|                  }
 3981|  24.3k|               }
 3982|  24.3k|               skip_comment(it, end);
 3983|   621k|               if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (3983:20): [True: 617k, False: 3.75k]
  |  Branch (3983:34): [True: 229k, False: 388k]
  |  Branch (3983:49): [True: 170k, False: 217k]
  ------------------
 3984|   399k|                  skip_newline(it, end);
 3985|   399k|               }
 3986|   221k|               else if (it != end) {
  ------------------
  |  Branch (3986:25): [True: 217k, False: 3.75k]
  ------------------
 3987|       |                  // The entry stopped part way along its line with something other than
 3988|       |                  // whitespace or a comment after it -- a ':' its value could not take as a
 3989|       |                  // separator, say. The next pass measures indent as though this were the start
 3990|       |                  // of a line, so what is left of the real one is lost; reject it instead.
 3991|   217k|                  if constexpr (requires { ctx.line_prefix_before(it); }) {
 3992|   217k|                     if (ctx.line_prefix_before(it).has_content) {
  ------------------
  |  Branch (3992:26): [True: 1.21k, False: 216k]
  ------------------
 3993|  1.21k|                        ctx.error = error_code::syntax_error;
 3994|  1.21k|                        return;
 3995|  1.21k|                     }
 3996|   217k|                  }
 3997|   217k|               }
 3998|   621k|            }
 3999|  1.20M|         }
 4000|   734k|      }
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SB_SB_EEbSO_SP_SG_i:
 4927|  1.29M|               ctx, it, end, int32_t(-1), [&](auto& ctx, auto& it, auto end, int32_t line_indent) -> bool {
 4928|  1.29M|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|  1.29M|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 4930|  1.29M|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|  1.29M|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|  1.29M|                           if (ctx.stream_begin) {
 4938|  1.29M|                              auto is_line_content_start = [&](auto pos) {
 4939|  1.29M|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|  1.29M|                              };
 4941|       |
 4942|  1.29M|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|  1.29M|                                 const char* line = ctx.line_begin_of(pos);
 4944|  1.29M|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|  1.29M|                                 return line != end && *line == ':';
 4946|  1.29M|                              };
 4947|       |
 4948|  1.29M|                              if (!is_line_content_start(it) &&
 4949|  1.29M|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
 4950|  1.29M|                                  !line_has_explicit_value_indicator(it)) {
 4951|  1.29M|                                 ctx.error = error_code::syntax_error;
 4952|  1.29M|                                 return false;
 4953|  1.29M|                              }
 4954|  1.29M|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|  1.29M|                           }
 4956|  1.29M|                        }
 4957|       |
 4958|  1.29M|                        if (*it == '-' &&
 4959|  1.29M|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
 4960|  1.29M|                            !line_starts_with_explicit_value_indicator) {
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|  1.29M|                           ctx.error = error_code::syntax_error;
 4963|  1.29M|                           return false;
 4964|  1.29M|                        }
 4965|       |
 4966|  1.29M|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 4967|  1.29M|                           return false;
 4968|  1.29M|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|  1.29M|                        ctx.pop_indent();
 4970|  1.29M|                     }
 4971|  1.29M|                     else {
 4972|  1.29M|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|  1.29M|                        if (nested_indent >= 0) {
 4974|  1.29M|                           yaml::skip_to_content(it, end);
 4975|  1.29M|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
 4976|  1.29M|                              ctx.error = error_code::syntax_error;
 4977|  1.29M|                              return false;
 4978|  1.29M|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|  1.29M|                           const int32_t value_indent =
 4982|  1.29M|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
 4983|  1.29M|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
 4984|  1.29M|                              return false;
 4985|  1.29M|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|  1.29M|                           ctx.pop_indent();
 4987|  1.29M|                        }
 4988|  1.29M|                     }
 4989|  1.29M|                     return !bool(ctx.error);
 4990|  1.29M|                  };
 4991|       |
 4992|       |                  // Explicit key entry form:
 4993|       |                  // ? key
 4994|       |                  // : value
 4995|  1.29M|                  if (*it == '?' && ((it + 1) != end) && *(it + 1) == '\t') {
  ------------------
  |  Branch (4995:23): [True: 353k, False: 939k]
  |  Branch (4995:37): [True: 351k, False: 1.96k]
  |  Branch (4995:58): [True: 9, False: 351k]
  ------------------
 4996|      9|                     ctx.error = error_code::syntax_error;
 4997|      9|                     return false;
 4998|      9|                  }
 4999|  1.29M|                  if (*it == '?' && ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\n' || *(it + 1) == '\r')) {
  ------------------
  |  Branch (4999:23): [True: 353k, False: 939k]
  |  Branch (4999:38): [True: 1.96k, False: 351k]
  |  Branch (4999:57): [True: 115k, False: 236k]
  |  Branch (4999:77): [True: 113k, False: 122k]
  |  Branch (4999:98): [True: 113k, False: 9.03k]
  ------------------
 5000|   344k|                     ++it; // skip '?'
 5001|   344k|                     yaml::skip_inline_ws(it, end);
 5002|       |
 5003|   344k|                     const int32_t explicit_value_indicator_indent =
 5004|   344k|                        (ctx.current_indent() < 0) ? 0 : (ctx.current_indent() + 1);
  ------------------
  |  Branch (5004:25): [True: 151k, False: 193k]
  ------------------
 5005|       |
 5006|   344k|                     key_t key{};
 5007|   344k|                     if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5008|   344k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   344k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   344k|                        };
 5011|       |
 5012|   344k|                        auto key_it = it;
 5013|   344k|                        yaml::skip_inline_ws(key_it, end);
 5014|       |
 5015|   344k|                        auto content = key_it;
 5016|   344k|                        yaml::skip_to_content(content, end);
 5017|   344k|                        bool handled_anchor_only_empty_key = false;
 5018|       |
 5019|       |                        // Anchor on an empty explicit key node:
 5020|       |                        //   ? &a
 5021|       |                        //   : value
 5022|   344k|                        if (content != end && *content == '&') {
  ------------------
  |  Branch (5022:29): [True: 331k, False: 12.6k]
  |  Branch (5022:47): [True: 61.4k, False: 270k]
  ------------------
 5023|  61.4k|                           auto anchor_probe = content + 1;
 5024|  61.4k|                           auto anchor_name = yaml::parse_anchor_name(anchor_probe, end);
 5025|  61.4k|                           if (!anchor_name.empty()) {
  ------------------
  |  Branch (5025:32): [True: 61.4k, False: 45]
  ------------------
 5026|  61.4k|                              auto after_anchor = anchor_probe;
 5027|  61.4k|                              yaml::skip_inline_ws(after_anchor, end);
 5028|       |
 5029|  61.4k|                              auto value_indicator = after_anchor;
 5030|  61.4k|                              if (value_indicator != end && *value_indicator == ':') {
  ------------------
  |  Branch (5030:35): [True: 59.9k, False: 1.48k]
  |  Branch (5030:61): [True: 5.58k, False: 54.3k]
  ------------------
 5031|  5.58k|                                 key.clear();
 5032|  5.58k|                                 ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5033|  5.58k|                                 it = value_indicator;
 5034|  5.58k|                                 handled_anchor_only_empty_key = true;
 5035|  5.58k|                              }
 5036|  55.8k|                              else {
 5037|  55.8k|                                 if (value_indicator != end && *value_indicator == '#') {
  ------------------
  |  Branch (5037:38): [True: 54.3k, False: 1.48k]
  |  Branch (5037:64): [True: 2.30k, False: 52.0k]
  ------------------
 5038|  2.30k|                                    yaml::skip_comment(value_indicator, end);
 5039|  2.30k|                                 }
 5040|  55.8k|                                 if (value_indicator != end && (*value_indicator == '\n' || *value_indicator == '\r')) {
  ------------------
  |  Branch (5040:38): [True: 53.9k, False: 1.94k]
  |  Branch (5040:65): [True: 11.3k, False: 42.5k]
  |  Branch (5040:93): [True: 11.6k, False: 30.9k]
  ------------------
 5041|  22.9k|                                    yaml::skip_newline(value_indicator, end);
 5042|  22.9k|                                    auto value_line = value_indicator;
 5043|  22.9k|                                    int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5044|  22.9k|                                    if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5044:41): [True: 6, False: 22.9k]
  ------------------
 5045|      6|                                       return false;
 5046|  22.9k|                                    if (value_line != end && *value_line == ':' &&
  ------------------
  |  Branch (5046:41): [True: 20.4k, False: 2.47k]
  |  Branch (5046:62): [True: 3.03k, False: 17.4k]
  ------------------
 5047|  3.03k|                                        value_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (5047:41): [True: 2.99k, False: 41]
  ------------------
 5048|  2.99k|                                       key.clear();
 5049|  2.99k|                                       ctx.anchors[std::string(anchor_name)] = {content, content, ctx.current_indent()};
 5050|  2.99k|                                       it = value_line;
 5051|  2.99k|                                       handled_anchor_only_empty_key = true;
 5052|  2.99k|                                    }
 5053|  19.9k|                                    else if (value_line != end && *value_line == ':') {
  ------------------
  |  Branch (5053:46): [True: 17.5k, False: 2.47k]
  |  Branch (5053:67): [True: 41, False: 17.4k]
  ------------------
 5054|       |                                       // In explicit-key form ("? &a"), a following ':'
 5055|       |                                       // starts the outer value indicator only at the same
 5056|       |                                       // indentation. A deeper-indented ': value' is malformed.
 5057|     41|                                       ctx.error = error_code::syntax_error;
 5058|     41|                                       return false;
 5059|     41|                                    }
 5060|  22.9k|                                 }
 5061|  55.8k|                              }
 5062|  61.4k|                           }
 5063|  61.4k|                        }
 5064|       |
 5065|   344k|                        const bool key_content_spans_lines = [&] {
 5066|   344k|                           auto scan = key_it;
 5067|   344k|                           while (scan != content && scan != end) {
 5068|   344k|                              if (*scan == '\n' || *scan == '\r') return true;
 5069|   344k|                              ++scan;
 5070|   344k|                           }
 5071|   344k|                           return false;
 5072|   344k|                        }();
 5073|       |
 5074|   344k|                        if (handled_anchor_only_empty_key) {
  ------------------
  |  Branch (5074:29): [True: 8.57k, False: 335k]
  ------------------
 5075|       |                           // 'it' already points to the explicit value indicator ':'
 5076|  8.57k|                        }
 5077|   335k|                        else if (content == end || (*content == ':' && key_content_spans_lines)) {
  ------------------
  |  Branch (5077:34): [True: 12.6k, False: 323k]
  |  Branch (5077:53): [True: 53.0k, False: 269k]
  |  Branch (5077:72): [True: 50.0k, False: 3.02k]
  ------------------
 5078|  62.6k|                           key.clear();
 5079|  62.6k|                           it = content;
 5080|  62.6k|                        }
 5081|   273k|                        else {
 5082|       |                           // Explicit mapping keys ('? key-node') are full YAML nodes.
 5083|       |                           // Parse the key node structurally (not via plain-key scanning)
 5084|       |                           // so inputs like '? []: x' and '? JSON: like' are interpreted
 5085|       |                           // as complex keys, not split into implicit key/value pairs.
 5086|   273k|                           auto key_node_it = content;
 5087|   273k|                           auto key_node_end = end;
 5088|   273k|                           if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 5089|       |                              // In explicit-key form, a following standalone ':'
 5090|       |                              // line (same or lower indentation) belongs to the
 5091|       |                              // outer mapping value, not the key node itself.
 5092|   273k|                              auto scan = content;
 5093|  6.23M|                              while (scan != end) {
  ------------------
  |  Branch (5093:38): [True: 6.08M, False: 151k]
  ------------------
 5094|  94.9M|                                 while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (5094:41): [True: 94.8M, False: 72.8k]
  |  Branch (5094:56): [True: 91.8M, False: 3.02M]
  |  Branch (5094:73): [True: 88.8M, False: 2.98M]
  ------------------
 5095|  88.8M|                                    ++scan;
 5096|  88.8M|                                 }
 5097|  6.08M|                                 if (scan == end) {
  ------------------
  |  Branch (5097:38): [True: 72.8k, False: 6.01M]
  ------------------
 5098|  72.8k|                                    break;
 5099|  72.8k|                                 }
 5100|       |
 5101|  6.01M|                                 yaml::skip_newline(scan, end);
 5102|  6.01M|                                 auto line_start = scan;
 5103|       |
 5104|  6.01M|                                 int32_t indicator_indent = 0;
 5105|  15.0M|                                 while (scan != end && *scan == ' ') {
  ------------------
  |  Branch (5105:41): [True: 14.9M, False: 151k]
  |  Branch (5105:56): [True: 9.05M, False: 5.85M]
  ------------------
 5106|  9.05M|                                    ++indicator_indent;
 5107|  9.05M|                                    ++scan;
 5108|  9.05M|                                 }
 5109|       |
 5110|  6.01M|                                 if (scan != end && *scan == ':') {
  ------------------
  |  Branch (5110:38): [True: 5.85M, False: 151k]
  |  Branch (5110:53): [True: 213k, False: 5.64M]
  ------------------
 5111|   213k|                                    const auto after_colon = scan + 1;
 5112|   213k|                                    if ((after_colon == end ||
  ------------------
  |  Branch (5112:42): [True: 1.25k, False: 212k]
  ------------------
 5113|   212k|                                         yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_colon)]) &&
  ------------------
  |  Branch (5113:42): [True: 140k, False: 71.6k]
  ------------------
 5114|   142k|                                        indicator_indent <= line_indent) {
  ------------------
  |  Branch (5114:41): [True: 48.2k, False: 93.9k]
  ------------------
 5115|  48.2k|                                       key_node_end = line_start;
 5116|  48.2k|                                       break;
 5117|  48.2k|                                    }
 5118|   213k|                                 }
 5119|  6.01M|                              }
 5120|   273k|                           }
 5121|       |
 5122|   273k|                           glz::generic key_node{};
 5123|   273k|                           const bool prev_explicit_mapping_key_context = ctx.explicit_mapping_key_context;
 5124|   273k|                           ctx.explicit_mapping_key_context = true;
 5125|   273k|                           from<YAML, glz::generic>::template op<Opts>(key_node, ctx, key_node_it, key_node_end);
 5126|   273k|                           ctx.explicit_mapping_key_context = prev_explicit_mapping_key_context;
 5127|   273k|                           if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5127:32): [True: 19.1k, False: 253k]
  ------------------
 5128|  19.1k|                              return false;
 5129|   253k|                           it = key_node_it;
 5130|   253k|                           if (!to_string_key(key_node)) [[unlikely]]
  ------------------
  |  Branch (5130:32): [True: 56, False: 253k]
  ------------------
 5131|     56|                              return false;
 5132|   253k|                        }
 5133|       |                     }
 5134|       |                     else {
 5135|       |                        if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 5136|       |                           from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5137|       |                           if (bool(ctx.error)) [[unlikely]]
 5138|       |                              return false;
 5139|       |                        }
 5140|       |                     }
 5141|       |
 5142|   325k|                     yaml::skip_inline_ws(it, end);
 5143|   344k|                     yaml::skip_comment(it, end);
 5144|       |
 5145|       |                     // Value indicator may appear on the next line at the same indent.
 5146|   344k|                     if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (5146:26): [True: 245k, False: 98.6k]
  |  Branch (5146:40): [True: 52.7k, False: 192k]
  |  Branch (5146:55): [True: 57.2k, False: 135k]
  ------------------
 5147|   110k|                        auto probe = it;
 5148|   110k|                        bool found_value_indicator = false;
 5149|       |
 5150|   178k|                        while (probe != end && (*probe == '\n' || *probe == '\r')) {
  ------------------
  |  Branch (5150:32): [True: 135k, False: 43.0k]
  |  Branch (5150:49): [True: 61.0k, False: 74.1k]
  |  Branch (5150:67): [True: 74.0k, False: 66]
  ------------------
 5151|   135k|                           yaml::skip_newline(probe, end);
 5152|       |
 5153|   135k|                           auto value_line = probe;
 5154|   135k|                           int32_t value_indent = yaml::measure_indent(value_line, end, ctx);
 5155|   135k|                           if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5155:32): [True: 8, False: 135k]
  ------------------
 5156|      8|                              return false;
 5157|       |
 5158|   135k|                           if (value_line == end || *value_line == '\n' || *value_line == '\r') {
  ------------------
  |  Branch (5158:32): [True: 42.3k, False: 92.7k]
  |  Branch (5158:53): [True: 4.98k, False: 87.7k]
  |  Branch (5158:76): [True: 13.9k, False: 73.7k]
  ------------------
 5159|  61.3k|                              probe = value_line;
 5160|  61.3k|                              continue; // blank line
 5161|  61.3k|                           }
 5162|  73.7k|                           if (*value_line == '#') {
  ------------------
  |  Branch (5162:32): [True: 6.92k, False: 66.8k]
  ------------------
 5163|  6.92k|                              yaml::skip_comment(value_line, end);
 5164|  6.92k|                              probe = value_line;
 5165|  6.92k|                              continue; // comment-only line
 5166|  6.92k|                           }
 5167|  66.8k|                           if (*value_line == ':' && value_indent == explicit_value_indicator_indent) {
  ------------------
  |  Branch (5167:32): [True: 11.9k, False: 54.8k]
  |  Branch (5167:54): [True: 6.16k, False: 5.83k]
  ------------------
 5168|  6.16k|                              it = value_line;
 5169|  6.16k|                              found_value_indicator = true;
 5170|  6.16k|                           }
 5171|  66.8k|                           break;
 5172|  73.7k|                        }
 5173|       |
 5174|   110k|                        if (found_value_indicator) {
  ------------------
  |  Branch (5174:29): [True: 6.16k, False: 103k]
  ------------------
 5175|  6.16k|                           yaml::skip_inline_ws(it, end);
 5176|  6.16k|                        }
 5177|   110k|                     }
 5178|       |
 5179|   344k|                     val_t val{};
 5180|   344k|                     if (it != end && *it == ':') {
  ------------------
  |  Branch (5180:26): [True: 245k, False: 98.6k]
  |  Branch (5180:39): [True: 118k, False: 126k]
  ------------------
 5181|   118k|                        ++it;
 5182|   118k|                        if (it != end && *it == '\t') {
  ------------------
  |  Branch (5182:29): [True: 118k, False: 818]
  |  Branch (5182:42): [True: 20, False: 118k]
  ------------------
 5183|     20|                           ctx.error = error_code::syntax_error;
 5184|     20|                           return false;
 5185|     20|                        }
 5186|   118k|                        if (it != end && (*it == '\n' || *it == '\r')) {
  ------------------
  |  Branch (5186:29): [True: 118k, False: 818]
  |  Branch (5186:43): [True: 5.53k, False: 112k]
  |  Branch (5186:58): [True: 50.1k, False: 62.4k]
  ------------------
 5187|  55.6k|                           auto probe = it;
 5188|  55.6k|                           yaml::skip_newline(probe, end);
 5189|   174k|                           while (probe != end && *probe == ' ') ++probe;
  ------------------
  |  Branch (5189:35): [True: 171k, False: 2.91k]
  |  Branch (5189:51): [True: 118k, False: 52.7k]
  ------------------
 5190|  55.6k|                           if (probe != end && *probe == ':' && ((probe + 1) != end) && *(probe + 1) == '\t') {
  ------------------
  |  Branch (5190:32): [True: 52.7k, False: 2.91k]
  |  Branch (5190:48): [True: 16.4k, False: 36.2k]
  |  Branch (5190:65): [True: 15.6k, False: 766]
  |  Branch (5190:89): [True: 6, False: 15.6k]
  ------------------
 5191|      6|                              ctx.error = error_code::syntax_error;
 5192|      6|                              return false;
 5193|      6|                           }
 5194|  55.6k|                        }
 5195|   118k|                        yaml::skip_inline_ws(it, end);
 5196|   118k|                        if (!parse_map_value(val)) [[unlikely]]
  ------------------
  |  Branch (5196:29): [True: 1.41k, False: 117k]
  ------------------
 5197|  1.41k|                           return false;
 5198|   118k|                     }
 5199|       |
 5200|   342k|                     value.emplace(std::move(key), std::move(val));
 5201|   342k|                     return true;
 5202|   344k|                  }
 5203|       |
 5204|   948k|                  key_t key{};
 5205|   948k|                  if constexpr (std::same_as<std::remove_cvref_t<key_t>, std::string>) {
 5206|   948k|                     auto key_probe = it;
 5207|   948k|                     yaml::skip_inline_ws(key_probe, end);
 5208|   948k|                     const bool complex_flow_key = (key_probe != end && (*key_probe == '[' || *key_probe == '{'));
  ------------------
  |  Branch (5208:53): [True: 948k, False: 0]
  |  Branch (5208:74): [True: 5.25k, False: 943k]
  |  Branch (5208:95): [True: 2.17k, False: 941k]
  ------------------
 5209|   948k|                     if (complex_flow_key) {
  ------------------
  |  Branch (5209:26): [True: 7.42k, False: 941k]
  ------------------
 5210|  7.42k|                        glz::generic key_node{};
 5211|  7.42k|                        from<YAML, glz::generic>::template op<yaml::flow_context_on<Opts>()>(key_node, ctx, it, end);
 5212|  7.42k|                        if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (5212:29): [True: 1.34k, False: 6.08k]
  ------------------
 5213|  1.34k|                           return false;
 5214|  6.08k|                        if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (5214:29): [True: 4, False: 6.07k]
  ------------------
 5215|      4|                           return false;
 5216|  6.08k|                     }
 5217|   941k|                     else {
 5218|   941k|                        if (!yaml::parse_yaml_key(key, ctx, it, end, false)) {
  ------------------
  |  Branch (5218:29): [True: 8.23k, False: 933k]
  ------------------
 5219|  8.23k|                           return false;
 5220|  8.23k|                        }
 5221|   941k|                     }
 5222|       |                  }
 5223|       |                  else {
 5224|       |                     from<YAML, key_t>::template op<Opts>(key, ctx, it, end);
 5225|       |                     if (bool(ctx.error)) [[unlikely]]
 5226|       |                        return false;
 5227|       |                  }
 5228|       |
 5229|   939k|                  yaml::skip_inline_ws(it, end);
 5230|       |
 5231|   948k|                  if (it == end || *it != ':') {
  ------------------
  |  Branch (5231:23): [True: 10.3k, False: 938k]
  |  Branch (5231:36): [True: 2.42k, False: 935k]
  ------------------
 5232|  3.23k|                     ctx.error = error_code::syntax_error;
 5233|  3.23k|                     return false;
 5234|  3.23k|                  }
 5235|   945k|                  ++it;
 5236|   945k|                  yaml::skip_inline_ws(it, end);
 5237|       |
 5238|   945k|                  val_t val{};
 5239|   945k|                  if (!parse_map_value(val)) [[unlikely]]
  ------------------
  |  Branch (5239:23): [True: 53.7k, False: 891k]
  ------------------
 5240|  53.7k|                     return false;
 5241|       |
 5242|   891k|                  value.emplace(std::move(key), std::move(val));
 5243|   891k|                  return true;
 5244|   945k|               });
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SB_SB_EEbSO_SP_SG_iENKUlvE_clEv:
 5065|   344k|                        const bool key_content_spans_lines = [&] {
 5066|   344k|                           auto scan = key_it;
 5067|   363k|                           while (scan != content && scan != end) {
  ------------------
  |  Branch (5067:35): [True: 250k, False: 113k]
  |  Branch (5067:54): [True: 250k, False: 0]
  ------------------
 5068|   250k|                              if (*scan == '\n' || *scan == '\r') return true;
  ------------------
  |  Branch (5068:35): [True: 115k, False: 135k]
  |  Branch (5068:52): [True: 116k, False: 19.6k]
  ------------------
 5069|  19.6k|                              ++scan;
 5070|  19.6k|                           }
 5071|   113k|                           return false;
 5072|   344k|                        }();
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SB_SB_EEbSO_SP_SG_iENKUlRS4_E0_clESS_:
 5008|   253k|                        auto to_string_key = [&](glz::generic& key_node) {
 5009|   253k|                           return yaml::materialize_key(key, key_node, ctx);
 5010|   253k|                        };
_ZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SB_SB_EEbSO_SP_SG_iENKUlRS4_E_clESS_:
 4928|  1.05M|                  auto parse_map_value = [&](val_t& val) -> bool {
 4929|  1.05M|                     if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (4929:26): [True: 1.03M, False: 21.8k]
  |  Branch (4929:39): [True: 743k, False: 289k]
  ------------------
 4930|   743k|                        bool line_starts_with_explicit_value_indicator = false;
 4931|       |
 4932|       |                        // Inline mapping values in block context cannot start with a
 4933|       |                        // plain "key: value" pair on the same line (e.g. "a: b: c").
 4934|       |                        // Such constructs are malformed unless wrapped in flow
 4935|       |                        // delimiters ({...} / [...]) or quoted.
 4936|   743k|                        if constexpr (std::is_pointer_v<std::decay_t<decltype(it)>>) {
 4937|   743k|                           if (ctx.stream_begin) {
  ------------------
  |  Branch (4937:32): [True: 743k, False: 0]
  ------------------
 4938|   743k|                              auto is_line_content_start = [&](auto pos) {
 4939|   743k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   743k|                              };
 4941|       |
 4942|   743k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   743k|                                 const char* line = ctx.line_begin_of(pos);
 4944|   743k|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
 4945|   743k|                                 return line != end && *line == ':';
 4946|   743k|                              };
 4947|       |
 4948|   743k|                              if (!is_line_content_start(it) &&
  ------------------
  |  Branch (4948:35): [True: 743k, False: 0]
  ------------------
 4949|   743k|                                  yaml::inline_value_has_plain_mapping_indicator(it, end) &&
  ------------------
  |  Branch (4949:35): [True: 126k, False: 617k]
  ------------------
 4950|   126k|                                  !line_has_explicit_value_indicator(it)) {
  ------------------
  |  Branch (4950:35): [True: 571, False: 125k]
  ------------------
 4951|    571|                                 ctx.error = error_code::syntax_error;
 4952|    571|                                 return false;
 4953|    571|                              }
 4954|   742k|                              line_starts_with_explicit_value_indicator = line_has_explicit_value_indicator(it);
 4955|   742k|                           }
 4956|   743k|                        }
 4957|       |
 4958|   743k|                        if (*it == '-' &&
  ------------------
  |  Branch (4958:29): [True: 10.6k, False: 732k]
  ------------------
 4959|  10.6k|                            ((it + 1) == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*(it + 1))]) &&
  ------------------
  |  Branch (4959:30): [True: 284, False: 10.3k]
  |  Branch (4959:49): [True: 1.37k, False: 9.02k]
  ------------------
 4960|  1.65k|                            !line_starts_with_explicit_value_indicator) {
  ------------------
  |  Branch (4960:29): [True: 33, False: 1.62k]
  ------------------
 4961|       |                           // "key: - item" is not valid block sequence syntax.
 4962|     33|                           ctx.error = error_code::syntax_error;
 4963|     33|                           return false;
 4964|     33|                        }
 4965|       |
 4966|   743k|                        if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
  ------------------
  |  Branch (4966:29): [True: 0, False: 743k]
  ------------------
 4967|      0|                           return false;
 4968|   743k|                        from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4969|   743k|                        ctx.pop_indent();
 4970|   743k|                     }
 4971|   311k|                     else {
 4972|   311k|                        int32_t nested_indent = yaml::detect_nested_value_indent(ctx, it, end, line_indent);
 4973|   311k|                        if (nested_indent >= 0) {
  ------------------
  |  Branch (4973:29): [True: 104k, False: 207k]
  ------------------
 4974|   104k|                           yaml::skip_to_content(it, end);
 4975|   104k|                           if (it != end && *it == ':' && (it + 1) != end && *(it + 1) == '\t') {
  ------------------
  |  Branch (4975:32): [True: 104k, False: 0]
  |  Branch (4975:45): [True: 0, False: 104k]
  |  Branch (4975:59): [True: 0, False: 0]
  |  Branch (4975:78): [True: 0, False: 0]
  ------------------
 4976|      0|                              ctx.error = error_code::syntax_error;
 4977|      0|                              return false;
 4978|      0|                           }
 4979|       |                           // A struct value reads the pushed indent as its own key column;
 4980|       |                           // every other value type reads it as the enclosing baseline.
 4981|   104k|                           const int32_t value_indent =
 4982|   104k|                              yaml::receives_block_mapping_column<val_t>() ? nested_indent : nested_indent - 1;
  ------------------
  |  Branch (4982:31): [Folded, False: 104k]
  ------------------
 4983|   104k|                           if (!ctx.push_indent(value_indent)) [[unlikely]]
  ------------------
  |  Branch (4983:32): [True: 0, False: 104k]
  ------------------
 4984|      0|                              return false;
 4985|   104k|                           from<YAML, val_t>::template op<Opts>(val, ctx, it, end);
 4986|   104k|                           ctx.pop_indent();
 4987|   104k|                        }
 4988|   311k|                     }
 4989|  1.05M|                     return !bool(ctx.error);
 4990|  1.05M|                  };
_ZZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SB_SB_EEbSO_SP_SG_iENKUlRS4_E_clESS_ENKUlSN_E_clISB_EEDaSN_:
 4938|   743k|                              auto is_line_content_start = [&](auto pos) {
 4939|   743k|                                 return !ctx.line_prefix_before(pos).has_content;
 4940|   743k|                              };
_ZZZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_ENKUlRT_RSK_SG_iE_clISE_SB_SB_EEbSO_SP_SG_iENKUlRS4_E_clESS_ENKUlSN_E0_clISB_EEDaSN_:
 4942|   868k|                              auto line_has_explicit_value_indicator = [&](auto pos) {
 4943|   868k|                                 const char* line = ctx.line_begin_of(pos);
 4944|  3.78M|                                 while (line != end && (*line == ' ' || *line == '\t')) ++line;
  ------------------
  |  Branch (4944:41): [True: 3.78M, False: 0]
  |  Branch (4944:57): [True: 2.91M, False: 870k]
  |  Branch (4944:73): [True: 1.49k, False: 868k]
  ------------------
 4945|   868k|                                 return line != end && *line == ':';
  ------------------
  |  Branch (4945:41): [True: 868k, False: 0]
  |  Branch (4945:56): [True: 616k, False: 252k]
  ------------------
 4946|   868k|                              };
_ZZN3glz4fromILj450ENS_17ordered_small_mapINS_12generic_jsonILNS_8num_modeE0ES1_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRS5_TkNS_10is_contextERNS8_12yaml_contextESB_EEvOT1_OT2_OT0_T3_EN19merge_restore_guardD2Ev:
 4696|   812k|            {
 4697|       |               // emplace is a no-op for keys the document already wrote, so only
 4698|       |               // untouched pre-existing entries are put back.
 4699|   812k|               for (auto& entry : saved) {
  ------------------
  |  Branch (4699:33): [True: 0, False: 812k]
  ------------------
 4700|      0|                  target.emplace(entry.first, std::move(entry.second));
 4701|      0|               }
 4702|   812k|            }
_ZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE10redispatchITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRSH_TkNS_10is_contextERNSK_12yaml_contextESN_EEvOT1_OT2_OT0_T3_:
 6762|   255k|      {
 6763|   255k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 6764|   255k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (6764:14): [True: 9, False: 255k]
  ------------------
 6765|      9|            return;
 6766|   255k|         op<Opts>(value, ctx, it, end);
 6767|   255k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEERNSt3__17variantIJDndNS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbNS3_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS8_ISF_EEEENSE_ISF_EEEEENS0_12yaml_contextEPKcSN_EEbOT0_RT1_RT2_T3_:
  309|   251k|      {
  310|   251k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 251k]
  |  Branch (310:27): [True: 0, False: 251k]
  ------------------
  311|       |
  312|   251k|         ++it; // skip '*'
  313|   251k|         auto name = parse_anchor_name(it, end);
  314|   251k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 465, False: 251k]
  ------------------
  315|    465|            ctx.error = error_code::syntax_error;
  316|    465|            return true;
  317|    465|         }
  318|       |
  319|   251k|         auto anchor_it = ctx.anchors.find(name);
  320|   251k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 2.26k, False: 248k]
  ------------------
  321|  2.26k|            ctx.error = error_code::syntax_error; // undefined alias
  322|  2.26k|            return true;
  323|  2.26k|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|   248k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|   248k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 3.31k, False: 245k]
  ------------------
  331|  3.31k|            return true;
  332|  3.31k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|   245k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 125, False: 245k]
  ------------------
  338|    125|            ctx.error = error_code::syntax_error; // cyclic alias
  339|    125|            return true;
  340|    125|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|   245k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|   245k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 6, False: 245k]
  ------------------
  348|      6|            return true;
  349|       |
  350|   245k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 18, False: 245k]
  ------------------
  351|     18|            ctx.error = error_code::exceeded_max_expansion;
  352|     18|            ctx.custom_error_message = "alias expansion";
  353|     18|            return true;
  354|     18|         }
  355|       |
  356|   245k|         auto replay_it = span.begin;
  357|   245k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|   245k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|   245k|         ctx.indent_stack.clear();
  362|   245k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 148k, False: 96.5k]
  ------------------
  363|   148k|            ctx.push_indent(span.base_indent - 1);
  364|   148k|         }
  365|       |
  366|   245k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|   245k|         using V = std::remove_cvref_t<T>;
  369|   245k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|   245k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|   245k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|   245k|         return true;
  376|   245k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_19is_yaml_variant_strEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERSH_TkNS_10is_contextERNSL_12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   288k|      {
 5356|   288k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   288k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   288k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   288k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   288k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 288k, False: 0]
  ------------------
 5366|   288k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   288k|      }
_ZN3glz4fromILj450ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRS7_TkNS_10is_contextERNSA_12yaml_contextESD_EEvOT1_OT2_OT0_T3_:
 1987|   297k|      {
 1988|   297k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (1988:14): [True: 26.4k, False: 271k]
  ------------------
 1989|  26.4k|            return;
 1990|       |
 1991|   271k|         yaml::node_preamble_state preamble{};
 1992|   271k|         if (yaml::parse_node_preamble<Opts, yaml::node_property_policy{true, false, false, true}>(
  ------------------
  |  Branch (1992:14): [True: 11.7k, False: 259k]
  ------------------
 1993|   271k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_string(tag); }))
 1994|  11.7k|            return;
 1995|       |
 1996|   259k|         std::string str;
 1997|   259k|         const auto style = yaml::detect_scalar_style(*it);
 1998|       |
 1999|   259k|         switch (style) {
  ------------------
  |  Branch (1999:18): [True: 259k, False: 0]
  ------------------
 2000|  3.95k|         case yaml::scalar_style::double_quoted:
  ------------------
  |  Branch (2000:10): [True: 3.95k, False: 255k]
  ------------------
 2001|  3.95k|            yaml::parse_double_quoted_string(str, ctx, it, end);
 2002|  3.95k|            break;
 2003|  2.16k|         case yaml::scalar_style::single_quoted:
  ------------------
  |  Branch (2003:10): [True: 2.16k, False: 257k]
  ------------------
 2004|  2.16k|            yaml::parse_single_quoted_string(str, ctx, it, end);
 2005|  2.16k|            break;
 2006|  1.12k|         case yaml::scalar_style::literal_block:
  ------------------
  |  Branch (2006:10): [True: 1.12k, False: 258k]
  ------------------
 2007|  4.85k|         case yaml::scalar_style::folded_block:
  ------------------
  |  Branch (2007:10): [True: 3.72k, False: 256k]
  ------------------
 2008|       |            // For same-line mapping/sequence values, parsing context is typically pushed
 2009|       |            // one column past the key/item indicator; block scalar indentation is relative
 2010|       |            // to the parent line indent.
 2011|  4.85k|            yaml::parse_block_scalar(str, ctx, it, end,
 2012|  4.85k|                                     ctx.current_indent() > 0 ? (ctx.current_indent() - 1) : ctx.current_indent());
  ------------------
  |  Branch (2012:38): [True: 1.78k, False: 3.06k]
  ------------------
 2013|  4.85k|            break;
 2014|   248k|         case yaml::scalar_style::plain:
  ------------------
  |  Branch (2014:10): [True: 248k, False: 10.9k]
  ------------------
 2015|       |            // A collection where a string is expected is a type mismatch. Reading it as a
 2016|       |            // plain scalar would store its source text, and for a block sequence only the
 2017|       |            // first entry, as the value.
 2018|   248k|            if (yaml::plain_scalar_starts_collection(it, end)) [[unlikely]] {
  ------------------
  |  Branch (2018:17): [True: 189, False: 248k]
  ------------------
 2019|    189|               ctx.error = error_code::syntax_error;
 2020|    189|               return;
 2021|    189|            }
 2022|       |            // In block context with known indent, use multiline parsing to support
 2023|       |            // plain scalars that span multiple lines (folding behavior)
 2024|   248k|            if constexpr (!yaml::check_flow_context(Opts)) {
 2025|   248k|               if (ctx.current_indent() >= 0) {
  ------------------
  |  Branch (2025:20): [True: 204k, False: 44.4k]
  ------------------
 2026|   204k|                  yaml::parse_plain_scalar_multiline(str, ctx, it, end, ctx.current_indent());
 2027|   204k|               }
 2028|  44.4k|               else {
 2029|       |                  // Top-level plain scalars may continue on same-indent or indented lines.
 2030|  44.4k|                  yaml::parse_plain_scalar_multiline(str, ctx, it, end, int32_t(0));
 2031|  44.4k|               }
 2032|       |            }
 2033|       |            else {
 2034|       |               yaml::parse_plain_scalar(str, ctx, it, end, true);
 2035|       |            }
 2036|   248k|            break;
 2037|   259k|         }
 2038|       |
 2039|   259k|         if (!bool(ctx.error)) {
  ------------------
  |  Branch (2039:14): [True: 246k, False: 12.6k]
  ------------------
 2040|   246k|            value = std::move(str);
 2041|   246k|            yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 2042|   246k|         }
 2043|   259k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEEXtlNS0_20node_property_policyELb1ELb0ELb0ELb1EEELb0ERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_12yaml_contextEPKcSE_ZNS_4fromILj450ESA_E2opITnDaXtlS2_Lj450ELb1ELb0ELb1ELh2EEERSE_SB_TkNS_10is_contextERSC_SE_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSN_RSQ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   271k|      {
  475|   271k|         skip_inline_ws(it, end);
  476|       |
  477|   271k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 21, False: 271k]
  ------------------
  478|     21|            if constexpr (!AllowEmptyInput) {
  479|     21|               ctx.error = error_code::unexpected_end;
  480|     21|            }
  481|     21|            return true;
  482|     21|         }
  483|       |
  484|   271k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   271k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 21, False: 271k]
  ------------------
  486|     21|            ctx.error = error_code::syntax_error;
  487|     21|            return true;
  488|     21|         }
  489|   271k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 25, False: 271k]
  ------------------
  490|     25|            ctx.error = error_code::syntax_error;
  491|     25|            return true;
  492|     25|         }
  493|       |
  494|   271k|         skip_inline_ws(it, end);
  495|       |
  496|   271k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 29, False: 271k]
  ------------------
  497|     29|            if constexpr (!AllowEmptyInput) {
  498|     29|               ctx.error = error_code::unexpected_end;
  499|     29|            }
  500|     29|            return true;
  501|     29|         }
  502|       |
  503|   271k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 11.6k, False: 259k]
  ------------------
  504|  11.6k|            return true;
  505|  11.6k|         }
  506|       |
  507|   259k|         return false;
  508|   271k|      }
_ZZN3glz4fromILj450ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRS7_TkNS_10is_contextERNSA_12yaml_contextESD_EEvOT1_OT2_OT0_T3_ENKUlNSA_8yaml_tagEE_clESP_:
 1993|   271k|                value, ctx, it, end, preamble, [](yaml::yaml_tag tag) { return yaml::tag_valid_for_string(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEEXtlNS0_20node_property_policyELb1ELb0ELb0ELb1EEERNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_12yaml_contextEPKcSE_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   271k|      {
  418|   271k|         state.has_anchor = false;
  419|   271k|         state.anchor_name.clear();
  420|   271k|         state.anchor_start = nullptr;
  421|   271k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   271k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|   271k|            else {
  430|   271k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 11.5k, False: 259k]
  ------------------
  431|   271k|            }
  432|   271k|         }
  433|       |
  434|   271k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 259k, False: 11.5k]
  |  Branch (434:27): [True: 9.50k, False: 250k]
  ------------------
  435|  9.50k|            ++it;
  436|  9.50k|            auto name = parse_anchor_name(it, end);
  437|  9.50k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 55, False: 9.45k]
  ------------------
  438|     55|               ctx.error = error_code::syntax_error;
  439|     55|               return true;
  440|     55|            }
  441|  9.45k|            skip_inline_ws(it, end);
  442|  9.45k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 82, False: 9.37k]
  ------------------
  443|     82|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     82|                  ctx.error = error_code::unexpected_end;
  445|     82|               }
  446|     82|               return true;
  447|     82|            }
  448|  9.37k|            if constexpr (Policy.disallow_anchor_on_alias) {
  449|  9.37k|               if (*it == '*') {
  ------------------
  |  Branch (449:20): [True: 6, False: 9.36k]
  ------------------
  450|      6|                  ctx.error = error_code::syntax_error;
  451|      6|                  return true;
  452|      6|               }
  453|  9.37k|            }
  454|  9.36k|            state.has_anchor = true;
  455|  9.37k|            state.anchor_name = std::string(name);
  456|  9.37k|            state.anchor_start = &*it;
  457|  9.37k|         }
  458|       |
  459|   271k|         return false;
  460|   271k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEERNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS0_12yaml_contextEPKcSD_EEbOT0_RT1_RT2_T3_:
  309|   271k|      {
  310|   271k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 271k]
  |  Branch (310:27): [True: 259k, False: 11.5k]
  ------------------
  311|       |
  312|  11.5k|         ++it; // skip '*'
  313|  11.5k|         auto name = parse_anchor_name(it, end);
  314|  11.5k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 47, False: 11.4k]
  ------------------
  315|     47|            ctx.error = error_code::syntax_error;
  316|     47|            return true;
  317|     47|         }
  318|       |
  319|  11.4k|         auto anchor_it = ctx.anchors.find(name);
  320|  11.4k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 122, False: 11.3k]
  ------------------
  321|    122|            ctx.error = error_code::syntax_error; // undefined alias
  322|    122|            return true;
  323|    122|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  11.3k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  11.3k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 1.47k, False: 9.87k]
  ------------------
  331|  1.47k|            return true;
  332|  1.47k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  9.87k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 36, False: 9.83k]
  ------------------
  338|     36|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     36|            return true;
  340|     36|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  9.83k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  9.83k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 6, False: 9.83k]
  ------------------
  348|      6|            return true;
  349|       |
  350|  9.83k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 0, False: 9.83k]
  ------------------
  351|      0|            ctx.error = error_code::exceeded_max_expansion;
  352|      0|            ctx.custom_error_message = "alias expansion";
  353|      0|            return true;
  354|      0|         }
  355|       |
  356|  9.83k|         auto replay_it = span.begin;
  357|  9.83k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  9.83k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  9.83k|         ctx.indent_stack.clear();
  362|  9.83k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 6.41k, False: 3.41k]
  ------------------
  363|  6.41k|            ctx.push_indent(span.base_indent - 1);
  364|  6.41k|         }
  365|       |
  366|  9.83k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  9.83k|         using V = std::remove_cvref_t<T>;
  369|  9.83k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  9.83k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  9.83k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  9.83k|         return true;
  376|  9.83k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_19is_yaml_variant_numEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERSH_TkNS_10is_contextERNSL_12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   107k|      {
 5356|   107k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   107k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   107k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   107k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   107k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 107k, False: 0]
  ------------------
 5366|   107k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   107k|      }
_ZN3glz4fromILj450EdE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRdTkNS_10is_contextERNS3_12yaml_contextES6_EEvOT1_OT2_OT0_T3_:
 2149|   117k|      {
 2150|   117k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2150:14): [True: 0, False: 117k]
  ------------------
 2151|      0|            return;
 2152|       |
 2153|   117k|         yaml::node_preamble_state preamble{};
 2154|   117k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble, [](yaml::yaml_tag tag) {
  ------------------
  |  Branch (2154:14): [True: 21.3k, False: 96.5k]
  ------------------
 2155|   117k|                if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2156|   117k|                   return yaml::tag_valid_for_float(tag);
 2157|   117k|                }
 2158|   117k|                else {
 2159|   117k|                   return yaml::tag_valid_for_int(tag);
 2160|   117k|                }
 2161|   117k|             }))
 2162|  21.3k|            return;
 2163|       |
 2164|  96.5k|         auto finalize = [&] { yaml::finalize_node_anchor(preamble.node_props, ctx, it); };
 2165|       |
 2166|       |         // Check for special float values
 2167|  96.5k|         if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2168|  96.5k|            auto start = it;
 2169|       |
 2170|       |            // Check for .inf, .nan, -.inf, etc.
 2171|  96.5k|            if (*it == '.') {
  ------------------
  |  Branch (2171:17): [True: 20.5k, False: 75.9k]
  ------------------
 2172|  20.5k|               ++it;
 2173|  20.5k|               if (it + 3 <= end && (std::string_view(it, 3) == "inf" || std::string_view(it, 3) == "Inf" ||
  ------------------
  |  Branch (2173:20): [True: 19.4k, False: 1.09k]
  |  Branch (2173:38): [True: 2.46k, False: 17.0k]
  |  Branch (2173:74): [True: 893, False: 16.1k]
  ------------------
 2174|  16.1k|                                     std::string_view(it, 3) == "INF")) {
  ------------------
  |  Branch (2174:38): [True: 1.19k, False: 14.9k]
  ------------------
 2175|  4.55k|                  value = std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2176|  4.55k|                  it += 3;
 2177|  4.55k|                  finalize();
 2178|  4.55k|                  return;
 2179|  4.55k|               }
 2180|  16.0k|               if (it + 3 <= end && (std::string_view(it, 3) == "nan" || std::string_view(it, 3) == "NaN" ||
  ------------------
  |  Branch (2180:20): [True: 14.9k, False: 1.09k]
  |  Branch (2180:38): [True: 2.75k, False: 12.1k]
  |  Branch (2180:74): [True: 654, False: 11.5k]
  ------------------
 2181|  11.5k|                                     std::string_view(it, 3) == "NAN")) {
  ------------------
  |  Branch (2181:38): [True: 1.03k, False: 10.4k]
  ------------------
 2182|  4.44k|                  value = std::numeric_limits<std::remove_cvref_t<T>>::quiet_NaN();
 2183|  4.44k|                  it += 3;
 2184|  4.44k|                  finalize();
 2185|  4.44k|                  return;
 2186|  4.44k|               }
 2187|  11.5k|               it = start;
 2188|  11.5k|            }
 2189|       |
 2190|  87.5k|            if (*it == '-' || *it == '+') {
  ------------------
  |  Branch (2190:17): [True: 11.2k, False: 76.2k]
  |  Branch (2190:31): [True: 10.5k, False: 65.7k]
  ------------------
 2191|  21.7k|               const char sign = *it;
 2192|  21.7k|               ++it;
 2193|  21.7k|               if (it != end && *it == '.') {
  ------------------
  |  Branch (2193:20): [True: 21.0k, False: 729]
  |  Branch (2193:33): [True: 7.90k, False: 13.1k]
  ------------------
 2194|  7.90k|                  ++it;
 2195|  7.90k|                  if (it + 3 <= end && (std::string_view(it, 3) == "inf" || std::string_view(it, 3) == "Inf" ||
  ------------------
  |  Branch (2195:23): [True: 6.72k, False: 1.17k]
  |  Branch (2195:41): [True: 2.95k, False: 3.76k]
  |  Branch (2195:77): [True: 394, False: 3.37k]
  ------------------
 2196|  3.77k|                                        std::string_view(it, 3) == "INF")) {
  ------------------
  |  Branch (2196:41): [True: 420, False: 2.95k]
  ------------------
 2197|  3.77k|                     if (sign == '-') {
  ------------------
  |  Branch (2197:26): [True: 2.66k, False: 1.11k]
  ------------------
 2198|  2.66k|                        value = -std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2199|  2.66k|                     }
 2200|  1.11k|                     else {
 2201|  1.11k|                        value = std::numeric_limits<std::remove_cvref_t<T>>::infinity();
 2202|  1.11k|                     }
 2203|  3.77k|                     it += 3;
 2204|  3.77k|                     finalize();
 2205|  3.77k|                     return;
 2206|  3.77k|                  }
 2207|  7.90k|               }
 2208|  18.0k|               it = start;
 2209|  18.0k|            }
 2210|  87.5k|         }
 2211|       |
 2212|       |         // Parse as plain scalar and convert
 2213|  83.7k|         auto start = it;
 2214|       |
 2215|       |         // Find end of number - use same rules as plain scalar for colons
 2216|  53.4M|         while (it != end) {
  ------------------
  |  Branch (2216:17): [True: 53.3M, False: 32.1k]
  ------------------
 2217|  53.3M|            const char c = *it;
 2218|  53.3M|            if (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == ',' || c == ']' || c == '}' || c == '#') {
  ------------------
  |  Branch (2218:17): [True: 24.6k, False: 53.3M]
  |  Branch (2218:29): [True: 4.11k, False: 53.3M]
  |  Branch (2218:42): [True: 8.26k, False: 53.3M]
  |  Branch (2218:55): [True: 5.75k, False: 53.3M]
  |  Branch (2218:68): [True: 3.73k, False: 53.3M]
  |  Branch (2218:80): [True: 1.64k, False: 53.3M]
  |  Branch (2218:92): [True: 1.71k, False: 53.3M]
  |  Branch (2218:104): [True: 4.78k, False: 53.3M]
  ------------------
 2219|  54.6k|               break;
 2220|  54.6k|            }
 2221|       |            // Colon only ends number if followed by space/tab/newline/end (YAML mapping indicator)
 2222|  53.3M|            if (c == ':') {
  ------------------
  |  Branch (2222:17): [True: 20.5k, False: 53.3M]
  ------------------
 2223|  20.5k|               if ((it + 1) == end || *(it + 1) == ' ' || *(it + 1) == '\t' || *(it + 1) == '\n' || *(it + 1) == '\r') {
  ------------------
  |  Branch (2223:20): [True: 1.12k, False: 19.4k]
  |  Branch (2223:39): [True: 5.46k, False: 13.9k]
  |  Branch (2223:59): [True: 388, False: 13.5k]
  |  Branch (2223:80): [True: 1.49k, False: 12.0k]
  |  Branch (2223:101): [True: 1.31k, False: 10.7k]
  ------------------
 2224|  9.77k|                  break;
 2225|  9.77k|               }
 2226|  20.5k|            }
 2227|  53.3M|            ++it;
 2228|  53.3M|         }
 2229|       |
 2230|  96.5k|         const std::string_view num_str(&*start, static_cast<size_t>(it - start));
 2231|       |
 2232|  96.5k|         if (num_str.empty()) {
  ------------------
  |  Branch (2232:14): [True: 4.96k, False: 91.5k]
  ------------------
 2233|  4.96k|            ctx.error = error_code::parse_number_failure;
 2234|  4.96k|            return;
 2235|  4.96k|         }
 2236|       |
 2237|       |         // Handle hex, octal, binary
 2238|       |         if constexpr (std::integral<std::remove_cvref_t<T>>) {
 2239|       |            if (num_str.size() > 2 && num_str[0] == '0') {
 2240|       |               int base = 10;
 2241|       |               size_t offset = 0;
 2242|       |
 2243|       |               if (num_str[1] == 'x' || num_str[1] == 'X') {
 2244|       |                  base = 16;
 2245|       |                  offset = 2;
 2246|       |               }
 2247|       |               else if (num_str[1] == 'o' || num_str[1] == 'O') {
 2248|       |                  base = 8;
 2249|       |                  offset = 2;
 2250|       |               }
 2251|       |               else if (num_str[1] == 'b' || num_str[1] == 'B') {
 2252|       |                  base = 2;
 2253|       |                  offset = 2;
 2254|       |               }
 2255|       |
 2256|       |               if (base != 10) {
 2257|       |                  const auto digits = num_str.substr(offset);
 2258|       |                  const bool has_underscores = (digits.find('_') != std::string_view::npos);
 2259|       |
 2260|       |                  std::string clean_storage;
 2261|       |                  std::string_view clean_view;
 2262|       |
 2263|       |                  if (has_underscores) {
 2264|       |                     clean_storage.reserve(digits.size());
 2265|       |                     for (char c : digits) {
 2266|       |                        if (c != '_') {
 2267|       |                           clean_storage.push_back(c);
 2268|       |                        }
 2269|       |                     }
 2270|       |                     clean_view = clean_storage;
 2271|       |                  }
 2272|       |                  else {
 2273|       |                     clean_view = digits;
 2274|       |                  }
 2275|       |
 2276|       |                  auto [ptr, ec] =
 2277|       |                     std::from_chars(clean_view.data(), clean_view.data() + clean_view.size(), value, base);
 2278|       |                  if (ec != std::errc{}) {
 2279|       |                     ctx.error = error_code::parse_number_failure;
 2280|       |                  }
 2281|       |                  finalize();
 2282|       |                  return;
 2283|       |               }
 2284|       |            }
 2285|       |         }
 2286|  91.5k|         else if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2287|  91.5k|            bool negative = false;
 2288|  91.5k|            std::string_view digits = num_str;
 2289|       |
 2290|  91.5k|            if (!digits.empty() && (digits.front() == '+' || digits.front() == '-')) {
  ------------------
  |  Branch (2290:17): [True: 78.7k, False: 12.7k]
  |  Branch (2290:37): [True: 9.39k, False: 69.3k]
  |  Branch (2290:62): [True: 8.63k, False: 60.7k]
  ------------------
 2291|  18.0k|               negative = (digits.front() == '-');
 2292|  18.0k|               digits.remove_prefix(1);
 2293|  18.0k|            }
 2294|       |
 2295|  91.5k|            if (digits.size() > 2 && digits[0] == '0') {
  ------------------
  |  Branch (2295:17): [True: 51.8k, False: 39.7k]
  |  Branch (2295:38): [True: 25.2k, False: 26.5k]
  ------------------
 2296|  25.2k|               int base = 10;
 2297|  25.2k|               size_t offset = 0;
 2298|       |
 2299|  25.2k|               if (digits[1] == 'x' || digits[1] == 'X') {
  ------------------
  |  Branch (2299:20): [True: 6.32k, False: 18.9k]
  |  Branch (2299:40): [True: 777, False: 18.1k]
  ------------------
 2300|  7.09k|                  base = 16;
 2301|  7.09k|                  offset = 2;
 2302|  7.09k|               }
 2303|  18.1k|               else if (digits[1] == 'o' || digits[1] == 'O') {
  ------------------
  |  Branch (2303:25): [True: 689, False: 17.4k]
  |  Branch (2303:45): [True: 1.01k, False: 16.4k]
  ------------------
 2304|  1.70k|                  base = 8;
 2305|  1.70k|                  offset = 2;
 2306|  1.70k|               }
 2307|  16.4k|               else if (digits[1] == 'b' || digits[1] == 'B') {
  ------------------
  |  Branch (2307:25): [True: 951, False: 15.5k]
  |  Branch (2307:45): [True: 848, False: 14.6k]
  ------------------
 2308|  1.79k|                  base = 2;
 2309|  1.79k|                  offset = 2;
 2310|  1.79k|               }
 2311|       |
 2312|  25.2k|               if (base != 10) {
  ------------------
  |  Branch (2312:20): [True: 10.5k, False: 14.6k]
  ------------------
 2313|  10.5k|                  auto raw_digits = digits.substr(offset);
 2314|  10.5k|                  const bool has_underscores = (raw_digits.find('_') != std::string_view::npos);
 2315|       |
 2316|  10.5k|                  std::string clean_storage;
 2317|  10.5k|                  std::string_view clean_view;
 2318|  10.5k|                  if (has_underscores) {
  ------------------
  |  Branch (2318:23): [True: 3.32k, False: 7.27k]
  ------------------
 2319|  3.32k|                     clean_storage.reserve(raw_digits.size());
 2320|  2.95M|                     for (char c : raw_digits) {
  ------------------
  |  Branch (2320:34): [True: 2.95M, False: 3.32k]
  ------------------
 2321|  2.95M|                        if (c != '_') {
  ------------------
  |  Branch (2321:29): [True: 2.94M, False: 6.17k]
  ------------------
 2322|  2.94M|                           clean_storage.push_back(c);
 2323|  2.94M|                        }
 2324|  2.95M|                     }
 2325|  3.32k|                     clean_view = clean_storage;
 2326|  3.32k|                  }
 2327|  7.27k|                  else {
 2328|  7.27k|                     clean_view = raw_digits;
 2329|  7.27k|                  }
 2330|       |
 2331|  10.5k|                  uint64_t parsed_int{};
 2332|  10.5k|                  auto [ptr, ec] =
 2333|  10.5k|                     std::from_chars(clean_view.data(), clean_view.data() + clean_view.size(), parsed_int, base);
 2334|  10.5k|                  if (ec != std::errc{} || ptr != (clean_view.data() + clean_view.size())) {
  ------------------
  |  Branch (2334:23): [True: 3.95k, False: 6.64k]
  |  Branch (2334:44): [True: 2.81k, False: 3.82k]
  ------------------
 2335|  6.77k|                     ctx.error = error_code::parse_number_failure;
 2336|  6.77k|                     finalize();
 2337|  6.77k|                     return;
 2338|  6.77k|                  }
 2339|       |
 2340|  3.82k|                  const auto as_float = static_cast<std::remove_cvref_t<T>>(parsed_int);
 2341|  3.82k|                  value = negative ? -as_float : as_float;
  ------------------
  |  Branch (2341:27): [True: 771, False: 3.05k]
  ------------------
 2342|  3.82k|                  finalize();
 2343|  3.82k|                  return;
 2344|  10.5k|               }
 2345|  25.2k|            }
 2346|  91.5k|         }
 2347|       |
 2348|       |         // Standard number parsing - only allocate if underscores present
 2349|  80.9k|         const bool has_underscores = (num_str.find('_') != std::string_view::npos);
 2350|       |
 2351|  91.5k|         std::string clean_storage;
 2352|  91.5k|         std::string_view clean_view;
 2353|       |
 2354|  91.5k|         if (has_underscores) {
  ------------------
  |  Branch (2354:14): [True: 13.0k, False: 78.4k]
  ------------------
 2355|  13.0k|            clean_storage.reserve(num_str.size());
 2356|  26.9M|            for (char c : num_str) {
  ------------------
  |  Branch (2356:25): [True: 26.9M, False: 13.0k]
  ------------------
 2357|  26.9M|               if (c != '_') {
  ------------------
  |  Branch (2357:20): [True: 26.8M, False: 20.3k]
  ------------------
 2358|  26.8M|                  clean_storage.push_back(c);
 2359|  26.8M|               }
 2360|  26.9M|            }
 2361|  13.0k|            clean_view = clean_storage;
 2362|  13.0k|         }
 2363|  78.4k|         else {
 2364|  78.4k|            clean_view = num_str;
 2365|  78.4k|         }
 2366|       |
 2367|       |         // YAML allows leading '+' for positive numbers, but C++ from_chars doesn't
 2368|       |         // Strip leading '+' if present
 2369|  91.5k|         auto parse_view = clean_view;
 2370|  91.5k|         if (!parse_view.empty() && parse_view.front() == '+') {
  ------------------
  |  Branch (2370:14): [True: 67.7k, False: 23.7k]
  |  Branch (2370:37): [True: 9.39k, False: 58.3k]
  ------------------
 2371|  9.39k|            parse_view.remove_prefix(1);
 2372|  9.39k|            if (parse_view.empty()) {
  ------------------
  |  Branch (2372:17): [True: 2.52k, False: 6.86k]
  ------------------
 2373|  2.52k|               ctx.error = error_code::parse_number_failure;
 2374|  2.52k|               return;
 2375|  2.52k|            }
 2376|  9.39k|         }
 2377|       |
 2378|  89.0k|         if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2379|  89.0k|            auto result = glz::fast_float::from_chars(parse_view.data(), parse_view.data() + parse_view.size(), value);
 2380|       |            // Check both for errors and that all input was consumed (e.g., "12:30" is not a valid number)
 2381|  89.0k|            if (result.ec != std::errc{} || result.ptr != parse_view.data() + parse_view.size()) {
  ------------------
  |  Branch (2381:17): [True: 50.0k, False: 38.9k]
  |  Branch (2381:45): [True: 23.4k, False: 15.5k]
  ------------------
 2382|  50.1k|               ctx.error = error_code::parse_number_failure;
 2383|  50.1k|            }
 2384|       |         }
 2385|       |         else {
 2386|       |            auto [ptr, ec] = std::from_chars(parse_view.data(), parse_view.data() + parse_view.size(), value);
 2387|       |            // Check both for errors and that all input was consumed
 2388|       |            if (ec != std::errc{} || ptr != parse_view.data() + parse_view.size()) {
 2389|       |               ctx.error = error_code::parse_number_failure;
 2390|       |            }
 2391|       |         }
 2392|       |
 2393|  89.0k|         finalize();
 2394|  89.0k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEEXtlNS0_20node_property_policyELb1EEELb0ERdNS0_12yaml_contextEPKcS7_ZNS_4fromILj450EdE2opITnDaXtlS2_Lj450ELb1ELb0ELb1ELh2EEERS7_S4_TkNS_10is_contextERS5_S7_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSG_RSJ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   117k|      {
  475|   117k|         skip_inline_ws(it, end);
  476|       |
  477|   117k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 653, False: 117k]
  ------------------
  478|    653|            if constexpr (!AllowEmptyInput) {
  479|    653|               ctx.error = error_code::unexpected_end;
  480|    653|            }
  481|    653|            return true;
  482|    653|         }
  483|       |
  484|   117k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   117k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 942, False: 116k]
  ------------------
  486|    942|            ctx.error = error_code::syntax_error;
  487|    942|            return true;
  488|    942|         }
  489|   116k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 570, False: 115k]
  ------------------
  490|    570|            ctx.error = error_code::syntax_error;
  491|    570|            return true;
  492|    570|         }
  493|       |
  494|   115k|         skip_inline_ws(it, end);
  495|       |
  496|   115k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 476, False: 115k]
  ------------------
  497|    476|            if constexpr (!AllowEmptyInput) {
  498|    476|               ctx.error = error_code::unexpected_end;
  499|    476|            }
  500|    476|            return true;
  501|    476|         }
  502|       |
  503|   115k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 18.6k, False: 96.5k]
  ------------------
  504|  18.6k|            return true;
  505|  18.6k|         }
  506|       |
  507|  96.5k|         return false;
  508|   115k|      }
_ZZN3glz4fromILj450EdE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRdTkNS_10is_contextERNS3_12yaml_contextES6_EEvOT1_OT2_OT0_T3_ENKUlNS3_8yaml_tagEE_clESI_:
 2154|   116k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble, [](yaml::yaml_tag tag) {
 2155|   116k|                if constexpr (std::floating_point<std::remove_cvref_t<T>>) {
 2156|   116k|                   return yaml::tag_valid_for_float(tag);
 2157|       |                }
 2158|       |                else {
 2159|       |                   return yaml::tag_valid_for_int(tag);
 2160|       |                }
 2161|   116k|             }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEEXtlNS0_20node_property_policyELb1EEERdNS0_12yaml_contextEPKcS7_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   115k|      {
  418|   115k|         state.has_anchor = false;
  419|   115k|         state.anchor_name.clear();
  420|   115k|         state.anchor_start = nullptr;
  421|   115k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   115k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|   115k|            else {
  430|   115k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 17.0k, False: 98.1k]
  ------------------
  431|   115k|            }
  432|   115k|         }
  433|       |
  434|   115k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 98.1k, False: 17.0k]
  |  Branch (434:27): [True: 10.8k, False: 87.2k]
  ------------------
  435|  10.8k|            ++it;
  436|  10.8k|            auto name = parse_anchor_name(it, end);
  437|  10.8k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 927, False: 9.89k]
  ------------------
  438|    927|               ctx.error = error_code::syntax_error;
  439|    927|               return true;
  440|    927|            }
  441|  9.89k|            skip_inline_ws(it, end);
  442|  9.89k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 662, False: 9.22k]
  ------------------
  443|    662|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|    662|                  ctx.error = error_code::unexpected_end;
  445|    662|               }
  446|    662|               return true;
  447|    662|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  9.22k|            state.has_anchor = true;
  455|  9.22k|            state.anchor_name = std::string(name);
  456|  9.22k|            state.anchor_start = &*it;
  457|  9.22k|         }
  458|       |
  459|   113k|         return false;
  460|   115k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEERdNS0_12yaml_contextEPKcS6_EEbOT0_RT1_RT2_T3_:
  309|   115k|      {
  310|   115k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 115k]
  |  Branch (310:27): [True: 98.1k, False: 17.0k]
  ------------------
  311|       |
  312|  17.0k|         ++it; // skip '*'
  313|  17.0k|         auto name = parse_anchor_name(it, end);
  314|  17.0k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 1.19k, False: 15.8k]
  ------------------
  315|  1.19k|            ctx.error = error_code::syntax_error;
  316|  1.19k|            return true;
  317|  1.19k|         }
  318|       |
  319|  15.8k|         auto anchor_it = ctx.anchors.find(name);
  320|  15.8k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 3.31k, False: 12.5k]
  ------------------
  321|  3.31k|            ctx.error = error_code::syntax_error; // undefined alias
  322|  3.31k|            return true;
  323|  3.31k|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  12.5k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  12.5k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 1.38k, False: 11.1k]
  ------------------
  331|  1.38k|            return true;
  332|  1.38k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  11.1k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 487, False: 10.7k]
  ------------------
  338|    487|            ctx.error = error_code::syntax_error; // cyclic alias
  339|    487|            return true;
  340|    487|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  10.7k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  10.7k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 4, False: 10.6k]
  ------------------
  348|      4|            return true;
  349|       |
  350|  10.6k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 0, False: 10.6k]
  ------------------
  351|      0|            ctx.error = error_code::exceeded_max_expansion;
  352|      0|            ctx.custom_error_message = "alias expansion";
  353|      0|            return true;
  354|      0|         }
  355|       |
  356|  10.6k|         auto replay_it = span.begin;
  357|  10.6k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  10.6k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  10.6k|         ctx.indent_stack.clear();
  362|  10.6k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 6.45k, False: 4.24k]
  ------------------
  363|  6.45k|            ctx.push_indent(span.base_indent - 1);
  364|  6.45k|         }
  365|       |
  366|  10.6k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  10.6k|         using V = std::remove_cvref_t<T>;
  369|  10.6k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  10.6k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  10.6k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  10.6k|         return true;
  376|  10.6k|      }
_ZZN3glz4fromILj450EdE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRdTkNS_10is_contextERNS3_12yaml_contextES6_EEvOT1_OT2_OT0_T3_ENKUlvE_clEv:
 2164|  89.0k|         auto finalize = [&] { yaml::finalize_node_anchor(preamble.node_props, ctx, it); };
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_20is_yaml_variant_boolEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERSH_TkNS_10is_contextERNSL_12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|  50.4k|      {
 5356|  50.4k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|  50.4k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|  50.4k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|  50.4k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|  50.4k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 50.4k, False: 0]
  ------------------
 5366|  50.4k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|  50.4k|      }
_ZN3glz4fromILj450EbE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRbTkNS_10is_contextERNS3_12yaml_contextES6_EEvOT1_OT2_OT0_T3_:
 2114|  65.2k|      {
 2115|  65.2k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2115:14): [True: 0, False: 65.2k]
  ------------------
 2116|      0|            return;
 2117|       |
 2118|  65.2k|         yaml::node_preamble_state preamble{};
 2119|  65.2k|         if (yaml::parse_node_preamble<Opts>(value, ctx, it, end, preamble,
  ------------------
  |  Branch (2119:14): [True: 16.2k, False: 48.9k]
  ------------------
 2120|  65.2k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_bool(tag); }))
 2121|  16.2k|            return;
 2122|       |
 2123|       |         // Parse as plain scalar first
 2124|  48.9k|         std::string str;
 2125|  48.9k|         yaml::parse_plain_scalar(str, ctx, it, end, yaml::check_flow_context(Opts));
 2126|       |
 2127|  48.9k|         if (str == "true" || str == "True" || str == "TRUE" || str == "yes" || str == "Yes" || str == "YES" ||
  ------------------
  |  Branch (2127:14): [True: 11.8k, False: 37.0k]
  |  Branch (2127:31): [True: 11.8k, False: 25.2k]
  |  Branch (2127:48): [True: 2.75k, False: 22.4k]
  |  Branch (2127:65): [True: 753, False: 21.7k]
  |  Branch (2127:81): [True: 819, False: 20.9k]
  |  Branch (2127:97): [True: 1.48k, False: 19.4k]
  ------------------
 2128|  32.4k|             str == "on" || str == "On" || str == "ON") {
  ------------------
  |  Branch (2128:14): [True: 812, False: 18.6k]
  |  Branch (2128:29): [True: 1.18k, False: 17.4k]
  |  Branch (2128:44): [True: 927, False: 16.4k]
  ------------------
 2129|  32.4k|            value = true;
 2130|  32.4k|         }
 2131|  16.4k|         else if (str == "false" || str == "False" || str == "FALSE" || str == "no" || str == "No" || str == "NO" ||
  ------------------
  |  Branch (2131:19): [True: 3.72k, False: 12.7k]
  |  Branch (2131:37): [True: 5.17k, False: 7.59k]
  |  Branch (2131:55): [True: 1.56k, False: 6.03k]
  |  Branch (2131:73): [True: 903, False: 5.13k]
  |  Branch (2131:88): [True: 1.38k, False: 3.74k]
  |  Branch (2131:103): [True: 867, False: 2.87k]
  ------------------
 2132|  15.9k|                  str == "off" || str == "Off" || str == "OFF") {
  ------------------
  |  Branch (2132:19): [True: 768, False: 2.11k]
  |  Branch (2132:35): [True: 831, False: 1.28k]
  |  Branch (2132:51): [True: 792, False: 488]
  ------------------
 2133|  15.9k|            value = false;
 2134|  15.9k|         }
 2135|    488|         else {
 2136|    488|            ctx.error = error_code::expected_true_or_false;
 2137|    488|         }
 2138|       |
 2139|  48.9k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 2140|  48.9k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEEXtlNS0_20node_property_policyELb1EEELb0ERbNS0_12yaml_contextEPKcS7_ZNS_4fromILj450EbE2opITnDaXtlS2_Lj450ELb1ELb0ELb1ELh2EEERS7_S4_TkNS_10is_contextERS5_S7_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSG_RSJ_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|  65.2k|      {
  475|  65.2k|         skip_inline_ws(it, end);
  476|       |
  477|  65.2k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 16, False: 65.1k]
  ------------------
  478|     16|            if constexpr (!AllowEmptyInput) {
  479|     16|               ctx.error = error_code::unexpected_end;
  480|     16|            }
  481|     16|            return true;
  482|     16|         }
  483|       |
  484|  65.1k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|  65.1k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 6, False: 65.1k]
  ------------------
  486|      6|            ctx.error = error_code::syntax_error;
  487|      6|            return true;
  488|      6|         }
  489|  65.1k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 6, False: 65.1k]
  ------------------
  490|      6|            ctx.error = error_code::syntax_error;
  491|      6|            return true;
  492|      6|         }
  493|       |
  494|  65.1k|         skip_inline_ws(it, end);
  495|       |
  496|  65.1k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 13, False: 65.1k]
  ------------------
  497|     13|            if constexpr (!AllowEmptyInput) {
  498|     13|               ctx.error = error_code::unexpected_end;
  499|     13|            }
  500|     13|            return true;
  501|     13|         }
  502|       |
  503|  65.1k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 16.2k, False: 48.9k]
  ------------------
  504|  16.2k|            return true;
  505|  16.2k|         }
  506|       |
  507|  48.9k|         return false;
  508|  65.1k|      }
_ZZN3glz4fromILj450EbE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRbTkNS_10is_contextERNS3_12yaml_contextES6_EEvOT1_OT2_OT0_T3_ENKUlNS3_8yaml_tagEE_clESI_:
 2120|  65.1k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_bool(tag); }))
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEEXtlNS0_20node_property_policyELb1EEERbNS0_12yaml_contextEPKcS7_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|  65.1k|      {
  418|  65.1k|         state.has_anchor = false;
  419|  65.1k|         state.anchor_name.clear();
  420|  65.1k|         state.anchor_start = nullptr;
  421|  65.1k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|  65.1k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|  65.1k|            else {
  430|  65.1k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 16.1k, False: 49.0k]
  ------------------
  431|  65.1k|            }
  432|  65.1k|         }
  433|       |
  434|  65.1k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 49.0k, False: 16.1k]
  |  Branch (434:27): [True: 11.9k, False: 37.0k]
  ------------------
  435|  11.9k|            ++it;
  436|  11.9k|            auto name = parse_anchor_name(it, end);
  437|  11.9k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 24, False: 11.9k]
  ------------------
  438|     24|               ctx.error = error_code::syntax_error;
  439|     24|               return true;
  440|     24|            }
  441|  11.9k|            skip_inline_ws(it, end);
  442|  11.9k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 50, False: 11.8k]
  ------------------
  443|     50|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     50|                  ctx.error = error_code::unexpected_end;
  445|     50|               }
  446|     50|               return true;
  447|     50|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  11.8k|            state.has_anchor = true;
  455|  11.8k|            state.anchor_name = std::string(name);
  456|  11.8k|            state.anchor_start = &*it;
  457|  11.8k|         }
  458|       |
  459|  65.0k|         return false;
  460|  65.1k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEERbNS0_12yaml_contextEPKcS6_EEbOT0_RT1_RT2_T3_:
  309|  65.1k|      {
  310|  65.1k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 65.1k]
  |  Branch (310:27): [True: 49.0k, False: 16.1k]
  ------------------
  311|       |
  312|  16.1k|         ++it; // skip '*'
  313|  16.1k|         auto name = parse_anchor_name(it, end);
  314|  16.1k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 32, False: 16.1k]
  ------------------
  315|     32|            ctx.error = error_code::syntax_error;
  316|     32|            return true;
  317|     32|         }
  318|       |
  319|  16.1k|         auto anchor_it = ctx.anchors.find(name);
  320|  16.1k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 148, False: 15.9k]
  ------------------
  321|    148|            ctx.error = error_code::syntax_error; // undefined alias
  322|    148|            return true;
  323|    148|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  15.9k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  15.9k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 1.19k, False: 14.7k]
  ------------------
  331|  1.19k|            return true;
  332|  1.19k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  14.7k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 17, False: 14.7k]
  ------------------
  338|     17|            ctx.error = error_code::syntax_error; // cyclic alias
  339|     17|            return true;
  340|     17|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  14.7k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  14.7k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 3, False: 14.7k]
  ------------------
  348|      3|            return true;
  349|       |
  350|  14.7k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 0, False: 14.7k]
  ------------------
  351|      0|            ctx.error = error_code::exceeded_max_expansion;
  352|      0|            ctx.custom_error_message = "alias expansion";
  353|      0|            return true;
  354|      0|         }
  355|       |
  356|  14.7k|         auto replay_it = span.begin;
  357|  14.7k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  14.7k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  14.7k|         ctx.indent_stack.clear();
  362|  14.7k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 2.02k, False: 12.7k]
  ------------------
  363|  2.02k|            ctx.push_indent(span.base_indent - 1);
  364|  2.02k|         }
  365|       |
  366|  14.7k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  14.7k|         using V = std::remove_cvref_t<T>;
  369|  14.7k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  14.7k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  14.7k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  14.7k|         return true;
  376|  14.7k|      }
_ZN3glz4fromILj450EDnE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRDnTkNS_10is_contextERNS3_12yaml_contextES6_EEvOT1_OT2_OT0_T3_:
 2500|  29.5k|      {
 2501|  29.5k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2501:14): [True: 0, False: 29.5k]
  ------------------
 2502|      0|            return;
 2503|       |
 2504|  29.5k|         yaml::skip_inline_ws(it, end);
 2505|       |
 2506|  29.5k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2506:14): [True: 17, False: 29.5k]
  ------------------
 2507|     17|            ctx.error = error_code::unexpected_end;
 2508|     17|            return;
 2509|     17|         }
 2510|       |
 2511|       |         // Check for null values: null, Null, NULL, ~
 2512|  29.5k|         if (*it == '~') {
  ------------------
  |  Branch (2512:14): [True: 4.51k, False: 25.0k]
  ------------------
 2513|  4.51k|            ++it;
 2514|  4.51k|            return;
 2515|  4.51k|         }
 2516|       |
 2517|       |         // Parse as plain scalar and check if it's a null keyword
 2518|  25.0k|         auto start = it;
 2519|   122k|         while (it != end && !yaml::plain_scalar_end_or_control_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (2519:17): [True: 121k, False: 1.14k]
  |  Branch (2519:30): [True: 97.3k, False: 23.8k]
  ------------------
 2520|  97.3k|            ++it;
 2521|  97.3k|         }
 2522|       |
 2523|  25.0k|         std::string_view str{start, static_cast<size_t>(it - start)};
 2524|  25.0k|         if (!yaml::is_yaml_null(str)) {
  ------------------
  |  Branch (2524:14): [True: 83, False: 24.9k]
  ------------------
 2525|     83|            ctx.error = error_code::syntax_error;
 2526|     83|         }
 2527|  25.0k|      }
_ZN3glz33process_yaml_variant_alternativesINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEENS_21is_yaml_variant_arrayEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERSH_TkNS_10is_contextERNSL_12yaml_contextERPKcSR_EEvOT0_OT1_OT2_T3_:
 5355|   217k|      {
 5356|   217k|         constexpr auto category_count = yaml_variant_count_v<Variant, Trait>;
 5357|       |
 5358|       |         if constexpr (category_count == 0) {
 5359|       |            ctx.error = error_code::no_matching_variant_type;
 5360|       |         }
 5361|   217k|         else if constexpr (category_count == 1) {
 5362|       |            // Only one type in this category, use it directly
 5363|   217k|            constexpr auto first_idx = yaml_variant_first_index_v<Variant, Trait>;
 5364|   217k|            using V = std::variant_alternative_t<first_idx, Variant>;
 5365|   217k|            if (!std::holds_alternative<V>(value)) value = V{};
  ------------------
  |  Branch (5365:17): [True: 217k, False: 0]
  ------------------
 5366|   217k|            from<YAML, V>::template op<Opts>(std::get<V>(value), ctx, it, end);
 5367|       |         }
 5368|       |         else {
 5369|       |            // Multiple types in this category, try each one
 5370|       |            constexpr auto N = std::variant_size_v<Variant>;
 5371|       |            bool found_match{};
 5372|       |            size_t match_idx = 0;
 5373|       |            // Only the last alternative propagates its error, so an alternative that exhausted an
 5374|       |            // expansion budget would otherwise be reported as no_matching_variant_type -- a wrong
 5375|       |            // diagnosis for a document that is hostile rather than merely the wrong shape. Held
 5376|       |            // aside and used only if nothing matched, so an alternative that does succeed later
 5377|       |            // (one that materializes no key text can still parse under a latched budget) is
 5378|       |            // unaffected.
 5379|       |            error_code expansion_error{};
 5380|       |            std::string_view expansion_message{};
 5381|       |
 5382|       |            for_each<N>([&]<size_t I>() {
 5383|       |               if (found_match) {
 5384|       |                  return;
 5385|       |               }
 5386|       |               using V = std::variant_alternative_t<I, Variant>;
 5387|       |               if constexpr (Trait<V>::value) {
 5388|       |                  auto copy_it = it;
 5389|       |                  if (!std::holds_alternative<V>(value)) {
 5390|       |                     value = V{};
 5391|       |                  }
 5392|       |
 5393|       |                  auto temp_ctx = ctx.make_speculative();
 5394|       |                  from<YAML, V>::template op<Opts>(std::get<V>(value), temp_ctx, it, end);
 5395|       |
 5396|       |                  // Charged whether or not the alternative fit: a rejected probe still replayed
 5397|       |                  // whatever aliases it reached, and an attempt that is never billed is an
 5398|       |                  // attempt that can be repeated for free.
 5399|       |                  ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget;
 5400|       |                  ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5401|       |
 5402|       |                  if (!bool(temp_ctx.error)) {
 5403|       |                     found_match = true;
 5404|       |                     ctx.anchors = std::move(temp_ctx.anchors);
 5405|       |                  }
 5406|       |                  else {
 5407|       |                     it = copy_it;
 5408|       |                     if (temp_ctx.error == error_code::exceeded_max_expansion && expansion_error == error_code::none) {
 5409|       |                        expansion_error = temp_ctx.error;
 5410|       |                        expansion_message = temp_ctx.custom_error_message;
 5411|       |                     }
 5412|       |                     if (match_idx + 1 < category_count) {
 5413|       |                        // Not the last type, continue trying
 5414|       |                     }
 5415|       |                     else {
 5416|       |                        // Last type failed, propagate error
 5417|       |                        ctx.error = temp_ctx.error;
 5418|       |                        ctx.custom_error_message = temp_ctx.custom_error_message;
 5419|       |                     }
 5420|       |                  }
 5421|       |                  ++match_idx;
 5422|       |               }
 5423|       |            });
 5424|       |
 5425|       |            if (!found_match && !bool(ctx.error)) {
 5426|       |               if (expansion_error != error_code::none) {
 5427|       |                  ctx.error = expansion_error;
 5428|       |                  ctx.custom_error_message = expansion_message;
 5429|       |               }
 5430|       |               else {
 5431|       |                  ctx.error = error_code::no_matching_variant_type;
 5432|       |               }
 5433|       |            }
 5434|       |         }
 5435|   217k|      }
_ZN3glz4fromILj450ENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS1_9allocatorIS6_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRS9_TkNS_10is_contextERNSC_12yaml_contextESF_EEvOT1_OT2_OT0_T3_:
 4207|   234k|      {
 4208|   234k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (4208:14): [True: 0, False: 234k]
  ------------------
 4209|      0|            return;
 4210|       |
 4211|       |         // Peek ahead to check for tag (don't consume indentation for block sequences)
 4212|   234k|         auto peek = it;
 4213|   234k|         yaml::node_preamble_state preamble{};
 4214|   234k|         if (yaml::parse_node_preamble<Opts>(value, ctx, peek, end, preamble,
  ------------------
  |  Branch (4214:14): [True: 20.0k, False: 214k]
  ------------------
 4215|   234k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_seq(tag); })) {
 4216|  20.0k|            it = peek;
 4217|  20.0k|            return;
 4218|  20.0k|         }
 4219|       |
 4220|       |         // A level of nesting, taken past the preamble as for sets above.
 4221|   214k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
 4222|   214k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (4222:14): [True: 6, False: 214k]
  ------------------
 4223|      6|            return;
 4224|       |
 4225|   214k|         if (*peek == '[') {
  ------------------
  |  Branch (4225:14): [True: 82.2k, False: 132k]
  ------------------
 4226|       |            // Flow sequence - consume whitespace and parse
 4227|  82.2k|            it = peek;
 4228|  82.2k|            yaml::parse_flow_sequence<Opts>(value, ctx, it, end);
 4229|  82.2k|         }
 4230|   132k|         else if (*peek == '-') {
  ------------------
  |  Branch (4230:19): [True: 132k, False: 289]
  ------------------
 4231|       |            // Block sequence - don't consume leading whitespace, let parse_block_sequence handle it
 4232|       |            // But if there was a tag, we need to advance past it
 4233|   132k|            if (preamble.tag != yaml::yaml_tag::none || preamble.node_props.has_anchor) {
  ------------------
  |  Branch (4233:17): [True: 789, False: 131k]
  |  Branch (4233:57): [True: 5.45k, False: 125k]
  ------------------
 4234|  6.24k|               it = peek;
 4235|  6.24k|            }
 4236|   132k|            int32_t seq_indent = ctx.current_indent();
 4237|   132k|            if (*it == '-' && ctx.current_indent() >= 0) {
  ------------------
  |  Branch (4237:17): [True: 131k, False: 637]
  |  Branch (4237:31): [True: 93.8k, False: 37.6k]
  ------------------
 4238|  93.8k|               seq_indent = ctx.allow_indentless_sequence ? (ctx.current_indent() > 0 ? (ctx.current_indent() - 1) : 0)
  ------------------
  |  Branch (4238:29): [True: 44.3k, False: 49.5k]
  |  Branch (4238:62): [True: 26.3k, False: 17.9k]
  ------------------
 4239|  93.8k|                                                          : (ctx.current_indent() + 1);
 4240|  93.8k|            }
 4241|   132k|            yaml::parse_block_sequence<Opts>(value, ctx, it, end, seq_indent);
 4242|   132k|         }
 4243|    289|         else {
 4244|    289|            ctx.error = error_code::syntax_error;
 4245|    289|         }
 4246|       |
 4247|   214k|         yaml::finalize_node_anchor(preamble.node_props, ctx, it);
 4248|   214k|      }
_ZN3glz4yaml19parse_node_preambleITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEEXtlNS0_20node_property_policyELb1EEELb0ERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS4_9allocatorIS9_EEEENS0_12yaml_contextEPKcSG_ZNS_4fromILj450ESC_E2opITnDaXtlS2_Lj450ELb1ELb0ELb1ELh2EEERSG_SD_TkNS_10is_contextERSE_SG_EEvOT1_OT2_OT0_T3_EUlNS0_8yaml_tagEE_EEbSP_RSS_RT4_T5_RNS0_19node_preamble_stateEOT6_:
  474|   234k|      {
  475|   234k|         skip_inline_ws(it, end);
  476|       |
  477|   234k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (477:14): [True: 12, False: 234k]
  ------------------
  478|     12|            if constexpr (!AllowEmptyInput) {
  479|     12|               ctx.error = error_code::unexpected_end;
  480|     12|            }
  481|     12|            return true;
  482|     12|         }
  483|       |
  484|   234k|         preamble.tag = parse_yaml_tag(it, end, ctx);
  485|   234k|         if (preamble.tag == yaml_tag::unknown) [[unlikely]] {
  ------------------
  |  Branch (485:14): [True: 9, False: 234k]
  ------------------
  486|      9|            ctx.error = error_code::syntax_error;
  487|      9|            return true;
  488|      9|         }
  489|   234k|         if (!tag_validator(preamble.tag)) [[unlikely]] {
  ------------------
  |  Branch (489:14): [True: 6, False: 234k]
  ------------------
  490|      6|            ctx.error = error_code::syntax_error;
  491|      6|            return true;
  492|      6|         }
  493|       |
  494|   234k|         skip_inline_ws(it, end);
  495|       |
  496|   234k|         if (it == end) [[unlikely]] {
  ------------------
  |  Branch (496:14): [True: 12, False: 234k]
  ------------------
  497|     12|            if constexpr (!AllowEmptyInput) {
  498|     12|               ctx.error = error_code::unexpected_end;
  499|     12|            }
  500|     12|            return true;
  501|     12|         }
  502|       |
  503|   234k|         if (parse_node_properties<Opts, PropertyPolicy>(std::forward<T>(value), ctx, it, end, preamble.node_props)) {
  ------------------
  |  Branch (503:14): [True: 20.0k, False: 214k]
  ------------------
  504|  20.0k|            return true;
  505|  20.0k|         }
  506|       |
  507|   214k|         return false;
  508|   234k|      }
_ZZN3glz4fromILj450ENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS1_9allocatorIS6_EEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRS9_TkNS_10is_contextERNSC_12yaml_contextESF_EEvOT1_OT2_OT0_T3_ENKUlNSC_8yaml_tagEE_clESR_:
 4215|   234k|                                             [](yaml::yaml_tag tag) { return yaml::tag_valid_for_seq(tag); })) {
_ZN3glz4yaml21parse_node_propertiesITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEEXtlNS0_20node_property_policyELb1EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS4_9allocatorIS9_EEEENS0_12yaml_contextEPKcSG_EEbOT1_RT2_RT3_T4_RNS0_19node_property_stateE:
  417|   234k|      {
  418|   234k|         state.has_anchor = false;
  419|   234k|         state.anchor_name.clear();
  420|   234k|         state.anchor_start = nullptr;
  421|   234k|         state.anchor_indent = ctx.current_indent();
  422|       |
  423|   234k|         if constexpr (Policy.allow_alias) {
  424|       |            if constexpr (Policy.alias_can_be_mapping_key) {
  425|       |               if (!alias_token_is_mapping_key(it, end)) {
  426|       |                  if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  427|       |               }
  428|       |            }
  429|   234k|            else {
  430|   234k|               if (handle_alias<Opts>(std::forward<T>(value), ctx, it, end)) return true;
  ------------------
  |  Branch (430:20): [True: 19.9k, False: 214k]
  ------------------
  431|   234k|            }
  432|   234k|         }
  433|       |
  434|   234k|         if (it != end && *it == '&') {
  ------------------
  |  Branch (434:14): [True: 214k, False: 19.9k]
  |  Branch (434:27): [True: 6.49k, False: 208k]
  ------------------
  435|  6.49k|            ++it;
  436|  6.49k|            auto name = parse_anchor_name(it, end);
  437|  6.49k|            if (name.empty()) {
  ------------------
  |  Branch (437:17): [True: 26, False: 6.46k]
  ------------------
  438|     26|               ctx.error = error_code::syntax_error;
  439|     26|               return true;
  440|     26|            }
  441|  6.46k|            skip_inline_ws(it, end);
  442|  6.46k|            if (it == end) {
  ------------------
  |  Branch (442:17): [True: 61, False: 6.40k]
  ------------------
  443|     61|               if constexpr (!Policy.allow_empty_after_anchor) {
  444|     61|                  ctx.error = error_code::unexpected_end;
  445|     61|               }
  446|     61|               return true;
  447|     61|            }
  448|       |            if constexpr (Policy.disallow_anchor_on_alias) {
  449|       |               if (*it == '*') {
  450|       |                  ctx.error = error_code::syntax_error;
  451|       |                  return true;
  452|       |               }
  453|       |            }
  454|  6.40k|            state.has_anchor = true;
  455|  6.40k|            state.anchor_name = std::string(name);
  456|  6.40k|            state.anchor_start = &*it;
  457|  6.40k|         }
  458|       |
  459|   234k|         return false;
  460|   234k|      }
_ZN3glz4yaml12handle_aliasITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEbOT0_RT1_RT2_T3_:
  309|   234k|      {
  310|   234k|         if (it == end || *it != '*') return false;
  ------------------
  |  Branch (310:14): [True: 0, False: 234k]
  |  Branch (310:27): [True: 214k, False: 19.9k]
  ------------------
  311|       |
  312|  19.9k|         ++it; // skip '*'
  313|  19.9k|         auto name = parse_anchor_name(it, end);
  314|  19.9k|         if (name.empty()) {
  ------------------
  |  Branch (314:14): [True: 37, False: 19.8k]
  ------------------
  315|     37|            ctx.error = error_code::syntax_error;
  316|     37|            return true;
  317|     37|         }
  318|       |
  319|  19.8k|         auto anchor_it = ctx.anchors.find(name);
  320|  19.8k|         if (anchor_it == ctx.anchors.end()) {
  ------------------
  |  Branch (320:14): [True: 111, False: 19.7k]
  ------------------
  321|    111|            ctx.error = error_code::syntax_error; // undefined alias
  322|    111|            return true;
  323|    111|         }
  324|       |
  325|       |         // Copied rather than referenced: the replay below can replace ctx.anchors wholesale
  326|       |         // (a speculative parse hands its own map back), which would dangle a reference here.
  327|  19.7k|         const auto span = anchor_it->second;
  328|       |
  329|       |         // Empty anchor span (anchor on null/empty node) — leave value as default
  330|  19.7k|         if (span.begin == span.end) {
  ------------------
  |  Branch (330:14): [True: 2.01k, False: 17.7k]
  ------------------
  331|  2.01k|            return true;
  332|  2.01k|         }
  333|       |
  334|       |         // An anchor is invisible to itself while it expands. A span that aliases the name it
  335|       |         // defines -- reachable because a mapping key's anchor is registered over the key text
  336|       |         // before that text is parsed -- would otherwise replay itself forever.
  337|  17.7k|         if (ctx.alias_span_is_replaying(span.begin, span.end)) [[unlikely]] {
  ------------------
  |  Branch (337:14): [True: 113, False: 17.6k]
  ------------------
  338|    113|            ctx.error = error_code::syntax_error; // cyclic alias
  339|    113|            return true;
  340|    113|         }
  341|       |
  342|       |         // Replaying an anchor re-enters the reader without opening a collection, so the
  343|       |         // sequence and mapping readers' depth accounting never sees a chain of aliases. The
  344|       |         // cycle check above stops the unbounded case; this bounds a legitimate but deeply
  345|       |         // chained one.
  346|  17.6k|         depth_guard guard{ctx, yaml::max_yaml_recursive_depth};
  347|  17.6k|         if (!guard) [[unlikely]]
  ------------------
  |  Branch (347:14): [True: 6, False: 17.6k]
  ------------------
  348|      6|            return true;
  349|       |
  350|  17.6k|         if (!ctx.charge_alias_expansion(static_cast<size_t>(span.end - span.begin))) [[unlikely]] {
  ------------------
  |  Branch (350:14): [True: 0, False: 17.6k]
  ------------------
  351|      0|            ctx.error = error_code::exceeded_max_expansion;
  352|      0|            ctx.custom_error_message = "alias expansion";
  353|      0|            return true;
  354|      0|         }
  355|       |
  356|  17.6k|         auto replay_it = span.begin;
  357|  17.6k|         auto replay_end = span.end;
  358|       |
  359|       |         // Save indent context and set up for replay
  360|  17.6k|         auto saved_indent_stack = std::move(ctx.indent_stack);
  361|  17.6k|         ctx.indent_stack.clear();
  362|  17.6k|         if (span.base_indent > 0) {
  ------------------
  |  Branch (362:14): [True: 13.6k, False: 3.93k]
  ------------------
  363|  13.6k|            ctx.push_indent(span.base_indent - 1);
  364|  13.6k|         }
  365|       |
  366|  17.6k|         ctx.active_alias_spans.emplace_back(span.begin, span.end);
  367|       |
  368|  17.6k|         using V = std::remove_cvref_t<T>;
  369|  17.6k|         from<YAML, V>::template op<Opts>(std::forward<T>(value), ctx, replay_it, replay_end);
  370|       |
  371|  17.6k|         ctx.active_alias_spans.pop_back();
  372|       |
  373|       |         // Restore indent context
  374|  17.6k|         ctx.indent_stack = std::move(saved_indent_stack);
  375|  17.6k|         return true;
  376|  17.6k|      }
_ZN3glz4yaml19parse_flow_sequenceITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_:
 2698|  82.2k|      {
 2699|  82.2k|         using V = std::remove_cvref_t<T>;
 2700|  82.2k|         using value_type = typename V::value_type;
 2701|       |
 2702|  82.2k|         struct sequence_container_adapter
 2703|  82.2k|         {
 2704|  82.2k|            size_t index = 0;
 2705|       |
 2706|  82.2k|            inline bool fixed_capacity_reached(const V& container) const noexcept
 2707|  82.2k|            {
 2708|  82.2k|               if constexpr (!resizable<V>) {
 2709|  82.2k|                  return index >= container.size();
 2710|  82.2k|               }
 2711|  82.2k|               else {
 2712|  82.2k|                  (void)container;
 2713|  82.2k|                  return false;
 2714|  82.2k|               }
 2715|  82.2k|            }
 2716|       |
 2717|  82.2k|            inline void commit_fixed_slot() noexcept { ++index; }
 2718|       |
 2719|  82.2k|            inline void append(V& container, value_type&& element) noexcept
 2720|  82.2k|            {
 2721|  82.2k|               if constexpr (emplace_backable<V>) {
 2722|  82.2k|                  container.emplace_back(std::move(element));
 2723|  82.2k|               }
 2724|  82.2k|               else if constexpr (emplaceable<V>) {
 2725|  82.2k|                  container.emplace(std::move(element));
 2726|  82.2k|               }
 2727|  82.2k|            }
 2728|  82.2k|         };
 2729|       |
 2730|  82.2k|         if (it == end || *it != '[') [[unlikely]] {
  ------------------
  |  Branch (2730:14): [True: 0, False: 82.2k]
  |  Branch (2730:27): [True: 0, False: 82.2k]
  ------------------
 2731|      0|            ctx.error = error_code::syntax_error;
 2732|      0|            return;
 2733|      0|         }
 2734|       |
 2735|       |         // Overwrite (do not append to) any pre-existing contents. Must happen
 2736|       |         // before the empty-array early return below so that `[]` also clears.
 2737|  82.2k|         clear_sequence_before_read<Opts>(value);
 2738|       |
 2739|  82.2k|         ++it; // Skip '['
 2740|       |         // Skip whitespace and newlines after opening bracket (YAML allows multi-line flow sequences)
 2741|  82.2k|         skip_flow_ws_and_newlines(ctx, it, end);
 2742|  82.2k|         if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2742:14): [True: 60, False: 82.1k]
  ------------------
 2743|     60|            return;
 2744|       |
 2745|       |         // Handle empty array
 2746|  82.1k|         if (it != end && *it == ']') {
  ------------------
  |  Branch (2746:14): [True: 80.0k, False: 2.08k]
  |  Branch (2746:27): [True: 9.32k, False: 70.7k]
  ------------------
 2747|  9.32k|            ++it;
 2748|  9.32k|            validate_flow_node_adjacent_tail(ctx, it, end);
 2749|  9.32k|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2749:17): [True: 65, False: 9.25k]
  ------------------
 2750|     65|               return;
 2751|  9.25k|            if constexpr (!yaml::check_flow_context(Opts)) {
 2752|  9.25k|               if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (2752:20): [True: 1.62k, False: 7.63k]
  ------------------
 2753|  1.62k|                  validate_root_flow_tail_after_close(ctx, it, end);
 2754|  1.62k|               }
 2755|  9.25k|            }
 2756|  9.25k|            return;
 2757|  9.32k|         }
 2758|       |
 2759|  72.8k|         bool just_saw_comma = false;
 2760|  72.8k|         sequence_container_adapter adapter{};
 2761|       |
 2762|  72.8k|         if constexpr (emplace_backable<V> || emplaceable<V>) {
 2763|       |            // Dynamic containers append items (vector-like and set-like)
 2764|  1.35M|            while (it != end) {
  ------------------
  |  Branch (2764:20): [True: 1.35M, False: 3.27k]
  ------------------
 2765|  1.35M|               skip_flow_ws_and_newlines(ctx, it, end);
 2766|  1.35M|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2766:20): [True: 0, False: 1.35M]
  ------------------
 2767|      0|                  return;
 2768|       |
 2769|  1.35M|               if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2769:20): [True: 0, False: 1.35M]
  ------------------
 2770|      0|                  ctx.error = error_code::unexpected_end;
 2771|      0|                  return;
 2772|      0|               }
 2773|       |
 2774|  1.35M|               if (*it == ']') {
  ------------------
  |  Branch (2774:20): [True: 9.79k, False: 1.34M]
  ------------------
 2775|  9.79k|                  if (just_saw_comma) {
  ------------------
  |  Branch (2775:23): [True: 9.79k, False: 0]
  ------------------
 2776|  9.79k|                     ++it;
 2777|  9.79k|                     validate_flow_node_adjacent_tail(ctx, it, end);
 2778|  9.79k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2778:26): [True: 22, False: 9.77k]
  ------------------
 2779|     22|                        return;
 2780|  9.77k|                     if constexpr (!yaml::check_flow_context(Opts)) {
 2781|  9.77k|                        if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (2781:29): [True: 1.73k, False: 8.04k]
  ------------------
 2782|  1.73k|                           validate_root_flow_tail_after_close(ctx, it, end);
 2783|  1.73k|                        }
 2784|  9.77k|                     }
 2785|  9.77k|                     return;
 2786|  9.79k|                  }
 2787|      0|                  ctx.error = error_code::syntax_error;
 2788|      0|                  return;
 2789|  9.79k|               }
 2790|       |
 2791|  1.34M|               if (*it == ',' || *it == '#') {
  ------------------
  |  Branch (2791:20): [True: 284, False: 1.34M]
  |  Branch (2791:34): [True: 117, False: 1.34M]
  ------------------
 2792|    401|                  ctx.error = error_code::syntax_error;
 2793|    401|                  return;
 2794|    401|               }
 2795|  1.34M|               just_saw_comma = false;
 2796|       |
 2797|  1.34M|               value_type element{};
 2798|  1.34M|               from<YAML, value_type>::template op<flow_context_on<Opts>()>(element, ctx, it, end);
 2799|       |
 2800|  1.34M|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2800:20): [True: 40.1k, False: 1.30M]
  ------------------
 2801|  40.1k|                  return;
 2802|       |
 2803|  1.30M|               bool saw_line_break_before_separator = false;
 2804|  1.30M|               skip_flow_ws_and_newlines(ctx, it, end, &saw_line_break_before_separator);
 2805|  1.30M|               if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2805:20): [True: 30, False: 1.30M]
  ------------------
 2806|     30|                  return;
 2807|       |
 2808|  1.30M|               if (it != end && *it == ':') {
  ------------------
  |  Branch (2808:20): [True: 1.29M, False: 3.03k]
  |  Branch (2808:33): [True: 23.1k, False: 1.27M]
  ------------------
 2809|       |                  // In flow sequences, implicit key-value pairs must be on a single line.
 2810|  23.1k|                  if (saw_line_break_before_separator) {
  ------------------
  |  Branch (2810:23): [True: 132, False: 23.0k]
  ------------------
 2811|    132|                     ctx.error = error_code::syntax_error;
 2812|    132|                     return;
 2813|    132|                  }
 2814|  23.0k|                  if constexpr (std::same_as<std::remove_cvref_t<value_type>, glz::generic>) {
 2815|  23.0k|                     glz::generic key_node = std::move(element);
 2816|  23.0k|                     ++it;
 2817|  23.0k|                     skip_inline_ws(it, end);
 2818|       |
 2819|  23.0k|                     glz::generic mapped{};
 2820|  23.0k|                     from<YAML, glz::generic>::template op<flow_context_on<Opts>()>(mapped, ctx, it, end);
 2821|  23.0k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2821:26): [True: 1.06k, False: 21.9k]
  ------------------
 2822|  1.06k|                        return;
 2823|       |
 2824|  21.9k|                     std::string key;
 2825|  21.9k|                     if (!yaml::materialize_key(key, key_node, ctx)) [[unlikely]]
  ------------------
  |  Branch (2825:26): [True: 4, False: 21.9k]
  ------------------
 2826|      4|                        return;
 2827|       |
 2828|  21.9k|                     glz::generic pair{};
 2829|  21.9k|                     pair[key] = std::move(mapped);
 2830|  21.9k|                     element = std::move(pair);
 2831|       |
 2832|  21.9k|                     skip_flow_ws_and_newlines(ctx, it, end);
 2833|  21.9k|                     if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2833:26): [True: 2, False: 21.9k]
  ------------------
 2834|      2|                        return;
 2835|       |                  }
 2836|       |                  else {
 2837|       |                     ctx.error = error_code::syntax_error;
 2838|       |                     return;
 2839|       |                  }
 2840|  23.0k|               }
 2841|       |
 2842|  1.30M|               adapter.append(value, std::move(element));
 2843|       |
 2844|  1.30M|               if (it == end) [[unlikely]] {
  ------------------
  |  Branch (2844:20): [True: 3.18k, False: 1.29M]
  ------------------
 2845|  3.18k|                  ctx.error = error_code::unexpected_end;
 2846|  3.18k|                  return;
 2847|  3.18k|               }
 2848|       |
 2849|  1.29M|               if (*it == ']') {
  ------------------
  |  Branch (2849:20): [True: 10.7k, False: 1.28M]
  ------------------
 2850|  10.7k|                  ++it;
 2851|  10.7k|                  validate_flow_node_adjacent_tail(ctx, it, end);
 2852|  10.7k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2852:23): [True: 222, False: 10.5k]
  ------------------
 2853|    222|                     return;
 2854|  10.5k|                  if constexpr (!yaml::check_flow_context(Opts)) {
 2855|  10.5k|                     if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (2855:26): [True: 1.36k, False: 9.16k]
  ------------------
 2856|  1.36k|                        validate_root_flow_tail_after_close(ctx, it, end);
 2857|  1.36k|                     }
 2858|  10.5k|                  }
 2859|  10.5k|                  return;
 2860|  10.7k|               }
 2861|  1.28M|               else if (*it == ',') {
  ------------------
  |  Branch (2861:25): [True: 1.28M, False: 5.07k]
  ------------------
 2862|  1.28M|                  ++it;
 2863|  1.28M|                  just_saw_comma = true;
 2864|  1.28M|                  skip_flow_ws_and_newlines(ctx, it, end);
 2865|  1.28M|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (2865:23): [True: 9, False: 1.28M]
  ------------------
 2866|      9|                     return;
 2867|  1.28M|               }
 2868|  5.07k|               else {
 2869|  5.07k|                  ctx.error = error_code::syntax_error;
 2870|  5.07k|                  return;
 2871|  5.07k|               }
 2872|  1.29M|            }
 2873|       |         }
 2874|       |         else if constexpr (!resizable<V>) {
 2875|       |            // Fixed-size containers (std::array)
 2876|       |            while (it != end) {
 2877|       |               skip_flow_ws_and_newlines(ctx, it, end);
 2878|       |               if (bool(ctx.error)) [[unlikely]]
 2879|       |                  return;
 2880|       |
 2881|       |               if (it == end) [[unlikely]] {
 2882|       |                  ctx.error = error_code::unexpected_end;
 2883|       |                  return;
 2884|       |               }
 2885|       |
 2886|       |               if (*it == ']') {
 2887|       |                  if (just_saw_comma) {
 2888|       |                     ++it;
 2889|       |                     validate_flow_node_adjacent_tail(ctx, it, end);
 2890|       |                     if (bool(ctx.error)) [[unlikely]]
 2891|       |                        return;
 2892|       |                     if constexpr (!yaml::check_flow_context(Opts)) {
 2893|       |                        if (ctx.current_indent() < 0) {
 2894|       |                           validate_root_flow_tail_after_close(ctx, it, end);
 2895|       |                        }
 2896|       |                     }
 2897|       |                     return;
 2898|       |                  }
 2899|       |                  ctx.error = error_code::syntax_error;
 2900|       |                  return;
 2901|       |               }
 2902|       |
 2903|       |               if (*it == ',' || *it == '#') {
 2904|       |                  ctx.error = error_code::syntax_error;
 2905|       |                  return;
 2906|       |               }
 2907|       |               just_saw_comma = false;
 2908|       |
 2909|       |               // An item beyond the last slot is an error, as in JSON.
 2910|       |               if (adapter.fixed_capacity_reached(value)) [[unlikely]] {
 2911|       |                  ctx.error = error_code::exceeded_static_array_size;
 2912|       |                  return;
 2913|       |               }
 2914|       |
 2915|       |               from<YAML, value_type>::template op<flow_context_on<Opts>()>(value[adapter.index], ctx, it, end);
 2916|       |
 2917|       |               if (bool(ctx.error)) [[unlikely]]
 2918|       |                  return;
 2919|       |
 2920|       |               adapter.commit_fixed_slot();
 2921|       |               skip_flow_ws_and_newlines(ctx, it, end);
 2922|       |               if (bool(ctx.error)) [[unlikely]]
 2923|       |                  return;
 2924|       |
 2925|       |               if (it == end) [[unlikely]] {
 2926|       |                  ctx.error = error_code::unexpected_end;
 2927|       |                  return;
 2928|       |               }
 2929|       |
 2930|       |               if (*it == ']') {
 2931|       |                  ++it;
 2932|       |                  validate_flow_node_adjacent_tail(ctx, it, end);
 2933|       |                  if (bool(ctx.error)) [[unlikely]]
 2934|       |                     return;
 2935|       |                  if constexpr (!yaml::check_flow_context(Opts)) {
 2936|       |                     if (ctx.current_indent() < 0) {
 2937|       |                        validate_root_flow_tail_after_close(ctx, it, end);
 2938|       |                     }
 2939|       |                  }
 2940|       |                  return;
 2941|       |               }
 2942|       |               else if (*it == ',') {
 2943|       |                  ++it;
 2944|       |                  just_saw_comma = true;
 2945|       |                  skip_flow_ws_and_newlines(ctx, it, end);
 2946|       |                  if (bool(ctx.error)) [[unlikely]]
 2947|       |                     return;
 2948|       |               }
 2949|       |               else {
 2950|       |                  ctx.error = error_code::syntax_error;
 2951|       |                  return;
 2952|       |               }
 2953|       |            }
 2954|       |         }
 2955|       |         else {
 2956|       |            ctx.error = error_code::syntax_error;
 2957|       |            return;
 2958|       |         }
 2959|  72.8k|      }
_ZN3glz4yaml26clear_sequence_before_readITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEENSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEEEEvRT0_:
 2682|   214k|      {
 2683|   214k|         if constexpr (emplace_backable<V> && requires { value.clear(); }) {
 2684|       |            // vector-like: honor the append_arrays option, matching json/read.hpp
 2685|   214k|            if constexpr (!check_append_arrays(Opts)) {
 2686|   214k|               value.clear();
 2687|   214k|            }
 2688|       |         }
 2689|       |         else if constexpr (emplaceable<V> && requires { value.clear(); }) {
 2690|       |            // set-like: json/read.hpp clears unconditionally; append_arrays does not apply
 2691|       |            value.clear();
 2692|       |         }
 2693|   214k|      }
_ZZN3glz4yaml19parse_flow_sequenceITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_EN26sequence_container_adapter6appendESC_OS8_:
 2720|  1.30M|            {
 2721|  1.30M|               if constexpr (emplace_backable<V>) {
 2722|  1.30M|                  container.emplace_back(std::move(element));
 2723|       |               }
 2724|       |               else if constexpr (emplaceable<V>) {
 2725|       |                  container.emplace(std::move(element));
 2726|       |               }
 2727|  1.30M|            }
_ZN3glz4yaml20parse_block_sequenceITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_i:
 3186|   132k|      {
 3187|   132k|         using V = std::remove_cvref_t<T>;
 3188|   132k|         using value_type = typename V::value_type;
 3189|       |
 3190|   132k|         struct sequence_container_adapter
 3191|   132k|         {
 3192|   132k|            size_t index = 0;
 3193|       |
 3194|   132k|            inline bool fixed_capacity_reached(const V& container) const noexcept
 3195|   132k|            {
 3196|   132k|               if constexpr (!resizable<V>) {
 3197|   132k|                  return index >= container.size();
 3198|   132k|               }
 3199|   132k|               else {
 3200|   132k|                  (void)container;
 3201|   132k|                  return false;
 3202|   132k|               }
 3203|   132k|            }
 3204|       |
 3205|   132k|            inline void commit_fixed_slot() noexcept { ++index; }
 3206|       |
 3207|   132k|            inline void append(V& container, value_type&& element) noexcept
 3208|   132k|            {
 3209|   132k|               if constexpr (emplace_backable<V>) {
 3210|   132k|                  container.emplace_back(std::move(element));
 3211|   132k|               }
 3212|   132k|               else if constexpr (emplaceable<V>) {
 3213|   132k|                  container.emplace(std::move(element));
 3214|   132k|               }
 3215|   132k|            }
 3216|   132k|         };
 3217|       |
 3218|       |         // Overwrite (do not append to) any pre-existing contents. A block
 3219|       |         // sequence is only entered once a '-' item is confirmed, so clearing
 3220|       |         // up front correctly (re)assigns the container to the parsed sequence.
 3221|   132k|         clear_sequence_before_read<Opts>(value);
 3222|       |
 3223|   132k|         sequence_container_adapter adapter{};
 3224|       |
 3225|       |         // Track if this is the first item (for handling whitespace-consumed case)
 3226|   132k|         bool first_item = true;
 3227|   132k|         bool has_pending_item_anchor = false;
 3228|   132k|         std::string pending_item_anchor_name{};
 3229|   132k|         int32_t pending_item_anchor_indent = sequence_indent;
 3230|       |
 3231|   435k|         while (it != end) {
  ------------------
  |  Branch (3231:17): [True: 382k, False: 52.5k]
  ------------------
 3232|       |            // Skip blank lines and comments, track indent
 3233|   382k|            int32_t line_indent = 0;
 3234|   382k|            int32_t dash_col = -1; // actual column of the '-' on the line
 3235|   382k|            auto line_start = it;
 3236|       |
 3237|   649k|            while (it != end) {
  ------------------
  |  Branch (3237:20): [True: 624k, False: 25.7k]
  ------------------
 3238|   624k|               if (*it == '#') {
  ------------------
  |  Branch (3238:20): [True: 30.7k, False: 593k]
  ------------------
 3239|  30.7k|                  skip_comment(it, end);
 3240|  30.7k|                  skip_newline(it, end);
 3241|  30.7k|                  line_start = it;
 3242|  30.7k|                  line_indent = 0;
 3243|  30.7k|               }
 3244|   593k|               else if (*it == '\n' || *it == '\r') {
  ------------------
  |  Branch (3244:25): [True: 78.3k, False: 514k]
  |  Branch (3244:40): [True: 122k, False: 392k]
  ------------------
 3245|   201k|                  skip_newline(it, end);
 3246|   201k|                  line_start = it;
 3247|   201k|                  line_indent = 0;
 3248|   201k|               }
 3249|   392k|               else if (*it == ' ') {
  ------------------
  |  Branch (3249:25): [True: 42.0k, False: 350k]
  ------------------
 3250|  42.0k|                  line_start = it;
 3251|  42.0k|                  line_indent = 0;
 3252|  1.97M|                  while (it != end && *it == ' ') {
  ------------------
  |  Branch (3252:26): [True: 1.97M, False: 1.20k]
  |  Branch (3252:39): [True: 1.92M, False: 40.8k]
  ------------------
 3253|  1.92M|                     ++line_indent;
 3254|  1.92M|                     ++it;
 3255|  1.92M|                  }
 3256|       |
 3257|  42.0k|                  bool saw_tab = false;
 3258|  49.6k|                  while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3258:26): [True: 47.7k, False: 1.94k]
  |  Branch (3258:40): [True: 3.11k, False: 44.5k]
  |  Branch (3258:54): [True: 4.51k, False: 40.0k]
  ------------------
 3259|  7.63k|                     saw_tab = saw_tab || (*it == '\t');
  ------------------
  |  Branch (3259:32): [True: 5.63k, False: 2.00k]
  |  Branch (3259:43): [True: 2.00k, False: 0]
  ------------------
 3260|  7.63k|                     ++it;
 3261|  7.63k|                  }
 3262|       |
 3263|  42.0k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3263:23): [True: 1.94k, False: 40.0k]
  |  Branch (3263:36): [True: 2.69k, False: 37.3k]
  |  Branch (3263:51): [True: 19.6k, False: 17.6k]
  |  Branch (3263:66): [True: 5.28k, False: 12.4k]
  ------------------
 3264|       |                     // Blank or comment line - continue to next line
 3265|  29.6k|                     if (it != end && *it == '#') {
  ------------------
  |  Branch (3265:26): [True: 27.6k, False: 1.94k]
  |  Branch (3265:39): [True: 5.28k, False: 22.3k]
  ------------------
 3266|  5.28k|                        skip_comment(it, end);
 3267|  5.28k|                     }
 3268|  29.6k|                     line_indent = 0;
 3269|  29.6k|                     continue;
 3270|  29.6k|                  }
 3271|       |
 3272|  12.4k|                  if (saw_tab) {
  ------------------
  |  Branch (3272:23): [True: 54, False: 12.3k]
  ------------------
 3273|     54|                     ctx.error = error_code::syntax_error;
 3274|     54|                     return;
 3275|     54|                  }
 3276|  12.3k|                  break; // Found content
 3277|  12.4k|               }
 3278|   350k|               else if (*it == '\t') {
  ------------------
  |  Branch (3278:25): [True: 5.63k, False: 344k]
  ------------------
 3279|  5.63k|                  line_start = it;
 3280|  16.0k|                  while (it != end && (*it == ' ' || *it == '\t')) ++it;
  ------------------
  |  Branch (3280:26): [True: 15.6k, False: 391]
  |  Branch (3280:40): [True: 870, False: 14.7k]
  |  Branch (3280:54): [True: 9.55k, False: 5.23k]
  ------------------
 3281|  5.63k|                  if (it == end || *it == '\n' || *it == '\r' || *it == '#') {
  ------------------
  |  Branch (3281:23): [True: 391, False: 5.23k]
  |  Branch (3281:36): [True: 746, False: 4.49k]
  |  Branch (3281:51): [True: 2.07k, False: 2.41k]
  |  Branch (3281:66): [True: 2.34k, False: 74]
  ------------------
 3282|  5.55k|                     if (it != end && *it == '#') {
  ------------------
  |  Branch (3282:26): [True: 5.16k, False: 391]
  |  Branch (3282:39): [True: 2.34k, False: 2.82k]
  ------------------
 3283|  2.34k|                        skip_comment(it, end);
 3284|  2.34k|                     }
 3285|  5.55k|                     line_indent = 0;
 3286|  5.55k|                     continue;
 3287|  5.55k|                  }
 3288|     74|                  ctx.error = error_code::syntax_error;
 3289|     74|                  return;
 3290|  5.63k|               }
 3291|   344k|               else {
 3292|       |                  // At content (no leading space on this line)
 3293|       |                  // If first item and at '-', whitespace was consumed by caller;
 3294|       |                  // treat as having correct indentation
 3295|   344k|                  if (first_item && *it == '-') {
  ------------------
  |  Branch (3295:23): [True: 132k, False: 212k]
  |  Branch (3295:37): [True: 131k, False: 637]
  ------------------
 3296|   131k|                     line_indent = sequence_indent;
 3297|   131k|                     if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3298|   131k|                        if (ctx.stream_begin && it > ctx.stream_begin) {
  ------------------
  |  Branch (3298:29): [True: 131k, False: 0]
  |  Branch (3298:49): [True: 129k, False: 2.04k]
  ------------------
 3299|   129k|                           auto probe = it;
 3300|   129k|                           int32_t leading_ws = 0;
 3301|   129k|                           bool saw_tab = false;
 3302|  2.98M|                           while (probe > ctx.stream_begin && (*(probe - 1) == ' ' || *(probe - 1) == '\t')) {
  ------------------
  |  Branch (3302:35): [True: 2.98M, False: 264]
  |  Branch (3302:64): [True: 2.85M, False: 136k]
  |  Branch (3302:87): [True: 6.91k, False: 129k]
  ------------------
 3303|  2.85M|                              --probe;
 3304|  2.85M|                              ++leading_ws;
 3305|  2.85M|                              saw_tab = saw_tab || (*probe == '\t');
  ------------------
  |  Branch (3305:41): [True: 763, False: 2.85M]
  |  Branch (3305:52): [True: 6.26k, False: 2.85M]
  ------------------
 3306|  2.85M|                           }
 3307|   129k|                           if (probe == ctx.stream_begin || *(probe - 1) == '\n' || *(probe - 1) == '\r') {
  ------------------
  |  Branch (3307:32): [True: 264, False: 129k]
  |  Branch (3307:61): [True: 26.2k, False: 103k]
  |  Branch (3307:85): [True: 30.7k, False: 72.2k]
  ------------------
 3308|  57.2k|                              if (saw_tab) {
  ------------------
  |  Branch (3308:35): [True: 48, False: 57.2k]
  ------------------
 3309|     48|                                 ctx.error = error_code::syntax_error;
 3310|     48|                                 return;
 3311|     48|                              }
 3312|  57.2k|                              line_indent = (std::max)(line_indent, leading_ws);
 3313|  57.2k|                           }
 3314|   129k|                        }
 3315|   131k|                     }
 3316|   131k|                  }
 3317|   131k|                  break;
 3318|   344k|               }
 3319|   624k|            }
 3320|       |
 3321|   382k|            if (it == end) break;
  ------------------
  |  Branch (3321:17): [True: 25.7k, False: 356k]
  ------------------
 3322|       |
 3323|       |            // Check for document end marker
 3324|   356k|            if (at_document_end(it, end)) break;
  ------------------
  |  Branch (3324:17): [True: 3.01k, False: 353k]
  ------------------
 3325|       |
 3326|       |            // Check for dedent
 3327|   353k|            if (line_indent < sequence_indent) {
  ------------------
  |  Branch (3327:17): [True: 11.8k, False: 341k]
  ------------------
 3328|  11.8k|               it = line_start;
 3329|  11.8k|               return;
 3330|  11.8k|            }
 3331|       |
 3332|   341k|            if (*it == '&') {
  ------------------
  |  Branch (3332:17): [True: 15.2k, False: 326k]
  ------------------
 3333|       |               // Standalone anchor lines before "- item" are only supported for
 3334|       |               // indentless mapping values. At top-level block sequences these are
 3335|       |               // malformed in yaml-test-suite cases.
 3336|  15.2k|               if (!ctx.allow_indentless_sequence) {
  ------------------
  |  Branch (3336:20): [True: 21, False: 15.1k]
  ------------------
 3337|     21|                  ctx.error = error_code::syntax_error;
 3338|     21|                  return;
 3339|     21|               }
 3340|       |
 3341|  15.1k|               ++it;
 3342|  15.1k|               auto pending_name = parse_anchor_name(it, end);
 3343|  15.1k|               if (pending_name.empty()) {
  ------------------
  |  Branch (3343:20): [True: 24, False: 15.1k]
  ------------------
 3344|     24|                  ctx.error = error_code::syntax_error;
 3345|     24|                  return;
 3346|     24|               }
 3347|  15.1k|               skip_inline_ws(it, end);
 3348|  15.1k|               if (it != end && *it == '#') {
  ------------------
  |  Branch (3348:20): [True: 15.0k, False: 117]
  |  Branch (3348:33): [True: 1.45k, False: 13.5k]
  ------------------
 3349|  1.45k|                  skip_comment(it, end);
 3350|  1.45k|               }
 3351|       |
 3352|  15.1k|               has_pending_item_anchor = true;
 3353|  15.1k|               pending_item_anchor_name = std::string(pending_name);
 3354|  15.1k|               pending_item_anchor_indent = line_indent;
 3355|       |
 3356|  15.1k|               if (it == end || (*it != '\n' && *it != '\r')) {
  ------------------
  |  Branch (3356:20): [True: 128, False: 15.0k]
  |  Branch (3356:34): [True: 9.10k, False: 5.92k]
  |  Branch (3356:49): [True: 131, False: 8.97k]
  ------------------
 3357|    259|                  ctx.error = error_code::syntax_error;
 3358|    259|                  return;
 3359|    259|               }
 3360|       |
 3361|  14.9k|               skip_newline(it, end);
 3362|  14.9k|               continue;
 3363|  15.1k|            }
 3364|       |
 3365|       |            // Expect dash for sequence item
 3366|   326k|            if (*it != '-') {
  ------------------
  |  Branch (3366:17): [True: 18.1k, False: 308k]
  ------------------
 3367|  18.1k|               it = line_start;
 3368|  18.1k|               return;
 3369|  18.1k|            }
 3370|       |
 3371|       |            // Compute the actual column of this sequence dash.
 3372|       |            // This is needed by plain-scalar multiline folding to distinguish
 3373|       |            // sibling "- item" entries from deeper "- " continuation content.
 3374|   308k|            dash_col = line_indent;
 3375|   308k|            if constexpr (std::is_pointer_v<std::decay_t<It>>) {
 3376|   308k|               if (ctx.stream_begin) {
  ------------------
  |  Branch (3376:20): [True: 308k, False: 48]
  ------------------
 3377|   308k|                  dash_col = ctx.line_prefix_before(&*it).column;
 3378|   308k|               }
 3379|   308k|            }
 3380|       |
 3381|   308k|            ++it; // Skip '-'
 3382|       |
 3383|       |            // Check for valid sequence item indicator (- followed by space or newline)
 3384|   308k|            if (it != end && !yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (3384:17): [True: 304k, False: 3.81k]
  |  Branch (3384:30): [True: 16.6k, False: 288k]
  ------------------
 3385|       |               // Not a sequence item (could be a number like -5)
 3386|  16.6k|               it = line_start;
 3387|  16.6k|               return;
 3388|  16.6k|            }
 3389|       |
 3390|   291k|            bool saw_tab_after_dash = false;
 3391|   744k|            while (it != end && (*it == ' ' || *it == '\t')) {
  ------------------
  |  Branch (3391:20): [True: 738k, False: 5.62k]
  |  Branch (3391:34): [True: 408k, False: 330k]
  |  Branch (3391:48): [True: 44.5k, False: 286k]
  ------------------
 3392|   452k|               saw_tab_after_dash = saw_tab_after_dash || (*it == '\t');
  ------------------
  |  Branch (3392:37): [True: 6.06k, False: 446k]
  |  Branch (3392:59): [True: 39.9k, False: 406k]
  ------------------
 3393|   452k|               ++it;
 3394|   452k|            }
 3395|       |            // A tab-separated nested "- " marker is not valid block indentation.
 3396|   291k|            if (saw_tab_after_dash && it != end && *it == '-') {
  ------------------
  |  Branch (3396:17): [True: 39.9k, False: 251k]
  |  Branch (3396:39): [True: 39.2k, False: 768]
  |  Branch (3396:52): [True: 1.23k, False: 37.9k]
  ------------------
 3397|  1.23k|               const auto after_dash = it + 1;
 3398|  1.23k|               if (after_dash == end || yaml::whitespace_or_line_end_table[static_cast<uint8_t>(*after_dash)]) {
  ------------------
  |  Branch (3398:20): [True: 12, False: 1.21k]
  |  Branch (3398:41): [True: 15, False: 1.20k]
  ------------------
 3399|     27|                  ctx.error = error_code::syntax_error;
 3400|     27|                  return;
 3401|     27|               }
 3402|  1.23k|            }
 3403|       |
 3404|       |            // Get reference to element to parse into
 3405|   291k|            auto parse_element = [&](auto& element) {
 3406|   291k|               const char* element_start = (it != end) ? &*it : nullptr;
 3407|       |
 3408|       |               // Check what follows
 3409|   291k|               if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
 3410|       |                  // Content on same line as dash - set indent to one less than content column
 3411|       |                  // This allows nested block mappings to continue parsing keys at the content indent
 3412|       |                  // For "- key: val", if dash is at column 0, content is at column 2
 3413|       |                  // We set parent indent to 1 so keys at column 2 pass the "indent > parent" check
 3414|   291k|                  if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
 3415|   291k|                     return;
 3416|   291k|                  const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3417|   291k|                  const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3418|   291k|                  ctx.sequence_item_value_context = true;
 3419|   291k|                  ctx.sequence_dash_indent = dash_col;
 3420|   291k|                  from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3421|   291k|                  ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3422|   291k|                  ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3423|   291k|                  ctx.pop_indent();
 3424|   291k|               }
 3425|   291k|               else {
 3426|       |                  // Value on next line - nested block
 3427|   291k|                  skip_ws_and_comment(it, end);
 3428|   291k|                  skip_newline(it, end);
 3429|       |
 3430|       |                  // Get indent of nested content
 3431|   291k|                  auto nested_start = it;
 3432|   291k|                  int32_t nested_indent = measure_indent(it, end, ctx);
 3433|   291k|                  if (bool(ctx.error)) [[unlikely]]
 3434|   291k|                     return;
 3435|   291k|                  it = nested_start;
 3436|       |
 3437|       |                  // Content is nested only if indented more than the current line.
 3438|       |                  // When line_indent is negative (root level), use 0 as the baseline.
 3439|       |                  // This prevents content at column 0 from being treated as nested.
 3440|   291k|                  const int32_t effective_line_indent = (line_indent < 0) ? 0 : line_indent;
 3441|   291k|                  if (nested_indent > effective_line_indent) {
 3442|       |                     // Save and set indent for nested parsing.
 3443|       |                     // A struct element reads the pushed indent as its own key column; every
 3444|       |                     // other element type reads it as the enclosing baseline, so it gets one
 3445|       |                     // less than the content indent and its content passes "indent > parent".
 3446|   291k|                     const int32_t element_indent =
 3447|   291k|                        receives_block_mapping_column<value_type>() ? nested_indent : nested_indent - 1;
 3448|   291k|                     if (!ctx.push_indent(element_indent)) [[unlikely]]
 3449|   291k|                        return;
 3450|   291k|                     const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3451|   291k|                     const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3452|   291k|                     ctx.sequence_item_value_context = true;
 3453|   291k|                     ctx.sequence_dash_indent = dash_col;
 3454|   291k|                     from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3455|   291k|                     ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3456|   291k|                     ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3457|   291k|                     ctx.pop_indent();
 3458|   291k|                  }
 3459|       |                  // else: empty element (default constructed)
 3460|   291k|               }
 3461|       |
 3462|   291k|               if (has_pending_item_anchor && !bool(ctx.error)) {
 3463|   291k|                  const char* element_end = (it != end) ? &*it : element_start;
 3464|   291k|                  ctx.anchors[std::move(pending_item_anchor_name)] = {element_start, element_end,
 3465|   291k|                                                                      pending_item_anchor_indent};
 3466|   291k|                  has_pending_item_anchor = false;
 3467|   291k|               }
 3468|   291k|            };
 3469|       |
 3470|   291k|            if constexpr (emplace_backable<V>) {
 3471|   291k|               auto& element = value.emplace_back();
 3472|   291k|               parse_element(element);
 3473|       |            }
 3474|       |            else if constexpr (emplaceable<V>) {
 3475|       |               value_type element{};
 3476|       |               parse_element(element);
 3477|       |               if (!bool(ctx.error)) {
 3478|       |                  adapter.append(value, std::move(element));
 3479|       |               }
 3480|       |            }
 3481|       |            else if constexpr (!resizable<V>) {
 3482|       |               // Fixed-size (e.g. std::array): an item beyond the last slot is an error, as in JSON.
 3483|       |               // Checked only once another item is confirmed, so a full container still ends cleanly.
 3484|       |               if (adapter.fixed_capacity_reached(value)) [[unlikely]] {
 3485|       |                  ctx.error = error_code::exceeded_static_array_size;
 3486|       |                  return;
 3487|       |               }
 3488|       |               parse_element(value[adapter.index]);
 3489|       |               adapter.commit_fixed_slot();
 3490|       |            }
 3491|       |            else {
 3492|       |               ctx.error = error_code::syntax_error;
 3493|       |               return;
 3494|       |            }
 3495|       |
 3496|   291k|            first_item = false;
 3497|       |
 3498|   291k|            if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3498:17): [True: 3.69k, False: 288k]
  ------------------
 3499|  3.69k|               return;
 3500|       |
 3501|       |            // Note: after parsing nested block content, iterator may already be
 3502|       |            // at the start of the next line. The outer loop will handle it.
 3503|   291k|         }
 3504|   132k|      }
_ZZN3glz4yaml20parse_block_sequenceITnDaXtlNS0_9yaml_optsELj450ELb1ELb0ELb1ELh2EEERNSt3__16vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS3_9allocatorIS8_EEEENS0_12yaml_contextEPKcSF_EEvOT0_RT1_RT2_T3_iENKUlRT_E_clIS8_EEDaSO_:
 3405|   291k|            auto parse_element = [&](auto& element) {
 3406|   291k|               const char* element_start = (it != end) ? &*it : nullptr;
  ------------------
  |  Branch (3406:44): [True: 286k, False: 5.57k]
  ------------------
 3407|       |
 3408|       |               // Check what follows
 3409|   291k|               if (it != end && !yaml::line_end_or_comment_table[static_cast<uint8_t>(*it)]) {
  ------------------
  |  Branch (3409:20): [True: 286k, False: 5.57k]
  |  Branch (3409:33): [True: 164k, False: 121k]
  ------------------
 3410|       |                  // Content on same line as dash - set indent to one less than content column
 3411|       |                  // This allows nested block mappings to continue parsing keys at the content indent
 3412|       |                  // For "- key: val", if dash is at column 0, content is at column 2
 3413|       |                  // We set parent indent to 1 so keys at column 2 pass the "indent > parent" check
 3414|   164k|                  if (!ctx.push_indent(line_indent + 1)) [[unlikely]]
  ------------------
  |  Branch (3414:23): [True: 0, False: 164k]
  ------------------
 3415|      0|                     return;
 3416|   164k|                  const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3417|   164k|                  const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3418|   164k|                  ctx.sequence_item_value_context = true;
 3419|   164k|                  ctx.sequence_dash_indent = dash_col;
 3420|   164k|                  from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3421|   164k|                  ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3422|   164k|                  ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3423|   164k|                  ctx.pop_indent();
 3424|   164k|               }
 3425|   126k|               else {
 3426|       |                  // Value on next line - nested block
 3427|   126k|                  skip_ws_and_comment(it, end);
 3428|   126k|                  skip_newline(it, end);
 3429|       |
 3430|       |                  // Get indent of nested content
 3431|   126k|                  auto nested_start = it;
 3432|   126k|                  int32_t nested_indent = measure_indent(it, end, ctx);
 3433|   126k|                  if (bool(ctx.error)) [[unlikely]]
  ------------------
  |  Branch (3433:23): [True: 9, False: 126k]
  ------------------
 3434|      9|                     return;
 3435|   126k|                  it = nested_start;
 3436|       |
 3437|       |                  // Content is nested only if indented more than the current line.
 3438|       |                  // When line_indent is negative (root level), use 0 as the baseline.
 3439|       |                  // This prevents content at column 0 from being treated as nested.
 3440|   126k|                  const int32_t effective_line_indent = (line_indent < 0) ? 0 : line_indent;
  ------------------
  |  Branch (3440:57): [True: 5.26k, False: 121k]
  ------------------
 3441|   126k|                  if (nested_indent > effective_line_indent) {
  ------------------
  |  Branch (3441:23): [True: 88.8k, False: 38.1k]
  ------------------
 3442|       |                     // Save and set indent for nested parsing.
 3443|       |                     // A struct element reads the pushed indent as its own key column; every
 3444|       |                     // other element type reads it as the enclosing baseline, so it gets one
 3445|       |                     // less than the content indent and its content passes "indent > parent".
 3446|  88.8k|                     const int32_t element_indent =
 3447|  88.8k|                        receives_block_mapping_column<value_type>() ? nested_indent : nested_indent - 1;
  ------------------
  |  Branch (3447:25): [Folded, False: 88.8k]
  ------------------
 3448|  88.8k|                     if (!ctx.push_indent(element_indent)) [[unlikely]]
  ------------------
  |  Branch (3448:26): [True: 0, False: 88.8k]
  ------------------
 3449|      0|                        return;
 3450|  88.8k|                     const bool prev_sequence_item_value_context = ctx.sequence_item_value_context;
 3451|  88.8k|                     const int32_t prev_sequence_dash_indent = ctx.sequence_dash_indent;
 3452|  88.8k|                     ctx.sequence_item_value_context = true;
 3453|  88.8k|                     ctx.sequence_dash_indent = dash_col;
 3454|  88.8k|                     from<YAML, value_type>::template op<Opts>(element, ctx, it, end);
 3455|  88.8k|                     ctx.sequence_dash_indent = prev_sequence_dash_indent;
 3456|  88.8k|                     ctx.sequence_item_value_context = prev_sequence_item_value_context;
 3457|  88.8k|                     ctx.pop_indent();
 3458|  88.8k|                  }
 3459|       |                  // else: empty element (default constructed)
 3460|   126k|               }
 3461|       |
 3462|   291k|               if (has_pending_item_anchor && !bool(ctx.error)) {
  ------------------
  |  Branch (3462:20): [True: 5.32k, False: 286k]
  |  Branch (3462:47): [True: 4.91k, False: 407]
  ------------------
 3463|  4.91k|                  const char* element_end = (it != end) ? &*it : element_start;
  ------------------
  |  Branch (3463:45): [True: 2.47k, False: 2.44k]
  ------------------
 3464|  4.91k|                  ctx.anchors[std::move(pending_item_anchor_name)] = {element_start, element_end,
 3465|  4.91k|                                                                      pending_item_anchor_indent};
 3466|  4.91k|                  has_pending_item_anchor = false;
 3467|  4.91k|               }
 3468|   291k|            };
_ZN3glz29parse_block_mapping_or_stringINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERSH_RNSI_12yaml_contextERPKcSO_EEvOT1_OT2_OT3_T4_:
 5575|   517k|   {
 5576|       |      if constexpr (yaml::check_flow_context(Opts)) {
 5577|       |         // In flow context, only treat plain content as an implicit "key: value"
 5578|       |         // when a mapping separator appears before the next top-level flow delimiter.
 5579|       |         auto could_be_implicit_flow_pair = [&](auto pos) {
 5580|       |            // Bounded by the longest implicit key the spec allows: unbounded, this probe runs
 5581|       |            // once per entry per nesting level over the whole remaining flow collection.
 5582|       |            const auto stop = yaml::implicit_key_scan_end(pos, end);
 5583|       |            // See `line_could_be_block_mapping` for why a quote is an indicator only where a node
 5584|       |            // can begin. Brackets need no such guard here: ns-plain-safe-in keeps them out of a
 5585|       |            // flow-context plain scalar, so every one of them is an indicator.
 5586|       |            bool at_node_start = true;
 5587|       |            int depth = 0;
 5588|       |            while (pos != stop) {
 5589|       |               const char c = *pos;
 5590|       |               if (c == ' ' || c == '\t') {
 5591|       |                  ++pos;
 5592|       |                  continue;
 5593|       |               }
 5594|       |               const bool node_start = std::exchange(at_node_start, false);
 5595|       |
 5596|       |               if ((c == '"' || c == '\'') && node_start) {
 5597|       |                  if (not yaml::skip_probe_quoted_scalar(pos, stop)) return false;
 5598|       |                  continue;
 5599|       |               }
 5600|       |               if (c == '[' || c == '{') {
 5601|       |                  ++depth;
 5602|       |                  at_node_start = true;
 5603|       |                  ++pos;
 5604|       |                  continue;
 5605|       |               }
 5606|       |               if (c == ']' || c == '}') {
 5607|       |                  if (depth == 0) return false;
 5608|       |                  --depth;
 5609|       |                  ++pos;
 5610|       |                  continue;
 5611|       |               }
 5612|       |               if (c == ',' && depth == 0) return false;
 5613|       |               if (c == ':' && depth == 0) {
 5614|       |                  auto next = pos + 1;
 5615|       |                  return next == end || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
 5616|       |               }
 5617|       |               // Inside a nested collection ',' separates entries and ':' ends a key.
 5618|       |               if (c == ',' || c == ':') {
 5619|       |                  at_node_start = true;
 5620|       |                  ++pos;
 5621|       |                  continue;
 5622|       |               }
 5623|       |               if (node_start && yaml::skip_probe_node_property(pos, stop)) {
 5624|       |                  at_node_start = true;
 5625|       |                  continue;
 5626|       |               }
 5627|       |               ++pos;
 5628|       |            }
 5629|       |            return false;
 5630|       |         };
 5631|       |
 5632|       |         if (could_be_implicit_flow_pair(it) || line_could_be_flow_mapping(it, end)) {
 5633|       |            if (try_parse_block_mapping_into_variant<Variant, Opts>(value, ctx, it, end)) {
 5634|       |               return;
 5635|       |            }
 5636|       |            if (bool(ctx.error)) {
 5637|       |               return;
 5638|       |            }
 5639|       |         }
 5640|       |
 5641|       |         process_yaml_variant_alternatives<Variant, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 5642|       |         return;
 5643|       |      }
 5644|       |
 5645|   517k|      if (try_parse_block_mapping_into_variant<Variant, Opts>(value, ctx, it, end)) {
  ------------------
  |  Branch (5645:11): [True: 291k, False: 226k]
  ------------------
 5646|   291k|         return;
 5647|   291k|      }
 5648|       |      // If an error was set (e.g., malformed flow collection in value), don't try to parse as string
 5649|   226k|      if (bool(ctx.error)) {
  ------------------
  |  Branch (5649:11): [True: 24.6k, False: 201k]
  ------------------
 5650|  24.6k|         return;
 5651|  24.6k|      }
 5652|   201k|      process_yaml_variant_alternatives<Variant, is_yaml_variant_str>::template op<Opts>(value, ctx, it, end);
 5653|   201k|   }
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRSH_TkNS_10is_contextERNSK_12yaml_contextESN_EEvOT1_OT2_OT0_T3_ENKUlT_E0_clISN_EEDaSZ_:
 6007|  72.3k|            auto is_word_boundary = [&](const auto ptr) {
 6008|  72.3k|               if (ptr == end) {
  ------------------
  |  Branch (6008:20): [True: 3.83k, False: 68.5k]
  ------------------
 6009|  3.83k|                  return true;
 6010|  3.83k|               }
 6011|  68.5k|               if (*ptr == ':') {
  ------------------
  |  Branch (6011:20): [True: 17.4k, False: 51.1k]
  ------------------
 6012|  17.4k|                  auto next = ptr + 1;
 6013|  17.4k|                  return (next == end) || *next == ' ' || *next == '\t' || *next == '\n' || *next == '\r';
  ------------------
  |  Branch (6013:26): [True: 3.90k, False: 13.5k]
  |  Branch (6013:43): [True: 2.96k, False: 10.5k]
  |  Branch (6013:59): [True: 2.25k, False: 8.30k]
  |  Branch (6013:76): [True: 2.94k, False: 5.36k]
  |  Branch (6013:93): [True: 3.53k, False: 1.83k]
  ------------------
 6014|  17.4k|               }
 6015|  51.1k|               return is_plain_scalar_boundary(*ptr);
 6016|  68.5k|            };
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRSH_TkNS_10is_contextERNSK_12yaml_contextESN_EEvOT1_OT2_OT0_T3_ENKUlcE_clEc:
 5933|  51.1k|            auto is_plain_scalar_boundary = [](const char ch) {
 5934|  51.1k|               switch (ch) {
 5935|  1.52k|               case ' ':
  ------------------
  |  Branch (5935:16): [True: 1.52k, False: 49.6k]
  ------------------
 5936|  2.97k|               case '\t':
  ------------------
  |  Branch (5936:16): [True: 1.45k, False: 49.6k]
  ------------------
 5937|  17.3k|               case '\n':
  ------------------
  |  Branch (5937:16): [True: 14.3k, False: 36.7k]
  ------------------
 5938|  43.4k|               case '\r':
  ------------------
  |  Branch (5938:16): [True: 26.1k, False: 25.0k]
  ------------------
 5939|  44.3k|               case ',':
  ------------------
  |  Branch (5939:16): [True: 856, False: 50.2k]
  ------------------
 5940|  45.2k|               case ']':
  ------------------
  |  Branch (5940:16): [True: 909, False: 50.2k]
  ------------------
 5941|  46.0k|               case '}':
  ------------------
  |  Branch (5941:16): [True: 765, False: 50.3k]
  ------------------
 5942|  46.0k|                  return true;
 5943|  5.11k|               default:
  ------------------
  |  Branch (5943:16): [True: 5.11k, False: 46.0k]
  ------------------
 5944|  5.11k|                  return false;
 5945|  51.1k|               }
 5946|  51.1k|            };
_ZZN3glz4fromILj450ENSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEEE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERPKcRSH_TkNS_10is_contextERNSK_12yaml_contextESN_EEvOT1_OT2_OT0_T3_ENKUlT_E_clISN_EEDaSZ_:
 5948|  65.4k|            auto has_indented_block_continuation = [&](auto word_end) {
 5949|       |               if constexpr (yaml::check_flow_context(Opts)) {
 5950|       |                  return false;
 5951|       |               }
 5952|  65.4k|               if (ctx.current_indent() < 0) {
  ------------------
  |  Branch (5952:20): [True: 5.65k, False: 59.7k]
  ------------------
 5953|  5.65k|                  return false;
 5954|  5.65k|               }
 5955|  59.7k|               if (word_end == end || (*word_end != '\n' && *word_end != '\r')) {
  ------------------
  |  Branch (5955:20): [True: 2.49k, False: 57.3k]
  |  Branch (5955:40): [True: 42.9k, False: 14.3k]
  |  Branch (5955:61): [True: 17.0k, False: 25.8k]
  ------------------
 5956|  19.5k|                  return false;
 5957|  19.5k|               }
 5958|       |
 5959|  40.2k|               auto look = word_end;
 5960|  40.2k|               yaml::skip_newline(look, end);
 5961|   147k|               while (look != end) {
  ------------------
  |  Branch (5961:23): [True: 131k, False: 16.3k]
  ------------------
 5962|   131k|                  int32_t line_indent = 0;
 5963|   579k|                  while (look != end && *look == ' ') {
  ------------------
  |  Branch (5963:26): [True: 578k, False: 673]
  |  Branch (5963:41): [True: 447k, False: 130k]
  ------------------
 5964|   447k|                     ++line_indent;
 5965|   447k|                     ++look;
 5966|   447k|                  }
 5967|   131k|                  if (look != end && *look == '\t') {
  ------------------
  |  Branch (5967:23): [True: 130k, False: 673]
  |  Branch (5967:38): [True: 1.51k, False: 129k]
  ------------------
 5968|  1.51k|                     return false;
 5969|  1.51k|                  }
 5970|   130k|                  if (look == end || *look == '\n' || *look == '\r') {
  ------------------
  |  Branch (5970:23): [True: 673, False: 129k]
  |  Branch (5970:38): [True: 87.4k, False: 41.9k]
  |  Branch (5970:55): [True: 11.0k, False: 30.9k]
  ------------------
 5971|  99.1k|                     if (look != end) {
  ------------------
  |  Branch (5971:26): [True: 98.4k, False: 673]
  ------------------
 5972|  98.4k|                        yaml::skip_newline(look, end);
 5973|  98.4k|                        continue;
 5974|  98.4k|                     }
 5975|    673|                     return false;
 5976|  99.1k|                  }
 5977|  30.9k|                  if (*look == '#') {
  ------------------
  |  Branch (5977:23): [True: 10.0k, False: 20.8k]
  ------------------
 5978|  10.0k|                     yaml::skip_comment(look, end);
 5979|  10.0k|                     if (look != end && (*look == '\n' || *look == '\r')) {
  ------------------
  |  Branch (5979:26): [True: 9.27k, False: 765]
  |  Branch (5979:42): [True: 5.50k, False: 3.76k]
  |  Branch (5979:59): [True: 3.72k, False: 47]
  ------------------
 5980|  9.22k|                        yaml::skip_newline(look, end);
 5981|  9.22k|                        continue;
 5982|  9.22k|                     }
 5983|    812|                     return false;
 5984|  10.0k|                  }
 5985|       |
 5986|       |                  // If the next non-empty line is an implicit mapping entry,
 5987|       |                  // don't treat it as scalar continuation for auto-deduced
 5988|       |                  // booleans/nulls.
 5989|  20.8k|                  {
 5990|  20.8k|                     auto scan = look;
 5991|   479k|                     while (scan != end && *scan != '\n' && *scan != '\r') {
  ------------------
  |  Branch (5991:29): [True: 478k, False: 1.25k]
  |  Branch (5991:44): [True: 469k, False: 9.32k]
  |  Branch (5991:61): [True: 467k, False: 1.89k]
  ------------------
 5992|   467k|                        if (*scan == ':') {
  ------------------
  |  Branch (5992:29): [True: 11.9k, False: 455k]
  ------------------
 5993|  11.9k|                           auto after_colon = scan + 1;
 5994|  11.9k|                           if (after_colon == end || *after_colon == ' ' || *after_colon == '\t' ||
  ------------------
  |  Branch (5994:32): [True: 871, False: 11.0k]
  |  Branch (5994:54): [True: 3.08k, False: 7.99k]
  |  Branch (5994:77): [True: 1.92k, False: 6.07k]
  ------------------
 5995|  8.41k|                               *after_colon == '\n' || *after_colon == '\r') {
  ------------------
  |  Branch (5995:32): [True: 1.09k, False: 4.97k]
  |  Branch (5995:56): [True: 1.44k, False: 3.52k]
  ------------------
 5996|  8.41k|                              return false;
 5997|  8.41k|                           }
 5998|  11.9k|                        }
 5999|   458k|                        ++scan;
 6000|   458k|                     }
 6001|  20.8k|                  }
 6002|       |
 6003|  12.4k|                  return line_indent > ctx.current_indent();
 6004|  20.8k|               }
 6005|  16.3k|               return false;
 6006|  40.2k|            };
_ZN3glz36try_parse_block_mapping_into_variantINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERSH_RNSI_12yaml_contextERPKcSO_EEbOT1_OT2_OT3_T4_:
 5529|   609k|   {
 5530|   609k|      using counts = yaml_variant_type_count<Variant>;
 5531|       |      if constexpr (counts::n_object == 0) {
 5532|       |         return false;
 5533|       |      }
 5534|   609k|      else {
 5535|       |         // Quick check: if no viable mapping separator in the current span,
 5536|       |         // avoid expensive speculative parse.
 5537|   609k|         const bool could_be_mapping = [&] {
 5538|   609k|            if constexpr (yaml::check_flow_context(Opts)) {
 5539|   609k|               return line_could_be_flow_mapping(it, end);
 5540|   609k|            }
 5541|   609k|            else {
 5542|   609k|               return yaml::line_could_be_block_mapping(it, end);
 5543|   609k|            }
 5544|   609k|         }();
 5545|   609k|         if (!could_be_mapping) {
  ------------------
  |  Branch (5545:14): [True: 238k, False: 371k]
  ------------------
 5546|   238k|            return false;
 5547|   238k|         }
 5548|       |         // Full parse attempt - use a temporary context that inherits indent from parent
 5549|   371k|         auto temp_ctx = ctx.make_speculative();
 5550|   371k|         process_yaml_variant_alternatives<Variant, is_yaml_variant_object>::template op<Opts>(value, temp_ctx, it,
 5551|   371k|                                                                                               end);
 5552|   371k|         ctx.alias_expansion_budget = temp_ctx.alias_expansion_budget; // charged even if rejected
 5553|   371k|         ctx.key_expansion_budget = temp_ctx.key_expansion_budget;
 5554|   371k|         if (!bool(temp_ctx.error)) {
  ------------------
  |  Branch (5554:14): [True: 319k, False: 51.4k]
  ------------------
 5555|   319k|            ctx.anchors = std::move(temp_ctx.anchors);
 5556|   319k|            return true;
 5557|   319k|         }
 5558|       |         // The line matched "key: value" pattern but parsing failed.
 5559|       |         // This indicates malformed content (e.g., unclosed flow collection),
 5560|       |         // so propagate the error rather than silently falling back to string.
 5561|  51.4k|         ctx.error = temp_ctx.error;
 5562|  51.4k|         ctx.custom_error_message = temp_ctx.custom_error_message;
 5563|  51.4k|         return false;
 5564|   371k|      }
 5565|   609k|   }
_ZZN3glz36try_parse_block_mapping_into_variantINSt3__17variantIJDndNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS1_6vectorINS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEENS6_ISD_EEEENSC_ISD_EEEEETnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERSH_RNSI_12yaml_contextERPKcSO_EEbOT1_OT2_OT3_T4_ENKUlvE_clEv:
 5537|   609k|         const bool could_be_mapping = [&] {
 5538|       |            if constexpr (yaml::check_flow_context(Opts)) {
 5539|       |               return line_could_be_flow_mapping(it, end);
 5540|       |            }
 5541|   609k|            else {
 5542|   609k|               return yaml::line_could_be_block_mapping(it, end);
 5543|   609k|            }
 5544|   609k|         }();
_ZZN3glz5parseILj450EE2opITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_10is_contextERNS3_12yaml_contextERPKcSD_EEvOT0_OT1_OT2_T3_ENKUlT_E_clISD_EEDaSM_:
  146|  1.79k|               auto is_document_start = [&](auto pos) {
  147|  1.79k|                  if (end - pos >= 3 && pos[0] == '-' && pos[1] == '-' && pos[2] == '-') {
  ------------------
  |  Branch (147:23): [True: 984, False: 814]
  |  Branch (147:41): [True: 425, False: 559]
  |  Branch (147:58): [True: 367, False: 58]
  |  Branch (147:75): [True: 347, False: 20]
  ------------------
  148|    347|                     auto after = pos + 3;
  149|    347|                     return after == end || *after == ' ' || *after == '\t' || *after == '\n' || *after == '\r' ||
  ------------------
  |  Branch (149:29): [True: 16, False: 331]
  |  Branch (149:45): [True: 109, False: 222]
  |  Branch (149:62): [True: 139, False: 83]
  |  Branch (149:80): [True: 40, False: 43]
  |  Branch (149:98): [True: 34, False: 9]
  ------------------
  150|      9|                            *after == '#';
  ------------------
  |  Branch (150:29): [True: 3, False: 6]
  ------------------
  151|    347|                  }
  152|  1.45k|                  return false;
  153|  1.79k|               };
_ZN3glz9read_yamlITnDaXtlNS_4yaml9yaml_optsELj450ELb1ELb0ELb1ELh2EEERNS_12generic_jsonILNS_8num_modeE0ENS_17ordered_small_mapEEETkNS_10contiguousERNSt3__16vectorIcNS8_9allocatorIcEEEEEENS_9error_ctxEOT0_OT1_:
 6777|  39.9k|   {
 6778|  39.9k|      if (buffer.size() == 0) {
  ------------------
  |  Branch (6778:11): [True: 0, False: 39.9k]
  ------------------
 6779|      0|         using V = std::remove_cvref_t<T>;
 6780|      0|         if constexpr (requires { value = nullptr; }) {
 6781|      0|            value = nullptr;
 6782|      0|            return {};
 6783|       |         }
 6784|       |         else if constexpr (nullable_like<V>) {
 6785|       |            value = {};
 6786|       |            return {};
 6787|       |         }
 6788|      0|      }
 6789|      0|      yaml::yaml_context ctx{};
 6790|  39.9k|      return read<set_yaml<Opts>()>(std::forward<T>(value), std::forward<Buffer>(buffer), ctx);
 6791|  39.9k|   }

