_Z16le16toh_internalt:
   29|  1.94k|{
   30|       |    if constexpr (std::endian::native == std::endian::big) return internal_bswap_16(little_endian_16bits);
   31|  1.94k|        else return little_endian_16bits;
   32|  1.94k|}
_Z16le32toh_internalj:
   49|  1.90k|{
   50|       |    if constexpr (std::endian::native == std::endian::big) return internal_bswap_32(little_endian_32bits);
   51|  1.90k|        else return little_endian_32bits;
   52|  1.90k|}
_Z16le64toh_internalm:
   69|  1.62k|{
   70|       |    if constexpr (std::endian::native == std::endian::big) return internal_bswap_64(little_endian_64bits);
   71|  1.62k|        else return little_endian_64bits;
   72|  1.62k|}

_Z11UnserializeI12BufferedFileEvRT_Rb:
  286|    672|template <typename Stream> inline void Unserialize(Stream& s, bool& a) { uint8_t f = ser_readdata8(s); a = f; }
_Z13ser_readdata8I12BufferedFileEhRT_:
   84|  7.69k|{
   85|  7.69k|    uint8_t obj;
   86|  7.69k|    s.read(AsWritableBytes(Span{&obj, 1}));
   87|  7.69k|    return obj;
   88|  7.69k|}
_Z11UnserializeI12BufferedFileEvRT_Ra:
  272|    894|template<typename Stream> inline void Unserialize(Stream& s, int8_t& a  ) { a = ser_readdata8(s); }
_Z11UnserializeI12BufferedFileEvRT_Rh:
  273|    592|template<typename Stream> inline void Unserialize(Stream& s, uint8_t& a ) { a = ser_readdata8(s); }
_Z11UnserializeI12BufferedFileEvRT_Rs:
  274|    629|template<typename Stream> inline void Unserialize(Stream& s, int16_t& a ) { a = ser_readdata16(s); }
_Z14ser_readdata16I12BufferedFileEtRT_:
   90|  1.98k|{
   91|  1.98k|    uint16_t obj;
   92|  1.98k|    s.read(AsWritableBytes(Span{&obj, 1}));
   93|  1.98k|    return le16toh_internal(obj);
   94|  1.98k|}
_Z11UnserializeI12BufferedFileEvRT_Rt:
  275|  1.00k|template<typename Stream> inline void Unserialize(Stream& s, uint16_t& a) { a = ser_readdata16(s); }
_Z11UnserializeI12BufferedFileEvRT_Ri:
  276|    756|template<typename Stream> inline void Unserialize(Stream& s, int32_t& a ) { a = ser_readdata32(s); }
_Z14ser_readdata32I12BufferedFileEjRT_:
  102|  1.95k|{
  103|  1.95k|    uint32_t obj;
  104|  1.95k|    s.read(AsWritableBytes(Span{&obj, 1}));
  105|  1.95k|    return le32toh_internal(obj);
  106|  1.95k|}
_Z11UnserializeI12BufferedFileEvRT_Rj:
  277|    720|template<typename Stream> inline void Unserialize(Stream& s, uint32_t& a) { a = ser_readdata32(s); }
_Z11UnserializeI12BufferedFileEvRT_Rl:
  278|    662|template<typename Stream> inline void Unserialize(Stream& s, int64_t& a ) { a = ser_readdata64(s); }
_Z14ser_readdata64I12BufferedFileEmRT_:
  114|  1.76k|{
  115|  1.76k|    uint64_t obj;
  116|  1.76k|    s.read(AsWritableBytes(Span{&obj, 1}));
  117|  1.76k|    return le64toh_internal(obj);
  118|  1.76k|}
_Z11UnserializeI12BufferedFileEvRT_Rm:
  279|    696|template<typename Stream> inline void Unserialize(Stream& s, uint64_t& a) { a = ser_readdata64(s); }
_Z11UnserializeI12BufferedFilecEvRT_RNSt3__112basic_stringIT0_NS3_11char_traitsIS5_EENS3_9allocatorIS5_EEEE:
  797|  2.06k|{
  798|  2.06k|    unsigned int nSize = ReadCompactSize(is);
  799|  2.06k|    str.resize(nSize);
  800|  2.06k|    if (nSize != 0)
  ------------------
  |  Branch (800:9): [True: 1.16k, False: 900]
  ------------------
  801|  1.16k|        is.read(MakeWritableByteSpan(str));
  802|  2.06k|}
_Z15ReadCompactSizeI12BufferedFileEmRT_b:
  340|  5.53k|{
  341|  5.53k|    uint8_t chSize = ser_readdata8(is);
  342|  5.53k|    uint64_t nSizeRet = 0;
  343|  5.53k|    if (chSize < 253)
  ------------------
  |  Branch (343:9): [True: 3.69k, False: 1.84k]
  ------------------
  344|  3.69k|    {
  345|  3.69k|        nSizeRet = chSize;
  346|  3.69k|    }
  347|  1.84k|    else if (chSize == 253)
  ------------------
  |  Branch (347:14): [True: 359, False: 1.48k]
  ------------------
  348|    359|    {
  349|    359|        nSizeRet = ser_readdata16(is);
  350|    359|        if (nSizeRet < 253)
  ------------------
  |  Branch (350:13): [True: 67, False: 292]
  ------------------
  351|     67|            throw std::ios_base::failure("non-canonical ReadCompactSize()");
  352|    359|    }
  353|  1.48k|    else if (chSize == 254)
  ------------------
  |  Branch (353:14): [True: 480, False: 1.00k]
  ------------------
  354|    480|    {
  355|    480|        nSizeRet = ser_readdata32(is);
  356|    480|        if (nSizeRet < 0x10000u)
  ------------------
  |  Branch (356:13): [True: 131, False: 349]
  ------------------
  357|    131|            throw std::ios_base::failure("non-canonical ReadCompactSize()");
  358|    480|    }
  359|  1.00k|    else
  360|  1.00k|    {
  361|  1.00k|        nSizeRet = ser_readdata64(is);
  362|  1.00k|        if (nSizeRet < 0x100000000ULL)
  ------------------
  |  Branch (362:13): [True: 105, False: 898]
  ------------------
  363|    105|            throw std::ios_base::failure("non-canonical ReadCompactSize()");
  364|  1.00k|    }
  365|  5.23k|    if (range_check && nSizeRet > MAX_SIZE) {
  ------------------
  |  Branch (365:9): [True: 4.62k, False: 608]
  |  Branch (365:24): [True: 470, False: 4.15k]
  ------------------
  366|    470|        throw std::ios_base::failure("ReadCompactSize(): size too large");
  367|    470|    }
  368|  4.76k|    return nSizeRet;
  369|  5.23k|}
_Z11UnserializeI12BufferedFilehNSt3__19allocatorIhEEEvRT_RNS1_6vectorIT0_T1_EE:
  866|  3.47k|{
  867|  3.47k|    if constexpr (BasicByte<T>) { // Use optimized version for unformatted basic bytes
  868|       |        // Limit size per read so bogus size value won't cause out of memory
  869|  3.47k|        v.clear();
  870|  3.47k|        unsigned int nSize = ReadCompactSize(is);
  871|  3.47k|        unsigned int i = 0;
  872|  5.23k|        while (i < nSize) {
  ------------------
  |  Branch (872:16): [True: 1.76k, False: 3.47k]
  ------------------
  873|  1.76k|            unsigned int blk = std::min(nSize - i, (unsigned int)(1 + 4999999 / sizeof(T)));
  874|  1.76k|            v.resize(i + blk);
  875|  1.76k|            is.read(AsWritableBytes(Span{&v[i], blk}));
  876|  1.76k|            i += blk;
  877|  1.76k|        }
  878|       |    } else {
  879|       |        Unserialize(is, Using<VectorFormatter<DefaultFormatter>>(v));
  880|       |    }
  881|  3.47k|}

_ZNK4SpanIKSt4byteE4sizeEv:
  187|   904k|    constexpr std::size_t size() const noexcept { return m_size; }
_ZNK4SpanIhE4dataEv:
  174|  9.45k|    constexpr C* data() const noexcept { return m_data; }
_ZNK4SpanISt4byteE4sizeEv:
  187|  2.26M|    constexpr std::size_t size() const noexcept { return m_size; }
_ZNK4SpanISt4byteEixEm:
  191|   476k|    {
  192|   476k|        ASSERT_IF_DEBUG(size() > pos);
  193|   476k|        return m_data[pos];
  194|   476k|    }
_ZNK4SpanIKSt4byteEixEm:
  191|   476k|    {
  192|   476k|        ASSERT_IF_DEBUG(size() > pos);
  193|   476k|        return m_data[pos];
  194|   476k|    }
_ZNK4SpanISt4byteE4dataEv:
  174|  1.28M|    constexpr C* data() const noexcept { return m_data; }
_ZNK4SpanISt4byteE7subspanEmm:
  201|  1.22M|    {
  202|  1.22M|        ASSERT_IF_DEBUG(size() >= offset + count);
  203|  1.22M|        return Span<C>(m_data + offset, count);
  204|  1.22M|    }
_ZNK4SpanISt4byteE7subspanEm:
  196|   267k|    {
  197|   267k|        ASSERT_IF_DEBUG(size() >= offset);
  198|   267k|        return Span<C>(m_data + offset, m_size - offset);
  199|   267k|    }
_ZNK4SpanIjE4dataEv:
  174|  1.95k|    constexpr C* data() const noexcept { return m_data; }
_ZNK4SpanIjE10size_bytesEv:
  188|  1.95k|    constexpr std::size_t size_bytes() const noexcept { return sizeof(C) * m_size; }
_ZNK4SpanIhE10size_bytesEv:
  188|  9.45k|    constexpr std::size_t size_bytes() const noexcept { return sizeof(C) * m_size; }
_ZNK4SpanItE4dataEv:
  174|  1.98k|    constexpr C* data() const noexcept { return m_data; }
_ZNK4SpanItE10size_bytesEv:
  188|  1.98k|    constexpr std::size_t size_bytes() const noexcept { return sizeof(C) * m_size; }
_ZNK4SpanImE4dataEv:
  174|  1.76k|    constexpr C* data() const noexcept { return m_data; }
_ZNK4SpanImE10size_bytesEv:
  188|  1.76k|    constexpr std::size_t size_bytes() const noexcept { return sizeof(C) * m_size; }
_ZN4SpanISt4byteEC2IS0_TnNSt3__19enable_ifIXsr3std14is_convertibleIPA_T_PA_S0_EE5valueEiE4typeELi0EEEPS5_m:
  119|  1.51M|    constexpr Span(T* begin, std::size_t size) noexcept : m_data(begin), m_size(size) {}
_Z15AsWritableBytesIhE4SpanISt4byteES0_IT_E:
  264|  9.45k|{
  265|  9.45k|    return {reinterpret_cast<std::byte*>(s.data()), s.size_bytes()};
  266|  9.45k|}
_ZN4SpanIhEC2IhTnNSt3__19enable_ifIXsr3std14is_convertibleIPA_T_PA_hEE5valueEiE4typeELi0EEEPS4_m:
  119|  9.45k|    constexpr Span(T* begin, std::size_t size) noexcept : m_data(begin), m_size(size) {}
_Z15AsWritableBytesItE4SpanISt4byteES0_IT_E:
  264|  1.98k|{
  265|  1.98k|    return {reinterpret_cast<std::byte*>(s.data()), s.size_bytes()};
  266|  1.98k|}
_ZN4SpanItEC2ItTnNSt3__19enable_ifIXsr3std14is_convertibleIPA_T_PA_tEE5valueEiE4typeELi0EEEPS4_m:
  119|  1.98k|    constexpr Span(T* begin, std::size_t size) noexcept : m_data(begin), m_size(size) {}
_Z15AsWritableBytesIjE4SpanISt4byteES0_IT_E:
  264|  1.95k|{
  265|  1.95k|    return {reinterpret_cast<std::byte*>(s.data()), s.size_bytes()};
  266|  1.95k|}
_ZN4SpanIjEC2IjTnNSt3__19enable_ifIXsr3std14is_convertibleIPA_T_PA_jEE5valueEiE4typeELi0EEEPS4_m:
  119|  1.95k|    constexpr Span(T* begin, std::size_t size) noexcept : m_data(begin), m_size(size) {}
_Z15AsWritableBytesImE4SpanISt4byteES0_IT_E:
  264|  1.76k|{
  265|  1.76k|    return {reinterpret_cast<std::byte*>(s.data()), s.size_bytes()};
  266|  1.76k|}
_ZN4SpanImEC2ImTnNSt3__19enable_ifIXsr3std14is_convertibleIPA_T_PA_mEE5valueEiE4typeELi0EEEPS4_m:
  119|  1.76k|    constexpr Span(T* begin, std::size_t size) noexcept : m_data(begin), m_size(size) {}
_Z20MakeWritableByteSpanIRNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEE4SpanISt4byteEOT_:
  275|  1.16k|{
  276|  1.16k|    return AsWritableBytes(Span{std::forward<V>(v)});
  277|  1.16k|}
_Z15AsWritableBytesIcE4SpanISt4byteES0_IT_E:
  264|  1.16k|{
  265|  1.16k|    return {reinterpret_cast<std::byte*>(s.data()), s.size_bytes()};
  266|  1.16k|}
_ZNK4SpanIcE4dataEv:
  174|  1.16k|    constexpr C* data() const noexcept { return m_data; }
_ZNK4SpanIcE10size_bytesEv:
  188|  1.16k|    constexpr std::size_t size_bytes() const noexcept { return sizeof(C) * m_size; }
_ZN4SpanIcEC2INSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEERT_NS2_9enable_ifIXaaaantsr7is_SpanIS9_EE5valuesr3std14is_convertibleIPA_NS2_14remove_pointerIDTcldtclsr3stdE7declvalISA_EE4dataEEE4typeEPA_cEE5valuesr3std14is_convertibleIDTcldtclsr3stdE7declvalISA_EE4sizeEEmEE5valueEDnE4typeE:
  165|  1.16k|        : m_data(other.data()), m_size(other.size()){}
_ZN4SpanIKSt4byteEC2INSt3__16vectorIS0_NS4_9allocatorIS0_EEEEEERT_NS4_9enable_ifIXaaaantsr7is_SpanIS9_EE5valuesr3std14is_convertibleIPA_NS4_14remove_pointerIDTcldtclsr3stdE7declvalISA_EE4dataEEE4typeEPA_S1_EE5valuesr3std14is_convertibleIDTcldtclsr3stdE7declvalISA_EE4sizeEEmEE5valueEDnE4typeE:
  165|   213k|        : m_data(other.data()), m_size(other.size()){}
_ZN4SpanISt4byteEC2INSt3__16vectorIS0_NS3_9allocatorIS0_EEEEEERT_NS3_9enable_ifIXaaaantsr7is_SpanIS8_EE5valuesr3std14is_convertibleIPA_NS3_14remove_pointerIDTcldtclsr3stdE7declvalIS9_EE4dataEEE4typeEPA_S0_EE5valuesr3std14is_convertibleIDTcldtclsr3stdE7declvalIS9_EE4sizeEEmEE5valueEDnE4typeE:
  165|  1.01M|        : m_data(other.data()), m_size(other.size()){}

_ZN8AutoFileC2EP8_IO_FILENSt3__16vectorISt4byteNS2_9allocatorIS4_EEEE:
   13|  1.63k|    : m_file{file}, m_xor{std::move(data_xor)}
   14|  1.63k|{
   15|  1.63k|    if (!IsNull()) {
  ------------------
  |  Branch (15:9): [True: 1.42k, False: 217]
  ------------------
   16|  1.42k|        auto pos{std::ftell(m_file)};
   17|  1.42k|        if (pos >= 0) m_position = pos;
  ------------------
  |  Branch (17:13): [True: 856, False: 564]
  ------------------
   18|  1.42k|    }
   19|  1.63k|}
_ZN8AutoFile12detail_freadE4SpanISt4byteE:
   22|  1.01M|{
   23|  1.01M|    if (!m_file) throw std::ios_base::failure("AutoFile::read: file handle is nullptr");
  ------------------
  |  Branch (23:9): [True: 0, False: 1.01M]
  ------------------
   24|  1.01M|    size_t ret = std::fread(dst.data(), 1, dst.size(), m_file);
   25|  1.01M|    if (!m_xor.empty()) {
  ------------------
  |  Branch (25:9): [True: 213k, False: 800k]
  ------------------
   26|   213k|        if (!m_position.has_value()) throw std::ios_base::failure("AutoFile::read: position unknown");
  ------------------
  |  Branch (26:13): [True: 78, False: 213k]
  ------------------
   27|   213k|        util::Xor(dst.subspan(0, ret), m_xor, *m_position);
   28|   213k|    }
   29|  1.01M|    if (m_position.has_value()) *m_position += ret;
  ------------------
  |  Branch (29:9): [True: 902k, False: 111k]
  ------------------
   30|  1.01M|    return ret;
   31|  1.01M|}

_ZN4util3XorE4SpanISt4byteES0_IKS1_Em:
   29|   213k|{
   30|   213k|    if (key.size() == 0) {
  ------------------
  |  Branch (30:9): [True: 0, False: 213k]
  ------------------
   31|      0|        return;
   32|      0|    }
   33|   213k|    key_offset %= key.size();
   34|       |
   35|   690k|    for (size_t i = 0, j = key_offset; i != write.size(); i++) {
  ------------------
  |  Branch (35:40): [True: 476k, False: 213k]
  ------------------
   36|   476k|        write[i] ^= key[j++];
   37|       |
   38|       |        // This potentially acts on very many bytes of data, so it's
   39|       |        // important that we calculate `j`, i.e. the `key` index in this
   40|       |        // way instead of doing a %, which would effectively be a division
   41|       |        // for each byte Xor'd -- much slower than need be.
   42|   476k|        if (j == key.size())
  ------------------
  |  Branch (42:13): [True: 110k, False: 366k]
  ------------------
   43|   110k|            j = 0;
   44|   476k|    }
   45|   213k|}
_ZN8AutoFileD2Ev:
  401|  1.63k|    ~AutoFile() { fclose(); }
_ZNK8AutoFile4feofEv:
  407|  2.55k|    bool feof() const { return std::feof(m_file); }
_ZN8AutoFile6fcloseEv:
  410|  1.63k|    {
  411|  1.63k|        if (auto rel{release()}) return std::fclose(rel);
  ------------------
  |  Branch (411:18): [True: 1.42k, False: 217]
  ------------------
  412|    217|        return 0;
  413|  1.63k|    }
_ZN8AutoFile7releaseEv:
  420|  1.63k|    {
  421|  1.63k|        std::FILE* ret{m_file};
  422|  1.63k|        m_file = nullptr;
  423|  1.63k|        return ret;
  424|  1.63k|    }
_ZNK8AutoFile6IsNullEv:
  428|  3.00k|    bool IsNull() const { return m_file == nullptr; }
_ZN12BufferedFile4FillEv:
  487|  1.01M|    bool Fill() {
  488|  1.01M|        unsigned int pos = nSrcPos % vchBuf.size();
  489|  1.01M|        unsigned int readNow = vchBuf.size() - pos;
  490|  1.01M|        unsigned int nAvail = vchBuf.size() - (nSrcPos - m_read_pos) - nRewind;
  491|  1.01M|        if (nAvail < readNow)
  ------------------
  |  Branch (491:13): [True: 902k, False: 111k]
  ------------------
  492|   902k|            readNow = nAvail;
  493|  1.01M|        if (readNow == 0)
  ------------------
  |  Branch (493:13): [True: 0, False: 1.01M]
  ------------------
  494|      0|            return false;
  495|  1.01M|        size_t nBytes{m_src.detail_fread(Span{vchBuf}.subspan(pos, readNow))};
  496|  1.01M|        if (nBytes == 0) {
  ------------------
  |  Branch (496:13): [True: 2.55k, False: 1.01M]
  ------------------
  497|  2.55k|            throw std::ios_base::failure{m_src.feof() ? "BufferedFile::Fill: end of file" : "BufferedFile::Fill: fread failed"};
  ------------------
  |  Branch (497:42): [True: 1.25k, False: 1.29k]
  ------------------
  498|  2.55k|        }
  499|  1.01M|        nSrcPos += nBytes;
  500|  1.01M|        return true;
  501|  1.01M|    }
_ZN12BufferedFile13AdvanceStreamEm:
  509|   269k|    {
  510|   269k|        assert(m_read_pos <= nSrcPos);
  511|   269k|        if (m_read_pos + length > nReadLimit) {
  ------------------
  |  Branch (511:13): [True: 464, False: 269k]
  ------------------
  512|    464|            throw std::ios_base::failure("Attempt to position past buffer limit");
  513|    464|        }
  514|       |        // If there are no bytes available, read from the file.
  515|   269k|        if (m_read_pos == nSrcPos && length > 0) Fill();
  ------------------
  |  Branch (515:13): [True: 259k, False: 9.58k]
  |  Branch (515:38): [True: 259k, False: 0]
  ------------------
  516|       |
  517|   269k|        size_t buffer_offset{static_cast<size_t>(m_read_pos % vchBuf.size())};
  518|   269k|        size_t buffer_available{static_cast<size_t>(vchBuf.size() - buffer_offset)};
  519|   269k|        size_t bytes_until_source_pos{static_cast<size_t>(nSrcPos - m_read_pos)};
  520|   269k|        size_t advance{std::min({length, buffer_available, bytes_until_source_pos})};
  521|   269k|        m_read_pos += advance;
  522|   269k|        return std::make_pair(&vchBuf[buffer_offset], advance);
  523|   269k|    }
_ZN12BufferedFileC2ER8AutoFilemm:
  527|  1.63k|        : m_src{file}, nReadLimit{std::numeric_limits<uint64_t>::max()}, nRewind{nRewindIn}, vchBuf(nBufSize, std::byte{0})
  528|  1.63k|    {
  529|  1.63k|        if (nRewindIn >= nBufSize)
  ------------------
  |  Branch (529:13): [True: 269, False: 1.36k]
  ------------------
  530|    269|            throw std::ios_base::failure("Rewind limit must be less than buffer size");
  531|  1.63k|    }
_ZN12BufferedFile4readE4SpanISt4byteE:
  540|  17.5k|    {
  541|   287k|        while (dst.size() > 0) {
  ------------------
  |  Branch (541:16): [True: 269k, False: 17.5k]
  ------------------
  542|   269k|            auto [buffer_pointer, length]{AdvanceStream(dst.size())};
  543|   269k|            memcpy(dst.data(), buffer_pointer, length);
  544|   269k|            dst = dst.subspan(length);
  545|   269k|        }
  546|  17.5k|    }
_ZNK12BufferedFile6GetPosEv:
  557|  1.32k|    uint64_t GetPos() const {
  558|  1.32k|        return m_read_pos;
  559|  1.32k|    }
_ZN12BufferedFile6SetPosEm:
  562|  1.10k|    bool SetPos(uint64_t nPos) {
  563|  1.10k|        size_t bufsize = vchBuf.size();
  564|  1.10k|        if (nPos + bufsize < nSrcPos) {
  ------------------
  |  Branch (564:13): [True: 204, False: 905]
  ------------------
  565|       |            // rewinding too far, rewind as far as possible
  566|    204|            m_read_pos = nSrcPos - bufsize;
  567|    204|            return false;
  568|    204|        }
  569|    905|        if (nPos > nSrcPos) {
  ------------------
  |  Branch (569:13): [True: 515, False: 390]
  ------------------
  570|       |            // can't go this far forward, go as far as possible
  571|    515|            m_read_pos = nSrcPos;
  572|    515|            return false;
  573|    515|        }
  574|    390|        m_read_pos = nPos;
  575|    390|        return true;
  576|    905|    }
_ZN12BufferedFile8SetLimitEm:
  580|    783|    bool SetLimit(uint64_t nPos = std::numeric_limits<uint64_t>::max()) {
  581|    783|        if (nPos < m_read_pos)
  ------------------
  |  Branch (581:13): [True: 165, False: 618]
  ------------------
  582|    165|            return false;
  583|    618|        nReadLimit = nPos;
  584|    618|        return true;
  585|    783|    }
_ZN12BufferedFile8FindByteESt4byte:
  595|  1.30k|    {
  596|       |        // For best performance, avoid mod operation within the loop.
  597|  1.30k|        size_t buf_offset{size_t(m_read_pos % uint64_t(vchBuf.size()))};
  598|   755k|        while (true) {
  ------------------
  |  Branch (598:16): [Folded - Ignored]
  ------------------
  599|   754k|            if (m_read_pos == nSrcPos) {
  ------------------
  |  Branch (599:17): [True: 754k, False: 296]
  ------------------
  600|       |                // No more bytes available; read from the file into the buffer,
  601|       |                // setting nSrcPos to one beyond the end of the new data.
  602|       |                // Throws exception if end-of-file reached.
  603|   754k|                Fill();
  604|   754k|            }
  605|   754k|            const size_t len{std::min<size_t>(vchBuf.size() - buf_offset, nSrcPos - m_read_pos)};
  606|   754k|            const auto it_start{vchBuf.begin() + buf_offset};
  607|   754k|            const auto it_find{std::find(it_start, it_start + len, byte)};
  608|   754k|            const size_t inc{size_t(std::distance(it_start, it_find))};
  609|   754k|            m_read_pos += inc;
  610|   754k|            if (inc < len) break;
  ------------------
  |  Branch (610:17): [True: 401, False: 754k]
  ------------------
  611|   754k|            buf_offset += inc;
  612|   754k|            if (buf_offset >= vchBuf.size()) buf_offset = 0;
  ------------------
  |  Branch (612:17): [True: 75.7k, False: 678k]
  ------------------
  613|   754k|        }
  614|  1.30k|    }
_ZN12BufferedFilersIRbEERS_OT_:
  588|    672|    BufferedFile& operator>>(T&& obj) {
  589|    672|        ::Unserialize(*this, obj);
  590|    672|        return (*this);
  591|    672|    }
_ZN12BufferedFilersIRaEERS_OT_:
  588|    894|    BufferedFile& operator>>(T&& obj) {
  589|    894|        ::Unserialize(*this, obj);
  590|    894|        return (*this);
  591|    894|    }
_ZN12BufferedFilersIRhEERS_OT_:
  588|    592|    BufferedFile& operator>>(T&& obj) {
  589|    592|        ::Unserialize(*this, obj);
  590|    592|        return (*this);
  591|    592|    }
_ZN12BufferedFilersIRsEERS_OT_:
  588|    629|    BufferedFile& operator>>(T&& obj) {
  589|    629|        ::Unserialize(*this, obj);
  590|    629|        return (*this);
  591|    629|    }
_ZN12BufferedFilersIRtEERS_OT_:
  588|  1.00k|    BufferedFile& operator>>(T&& obj) {
  589|  1.00k|        ::Unserialize(*this, obj);
  590|  1.00k|        return (*this);
  591|  1.00k|    }
_ZN12BufferedFilersIRiEERS_OT_:
  588|    756|    BufferedFile& operator>>(T&& obj) {
  589|    756|        ::Unserialize(*this, obj);
  590|    756|        return (*this);
  591|    756|    }
_ZN12BufferedFilersIRjEERS_OT_:
  588|    720|    BufferedFile& operator>>(T&& obj) {
  589|    720|        ::Unserialize(*this, obj);
  590|    720|        return (*this);
  591|    720|    }
_ZN12BufferedFilersIRlEERS_OT_:
  588|    662|    BufferedFile& operator>>(T&& obj) {
  589|    662|        ::Unserialize(*this, obj);
  590|    662|        return (*this);
  591|    662|    }
_ZN12BufferedFilersIRmEERS_OT_:
  588|    696|    BufferedFile& operator>>(T&& obj) {
  589|    696|        ::Unserialize(*this, obj);
  590|    696|        return (*this);
  591|    696|    }
_ZN12BufferedFilersIRNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEERS_OT_:
  588|  2.06k|    BufferedFile& operator>>(T&& obj) {
  589|  2.06k|        ::Unserialize(*this, obj);
  590|  2.06k|        return (*this);
  591|  2.06k|    }
_ZN12BufferedFilersIRNSt3__16vectorIhNS1_9allocatorIhEEEEEERS_OT_:
  588|  3.47k|    BufferedFile& operator>>(T&& obj) {
  589|  3.47k|        ::Unserialize(*this, obj);
  590|  3.47k|        return (*this);
  591|  3.47k|    }

_ZN18FuzzedDataProviderC2EPKhm:
   37|  1.63k|      : data_ptr_(data), remaining_bytes_(size) {}
_ZN18FuzzedDataProvider22ConsumeIntegralInRangeImEET_S1_S1_:
  205|  27.6k|T FuzzedDataProvider::ConsumeIntegralInRange(T min, T max) {
  206|  27.6k|  static_assert(std::is_integral<T>::value, "An integral type is required.");
  207|  27.6k|  static_assert(sizeof(T) <= sizeof(uint64_t), "Unsupported integral type.");
  208|       |
  209|  27.6k|  if (min > max)
  ------------------
  |  Branch (209:7): [True: 0, False: 27.6k]
  ------------------
  210|      0|    abort();
  211|       |
  212|       |  // Use the biggest type possible to hold the range and the result.
  213|  27.6k|  uint64_t range = static_cast<uint64_t>(max) - static_cast<uint64_t>(min);
  214|  27.6k|  uint64_t result = 0;
  215|  27.6k|  size_t offset = 0;
  216|       |
  217|  60.6k|  while (offset < sizeof(T) * CHAR_BIT && (range >> offset) > 0 &&
  ------------------
  |  Branch (217:10): [True: 60.6k, False: 0]
  |  Branch (217:43): [True: 33.5k, False: 27.0k]
  ------------------
  218|  60.6k|         remaining_bytes_ != 0) {
  ------------------
  |  Branch (218:10): [True: 33.0k, False: 579]
  ------------------
  219|       |    // Pull bytes off the end of the seed data. Experimentally, this seems to
  220|       |    // allow the fuzzer to more easily explore the input space. This makes
  221|       |    // sense, since it works by modifying inputs that caused new code to run,
  222|       |    // and this data is often used to encode length of data read by
  223|       |    // |ConsumeBytes|. Separating out read lengths makes it easier modify the
  224|       |    // contents of the data that is actually read.
  225|  33.0k|    --remaining_bytes_;
  226|  33.0k|    result = (result << CHAR_BIT) | data_ptr_[remaining_bytes_];
  227|  33.0k|    offset += CHAR_BIT;
  228|  33.0k|  }
  229|       |
  230|       |  // Avoid division by 0, in case |range + 1| results in overflow.
  231|  27.6k|  if (range != std::numeric_limits<decltype(range)>::max())
  ------------------
  |  Branch (231:7): [True: 27.6k, False: 0]
  ------------------
  232|  27.6k|    result = result % (range + 1);
  233|       |
  234|  27.6k|  return static_cast<T>(static_cast<uint64_t>(min) + result);
  235|  27.6k|}
_ZN18FuzzedDataProvider22ConsumeIntegralInRangeIiEET_S1_S1_:
  205|  10.7k|T FuzzedDataProvider::ConsumeIntegralInRange(T min, T max) {
  206|  10.7k|  static_assert(std::is_integral<T>::value, "An integral type is required.");
  207|  10.7k|  static_assert(sizeof(T) <= sizeof(uint64_t), "Unsupported integral type.");
  208|       |
  209|  10.7k|  if (min > max)
  ------------------
  |  Branch (209:7): [True: 0, False: 10.7k]
  ------------------
  210|      0|    abort();
  211|       |
  212|       |  // Use the biggest type possible to hold the range and the result.
  213|  10.7k|  uint64_t range = static_cast<uint64_t>(max) - static_cast<uint64_t>(min);
  214|  10.7k|  uint64_t result = 0;
  215|  10.7k|  size_t offset = 0;
  216|       |
  217|  18.5k|  while (offset < sizeof(T) * CHAR_BIT && (range >> offset) > 0 &&
  ------------------
  |  Branch (217:10): [True: 18.5k, False: 0]
  |  Branch (217:43): [True: 10.7k, False: 7.79k]
  ------------------
  218|  18.5k|         remaining_bytes_ != 0) {
  ------------------
  |  Branch (218:10): [True: 7.79k, False: 2.98k]
  ------------------
  219|       |    // Pull bytes off the end of the seed data. Experimentally, this seems to
  220|       |    // allow the fuzzer to more easily explore the input space. This makes
  221|       |    // sense, since it works by modifying inputs that caused new code to run,
  222|       |    // and this data is often used to encode length of data read by
  223|       |    // |ConsumeBytes|. Separating out read lengths makes it easier modify the
  224|       |    // contents of the data that is actually read.
  225|  7.79k|    --remaining_bytes_;
  226|  7.79k|    result = (result << CHAR_BIT) | data_ptr_[remaining_bytes_];
  227|  7.79k|    offset += CHAR_BIT;
  228|  7.79k|  }
  229|       |
  230|       |  // Avoid division by 0, in case |range + 1| results in overflow.
  231|  10.7k|  if (range != std::numeric_limits<decltype(range)>::max())
  ------------------
  |  Branch (231:7): [True: 10.7k, False: 0]
  ------------------
  232|  10.7k|    result = result % (range + 1);
  233|       |
  234|  10.7k|  return static_cast<T>(static_cast<uint64_t>(min) + result);
  235|  10.7k|}
_ZN18FuzzedDataProvider15ConsumeIntegralIhEET_v:
  195|  28.6k|template <typename T> T FuzzedDataProvider::ConsumeIntegral() {
  196|  28.6k|  return ConsumeIntegralInRange(std::numeric_limits<T>::min(),
  197|  28.6k|                                std::numeric_limits<T>::max());
  198|  28.6k|}
_ZN18FuzzedDataProvider22ConsumeIntegralInRangeIhEET_S1_S1_:
  205|  28.6k|T FuzzedDataProvider::ConsumeIntegralInRange(T min, T max) {
  206|  28.6k|  static_assert(std::is_integral<T>::value, "An integral type is required.");
  207|  28.6k|  static_assert(sizeof(T) <= sizeof(uint64_t), "Unsupported integral type.");
  208|       |
  209|  28.6k|  if (min > max)
  ------------------
  |  Branch (209:7): [True: 0, False: 28.6k]
  ------------------
  210|      0|    abort();
  211|       |
  212|       |  // Use the biggest type possible to hold the range and the result.
  213|  28.6k|  uint64_t range = static_cast<uint64_t>(max) - static_cast<uint64_t>(min);
  214|  28.6k|  uint64_t result = 0;
  215|  28.6k|  size_t offset = 0;
  216|       |
  217|  55.2k|  while (offset < sizeof(T) * CHAR_BIT && (range >> offset) > 0 &&
  ------------------
  |  Branch (217:10): [True: 28.6k, False: 26.6k]
  |  Branch (217:43): [True: 28.6k, False: 0]
  ------------------
  218|  55.2k|         remaining_bytes_ != 0) {
  ------------------
  |  Branch (218:10): [True: 26.6k, False: 1.97k]
  ------------------
  219|       |    // Pull bytes off the end of the seed data. Experimentally, this seems to
  220|       |    // allow the fuzzer to more easily explore the input space. This makes
  221|       |    // sense, since it works by modifying inputs that caused new code to run,
  222|       |    // and this data is often used to encode length of data read by
  223|       |    // |ConsumeBytes|. Separating out read lengths makes it easier modify the
  224|       |    // contents of the data that is actually read.
  225|  26.6k|    --remaining_bytes_;
  226|  26.6k|    result = (result << CHAR_BIT) | data_ptr_[remaining_bytes_];
  227|  26.6k|    offset += CHAR_BIT;
  228|  26.6k|  }
  229|       |
  230|       |  // Avoid division by 0, in case |range + 1| results in overflow.
  231|  28.6k|  if (range != std::numeric_limits<decltype(range)>::max())
  ------------------
  |  Branch (231:7): [True: 28.6k, False: 0]
  ------------------
  232|  28.6k|    result = result % (range + 1);
  233|       |
  234|  28.6k|  return static_cast<T>(static_cast<uint64_t>(min) + result);
  235|  28.6k|}
_ZN18FuzzedDataProvider25ConsumeRandomLengthStringEm:
  153|  1.63k|FuzzedDataProvider::ConsumeRandomLengthString(size_t max_length) {
  154|       |  // Reads bytes from the start of |data_ptr_|. Maps "\\" to "\", and maps "\"
  155|       |  // followed by anything else to the end of the string. As a result of this
  156|       |  // logic, a fuzzer can insert characters into the string, and the string
  157|       |  // will be lengthened to include those new characters, resulting in a more
  158|       |  // stable fuzzer than picking the length of a string independently from
  159|       |  // picking its contents.
  160|  1.63k|  std::string result;
  161|       |
  162|       |  // Reserve the anticipated capacity to prevent several reallocations.
  163|  1.63k|  result.reserve(std::min(max_length, remaining_bytes_));
  164|  17.2M|  for (size_t i = 0; i < max_length && remaining_bytes_ != 0; ++i) {
  ------------------
  |  Branch (164:22): [True: 17.2M, False: 102]
  |  Branch (164:40): [True: 17.2M, False: 24]
  ------------------
  165|  17.2M|    char next = ConvertUnsignedToSigned<char>(data_ptr_[0]);
  166|  17.2M|    Advance(1);
  167|  17.2M|    if (next == '\\' && remaining_bytes_ != 0) {
  ------------------
  |  Branch (167:9): [True: 2.21k, False: 17.2M]
  |  Branch (167:25): [True: 2.20k, False: 5]
  ------------------
  168|  2.20k|      next = ConvertUnsignedToSigned<char>(data_ptr_[0]);
  169|  2.20k|      Advance(1);
  170|  2.20k|      if (next != '\\')
  ------------------
  |  Branch (170:11): [True: 1.51k, False: 695]
  ------------------
  171|  1.51k|        break;
  172|  2.20k|    }
  173|  17.2M|    result += next;
  174|  17.2M|  }
  175|       |
  176|  1.63k|  result.shrink_to_fit();
  177|  1.63k|  return result;
  178|  1.63k|}
_ZN18FuzzedDataProvider25ConsumeRandomLengthStringEv:
  181|  1.63k|inline std::string FuzzedDataProvider::ConsumeRandomLengthString() {
  182|  1.63k|  return ConsumeRandomLengthString(remaining_bytes_);
  183|  1.63k|}
_ZN18FuzzedDataProvider11ConsumeBoolEv:
  289|  27.3k|inline bool FuzzedDataProvider::ConsumeBool() {
  290|  27.3k|  return 1 & ConsumeIntegral<uint8_t>();
  291|  27.3k|}
_ZN18FuzzedDataProvider14CopyAndAdvanceEPvm:
  339|  2.44k|                                               size_t num_bytes) {
  340|  2.44k|  std::memcpy(destination, data_ptr_, num_bytes);
  341|  2.44k|  Advance(num_bytes);
  342|  2.44k|}
_ZN18FuzzedDataProvider7AdvanceEm:
  344|  17.2M|inline void FuzzedDataProvider::Advance(size_t num_bytes) {
  345|  17.2M|  if (num_bytes > remaining_bytes_)
  ------------------
  |  Branch (345:7): [True: 0, False: 17.2M]
  ------------------
  346|      0|    abort();
  347|       |
  348|  17.2M|  data_ptr_ += num_bytes;
  349|  17.2M|  remaining_bytes_ -= num_bytes;
  350|  17.2M|}
_ZN18FuzzedDataProvider23ConvertUnsignedToSignedIchEET_T0_:
  379|  17.2M|TS FuzzedDataProvider::ConvertUnsignedToSigned(TU value) {
  380|  17.2M|  static_assert(sizeof(TS) == sizeof(TU), "Incompatible data types.");
  381|  17.2M|  static_assert(!std::numeric_limits<TU>::is_signed,
  382|  17.2M|                "Source type must be unsigned.");
  383|       |
  384|       |  // TODO(Dor1s): change to `if constexpr` once C++17 becomes mainstream.
  385|  17.2M|  if (std::numeric_limits<TS>::is_modulo)
  ------------------
  |  Branch (385:7): [Folded - Ignored]
  ------------------
  386|      0|    return static_cast<TS>(value);
  387|       |
  388|       |  // Avoid using implementation-defined unsigned to signed conversions.
  389|       |  // To learn more, see https://stackoverflow.com/questions/13150449.
  390|  17.2M|  if (value <= std::numeric_limits<TS>::max()) {
  ------------------
  |  Branch (390:7): [True: 11.4M, False: 5.80M]
  ------------------
  391|  11.4M|    return static_cast<TS>(value);
  392|  11.4M|  } else {
  393|  5.80M|    constexpr auto TS_min = std::numeric_limits<TS>::min();
  394|  5.80M|    return TS_min + static_cast<TS>(value - TS_min);
  395|  5.80M|  }
  396|  17.2M|}
_ZN18FuzzedDataProvider12ConsumeBytesIhEENSt3__16vectorIT_NS1_9allocatorIS3_EEEEm:
  109|  3.04k|std::vector<T> FuzzedDataProvider::ConsumeBytes(size_t num_bytes) {
  110|  3.04k|  num_bytes = std::min(num_bytes, remaining_bytes_);
  111|  3.04k|  return ConsumeBytes<T>(num_bytes, num_bytes);
  112|  3.04k|}
_ZN18FuzzedDataProvider12ConsumeBytesIhEENSt3__16vectorIT_NS1_9allocatorIS3_EEEEmm:
  353|  3.04k|std::vector<T> FuzzedDataProvider::ConsumeBytes(size_t size, size_t num_bytes) {
  354|  3.04k|  static_assert(sizeof(T) == sizeof(uint8_t), "Incompatible data type.");
  355|       |
  356|       |  // The point of using the size-based constructor below is to increase the
  357|       |  // odds of having a vector object with capacity being equal to the length.
  358|       |  // That part is always implementation specific, but at least both libc++ and
  359|       |  // libstdc++ allocate the requested number of bytes in that constructor,
  360|       |  // which seems to be a natural choice for other implementations as well.
  361|       |  // To increase the odds even more, we also call |shrink_to_fit| below.
  362|  3.04k|  std::vector<T> result(size);
  363|  3.04k|  if (size == 0) {
  ------------------
  |  Branch (363:7): [True: 594, False: 2.44k]
  ------------------
  364|    594|    if (num_bytes != 0)
  ------------------
  |  Branch (364:9): [True: 0, False: 594]
  ------------------
  365|      0|      abort();
  366|    594|    return result;
  367|    594|  }
  368|       |
  369|  2.44k|  CopyAndAdvance(result.data(), num_bytes);
  370|       |
  371|       |  // Even though |shrink_to_fit| is also implementation specific, we expect it
  372|       |  // to provide an additional assurance in case vector's constructor allocated
  373|       |  // a buffer which is larger than the actual amount of data we put inside it.
  374|  2.44k|  result.shrink_to_fit();
  375|  2.44k|  return result;
  376|  3.04k|}

_Z25buffered_file_fuzz_targetNSt3__14spanIKhLm18446744073709551615EEE:
   19|  1.63k|{
   20|  1.63k|    FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
   21|  1.63k|    FuzzedFileProvider fuzzed_file_provider{fuzzed_data_provider};
   22|  1.63k|    std::optional<BufferedFile> opt_buffered_file;
   23|  1.63k|    AutoFile fuzzed_file{
   24|  1.63k|        fuzzed_file_provider.open(),
   25|  1.63k|        ConsumeRandomLengthByteVector<std::byte>(fuzzed_data_provider),
   26|  1.63k|    };
   27|  1.63k|    try {
   28|  1.63k|        auto n_buf_size = fuzzed_data_provider.ConsumeIntegralInRange<uint64_t>(0, 4096);
   29|  1.63k|        auto n_rewind_in = fuzzed_data_provider.ConsumeIntegralInRange<uint64_t>(0, 4096);
   30|  1.63k|        opt_buffered_file.emplace(fuzzed_file, n_buf_size, n_rewind_in);
   31|  1.63k|    } catch (const std::ios_base::failure&) {
   32|    269|    }
   33|  1.63k|    if (opt_buffered_file && !fuzzed_file.IsNull()) {
  ------------------
  |  Branch (33:9): [True: 1.36k, False: 269]
  |  Branch (33:30): [True: 1.32k, False: 47]
  ------------------
   34|  1.32k|        bool setpos_fail = false;
   35|  1.32k|        LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 100)
  ------------------
  |  |   23|  8.98k|    for (unsigned _count{limit}; (condition) && _count; --_count)
  |  |  ------------------
  |  |  |  Branch (23:34): [True: 7.66k, False: 1.31k]
  |  |  |  Branch (23:49): [True: 7.65k, False: 10]
  |  |  ------------------
  ------------------
   36|  7.65k|        {
   37|  7.65k|            CallOneOf(
   38|  7.65k|                fuzzed_data_provider,
   39|  7.65k|                [&] {
   40|  7.65k|                    std::array<std::byte, 4096> arr{};
   41|  7.65k|                    try {
   42|  7.65k|                        opt_buffered_file->read({arr.data(), fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096)});
   43|  7.65k|                    } catch (const std::ios_base::failure&) {
   44|  7.65k|                    }
   45|  7.65k|                },
   46|  7.65k|                [&] {
   47|  7.65k|                    opt_buffered_file->SetLimit(fuzzed_data_provider.ConsumeIntegralInRange<uint64_t>(0, 4096));
   48|  7.65k|                },
   49|  7.65k|                [&] {
   50|  7.65k|                    if (!opt_buffered_file->SetPos(fuzzed_data_provider.ConsumeIntegralInRange<uint64_t>(0, 4096))) {
   51|  7.65k|                        setpos_fail = true;
   52|  7.65k|                    }
   53|  7.65k|                },
   54|  7.65k|                [&] {
   55|  7.65k|                    if (setpos_fail) {
   56|       |                        // Calling FindByte(...) after a failed SetPos(...) call may result in an infinite loop.
   57|  7.65k|                        return;
   58|  7.65k|                    }
   59|  7.65k|                    try {
   60|  7.65k|                        opt_buffered_file->FindByte(std::byte(fuzzed_data_provider.ConsumeIntegral<uint8_t>()));
   61|  7.65k|                    } catch (const std::ios_base::failure&) {
   62|  7.65k|                    }
   63|  7.65k|                },
   64|  7.65k|                [&] {
   65|  7.65k|                    ReadFromStream(fuzzed_data_provider, *opt_buffered_file);
   66|  7.65k|                });
   67|  7.65k|        }
   68|  1.32k|        opt_buffered_file->GetPos();
   69|  1.32k|    }
   70|  1.63k|}
buffered_file.cpp:_ZZ25buffered_file_fuzz_targetNSt3__14spanIKhLm18446744073709551615EEEENK3$_0clEv:
   39|  1.21k|                [&] {
   40|  1.21k|                    std::array<std::byte, 4096> arr{};
   41|  1.21k|                    try {
   42|  1.21k|                        opt_buffered_file->read({arr.data(), fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096)});
   43|  1.21k|                    } catch (const std::ios_base::failure&) {
   44|    848|                    }
   45|  1.21k|                },
buffered_file.cpp:_ZZ25buffered_file_fuzz_targetNSt3__14spanIKhLm18446744073709551615EEEENK3$_1clEv:
   46|    783|                [&] {
   47|    783|                    opt_buffered_file->SetLimit(fuzzed_data_provider.ConsumeIntegralInRange<uint64_t>(0, 4096));
   48|    783|                },
buffered_file.cpp:_ZZ25buffered_file_fuzz_targetNSt3__14spanIKhLm18446744073709551615EEEENK3$_2clEv:
   49|  1.10k|                [&] {
   50|  1.10k|                    if (!opt_buffered_file->SetPos(fuzzed_data_provider.ConsumeIntegralInRange<uint64_t>(0, 4096))) {
  ------------------
  |  Branch (50:25): [True: 719, False: 390]
  ------------------
   51|    719|                        setpos_fail = true;
   52|    719|                    }
   53|  1.10k|                },
buffered_file.cpp:_ZZ25buffered_file_fuzz_targetNSt3__14spanIKhLm18446744073709551615EEEENK3$_3clEv:
   54|  1.76k|                [&] {
   55|  1.76k|                    if (setpos_fail) {
  ------------------
  |  Branch (55:25): [True: 461, False: 1.30k]
  ------------------
   56|       |                        // Calling FindByte(...) after a failed SetPos(...) call may result in an infinite loop.
   57|    461|                        return;
   58|    461|                    }
   59|  1.30k|                    try {
   60|  1.30k|                        opt_buffered_file->FindByte(std::byte(fuzzed_data_provider.ConsumeIntegral<uint8_t>()));
   61|  1.30k|                    } catch (const std::ios_base::failure&) {
   62|    906|                    }
   63|  1.30k|                },
buffered_file.cpp:_ZZ25buffered_file_fuzz_targetNSt3__14spanIKhLm18446744073709551615EEEENK3$_4clEv:
   64|  2.78k|                [&] {
   65|  2.78k|                    ReadFromStream(fuzzed_data_provider, *opt_buffered_file);
   66|  2.78k|                });

LLVMFuzzerTestOneInput:
  222|  1.63k|{
  223|  1.63k|    test_one_input({data, size});
  224|  1.63k|    return 0;
  225|  1.63k|}
fuzz.cpp:_ZL14test_one_inputNSt3__14spanIKhLm18446744073709551615EEE:
   83|  1.63k|{
   84|  1.63k|    CheckGlobals check{};
   85|  1.63k|    (*Assert(g_test_one_input))(buffer);
  ------------------
  |  |   85|  1.63k|#define Assert(val) inline_assertion_check<true>(val, __FILE__, __LINE__, __func__, #val)
  ------------------
   86|  1.63k|}

_ZN18FuzzedFileProvider4openEv:
  252|  1.63k|{
  253|  1.63k|    SetFuzzedErrNo(m_fuzzed_data_provider);
  254|  1.63k|    if (m_fuzzed_data_provider.ConsumeBool()) {
  ------------------
  |  Branch (254:9): [True: 217, False: 1.42k]
  ------------------
  255|    217|        return nullptr;
  256|    217|    }
  257|  1.42k|    std::string mode;
  258|  1.42k|    CallOneOf(
  259|  1.42k|        m_fuzzed_data_provider,
  260|  1.42k|        [&] {
  261|  1.42k|            mode = "r";
  262|  1.42k|        },
  263|  1.42k|        [&] {
  264|  1.42k|            mode = "r+";
  265|  1.42k|        },
  266|  1.42k|        [&] {
  267|  1.42k|            mode = "w";
  268|  1.42k|        },
  269|  1.42k|        [&] {
  270|  1.42k|            mode = "w+";
  271|  1.42k|        },
  272|  1.42k|        [&] {
  273|  1.42k|            mode = "a";
  274|  1.42k|        },
  275|  1.42k|        [&] {
  276|  1.42k|            mode = "a+";
  277|  1.42k|        });
  278|  1.42k|#if defined _GNU_SOURCE && (defined(__linux__) || defined(__FreeBSD__))
  279|  1.42k|    const cookie_io_functions_t io_hooks = {
  280|  1.42k|        FuzzedFileProvider::read,
  281|  1.42k|        FuzzedFileProvider::write,
  282|  1.42k|        FuzzedFileProvider::seek,
  283|  1.42k|        FuzzedFileProvider::close,
  284|  1.42k|    };
  285|  1.42k|    return fopencookie(this, mode.c_str(), io_hooks);
  286|       |#else
  287|       |    (void)mode;
  288|       |    return nullptr;
  289|       |#endif
  290|  1.63k|}
_ZN18FuzzedFileProvider4readEPvPcm:
  293|  3.46k|{
  294|  3.46k|    FuzzedFileProvider* fuzzed_file = (FuzzedFileProvider*)cookie;
  295|  3.46k|    SetFuzzedErrNo(fuzzed_file->m_fuzzed_data_provider);
  296|  3.46k|    if (buf == nullptr || size == 0 || fuzzed_file->m_fuzzed_data_provider.ConsumeBool()) {
  ------------------
  |  Branch (296:9): [True: 0, False: 3.46k]
  |  Branch (296:27): [True: 0, False: 3.46k]
  |  Branch (296:40): [True: 423, False: 3.04k]
  ------------------
  297|    423|        return fuzzed_file->m_fuzzed_data_provider.ConsumeBool() ? 0 : -1;
  ------------------
  |  Branch (297:16): [True: 91, False: 332]
  ------------------
  298|    423|    }
  299|  3.04k|    const std::vector<uint8_t> random_bytes = fuzzed_file->m_fuzzed_data_provider.ConsumeBytes<uint8_t>(size);
  300|  3.04k|    if (random_bytes.empty()) {
  ------------------
  |  Branch (300:9): [True: 594, False: 2.44k]
  ------------------
  301|    594|        return 0;
  302|    594|    }
  303|  2.44k|    std::memcpy(buf, random_bytes.data(), random_bytes.size());
  304|  2.44k|    if (AdditionOverflow(fuzzed_file->m_offset, (int64_t)random_bytes.size())) {
  ------------------
  |  Branch (304:9): [True: 0, False: 2.44k]
  ------------------
  305|      0|        return fuzzed_file->m_fuzzed_data_provider.ConsumeBool() ? 0 : -1;
  ------------------
  |  Branch (305:16): [True: 0, False: 0]
  ------------------
  306|      0|    }
  307|  2.44k|    fuzzed_file->m_offset += random_bytes.size();
  308|  2.44k|    return random_bytes.size();
  309|  2.44k|}
_ZN18FuzzedFileProvider4seekEPvPli:
  324|  1.42k|{
  325|  1.42k|    assert(whence == SEEK_SET || whence == SEEK_CUR || whence == SEEK_END);
  326|  1.42k|    FuzzedFileProvider* fuzzed_file = (FuzzedFileProvider*)cookie;
  327|  1.42k|    SetFuzzedErrNo(fuzzed_file->m_fuzzed_data_provider);
  328|  1.42k|    int64_t new_offset = 0;
  329|  1.42k|    if (whence == SEEK_SET) {
  ------------------
  |  Branch (329:9): [True: 0, False: 1.42k]
  ------------------
  330|      0|        new_offset = *offset;
  331|  1.42k|    } else if (whence == SEEK_CUR) {
  ------------------
  |  Branch (331:16): [True: 1.42k, False: 0]
  ------------------
  332|  1.42k|        if (AdditionOverflow(fuzzed_file->m_offset, *offset)) {
  ------------------
  |  Branch (332:13): [True: 0, False: 1.42k]
  ------------------
  333|      0|            return -1;
  334|      0|        }
  335|  1.42k|        new_offset = fuzzed_file->m_offset + *offset;
  336|  1.42k|    } else if (whence == SEEK_END) {
  ------------------
  |  Branch (336:16): [True: 0, False: 0]
  ------------------
  337|      0|        const int64_t n = fuzzed_file->m_fuzzed_data_provider.ConsumeIntegralInRange<int64_t>(0, 4096);
  338|      0|        if (AdditionOverflow(n, *offset)) {
  ------------------
  |  Branch (338:13): [True: 0, False: 0]
  ------------------
  339|      0|            return -1;
  340|      0|        }
  341|      0|        new_offset = n + *offset;
  342|      0|    }
  343|  1.42k|    if (new_offset < 0) {
  ------------------
  |  Branch (343:9): [True: 0, False: 1.42k]
  ------------------
  344|      0|        return -1;
  345|      0|    }
  346|  1.42k|    fuzzed_file->m_offset = new_offset;
  347|  1.42k|    *offset = new_offset;
  348|  1.42k|    return fuzzed_file->m_fuzzed_data_provider.ConsumeIntegralInRange<int>(-1, 0);
  349|  1.42k|}
_ZN18FuzzedFileProvider5closeEPv:
  352|  1.42k|{
  353|  1.42k|    FuzzedFileProvider* fuzzed_file = (FuzzedFileProvider*)cookie;
  354|  1.42k|    SetFuzzedErrNo(fuzzed_file->m_fuzzed_data_provider);
  355|  1.42k|    return fuzzed_file->m_fuzzed_data_provider.ConsumeIntegralInRange<int>(-1, 0);
  356|  1.42k|}
util.cpp:_ZZN18FuzzedFileProvider4openEvENK3$_0clEv:
  260|    581|        [&] {
  261|    581|            mode = "r";
  262|    581|        },
util.cpp:_ZZN18FuzzedFileProvider4openEvENK3$_1clEv:
  263|    197|        [&] {
  264|    197|            mode = "r+";
  265|    197|        },
util.cpp:_ZZN18FuzzedFileProvider4openEvENK3$_2clEv:
  266|     61|        [&] {
  267|     61|            mode = "w";
  268|     61|        },
util.cpp:_ZZN18FuzzedFileProvider4openEvENK3$_3clEv:
  269|    155|        [&] {
  270|    155|            mode = "w+";
  271|    155|        },
util.cpp:_ZZN18FuzzedFileProvider4openEvENK3$_4clEv:
  272|     92|        [&] {
  273|     92|            mode = "a";
  274|     92|        },
util.cpp:_ZZN18FuzzedFileProvider4openEvENK3$_5clEv:
  275|    334|        [&] {
  276|    334|            mode = "a+";
  277|    334|        });

_Z14SetFuzzedErrNoR18FuzzedDataProvider:
  247|  7.94k|{
  248|  7.94k|    errno = fuzzed_data_provider.ConsumeIntegralInRange<int>(0, 133);
  249|  7.94k|}
_ZN18FuzzedFileProviderC2ER18FuzzedDataProvider:
  270|  1.63k|    FuzzedFileProvider(FuzzedDataProvider& fuzzed_data_provider) : m_fuzzed_data_provider{fuzzed_data_provider}
  271|  1.63k|    {
  272|  1.63k|    }
_Z29ConsumeRandomLengthByteVectorISt4byteENSt3__16vectorIT_NS1_9allocatorIS3_EEEER18FuzzedDataProviderRKNS1_8optionalImEE:
   58|  1.63k|{
   59|  1.63k|    static_assert(sizeof(B) == 1);
   60|  1.63k|    const std::string s = max_length ?
  ------------------
  |  Branch (60:27): [True: 0, False: 1.63k]
  ------------------
   61|      0|                              fuzzed_data_provider.ConsumeRandomLengthString(*max_length) :
   62|  1.63k|                              fuzzed_data_provider.ConsumeRandomLengthString();
   63|  1.63k|    std::vector<B> ret(s.size());
   64|  1.63k|    std::copy(s.begin(), s.end(), reinterpret_cast<char*>(ret.data()));
   65|  1.63k|    return ret;
   66|  1.63k|}
buffered_file.cpp:_Z9CallOneOfIJZ25buffered_file_fuzz_targetNSt3__14spanIKhLm18446744073709551615EEEE3$_0Z25buffered_file_fuzz_targetS3_E3$_1Z25buffered_file_fuzz_targetS3_E3$_2Z25buffered_file_fuzz_targetS3_E3$_3Z25buffered_file_fuzz_targetS3_E3$_4EEmR18FuzzedDataProviderDpT_:
   36|  7.65k|{
   37|  7.65k|    constexpr size_t call_size{sizeof...(callables)};
   38|  7.65k|    static_assert(call_size >= 1);
   39|  7.65k|    const size_t call_index{fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, call_size - 1)};
   40|       |
   41|  7.65k|    size_t i{0};
   42|  38.2k|    ((i++ == call_index ? callables() : void()), ...);
  ------------------
  |  Branch (42:7): [True: 1.21k, False: 6.44k]
  |  Branch (42:7): [True: 783, False: 6.87k]
  |  Branch (42:7): [True: 1.10k, False: 6.55k]
  |  Branch (42:7): [True: 1.76k, False: 5.89k]
  |  Branch (42:7): [True: 2.78k, False: 4.87k]
  ------------------
   43|  7.65k|    return call_size;
   44|  7.65k|}
_Z14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_:
  321|  2.78k|{
  322|  12.8k|    while (fuzzed_data_provider.ConsumeBool()) {
  ------------------
  |  Branch (322:12): [True: 12.1k, False: 669]
  ------------------
  323|  12.1k|        try {
  324|  12.1k|            CallOneOf(
  325|  12.1k|                fuzzed_data_provider,
  326|  12.1k|                READ_FROM_STREAM_CASE(bool),
  327|  12.1k|                READ_FROM_STREAM_CASE(int8_t),
  328|  12.1k|                READ_FROM_STREAM_CASE(uint8_t),
  329|  12.1k|                READ_FROM_STREAM_CASE(int16_t),
  330|  12.1k|                READ_FROM_STREAM_CASE(uint16_t),
  331|  12.1k|                READ_FROM_STREAM_CASE(int32_t),
  332|  12.1k|                READ_FROM_STREAM_CASE(uint32_t),
  333|  12.1k|                READ_FROM_STREAM_CASE(int64_t),
  334|  12.1k|                READ_FROM_STREAM_CASE(uint64_t),
  335|  12.1k|                READ_FROM_STREAM_CASE(std::string),
  336|  12.1k|                READ_FROM_STREAM_CASE(std::vector<uint8_t>));
  337|  12.1k|        } catch (const std::ios_base::failure&) {
  338|  2.11k|            break;
  339|  2.11k|        }
  340|  12.1k|    }
  341|  2.78k|}
_Z9CallOneOfIJZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_EUlvE_ZS0_IS1_EvS3_S5_EUlvE0_ZS0_IS1_EvS3_S5_EUlvE1_ZS0_IS1_EvS3_S5_EUlvE2_ZS0_IS1_EvS3_S5_EUlvE3_ZS0_IS1_EvS3_S5_EUlvE4_ZS0_IS1_EvS3_S5_EUlvE5_ZS0_IS1_EvS3_S5_EUlvE6_ZS0_IS1_EvS3_S5_EUlvE7_ZS0_IS1_EvS3_S5_EUlvE8_ZS0_IS1_EvS3_S5_EUlvE9_EEmS3_DpT_:
   36|  12.1k|{
   37|  12.1k|    constexpr size_t call_size{sizeof...(callables)};
   38|  12.1k|    static_assert(call_size >= 1);
   39|  12.1k|    const size_t call_index{fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, call_size - 1)};
   40|       |
   41|  12.1k|    size_t i{0};
   42|   133k|    ((i++ == call_index ? callables() : void()), ...);
  ------------------
  |  Branch (42:7): [True: 672, False: 11.4k]
  |  Branch (42:7): [True: 894, False: 11.2k]
  |  Branch (42:7): [True: 592, False: 11.5k]
  |  Branch (42:7): [True: 629, False: 11.5k]
  |  Branch (42:7): [True: 1.00k, False: 11.1k]
  |  Branch (42:7): [True: 756, False: 11.3k]
  |  Branch (42:7): [True: 720, False: 11.4k]
  |  Branch (42:7): [True: 662, False: 11.4k]
  |  Branch (42:7): [True: 696, False: 11.4k]
  |  Branch (42:7): [True: 2.06k, False: 10.0k]
  |  Branch (42:7): [True: 3.47k, False: 8.68k]
  ------------------
   43|  12.1k|    return call_size;
   44|  12.1k|}
_ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE_clEv:
  315|    672|    [&] {                           \
  316|    672|        type o;                     \
  317|    672|        stream >> o;                \
  318|    672|    }
_ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE0_clEv:
  315|    894|    [&] {                           \
  316|    894|        type o;                     \
  317|    894|        stream >> o;                \
  318|    894|    }
_ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE1_clEv:
  315|    592|    [&] {                           \
  316|    592|        type o;                     \
  317|    592|        stream >> o;                \
  318|    592|    }
_ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE2_clEv:
  315|    629|    [&] {                           \
  316|    629|        type o;                     \
  317|    629|        stream >> o;                \
  318|    629|    }
_ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE3_clEv:
  315|  1.00k|    [&] {                           \
  316|  1.00k|        type o;                     \
  317|  1.00k|        stream >> o;                \
  318|  1.00k|    }
_ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE4_clEv:
  315|    756|    [&] {                           \
  316|    756|        type o;                     \
  317|    756|        stream >> o;                \
  318|    756|    }
_ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE5_clEv:
  315|    720|    [&] {                           \
  316|    720|        type o;                     \
  317|    720|        stream >> o;                \
  318|    720|    }
_ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE6_clEv:
  315|    662|    [&] {                           \
  316|    662|        type o;                     \
  317|    662|        stream >> o;                \
  318|    662|    }
_ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE7_clEv:
  315|    696|    [&] {                           \
  316|    696|        type o;                     \
  317|    696|        stream >> o;                \
  318|    696|    }
_ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE8_clEv:
  315|  2.06k|    [&] {                           \
  316|  2.06k|        type o;                     \
  317|  2.06k|        stream >> o;                \
  318|  2.06k|    }
_ZZ14ReadFromStreamI12BufferedFileEvR18FuzzedDataProviderRT_ENKUlvE9_clEv:
  315|  3.47k|    [&] {                           \
  316|  3.47k|        type o;                     \
  317|  3.47k|        stream >> o;                \
  318|  3.47k|    }
util.cpp:_Z9CallOneOfIJZN18FuzzedFileProvider4openEvE3$_0ZNS0_4openEvE3$_1ZNS0_4openEvE3$_2ZNS0_4openEvE3$_3ZNS0_4openEvE3$_4ZNS0_4openEvE3$_5EEmR18FuzzedDataProviderDpT_:
   36|  1.42k|{
   37|  1.42k|    constexpr size_t call_size{sizeof...(callables)};
   38|  1.42k|    static_assert(call_size >= 1);
   39|  1.42k|    const size_t call_index{fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, call_size - 1)};
   40|       |
   41|  1.42k|    size_t i{0};
   42|  8.52k|    ((i++ == call_index ? callables() : void()), ...);
  ------------------
  |  Branch (42:7): [True: 581, False: 839]
  |  Branch (42:7): [True: 197, False: 1.22k]
  |  Branch (42:7): [True: 61, False: 1.35k]
  |  Branch (42:7): [True: 155, False: 1.26k]
  |  Branch (42:7): [True: 92, False: 1.32k]
  |  Branch (42:7): [True: 334, False: 1.08k]
  ------------------
   43|  1.42k|    return call_size;
   44|  1.42k|}

_ZN12CheckGlobalsC2Ev:
   56|  1.63k|CheckGlobals::CheckGlobals() : m_impl(std::make_unique<CheckGlobalsImpl>()) {}
_ZN12CheckGlobalsD2Ev:
   57|  1.63k|CheckGlobals::~CheckGlobals() = default;
_ZN16CheckGlobalsImplC2Ev:
   17|  1.63k|    {
   18|  1.63k|        g_used_g_prng = false;
   19|  1.63k|        g_seeded_g_prng_zero = false;
   20|  1.63k|        g_used_system_time = false;
   21|  1.63k|        SetMockTime(0s);
   22|  1.63k|    }
_ZN16CheckGlobalsImplD2Ev:
   24|  1.63k|    {
   25|  1.63k|        if (g_used_g_prng && !g_seeded_g_prng_zero) {
  ------------------
  |  Branch (25:13): [True: 0, False: 1.63k]
  |  Branch (25:30): [True: 0, False: 0]
  ------------------
   26|      0|            std::cerr << "\n\n"
   27|      0|                         "The current fuzz target used the global random state.\n\n"
   28|       |
   29|      0|                         "This is acceptable, but requires the fuzz target to call \n"
   30|      0|                         "SeedRandomStateForTest(SeedRand::ZEROS) in the first line \n"
   31|      0|                         "of the FUZZ_TARGET function.\n\n"
   32|       |
   33|      0|                         "An alternative solution would be to avoid any use of globals.\n\n"
   34|       |
   35|      0|                         "Without a solution, fuzz instability and non-determinism can lead \n"
   36|      0|                         "to non-reproducible bugs or inefficient fuzzing.\n\n"
   37|      0|                      << std::endl;
   38|      0|            std::abort(); // Abort, because AFL may try to recover from a std::exit
   39|      0|        }
   40|       |
   41|  1.63k|        if (g_used_system_time) {
  ------------------
  |  Branch (41:13): [True: 0, False: 1.63k]
  ------------------
   42|      0|            std::cerr << "\n\n"
   43|      0|                         "The current fuzz target accessed system time.\n\n"
   44|       |
   45|      0|                         "This is acceptable, but requires the fuzz target to call \n"
   46|      0|                         "SetMockTime() at the beginning of processing the fuzz input.\n\n"
   47|       |
   48|      0|                         "Without setting mock time, time-dependent behavior can lead \n"
   49|      0|                         "to non-reproducible bugs or inefficient fuzzing.\n\n"
   50|      0|                      << std::endl;
   51|      0|            std::abort();
   52|      0|        }
   53|  1.63k|    }

_Z22inline_assertion_checkILb1EbEOT0_S1_PKciS3_S3_:
   52|  1.63k|{
   53|  1.63k|    if (IS_ASSERT || std::is_constant_evaluated() || G_FUZZING
  ------------------
  |  Branch (53:9): [Folded - Ignored]
  |  Branch (53:22): [Folded - Ignored]
  |  Branch (53:54): [Folded - Ignored]
  ------------------
   54|       |#ifdef ABORT_ON_FAILED_ASSUME
   55|       |        || true
   56|       |#endif
   57|  1.63k|    ) {
   58|  1.63k|        if (!val) {
  ------------------
  |  Branch (58:13): [True: 0, False: 1.63k]
  ------------------
   59|      0|            assertion_fail(file, line, func, assertion);
   60|      0|        }
   61|  1.63k|    }
   62|  1.63k|    return std::forward<T>(val);
   63|  1.63k|}
_Z22inline_assertion_checkILb1ERPKNSt3__18functionIFvNS0_4spanIKhLm18446744073709551615EEEEEEEOT0_SB_PKciSD_SD_:
   52|  1.63k|{
   53|  1.63k|    if (IS_ASSERT || std::is_constant_evaluated() || G_FUZZING
  ------------------
  |  Branch (53:9): [Folded - Ignored]
  |  Branch (53:22): [Folded - Ignored]
  |  Branch (53:54): [Folded - Ignored]
  ------------------
   54|       |#ifdef ABORT_ON_FAILED_ASSUME
   55|       |        || true
   56|       |#endif
   57|  1.63k|    ) {
   58|  1.63k|        if (!val) {
  ------------------
  |  Branch (58:13): [True: 0, False: 1.63k]
  ------------------
   59|      0|            assertion_fail(file, line, func, assertion);
   60|      0|        }
   61|  1.63k|    }
   62|  1.63k|    return std::forward<T>(val);
   63|  1.63k|}

_Z16AdditionOverflowIlEbT_S0_:
   16|  3.86k|{
   17|  3.86k|    static_assert(std::is_integral<T>::value, "Integral required.");
   18|  3.86k|    if constexpr (std::numeric_limits<T>::is_signed) {
   19|  3.86k|        return (i > 0 && j > std::numeric_limits<T>::max() - i) ||
  ------------------
  |  Branch (19:17): [True: 1.51k, False: 2.35k]
  |  Branch (19:26): [True: 0, False: 1.51k]
  ------------------
   20|  3.86k|               (i < 0 && j < std::numeric_limits<T>::min() - i);
  ------------------
  |  Branch (20:17): [True: 0, False: 3.86k]
  |  Branch (20:26): [True: 0, False: 0]
  ------------------
   21|  3.86k|    }
   22|      0|    return std::numeric_limits<T>::max() - i < j;
   23|  3.86k|}

_Z11SetMockTimeNSt3__16chrono8durationIxNS_5ratioILl1ELl1EEEEE:
   42|  1.63k|{
   43|  1.63k|    Assert(mock_time_in >= 0s);
  ------------------
  |  |   85|  1.63k|#define Assert(val) inline_assertion_check<true>(val, __FILE__, __LINE__, __func__, #val)
  ------------------
   44|  1.63k|    g_mock_time.store(mock_time_in, std::memory_order_relaxed);
   45|  1.63k|}

