LLVMFuzzerTestOneInput:
   55|  20.8k|{
   56|  20.8k|#ifndef _WIN32
   57|       |    // Used by jpeg library to work around false positives in memory sanitizer.
   58|  20.8k|    setenv("JSIMD_FORCENONE", "1", 1);
   59|  20.8k|#endif
   60|  20.8k|    FuzzHelper f(data, size);
   61|  20.8k|    f.run();
   62|  20.8k|    return 0;
   63|  20.8k|}
_ZN10FuzzHelperC2EPKhm:
   15|  20.8k|        input_buffer(const_cast<unsigned char*>(data), size)
   16|  20.8k|    {
   17|  20.8k|    }
_ZN10FuzzHelper3runEv:
   21|  20.8k|    {
   22|  20.8k|        qpdf::global::options::fuzz_mode(true);
   23|       |        // The goal here is that you should be able to throw anything at libqpdf and it will respond
   24|       |        // without any memory errors and never do anything worse than throwing a QPDFExc or
   25|       |        // std::runtime_error. Throwing any other kind of exception, segfaulting, or having a memory
   26|       |        // error (when built with appropriate sanitizers) will all cause abnormal exit.
   27|  20.8k|        try {
   28|  20.8k|            std::cerr << "\ninfo: starting testOutlines\n";
   29|       |
   30|  20.8k|            auto is = std::make_shared<BufferInputSource>("fuzz input", &input_buffer);
   31|  20.8k|            QPDF qpdf;
   32|  20.8k|            qpdf.processInputSource(is);
   33|  20.8k|            std::list<std::vector<QPDFOutlineObjectHelper>> queue;
   34|  20.8k|            auto& odh = QPDFOutlineDocumentHelper::get(qpdf);
   35|  20.8k|            queue.push_back(odh.getTopLevelOutlines());
   36|  30.8k|            while (!queue.empty()) {
  ------------------
  |  Branch (36:20): [True: 10.0k, False: 20.8k]
  ------------------
   37|  10.0k|                for (auto& ol: *(queue.begin())) {
  ------------------
  |  Branch (37:30): [True: 8.36k, False: 10.0k]
  ------------------
   38|  8.36k|                    ol.getDestPage();
   39|  8.36k|                    queue.push_back(ol.getKids());
   40|  8.36k|                }
   41|  10.0k|                queue.pop_front();
   42|  10.0k|            }
   43|  20.8k|        } catch (std::runtime_error const& e) {
   44|  19.1k|            std::cerr << "runtime_error: " << e.what() << '\n';
   45|  19.1k|        }
   46|  20.8k|    }

_ZN11InputSourceC2Ev:
   35|  89.4k|    InputSource() = default;
_ZN11InputSourceD2Ev:
   37|  89.4k|    virtual ~InputSource() = default;
_ZN11InputSource6FinderC2Ev:
   43|  62.8k|        Finder() = default;

_ZN4qpdf10BaseHandleD2Ev:
  131|  54.0M|        ~BaseHandle() = default;
_ZNK4qpdf10BaseHandleeqERKS0_:
   67|  7.81k|        {
   68|  7.81k|            return obj == other.obj;
   69|  7.81k|        }
_ZNK4qpdf10BaseHandle5emptyEv:
   82|  8.13k|        {
   83|  8.13k|            return size() == 0;
   84|  8.13k|        }
_ZN4qpdf10BaseHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  120|  1.76M|            obj(obj) {};
_ZN4qpdf10BaseHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
  122|  16.8M|            obj(std::move(obj)) {};
_ZN4qpdf10BaseHandleC2Ev:
  118|  4.48M|        BaseHandle() = default;
_ZN4qpdf10BaseHandleC2ERKS0_:
  123|  3.97M|        BaseHandle(BaseHandle const&) = default;
_ZN4qpdf10BaseHandleaSEOS0_:
  126|  3.97M|        BaseHandle& operator=(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleC2EOS0_:
  125|  24.9M|        BaseHandle(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleaSERKS0_:
  124|   410k|        BaseHandle& operator=(BaseHandle const&) = default;

_ZNK8Pipeline4nextEv:
  103|  74.9M|    {
  104|  74.9M|        return next_;
  105|  74.9M|    }
_ZN8PipelineD2Ev:
   52|   453k|    virtual ~Pipeline() = default;

_ZN5QIntC11range_checkIxEEvRKT_S3_:
  274|   110k|    {
  275|   110k|        if ((delta > 0) != (cur > 0)) {
  ------------------
  |  Branch (275:13): [True: 98.2k, False: 11.9k]
  ------------------
  276|  98.2k|            return;
  277|  98.2k|        }
  278|  11.9k|        QIntC::range_check_error<T>(cur, delta);
  279|  11.9k|    }
_ZN5QIntC17range_check_errorIxEEvRKT_S3_:
  257|  11.9k|    {
  258|  11.9k|        if ((delta > 0) && ((std::numeric_limits<T>::max() - cur) < delta)) {
  ------------------
  |  Branch (258:13): [True: 11.9k, False: 0]
  |  Branch (258:28): [True: 31, False: 11.9k]
  ------------------
  259|     31|            std::ostringstream msg;
  260|     31|            msg.imbue(std::locale::classic());
  261|     31|            msg << "adding " << delta << " to " << cur << " would cause an integer overflow";
  262|     31|            throw std::range_error(msg.str());
  263|  11.9k|        } else if ((delta < 0) && ((std::numeric_limits<T>::min() - cur) > delta)) {
  ------------------
  |  Branch (263:20): [True: 0, False: 11.9k]
  |  Branch (263:35): [True: 0, False: 0]
  ------------------
  264|      0|            std::ostringstream msg;
  265|      0|            msg.imbue(std::locale::classic());
  266|      0|            msg << "adding " << delta << " to " << cur << " would cause an integer underflow";
  267|      0|            throw std::range_error(msg.str());
  268|      0|        }
  269|  11.9k|    }
_ZN5QIntC7to_sizeIxEEmRKT_:
  215|  3.51M|    {
  216|  3.51M|        return IntConverter<T, size_t>::convert(i);
  217|  3.51M|    }
_ZN5QIntC12IntConverterIxmLb1ELb0EE7convertERKx:
  119|  3.51M|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|  3.51M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  3.51M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 3.51M]
  |  Branch (124:28): [True: 0, False: 3.51M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  3.51M|            return static_cast<To>(i);
  128|  3.51M|        }
_ZN5QIntC9to_offsetImEExRKT_:
  222|  4.55M|    {
  223|  4.55M|        return IntConverter<T, qpdf_offset_t>::convert(i);
  224|  4.55M|    }
_ZN5QIntC12IntConverterImxLb0ELb1EE7convertERKm:
  147|  4.55M|        {
  148|       |            // From is unsigned, and to is signed. Convert To's max to the
  149|       |            // unsigned version of To and compare i against that.
  150|  4.55M|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|  4.55M|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 0, False: 4.55M]
  ------------------
  152|      0|                error(i);
  153|      0|            }
  154|  4.55M|            return static_cast<To>(i);
  155|  4.55M|        }
_ZN5QIntC7to_sizeIlEEmRKT_:
  215|   512k|    {
  216|   512k|        return IntConverter<T, size_t>::convert(i);
  217|   512k|    }
_ZN5QIntC12IntConverterIlmLb1ELb0EE7convertERKl:
  119|   512k|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|   512k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   512k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 512k]
  |  Branch (124:28): [True: 0, False: 512k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   512k|            return static_cast<To>(i);
  128|   512k|        }
_ZN5QIntC6to_intImEEiRKT_:
  201|  15.0k|    {
  202|  15.0k|        return IntConverter<T, int>::convert(i);
  203|  15.0k|    }
_ZN5QIntC12IntConverterImiLb0ELb1EE7convertERKm:
  147|  15.0k|        {
  148|       |            // From is unsigned, and to is signed. Convert To's max to the
  149|       |            // unsigned version of To and compare i against that.
  150|  15.0k|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|  15.0k|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 0, False: 15.0k]
  ------------------
  152|      0|                error(i);
  153|      0|            }
  154|  15.0k|            return static_cast<To>(i);
  155|  15.0k|        }
_ZN5QIntC7to_sizeIiEEmRKT_:
  215|  24.1k|    {
  216|  24.1k|        return IntConverter<T, size_t>::convert(i);
  217|  24.1k|    }
_ZN5QIntC12IntConverterIimLb1ELb0EE7convertERKi:
  119|   164M|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|   164M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   164M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 164M]
  |  Branch (124:28): [True: 0, False: 164M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   164M|            return static_cast<To>(i);
  128|   164M|        }
_ZN5QIntC6to_intIxEEiRKT_:
  201|  5.20M|    {
  202|  5.20M|        return IntConverter<T, int>::convert(i);
  203|  5.20M|    }
_ZN5QIntC12IntConverterIxiLb1ELb1EE7convertERKx:
   94|  5.20M|        {
   95|       |            // From and To are both signed.
   96|  5.20M|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 1.04k, False: 5.20M]
  |  Branch (96:57): [True: 1.38k, False: 5.20M]
  ------------------
   97|  2.43k|                error(i);
   98|  2.43k|            }
   99|  5.20M|            return static_cast<To>(i);
  100|  5.20M|        }
_ZN5QIntC12IntConverterIxiLb1ELb1EE5errorEx:
  104|  2.43k|        {
  105|  2.43k|            std::ostringstream msg;
  106|  2.43k|            msg.imbue(std::locale::classic());
  107|  2.43k|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  108|  2.43k|                << "-byte signed type to a " << sizeof(To) << "-byte signed type";
  109|  2.43k|            throw std::range_error(msg.str());
  110|  2.43k|        }
_ZN5QIntC7to_sizeImEEmRKT_:
  215|     39|    {
  216|     39|        return IntConverter<T, size_t>::convert(i);
  217|     39|    }
_ZN5QIntC12IntConverterImmLb0ELb0EE7convertERKm:
   69|   109k|        {
   70|       |            // From and To are both unsigned.
   71|   109k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 109k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   109k|            return static_cast<To>(i);
   75|   109k|        }
_ZN5QIntC7to_uintIiEEjRKT_:
  208|  25.3k|    {
  209|  25.3k|        return IntConverter<T, unsigned int>::convert(i);
  210|  25.3k|    }
_ZN5QIntC12IntConverterIijLb1ELb0EE7convertERKi:
  119|  25.3k|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|  25.3k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  25.3k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 25.3k]
  |  Branch (124:28): [True: 0, False: 25.3k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  25.3k|            return static_cast<To>(i);
  128|  25.3k|        }
_ZN5QIntC6to_intIlEEiRKT_:
  201|  9.02k|    {
  202|  9.02k|        return IntConverter<T, int>::convert(i);
  203|  9.02k|    }
_ZN5QIntC12IntConverterIliLb1ELb1EE7convertERKl:
   94|  9.02k|        {
   95|       |            // From and To are both signed.
   96|  9.02k|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 0, False: 9.02k]
  |  Branch (96:57): [True: 0, False: 9.02k]
  ------------------
   97|      0|                error(i);
   98|      0|            }
   99|  9.02k|            return static_cast<To>(i);
  100|  9.02k|        }
_ZN5QIntC7to_sizeIyEEmRKT_:
  215|  12.2k|    {
  216|  12.2k|        return IntConverter<T, size_t>::convert(i);
  217|  12.2k|    }
_ZN5QIntC12IntConverterIymLb0ELb0EE7convertERKy:
   69|  12.2k|        {
   70|       |            // From and To are both unsigned.
   71|  12.2k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 12.2k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  12.2k|            return static_cast<To>(i);
   75|  12.2k|        }
_ZN5QIntC8to_ulongIcEEmRKT_:
  236|  1.85M|    {
  237|  1.85M|        return IntConverter<T, unsigned long>::convert(i);
  238|  1.85M|    }
_ZN5QIntC12IntConverterIcmLb1ELb0EE7convertERKc:
  119|  1.85M|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|  1.85M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  1.85M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 1.85M]
  |  Branch (124:28): [True: 0, False: 1.85M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  1.85M|            return static_cast<To>(i);
  128|  1.85M|        }
_ZN5QIntC8to_ulongIhEEmRKT_:
  236|   478M|    {
  237|   478M|        return IntConverter<T, unsigned long>::convert(i);
  238|   478M|    }
_ZN5QIntC12IntConverterIhmLb0ELb0EE7convertERKh:
   69|   478M|        {
   70|       |            // From and To are both unsigned.
   71|   478M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 478M]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   478M|            return static_cast<To>(i);
   75|   478M|        }
_ZN5QIntC8to_ulongIiEEmRKT_:
  236|   164M|    {
  237|   164M|        return IntConverter<T, unsigned long>::convert(i);
  238|   164M|    }
_ZN5QIntC9to_ushortIiEEtRKT_:
  194|  16.3M|    {
  195|  16.3M|        return IntConverter<T, unsigned short>::convert(i);
  196|  16.3M|    }
_ZN5QIntC12IntConverterIitLb1ELb0EE7convertERKi:
  119|  16.3M|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|  16.3M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  16.3M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 16.3M]
  |  Branch (124:28): [True: 0, False: 16.3M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  16.3M|            return static_cast<To>(i);
  128|  16.3M|        }
_ZN5QIntC7to_sizeIjEEmRKT_:
  215|  5.47k|    {
  216|  5.47k|        return IntConverter<T, size_t>::convert(i);
  217|  5.47k|    }
_ZN5QIntC12IntConverterIjmLb0ELb0EE7convertERKj:
   69|  5.47k|        {
   70|       |            // From and To are both unsigned.
   71|  5.47k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 5.47k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  5.47k|            return static_cast<To>(i);
   75|  5.47k|        }
_ZN5QIntC7to_uintImEEjRKT_:
  208|  3.18M|    {
  209|  3.18M|        return IntConverter<T, unsigned int>::convert(i);
  210|  3.18M|    }
_ZN5QIntC12IntConverterImjLb0ELb0EE7convertERKm:
   69|  3.18M|        {
   70|       |            // From and To are both unsigned.
   71|  3.18M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 3.18M]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  3.18M|            return static_cast<To>(i);
   75|  3.18M|        }
_ZN5QIntC8to_ulongImEEmRKT_:
  236|   109k|    {
  237|   109k|        return IntConverter<T, unsigned long>::convert(i);
  238|   109k|    }

_ZN14QPDFCryptoImplC2Ev:
   38|   401k|    QPDFCryptoImpl() = default;
_ZN14QPDFCryptoImplD2Ev:
   40|   401k|    virtual ~QPDFCryptoImpl() = default;

_ZN18QPDFCryptoProviderD2Ev:
   78|      1|    ~QPDFCryptoProvider() = default;
_ZN18QPDFCryptoProvider7MembersC2Ev:
   93|      1|        Members() = default;
_ZN18QPDFCryptoProvider7MembersD2Ev:
   94|      1|        ~Members() = default;

_ZN18QPDFDocumentHelperC2ER4QPDF:
   37|  1.92k|        qpdf(qpdf)
   38|  1.92k|    {
   39|  1.92k|    }

_ZN7QPDFExcD2Ev:
   50|  2.33M|    ~QPDFExc() noexcept override = default;

_ZN24QPDFNameTreeObjectHelper8iteratorD2Ev:
   88|  5.87k|        virtual ~iterator() = default;

_ZN10QPDFObjGenC2Eii:
   40|  1.66M|        obj(obj),
   41|  1.66M|        gen(gen)
   42|  1.66M|    {
   43|  1.66M|    }
_ZNK10QPDFObjGenltERKS_:
   46|  51.4M|    {
   47|  51.4M|        return (obj < rhs.obj) || (obj == rhs.obj && gen < rhs.gen);
  ------------------
  |  Branch (47:16): [True: 30.1M, False: 21.2M]
  |  Branch (47:36): [True: 4.24M, False: 16.9M]
  |  Branch (47:54): [True: 170k, False: 4.07M]
  ------------------
   48|  51.4M|    }
_ZNK10QPDFObjGeneqERKS_:
   51|   109k|    {
   52|   109k|        return obj == rhs.obj && gen == rhs.gen;
  ------------------
  |  Branch (52:16): [True: 104k, False: 5.00k]
  |  Branch (52:34): [True: 104k, False: 143]
  ------------------
   53|   109k|    }
_ZNK10QPDFObjGenneERKS_:
   56|  92.5k|    {
   57|  92.5k|        return !(*this == rhs);
   58|  92.5k|    }
_ZNK10QPDFObjGen6getObjEv:
   61|  1.68M|    {
   62|  1.68M|        return obj;
   63|  1.68M|    }
_ZNK10QPDFObjGen6getGenEv:
   66|  2.64k|    {
   67|  2.64k|        return gen;
   68|  2.64k|    }
_ZNK10QPDFObjGen10isIndirectEv:
   71|  4.80M|    {
   72|  4.80M|        return obj != 0;
   73|  4.80M|    }
_ZNK10QPDFObjGen7unparseEc:
   76|   208k|    {
   77|   208k|        return std::to_string(obj) + separator + std::to_string(gen);
   78|   208k|    }
_ZN10QPDFObjGen3set3addES_:
  111|   152k|        {
  112|   152k|            if (og.isIndirect()) {
  ------------------
  |  Branch (112:17): [True: 63.4k, False: 89.3k]
  ------------------
  113|  63.4k|                if (count(og)) {
  ------------------
  |  Branch (113:21): [True: 10.3k, False: 53.0k]
  ------------------
  114|  10.3k|                    return false;
  115|  10.3k|                }
  116|  53.0k|                emplace(og);
  117|  53.0k|            }
  118|   142k|            return true;
  119|   152k|        }
_ZN10QPDFObjGenC2Ev:
   38|  21.2M|    QPDFObjGen() = default;

_ZN16QPDFObjectHandle9RectangleC2Edddd:
  243|  4.46k|            llx(llx),
  244|  4.46k|            lly(lly),
  245|  4.46k|            urx(urx),
  246|  4.46k|            ury(ury)
  247|  4.46k|        {
  248|  4.46k|        }
_ZN16QPDFObjectHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
 1315|  1.35M|        qpdf::BaseHandle(obj)
 1316|  1.35M|    {
 1317|  1.35M|    }
_ZN16QPDFObjectHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
 1319|  16.7M|        qpdf::BaseHandle(std::move(obj))
 1320|  16.7M|    {
 1321|  16.7M|    }
_ZN16QPDFObjectHandle6getObjEv:
 1324|  9.82k|    {
 1325|  9.82k|        return obj;
 1326|  9.82k|    }
_ZNK4qpdf10BaseHandlecvbEv:
 1559|  2.33M|    {
 1560|  2.33M|        return static_cast<bool>(obj);
 1561|  2.33M|    }
_ZNK4qpdf10BaseHandlecv16QPDFObjectHandleEv:
 1565|   146k|    {
 1566|   146k|        return {obj};
 1567|   146k|    }
_ZN16QPDFObjectHandleC2Ev:
  289|  4.41M|    QPDFObjectHandle() = default;
_ZN16QPDFObjectHandleC2ERKS_:
  290|  3.81M|    QPDFObjectHandle(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandleaSEOS_:
  293|  3.97M|    QPDFObjectHandle& operator=(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleC2EOS_:
  292|  24.9M|    QPDFObjectHandle(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleaSERKS_:
  291|   400k|    QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilterC2Ev:
  163|  10.9k|        TokenFilter() = default;

_ZN16QPDFObjectHelperC2E16QPDFObjectHandle:
   38|  9.82k|        qpdf::BaseHandle(oh.getObj())
   39|  9.82k|    {
   40|  9.82k|    }

_ZN25QPDFOutlineDocumentHelperD2Ev:
   59|  1.92k|    ~QPDFOutlineDocumentHelper() override = default;

_ZN23QPDFOutlineObjectHelperD2Ev:
   37|  37.5k|    {
   38|       |        // This must be cleared explicitly to avoid circular references that prevent cleanup of
   39|       |        // shared pointers.
   40|  37.5k|        m->parent = nullptr;
   41|  37.5k|    }
_ZN23QPDFOutlineObjectHelper8Accessor6createE16QPDFObjectHandleR25QPDFOutlineDocumentHelperi:
   82|  2.54k|        {
   83|  2.54k|            return {oh, dh, depth};
   84|  2.54k|        }
_ZN23QPDFOutlineObjectHelper7MembersD2Ev:
   95|  8.44k|        ~Members() = default;

_ZN16QPDFStreamFilterC2Ev:
   30|  13.4k|    QPDFStreamFilter() = default;
_ZN16QPDFStreamFilterD2Ev:
   32|  13.4k|    virtual ~QPDFStreamFilter() = default;

_ZN13QPDFTokenizer5TokenC2Ev:
   71|  2.03M|            type(tt_bad)
   72|  2.03M|        {
   73|  2.03M|        }
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES8_S8_:
   81|  2.03M|            type(type),
   82|  2.03M|            value(value),
   83|  2.03M|            raw_value(raw_value),
   84|  2.03M|            error_message(error_message)
   85|  2.03M|        {
   86|  2.03M|        }
_ZNK13QPDFTokenizer5Token7getTypeEv:
   89|  2.03M|        {
   90|  2.03M|            return this->type;
   91|  2.03M|        }
_ZNK13QPDFTokenizer5Token8getValueEv:
   94|  1.56M|        {
   95|  1.56M|            return this->value;
   96|  1.56M|        }
_ZNK13QPDFTokenizer5Token9isIntegerEv:
  116|  1.57M|        {
  117|  1.57M|            return this->type == tt_integer;
  118|  1.57M|        }
_ZNK13QPDFTokenizer5Token6isWordERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  126|  1.73M|        {
  127|  1.73M|            return this->type == tt_word && this->value == value;
  ------------------
  |  Branch (127:20): [True: 1.00M, False: 726k]
  |  Branch (127:45): [True: 369k, False: 636k]
  ------------------
  128|  1.73M|        }

_ZN13QPDFXRefEntryC2Ex:
   41|   247k|        type(1),
   42|   247k|        field1(offset)
   43|   247k|    {
   44|   247k|    }
_ZN13QPDFXRefEntryC2Eii:
   47|   340k|        type(2),
   48|   340k|        field1(stream_number),
   49|   340k|        field2(index)
   50|   340k|    {
   51|   340k|    }

_ZN3QTC2TCEPKcS1_i:
   36|  1.49M|    {
   37|       |#ifndef QPDF_DISABLE_QTC
   38|       |        TC_real(scope, ccase, n);
   39|       |#endif // QPDF_DISABLE_QTC
   40|  1.49M|    }

_ZN5QUtil10FileCloserC2EP8_IO_FILE:
  115|      1|            f(f)
  116|      1|        {
  117|      1|        }
_ZN5QUtil10FileCloserD2Ev:
  120|      1|        {
  121|      1|            if (f) {
  ------------------
  |  Branch (121:17): [True: 1, False: 0]
  ------------------
  122|      1|                fclose(f);
  123|      1|                f = nullptr;
  124|      1|            }
  125|      1|        }
_ZN5QUtil17make_shared_arrayIhEENSt3__110shared_ptrIT_EEm:
  183|  9.54k|    {
  184|  9.54k|        return std::shared_ptr<T>(new T[n], std::default_delete<T[]>());
  185|  9.54k|    }

_ZN4qpdf6global7options9fuzz_modeEb:
  132|  20.8k|        {
  133|  20.8k|            set_uint32(qpdf_p_fuzz_mode, value ? QPDF_TRUE : QPDF_FALSE);
  ------------------
  |  |  142|  20.8k|#define QPDF_TRUE 1
  ------------------
                          set_uint32(qpdf_p_fuzz_mode, value ? QPDF_TRUE : QPDF_FALSE);
  ------------------
  |  |  143|  20.8k|#define QPDF_FALSE 0
  ------------------
  |  Branch (133:42): [True: 20.8k, False: 0]
  ------------------
  134|  20.8k|        }
_ZN4qpdf6global10set_uint32E12qpdf_param_ej:
   53|  20.8k|    {
   54|  20.8k|        handle_result(qpdf_global_set_uint32(param, value));
   55|  20.8k|    }
_ZN4qpdf6global13handle_resultE13qpdf_result_e:
   35|  20.8k|    {
   36|  20.8k|        if (result != qpdf_r_ok) {
  ------------------
  |  Branch (36:13): [True: 0, False: 20.8k]
  ------------------
   37|      0|            QUtil::handle_result_code(result, "qpdf::global");
   38|      0|        }
   39|  20.8k|    }

_ZN14AES_PDF_nativeC2EbPKhmbPh:
   18|   138k|    encrypt(encrypt),
   19|   138k|    cbc_mode(cbc_mode),
   20|   138k|    cbc_block(cbc_block)
   21|   138k|{
   22|   138k|    size_t keybits = 8 * key_bytes;
   23|   138k|    key = std::make_unique<unsigned char[]>(key_bytes);
   24|   138k|    rk = std::make_unique<uint32_t[]>(RKLENGTH(keybits));
  ------------------
  |  |   22|   138k|#define RKLENGTH(keybits) ((keybits) / 8 + 28)
  ------------------
   25|   138k|    size_t rk_bytes = RKLENGTH(keybits) * sizeof(uint32_t);
  ------------------
  |  |   22|   138k|#define RKLENGTH(keybits) ((keybits) / 8 + 28)
  ------------------
   26|   138k|    std::memcpy(key.get(), a_key, key_bytes);
   27|   138k|    std::memset(rk.get(), 0, rk_bytes);
   28|   138k|    if (encrypt) {
  ------------------
  |  Branch (28:9): [True: 127k, False: 11.2k]
  ------------------
   29|   127k|        nrounds = rijndaelSetupEncrypt(rk.get(), key.get(), keybits);
   30|   127k|    } else {
   31|  11.2k|        nrounds = rijndaelSetupDecrypt(rk.get(), key.get(), keybits);
   32|  11.2k|    }
   33|   138k|}
_ZN14AES_PDF_native6updateEPhS0_:
   37|  35.1M|{
   38|  35.1M|    if (encrypt) {
  ------------------
  |  Branch (38:9): [True: 34.6M, False: 538k]
  ------------------
   39|  34.6M|        if (cbc_mode) {
  ------------------
  |  Branch (39:13): [True: 34.6M, False: 0]
  ------------------
   40|   588M|            for (size_t i = 0; i < QPDFCryptoImpl::rijndael_buf_size; ++i) {
  ------------------
  |  Branch (40:32): [True: 554M, False: 34.6M]
  ------------------
   41|   554M|                in_data[i] ^= cbc_block[i];
   42|   554M|            }
   43|  34.6M|        }
   44|  34.6M|        rijndaelEncrypt(rk.get(), nrounds, in_data, out_data);
   45|  34.6M|        if (cbc_mode) {
  ------------------
  |  Branch (45:13): [True: 34.6M, False: 0]
  ------------------
   46|  34.6M|            memcpy(cbc_block, out_data, QPDFCryptoImpl::rijndael_buf_size);
   47|  34.6M|        }
   48|  34.6M|    } else {
   49|   538k|        rijndaelDecrypt(rk.get(), nrounds, in_data, out_data);
   50|   538k|        if (cbc_mode) {
  ------------------
  |  Branch (50:13): [True: 538k, False: 0]
  ------------------
   51|  9.15M|            for (size_t i = 0; i < QPDFCryptoImpl::rijndael_buf_size; ++i) {
  ------------------
  |  Branch (51:32): [True: 8.61M, False: 538k]
  ------------------
   52|  8.61M|                out_data[i] ^= cbc_block[i];
   53|  8.61M|            }
   54|   538k|            memcpy(cbc_block, in_data, QPDFCryptoImpl::rijndael_buf_size);
   55|   538k|        }
   56|   538k|    }
   57|  35.1M|}

_ZN9BitStreamC2EPKhm:
   13|  1.79k|    start(p),
   14|  1.79k|    nbytes(nbytes)
   15|  1.79k|{
   16|  1.79k|    reset();
   17|  1.79k|}
_ZN9BitStream5resetEv:
   21|  1.79k|{
   22|  1.79k|    p = start;
   23|  1.79k|    bit_offset = 7;
   24|  1.79k|    if (QIntC::to_uint(nbytes) > static_cast<unsigned int>(-1) / 8) {
  ------------------
  |  Branch (24:9): [True: 0, False: 1.79k]
  ------------------
   25|      0|        throw std::runtime_error("array too large for bitstream");
   26|      0|    }
   27|  1.79k|    bits_available = 8 * nbytes;
   28|  1.79k|}
_ZN9BitStream13getBitsSignedEm:
   38|  1.82M|{
   39|  1.82M|    unsigned long long bits = read_bits(this->p, this->bit_offset, this->bits_available, nbits);
   40|  1.82M|    long long result = 0;
   41|  1.82M|    if (static_cast<long long>(bits) > 1LL << (nbits - 1)) {
  ------------------
  |  Branch (41:9): [True: 229k, False: 1.60M]
  ------------------
   42|   229k|        result = static_cast<long long>(bits - (1ULL << nbits));
   43|  1.60M|    } else {
   44|  1.60M|        result = static_cast<long long>(bits);
   45|  1.60M|    }
   46|  1.82M|    return result;
   47|  1.82M|}

_ZN9BitWriterC2EP8Pipeline:
    8|  1.79k|    pl(pl)
    9|  1.79k|{
   10|  1.79k|}
_ZN9BitWriter9writeBitsEym:
   14|  1.82M|{
   15|  1.82M|    write_bits(this->ch, this->bit_offset, val, bits, this->pl);
   16|  1.82M|}
_ZN9BitWriter15writeBitsSignedExm:
   20|  1.82M|{
   21|  1.82M|    unsigned long long uval = 0;
   22|  1.82M|    if (val < 0) {
  ------------------
  |  Branch (22:9): [True: 775k, False: 1.05M]
  ------------------
   23|   775k|        uval = (1ULL << bits) + static_cast<unsigned long long>(val);
   24|  1.05M|    } else {
   25|  1.05M|        uval = static_cast<unsigned long long>(val);
   26|  1.05M|    }
   27|  1.82M|    writeBits(uval, bits);
   28|  1.82M|}
_ZN9BitWriter5flushEv:
   38|  1.77k|{
   39|  1.77k|    if (bit_offset < 7) {
  ------------------
  |  Branch (39:9): [True: 1.13k, False: 640]
  ------------------
   40|  1.13k|        size_t bits_to_write = bit_offset + 1;
   41|  1.13k|        write_bits(this->ch, this->bit_offset, 0, bits_to_write, this->pl);
   42|  1.13k|    }
   43|  1.77k|}

_ZN6BufferC2Em:
   38|  2.94M|    m(std::make_unique<Members>(std::string(size, '\0')))
   39|  2.94M|{
   40|  2.94M|}
_ZN6BufferC2EONSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   43|  6.69k|    m(std::make_unique<Members>(std::move(content)))
   44|  6.69k|{
   45|  6.69k|}
_ZN6BufferC2EPhm:
   48|  20.8k|    m(std::make_unique<Members>(size, reinterpret_cast<char*>(buf)))
   49|  20.8k|{
   50|  20.8k|}
_ZN6BufferC2EOS_:
   58|  3.28M|    m(std::move(rhs.m))
   59|  3.28M|{
   60|  3.28M|}
_ZN6BufferD2Ev:
   69|  6.26M|Buffer::~Buffer() = default;
_ZNK6Buffer7getSizeEv:
   73|  70.9k|{
   74|  70.9k|    return m->size;
   75|  70.9k|}
_ZN6Buffer9getBufferEv:
   85|  3.00M|{
   86|  3.00M|    return reinterpret_cast<unsigned char*>(m->buf);
   87|  3.00M|}
_ZN6Buffer7MembersD2Ev:
   24|  2.97M|    ~Members() = default;
_ZN6Buffer7MembersC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   18|  2.95M|        str(std::move(content)),
   19|  2.95M|        size(str.size()),
   20|  2.95M|        buf(str.data())
   21|  2.95M|    {
   22|  2.95M|    }
_ZN6Buffer7MembersC2EmPc:
   13|  20.8k|        size(size),
   14|  20.8k|        buf(buf)
   15|  20.8k|    {
   16|  20.8k|    }

_ZN17BufferInputSourceC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEP6Bufferb:
  170|  20.8k|    m(std::make_unique<Members>(description, buf, own_memory))
  171|  20.8k|{
  172|  20.8k|}
_ZN17BufferInputSourceD2Ev:
  178|  20.8k|BufferInputSource::~BufferInputSource() = default;
_ZN17BufferInputSource18findAndSkipNextEOLEv:
  182|  1.04M|{
  183|  1.04M|    auto result = m->is.findAndSkipNextEOL();
  184|  1.04M|    last_offset = m->is.getLastOffset();
  185|  1.04M|    return result;
  186|  1.04M|}
_ZNK17BufferInputSource7getNameEv:
  189|   818k|{
  190|   818k|    return m->is.getName();
  191|   818k|}
_ZN17BufferInputSource4tellEv:
  194|  24.7M|{
  195|  24.7M|    return m->is.tell();
  196|  24.7M|}
_ZN17BufferInputSource4seekExi:
  199|  21.3M|{
  200|  21.3M|    m->is.seek(offset, whence);
  201|  21.3M|}
_ZN17BufferInputSource4readEPcm:
  209|  3.48M|{
  210|  3.48M|    auto result = m->is.read(buffer, length);
  211|  3.48M|    last_offset = m->is.getLastOffset();
  212|  3.48M|    return result;
  213|  3.48M|}
_ZN17BufferInputSource8unreadChEc:
  216|  23.1k|{
  217|  23.1k|    m->is.unreadCh(ch);
  218|  23.1k|}
_ZN4qpdf2is12OffsetBuffer18findAndSkipNextEOLEv:
  224|  1.04M|{
  225|  1.04M|    util::internal_error_if(pos < 0, "is::OffsetBuffer offset < 0");
  226|  1.04M|    auto end_pos = static_cast<qpdf_offset_t>(view_.size());
  227|  1.04M|    if (pos >= end_pos) {
  ------------------
  |  Branch (227:9): [True: 6.49k, False: 1.04M]
  ------------------
  228|  6.49k|        last_offset = end_pos + global_offset;
  229|  6.49k|        pos = end_pos;
  230|  6.49k|        return end_pos + global_offset;
  231|  6.49k|    }
  232|       |
  233|  1.04M|    qpdf_offset_t result = 0;
  234|  1.04M|    auto buffer = view_.begin();
  235|  1.04M|    auto end = view_.end();
  236|  1.04M|    auto p = buffer + static_cast<std::ptrdiff_t>(pos);
  237|       |
  238|   242M|    while (p < end && !(*p == '\r' || *p == '\n')) {
  ------------------
  |  Branch (238:12): [True: 242M, False: 13.3k]
  |  Branch (238:25): [True: 401k, False: 242M]
  |  Branch (238:39): [True: 627k, False: 241M]
  ------------------
  239|   241M|        ++p;
  240|   241M|    }
  241|  1.04M|    if (p < end) {
  ------------------
  |  Branch (241:9): [True: 1.02M, False: 13.3k]
  ------------------
  242|  1.02M|        result = p - buffer;
  243|  1.02M|        pos = result + 1;
  244|  1.02M|        ++p;
  245|  1.58M|        while (pos < end_pos && (*p == '\r' || *p == '\n')) {
  ------------------
  |  Branch (245:16): [True: 1.57M, False: 1.94k]
  |  Branch (245:34): [True: 24.5k, False: 1.55M]
  |  Branch (245:48): [True: 527k, False: 1.02M]
  ------------------
  246|   551k|            ++p;
  247|   551k|            ++pos;
  248|   551k|        }
  249|  1.02M|    } else {
  250|  13.3k|        pos = end_pos;
  251|  13.3k|        result = end_pos;
  252|  13.3k|    }
  253|  1.04M|    return result + global_offset;
  254|  1.04M|}
_ZN4qpdf2is12OffsetBuffer4seekExi:
  258|  23.6M|{
  259|  23.6M|    switch (whence) {
  260|  23.5M|    case SEEK_SET:
  ------------------
  |  Branch (260:5): [True: 23.5M, False: 110k]
  ------------------
  261|  23.5M|        pos = offset - global_offset;
  262|  23.5M|        break;
  263|       |
  264|  40.5k|    case SEEK_END:
  ------------------
  |  Branch (264:5): [True: 40.5k, False: 23.5M]
  ------------------
  265|  40.5k|        QIntC::range_check(static_cast<qpdf_offset_t>(view_.size()), offset);
  266|  40.5k|        pos = static_cast<qpdf_offset_t>(view_.size()) + offset;
  267|  40.5k|        break;
  268|       |
  269|  69.6k|    default:
  ------------------
  |  Branch (269:5): [True: 69.6k, False: 23.5M]
  ------------------
  270|  69.6k|        util::assertion(whence == SEEK_CUR, "invalid argument to BufferInputSource::seek");
  271|  69.6k|        QIntC::range_check(pos, offset);
  272|  69.6k|        pos += offset;
  273|  23.6M|    }
  274|       |
  275|  23.6M|    if (pos < 0) {
  ------------------
  |  Branch (275:9): [True: 464, False: 23.6M]
  ------------------
  276|    464|        throw std::runtime_error(description + ": seek before beginning of buffer");
  277|    464|    }
  278|  23.6M|}
_ZN4qpdf2is12OffsetBuffer4readEPcm:
  282|  3.54M|{
  283|  3.54M|    util::internal_error_if(pos < 0, "is::OffsetBuffer offset < 0");
  284|  3.54M|    auto end_pos = static_cast<qpdf_offset_t>(view_.size());
  285|  3.54M|    if (pos >= end_pos) {
  ------------------
  |  Branch (285:9): [True: 74.9k, False: 3.47M]
  ------------------
  286|  74.9k|        last_offset = end_pos + global_offset;
  287|  74.9k|        return 0;
  288|  74.9k|    }
  289|       |
  290|  3.47M|    last_offset = pos + global_offset;
  291|  3.47M|    size_t len = std::min(QIntC::to_size(end_pos - pos), length);
  292|  3.47M|    memcpy(buffer, view_.data() + pos, len);
  293|  3.47M|    pos += QIntC::to_offset(len);
  294|  3.47M|    return len;
  295|  3.54M|}
_ZN17BufferInputSource7MembersC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6Bufferb:
  148|  20.8k|        buf(own_memory ? buf : nullptr),
  ------------------
  |  Branch (148:13): [True: 0, False: 20.8k]
  ------------------
  149|  20.8k|        is(description,
  150|  20.8k|           buf && buf->getSize() > 0
  ------------------
  |  Branch (150:12): [True: 20.8k, False: 0]
  |  Branch (150:19): [True: 20.8k, False: 0]
  ------------------
  151|  20.8k|               ? std::string_view(reinterpret_cast<const char*>(buf->getBuffer()), buf->getSize())
  152|  20.8k|               : std::string_view())
  153|  20.8k|    {
  154|  20.8k|    }
_ZN17BufferInputSource7MembersD2Ev:
  162|  20.8k|    ~Members() = default;

_ZN24CryptoRandomDataProvider17provideRandomDataEPhm:
    7|    319|{
    8|    319|    auto crypto = QPDFCryptoProvider::getImpl();
    9|    319|    crypto->provideRandomData(data, len);
   10|    319|}
_ZN24CryptoRandomDataProvider11getInstanceEv:
   14|      1|{
   15|      1|    static CryptoRandomDataProvider instance;
   16|      1|    return &instance;
   17|      1|}

_ZN11InputSource13setLastOffsetEx:
   15|  20.5M|{
   16|  20.5M|    this->last_offset = offset;
   17|  20.5M|}
_ZNK11InputSource13getLastOffsetEv:
   21|  21.9M|{
   22|  21.9M|    return this->last_offset;
   23|  21.9M|}
_ZN11InputSource9read_lineERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   27|  10.9k|{
   28|       |    // Return at most max_line_length characters from the next line. Lines are terminated by one or
   29|       |    // more \r or \n characters. Consume the trailing newline characters but don't return them.
   30|       |    // After this is called, the file will be positioned after a line terminator or at the end of
   31|       |    // the file, and last_offset will point to position the file had when this method was called.
   32|       |
   33|  10.9k|    read(str, count, at);
   34|  10.9k|    auto eol = str.find_first_of("\n\r"sv);
   35|  10.9k|    if (eol != std::string::npos) {
  ------------------
  |  Branch (35:9): [True: 8.23k, False: 2.70k]
  ------------------
   36|  8.23k|        auto next_line = str.find_first_not_of("\n\r"sv, eol);
   37|  8.23k|        str.resize(eol);
   38|  8.23k|        if (next_line != std::string::npos) {
  ------------------
  |  Branch (38:13): [True: 7.54k, False: 696]
  ------------------
   39|  7.54k|            seek(last_offset + static_cast<qpdf_offset_t>(next_line), SEEK_SET);
   40|  7.54k|            return eol;
   41|  7.54k|        }
   42|  8.23k|    }
   43|       |    // We did not necessarily find the end of the trailing newline sequence.
   44|  3.39k|    seek(last_offset, SEEK_SET);
   45|  3.39k|    findAndSkipNextEOL();
   46|  3.39k|    return eol;
   47|  10.9k|}
_ZN11InputSource8readLineEm:
   51|  10.9k|{
   52|  10.9k|    return read_line(max_line_length);
   53|  10.9k|}
_ZN11InputSource9findFirstEPKcxmRNS_6FinderE:
   65|  68.9k|{
   66|       |    // Basic approach: search for the first character of start_chars starting from offset but not
   67|       |    // going past len (if len != 0). Once the first character is found, see if it is the beginning
   68|       |    // of a sequence of characters matching start_chars. If so, call finder.check() to do
   69|       |    // caller-specific additional checks. If not, keep searching.
   70|       |
   71|       |    // This code is tricky and highly subject to off-by-one or other edge case logic errors. See
   72|       |    // comments throughout that explain how we're not missing any edge cases. There are also tests
   73|       |    // specifically constructed to make sure we caught the edge cases in testing.
   74|       |
   75|  68.9k|    char buf[1025]; // size known to input_source.cc in libtests
   76|       |    // To enable us to guarantee null-termination, save an extra byte so that buf[size] is valid
   77|       |    // memory.
   78|  68.9k|    size_t size = sizeof(buf) - 1;
   79|  68.9k|    util::assertion(
   80|  68.9k|        !(strlen(start_chars) < 1 || strlen(start_chars) > size),
  ------------------
  |  Branch (80:11): [True: 0, False: 68.9k]
  |  Branch (80:38): [True: 0, False: 68.9k]
  ------------------
   81|  68.9k|        "InputSource::findSource called with too small or too large of a character sequence" //
   82|  68.9k|    );
   83|       |
   84|  68.9k|    char* p = nullptr;
   85|  68.9k|    qpdf_offset_t buf_offset = offset;
   86|  68.9k|    size_t bytes_read = 0;
   87|       |
   88|       |    // Guarantee that we return from this loop. Each time through, we either return, advance p, or
   89|       |    // restart the loop with a condition that will cause return on the next pass. Eventually we will
   90|       |    // either be out of range or hit EOF, either of which forces us to return.
   91|   553k|    while (true) {
  ------------------
  |  Branch (91:12): [True: 553k, Folded]
  ------------------
   92|       |        // Do we need to read more data? Pretend size = 5, buf starts at 0, and start_chars has 3
   93|       |        // characters. buf[5] is valid and null. If p == 2, start_chars could be buf[2] through
   94|       |        // buf[4], so p + strlen(start_chars) == buf + size is okay. If p points to buf[size], since
   95|       |        // strlen(start_chars) is always >= 1, this overflow test will be correct for that case
   96|       |        // regardless of start_chars.
   97|   553k|        if ((p == nullptr) || ((p + strlen(start_chars)) > (buf + bytes_read))) {
  ------------------
  |  Branch (97:13): [True: 68.9k, False: 484k]
  |  Branch (97:31): [True: 196k, False: 287k]
  ------------------
   98|   265k|            if (p) {
  ------------------
  |  Branch (98:17): [True: 196k, False: 68.9k]
  ------------------
   99|   196k|                QTC::TC(
  100|   196k|                    "libtests", "InputSource read next block", ((p == buf + bytes_read) ? 0 : 1));
  ------------------
  |  Branch (100:65): [True: 193k, False: 3.41k]
  ------------------
  101|   196k|                buf_offset += (p - buf);
  102|   196k|            }
  103|   265k|            this->seek(buf_offset, SEEK_SET);
  104|       |            // Read into buffer and zero out the rest of the buffer including buf[size]. We
  105|       |            // allocated an extra byte so that we could guarantee null termination as an extra
  106|       |            // protection against overrun when using string functions.
  107|   265k|            bytes_read = this->read(buf, size);
  108|   265k|            if (bytes_read < strlen(start_chars)) {
  ------------------
  |  Branch (108:17): [True: 40.4k, False: 225k]
  ------------------
  109|  40.4k|                QTC::TC("libtests", "InputSource find EOF", bytes_read == 0 ? 0 : 1);
  ------------------
  |  Branch (109:61): [True: 33.7k, False: 6.63k]
  ------------------
  110|  40.4k|                return false;
  111|  40.4k|            }
  112|   225k|            memset(buf + bytes_read, '\0', 1 + (size - bytes_read));
  113|   225k|            p = buf;
  114|   225k|        }
  115|       |
  116|       |        // Search for the first character.
  117|   512k|        if ((p = static_cast<char*>(
  ------------------
  |  Branch (117:13): [True: 319k, False: 193k]
  ------------------
  118|       |                 // line-break
  119|   512k|                 memchr(p, start_chars[0], bytes_read - QIntC::to_size(p - buf)))) != nullptr) {
  120|   319k|            if (p == buf) {
  ------------------
  |  Branch (120:17): [True: 3.87k, False: 315k]
  ------------------
  121|  3.87k|                QTC::TC("libtests", "InputSource found match at buf[0]");
  122|  3.87k|            }
  123|       |            // Found first letter.
  124|   319k|            if (len != 0) {
  ------------------
  |  Branch (124:17): [True: 18.3k, False: 300k]
  ------------------
  125|       |                // Make sure it's in range.
  126|  18.3k|                size_t p_relative_offset = QIntC::to_size((p - buf) + (buf_offset - offset));
  127|  18.3k|                if (p_relative_offset >= len) {
  ------------------
  |  Branch (127:21): [True: 1.20k, False: 17.1k]
  ------------------
  128|       |                    // out of range
  129|  1.20k|                    QTC::TC("libtests", "InputSource out of range");
  130|  1.20k|                    return false;
  131|  1.20k|                }
  132|  18.3k|            }
  133|   317k|            if ((p + strlen(start_chars)) > (buf + bytes_read)) {
  ------------------
  |  Branch (133:17): [True: 2.51k, False: 315k]
  ------------------
  134|       |                // If there are not enough bytes left in the file for start_chars, we will detect
  135|       |                // this on the next pass as EOF and return.
  136|  2.51k|                QTC::TC("libtests", "InputSource not enough bytes");
  137|  2.51k|                continue;
  138|  2.51k|            }
  139|       |
  140|       |            // See if p points to a sequence matching start_chars. We already checked above to make
  141|       |            // sure we are not going to overrun memory.
  142|   315k|            if (strncmp(p, start_chars, strlen(start_chars)) == 0) {
  ------------------
  |  Branch (142:17): [True: 37.7k, False: 277k]
  ------------------
  143|       |                // Call finder.check() with the input source positioned to the point of the match.
  144|  37.7k|                this->seek(buf_offset + (p - buf), SEEK_SET);
  145|  37.7k|                if (finder.check()) {
  ------------------
  |  Branch (145:21): [True: 27.3k, False: 10.4k]
  ------------------
  146|  27.3k|                    return true;
  147|  27.3k|                } else {
  148|  10.4k|                    QTC::TC("libtests", "InputSource start_chars matched but not check");
  149|  10.4k|                }
  150|   277k|            } else {
  151|   277k|                QTC::TC("libtests", "InputSource first char matched but not string");
  152|   277k|            }
  153|       |            // This occurrence of the first character wasn't a match. Skip over it and keep
  154|       |            // searching.
  155|   288k|            ++p;
  156|   288k|        } else {
  157|       |            // Trigger reading the next block
  158|   193k|            p = buf + bytes_read;
  159|   193k|        }
  160|   512k|    }
  161|  68.9k|}
_ZN11InputSource8findLastEPKcxmRNS_6FinderE:
  165|  20.8k|{
  166|  20.8k|    bool found = false;
  167|  20.8k|    qpdf_offset_t after_found_offset = 0;
  168|  20.8k|    qpdf_offset_t cur_offset = offset;
  169|  20.8k|    size_t cur_len = len;
  170|  26.9k|    while (this->findFirst(start_chars, cur_offset, cur_len, finder)) {
  ------------------
  |  Branch (170:12): [True: 6.13k, False: 20.8k]
  ------------------
  171|  6.13k|        if (found) {
  ------------------
  |  Branch (171:13): [True: 342, False: 5.79k]
  ------------------
  172|    342|            QTC::TC("libtests", "InputSource findLast found more than one");
  173|  5.79k|        } else {
  174|  5.79k|            found = true;
  175|  5.79k|        }
  176|  6.13k|        after_found_offset = this->tell();
  177|  6.13k|        cur_offset = after_found_offset;
  178|  6.13k|        cur_len = len - QIntC::to_size((cur_offset - offset));
  179|  6.13k|    }
  180|  20.8k|    if (found) {
  ------------------
  |  Branch (180:9): [True: 5.79k, False: 15.0k]
  ------------------
  181|       |        this->seek(after_found_offset, SEEK_SET);
  182|  5.79k|    }
  183|  20.8k|    return found;
  184|  20.8k|}
_ZN11InputSource9read_lineEmx:
   57|  10.9k|{
   58|  10.9k|    std::string result(count, '\0');
   59|  10.9k|    read_line(result, count, at);
   60|  10.9k|    return result;
   61|  10.9k|}

_ZN3MD5C2Ev:
   12|  96.5k|{
   13|  96.5k|    init();
   14|  96.5k|}
_ZN3MD54initEv:
   18|  96.5k|{
   19|  96.5k|    crypto = QPDFCryptoProvider::getImpl();
   20|  96.5k|    crypto->MD5_init();
   21|  96.5k|}
_ZN3MD56digestEPh:
   88|  96.5k|{
   89|  96.5k|    crypto->MD5_finalize();
   90|  96.5k|    crypto->MD5_digest(result);
   91|  96.5k|}
_ZN3MD56digestEv:
   95|    963|{
   96|    963|    Digest digest_val;
   97|    963|    digest(digest_val);
   98|    963|    return {reinterpret_cast<char*>(digest_val), 16};
   99|    963|}
_ZN3MD56digestENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
  103|  1.98k|{
  104|  1.98k|    MD5 m;
  105|  1.98k|    m.encodeDataIncrementally(data.data(), data.size());
  106|  1.98k|    Digest digest_val;
  107|  1.98k|    m.digest(digest_val);
  108|  1.98k|    return {reinterpret_cast<char*>(digest_val), 16};
  109|  1.98k|}

_ZN10MD5_nativeC2Ev:
   99|  96.5k|{
  100|  96.5k|    init();
  101|  96.5k|}
_ZN10MD5_native4initEv:
  105|  96.5k|{
  106|  96.5k|    count[0] = count[1] = 0;
  107|       |    // Load magic initialization constants.
  108|  96.5k|    state[0] = 0x67452301;
  109|  96.5k|    state[1] = 0xefcdab89;
  110|  96.5k|    state[2] = 0x98badcfe;
  111|  96.5k|    state[3] = 0x10325476;
  112|       |
  113|  96.5k|    finalized = false;
  114|  96.5k|    memset(digest_val, 0, sizeof(digest_val));
  115|  96.5k|}
_ZN10MD5_native6updateEPhm:
  123|   294k|{
  124|   294k|    unsigned int i, index, partLen;
  125|       |
  126|       |    // Compute number of bytes mod 64
  127|   294k|    index = static_cast<unsigned int>((count[0] >> 3) & 0x3f);
  128|       |
  129|       |    // Update number of bits
  130|   294k|    if ((count[0] += (static_cast<uint32_t>(inputLen) << 3)) <
  ------------------
  |  Branch (130:9): [True: 0, False: 294k]
  ------------------
  131|   294k|        (static_cast<uint32_t>(inputLen) << 3))
  132|      0|        count[1]++;
  133|   294k|    count[1] += (static_cast<uint32_t>(inputLen) >> 29);
  134|       |
  135|   294k|    partLen = 64 - index;
  136|       |
  137|       |    // Transform as many times as possible.
  138|       |
  139|   294k|    if (inputLen >= partLen) {
  ------------------
  |  Branch (139:9): [True: 98.3k, False: 196k]
  ------------------
  140|  98.3k|        memcpy(&buffer[index], input, partLen);
  141|  98.3k|        transform(state, buffer);
  142|       |
  143|   548k|        for (i = partLen; i + 63 < inputLen; i += 64)
  ------------------
  |  Branch (143:27): [True: 450k, False: 98.3k]
  ------------------
  144|   450k|            transform(state, &input[i]);
  145|       |
  146|  98.3k|        index = 0;
  147|  98.3k|    }
  148|   196k|    else
  149|   196k|        i = 0;
  150|       |
  151|       |    // Buffer remaining input
  152|   294k|    memcpy(&buffer[index], &input[i], inputLen-i);
  153|   294k|}
_ZN10MD5_native8finalizeEv:
  158|  96.5k|{
  159|  96.5k|    if (finalized)
  ------------------
  |  Branch (159:9): [True: 0, False: 96.5k]
  ------------------
  160|      0|    {
  161|      0|        return;
  162|      0|    }
  163|       |
  164|  96.5k|    unsigned char bits[8];
  165|  96.5k|    unsigned int index, padLen;
  166|       |
  167|       |    // Save number of bits
  168|  96.5k|    encode(bits, count, 8);
  169|       |
  170|       |    // Pad out to 56 mod 64.
  171|       |
  172|  96.5k|    index = static_cast<unsigned int>((count[0] >> 3) & 0x3f);
  173|  96.5k|    padLen = (index < 56) ? (56 - index) : (120 - index);
  ------------------
  |  Branch (173:14): [True: 96.4k, False: 60]
  ------------------
  174|  96.5k|    update(PADDING, padLen);
  175|       |
  176|       |    // Append length (before padding)
  177|  96.5k|    update(bits, 8);
  178|       |    // Store state in digest_val
  179|  96.5k|    encode(digest_val, state, 16);
  180|       |
  181|       |    // Zeroize sensitive information.
  182|  96.5k|    memset(state, 0, sizeof(state));
  183|  96.5k|    memset(count, 0, sizeof(count));
  184|  96.5k|    memset(buffer, 0, sizeof(buffer));
  185|       |
  186|  96.5k|    finalized = true;
  187|  96.5k|}
_ZN10MD5_native6digestEPh:
  191|  96.5k|{
  192|  96.5k|    memcpy(result, digest_val, sizeof(digest_val));
  193|  96.5k|}
_ZN10MD5_native9transformEPjPh:
  202|   548k|{
  203|   548k|    uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16];
  204|       |
  205|   548k|    decode(x, block, 64);
  206|       |
  207|       |    // Round 1
  208|   548k|    FF (a, b, c, d, x[ 0], S11, 0xd76aa478); // 1
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  209|   548k|    FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); // 2
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  210|   548k|    FF (c, d, a, b, x[ 2], S13, 0x242070db); // 3
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  211|   548k|    FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); // 4
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  212|   548k|    FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); // 5
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  213|   548k|    FF (d, a, b, c, x[ 5], S12, 0x4787c62a); // 6
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  214|   548k|    FF (c, d, a, b, x[ 6], S13, 0xa8304613); // 7
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  215|   548k|    FF (b, c, d, a, x[ 7], S14, 0xfd469501); // 8
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  216|   548k|    FF (a, b, c, d, x[ 8], S11, 0x698098d8); // 9
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  217|   548k|    FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); // 10
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  218|   548k|    FF (c, d, a, b, x[10], S13, 0xffff5bb1); // 11
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  219|   548k|    FF (b, c, d, a, x[11], S14, 0x895cd7be); // 12
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  220|   548k|    FF (a, b, c, d, x[12], S11, 0x6b901122); // 13
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  221|   548k|    FF (d, a, b, c, x[13], S12, 0xfd987193); // 14
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  222|   548k|    FF (c, d, a, b, x[14], S13, 0xa679438e); // 15
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  223|   548k|    FF (b, c, d, a, x[15], S14, 0x49b40821); // 16
  ------------------
  |  |   77|   548k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   548k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   548k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   548k| (a) += (b); \
  |  |   81|   548k|  }
  ------------------
  224|       |
  225|       |    // Round 2
  226|   548k|    GG (a, b, c, d, x[ 1], S21, 0xf61e2562); // 17
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  227|   548k|    GG (d, a, b, c, x[ 6], S22, 0xc040b340); // 18
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  228|   548k|    GG (c, d, a, b, x[11], S23, 0x265e5a51); // 19
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  229|   548k|    GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); // 20
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  230|   548k|    GG (a, b, c, d, x[ 5], S21, 0xd62f105d); // 21
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  231|   548k|    GG (d, a, b, c, x[10], S22,  0x2441453); // 22
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  232|   548k|    GG (c, d, a, b, x[15], S23, 0xd8a1e681); // 23
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  233|   548k|    GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); // 24
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  234|   548k|    GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); // 25
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  235|   548k|    GG (d, a, b, c, x[14], S22, 0xc33707d6); // 26
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  236|   548k|    GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); // 27
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  237|   548k|    GG (b, c, d, a, x[ 8], S24, 0x455a14ed); // 28
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  238|   548k|    GG (a, b, c, d, x[13], S21, 0xa9e3e905); // 29
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  239|   548k|    GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); // 30
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  240|   548k|    GG (c, d, a, b, x[ 7], S23, 0x676f02d9); // 31
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  241|   548k|    GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); // 32
  ------------------
  |  |   82|   548k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   548k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   548k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   548k| (a) += (b); \
  |  |   86|   548k|  }
  ------------------
  242|       |
  243|       |    // Round 3
  244|   548k|    HH (a, b, c, d, x[ 5], S31, 0xfffa3942); // 33
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  245|   548k|    HH (d, a, b, c, x[ 8], S32, 0x8771f681); // 34
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  246|   548k|    HH (c, d, a, b, x[11], S33, 0x6d9d6122); // 35
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  247|   548k|    HH (b, c, d, a, x[14], S34, 0xfde5380c); // 36
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  248|   548k|    HH (a, b, c, d, x[ 1], S31, 0xa4beea44); // 37
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  249|   548k|    HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); // 38
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  250|   548k|    HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); // 39
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  251|   548k|    HH (b, c, d, a, x[10], S34, 0xbebfbc70); // 40
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  252|   548k|    HH (a, b, c, d, x[13], S31, 0x289b7ec6); // 41
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  253|   548k|    HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); // 42
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  254|   548k|    HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); // 43
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  255|   548k|    HH (b, c, d, a, x[ 6], S34,  0x4881d05); // 44
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  256|   548k|    HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); // 45
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  257|   548k|    HH (d, a, b, c, x[12], S32, 0xe6db99e5); // 46
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  258|   548k|    HH (c, d, a, b, x[15], S33, 0x1fa27cf8); // 47
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  259|   548k|    HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); // 48
  ------------------
  |  |   87|   548k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   548k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   548k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   548k| (a) += (b); \
  |  |   91|   548k|  }
  ------------------
  260|       |
  261|       |    // Round 4
  262|   548k|    II (a, b, c, d, x[ 0], S41, 0xf4292244); // 49
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  263|   548k|    II (d, a, b, c, x[ 7], S42, 0x432aff97); // 50
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  264|   548k|    II (c, d, a, b, x[14], S43, 0xab9423a7); // 51
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  265|   548k|    II (b, c, d, a, x[ 5], S44, 0xfc93a039); // 52
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  266|   548k|    II (a, b, c, d, x[12], S41, 0x655b59c3); // 53
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  267|   548k|    II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); // 54
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  268|   548k|    II (c, d, a, b, x[10], S43, 0xffeff47d); // 55
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  269|   548k|    II (b, c, d, a, x[ 1], S44, 0x85845dd1); // 56
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  270|   548k|    II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); // 57
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  271|   548k|    II (d, a, b, c, x[15], S42, 0xfe2ce6e0); // 58
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  272|   548k|    II (c, d, a, b, x[ 6], S43, 0xa3014314); // 59
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  273|   548k|    II (b, c, d, a, x[13], S44, 0x4e0811a1); // 60
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  274|   548k|    II (a, b, c, d, x[ 4], S41, 0xf7537e82); // 61
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  275|   548k|    II (d, a, b, c, x[11], S42, 0xbd3af235); // 62
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  276|   548k|    II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); // 63
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  277|   548k|    II (b, c, d, a, x[ 9], S44, 0xeb86d391); // 64
  ------------------
  |  |   92|   548k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   548k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   548k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   548k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   548k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   548k| (a) += (b); \
  |  |   96|   548k|  }
  ------------------
  278|       |
  279|   548k|    state[0] += a;
  280|   548k|    state[1] += b;
  281|   548k|    state[2] += c;
  282|   548k|    state[3] += d;
  283|       |
  284|       |    // Zeroize sensitive information.
  285|       |
  286|   548k|    memset (x, 0, sizeof (x));
  287|   548k|}
_ZN10MD5_native6encodeEPhPjm:
  292|   193k|{
  293|   193k|    unsigned int i, j;
  294|       |
  295|   772k|    for (i = 0, j = 0; j < len; i++, j += 4) {
  ------------------
  |  Branch (295:24): [True: 579k, False: 193k]
  ------------------
  296|   579k|        output[j] = static_cast<unsigned char>(input[i] & 0xff);
  297|   579k|        output[j+1] = static_cast<unsigned char>((input[i] >> 8) & 0xff);
  298|   579k|        output[j+2] = static_cast<unsigned char>((input[i] >> 16) & 0xff);
  299|   579k|        output[j+3] = static_cast<unsigned char>((input[i] >> 24) & 0xff);
  300|   579k|    }
  301|   193k|}
_ZN10MD5_native6decodeEPjPhm:
  306|   548k|{
  307|   548k|    unsigned int i, j;
  308|       |
  309|  9.32M|    for (i = 0, j = 0; j < len; i++, j += 4)
  ------------------
  |  Branch (309:24): [True: 8.77M, False: 548k]
  ------------------
  310|  8.77M|        output[i] =
  311|  8.77M|            static_cast<uint32_t>(input[j]) |
  312|  8.77M|            (static_cast<uint32_t>(input[j+1]) << 8) |
  313|  8.77M|            (static_cast<uint32_t>(input[j+2]) << 16) |
  314|  8.77M|            (static_cast<uint32_t>(input[j+3]) << 24);
  315|   548k|}

_ZN10NNTreeImpl4warnERK16QPDFObjectHandleRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   32|  4.70k|{
   33|  4.70k|    qpdf.warn(qpdf_e_damaged_pdf, get_description(node), 0, msg);
   34|  4.70k|    if (++error_count > 5 && qpdf.doc().reconstructed_xref()) {
  ------------------
  |  Branch (34:9): [True: 355, False: 4.35k]
  |  Branch (34:30): [True: 261, False: 94]
  ------------------
   35|    261|        error(node, "too many errors - giving up");
   36|    261|    }
   37|  4.70k|}
_ZNK10NNTreeImpl5errorERK16QPDFObjectHandleRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   41|    979|{
   42|    979|    throw QPDFExc(qpdf_e_damaged_pdf, qpdf.getFilename(), get_description(node), 0, msg);
   43|    979|}
_ZN14NNTreeIterator12updateIValueEb:
   47|   148k|{
   48|       |    // ivalue should never be used inside the class since we return a pointer/reference to it. Every
   49|       |    // bit of code that ever changes what object the iterator points to should take care to call
   50|       |    // updateIValue. Failure to do this means that any old references to *iter will point to
   51|       |    // incorrect objects, though the next dereference of the iterator will fix it. This isn't
   52|       |    // necessarily catastrophic, but it would be confusing. The test suite attempts to exercise
   53|       |    // various cases to ensure we don't introduce that bug in the future, but sadly it's tricky to
   54|       |    // verify by reasoning about the code that this constraint is always satisfied. Whenever we
   55|       |    // update what the iterator points to, we should call setItemNumber, which calls this. If we
   56|       |    // change what the iterator points to in some other way, such as replacing a value or removing
   57|       |    // an item and making the iterator point at a different item in potentially the same position,
   58|       |    // we must call updateIValue as well. These cases are handled, and for good measure, we also
   59|       |    // call updateIValue in operator* and operator->.
   60|       |
   61|   148k|    Array items = node[impl.itemsKey()];
   62|   148k|    ivalue.first = items[item_number];
   63|   148k|    ivalue.second = items[item_number + 1];
   64|   148k|    if (ivalue.second) {
  ------------------
  |  Branch (64:9): [True: 146k, False: 2.45k]
  ------------------
   65|   146k|        return;
   66|   146k|    }
   67|       |
   68|  2.45k|    if (item_number < 0 || !node) {
  ------------------
  |  Branch (68:9): [True: 2.44k, False: 4]
  |  Branch (68:28): [True: 0, False: 4]
  ------------------
   69|  2.44k|        util::assertion(
   70|  2.44k|            allow_invalid, "attempt made to dereference an invalid name/number tree iterator");
   71|  2.44k|        return;
   72|  2.44k|    }
   73|      4|    impl.error(node, "update ivalue: items array is too short");
   74|      4|}
_ZN14NNTreeIterator10getNextKidERNS_11PathElementEb:
   78|    586|{
   79|    838|    while (true) {
  ------------------
  |  Branch (79:12): [True: 792, Folded]
  ------------------
   80|    792|        pe.kid_number += backward ? -1 : 1;
  ------------------
  |  Branch (80:26): [True: 0, False: 792]
  ------------------
   81|    792|        Dictionary result = pe.node["/Kids"][pe.kid_number];
   82|    792|        if (result.contains("/Kids") || result.contains(impl.itemsKey())) {
  ------------------
  |  Branch (82:13): [True: 212, False: 580]
  |  Branch (82:13): [True: 275, False: 517]
  |  Branch (82:41): [True: 63, False: 517]
  ------------------
   83|    275|            return result;
   84|    275|        }
   85|    517|        if (pe.kid_number < 0 || std::cmp_greater_equal(pe.kid_number, pe.node["/Kids"].size())) {
  ------------------
  |  Branch (85:13): [True: 0, False: 517]
  |  Branch (85:13): [True: 265, False: 252]
  |  Branch (85:34): [True: 265, False: 252]
  ------------------
   86|    265|            return {};
   87|    265|        }
   88|    252|        impl.warn(pe.node, "skipping over invalid kid at index " + std::to_string(pe.kid_number));
   89|    252|    }
   90|    586|}
_ZN14NNTreeIterator9incrementEb:
   93|  49.4k|{
   94|  49.4k|    if (item_number < 0) {
  ------------------
  |  Branch (94:9): [True: 0, False: 49.4k]
  ------------------
   95|      0|        deepen(impl.tree_root, !backward, true);
   96|      0|        return;
   97|      0|    }
   98|       |
   99|  52.5k|    while (valid()) {
  ------------------
  |  Branch (99:12): [True: 51.6k, False: 885]
  ------------------
  100|  51.6k|        item_number += backward ? -2 : 2;
  ------------------
  |  Branch (100:24): [True: 0, False: 51.6k]
  ------------------
  101|  51.6k|        Array items = node[impl.itemsKey()];
  102|  51.6k|        if (item_number < 0 || std::cmp_greater_equal(item_number, items.size())) {
  ------------------
  |  Branch (102:13): [True: 0, False: 51.6k]
  |  Branch (102:32): [True: 942, False: 50.7k]
  ------------------
  103|    942|            setItemNumber(QPDFObjectHandle(), -1);
  104|  1.33k|            while (!path.empty()) {
  ------------------
  |  Branch (104:20): [True: 586, False: 748]
  ------------------
  105|    586|                auto& element = path.back();
  106|    586|                if (auto pe_node = getNextKid(element, backward)) {
  ------------------
  |  Branch (106:26): [True: 275, False: 311]
  ------------------
  107|    275|                    if (deepen(pe_node, !backward, false)) {
  ------------------
  |  Branch (107:25): [True: 194, False: 81]
  ------------------
  108|    194|                        break;
  109|    194|                    }
  110|    311|                } else {
  111|    311|                    path.pop_back();
  112|    311|                }
  113|    586|            }
  114|    942|        }
  115|  51.6k|        if (item_number >= 0) {
  ------------------
  |  Branch (115:13): [True: 50.9k, False: 748]
  ------------------
  116|  50.9k|            items = node[impl.itemsKey()];
  117|  50.9k|            if (std::cmp_greater_equal(item_number + 1, items.size())) {
  ------------------
  |  Branch (117:17): [True: 496, False: 50.4k]
  ------------------
  118|    496|                impl.warn(node, "items array doesn't have enough elements");
  119|  50.4k|            } else if (!impl.keyValid(items[item_number])) {
  ------------------
  |  Branch (119:24): [True: 935, False: 49.4k]
  ------------------
  120|    935|                impl.warn(node, ("item " + std::to_string(item_number) + " has the wrong type"));
  121|  49.4k|            } else if (!impl.value_valid(items[item_number + 1])) {
  ------------------
  |  Branch (121:24): [True: 878, False: 48.6k]
  ------------------
  122|    878|                impl.warn(node, "item " + std::to_string(item_number + 1) + " is invalid");
  123|  48.6k|            } else {
  124|  48.6k|                return;
  125|  48.6k|            }
  126|  50.9k|        }
  127|  51.6k|    }
  128|  49.4k|}
_ZN14NNTreeIterator11resetLimitsEN4qpdf10DictionaryENSt3__115__list_iteratorINS_11PathElementEPvEE:
  132|  19.1k|{
  133|  19.1k|    while (true) {
  ------------------
  |  Branch (133:12): [True: 19.1k, Folded]
  ------------------
  134|  19.1k|        if (parent == path.end()) {
  ------------------
  |  Branch (134:13): [True: 11.2k, False: 7.81k]
  ------------------
  135|  11.2k|            a_node.erase("/Limits");
  136|  11.2k|            return;
  137|  11.2k|        }
  138|       |
  139|  7.81k|        QPDFObjectHandle first;
  140|  7.81k|        QPDFObjectHandle last;
  141|  7.81k|        Array items = a_node[impl.itemsKey()];
  142|  7.81k|        size_t nitems = items.size();
  143|  7.81k|        if (nitems >= 2) {
  ------------------
  |  Branch (143:13): [True: 7.46k, False: 350]
  ------------------
  144|  7.46k|            first = items[0];
  145|  7.46k|            last = items[(nitems - 1u) & ~1u];
  146|  7.46k|        } else {
  147|    350|            Array kids = a_node["/Kids"];
  148|    350|            size_t nkids = kids.size();
  149|    350|            if (nkids > 0) {
  ------------------
  |  Branch (149:17): [True: 350, False: 0]
  ------------------
  150|    350|                Array first_limits = kids[0]["/Limits"];
  151|    350|                if (first_limits.size() >= 2) {
  ------------------
  |  Branch (151:21): [True: 350, False: 0]
  ------------------
  152|    350|                    first = first_limits[0];
  153|    350|                    last = kids[nkids - 1u]["/Limits"][1];
  154|    350|                }
  155|    350|            }
  156|    350|        }
  157|  7.81k|        if (!(first && last)) {
  ------------------
  |  Branch (157:15): [True: 7.81k, False: 0]
  |  Branch (157:24): [True: 7.81k, False: 0]
  ------------------
  158|      0|            impl.warn(a_node, "unable to determine limits");
  159|  7.81k|        } else {
  160|  7.81k|            Array olimits = a_node["/Limits"];
  161|  7.81k|            if (olimits.size() == 2) {
  ------------------
  |  Branch (161:17): [True: 6.51k, False: 1.30k]
  ------------------
  162|  6.51k|                auto ofirst = olimits[0];
  163|  6.51k|                auto olast = olimits[1];
  164|  6.51k|                if (impl.keyValid(ofirst) && impl.keyValid(olast) &&
  ------------------
  |  Branch (164:21): [True: 6.51k, False: 0]
  |  Branch (164:21): [True: 0, False: 6.51k]
  |  Branch (164:46): [True: 6.51k, False: 0]
  ------------------
  165|  6.51k|                    impl.compareKeys(first, ofirst) == 0 && impl.compareKeys(last, olast) == 0) {
  ------------------
  |  Branch (165:21): [True: 6.51k, False: 0]
  |  Branch (165:61): [True: 0, False: 6.51k]
  ------------------
  166|      0|                    return;
  167|      0|                }
  168|  6.51k|            }
  169|  7.81k|            if (a_node != path.begin()->node) {
  ------------------
  |  Branch (169:17): [True: 7.46k, False: 350]
  ------------------
  170|  7.46k|                a_node.replace("/Limits", Array({first, last}));
  171|  7.46k|            }
  172|  7.81k|        }
  173|       |
  174|  7.81k|        if (parent == path.begin()) {
  ------------------
  |  Branch (174:13): [True: 7.81k, False: 0]
  ------------------
  175|  7.81k|            return;
  176|  7.81k|        }
  177|      0|        a_node = parent->node;
  178|      0|        --parent;
  179|      0|    }
  180|  19.1k|}
_ZN14NNTreeIterator5splitEN4qpdf10DictionaryENSt3__115__list_iteratorINS_11PathElementEPvEE:
  184|  17.8k|{
  185|       |    // Split some node along the path to the item pointed to by this iterator, and adjust the
  186|       |    // iterator so it points to the same item.
  187|       |
  188|       |    // In examples, for simplicity, /Nums is shown to just contain numbers instead of pairs. Imagine
  189|       |    // this tree:
  190|       |    //
  191|       |    // root: << /Kids [ A B C D ] >>
  192|       |    // A: << /Nums [ 1 2 3 4 ] >>
  193|       |    // B: << /Nums [ 5 6 7 8 ] >>
  194|       |    // C: << /Nums [ 9 10 11 12 ] >>
  195|       |    // D: << /Kids [ E F ]
  196|       |    // E: << /Nums [ 13 14 15 16 ] >>
  197|       |    // F: << /Nums [ 17 18 19 20 ] >>
  198|       |
  199|       |    // iter1 (points to 19)
  200|       |    //   path:
  201|       |    //   - { node: root: kid_number: 3 }
  202|       |    //   - { node: D, kid_number: 1 }
  203|       |    //   node: F
  204|       |    //   item_number: 2
  205|       |
  206|       |    // iter2 (points to 1)
  207|       |    //   path:
  208|       |    //   - { node: root, kid_number: 0}
  209|       |    //   node: A
  210|       |    //   item_number: 0
  211|       |
  212|  17.8k|    util::assertion(valid(), "NNTreeIterator::split called an invalid iterator");
  213|       |
  214|       |    // Find the array we actually need to split, which is either this node's kids or items.
  215|  17.8k|    Array kids = to_split["/Kids"];
  216|  17.8k|    size_t nkids = kids.size();
  217|  17.8k|    Array items = to_split[impl.itemsKey()];
  218|  17.8k|    size_t nitems = items.size();
  219|       |
  220|  17.8k|    Array first_half;
  221|  17.8k|    size_t n = 0;
  222|  17.8k|    std::string key;
  223|  17.8k|    size_t threshold = static_cast<size_t>(impl.split_threshold);
  224|  17.8k|    if (nkids > 0) {
  ------------------
  |  Branch (224:9): [True: 350, False: 17.4k]
  ------------------
  225|    350|        first_half = kids;
  226|    350|        n = nkids;
  227|    350|        key = "/Kids";
  228|  17.4k|    } else {
  229|  17.4k|        util::assertion(nitems > 0, "NNTreeIterator::split called on invalid node");
  230|  17.4k|        first_half = items;
  231|  17.4k|        n = nitems;
  232|  17.4k|        threshold *= 2;
  233|  17.4k|        key = impl.itemsKey();
  234|  17.4k|    }
  235|       |
  236|  17.8k|    if (n <= threshold) {
  ------------------
  |  Branch (236:9): [True: 17.1k, False: 652]
  ------------------
  237|  17.1k|        return;
  238|  17.1k|    }
  239|       |
  240|    652|    bool is_root = parent == path.end();
  241|    652|    bool is_leaf = nitems > 0;
  242|       |
  243|       |    // CURRENT STATE: tree is in original state; iterator is valid and unchanged.
  244|       |
  245|    652|    if (is_root) {
  ------------------
  |  Branch (245:9): [True: 302, False: 350]
  ------------------
  246|       |        // What we want to do is to create a new node for the second half of the items and put it in
  247|       |        // the parent's /Kids array right after the element that points to the current to_split
  248|       |        // node, but if we're splitting root, there is no parent, so handle that first.
  249|       |
  250|       |        // In the non-root case, parent points to the path element whose /Kids contains the first
  251|       |        // half node, and the first half node is to_split. If we are splitting the root, we need to
  252|       |        // push everything down a level, but we want to keep the actual root object the same so that
  253|       |        // indirect references to it remain intact (and also in case it might be a direct object,
  254|       |        // which it shouldn't be but that case probably exists in the wild). To achieve this, we
  255|       |        // create a new node for the first half and then replace /Kids in the root to contain it.
  256|       |        // Then we adjust the path so that the first element is root and the second element, if any,
  257|       |        // is the new first half. In this way, we make the root case identical to the non-root case
  258|       |        // so remaining logic can handle them in the same way.
  259|       |
  260|    302|        Dictionary first_node = impl.qpdf.makeIndirectObject(Dictionary({{key, first_half}}));
  261|    302|        auto new_kids = Array::empty();
  262|    302|        new_kids.push_back(first_node);
  263|    302|        to_split.erase("/Limits"); // already shouldn't be there for root
  264|    302|        to_split.erase(impl.itemsKey());
  265|    302|        to_split.replace("/Kids", new_kids);
  266|    302|        if (is_leaf) {
  ------------------
  |  Branch (266:13): [True: 302, False: 0]
  ------------------
  267|    302|            node = first_node;
  268|    302|        } else {
  269|      0|            auto next = path.begin();
  270|      0|            next->node = first_node;
  271|      0|        }
  272|    302|        this->path.emplace_front(to_split, 0);
  273|    302|        parent = path.begin();
  274|    302|        to_split = first_node;
  275|    302|    }
  276|       |
  277|       |    // CURRENT STATE: parent is guaranteed to be defined, and we have the invariants that
  278|       |    // parent[/Kids][kid_number] == to_split and (++parent).node == to_split.
  279|       |
  280|       |    // Create a second half array, and transfer the second half of the items into the second half
  281|       |    // array.
  282|    652|    auto second_half = Array::empty();
  283|    652|    auto start_idx = static_cast<int>((n / 2) & ~1u);
  284|  22.8k|    while (std::cmp_greater(first_half.size(), start_idx)) {
  ------------------
  |  Branch (284:12): [True: 22.1k, False: 652]
  ------------------
  285|  22.1k|        second_half.push_back(first_half[start_idx]);
  286|  22.1k|        first_half.erase(start_idx);
  287|  22.1k|    }
  288|    652|    resetLimits(to_split, parent);
  289|       |
  290|       |    // Create a new node to contain the second half
  291|    652|    Dictionary second_node = impl.qpdf.makeIndirectObject(Dictionary({{key, second_half}}));
  292|    652|    resetLimits(second_node, parent);
  293|       |
  294|       |    // CURRENT STATE: half the items from the kids or items array in the node being split have been
  295|       |    // moved into a new node. The new node is not yet attached to the tree. The iterator may have a
  296|       |    // path element or leaf node that is out of bounds.
  297|       |
  298|       |    // We need to adjust the parent to add the second node to /Kids and, if needed, update
  299|       |    // kid_number to traverse through it. We need to update to_split's path element, or the node if
  300|       |    // this is a leaf, so that the kid/item number points to the right place.
  301|       |
  302|    652|    Array parent_kids = parent->node["/Kids"];
  303|    652|    if (!parent_kids) {
  ------------------
  |  Branch (303:9): [True: 0, False: 652]
  ------------------
  304|      0|        impl.error(parent->node, "parent node has no /Kids array");
  305|      0|    }
  306|    652|    parent_kids.insert(parent->kid_number + 1, second_node);
  307|    652|    auto cur_elem = parent;
  308|    652|    ++cur_elem; // points to end() for leaf nodes
  309|    652|    int old_idx = (is_leaf ? item_number : cur_elem->kid_number);
  ------------------
  |  Branch (309:20): [True: 652, False: 0]
  ------------------
  310|    652|    if (old_idx >= start_idx) {
  ------------------
  |  Branch (310:9): [True: 652, False: 0]
  ------------------
  311|    652|        ++parent->kid_number;
  312|    652|        if (is_leaf) {
  ------------------
  |  Branch (312:13): [True: 652, False: 0]
  ------------------
  313|    652|            setItemNumber(second_node, item_number - start_idx);
  314|    652|        } else {
  315|      0|            cur_elem->node = second_node;
  316|      0|            cur_elem->kid_number -= start_idx;
  317|      0|        }
  318|    652|    }
  319|    652|    if (!is_root) {
  ------------------
  |  Branch (319:9): [True: 350, False: 302]
  ------------------
  320|    350|        auto next = parent->node;
  321|    350|        resetLimits(next, parent);
  322|    350|        --parent;
  323|    350|        split(next, parent);
  324|    350|    }
  325|    652|}
_ZN14NNTreeIterator15lastPathElementEv:
  329|  34.9k|{
  330|  34.9k|    return path.empty() ? path.end() : std::prev(path.end());
  ------------------
  |  Branch (330:12): [True: 22.5k, False: 12.3k]
  ------------------
  331|  34.9k|}
_ZN14NNTreeIterator11insertAfterERK16QPDFObjectHandleS2_:
  335|  16.9k|{
  336|  16.9k|    if (!valid()) {
  ------------------
  |  Branch (336:9): [True: 0, False: 16.9k]
  ------------------
  337|      0|        impl.insertFirst(key, value);
  338|      0|        deepen(impl.tree_root, true, false);
  339|      0|        return;
  340|      0|    }
  341|       |
  342|  16.9k|    Array items = node[impl.itemsKey()];
  343|  16.9k|    if (!items) {
  ------------------
  |  Branch (343:9): [True: 0, False: 16.9k]
  ------------------
  344|      0|        impl.error(node, "node contains no items array");
  345|      0|    }
  346|       |
  347|  16.9k|    if (std::cmp_less(items.size(), item_number + 2)) {
  ------------------
  |  Branch (347:9): [True: 0, False: 16.9k]
  ------------------
  348|      0|        impl.error(node, "insert: items array is too short");
  349|      0|    }
  350|  16.9k|    if (!(key && value)) {
  ------------------
  |  Branch (350:11): [True: 16.9k, False: 0]
  |  Branch (350:18): [True: 16.9k, False: 0]
  ------------------
  351|      0|        impl.error(node, "insert: key or value is null");
  352|      0|    }
  353|  16.9k|    if (!impl.value_valid(value)) {
  ------------------
  |  Branch (353:9): [True: 0, False: 16.9k]
  ------------------
  354|      0|        impl.error(node, "insert: value is invalid");
  355|      0|    }
  356|  16.9k|    items.insert(item_number + 2, key);
  357|  16.9k|    items.insert(item_number + 3, value);
  358|  16.9k|    resetLimits(node, lastPathElement());
  359|  16.9k|    split(node, lastPathElement());
  360|  16.9k|    increment(false);
  361|  16.9k|}
_ZNK14NNTreeIteratoreqERKS_:
  455|  37.3k|{
  456|  37.3k|    if (item_number == -1 && other.item_number == -1) {
  ------------------
  |  Branch (456:9): [True: 3.64k, False: 33.7k]
  |  Branch (456:30): [True: 3.64k, False: 0]
  ------------------
  457|  3.64k|        return true;
  458|  3.64k|    }
  459|  33.7k|    if (path.size() != other.path.size()) {
  ------------------
  |  Branch (459:9): [True: 11.2k, False: 22.4k]
  ------------------
  460|  11.2k|        return false;
  461|  11.2k|    }
  462|  22.4k|    auto tpi = path.begin();
  463|  22.4k|    auto opi = other.path.begin();
  464|  22.4k|    while (tpi != path.end()) {
  ------------------
  |  Branch (464:12): [True: 0, False: 22.4k]
  ------------------
  465|      0|        if (tpi->kid_number != opi->kid_number) {
  ------------------
  |  Branch (465:13): [True: 0, False: 0]
  ------------------
  466|      0|            return false;
  467|      0|        }
  468|      0|        ++tpi;
  469|      0|        ++opi;
  470|      0|    }
  471|  22.4k|    return item_number == other.item_number;
  472|  22.4k|}
_ZN14NNTreeIterator6deepenEN4qpdf10DictionaryEbb:
  476|  23.3k|{
  477|       |    // Starting at this node, descend through the first or last kid until we reach a node with
  478|       |    // items. If we succeed, return true; otherwise return false and leave path alone.
  479|       |
  480|  23.3k|    auto opath = path;
  481|       |
  482|  23.3k|    auto fail = [this, &opath](Dictionary const& failed_node, std::string const& msg) {
  483|  23.3k|        impl.warn(failed_node, msg);
  484|  23.3k|        path = opath;
  485|  23.3k|        return false;
  486|  23.3k|    };
  487|       |
  488|  23.3k|    QPDFObjGen::set seen;
  489|  23.3k|    for (auto const& i: path) {
  ------------------
  |  Branch (489:23): [True: 458, False: 23.3k]
  ------------------
  490|    458|        seen.add(i.node);
  491|    458|    }
  492|  32.0k|    while (true) {
  ------------------
  |  Branch (492:12): [True: 32.0k, Folded]
  ------------------
  493|  32.0k|        if (!seen.add(a_node)) {
  ------------------
  |  Branch (493:13): [True: 45, False: 31.9k]
  ------------------
  494|     45|            return fail(a_node, "loop detected while traversing name/number tree");
  495|     45|        }
  496|       |
  497|  31.9k|        if (!a_node) {
  ------------------
  |  Branch (497:13): [True: 0, False: 31.9k]
  ------------------
  498|      0|            return fail(a_node, "non-dictionary node while traversing name/number tree");
  499|      0|        }
  500|       |
  501|  31.9k|        Array items = a_node[impl.itemsKey()];
  502|  31.9k|        int nitems = static_cast<int>(items.size());
  503|  31.9k|        if (nitems > 1) {
  ------------------
  |  Branch (503:13): [True: 20.3k, False: 11.6k]
  ------------------
  504|  20.3k|            setItemNumber(a_node, first ? 0 : nitems - 2);
  ------------------
  |  Branch (504:35): [True: 20.3k, False: 0]
  ------------------
  505|  20.3k|            return true;
  506|  20.3k|        }
  507|       |
  508|  11.6k|        Array kids = a_node["/Kids"];
  509|  11.6k|        int nkids = static_cast<int>(kids.size());
  510|  11.6k|        if (nkids == 0) {
  ------------------
  |  Branch (510:13): [True: 2.68k, False: 8.92k]
  ------------------
  511|  2.68k|            if (allow_empty && items) {
  ------------------
  |  Branch (511:17): [True: 2.65k, False: 34]
  |  Branch (511:32): [True: 1.57k, False: 1.08k]
  ------------------
  512|  1.57k|                setItemNumber(a_node, -1);
  513|  1.57k|                return true;
  514|  1.57k|            }
  515|  1.11k|            return fail(
  516|  1.11k|                a_node,
  517|  1.11k|                "name/number tree node has neither non-empty " + impl.itemsKey() + " nor /Kids");
  518|  2.68k|        }
  519|       |
  520|  8.92k|        int kid_number = first ? 0 : nkids - 1;
  ------------------
  |  Branch (520:26): [True: 8.92k, False: 0]
  ------------------
  521|  8.92k|        addPathElement(a_node, kid_number);
  522|  8.92k|        Dictionary next = kids[kid_number];
  523|  8.92k|        if (!next) {
  ------------------
  |  Branch (523:13): [True: 219, False: 8.70k]
  ------------------
  524|    219|            return fail(a_node, "kid number " + std::to_string(kid_number) + " is invalid");
  525|    219|        }
  526|  8.70k|        if (!next.indirect()) {
  ------------------
  |  Branch (526:13): [True: 17, False: 8.69k]
  ------------------
  527|     17|            if (impl.auto_repair) {
  ------------------
  |  Branch (527:17): [True: 17, False: 0]
  ------------------
  528|     17|                impl.warn(
  529|     17|                    a_node,
  530|     17|                    "converting kid number " + std::to_string(kid_number) +
  531|     17|                        " to an indirect object");
  532|     17|                next = impl.qpdf.makeIndirectObject(next);
  533|     17|                kids.set(kid_number, next);
  534|     17|            } else {
  535|      0|                impl.warn(
  536|      0|                    a_node,
  537|      0|                    "kid number " + std::to_string(kid_number) + " is not an indirect object");
  538|      0|            }
  539|     17|        }
  540|       |
  541|  8.70k|        a_node = next;
  542|  8.70k|    }
  543|  23.3k|}
_ZN10NNTreeImpl5beginEv:
  547|  23.0k|{
  548|  23.0k|    iterator result(*this);
  549|  23.0k|    result.deepen(tree_root, true, true);
  550|  23.0k|    return result;
  551|  23.0k|}
_ZNK10NNTreeImpl11compareKeysE16QPDFObjectHandleS0_:
  563|   136k|{
  564|       |    // We don't call this without calling keyValid first
  565|   136k|    qpdf_assert_debug(keyValid(a));
  ------------------
  |  |   11|   136k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (565:5): [True: 136k, False: 0]
  ------------------
  566|   136k|    qpdf_assert_debug(keyValid(b));
  ------------------
  |  |   11|   136k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (566:5): [True: 136k, False: 0]
  ------------------
  567|   136k|    if (key_type == ::ot_string) {
  ------------------
  |  Branch (567:9): [True: 136k, False: 0]
  ------------------
  568|   136k|        auto as = a.getUTF8Value();
  569|   136k|        auto bs = b.getUTF8Value();
  570|   136k|        return as < bs ? -1 : (as > bs ? 1 : 0);
  ------------------
  |  Branch (570:16): [True: 4.85k, False: 131k]
  |  Branch (570:32): [True: 123k, False: 7.66k]
  ------------------
  571|   136k|    }
  572|      0|    auto as = a.getIntValue();
  573|      0|    auto bs = b.getIntValue();
  574|      0|    return as < bs ? -1 : (as > bs ? 1 : 0);
  ------------------
  |  Branch (574:12): [True: 0, False: 0]
  |  Branch (574:28): [True: 0, False: 0]
  ------------------
  575|   136k|}
_ZNK10NNTreeImpl12binarySearchERK16QPDFObjectHandleRKN4qpdf5ArrayEmbb:
  584|  25.3k|{
  585|  25.3k|    size_t max_idx = std::bit_ceil(num_items);
  586|       |
  587|  25.3k|    int step = static_cast<int>(max_idx / 2);
  588|  25.3k|    int checks = static_cast<int>(std::bit_width(max_idx)); // AppImage gcc version returns size_t
  589|  25.3k|    int idx = step;
  590|  25.3k|    int found_idx = -1;
  591|       |
  592|   143k|    for (int i = 0; i < checks; ++i) {
  ------------------
  |  Branch (592:21): [True: 119k, False: 24.2k]
  ------------------
  593|   119k|        int status = -1;
  594|   119k|        if (std::cmp_less(idx, num_items)) {
  ------------------
  |  Branch (594:13): [True: 72.8k, False: 46.5k]
  ------------------
  595|  72.8k|            status = search_kids ? compareKeyKid(key, items, idx) : compareKeyItem(key, items, idx);
  ------------------
  |  Branch (595:22): [True: 14.6k, False: 58.2k]
  ------------------
  596|  72.8k|            if (status == 0) {
  ------------------
  |  Branch (596:17): [True: 1.17k, False: 71.6k]
  ------------------
  597|  1.17k|                return idx;
  598|  1.17k|            }
  599|  71.6k|            if (status > 0) {
  ------------------
  |  Branch (599:17): [True: 68.3k, False: 3.38k]
  ------------------
  600|  68.3k|                found_idx = idx;
  601|  68.3k|            }
  602|  71.6k|        }
  603|   118k|        step = std::max(step / 2, 1);
  604|   118k|        idx += status * step;
  605|   118k|    }
  606|  24.2k|    return return_prev_if_not_found ? found_idx : -1;
  ------------------
  |  Branch (606:12): [True: 23.1k, False: 1.03k]
  ------------------
  607|  25.3k|}
_ZNK10NNTreeImpl14compareKeyItemERK16QPDFObjectHandleRKN4qpdf5ArrayEi:
  611|  58.2k|{
  612|  58.2k|    if (!keyValid(items[2 * idx])) {
  ------------------
  |  Branch (612:9): [True: 25, False: 58.2k]
  ------------------
  613|     25|        error(tree_root, ("item at index " + std::to_string(2 * idx) + " is not the right type"));
  614|     25|    }
  615|  58.2k|    return compareKeys(key, items[2 * idx]);
  616|  58.2k|}
_ZNK10NNTreeImpl13compareKeyKidERK16QPDFObjectHandleRKN4qpdf5ArrayEi:
  620|  14.6k|{
  621|  14.6k|    Dictionary kid = kids[idx];
  622|  14.6k|    if (!kid) {
  ------------------
  |  Branch (622:9): [True: 8, False: 14.6k]
  ------------------
  623|      8|        error(tree_root, "invalid kid at index " + std::to_string(idx));
  624|      8|    }
  625|  14.6k|    Array limits = kid["/Limits"];
  626|  14.6k|    if (!(keyValid(limits[0]) && keyValid(limits[1]))) {
  ------------------
  |  Branch (626:9): [True: 18, False: 14.6k]
  |  Branch (626:11): [True: 14.6k, False: 23]
  |  Branch (626:34): [True: 14.6k, False: 3]
  ------------------
  627|     18|        error(kids[idx], "node is missing /Limits");
  628|     18|    }
  629|  14.6k|    if (compareKeys(key, limits[0]) < 0) {
  ------------------
  |  Branch (629:9): [True: 573, False: 14.0k]
  ------------------
  630|    573|        return -1;
  631|    573|    }
  632|  14.0k|    if (compareKeys(key, limits[1]) > 0) {
  ------------------
  |  Branch (632:9): [True: 13.3k, False: 673]
  ------------------
  633|  13.3k|        return 1;
  634|  13.3k|    }
  635|    673|    return 0;
  636|  14.0k|}
_ZN10NNTreeImpl6repairEv:
  657|    706|{
  658|    706|    auto new_node = Dictionary({{itemsKey(), Array::empty()}});
  659|    706|    NNTreeImpl repl(qpdf, new_node, key_type, value_valid, false);
  660|    706|    std::map<QPDFObjectHandle, QPDFObjectHandle, Cmp> items;
  661|  31.4k|    for (auto const& [key, value]: *this) {
  ------------------
  |  Branch (661:34): [True: 31.4k, False: 706]
  ------------------
  662|  31.4k|        if (key && value && repl.keyValid(key) && repl.value_valid(value)) {
  ------------------
  |  Branch (662:13): [True: 31.4k, False: 5]
  |  Branch (662:13): [True: 31.2k, False: 238]
  |  Branch (662:20): [True: 31.4k, False: 0]
  |  Branch (662:29): [True: 31.4k, False: 61]
  |  Branch (662:51): [True: 31.2k, False: 172]
  ------------------
  663|  31.2k|            items.insert_or_assign(key, value);
  664|  31.2k|        }
  665|  31.4k|    }
  666|  17.4k|    for (auto const& [key, value]: items) {
  ------------------
  |  Branch (666:34): [True: 17.4k, False: 706]
  ------------------
  667|  17.4k|        repl.insert(key, value);
  668|  17.4k|    }
  669|    706|    tree_root.replace("/Kids", new_node["/Kids"]);
  670|    706|    tree_root.replace(itemsKey(), new_node[itemsKey()]);
  671|    706|}
_ZN10NNTreeImpl4findERK16QPDFObjectHandleb:
  675|  20.4k|{
  676|  20.4k|    try {
  677|  20.4k|        return findInternal(key, return_prev_if_not_found);
  678|  20.4k|    } catch (QPDFExc& e) {
  679|     76|        if (auto_repair) {
  ------------------
  |  Branch (679:13): [True: 76, False: 0]
  ------------------
  680|     76|            warn(tree_root, std::string("attempting to repair after error: ") + e.what());
  681|     76|            repair();
  682|     76|            return findInternal(key, return_prev_if_not_found);
  683|     76|        } else {
  684|      0|            throw;
  685|      0|        }
  686|     76|    }
  687|  20.4k|}
_ZN10NNTreeImpl12findInternalERK16QPDFObjectHandleb:
  691|  20.4k|{
  692|  20.4k|    auto first_item = begin();
  693|  20.4k|    if (!first_item.valid()) {
  ------------------
  |  Branch (693:9): [True: 1.82k, False: 18.6k]
  ------------------
  694|  1.82k|        return end();
  695|  1.82k|    }
  696|  18.6k|    if (!keyValid(first_item->first)) {
  ------------------
  |  Branch (696:9): [True: 0, False: 18.6k]
  ------------------
  697|      0|        error(tree_root, "encountered invalid key in find");
  698|      0|    }
  699|  18.6k|    if (!value_valid(first_item->second)) {
  ------------------
  |  Branch (699:9): [True: 0, False: 18.6k]
  ------------------
  700|      0|        error(tree_root, "encountered invalid value in find");
  701|      0|    }
  702|  18.6k|    if (compareKeys(key, first_item->first) < 0) {
  ------------------
  |  Branch (702:9): [True: 88, False: 18.5k]
  ------------------
  703|       |        // Before the first key
  704|     88|        return end();
  705|     88|    }
  706|       |
  707|  18.5k|    QPDFObjGen::set seen;
  708|  18.5k|    auto node = tree_root;
  709|  18.5k|    iterator result(*this);
  710|       |
  711|  25.4k|    while (true) {
  ------------------
  |  Branch (711:12): [True: 25.3k, Folded]
  ------------------
  712|  25.3k|        if (!seen.add(node)) {
  ------------------
  |  Branch (712:13): [True: 0, False: 25.3k]
  ------------------
  713|      0|            error(node, "loop detected in find");
  714|      0|        }
  715|       |
  716|  25.3k|        Array items = node[itemsKey()];
  717|  25.3k|        size_t nitems = items.size();
  718|  25.3k|        if (nitems > 1) {
  ------------------
  |  Branch (718:13): [True: 18.5k, False: 6.87k]
  ------------------
  719|  18.5k|            int idx = binarySearch(key, items, nitems / 2, return_prev_if_not_found, false);
  720|  18.5k|            if (idx >= 0) {
  ------------------
  |  Branch (720:17): [True: 17.5k, False: 1.01k]
  ------------------
  721|  17.5k|                result.setItemNumber(node, 2 * idx);
  722|  17.5k|                if (!result.impl.keyValid(result.ivalue.first)) {
  ------------------
  |  Branch (722:21): [True: 0, False: 17.5k]
  ------------------
  723|      0|                    error(node, "encountered invalid key in find");
  724|      0|                }
  725|  17.5k|                if (!result.impl.value_valid(result.ivalue.second)) {
  ------------------
  |  Branch (725:21): [True: 6, False: 17.4k]
  ------------------
  726|      6|                    error(tree_root, "encountered invalid value in find");
  727|      6|                }
  728|  17.5k|            }
  729|  18.5k|            return result;
  730|  18.5k|        }
  731|       |
  732|  6.87k|        Array kids = node["/Kids"];
  733|  6.87k|        size_t nkids = kids.size();
  734|  6.87k|        if (nkids == 0) {
  ------------------
  |  Branch (734:13): [True: 1, False: 6.87k]
  ------------------
  735|      1|            error(node, "bad node during find");
  736|      1|        }
  737|  6.87k|        int idx = binarySearch(key, kids, nkids, true, true);
  738|  6.87k|        if (idx == -1) {
  ------------------
  |  Branch (738:13): [True: 1, False: 6.87k]
  ------------------
  739|      1|            error(node, "unexpected -1 from binary search of kids; limits may by wrong");
  740|      1|        }
  741|  6.87k|        result.addPathElement(node, idx);
  742|  6.87k|        node = kids[idx];
  743|  6.87k|    }
  744|  18.5k|}
_ZN10NNTreeImpl11insertFirstERK16QPDFObjectHandleS2_:
  748|    484|{
  749|    484|    auto iter = begin();
  750|    484|    Array items = iter.node[items_key];
  751|    484|    if (!items) {
  ------------------
  |  Branch (751:9): [True: 0, False: 484]
  ------------------
  752|      0|        error(tree_root, "unable to find a valid items node");
  753|      0|    }
  754|    484|    if (!(key && value)) {
  ------------------
  |  Branch (754:11): [True: 484, False: 0]
  |  Branch (754:18): [True: 484, False: 0]
  ------------------
  755|      0|        error(tree_root, "unable to insert null key or value");
  756|      0|    }
  757|    484|    if (!value_valid(value)) {
  ------------------
  |  Branch (757:9): [True: 0, False: 484]
  ------------------
  758|      0|        error(tree_root, "attempting to insert an invalid value");
  759|      0|    }
  760|    484|    items.insert(0, key);
  761|    484|    items.insert(1, value);
  762|    484|    iter.setItemNumber(iter.node, 0);
  763|    484|    iter.resetLimits(iter.node, iter.lastPathElement());
  764|    484|    iter.split(iter.node, iter.lastPathElement());
  765|    484|    return iter;
  766|    484|}
_ZN10NNTreeImpl6insertERK16QPDFObjectHandleS2_:
  770|  17.4k|{
  771|  17.4k|    auto iter = find(key, true);
  772|  17.4k|    if (!iter.valid()) {
  ------------------
  |  Branch (772:9): [True: 484, False: 16.9k]
  ------------------
  773|    484|        return insertFirst(key, value);
  774|  16.9k|    } else if (compareKeys(key, iter->first) == 0) {
  ------------------
  |  Branch (774:16): [True: 0, False: 16.9k]
  ------------------
  775|      0|        Array items = iter.node[itemsKey()];
  776|      0|        items.set(iter.item_number + 1, value);
  777|      0|        iter.updateIValue();
  778|  16.9k|    } else {
  779|  16.9k|        iter.insertAfter(key, value);
  780|  16.9k|    }
  781|  16.9k|    return iter;
  782|  17.4k|}
_ZN10NNTreeImpl8validateEb:
  800|  1.38k|{
  801|  1.38k|    bool first = true;
  802|  1.38k|    QPDFObjectHandle last_key;
  803|  1.38k|    try {
  804|  1.69k|        for (auto const& [key, value]: *this) {
  ------------------
  |  Branch (804:38): [True: 1.69k, False: 1.38k]
  ------------------
  805|  1.69k|            if (!keyValid(key)) {
  ------------------
  |  Branch (805:17): [True: 66, False: 1.62k]
  ------------------
  806|     66|                error(tree_root, "invalid key in validate");
  807|     66|            }
  808|  1.69k|            if (!value_valid(value)) {
  ------------------
  |  Branch (808:17): [True: 172, False: 1.52k]
  ------------------
  809|    172|                error(tree_root, "invalid value in validate");
  810|    172|            }
  811|  1.69k|            if (first) {
  ------------------
  |  Branch (811:17): [True: 598, False: 1.09k]
  ------------------
  812|    598|                first = false;
  813|  1.09k|            } else if (last_key && compareKeys(last_key, key) != -1) {
  ------------------
  |  Branch (813:24): [True: 858, False: 238]
  |  Branch (813:24): [True: 417, False: 679]
  |  Branch (813:36): [True: 417, False: 441]
  ------------------
  814|    417|                error(tree_root, "keys are not sorted in validate");
  815|    417|            }
  816|  1.69k|            last_key = key;
  817|  1.69k|        }
  818|  1.38k|    } catch (QPDFExc& e) {
  819|    673|        if (a_repair) {
  ------------------
  |  Branch (819:13): [True: 673, False: 0]
  ------------------
  820|    673|            warn(tree_root, std::string("attempting to repair after error: ") + e.what());
  821|    673|            repair();
  822|    673|        }
  823|    673|        return false;
  824|    673|    }
  825|    714|    return true;
  826|  1.38k|}
_ZN24QPDFNameTreeObjectHelperD2Ev:
  847|  1.38k|QPDFNameTreeObjectHelper::~QPDFNameTreeObjectHelper() = default;
_ZN24QPDFNameTreeObjectHelperC2E16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS0_EEEb:
  860|  1.38k|    QPDFObjectHelper(oh),
  861|  1.38k|    m(std::make_shared<Members>(oh, q, value_validator, auto_repair))
  862|  1.38k|{
  863|  1.38k|}
_ZN24QPDFNameTreeObjectHelper8iteratorC2ERKNSt3__110shared_ptrI14NNTreeIteratorEE:
  872|  5.87k|    impl(i)
  873|  5.87k|{
  874|  5.87k|}
_ZN24QPDFNameTreeObjectHelper8iterator12updateIValueEv:
  900|    526|{
  901|    526|    if (impl->valid()) {
  ------------------
  |  Branch (901:9): [True: 526, False: 0]
  ------------------
  902|    526|        auto p = *impl;
  903|    526|        ivalue.first = p->first.getUTF8Value();
  904|    526|        ivalue.second = p->second;
  905|    526|    } else {
  906|      0|        ivalue.first = "";
  907|      0|        ivalue.second = QPDFObjectHandle();
  908|      0|    }
  909|    526|}
_ZN24QPDFNameTreeObjectHelper8iteratorptEv:
  920|    526|{
  921|    526|    updateIValue();
  922|    526|    return &ivalue;
  923|    526|}
_ZNK24QPDFNameTreeObjectHelper8iteratoreqERKS0_:
  927|  2.93k|{
  928|  2.93k|    return *(impl) == *(other.impl);
  929|  2.93k|}
_ZNK24QPDFNameTreeObjectHelper3endEv:
  953|  2.93k|{
  954|  2.93k|    return {std::make_shared<NNTreeIterator>(m->impl.end())};
  955|  2.93k|}
_ZN24QPDFNameTreeObjectHelper4findERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEb:
  965|  2.98k|{
  966|  2.98k|    auto i = m->impl.find(QPDFObjectHandle::newUnicodeString(key), return_prev_if_not_found);
  967|  2.98k|    return {std::make_shared<NNTreeIterator>(i)};
  968|  2.98k|}
_ZN24QPDFNameTreeObjectHelper10findObjectERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEER16QPDFObjectHandle:
  992|  2.98k|{
  993|  2.98k|    auto i = find(name);
  994|  2.98k|    if (i == end()) {
  ------------------
  |  Branch (994:9): [True: 2.41k, False: 571]
  ------------------
  995|  2.41k|        return false;
  996|  2.41k|    }
  997|    571|    oh = i->second;
  998|    571|    return true;
  999|  2.98k|}
_ZN24QPDFNameTreeObjectHelper8validateEb:
 1017|  1.38k|{
 1018|  1.38k|    return m->impl.validate(repair);
 1019|  1.38k|}
NNTree.cc:_ZL15get_descriptionRK16QPDFObjectHandle:
   22|  5.68k|{
   23|  5.68k|    std::string result("Name/Number tree node");
   24|  5.68k|    if (node.indirect()) {
  ------------------
  |  Branch (24:9): [True: 5.66k, False: 24]
  ------------------
   25|  5.66k|        result += " (object " + std::to_string(node.getObjectID()) + ")";
   26|  5.66k|    }
   27|  5.68k|    return result;
   28|  5.68k|}
NNTree.cc:_ZZN14NNTreeIterator6deepenEN4qpdf10DictionaryEbbENK3$_0clERKS1_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  482|  1.38k|    auto fail = [this, &opath](Dictionary const& failed_node, std::string const& msg) {
  483|  1.38k|        impl.warn(failed_node, msg);
  484|  1.38k|        path = opath;
  485|  1.38k|        return false;
  486|  1.38k|    };
NNTree.cc:_ZNK12_GLOBAL__N_13CmpclERK16QPDFObjectHandleS3_:
  644|   226k|        {
  645|   226k|            Integer l = lhs;
  646|   226k|            Integer r = rhs;
  647|   226k|            if (l && r) {
  ------------------
  |  Branch (647:17): [True: 0, False: 226k]
  |  Branch (647:22): [True: 0, False: 0]
  ------------------
  648|      0|                return l.value() < r.value();
  649|      0|            }
  650|   226k|            return lhs.getUTF8Value() < rhs.getUTF8Value();
  651|   226k|        }
_ZN24QPDFNameTreeObjectHelper7MembersC2ER16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS1_EEEb:
  836|  1.38k|        impl(q, oh, ::ot_string, value_validator, auto_repair)
  837|  1.38k|    {
  838|  1.38k|    }
_ZN24QPDFNameTreeObjectHelper7MembersD2Ev:
  840|  1.38k|    ~Members() = default;

_ZN17OffsetInputSourceC2ENSt3__110shared_ptrI11InputSourceEEx:
   13|    622|    proxied(proxied),
   14|    622|    global_offset(global_offset)
   15|    622|{
   16|    622|    util::assertion(global_offset >= 0, "OffsetInputSource constructed with negative offset");
   17|    622|    max_safe_offset = std::numeric_limits<qpdf_offset_t>::max() - global_offset;
   18|    622|}
_ZN17OffsetInputSource18findAndSkipNextEOLEv:
   22|  90.1k|{
   23|  90.1k|    return proxied->findAndSkipNextEOL() - global_offset;
   24|  90.1k|}
_ZNK17OffsetInputSource7getNameEv:
   28|  57.5k|{
   29|  57.5k|    return proxied->getName();
   30|  57.5k|}
_ZN17OffsetInputSource4tellEv:
   34|  2.55M|{
   35|  2.55M|    return proxied->tell() - global_offset;
   36|  2.55M|}
_ZN17OffsetInputSource4seekExi:
   40|  1.18M|{
   41|  1.18M|    if (whence == SEEK_SET) {
  ------------------
  |  Branch (41:9): [True: 1.17M, False: 7.71k]
  ------------------
   42|  1.17M|        if (offset > max_safe_offset) {
  ------------------
  |  Branch (42:13): [True: 10, False: 1.17M]
  ------------------
   43|     10|            std::ostringstream msg;
   44|     10|            msg.imbue(std::locale::classic());
   45|     10|            msg << "seeking to " << offset << " offset by " << global_offset
   46|     10|                << " would cause an overflow of the offset type";
   47|     10|            throw std::range_error(msg.str());
   48|     10|        }
   49|  1.17M|        proxied->seek(offset + global_offset, whence);
   50|  1.17M|    } else {
   51|  7.71k|        proxied->seek(offset, whence);
   52|  7.71k|    }
   53|  1.18M|    util::no_ci_rt_error_if(tell() < 0, "offset input source: seek before beginning of file");
   54|  1.18M|}
_ZN17OffsetInputSource4readEPcm:
   64|   405k|{
   65|   405k|    size_t result = proxied->read(buffer, length);
   66|   405k|    setLastOffset(proxied->getLastOffset() - global_offset);
   67|   405k|    return result;
   68|   405k|}
_ZN17OffsetInputSource8unreadChEc:
   72|    693|{
   73|    693|    proxied->unreadCh(ch);
   74|    693|}

_ZN8PipelineC2EPKcPS_:
   11|   453k|    identifier(identifier),
   12|   453k|    next_(next)
   13|   453k|{
   14|   453k|}
_ZN8Pipeline9writeCStrEPKc:
   32|  2.02M|{
   33|  2.02M|    write(cstr, strlen(cstr));
   34|  2.02M|}
_ZN8Pipeline11writeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   38|  8.32M|{
   39|  8.32M|    write(str.c_str(), str.length());
   40|  8.32M|}
_ZN8PipelinelsEPKc:
   44|  2.02M|{
   45|  2.02M|    writeCStr(cstr);
   46|  2.02M|    return *this;
   47|  2.02M|}
_ZN8PipelinelsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   51|  10.0k|{
   52|  10.0k|    writeString(str);
   53|  10.0k|    return *this;
   54|  10.0k|}
_ZN8Pipeline5writeEPKcm:
  114|  10.3M|{
  115|  10.3M|    write(reinterpret_cast<unsigned char const*>(data), len);
  116|  10.3M|}

_ZN10Pl_AES_PDFC2EPKcP8PipelinebNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
   16|   138k|    Pipeline(identifier, next),
   17|   138k|    key(key),
   18|   138k|    crypto(QPDFCryptoProvider::getImpl()),
   19|   138k|    encrypt(encrypt)
   20|   138k|{
   21|   138k|    util::assertion(next, "Attempt to create Pl_AES_PDF with nullptr as next");
   22|   138k|    util::no_ci_rt_error_if(!(key.size() == 32 || key.size() == 16), "unsupported key length");
  ------------------
  |  Branch (22:31): [True: 4.22k, False: 134k]
  |  Branch (22:51): [True: 134k, False: 5]
  ------------------
   23|   138k|    std::memset(this->inbuf, 0, this->buf_size);
   24|   138k|    std::memset(this->outbuf, 0, this->buf_size);
   25|   138k|    std::memset(this->cbc_block, 0, this->buf_size);
   26|   138k|}
_ZN10Pl_AES_PDF9useZeroIVEv:
   30|    638|{
   31|    638|    use_zero_iv = true;
   32|    638|}
_ZN10Pl_AES_PDF14disablePaddingEv:
   36|   128k|{
   37|   128k|    disable_padding = true;
   38|   128k|}
_ZN10Pl_AES_PDF5setIVEPKhm:
   42|   127k|{
   43|   127k|    util::assertion(
   44|   127k|        bytes == buf_size,
   45|   127k|        "Pl_AES_PDF: specified initialization vector size in bytes must be " +
   46|   127k|            std::to_string(bytes));
   47|   127k|    use_specified_iv = true;
   48|   127k|    memcpy(specified_iv, iv, bytes);
   49|   127k|}
_ZN10Pl_AES_PDF5writeEPKhm:
   65|  8.18M|{
   66|  8.18M|    size_t bytes_left = len;
   67|  8.18M|    unsigned char const* p = data;
   68|       |
   69|  43.3M|    while (bytes_left > 0) {
  ------------------
  |  Branch (69:12): [True: 35.1M, False: 8.18M]
  ------------------
   70|  35.1M|        if (offset == buf_size) {
  ------------------
  |  Branch (70:13): [True: 35.0M, False: 138k]
  ------------------
   71|  35.0M|            flush(false);
   72|  35.0M|        }
   73|       |
   74|  35.1M|        size_t available = buf_size - offset;
   75|  35.1M|        size_t bytes = (bytes_left < available ? bytes_left : available);
  ------------------
  |  Branch (75:25): [True: 8.65k, False: 35.1M]
  ------------------
   76|  35.1M|        bytes_left -= bytes;
   77|  35.1M|        std::memcpy(inbuf + offset, p, bytes);
   78|  35.1M|        offset += bytes;
   79|  35.1M|        p += bytes;
   80|  35.1M|    }
   81|  8.18M|}
_ZN10Pl_AES_PDF6finishEv:
   85|   138k|{
   86|   138k|    if (encrypt) {
  ------------------
  |  Branch (86:9): [True: 127k, False: 11.2k]
  ------------------
   87|   127k|        if (offset == buf_size) {
  ------------------
  |  Branch (87:13): [True: 127k, False: 0]
  ------------------
   88|   127k|            flush(false);
   89|   127k|        }
   90|   127k|        if (!disable_padding) {
  ------------------
  |  Branch (90:13): [True: 0, False: 127k]
  ------------------
   91|       |            // Pad as described in section 3.5.1 of version 1.7 of the PDF specification, including
   92|       |            // providing an entire block of padding if the input was a multiple of 16 bytes.
   93|      0|            unsigned char pad = QIntC::to_uchar(buf_size - offset);
   94|      0|            memset(inbuf + offset, pad, pad);
   95|      0|            offset = buf_size;
   96|      0|            flush(false);
   97|      0|        }
   98|   127k|    } else {
   99|  11.2k|        if (offset != buf_size) {
  ------------------
  |  Branch (99:13): [True: 9.18k, False: 2.04k]
  ------------------
  100|       |            // This is never supposed to happen as the output is always supposed to be padded.
  101|       |            // However, we have encountered files for which the output is not a multiple of the
  102|       |            // block size.  In this case, pad with zeroes and hope for the best.
  103|  9.18k|            util::assertion(offset < buf_size, "buffer overflow in AES encryption pipeline");
  104|  9.18k|            std::memset(inbuf + offset, 0, buf_size - offset);
  105|  9.18k|            offset = buf_size;
  106|  9.18k|        }
  107|  11.2k|        flush(!disable_padding);
  108|  11.2k|    }
  109|   138k|    crypto->rijndael_finalize();
  110|   138k|    next()->finish();
  111|   138k|}
_ZN10Pl_AES_PDF16initializeVectorEv:
  115|   128k|{
  116|   128k|    if (use_zero_iv) {
  ------------------
  |  Branch (116:9): [True: 638, False: 127k]
  ------------------
  117|  10.8k|        for (unsigned int i = 0; i < buf_size; ++i) {
  ------------------
  |  Branch (117:34): [True: 10.2k, False: 638]
  ------------------
  118|  10.2k|            cbc_block[i] = 0;
  119|  10.2k|        }
  120|   127k|    } else if (use_specified_iv) {
  ------------------
  |  Branch (120:16): [True: 127k, False: 0]
  ------------------
  121|   127k|        std::memcpy(cbc_block, specified_iv, buf_size);
  122|   127k|    } else if (use_static_iv) {
  ------------------
  |  Branch (122:16): [True: 0, False: 0]
  ------------------
  123|      0|        for (unsigned int i = 0; i < buf_size; ++i) {
  ------------------
  |  Branch (123:34): [True: 0, False: 0]
  ------------------
  124|      0|            cbc_block[i] = static_cast<unsigned char>(14U * (1U + i));
  125|      0|        }
  126|      0|    } else {
  127|      0|        QUtil::initializeWithRandomBytes(cbc_block, buf_size);
  128|      0|    }
  129|   128k|}
_ZN10Pl_AES_PDF5flushEb:
  133|  35.1M|{
  134|  35.1M|    util::assertion(offset == buf_size, "AES pipeline: flush called when buffer was not full");
  135|       |
  136|  35.1M|    if (first) {
  ------------------
  |  Branch (136:9): [True: 138k, False: 35.0M]
  ------------------
  137|   138k|        first = false;
  138|   138k|        bool return_after_init = false;
  139|   138k|        if (cbc_mode) {
  ------------------
  |  Branch (139:13): [True: 138k, False: 0]
  ------------------
  140|   138k|            if (encrypt) {
  ------------------
  |  Branch (140:17): [True: 127k, False: 11.2k]
  ------------------
  141|       |                // Set cbc_block to the initialization vector, and if not zero, write it to the
  142|       |                // output stream.
  143|   127k|                initializeVector();
  144|   127k|                if (!(use_zero_iv || use_specified_iv)) {
  ------------------
  |  Branch (144:23): [True: 0, False: 127k]
  |  Branch (144:38): [True: 127k, False: 0]
  ------------------
  145|      0|                    next()->write(cbc_block, buf_size);
  146|      0|                }
  147|   127k|            } else if (use_zero_iv || use_specified_iv) {
  ------------------
  |  Branch (147:24): [True: 638, False: 10.5k]
  |  Branch (147:39): [True: 0, False: 10.5k]
  ------------------
  148|       |                // Initialize vector with zeroes; zero vector was not written to the beginning of
  149|       |                // the input file.
  150|    638|                initializeVector();
  151|  10.5k|            } else {
  152|       |                // Take the first block of input as the initialization vector.  There's nothing to
  153|       |                // write at this time.
  154|  10.5k|                memcpy(cbc_block, inbuf, buf_size);
  155|  10.5k|                offset = 0;
  156|  10.5k|                return_after_init = true;
  157|  10.5k|            }
  158|   138k|        }
  159|   138k|        crypto->rijndael_init(
  160|   138k|            encrypt,
  161|   138k|            reinterpret_cast<const unsigned char*>(key.data()),
  162|   138k|            key.size(),
  163|   138k|            cbc_mode,
  164|   138k|            cbc_block);
  165|   138k|        if (return_after_init) {
  ------------------
  |  Branch (165:13): [True: 10.5k, False: 128k]
  ------------------
  166|  10.5k|            return;
  167|  10.5k|        }
  168|   138k|    }
  169|       |
  170|  35.1M|    crypto->rijndael_process(inbuf, outbuf);
  171|  35.1M|    unsigned int bytes = buf_size;
  172|  35.1M|    if (strip_padding) {
  ------------------
  |  Branch (172:9): [True: 8.57k, False: 35.1M]
  ------------------
  173|  8.57k|        unsigned char last = outbuf[buf_size - 1];
  174|  8.57k|        if (last <= buf_size) {
  ------------------
  |  Branch (174:13): [True: 1.24k, False: 7.33k]
  ------------------
  175|  1.24k|            bool strip = true;
  176|  2.73k|            for (unsigned int i = 1; i <= last; ++i) {
  ------------------
  |  Branch (176:38): [True: 2.28k, False: 447]
  ------------------
  177|  2.28k|                if (outbuf[buf_size - i] != last) {
  ------------------
  |  Branch (177:21): [True: 796, False: 1.48k]
  ------------------
  178|    796|                    strip = false;
  179|    796|                    break;
  180|    796|                }
  181|  2.28k|            }
  182|  1.24k|            if (strip) {
  ------------------
  |  Branch (182:17): [True: 447, False: 796]
  ------------------
  183|    447|                bytes -= last;
  184|    447|            }
  185|  1.24k|        }
  186|  8.57k|    }
  187|  35.1M|    offset = 0;
  188|  35.1M|    next()->write(outbuf, bytes);
  189|  35.1M|}

_ZN17Pl_ASCII85DecoderC2EPKcP8Pipeline:
   12|    683|    Pipeline(identifier, next)
   13|    683|{
   14|    683|    util::assertion(next, "Attempt to create Pl_ASCII85Decoder with nullptr as next");
   15|    683|}
_ZN17Pl_ASCII85Decoder5writeEPKhm:
   19|    802|{
   20|    802|    if (eod > 1) {
  ------------------
  |  Branch (20:9): [True: 0, False: 802]
  ------------------
   21|      0|        return;
   22|      0|    }
   23|   339k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (23:24): [True: 338k, False: 571]
  ------------------
   24|   338k|        switch (buf[i]) {
  ------------------
  |  Branch (24:17): [True: 5.94k, False: 332k]
  ------------------
   25|    870|        case ' ':
  ------------------
  |  Branch (25:9): [True: 870, False: 337k]
  ------------------
   26|  1.49k|        case '\f':
  ------------------
  |  Branch (26:9): [True: 625, False: 337k]
  ------------------
   27|  1.79k|        case '\v':
  ------------------
  |  Branch (27:9): [True: 295, False: 338k]
  ------------------
   28|  2.07k|        case '\t':
  ------------------
  |  Branch (28:9): [True: 288, False: 338k]
  ------------------
   29|  4.79k|        case '\r':
  ------------------
  |  Branch (29:9): [True: 2.71k, False: 335k]
  ------------------
   30|  5.94k|        case '\n':
  ------------------
  |  Branch (30:9): [True: 1.15k, False: 337k]
  ------------------
   31|  5.94k|            QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
   32|       |            // ignore whitespace
   33|  5.94k|            continue;
   34|   338k|        }
   35|   332k|        if (eod > 1) {
  ------------------
  |  Branch (35:13): [True: 6, False: 332k]
  ------------------
   36|      6|            break;
   37|   332k|        } else if (eod == 1) {
  ------------------
  |  Branch (37:20): [True: 25, False: 332k]
  ------------------
   38|     25|            util::no_ci_rt_error_if(buf[i] != '>', "broken end-of-data sequence in base 85 data");
   39|     25|            flush();
   40|     25|            eod = 2;
   41|   332k|        } else {
   42|   332k|            switch (buf[i]) {
   43|     26|            case '~':
  ------------------
  |  Branch (43:13): [True: 26, False: 332k]
  ------------------
   44|     26|                eod = 1;
   45|     26|                break;
   46|       |
   47|    764|            case 'z':
  ------------------
  |  Branch (47:13): [True: 764, False: 331k]
  ------------------
   48|    764|                if (pos != 0) {
  ------------------
  |  Branch (48:21): [True: 23, False: 741]
  ------------------
   49|     23|                    throw std::runtime_error("unexpected z during base 85 decode");
   50|     23|                }
   51|    741|                unsigned char zeroes[4];
   52|    741|                memset(zeroes, '\0', 4);
   53|    741|                next()->write(zeroes, 4);
   54|    741|                break;
   55|       |
   56|   331k|            default:
  ------------------
  |  Branch (56:13): [True: 331k, False: 790]
  ------------------
   57|   331k|                if (buf[i] < 33 || buf[i] > 117) {
  ------------------
  |  Branch (57:21): [True: 47, False: 331k]
  |  Branch (57:36): [True: 110, False: 331k]
  ------------------
   58|    157|                    error = true;
   59|    157|                    throw std::runtime_error("character out of range during base 85 decode");
   60|   331k|                } else {
   61|   331k|                    this->inbuf[this->pos++] = buf[i];
   62|   331k|                    if (pos == 5) {
  ------------------
  |  Branch (62:25): [True: 66.1k, False: 265k]
  ------------------
   63|  66.1k|                        flush();
   64|  66.1k|                    }
   65|   331k|                }
   66|   331k|                break;
   67|   332k|            }
   68|   332k|        }
   69|   332k|    }
   70|    802|}
_ZN17Pl_ASCII85Decoder5flushEv:
   74|  66.6k|{
   75|  66.6k|    if (this->pos == 0) {
  ------------------
  |  Branch (75:9): [True: 206, False: 66.4k]
  ------------------
   76|    206|        return;
   77|    206|    }
   78|  66.4k|    unsigned long lval = 0;
   79|   398k|    for (int i = 0; i < 5; ++i) {
  ------------------
  |  Branch (79:21): [True: 332k, False: 66.4k]
  ------------------
   80|   332k|        lval *= 85;
   81|   332k|        lval += (this->inbuf[i] - 33U);
   82|   332k|    }
   83|       |
   84|  66.4k|    unsigned char outbuf[4];
   85|  66.4k|    memset(outbuf, 0, 4);
   86|   332k|    for (int i = 3; i >= 0; --i) {
  ------------------
  |  Branch (86:21): [True: 265k, False: 66.4k]
  ------------------
   87|   265k|        outbuf[i] = lval & 0xff;
   88|   265k|        lval >>= 8;
   89|   265k|    }
   90|       |
   91|  66.4k|    QTC::TC("libtests", "Pl_ASCII85Decoder partial flush", (this->pos == 5) ? 0 : 1);
  ------------------
  |  Branch (91:60): [True: 66.1k, False: 272]
  ------------------
   92|       |    // Reset before calling getNext()->write in case that throws an exception.
   93|  66.4k|    auto t = this->pos - 1;
   94|  66.4k|    this->pos = 0;
   95|  66.4k|    memset(this->inbuf, 117, 5);
   96|       |
   97|  66.4k|    next()->write(outbuf, t);
   98|  66.4k|}
_ZN17Pl_ASCII85Decoder6finishEv:
  102|    606|{
  103|    606|    if (error) {
  ------------------
  |  Branch (103:9): [True: 135, False: 471]
  ------------------
  104|    135|        return;
  105|    135|    }
  106|    471|    flush();
  107|    471|    next()->finish();
  108|    471|}

_ZN18Pl_ASCIIHexDecoderC2EPKcP8Pipeline:
   13|    453|    Pipeline(identifier, next)
   14|    453|{
   15|    453|    util::assertion(next, "Attempt to create Pl_ASCIIHexDecoder with nullptr as next");
   16|    453|}
_ZN18Pl_ASCIIHexDecoder5writeEPKhm:
   20|    749|{
   21|    749|    if (eod) {
  ------------------
  |  Branch (21:9): [True: 209, False: 540]
  ------------------
   22|    209|        return;
   23|    209|    }
   24|  5.03k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (24:24): [True: 4.66k, False: 373]
  ------------------
   25|  4.66k|        char ch = static_cast<char>(toupper(buf[i]));
   26|  4.66k|        switch (ch) {
   27|    303|        case ' ':
  ------------------
  |  Branch (27:9): [True: 303, False: 4.35k]
  ------------------
   28|    811|        case '\f':
  ------------------
  |  Branch (28:9): [True: 508, False: 4.15k]
  ------------------
   29|  1.10k|        case '\v':
  ------------------
  |  Branch (29:9): [True: 291, False: 4.37k]
  ------------------
   30|  1.37k|        case '\t':
  ------------------
  |  Branch (30:9): [True: 277, False: 4.38k]
  ------------------
   31|  1.67k|        case '\r':
  ------------------
  |  Branch (31:9): [True: 297, False: 4.36k]
  ------------------
   32|  1.99k|        case '\n':
  ------------------
  |  Branch (32:9): [True: 318, False: 4.34k]
  ------------------
   33|  1.99k|            QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space");
   34|       |            // ignore whitespace
   35|  1.99k|            break;
   36|       |
   37|     44|        case '>':
  ------------------
  |  Branch (37:9): [True: 44, False: 4.61k]
  ------------------
   38|     44|            eod = true;
   39|     44|            flush();
   40|     44|            break;
   41|       |
   42|  2.62k|        default:
  ------------------
  |  Branch (42:9): [True: 2.62k, False: 2.03k]
  ------------------
   43|  2.62k|            if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F')) {
  ------------------
  |  Branch (43:18): [True: 2.55k, False: 73]
  |  Branch (43:31): [True: 1.87k, False: 675]
  |  Branch (43:46): [True: 667, False: 81]
  |  Branch (43:59): [True: 628, False: 39]
  ------------------
   44|  2.50k|                inbuf[pos++] = ch;
   45|  2.50k|                if (pos == 2) {
  ------------------
  |  Branch (45:21): [True: 1.19k, False: 1.30k]
  ------------------
   46|  1.19k|                    flush();
   47|  1.19k|                }
   48|  2.50k|            } else {
   49|    120|                char t[2];
   50|    120|                t[0] = ch;
   51|    120|                t[1] = 0;
   52|    120|                throw std::runtime_error("character out of range during base Hex decode: "s + t);
   53|    120|            }
   54|  2.50k|            break;
   55|  4.66k|        }
   56|  4.53k|        if (eod) {
  ------------------
  |  Branch (56:13): [True: 44, False: 4.49k]
  ------------------
   57|     44|            break;
   58|     44|        }
   59|  4.53k|    }
   60|    540|}
_ZN18Pl_ASCIIHexDecoder5flushEv:
   64|  1.58k|{
   65|  1.58k|    if (pos == 0) {
  ------------------
  |  Branch (65:9): [True: 281, False: 1.30k]
  ------------------
   66|    281|        QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush");
   67|    281|        return;
   68|    281|    }
   69|  1.30k|    int b[2];
   70|  3.91k|    for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (70:21): [True: 2.60k, False: 1.30k]
  ------------------
   71|  2.60k|        if (inbuf[i] >= 'A') {
  ------------------
  |  Branch (71:13): [True: 627, False: 1.98k]
  ------------------
   72|    627|            b[i] = inbuf[i] - 'A' + 10;
   73|  1.98k|        } else {
   74|  1.98k|            b[i] = inbuf[i] - '0';
   75|  1.98k|        }
   76|  2.60k|    }
   77|  1.30k|    auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
   78|       |
   79|  1.30k|    QTC::TC("libtests", "Pl_ASCIIHexDecoder partial flush", (pos == 2) ? 0 : 1);
  ------------------
  |  Branch (79:61): [True: 1.19k, False: 110]
  ------------------
   80|       |    // Reset before calling getNext()->write in case that throws an exception.
   81|  1.30k|    pos = 0;
   82|  1.30k|    inbuf[0] = '0';
   83|  1.30k|    inbuf[1] = '0';
   84|  1.30k|    inbuf[2] = '\0';
   85|       |
   86|  1.30k|    next()->write(&ch, 1);
   87|  1.30k|}
_ZN18Pl_ASCIIHexDecoder6finishEv:
   91|    347|{
   92|    347|    flush();
   93|    347|    next()->finish();
   94|    347|}

_ZN9Pl_BufferC2EPKcP8Pipeline:
   23|   138k|    Pipeline(identifier, next),
   24|   138k|    m(std::make_unique<Members>())
   25|   138k|{
   26|   138k|}
_ZN9Pl_BufferD2Ev:
   29|   138k|Pl_Buffer::~Pl_Buffer() = default;
_ZN9Pl_Buffer5writeEPKhm:
   33|  35.0M|{
   34|  35.0M|    if (!len) {
  ------------------
  |  Branch (34:9): [True: 0, False: 35.0M]
  ------------------
   35|      0|        return;
   36|      0|    }
   37|  35.0M|    m->data.append(reinterpret_cast<char const*>(buf), len);
   38|  35.0M|    m->ready = false;
   39|       |
   40|  35.0M|    if (next()) {
  ------------------
  |  Branch (40:9): [True: 0, False: 35.0M]
  ------------------
   41|      0|        next()->write(buf, len);
   42|      0|    }
   43|  35.0M|}
_ZN9Pl_Buffer6finishEv:
   47|   138k|{
   48|   138k|    m->ready = true;
   49|   138k|    if (next()) {
  ------------------
  |  Branch (49:9): [True: 0, False: 138k]
  ------------------
   50|      0|        next()->finish();
   51|      0|    }
   52|   138k|}
_ZN9Pl_Buffer9getStringEv:
   65|   138k|{
   66|   138k|    util::assertion(m->ready, "Pl_Buffer::getString() called when not ready");
   67|   138k|    auto s = std::move(m->data);
   68|   138k|    m->data.clear();
   69|   138k|    return s;
   70|   138k|}
_ZN9Pl_Buffer7MembersC2Ev:
   15|   138k|    Members() = default;

_ZN10Pl_DiscardC2Ev:
    9|  20.8k|    Pipeline("discard", nullptr)
   10|  20.8k|{
   11|  20.8k|}
_ZN10Pl_DiscardD2Ev:
   14|  20.8k|Pl_Discard::~Pl_Discard() = default;

_ZN8Pl_Flate7MembersC2EmNS_8action_eE:
   27|  5.47k|    out_bufsize(out_bufsize),
   28|  5.47k|    action(action),
   29|  5.47k|    initialized(false),
   30|  5.47k|    zdata(nullptr)
   31|  5.47k|{
   32|  5.47k|    this->outbuf = QUtil::make_shared_array<unsigned char>(out_bufsize);
   33|       |    // Indirect through zdata to reach the z_stream so we don't have to include zlib.h in
   34|       |    // Pl_Flate.hh.  This means people using shared library versions of qpdf don't have to have zlib
   35|       |    // development files available, which particularly helps in a Windows environment.
   36|  5.47k|    zdata = new z_stream;
   37|       |
   38|  5.47k|    util::no_ci_rt_error_if(
   39|  5.47k|        out_bufsize > UINT_MAX,
   40|  5.47k|        "Pl_Flate: zlib doesn't support buffer sizes larger than unsigned int");
   41|       |
   42|  5.47k|    z_stream& zstream = *(static_cast<z_stream*>(this->zdata));
   43|  5.47k|    zstream.zalloc = nullptr;
   44|  5.47k|    zstream.zfree = nullptr;
   45|  5.47k|    zstream.opaque = nullptr;
   46|  5.47k|    zstream.next_in = nullptr;
   47|  5.47k|    zstream.avail_in = 0;
   48|  5.47k|    zstream.next_out = this->outbuf.get();
   49|  5.47k|    zstream.avail_out = QIntC::to_uint(out_bufsize);
   50|       |
   51|  5.47k|    if (action == a_deflate && Pl_Flate::zopfli_enabled()) {
  ------------------
  |  Branch (51:9): [True: 0, False: 5.47k]
  |  Branch (51:32): [True: 0, False: 0]
  ------------------
   52|      0|        zopfli_buf = std::make_unique<std::string>();
   53|      0|    }
   54|  5.47k|}
_ZN8Pl_Flate7MembersD2Ev:
   57|  5.47k|{
   58|  5.47k|    if (initialized) {
  ------------------
  |  Branch (58:9): [True: 1.48k, False: 3.99k]
  ------------------
   59|  1.48k|        z_stream& zstream = *(static_cast<z_stream*>(zdata));
   60|  1.48k|        if (action == a_deflate) {
  ------------------
  |  Branch (60:13): [True: 0, False: 1.48k]
  ------------------
   61|      0|            deflateEnd(&zstream);
   62|  1.48k|        } else {
   63|  1.48k|            inflateEnd(&zstream);
   64|  1.48k|        }
   65|  1.48k|    }
   66|       |
   67|  5.47k|    delete static_cast<z_stream*>(this->zdata);
   68|  5.47k|    zdata = nullptr;
   69|  5.47k|}
_ZN8Pl_FlateC2EPKcP8PipelineNS_8action_eEj:
   73|  5.47k|    Pipeline(identifier, next),
   74|  5.47k|    m(std::make_unique<Members>(QIntC::to_size(out_bufsize_int), action))
   75|  5.47k|{
   76|  5.47k|    util::assertion(next, "Attempt to create Pl_Flate with nullptr as next");
   77|  5.47k|}
_ZN8Pl_FlateD2Ev:
   80|  5.47k|Pl_Flate::~Pl_Flate() = default;
_ZN8Pl_Flate12memory_limitEv:
   84|  5.08k|{
   85|  5.08k|    return ::memory_limit;
   86|  5.08k|}
_ZN8Pl_Flate15setWarnCallbackENSt3__18functionIFvPKciEEE:
   96|  6.33k|{
   97|  6.33k|    m->callback = callback;
   98|  6.33k|}
_ZN8Pl_Flate4warnEPKci:
  102|  2.57k|{
  103|  2.57k|    if (m->callback) {
  ------------------
  |  Branch (103:9): [True: 2.57k, False: 0]
  ------------------
  104|  2.57k|        m->callback(msg, code);
  105|  2.57k|    }
  106|  2.57k|}
_ZN8Pl_Flate5writeEPKhm:
  110|   109k|{
  111|   109k|    util::assertion(
  112|   109k|        m->outbuf.get(), identifier + ": Pl_Flate: write() called after finish() called");
  113|   109k|    if (m->zopfli_buf) {
  ------------------
  |  Branch (113:9): [True: 0, False: 109k]
  ------------------
  114|      0|        m->zopfli_buf->append(reinterpret_cast<char const*>(data), len);
  115|      0|        return;
  116|      0|    }
  117|       |
  118|       |    // Write in chunks in case len is too big to fit in an int. Assume int is at least 32 bits.
  119|   109k|    static size_t const max_bytes = 1 << 30;
  120|   109k|    size_t bytes_left = len;
  121|   109k|    unsigned char const* buf = data;
  122|   218k|    while (bytes_left > 0) {
  ------------------
  |  Branch (122:12): [True: 109k, False: 109k]
  ------------------
  123|   109k|        size_t bytes = (bytes_left >= max_bytes ? max_bytes : bytes_left);
  ------------------
  |  Branch (123:25): [True: 0, False: 109k]
  ------------------
  124|   109k|        handleData(buf, bytes, (m->action == a_inflate ? Z_SYNC_FLUSH : Z_NO_FLUSH));
  ------------------
  |  Branch (124:33): [True: 109k, False: 0]
  ------------------
  125|   109k|        bytes_left -= bytes;
  126|   109k|        buf += bytes;
  127|   109k|    }
  128|   109k|}
_ZN8Pl_Flate10handleDataEPKhmi:
  132|   113k|{
  133|   113k|    util::no_ci_rt_error_if(
  134|   113k|        len > UINT_MAX, "Pl_Flate: zlib doesn't support data blocks larger than int");
  135|   113k|    z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  136|       |    // zlib is known not to modify the data pointed to by next_in but doesn't declare the field
  137|       |    // value const unless compiled to do so.
  138|   113k|    zstream.next_in = const_cast<unsigned char*>(data);
  139|   113k|    zstream.avail_in = QIntC::to_uint(len);
  140|       |
  141|   113k|    if (!m->initialized) {
  ------------------
  |  Branch (141:9): [True: 5.00k, False: 108k]
  ------------------
  142|  5.00k|        int err = Z_OK;
  143|       |
  144|       |        // deflateInit and inflateInit are macros that use old-style casts.
  145|  5.00k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  146|  5.00k|# pragma GCC diagnostic push
  147|  5.00k|# pragma GCC diagnostic ignored "-Wold-style-cast"
  148|  5.00k|#endif
  149|  5.00k|        if (m->action == a_deflate) {
  ------------------
  |  Branch (149:13): [True: 0, False: 5.00k]
  ------------------
  150|      0|            err = deflateInit(&zstream, compression_level);
  151|  5.00k|        } else {
  152|  5.00k|            err = inflateInit(&zstream);
  153|  5.00k|        }
  154|  5.00k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  155|  5.00k|# pragma GCC diagnostic pop
  156|  5.00k|#endif
  157|       |
  158|  5.00k|        checkError("Init", err);
  159|  5.00k|        m->initialized = true;
  160|  5.00k|    }
  161|       |
  162|   113k|    int err = Z_OK;
  163|       |
  164|   113k|    bool done = false;
  165|   225k|    while (!done) {
  ------------------
  |  Branch (165:12): [True: 114k, False: 111k]
  ------------------
  166|   114k|        if (m->action == a_deflate) {
  ------------------
  |  Branch (166:13): [True: 0, False: 114k]
  ------------------
  167|      0|            err = deflate(&zstream, flush);
  168|   114k|        } else {
  169|   114k|            err = inflate(&zstream, flush);
  170|   114k|        }
  171|   114k|        if ((m->action == a_inflate) && (err != Z_OK) && zstream.msg &&
  ------------------
  |  Branch (171:13): [True: 114k, False: 0]
  |  Branch (171:41): [True: 7.30k, False: 107k]
  |  Branch (171:58): [True: 3.60k, False: 3.69k]
  ------------------
  172|  3.60k|            (strcmp(zstream.msg, "incorrect data check") == 0)) {
  ------------------
  |  Branch (172:13): [True: 1.31k, False: 2.29k]
  ------------------
  173|       |            // Other PDF readers ignore this specific error. Combining this with Z_SYNC_FLUSH
  174|       |            // enables qpdf to handle some broken zlib streams without losing data.
  175|  1.31k|            err = Z_STREAM_END;
  176|  1.31k|        }
  177|   114k|        switch (err) {
  178|  2.57k|        case Z_BUF_ERROR:
  ------------------
  |  Branch (178:9): [True: 2.57k, False: 111k]
  ------------------
  179|       |            // Probably shouldn't be able to happen, but possible as a boundary condition: if the
  180|       |            // last call to inflate exactly filled the output buffer, it's possible that the next
  181|       |            // call to inflate could have nothing to do. There are PDF files in the wild that have
  182|       |            // this error (including at least one in qpdf's test suite). In some cases, we want to
  183|       |            // know about this, because it indicates incorrect compression, so call a callback if
  184|       |            // provided.
  185|  2.57k|            warn("input stream is complete but output may still be valid", err);
  186|  2.57k|            done = true;
  187|  2.57k|            break;
  188|       |
  189|  2.32k|        case Z_STREAM_END:
  ------------------
  |  Branch (189:9): [True: 2.32k, False: 112k]
  ------------------
  190|  2.32k|            done = true;
  191|       |            // fall through
  192|       |
  193|   109k|        case Z_OK:
  ------------------
  |  Branch (193:9): [True: 107k, False: 7.30k]
  ------------------
  194|   109k|            {
  195|   109k|                if ((zstream.avail_in == 0) && (zstream.avail_out > 0)) {
  ------------------
  |  Branch (195:21): [True: 107k, False: 1.47k]
  |  Branch (195:48): [True: 107k, False: 46]
  ------------------
  196|       |                    // There is nothing left to read, and there was sufficient buffer space to write
  197|       |                    // everything we needed, so we're done for now.
  198|   107k|                    done = true;
  199|   107k|                }
  200|   109k|                uLong ready = QIntC::to_ulong(m->out_bufsize - zstream.avail_out);
  201|   109k|                if (ready > 0) {
  ------------------
  |  Branch (201:21): [True: 107k, False: 2.04k]
  ------------------
  202|   107k|                    if (::memory_limit && m->action != a_deflate) {
  ------------------
  |  Branch (202:25): [True: 107k, False: 0]
  |  Branch (202:43): [True: 107k, False: 0]
  ------------------
  203|   107k|                        m->written += ready;
  204|   107k|                        if (m->written > ::memory_limit) {
  ------------------
  |  Branch (204:29): [True: 58, False: 107k]
  ------------------
  205|     58|                            throw std::runtime_error("PL_Flate memory limit exceeded");
  206|     58|                        }
  207|   107k|                    }
  208|   107k|                    next()->write(m->outbuf.get(), ready);
  209|   107k|                    zstream.next_out = m->outbuf.get();
  210|   107k|                    zstream.avail_out = QIntC::to_uint(m->out_bufsize);
  211|   107k|                }
  212|   109k|            }
  213|   109k|            break;
  214|       |
  215|   109k|        default:
  ------------------
  |  Branch (215:9): [True: 2.40k, False: 111k]
  ------------------
  216|  2.40k|            checkError("data", err);
  217|   114k|        }
  218|   114k|    }
  219|   113k|}
_ZN8Pl_Flate6finishEv:
  223|  5.06k|{
  224|  5.06k|    if (m->written > ::memory_limit) {
  ------------------
  |  Branch (224:9): [True: 46, False: 5.01k]
  ------------------
  225|     46|        throw std::runtime_error("PL_Flate memory limit exceeded");
  226|     46|    }
  227|  5.01k|    try {
  228|  5.01k|        if (m->zopfli_buf) {
  ------------------
  |  Branch (228:13): [True: 0, False: 5.01k]
  ------------------
  229|      0|            finish_zopfli();
  230|  5.01k|        } else if (m->outbuf.get()) {
  ------------------
  |  Branch (230:20): [True: 5.01k, False: 0]
  ------------------
  231|  5.01k|            if (m->initialized) {
  ------------------
  |  Branch (231:17): [True: 4.62k, False: 399]
  ------------------
  232|  4.62k|                z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  233|  4.62k|                unsigned char buf[1];
  234|  4.62k|                buf[0] = '\0';
  235|  4.62k|                handleData(buf, 0, Z_FINISH);
  236|  4.62k|                int err = Z_OK;
  237|  4.62k|                if (m->action == a_deflate) {
  ------------------
  |  Branch (237:21): [True: 0, False: 4.62k]
  ------------------
  238|      0|                    err = deflateEnd(&zstream);
  239|  4.62k|                } else {
  240|  4.62k|                    err = inflateEnd(&zstream);
  241|  4.62k|                }
  242|  4.62k|                m->initialized = false;
  243|  4.62k|                checkError("End", err);
  244|  4.62k|            }
  245|       |
  246|  5.01k|            m->outbuf = nullptr;
  247|  5.01k|        }
  248|  5.01k|    } catch (std::exception& e) {
  249|  1.09k|        try {
  250|  1.09k|            next()->finish();
  251|  1.09k|        } catch (...) {
  252|       |            // ignore secondary exception
  253|     14|        }
  254|  1.09k|        throw std::runtime_error(e.what());
  255|  1.09k|    }
  256|  3.92k|    next()->finish();
  257|  3.92k|}
_ZN8Pl_Flate10checkErrorEPKci:
  267|  10.9k|{
  268|  10.9k|    z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  269|  10.9k|    if (error_code != Z_OK) {
  ------------------
  |  Branch (269:9): [True: 2.40k, False: 8.52k]
  ------------------
  270|  2.40k|        char const* action_str = (m->action == a_deflate ? "deflate" : "inflate");
  ------------------
  |  Branch (270:35): [True: 0, False: 2.40k]
  ------------------
  271|  2.40k|        std::string msg = identifier + ": " + action_str + ": " + prefix + ": ";
  272|       |
  273|  2.40k|        if (zstream.msg) {
  ------------------
  |  Branch (273:13): [True: 2.29k, False: 114]
  ------------------
  274|  2.29k|            msg += zstream.msg;
  275|  2.29k|        } else {
  276|    114|            switch (error_code) {
  277|      0|            case Z_ERRNO:
  ------------------
  |  Branch (277:13): [True: 0, False: 114]
  ------------------
  278|      0|                msg += "zlib system error";
  279|      0|                break;
  280|       |
  281|      0|            case Z_STREAM_ERROR:
  ------------------
  |  Branch (281:13): [True: 0, False: 114]
  ------------------
  282|      0|                msg += "zlib stream error";
  283|      0|                break;
  284|       |
  285|      0|            case Z_DATA_ERROR:
  ------------------
  |  Branch (285:13): [True: 0, False: 114]
  ------------------
  286|      0|                msg += "zlib data error";
  287|      0|                break;
  288|       |
  289|      0|            case Z_MEM_ERROR:
  ------------------
  |  Branch (289:13): [True: 0, False: 114]
  ------------------
  290|      0|                msg += "zlib memory error";
  291|      0|                break;
  292|       |
  293|      0|            case Z_BUF_ERROR:
  ------------------
  |  Branch (293:13): [True: 0, False: 114]
  ------------------
  294|      0|                msg += "zlib buffer error";
  295|      0|                break;
  296|       |
  297|      0|            case Z_VERSION_ERROR:
  ------------------
  |  Branch (297:13): [True: 0, False: 114]
  ------------------
  298|      0|                msg += "zlib version error";
  299|      0|                break;
  300|       |
  301|    114|            default:
  ------------------
  |  Branch (301:13): [True: 114, False: 0]
  ------------------
  302|    114|                msg += std::string("zlib unknown error (") + std::to_string(error_code) + ")";
  303|    114|                break;
  304|    114|            }
  305|    114|        }
  306|       |
  307|  2.40k|        throw std::runtime_error(msg);
  308|  2.40k|    }
  309|  10.9k|}

_ZN13Pl_LZWDecoderC2EPKcP8Pipelineb:
   12|  3.47k|    Pipeline(identifier, next),
   13|  3.47k|    code_change_delta(early_code_change)
   14|  3.47k|{
   15|  3.47k|    util::assertion(next, "Attempt to create Pl_LZWDecoder with nullptr as next");
   16|  3.47k|}
_ZN13Pl_LZWDecoder5writeEPKhm:
   20|  6.15k|{
   21|  4.16M|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (21:24): [True: 4.16M, False: 6.15k]
  ------------------
   22|  4.16M|        buf[next_char_++] = bytes[i];
   23|  4.16M|        if (next_char_ == 3) {
  ------------------
  |  Branch (23:13): [True: 1.38M, False: 2.77M]
  ------------------
   24|  1.38M|            next_char_ = 0;
   25|  1.38M|        }
   26|  4.16M|        bits_available += 8;
   27|  4.16M|        if (bits_available >= code_size) {
  ------------------
  |  Branch (27:13): [True: 3.40M, False: 752k]
  ------------------
   28|  3.40M|            sendNextCode();
   29|  3.40M|        }
   30|  4.16M|    }
   31|  6.15k|}
_ZN13Pl_LZWDecoder6finishEv:
   35|  3.39k|{
   36|  3.39k|    next()->finish();
   37|  3.39k|}
_ZN13Pl_LZWDecoder12sendNextCodeEv:
   41|  3.40M|{
   42|  3.40M|    unsigned int high = byte_pos;
   43|  3.40M|    unsigned int med = (byte_pos + 1) % 3;
   44|  3.40M|    unsigned int low = (byte_pos + 2) % 3;
   45|       |
   46|  3.40M|    unsigned int bits_from_high = 8 - bit_pos;
   47|  3.40M|    unsigned int bits_from_med = code_size - bits_from_high;
   48|  3.40M|    unsigned int bits_from_low = 0;
   49|  3.40M|    if (bits_from_med > 8) {
  ------------------
  |  Branch (49:9): [True: 329k, False: 3.07M]
  ------------------
   50|   329k|        bits_from_low = bits_from_med - 8;
   51|   329k|        bits_from_med = 8;
   52|   329k|    }
   53|  3.40M|    unsigned int high_mask = (1U << bits_from_high) - 1U;
   54|  3.40M|    unsigned int med_mask = 0xff - ((1U << (8 - bits_from_med)) - 1U);
   55|  3.40M|    unsigned int low_mask = 0xff - ((1U << (8 - bits_from_low)) - 1U);
   56|  3.40M|    unsigned int code = 0;
   57|  3.40M|    code += (buf[high] & high_mask) << bits_from_med;
   58|  3.40M|    code += ((buf[med] & med_mask) >> (8 - bits_from_med));
   59|  3.40M|    if (bits_from_low) {
  ------------------
  |  Branch (59:9): [True: 329k, False: 3.07M]
  ------------------
   60|   329k|        code <<= bits_from_low;
   61|   329k|        code += ((buf[low] & low_mask) >> (8 - bits_from_low));
   62|   329k|        byte_pos = low;
   63|   329k|        bit_pos = bits_from_low;
   64|  3.07M|    } else {
   65|  3.07M|        byte_pos = med;
   66|  3.07M|        bit_pos = bits_from_med;
   67|  3.07M|    }
   68|  3.40M|    if (bit_pos == 8) {
  ------------------
  |  Branch (68:9): [True: 422k, False: 2.98M]
  ------------------
   69|   422k|        bit_pos = 0;
   70|   422k|        ++byte_pos;
   71|   422k|        byte_pos %= 3;
   72|   422k|    }
   73|  3.40M|    bits_available -= code_size;
   74|       |
   75|  3.40M|    handleCode(code);
   76|  3.40M|}
_ZN13Pl_LZWDecoder12getFirstCharEj:
   80|  11.3k|{
   81|  11.3k|    if (code < 256) {
  ------------------
  |  Branch (81:9): [True: 589, False: 10.7k]
  ------------------
   82|    589|        return static_cast<unsigned char>(code);
   83|    589|    }
   84|  10.7k|    util::no_ci_rt_error_if(
   85|  10.7k|        code <= 257,
   86|  10.7k|        "Pl_LZWDecoder::getFirstChar called with invalid code (" + std::to_string(code) + ")");
   87|       |
   88|  10.7k|    unsigned int idx = code - 258;
   89|  10.7k|    util::no_ci_rt_error_if(idx >= table.size(), "Pl_LZWDecoder::getFirstChar: table overflow");
   90|  10.7k|    Buffer& b = table.at(idx);
   91|  10.7k|    return b.getBuffer()[0];
   92|  11.3k|}
_ZN13Pl_LZWDecoder10addToTableEh:
   96|  2.94M|{
   97|  2.94M|    unsigned int last_size = 0;
   98|  2.94M|    unsigned char const* last_data = nullptr;
   99|  2.94M|    unsigned char tmp[1];
  100|       |
  101|  2.94M|    if (last_code < 256) {
  ------------------
  |  Branch (101:9): [True: 2.93M, False: 11.2k]
  ------------------
  102|  2.93M|        tmp[0] = static_cast<unsigned char>(last_code);
  103|  2.93M|        last_data = tmp;
  104|  2.93M|        last_size = 1;
  105|  2.93M|    } else {
  106|  11.2k|        util::no_ci_rt_error_if(
  107|  11.2k|            last_code <= 257,
  108|  11.2k|            "Pl_LZWDecoder::addToTable called with invalid code (" + std::to_string(last_code) +
  109|  11.2k|                ")");
  110|  11.2k|        unsigned int idx = last_code - 258;
  111|  11.2k|        util::no_ci_rt_error_if(idx >= table.size(), "Pl_LZWDecoder::addToTable: table overflow");
  112|  11.2k|        Buffer& b = table.at(idx);
  113|  11.2k|        last_data = b.getBuffer();
  114|  11.2k|        last_size = QIntC::to_uint(b.getSize());
  115|  11.2k|    }
  116|       |
  117|  2.94M|    Buffer entry(1 + last_size);
  118|  2.94M|    unsigned char* new_data = entry.getBuffer();
  119|  2.94M|    memcpy(new_data, last_data, last_size);
  120|  2.94M|    new_data[last_size] = c;
  121|  2.94M|    table.push_back(std::move(entry));
  122|  2.94M|}
_ZN13Pl_LZWDecoder10handleCodeEj:
  126|  3.40M|{
  127|  3.40M|    if (eod) {
  ------------------
  |  Branch (127:9): [True: 442k, False: 2.96M]
  ------------------
  128|   442k|        return;
  129|   442k|    }
  130|       |
  131|  2.96M|    if (code == 256) {
  ------------------
  |  Branch (131:9): [True: 7.84k, False: 2.95M]
  ------------------
  132|  7.84k|        if (!table.empty()) {
  ------------------
  |  Branch (132:13): [True: 6.81k, False: 1.03k]
  ------------------
  133|  6.81k|            QTC::TC("libtests", "Pl_LZWDecoder intermediate reset");
  134|  6.81k|        }
  135|  7.84k|        table.clear();
  136|  7.84k|        code_size = 9;
  137|  2.95M|    } else if (code == 257) {
  ------------------
  |  Branch (137:16): [True: 49, False: 2.95M]
  ------------------
  138|     49|        eod = true;
  139|  2.95M|    } else {
  140|  2.95M|        if (last_code != 256) {
  ------------------
  |  Branch (140:13): [True: 2.94M, False: 8.78k]
  ------------------
  141|       |            // Add to the table from last time.  New table entry would be what we read last plus the
  142|       |            // first character of what we're reading now.
  143|  2.94M|            unsigned char next_c = '\0';
  144|  2.94M|            unsigned int table_size = QIntC::to_uint(table.size());
  145|  2.94M|            if (code < 256) {
  ------------------
  |  Branch (145:17): [True: 2.93M, False: 11.5k]
  ------------------
  146|       |                // just read < 256; last time's next_c was code
  147|  2.93M|                next_c = static_cast<unsigned char>(code);
  148|  2.93M|            } else if (code > 257) {
  ------------------
  |  Branch (148:24): [True: 11.5k, False: 0]
  ------------------
  149|  11.5k|                size_t idx = code - 258;
  150|  11.5k|                if (idx > table_size) {
  ------------------
  |  Branch (150:21): [True: 163, False: 11.3k]
  ------------------
  151|    163|                    throw std::runtime_error("LZWDecoder: bad code received");
  152|  11.3k|                } else if (idx == table_size) {
  ------------------
  |  Branch (152:28): [True: 589, False: 10.7k]
  ------------------
  153|       |                    // The encoder would have just created this entry, so the first character of
  154|       |                    // this entry would have been the same as the first character of the last entry.
  155|    589|                    next_c = getFirstChar(last_code);
  156|  10.7k|                } else {
  157|  10.7k|                    next_c = getFirstChar(code);
  158|  10.7k|                }
  159|  11.5k|            }
  160|  2.94M|            unsigned int new_idx = 258 + table_size;
  161|  2.94M|            util::no_ci_rt_error_if(new_idx == 4096, "LZWDecoder: table full");
  162|  2.94M|            addToTable(next_c);
  163|  2.94M|            unsigned int change_idx = new_idx + code_change_delta;
  164|  2.94M|            if (change_idx == 511 || change_idx == 1023 || change_idx == 2047) {
  ------------------
  |  Branch (164:17): [True: 4.14k, False: 2.94M]
  |  Branch (164:38): [True: 1.06k, False: 2.94M]
  |  Branch (164:60): [True: 421, False: 2.94M]
  ------------------
  165|  5.61k|                ++code_size;
  166|  5.61k|            }
  167|  2.94M|        }
  168|       |
  169|  2.95M|        if (code < 256) {
  ------------------
  |  Branch (169:13): [True: 2.94M, False: 11.3k]
  ------------------
  170|  2.94M|            auto ch = static_cast<unsigned char>(code);
  171|  2.94M|            next()->write(&ch, 1);
  172|  2.94M|        } else {
  173|  11.3k|            unsigned int idx = code - 258;
  174|  11.3k|            if (idx >= table.size()) {
  ------------------
  |  Branch (174:17): [True: 41, False: 11.3k]
  ------------------
  175|     41|                throw std::runtime_error("Pl_LZWDecoder::handleCode: table overflow");
  176|     41|            }
  177|  11.3k|            Buffer& b = table.at(idx);
  178|  11.3k|            next()->write(b.getBuffer(), b.getSize());
  179|  11.3k|        }
  180|  2.95M|    }
  181|       |
  182|  2.96M|    last_code = code;
  183|  2.96M|}

_ZN10Pl_OStreamC2EPKcRNSt3__113basic_ostreamIcNS2_11char_traitsIcEEEE:
   19|      2|    Pipeline(identifier, nullptr),
   20|      2|    m(std::make_unique<Members>(os))
   21|      2|{
   22|      2|}
_ZN10Pl_OStreamD2Ev:
   25|      2|Pl_OStream::~Pl_OStream() = default;
_ZN10Pl_OStream5writeEPKhm:
   29|  2.03M|{
   30|  2.03M|    m->os.write(reinterpret_cast<char const*>(buf), static_cast<std::streamsize>(len));
   31|  2.03M|}
_ZN10Pl_OStream6finishEv:
   35|      2|{
   36|      2|    m->os.flush();
   37|      2|}
_ZN10Pl_OStream7MembersC2ERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE:
    9|      2|        os(os)
   10|      2|    {
   11|      2|    }

_ZN12Pl_PNGFilterC2EPKcP8PipelineNS_8action_eEjjj:
   30|  1.98k|    Pipeline(identifier, next),
   31|  1.98k|    action(action)
   32|  1.98k|{
   33|  1.98k|    util::assertion(next, "Attempt to create Pl_PNGFilter with nullptr as next");
   34|  1.98k|    util::no_ci_rt_error_if(
   35|  1.98k|        samples_per_pixel < 1, "PNGFilter created with invalid samples_per_pixel");
   36|  1.98k|    util::no_ci_rt_error_if(
   37|  1.98k|        !(bits_per_sample == 1 || bits_per_sample == 2 || bits_per_sample == 4 ||
  ------------------
  |  Branch (37:11): [True: 132, False: 1.85k]
  |  Branch (37:35): [True: 69, False: 1.78k]
  |  Branch (37:59): [True: 69, False: 1.71k]
  ------------------
   38|  1.71k|          bits_per_sample == 8 || bits_per_sample == 16),
  ------------------
  |  Branch (38:11): [True: 1.62k, False: 89]
  |  Branch (38:35): [True: 66, False: 23]
  ------------------
   39|  1.98k|        "PNGFilter created with invalid bits_per_sample not 1, 2, 4, 8, or 16");
   40|  1.98k|    auto bits_per_pixel = 1ULL * bits_per_sample * samples_per_pixel;
   41|  1.98k|    util::no_ci_rt_error_if(
   42|  1.98k|        !util::fits<uint32_t>(bits_per_pixel + 7),
   43|  1.98k|        "PNGFilter created with bits_per_sample and samples_per_pixel values that cause overflow");
   44|  1.98k|    util::no_ci_rt_error_if(
   45|  1.98k|        !util::fits<uint32_t>(columns),
   46|  1.98k|        "PNGFilter created with columns value that causes overflow");
   47|  1.98k|    bytes_per_pixel = static_cast<uint32_t>((bits_per_pixel + 7) / 8);
   48|  1.98k|    auto bpr = ((columns * bits_per_pixel) + 7) / 8;
   49|  1.98k|    util::no_ci_rt_error_if(
   50|  1.98k|        bpr == 0 || !util::fits<uint32_t>(bpr), "PNGFilter created with invalid columns value");
  ------------------
  |  Branch (50:9): [True: 26, False: 1.95k]
  |  Branch (50:21): [True: 3, False: 1.95k]
  ------------------
   51|  1.98k|    util::no_ci_rt_error_if(
   52|  1.98k|        memory_limit > 0 && bpr > (memory_limit / 2U), "PNGFilter memory limit exceeded");
  ------------------
  |  Branch (52:9): [True: 1.95k, False: 29]
  |  Branch (52:29): [True: 35, False: 1.92k]
  ------------------
   53|  1.98k|    bytes_per_row = static_cast<uint32_t>(bpr);
   54|  1.98k|    buf1 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   55|  1.98k|    buf2 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   56|  1.98k|    memset(buf1.get(), 0, bytes_per_row + 1);
   57|  1.98k|    memset(buf2.get(), 0, bytes_per_row + 1);
   58|  1.98k|    cur_row = buf1.get();
   59|  1.98k|    prev_row = buf2.get();
   60|       |
   61|       |    // number of bytes per incoming row
   62|  1.98k|    incoming = (action == a_encode ? bytes_per_row : bytes_per_row + 1);
  ------------------
  |  Branch (62:17): [True: 0, False: 1.98k]
  ------------------
   63|  1.98k|}
_ZN12Pl_PNGFilter5writeEPKhm:
   73|   247k|{
   74|   247k|    size_t left = incoming - pos;
   75|   247k|    size_t offset = 0;
   76|  1.23M|    while (len >= left) {
  ------------------
  |  Branch (76:12): [True: 989k, False: 247k]
  ------------------
   77|       |        // finish off current row
   78|   989k|        memcpy(cur_row + pos, data + offset, left);
   79|   989k|        offset += left;
   80|   989k|        len -= left;
   81|       |
   82|   989k|        processRow();
   83|       |
   84|       |        // Swap rows
   85|   989k|        unsigned char* t = prev_row;
   86|   989k|        prev_row = cur_row;
   87|   989k|        cur_row = t ? t : buf2.get();
  ------------------
  |  Branch (87:19): [True: 989k, False: 2]
  ------------------
   88|   989k|        memset(cur_row, 0, bytes_per_row + 1);
   89|   989k|        left = incoming;
   90|   989k|        pos = 0;
   91|   989k|    }
   92|   247k|    if (len) {
  ------------------
  |  Branch (92:9): [True: 246k, False: 692]
  ------------------
   93|   246k|        memcpy(cur_row + pos, data + offset, len);
   94|   246k|    }
   95|   247k|    pos += len;
   96|   247k|}
_ZN12Pl_PNGFilter10processRowEv:
  100|   990k|{
  101|   990k|    if (action == a_encode) {
  ------------------
  |  Branch (101:9): [True: 0, False: 990k]
  ------------------
  102|      0|        encodeRow();
  103|   990k|    } else {
  104|   990k|        decodeRow();
  105|   990k|    }
  106|   990k|}
_ZN12Pl_PNGFilter9decodeRowEv:
  110|   990k|{
  111|   990k|    int filter = cur_row[0];
  112|   990k|    if (prev_row) {
  ------------------
  |  Branch (112:9): [True: 990k, False: 0]
  ------------------
  113|   990k|        switch (filter) {
  114|   285k|        case 0:
  ------------------
  |  Branch (114:9): [True: 285k, False: 704k]
  ------------------
  115|   285k|            break;
  116|   171k|        case 1:
  ------------------
  |  Branch (116:9): [True: 171k, False: 819k]
  ------------------
  117|   171k|            decodeSub();
  118|   171k|            break;
  119|   421k|        case 2:
  ------------------
  |  Branch (119:9): [True: 421k, False: 568k]
  ------------------
  120|   421k|            decodeUp();
  121|   421k|            break;
  122|    587|        case 3:
  ------------------
  |  Branch (122:9): [True: 587, False: 989k]
  ------------------
  123|    587|            decodeAverage();
  124|    587|            break;
  125|  11.4k|        case 4:
  ------------------
  |  Branch (125:9): [True: 11.4k, False: 978k]
  ------------------
  126|  11.4k|            decodePaeth();
  127|  11.4k|            break;
  128|  99.5k|        default:
  ------------------
  |  Branch (128:9): [True: 99.5k, False: 890k]
  ------------------
  129|       |            // ignore
  130|  99.5k|            break;
  131|   990k|        }
  132|   990k|    }
  133|       |
  134|   990k|    next()->write(cur_row + 1, bytes_per_row);
  135|   990k|}
_ZN12Pl_PNGFilter9decodeSubEv:
  139|   171k|{
  140|   171k|    unsigned char* buffer = cur_row + 1;
  141|   171k|    unsigned int bpp = bytes_per_pixel;
  142|       |
  143|  2.04M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (143:30): [True: 1.87M, False: 171k]
  ------------------
  144|  1.87M|        unsigned char left = 0;
  145|       |
  146|  1.87M|        if (i >= bpp) {
  ------------------
  |  Branch (146:13): [True: 1.70M, False: 172k]
  ------------------
  147|  1.70M|            left = buffer[i - bpp];
  148|  1.70M|        }
  149|       |
  150|  1.87M|        buffer[i] = static_cast<unsigned char>(buffer[i] + left);
  151|  1.87M|    }
  152|   171k|}
_ZN12Pl_PNGFilter8decodeUpEv:
  156|   421k|{
  157|   421k|    unsigned char* buffer = cur_row + 1;
  158|   421k|    unsigned char* above_buffer = prev_row + 1;
  159|       |
  160|  2.76M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (160:30): [True: 2.34M, False: 421k]
  ------------------
  161|  2.34M|        unsigned char up = above_buffer[i];
  162|  2.34M|        buffer[i] = static_cast<unsigned char>(buffer[i] + up);
  163|  2.34M|    }
  164|   421k|}
_ZN12Pl_PNGFilter13decodeAverageEv:
  168|    587|{
  169|    587|    unsigned char* buffer = cur_row + 1;
  170|    587|    unsigned char* above_buffer = prev_row + 1;
  171|    587|    auto bpp = bytes_per_pixel;
  172|       |
  173|   838k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (173:30): [True: 837k, False: 587]
  ------------------
  174|   837k|        int left = 0;
  175|   837k|        int up = 0;
  176|       |
  177|   837k|        if (i >= bpp) {
  ------------------
  |  Branch (177:13): [True: 579k, False: 258k]
  ------------------
  178|   579k|            left = buffer[i - bpp];
  179|   579k|        }
  180|       |
  181|   837k|        up = above_buffer[i];
  182|   837k|        buffer[i] = static_cast<unsigned char>(buffer[i] + (left + up) / 2);
  183|   837k|    }
  184|    587|}
_ZN12Pl_PNGFilter11decodePaethEv:
  188|  11.4k|{
  189|  11.4k|    unsigned char* buffer = cur_row + 1;
  190|  11.4k|    unsigned char* above_buffer = prev_row + 1;
  191|  11.4k|    auto bpp = bytes_per_pixel;
  192|       |
  193|   591k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (193:30): [True: 580k, False: 11.4k]
  ------------------
  194|   580k|        int left = 0;
  195|   580k|        int up = above_buffer[i];
  196|   580k|        int upper_left = 0;
  197|       |
  198|   580k|        if (i >= bpp) {
  ------------------
  |  Branch (198:13): [True: 475k, False: 105k]
  ------------------
  199|   475k|            left = buffer[i - bpp];
  200|   475k|            upper_left = above_buffer[i - bpp];
  201|   475k|        }
  202|       |
  203|   580k|        buffer[i] = static_cast<unsigned char>(buffer[i] + PaethPredictor(left, up, upper_left));
  204|   580k|    }
  205|  11.4k|}
_ZN12Pl_PNGFilter14PaethPredictorEiii:
  209|   580k|{
  210|   580k|    int p = a + b - c;
  211|   580k|    int pa = abs_diff(p, a);
  212|   580k|    int pb = abs_diff(p, b);
  213|   580k|    int pc = abs_diff(p, c);
  214|       |
  215|   580k|    if (pa <= pb && pa <= pc) {
  ------------------
  |  Branch (215:9): [True: 547k, False: 32.8k]
  |  Branch (215:21): [True: 547k, False: 298]
  ------------------
  216|   547k|        return a;
  217|   547k|    }
  218|  33.1k|    if (pb <= pc) {
  ------------------
  |  Branch (218:9): [True: 32.8k, False: 314]
  ------------------
  219|  32.8k|        return b;
  220|  32.8k|    }
  221|    314|    return c;
  222|  33.1k|}
_ZN12Pl_PNGFilter6finishEv:
  242|  1.90k|{
  243|  1.90k|    if (pos) {
  ------------------
  |  Branch (243:9): [True: 936, False: 968]
  ------------------
  244|       |        // write partial row
  245|    936|        processRow();
  246|    936|    }
  247|  1.90k|    prev_row = nullptr;
  248|  1.90k|    cur_row = buf1.get();
  249|  1.90k|    pos = 0;
  250|  1.90k|    memset(cur_row, 0, bytes_per_row + 1);
  251|       |
  252|  1.90k|    next()->finish();
  253|  1.90k|}
Pl_PNGFilter.cc:_ZL8abs_diffii:
   19|  1.74M|{
   20|  1.74M|    return a > b ? a - b : b - a;
  ------------------
  |  Branch (20:12): [True: 744k, False: 996k]
  ------------------
   21|  1.74M|}

_ZN6Pl_RC4C2EPKcP8PipelineNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEm:
    9|    227|    Pipeline(identifier, next),
   10|    227|    out_bufsize(out_bufsize),
   11|    227|    rc4(reinterpret_cast<unsigned char const*>(key.data()), static_cast<int>(key.size()))
   12|    227|{
   13|    227|    util::assertion(next, "Attempt to create Pl_RC4 with nullptr as next");
   14|    227|    this->outbuf = QUtil::make_shared_array<unsigned char>(out_bufsize);
   15|    227|}
_ZN6Pl_RC45writeEPKhm:
   19|    227|{
   20|    227|    util::assertion(outbuf.get(), "Pl_RC4: write() called after finish() called");
   21|       |
   22|    227|    size_t bytes_left = len;
   23|    227|    unsigned char const* p = data;
   24|       |
   25|    474|    while (bytes_left > 0) {
  ------------------
  |  Branch (25:12): [True: 247, False: 227]
  ------------------
   26|    247|        size_t bytes = (bytes_left < this->out_bufsize ? bytes_left : out_bufsize);
  ------------------
  |  Branch (26:25): [True: 198, False: 49]
  ------------------
   27|    247|        bytes_left -= bytes;
   28|    247|        rc4.process(p, bytes, outbuf.get());
   29|    247|        p += bytes;
   30|    247|        next()->write(outbuf.get(), bytes);
   31|    247|    }
   32|    227|}
_ZN6Pl_RC46finishEv:
   36|    227|{
   37|    227|    outbuf = nullptr;
   38|    227|    next()->finish();
   39|    227|}

_ZN12Pl_RunLengthC2EPKcP8PipelineNS_8action_eE:
   32|  1.05k|    Pipeline(identifier, next),
   33|  1.05k|    m(std::make_unique<Members>(action))
   34|  1.05k|{
   35|  1.05k|    util::assertion(next, "Attempt to create Pl_RunLength with nullptr as next");
   36|  1.05k|}
_ZN12Pl_RunLengthD2Ev:
   44|  1.05k|Pl_RunLength::~Pl_RunLength() = default;
_ZN12Pl_RunLength5writeEPKhm:
   48|  19.6k|{
   49|  19.6k|    if (m->action == a_encode) {
  ------------------
  |  Branch (49:9): [True: 0, False: 19.6k]
  ------------------
   50|      0|        encode(data, len);
   51|  19.6k|    } else {
   52|  19.6k|        decode(data, len);
   53|  19.6k|    }
   54|  19.6k|}
_ZN12Pl_RunLength6decodeEPKhm:
   90|  19.6k|{
   91|  19.6k|    util::no_ci_rt_error_if(
   92|  19.6k|        memory_limit && (len + m->out.size()) > memory_limit, "Pl_RunLength memory limit exceeded");
  ------------------
  |  Branch (92:9): [True: 19.6k, False: 0]
  |  Branch (92:25): [True: 29, False: 19.6k]
  ------------------
   93|  19.6k|    m->out.reserve(len);
   94|  8.86M|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (94:24): [True: 8.84M, False: 19.6k]
  ------------------
   95|  8.84M|        unsigned char const& ch = data[i];
   96|  8.84M|        switch (m->state) {
  ------------------
  |  Branch (96:17): [True: 8.84M, False: 0]
  ------------------
   97|  4.14M|        case st_top:
  ------------------
  |  Branch (97:9): [True: 4.14M, False: 4.70M]
  ------------------
   98|  4.14M|            if (ch < 128) {
  ------------------
  |  Branch (98:17): [True: 107k, False: 4.03M]
  ------------------
   99|       |                // length represents remaining number of bytes to copy
  100|   107k|                m->length = 1U + ch;
  101|   107k|                m->state = st_copying;
  102|  4.03M|            } else if (ch > 128) {
  ------------------
  |  Branch (102:24): [True: 4.03M, False: 2.10k]
  ------------------
  103|       |                // length represents number of copies of next byte
  104|  4.03M|                m->length = 257U - ch;
  105|  4.03M|                m->state = st_run;
  106|  4.03M|            } else // ch == 128
  107|  2.10k|            {
  108|       |                // EOD; stay in this state
  109|  2.10k|            }
  110|  4.14M|            break;
  111|       |
  112|   676k|        case st_copying:
  ------------------
  |  Branch (112:9): [True: 676k, False: 8.17M]
  ------------------
  113|   676k|            m->out.append(1, static_cast<char>(ch));
  114|   676k|            if (--m->length == 0) {
  ------------------
  |  Branch (114:17): [True: 107k, False: 569k]
  ------------------
  115|   107k|                m->state = st_top;
  116|   107k|            }
  117|   676k|            break;
  118|       |
  119|  4.03M|        case st_run:
  ------------------
  |  Branch (119:9): [True: 4.03M, False: 4.81M]
  ------------------
  120|  4.03M|            m->out.append(m->length, static_cast<char>(ch));
  121|  4.03M|            m->state = st_top;
  122|  4.03M|            break;
  123|  8.84M|        }
  124|  8.84M|    }
  125|  19.6k|}
_ZN12Pl_RunLength6finishEv:
  159|    990|{
  160|       |    // When decoding, we might have read a length byte not followed by data, which means the stream
  161|       |    // was terminated early, but we will just ignore this case since this is the only sensible thing
  162|       |    // to do.
  163|    990|    if (m->action == a_encode) {
  ------------------
  |  Branch (163:9): [True: 0, False: 990]
  ------------------
  164|      0|        flush_encode();
  165|      0|        unsigned char ch = 128;
  166|      0|        next()->write(&ch, 1);
  167|    990|    } else {
  168|    990|        if (memory_limit && (m->out.size()) > memory_limit) {
  ------------------
  |  Branch (168:13): [True: 990, False: 0]
  |  Branch (168:29): [True: 52, False: 938]
  ------------------
  169|     52|            throw std::runtime_error("Pl_RunLength memory limit exceeded");
  170|     52|        }
  171|    938|        next()->writeString(m->out);
  172|    938|    }
  173|    938|    next()->finish();
  174|    938|}
_ZN12Pl_RunLength7MembersC2ENS_8action_eE:
   18|  1.05k|        action(action)
   19|  1.05k|    {
   20|  1.05k|    }
_ZN12Pl_RunLength7MembersD2Ev:
   22|  1.05k|    ~Members() = default;

_ZN7Pl_SHA2C2EiP8Pipeline:
   10|   129k|    Pipeline("sha2", next)
   11|   129k|{
   12|   129k|    if (bits) {
  ------------------
  |  Branch (12:9): [True: 129k, False: 0]
  ------------------
   13|   129k|        resetBits(bits);
   14|   129k|    }
   15|   129k|}
_ZN7Pl_SHA25writeEPKhm:
   19|   133k|{
   20|   133k|    if (!in_progress) {
  ------------------
  |  Branch (20:9): [True: 129k, False: 3.69k]
  ------------------
   21|   129k|        in_progress = true;
   22|   129k|    }
   23|       |
   24|       |    // Write in chunks in case len is too big to fit in an int. Assume int is at least 32 bits.
   25|   133k|    static size_t const max_bytes = 1 << 30;
   26|   133k|    size_t bytes_left = len;
   27|   133k|    unsigned char const* data = buf;
   28|   263k|    while (bytes_left > 0) {
  ------------------
  |  Branch (28:12): [True: 130k, False: 133k]
  ------------------
   29|   130k|        size_t bytes = (bytes_left >= max_bytes ? max_bytes : bytes_left);
  ------------------
  |  Branch (29:25): [True: 0, False: 130k]
  ------------------
   30|   130k|        crypto->SHA2_update(data, bytes);
   31|   130k|        bytes_left -= bytes;
   32|   130k|        data += bytes;
   33|   130k|    }
   34|       |
   35|   133k|    if (next()) {
  ------------------
  |  Branch (35:9): [True: 0, False: 133k]
  ------------------
   36|      0|        next()->write(buf, len);
   37|      0|    }
   38|   133k|}
_ZN7Pl_SHA26finishEv:
   42|   129k|{
   43|   129k|    if (next()) {
  ------------------
  |  Branch (43:9): [True: 0, False: 129k]
  ------------------
   44|      0|        next()->finish();
   45|      0|    }
   46|   129k|    crypto->SHA2_finalize();
   47|   129k|    in_progress = false;
   48|   129k|}
_ZN7Pl_SHA29resetBitsEi:
   52|   129k|{
   53|   129k|    util::assertion(!in_progress, "bit reset requested for in-progress SHA2 Pipeline");
   54|   129k|    crypto = QPDFCryptoProvider::getImpl();
   55|   129k|    crypto->SHA2_init(bits);
   56|   129k|}
_ZN7Pl_SHA212getRawDigestEv:
   60|   129k|{
   61|   129k|    util::assertion(!in_progress, "digest requested for in-progress SHA2 Pipeline");
   62|   129k|    return crypto->SHA2_digest();
   63|   129k|}

_ZN16Pl_TIFFPredictorC2EPKcP8PipelineNS_8action_eEjjj:
   26|    852|    Pipeline(identifier, next),
   27|    852|    action(action),
   28|    852|    columns(columns),
   29|    852|    samples_per_pixel(samples_per_pixel),
   30|    852|    bits_per_sample(bits_per_sample)
   31|    852|{
   32|    852|    util::assertion(next, "Attempt to create Pl_TIFFPredictor with nullptr as next");
   33|    852|    util::no_ci_rt_error_if(
   34|    852|        samples_per_pixel < 1, "TIFFPredictor created with invalid samples_per_pixel");
   35|    852|    util::no_ci_rt_error_if(
   36|    852|        bits_per_sample < 1 || bits_per_sample > (8 * (sizeof(unsigned long long))),
  ------------------
  |  Branch (36:9): [True: 6, False: 846]
  |  Branch (36:32): [True: 12, False: 834]
  ------------------
   37|    852|        "TIFFPredictor created with invalid bits_per_sample");
   38|    852|    auto bits_per_pixel = 1ULL * bits_per_sample * samples_per_pixel;
   39|    852|    util::no_ci_rt_error_if(
   40|    852|        !util::fits<uint32_t>(bits_per_pixel + 7),
   41|    852|        "TIFFPredictor created with bits_per_sample and samples_per_pixel values that cause "
   42|    852|        "overflow");
   43|    852|    auto bpr = (columns * bits_per_pixel + 7) / 8;
   44|    852|    util::no_ci_rt_error_if(
   45|    852|        bpr == 0 || !util::fits<uint32_t>(bpr), "TIFFPredictor created with invalid columns value");
  ------------------
  |  Branch (45:9): [True: 18, False: 834]
  |  Branch (45:21): [True: 3, False: 831]
  ------------------
   46|    852|    util::no_ci_rt_error_if(
   47|    852|        memory_limit > 0 && bpr > (memory_limit / 2ULL), "TIFFPredictor memory limit exceeded");
  ------------------
  |  Branch (47:9): [True: 831, False: 21]
  |  Branch (47:29): [True: 35, False: 796]
  ------------------
   48|    852|    bytes_per_row = static_cast<uint32_t>(bpr);
   49|    852|}
_ZN16Pl_TIFFPredictor5writeEPKhm:
   59|  2.68M|{
   60|  2.68M|    auto end = data + len;
   61|  2.68M|    auto row_end = data + (bytes_per_row - cur_row.size());
   62|  2.69M|    while (row_end <= end) {
  ------------------
  |  Branch (62:12): [True: 2.51k, False: 2.68M]
  ------------------
   63|       |        // finish off current row
   64|  2.51k|        cur_row.insert(cur_row.end(), data, row_end);
   65|  2.51k|        data = row_end;
   66|  2.51k|        row_end += bytes_per_row;
   67|       |
   68|  2.51k|        processRow();
   69|       |
   70|       |        // Prepare for next row
   71|  2.51k|        cur_row.clear();
   72|  2.51k|    }
   73|       |
   74|  2.68M|    cur_row.insert(cur_row.end(), data, end);
   75|  2.68M|}
_ZN16Pl_TIFFPredictor10processRowEv:
   79|  3.03k|{
   80|  3.03k|    QTC::TC("libtests", "Pl_TIFFPredictor processRow", (action == a_decode ? 0 : 1));
  ------------------
  |  Branch (80:57): [True: 3.03k, False: 0]
  ------------------
   81|  3.03k|    previous.assign(samples_per_pixel, 0);
   82|  3.03k|    if (bits_per_sample != 8) {
  ------------------
  |  Branch (82:9): [True: 1.79k, False: 1.24k]
  ------------------
   83|  1.79k|        BitWriter bw(next());
   84|  1.79k|        BitStream in(cur_row.data(), cur_row.size());
   85|  1.82M|        for (uint32_t col = 0; col < this->columns; ++col) {
  ------------------
  |  Branch (85:32): [True: 1.82M, False: 1.79k]
  ------------------
   86|  1.82M|            for (auto& prev: previous) {
  ------------------
  |  Branch (86:28): [True: 1.82M, False: 1.82M]
  ------------------
   87|  1.82M|                long long sample = in.getBitsSigned(this->bits_per_sample);
   88|  1.82M|                long long new_sample = sample;
   89|  1.82M|                if (action == a_encode) {
  ------------------
  |  Branch (89:21): [True: 0, False: 1.82M]
  ------------------
   90|      0|                    new_sample -= prev;
   91|      0|                    prev = sample;
   92|  1.82M|                } else {
   93|  1.82M|                    new_sample += prev;
   94|  1.82M|                    prev = new_sample;
   95|  1.82M|                }
   96|  1.82M|                bw.writeBitsSigned(new_sample, this->bits_per_sample);
   97|  1.82M|            }
   98|  1.82M|        }
   99|  1.79k|        bw.flush();
  100|  1.79k|    } else {
  101|  1.24k|        out.clear();
  102|  1.24k|        auto next_it = cur_row.begin();
  103|  1.24k|        auto cr_end = cur_row.end();
  104|  1.24k|        auto pr_end = previous.end();
  105|       |
  106|  1.74M|        while (next_it != cr_end) {
  ------------------
  |  Branch (106:16): [True: 1.74M, False: 1.24k]
  ------------------
  107|  12.5M|            for (auto prev = previous.begin(); prev != pr_end && next_it != cr_end;
  ------------------
  |  Branch (107:48): [True: 10.7M, False: 1.74M]
  |  Branch (107:66): [True: 10.7M, False: 0]
  ------------------
  108|  10.7M|                 ++prev, ++next_it) {
  109|  10.7M|                long long sample = *next_it;
  110|  10.7M|                long long new_sample = sample;
  111|  10.7M|                if (action == a_encode) {
  ------------------
  |  Branch (111:21): [True: 0, False: 10.7M]
  ------------------
  112|      0|                    new_sample -= *prev;
  113|      0|                    *prev = sample;
  114|  10.7M|                } else {
  115|  10.7M|                    new_sample += *prev;
  116|  10.7M|                    *prev = new_sample;
  117|  10.7M|                }
  118|  10.7M|                out.push_back(static_cast<unsigned char>(255U & new_sample));
  119|  10.7M|            }
  120|  1.74M|        }
  121|  1.24k|        next()->write(out.data(), out.size());
  122|  1.24k|    }
  123|  3.03k|}
_ZN16Pl_TIFFPredictor6finishEv:
  127|    763|{
  128|    763|    if (!cur_row.empty()) {
  ------------------
  |  Branch (128:9): [True: 525, False: 238]
  ------------------
  129|       |        // write partial row
  130|    525|        cur_row.insert(cur_row.end(), bytes_per_row - cur_row.size(), 0);
  131|    525|        processRow();
  132|    525|    }
  133|    763|    cur_row.clear();
  134|    763|    next()->finish();
  135|    763|}

_ZN4QPDF15StringDecrypterC2EPS_10QPDFObjGen:
  118|  85.8k|    qpdf(qpdf),
  119|  85.8k|    og(og)
  120|  85.8k|{
  121|  85.8k|}
_ZN4QPDF7MembersC2ERS_:
  131|  20.8k|    Doc(qpdf, this),
  132|  20.8k|    c(qpdf, this),
  133|  20.8k|    lin(*this),
  134|  20.8k|    objects(*this),
  135|  20.8k|    pages(*this),
  136|  20.8k|    file(std::make_shared<InvalidInputSource>()),
  137|  20.8k|    encp(std::make_shared<EncryptionParameters>())
  138|  20.8k|{
  139|  20.8k|}
_ZN4QPDFC2Ev:
  142|  20.8k|    m(std::make_unique<Members>(*this))
  143|  20.8k|{
  144|  20.8k|    m->tokenizer.allowEOF();
  145|       |    // Generate a unique ID. It just has to be unique among all QPDF objects allocated throughout
  146|       |    // the lifetime of this running application.
  147|  20.8k|    static std::atomic<unsigned long long> unique_id{0};
  148|  20.8k|    m->unique_id = unique_id.fetch_add(1ULL);
  149|  20.8k|}
_ZN4QPDFD2Ev:
  186|  20.8k|{
  187|       |    // If two objects are mutually referential (through each object having an array or dictionary
  188|       |    // that contains an indirect reference to the other), the circular references in the
  189|       |    // std::shared_ptr objects will prevent the objects from being deleted. Walk through all objects
  190|       |    // in the object cache, which is those objects that we read from the file, and break all
  191|       |    // resolved indirect references by replacing them with an internal object type representing that
  192|       |    // they have been destroyed. Note that we can't break references like this at any time when the
  193|       |    // QPDF object is active. The call to reset also causes all direct QPDFObjectHandle objects that
  194|       |    // are reachable from this object to release their association with this QPDF. Direct objects
  195|       |    // are not destroyed since they can be moved to other QPDF objects safely.
  196|       |
  197|       |    // At this point, obviously no one is still using the QPDF object, but we'll explicitly clear
  198|       |    // the xref table anyway just to prevent any possibility of resolve() succeeding.
  199|  20.8k|    m->xref_table.clear();
  200|   285k|    for (auto const& iter: m->obj_cache) {
  ------------------
  |  Branch (200:26): [True: 285k, False: 20.8k]
  ------------------
  201|   285k|        Disconnect(iter.second.object).disconnect();
  202|   285k|    }
  203|  20.8k|}
_ZN4QPDF18processInputSourceENSt3__110shared_ptrI11InputSourceEEPKc:
  235|  20.8k|{
  236|  20.8k|    m->file = source;
  237|  20.8k|    m->objects.parse(password);
  238|  20.8k|}
_ZN4QPDF4warnERK7QPDFExc:
  337|   371k|{
  338|   371k|    m->c.warn(e);
  339|   371k|}
_ZN4QPDF3Doc6Common4warnERK7QPDFExc:
  343|   703k|{
  344|   703k|    if (cf.max_warnings() > 0 && m->warnings.size() >= cf.max_warnings()) {
  ------------------
  |  Branch (344:9): [True: 661k, False: 41.6k]
  |  Branch (344:34): [True: 32.7k, False: 628k]
  ------------------
  345|  32.7k|        stopOnError("Too many warnings - file is too badly damaged");
  346|  32.7k|    }
  347|   703k|    m->warnings.emplace_back(e);
  348|   703k|    if (!cf.suppress_warnings()) {
  ------------------
  |  Branch (348:9): [True: 670k, False: 32.7k]
  ------------------
  349|   670k|        *cf.log()->getWarn() << "WARNING: " << m->warnings.back().what() << "\n";
  350|   670k|    }
  351|   703k|}
_ZN4QPDF4warnE17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEExS9_:
  359|  7.36k|{
  360|  7.36k|    m->c.warn(QPDFExc(error_code, getFilename(), object, offset, message));
  361|  7.36k|}
_ZN4QPDF3Doc6Common4warnE17qpdf_error_code_eRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEExSB_:
  369|  1.07k|{
  370|  1.07k|    warn(QPDFExc(error_code, qpdf.getFilename(), object, offset, message));
  371|  1.07k|}
_ZN4QPDF9getObjectEii:
  410|  39.7k|{
  411|  39.7k|    return getObject({objid, generation});
  412|  39.7k|}
_ZNK4QPDF11getFilenameEv:
  625|  60.1k|{
  626|  60.1k|    return m->file->getName();
  627|  60.1k|}
_ZN4QPDF7getRootEv:
  669|  19.9k|{
  670|  19.9k|    Dictionary Root = m->trailer["/Root"];
  671|  19.9k|    if (!Root) {
  ------------------
  |  Branch (671:9): [True: 7.25k, False: 12.7k]
  ------------------
  672|  7.25k|        throw m->c.damagedPDF("", -1, "unable to find /Root dictionary");
  673|  7.25k|    }
  674|  12.7k|    if (!m->objects.root_checked()) {
  ------------------
  |  Branch (674:9): [True: 4.23k, False: 8.50k]
  ------------------
  675|  4.23k|        m->objects.root_checked(true);
  676|  4.23k|        if (Name(Root["/Type"]) != "/Catalog") {
  ------------------
  |  Branch (676:13): [True: 1.38k, False: 2.85k]
  ------------------
  677|  1.38k|            warn(m->c.damagedPDF(
  678|  1.38k|                "", -1, "Catalog: setting missing or invalid /Type entry to /Catalog"));
  679|  1.38k|            if (!global::Options::inspection_mode()) {
  ------------------
  |  Branch (679:17): [True: 1.38k, False: 1]
  ------------------
  680|  1.38k|                Root.replace("/Type", Name("/Catalog"));
  681|  1.38k|            }
  682|  1.38k|        }
  683|  4.23k|    }
  684|  12.7k|    return Root.oh();
  685|  19.9k|}
_ZN4QPDF14pipeStreamDataENSt3__110shared_ptrINS_20EncryptionParametersEEENS1_I11InputSourceEERS_10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
  713|  10.8k|{
  714|  10.8k|    std::unique_ptr<Pipeline> to_delete;
  715|  10.8k|    if (encp->encrypted) {
  ------------------
  |  Branch (715:9): [True: 531, False: 10.3k]
  ------------------
  716|    531|        decryptStream(
  717|    531|            encp, file, qpdf_for_warning, pipeline, og, stream_dict, is_root_metadata, to_delete);
  718|    531|    }
  719|       |
  720|  10.8k|    bool attempted_finish = false;
  721|  10.8k|    try {
  722|  10.8k|        auto buf = file->read(length, offset);
  723|  10.8k|        if (buf.size() != length) {
  ------------------
  |  Branch (723:13): [True: 0, False: 10.8k]
  ------------------
  724|      0|            throw qpdf_for_warning.m->c.damagedPDF(
  725|      0|                *file,
  726|      0|                "",
  727|      0|                offset + QIntC::to_offset(buf.size()),
  728|      0|                "unexpected EOF reading stream data");
  729|      0|        }
  730|  10.8k|        pipeline->write(buf.data(), length);
  731|  10.8k|        attempted_finish = true;
  732|  10.8k|        pipeline->finish();
  733|  10.8k|        return true;
  734|  10.8k|    } catch (QPDFExc& e) {
  735|      1|        if (!suppress_warnings) {
  ------------------
  |  Branch (735:13): [True: 1, False: 0]
  ------------------
  736|      1|            qpdf_for_warning.warn(e);
  737|      1|        }
  738|  1.90k|    } catch (std::exception& e) {
  739|  1.90k|        if (!suppress_warnings) {
  ------------------
  |  Branch (739:13): [True: 1.90k, False: 0]
  ------------------
  740|  1.90k|            QTC::TC("qpdf", "QPDF decoding error warning");
  741|  1.90k|            qpdf_for_warning.warn(
  742|       |                // line-break
  743|  1.90k|                qpdf_for_warning.m->c.damagedPDF(
  744|  1.90k|                    *file,
  745|  1.90k|                    "",
  746|  1.90k|                    file->getLastOffset(),
  747|  1.90k|                    ("error decoding stream data for object " + og.unparse(' ') + ": " +
  748|  1.90k|                     e.what())));
  749|  1.90k|            if (will_retry) {
  ------------------
  |  Branch (749:17): [True: 0, False: 1.90k]
  ------------------
  750|      0|                qpdf_for_warning.warn(
  751|       |                    // line-break
  752|      0|                    qpdf_for_warning.m->c.damagedPDF(
  753|      0|                        *file,
  754|      0|                        "",
  755|      0|                        file->getLastOffset(),
  756|      0|                        "stream will be re-processed without filtering to avoid data loss"));
  757|      0|            }
  758|  1.90k|        }
  759|  1.90k|    }
  760|  1.79k|    if (!attempted_finish) {
  ------------------
  |  Branch (760:9): [True: 1.61k, False: 181]
  ------------------
  761|  1.61k|        try {
  762|  1.61k|            pipeline->finish();
  763|  1.61k|        } catch (std::exception&) {
  764|       |            // ignore
  765|  1.25k|        }
  766|  1.61k|    }
  767|  1.79k|    return false;
  768|  1.79k|}
_ZN4QPDF14pipeStreamDataE10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
  780|  10.8k|{
  781|  10.8k|    return pipeStreamData(
  782|  10.8k|        m->encp,
  783|  10.8k|        m->file,
  784|  10.8k|        *this,
  785|  10.8k|        og,
  786|  10.8k|        offset,
  787|  10.8k|        length,
  788|  10.8k|        stream_dict,
  789|  10.8k|        is_root_metadata,
  790|  10.8k|        pipeline,
  791|  10.8k|        suppress_warnings,
  792|  10.8k|        will_retry);
  793|  10.8k|}
_ZN4QPDF3Doc6Common11stopOnErrorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  799|  32.7k|{
  800|  32.7k|    throw damagedPDF("", message);
  801|  32.7k|}
_ZN4QPDF3Doc6Common10damagedPDFER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEExSC_:
  807|  44.3k|{
  808|  44.3k|    return {qpdf_e_damaged_pdf, input.getName(), object, offset, message, true};
  809|  44.3k|}
_ZNK4QPDF3Doc6Common10damagedPDFER11InputSourcexRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
  815|  42.4k|{
  816|  42.4k|    return damagedPDF(input, m->last_object_description, offset, message);
  817|  42.4k|}
_ZNK4QPDF3Doc6Common10damagedPDFERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEExSA_:
  823|   292k|{
  824|   292k|    return {qpdf_e_damaged_pdf, m->file->getName(), object, offset, message, true};
  825|   292k|}
_ZNK4QPDF3Doc6Common10damagedPDFERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  831|  86.7k|{
  832|  86.7k|    return damagedPDF(object, m->file->getLastOffset(), message);
  833|  86.7k|}
_ZNK4QPDF3Doc6Common10damagedPDFExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  839|  59.0k|{
  840|  59.0k|    return damagedPDF(m->last_object_description, offset, message);
  841|  59.0k|}
_ZNK4QPDF3Doc6Common10damagedPDFERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  847|  31.2k|{
  848|  31.2k|    return damagedPDF(m->last_object_description, m->file->getLastOffset(), message);
  849|  31.2k|}
_ZN10DisconnectC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  172|   285k|        BaseHandle(obj)
  173|   285k|    {
  174|   285k|    }
_ZN10Disconnect10disconnectEv:
  177|   285k|    {
  178|   285k|        BaseHandle::disconnect(false);
  179|   285k|        if (raw_type_code() != ::ot_null) {
  ------------------
  |  Branch (179:13): [True: 101k, False: 184k]
  ------------------
  180|   101k|            obj->value = QPDF_Destroyed();
  181|   101k|        }
  182|   285k|    }

_ZN18QPDFCryptoProvider7getImplEv:
   19|   401k|{
   20|   401k|    QPDFCryptoProvider& p = getInstance();
   21|   401k|    if (p.m->default_provider.empty()) {
  ------------------
  |  Branch (21:9): [True: 0, False: 401k]
  ------------------
   22|      0|        throw std::logic_error("QPDFCryptoProvider::getImpl called with no default provider.");
   23|      0|    }
   24|   401k|    return p.getImpl_internal(p.m->default_provider);
   25|   401k|}
_ZN18QPDFCryptoProviderC2Ev:
   46|      1|    m(std::make_shared<Members>())
   47|      1|{
   48|      1|#ifdef USE_CRYPTO_NATIVE
   49|      1|    registerImpl_internal("native", std::make_shared<QPDFCrypto_native>);
   50|      1|#endif
   51|       |#ifdef USE_CRYPTO_GNUTLS
   52|       |    registerImpl_internal("gnutls", std::make_shared<QPDFCrypto_gnutls>);
   53|       |#endif
   54|       |#ifdef USE_CRYPTO_OPENSSL
   55|       |    registerImpl_internal("openssl", std::make_shared<QPDFCrypto_openssl>);
   56|       |#endif
   57|      1|    std::string default_crypto;
   58|      1|    if (!QUtil::get_env("QPDF_CRYPTO_PROVIDER", &default_crypto)) {
  ------------------
  |  Branch (58:9): [True: 1, False: 0]
  ------------------
   59|      1|        default_crypto = DEFAULT_CRYPTO;
  ------------------
  |  |    3|      1|#define DEFAULT_CRYPTO "native"
  ------------------
   60|      1|    }
   61|      1|    setDefaultProvider_internal(default_crypto);
   62|      1|}
_ZN18QPDFCryptoProvider11getInstanceEv:
   66|   401k|{
   67|   401k|    static QPDFCryptoProvider instance;
   68|   401k|    return instance;
   69|   401k|}
_ZNK18QPDFCryptoProvider16getImpl_internalERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   73|   401k|{
   74|   401k|    auto iter = m->providers.find(name);
   75|   401k|    if (iter == m->providers.end()) {
  ------------------
  |  Branch (75:9): [True: 0, False: 401k]
  ------------------
   76|      0|        throw std::logic_error(
   77|      0|            "QPDFCryptoProvider requested unknown implementation \"" + name + "\"");
   78|      0|    }
   79|   401k|    return m->providers[name]();
   80|   401k|}
_ZN18QPDFCryptoProvider21registerImpl_internalERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_8functionIFNS0_10shared_ptrI14QPDFCryptoImplEEvEEE:
   84|      1|{
   85|      1|    m->providers[name] = std::move(f);
   86|      1|}
_ZN18QPDFCryptoProvider27setDefaultProvider_internalERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   90|      1|{
   91|      1|    if (!m->providers.contains(name)) {
  ------------------
  |  Branch (91:9): [True: 0, False: 1]
  ------------------
   92|      0|        throw std::logic_error(
   93|      0|            "QPDFCryptoProvider: request to set default provider to unknown implementation \"" +
   94|      0|            name + "\"");
   95|      0|    }
   96|      1|    m->default_provider = name;
   97|      1|}

_ZN17QPDFCrypto_native17provideRandomDataEPhm:
   36|    319|{
   37|    319|    getRandomProvider()->provideRandomData(data, len);
   38|    319|}
_ZN17QPDFCrypto_native8MD5_initEv:
   42|  96.5k|{
   43|  96.5k|    md5 = std::make_shared<MD5_native>();
   44|  96.5k|}
_ZN17QPDFCrypto_native10MD5_updateEPKhm:
   48|   101k|{
   49|   101k|    md5->update(const_cast<unsigned char*>(data), len);
   50|   101k|}
_ZN17QPDFCrypto_native12MD5_finalizeEv:
   54|  96.5k|{
   55|  96.5k|    md5->finalize();
   56|  96.5k|}
_ZN17QPDFCrypto_native10MD5_digestEPh:
   60|  96.5k|{
   61|  96.5k|    md5->digest(d);
   62|  96.5k|}
_ZN17QPDFCrypto_native8RC4_initEPKhi:
   66|  36.6k|{
   67|  36.6k|    rc4 = std::make_shared<RC4_native>(key_data, key_len);
   68|  36.6k|}
_ZN17QPDFCrypto_native11RC4_processEPKhmPh:
   72|  36.6k|{
   73|  36.6k|    rc4->process(in_data, len, out_data);
   74|  36.6k|}
_ZN17QPDFCrypto_native9SHA2_initEi:
   83|   129k|{
   84|   129k|    sha2 = std::make_shared<SHA2_native>(bits);
   85|   129k|}
_ZN17QPDFCrypto_native11SHA2_updateEPKhm:
   89|   130k|{
   90|   130k|    sha2->update(data, len);
   91|   130k|}
_ZN17QPDFCrypto_native13SHA2_finalizeEv:
   95|   129k|{
   96|   129k|    sha2->finalize();
   97|   129k|}
_ZN17QPDFCrypto_native11SHA2_digestEv:
  101|   129k|{
  102|   129k|    return sha2->getRawDigest();
  103|   129k|}
_ZN17QPDFCrypto_native13rijndael_initEbPKhmbPh:
  113|   138k|{
  114|   138k|    aes_pdf = std::make_shared<AES_PDF_native>(encrypt, key_data, key_len, cbc_mode, cbc_block);
  115|   138k|}
_ZN17QPDFCrypto_native16rijndael_processEPhS0_:
  119|  35.1M|{
  120|  35.1M|    aes_pdf->update(in_data, out_data);
  121|  35.1M|}
_ZN17QPDFCrypto_native17rijndael_finalizeEv:
  125|   138k|{
  126|   138k|}
QPDFCrypto_native.cc:_ZL17getRandomProviderv:
   12|    319|{
   13|       |#ifdef USE_INSECURE_RANDOM
   14|       |    static RandomDataProvider* insecure_random_data_provider =
   15|       |        InsecureRandomDataProvider::getInstance();
   16|       |#else
   17|    319|    static RandomDataProvider* insecure_random_data_provider = nullptr;
   18|    319|#endif
   19|    319|    static RandomDataProvider* secure_random_data_provider =
   20|    319|        SecureRandomDataProvider::getInstance();
   21|       |
   22|    319|    static RandomDataProvider* provider =
   23|    319|        (secure_random_data_provider         ? secure_random_data_provider
  ------------------
  |  Branch (23:10): [True: 1, False: 318]
  ------------------
   24|    319|             : insecure_random_data_provider ? insecure_random_data_provider
  ------------------
  |  Branch (24:16): [True: 0, False: 318]
  ------------------
   25|    318|                                             : nullptr);
   26|       |
   27|    319|    if (provider == nullptr) {
  ------------------
  |  Branch (27:9): [True: 0, False: 319]
  ------------------
   28|      0|        throw std::logic_error("QPDFCrypto_native has no random data provider");
   29|      0|    }
   30|       |
   31|    319|    return provider;
   32|    319|}

_ZN18QPDFDocumentHelperD2Ev:
    4|  1.92k|{
    5|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
    6|  1.92k|}

_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_:
    9|   379k|    std::runtime_error(createWhat(filename, object, (offset ? offset : -1), message)),
  ------------------
  |  Branch (9:54): [True: 315k, False: 64.7k]
  ------------------
   10|   379k|    error_code(error_code),
   11|   379k|    filename(filename),
   12|   379k|    object(object),
   13|   379k|    offset(offset ? offset : -1),
  ------------------
  |  Branch (13:12): [True: 315k, False: 64.7k]
  ------------------
   14|   379k|    message(message)
   15|   379k|{
   16|   379k|}
_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_b:
   25|   357k|    std::runtime_error(
   26|   357k|        createWhat(filename, object, (offset || zero_offset_valid ? offset : -1), message)),
  ------------------
  |  Branch (26:39): [True: 357k, False: 92]
  |  Branch (26:49): [True: 92, False: 0]
  ------------------
   27|   357k|    error_code(error_code),
   28|   357k|    filename(filename),
   29|   357k|    object(object),
   30|   357k|    offset(offset || zero_offset_valid ? offset : -1),
  ------------------
  |  Branch (30:12): [True: 357k, False: 92]
  |  Branch (30:22): [True: 92, False: 0]
  ------------------
   31|   357k|    message(message)
   32|   357k|{
   33|   357k|}
_ZN7QPDFExc10createWhatERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_xS8_:
   41|   737k|{
   42|   737k|    std::string result;
   43|   737k|    if (!filename.empty()) {
  ------------------
  |  Branch (43:9): [True: 678k, False: 58.2k]
  ------------------
   44|   678k|        result += filename;
   45|   678k|    }
   46|   737k|    if (!(object.empty() && offset < 0)) {
  ------------------
  |  Branch (46:11): [True: 149k, False: 587k]
  |  Branch (46:29): [True: 107k, False: 42.7k]
  ------------------
   47|   629k|        if (!filename.empty()) {
  ------------------
  |  Branch (47:13): [True: 571k, False: 57.9k]
  ------------------
   48|   571k|            result += " (";
   49|   571k|        }
   50|   629k|        if (!object.empty()) {
  ------------------
  |  Branch (50:13): [True: 587k, False: 42.7k]
  ------------------
   51|   587k|            result += object;
   52|   587k|            if (offset >= 0) {
  ------------------
  |  Branch (52:17): [True: 523k, False: 64.0k]
  ------------------
   53|   523k|                result += ", ";
   54|   523k|            }
   55|   587k|        }
   56|   629k|        if (offset >= 0) {
  ------------------
  |  Branch (56:13): [True: 565k, False: 64.0k]
  ------------------
   57|   565k|            result += "offset " + std::to_string(offset);
   58|   565k|        }
   59|   629k|        if (!filename.empty()) {
  ------------------
  |  Branch (59:13): [True: 571k, False: 57.9k]
  ------------------
   60|   571k|            result += ")";
   61|   571k|        }
   62|   629k|    }
   63|   737k|    if (!result.empty()) {
  ------------------
  |  Branch (63:9): [True: 736k, False: 303]
  ------------------
   64|   736k|        result += ": ";
   65|   736k|    }
   66|   737k|    result += message;
   67|   737k|    return result;
   68|   737k|}

_ZN10QPDFLogger7MembersC2Ev:
   47|      1|    p_discard(new Pl_Discard()),
   48|      1|    p_real_stdout(new Pl_OStream("standard output", std::cout)),
   49|      1|    p_stdout(new Pl_Track("track stdout", p_real_stdout.get())),
   50|      1|    p_stderr(new Pl_OStream("standard error", std::cerr)),
   51|      1|    p_info(p_stdout),
   52|      1|    p_warn(nullptr),
   53|      1|    p_error(p_stderr),
   54|      1|    p_save(nullptr)
   55|      1|{
   56|      1|}
_ZN10QPDFLogger7MembersD2Ev:
   59|      1|{
   60|      1|    p_stdout->finish();
   61|      1|    p_stderr->finish();
   62|      1|}
_ZN10QPDFLoggerC2Ev:
   65|      1|    m(new Members())
   66|      1|{
   67|      1|}
_ZN10QPDFLogger6createEv:
   71|      1|{
   72|      1|    return std::shared_ptr<QPDFLogger>(new QPDFLogger);
   73|      1|}
_ZN10QPDFLogger13defaultLoggerEv:
   77|  30.8k|{
   78|  30.8k|    static auto l = create();
   79|  30.8k|    return l;
   80|  30.8k|}
_ZN10QPDFLogger4warnEPKc:
  102|     15|{
  103|     15|    getWarn(false)->writeCStr(s);
  104|     15|}
_ZN10QPDFLogger7getWarnEb:
  114|   670k|{
  115|   670k|    if (m->p_warn) {
  ------------------
  |  Branch (115:9): [True: 0, False: 670k]
  ------------------
  116|      0|        return m->p_warn;
  117|      0|    }
  118|   670k|    return getError(null_okay);
  119|   670k|}
_ZN10QPDFLogger8getErrorEb:
  135|   680k|{
  136|   680k|    return throwIfNull(m->p_error, null_okay);
  137|   680k|}
_ZN10QPDFLogger11throwIfNullENSt3__110shared_ptrI8PipelineEEb:
  254|   680k|{
  255|   680k|    if (!(null_okay || p)) {
  ------------------
  |  Branch (255:11): [True: 0, False: 680k]
  |  Branch (255:24): [True: 680k, False: 0]
  ------------------
  256|      0|        throw std::logic_error("QPDFLogger: requested a null pipeline without null_okay == true");
  257|      0|    }
  258|   680k|    return p;
  259|   680k|}
QPDFLogger.cc:_ZN12_GLOBAL__N_18Pl_TrackC2EPKcP8Pipeline:
   15|      1|            Pipeline(identifier, next)
   16|      1|        {
   17|      1|            if (!next) {
  ------------------
  |  Branch (17:17): [True: 0, False: 1]
  ------------------
   18|      0|                throw std::logic_error("Attempt to create Pl_Track with nullptr as next");
   19|      0|            }
   20|      1|        }
QPDFLogger.cc:_ZN12_GLOBAL__N_18Pl_Track6finishEv:
   31|      1|        {
   32|      1|            next()->finish();
   33|      1|        }

_ZN10QPDFObject14getDescriptionEv:
    5|  59.8k|{
    6|  59.8k|    qpdf_offset_t shift = (getTypeCode() == ::ot_dictionary) ? 2
  ------------------
  |  Branch (6:27): [True: 38.4k, False: 21.3k]
  ------------------
    7|  59.8k|        : (getTypeCode() == ::ot_array)                      ? 1
  ------------------
  |  Branch (7:11): [True: 77, False: 21.2k]
  ------------------
    8|  21.3k|                                                             : 0;
    9|       |
   10|  59.8k|    if (object_description) {
  ------------------
  |  Branch (10:9): [True: 54.1k, False: 5.66k]
  ------------------
   11|  54.1k|        switch (object_description->index()) {
  ------------------
  |  Branch (11:17): [True: 54.1k, False: 0]
  ------------------
   12|  51.3k|        case 0:
  ------------------
  |  Branch (12:9): [True: 51.3k, False: 2.80k]
  ------------------
   13|  51.3k|            {
   14|       |                // Simple template string
   15|  51.3k|                auto description = std::get<0>(*object_description);
   16|       |
   17|  51.3k|                if (auto pos = description.find("$OG"); pos != std::string::npos) {
  ------------------
  |  Branch (17:57): [True: 0, False: 51.3k]
  ------------------
   18|      0|                    description.replace(pos, 3, og.unparse(' '));
   19|      0|                }
   20|  51.3k|                if (auto pos = description.find("$PO"); pos != std::string::npos) {
  ------------------
  |  Branch (20:57): [True: 51.1k, False: 245]
  ------------------
   21|  51.1k|                    description.replace(pos, 3, std::to_string(parsed_offset + shift));
   22|  51.1k|                }
   23|  51.3k|                return description;
   24|      0|            }
   25|      0|        case 1:
  ------------------
  |  Branch (25:9): [True: 0, False: 54.1k]
  ------------------
   26|      0|            {
   27|       |                // QPDF::JSONReactor generated description
   28|      0|                auto j_descr = std::get<1>(*object_description);
   29|      0|                return (
   30|      0|                    *j_descr.input + (j_descr.object.empty() ? "" : ", " + j_descr.object) +
  ------------------
  |  Branch (30:39): [True: 0, False: 0]
  ------------------
   31|      0|                    " at offset " + std::to_string(parsed_offset));
   32|      0|            }
   33|  1.53k|        case 2:
  ------------------
  |  Branch (33:9): [True: 1.53k, False: 52.6k]
  ------------------
   34|  1.53k|            {
   35|       |                // Child object description
   36|  1.53k|                auto j_descr = std::get<2>(*object_description);
   37|  1.53k|                std::string result;
   38|  1.53k|                if (auto p = j_descr.parent.lock()) {
  ------------------
  |  Branch (38:26): [True: 1.53k, False: 0]
  ------------------
   39|  1.53k|                    result = p->getDescription();
   40|  1.53k|                }
   41|  1.53k|                result += j_descr.static_descr;
   42|  1.53k|                if (auto pos = result.find("$VD"); pos != std::string::npos) {
  ------------------
  |  Branch (42:52): [True: 1.53k, False: 0]
  ------------------
   43|  1.53k|                    result.replace(pos, 3, j_descr.var_descr);
   44|  1.53k|                }
   45|  1.53k|                return result;
   46|      0|            }
   47|  1.26k|        case 3:
  ------------------
  |  Branch (47:9): [True: 1.26k, False: 52.8k]
  ------------------
   48|  1.26k|            auto [stream_id, obj_id] = std::get<3>(*object_description);
   49|  1.26k|            std::string result = qpdf ? qpdf->getFilename() : "";
  ------------------
  |  Branch (49:34): [True: 1.26k, False: 0]
  ------------------
   50|  1.26k|            result += " object stream " + std::to_string(stream_id) + ", object " +
   51|  1.26k|                std::to_string(obj_id) + " 0 at offset " + std::to_string(parsed_offset + shift);
   52|  1.26k|            return result;
   53|  54.1k|        }
   54|       |
   55|  54.1k|    } else if (og.isIndirect()) {
  ------------------
  |  Branch (55:16): [True: 5.36k, False: 303]
  ------------------
   56|  5.36k|        return "object " + og.unparse(' ');
   57|  5.36k|    }
   58|    303|    return {};
   59|  59.8k|}

_ZNK4qpdf10BaseHandlecv10QPDFObjGenEv:
   34|   144k|{
   35|   144k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (35:12): [True: 144k, False: 0]
  ------------------
   36|   144k|}
_ZN16QPDFObjectHandle18StreamDataProviderC2Eb:
   46|  20.8k|    supports_retry(supports_retry)
   47|  20.8k|{
   48|  20.8k|}
_ZN16QPDFObjectHandle18StreamDataProviderD2Ev:
   51|  20.8k|{
   52|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   53|  20.8k|}
_ZNK4qpdf10BaseHandle4copyEb:
  252|   119k|{
  253|   119k|    switch (resolved_type_code()) {
  ------------------
  |  Branch (253:13): [True: 119k, False: 0]
  ------------------
  254|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (254:5): [True: 0, False: 119k]
  ------------------
  255|      0|        throw std::logic_error("QPDFObjectHandle: attempting to copy an uninitialized object");
  256|      0|        return {}; // does not return
  257|      0|    case ::ot_reserved:
  ------------------
  |  Branch (257:5): [True: 0, False: 119k]
  ------------------
  258|      0|        return QPDFObject::create<QPDF_Reserved>();
  259|    878|    case ::ot_null:
  ------------------
  |  Branch (259:5): [True: 878, False: 118k]
  ------------------
  260|    878|        return QPDFObject::create<QPDF_Null>();
  261|    257|    case ::ot_boolean:
  ------------------
  |  Branch (261:5): [True: 257, False: 119k]
  ------------------
  262|    257|        return QPDFObject::create<QPDF_Bool>(std::get<QPDF_Bool>(obj->value).val);
  263|  1.36k|    case ::ot_integer:
  ------------------
  |  Branch (263:5): [True: 1.36k, False: 118k]
  ------------------
  264|  1.36k|        return QPDFObject::create<QPDF_Integer>(std::get<QPDF_Integer>(obj->value).val);
  265|    591|    case ::ot_real:
  ------------------
  |  Branch (265:5): [True: 591, False: 118k]
  ------------------
  266|    591|        return QPDFObject::create<QPDF_Real>(std::get<QPDF_Real>(obj->value).val);
  267|  2.09k|    case ::ot_string:
  ------------------
  |  Branch (267:5): [True: 2.09k, False: 117k]
  ------------------
  268|  2.09k|        return QPDFObject::create<QPDF_String>(std::get<QPDF_String>(obj->value).val);
  269|   113k|    case ::ot_name:
  ------------------
  |  Branch (269:5): [True: 113k, False: 6.32k]
  ------------------
  270|   113k|        return QPDFObject::create<QPDF_Name>(std::get<QPDF_Name>(obj->value).name);
  271|    418|    case ::ot_array:
  ------------------
  |  Branch (271:5): [True: 418, False: 119k]
  ------------------
  272|    418|        {
  273|    418|            auto const& a = std::get<QPDF_Array>(obj->value);
  274|    418|            if (shallow) {
  ------------------
  |  Branch (274:17): [True: 0, False: 418]
  ------------------
  275|      0|                return QPDFObject::create<QPDF_Array>(a);
  276|    418|            } else {
  277|    418|                QTC::TC("qpdf", "QPDF_Array copy", a.sp ? 0 : 1);
  ------------------
  |  Branch (277:52): [True: 24, False: 394]
  ------------------
  278|    418|                if (a.sp) {
  ------------------
  |  Branch (278:21): [True: 24, False: 394]
  ------------------
  279|     24|                    QPDF_Array result;
  280|     24|                    result.sp = std::make_unique<QPDF_Array::Sparse>();
  281|     24|                    result.sp->size = a.sp->size;
  282|  4.82k|                    for (auto const& [idx, oh]: a.sp->elements) {
  ------------------
  |  Branch (282:47): [True: 4.82k, False: 24]
  ------------------
  283|  4.82k|                        result.sp->elements[idx] = oh.indirect() ? oh : oh.copy();
  ------------------
  |  Branch (283:52): [True: 102, False: 4.72k]
  ------------------
  284|  4.82k|                    }
  285|     24|                    return QPDFObject::create<QPDF_Array>(std::move(result));
  286|    394|                } else {
  287|    394|                    std::vector<QPDFObjectHandle> result;
  288|    394|                    result.reserve(a.elements.size());
  289|   113k|                    for (auto const& element: a.elements) {
  ------------------
  |  Branch (289:45): [True: 113k, False: 394]
  ------------------
  290|   113k|                        result.emplace_back(
  291|   113k|                            element ? (element.indirect() ? element : element.copy()) : element);
  ------------------
  |  Branch (291:29): [True: 113k, False: 0]
  |  Branch (291:40): [True: 1.54k, False: 112k]
  ------------------
  292|   113k|                    }
  293|    394|                    return QPDFObject::create<QPDF_Array>(std::move(result), false);
  294|    394|                }
  295|    418|            }
  296|    418|        }
  297|    722|    case ::ot_dictionary:
  ------------------
  |  Branch (297:5): [True: 722, False: 118k]
  ------------------
  298|    722|        {
  299|    722|            auto const& d = std::get<QPDF_Dictionary>(obj->value);
  300|    722|            if (shallow) {
  ------------------
  |  Branch (300:17): [True: 0, False: 722]
  ------------------
  301|      0|                return QPDFObject::create<QPDF_Dictionary>(d.items);
  302|    722|            } else {
  303|    722|                std::map<std::string, QPDFObjectHandle> new_items;
  304|  2.92k|                for (auto const& [key, val]: d.items) {
  ------------------
  |  Branch (304:44): [True: 2.92k, False: 722]
  ------------------
  305|  2.92k|                    new_items[key] = val.indirect() ? val : val.copy();
  ------------------
  |  Branch (305:38): [True: 510, False: 2.41k]
  ------------------
  306|  2.92k|                }
  307|    722|                return QPDFObject::create<QPDF_Dictionary>(new_items);
  308|    722|            }
  309|    722|        }
  310|      0|    case ::ot_stream:
  ------------------
  |  Branch (310:5): [True: 0, False: 119k]
  ------------------
  311|      0|        QTC::TC("qpdf", "QPDF_Stream ERR shallow copy stream");
  312|      0|        throw std::runtime_error("stream objects cannot be cloned");
  313|      0|        return {}; // does not return
  314|      0|    case ::ot_operator:
  ------------------
  |  Branch (314:5): [True: 0, False: 119k]
  ------------------
  315|      0|        return QPDFObject::create<QPDF_Operator>(std::get<QPDF_Operator>(obj->value).val);
  316|      0|    case ::ot_inlineimage:
  ------------------
  |  Branch (316:5): [True: 0, False: 119k]
  ------------------
  317|      0|        return QPDFObject::create<QPDF_InlineImage>(std::get<QPDF_InlineImage>(obj->value).val);
  318|      0|    case ::ot_unresolved:
  ------------------
  |  Branch (318:5): [True: 0, False: 119k]
  ------------------
  319|      0|        throw std::logic_error("QPDFObjectHandle: attempting to unparse a reserved object");
  320|      0|        return {}; // does not return
  321|      0|    case ::ot_destroyed:
  ------------------
  |  Branch (321:5): [True: 0, False: 119k]
  ------------------
  322|      0|        throw std::logic_error("attempted to shallow copy QPDFObjectHandle from destroyed QPDF");
  323|      0|        return {}; // does not return
  324|      0|    case ::ot_reference:
  ------------------
  |  Branch (324:5): [True: 0, False: 119k]
  ------------------
  325|      0|        return referenced_object().obj_sp();
  326|   119k|    }
  327|      0|    return {}; // unreachable
  328|   119k|}
_ZN4qpdf10BaseHandle10disconnectEb:
  692|  4.52M|{
  693|       |    // QPDF::~QPDF() calls disconnect for indirect objects, so we don't do that here.
  694|  4.52M|    if (only_direct && indirect()) {
  ------------------
  |  Branch (694:9): [True: 4.24M, False: 285k]
  |  Branch (694:24): [True: 102k, False: 4.14M]
  ------------------
  695|   102k|        return;
  696|   102k|    }
  697|       |
  698|  4.42M|    switch (raw_type_code()) {
  699|  54.1k|    case ::ot_array:
  ------------------
  |  Branch (699:5): [True: 54.1k, False: 4.37M]
  ------------------
  700|  54.1k|        {
  701|  54.1k|            auto& a = std::get<QPDF_Array>(obj->value);
  702|  54.1k|            if (a.sp) {
  ------------------
  |  Branch (702:17): [True: 228, False: 53.9k]
  ------------------
  703|  1.98M|                for (auto& item: a.sp->elements) {
  ------------------
  |  Branch (703:32): [True: 1.98M, False: 228]
  ------------------
  704|  1.98M|                    item.second.disconnect();
  705|  1.98M|                }
  706|  53.9k|            } else {
  707|  1.89M|                for (auto& oh: a.elements) {
  ------------------
  |  Branch (707:30): [True: 1.89M, False: 53.9k]
  ------------------
  708|  1.89M|                    oh.disconnect();
  709|  1.89M|                }
  710|  53.9k|            }
  711|  54.1k|        }
  712|  54.1k|        break;
  713|  95.0k|    case ::ot_dictionary:
  ------------------
  |  Branch (713:5): [True: 95.0k, False: 4.33M]
  ------------------
  714|   341k|        for (auto& iter: std::get<QPDF_Dictionary>(obj->value).items) {
  ------------------
  |  Branch (714:24): [True: 341k, False: 95.0k]
  ------------------
  715|   341k|            iter.second.disconnect();
  716|   341k|        }
  717|  95.0k|        break;
  718|  20.5k|    case ::ot_stream:
  ------------------
  |  Branch (718:5): [True: 20.5k, False: 4.40M]
  ------------------
  719|  20.5k|        {
  720|  20.5k|            auto& s = std::get<QPDF_Stream>(obj->value);
  721|  20.5k|            s.m->stream_provider = nullptr;
  722|  20.5k|            s.m->stream_dict.disconnect();
  723|  20.5k|        }
  724|  20.5k|        break;
  725|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (725:5): [True: 0, False: 4.42M]
  ------------------
  726|      0|        return;
  727|  4.25M|    default:
  ------------------
  |  Branch (727:5): [True: 4.25M, False: 169k]
  ------------------
  728|  4.25M|        break;
  729|  4.42M|    }
  730|  4.42M|    obj->qpdf = nullptr;
  731|  4.42M|    obj->og = QPDFObjGen();
  732|  4.42M|}
_ZNK16QPDFObjectHandle14isSameObjectAsERKS_:
  736|    198|{
  737|    198|    return obj == rhs.obj;
  738|    198|}
_ZNK4qpdf10BaseHandle9type_nameEv:
  748|  5.72k|{
  749|  5.72k|    static constexpr std::array<char const*, 16> tn{
  750|  5.72k|        "uninitialized",
  751|  5.72k|        "reserved",
  752|  5.72k|        "null",
  753|  5.72k|        "boolean",
  754|  5.72k|        "integer",
  755|  5.72k|        "real",
  756|  5.72k|        "string",
  757|  5.72k|        "name",
  758|  5.72k|        "array",
  759|  5.72k|        "dictionary",
  760|  5.72k|        "stream",
  761|  5.72k|        "operator",
  762|  5.72k|        "inline-image",
  763|  5.72k|        "unresolved",
  764|  5.72k|        "destroyed",
  765|  5.72k|        "reference"};
  766|  5.72k|    return tn[type_code()];
  767|  5.72k|}
_ZNK16QPDFObjectHandle6isBoolEv:
  783|  5.16k|{
  784|  5.16k|    return type_code() == ::ot_boolean;
  785|  5.16k|}
_ZNK16QPDFObjectHandle6isNullEv:
  797|  2.36k|{
  798|  2.36k|    return type_code() == ::ot_null;
  799|  2.36k|}
_ZNK16QPDFObjectHandle9isIntegerEv:
  803|   170k|{
  804|   170k|    return type_code() == ::ot_integer;
  805|   170k|}
_ZNK16QPDFObjectHandle6isRealEv:
  809|  16.7k|{
  810|  16.7k|    return type_code() == ::ot_real;
  811|  16.7k|}
_ZNK16QPDFObjectHandle8isNumberEv:
  815|  28.2k|{
  816|  28.2k|    return (isInteger() || isReal());
  ------------------
  |  Branch (816:13): [True: 11.9k, False: 16.3k]
  |  Branch (816:28): [True: 16.1k, False: 151]
  ------------------
  817|  28.2k|}
_ZNK16QPDFObjectHandle6isNameEv:
  845|  18.8k|{
  846|  18.8k|    return type_code() == ::ot_name;
  847|  18.8k|}
_ZNK16QPDFObjectHandle8isStringEv:
  851|  12.1k|{
  852|  12.1k|    return type_code() == ::ot_string;
  853|  12.1k|}
_ZNK16QPDFObjectHandle7isArrayEv:
  869|   148k|{
  870|   148k|    return type_code() == ::ot_array;
  871|   148k|}
_ZNK16QPDFObjectHandle12isDictionaryEv:
  875|   467k|{
  876|   467k|    return type_code() == ::ot_dictionary;
  877|   467k|}
_ZNK16QPDFObjectHandle8isScalarEv:
  893|  4.09k|{
  894|  4.09k|    return isBool() || isInteger() || isName() || isNull() || isReal() || isString();
  ------------------
  |  Branch (894:12): [True: 15, False: 4.08k]
  |  Branch (894:24): [True: 237, False: 3.84k]
  |  Branch (894:39): [True: 3.36k, False: 482]
  |  Branch (894:51): [True: 0, False: 482]
  |  Branch (894:63): [True: 88, False: 394]
  |  Branch (894:75): [True: 22, False: 372]
  ------------------
  895|  4.09k|}
_ZNK16QPDFObjectHandle15isNameAndEqualsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  899|  2.10k|{
  900|  2.10k|    return Name(*this) == name;
  901|  2.10k|}
_ZNK16QPDFObjectHandle18isDictionaryOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  905|   157k|{
  906|   157k|    return isDictionary() && (type.empty() || Name((*this)["/Type"]) == type) &&
  ------------------
  |  Branch (906:12): [True: 58.6k, False: 98.7k]
  |  Branch (906:31): [True: 0, False: 58.6k]
  |  Branch (906:47): [True: 10.7k, False: 47.9k]
  ------------------
  907|  10.7k|        (subtype.empty() || Name((*this)["/Subtype"]) == subtype);
  ------------------
  |  Branch (907:10): [True: 10.6k, False: 51]
  |  Branch (907:29): [True: 18, False: 33]
  ------------------
  908|   157k|}
_ZNK16QPDFObjectHandle14isStreamOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  912|  60.4k|{
  913|  60.4k|    if (auto stream = as_stream()) {
  ------------------
  |  Branch (913:14): [True: 26.5k, False: 33.9k]
  ------------------
  914|  26.5k|        return stream && (type.empty() || stream.Type() == type) &&
  ------------------
  |  Branch (914:16): [True: 26.5k, False: 0]
  |  Branch (914:27): [True: 0, False: 26.5k]
  |  Branch (914:43): [True: 17.2k, False: 9.32k]
  ------------------
  915|  17.1k|            (subtype.empty() || stream.Subtype() == subtype);
  ------------------
  |  Branch (915:14): [True: 17.1k, False: 0]
  |  Branch (915:33): [True: 0, False: 0]
  ------------------
  916|  26.5k|    }
  917|  33.9k|    return false;
  918|  60.4k|}
_ZNK16QPDFObjectHandle12getBoolValueEv:
  924|      3|{
  925|      3|    if (auto boolean = as<QPDF_Bool>()) {
  ------------------
  |  Branch (925:14): [True: 3, False: 0]
  ------------------
  926|      3|        return boolean->val;
  927|      3|    } else {
  928|      0|        typeWarning("boolean", "returning false");
  929|      0|        QTC::TC("qpdf", "QPDFObjectHandle boolean returning false");
  930|      0|        return false;
  931|      0|    }
  932|      3|}
_ZN4qpdf7IntegerC2Ex:
  947|  1.78k|    BaseHandle(QPDFObject::create<QPDF_Integer>(value))
  948|  1.78k|{
  949|  1.78k|}
_ZNK4qpdf7Integer5valueEv:
  959|   145k|{
  960|   145k|    auto* i = as<QPDF_Integer>();
  961|   145k|    if (!i) {
  ------------------
  |  Branch (961:9): [True: 1.53k, False: 143k]
  ------------------
  962|  1.53k|        throw invalid_error("Integer");
  963|  1.53k|    }
  964|   143k|    return i->val;
  965|   145k|}
_ZNK16QPDFObjectHandle11getIntValueEv:
  969|  56.8k|{
  970|  56.8k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (970:20): [True: 56.8k, False: 0]
  ------------------
  971|  56.8k|        return integer;
  972|  56.8k|    } else {
  973|      0|        typeWarning("integer", "returning 0");
  974|      0|        return 0;
  975|      0|    }
  976|  56.8k|}
_ZNK16QPDFObjectHandle13getValueAsIntERx:
  980|  9.04k|{
  981|  9.04k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (981:20): [True: 8.99k, False: 45]
  ------------------
  982|  8.99k|        value = integer;
  983|  8.99k|        return true;
  984|  8.99k|    }
  985|     45|    return false;
  986|  9.04k|}
_ZNK16QPDFObjectHandle16getIntValueAsIntEv:
  990|  51.9k|{
  991|  51.9k|    try {
  992|  51.9k|        return Integer(*this).value<int>();
  993|  51.9k|    } catch (std::invalid_argument&) {
  994|     29|        typeWarning("integer", "returning 0");
  995|     29|        return 0;
  996|     29|    }
  997|  51.9k|}
_ZNK16QPDFObjectHandle13getValueAsIntERi:
 1001|  2.54k|{
 1002|  2.54k|    if (!isInteger()) {
  ------------------
  |  Branch (1002:9): [True: 44, False: 2.50k]
  ------------------
 1003|     44|        return false;
 1004|     44|    }
 1005|  2.50k|    value = getIntValueAsInt();
 1006|  2.50k|    return true;
 1007|  2.54k|}
_ZNK16QPDFObjectHandle12getUIntValueEv:
 1011|  17.0k|{
 1012|  17.0k|    try {
 1013|  17.0k|        return Integer(*this).value<unsigned long long>();
 1014|  17.0k|    } catch (std::invalid_argument&) {
 1015|  1.07k|        typeWarning("integer", "returning 0");
 1016|  1.07k|        return 0;
 1017|  1.07k|    }
 1018|  17.0k|}
_ZNK16QPDFObjectHandle18getUIntValueAsUIntEv:
 1032|  10.2k|{
 1033|  10.2k|    try {
 1034|  10.2k|        return Integer(*this).value<unsigned int>();
 1035|  10.2k|    } catch (std::invalid_argument&) {
 1036|    427|        typeWarning("integer", "returning 0");
 1037|    427|        return 0;
 1038|    427|    }
 1039|  10.2k|}
_ZNK16QPDFObjectHandle14getValueAsUIntERj:
 1043|  3.08k|{
 1044|  3.08k|    if (!isInteger()) {
  ------------------
  |  Branch (1044:9): [True: 534, False: 2.55k]
  ------------------
 1045|    534|        return false;
 1046|    534|    }
 1047|  2.55k|    value = getUIntValueAsUInt();
 1048|  2.55k|    return true;
 1049|  3.08k|}
_ZN4qpdf4NameC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1087|  12.1k|    BaseHandle(QPDFObject::create<QPDF_Name>(std::move(name)))
 1088|  12.1k|{
 1089|  12.1k|}
_ZNK4qpdf4Name5valueEv:
 1093|  72.8k|{
 1094|  72.8k|    auto* n = as<QPDF_Name>();
 1095|  72.8k|    if (!n) {
  ------------------
  |  Branch (1095:9): [True: 0, False: 72.8k]
  ------------------
 1096|      0|        throw invalid_error("Name");
 1097|      0|    }
 1098|  72.8k|    return n->name;
 1099|  72.8k|}
_ZNK16QPDFObjectHandle7getNameEv:
 1103|  6.10k|{
 1104|  6.10k|    if (auto* name = as<QPDF_Name>()) {
  ------------------
  |  Branch (1104:15): [True: 6.10k, False: 0]
  ------------------
 1105|  6.10k|        return name->name;
 1106|  6.10k|    }
 1107|      0|    typeWarning("name", "returning dummy name");
 1108|      0|    return "/QPDFFakeName";
 1109|  6.10k|}
_ZN16QPDFObjectHandle9newStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1125|     28|{
 1126|     28|    return {QPDFObject::create<QPDF_String>(str)};
 1127|     28|}
_ZN16QPDFObjectHandle16newUnicodeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1131|  2.98k|{
 1132|  2.98k|    return {String::utf16(utf8_str).obj_sp()};
 1133|  2.98k|}
_ZN4qpdf6StringC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1136|  2.26k|    BaseHandle(QPDFObject::create<QPDF_String>(str))
 1137|  2.26k|{
 1138|  2.26k|}
_ZN4qpdf6StringC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1141|    712|    BaseHandle(QPDFObject::create<QPDF_String>(std::move(str)))
 1142|    712|{
 1143|    712|}
_ZN4qpdf6String5utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1147|  2.98k|{
 1148|  2.98k|    std::string result;
 1149|  2.98k|    if (QUtil::utf8_to_pdf_doc(utf8_str, result, '?')) {
  ------------------
  |  Branch (1149:9): [True: 2.26k, False: 712]
  ------------------
 1150|  2.26k|        return String(result);
 1151|  2.26k|    }
 1152|    712|    return String(QUtil::utf8_to_utf16(utf8_str));
 1153|  2.98k|}
_ZNK4qpdf6String5valueEv:
 1157|  4.04k|{
 1158|  4.04k|    auto* s = as<QPDF_String>();
 1159|  4.04k|    if (!s) {
  ------------------
  |  Branch (1159:9): [True: 0, False: 4.04k]
  ------------------
 1160|      0|        throw invalid_error("String");
 1161|      0|    }
 1162|  4.04k|    return s->val;
 1163|  4.04k|}
_ZNK4qpdf6String10utf8_valueEv:
 1167|   729k|{
 1168|   729k|    auto* s = as<QPDF_String>();
 1169|   729k|    if (!s) {
  ------------------
  |  Branch (1169:9): [True: 0, False: 729k]
  ------------------
 1170|      0|        throw invalid_error("String");
 1171|      0|    }
 1172|   729k|    if (util::is_utf16(s->val)) {
  ------------------
  |  Branch (1172:9): [True: 45.6k, False: 683k]
  ------------------
 1173|  45.6k|        return QUtil::utf16_to_utf8(s->val);
 1174|  45.6k|    }
 1175|   683k|    if (util::is_explicit_utf8(s->val)) {
  ------------------
  |  Branch (1175:9): [True: 4.74k, False: 678k]
  ------------------
 1176|       |        // PDF 2.0 allows UTF-8 strings when explicitly prefixed with the three-byte representation
 1177|       |        // of U+FEFF.
 1178|  4.74k|        return s->val.substr(3);
 1179|  4.74k|    }
 1180|   678k|    return QUtil::pdf_doc_to_utf8(s->val);
 1181|   683k|}
_ZNK16QPDFObjectHandle14getStringValueEv:
 1185|  4.04k|{
 1186|  4.04k|    try {
 1187|  4.04k|        return String(obj).value();
 1188|  4.04k|    } catch (std::invalid_argument&) {
 1189|      0|        typeWarning("string", "returning empty string");
 1190|      0|        return {};
 1191|      0|    }
 1192|  4.04k|}
_ZNK16QPDFObjectHandle12getUTF8ValueEv:
 1207|   729k|{
 1208|   729k|    try {
 1209|   729k|        return String(obj).utf8_value();
 1210|   729k|    } catch (std::invalid_argument&) {
 1211|      0|        typeWarning("string", "returning empty string");
 1212|      0|        return {};
 1213|      0|    }
 1214|   729k|}
_ZNK16QPDFObjectHandle11isOrHasNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1289|    504|{
 1290|    504|    if (isNameAndEquals(value)) {
  ------------------
  |  Branch (1290:9): [True: 0, False: 504]
  ------------------
 1291|      0|        return true;
 1292|    504|    } else if (isArray()) {
  ------------------
  |  Branch (1292:16): [True: 66, False: 438]
  ------------------
 1293|  1.44k|        for (auto& item: getArrayAsVector()) {
  ------------------
  |  Branch (1293:24): [True: 1.44k, False: 37]
  ------------------
 1294|  1.44k|            if (item.isNameAndEquals(value)) {
  ------------------
  |  Branch (1294:17): [True: 29, False: 1.41k]
  ------------------
 1295|     29|                return true;
 1296|     29|            }
 1297|  1.44k|        }
 1298|     66|    }
 1299|    475|    return false;
 1300|    504|}
_ZN16QPDFObjectHandle7newNullEv:
 1895|  20.4k|{
 1896|  20.4k|    return {QPDFObject::create<QPDF_Null>()};
 1897|  20.4k|}
_ZN16QPDFObjectHandle7newRealEdib:
 1907|  17.8k|{
 1908|  17.8k|    return {QPDFObject::create<QPDF_Real>(value, decimal_places, trim_trailing_zeroes)};
 1909|  17.8k|}
_ZN16QPDFObjectHandle8newArrayERKNSt3__16vectorIS_NS0_9allocatorIS_EEEE:
 1931|  4.46k|{
 1932|  4.46k|    return {QPDFObject::create<QPDF_Array>(items)};
 1933|  4.46k|}
_ZN16QPDFObjectHandle8newArrayERKNS_9RectangleE:
 1937|  4.46k|{
 1938|  4.46k|    return newArray({newReal(rect.llx), newReal(rect.lly), newReal(rect.urx), newReal(rect.ury)});
 1939|  4.46k|}
_ZN16QPDFObjectHandle13newDictionaryEv:
 1985|  5.90k|{
 1986|  5.90k|    return newDictionary(std::map<std::string, QPDFObjectHandle>());
 1987|  5.90k|}
_ZN16QPDFObjectHandle13newDictionaryERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S_EEEEEE:
 1991|  5.90k|{
 1992|  5.90k|    return {QPDFObject::create<QPDF_Dictionary>(items)};
 1993|  5.90k|}
_ZNK4qpdf10BaseHandle11descriptionEv:
 2036|  58.2k|{
 2037|  58.2k|    return obj ? obj->getDescription() : ""s;
  ------------------
  |  Branch (2037:12): [True: 58.2k, False: 0]
  ------------------
 2038|  58.2k|}
_ZNK16QPDFObjectHandle20hasObjectDescriptionEv:
 2051|  28.9k|{
 2052|  28.9k|    return obj && obj->hasDescription();
  ------------------
  |  Branch (2052:12): [True: 28.9k, False: 0]
  |  Branch (2052:19): [True: 28.9k, False: 0]
  ------------------
 2053|  28.9k|}
_ZN16QPDFObjectHandle11shallowCopyEv:
 2057|    187|{
 2058|    187|    if (!obj) {
  ------------------
  |  Branch (2058:9): [True: 0, False: 187]
  ------------------
 2059|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2060|      0|    }
 2061|    187|    return {copy()};
 2062|    187|}
_ZNK4qpdf10BaseHandle13invalid_errorERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2137|  1.53k|{
 2138|  1.53k|    return std::invalid_argument(method + " operation attempted on invalid object");
 2139|  1.53k|}
_ZNK4qpdf10BaseHandle10type_errorEPKcRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 2149|  5.72k|{
 2150|  5.72k|    return {
 2151|  5.72k|        qpdf_e_object,
 2152|  5.72k|        "",
 2153|  5.72k|        description(),
 2154|  5.72k|        0,
 2155|  5.72k|        "operation for "s + expected_type + " attempted on object of type " + type_name() + ": " +
 2156|  5.72k|            message};
 2157|  5.72k|}
_ZNK16QPDFObjectHandle11typeWarningEPKcRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2161|  5.72k|{
 2162|  5.72k|    if (!obj) {
  ------------------
  |  Branch (2162:9): [True: 0, False: 5.72k]
  ------------------
 2163|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 2164|      0|    }
 2165|  5.72k|    warn(type_error(expected_type, message));
 2166|  5.72k|}
_ZNK4qpdf10BaseHandle4warnEO7QPDFExc:
 2338|  58.2k|{
 2339|  58.2k|    if (!qpdf()) {
  ------------------
  |  Branch (2339:9): [True: 303, False: 57.9k]
  ------------------
 2340|    303|        throw std::move(e);
 2341|    303|    }
 2342|  57.9k|    qpdf()->warn(std::move(e));
 2343|  57.9k|}
_ZNK4qpdf10BaseHandle4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2347|  62.5k|{
 2348|  62.5k|    if (qpdf()) {
  ------------------
  |  Branch (2348:9): [True: 52.5k, False: 10.0k]
  ------------------
 2349|  52.5k|        warn({qpdf_e_damaged_pdf, "", description(), 0, warning});
 2350|  52.5k|    } else {
 2351|  10.0k|        *QPDFLogger::defaultLogger()->getError() << warning << "\n";
 2352|  10.0k|    }
 2353|  62.5k|}
_ZNK16QPDFObjectHandle9getObjGenEv:
 2522|  38.0k|{
 2523|  38.0k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (2523:12): [True: 38.0k, False: 0]
  ------------------
 2524|  38.0k|}
_ZNK16QPDFObjectHandle11getObjectIDEv:
 2528|  26.3k|{
 2529|  26.3k|    return getObjGen().getObj();
 2530|  26.3k|}
_ZNK16QPDFObjectHandle10isIndirectEv:
 2540|  20.7k|{
 2541|  20.7k|    return getObjectID() != 0;
 2542|  20.7k|}
_ZNK16QPDFObjectHandle13getOwningQPDFEv:
 2547|  62.3k|{
 2548|  62.3k|    return obj ? obj->getQPDF() : nullptr;
  ------------------
  |  Branch (2548:12): [True: 62.3k, False: 0]
  ------------------
 2549|  62.3k|}
_ZN16QPDFObjectHandle15setParsedOffsetEx:
 2562|     28|{
 2563|     28|    if (obj) {
  ------------------
  |  Branch (2563:9): [True: 28, False: 0]
  ------------------
 2564|     28|        obj->setParsedOffset(offset);
 2565|     28|    }
 2566|     28|}

_ZN16QPDFObjectHelperD2Ev:
    4|  38.9k|QPDFObjectHelper::~QPDFObjectHelper() = default;

_ZN25QPDFOutlineDocumentHelper8Accessor9checkSeenERS_10QPDFObjGen:
   23|  8.44k|{
   24|  8.44k|    return !dh.m->seen.add(og);
   25|  8.44k|}
_ZN25QPDFOutlineDocumentHelperC2ER4QPDF:
   28|  1.92k|    QPDFDocumentHelper(qpdf),
   29|  1.92k|    m(std::make_shared<Members>())
   30|  1.92k|{
   31|  1.92k|    validate();
   32|  1.92k|}
_ZN25QPDFOutlineDocumentHelper3getER4QPDF:
   36|  1.92k|{
   37|  1.92k|    return qpdf.doc().outlines();
   38|  1.92k|}
_ZN25QPDFOutlineDocumentHelper8validateEb:
   42|  1.92k|{
   43|  1.92k|    m->outlines.clear();
   44|  1.92k|    m->names_dest = nullptr;
   45|       |
   46|  1.92k|    QPDFObjectHandle root = qpdf.getRoot();
   47|  1.92k|    if (!root.hasKey("/Outlines")) {
  ------------------
  |  Branch (47:9): [True: 258, False: 1.66k]
  ------------------
   48|    258|        return;
   49|    258|    }
   50|  1.66k|    auto outlines = root.getKey("/Outlines");
   51|  1.66k|    if (!(outlines.isDictionary() && outlines.hasKey("/First"))) {
  ------------------
  |  Branch (51:9): [True: 15, False: 1.65k]
  |  Branch (51:11): [True: 1.66k, False: 3]
  |  Branch (51:38): [True: 1.65k, False: 12]
  ------------------
   52|     15|        return;
   53|     15|    }
   54|  1.65k|    QPDFObjectHandle cur = outlines.getKey("/First");
   55|  1.65k|    QPDFObjGen::set seen;
   56|  4.19k|    while (!cur.null()) {
  ------------------
  |  Branch (56:12): [True: 2.61k, False: 1.58k]
  ------------------
   57|  2.61k|        if (!seen.add(cur)) {
  ------------------
  |  Branch (57:13): [True: 68, False: 2.54k]
  ------------------
   58|     68|            cur.warn("Loop detected loop in /Outlines tree");
   59|     68|            return;
   60|     68|        }
   61|  2.54k|        m->outlines.emplace_back(QPDFOutlineObjectHelper::Accessor::create(cur, *this, 1));
   62|  2.54k|        cur = cur.getKey("/Next");
   63|  2.54k|    }
   64|  1.65k|}
_ZN25QPDFOutlineDocumentHelper19getTopLevelOutlinesEv:
   74|  1.92k|{
   75|  1.92k|    return m->outlines;
   76|  1.92k|}
_ZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandle:
  107|  3.65k|{
  108|  3.65k|    QPDFObjectHandle result;
  109|  3.65k|    if (name.isName()) {
  ------------------
  |  Branch (109:9): [True: 208, False: 3.45k]
  ------------------
  110|    208|        if (!m->dest_dict) {
  ------------------
  |  Branch (110:13): [True: 83, False: 125]
  ------------------
  111|     83|            m->dest_dict = qpdf.getRoot().getKey("/Dests");
  112|     83|        }
  113|    208|        result = m->dest_dict.getKeyIfDict(name.getName());
  114|  3.45k|    } else if (name.isString()) {
  ------------------
  |  Branch (114:16): [True: 3.45k, False: 0]
  ------------------
  115|  3.45k|        if (!m->names_dest) {
  ------------------
  |  Branch (115:13): [True: 1.67k, False: 1.77k]
  ------------------
  116|  1.67k|            auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests");
  117|  1.67k|            if (dests.isDictionary()) {
  ------------------
  |  Branch (117:17): [True: 1.38k, False: 285]
  ------------------
  118|  1.38k|                m->names_dest = std::make_unique<QPDFNameTreeObjectHelper>(
  119|  1.38k|                    dests,
  120|  1.38k|                    qpdf,
  121|  1.38k|                    [](QPDFObjectHandle const& o) -> bool {
  122|  1.38k|                        return o.isArray() || o.contains("/D");
  123|  1.38k|                    },
  124|  1.38k|                    true);
  125|  1.38k|                m->names_dest->validate();
  126|  1.38k|            }
  127|  1.67k|        }
  128|  3.45k|        if (m->names_dest) {
  ------------------
  |  Branch (128:13): [True: 2.98k, False: 470]
  ------------------
  129|  2.98k|            if (m->names_dest->findObject(name.getUTF8Value(), result)) {
  ------------------
  |  Branch (129:17): [True: 526, False: 2.45k]
  ------------------
  130|    526|                QTC::TC("qpdf", "QPDFOutlineDocumentHelper string named dest");
  131|    526|            }
  132|  2.98k|        }
  133|  3.45k|    }
  134|  3.65k|    if (!result) {
  ------------------
  |  Branch (134:9): [True: 2.69k, False: 964]
  ------------------
  135|  2.69k|        return QPDFObjectHandle::newNull();
  136|  2.69k|    }
  137|    964|    if (result.isDictionary()) {
  ------------------
  |  Branch (137:9): [True: 300, False: 664]
  ------------------
  138|    300|        return result.getKey("/D");
  139|    300|    }
  140|    664|    return result;
  141|    964|}
_ZN25QPDFOutlineDocumentHelper7MembersC2Ev:
   10|  1.92k|    Members() = default;
_ZN25QPDFOutlineDocumentHelper7MembersD2Ev:
   12|  1.92k|    ~Members() = default;
QPDFOutlineDocumentHelper.cc:_ZZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandleENK3$_0clERKS0_:
  121|   136k|                    [](QPDFObjectHandle const& o) -> bool {
  122|   136k|                        return o.isArray() || o.contains("/D");
  ------------------
  |  Branch (122:32): [True: 129k, False: 6.27k]
  |  Branch (122:47): [True: 5.04k, False: 1.22k]
  ------------------
  123|   136k|                    },

_ZN23QPDFOutlineObjectHelper7MembersC2ER25QPDFOutlineDocumentHelper:
    8|  8.44k|    dh(dh)
    9|  8.44k|{
   10|  8.44k|}
_ZN23QPDFOutlineObjectHelperC2E16QPDFObjectHandleR25QPDFOutlineDocumentHelperi:
   14|  8.44k|    QPDFObjectHelper(a_oh),
   15|  8.44k|    m(new Members(dh))
   16|  8.44k|{
   17|  8.44k|    if (depth > 50) {
  ------------------
  |  Branch (17:9): [True: 0, False: 8.44k]
  ------------------
   18|       |        // Not exercised in test suite, but was tested manually by temporarily changing max depth
   19|       |        // to 1.
   20|      0|        return;
   21|      0|    }
   22|  8.44k|    if (QPDFOutlineDocumentHelper::Accessor::checkSeen(m->dh, a_oh.getObjGen())) {
  ------------------
  |  Branch (22:9): [True: 4.83k, False: 3.60k]
  ------------------
   23|  4.83k|        a_oh.warn("Loop detected loop in /Outlines tree");
   24|  4.83k|        return;
   25|  4.83k|    }
   26|       |
   27|  3.60k|    QPDFObjGen::set children;
   28|  3.60k|    QPDFObjectHandle cur = a_oh.getKey("/First");
   29|  9.49k|    while (!cur.null() && cur.isIndirect()) {
  ------------------
  |  Branch (29:12): [True: 6.26k, False: 3.23k]
  |  Branch (29:27): [True: 6.18k, False: 78]
  ------------------
   30|  6.18k|        if (!children.add(cur)) {
  ------------------
  |  Branch (30:13): [True: 294, False: 5.89k]
  ------------------
   31|    294|            cur.warn("Loop detected loop in /Outlines tree");
   32|    294|            break;
   33|    294|        }
   34|  5.89k|        QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth);
   35|  5.89k|        new_ooh.m->parent = std::make_shared<QPDFOutlineObjectHelper>(*this);
   36|  5.89k|        m->kids.emplace_back(new_ooh);
   37|  5.89k|        cur = cur.getKey("/Next");
   38|  5.89k|    }
   39|  3.60k|}
_ZN23QPDFOutlineObjectHelper7getKidsEv:
   49|  8.13k|{
   50|  8.13k|    return m->kids;
   51|  8.13k|}
_ZN23QPDFOutlineObjectHelper7getDestEv:
   55|  8.36k|{
   56|  8.36k|    auto dest = get("/Dest");
   57|  8.36k|    if (dest.null()) {
  ------------------
  |  Branch (57:9): [True: 7.07k, False: 1.28k]
  ------------------
   58|  7.07k|        auto const& A = get("/A");
   59|  7.07k|        if (Name(A["/S"]) == "/GoTo") {
  ------------------
  |  Branch (59:13): [True: 3.08k, False: 3.99k]
  ------------------
   60|  3.08k|            dest = A["/D"];
   61|  3.08k|        }
   62|  7.07k|    }
   63|  8.36k|    if (dest.null()) {
  ------------------
  |  Branch (63:9): [True: 4.05k, False: 4.30k]
  ------------------
   64|  4.05k|        return QPDFObjectHandle::newNull();
   65|  4.05k|    }
   66|  4.30k|    if (dest.isName() || dest.isString()) {
  ------------------
  |  Branch (66:9): [True: 208, False: 4.10k]
  |  Branch (66:26): [True: 3.45k, False: 649]
  ------------------
   67|  3.65k|        return m->dh.resolveNamedDest(dest);
   68|  3.65k|    }
   69|    649|    return dest;
   70|  4.30k|}
_ZN23QPDFOutlineObjectHelper11getDestPageEv:
   74|  8.36k|{
   75|  8.36k|    QPDFObjectHandle dest = getDest();
   76|  8.36k|    if (!dest.empty() && dest.isArray()) {
  ------------------
  |  Branch (76:9): [True: 1.17k, False: 7.18k]
  |  Branch (76:26): [True: 778, False: 397]
  ------------------
   77|    778|        return dest.getArrayItem(0);
   78|    778|    }
   79|  7.58k|    return QPDFObjectHandle::newNull();
   80|  8.36k|}

_ZN4qpdf4impl6Parser5parseER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERNS_9TokenizerEPN16QPDFObjectHandle15StringDecrypterER4QPDFb:
  129|   109k|{
  130|   109k|    return Parser(
  131|   109k|               input,
  132|   109k|               make_description(input.getName(), object_description),
  133|   109k|               object_description,
  134|   109k|               tokenizer,
  135|   109k|               decrypter,
  136|   109k|               &context,
  137|   109k|               true,
  138|   109k|               0,
  139|   109k|               0,
  140|   109k|               sanity_checks)
  141|   109k|        .parse();
  142|   109k|}
_ZN4qpdf4impl6Parser5parseERNS_2is12OffsetBufferEiiRNS_9TokenizerER4QPDF:
  147|  24.7k|{
  148|  24.7k|    return Parser(
  149|  24.7k|               input,
  150|  24.7k|               std::make_shared<QPDFObject::Description>(
  151|  24.7k|                   QPDFObject::ObjStreamDescr(stream_id, obj_id)),
  152|  24.7k|               "",
  153|  24.7k|               tokenizer,
  154|  24.7k|               nullptr,
  155|  24.7k|               &context,
  156|  24.7k|               true,
  157|  24.7k|               stream_id,
  158|  24.7k|               obj_id)
  159|  24.7k|        .parse();
  160|  24.7k|}
_ZN4qpdf4impl6Parser5parseEb:
  164|   134k|{
  165|   134k|    try {
  166|   134k|        return parse_first(content_stream);
  167|   134k|    } catch (Error&) {
  168|  8.63k|        return {};
  169|  8.63k|    } catch (QPDFExc& e) {
  170|  3.40k|        throw e;
  171|  3.40k|    } catch (std::logic_error& e) {
  172|      1|        throw e;
  173|  1.28k|    } catch (std::exception& e) {
  174|  1.28k|        warn("treating object as null because of error during parsing: "s + e.what());
  175|  1.28k|        return {};
  176|  1.28k|    }
  177|   134k|}
_ZN4qpdf4impl6Parser11parse_firstEb:
  181|   134k|{
  182|       |    // This method must take care not to resolve any objects. Don't check the type of any object
  183|       |    // without first ensuring that it is a direct object. Otherwise, doing so may have the side
  184|       |    // effect of reading the object and changing the file pointer. If you do this, it will cause a
  185|       |    // logic error to be thrown from QPDF::inParse().
  186|       |
  187|   134k|    QPDF::Doc::ParseGuard pg(context_);
  188|   134k|    start_ = input_.tell();
  189|   134k|    if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (189:9): [True: 1.57k, False: 132k]
  ------------------
  190|  1.57k|        warn(tokenizer_.getErrorMessage());
  191|  1.57k|    }
  192|       |
  193|   134k|    switch (tokenizer_.getType()) {
  194|    518|    case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (194:5): [True: 518, False: 133k]
  ------------------
  195|    518|        if (content_stream) {
  ------------------
  |  Branch (195:13): [True: 0, False: 518]
  ------------------
  196|       |            // In content stream mode, leave object uninitialized to indicate EOF
  197|      0|            empty_ = true;
  198|      0|            return {};
  199|      0|        }
  200|    518|        warn("unexpected EOF");
  201|    518|        return {};
  202|       |
  203|  1.45k|    case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (203:5): [True: 1.45k, False: 132k]
  ------------------
  204|  1.45k|        return {};
  205|       |
  206|    166|    case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (206:5): [True: 166, False: 134k]
  ------------------
  207|    279|    case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (207:5): [True: 113, False: 134k]
  ------------------
  208|    279|        warn("treating unexpected brace token as null");
  209|    279|        return {};
  210|       |
  211|    456|    case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (211:5): [True: 456, False: 133k]
  ------------------
  212|    456|        warn("treating unexpected array close token as null");
  213|    456|        return {};
  214|       |
  215|    295|    case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (215:5): [True: 295, False: 134k]
  ------------------
  216|    295|        warn("unexpected dictionary close token");
  217|    295|        return {};
  218|       |
  219|  10.8k|    case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (219:5): [True: 10.8k, False: 123k]
  ------------------
  220|   108k|    case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (220:5): [True: 97.8k, False: 36.4k]
  ------------------
  221|   108k|        stack_.clear();
  222|   108k|        stack_.emplace_back(
  223|   108k|            input_,
  224|   108k|            (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array : st_dictionary_key);
  ------------------
  |  Branch (224:13): [True: 10.8k, False: 97.8k]
  ------------------
  225|   108k|        frame_ = &stack_.back();
  226|   108k|        return parse_remainder(content_stream);
  227|       |
  228|    467|    case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (228:5): [True: 467, False: 133k]
  ------------------
  229|    467|        return with_description<QPDF_Bool>(tokenizer_.getValue() == "true");
  230|       |
  231|    205|    case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (231:5): [True: 205, False: 134k]
  ------------------
  232|    205|        return {QPDFObject::create<QPDF_Null>()};
  233|       |
  234|  9.32k|    case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (234:5): [True: 9.32k, False: 124k]
  ------------------
  235|  9.32k|        return with_description<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  236|       |
  237|  1.89k|    case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (237:5): [True: 1.89k, False: 132k]
  ------------------
  238|  1.89k|        return with_description<QPDF_Real>(tokenizer_.getValue());
  239|       |
  240|  1.69k|    case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (240:5): [True: 1.69k, False: 132k]
  ------------------
  241|  1.69k|        return with_description<QPDF_Name>(tokenizer_.getValue());
  242|       |
  243|  8.39k|    case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (243:5): [True: 8.39k, False: 125k]
  ------------------
  244|  8.39k|        {
  245|  8.39k|            auto const& value = tokenizer_.getValue();
  246|  8.39k|            if (content_stream) {
  ------------------
  |  Branch (246:17): [True: 0, False: 8.39k]
  ------------------
  247|      0|                return with_description<QPDF_Operator>(value);
  248|  8.39k|            } else if (value == "endobj") {
  ------------------
  |  Branch (248:24): [True: 320, False: 8.07k]
  ------------------
  249|       |                // We just saw endobj without having read anything. Nothing in the PDF spec appears
  250|       |                // to allow empty objects, but they have been encountered in actual PDF files and
  251|       |                // Adobe Reader appears to ignore them. Treat this as a null and do not move the
  252|       |                // input source's offset.
  253|    320|                empty_ = true;
  254|    320|                input_.seek(input_.getLastOffset(), SEEK_SET);
  255|    320|                if (!content_stream) {
  ------------------
  |  Branch (255:21): [True: 320, False: 0]
  ------------------
  256|    320|                    warn("empty object treated as null");
  257|    320|                }
  258|    320|                return {};
  259|  8.07k|            } else {
  260|  8.07k|                warn("unknown token while reading object; treating as string");
  261|  8.07k|                return with_description<QPDF_String>(value);
  262|  8.07k|            }
  263|  8.39k|        }
  264|       |
  265|    528|    case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (265:5): [True: 528, False: 133k]
  ------------------
  266|    528|        if (decrypter_) {
  ------------------
  |  Branch (266:13): [True: 121, False: 407]
  ------------------
  267|    121|            std::string s{tokenizer_.getValue()};
  268|    121|            decrypter_->decryptString(s);
  269|    121|            return with_description<QPDF_String>(s);
  270|    407|        } else {
  271|    407|            return with_description<QPDF_String>(tokenizer_.getValue());
  272|    407|        }
  273|       |
  274|      0|    default:
  ------------------
  |  Branch (274:5): [True: 0, False: 134k]
  ------------------
  275|      0|        warn("treating unknown token type as null while reading object");
  276|      0|        return {};
  277|   134k|    }
  278|   134k|}
_ZN4qpdf4impl6Parser15parse_remainderEb:
  282|   108k|{
  283|       |    // This method must take care not to resolve any objects. Don't check the type of any object
  284|       |    // without first ensuring that it is a direct object. Otherwise, doing so may have the side
  285|       |    // effect of reading the object and changing the file pointer. If you do this, it will cause a
  286|       |    // logic error to be thrown from QPDF::inParse().
  287|       |
  288|   108k|    bad_count_ = 0;
  289|   108k|    bool b_contents = false;
  290|       |
  291|  17.9M|    while (true) {
  ------------------
  |  Branch (291:12): [True: 17.9M, Folded]
  ------------------
  292|  17.9M|        if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (292:13): [True: 37.4k, False: 17.9M]
  ------------------
  293|  37.4k|            warn(tokenizer_.getErrorMessage());
  294|  37.4k|        }
  295|  17.9M|        ++good_count_; // optimistically
  296|       |
  297|  17.9M|        if (int_count_ != 0) {
  ------------------
  |  Branch (297:13): [True: 7.44M, False: 10.5M]
  ------------------
  298|       |            // Special handling of indirect references. Treat integer tokens as part of an indirect
  299|       |            // reference until proven otherwise.
  300|  7.44M|            if (tokenizer_.getType() == QPDFTokenizer::tt_integer) {
  ------------------
  |  Branch (300:17): [True: 6.99M, False: 450k]
  ------------------
  301|  6.99M|                if (++int_count_ > 2) {
  ------------------
  |  Branch (301:21): [True: 6.66M, False: 322k]
  ------------------
  302|       |                    // Process the oldest buffered integer.
  303|  6.66M|                    add_int(int_count_);
  304|  6.66M|                }
  305|  6.99M|                last_offset_buffer_[int_count_ % 2] = input_.getLastOffset();
  306|  6.99M|                int_buffer_[int_count_ % 2] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  307|  6.99M|                continue;
  308|       |
  309|  6.99M|            } else if (
  310|   450k|                int_count_ >= 2 && tokenizer_.getType() == QPDFTokenizer::tt_word &&
  ------------------
  |  Branch (310:17): [True: 321k, False: 128k]
  |  Branch (310:36): [True: 283k, False: 38.7k]
  ------------------
  311|   283k|                tokenizer_.getValue() == "R") {
  ------------------
  |  Branch (311:17): [True: 268k, False: 14.8k]
  ------------------
  312|   268k|                if (!context_) {
  ------------------
  |  Branch (312:21): [True: 0, False: 268k]
  ------------------
  313|      0|                    throw std::logic_error(
  314|      0|                        "Parser::parse called without context on an object with indirect "
  315|      0|                        "references");
  316|      0|                }
  317|   268k|                auto id = QIntC::to_int(int_buffer_[(int_count_ - 1) % 2]);
  318|   268k|                auto gen = QIntC::to_int(int_buffer_[(int_count_) % 2]);
  319|   268k|                if (!(id < 1 || gen < 0 || gen >= 65535)) {
  ------------------
  |  Branch (319:23): [True: 2.00k, False: 266k]
  |  Branch (319:33): [True: 420, False: 265k]
  |  Branch (319:44): [True: 393, False: 265k]
  ------------------
  320|   265k|                    add(ParseGuard::getObject(context_, id, gen, parse_pdf_));
  321|   265k|                } else {
  322|  2.82k|                    add_bad_null(
  323|  2.82k|                        "treating bad indirect reference (" + std::to_string(id) + " " +
  324|  2.82k|                        std::to_string(gen) + " R) as null");
  325|  2.82k|                }
  326|   268k|                int_count_ = 0;
  327|   268k|                continue;
  328|       |
  329|   268k|            } else if (int_count_ > 0) {
  ------------------
  |  Branch (329:24): [True: 182k, False: 0]
  ------------------
  330|       |                // Process the buffered integers before processing the current token.
  331|   182k|                if (int_count_ > 1) {
  ------------------
  |  Branch (331:21): [True: 53.5k, False: 128k]
  ------------------
  332|  53.5k|                    add_int(int_count_ - 1);
  333|  53.5k|                }
  334|   182k|                add_int(int_count_);
  335|   182k|                int_count_ = 0;
  336|   182k|            }
  337|  7.44M|        }
  338|       |
  339|  10.6M|        switch (tokenizer_.getType()) {
  340|  7.34k|        case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (340:9): [True: 7.34k, False: 10.6M]
  ------------------
  341|  7.34k|            warn("parse error while reading object");
  342|  7.34k|            if (content_stream) {
  ------------------
  |  Branch (342:17): [True: 0, False: 7.34k]
  ------------------
  343|       |                // In content stream mode, leave object uninitialized to indicate EOF
  344|      0|                return {};
  345|      0|            }
  346|  7.34k|            warn("unexpected EOF");
  347|  7.34k|            return {};
  348|       |
  349|  29.9k|        case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (349:9): [True: 29.9k, False: 10.6M]
  ------------------
  350|  29.9k|            check_too_many_bad_tokens();
  351|  29.9k|            add_null();
  352|  29.9k|            continue;
  353|       |
  354|  1.66k|        case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (354:9): [True: 1.66k, False: 10.6M]
  ------------------
  355|  4.02k|        case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (355:9): [True: 2.36k, False: 10.6M]
  ------------------
  356|  4.02k|            add_bad_null("treating unexpected brace token as null");
  357|  4.02k|            continue;
  358|       |
  359|  76.6k|        case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (359:9): [True: 76.6k, False: 10.6M]
  ------------------
  360|  76.6k|            if (frame_->state == st_array) {
  ------------------
  |  Branch (360:17): [True: 74.4k, False: 2.21k]
  ------------------
  361|  74.4k|                auto object = frame_->null_count > 100
  ------------------
  |  Branch (361:31): [True: 600, False: 73.8k]
  ------------------
  362|  74.4k|                    ? QPDFObject::create<QPDF_Array>(std::move(frame_->olist), true)
  363|  74.4k|                    : QPDFObject::create<QPDF_Array>(std::move(frame_->olist));
  364|  74.4k|                set_description(object, frame_->offset - 1);
  365|       |                // The `offset` points to the next of "[".  Set the rewind offset to point to the
  366|       |                // beginning of "[". This has been explicitly tested with whitespace surrounding the
  367|       |                // array start delimiter. getLastOffset points to the array end token and therefore
  368|       |                // can't be used here.
  369|  74.4k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (369:21): [True: 2.11k, False: 72.3k]
  ------------------
  370|  2.11k|                    return object;
  371|  2.11k|                }
  372|  72.3k|                stack_.pop_back();
  373|  72.3k|                frame_ = &stack_.back();
  374|  72.3k|                add(std::move(object));
  375|  72.3k|            } else {
  376|  2.21k|                if (sanity_checks_) {
  ------------------
  |  Branch (376:21): [True: 1.50k, False: 717]
  ------------------
  377|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  378|       |                    // unusable.
  379|  1.50k|                    warn("unexpected array close token; giving up on reading object");
  380|  1.50k|                    return {};
  381|  1.50k|                }
  382|    717|                add_bad_null("treating unexpected array close token as null");
  383|    717|            }
  384|  73.0k|            continue;
  385|       |
  386|   129k|        case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (386:9): [True: 129k, False: 10.5M]
  ------------------
  387|   129k|            if (frame_->state <= st_dictionary_value) {
  ------------------
  |  Branch (387:17): [True: 128k, False: 1.11k]
  ------------------
  388|       |                // Attempt to recover more or less gracefully from invalid dictionaries.
  389|   128k|                auto& dict = frame_->dict;
  390|       |
  391|   128k|                if (frame_->state == st_dictionary_value) {
  ------------------
  |  Branch (391:21): [True: 9.25k, False: 119k]
  ------------------
  392|  9.25k|                    warn(
  393|  9.25k|                        frame_->offset,
  394|  9.25k|                        "dictionary ended prematurely; using null as value for last key");
  395|  9.25k|                    dict[frame_->key] = QPDFObject::create<QPDF_Null>();
  396|  9.25k|                }
  397|   128k|                if (!frame_->olist.empty()) {
  ------------------
  |  Branch (397:21): [True: 37.2k, False: 91.2k]
  ------------------
  398|  37.2k|                    if (sanity_checks_) {
  ------------------
  |  Branch (398:25): [True: 33.5k, False: 3.71k]
  ------------------
  399|  33.5k|                        warn(
  400|  33.5k|                            frame_->offset,
  401|  33.5k|                            "expected dictionary keys but found non-name objects; ignoring");
  402|  33.5k|                    } else {
  403|  3.71k|                        fix_missing_keys();
  404|  3.71k|                    }
  405|  37.2k|                }
  406|       |
  407|   128k|                if (!frame_->contents_string.empty() && dict.contains("/Type") &&
  ------------------
  |  Branch (407:21): [True: 287, False: 128k]
  |  Branch (407:21): [True: 28, False: 128k]
  |  Branch (407:57): [True: 157, False: 130]
  ------------------
  408|    157|                    dict["/Type"].isNameAndEquals("/Sig") && dict.contains("/ByteRange") &&
  ------------------
  |  Branch (408:21): [True: 58, False: 99]
  |  Branch (408:62): [True: 38, False: 20]
  ------------------
  409|     38|                    dict.contains("/Contents") && dict["/Contents"].isString()) {
  ------------------
  |  Branch (409:21): [True: 28, False: 10]
  |  Branch (409:51): [True: 28, False: 0]
  ------------------
  410|     28|                    dict["/Contents"] = QPDFObjectHandle::newString(frame_->contents_string);
  411|     28|                    dict["/Contents"].setParsedOffset(frame_->contents_offset);
  412|     28|                }
  413|   128k|                auto object = QPDFObject::create<QPDF_Dictionary>(std::move(dict));
  414|   128k|                set_description(object, frame_->offset - 2);
  415|       |                // The `offset` points to the next of "<<". Set the rewind offset to point to the
  416|       |                // beginning of "<<". This has been explicitly tested with whitespace surrounding
  417|       |                // the dictionary start delimiter. getLastOffset points to the dictionary end token
  418|       |                // and therefore can't be used here.
  419|   128k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (419:21): [True: 84.1k, False: 44.3k]
  ------------------
  420|  84.1k|                    return object;
  421|  84.1k|                }
  422|  44.3k|                stack_.pop_back();
  423|  44.3k|                frame_ = &stack_.back();
  424|  44.3k|                add(std::move(object));
  425|  44.3k|            } else {
  426|  1.11k|                if (sanity_checks_) {
  ------------------
  |  Branch (426:21): [True: 667, False: 452]
  ------------------
  427|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  428|       |                    // unusable.
  429|    667|                    warn("unexpected dictionary close token; giving up on reading object");
  430|    667|                    return {};
  431|    667|                }
  432|    452|                add_bad_null("unexpected dictionary close token");
  433|    452|            }
  434|  44.8k|            continue;
  435|       |
  436|   154k|        case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (436:9): [True: 154k, False: 10.5M]
  ------------------
  437|   223k|        case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (437:9): [True: 69.4k, False: 10.6M]
  ------------------
  438|   223k|            if (stack_.size() > max_nesting) {
  ------------------
  |  Branch (438:17): [True: 84, False: 223k]
  ------------------
  439|     84|                limits_error(
  440|     84|                    "parser-max-nesting", "ignoring excessively deeply nested data structure");
  441|     84|            }
  442|   223k|            b_contents = false;
  443|   223k|            stack_.emplace_back(
  444|   223k|                input_,
  445|   223k|                (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array
  ------------------
  |  Branch (445:17): [True: 154k, False: 69.5k]
  ------------------
  446|   223k|                                                                       : st_dictionary_key);
  447|   223k|            frame_ = &stack_.back();
  448|   223k|            continue;
  449|       |
  450|  8.49k|        case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (450:9): [True: 8.49k, False: 10.6M]
  ------------------
  451|  8.49k|            add_scalar<QPDF_Bool>(tokenizer_.getValue() == "true");
  452|  8.49k|            continue;
  453|       |
  454|  70.0k|        case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (454:9): [True: 70.0k, False: 10.6M]
  ------------------
  455|  70.0k|            add_null();
  456|  70.0k|            continue;
  457|       |
  458|   450k|        case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (458:9): [True: 450k, False: 10.2M]
  ------------------
  459|   450k|            if (!content_stream) {
  ------------------
  |  Branch (459:17): [True: 450k, False: 0]
  ------------------
  460|       |                // Buffer token in case it is part of an indirect reference.
  461|   450k|                last_offset_buffer_[1] = input_.getLastOffset();
  462|   450k|                int_buffer_[1] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  463|   450k|                int_count_ = 1;
  464|   450k|            } else {
  465|      0|                add_scalar<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  466|      0|            }
  467|   450k|            continue;
  468|       |
  469|  59.5k|        case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (469:9): [True: 59.5k, False: 10.6M]
  ------------------
  470|  59.5k|            add_scalar<QPDF_Real>(tokenizer_.getValue());
  471|  59.5k|            continue;
  472|       |
  473|  9.33M|        case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (473:9): [True: 9.33M, False: 1.35M]
  ------------------
  474|  9.33M|            if (frame_->state == st_dictionary_key) {
  ------------------
  |  Branch (474:17): [True: 472k, False: 8.86M]
  ------------------
  475|   472k|                frame_->key = tokenizer_.getValue();
  476|   472k|                frame_->state = st_dictionary_value;
  477|   472k|                b_contents = decrypter_ && frame_->key == "/Contents";
  ------------------
  |  Branch (477:30): [True: 24.3k, False: 447k]
  |  Branch (477:44): [True: 668, False: 23.6k]
  ------------------
  478|   472k|                continue;
  479|  8.86M|            } else {
  480|  8.86M|                add_scalar<QPDF_Name>(tokenizer_.getValue());
  481|  8.86M|            }
  482|  8.86M|            continue;
  483|       |
  484|  8.86M|        case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (484:9): [True: 161k, False: 10.5M]
  ------------------
  485|   161k|            if (content_stream) {
  ------------------
  |  Branch (485:17): [True: 0, False: 161k]
  ------------------
  486|      0|                add_scalar<QPDF_Operator>(tokenizer_.getValue());
  487|      0|                continue;
  488|      0|            }
  489|       |
  490|   161k|            if (sanity_checks_) {
  ------------------
  |  Branch (490:17): [True: 152k, False: 9.00k]
  ------------------
  491|   152k|                if (tokenizer_.getValue() == "endobj" || tokenizer_.getValue() == "endstream") {
  ------------------
  |  Branch (491:21): [True: 984, False: 151k]
  |  Branch (491:58): [True: 338, False: 151k]
  ------------------
  492|       |                    // During sanity checks, assume an unexpected endobj or endstream indicates that
  493|       |                    // we are parsing past the end of the object.
  494|  1.32k|                    warn(
  495|  1.32k|                        "unexpected 'endobj' or 'endstream' while reading object; giving up on "
  496|  1.32k|                        "reading object");
  497|  1.32k|                    return {};
  498|  1.32k|                }
  499|       |
  500|   151k|                add_bad_null("unknown token while reading object; treating as null");
  501|   151k|                continue;
  502|   152k|            }
  503|       |
  504|  9.00k|            warn("unknown token while reading object; treating as string");
  505|  9.00k|            check_too_many_bad_tokens();
  506|  9.00k|            add_scalar<QPDF_String>(tokenizer_.getValue());
  507|       |
  508|  9.00k|            continue;
  509|       |
  510|   135k|        case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (510:9): [True: 135k, False: 10.5M]
  ------------------
  511|   135k|            {
  512|   135k|                auto const& val = tokenizer_.getValue();
  513|   135k|                if (decrypter_) {
  ------------------
  |  Branch (513:21): [True: 15.9k, False: 119k]
  ------------------
  514|  15.9k|                    if (b_contents) {
  ------------------
  |  Branch (514:25): [True: 612, False: 15.3k]
  ------------------
  515|    612|                        frame_->contents_string = val;
  516|    612|                        frame_->contents_offset = input_.getLastOffset();
  517|    612|                        b_contents = false;
  518|    612|                    }
  519|  15.9k|                    std::string s{val};
  520|  15.9k|                    decrypter_->decryptString(s);
  521|  15.9k|                    add_scalar<QPDF_String>(s);
  522|   119k|                } else {
  523|   119k|                    add_scalar<QPDF_String>(val);
  524|   119k|                }
  525|   135k|            }
  526|   135k|            continue;
  527|       |
  528|      0|        default:
  ------------------
  |  Branch (528:9): [True: 0, False: 10.6M]
  ------------------
  529|      0|            add_bad_null("treating unknown token type as null while reading object");
  530|  10.6M|        }
  531|  10.6M|    }
  532|   108k|}
_ZN4qpdf4impl6Parser3addEONSt3__110shared_ptrI10QPDFObjectEE:
  536|  16.3M|{
  537|  16.3M|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (537:9): [True: 15.9M, False: 431k]
  ------------------
  538|       |        // If state is st_dictionary_key then there is a missing key. Push onto olist for
  539|       |        // processing once the tt_dict_close token has been found.
  540|  15.9M|        frame_->olist.emplace_back(std::move(obj));
  541|  15.9M|    } else {
  542|   431k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, std::move(obj)); !res.second) {
  ------------------
  |  Branch (542:84): [True: 7.00k, False: 424k]
  ------------------
  543|  7.00k|            warn_duplicate_key();
  544|  7.00k|        }
  545|   431k|        frame_->state = st_dictionary_key;
  546|   431k|    }
  547|  16.3M|}
_ZN4qpdf4impl6Parser8add_nullEv:
  551|   250k|{
  552|   250k|    const static ObjectPtr null_obj = QPDFObject::create<QPDF_Null>();
  553|       |
  554|   250k|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (554:9): [True: 225k, False: 24.8k]
  ------------------
  555|       |        // If state is st_dictionary_key then there is a missing key. Push onto olist for
  556|       |        // processing once the tt_dict_close token has been found.
  557|   225k|        frame_->olist.emplace_back(null_obj);
  558|   225k|    } else {
  559|  24.8k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, null_obj); !res.second) {
  ------------------
  |  Branch (559:78): [True: 2.30k, False: 22.5k]
  ------------------
  560|  2.30k|            warn_duplicate_key();
  561|  2.30k|        }
  562|  24.8k|        frame_->state = st_dictionary_key;
  563|  24.8k|    }
  564|   250k|    ++frame_->null_count;
  565|   250k|}
_ZN4qpdf4impl6Parser12add_bad_nullERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  569|   158k|{
  570|   158k|    warn(msg);
  571|   158k|    check_too_many_bad_tokens();
  572|   158k|    add_null();
  573|   158k|}
_ZN4qpdf4impl6Parser7add_intEi:
  577|  6.90M|{
  578|  6.90M|    auto obj = QPDFObject::create<QPDF_Integer>(int_buffer_[count % 2]);
  579|  6.90M|    obj->setDescription(context_, description_, last_offset_buffer_[count % 2]);
  580|  6.90M|    add(std::move(obj));
  581|  6.90M|}
_ZN4qpdf4impl6Parser15set_descriptionERNSt3__110shared_ptrI10QPDFObjectEEx:
  610|   202k|{
  611|   202k|    if (obj) {
  ------------------
  |  Branch (611:9): [True: 202k, False: 0]
  ------------------
  612|   202k|        obj->setDescription(context_, description_, parsed_offset);
  613|   202k|    }
  614|   202k|}
_ZN4qpdf4impl6Parser16fix_missing_keysEv:
  618|  3.71k|{
  619|  3.71k|    std::set<std::string> names;
  620|  11.9k|    for (auto& obj: frame_->olist) {
  ------------------
  |  Branch (620:19): [True: 11.9k, False: 3.71k]
  ------------------
  621|  11.9k|        if (obj.raw_type_code() == ::ot_name) {
  ------------------
  |  Branch (621:13): [True: 601, False: 11.3k]
  ------------------
  622|    601|            names.insert(obj.getName());
  623|    601|        }
  624|  11.9k|    }
  625|  3.71k|    int next_fake_key = 1;
  626|  11.7k|    for (auto const& item: frame_->olist) {
  ------------------
  |  Branch (626:26): [True: 11.7k, False: 3.71k]
  ------------------
  627|  11.8k|        while (true) {
  ------------------
  |  Branch (627:16): [True: 11.8k, Folded]
  ------------------
  628|  11.8k|            const std::string key = "/QPDFFake" + std::to_string(next_fake_key++);
  629|  11.8k|            const bool found_fake = !frame_->dict.contains(key) && !names.contains(key);
  ------------------
  |  Branch (629:37): [True: 11.7k, False: 68]
  |  Branch (629:68): [True: 11.7k, False: 18]
  ------------------
  630|  11.8k|            QTC::TC("qpdf", "QPDFParser found fake", (found_fake ? 0 : 1));
  ------------------
  |  Branch (630:55): [True: 11.7k, False: 86]
  ------------------
  631|  11.8k|            if (found_fake) {
  ------------------
  |  Branch (631:17): [True: 11.7k, False: 86]
  ------------------
  632|  11.7k|                warn(
  633|  11.7k|                    frame_->offset,
  634|  11.7k|                    "expected dictionary key but found non-name object; inserting key " + key);
  635|  11.7k|                frame_->dict[key] = item;
  636|  11.7k|                break;
  637|  11.7k|            }
  638|  11.8k|        }
  639|  11.7k|    }
  640|  3.71k|}
_ZN4qpdf4impl6Parser25check_too_many_bad_tokensEv:
  644|   205k|{
  645|   205k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (645:52): [True: 157k, False: 48.6k]
  |  Branch (645:66): [True: 45.0k, False: 3.60k]
  ------------------
  646|   205k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (646:9): [True: 504, False: 205k]
  |  Branch (646:42): [True: 0, False: 205k]
  ------------------
  647|    504|        if (bad_count_) {
  ------------------
  |  Branch (647:13): [True: 422, False: 82]
  ------------------
  648|    422|            limits_error(
  649|    422|                "parser-max-container-size-damaged",
  650|    422|                "encountered errors while parsing an array or dictionary with more than " +
  651|    422|                    std::to_string(limit) + " elements; giving up on reading object");
  652|    422|        }
  653|    504|        limits_error(
  654|    504|            "parser-max-container-size",
  655|    504|            "encountered an array or dictionary with more than " + std::to_string(limit) +
  656|    504|                " elements during xref recovery; giving up on reading object");
  657|    504|    }
  658|   205k|    if (max_bad_count_ && --max_bad_count_ == 0) {
  ------------------
  |  Branch (658:9): [True: 205k, False: 504]
  |  Branch (658:27): [True: 1.52k, False: 203k]
  ------------------
  659|  1.52k|        limits_error(
  660|  1.52k|            "parser-max-errors", "too many errors during parsing; treating object as null");
  661|  1.52k|    }
  662|   205k|    if (good_count_ > 4) {
  ------------------
  |  Branch (662:9): [True: 64.7k, False: 141k]
  ------------------
  663|  64.7k|        good_count_ = 0;
  664|  64.7k|        bad_count_ = 1;
  665|  64.7k|        return;
  666|  64.7k|    }
  667|   141k|    if (++bad_count_ > 5 ||
  ------------------
  |  Branch (667:9): [True: 6.42k, False: 134k]
  ------------------
  668|   134k|        (frame_->state != st_array && std::cmp_less(max_bad_count_, frame_->olist.size()))) {
  ------------------
  |  Branch (668:10): [True: 84.7k, False: 49.9k]
  |  Branch (668:39): [True: 2.18k, False: 82.5k]
  ------------------
  669|       |        // Give up after 5 errors in close proximity or if the number of missing dictionary keys
  670|       |        // exceeds the remaining number of allowable total errors.
  671|  6.57k|        warn("too many errors; giving up on reading object");
  672|  6.57k|        throw Error();
  673|  6.57k|    }
  674|   134k|    good_count_ = 0;
  675|   134k|}
_ZN4qpdf4impl6Parser12limits_errorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  679|  2.11k|{
  680|  2.11k|    Limits::error();
  681|  2.11k|    warn("limits error("s + limit + "): " + msg);
  682|  2.11k|    throw Error();
  683|  2.11k|}
_ZNK4qpdf4impl6Parser4warnERK7QPDFExc:
  687|   308k|{
  688|       |    // If parsing on behalf of a QPDF object and want to give a warning, we can warn through the
  689|       |    // object. If parsing for some other reason, such as an explicit creation of an object from a
  690|       |    // string, then just throw the exception.
  691|   308k|    if (context_) {
  ------------------
  |  Branch (691:9): [True: 308k, False: 0]
  ------------------
  692|   308k|        context_->warn(e);
  693|   308k|    } else {
  694|      0|        throw e;
  695|      0|    }
  696|   308k|}
_ZN4qpdf4impl6Parser18warn_duplicate_keyEv:
  700|  9.31k|{
  701|  9.31k|    warn(
  702|  9.31k|        frame_->offset,
  703|  9.31k|        "dictionary has duplicated key " + frame_->key +
  704|  9.31k|            "; last occurrence overrides earlier ones");
  705|  9.31k|    check_too_many_bad_tokens();
  706|  9.31k|}
_ZNK4qpdf4impl6Parser4warnExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  710|   308k|{
  711|   308k|    if (stream_id_) {
  ------------------
  |  Branch (711:9): [True: 18.0k, False: 290k]
  ------------------
  712|  18.0k|        std::string descr = "object "s + std::to_string(obj_id_) + " 0";
  713|  18.0k|        std::string name = context_->getFilename() + " object stream " + std::to_string(stream_id_);
  714|  18.0k|        warn(QPDFExc(qpdf_e_damaged_pdf, name, descr, offset, msg));
  715|   290k|    } else {
  716|   290k|        warn(QPDFExc(qpdf_e_damaged_pdf, input_.getName(), object_description_, offset, msg));
  717|   290k|    }
  718|   308k|}
_ZNK4qpdf4impl6Parser4warnERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  722|   244k|{
  723|   244k|    warn(input_.getLastOffset(), msg);
  724|   244k|}
_ZN4QPDF3Doc10ParseGuardC2EPS_:
   26|   134k|        objects(qpdf ? &qpdf->m->objects : nullptr)
  ------------------
  |  Branch (26:17): [True: 134k, False: 0]
  ------------------
   27|   134k|    {
   28|   134k|        if (objects) {
  ------------------
  |  Branch (28:13): [True: 134k, False: 0]
  ------------------
   29|   134k|            objects->inParse(true);
   30|   134k|        }
   31|   134k|    }
_ZN4QPDF3Doc10ParseGuardD2Ev:
   40|   134k|    {
   41|   134k|        if (objects) {
  ------------------
  |  Branch (41:13): [True: 134k, False: 0]
  ------------------
   42|   134k|            objects->inParse(false);
   43|   134k|        }
   44|   134k|    }
_ZN4QPDF3Doc10ParseGuard9getObjectEPS_iib:
   35|   265k|    {
   36|   265k|        return qpdf->m->objects.getObjectForParser(id, gen, parse_pdf);
   37|   265k|    }
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_BoolJbEEE16QPDFObjectHandleDpOT0_:
  602|    467|{
  603|    467|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    467|    obj->setDescription(context_, description_, start_);
  605|    467|    return {obj};
  606|    467|}
_ZN4qpdf4impl6Parser16with_descriptionI12QPDF_IntegerJxEEE16QPDFObjectHandleDpOT0_:
  602|  8.85k|{
  603|  8.85k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  8.85k|    obj->setDescription(context_, description_, start_);
  605|  8.85k|    return {obj};
  606|  8.85k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  1.89k|{
  603|  1.89k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.89k|    obj->setDescription(context_, description_, start_);
  605|  1.89k|    return {obj};
  606|  1.89k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  1.69k|{
  603|  1.69k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.69k|    obj->setDescription(context_, description_, start_);
  605|  1.69k|    return {obj};
  606|  1.69k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  7.98k|{
  603|  7.98k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  7.98k|    obj->setDescription(context_, description_, start_);
  605|  7.98k|    return {obj};
  606|  7.98k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|    119|{
  603|    119|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    119|    obj->setDescription(context_, description_, start_);
  605|    119|    return {obj};
  606|    119|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_BoolJbEEEvDpOT0_:
  586|  8.49k|{
  587|  8.49k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 5.57k, False: 2.92k]
  |  Branch (587:66): [True: 1.93k, False: 993]
  ------------------
  588|  8.49k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 70, False: 8.42k]
  |  Branch (588:42): [True: 0, False: 8.42k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     70|        max_bad_count_ = 1;
  592|     70|        check_too_many_bad_tokens(); // always throws Error()
  593|     70|    }
  594|  8.49k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  8.49k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  8.49k|    add(std::move(obj));
  597|  8.49k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  59.5k|{
  587|  59.5k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 11.9k, False: 47.6k]
  |  Branch (587:66): [True: 45.9k, False: 1.66k]
  ------------------
  588|  59.5k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 77, False: 59.4k]
  |  Branch (588:42): [True: 0, False: 59.4k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     77|        max_bad_count_ = 1;
  592|     77|        check_too_many_bad_tokens(); // always throws Error()
  593|     77|    }
  594|  59.5k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  59.5k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  59.5k|    add(std::move(obj));
  597|  59.5k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  8.86M|{
  587|  8.86M|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 1.90M, False: 6.96M]
  |  Branch (587:66): [True: 354k, False: 6.60M]
  ------------------
  588|  8.86M|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 220, False: 8.86M]
  |  Branch (588:42): [True: 0, False: 8.86M]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|    220|        max_bad_count_ = 1;
  592|    220|        check_too_many_bad_tokens(); // always throws Error()
  593|    220|    }
  594|  8.86M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  8.86M|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  8.86M|    add(std::move(obj));
  597|  8.86M|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   127k|{
  587|   127k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 104k, False: 23.0k]
  |  Branch (587:66): [True: 19.2k, False: 3.71k]
  ------------------
  588|   127k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 95, False: 127k]
  |  Branch (588:42): [True: 0, False: 127k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     95|        max_bad_count_ = 1;
  592|     95|        check_too_many_bad_tokens(); // always throws Error()
  593|     95|    }
  594|   127k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   127k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   127k|    add(std::move(obj));
  597|   127k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  15.9k|{
  587|  15.9k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 11.1k, False: 4.77k]
  |  Branch (587:66): [True: 4.73k, False: 35]
  ------------------
  588|  15.9k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 27, False: 15.9k]
  |  Branch (588:42): [True: 0, False: 15.9k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     27|        max_bad_count_ = 1;
  592|     27|        check_too_many_bad_tokens(); // always throws Error()
  593|     27|    }
  594|  15.9k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  15.9k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  15.9k|    add(std::move(obj));
  597|  15.9k|}

_ZN16QPDFStreamFilter14setDecodeParmsE16QPDFObjectHandle:
    7|  2.21k|{
    8|  2.21k|    return decode_parms.null();
    9|  2.21k|}
_ZN16QPDFStreamFilter18isLossyCompressionEv:
   19|  12.3k|{
   20|  12.3k|    return false;
   21|  12.3k|}

_ZN4qpdf9Tokenizer5resetEv:
   85|  22.1M|{
   86|  22.1M|    state = st_before_token;
   87|  22.1M|    type = tt::tt_bad;
   88|  22.1M|    val.clear();
   89|  22.1M|    raw_val.clear();
   90|  22.1M|    error_message = "";
   91|  22.1M|    before_token = true;
   92|  22.1M|    in_token = false;
   93|  22.1M|    char_to_unread = '\0';
   94|  22.1M|    inline_image_bytes = 0;
   95|  22.1M|    string_depth = 0;
   96|  22.1M|    bad = false;
   97|  22.1M|}
_ZN4qpdf9TokenizerC2Ev:
  119|  20.8k|{
  120|  20.8k|    reset();
  121|  20.8k|}
_ZN4qpdf9Tokenizer8allowEOFEv:
  131|  20.8k|{
  132|  20.8k|    allow_eof = true;
  133|  20.8k|}
_ZN4qpdf9Tokenizer7isSpaceEc:
  149|  34.3M|{
  150|  34.3M|    return (ch == '\0' || util::is_space(ch));
  ------------------
  |  Branch (150:13): [True: 3.91M, False: 30.4M]
  |  Branch (150:27): [True: 10.3M, False: 20.1M]
  ------------------
  151|  34.3M|}
_ZN4qpdf9Tokenizer11isDelimiterEc:
  155|   160M|{
  156|   160M|    return is_delimiter(ch);
  157|   160M|}
_ZN4qpdf9Tokenizer16presentCharacterEc:
  167|  17.7k|{
  168|  17.7k|    handleCharacter(ch);
  169|       |
  170|  17.7k|    if (in_token) {
  ------------------
  |  Branch (170:9): [True: 0, False: 17.7k]
  ------------------
  171|      0|        raw_val += ch;
  172|      0|    }
  173|  17.7k|}
_ZN4qpdf9Tokenizer15handleCharacterEc:
  177|   359M|{
  178|       |    // In some cases, functions called below may call a second handler. This happens whenever you
  179|       |    // have to use a character from the next token to detect the end of the current token.
  180|       |
  181|   359M|    switch (state) {
  182|      0|    case st_top:
  ------------------
  |  Branch (182:5): [True: 0, False: 359M]
  ------------------
  183|      0|        inTop(ch);
  184|      0|        return;
  185|       |
  186|      0|    case st_in_space:
  ------------------
  |  Branch (186:5): [True: 0, False: 359M]
  ------------------
  187|      0|        inSpace(ch);
  188|      0|        return;
  189|       |
  190|  1.56M|    case st_in_comment:
  ------------------
  |  Branch (190:5): [True: 1.56M, False: 358M]
  ------------------
  191|  1.56M|        inComment(ch);
  192|  1.56M|        return;
  193|       |
  194|   260k|    case st_lt:
  ------------------
  |  Branch (194:5): [True: 260k, False: 359M]
  ------------------
  195|   260k|        inLt(ch);
  196|   260k|        return;
  197|       |
  198|   174k|    case st_gt:
  ------------------
  |  Branch (198:5): [True: 174k, False: 359M]
  ------------------
  199|   174k|        inGt(ch);
  200|   174k|        return;
  201|       |
  202|   146M|    case st_in_string:
  ------------------
  |  Branch (202:5): [True: 146M, False: 213M]
  ------------------
  203|   146M|        inString(ch);
  204|   146M|        return;
  205|       |
  206|  93.7M|    case st_name:
  ------------------
  |  Branch (206:5): [True: 93.7M, False: 266M]
  ------------------
  207|  93.7M|        inName(ch);
  208|  93.7M|        return;
  209|       |
  210|  24.4M|    case st_number:
  ------------------
  |  Branch (210:5): [True: 24.4M, False: 335M]
  ------------------
  211|  24.4M|        inNumber(ch);
  212|  24.4M|        return;
  213|       |
  214|   238k|    case st_real:
  ------------------
  |  Branch (214:5): [True: 238k, False: 359M]
  ------------------
  215|   238k|        inReal(ch);
  216|   238k|        return;
  217|       |
  218|   151k|    case st_string_after_cr:
  ------------------
  |  Branch (218:5): [True: 151k, False: 359M]
  ------------------
  219|   151k|        inStringAfterCR(ch);
  220|   151k|        return;
  221|       |
  222|  22.3k|    case st_string_escape:
  ------------------
  |  Branch (222:5): [True: 22.3k, False: 359M]
  ------------------
  223|  22.3k|        inStringEscape(ch);
  224|  22.3k|        return;
  225|       |
  226|  7.56k|    case st_char_code:
  ------------------
  |  Branch (226:5): [True: 7.56k, False: 359M]
  ------------------
  227|  7.56k|        inCharCode(ch);
  228|  7.56k|        return;
  229|       |
  230|  58.4M|    case st_literal:
  ------------------
  |  Branch (230:5): [True: 58.4M, False: 301M]
  ------------------
  231|  58.4M|        inLiteral(ch);
  232|  58.4M|        return;
  233|       |
  234|      0|    case st_inline_image:
  ------------------
  |  Branch (234:5): [True: 0, False: 359M]
  ------------------
  235|      0|        inInlineImage(ch);
  236|      0|        return;
  237|       |
  238|   100k|    case st_in_hexstring:
  ------------------
  |  Branch (238:5): [True: 100k, False: 359M]
  ------------------
  239|   100k|        inHexstring(ch);
  240|   100k|        return;
  241|       |
  242|   106k|    case st_in_hexstring_2nd:
  ------------------
  |  Branch (242:5): [True: 106k, False: 359M]
  ------------------
  243|   106k|        inHexstring2nd(ch);
  244|   106k|        return;
  245|       |
  246|  23.4k|    case st_name_hex1:
  ------------------
  |  Branch (246:5): [True: 23.4k, False: 359M]
  ------------------
  247|  23.4k|        inNameHex1(ch);
  248|  23.4k|        return;
  249|       |
  250|  9.70k|    case st_name_hex2:
  ------------------
  |  Branch (250:5): [True: 9.70k, False: 359M]
  ------------------
  251|  9.70k|        inNameHex2(ch);
  252|  9.70k|        return;
  253|       |
  254|  20.5k|    case st_sign:
  ------------------
  |  Branch (254:5): [True: 20.5k, False: 359M]
  ------------------
  255|  20.5k|        inSign(ch);
  256|  20.5k|        return;
  257|       |
  258|  8.62k|    case st_decimal:
  ------------------
  |  Branch (258:5): [True: 8.62k, False: 359M]
  ------------------
  259|  8.62k|        inDecimal(ch);
  260|  8.62k|        return;
  261|       |
  262|  34.3M|    case (st_before_token):
  ------------------
  |  Branch (262:5): [True: 34.3M, False: 325M]
  ------------------
  263|  34.3M|        inBeforeToken(ch);
  264|  34.3M|        return;
  265|       |
  266|      0|    case (st_token_ready):
  ------------------
  |  Branch (266:5): [True: 0, False: 359M]
  ------------------
  267|      0|        inTokenReady(ch);
  268|      0|        return;
  269|       |
  270|      0|    default:
  ------------------
  |  Branch (270:5): [True: 0, False: 359M]
  ------------------
  271|      0|        throw std::logic_error("INTERNAL ERROR: invalid state while reading token");
  272|   359M|    }
  273|   359M|}
_ZN4qpdf9Tokenizer13inBeforeTokenEc:
  284|  34.3M|{
  285|       |    // Note: we specifically do not use ctype here.  It is locale-dependent.
  286|  34.3M|    if (isSpace(ch)) {
  ------------------
  |  Branch (286:9): [True: 14.1M, False: 20.1M]
  ------------------
  287|  14.1M|        before_token = !include_ignorable;
  288|  14.1M|        in_token = include_ignorable;
  289|  14.1M|        if (include_ignorable) {
  ------------------
  |  Branch (289:13): [True: 0, False: 14.1M]
  ------------------
  290|      0|            state = st_in_space;
  291|      0|        }
  292|  20.1M|    } else if (ch == '%') {
  ------------------
  |  Branch (292:16): [True: 22.7k, False: 20.1M]
  ------------------
  293|  22.7k|        before_token = !include_ignorable;
  294|  22.7k|        in_token = include_ignorable;
  295|  22.7k|        state = st_in_comment;
  296|  20.1M|    } else {
  297|  20.1M|        before_token = false;
  298|  20.1M|        in_token = true;
  299|  20.1M|        inTop(ch);
  300|  20.1M|    }
  301|  34.3M|}
_ZN4qpdf9Tokenizer5inTopEc:
  305|  20.1M|{
  306|  20.1M|    switch (ch) {
  307|   132k|    case '(':
  ------------------
  |  Branch (307:5): [True: 132k, False: 19.9M]
  ------------------
  308|   132k|        string_depth = 1;
  309|   132k|        state = st_in_string;
  310|   132k|        return;
  311|       |
  312|   261k|    case '<':
  ------------------
  |  Branch (312:5): [True: 261k, False: 19.8M]
  ------------------
  313|   261k|        state = st_lt;
  314|   261k|        return;
  315|       |
  316|   175k|    case '>':
  ------------------
  |  Branch (316:5): [True: 175k, False: 19.9M]
  ------------------
  317|   175k|        state = st_gt;
  318|   175k|        return;
  319|       |
  320|  17.7k|    case (')'):
  ------------------
  |  Branch (320:5): [True: 17.7k, False: 20.0M]
  ------------------
  321|  17.7k|        type = tt::tt_bad;
  322|  17.7k|        QTC::TC("qpdf", "QPDFTokenizer bad )");
  323|  17.7k|        error_message = "unexpected )";
  324|  17.7k|        state = st_token_ready;
  325|  17.7k|        return;
  326|       |
  327|   168k|    case '[':
  ------------------
  |  Branch (327:5): [True: 168k, False: 19.9M]
  ------------------
  328|   168k|        type = tt::tt_array_open;
  329|   168k|        state = st_token_ready;
  330|   168k|        return;
  331|       |
  332|  88.1k|    case ']':
  ------------------
  |  Branch (332:5): [True: 88.1k, False: 20.0M]
  ------------------
  333|  88.1k|        type = tt::tt_array_close;
  334|  88.1k|        state = st_token_ready;
  335|  88.1k|        return;
  336|       |
  337|  3.36k|    case '{':
  ------------------
  |  Branch (337:5): [True: 3.36k, False: 20.1M]
  ------------------
  338|  3.36k|        type = tt::tt_brace_open;
  339|  3.36k|        state = st_token_ready;
  340|  3.36k|        return;
  341|       |
  342|  3.92k|    case '}':
  ------------------
  |  Branch (342:5): [True: 3.92k, False: 20.0M]
  ------------------
  343|  3.92k|        type = tt::tt_brace_close;
  344|  3.92k|        state = st_token_ready;
  345|  3.92k|        return;
  346|       |
  347|  9.46M|    case '/':
  ------------------
  |  Branch (347:5): [True: 9.46M, False: 10.6M]
  ------------------
  348|  9.46M|        state = st_name;
  349|  9.46M|        val += ch;
  350|  9.46M|        return;
  351|       |
  352|   739k|    case '0':
  ------------------
  |  Branch (352:5): [True: 739k, False: 19.3M]
  ------------------
  353|  2.07M|    case '1':
  ------------------
  |  Branch (353:5): [True: 1.33M, False: 18.7M]
  ------------------
  354|  2.72M|    case '2':
  ------------------
  |  Branch (354:5): [True: 654k, False: 19.4M]
  ------------------
  355|  3.00M|    case '3':
  ------------------
  |  Branch (355:5): [True: 275k, False: 19.8M]
  ------------------
  356|  3.42M|    case '4':
  ------------------
  |  Branch (356:5): [True: 422k, False: 19.6M]
  ------------------
  357|  4.30M|    case '5':
  ------------------
  |  Branch (357:5): [True: 878k, False: 19.2M]
  ------------------
  358|  6.15M|    case '6':
  ------------------
  |  Branch (358:5): [True: 1.85M, False: 18.2M]
  ------------------
  359|  7.79M|    case '7':
  ------------------
  |  Branch (359:5): [True: 1.64M, False: 18.4M]
  ------------------
  360|  8.21M|    case '8':
  ------------------
  |  Branch (360:5): [True: 416k, False: 19.6M]
  ------------------
  361|  8.35M|    case '9':
  ------------------
  |  Branch (361:5): [True: 143k, False: 19.9M]
  ------------------
  362|  8.35M|        state = st_number;
  363|  8.35M|        return;
  364|       |
  365|  2.53k|    case '+':
  ------------------
  |  Branch (365:5): [True: 2.53k, False: 20.1M]
  ------------------
  366|  20.5k|    case '-':
  ------------------
  |  Branch (366:5): [True: 18.0k, False: 20.0M]
  ------------------
  367|  20.5k|        state = st_sign;
  368|  20.5k|        return;
  369|       |
  370|  8.35k|    case '.':
  ------------------
  |  Branch (370:5): [True: 8.35k, False: 20.0M]
  ------------------
  371|  8.35k|        state = st_decimal;
  372|  8.35k|        return;
  373|       |
  374|  1.39M|    default:
  ------------------
  |  Branch (374:5): [True: 1.39M, False: 18.7M]
  ------------------
  375|  1.39M|        state = st_literal;
  376|  1.39M|        return;
  377|  20.1M|    }
  378|  20.1M|}
_ZN4qpdf9Tokenizer9inCommentEc:
  394|  1.56M|{
  395|  1.56M|    if ((ch == '\r') || (ch == '\n')) {
  ------------------
  |  Branch (395:9): [True: 4.57k, False: 1.56M]
  |  Branch (395:25): [True: 17.0k, False: 1.54M]
  ------------------
  396|  21.6k|        if (include_ignorable) {
  ------------------
  |  Branch (396:13): [True: 0, False: 21.6k]
  ------------------
  397|      0|            type = tt::tt_comment;
  398|      0|            in_token = false;
  399|      0|            char_to_unread = ch;
  400|      0|            state = st_token_ready;
  401|  21.6k|        } else {
  402|  21.6k|            state = st_before_token;
  403|  21.6k|        }
  404|  21.6k|    }
  405|  1.56M|}
_ZN4qpdf9Tokenizer8inStringEc:
  409|   146M|{
  410|   146M|    switch (ch) {
  411|  22.4k|    case '\\':
  ------------------
  |  Branch (411:5): [True: 22.4k, False: 146M]
  ------------------
  412|  22.4k|        state = st_string_escape;
  413|  22.4k|        return;
  414|       |
  415|  73.9k|    case '(':
  ------------------
  |  Branch (415:5): [True: 73.9k, False: 146M]
  ------------------
  416|  73.9k|        val += ch;
  417|  73.9k|        ++string_depth;
  418|  73.9k|        return;
  419|       |
  420|   172k|    case ')':
  ------------------
  |  Branch (420:5): [True: 172k, False: 146M]
  ------------------
  421|   172k|        if (--string_depth == 0) {
  ------------------
  |  Branch (421:13): [True: 126k, False: 46.0k]
  ------------------
  422|   126k|            type = tt::tt_string;
  423|   126k|            state = st_token_ready;
  424|   126k|            return;
  425|   126k|        }
  426|       |
  427|  46.0k|        val += ch;
  428|  46.0k|        return;
  429|       |
  430|   151k|    case '\r':
  ------------------
  |  Branch (430:5): [True: 151k, False: 146M]
  ------------------
  431|       |        // CR by itself is converted to LF
  432|   151k|        val += '\n';
  433|   151k|        state = st_string_after_cr;
  434|   151k|        return;
  435|       |
  436|   348k|    case '\n':
  ------------------
  |  Branch (436:5): [True: 348k, False: 145M]
  ------------------
  437|   348k|        val += ch;
  438|   348k|        return;
  439|       |
  440|   145M|    default:
  ------------------
  |  Branch (440:5): [True: 145M, False: 768k]
  ------------------
  441|   145M|        val += ch;
  442|   145M|        return;
  443|   146M|    }
  444|   146M|}
_ZN4qpdf9Tokenizer6inNameEc:
  448|  93.7M|{
  449|  93.7M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (449:9): [True: 9.45M, False: 84.2M]
  ------------------
  450|       |        // A C-locale whitespace character or delimiter terminates token.  It is important to unread
  451|       |        // the whitespace character even though it is ignored since it may be the newline after a
  452|       |        // stream keyword.  Removing it here could make the stream-reading code break on some files,
  453|       |        // though not on any files in the test suite as of this
  454|       |        // writing.
  455|       |
  456|  9.45M|        type = bad ? tt::tt_bad : tt::tt_name;
  ------------------
  |  Branch (456:16): [True: 256, False: 9.45M]
  ------------------
  457|  9.45M|        in_token = false;
  458|  9.45M|        char_to_unread = ch;
  459|  9.45M|        state = st_token_ready;
  460|  84.2M|    } else if (ch == '#') {
  ------------------
  |  Branch (460:16): [True: 23.4k, False: 84.2M]
  ------------------
  461|  23.4k|        char_code = 0;
  462|  23.4k|        state = st_name_hex1;
  463|  84.2M|    } else {
  464|  84.2M|        val += ch;
  465|  84.2M|    }
  466|  93.7M|}
_ZN4qpdf9Tokenizer10inNameHex1Ec:
  470|  23.4k|{
  471|  23.4k|    hex_char = ch;
  472|       |
  473|  23.4k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (473:48): [True: 9.71k, False: 13.7k]
  ------------------
  474|  9.71k|        char_code = int(hval) << 4;
  475|  9.71k|        state = st_name_hex2;
  476|  13.7k|    } else {
  477|  13.7k|        QTC::TC("qpdf", "QPDFTokenizer bad name 1");
  478|  13.7k|        error_message = "name with stray # will not work with PDF >= 1.2";
  479|       |        // Use null to encode a bad # -- this is reversed in QPDF_Name::normalizeName.
  480|  13.7k|        val += '\0';
  481|  13.7k|        state = st_name;
  482|  13.7k|        inName(ch);
  483|  13.7k|    }
  484|  23.4k|}
_ZN4qpdf9Tokenizer10inNameHex2Ec:
  488|  9.70k|{
  489|  9.70k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (489:48): [True: 2.13k, False: 7.56k]
  ------------------
  490|  2.13k|        char_code |= int(hval);
  491|  7.56k|    } else {
  492|  7.56k|        QTC::TC("qpdf", "QPDFTokenizer bad name 2");
  493|  7.56k|        error_message = "name with stray # will not work with PDF >= 1.2";
  494|       |        // Use null to encode a bad # -- this is reversed in QPDF_Name::normalizeName.
  495|  7.56k|        val += '\0';
  496|  7.56k|        val += hex_char;
  497|  7.56k|        state = st_name;
  498|  7.56k|        inName(ch);
  499|  7.56k|        return;
  500|  7.56k|    }
  501|  2.13k|    if (char_code == 0) {
  ------------------
  |  Branch (501:9): [True: 1.34k, False: 789]
  ------------------
  502|  1.34k|        QTC::TC("qpdf", "QPDFTokenizer null in name");
  503|  1.34k|        error_message = "null character not allowed in name token";
  504|  1.34k|        val += "#00";
  505|  1.34k|        state = st_name;
  506|  1.34k|        bad = true;
  507|  1.34k|    } else {
  508|    789|        val += char(char_code);
  509|    789|        state = st_name;
  510|    789|    }
  511|  2.13k|}
_ZN4qpdf9Tokenizer6inSignEc:
  515|  20.5k|{
  516|  20.5k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (516:9): [True: 14.6k, False: 5.87k]
  ------------------
  517|  14.6k|        state = st_number;
  518|  14.6k|    } else if (ch == '.') {
  ------------------
  |  Branch (518:16): [True: 275, False: 5.60k]
  ------------------
  519|    275|        state = st_decimal;
  520|  5.60k|    } else {
  521|  5.60k|        state = st_literal;
  522|  5.60k|        inLiteral(ch);
  523|  5.60k|    }
  524|  20.5k|}
_ZN4qpdf9Tokenizer9inDecimalEc:
  528|  8.62k|{
  529|  8.62k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (529:9): [True: 5.50k, False: 3.12k]
  ------------------
  530|  5.50k|        state = st_real;
  531|  5.50k|    } else {
  532|  3.12k|        state = st_literal;
  533|  3.12k|        inLiteral(ch);
  534|  3.12k|    }
  535|  8.62k|}
_ZN4qpdf9Tokenizer8inNumberEc:
  539|  24.4M|{
  540|  24.4M|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (540:9): [True: 16.1M, False: 8.29M]
  ------------------
  541|  16.1M|    } else if (ch == '.') {
  ------------------
  |  Branch (541:16): [True: 63.3k, False: 8.23M]
  ------------------
  542|  63.3k|        state = st_real;
  543|  8.23M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (543:16): [True: 8.19M, False: 39.7k]
  ------------------
  544|  8.19M|        type = tt::tt_integer;
  545|  8.19M|        state = st_token_ready;
  546|  8.19M|        in_token = false;
  547|  8.19M|        char_to_unread = ch;
  548|  8.19M|    } else {
  549|  39.7k|        state = st_literal;
  550|  39.7k|    }
  551|  24.4M|}
_ZN4qpdf9Tokenizer6inRealEc:
  555|   238k|{
  556|   238k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (556:9): [True: 169k, False: 68.8k]
  ------------------
  557|   169k|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (557:16): [True: 67.2k, False: 1.61k]
  ------------------
  558|  67.2k|        type = tt::tt_real;
  559|  67.2k|        state = st_token_ready;
  560|  67.2k|        in_token = false;
  561|  67.2k|        char_to_unread = ch;
  562|  67.2k|    } else {
  563|  1.61k|        state = st_literal;
  564|  1.61k|    }
  565|   238k|}
_ZN4qpdf9Tokenizer14inStringEscapeEc:
  568|  22.3k|{
  569|  22.3k|    state = st_in_string;
  570|  22.3k|    switch (ch) {
  571|  1.31k|    case '0':
  ------------------
  |  Branch (571:5): [True: 1.31k, False: 21.0k]
  ------------------
  572|  1.97k|    case '1':
  ------------------
  |  Branch (572:5): [True: 662, False: 21.7k]
  ------------------
  573|  3.78k|    case '2':
  ------------------
  |  Branch (573:5): [True: 1.80k, False: 20.5k]
  ------------------
  574|  4.87k|    case '3':
  ------------------
  |  Branch (574:5): [True: 1.09k, False: 21.2k]
  ------------------
  575|  5.55k|    case '4':
  ------------------
  |  Branch (575:5): [True: 676, False: 21.6k]
  ------------------
  576|  6.00k|    case '5':
  ------------------
  |  Branch (576:5): [True: 455, False: 21.9k]
  ------------------
  577|  6.32k|    case '6':
  ------------------
  |  Branch (577:5): [True: 318, False: 22.0k]
  ------------------
  578|  6.66k|    case '7':
  ------------------
  |  Branch (578:5): [True: 335, False: 22.0k]
  ------------------
  579|  6.66k|        state = st_char_code;
  580|  6.66k|        char_code = 0;
  581|  6.66k|        digit_count = 0;
  582|  6.66k|        inCharCode(ch);
  583|  6.66k|        return;
  584|       |
  585|  3.45k|    case 'n':
  ------------------
  |  Branch (585:5): [True: 3.45k, False: 18.9k]
  ------------------
  586|  3.45k|        val += '\n';
  587|  3.45k|        return;
  588|       |
  589|    636|    case 'r':
  ------------------
  |  Branch (589:5): [True: 636, False: 21.7k]
  ------------------
  590|    636|        val += '\r';
  591|    636|        return;
  592|       |
  593|    227|    case 't':
  ------------------
  |  Branch (593:5): [True: 227, False: 22.1k]
  ------------------
  594|    227|        val += '\t';
  595|    227|        return;
  596|       |
  597|    240|    case 'b':
  ------------------
  |  Branch (597:5): [True: 240, False: 22.1k]
  ------------------
  598|    240|        val += '\b';
  599|    240|        return;
  600|       |
  601|    302|    case 'f':
  ------------------
  |  Branch (601:5): [True: 302, False: 22.0k]
  ------------------
  602|    302|        val += '\f';
  603|    302|        return;
  604|       |
  605|    236|    case '\n':
  ------------------
  |  Branch (605:5): [True: 236, False: 22.1k]
  ------------------
  606|    236|        return;
  607|       |
  608|    259|    case '\r':
  ------------------
  |  Branch (608:5): [True: 259, False: 22.1k]
  ------------------
  609|    259|        state = st_string_after_cr;
  610|    259|        return;
  611|       |
  612|  10.3k|    default:
  ------------------
  |  Branch (612:5): [True: 10.3k, False: 12.0k]
  ------------------
  613|       |        // PDF spec says backslash is ignored before anything else
  614|  10.3k|        val += ch;
  615|  10.3k|        return;
  616|  22.3k|    }
  617|  22.3k|}
_ZN4qpdf9Tokenizer15inStringAfterCREc:
  621|   151k|{
  622|   151k|    state = st_in_string;
  623|   151k|    if (ch != '\n') {
  ------------------
  |  Branch (623:9): [True: 71.2k, False: 80.3k]
  ------------------
  624|  71.2k|        inString(ch);
  625|  71.2k|    }
  626|   151k|}
_ZN4qpdf9Tokenizer4inLtEc:
  630|   260k|{
  631|   260k|    if (ch == '<') {
  ------------------
  |  Branch (631:9): [True: 231k, False: 29.2k]
  ------------------
  632|   231k|        type = tt::tt_dict_open;
  633|   231k|        state = st_token_ready;
  634|   231k|        return;
  635|   231k|    }
  636|       |
  637|  29.2k|    state = st_in_hexstring;
  638|  29.2k|    inHexstring(ch);
  639|  29.2k|}
_ZN4qpdf9Tokenizer4inGtEc:
  643|   174k|{
  644|   174k|    if (ch == '>') {
  ------------------
  |  Branch (644:9): [True: 162k, False: 12.1k]
  ------------------
  645|   162k|        type = tt::tt_dict_close;
  646|   162k|        state = st_token_ready;
  647|   162k|    } else {
  648|  12.1k|        type = tt::tt_bad;
  649|  12.1k|        QTC::TC("qpdf", "QPDFTokenizer bad >");
  650|  12.1k|        error_message = "unexpected >";
  651|  12.1k|        in_token = false;
  652|  12.1k|        char_to_unread = ch;
  653|  12.1k|        state = st_token_ready;
  654|  12.1k|    }
  655|   174k|}
_ZN4qpdf9Tokenizer9inLiteralEc:
  659|  58.4M|{
  660|  58.4M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (660:9): [True: 1.32M, False: 57.1M]
  ------------------
  661|       |        // A C-locale whitespace character or delimiter terminates token.  It is important to unread
  662|       |        // the whitespace character even though it is ignored since it may be the newline after a
  663|       |        // stream keyword.  Removing it here could make the stream-reading code break on some files,
  664|       |        // though not on any files in the test suite as of this writing.
  665|       |
  666|  1.32M|        in_token = false;
  667|  1.32M|        char_to_unread = ch;
  668|  1.32M|        state = st_token_ready;
  669|  1.32M|        type = (raw_val == "true") || (raw_val == "false")
  ------------------
  |  Branch (669:16): [True: 8.68k, False: 1.31M]
  |  Branch (669:39): [True: 1.58k, False: 1.31M]
  ------------------
  670|  1.32M|            ? tt::tt_bool
  671|  1.32M|            : (raw_val == "null" ? tt::tt_null : tt::tt_word);
  ------------------
  |  Branch (671:16): [True: 70.8k, False: 1.23M]
  ------------------
  672|  1.32M|    }
  673|  58.4M|}
_ZN4qpdf9Tokenizer11inHexstringEc:
  677|   130k|{
  678|   130k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (678:48): [True: 96.6k, False: 33.5k]
  ------------------
  679|  96.6k|        char_code = int(hval) << 4;
  680|  96.6k|        state = st_in_hexstring_2nd;
  681|       |
  682|  96.6k|    } else if (ch == '>') {
  ------------------
  |  Branch (682:16): [True: 7.47k, False: 26.0k]
  ------------------
  683|  7.47k|        type = tt::tt_string;
  684|  7.47k|        state = st_token_ready;
  685|       |
  686|  26.0k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (686:16): [True: 11.5k, False: 14.5k]
  ------------------
  687|       |        // ignore
  688|       |
  689|  14.5k|    } else {
  690|  14.5k|        type = tt::tt_bad;
  691|  14.5k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring character");
  692|  14.5k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  693|  14.5k|        state = st_token_ready;
  694|  14.5k|    }
  695|   130k|}
_ZN4qpdf9Tokenizer14inHexstring2ndEc:
  699|   106k|{
  700|   106k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (700:48): [True: 89.6k, False: 16.8k]
  ------------------
  701|  89.6k|        val += char(char_code) | hval;
  702|  89.6k|        state = st_in_hexstring;
  703|       |
  704|  89.6k|    } else if (ch == '>') {
  ------------------
  |  Branch (704:16): [True: 3.94k, False: 12.8k]
  ------------------
  705|       |        // PDF spec says odd hexstrings have implicit trailing 0.
  706|  3.94k|        val += char(char_code);
  707|  3.94k|        type = tt::tt_string;
  708|  3.94k|        state = st_token_ready;
  709|       |
  710|  12.8k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (710:16): [True: 10.1k, False: 2.68k]
  ------------------
  711|       |        // ignore
  712|       |
  713|  10.1k|    } else {
  714|  2.68k|        type = tt::tt_bad;
  715|  2.68k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character");
  716|  2.68k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  717|  2.68k|        state = st_token_ready;
  718|  2.68k|    }
  719|   106k|}
_ZN4qpdf9Tokenizer10inCharCodeEc:
  723|  14.2k|{
  724|  14.2k|    bool handled = false;
  725|  14.2k|    if (('0' <= ch) && (ch <= '7')) {
  ------------------
  |  Branch (725:9): [True: 12.5k, False: 1.63k]
  |  Branch (725:24): [True: 8.07k, False: 4.51k]
  ------------------
  726|  8.07k|        char_code = 8 * char_code + (int(ch) - int('0'));
  727|  8.07k|        if (++(digit_count) < 3) {
  ------------------
  |  Branch (727:13): [True: 7.73k, False: 336]
  ------------------
  728|  7.73k|            return;
  729|  7.73k|        }
  730|    336|        handled = true;
  731|    336|    }
  732|       |    // We've accumulated \ddd or we have \d or \dd followed by other than an octal digit. The PDF
  733|       |    // Spec says to ignore high-order overflow.
  734|  6.49k|    val += char(char_code % 256);
  735|  6.49k|    state = st_in_string;
  736|  6.49k|    if (!handled) {
  ------------------
  |  Branch (736:9): [True: 6.15k, False: 336]
  ------------------
  737|  6.15k|        inString(ch);
  738|  6.15k|    }
  739|  6.49k|}
_ZN4qpdf9Tokenizer10presentEOFEv:
  760|  38.2k|{
  761|  38.2k|    switch (state) {
  762|  1.97k|    case st_name:
  ------------------
  |  Branch (762:5): [True: 1.97k, False: 36.2k]
  ------------------
  763|  2.13k|    case st_name_hex1:
  ------------------
  |  Branch (763:5): [True: 155, False: 38.0k]
  ------------------
  764|  2.26k|    case st_name_hex2:
  ------------------
  |  Branch (764:5): [True: 136, False: 38.1k]
  ------------------
  765|  8.08k|    case st_number:
  ------------------
  |  Branch (765:5): [True: 5.81k, False: 32.4k]
  ------------------
  766|  8.35k|    case st_real:
  ------------------
  |  Branch (766:5): [True: 267, False: 37.9k]
  ------------------
  767|  8.52k|    case st_sign:
  ------------------
  |  Branch (767:5): [True: 173, False: 38.0k]
  ------------------
  768|  8.65k|    case st_decimal:
  ------------------
  |  Branch (768:5): [True: 134, False: 38.1k]
  ------------------
  769|  17.7k|    case st_literal:
  ------------------
  |  Branch (769:5): [True: 9.04k, False: 29.1k]
  ------------------
  770|  17.7k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token");
  771|       |        // Push any delimiter to the state machine to finish off the final token.
  772|  17.7k|        presentCharacter('\f');
  773|  17.7k|        in_token = true;
  774|  17.7k|        break;
  775|       |
  776|      0|    case st_top:
  ------------------
  |  Branch (776:5): [True: 0, False: 38.2k]
  ------------------
  777|  15.7k|    case st_before_token:
  ------------------
  |  Branch (777:5): [True: 15.7k, False: 22.4k]
  ------------------
  778|  15.7k|        type = tt::tt_eof;
  779|  15.7k|        break;
  780|       |
  781|      0|    case st_in_space:
  ------------------
  |  Branch (781:5): [True: 0, False: 38.2k]
  ------------------
  782|      0|        type = include_ignorable ? tt::tt_space : tt::tt_eof;
  ------------------
  |  Branch (782:16): [True: 0, False: 0]
  ------------------
  783|      0|        break;
  784|       |
  785|  1.10k|    case st_in_comment:
  ------------------
  |  Branch (785:5): [True: 1.10k, False: 37.1k]
  ------------------
  786|  1.10k|        type = include_ignorable ? tt::tt_comment : tt::tt_bad;
  ------------------
  |  Branch (786:16): [True: 0, False: 1.10k]
  ------------------
  787|  1.10k|        break;
  788|       |
  789|      0|    case st_token_ready:
  ------------------
  |  Branch (789:5): [True: 0, False: 38.2k]
  ------------------
  790|      0|        break;
  791|       |
  792|  3.66k|    default:
  ------------------
  |  Branch (792:5): [True: 3.66k, False: 34.5k]
  ------------------
  793|  3.66k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading token");
  794|  3.66k|        type = tt::tt_bad;
  795|  3.66k|        error_message = "EOF while reading token";
  796|  38.2k|    }
  797|  38.2k|    state = st_token_ready;
  798|  38.2k|}
_ZN4qpdf9Tokenizer8getTokenERN13QPDFTokenizer5TokenERbRc:
  916|  2.03M|{
  917|  2.03M|    bool ready = (state == st_token_ready);
  918|  2.03M|    unread_char = !in_token && !before_token;
  ------------------
  |  Branch (918:19): [True: 1.67M, False: 360k]
  |  Branch (918:32): [True: 1.66M, False: 8.83k]
  ------------------
  919|  2.03M|    ch = char_to_unread;
  920|  2.03M|    if (ready) {
  ------------------
  |  Branch (920:9): [True: 2.03M, False: 0]
  ------------------
  921|  2.03M|        token = (!(type == tt::tt_name || type == tt::tt_string))
  ------------------
  |  Branch (921:20): [True: 116k, False: 1.91M]
  |  Branch (921:43): [True: 2.16k, False: 1.91M]
  ------------------
  922|  2.03M|            ? Token(type, raw_val, raw_val, error_message)
  923|  2.03M|            : Token(type, val, raw_val, error_message);
  924|       |
  925|  2.03M|        reset();
  926|  2.03M|    }
  927|  2.03M|    return ready;
  928|  2.03M|}
_ZN4qpdf9Tokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbm:
  958|  2.03M|{
  959|  2.03M|    nextToken(input, context, max_len);
  960|       |
  961|  2.03M|    Token token;
  962|  2.03M|    bool unread_char;
  963|  2.03M|    char char_to_unread;
  964|  2.03M|    getToken(token, unread_char, char_to_unread);
  965|       |
  966|  2.03M|    if (token.getType() == tt::tt_bad) {
  ------------------
  |  Branch (966:9): [True: 237k, False: 1.79M]
  ------------------
  967|   237k|        if (allow_bad) {
  ------------------
  |  Branch (967:13): [True: 237k, False: 0]
  ------------------
  968|   237k|            QTC::TC("qpdf", "QPDFTokenizer allowing bad token");
  969|   237k|        } else {
  970|      0|            throw QPDFExc(
  971|      0|                qpdf_e_damaged_pdf,
  972|      0|                input.getName(),
  973|      0|                context.empty() ? "offset " + std::to_string(input.getLastOffset()) : context,
  ------------------
  |  Branch (973:17): [True: 0, False: 0]
  ------------------
  974|      0|                input.getLastOffset(),
  975|      0|                token.getErrorMessage());
  976|      0|        }
  977|   237k|    }
  978|  2.03M|    return token;
  979|  2.03M|}
_ZN4qpdf9Tokenizer9nextTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEm:
  983|  20.1M|{
  984|  20.1M|    if (state != st_inline_image) {
  ------------------
  |  Branch (984:9): [True: 20.1M, False: 0]
  ------------------
  985|  20.1M|        reset();
  986|  20.1M|    }
  987|  20.1M|    qpdf_offset_t offset = input.fastTell();
  988|       |
  989|   379M|    while (state != st_token_ready) {
  ------------------
  |  Branch (989:12): [True: 359M, False: 20.1M]
  ------------------
  990|   359M|        char ch;
  991|   359M|        if (!input.fastRead(ch)) {
  ------------------
  |  Branch (991:13): [True: 38.2k, False: 359M]
  ------------------
  992|  38.2k|            presentEOF();
  993|       |
  994|  38.2k|            if ((type == tt::tt_eof) && (!allow_eof)) {
  ------------------
  |  Branch (994:17): [True: 15.7k, False: 22.4k]
  |  Branch (994:41): [True: 0, False: 15.7k]
  ------------------
  995|       |                // Nothing in the qpdf library calls readToken without allowEOF anymore, so this
  996|       |                // case is not exercised.
  997|      0|                type = tt::tt_bad;
  998|      0|                error_message = "unexpected EOF";
  999|      0|                offset = input.getLastOffset();
 1000|      0|            }
 1001|   359M|        } else {
 1002|   359M|            handleCharacter(ch);
 1003|   359M|            if (before_token) {
  ------------------
  |  Branch (1003:17): [True: 15.7M, False: 343M]
  ------------------
 1004|  15.7M|                ++offset;
 1005|  15.7M|            }
 1006|   359M|            if (in_token) {
  ------------------
  |  Branch (1006:17): [True: 324M, False: 34.8M]
  ------------------
 1007|   324M|                raw_val += ch;
 1008|   324M|            }
 1009|   359M|            if (max_len && (raw_val.length() >= max_len) && (state != st_token_ready)) {
  ------------------
  |  Branch (1009:17): [True: 10.1M, False: 349M]
  |  Branch (1009:28): [True: 218k, False: 9.94M]
  |  Branch (1009:61): [True: 217k, False: 893]
  ------------------
 1010|       |                // terminate this token now
 1011|   217k|                QTC::TC("qpdf", "QPDFTokenizer block long token");
 1012|   217k|                type = tt::tt_bad;
 1013|   217k|                state = st_token_ready;
 1014|   217k|                error_message = "exceeded allowable length while reading token";
 1015|   217k|            }
 1016|   359M|        }
 1017|   359M|    }
 1018|       |
 1019|  20.1M|    input.fastUnread(!in_token && !before_token);
  ------------------
  |  Branch (1019:22): [True: 19.0M, False: 1.06M]
  |  Branch (1019:35): [True: 19.0M, False: 16.8k]
  ------------------
 1020|       |
 1021|  20.1M|    if (type != tt::tt_eof) {
  ------------------
  |  Branch (1021:9): [True: 20.1M, False: 15.7k]
  ------------------
 1022|  20.1M|        input.setLastOffset(offset);
 1023|  20.1M|    }
 1024|       |
 1025|  20.1M|    return error_message.empty();
 1026|  20.1M|}
QPDFTokenizer.cc:_ZL12is_delimiterc:
   25|   160M|{
   26|   160M|    return (
   27|   160M|        ch == ' ' || ch == '\n' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (27:9): [True: 8.67M, False: 151M]
  |  Branch (27:22): [True: 485k, False: 151M]
  |  Branch (27:36): [True: 9.02M, False: 142M]
  |  Branch (27:49): [True: 28.8k, False: 142M]
  |  Branch (27:62): [True: 34.2k, False: 142M]
  |  Branch (27:75): [True: 8.67k, False: 142M]
  |  Branch (27:88): [True: 9.08k, False: 142M]
  ------------------
   28|   142M|        ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch == '\t' || ch == '\r' ||
  ------------------
  |  Branch (28:9): [True: 103k, False: 142M]
  |  Branch (28:22): [True: 81.6k, False: 142M]
  |  Branch (28:35): [True: 95.8k, False: 141M]
  |  Branch (28:48): [True: 65.4k, False: 141M]
  |  Branch (28:61): [True: 13.0k, False: 141M]
  |  Branch (28:74): [True: 22.5k, False: 141M]
  |  Branch (28:88): [True: 202k, False: 141M]
  ------------------
   29|   141M|        ch == '\v' || ch == '\f' || ch == 0);
  ------------------
  |  Branch (29:9): [True: 13.9k, False: 141M]
  |  Branch (29:23): [True: 52.3k, False: 141M]
  |  Branch (29:37): [True: 118k, False: 141M]
  ------------------
   30|   160M|}

_ZN10QPDF_ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEEb:
   39|    994|{
   40|    994|    if (sparse) {
  ------------------
  |  Branch (40:9): [True: 600, False: 394]
  ------------------
   41|    600|        sp = std::make_unique<Sparse>();
   42|  3.59M|        for (auto& item: v) {
  ------------------
  |  Branch (42:24): [True: 3.59M, False: 600]
  ------------------
   43|  3.59M|            if (item.raw_type_code() != ::ot_null || item.indirect()) {
  ------------------
  |  Branch (43:17): [True: 3.52M, False: 69.4k]
  |  Branch (43:54): [True: 218, False: 69.2k]
  ------------------
   44|  3.52M|                sp->elements[sp->size] = std::move(item);
   45|  3.52M|            }
   46|  3.59M|            ++sp->size;
   47|  3.59M|        }
   48|    600|    } else {
   49|    394|        elements = std::move(v);
   50|    394|    }
   51|    994|}
_ZNK4qpdf5Array5arrayEv:
   55|   126k|{
   56|   126k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (56:14): [True: 126k, False: 0]
  ------------------
   57|   126k|        return a;
   58|   126k|    }
   59|       |
   60|      0|    throw std::runtime_error("Expected an array but found a non-array object");
   61|      0|    return nullptr; // unreachable
   62|   126k|}
_ZN4qpdf5ArrayC2ERKNSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   65|  2.84k|    BaseHandle(QPDFObject::create<QPDF_Array>(items))
   66|  2.84k|{
   67|  2.84k|}
_ZN4qpdf5ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   70|  9.12k|    BaseHandle(QPDFObject::create<QPDF_Array>(std::move(items)))
   71|  9.12k|{
   72|  9.12k|}
_ZN4qpdf5Array5emptyEv:
   76|  1.66k|{
   77|  1.66k|    return Array(std::vector<QPDFObjectHandle>());
   78|  1.66k|}
_ZN4qpdf5Array5beginEv:
   82|  34.8k|{
   83|  34.8k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (83:14): [True: 17.4k, False: 17.4k]
  ------------------
   84|  17.4k|        if (!a->sp) {
  ------------------
  |  Branch (84:13): [True: 16.9k, False: 493]
  ------------------
   85|  16.9k|            return a->elements.begin();
   86|  16.9k|        }
   87|    493|        if (!sp_elements) {
  ------------------
  |  Branch (87:13): [True: 493, False: 0]
  ------------------
   88|    493|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
   89|    493|        }
   90|    493|        return sp_elements->begin();
   91|  17.4k|    }
   92|  17.4k|    return {};
   93|  34.8k|}
_ZN4qpdf5Array3endEv:
   97|  34.8k|{
   98|  34.8k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (98:14): [True: 17.4k, False: 17.4k]
  ------------------
   99|  17.4k|        if (!a->sp) {
  ------------------
  |  Branch (99:13): [True: 16.9k, False: 493]
  ------------------
  100|  16.9k|            return a->elements.end();
  101|  16.9k|        }
  102|    493|        if (!sp_elements) {
  ------------------
  |  Branch (102:13): [True: 0, False: 493]
  ------------------
  103|      0|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
  104|      0|        }
  105|    493|        return sp_elements->end();
  106|  17.4k|    }
  107|  17.4k|    return {};
  108|  34.8k|}
_ZNK4qpdf5Array4sizeEv:
  178|   346k|{
  179|   346k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (179:14): [True: 295k, False: 50.6k]
  ------------------
  180|   295k|        return a->sp ? a->sp->size : a->elements.size();
  ------------------
  |  Branch (180:16): [True: 1.55k, False: 294k]
  ------------------
  181|   295k|    }
  182|  50.6k|    return 0;
  183|   346k|}
_ZNK4qpdf5ArrayixEm:
  187|   680k|{
  188|   680k|    static const QPDFObjectHandle null_obj;
  189|   680k|    auto a = as<QPDF_Array>();
  190|   680k|    if (!a) {
  ------------------
  |  Branch (190:9): [True: 956, False: 679k]
  ------------------
  191|    956|        return null_obj;
  192|    956|    }
  193|   679k|    if (a->sp) {
  ------------------
  |  Branch (193:9): [True: 971, False: 678k]
  ------------------
  194|    971|        auto const& iter = a->sp->elements.find(n);
  195|    971|        return iter == a->sp->elements.end() ? null_obj : iter->second;
  ------------------
  |  Branch (195:16): [True: 147, False: 824]
  ------------------
  196|    971|    }
  197|   678k|    return n >= a->elements.size() ? null_obj : a->elements[n];
  ------------------
  |  Branch (197:12): [True: 1.77k, False: 676k]
  ------------------
  198|   679k|}
_ZNK4qpdf5ArrayixEi:
  202|   673k|{
  203|   673k|    static const QPDFObjectHandle null_obj;
  204|   673k|    if (n < 0) {
  ------------------
  |  Branch (204:9): [True: 2.51k, False: 671k]
  ------------------
  205|  2.51k|        return null_obj;
  206|  2.51k|    }
  207|   671k|    return (*this)[static_cast<size_t>(n)];
  208|   673k|}
_ZNK4qpdf5Array3getEm:
  212|    157|{
  213|    157|    if (n >= size()) {
  ------------------
  |  Branch (213:9): [True: 0, False: 157]
  ------------------
  214|      0|        return {};
  215|      0|    }
  216|    157|    auto a = array();
  217|    157|    if (!a->sp) {
  ------------------
  |  Branch (217:9): [True: 157, False: 0]
  ------------------
  218|    157|        return a->elements[n];
  219|    157|    }
  220|      0|    auto const& iter = a->sp->elements.find(n);
  221|      0|    return iter == a->sp->elements.end() ? null() : iter->second;
  ------------------
  |  Branch (221:12): [True: 0, False: 0]
  ------------------
  222|    157|}
_ZNK4qpdf5Array3getEi:
  226|    157|{
  227|    157|    if (n < 0) {
  ------------------
  |  Branch (227:9): [True: 0, False: 157]
  ------------------
  228|      0|        return {};
  229|      0|    }
  230|    157|    return get(to_s(n));
  231|    157|}
_ZNK4qpdf5Array11getAsVectorEv:
  235|  11.0k|{
  236|  11.0k|    auto a = array();
  237|  11.0k|    if (a->sp) {
  ------------------
  |  Branch (237:9): [True: 527, False: 10.4k]
  ------------------
  238|    527|        std::vector<QPDFObjectHandle> v;
  239|    527|        v.reserve(size());
  240|   634k|        for (auto const& item: a->sp->elements) {
  ------------------
  |  Branch (240:30): [True: 634k, False: 527]
  ------------------
  241|   634k|            v.resize(item.first, null_oh);
  242|   634k|            v.emplace_back(item.second);
  243|   634k|        }
  244|    527|        v.resize(size(), null_oh);
  245|    527|        return v;
  246|  10.4k|    } else {
  247|  10.4k|        return a->elements;
  248|  10.4k|    }
  249|  11.0k|}
_ZN4qpdf5Array3setEmRK16QPDFObjectHandle:
  253|     16|{
  254|     16|    if (at >= size()) {
  ------------------
  |  Branch (254:9): [True: 0, False: 16]
  ------------------
  255|      0|        return false;
  256|      0|    }
  257|     16|    auto a = array();
  258|     16|    checkOwnership(oh);
  259|     16|    if (a->sp) {
  ------------------
  |  Branch (259:9): [True: 0, False: 16]
  ------------------
  260|      0|        a->sp->elements[at] = oh;
  261|     16|    } else {
  262|     16|        a->elements[at] = oh;
  263|     16|    }
  264|     16|    return true;
  265|     16|}
_ZN4qpdf5Array3setEiRK16QPDFObjectHandle:
  269|     16|{
  270|     16|    if (at < 0) {
  ------------------
  |  Branch (270:9): [True: 0, False: 16]
  ------------------
  271|      0|        return false;
  272|      0|    }
  273|     16|    return set(to_s(at), oh);
  274|     16|}
_ZN4qpdf5Array6insertEmRK16QPDFObjectHandle:
  290|  35.5k|{
  291|  35.5k|    auto a = array();
  292|  35.5k|    size_t sz = size();
  293|  35.5k|    if (at > sz) {
  ------------------
  |  Branch (293:9): [True: 0, False: 35.5k]
  ------------------
  294|      0|        return false;
  295|      0|    }
  296|  35.5k|    checkOwnership(item);
  297|  35.5k|    if (at == sz) {
  ------------------
  |  Branch (297:9): [True: 35.5k, False: 0]
  ------------------
  298|       |        // As special case, also allow insert beyond the end
  299|  35.5k|        push_back(item);
  300|  35.5k|        return true;
  301|  35.5k|    }
  302|      0|    if (!a->sp) {
  ------------------
  |  Branch (302:9): [True: 0, False: 0]
  ------------------
  303|      0|        a->elements.insert(a->elements.cbegin() + to_i(at), item);
  304|      0|        return true;
  305|      0|    }
  306|      0|    auto iter = a->sp->elements.crbegin();
  307|      0|    while (iter != a->sp->elements.crend()) {
  ------------------
  |  Branch (307:12): [True: 0, False: 0]
  ------------------
  308|      0|        auto key = (iter++)->first;
  309|      0|        if (key >= at) {
  ------------------
  |  Branch (309:13): [True: 0, False: 0]
  ------------------
  310|      0|            auto nh = a->sp->elements.extract(key);
  311|      0|            ++nh.key();
  312|      0|            a->sp->elements.insert(std::move(nh));
  313|      0|        } else {
  314|      0|            break;
  315|      0|        }
  316|      0|    }
  317|      0|    a->sp->elements[at] = item;
  318|      0|    ++a->sp->size;
  319|      0|    return true;
  320|      0|}
_ZN4qpdf5Array6insertEiRK16QPDFObjectHandle:
  324|  35.5k|{
  325|  35.5k|    if (at_i < 0) {
  ------------------
  |  Branch (325:9): [True: 0, False: 35.5k]
  ------------------
  326|      0|        return false;
  327|      0|    }
  328|  35.5k|    return insert(to_s(at_i), item);
  329|  35.5k|}
_ZN4qpdf5Array9push_backERK16QPDFObjectHandle:
  333|  58.0k|{
  334|  58.0k|    auto a = array();
  335|  58.0k|    checkOwnership(item);
  336|  58.0k|    if (a->sp) {
  ------------------
  |  Branch (336:9): [True: 0, False: 58.0k]
  ------------------
  337|      0|        a->sp->elements[(a->sp->size)++] = item;
  338|  58.0k|    } else {
  339|  58.0k|        a->elements.emplace_back(item);
  340|  58.0k|    }
  341|  58.0k|}
_ZN4qpdf5Array5eraseEm:
  345|  22.1k|{
  346|  22.1k|    auto a = array();
  347|  22.1k|    if (at >= size()) {
  ------------------
  |  Branch (347:9): [True: 0, False: 22.1k]
  ------------------
  348|      0|        return false;
  349|      0|    }
  350|  22.1k|    if (!a->sp) {
  ------------------
  |  Branch (350:9): [True: 22.1k, False: 0]
  ------------------
  351|  22.1k|        a->elements.erase(a->elements.cbegin() + to_i(at));
  352|  22.1k|        return true;
  353|  22.1k|    }
  354|      0|    auto end = a->sp->elements.end();
  355|      0|    if (auto iter = a->sp->elements.lower_bound(at); iter != end) {
  ------------------
  |  Branch (355:54): [True: 0, False: 0]
  ------------------
  356|      0|        if (iter->first == at) {
  ------------------
  |  Branch (356:13): [True: 0, False: 0]
  ------------------
  357|      0|            iter++;
  358|      0|            a->sp->elements.erase(at);
  359|      0|        }
  360|       |
  361|      0|        while (iter != end) {
  ------------------
  |  Branch (361:16): [True: 0, False: 0]
  ------------------
  362|      0|            auto nh = a->sp->elements.extract(iter++);
  363|      0|            --nh.key();
  364|      0|            a->sp->elements.insert(std::move(nh));
  365|      0|        }
  366|      0|    }
  367|      0|    --(a->sp->size);
  368|      0|    return true;
  369|  22.1k|}
_ZN4qpdf5Array5eraseEi:
  373|  22.1k|{
  374|  22.1k|    if (at_i < 0) {
  ------------------
  |  Branch (374:9): [True: 0, False: 22.1k]
  ------------------
  375|      0|        return false;
  376|      0|    }
  377|  22.1k|    return erase(to_s(at_i));
  378|  22.1k|}
_ZNK16QPDFObjectHandle12getArrayItemEi:
  393|  28.6k|{
  394|  28.6k|    if (auto array = Array(*this)) {
  ------------------
  |  Branch (394:14): [True: 28.6k, False: 0]
  ------------------
  395|  28.6k|        if (auto result = array[n]) {
  ------------------
  |  Branch (395:18): [True: 28.6k, False: 47]
  ------------------
  396|  28.6k|            return result;
  397|  28.6k|        }
  398|     47|        if (n >= 0 && std::cmp_less(n, array.size())) {
  ------------------
  |  Branch (398:13): [True: 47, False: 0]
  |  Branch (398:23): [True: 47, False: 0]
  ------------------
  399|       |            // sparse array null
  400|     47|            return newNull();
  401|     47|        }
  402|      0|        objectWarning("returning null for out of bounds array access");
  403|      0|    } else {
  404|      0|        typeWarning("array", "returning null");
  405|      0|    }
  406|      0|    static auto constexpr msg = " -> null returned from invalid array access"sv;
  407|      0|    return QPDF_Null::create(obj, msg, "");
  408|  28.6k|}
_ZNK16QPDFObjectHandle11isRectangleEv:
  412|  17.2k|{
  413|  17.2k|    Array array(*this);
  414|  28.2k|    for (auto const& oh: array) {
  ------------------
  |  Branch (414:24): [True: 28.2k, False: 17.1k]
  ------------------
  415|  28.2k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (415:13): [True: 151, False: 28.1k]
  ------------------
  416|    151|            return false;
  417|    151|        }
  418|  28.2k|    }
  419|  17.1k|    return array.size() == 4;
  420|  17.2k|}
_ZNK16QPDFObjectHandle16getArrayAsVectorEv:
  472|  10.5k|{
  473|  10.5k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (473:14): [True: 10.5k, False: 0]
  ------------------
  474|  10.5k|        return array.getAsVector();
  475|  10.5k|    }
  476|      0|    typeWarning("array", "treating as empty");
  477|      0|    QTC::TC("qpdf", "QPDFObjectHandle array treating as empty vector");
  478|      0|    return {};
  479|  10.5k|}
_ZNK4qpdf10BaseHandle4sizeEv:
  566|  26.7k|{
  567|  26.7k|    switch (resolved_type_code()) {
  568|  12.7k|    case ::ot_array:
  ------------------
  |  Branch (568:5): [True: 12.7k, False: 14.0k]
  ------------------
  569|  12.7k|        return as<QPDF_Array>()->size();
  570|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (570:5): [True: 0, False: 26.7k]
  ------------------
  571|      0|    case ::ot_reserved:
  ------------------
  |  Branch (571:5): [True: 0, False: 26.7k]
  ------------------
  572|  8.30k|    case ::ot_null:
  ------------------
  |  Branch (572:5): [True: 8.30k, False: 18.4k]
  ------------------
  573|  8.30k|    case ::ot_destroyed:
  ------------------
  |  Branch (573:5): [True: 0, False: 26.7k]
  ------------------
  574|  8.30k|    case ::ot_unresolved:
  ------------------
  |  Branch (574:5): [True: 0, False: 26.7k]
  ------------------
  575|  8.30k|    case ::ot_reference:
  ------------------
  |  Branch (575:5): [True: 0, False: 26.7k]
  ------------------
  576|  8.30k|        return 0;
  577|     37|    case ::ot_boolean:
  ------------------
  |  Branch (577:5): [True: 37, False: 26.7k]
  ------------------
  578|    113|    case ::ot_integer:
  ------------------
  |  Branch (578:5): [True: 76, False: 26.6k]
  ------------------
  579|    185|    case ::ot_real:
  ------------------
  |  Branch (579:5): [True: 72, False: 26.6k]
  ------------------
  580|    259|    case ::ot_string:
  ------------------
  |  Branch (580:5): [True: 74, False: 26.6k]
  ------------------
  581|  5.64k|    case ::ot_name:
  ------------------
  |  Branch (581:5): [True: 5.38k, False: 21.3k]
  ------------------
  582|  5.69k|    case ::ot_dictionary:
  ------------------
  |  Branch (582:5): [True: 48, False: 26.7k]
  ------------------
  583|  5.71k|    case ::ot_stream:
  ------------------
  |  Branch (583:5): [True: 19, False: 26.7k]
  ------------------
  584|  5.71k|    case ::ot_inlineimage:
  ------------------
  |  Branch (584:5): [True: 0, False: 26.7k]
  ------------------
  585|  5.71k|    case ::ot_operator:
  ------------------
  |  Branch (585:5): [True: 0, False: 26.7k]
  ------------------
  586|  5.71k|        return 1;
  587|      0|    default:
  ------------------
  |  Branch (587:5): [True: 0, False: 26.7k]
  ------------------
  588|      0|        throw std::logic_error("Unexpected type code in size"); // unreachable
  589|      0|        return 0;                                               // unreachable
  590|  26.7k|    }
  591|  26.7k|}
_ZNK4qpdf10BaseHandleixEm:
  595|  1.14k|{
  596|  1.14k|    if (resolved_type_code() == ::ot_array) {
  ------------------
  |  Branch (596:9): [True: 1.14k, False: 0]
  ------------------
  597|  1.14k|        return Array(obj)[n];
  598|  1.14k|    }
  599|      0|    if (n < size()) {
  ------------------
  |  Branch (599:9): [True: 0, False: 0]
  ------------------
  600|      0|        return *this;
  601|      0|    }
  602|      0|    return {};
  603|      0|}
_ZNK4qpdf10BaseHandleixEi:
  607|  1.14k|{
  608|  1.14k|    if (n < 0) {
  ------------------
  |  Branch (608:9): [True: 0, False: 1.14k]
  ------------------
  609|      0|        return {};
  610|      0|    }
  611|  1.14k|    return (*this)[static_cast<size_t>(n)];
  612|  1.14k|}
QPDF_Array.cc:_ZL4to_si:
   15|  57.9k|{
   16|  57.9k|    return static_cast<size_t>(n);
   17|  57.9k|}
_ZNK4qpdf5Array14checkOwnershipERK16QPDFObjectHandle:
   27|  93.6k|{
   28|  93.6k|    if (!item) {
  ------------------
  |  Branch (28:9): [True: 0, False: 93.6k]
  ------------------
   29|      0|        throw std::logic_error("Attempting to add an uninitialized object to a QPDF_Array.");
   30|      0|    }
   31|  93.6k|    if (qpdf() && item.qpdf() && qpdf() != item.qpdf()) {
  ------------------
  |  Branch (31:9): [True: 16, False: 93.5k]
  |  Branch (31:19): [True: 16, False: 0]
  |  Branch (31:34): [True: 0, False: 16]
  ------------------
   32|      0|        throw std::logic_error(
   33|      0|            "Attempting to add an object from a different QPDF. Use "
   34|      0|            "QPDF::copyForeignObject to add objects from another file.");
   35|      0|    }
   36|  93.6k|}
QPDF_Array.cc:_ZL4to_im:
   21|  22.1k|{
   22|  22.1k|    return static_cast<int>(n);
   23|  22.1k|}

_ZNK4qpdf14BaseDictionary4dictEv:
   12|  11.3k|{
   13|  11.3k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (13:14): [True: 11.3k, False: 0]
  ------------------
   14|  11.3k|        return d;
   15|  11.3k|    }
   16|      0|    throw std::runtime_error("Expected a dictionary but found a non-dictionary object");
   17|      0|    return nullptr; // unreachable
   18|  11.3k|}
_ZNK4qpdf10BaseHandleixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   22|   886k|{
   23|   886k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (23:14): [True: 875k, False: 11.0k]
  ------------------
   24|   875k|        auto it = d->items.find(key);
   25|   875k|        if (it != d->items.end()) {
  ------------------
  |  Branch (25:13): [True: 672k, False: 202k]
  ------------------
   26|   672k|            return it->second;
   27|   672k|        }
   28|   875k|    }
   29|   213k|    static const QPDFObjectHandle null_obj;
   30|   213k|    return null_obj;
   31|   886k|}
_ZNK4qpdf10BaseHandle8containsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   63|  59.2k|{
   64|  59.2k|    return !(*this)[key].null();
   65|  59.2k|}
_ZN4qpdf14BaseDictionary7getKeysEv:
   99|  11.3k|{
  100|  11.3k|    std::set<std::string> result;
  101|  39.2k|    for (auto& iter: dict()->items) {
  ------------------
  |  Branch (101:20): [True: 39.2k, False: 11.3k]
  ------------------
  102|  39.2k|        if (!iter.second.null()) {
  ------------------
  |  Branch (102:13): [True: 36.2k, False: 2.99k]
  ------------------
  103|  36.2k|            result.insert(iter.first);
  104|  36.2k|        }
  105|  39.2k|    }
  106|  11.3k|    return result;
  107|  11.3k|}
_ZN4qpdf10BaseHandle5eraseERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  117|  16.0k|{
  118|       |    // no-op if key does not exist
  119|  16.0k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (119:14): [True: 16.0k, False: 0]
  ------------------
  120|  16.0k|        return d->items.erase(key);
  121|  16.0k|    }
  122|      0|    return 0;
  123|  16.0k|}
_ZN4qpdf10BaseHandle7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  140|  41.3k|{
  141|  41.3k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (141:14): [True: 41.3k, False: 0]
  ------------------
  142|  41.3k|        if (value.null() && !value.indirect()) {
  ------------------
  |  Branch (142:13): [True: 519, False: 40.8k]
  |  Branch (142:29): [True: 519, False: 0]
  ------------------
  143|       |            // The PDF spec doesn't distinguish between keys with null values and missing keys.
  144|       |            // Allow indirect nulls which are equivalent to a dangling reference, which is permitted
  145|       |            // by the spec.
  146|    519|            d->items.erase(key);
  147|  40.8k|        } else {
  148|       |            // add or replace value
  149|  40.8k|            d->items[key] = value;
  150|  40.8k|        }
  151|  41.3k|        return true;
  152|  41.3k|    }
  153|      0|    return false;
  154|  41.3k|}
_ZN4qpdf14BaseDictionary7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  172|  41.3k|{
  173|  41.3k|    if (!BaseHandle::replace(key, value)) {
  ------------------
  |  Branch (173:9): [True: 0, False: 41.3k]
  ------------------
  174|      0|        (void)dict();
  175|      0|    }
  176|  41.3k|}
_ZN4qpdf10DictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  179|  1.66k|    BaseDictionary(std::move(dict))
  180|  1.66k|{
  181|  1.66k|}
_ZN4qpdf10DictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  184|  47.3k|    BaseDictionary(obj)
  185|  47.3k|{
  186|  47.3k|}
_ZNK16QPDFObjectHandle14checkOwnershipERKS_:
  196|  31.1k|{
  197|  31.1k|    auto qpdf = getOwningQPDF();
  198|  31.1k|    auto item_qpdf = item.getOwningQPDF();
  199|  31.1k|    if (qpdf && item_qpdf && qpdf != item_qpdf) {
  ------------------
  |  Branch (199:9): [True: 29.3k, False: 1.82k]
  |  Branch (199:17): [True: 5.44k, False: 23.9k]
  |  Branch (199:30): [True: 0, False: 5.44k]
  ------------------
  200|      0|        throw std::logic_error(
  201|      0|            "Attempting to add an object from a different QPDF. Use "
  202|      0|            "QPDF::copyForeignObject to add objects from another file.");
  203|      0|    }
  204|  31.1k|}
_ZNK16QPDFObjectHandle6hasKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  208|  38.0k|{
  209|  38.0k|    if (Dictionary dict = *this) {
  ------------------
  |  Branch (209:20): [True: 37.8k, False: 170]
  ------------------
  210|  37.8k|        return dict.contains(key);
  211|  37.8k|    } else {
  212|    170|        typeWarning("dictionary", "returning false for a key containment request");
  213|    170|        QTC::TC("qpdf", "QPDFObjectHandle dictionary false for hasKey");
  214|    170|        return false;
  215|    170|    }
  216|  38.0k|}
_ZNK16QPDFObjectHandle6getKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  220|   248k|{
  221|   248k|    if (auto result = get(key)) {
  ------------------
  |  Branch (221:14): [True: 172k, False: 75.4k]
  ------------------
  222|   172k|        return result;
  223|   172k|    }
  224|  75.4k|    if (isDictionary()) {
  ------------------
  |  Branch (224:9): [True: 75.2k, False: 264]
  ------------------
  225|  75.2k|        static auto constexpr msg = " -> dictionary key $VD"sv;
  226|  75.2k|        return QPDF_Null::create(obj, msg, key);
  227|  75.2k|    }
  228|    264|    typeWarning("dictionary", "returning null for attempted key retrieval");
  229|    264|    static auto constexpr msg = " -> null returned from getting key $VD from non-Dictionary"sv;
  230|    264|    return QPDF_Null::create(obj, msg, "");
  231|  75.4k|}
_ZNK16QPDFObjectHandle12getKeyIfDictERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  235|  1.88k|{
  236|  1.88k|    return isNull() ? newNull() : getKey(key);
  ------------------
  |  Branch (236:12): [True: 254, False: 1.62k]
  ------------------
  237|  1.88k|}
_ZNK16QPDFObjectHandle7getKeysEv:
  241|  11.5k|{
  242|  11.5k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (242:14): [True: 11.3k, False: 181]
  ------------------
  243|  11.3k|        return dict.getKeys();
  244|  11.3k|    }
  245|    181|    typeWarning("dictionary", "treating as empty");
  246|    181|    QTC::TC("qpdf", "QPDFObjectHandle dictionary empty set for getKeys");
  247|    181|    return {};
  248|  11.5k|}
_ZN16QPDFObjectHandle10replaceKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  263|  34.7k|{
  264|  34.7k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (264:14): [True: 31.1k, False: 3.58k]
  ------------------
  265|  31.1k|        checkOwnership(value);
  266|  31.1k|        dict.replace(key, value);
  267|  31.1k|        return;
  268|  31.1k|    }
  269|  3.58k|    typeWarning("dictionary", "ignoring key replacement request");
  270|  3.58k|}
_ZN16QPDFObjectHandle9removeKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  289|     20|{
  290|     20|    if (erase(key) || isDictionary()) {
  ------------------
  |  Branch (290:9): [True: 20, False: 0]
  |  Branch (290:23): [True: 0, False: 0]
  ------------------
  291|     20|        return;
  292|     20|    }
  293|      0|    typeWarning("dictionary", "ignoring key removal request");
  294|      0|}

_ZN4QPDF3Doc7Objects7StreamsC2ERNS0_6CommonE:
  126|  20.8k|    Common(common),
  127|  20.8k|    copier_(std::make_shared<Copier>(*this))
  128|  20.8k|{
  129|  20.8k|}
_ZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  225|  13.7k|{
  226|  13.7k|    if (filter_factories_registered) [[unlikely]] {
  ------------------
  |  Branch (226:9): [True: 0, False: 13.7k]
  ------------------
  227|       |        // We need to check user provided filters first as we allow users to replace qpdf provided
  228|       |        // default filters. This will have a performance impact if the facility to register stream
  229|       |        // filters is actually used. We can optimize this away if necessary.
  230|      0|        auto ff = filter_factories.find(expand_filter_name(name));
  231|      0|        if (ff != filter_factories.end()) {
  ------------------
  |  Branch (231:13): [True: 0, False: 0]
  ------------------
  232|      0|            return ff->second;
  233|      0|        }
  234|      0|    }
  235|  13.7k|    if (name == "/FlateDecode") {
  ------------------
  |  Branch (235:9): [True: 3.38k, False: 10.3k]
  ------------------
  236|  3.38k|        return SF_FlateLzwDecode::flate_factory;
  237|  3.38k|    }
  238|  10.3k|    if (name == "/Crypt") {
  ------------------
  |  Branch (238:9): [True: 1.08k, False: 9.31k]
  ------------------
  239|  1.08k|        return []() { return std::make_shared<SF_Crypt>(); };
  240|  1.08k|    }
  241|  9.31k|    if (name == "/LZWDecode") {
  ------------------
  |  Branch (241:9): [True: 501, False: 8.81k]
  ------------------
  242|    501|        return SF_FlateLzwDecode::lzw_factory;
  243|    501|    }
  244|  8.81k|    if (name == "/RunLengthDecode") {
  ------------------
  |  Branch (244:9): [True: 70, False: 8.74k]
  ------------------
  245|     70|        return SF_RunLengthDecode::factory;
  246|     70|    }
  247|  8.74k|    if (name == "/DCTDecode") {
  ------------------
  |  Branch (247:9): [True: 34, False: 8.70k]
  ------------------
  248|     34|        return SF_DCTDecode::factory;
  249|     34|    }
  250|  8.70k|    if (name == "/ASCII85Decode") {
  ------------------
  |  Branch (250:9): [True: 550, False: 8.15k]
  ------------------
  251|    550|        return SF_ASCII85Decode::factory;
  252|    550|    }
  253|  8.15k|    if (name == "/ASCIIHexDecode") {
  ------------------
  |  Branch (253:9): [True: 7, False: 8.14k]
  ------------------
  254|      7|        return SF_ASCIIHexDecode::factory;
  255|      7|    }
  256|       |    // The PDF specification provides these filter abbreviations for use in inline images, but
  257|       |    // according to table H.1 in the pre-ISO versions of the PDF specification, Adobe Reader
  258|       |    // also accepts them for stream filters.
  259|       |
  260|  8.14k|    if (name == "/Fl") {
  ------------------
  |  Branch (260:9): [True: 2.38k, False: 5.76k]
  ------------------
  261|  2.38k|        return SF_FlateLzwDecode::flate_factory;
  262|  2.38k|    }
  263|  5.76k|    if (name == "/AHx") {
  ------------------
  |  Branch (263:9): [True: 522, False: 5.24k]
  ------------------
  264|    522|        return SF_ASCIIHexDecode::factory;
  265|    522|    }
  266|  5.24k|    if (name == "/A85") {
  ------------------
  |  Branch (266:9): [True: 249, False: 4.99k]
  ------------------
  267|    249|        return SF_ASCII85Decode::factory;
  268|    249|    }
  269|  4.99k|    if (name == "/LZW") {
  ------------------
  |  Branch (269:9): [True: 3.30k, False: 1.69k]
  ------------------
  270|  3.30k|        return SF_FlateLzwDecode::lzw_factory;
  271|  3.30k|    }
  272|  1.69k|    if (name == "/RL") {
  ------------------
  |  Branch (272:9): [True: 1.19k, False: 505]
  ------------------
  273|  1.19k|        return SF_RunLengthDecode::factory;
  274|  1.19k|    }
  275|    505|    if (name == "/DCT") {
  ------------------
  |  Branch (275:9): [True: 131, False: 374]
  ------------------
  276|    131|        return SF_DCTDecode::factory;
  277|    131|    }
  278|    374|    return nullptr;
  279|    505|}
_ZN4qpdf6StreamC2ER4QPDF10QPDFObjGen16QPDFObjectHandlexm:
  283|  28.9k|    BaseHandle(QPDFObject::create<QPDF_Stream>(&qpdf, og, std::move(stream_dict), length))
  284|  28.9k|{
  285|  28.9k|    auto descr = std::make_shared<QPDFObject::Description>(
  286|  28.9k|        qpdf.getFilename() + ", stream object " + og.unparse(' '));
  287|  28.9k|    obj->setDescription(&qpdf, descr, offset);
  288|  28.9k|    setDictDescription();
  289|  28.9k|}
_ZN4qpdf6Stream18setDictDescriptionEv:
  451|  28.9k|{
  452|  28.9k|    auto s = stream();
  453|  28.9k|    if (!s->stream_dict.hasObjectDescription()) {
  ------------------
  |  Branch (453:9): [True: 0, False: 28.9k]
  ------------------
  454|      0|        s->stream_dict.setObjectDescription(
  455|      0|            obj->getQPDF(), obj->getDescription() + " -> stream dictionary");
  456|      0|    }
  457|  28.9k|}
_ZN4qpdf6Stream13getStreamDataE26qpdf_stream_decode_level_e:
  461|  11.0k|{
  462|  11.0k|    std::string result;
  463|  11.0k|    pl::String buf(result);
  464|  11.0k|    bool filtered;
  465|  11.0k|    pipeStreamData(&buf, &filtered, 0, decode_level, false, false);
  466|  11.0k|    if (!filtered) {
  ------------------
  |  Branch (466:9): [True: 2.42k, False: 8.57k]
  ------------------
  467|  2.42k|        throw QPDFExc(
  468|  2.42k|            qpdf_e_unsupported,
  469|  2.42k|            qpdf()->getFilename(),
  470|  2.42k|            "",
  471|  2.42k|            offset(),
  472|  2.42k|            "getStreamData called on unfilterable stream");
  473|  2.42k|    }
  474|  8.57k|    return result;
  475|  11.0k|}
_ZNK4qpdf6Stream14isRootMetadataEv:
  495|  10.8k|{
  496|  10.8k|    if (!stream()->stream_dict.isDictionaryOfType("/Metadata", "/XML")) {
  ------------------
  |  Branch (496:9): [True: 10.8k, False: 18]
  ------------------
  497|  10.8k|        return false;
  498|  10.8k|    }
  499|     18|    return qpdf()->getRoot()["/Metadata"].isSameObjectAs(obj);
  500|  10.8k|}
_ZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEE:
  506|  11.0k|{
  507|  11.0k|    auto s = stream();
  508|       |    // Check filters
  509|       |
  510|  11.0k|    auto const& filter_obj = s->stream_dict["/Filter"];
  511|       |
  512|  11.0k|    if (filter_obj.null()) {
  ------------------
  |  Branch (512:9): [True: 3.88k, False: 7.12k]
  ------------------
  513|       |        // No filters
  514|  3.88k|        return true;
  515|  3.88k|    }
  516|  7.12k|    if (filter_obj.size() > global::Limits::max_stream_filters()) {
  ------------------
  |  Branch (516:9): [True: 54, False: 7.06k]
  ------------------
  517|     54|        global::Limits::error();
  518|     54|        warn(
  519|     54|            "limits error(max-stream-filters): too many filters for stream; treating stream as "
  520|     54|            "not filterable");
  521|     54|        return false;
  522|     54|    }
  523|  7.06k|    if (filter_obj.isName()) {
  ------------------
  |  Branch (523:9): [True: 5.29k, False: 1.77k]
  ------------------
  524|       |        // One filter
  525|  5.29k|        auto ff = s->filter_factory(filter_obj.getName());
  526|  5.29k|        if (!ff) {
  ------------------
  |  Branch (526:13): [True: 211, False: 5.08k]
  ------------------
  527|    211|            return false;
  528|    211|        }
  529|  5.08k|        filters.emplace_back(ff());
  530|  5.08k|    } else if (Array array = filter_obj) {
  ------------------
  |  Branch (530:22): [True: 1.76k, False: 9]
  ------------------
  531|       |        // Potentially multiple filters
  532|  8.50k|        for (Name item: array) {
  ------------------
  |  Branch (532:23): [True: 8.50k, False: 1.58k]
  ------------------
  533|  8.50k|            if (!item) {
  ------------------
  |  Branch (533:17): [True: 17, False: 8.48k]
  ------------------
  534|     17|                warn("stream filter type is not name or array");
  535|     17|                return false;
  536|     17|            }
  537|  8.48k|            auto ff = s->filter_factory(item);
  538|  8.48k|            if (!ff) {
  ------------------
  |  Branch (538:17): [True: 163, False: 8.32k]
  ------------------
  539|    163|                filters.clear();
  540|    163|                return false;
  541|    163|            }
  542|  8.32k|            filters.emplace_back(ff());
  543|  8.32k|        }
  544|  1.76k|    } else {
  545|      9|        warn("stream filter type is not name or array");
  546|      9|        return false;
  547|      9|    }
  548|       |
  549|       |    // filters now contains a list of filters to be applied in order. See which ones we can support.
  550|       |    // See if we can support any decode parameters that are specified.
  551|       |
  552|  6.66k|    auto decode_obj = s->stream_dict.getKey("/DecodeParms");
  553|       |
  554|  6.66k|    auto can_filter = // linebreak
  555|  6.66k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  6.66k|        if (!filter.setDecodeParms(d_obj) ||
  557|  6.66k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  558|  6.66k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  559|  6.66k|            return false;
  560|  6.66k|        }
  561|  6.66k|        return true;
  562|  6.66k|    };
  563|       |
  564|  6.66k|    auto decode_array = decode_obj.as_array(strict);
  565|  6.66k|    if (!decode_array || decode_array.size() == 0) {
  ------------------
  |  Branch (565:9): [True: 6.62k, False: 48]
  |  Branch (565:26): [True: 6, False: 42]
  ------------------
  566|  6.62k|        if (decode_array) {
  ------------------
  |  Branch (566:13): [True: 6, False: 6.62k]
  ------------------
  567|      6|            decode_obj = QPDFObjectHandle::newNull();
  568|      6|        }
  569|       |
  570|  12.3k|        for (auto& filter: filters) {
  ------------------
  |  Branch (570:26): [True: 12.3k, False: 6.45k]
  ------------------
  571|  12.3k|            if (!can_filter(decode_level, *filter, decode_obj)) {
  ------------------
  |  Branch (571:17): [True: 167, False: 12.2k]
  ------------------
  572|    167|                return false;
  573|    167|            }
  574|  12.3k|        }
  575|  6.62k|    } else {
  576|       |        // Ignore /DecodeParms entirely if /Filters is empty.  At least one case of a file whose
  577|       |        // /DecodeParms was [ << >> ] when /Filters was empty has been seen in the wild.
  578|     42|        if (!filters.empty() && QIntC::to_size(decode_array.size()) != filters.size()) {
  ------------------
  |  Branch (578:13): [True: 39, False: 3]
  |  Branch (578:13): [True: 5, False: 37]
  |  Branch (578:33): [True: 5, False: 34]
  ------------------
  579|      5|            warn("stream /DecodeParms length is inconsistent with filters");
  580|      5|            return false;
  581|      5|        }
  582|       |
  583|     37|        int i = -1;
  584|    157|        for (auto& filter: filters) {
  ------------------
  |  Branch (584:26): [True: 157, False: 27]
  ------------------
  585|    157|            auto d_obj = decode_array.get(++i);
  586|    157|            if (!can_filter(decode_level, *filter, d_obj)) {
  ------------------
  |  Branch (586:17): [True: 10, False: 147]
  ------------------
  587|     10|                return false;
  588|     10|            }
  589|    157|        }
  590|     37|    }
  591|       |
  592|  6.48k|    return true;
  593|  6.66k|}
_ZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebb:
  603|  11.0k|{
  604|  11.0k|    auto s = stream();
  605|  11.0k|    std::vector<std::shared_ptr<QPDFStreamFilter>> filters;
  606|  11.0k|    bool ignored;
  607|  11.0k|    if (!filterp) {
  ------------------
  |  Branch (607:9): [True: 0, False: 11.0k]
  ------------------
  608|      0|        filterp = &ignored;
  609|      0|    }
  610|  11.0k|    bool& filter = *filterp;
  611|       |
  612|  11.0k|    const bool empty_stream = !s->stream_provider && !s->stream_data && s->length == 0;
  ------------------
  |  Branch (612:31): [True: 11.0k, False: 0]
  |  Branch (612:54): [True: 11.0k, False: 0]
  |  Branch (612:73): [True: 762, False: 10.2k]
  ------------------
  613|  11.0k|    const bool empty_stream_data = s->stream_data && s->stream_data->getSize() == 0;
  ------------------
  |  Branch (613:36): [True: 0, False: 11.0k]
  |  Branch (613:54): [True: 0, False: 0]
  ------------------
  614|  11.0k|    const bool empty = empty_stream || empty_stream_data;
  ------------------
  |  Branch (614:24): [True: 762, False: 10.2k]
  |  Branch (614:40): [True: 0, False: 10.2k]
  ------------------
  615|       |
  616|  11.0k|    if (empty_stream || empty_stream_data) {
  ------------------
  |  Branch (616:9): [True: 762, False: 10.2k]
  |  Branch (616:25): [True: 0, False: 10.2k]
  ------------------
  617|    762|        filter = true;
  618|    762|    }
  619|       |
  620|  11.0k|    filter = empty || encode_flags || decode_level != qpdf_dl_none;
  ------------------
  |  Branch (620:14): [True: 762, False: 10.2k]
  |  Branch (620:23): [True: 0, False: 10.2k]
  |  Branch (620:39): [True: 10.2k, False: 0]
  ------------------
  621|  11.0k|    if (filter) {
  ------------------
  |  Branch (621:9): [True: 11.0k, False: 0]
  ------------------
  622|  11.0k|        filter = filterable(decode_level, filters);
  623|  11.0k|    }
  624|       |
  625|  11.0k|    if (!pipeline) {
  ------------------
  |  Branch (625:9): [True: 0, False: 11.0k]
  ------------------
  626|      0|        QTC::TC("qpdf", "QPDF_Stream pipeStreamData with null pipeline");
  627|       |        // Return value is whether we can filter in this case.
  628|      0|        return filter;
  629|      0|    }
  630|       |
  631|       |    // Construct the pipeline in reverse order. Force pipelines we create to be deleted when this
  632|       |    // function finishes. Pipelines created by QPDFStreamFilter objects will be deleted by those
  633|       |    // objects.
  634|  11.0k|    std::vector<std::unique_ptr<Pipeline>> to_delete;
  635|       |
  636|  11.0k|    ContentNormalizer normalizer;
  637|  11.0k|    if (filter) {
  ------------------
  |  Branch (637:9): [True: 10.3k, False: 641]
  ------------------
  638|  10.3k|        if (encode_flags & qpdf_ef_compress) {
  ------------------
  |  Branch (638:13): [True: 0, False: 10.3k]
  ------------------
  639|      0|            auto new_pipeline =
  640|      0|                std::make_unique<Pl_Flate>("compress stream", pipeline, Pl_Flate::a_deflate);
  641|      0|            pipeline = new_pipeline.get();
  642|      0|            to_delete.push_back(std::move(new_pipeline));
  643|      0|        }
  644|       |
  645|  10.3k|        if (encode_flags & qpdf_ef_normalize) {
  ------------------
  |  Branch (645:13): [True: 0, False: 10.3k]
  ------------------
  646|      0|            auto new_pipeline =
  647|      0|                std::make_unique<Pl_QPDFTokenizer>("normalizer", &normalizer, pipeline);
  648|      0|            pipeline = new_pipeline.get();
  649|      0|            to_delete.push_back(std::move(new_pipeline));
  650|      0|        }
  651|       |
  652|  10.3k|        for (auto iter = s->token_filters.rbegin(); iter != s->token_filters.rend(); ++iter) {
  ------------------
  |  Branch (652:53): [True: 0, False: 10.3k]
  ------------------
  653|      0|            auto new_pipeline =
  654|      0|                std::make_unique<Pl_QPDFTokenizer>("token filter", (*iter).get(), pipeline);
  655|      0|            pipeline = new_pipeline.get();
  656|      0|            to_delete.push_back(std::move(new_pipeline));
  657|      0|        }
  658|       |
  659|  22.6k|        for (auto f_iter = filters.rbegin(); f_iter != filters.rend(); ++f_iter) {
  ------------------
  |  Branch (659:46): [True: 12.2k, False: 10.3k]
  ------------------
  660|  12.2k|            if (auto decode_pipeline = (*f_iter)->getDecodePipeline(pipeline)) {
  ------------------
  |  Branch (660:22): [True: 11.1k, False: 1.12k]
  ------------------
  661|  11.1k|                pipeline = decode_pipeline;
  662|  11.1k|            }
  663|  12.2k|            auto* flate = dynamic_cast<Pl_Flate*>(pipeline);
  664|  12.2k|            if (flate) {
  ------------------
  |  Branch (664:17): [True: 6.33k, False: 5.92k]
  ------------------
  665|  6.33k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });
  666|  6.33k|            }
  667|  12.2k|        }
  668|  10.3k|    }
  669|       |
  670|  11.0k|    if (s->stream_data.get()) {
  ------------------
  |  Branch (670:9): [True: 0, False: 11.0k]
  ------------------
  671|      0|        QTC::TC("qpdf", "QPDF_Stream pipe replaced stream data");
  672|      0|        pipeline->write(s->stream_data->getBuffer(), s->stream_data->getSize());
  673|      0|        pipeline->finish();
  674|  11.0k|    } else if (s->stream_provider.get()) {
  ------------------
  |  Branch (674:16): [True: 0, False: 11.0k]
  ------------------
  675|      0|        Pl_Count count("stream provider count", pipeline);
  676|      0|        if (s->stream_provider->supportsRetry()) {
  ------------------
  |  Branch (676:13): [True: 0, False: 0]
  ------------------
  677|      0|            if (!s->stream_provider->provideStreamData(
  ------------------
  |  Branch (677:17): [True: 0, False: 0]
  ------------------
  678|      0|                    obj->getObjGen(), &count, suppress_warnings, will_retry)) {
  679|      0|                filter = false;
  680|      0|                return false;
  681|      0|            }
  682|      0|        } else {
  683|      0|            s->stream_provider->provideStreamData(obj->getObjGen(), &count);
  684|      0|        }
  685|      0|        qpdf_offset_t actual_length = count.getCount();
  686|      0|        if (auto desired_length = Length()) {
  ------------------
  |  Branch (686:18): [True: 0, False: 0]
  ------------------
  687|      0|            if (actual_length != desired_length) {
  ------------------
  |  Branch (687:17): [True: 0, False: 0]
  ------------------
  688|       |                // This would be caused by programmer error on the part of a library user, not by
  689|       |                // invalid input data.
  690|      0|                throw std::runtime_error(
  691|      0|                    "stream data provider for " + obj->getObjGen().unparse(' ') + " provided " +
  692|      0|                    std::to_string(actual_length) + " bytes instead of expected " +
  693|      0|                    std::to_string(desired_length.value()) + " bytes");
  694|      0|            }
  695|      0|        } else {
  696|      0|            Length(actual_length);
  697|      0|        }
  698|  11.0k|    } else {
  699|  11.0k|        if (offset() == 0) {
  ------------------
  |  Branch (699:13): [True: 0, False: 11.0k]
  ------------------
  700|      0|            throw std::logic_error("pipeStreamData called for stream with no data");
  701|      0|        }
  702|  11.0k|        if (!Streams::pipeStreamData(
  ------------------
  |  Branch (702:13): [True: 1.79k, False: 9.20k]
  ------------------
  703|  11.0k|                qpdf(),
  704|  11.0k|                id_gen(),
  705|  11.0k|                offset(),
  706|  11.0k|                s->length,
  707|  11.0k|                s->stream_dict,
  708|  11.0k|                isRootMetadata(),
  709|  11.0k|                pipeline,
  710|  11.0k|                suppress_warnings,
  711|  11.0k|                will_retry)) {
  712|  1.79k|            filter = false;
  713|  1.79k|            return false;
  714|  1.79k|        }
  715|  11.0k|    }
  716|       |
  717|  9.20k|    if (filter && !suppress_warnings && normalizer.anyBadTokens()) {
  ------------------
  |  Branch (717:9): [True: 8.33k, False: 874]
  |  Branch (717:19): [True: 8.33k, False: 0]
  |  Branch (717:41): [True: 0, False: 8.33k]
  ------------------
  718|      0|        warn("content normalization encountered bad tokens");
  719|      0|        if (normalizer.lastTokenWasBad()) {
  ------------------
  |  Branch (719:13): [True: 0, False: 0]
  ------------------
  720|      0|            QTC::TC("qpdf", "QPDF_Stream bad token at end during normalize");
  721|      0|            warn(
  722|      0|                "normalized content ended with a bad token; you may be able to resolve this by "
  723|      0|                "coalescing content streams in combination with normalizing content. From the "
  724|      0|                "command line, specify --coalesce-contents");
  725|      0|        }
  726|      0|        warn(
  727|      0|            "Resulting stream data may be corrupted but is may still useful for manual "
  728|      0|            "inspection. For more information on this warning, search for content normalization "
  729|      0|            "in the manual.");
  730|      0|    }
  731|       |
  732|  9.20k|    return true;
  733|  11.0k|}
_ZN4qpdf6Stream4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  789|  2.65k|{
  790|  2.65k|    qpdf()->warn(qpdf_e_damaged_pdf, "", offset(), message);
  791|  2.65k|}
_ZNK16QPDFObjectHandle7getDictEv:
  795|  24.7k|{
  796|  24.7k|    return as_stream(error).getDict();
  797|  24.7k|}
_ZN16QPDFObjectHandle13getStreamDataE26qpdf_stream_decode_level_e:
  831|  8.51k|{
  832|  8.51k|    return std::make_shared<Buffer>(as_stream(error).getStreamData(level));
  833|  8.51k|}
QPDF_Stream.cc:_ZZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEEENK3$_0clIS1_S5_16QPDFObjectHandleEEbT_RT0_RT1_:
  555|  12.5k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  12.5k|        if (!filter.setDecodeParms(d_obj) ||
  ------------------
  |  Branch (556:13): [True: 160, False: 12.3k]
  |  Branch (556:13): [True: 177, False: 12.3k]
  ------------------
  557|  12.3k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  ------------------
  |  Branch (557:14): [True: 12.3k, False: 0]
  |  Branch (557:39): [True: 22, False: 12.3k]
  ------------------
  558|  12.3k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  ------------------
  |  Branch (558:14): [True: 0, False: 12.3k]
  |  Branch (558:47): [True: 0, False: 0]
  ------------------
  559|    177|            return false;
  560|    177|        }
  561|  12.3k|        return true;
  562|  12.5k|    };
_ZN4QPDF3Doc7Objects7Streams6CopierC2ERS2_:
   67|  20.8k|        QPDFObjectHandle::StreamDataProvider(true),
   68|  20.8k|        streams(streams)
   69|  20.8k|    {
   70|  20.8k|    }
_ZN4QPDF3Doc7Objects7Streams6CopierD2Ev:
   64|  20.8k|    ~Copier() final = default;
QPDF_Stream.cc:_ZZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_0clEv:
  239|  1.08k|        return []() { return std::make_shared<SF_Crypt>(); };
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_CryptC2Ev:
  136|  1.08k|        SF_Crypt() = default;
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt14setDecodeParmsE16QPDFObjectHandle:
  141|  1.03k|        {
  142|       |            // we only validate here - processing happens in decryptStream
  143|  1.03k|            if (Dictionary dict = decode_parms) {
  ------------------
  |  Branch (143:28): [True: 845, False: 193]
  ------------------
  144|  2.92k|                for (auto const& [key, value]: dict) {
  ------------------
  |  Branch (144:46): [True: 2.92k, False: 820]
  ------------------
  145|  2.92k|                    if (key == "/Type" &&
  ------------------
  |  Branch (145:25): [True: 142, False: 2.78k]
  |  Branch (145:25): [True: 134, False: 2.79k]
  ------------------
  146|    142|                        (value.null() || Name(value) == "/CryptFilterDecodeParms")) {
  ------------------
  |  Branch (146:26): [True: 67, False: 75]
  |  Branch (146:42): [True: 67, False: 8]
  ------------------
  147|    134|                        continue;
  148|    134|                    }
  149|  2.79k|                    if (key == "/Name") {
  ------------------
  |  Branch (149:25): [True: 66, False: 2.72k]
  ------------------
  150|     66|                        continue;
  151|     66|                    }
  152|  2.72k|                    if (!value.null()) {
  ------------------
  |  Branch (152:25): [True: 25, False: 2.70k]
  ------------------
  153|     25|                        return false;
  154|     25|                    }
  155|  2.72k|                }
  156|    820|                return true;
  157|    845|            }
  158|    193|            return decode_parms.null();
  159|  1.03k|        }
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt17getDecodePipelineEP8Pipeline:
  163|  1.00k|        {
  164|       |            // Not used -- handled by pipeStreamData
  165|  1.00k|            return nullptr;
  166|  1.00k|        }
QPDF_Stream.cc:_ZZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebbENK3$_0clEPKci:
  665|  2.57k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });

_ZNK4QPDF3Doc10Encryption4getVEv:
  131|  4.80k|{
  132|  4.80k|    return this->V;
  133|  4.80k|}
_ZNK4QPDF3Doc10Encryption4getREv:
  137|  8.29k|{
  138|  8.29k|    return this->R;
  139|  8.29k|}
_ZNK4QPDF3Doc10Encryption14getLengthBytesEv:
  143|  3.90k|{
  144|  3.90k|    return this->Length_bytes;
  145|  3.90k|}
_ZNK4QPDF3Doc10Encryption4getPEv:
  149|  1.72k|{
  150|  1.72k|    return static_cast<int>(P.to_ulong());
  151|  1.72k|}
_ZNK4QPDF3Doc10Encryption4getOEv:
  169|  2.96k|{
  170|  2.96k|    return this->O;
  171|  2.96k|}
_ZNK4QPDF3Doc10Encryption4getUEv:
  175|  3.74k|{
  176|  3.74k|    return this->U;
  177|  3.74k|}
_ZNK4QPDF3Doc10Encryption5getOEEv:
  181|     14|{
  182|     14|    return this->OE;
  183|     14|}
_ZNK4QPDF3Doc10Encryption5getUEEv:
  187|    305|{
  188|    305|    return this->UE;
  189|    305|}
_ZNK4QPDF3Doc10Encryption8getPermsEv:
  193|    319|{
  194|    319|    return this->Perms;
  195|    319|}
_ZNK4QPDF3Doc10Encryption6getId1Ev:
  199|  2.37k|{
  200|  2.37k|    return this->id1;
  201|  2.37k|}
_ZNK4QPDF3Doc10Encryption18getEncryptMetadataEv:
  205|  1.35k|{
  206|  1.35k|    return this->encrypt_metadata;
  207|  1.35k|}
_ZN4QPDF18trim_user_passwordERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  257|    223|{
  258|       |    // Although unnecessary, this routine trims the padding string from the end of a user password.
  259|       |    // Its only purpose is for recovery of user passwords which is done in the test suite.
  260|    223|    if (user_password.size() < key_bytes) {
  ------------------
  |  Branch (260:9): [True: 0, False: 223]
  ------------------
  261|      0|        return;
  262|      0|    }
  263|       |
  264|    223|    auto idx = user_password.find('\x28');
  265|       |
  266|    229|    while (idx != user_password.npos) {
  ------------------
  |  Branch (266:12): [True: 6, False: 223]
  ------------------
  267|      6|        if (padding_string.starts_with(user_password.substr(idx))) {
  ------------------
  |  Branch (267:13): [True: 0, False: 6]
  ------------------
  268|      0|            user_password.resize(idx);
  269|      0|            return;
  270|      0|        }
  271|      6|        QTC::TC("qpdf", "QPDF_encryption skip 0x28");
  272|      6|        idx = user_password.find('\x28', ++idx);
  273|      6|    }
  274|    223|}
_ZNK4QPDF3Doc10Encryption7hash_V5ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_SA_:
  346|  1.84k|{
  347|  1.84k|    Pl_SHA2 hash(256);
  348|  1.84k|    hash.writeString(password);
  349|  1.84k|    hash.writeString(salt);
  350|  1.84k|    hash.writeString(udata);
  351|  1.84k|    hash.finish();
  352|  1.84k|    std::string K = hash.getRawDigest();
  353|       |
  354|  1.84k|    std::string result;
  355|  1.84k|    if (getR() < 6) {
  ------------------
  |  Branch (355:9): [True: 90, False: 1.75k]
  ------------------
  356|     90|        result = K;
  357|  1.75k|    } else {
  358|       |        // Algorithm 2.B from ISO 32000-1 chapter 7: Computing a hash
  359|       |
  360|  1.75k|        int round_number = 0;
  361|  1.75k|        bool done = false;
  362|   129k|        while (!done) {
  ------------------
  |  Branch (362:16): [True: 127k, False: 1.75k]
  ------------------
  363|       |            // The hash algorithm has us setting K initially to the R5 value and then repeating a
  364|       |            // series of steps 64 times before starting with the termination case testing.  The
  365|       |            // wording of the specification is very unclear as to the exact number of times it
  366|       |            // should be run since the wording about whether the initial setup counts as round 0 or
  367|       |            // not is ambiguous.  This code counts the initial setup (R5) value as round 0, which
  368|       |            // appears to be correct.  This was determined to be correct by increasing or decreasing
  369|       |            // the number of rounds by 1 or 2 from this value and generating 20 test files.  In this
  370|       |            // interpretation, all the test files worked with Adobe Reader X.  In the other
  371|       |            // configurations, many of the files did not work, and we were accurately able to
  372|       |            // predict which files didn't work by looking at the conditions under which we
  373|       |            // terminated repetition.
  374|       |
  375|   127k|            ++round_number;
  376|   127k|            std::string K1 = password + K + udata;
  377|   127k|            qpdf_assert_debug(K.length() >= 32);
  ------------------
  |  |   11|   127k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (377:13): [True: 127k, False: 0]
  ------------------
  378|   127k|            std::string E = process_with_aes(
  379|   127k|                K.substr(0, 16),
  380|   127k|                true,
  381|   127k|                K1,
  382|   127k|                0,
  383|   127k|                64,
  384|   127k|                QUtil::unsigned_char_pointer(K.substr(16, 16)),
  385|   127k|                16);
  386|       |
  387|       |            // E_mod_3 is supposed to be mod 3 of the first 16 bytes of E taken as as a (128-bit)
  388|       |            // big-endian number.  Since (xy mod n) is equal to ((x mod n) + (y mod n)) mod n and
  389|       |            // since 256 mod n is 1, we can just take the sums of the the mod 3s of each byte to get
  390|       |            // the same result.
  391|   127k|            int E_mod_3 = 0;
  392|  2.17M|            for (unsigned int i = 0; i < 16; ++i) {
  ------------------
  |  Branch (392:38): [True: 2.04M, False: 127k]
  ------------------
  393|  2.04M|                E_mod_3 += static_cast<unsigned char>(E.at(i));
  394|  2.04M|            }
  395|   127k|            E_mod_3 %= 3;
  396|   127k|            int next_hash = ((E_mod_3 == 0) ? 256 : (E_mod_3 == 1) ? 384 : 512);
  ------------------
  |  Branch (396:30): [True: 43.2k, False: 84.4k]
  |  Branch (396:53): [True: 41.5k, False: 42.9k]
  ------------------
  397|   127k|            Pl_SHA2 sha2(next_hash);
  398|   127k|            sha2.writeString(E);
  399|   127k|            sha2.finish();
  400|   127k|            K = sha2.getRawDigest();
  401|       |
  402|   127k|            if (round_number >= 64) {
  ------------------
  |  Branch (402:17): [True: 16.8k, False: 110k]
  ------------------
  403|  16.8k|                unsigned int ch = static_cast<unsigned char>(*(E.rbegin()));
  404|       |
  405|  16.8k|                if (ch <= QIntC::to_uint(round_number - 32)) {
  ------------------
  |  Branch (405:21): [True: 1.75k, False: 15.1k]
  ------------------
  406|  1.75k|                    done = true;
  407|  1.75k|                }
  408|  16.8k|            }
  409|   127k|        }
  410|  1.75k|        result = K.substr(0, 32);
  411|  1.75k|    }
  412|       |
  413|  1.84k|    return result;
  414|  1.84k|}
_ZN4QPDF16compute_data_keyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEiibii:
  433|  2.64k|{
  434|       |    // Algorithm 3.1 from the PDF 1.7 Reference Manual
  435|       |
  436|  2.64k|    std::string result = encryption_key;
  437|       |
  438|  2.64k|    if (encryption_V >= 5) {
  ------------------
  |  Branch (438:9): [True: 661, False: 1.98k]
  ------------------
  439|       |        // Algorithm 3.1a (PDF 1.7 extension level 3): just use encryption key straight.
  440|    661|        return result;
  441|    661|    }
  442|       |
  443|       |    // Append low three bytes of object ID and low two bytes of generation
  444|  1.98k|    result.append(1, static_cast<char>(objid & 0xff));
  445|  1.98k|    result.append(1, static_cast<char>((objid >> 8) & 0xff));
  446|  1.98k|    result.append(1, static_cast<char>((objid >> 16) & 0xff));
  447|  1.98k|    result.append(1, static_cast<char>(generation & 0xff));
  448|  1.98k|    result.append(1, static_cast<char>((generation >> 8) & 0xff));
  449|  1.98k|    if (use_aes) {
  ------------------
  |  Branch (449:9): [True: 1.40k, False: 575]
  ------------------
  450|  1.40k|        result += "sAlT";
  451|  1.40k|    }
  452|  1.98k|    return MD5::digest(result).substr(0, result.size());
  453|  2.64k|}
_ZNK4QPDF3Doc10Encryption22compute_encryption_keyERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  475|  1.41k|{
  476|  1.41k|    if (getV() >= 5) {
  ------------------
  |  Branch (476:9): [True: 0, False: 1.41k]
  ------------------
  477|       |        // For V >= 5, the encryption key is generated and stored in the file, encrypted separately
  478|       |        // with both user and owner passwords.
  479|      0|        return recover_encryption_key_with_password(password);
  480|  1.41k|    } else {
  481|       |        // For V < 5, the encryption key is derived from the user
  482|       |        // password.
  483|  1.41k|        return compute_encryption_key_from_password(password);
  484|  1.41k|    }
  485|  1.41k|}
_ZNK4QPDF3Doc10Encryption36compute_encryption_key_from_passwordERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  489|  1.41k|{
  490|       |    // Algorithm 3.2 from the PDF 1.7 Reference Manual
  491|       |
  492|       |    // This code does not properly handle Unicode passwords. Passwords are supposed to be converted
  493|       |    // from OS codepage characters to PDFDocEncoding.  Unicode passwords are supposed to be
  494|       |    // converted to OS codepage before converting to PDFDocEncoding.  We instead require the
  495|       |    // password to be presented in its final form.
  496|       |
  497|  1.41k|    MD5 md5;
  498|  1.41k|    md5.encodeDataIncrementally(pad_or_truncate_password_V4(password));
  499|  1.41k|    md5.encodeDataIncrementally(getO());
  500|  1.41k|    char pbytes[4];
  501|  1.41k|    int p = getP();
  502|  1.41k|    pbytes[0] = static_cast<char>(p & 0xff);
  503|  1.41k|    pbytes[1] = static_cast<char>((p >> 8) & 0xff);
  504|  1.41k|    pbytes[2] = static_cast<char>((p >> 16) & 0xff);
  505|  1.41k|    pbytes[3] = static_cast<char>((p >> 24) & 0xff);
  506|  1.41k|    md5.encodeDataIncrementally(pbytes, 4);
  507|  1.41k|    md5.encodeDataIncrementally(getId1());
  508|  1.41k|    if (getR() >= 4 && !getEncryptMetadata()) {
  ------------------
  |  Branch (508:9): [True: 1.03k, False: 376]
  |  Branch (508:24): [True: 5, False: 1.02k]
  ------------------
  509|      5|        md5.encodeDataIncrementally("\xff\xff\xff\xff");
  510|      5|    }
  511|  1.41k|    return iterate_md5_digest(md5, (getR() >= 3 ? 50 : 0), getLengthBytes());
  ------------------
  |  Branch (511:37): [True: 1.23k, False: 173]
  ------------------
  512|  1.41k|}
_ZNK4QPDF3Doc10Encryption17compute_O_rc4_keyERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  517|    679|{
  518|    679|    if (getV() >= 5) {
  ------------------
  |  Branch (518:9): [True: 0, False: 679]
  ------------------
  519|      0|        throw std::logic_error("compute_O_rc4_key called for file with V >= 5");
  520|      0|    }
  521|    679|    std::string password = owner_password.empty() ? user_password : owner_password;
  ------------------
  |  Branch (521:28): [True: 679, False: 0]
  ------------------
  522|    679|    MD5 md5;
  523|    679|    md5.encodeDataIncrementally(pad_or_truncate_password_V4(password));
  524|    679|    return iterate_md5_digest(md5, (getR() >= 3 ? 50 : 0), getLengthBytes());
  ------------------
  |  Branch (524:37): [True: 593, False: 86]
  ------------------
  525|    679|}
_ZNK4QPDF3Doc10Encryption18compute_U_value_R2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  542|    172|{
  543|       |    // Algorithm 3.4 from the PDF 1.7 Reference Manual
  544|       |
  545|    172|    std::string k1 = compute_encryption_key(user_password);
  546|    172|    auto udata = padding_string;
  547|    172|    pad_short_parameter(k1, QIntC::to_size(getLengthBytes()));
  548|    172|    iterate_rc4(udata, k1, 1, false);
  549|    172|    return udata;
  550|    172|}
_ZNK4QPDF3Doc10Encryption18compute_U_value_R3ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  554|    963|{
  555|       |    // Algorithm 3.5 from the PDF 1.7 Reference Manual
  556|       |
  557|    963|    std::string k1 = compute_encryption_key(user_password);
  558|    963|    MD5 md5;
  559|    963|    md5.encodeDataIncrementally(padding_string);
  560|    963|    md5.encodeDataIncrementally(getId1());
  561|    963|    auto result = md5.digest();
  562|    963|    pad_short_parameter(k1, QIntC::to_size(getLengthBytes()));
  563|    963|    iterate_rc4(result, k1, 20, false);
  564|       |    // pad with arbitrary data -- make it consistent for the sake of testing
  565|    963|    result += "\x0\x21\x44\x69\x90\xb9\xe4\x11\x40\x71\xa4\xd9\x10\x49\x84\xc1"s;
  566|    963|    return result;
  567|    963|}
_ZNK4QPDF3Doc10Encryption15compute_U_valueERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  571|  1.13k|{
  572|  1.13k|    if (getR() >= 3) {
  ------------------
  |  Branch (572:9): [True: 963, False: 172]
  ------------------
  573|    963|        return compute_U_value_R3(user_password);
  574|    963|    }
  575|       |
  576|    172|    return compute_U_value_R2(user_password);
  577|  1.13k|}
_ZNK4QPDF3Doc10Encryption22check_user_password_V4ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  581|  1.13k|{
  582|       |    // Algorithm 3.6 from the PDF 1.7 Reference Manual
  583|       |
  584|  1.13k|    std::string u_value = compute_U_value(user_password);
  585|  1.13k|    size_t to_compare = (getR() >= 3 ? sizeof(MD5::Digest) : key_bytes);
  ------------------
  |  Branch (585:26): [True: 963, False: 172]
  ------------------
  586|  1.13k|    return memcmp(getU().c_str(), u_value.c_str(), to_compare) == 0;
  587|  1.13k|}
_ZNK4QPDF3Doc10Encryption22check_user_password_V5ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  591|    758|{
  592|       |    // Algorithm 3.11 from the PDF 1.7 extension level 3
  593|       |
  594|    758|    std::string user_data = getU().substr(0, 32);
  595|    758|    std::string validation_salt = getU().substr(32, 8);
  596|    758|    std::string password = user_password.substr(0, 127);
  597|    758|    return hash_V5(user_password.substr(0, 127), validation_salt, "") == user_data;
  598|    758|}
_ZNK4QPDF3Doc10Encryption19check_user_passwordERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  602|  1.58k|{
  603|  1.58k|    if (getV() < 5) {
  ------------------
  |  Branch (603:9): [True: 1.13k, False: 453]
  ------------------
  604|  1.13k|        return check_user_password_V4(user_password);
  605|  1.13k|    } else {
  606|    453|        return check_user_password_V5(user_password);
  607|    453|    }
  608|  1.58k|}
_ZNK4QPDF3Doc10Encryption23check_owner_password_V4ERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKS8_:
  613|    679|{
  614|       |    // Algorithm 3.7 from the PDF 1.7 Reference Manual
  615|       |
  616|    679|    auto key = compute_O_rc4_key(user_password, owner_password);
  617|    679|    pad_short_parameter(key, QIntC::to_size(getLengthBytes()));
  618|    679|    auto new_user_password = O.substr(0, key_bytes);
  619|    679|    iterate_rc4(new_user_password, key, (getR() >= 3) ? 20 : 1, true);
  ------------------
  |  Branch (619:41): [True: 593, False: 86]
  ------------------
  620|    679|    if (check_user_password(new_user_password)) {
  ------------------
  |  Branch (620:9): [True: 223, False: 456]
  ------------------
  621|    223|        user_password = new_user_password;
  622|    223|        return true;
  623|    223|    }
  624|    456|    return false;
  625|    679|}
_ZNK4QPDF3Doc10Encryption23check_owner_password_V5ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  629|    772|{
  630|       |    // Algorithm 3.12 from the PDF 1.7 extension level 3
  631|       |
  632|    772|    std::string user_data = getU().substr(0, 48);
  633|    772|    std::string owner_data = getO().substr(0, 32);
  634|    772|    std::string validation_salt = getO().substr(32, 8);
  635|    772|    return hash_V5(owner_password.substr(0, 127), validation_salt, user_data) == owner_data;
  636|    772|}
_ZNK4QPDF3Doc10Encryption20check_owner_passwordERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKS8_:
  641|  1.13k|{
  642|  1.13k|    if (getV() < 5) {
  ------------------
  |  Branch (642:9): [True: 679, False: 453]
  ------------------
  643|    679|        return check_owner_password_V4(user_password, owner_password);
  644|    679|    } else {
  645|    453|        return check_owner_password_V5(owner_password);
  646|    453|    }
  647|  1.13k|}
_ZNK4QPDF3Doc10Encryption28compute_Perms_value_V5_clearEv:
  659|    319|{
  660|       |    // From algorithm 3.10 from the PDF 1.7 extension level 3
  661|       |    // cSpell:ignore Tadb
  662|    319|    std::string k = "    \xff\xff\xff\xffTadb    ";
  663|    319|    int perms = getP();
  664|  1.59k|    for (size_t i = 0; i < 4; ++i) {
  ------------------
  |  Branch (664:24): [True: 1.27k, False: 319]
  ------------------
  665|  1.27k|        k[i] = static_cast<char>(perms & 0xff);
  666|  1.27k|        perms >>= 8;
  667|  1.27k|    }
  668|    319|    if (!getEncryptMetadata()) {
  ------------------
  |  Branch (668:9): [True: 1, False: 318]
  ------------------
  669|      1|        k[8] = 'F';
  670|      1|    }
  671|    319|    QUtil::initializeWithRandomBytes(reinterpret_cast<unsigned char*>(&k[12]), 4);
  672|    319|    return k;
  673|    319|}
_ZNK4QPDF3Doc10Encryption36recover_encryption_key_with_passwordERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERb:
  678|    319|{
  679|       |    // Algorithm 3.2a from the PDF 1.7 extension level 3
  680|       |
  681|       |    // This code does not handle Unicode passwords correctly. Empirical evidence suggests that most
  682|       |    // viewers don't.  We are supposed to process the input string with the SASLprep (RFC 4013)
  683|       |    // profile of stringprep (RFC 3454) and then convert the result to UTF-8.
  684|       |
  685|    319|    perms_valid = false;
  686|    319|    std::string key_password = password.substr(0, 127);
  687|    319|    std::string key_salt;
  688|    319|    std::string user_data;
  689|    319|    std::string encrypted_file_key;
  690|    319|    if (check_owner_password_V5(key_password)) {
  ------------------
  |  Branch (690:9): [True: 14, False: 305]
  ------------------
  691|     14|        key_salt = getO().substr(40, 8);
  692|     14|        user_data = getU().substr(0, 48);
  693|     14|        encrypted_file_key = getOE().substr(0, 32);
  694|    305|    } else if (check_user_password_V5(key_password)) {
  ------------------
  |  Branch (694:16): [True: 305, False: 0]
  ------------------
  695|    305|        key_salt = getU().substr(40, 8);
  696|    305|        encrypted_file_key = getUE().substr(0, 32);
  697|    305|    }
  698|    319|    std::string intermediate_key = hash_V5(key_password, key_salt, user_data);
  699|    319|    std::string file_key = process_with_aes(intermediate_key, false, encrypted_file_key);
  700|       |
  701|       |    // Decrypt Perms and check against expected value
  702|    319|    auto perms_check = process_with_aes(file_key, false, getPerms()).substr(0, 12);
  703|    319|    perms_valid = compute_Perms_value_V5_clear().substr(0, 12) == perms_check;
  704|    319|    return file_key;
  705|    319|}
_ZNK4QPDF20EncryptionParameters11interpretCFERKN4qpdf4NameE:
  709|  2.32k|{
  710|  2.32k|    if (!cf) {
  ------------------
  |  Branch (710:9): [True: 1.26k, False: 1.05k]
  ------------------
  711|       |        // Default: /Identity
  712|  1.26k|        return e_none;
  713|  1.26k|    }
  714|  1.05k|    auto it = crypt_filters.find(cf);
  715|  1.05k|    if (it != crypt_filters.end()) {
  ------------------
  |  Branch (715:9): [True: 410, False: 646]
  ------------------
  716|    410|        return it->second;
  717|    410|    }
  718|    646|    if (cf == "/Identity") {
  ------------------
  |  Branch (718:9): [True: 4, False: 642]
  ------------------
  719|      4|        return e_none;
  720|      4|    }
  721|    642|    return e_unknown;
  722|    646|}
_ZN4QPDF20EncryptionParameters10initializeERS_:
  732|  3.61k|{
  733|  3.61k|    if (encryption_initialized) {
  ------------------
  |  Branch (733:9): [True: 3, False: 3.60k]
  ------------------
  734|      3|        return;
  735|      3|    }
  736|  3.60k|    encryption_initialized = true;
  737|       |
  738|  3.60k|    auto& c = qpdf.m->c;
  739|  3.60k|    auto& qm = *qpdf.m;
  740|  3.60k|    auto& trailer = qm.trailer;
  741|  3.60k|    auto& file = qm.file;
  742|       |
  743|  3.60k|    auto warn_damaged_pdf = [&qpdf, c](std::string const& msg) {
  744|  3.60k|        qpdf.warn(c.damagedPDF("encryption dictionary", msg));
  745|  3.60k|    };
  746|  3.60k|    auto throw_damaged_pdf = [&qpdf](std::string const& msg) {
  747|  3.60k|        throw qpdf.m->c.damagedPDF("encryption dictionary", msg);
  748|  3.60k|    };
  749|  3.60k|    auto unsupported = [&file](std::string const& msg) -> QPDFExc {
  750|  3.60k|        return {
  751|  3.60k|            qpdf_e_unsupported,
  752|  3.60k|            file->getName(),
  753|  3.60k|            "encryption dictionary",
  754|  3.60k|            file->getLastOffset(),
  755|  3.60k|            msg};
  756|  3.60k|    };
  757|       |
  758|       |    // After we initialize encryption parameters, we must use stored key information and never look
  759|       |    // at /Encrypt again.  Otherwise, things could go wrong if someone mutates the encryption
  760|       |    // dictionary.
  761|       |
  762|  3.60k|    if (!trailer.contains("/Encrypt")) {
  ------------------
  |  Branch (762:9): [True: 2.15k, False: 1.45k]
  ------------------
  763|  2.15k|        return;
  764|  2.15k|    }
  765|       |
  766|       |    // Go ahead and set m->encrypted here.  That way, isEncrypted will return true even if there
  767|       |    // were errors reading the encryption dictionary.
  768|  1.45k|    encrypted = true;
  769|       |
  770|  1.45k|    std::string id1;
  771|  1.45k|    auto id_obj = trailer.getKey("/ID");
  772|  1.45k|    if (id_obj.size() != 2 || !id_obj.getArrayItem(0).isString()) {
  ------------------
  |  Branch (772:9): [True: 1.28k, False: 166]
  |  Branch (772:9): [True: 1.28k, False: 164]
  |  Branch (772:31): [True: 4, False: 162]
  ------------------
  773|       |        // Treating a missing ID as the empty string enables qpdf to decrypt some invalid encrypted
  774|       |        // files with no /ID that poppler can read but Adobe Reader can't.
  775|  1.28k|        qpdf.warn(qpdf.m->c.damagedPDF("trailer", "invalid /ID in trailer dictionary"));
  776|  1.28k|    } else {
  777|    164|        id1 = id_obj.getArrayItem(0).getStringValue();
  778|    164|    }
  779|       |
  780|  1.45k|    auto encryption_dict = trailer.getKey("/Encrypt");
  781|  1.45k|    if (!encryption_dict.isDictionary()) {
  ------------------
  |  Branch (781:9): [True: 3, False: 1.45k]
  ------------------
  782|      3|        throw qpdf.m->c.damagedPDF("/Encrypt in trailer dictionary is not a dictionary");
  783|      3|    }
  784|       |
  785|  1.45k|    if (Name(encryption_dict["/Filter"]) != "/Standard") {
  ------------------
  |  Branch (785:9): [True: 83, False: 1.36k]
  ------------------
  786|     83|        throw unsupported("unsupported encryption filter");
  787|     83|    }
  788|  1.36k|    if (!encryption_dict.getKey("/SubFilter").null()) {
  ------------------
  |  Branch (788:9): [True: 1, False: 1.36k]
  ------------------
  789|      1|        qpdf.warn(unsupported("file uses encryption SubFilters, which qpdf does not support"));
  790|      1|    }
  791|       |
  792|  1.36k|    if (!(encryption_dict.getKey("/V").isInteger() && encryption_dict.getKey("/R").isInteger() &&
  ------------------
  |  Branch (792:9): [True: 96, False: 1.27k]
  |  Branch (792:11): [True: 1.32k, False: 38]
  |  Branch (792:55): [True: 1.31k, False: 14]
  ------------------
  793|  1.31k|          encryption_dict.getKey("/O").isString() && encryption_dict.getKey("/U").isString() &&
  ------------------
  |  Branch (793:11): [True: 1.27k, False: 37]
  |  Branch (793:54): [True: 1.27k, False: 4]
  ------------------
  794|  1.27k|          encryption_dict.getKey("/P").isInteger())) {
  ------------------
  |  Branch (794:11): [True: 1.26k, False: 11]
  ------------------
  795|     96|        throw_damaged_pdf("some encryption dictionary parameters are missing or the wrong type");
  796|     96|    }
  797|       |
  798|  1.36k|    int V = encryption_dict.getKey("/V").getIntValueAsInt();
  799|  1.36k|    int R = encryption_dict.getKey("/R").getIntValueAsInt();
  800|  1.36k|    std::string O = encryption_dict.getKey("/O").getStringValue();
  801|  1.36k|    std::string U = encryption_dict.getKey("/U").getStringValue();
  802|  1.36k|    int p = static_cast<int>(encryption_dict.getKey("/P").getIntValue());
  803|       |
  804|       |    // If supporting new encryption R/V values, remember to update error message inside this if
  805|       |    // statement.
  806|  1.36k|    if (!(2 <= R && R <= 6 && (V == 1 || V == 2 || V == 4 || V == 5))) {
  ------------------
  |  Branch (806:11): [True: 1.22k, False: 138]
  |  Branch (806:21): [True: 1.21k, False: 17]
  |  Branch (806:32): [True: 14, False: 1.19k]
  |  Branch (806:42): [True: 65, False: 1.13k]
  |  Branch (806:52): [True: 630, False: 503]
  |  Branch (806:62): [True: 458, False: 45]
  ------------------
  807|     94|        throw unsupported(
  808|     94|            "Unsupported /R or /V in encryption dictionary; R = " + std::to_string(R) +
  809|     94|            " (max 6), V = " + std::to_string(V) + " (max 5)");
  810|     94|    }
  811|       |
  812|  1.27k|    P_ = std::bitset<32>(static_cast<unsigned long long>(p));
  813|  1.27k|    encryption_V = V;
  814|  1.27k|    R_ = R;
  815|       |
  816|       |    // OE, UE, and Perms are only present if V >= 5.
  817|  1.27k|    std::string OE;
  818|  1.27k|    std::string UE;
  819|  1.27k|    std::string Perms;
  820|       |
  821|  1.27k|    if (V < 5) {
  ------------------
  |  Branch (821:9): [True: 709, False: 564]
  ------------------
  822|       |        // These must be exactly the right number of bytes.
  823|    709|        pad_short_parameter(O, key_bytes);
  824|    709|        pad_short_parameter(U, key_bytes);
  825|    709|        if (!(O.length() == key_bytes && U.length() == key_bytes)) {
  ------------------
  |  Branch (825:15): [True: 693, False: 16]
  |  Branch (825:42): [True: 682, False: 11]
  ------------------
  826|     27|            throw_damaged_pdf("incorrect length for /O and/or /U in encryption dictionary");
  827|     27|        }
  828|    709|    } else {
  829|    564|        if (!(encryption_dict.getKey("/OE").isString() &&
  ------------------
  |  Branch (829:13): [True: 3, False: 561]
  |  Branch (829:15): [True: 457, False: 107]
  ------------------
  830|    457|              encryption_dict.getKey("/UE").isString() &&
  ------------------
  |  Branch (830:15): [True: 456, False: 1]
  ------------------
  831|    456|              encryption_dict.getKey("/Perms").isString())) {
  ------------------
  |  Branch (831:15): [True: 455, False: 1]
  ------------------
  832|      3|            throw_damaged_pdf(
  833|      3|                "some V=5 encryption dictionary parameters are missing or the wrong type");
  834|      3|        }
  835|    564|        OE = encryption_dict.getKey("/OE").getStringValue();
  836|    564|        UE = encryption_dict.getKey("/UE").getStringValue();
  837|    564|        Perms = encryption_dict.getKey("/Perms").getStringValue();
  838|       |
  839|       |        // These may be longer than the minimum number of bytes.
  840|    564|        pad_short_parameter(O, OU_key_bytes_V5);
  841|    564|        pad_short_parameter(U, OU_key_bytes_V5);
  842|    564|        pad_short_parameter(OE, OUE_key_bytes_V5);
  843|    564|        pad_short_parameter(UE, OUE_key_bytes_V5);
  844|    564|        pad_short_parameter(Perms, Perms_key_bytes_V5);
  845|    564|    }
  846|       |
  847|  1.27k|    int Length = 128; // Just take a guess.
  848|  1.27k|    if (V <= 1) {
  ------------------
  |  Branch (848:9): [True: 13, False: 1.26k]
  ------------------
  849|     13|        Length = 40;
  850|  1.26k|    } else if (V == 4) {
  ------------------
  |  Branch (850:16): [True: 608, False: 652]
  ------------------
  851|    608|        Length = 128;
  852|    652|    } else if (V == 5) {
  ------------------
  |  Branch (852:16): [True: 455, False: 197]
  ------------------
  853|    455|        Length = 256;
  854|    455|    } else {
  855|    197|        if (encryption_dict.getKey("/Length").isInteger()) {
  ------------------
  |  Branch (855:13): [True: 9, False: 188]
  ------------------
  856|      9|            Length = encryption_dict.getKey("/Length").getIntValueAsInt();
  857|      9|            if (Length % 8 || Length < 40 || Length > 128) {
  ------------------
  |  Branch (857:17): [True: 2, False: 7]
  |  Branch (857:31): [True: 3, False: 4]
  |  Branch (857:46): [True: 1, False: 3]
  ------------------
  858|      6|                Length = 128; // Just take a guess.
  859|      6|            }
  860|      9|        }
  861|    197|    }
  862|       |
  863|  1.27k|    encrypt_metadata = true;
  864|  1.27k|    if (V >= 4 && encryption_dict.getKey("/EncryptMetadata").isBool()) {
  ------------------
  |  Branch (864:9): [True: 1.06k, False: 210]
  |  Branch (864:9): [True: 3, False: 1.27k]
  |  Branch (864:19): [True: 3, False: 1.06k]
  ------------------
  865|      3|        encrypt_metadata = encryption_dict.getKey("/EncryptMetadata").getBoolValue();
  866|      3|    }
  867|       |
  868|  1.27k|    if (V == 4 || V == 5) {
  ------------------
  |  Branch (868:9): [True: 745, False: 528]
  |  Branch (868:19): [True: 454, False: 74]
  ------------------
  869|  1.06k|        auto CF = encryption_dict.getKey("/CF");
  870|  3.84k|        for (auto const& [filter, cdict]: CF.as_dictionary()) {
  ------------------
  |  Branch (870:41): [True: 3.84k, False: 1.06k]
  ------------------
  871|  3.84k|            if (cdict.isDictionary()) {
  ------------------
  |  Branch (871:17): [True: 1.99k, False: 1.85k]
  ------------------
  872|  1.99k|                encryption_method_e method = e_none;
  873|  1.99k|                if (Name const& CFM = cdict["/CFM"]) {
  ------------------
  |  Branch (873:33): [True: 838, False: 1.16k]
  ------------------
  874|    838|                    if (CFM == "/V2") {
  ------------------
  |  Branch (874:25): [True: 145, False: 693]
  ------------------
  875|    145|                        method = e_rc4;
  876|    693|                    } else if (CFM == "/AESV2") {
  ------------------
  |  Branch (876:32): [True: 118, False: 575]
  ------------------
  877|    118|                        method = e_aes;
  878|    575|                    } else if (CFM == "/AESV3") {
  ------------------
  |  Branch (878:32): [True: 141, False: 434]
  ------------------
  879|    141|                        method = e_aesv3;
  880|    434|                    } else {
  881|       |                        // Don't complain now -- maybe we won't need to reference this type.
  882|    434|                        method = e_unknown;
  883|    434|                    }
  884|    838|                }
  885|  1.99k|                crypt_filters[filter] = method;
  886|  1.99k|            }
  887|  3.84k|        }
  888|       |
  889|  1.06k|        cf_stream = interpretCF(encryption_dict["/StmF"]);
  890|  1.06k|        cf_string = interpretCF(encryption_dict["/StrF"]);
  891|  1.06k|        if (Name const& EFF = encryption_dict["/EFF"]) {
  ------------------
  |  Branch (891:25): [True: 200, False: 862]
  ------------------
  892|       |            // qpdf does not use this for anything other than informational purposes. This is
  893|       |            // intended to instruct conforming writers on which crypt filter should be used when new
  894|       |            // file attachments are added to a PDF file, but qpdf never generates encrypted files
  895|       |            // with non-default crypt filters. Prior to 10.2, I was under the mistaken impression
  896|       |            // that this was supposed to be used for decrypting attachments, but the code was wrong
  897|       |            // in a way that turns out not to have mattered because no writers were generating files
  898|       |            // the way I was imagining. Still, providing this information could be useful when
  899|       |            // looking at a file generated by something else, such as Acrobat when specifying that
  900|       |            // only attachments should be encrypted.
  901|    200|            cf_file = interpretCF(EFF);
  902|    862|        } else {
  903|    862|            cf_file = cf_stream;
  904|    862|        }
  905|  1.06k|    }
  906|       |
  907|  1.27k|    Encryption data(V, R, Length / 8, p, O, U, OE, UE, Perms, id1, encrypt_metadata);
  908|  1.27k|    if (qm.cf.password_is_hex_key()) {
  ------------------
  |  Branch (908:9): [True: 0, False: 1.27k]
  ------------------
  909|       |        // ignore passwords in file
  910|      0|        encryption_key = QUtil::hex_decode(provided_password);
  911|      0|        return;
  912|      0|    }
  913|       |
  914|  1.27k|    owner_password_matched = data.check_owner_password(user_password, provided_password);
  915|  1.27k|    if (owner_password_matched && V < 5) {
  ------------------
  |  Branch (915:9): [True: 237, False: 1.03k]
  |  Branch (915:35): [True: 223, False: 14]
  ------------------
  916|       |        // password supplied was owner password; user_password has been initialized for V < 5
  917|    223|        if (qpdf.getTrimmedUserPassword() == provided_password) {
  ------------------
  |  Branch (917:13): [True: 0, False: 223]
  ------------------
  918|      0|            user_password_matched = true;
  919|      0|            QTC::TC("qpdf", "QPDF_encryption user matches owner V < 5");
  920|      0|        }
  921|  1.05k|    } else {
  922|  1.05k|        user_password_matched = data.check_user_password(provided_password);
  923|  1.05k|        if (user_password_matched) {
  ------------------
  |  Branch (923:13): [True: 357, False: 693]
  ------------------
  924|    357|            user_password = provided_password;
  925|    357|        }
  926|  1.05k|    }
  927|  1.27k|    if (user_password_matched && owner_password_matched) {
  ------------------
  |  Branch (927:9): [True: 357, False: 916]
  |  Branch (927:34): [True: 0, False: 357]
  ------------------
  928|      0|        QTC::TC("qpdf", "QPDF_encryption same password", (V < 5) ? 0 : 1);
  ------------------
  |  Branch (928:58): [True: 0, False: 0]
  ------------------
  929|      0|    }
  930|  1.27k|    if (!(owner_password_matched || user_password_matched)) {
  ------------------
  |  Branch (930:11): [True: 378, False: 895]
  |  Branch (930:37): [True: 357, False: 538]
  ------------------
  931|    538|        throw QPDFExc(qpdf_e_password, file->getName(), "", 0, "invalid password");
  932|    538|    }
  933|       |
  934|    735|    if (V < 5) {
  ------------------
  |  Branch (934:9): [True: 275, False: 460]
  ------------------
  935|       |        // For V < 5, the user password is encrypted with the owner password, and the user password
  936|       |        // is always used for computing the encryption key.
  937|    275|        encryption_key = data.compute_encryption_key(user_password);
  938|    460|    } else {
  939|       |        // For V >= 5, either password can be used independently to compute the encryption key, and
  940|       |        // neither password can be used to recover the other.
  941|    460|        bool perms_valid;
  942|    460|        encryption_key = data.recover_encryption_key_with_password(provided_password, perms_valid);
  943|    460|        if (!perms_valid) {
  ------------------
  |  Branch (943:13): [True: 296, False: 164]
  ------------------
  944|    296|            warn_damaged_pdf("/Perms field in encryption dictionary doesn't match expected value");
  945|    296|        }
  946|    460|    }
  947|    735|}
_ZN4QPDF15getKeyForObjectENSt3__110shared_ptrINS_20EncryptionParametersEEE10QPDFObjGenb:
  951|  15.8k|{
  952|  15.8k|    if (!encp->encrypted) {
  ------------------
  |  Branch (952:9): [True: 0, False: 15.8k]
  ------------------
  953|      0|        throw std::logic_error("request for encryption key in non-encrypted PDF");
  954|      0|    }
  955|       |
  956|  15.8k|    if (og != encp->cached_key_og) {
  ------------------
  |  Branch (956:9): [True: 2.64k, False: 13.2k]
  ------------------
  957|  2.64k|        encp->cached_object_encryption_key = compute_data_key(
  958|  2.64k|            encp->encryption_key, og.getObj(), og.getGen(), use_aes, encp->encryption_V, encp->R());
  959|  2.64k|        encp->cached_key_og = og;
  960|  2.64k|    }
  961|       |
  962|  15.8k|    return encp->cached_object_encryption_key;
  963|  15.8k|}
_ZN4QPDF13decryptStringERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE10QPDFObjGen:
  967|  16.0k|{
  968|  16.0k|    if (!og.isIndirect()) {
  ------------------
  |  Branch (968:9): [True: 0, False: 16.0k]
  ------------------
  969|      0|        return;
  970|      0|    }
  971|  16.0k|    bool use_aes = false;
  972|  16.0k|    if (m->encp->encryption_V >= 4) {
  ------------------
  |  Branch (972:9): [True: 11.2k, False: 4.83k]
  ------------------
  973|  11.2k|        switch (m->encp->cf_string) {
  974|    669|        case e_none:
  ------------------
  |  Branch (974:9): [True: 669, False: 10.5k]
  ------------------
  975|    669|            return;
  976|       |
  977|  9.38k|        case e_aes:
  ------------------
  |  Branch (977:9): [True: 9.38k, False: 1.83k]
  ------------------
  978|  9.38k|            use_aes = true;
  979|  9.38k|            break;
  980|       |
  981|    775|        case e_aesv3:
  ------------------
  |  Branch (981:9): [True: 775, False: 10.4k]
  ------------------
  982|    775|            use_aes = true;
  983|    775|            break;
  984|       |
  985|    199|        case e_rc4:
  ------------------
  |  Branch (985:9): [True: 199, False: 11.0k]
  ------------------
  986|    199|            break;
  987|       |
  988|    194|        default:
  ------------------
  |  Branch (988:9): [True: 194, False: 11.0k]
  ------------------
  989|    194|            warn(m->c.damagedPDF(
  990|    194|                "unknown encryption filter for strings (check /StrF in "
  991|    194|                "/Encrypt dictionary); strings may be decrypted improperly"));
  992|       |            // To avoid repeated warnings, reset cf_string.  Assume we'd want to use AES if V == 4.
  993|    194|            m->encp->cf_string = e_aes;
  994|    194|            use_aes = true;
  995|    194|            break;
  996|  11.2k|        }
  997|  11.2k|    }
  998|       |
  999|  15.3k|    std::string key = getKeyForObject(m->encp, og, use_aes);
 1000|  15.3k|    try {
 1001|  15.3k|        if (use_aes) {
  ------------------
  |  Branch (1001:13): [True: 10.3k, False: 5.03k]
  ------------------
 1002|  10.3k|            QTC::TC("qpdf", "QPDF_encryption aes decode string");
 1003|  10.3k|            Pl_Buffer bufpl("decrypted string");
 1004|  10.3k|            Pl_AES_PDF pl("aes decrypt string", &bufpl, false, key);
 1005|  10.3k|            pl.writeString(str);
 1006|  10.3k|            pl.finish();
 1007|  10.3k|            str = bufpl.getString();
 1008|  10.3k|        } else {
 1009|  5.03k|            QTC::TC("qpdf", "QPDF_encryption rc4 decode string");
 1010|  5.03k|            size_t vlen = str.length();
 1011|       |            // Using std::shared_ptr guarantees that tmp will be freed even if rc4.process throws an
 1012|       |            // exception.
 1013|  5.03k|            auto tmp = QUtil::make_unique_cstr(str);
 1014|  5.03k|            RC4 rc4(QUtil::unsigned_char_pointer(key), QIntC::to_int(key.length()));
 1015|  5.03k|            auto data = QUtil::unsigned_char_pointer(tmp.get());
 1016|  5.03k|            rc4.process(data, vlen, data);
 1017|  5.03k|            str = std::string(tmp.get(), vlen);
 1018|  5.03k|        }
 1019|  15.3k|    } catch (QPDFExc&) {
 1020|      0|        throw;
 1021|      5|    } catch (std::runtime_error& e) {
 1022|      5|        throw m->c.damagedPDF(
 1023|      5|            "error decrypting string for object " + og.unparse() + ": " + e.what());
 1024|      5|    }
 1025|  15.3k|}
_ZN4QPDF13decryptStreamENSt3__110shared_ptrINS_20EncryptionParametersEEENS1_I11InputSourceEERS_RP8Pipeline10QPDFObjGenR16QPDFObjectHandlebRNS0_10unique_ptrIS7_NS0_14default_deleteIS7_EEEE:
 1040|    531|{
 1041|    531|    if (Name(stream_dict["/Type"]) == "/XRef") {
  ------------------
  |  Branch (1041:9): [True: 14, False: 517]
  ------------------
 1042|     14|        return;
 1043|     14|    }
 1044|    517|    bool use_aes = false;
 1045|    517|    if (encp->encryption_V >= 4) {
  ------------------
  |  Branch (1045:9): [True: 504, False: 13]
  ------------------
 1046|    504|        encryption_method_e method = e_unknown;
 1047|    504|        std::string method_source = "/StmF from /Encrypt dictionary";
 1048|       |
 1049|    504|        if (stream_dict.getKey("/Filter").isOrHasName("/Crypt")) {
  ------------------
  |  Branch (1049:13): [True: 29, False: 475]
  ------------------
 1050|     29|            if (Dictionary decode_parms = stream_dict["/DecodeParms"]) {
  ------------------
  |  Branch (1050:28): [True: 12, False: 17]
  ------------------
 1051|     12|                if (Name(decode_parms["/Type"]) == "/CryptFilterDecodeParms") {
  ------------------
  |  Branch (1051:21): [True: 0, False: 12]
  ------------------
 1052|      0|                    method = encp->interpretCF(decode_parms["/Name"]);
 1053|      0|                    method_source = "stream's Crypt decode parameters";
 1054|      0|                }
 1055|     17|            } else {
 1056|     17|                Array filter = stream_dict["/Filter"];
 1057|     17|                Array decode = stream_dict.getKey("/DecodeParms");
 1058|     17|                if (filter.size() == decode.size()) {
  ------------------
  |  Branch (1058:21): [True: 0, False: 17]
  ------------------
 1059|      0|                    size_t i = 0;
 1060|      0|                    for (Name item: filter) {
  ------------------
  |  Branch (1060:35): [True: 0, False: 0]
  ------------------
 1061|      0|                        if (item == "/Crypt") {
  ------------------
  |  Branch (1061:29): [True: 0, False: 0]
  ------------------
 1062|      0|                            if (Name name = decode[i]["/Name"]) {
  ------------------
  |  Branch (1062:38): [True: 0, False: 0]
  ------------------
 1063|      0|                                method = encp->interpretCF(name);
 1064|      0|                                method_source = "stream's Crypt decode parameters (array)";
 1065|      0|                            }
 1066|      0|                            break;
 1067|      0|                        }
 1068|      0|                        ++i;
 1069|      0|                    }
 1070|      0|                }
 1071|     17|            }
 1072|     29|        }
 1073|       |
 1074|    504|        if (method == e_unknown) {
  ------------------
  |  Branch (1074:13): [True: 504, False: 0]
  ------------------
 1075|    504|            if (!encp->encrypt_metadata && is_root_metadata) {
  ------------------
  |  Branch (1075:17): [True: 0, False: 504]
  |  Branch (1075:44): [True: 0, False: 0]
  ------------------
 1076|      0|                method = e_none;
 1077|    504|            } else {
 1078|    504|                method = encp->cf_stream;
 1079|    504|            }
 1080|    504|        }
 1081|    504|        use_aes = false;
 1082|    504|        switch (method) {
 1083|     53|        case e_none:
  ------------------
  |  Branch (1083:9): [True: 53, False: 451]
  ------------------
 1084|     53|            return;
 1085|      0|            break;
 1086|       |
 1087|    182|        case e_aes:
  ------------------
  |  Branch (1087:9): [True: 182, False: 322]
  ------------------
 1088|    182|            use_aes = true;
 1089|    182|            break;
 1090|       |
 1091|      6|        case e_aesv3:
  ------------------
  |  Branch (1091:9): [True: 6, False: 498]
  ------------------
 1092|      6|            use_aes = true;
 1093|      6|            break;
 1094|       |
 1095|    214|        case e_rc4:
  ------------------
  |  Branch (1095:9): [True: 214, False: 290]
  ------------------
 1096|    214|            break;
 1097|       |
 1098|     49|        default:
  ------------------
  |  Branch (1098:9): [True: 49, False: 455]
  ------------------
 1099|       |            // filter local to this stream.
 1100|     49|            qpdf_for_warning.warn(
 1101|     49|                {qpdf_e_damaged_pdf,
 1102|     49|                 file->getName(),
 1103|     49|                 "",
 1104|     49|                 file->getLastOffset(),
 1105|     49|                 "unknown encryption filter for streams (check " + method_source +
 1106|     49|                     "); streams may be decrypted improperly"});
 1107|       |            // To avoid repeated warnings, reset cf_stream.  Assume we'd want to use AES if V == 4.
 1108|     49|            encp->cf_stream = e_aes;
 1109|     49|            use_aes = true;
 1110|     49|            break;
 1111|    504|        }
 1112|    504|    }
 1113|    464|    std::string key = getKeyForObject(encp, og, use_aes);
 1114|    464|    if (use_aes) {
  ------------------
  |  Branch (1114:9): [True: 237, False: 227]
  ------------------
 1115|    237|        decrypt_pipeline =
 1116|    237|            std::make_unique<Pl_AES_PDF>("AES stream decryption", pipeline, false, key);
 1117|    237|    } else {
 1118|    227|        decrypt_pipeline = std::make_unique<Pl_RC4>("RC4 stream decryption", pipeline, key);
 1119|    227|    }
 1120|    464|    pipeline = decrypt_pipeline.get();
 1121|    464|}
_ZNK4QPDF22getTrimmedUserPasswordEv:
 1219|    223|{
 1220|    223|    std::string result = m->encp->user_password;
 1221|    223|    trim_user_password(result);
 1222|    223|    return result;
 1223|    223|}
QPDF_encryption.cc:_ZL16process_with_aesRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEbS7_mjPKhm:
  323|   128k|{
  324|   128k|    Pl_Buffer buffer("buffer");
  325|   128k|    Pl_AES_PDF aes("aes", &buffer, encrypt, key);
  326|   128k|    if (iv) {
  ------------------
  |  Branch (326:9): [True: 127k, False: 638]
  ------------------
  327|   127k|        aes.setIV(iv, iv_length);
  328|   127k|    } else {
  329|    638|        aes.useZeroIV();
  330|    638|    }
  331|   128k|    aes.disablePadding();
  332|  8.30M|    for (unsigned int i = 0; i < repetitions; ++i) {
  ------------------
  |  Branch (332:30): [True: 8.17M, False: 128k]
  ------------------
  333|  8.17M|        aes.writeString(data);
  334|  8.17M|    }
  335|   128k|    aes.finish();
  336|   128k|    if (outlength == 0) {
  ------------------
  |  Branch (336:9): [True: 128k, False: 0]
  ------------------
  337|   128k|        return buffer.getString();
  338|   128k|    } else {
  339|      0|        return buffer.getString().substr(0, outlength);
  340|      0|    }
  341|   128k|}
QPDF_encryption.cc:_ZL27pad_or_truncate_password_V4NSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE:
  278|  2.08k|{
  279|  2.08k|    if (password.size() < key_bytes) {
  ------------------
  |  Branch (279:9): [True: 1.18k, False: 902]
  ------------------
  280|  1.18k|        password.append(padding_string);
  281|  1.18k|    }
  282|  2.08k|    password.resize(key_bytes);
  283|  2.08k|    return password;
  284|  2.08k|}
QPDF_encryption.cc:_ZL18iterate_md5_digestR3MD5ii:
  288|  2.08k|{
  289|  2.08k|    MD5::Digest digest;
  290|  2.08k|    md5.digest(digest);
  291|  2.08k|    auto len = std::min(QIntC::to_size(key_len), sizeof(digest));
  292|  93.5k|    for (int i = 0; i < iterations; ++i) {
  ------------------
  |  Branch (292:21): [True: 91.5k, False: 2.08k]
  ------------------
  293|  91.5k|        MD5 m;
  294|  91.5k|        m.encodeDataIncrementally(reinterpret_cast<char*>(digest), len);
  295|  91.5k|        m.digest(digest);
  296|  91.5k|    }
  297|  2.08k|    return {reinterpret_cast<char*>(digest), len};
  298|  2.08k|}
QPDF_encryption.cc:_ZL19pad_short_parameterRNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEm:
  418|  5.50k|{
  419|  5.50k|    if (param.length() < max_len) {
  ------------------
  |  Branch (419:9): [True: 3.01k, False: 2.49k]
  ------------------
  420|  3.01k|        QTC::TC("qpdf", "QPDF_encryption pad short parameter");
  421|  3.01k|        param.append(max_len - param.length(), '\0');
  422|  3.01k|    }
  423|  5.50k|}
QPDF_encryption.cc:_ZL11iterate_rc4RNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_17basic_string_viewIcS2_EEib:
  302|  1.81k|{
  303|  1.81k|    auto len = okey.size();
  304|  1.81k|    std::string key(len, '\0');
  305|  33.1k|    for (int i = 0; i < iterations; ++i) {
  ------------------
  |  Branch (305:21): [True: 31.3k, False: 1.81k]
  ------------------
  306|  31.3k|        int const xor_value = (reverse ? iterations - 1 - i : i);
  ------------------
  |  Branch (306:32): [True: 11.9k, False: 19.4k]
  ------------------
  307|   527k|        for (size_t j = 0; j < len; ++j) {
  ------------------
  |  Branch (307:28): [True: 496k, False: 31.3k]
  ------------------
  308|   496k|            key[j] = static_cast<char>(okey[j] ^ xor_value);
  309|   496k|        }
  310|  31.3k|        RC4::process(key, data);
  311|  31.3k|    }
  312|  1.81k|}
QPDF_encryption.cc:_ZZN4QPDF20EncryptionParameters10initializeERS_ENK3$_2clERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  749|    178|    auto unsupported = [&file](std::string const& msg) -> QPDFExc {
  750|    178|        return {
  751|    178|            qpdf_e_unsupported,
  752|    178|            file->getName(),
  753|    178|            "encryption dictionary",
  754|    178|            file->getLastOffset(),
  755|    178|            msg};
  756|    178|    };
QPDF_encryption.cc:_ZZN4QPDF20EncryptionParameters10initializeERS_ENK3$_1clERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  746|    126|    auto throw_damaged_pdf = [&qpdf](std::string const& msg) {
  747|    126|        throw qpdf.m->c.damagedPDF("encryption dictionary", msg);
  748|    126|    };
QPDF_encryption.cc:_ZZN4QPDF20EncryptionParameters10initializeERS_ENK3$_0clERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  743|    296|    auto warn_damaged_pdf = [&qpdf, c](std::string const& msg) {
  744|    296|        qpdf.warn(c.damagedPDF("encryption dictionary", msg));
  745|    296|    };

_ZN13QPDFXRefEntryC2Ev:
   30|   588k|QPDFXRefEntry::QPDFXRefEntry() = default;
_ZNK13QPDFXRefEntry7getTypeEv:
   42|   805k|{
   43|   805k|    return type;
   44|   805k|}
_ZNK13QPDFXRefEntry9getOffsetEv:
   48|   422k|{
   49|   422k|    util::assertion(type == 1, "getOffset called for xref entry of type != 1");
   50|   422k|    return this->field1;
   51|   422k|}
_ZNK13QPDFXRefEntry18getObjStreamNumberEv:
   55|   175k|{
   56|   175k|    util::assertion(type == 2, "getObjStreamNumber called for xref entry of type != 2");
   57|   175k|    return QIntC::to_int(field1);
   58|   175k|}
_ZN4QPDF3Doc7Objects18validatePDFVersionERPKcRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  165|  3.22k|{
  166|  3.22k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (166:9): [True: 1.34k, False: 1.87k]
  ------------------
  167|  1.34k|        return false;
  168|  1.34k|    }
  169|  5.94k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (169:12): [True: 4.07k, False: 1.87k]
  ------------------
  170|  4.07k|        version.append(1, *p++);
  171|  4.07k|    }
  172|  1.87k|    if (!(*p == '.' && util::is_digit(*(p + 1)))) {
  ------------------
  |  Branch (172:11): [True: 1.49k, False: 383]
  |  Branch (172:24): [True: 936, False: 555]
  ------------------
  173|    938|        return false;
  174|    938|    }
  175|    936|    version.append(1, *p++);
  176|  2.90k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (176:12): [True: 1.96k, False: 936]
  ------------------
  177|  1.96k|        version.append(1, *p++);
  178|  1.96k|    }
  179|    936|    return true;
  180|  1.87k|}
_ZN4QPDF3Doc7Objects10findHeaderEv:
  184|  3.22k|{
  185|  3.22k|    qpdf_offset_t global_offset = m->file->tell();
  186|  3.22k|    std::string line = m->file->readLine(1024);
  187|  3.22k|    char const* p = line.data();
  188|  3.22k|    util::assertion(strncmp(p, "%PDF-", 5) == 0, "findHeader is not looking at %PDF-");
  189|  3.22k|    p += 5;
  190|  3.22k|    std::string version;
  191|       |    // Note: The string returned by line.data() is always null-terminated. The code below never
  192|       |    // overruns the buffer because a null character always short-circuits further advancement.
  193|  3.22k|    if (!validatePDFVersion(p, version)) {
  ------------------
  |  Branch (193:9): [True: 2.28k, False: 936]
  ------------------
  194|  2.28k|        return false;
  195|  2.28k|    }
  196|    936|    m->pdf_version = version;
  197|    936|    if (global_offset != 0) {
  ------------------
  |  Branch (197:9): [True: 622, False: 314]
  ------------------
  198|       |        // Empirical evidence strongly suggests (codified in PDF 2.0 spec) that when there is
  199|       |        // leading material prior to the PDF header, all explicit offsets in the file are such that
  200|       |        // 0 points to the beginning of the header.
  201|    622|        m->file = std::make_shared<OffsetInputSource>(m->file, global_offset);
  202|    622|    }
  203|    936|    return true;
  204|  3.22k|}
_ZN4QPDF3Doc7Objects13findStartxrefEv:
  208|  8.56k|{
  209|  8.56k|    if (readToken(*m->file).isWord("startxref") && readToken(*m->file).isInteger()) {
  ------------------
  |  Branch (209:9): [True: 7.95k, False: 607]
  |  Branch (209:9): [True: 6.13k, False: 2.43k]
  |  Branch (209:52): [True: 6.13k, False: 1.82k]
  ------------------
  210|       |        // Position in front of offset token
  211|  6.13k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
  212|  6.13k|        return true;
  213|  6.13k|    }
  214|  2.43k|    return false;
  215|  8.56k|}
_ZN4QPDF3Doc7Objects5parseEPKc:
  219|  20.8k|{
  220|  20.8k|    if (password) {
  ------------------
  |  Branch (220:9): [True: 0, False: 20.8k]
  ------------------
  221|      0|        m->encp->provided_password = password;
  222|      0|    }
  223|       |
  224|       |    // Find the header anywhere in the first 1024 bytes of the file.
  225|  20.8k|    PatternFinder hf(*this, &Objects::findHeader);
  226|  20.8k|    if (!m->file->findFirst("%PDF-", 0, 1024, hf)) {
  ------------------
  |  Branch (226:9): [True: 19.8k, False: 936]
  ------------------
  227|  19.8k|        warn(damagedPDF("", -1, "can't find PDF header"));
  228|       |        // QPDFWriter writes files that usually require at least version 1.2 for /FlateDecode
  229|  19.8k|        m->pdf_version = "1.2";
  230|  19.8k|    }
  231|       |
  232|       |    // PDF spec says %%EOF must be found within the last 1024 bytes of/ the file.  We add an extra
  233|       |    // 30 characters to leave room for the startxref stuff.
  234|  20.8k|    m->file->seek(0, SEEK_END);
  235|  20.8k|    qpdf_offset_t end_offset = m->file->tell();
  236|  20.8k|    m->xref_table_max_offset = end_offset;
  237|       |    // Sanity check on object ids. All objects must appear in xref table / stream. In all realistic
  238|       |    // scenarios at least 3 bytes are required.
  239|  20.8k|    if (m->xref_table_max_id > m->xref_table_max_offset / 3) {
  ------------------
  |  Branch (239:9): [True: 20.8k, False: 0]
  ------------------
  240|  20.8k|        m->xref_table_max_id = static_cast<int>(m->xref_table_max_offset / 3);
  241|  20.8k|    }
  242|  20.8k|    qpdf_offset_t start_offset = (end_offset > 1054 ? end_offset - 1054 : 0);
  ------------------
  |  Branch (242:35): [True: 3.03k, False: 17.7k]
  ------------------
  243|  20.8k|    PatternFinder sf(*this, &Objects::findStartxref);
  244|  20.8k|    qpdf_offset_t xref_offset = 0;
  245|  20.8k|    if (m->file->findLast("startxref", start_offset, 0, sf)) {
  ------------------
  |  Branch (245:9): [True: 5.79k, False: 15.0k]
  ------------------
  246|  5.79k|        xref_offset = QUtil::string_to_ll(readToken(*m->file).getValue().c_str());
  247|  5.79k|    }
  248|       |
  249|  20.8k|    try {
  250|  20.8k|        if (xref_offset == 0) {
  ------------------
  |  Branch (250:13): [True: 15.0k, False: 5.76k]
  ------------------
  251|  15.0k|            throw damagedPDF("", -1, "can't find startxref");
  252|  15.0k|        }
  253|  5.76k|        try {
  254|  5.76k|            read_xref(xref_offset);
  255|  5.76k|        } catch (QPDFExc&) {
  256|  3.60k|            throw;
  257|  3.60k|        } catch (std::exception& e) {
  258|    757|            throw damagedPDF("", -1, std::string("error reading xref: ") + e.what());
  259|    757|        }
  260|  19.3k|    } catch (QPDFExc& e) {
  261|  19.3k|        if (global::Options::inspection_mode()) {
  ------------------
  |  Branch (261:13): [True: 0, False: 19.3k]
  ------------------
  262|      0|            try {
  263|      0|                reconstruct_xref(e, xref_offset > 0);
  264|      0|            } catch (std::exception& er) {
  265|      0|                warn(damagedPDF("", -1, "error reconstructing xref: "s + er.what()));
  266|      0|            }
  267|      0|            if (!m->trailer) {
  ------------------
  |  Branch (267:17): [True: 0, False: 0]
  ------------------
  268|      0|                m->trailer = Dictionary::empty();
  269|      0|            }
  270|      0|            return;
  271|      0|        }
  272|  19.3k|        if (cf.surpress_recovery()) {
  ------------------
  |  Branch (272:13): [True: 0, False: 19.3k]
  ------------------
  273|      0|            throw;
  274|      0|        }
  275|  19.3k|        reconstruct_xref(e, xref_offset > 0);
  276|  19.3k|    }
  277|       |
  278|  3.60k|    m->encp->initialize(qpdf);
  279|  3.60k|    m->parsed = true;
  280|  3.60k|    if (!m->xref_table.empty() && !qpdf.getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (280:9): [True: 2.46k, False: 1.14k]
  |  Branch (280:9): [True: 26, False: 3.58k]
  |  Branch (280:35): [True: 26, False: 2.43k]
  ------------------
  281|       |        // QPDFs created from JSON have an empty xref table and no root object yet.
  282|     26|        throw damagedPDF("", -1, "unable to find page tree");
  283|     26|    }
  284|  3.58k|    if (m->cf.max_warnings()) {
  ------------------
  |  Branch (284:9): [True: 2.24k, False: 1.34k]
  ------------------
  285|  2.24k|        if (m->pages.empty()) {
  ------------------
  |  Branch (285:13): [True: 12, False: 2.23k]
  ------------------
  286|     12|            throw damagedPDF("", -1, "no pages found");
  287|     12|        }
  288|  2.23k|        (void)m->cf.max_warnings(0);
  289|  2.23k|    }
  290|  3.58k|}
_ZN4QPDF3Doc7Objects7inParseEb:
  294|   268k|{
  295|   268k|    util::internal_error_if(
  296|   268k|        m->in_parse == v, "QPDF: re-entrant parsing detected"
  297|       |        // This happens if QPDFParser::parse tries to resolve an indirect object while it is
  298|       |        // parsing.
  299|   268k|    );
  300|   268k|    m->in_parse = v;
  301|   268k|}
_ZN4QPDF3Doc7Objects10setTrailerE16QPDFObjectHandle:
  305|  9.64k|{
  306|  9.64k|    if (m->trailer) {
  ------------------
  |  Branch (306:9): [True: 651, False: 8.98k]
  ------------------
  307|    651|        return;
  308|    651|    }
  309|  8.98k|    m->trailer = obj;
  310|  8.98k|}
_ZN4QPDF3Doc7Objects16reconstruct_xrefER7QPDFExcb:
  314|  24.5k|{
  315|  24.5k|    if (m->reconstructed_xref) {
  ------------------
  |  Branch (315:9): [True: 4.83k, False: 19.7k]
  ------------------
  316|       |        // Avoid xref reconstruction infinite loops. This is getting very hard to reproduce because
  317|       |        // qpdf is throwing many fewer exceptions while parsing. Most situations are warnings now.
  318|  4.83k|        throw e;
  319|  4.83k|    }
  320|       |
  321|       |    // If recovery generates more than 1000 warnings, the file is so severely damaged that there
  322|       |    // probably is no point trying to continue.
  323|  19.7k|    const auto max_warnings = m->warnings.size() + 1000U;
  324|  19.7k|    auto check_warnings = [this, max_warnings]() {
  325|  19.7k|        if (m->warnings.size() > max_warnings) {
  326|  19.7k|            throw damagedPDF("", -1, "too many errors while reconstructing cross-reference table");
  327|  19.7k|        }
  328|  19.7k|    };
  329|       |
  330|  19.7k|    m->reconstructed_xref = true;
  331|       |    // We may find more objects, which may contain dangling references.
  332|  19.7k|    m->fixed_dangling_refs = false;
  333|       |
  334|  19.7k|    warn(damagedPDF("", -1, "file is damaged"));
  335|  19.7k|    warn(e);
  336|  19.7k|    warn(damagedPDF("", -1, "Attempting to reconstruct cross-reference table"));
  337|       |
  338|       |    // Delete all references to type 1 (uncompressed) objects
  339|  19.7k|    std::vector<QPDFObjGen> to_delete;
  340|  93.3k|    for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (340:26): [True: 93.3k, False: 19.7k]
  ------------------
  341|  93.3k|        if (iter.second.getType() == 1) {
  ------------------
  |  Branch (341:13): [True: 69.3k, False: 23.9k]
  ------------------
  342|  69.3k|            to_delete.emplace_back(iter.first);
  343|  69.3k|        }
  344|  93.3k|    }
  345|  69.3k|    for (auto const& iter: to_delete) {
  ------------------
  |  Branch (345:26): [True: 69.3k, False: 19.7k]
  ------------------
  346|  69.3k|        m->xref_table.erase(iter);
  347|  69.3k|    }
  348|       |
  349|  19.7k|    std::vector<std::tuple<int, int, qpdf_offset_t>> found_objects;
  350|  19.7k|    std::vector<qpdf_offset_t> trailers;
  351|  19.7k|    std::vector<qpdf_offset_t> startxrefs;
  352|       |
  353|  19.7k|    m->file->seek(0, SEEK_END);
  354|  19.7k|    qpdf_offset_t eof = m->file->tell();
  355|  19.7k|    m->file->seek(0, SEEK_SET);
  356|       |    // Don't allow very long tokens here during recovery. All the interesting tokens are covered.
  357|  19.7k|    static size_t const MAX_LEN = 10;
  358|  1.06M|    while (m->file->tell() < eof) {
  ------------------
  |  Branch (358:12): [True: 1.04M, False: 19.7k]
  ------------------
  359|  1.04M|        QPDFTokenizer::Token t1 = m->objects.readToken(*m->file, MAX_LEN);
  360|  1.04M|        qpdf_offset_t token_start = m->file->tell() - toO(t1.getValue().length());
  361|  1.04M|        if (t1.isInteger()) {
  ------------------
  |  Branch (361:13): [True: 220k, False: 825k]
  ------------------
  362|   220k|            auto pos = m->file->tell();
  363|   220k|            auto t2 = m->objects.readToken(*m->file, MAX_LEN);
  364|   220k|            if (t2.isInteger() && m->objects.readToken(*m->file, MAX_LEN).isWord("obj")) {
  ------------------
  |  Branch (364:17): [True: 174k, False: 45.3k]
  |  Branch (364:17): [True: 101k, False: 118k]
  |  Branch (364:35): [True: 101k, False: 73.1k]
  ------------------
  365|   101k|                int obj = QUtil::string_to_int(t1.getValue().c_str());
  366|   101k|                if (obj > 0) {
  ------------------
  |  Branch (366:21): [True: 101k, False: 745]
  ------------------
  367|   101k|                    int gen = QUtil::string_to_int(t2.getValue().c_str());
  368|   101k|                    if (0 <= gen && gen < 65535) {
  ------------------
  |  Branch (368:25): [True: 100k, False: 344]
  |  Branch (368:37): [True: 100k, False: 216]
  ------------------
  369|   100k|                        if (obj <= m->xref_table_max_id) {
  ------------------
  |  Branch (369:29): [True: 99.3k, False: 1.12k]
  ------------------
  370|  99.3k|                            found_objects.emplace_back(obj, gen, token_start);
  371|  99.3k|                        } else {
  372|  1.12k|                            warn(damagedPDF(
  373|  1.12k|                                "",
  374|  1.12k|                                -1,
  375|  1.12k|                                "ignoring object with impossibly large id " + std::to_string(obj)));
  376|  1.12k|                        }
  377|   100k|                    }
  378|   101k|                }
  379|   101k|            }
  380|   220k|            m->file->seek(pos, SEEK_SET);
  381|   825k|        } else if (!m->trailer && t1.isWord("trailer")) {
  ------------------
  |  Branch (381:20): [True: 697k, False: 127k]
  |  Branch (381:20): [True: 44.2k, False: 780k]
  |  Branch (381:35): [True: 44.2k, False: 652k]
  ------------------
  382|  44.2k|            trailers.emplace_back(m->file->tell());
  383|   780k|        } else if (!found_startxref && t1.isWord("startxref")) {
  ------------------
  |  Branch (383:20): [True: 566k, False: 214k]
  |  Branch (383:20): [True: 18.7k, False: 762k]
  |  Branch (383:40): [True: 18.7k, False: 547k]
  ------------------
  384|  18.7k|            startxrefs.emplace_back(m->file->tell());
  385|  18.7k|        }
  386|  1.04M|        check_warnings();
  387|  1.04M|        m->file->findAndSkipNextEOL();
  388|  1.04M|    }
  389|       |
  390|  19.7k|    if (!found_startxref && !startxrefs.empty() && !found_objects.empty() &&
  ------------------
  |  Branch (390:9): [True: 15.2k, False: 4.46k]
  |  Branch (390:29): [True: 613, False: 14.6k]
  |  Branch (390:52): [True: 475, False: 138]
  ------------------
  391|    475|        startxrefs.back() > std::get<2>(found_objects.back())) {
  ------------------
  |  Branch (391:9): [True: 321, False: 154]
  ------------------
  392|    321|        auto xref_backup{m->xref_table};
  393|    321|        try {
  394|    321|            m->file->seek(startxrefs.back(), SEEK_SET);
  395|    321|            if (auto offset = QUtil::string_to_ll(readToken(*m->file).getValue().data())) {
  ------------------
  |  Branch (395:22): [True: 274, False: 47]
  ------------------
  396|    274|                read_xref(offset);
  397|       |
  398|    274|                if (qpdf.getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (398:21): [True: 3, False: 271]
  ------------------
  399|      3|                    warn(damagedPDF(
  400|      3|                        "", -1, "startxref was more than 1024 bytes before end of file"));
  401|      3|                    m->encp->initialize(qpdf);
  402|      3|                    m->parsed = true;
  403|      3|                    m->reconstructed_xref = false;
  404|      3|                    return;
  405|      3|                }
  406|    274|            }
  407|    321|        } catch (...) {
  408|       |            // ok, bad luck. Do recovery.
  409|    271|        }
  410|    318|        m->xref_table = std::move(xref_backup);
  411|    318|    }
  412|       |
  413|  19.7k|    auto rend = found_objects.rend();
  414|   118k|    for (auto it = found_objects.rbegin(); it != rend; it++) {
  ------------------
  |  Branch (414:44): [True: 99.2k, False: 19.7k]
  ------------------
  415|  99.2k|        auto [obj, gen, token_start] = *it;
  416|  99.2k|        insertXrefEntry(obj, 1, token_start, gen);
  417|  99.2k|        check_warnings();
  418|  99.2k|    }
  419|  19.7k|    m->deleted_objects.clear();
  420|       |
  421|       |    // Search at most the last 100 trailer candidates. If none of them are valid, odds are this file
  422|       |    // is deliberately broken.
  423|  19.7k|    int end_index = trailers.size() > 100 ? static_cast<int>(trailers.size()) - 100 : 0;
  ------------------
  |  Branch (423:21): [True: 27, False: 19.7k]
  ------------------
  424|  40.6k|    for (auto it = trailers.rbegin(); it != std::prev(trailers.rend(), end_index); it++) {
  ------------------
  |  Branch (424:39): [True: 22.4k, False: 18.2k]
  ------------------
  425|  22.4k|        m->file->seek(*it, SEEK_SET);
  426|  22.4k|        auto t = readTrailer();
  427|  22.4k|        if (!t.isDictionary()) {
  ------------------
  |  Branch (427:13): [True: 19.5k, False: 2.93k]
  ------------------
  428|       |            // Oh well.  It was worth a try.
  429|  19.5k|        } else {
  430|  2.93k|            if (t.hasKey("/Root")) {
  ------------------
  |  Branch (430:17): [True: 1.52k, False: 1.41k]
  ------------------
  431|  1.52k|                m->trailer = t;
  432|  1.52k|                break;
  433|  1.52k|            }
  434|  1.41k|            warn(damagedPDF("trailer", *it, "recovered trailer has no /Root entry"));
  435|  1.41k|        }
  436|  20.9k|        check_warnings();
  437|  20.9k|    }
  438|       |
  439|  19.7k|    if (!m->trailer) {
  ------------------
  |  Branch (439:9): [True: 17.1k, False: 2.57k]
  ------------------
  440|  17.1k|        qpdf_offset_t max_offset{0};
  441|  17.1k|        size_t max_size{0};
  442|       |        // If there are any xref streams, take the last one to appear.
  443|  50.5k|        for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (443:30): [True: 50.5k, False: 17.1k]
  ------------------
  444|  50.5k|            auto entry = iter.second;
  445|  50.5k|            if (entry.getType() != 1) {
  ------------------
  |  Branch (445:17): [True: 1.36k, False: 49.2k]
  ------------------
  446|  1.36k|                continue;
  447|  1.36k|            }
  448|  49.2k|            auto oh = qpdf.getObject(iter.first);
  449|  49.2k|            try {
  450|  49.2k|                if (!oh.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (450:21): [True: 38.4k, False: 10.8k]
  ------------------
  451|  38.4k|                    continue;
  452|  38.4k|                }
  453|  49.2k|            } catch (std::exception&) {
  454|  3.14k|                continue;
  455|  3.14k|            }
  456|  7.66k|            auto offset = entry.getOffset();
  457|  7.66k|            auto size = oh.getDict().getKey("/Size").getUIntValueAsUInt();
  458|  7.66k|            if (size > max_size || (size == max_size && offset > max_offset)) {
  ------------------
  |  Branch (458:17): [True: 5.74k, False: 1.91k]
  |  Branch (458:37): [True: 1.91k, False: 0]
  |  Branch (458:57): [True: 1.82k, False: 96]
  ------------------
  459|  7.56k|                max_offset = offset;
  460|  7.56k|                setTrailer(oh.getDict());
  461|  7.56k|            }
  462|  7.66k|            check_warnings();
  463|  7.66k|        }
  464|  17.1k|        if (max_offset > 0) {
  ------------------
  |  Branch (464:13): [True: 6.91k, False: 10.2k]
  ------------------
  465|  6.91k|            try {
  466|  6.91k|                read_xref(max_offset, true);
  467|  6.91k|            } catch (std::exception&) {
  468|  3.85k|                warn(damagedPDF(
  469|  3.85k|                    "", -1, "error decoding candidate xref stream while recovering damaged file"));
  470|  3.85k|            }
  471|  6.91k|            QTC::TC("qpdf", "QPDF recover xref stream");
  472|  6.85k|        }
  473|  17.1k|    }
  474|       |
  475|  19.6k|    if (!m->trailer || (!m->parsed && !m->trailer.getKey("/Root").isDictionary())) {
  ------------------
  |  Branch (475:9): [True: 10.2k, False: 9.38k]
  |  Branch (475:9): [True: 17.7k, False: 1.93k]
  |  Branch (475:25): [True: 9.07k, False: 315]
  |  Branch (475:39): [True: 7.50k, False: 1.57k]
  ------------------
  476|       |        // Try to find a Root dictionary. As a quick fix try the one with the highest object id.
  477|  17.7k|        QPDFObjectHandle root;
  478|  97.8k|        for (auto const& iter: m->obj_cache) {
  ------------------
  |  Branch (478:30): [True: 97.8k, False: 17.7k]
  ------------------
  479|  97.8k|            try {
  480|  97.8k|                if (QPDFObjectHandle(iter.second.object).isDictionaryOfType("/Catalog")) {
  ------------------
  |  Branch (480:21): [True: 2.56k, False: 95.2k]
  ------------------
  481|  2.56k|                    root = iter.second.object;
  482|  2.56k|                }
  483|  97.8k|            } catch (std::exception&) {
  484|  5.98k|                continue;
  485|  5.98k|            }
  486|  97.8k|        }
  487|  17.7k|        if (root) {
  ------------------
  |  Branch (487:13): [True: 2.48k, False: 15.2k]
  ------------------
  488|  2.48k|            if (!m->trailer) {
  ------------------
  |  Branch (488:17): [True: 1.82k, False: 656]
  ------------------
  489|  1.82k|                warn(damagedPDF(
  490|  1.82k|                    "", -1, "unable to find trailer dictionary while recovering damaged file"));
  491|  1.82k|                m->trailer = QPDFObjectHandle::newDictionary();
  492|  1.82k|            }
  493|  2.48k|            m->trailer.replaceKey("/Root", root);
  494|  2.48k|        }
  495|  17.7k|    }
  496|       |
  497|  19.6k|    if (!m->trailer) {
  ------------------
  |  Branch (497:9): [True: 8.41k, False: 11.2k]
  ------------------
  498|       |        // We could check the last encountered object to see if it was an xref stream.  If so, we
  499|       |        // could try to get the trailer from there.  This may make it possible to recover files with
  500|       |        // bad startxref pointers even when they have object streams.
  501|       |
  502|  8.41k|        throw damagedPDF("", -1, "unable to find trailer dictionary while recovering damaged file");
  503|  8.41k|    }
  504|  11.2k|    if (m->xref_table.empty()) {
  ------------------
  |  Branch (504:9): [True: 386, False: 10.8k]
  ------------------
  505|       |        // We cannot check for an empty xref table in parse because empty tables are valid when
  506|       |        // creating QPDF objects from JSON.
  507|    386|        throw damagedPDF("", -1, "unable to find objects while recovering damaged file");
  508|    386|    }
  509|  10.8k|    check_warnings();
  510|  10.8k|    if (!m->parsed) {
  ------------------
  |  Branch (510:9): [True: 10.5k, False: 370]
  ------------------
  511|  10.5k|        m->parsed = !m->pages.empty();
  512|  10.5k|        if (!m->parsed) {
  ------------------
  |  Branch (512:13): [True: 1.11k, False: 9.39k]
  ------------------
  513|  1.11k|            throw damagedPDF("", -1, "unable to find any pages while recovering damaged file");
  514|  1.11k|        }
  515|  9.39k|        check_warnings();
  516|  9.39k|    }
  517|       |
  518|       |    // We could iterate through the objects looking for streams and try to find objects inside of
  519|       |    // them, but it's probably not worth the trouble.  Acrobat can't recover files with any errors
  520|       |    // in an xref stream, and this would be a real long shot anyway.  If we wanted to do anything
  521|       |    // that involved looking at stream contents, we'd also have to call initializeEncryption() here.
  522|       |    // It's safe to call it more than once.
  523|  10.8k|}
_ZN4QPDF3Doc7Objects9read_xrefExb:
  527|  12.9k|{
  528|  12.9k|    std::map<int, int> free_table;
  529|  12.9k|    std::set<qpdf_offset_t> visited;
  530|  26.7k|    while (xref_offset) {
  ------------------
  |  Branch (530:12): [True: 14.1k, False: 12.5k]
  ------------------
  531|  14.1k|        visited.insert(xref_offset);
  532|  14.1k|        char buf[7];
  533|  14.1k|        memset(buf, 0, sizeof(buf));
  534|  14.1k|        m->file->seek(xref_offset, SEEK_SET);
  535|       |        // Some files miss the mark a little with startxref. We could do a better job of searching
  536|       |        // in the neighborhood for something that looks like either an xref table or stream, but the
  537|       |        // simple heuristic of skipping whitespace can help with the xref table case and is harmless
  538|       |        // with the stream case.
  539|  14.1k|        bool done = false;
  540|  14.1k|        bool skipped_space = false;
  541|  32.7k|        while (!done) {
  ------------------
  |  Branch (541:16): [True: 18.6k, False: 14.1k]
  ------------------
  542|  18.6k|            char ch;
  543|  18.6k|            if (1 == m->file->read(&ch, 1)) {
  ------------------
  |  Branch (543:17): [True: 18.1k, False: 468]
  ------------------
  544|  18.1k|                if (util::is_space(ch)) {
  ------------------
  |  Branch (544:21): [True: 4.93k, False: 13.2k]
  ------------------
  545|  4.93k|                    skipped_space = true;
  546|  13.2k|                } else {
  547|  13.2k|                    m->file->unreadCh(ch);
  548|  13.2k|                    done = true;
  549|  13.2k|                }
  550|  18.1k|            } else {
  551|    468|                QTC::TC("qpdf", "QPDF eof skipping spaces before xref", skipped_space ? 0 : 1);
  ------------------
  |  Branch (551:73): [True: 0, False: 468]
  ------------------
  552|    468|                done = true;
  553|    468|            }
  554|  18.6k|        }
  555|       |
  556|  14.1k|        m->file->read(buf, sizeof(buf) - 1);
  557|       |        // The PDF spec says xref must be followed by a line terminator, but files exist in the wild
  558|       |        // where it is terminated by arbitrary whitespace.
  559|  14.1k|        if ((strncmp(buf, "xref", 4) == 0) && util::is_space(buf[4])) {
  ------------------
  |  Branch (559:13): [True: 2.67k, False: 11.4k]
  |  Branch (559:47): [True: 2.65k, False: 15]
  ------------------
  560|  2.65k|            if (skipped_space) {
  ------------------
  |  Branch (560:17): [True: 108, False: 2.55k]
  ------------------
  561|    108|                warn(damagedPDF("", -1, "extraneous whitespace seen before xref"));
  562|    108|            }
  563|  2.65k|            QTC::TC(
  564|  2.65k|                "qpdf",
  565|  2.65k|                "QPDF xref space",
  566|  2.65k|                ((buf[4] == '\n')       ? 0
  ------------------
  |  Branch (566:18): [True: 335, False: 2.32k]
  ------------------
  567|  2.65k|                     : (buf[4] == '\r') ? 1
  ------------------
  |  Branch (567:24): [True: 1.86k, False: 454]
  ------------------
  568|  2.32k|                     : (buf[4] == ' ')  ? 2
  ------------------
  |  Branch (568:24): [True: 283, False: 171]
  ------------------
  569|    454|                                        : 9999));
  570|  2.65k|            int skip = 4;
  571|       |            // buf is null-terminated, and util::is_space('\0') is false, so this won't overrun.
  572|  5.62k|            while (util::is_space(buf[skip])) {
  ------------------
  |  Branch (572:20): [True: 2.96k, False: 2.65k]
  ------------------
  573|  2.96k|                ++skip;
  574|  2.96k|            }
  575|  2.65k|            xref_offset = read_xrefTable(xref_offset + skip);
  576|  11.4k|        } else {
  577|  11.4k|            xref_offset = read_xrefStream(xref_offset, in_stream_recovery);
  578|  11.4k|        }
  579|  14.1k|        if (visited.contains(xref_offset)) {
  ------------------
  |  Branch (579:13): [True: 345, False: 13.7k]
  ------------------
  580|    345|            throw damagedPDF("", -1, "loop detected following xref tables");
  581|    345|        }
  582|  14.1k|    }
  583|       |
  584|  12.5k|    if (!m->trailer) {
  ------------------
  |  Branch (584:9): [True: 0, False: 12.5k]
  ------------------
  585|      0|        throw damagedPDF("", -1, "unable to find trailer while reading xref");
  586|      0|    }
  587|  12.5k|    int size = m->trailer.getKey("/Size").getIntValueAsInt();
  588|  12.5k|    int max_obj = 0;
  589|  12.5k|    if (!m->xref_table.empty()) {
  ------------------
  |  Branch (589:9): [True: 3.94k, False: 8.65k]
  ------------------
  590|  3.94k|        max_obj = m->xref_table.rbegin()->first.getObj();
  591|  3.94k|    }
  592|  12.5k|    if (!m->deleted_objects.empty()) {
  ------------------
  |  Branch (592:9): [True: 1.02k, False: 11.5k]
  ------------------
  593|  1.02k|        max_obj = std::max(max_obj, *(m->deleted_objects.rbegin()));
  594|  1.02k|    }
  595|  12.5k|    if (size < 1 || (size - 1) != max_obj) {
  ------------------
  |  Branch (595:9): [True: 9.05k, False: 3.54k]
  |  Branch (595:21): [True: 2.78k, False: 761]
  ------------------
  596|  3.74k|        if (size == (max_obj + 2) && qpdf.getObject(max_obj + 1, 0).isStreamOfType("/XRef")) {
  ------------------
  |  Branch (596:13): [True: 219, False: 3.52k]
  |  Branch (596:13): [True: 9, False: 3.73k]
  |  Branch (596:38): [True: 9, False: 210]
  ------------------
  597|      9|            warn(damagedPDF(
  598|      9|                "",
  599|      9|                -1,
  600|      9|                "xref entry for the xref stream itself is missing - a common error handled "
  601|      9|                "correctly by qpdf and most other applications"));
  602|  3.73k|        } else {
  603|  3.73k|            warn(damagedPDF(
  604|  3.73k|                "",
  605|  3.73k|                -1,
  606|  3.73k|                ("reported number of objects (" + std::to_string(size) +
  607|  3.73k|                 ") is not one plus the highest object number (" + std::to_string(max_obj) + ")")));
  608|  3.73k|        }
  609|  3.74k|    }
  610|       |
  611|       |    // We no longer need the deleted_objects table, so go ahead and clear it out to make sure we
  612|       |    // never depend on its being set.
  613|  12.5k|    m->deleted_objects.clear();
  614|       |
  615|       |    // Make sure we keep only the highest generation for any object.
  616|  12.5k|    QPDFObjGen last_og{-1, 0};
  617|   446k|    for (auto const& item: m->xref_table) {
  ------------------
  |  Branch (617:26): [True: 446k, False: 12.5k]
  ------------------
  618|   446k|        auto id = item.first.getObj();
  619|   446k|        if (id == last_og.getObj() && id > 0) {
  ------------------
  |  Branch (619:13): [True: 23.6k, False: 422k]
  |  Branch (619:39): [True: 23.6k, False: 0]
  ------------------
  620|  23.6k|            qpdf.removeObject(last_og);
  621|  23.6k|        }
  622|   446k|        last_og = item.first;
  623|   446k|    }
  624|  12.5k|}
_ZN4QPDF3Doc7Objects15parse_xrefFirstERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERiSB_SB_:
  628|  9.50k|{
  629|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  630|       |    // buffer.
  631|  9.50k|    char const* p = line.c_str();
  632|  9.50k|    char const* start = line.c_str();
  633|       |
  634|       |    // Skip zero or more spaces
  635|  10.8k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (635:12): [True: 1.34k, False: 9.50k]
  ------------------
  636|  1.34k|        ++p;
  637|  1.34k|    }
  638|       |    // Require digit
  639|  9.50k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (639:9): [True: 238, False: 9.26k]
  ------------------
  640|    238|        return false;
  641|    238|    }
  642|       |    // Gather digits
  643|  9.26k|    std::string obj_str;
  644|  36.0k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (644:12): [True: 26.7k, False: 9.26k]
  ------------------
  645|  26.7k|        obj_str.append(1, *p++);
  646|  26.7k|    }
  647|       |    // Require space
  648|  9.26k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (648:9): [True: 133, False: 9.13k]
  ------------------
  649|    133|        return false;
  650|    133|    }
  651|       |    // Skip spaces
  652|  26.9k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (652:12): [True: 17.7k, False: 9.13k]
  ------------------
  653|  17.7k|        ++p;
  654|  17.7k|    }
  655|       |    // Require digit
  656|  9.13k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (656:9): [True: 105, False: 9.02k]
  ------------------
  657|    105|        return false;
  658|    105|    }
  659|       |    // Gather digits
  660|  9.02k|    std::string num_str;
  661|  24.9k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (661:12): [True: 15.9k, False: 9.02k]
  ------------------
  662|  15.9k|        num_str.append(1, *p++);
  663|  15.9k|    }
  664|       |    // Skip any space including line terminators
  665|  27.4k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (665:12): [True: 18.4k, False: 9.02k]
  ------------------
  666|  18.4k|        ++p;
  667|  18.4k|    }
  668|  9.02k|    bytes = toI(p - start);
  669|  9.02k|    obj = QUtil::string_to_int(obj_str.c_str());
  670|  9.02k|    num = QUtil::string_to_int(num_str.c_str());
  671|  9.02k|    return true;
  672|  9.13k|}
_ZN4QPDF3Doc7Objects18read_bad_xrefEntryERxRiRc:
  676|  7.71k|{
  677|       |    // Reposition after initial read attempt and reread.
  678|  7.71k|    m->file->seek(m->file->getLastOffset(), SEEK_SET);
  679|  7.71k|    auto line = m->file->readLine(30);
  680|       |
  681|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  682|       |    // buffer.
  683|  7.71k|    char const* p = line.data();
  684|       |
  685|       |    // Skip zero or more spaces. There aren't supposed to be any.
  686|  7.71k|    bool invalid = false;
  687|  8.87k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (687:12): [True: 1.15k, False: 7.71k]
  ------------------
  688|  1.15k|        ++p;
  689|  1.15k|        invalid = true;
  690|  1.15k|    }
  691|       |    // Require digit
  692|  7.71k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (692:9): [True: 49, False: 7.66k]
  ------------------
  693|     49|        return false;
  694|     49|    }
  695|       |    // Gather digits
  696|  7.66k|    std::string f1_str;
  697|  41.3k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (697:12): [True: 33.6k, False: 7.66k]
  ------------------
  698|  33.6k|        f1_str.append(1, *p++);
  699|  33.6k|    }
  700|       |    // Require space
  701|  7.66k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (701:9): [True: 47, False: 7.62k]
  ------------------
  702|     47|        return false;
  703|     47|    }
  704|  7.62k|    if (util::is_space(*(p + 1))) {
  ------------------
  |  Branch (704:9): [True: 943, False: 6.67k]
  ------------------
  705|    943|        invalid = true;
  706|    943|    }
  707|       |    // Skip spaces
  708|  16.7k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (708:12): [True: 9.10k, False: 7.62k]
  ------------------
  709|  9.10k|        ++p;
  710|  9.10k|    }
  711|       |    // Require digit
  712|  7.62k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (712:9): [True: 78, False: 7.54k]
  ------------------
  713|     78|        return false;
  714|     78|    }
  715|       |    // Gather digits
  716|  7.54k|    std::string f2_str;
  717|  31.0k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (717:12): [True: 23.5k, False: 7.54k]
  ------------------
  718|  23.5k|        f2_str.append(1, *p++);
  719|  23.5k|    }
  720|       |    // Require space
  721|  7.54k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (721:9): [True: 82, False: 7.46k]
  ------------------
  722|     82|        return false;
  723|     82|    }
  724|  7.46k|    if (util::is_space(*(p + 1))) {
  ------------------
  |  Branch (724:9): [True: 1.25k, False: 6.20k]
  ------------------
  725|  1.25k|        invalid = true;
  726|  1.25k|    }
  727|       |    // Skip spaces
  728|  17.4k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (728:12): [True: 10.0k, False: 7.46k]
  ------------------
  729|  10.0k|        ++p;
  730|  10.0k|    }
  731|  7.46k|    if ((*p == 'f') || (*p == 'n')) {
  ------------------
  |  Branch (731:9): [True: 1.65k, False: 5.80k]
  |  Branch (731:24): [True: 5.70k, False: 95]
  ------------------
  732|  7.36k|        type = *p;
  733|  7.36k|    } else {
  734|     95|        return false;
  735|     95|    }
  736|  7.36k|    if ((f1_str.length() != 10) || (f2_str.length() != 5)) {
  ------------------
  |  Branch (736:9): [True: 6.08k, False: 1.28k]
  |  Branch (736:36): [True: 717, False: 567]
  ------------------
  737|  6.79k|        invalid = true;
  738|  6.79k|    }
  739|       |
  740|  7.36k|    if (invalid) {
  ------------------
  |  Branch (740:9): [True: 6.86k, False: 499]
  ------------------
  741|  6.86k|        warn(damagedPDF("xref table", "accepting invalid xref table entry"));
  742|  6.86k|    }
  743|       |
  744|  7.36k|    f1 = QUtil::string_to_ll(f1_str.c_str());
  745|  7.36k|    f2 = QUtil::string_to_int(f2_str.c_str());
  746|       |
  747|  7.36k|    return true;
  748|  7.46k|}
_ZN4QPDF3Doc7Objects14read_xrefEntryERxRiRc:
  754|  33.2k|{
  755|  33.2k|    std::array<char, 21> line;
  756|  33.2k|    if (m->file->read(line.data(), 20) != 20) {
  ------------------
  |  Branch (756:9): [True: 337, False: 32.9k]
  ------------------
  757|       |        // C++20: [[unlikely]]
  758|    337|        return false;
  759|    337|    }
  760|  32.9k|    line[20] = '\0';
  761|  32.9k|    char const* p = line.data();
  762|       |
  763|  32.9k|    int f1_len = 0;
  764|  32.9k|    int f2_len = 0;
  765|       |
  766|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  767|       |    // buffer.
  768|       |
  769|       |    // Gather f1 digits. NB No risk of overflow as 9'999'999'999 < max long long.
  770|   193k|    while (*p == '0') {
  ------------------
  |  Branch (770:12): [True: 160k, False: 32.9k]
  ------------------
  771|   160k|        ++f1_len;
  772|   160k|        ++p;
  773|   160k|    }
  774|   149k|    while (util::is_digit(*p) && f1_len++ < 10) {
  ------------------
  |  Branch (774:12): [True: 116k, False: 32.9k]
  |  Branch (774:34): [True: 116k, False: 18]
  ------------------
  775|   116k|        f1 *= 10;
  776|   116k|        f1 += *p++ - '0';
  777|   116k|    }
  778|       |    // Require space
  779|  32.9k|    if (!util::is_space(*p++)) {
  ------------------
  |  Branch (779:9): [True: 121, False: 32.8k]
  ------------------
  780|       |        // Entry doesn't start with space or digit.
  781|       |        // C++20: [[unlikely]]
  782|    121|        return false;
  783|    121|    }
  784|       |    // Gather digits. NB No risk of overflow as 99'999 < max int.
  785|   155k|    while (*p == '0') {
  ------------------
  |  Branch (785:12): [True: 123k, False: 32.8k]
  ------------------
  786|   123k|        ++f2_len;
  787|   123k|        ++p;
  788|   123k|    }
  789|  59.7k|    while (util::is_digit(*p) && f2_len++ < 5) {
  ------------------
  |  Branch (789:12): [True: 27.6k, False: 32.0k]
  |  Branch (789:34): [True: 26.9k, False: 778]
  ------------------
  790|  26.9k|        f2 *= 10;
  791|  26.9k|        f2 += static_cast<int>(*p++ - '0');
  792|  26.9k|    }
  793|  32.8k|    if (util::is_space(*p++) && (*p == 'f' || *p == 'n')) {
  ------------------
  |  Branch (793:9): [True: 31.7k, False: 1.08k]
  |  Branch (793:34): [True: 3.83k, False: 27.9k]
  |  Branch (793:47): [True: 26.0k, False: 1.91k]
  ------------------
  794|       |        // C++20: [[likely]]
  795|  29.8k|        type = *p;
  796|       |        // No test for valid line[19].
  797|  29.8k|        if (*(++p) && *(++p) && (*p == '\n' || *p == '\r') && f1_len == 10 && f2_len == 5) {
  ------------------
  |  Branch (797:13): [True: 29.4k, False: 354]
  |  Branch (797:23): [True: 29.3k, False: 105]
  |  Branch (797:34): [True: 26.3k, False: 2.97k]
  |  Branch (797:48): [True: 405, False: 2.57k]
  |  Branch (797:63): [True: 25.6k, False: 1.18k]
  |  Branch (797:79): [True: 25.1k, False: 504]
  ------------------
  798|       |            // C++20: [[likely]]
  799|  25.1k|            return true;
  800|  25.1k|        }
  801|  29.8k|    }
  802|  7.71k|    return read_bad_xrefEntry(f1, f2, type);
  803|  32.8k|}
_ZN4QPDF3Doc7Objects14read_xrefTableEx:
  808|  2.65k|{
  809|  2.65k|    m->file->seek(xref_offset, SEEK_SET);
  810|  2.65k|    std::string line;
  811|  9.53k|    while (true) {
  ------------------
  |  Branch (811:12): [True: 9.50k, Folded]
  ------------------
  812|  9.50k|        line.assign(50, '\0');
  813|  9.50k|        m->file->read(line.data(), line.size());
  814|  9.50k|        int obj = 0;
  815|  9.50k|        int num = 0;
  816|  9.50k|        int bytes = 0;
  817|  9.50k|        if (!parse_xrefFirst(line, obj, num, bytes)) {
  ------------------
  |  Branch (817:13): [True: 476, False: 9.02k]
  ------------------
  818|    476|            throw damagedPDF("xref table", "xref syntax invalid");
  819|    476|        }
  820|  9.02k|        m->file->seek(m->file->getLastOffset() + bytes, SEEK_SET);
  821|  41.5k|        for (qpdf_offset_t i = obj; i - num < obj; ++i) {
  ------------------
  |  Branch (821:37): [True: 33.2k, False: 8.21k]
  ------------------
  822|  33.2k|            if (i == 0) {
  ------------------
  |  Branch (822:17): [True: 969, False: 32.3k]
  ------------------
  823|       |                // This is needed by checkLinearization()
  824|    969|                first_xref_item_offset_ = m->file->tell();
  825|    969|            }
  826|       |            // For xref_table, these will always be small enough to be ints
  827|  33.2k|            qpdf_offset_t f1 = 0;
  828|  33.2k|            int f2 = 0;
  829|  33.2k|            char type = '\0';
  830|  33.2k|            if (!read_xrefEntry(f1, f2, type)) {
  ------------------
  |  Branch (830:17): [True: 809, False: 32.4k]
  ------------------
  831|    809|                throw damagedPDF(
  832|    809|                    "xref table", "invalid xref entry (obj=" + std::to_string(i) + ")");
  833|    809|            }
  834|  32.4k|            if (type == 'f') {
  ------------------
  |  Branch (834:17): [True: 4.61k, False: 27.8k]
  ------------------
  835|  4.61k|                insertFreeXrefEntry(QPDFObjGen(toI(i), f2));
  836|  27.8k|            } else {
  837|  27.8k|                insertXrefEntry(toI(i), 1, f1, f2);
  838|  27.8k|            }
  839|  32.4k|        }
  840|  8.21k|        qpdf_offset_t pos = m->file->tell();
  841|  8.21k|        if (readToken(*m->file).isWord("trailer")) {
  ------------------
  |  Branch (841:13): [True: 1.34k, False: 6.87k]
  ------------------
  842|  1.34k|            break;
  843|  6.87k|        } else {
  844|  6.87k|            m->file->seek(pos, SEEK_SET);
  845|  6.87k|        }
  846|  8.21k|    }
  847|       |
  848|       |    // Set offset to previous xref table if any
  849|  1.37k|    QPDFObjectHandle cur_trailer = m->objects.readTrailer();
  850|  1.37k|    if (!cur_trailer.isDictionary()) {
  ------------------
  |  Branch (850:9): [True: 110, False: 1.26k]
  ------------------
  851|    110|        throw damagedPDF("", "expected trailer dictionary");
  852|    110|    }
  853|       |
  854|  1.26k|    if (!m->trailer) {
  ------------------
  |  Branch (854:9): [True: 1.15k, False: 103]
  ------------------
  855|  1.15k|        setTrailer(cur_trailer);
  856|       |
  857|  1.15k|        if (!m->trailer.hasKey("/Size")) {
  ------------------
  |  Branch (857:13): [True: 167, False: 992]
  ------------------
  858|    167|            throw damagedPDF("trailer", "trailer dictionary lacks /Size key");
  859|    167|        }
  860|    992|        if (!m->trailer.getKey("/Size").isInteger()) {
  ------------------
  |  Branch (860:13): [True: 2, False: 990]
  ------------------
  861|      2|            throw damagedPDF("trailer", "/Size key in trailer dictionary is not an integer");
  862|      2|        }
  863|    992|    }
  864|       |
  865|  1.09k|    if (cur_trailer.hasKey("/XRefStm")) {
  ------------------
  |  Branch (865:9): [True: 33, False: 1.06k]
  ------------------
  866|     33|        if (cf.ignore_xref_streams()) {
  ------------------
  |  Branch (866:13): [True: 0, False: 33]
  ------------------
  867|      0|            QTC::TC("qpdf", "QPDF ignoring XRefStm in trailer");
  868|     33|        } else {
  869|     33|            if (cur_trailer.getKey("/XRefStm").isInteger()) {
  ------------------
  |  Branch (869:17): [True: 32, False: 1]
  ------------------
  870|       |                // Read the xref stream but disregard any return value -- we'll use our trailer's
  871|       |                // /Prev key instead of the xref stream's.
  872|     32|                (void)read_xrefStream(cur_trailer.getKey("/XRefStm").getIntValue());
  873|     32|            } else {
  874|      1|                throw damagedPDF("xref stream", xref_offset, "invalid /XRefStm");
  875|      1|            }
  876|     33|        }
  877|     33|    }
  878|       |
  879|  1.09k|    if (cur_trailer.hasKey("/Prev")) {
  ------------------
  |  Branch (879:9): [True: 246, False: 846]
  ------------------
  880|    246|        if (!cur_trailer.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (880:13): [True: 1, False: 245]
  ------------------
  881|      1|            throw damagedPDF("trailer", "/Prev key in trailer dictionary is not an integer");
  882|      1|        }
  883|    245|        return cur_trailer.getKey("/Prev").getIntValue();
  884|    246|    }
  885|       |
  886|    846|    return 0;
  887|  1.09k|}
_ZN4QPDF3Doc7Objects15read_xrefStreamExb:
  892|  11.0k|{
  893|  11.0k|    if (!cf.ignore_xref_streams()) {
  ------------------
  |  Branch (893:9): [True: 11.0k, False: 0]
  ------------------
  894|  11.0k|        QPDFObjectHandle xref_obj;
  895|  11.0k|        try {
  896|  11.0k|            m->in_read_xref_stream = true;
  897|  11.0k|            xref_obj = readObjectAtOffset(xref_offset, "xref stream", true);
  898|  11.0k|        } catch (QPDFExc&) {
  899|       |            // ignore -- report error below
  900|  1.32k|        }
  901|  11.0k|        m->in_read_xref_stream = false;
  902|  11.0k|        if (xref_obj.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (902:13): [True: 9.52k, False: 1.49k]
  ------------------
  903|  9.52k|            return processXRefStream(xref_offset, xref_obj, in_stream_recovery);
  904|  9.52k|        }
  905|  11.0k|    }
  906|       |
  907|  1.49k|    throw damagedPDF("", xref_offset, "xref not found");
  908|      0|    return 0; // unreachable
  909|  11.0k|}
_ZN4QPDF3Doc7Objects12processXRefWER16QPDFObjectHandleNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  914|  9.52k|{
  915|  9.52k|    auto W_obj = dict.getKey("/W");
  916|  9.52k|    if (!(W_obj.size() >= 3 && W_obj.getArrayItem(0).isInteger() &&
  ------------------
  |  Branch (916:9): [True: 382, False: 9.14k]
  |  Branch (916:11): [True: 9.20k, False: 323]
  |  Branch (916:32): [True: 9.19k, False: 10]
  ------------------
  917|  9.19k|          W_obj.getArrayItem(1).isInteger() && W_obj.getArrayItem(2).isInteger())) {
  ------------------
  |  Branch (917:11): [True: 9.17k, False: 21]
  |  Branch (917:48): [True: 9.14k, False: 28]
  ------------------
  918|    382|        throw damaged("Cross-reference stream does not have a proper /W key");
  919|    382|    }
  920|       |
  921|  9.14k|    std::array<int, 3> W;
  922|  9.14k|    int entry_size = 0;
  923|  9.14k|    auto w_vector = W_obj.getArrayAsVector();
  924|  9.14k|    int max_bytes = sizeof(qpdf_offset_t);
  925|  36.3k|    for (size_t i = 0; i < 3; ++i) {
  ------------------
  |  Branch (925:24): [True: 27.3k, False: 9.04k]
  ------------------
  926|  27.3k|        W[i] = w_vector[i].getIntValueAsInt();
  927|  27.3k|        if (W[i] > max_bytes) {
  ------------------
  |  Branch (927:13): [True: 51, False: 27.2k]
  ------------------
  928|     51|            throw damaged("Cross-reference stream's /W contains impossibly large values");
  929|     51|        }
  930|  27.2k|        if (W[i] < 0) {
  ------------------
  |  Branch (930:13): [True: 50, False: 27.2k]
  ------------------
  931|     50|            throw damaged("Cross-reference stream's /W contains negative values");
  932|     50|        }
  933|  27.2k|        entry_size += W[i];
  934|  27.2k|    }
  935|  9.04k|    if (entry_size == 0) {
  ------------------
  |  Branch (935:9): [True: 3, False: 9.04k]
  ------------------
  936|      3|        throw damaged("Cross-reference stream's /W indicates entry size of 0");
  937|      3|    }
  938|  9.04k|    return {entry_size, W};
  939|  9.04k|}
_ZN4QPDF3Doc7Objects15processXRefSizeER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  945|  9.04k|{
  946|       |    // Number of entries is limited by the highest possible object id and stream size.
  947|  9.04k|    auto max_num_entries = std::numeric_limits<int>::max();
  948|  9.04k|    if (max_num_entries > (std::numeric_limits<qpdf_offset_t>::max() / entry_size)) {
  ------------------
  |  Branch (948:9): [True: 0, False: 9.04k]
  ------------------
  949|      0|        max_num_entries = toI(std::numeric_limits<qpdf_offset_t>::max() / entry_size);
  950|      0|    }
  951|       |
  952|  9.04k|    auto Size_obj = dict.getKey("/Size");
  953|  9.04k|    long long size;
  954|  9.04k|    if (!dict.getKey("/Size").getValueAsInt(size)) {
  ------------------
  |  Branch (954:9): [True: 45, False: 8.99k]
  ------------------
  955|     45|        throw damaged("Cross-reference stream does not have a proper /Size key");
  956|  8.99k|    } else if (size < 0) {
  ------------------
  |  Branch (956:16): [True: 68, False: 8.92k]
  ------------------
  957|     68|        throw damaged("Cross-reference stream has a negative /Size key");
  958|  8.92k|    } else if (size >= max_num_entries) {
  ------------------
  |  Branch (958:16): [True: 89, False: 8.83k]
  ------------------
  959|     89|        throw damaged("Cross-reference stream has an impossibly large /Size key");
  960|     89|    }
  961|       |    // We are not validating that Size <= (Size key of parent xref / trailer).
  962|  8.83k|    return max_num_entries;
  963|  9.04k|}
_ZN4QPDF3Doc7Objects16processXRefIndexER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  969|  8.83k|{
  970|  8.83k|    auto size = dict.getKey("/Size").getIntValueAsInt();
  971|  8.83k|    auto Index_obj = dict.getKey("/Index");
  972|       |
  973|  8.83k|    if (Index_obj.isArray()) {
  ------------------
  |  Branch (973:9): [True: 1.30k, False: 7.53k]
  ------------------
  974|  1.30k|        std::vector<std::pair<int, int>> indx;
  975|  1.30k|        int num_entries = 0;
  976|  1.30k|        auto index_vec = Index_obj.getArrayAsVector();
  977|  1.30k|        if ((index_vec.size() % 2) || index_vec.size() < 2) {
  ------------------
  |  Branch (977:13): [True: 9, False: 1.29k]
  |  Branch (977:39): [True: 7, False: 1.28k]
  ------------------
  978|     16|            throw damaged("Cross-reference stream's /Index has an invalid number of values");
  979|     16|        }
  980|       |
  981|  1.28k|        int i = 0;
  982|  1.28k|        long long first = 0;
  983|  54.0k|        for (auto& val: index_vec) {
  ------------------
  |  Branch (983:23): [True: 54.0k, False: 988]
  ------------------
  984|  54.0k|            if (val.isInteger()) {
  ------------------
  |  Branch (984:17): [True: 54.0k, False: 32]
  ------------------
  985|  54.0k|                if (i % 2) {
  ------------------
  |  Branch (985:21): [True: 26.9k, False: 27.0k]
  ------------------
  986|  26.9k|                    auto count = val.getIntValue();
  987|  26.9k|                    if (count <= 0) {
  ------------------
  |  Branch (987:25): [True: 75, False: 26.8k]
  ------------------
  988|     75|                        throw damaged(
  989|     75|                            "Cross-reference stream section claims to contain " +
  990|     75|                            std::to_string(count) + " entries");
  991|     75|                    }
  992|       |                    // We are guarding against the possibility of num_entries * entry_size
  993|       |                    // overflowing. We are not checking that entries are in ascending order as
  994|       |                    // required by the spec, which probably should generate a warning. We are also
  995|       |                    // not checking that for each subsection first object number + number of entries
  996|       |                    // <= /Size. The spec requires us to ignore object number > /Size.
  997|  26.8k|                    if (first > (max_num_entries - count) ||
  ------------------
  |  Branch (997:25): [True: 72, False: 26.8k]
  ------------------
  998|  26.8k|                        count > (max_num_entries - num_entries)) {
  ------------------
  |  Branch (998:25): [True: 4, False: 26.8k]
  ------------------
  999|     76|                        throw damaged(
 1000|     76|                            "Cross-reference stream claims to contain too many entries: " +
 1001|     76|                            std::to_string(first) + " " + std::to_string(max_num_entries) + " " +
 1002|     76|                            std::to_string(num_entries));
 1003|     76|                    }
 1004|  26.8k|                    indx.emplace_back(static_cast<int>(first), static_cast<int>(count));
 1005|  26.8k|                    num_entries += static_cast<int>(count);
 1006|  27.0k|                } else {
 1007|  27.0k|                    first = val.getIntValue();
 1008|  27.0k|                    if (first < 0) {
  ------------------
  |  Branch (1008:25): [True: 42, False: 27.0k]
  ------------------
 1009|     42|                        throw damaged(
 1010|     42|                            "Cross-reference stream's /Index contains a negative object id");
 1011|  27.0k|                    } else if (first > max_num_entries) {
  ------------------
  |  Branch (1011:32): [True: 76, False: 26.9k]
  ------------------
 1012|     76|                        throw damaged(
 1013|     76|                            "Cross-reference stream's /Index contains an impossibly "
 1014|     76|                            "large object id");
 1015|     76|                    }
 1016|  27.0k|                }
 1017|  54.0k|            } else {
 1018|     32|                throw damaged(
 1019|     32|                    "Cross-reference stream's /Index's item " + std::to_string(i) +
 1020|     32|                    " is not an integer");
 1021|     32|            }
 1022|  53.7k|            i++;
 1023|  53.7k|        }
 1024|    988|        QTC::TC("qpdf", "QPDF xref /Index is array", index_vec.size() == 2 ? 0 : 1);
  ------------------
  |  Branch (1024:54): [True: 637, False: 351]
  ------------------
 1025|    988|        return {num_entries, indx};
 1026|  7.53k|    } else if (Index_obj.null()) {
  ------------------
  |  Branch (1026:16): [True: 7.52k, False: 4]
  ------------------
 1027|  7.52k|        return {size, {{0, size}}};
 1028|  7.52k|    } else {
 1029|      4|        throw damaged("Cross-reference stream does not have a proper /Index key");
 1030|      4|    }
 1031|  8.83k|}
_ZN4QPDF3Doc7Objects17processXRefStreamExR16QPDFObjectHandleb:
 1036|  9.52k|{
 1037|  9.52k|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1038|  9.52k|        return damagedPDF("xref stream", xref_offset, msg.data());
 1039|  9.52k|    };
 1040|       |
 1041|  9.52k|    auto dict = xref_obj.getDict();
 1042|       |
 1043|  9.52k|    auto [entry_size, W] = processXRefW(dict, damaged);
 1044|  9.52k|    int max_num_entries = processXRefSize(dict, entry_size, damaged);
 1045|  9.52k|    auto [num_entries, indx] = processXRefIndex(dict, max_num_entries, damaged);
 1046|       |
 1047|  9.52k|    std::shared_ptr<Buffer> bp = xref_obj.getStreamData(qpdf_dl_specialized);
 1048|  9.52k|    size_t actual_size = bp->getSize();
 1049|  9.52k|    auto expected_size = toS(entry_size) * toS(num_entries);
 1050|       |
 1051|  9.52k|    if (expected_size != actual_size) {
  ------------------
  |  Branch (1051:9): [True: 4.91k, False: 4.61k]
  ------------------
 1052|  4.91k|        QPDFExc x = damaged(
 1053|  4.91k|            "Cross-reference stream data has the wrong size; expected = " +
 1054|  4.91k|            std::to_string(expected_size) + "; actual = " + std::to_string(actual_size));
 1055|  4.91k|        if (expected_size > actual_size) {
  ------------------
  |  Branch (1055:13): [True: 1.00k, False: 3.90k]
  ------------------
 1056|  1.00k|            throw x;
 1057|  3.90k|        } else {
 1058|  3.90k|            warn(x);
 1059|  3.90k|        }
 1060|  4.91k|    }
 1061|       |
 1062|  8.52k|    bool saw_first_compressed_object = false;
 1063|       |
 1064|       |    // Actual size vs. expected size check above ensures that we will not overflow any buffers here.
 1065|       |    // We know that entry_size * num_entries is less or equal to the size of the buffer.
 1066|  8.52k|    auto p = bp->getBuffer();
 1067|  8.52k|    for (auto [obj, sec_entries]: indx) {
  ------------------
  |  Branch (1067:33): [True: 7.98k, False: 8.52k]
  ------------------
 1068|       |        // Process a subsection.
 1069|  2.04M|        for (int i = 0; i < sec_entries; ++i) {
  ------------------
  |  Branch (1069:25): [True: 2.04M, False: 7.98k]
  ------------------
 1070|       |            // Read this entry
 1071|  2.04M|            std::array<qpdf_offset_t, 3> fields{};
 1072|  2.04M|            if (W[0] == 0) {
  ------------------
  |  Branch (1072:17): [True: 331k, False: 1.70M]
  ------------------
 1073|   331k|                fields[0] = 1;
 1074|   331k|            }
 1075|  8.16M|            for (size_t j = 0; j < 3; ++j) {
  ------------------
  |  Branch (1075:32): [True: 6.12M, False: 2.04M]
  ------------------
 1076|  13.8M|                for (int k = 0; k < W[j]; ++k) {
  ------------------
  |  Branch (1076:33): [True: 7.72M, False: 6.12M]
  ------------------
 1077|  7.72M|                    fields[j] <<= 8;
 1078|  7.72M|                    fields[j] |= *p++;
 1079|  7.72M|                }
 1080|  6.12M|            }
 1081|       |
 1082|       |            // Get the generation number.  The generation number is 0 unless this is an uncompressed
 1083|       |            // object record, in which case the generation number appears as the third field.
 1084|  2.04M|            if (saw_first_compressed_object) {
  ------------------
  |  Branch (1084:17): [True: 1.36M, False: 675k]
  ------------------
 1085|  1.36M|                if (fields[0] != 2) {
  ------------------
  |  Branch (1085:21): [True: 892k, False: 472k]
  ------------------
 1086|   892k|                    uncompressed_after_compressed_ = true;
 1087|   892k|                }
 1088|  1.36M|            } else if (fields[0] == 2) {
  ------------------
  |  Branch (1088:24): [True: 2.73k, False: 672k]
  ------------------
 1089|  2.73k|                saw_first_compressed_object = true;
 1090|  2.73k|            }
 1091|  2.04M|            if (obj == 0) {
  ------------------
  |  Branch (1091:17): [True: 4.41k, False: 2.03M]
  ------------------
 1092|       |                // This is needed by checkLinearization()
 1093|  4.41k|                first_xref_item_offset_ = xref_offset;
 1094|  2.03M|            } else if (fields[0] == 0) {
  ------------------
  |  Branch (1094:24): [True: 559k, False: 1.47M]
  ------------------
 1095|       |                // Ignore fields[2], which we don't care about in this case. This works around the
 1096|       |                // issue of some PDF files that put invalid values, like -1, here for deleted
 1097|       |                // objects.
 1098|   559k|                insertFreeXrefEntry(QPDFObjGen(obj, 0));
 1099|  1.47M|            } else {
 1100|  1.47M|                auto typ = toI(fields[0]);
 1101|  1.47M|                if (!in_stream_recovery || typ == 2) {
  ------------------
  |  Branch (1101:21): [True: 685k, False: 791k]
  |  Branch (1101:44): [True: 378k, False: 413k]
  ------------------
 1102|       |                    // If we are in xref stream recovery all actual uncompressed objects have
 1103|       |                    // already been inserted into the xref table. Avoid adding junk data into the
 1104|       |                    // xref table.
 1105|  1.06M|                    insertXrefEntry(obj, toI(fields[0]), fields[1], toI(fields[2]));
 1106|  1.06M|                }
 1107|  1.47M|            }
 1108|  2.04M|            ++obj;
 1109|  2.04M|        }
 1110|  7.98k|    }
 1111|       |
 1112|  8.52k|    if (!m->trailer) {
  ------------------
  |  Branch (1112:9): [True: 918, False: 7.60k]
  ------------------
 1113|    918|        setTrailer(dict);
 1114|    918|    }
 1115|       |
 1116|  8.52k|    if (dict.hasKey("/Prev")) {
  ------------------
  |  Branch (1116:9): [True: 1.33k, False: 7.18k]
  ------------------
 1117|  1.33k|        if (!dict.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (1117:13): [True: 32, False: 1.30k]
  ------------------
 1118|     32|            throw damagedPDF(
 1119|     32|                "xref stream", "/Prev key in xref stream dictionary is not an integer");
 1120|     32|        }
 1121|  1.30k|        return dict.getKey("/Prev").getIntValue();
 1122|  7.18k|    } else {
 1123|  7.18k|        return 0;
 1124|  7.18k|    }
 1125|  8.52k|}
_ZN4QPDF3Doc7Objects15insertXrefEntryEiixi:
 1129|  1.18M|{
 1130|       |    // Populate the xref table in such a way that the first reference to an object that we see,
 1131|       |    // which is the one in the latest xref table in which it appears, is the one that gets stored.
 1132|       |    // This works because we are reading more recent appends before older ones.
 1133|       |
 1134|       |    // If there is already an entry for this object and generation in the table, it means that a
 1135|       |    // later xref table has registered this object.  Disregard this one.
 1136|  1.18M|    int new_gen = f0 == 2 ? 0 : f2;
  ------------------
  |  Branch (1136:19): [True: 475k, False: 714k]
  ------------------
 1137|       |
 1138|  1.18M|    if (!(f0 == 1 || f0 == 2)) {
  ------------------
  |  Branch (1138:11): [True: 553k, False: 635k]
  |  Branch (1138:22): [True: 475k, False: 160k]
  ------------------
 1139|   160k|        return;
 1140|   160k|    }
 1141|       |
 1142|  1.02M|    if (!(obj > 0 && obj <= m->xref_table_max_id && 0 <= f2 && new_gen < 65535)) {
  ------------------
  |  Branch (1142:11): [True: 1.02M, False: 637]
  |  Branch (1142:22): [True: 679k, False: 348k]
  |  Branch (1142:53): [True: 679k, False: 70]
  |  Branch (1142:64): [True: 676k, False: 3.64k]
  ------------------
 1143|       |        // We are ignoring invalid objgens. Most will arrive here from xref reconstruction. There
 1144|       |        // is probably no point having another warning but we could count invalid items in order to
 1145|       |        // decide when to give up.
 1146|       |        // ignore impossibly large object ids or object ids > Size.
 1147|   352k|        return;
 1148|   352k|    }
 1149|       |
 1150|   676k|    if (m->deleted_objects.contains(obj)) {
  ------------------
  |  Branch (1150:9): [True: 3.61k, False: 672k]
  ------------------
 1151|  3.61k|        return;
 1152|  3.61k|    }
 1153|       |
 1154|   672k|    if (f0 == 2) {
  ------------------
  |  Branch (1154:9): [True: 359k, False: 313k]
  ------------------
 1155|   359k|        if (f1 == obj) {
  ------------------
  |  Branch (1155:13): [True: 600, False: 358k]
  ------------------
 1156|    600|            warn(
 1157|    600|                damagedPDF("xref stream", "self-referential object stream " + std::to_string(obj)));
 1158|    600|            return;
 1159|    600|        }
 1160|   358k|        if (f1 > m->xref_table_max_id) {
  ------------------
  |  Branch (1160:13): [True: 5.36k, False: 353k]
  ------------------
 1161|       |            // ignore impossibly large object stream ids
 1162|  5.36k|            warn(damagedPDF(
 1163|  5.36k|                "xref stream",
 1164|  5.36k|                "object stream id " + std::to_string(f1) + " for object " + std::to_string(obj) +
 1165|  5.36k|                    " is impossibly large"));
 1166|  5.36k|            return;
 1167|  5.36k|        }
 1168|   358k|    }
 1169|       |
 1170|   666k|    auto [iter, created] = m->xref_table.try_emplace(QPDFObjGen(obj, (f0 == 2 ? 0 : f2)));
  ------------------
  |  Branch (1170:71): [True: 353k, False: 313k]
  ------------------
 1171|   666k|    if (!created) {
  ------------------
  |  Branch (1171:9): [True: 78.3k, False: 588k]
  ------------------
 1172|  78.3k|        return;
 1173|  78.3k|    }
 1174|       |
 1175|   588k|    switch (f0) {
 1176|   247k|    case 1:
  ------------------
  |  Branch (1176:5): [True: 247k, False: 340k]
  ------------------
 1177|       |        // f2 is generation
 1178|   247k|        QTC::TC("qpdf", "QPDF xref gen > 0", ((f2 > 0) ? 1 : 0));
  ------------------
  |  Branch (1178:47): [True: 150k, False: 96.8k]
  ------------------
 1179|   247k|        iter->second = QPDFXRefEntry(f1);
 1180|   247k|        break;
 1181|       |
 1182|   340k|    case 2:
  ------------------
  |  Branch (1182:5): [True: 340k, False: 247k]
  ------------------
 1183|   340k|        iter->second = QPDFXRefEntry(toI(f1), f2);
 1184|   340k|        break;
 1185|       |
 1186|      0|    default:
  ------------------
  |  Branch (1186:5): [True: 0, False: 588k]
  ------------------
 1187|      0|        throw damagedPDF("xref stream", "unknown xref stream entry type " + std::to_string(f0));
 1188|      0|        break;
 1189|   588k|    }
 1190|   588k|}
_ZN4QPDF3Doc7Objects19insertFreeXrefEntryE10QPDFObjGen:
 1194|   563k|{
 1195|   563k|    if (!m->xref_table.contains(og) && og.getObj() <= m->xref_table_max_id) {
  ------------------
  |  Branch (1195:9): [True: 558k, False: 5.08k]
  |  Branch (1195:40): [True: 161k, False: 397k]
  ------------------
 1196|   161k|        m->deleted_objects.insert(og.getObj());
 1197|   161k|    }
 1198|   563k|}
_ZN4QPDF3Doc7Objects16resolveXRefTableEv:
 1230|  1.59k|{
 1231|  1.59k|    bool may_change = !m->reconstructed_xref;
 1232|   151k|    for (auto& iter: m->xref_table) {
  ------------------
  |  Branch (1232:20): [True: 151k, False: 1.50k]
  ------------------
 1233|   151k|        if (isUnresolved(iter.first)) {
  ------------------
  |  Branch (1233:13): [True: 132k, False: 18.2k]
  ------------------
 1234|   132k|            resolve(iter.first);
 1235|   132k|            if (may_change && m->reconstructed_xref) {
  ------------------
  |  Branch (1235:17): [True: 1.68k, False: 131k]
  |  Branch (1235:31): [True: 92, False: 1.59k]
  ------------------
 1236|     92|                return false;
 1237|     92|            }
 1238|   132k|        }
 1239|   151k|    }
 1240|  1.50k|    return true;
 1241|  1.59k|}
_ZN4QPDF21fixDanglingReferencesEb:
 1247|  6.90k|{
 1248|  6.90k|    if (m->fixed_dangling_refs) {
  ------------------
  |  Branch (1248:9): [True: 5.39k, False: 1.50k]
  ------------------
 1249|  5.39k|        return;
 1250|  5.39k|    }
 1251|  1.50k|    if (!m->objects.resolveXRefTable()) {
  ------------------
  |  Branch (1251:9): [True: 92, False: 1.41k]
  ------------------
 1252|     92|        m->objects.resolveXRefTable();
 1253|     92|    }
 1254|  1.50k|    m->fixed_dangling_refs = true;
 1255|  1.50k|}
_ZN4QPDF14getObjectCountEv:
 1259|  6.90k|{
 1260|       |    // This method returns the next available indirect object number. makeIndirectObject uses it for
 1261|       |    // this purpose. After fixDanglingReferences is called, all objects in the xref table will also
 1262|       |    // be in obj_cache.
 1263|  6.90k|    fixDanglingReferences();
 1264|  6.90k|    QPDFObjGen og;
 1265|  6.90k|    if (!m->obj_cache.empty()) {
  ------------------
  |  Branch (1265:9): [True: 6.85k, False: 48]
  ------------------
 1266|  6.85k|        og = (*(m->obj_cache.rbegin())).first;
 1267|  6.85k|    }
 1268|  6.90k|    return QIntC::to_size(og.getObj());
 1269|  6.90k|}
_ZN4QPDF3Doc7Objects24setLastObjectDescriptionERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1285|   168k|{
 1286|   168k|    m->last_object_description.clear();
 1287|   168k|    if (!description.empty()) {
  ------------------
  |  Branch (1287:9): [True: 9.85k, False: 158k]
  ------------------
 1288|  9.85k|        m->last_object_description += description;
 1289|  9.85k|        if (og.isIndirect()) {
  ------------------
  |  Branch (1289:13): [True: 9.85k, False: 0]
  ------------------
 1290|  9.85k|            m->last_object_description += ": ";
 1291|  9.85k|        }
 1292|  9.85k|    }
 1293|   168k|    if (og.isIndirect()) {
  ------------------
  |  Branch (1293:9): [True: 168k, False: 0]
  ------------------
 1294|   168k|        m->last_object_description += "object " + og.unparse(' ');
 1295|   168k|    }
 1296|   168k|}
_ZN4QPDF3Doc7Objects11readTrailerEv:
 1300|  23.7k|{
 1301|  23.7k|    qpdf_offset_t offset = m->file->tell();
 1302|  23.7k|    auto object =
 1303|  23.7k|        Parser::parse(*m->file, "trailer", m->tokenizer, nullptr, qpdf, m->reconstructed_xref);
 1304|  23.7k|    if (object.isDictionary() && m->objects.readToken(*m->file).isWord("stream")) {
  ------------------
  |  Branch (1304:9): [True: 4.12k, False: 19.6k]
  |  Branch (1304:9): [True: 107, False: 23.6k]
  |  Branch (1304:34): [True: 107, False: 4.01k]
  ------------------
 1305|    107|        warn(damagedPDF("trailer", m->file->tell(), "stream keyword found in trailer"));
 1306|    107|    }
 1307|       |    // Override last_offset so that it points to the beginning of the object we just read
 1308|  23.7k|    m->file->setLastOffset(offset);
 1309|  23.7k|    return object;
 1310|  23.7k|}
_ZN4QPDF3Doc7Objects10readObjectERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1314|  85.8k|{
 1315|  85.8k|    setLastObjectDescription(description, og);
 1316|  85.8k|    qpdf_offset_t offset = m->file->tell();
 1317|       |
 1318|  85.8k|    StringDecrypter decrypter{&qpdf, og};
 1319|  85.8k|    StringDecrypter* decrypter_ptr = m->encp->encrypted ? &decrypter : nullptr;
  ------------------
  |  Branch (1319:38): [True: 3.92k, False: 81.8k]
  ------------------
 1320|  85.8k|    auto object = Parser::parse(
 1321|  85.8k|        *m->file,
 1322|  85.8k|        m->last_object_description,
 1323|  85.8k|        m->tokenizer,
 1324|  85.8k|        decrypter_ptr,
 1325|  85.8k|        qpdf,
 1326|  85.8k|        m->reconstructed_xref || m->in_read_xref_stream);
  ------------------
  |  Branch (1326:9): [True: 80.2k, False: 5.53k]
  |  Branch (1326:34): [True: 2.43k, False: 3.09k]
  ------------------
 1327|  85.8k|    if (!object) {
  ------------------
  |  Branch (1327:9): [True: 6.27k, False: 79.5k]
  ------------------
 1328|  6.27k|        return {};
 1329|  6.27k|    }
 1330|  79.5k|    auto token = readToken(*m->file);
 1331|  79.5k|    if (object.isDictionary() && token.isWord("stream")) {
  ------------------
  |  Branch (1331:9): [True: 66.9k, False: 12.6k]
  |  Branch (1331:9): [True: 38.5k, False: 41.0k]
  |  Branch (1331:34): [True: 38.5k, False: 28.3k]
  ------------------
 1332|  38.5k|        readStream(object, og, offset);
 1333|  38.5k|        token = readToken(*m->file);
 1334|  38.5k|    }
 1335|  79.5k|    if (!token.isWord("endobj")) {
  ------------------
  |  Branch (1335:9): [True: 26.6k, False: 52.9k]
  ------------------
 1336|  26.6k|        warn(damagedPDF("expected endobj"));
 1337|  26.6k|    }
 1338|  79.5k|    return object;
 1339|  85.8k|}
_ZN4QPDF3Doc7Objects10readStreamER16QPDFObjectHandle10QPDFObjGenx:
 1344|  38.5k|{
 1345|  38.5k|    validateStreamLineEnd(object, og, offset);
 1346|       |
 1347|       |    // Must get offset before accessing any additional objects since resolving a previously
 1348|       |    // unresolved indirect object will change file position.
 1349|  38.5k|    qpdf_offset_t stream_offset = m->file->tell();
 1350|  38.5k|    size_t length = 0;
 1351|       |
 1352|  38.5k|    try {
 1353|  38.5k|        auto length_obj = object.getKey("/Length");
 1354|       |
 1355|  38.5k|        if (!length_obj.isInteger()) {
  ------------------
  |  Branch (1355:13): [True: 18.2k, False: 20.2k]
  ------------------
 1356|  18.2k|            if (length_obj.null()) {
  ------------------
  |  Branch (1356:17): [True: 18.0k, False: 214]
  ------------------
 1357|  18.0k|                throw damagedPDF(offset, "stream dictionary lacks /Length key");
 1358|  18.0k|            }
 1359|    214|            throw damagedPDF(offset, "/Length key in stream dictionary is not an integer");
 1360|  18.2k|        }
 1361|       |
 1362|  20.2k|        length = toS(length_obj.getUIntValue());
 1363|       |        // Seek in two steps to avoid potential integer overflow
 1364|  20.2k|        m->file->seek(stream_offset, SEEK_SET);
 1365|  20.2k|        m->file->seek(toO(length), SEEK_CUR);
 1366|  20.2k|        if (!readToken(*m->file).isWord("endstream")) {
  ------------------
  |  Branch (1366:13): [True: 4.45k, False: 15.7k]
  ------------------
 1367|  4.45k|            throw damagedPDF("expected endstream");
 1368|  4.45k|        }
 1369|  30.5k|    } catch (QPDFExc& e) {
 1370|  30.5k|        if (!cf.surpress_recovery()) {
  ------------------
  |  Branch (1370:13): [True: 30.5k, False: 0]
  ------------------
 1371|  30.5k|            warn(e);
 1372|  30.5k|            length = recoverStreamLength(m->file, og, stream_offset);
 1373|  30.5k|        } else {
 1374|      0|            throw;
 1375|      0|        }
 1376|  30.5k|    }
 1377|  30.5k|    object = QPDFObjectHandle(qpdf::Stream(qpdf, og, object, stream_offset, length));
 1378|  28.9k|}
_ZN4QPDF3Doc7Objects21validateStreamLineEndER16QPDFObjectHandle10QPDFObjGenx:
 1382|  38.5k|{
 1383|       |    // The PDF specification states that the word "stream" should be followed by either a carriage
 1384|       |    // return and a newline or by a newline alone.  It specifically disallowed following it by a
 1385|       |    // carriage return alone since, in that case, there would be no way to tell whether the NL in a
 1386|       |    // CR NL sequence was part of the stream data.  However, some readers, including Adobe reader,
 1387|       |    // accept a carriage return by itself when followed by a non-newline character, so that's what
 1388|       |    // we do here. We have also seen files that have extraneous whitespace between the stream
 1389|       |    // keyword and the newline.
 1390|  61.5k|    while (true) {
  ------------------
  |  Branch (1390:12): [True: 61.4k, Folded]
  ------------------
 1391|  61.4k|        char ch;
 1392|  61.4k|        if (m->file->read(&ch, 1) == 0) {
  ------------------
  |  Branch (1392:13): [True: 321, False: 61.1k]
  ------------------
 1393|       |            // A premature EOF here will result in some other problem that will get reported at
 1394|       |            // another time.
 1395|    321|            return;
 1396|    321|        }
 1397|  61.1k|        if (ch == '\n') {
  ------------------
  |  Branch (1397:13): [True: 16.6k, False: 44.4k]
  ------------------
 1398|       |            // ready to read stream data
 1399|  16.6k|            return;
 1400|  16.6k|        }
 1401|  44.4k|        if (ch == '\r') {
  ------------------
  |  Branch (1401:13): [True: 13.9k, False: 30.5k]
  ------------------
 1402|       |            // Read another character
 1403|  13.9k|            if (m->file->read(&ch, 1) != 0) {
  ------------------
  |  Branch (1403:17): [True: 13.9k, False: 35]
  ------------------
 1404|  13.9k|                if (ch == '\n') {
  ------------------
  |  Branch (1404:21): [True: 11.5k, False: 2.35k]
  ------------------
 1405|       |                    // Ready to read stream data
 1406|  11.5k|                    QTC::TC("qpdf", "QPDF stream with CRNL");
 1407|  11.5k|                } else {
 1408|       |                    // Treat the \r by itself as the whitespace after endstream and start reading
 1409|       |                    // stream data in spite of not having seen a newline.
 1410|  2.35k|                    m->file->unreadCh(ch);
 1411|  2.35k|                    warn(damagedPDF(
 1412|  2.35k|                        m->file->tell(), "stream keyword followed by carriage return only"));
 1413|  2.35k|                }
 1414|  13.9k|            }
 1415|  13.9k|            return;
 1416|  13.9k|        }
 1417|  30.5k|        if (!util::is_space(ch)) {
  ------------------
  |  Branch (1417:13): [True: 7.51k, False: 23.0k]
  ------------------
 1418|  7.51k|            m->file->unreadCh(ch);
 1419|  7.51k|            warn(damagedPDF(
 1420|  7.51k|                m->file->tell(), "stream keyword not followed by proper line terminator"));
 1421|  7.51k|            return;
 1422|  7.51k|        }
 1423|  23.0k|        warn(damagedPDF(m->file->tell(), "stream keyword followed by extraneous whitespace"));
 1424|  23.0k|    }
 1425|  38.5k|}
_ZN4QPDF3Doc7Objects13findEndstreamEv:
 1429|  26.0k|{
 1430|       |    // Find endstream or endobj. Position the input at that token.
 1431|  26.0k|    auto t = readToken(*m->file, 20);
 1432|  26.0k|    if (t.isWord("endobj") || t.isWord("endstream")) {
  ------------------
  |  Branch (1432:9): [True: 14.2k, False: 11.7k]
  |  Branch (1432:9): [True: 20.2k, False: 5.72k]
  |  Branch (1432:31): [True: 6.01k, False: 5.72k]
  ------------------
 1433|  20.2k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1434|  20.2k|        return true;
 1435|  20.2k|    }
 1436|  5.72k|    return false;
 1437|  26.0k|}
_ZN4QPDF3Doc7Objects19recoverStreamLengthENSt3__110shared_ptrI11InputSourceEE10QPDFObjGenx:
 1442|  21.2k|{
 1443|       |    // Try to reconstruct stream length by looking for endstream or endobj
 1444|  21.2k|    warn(damagedPDF(*input, stream_offset, "attempting to recover stream length"));
 1445|       |
 1446|  21.2k|    PatternFinder ef(*this, &Objects::findEndstream);
 1447|  21.2k|    size_t length = 0;
 1448|  21.2k|    if (m->file->findFirst("end", stream_offset, 0, ef)) {
  ------------------
  |  Branch (1448:9): [True: 20.2k, False: 963]
  ------------------
 1449|  20.2k|        length = toS(m->file->tell() - stream_offset);
 1450|       |        // Reread endstream but, if it was endobj, don't skip that.
 1451|  20.2k|        QPDFTokenizer::Token t = readToken(*m->file);
 1452|  20.2k|        if (t.getValue() == "endobj") {
  ------------------
  |  Branch (1452:13): [True: 14.2k, False: 6.01k]
  ------------------
 1453|  14.2k|            m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1454|  14.2k|        }
 1455|  20.2k|    }
 1456|       |
 1457|  21.2k|    if (length) {
  ------------------
  |  Branch (1457:9): [True: 19.1k, False: 2.05k]
  ------------------
 1458|  19.1k|        auto end = stream_offset + toO(length);
 1459|  19.1k|        qpdf_offset_t found_offset = 0;
 1460|  19.1k|        QPDFObjGen found_og;
 1461|       |
 1462|       |        // Make sure this is inside this object
 1463|   403k|        for (auto const& [current_og, entry]: m->xref_table) {
  ------------------
  |  Branch (1463:45): [True: 403k, False: 19.1k]
  ------------------
 1464|   403k|            if (entry.getType() == 1) {
  ------------------
  |  Branch (1464:17): [True: 331k, False: 71.7k]
  ------------------
 1465|   331k|                qpdf_offset_t obj_offset = entry.getOffset();
 1466|   331k|                if (found_offset < obj_offset && obj_offset < end) {
  ------------------
  |  Branch (1466:21): [True: 246k, False: 85.2k]
  |  Branch (1466:50): [True: 75.4k, False: 171k]
  ------------------
 1467|  75.4k|                    found_offset = obj_offset;
 1468|  75.4k|                    found_og = current_og;
 1469|  75.4k|                }
 1470|   331k|            }
 1471|   403k|        }
 1472|  19.1k|        if (!found_offset || found_og == og) {
  ------------------
  |  Branch (1472:13): [True: 2.08k, False: 17.0k]
  |  Branch (1472:30): [True: 15.2k, False: 1.79k]
  ------------------
 1473|       |            // If we are trying to recover an XRef stream the xref table will not contain and
 1474|       |            // won't contain any entries, therefore we cannot check the found length. Otherwise we
 1475|       |            // found endstream\nendobj within the space allowed for this object, so we're probably
 1476|       |            // in good shape.
 1477|  17.3k|        } else {
 1478|  1.79k|            length = 0;
 1479|  1.79k|        }
 1480|  19.1k|    }
 1481|       |
 1482|  21.2k|    if (length == 0) {
  ------------------
  |  Branch (1482:9): [True: 3.84k, False: 17.3k]
  ------------------
 1483|  3.84k|        warn(damagedPDF(
 1484|  3.84k|            *input, stream_offset, "unable to recover stream data; treating stream as empty"));
 1485|  17.3k|    } else {
 1486|  17.3k|        warn(damagedPDF(
 1487|  17.3k|            *input, stream_offset, "recovered stream length: " + std::to_string(length)));
 1488|  17.3k|    }
 1489|       |
 1490|  21.2k|    return length;
 1491|  21.2k|}
_ZN4QPDF3Doc7Objects9readTokenER11InputSourcem:
 1495|  2.03M|{
 1496|  2.03M|    return m->tokenizer.readToken(input, m->last_object_description, true, max_len);
 1497|  2.03M|}
_ZN4QPDF3Doc7Objects17read_object_startEx:
 1501|  93.3k|{
 1502|  93.3k|    m->file->seek(offset, SEEK_SET);
 1503|  93.3k|    QPDFTokenizer::Token tobjid = readToken(*m->file);
 1504|  93.3k|    bool objidok = tobjid.isInteger();
 1505|  93.3k|    if (!objidok) {
  ------------------
  |  Branch (1505:9): [True: 3.54k, False: 89.8k]
  ------------------
 1506|  3.54k|        throw damagedPDF(offset, "expected n n obj");
 1507|  3.54k|    }
 1508|  89.8k|    QPDFTokenizer::Token tgen = readToken(*m->file);
 1509|  89.8k|    bool genok = tgen.isInteger();
 1510|  89.8k|    if (!genok) {
  ------------------
  |  Branch (1510:9): [True: 369, False: 89.4k]
  ------------------
 1511|    369|        throw damagedPDF(offset, "expected n n obj");
 1512|    369|    }
 1513|  89.4k|    QPDFTokenizer::Token tobj = readToken(*m->file);
 1514|       |
 1515|  89.4k|    bool objok = tobj.isWord("obj");
 1516|       |
 1517|  89.4k|    if (!objok) {
  ------------------
  |  Branch (1517:9): [True: 914, False: 88.5k]
  ------------------
 1518|    914|        throw damagedPDF(offset, "expected n n obj");
 1519|    914|    }
 1520|  88.5k|    int objid = QUtil::string_to_int(tobjid.getValue().c_str());
 1521|  88.5k|    int generation = QUtil::string_to_int(tgen.getValue().c_str());
 1522|  88.5k|    if (objid <= 0 || objid >= m->xref_table_max_id || generation < 0 || generation >= 65535) {
  ------------------
  |  Branch (1522:9): [True: 1.45k, False: 87.0k]
  |  Branch (1522:23): [True: 377, False: 86.6k]
  |  Branch (1522:56): [True: 122, False: 86.5k]
  |  Branch (1522:74): [True: 53, False: 86.5k]
  ------------------
 1523|    804|        throw damagedPDF(
 1524|    804|            offset,
 1525|    804|            "object " + std::to_string(objid) + " " + std::to_string(generation) +
 1526|    804|                " has an invalid or impossibly large ID or generation");
 1527|    804|    }
 1528|  87.7k|    return {objid, generation};
 1529|  88.5k|}
_ZN4QPDF3Doc7Objects18readObjectAtOffsetEbxRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1534|  82.5k|{
 1535|  82.5k|    QPDFObjGen og;
 1536|  82.5k|    setLastObjectDescription(description, exp_og);
 1537|       |
 1538|  82.5k|    if (cf.surpress_recovery()) {
  ------------------
  |  Branch (1538:9): [True: 0, False: 82.5k]
  ------------------
 1539|      0|        try_recovery = false;
 1540|      0|    }
 1541|       |
 1542|       |    // Special case: if offset is 0, just return null.  Some PDF writers, in particular
 1543|       |    // "Mac OS X 10.7.5 Quartz PDFContext", may store deleted objects in the xref table as
 1544|       |    // "0000000000 00000 n", which is not correct, but it won't hurt anything for us to ignore
 1545|       |    // these.
 1546|  82.5k|    if (offset == 0) {
  ------------------
  |  Branch (1546:9): [True: 307, False: 82.2k]
  ------------------
 1547|    307|        warn(damagedPDF(
 1548|    307|            -1,
 1549|    307|            "object has offset 0 - a common error handled correctly by qpdf and most other "
 1550|    307|            "applications"));
 1551|    307|        return;
 1552|    307|    }
 1553|       |
 1554|  82.2k|    try {
 1555|  82.2k|        og = read_object_start(offset);
 1556|  82.2k|        if (exp_og != og) {
  ------------------
  |  Branch (1556:13): [True: 709, False: 81.5k]
  ------------------
 1557|    709|            QPDFExc e = damagedPDF(offset, "expected " + exp_og.unparse(' ') + " obj");
 1558|    709|            if (try_recovery) {
  ------------------
  |  Branch (1558:17): [True: 709, False: 0]
  ------------------
 1559|       |                // Will be retried below
 1560|    709|                throw e;
 1561|    709|            } else {
 1562|       |                // We can try reading the object anyway even if the ID doesn't match.
 1563|      0|                warn(e);
 1564|      0|            }
 1565|    709|        }
 1566|  82.2k|    } catch (QPDFExc& e) {
 1567|  5.17k|        if (!try_recovery) {
  ------------------
  |  Branch (1567:13): [True: 0, False: 5.17k]
  ------------------
 1568|      0|            throw;
 1569|      0|        }
 1570|       |        // Try again after reconstructing xref table
 1571|  5.17k|        reconstruct_xref(e);
 1572|  5.17k|        if (m->xref_table.contains(exp_og) && m->xref_table[exp_og].getType() == 1) {
  ------------------
  |  Branch (1572:13): [True: 156, False: 5.01k]
  |  Branch (1572:47): [True: 156, False: 0]
  ------------------
 1573|    156|            qpdf_offset_t new_offset = m->xref_table[exp_og].getOffset();
 1574|    156|            readObjectAtOffset(false, new_offset, description, exp_og);
 1575|    156|            return;
 1576|    156|        }
 1577|  5.01k|        warn(damagedPDF(
 1578|  5.01k|            "",
 1579|  5.01k|            -1,
 1580|  5.01k|            ("object " + exp_og.unparse(' ') +
 1581|  5.01k|             " not found in file after regenerating cross reference table")));
 1582|  5.01k|        return;
 1583|  5.17k|    }
 1584|       |
 1585|  75.9k|    if (auto oh = readObject(description, og)) {
  ------------------
  |  Branch (1585:14): [True: 56.1k, False: 19.8k]
  ------------------
 1586|       |        // Determine the end offset of this object before and after white space.  We use these
 1587|       |        // numbers to validate linearization hint tables.  Offsets and lengths of objects may imply
 1588|       |        // the end of an object to be anywhere between these values.
 1589|  56.1k|        qpdf_offset_t end_before_space = m->file->tell();
 1590|       |
 1591|       |        // skip over spaces
 1592|   120k|        while (true) {
  ------------------
  |  Branch (1592:16): [True: 120k, Folded]
  ------------------
 1593|   120k|            char ch;
 1594|   120k|            if (!m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1594:17): [True: 1.13k, False: 119k]
  ------------------
 1595|  1.13k|                throw damagedPDF(m->file->tell(), "EOF after endobj");
 1596|  1.13k|            }
 1597|   119k|            if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1597:17): [True: 55.0k, False: 64.4k]
  ------------------
 1598|  55.0k|                m->file->seek(-1, SEEK_CUR);
 1599|  55.0k|                break;
 1600|  55.0k|            }
 1601|   119k|        }
 1602|  55.0k|        m->objects.updateCache(og, oh.obj_sp(), end_before_space, m->file->tell());
 1603|  55.0k|    }
 1604|  75.9k|}
_ZN4QPDF3Doc7Objects18readObjectAtOffsetExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb:
 1609|  11.0k|{
 1610|  11.0k|    auto og = read_object_start(offset);
 1611|  11.0k|    auto oh = readObject(description, og);
 1612|       |
 1613|  11.0k|    if (!oh || !m->objects.isUnresolved(og)) {
  ------------------
  |  Branch (1613:9): [True: 1.31k, False: 9.77k]
  |  Branch (1613:16): [True: 7.17k, False: 2.59k]
  ------------------
 1614|  7.23k|        return oh;
 1615|  7.23k|    }
 1616|       |
 1617|  3.85k|    if (skip_cache_if_in_xref && m->xref_table.contains(og)) {
  ------------------
  |  Branch (1617:9): [True: 2.59k, False: 1.25k]
  |  Branch (1617:34): [True: 23, False: 2.57k]
  ------------------
 1618|       |        // In the special case of the xref stream and linearization hint tables, the offset comes
 1619|       |        // from another source. For the specific case of xref streams, the xref stream is read and
 1620|       |        // loaded into the object cache very early in parsing. Ordinarily, when a file is updated by
 1621|       |        // appending, items inserted into the xref table in later updates take precedence over
 1622|       |        // earlier items. In the special case of reusing the object number previously used as the
 1623|       |        // xref stream, we have the following order of events:
 1624|       |        //
 1625|       |        // * reused object gets loaded into the xref table
 1626|       |        // * old object is read here while reading xref streams
 1627|       |        // * original xref entry is ignored (since already in xref table)
 1628|       |        //
 1629|       |        // It is the second step that causes a problem. Even though the xref table is correct in
 1630|       |        // this case, the old object is already in the cache and so effectively prevails over the
 1631|       |        // reused object. To work around this issue, we have a special case for the xref stream (via
 1632|       |        // the skip_cache_if_in_xref): if the object is already in the xref stream, don't cache what
 1633|       |        // we read here.
 1634|       |        //
 1635|       |        // It is likely that the same bug may exist for linearization hint tables, but the existing
 1636|       |        // code uses end_before_space and end_after_space from the cache, so fixing that would
 1637|       |        // require more significant rework. The chances of a linearization hint stream being reused
 1638|       |        // seems smaller because the xref stream is probably the highest object in the file and the
 1639|       |        // linearization hint stream would be some random place in the middle, so I'm leaving that
 1640|       |        // bug unfixed for now. If the bug were to be fixed, we could use !check_og in place of
 1641|       |        // skip_cache_if_in_xref.
 1642|     23|        QTC::TC("qpdf", "QPDF skipping cache for known unchecked object");
 1643|     23|        return oh;
 1644|     23|    }
 1645|       |
 1646|       |    // Determine the end offset of this object before and after white space.  We use these
 1647|       |    // numbers to validate linearization hint tables.  Offsets and lengths of objects may imply
 1648|       |    // the end of an object to be anywhere between these values.
 1649|  3.82k|    qpdf_offset_t end_before_space = m->file->tell();
 1650|       |
 1651|       |    // skip over spaces
 1652|  6.39k|    while (true) {
  ------------------
  |  Branch (1652:12): [True: 5.14k, Folded]
  ------------------
 1653|  5.14k|        char ch;
 1654|  5.14k|        if (!m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1654:13): [True: 138, False: 5.00k]
  ------------------
 1655|    138|            throw damagedPDF(m->file->tell(), "EOF after endobj");
 1656|    138|        }
 1657|  5.00k|        if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1657:13): [True: 2.43k, False: 2.56k]
  ------------------
 1658|  2.43k|            m->file->seek(-1, SEEK_CUR);
 1659|  2.43k|            break;
 1660|  2.43k|        }
 1661|  5.00k|    }
 1662|  3.68k|    m->objects.updateCache(og, oh.obj_sp(), end_before_space, m->file->tell());
 1663|       |
 1664|  3.68k|    return oh;
 1665|  3.82k|}
_ZN4QPDF3Doc7Objects7resolveE10QPDFObjGen:
 1669|   258k|{
 1670|   258k|    if (!isUnresolved(og)) {
  ------------------
  |  Branch (1670:9): [True: 0, False: 258k]
  ------------------
 1671|      0|        return m->obj_cache[og].object;
 1672|      0|    }
 1673|       |
 1674|   258k|    if (m->resolving.contains(og)) {
  ------------------
  |  Branch (1674:9): [True: 308, False: 258k]
  ------------------
 1675|       |        // This can happen if an object references itself directly or indirectly in some key that
 1676|       |        // has to be resolved during object parsing, such as stream length.
 1677|    308|        warn(damagedPDF("", "loop detected resolving object " + og.unparse(' ')));
 1678|    308|        updateCache(og, QPDFObject::create<QPDF_Null>(), -1, -1);
 1679|    308|        return m->obj_cache[og].object;
 1680|    308|    }
 1681|   258k|    ResolveRecorder rr(qpdf, og);
 1682|       |
 1683|   258k|    if (m->xref_table.contains(og)) {
  ------------------
  |  Branch (1683:9): [True: 231k, False: 27.4k]
  ------------------
 1684|   231k|        QPDFXRefEntry const& entry = m->xref_table[og];
 1685|   231k|        try {
 1686|   231k|            switch (entry.getType()) {
 1687|  82.4k|            case 1:
  ------------------
  |  Branch (1687:13): [True: 82.4k, False: 148k]
  ------------------
 1688|       |                // Object stored in cache by readObjectAtOffset
 1689|  82.4k|                readObjectAtOffset(true, entry.getOffset(), "", og);
 1690|  82.4k|                break;
 1691|       |
 1692|   148k|            case 2:
  ------------------
  |  Branch (1692:13): [True: 148k, False: 82.4k]
  ------------------
 1693|   148k|                resolveObjectsInStream(entry.getObjStreamNumber());
 1694|   148k|                break;
 1695|       |
 1696|     12|            default:
  ------------------
  |  Branch (1696:13): [True: 12, False: 231k]
  ------------------
 1697|     12|                throw damagedPDF(
 1698|     12|                    "", -1, ("object " + og.unparse('/') + " has unexpected xref entry type"));
 1699|   231k|            }
 1700|   231k|        } catch (QPDFExc& e) {
 1701|  58.1k|            warn(e);
 1702|  58.1k|        } catch (std::exception& e) {
 1703|  1.26k|            warn(damagedPDF(
 1704|  1.26k|                "", -1, ("object " + og.unparse('/') + ": error reading object: " + e.what())));
 1705|  1.26k|        }
 1706|   231k|    }
 1707|       |
 1708|   240k|    if (isUnresolved(og)) {
  ------------------
  |  Branch (1708:9): [True: 184k, False: 55.6k]
  ------------------
 1709|       |        // PDF spec says unknown objects resolve to the null object.
 1710|   184k|        updateCache(og, QPDFObject::create<QPDF_Null>(), -1, -1);
 1711|   184k|    }
 1712|       |
 1713|   240k|    auto& result(m->obj_cache[og].object);
 1714|   240k|    result->setDefaultDescription(&qpdf, og);
 1715|   240k|    return result;
 1716|   258k|}
_ZN4QPDF3Doc7Objects22resolveObjectsInStreamEi:
 1720|   148k|{
 1721|   148k|    auto damaged =
 1722|   148k|        [this, obj_stream_number](int id, qpdf_offset_t offset, std::string const& msg) -> QPDFExc {
 1723|   148k|        return {
 1724|   148k|            qpdf_e_damaged_pdf,
 1725|   148k|            m->file->getName() + " object stream " + std::to_string(obj_stream_number),
 1726|   148k|            +"object " + std::to_string(id) + " 0",
 1727|   148k|            offset,
 1728|   148k|            msg,
 1729|   148k|            true};
 1730|   148k|    };
 1731|       |
 1732|   148k|    if (m->resolved_object_streams.contains(obj_stream_number)) {
  ------------------
  |  Branch (1732:9): [True: 109k, False: 39.5k]
  ------------------
 1733|   109k|        return;
 1734|   109k|    }
 1735|  39.5k|    m->resolved_object_streams.insert(obj_stream_number);
 1736|       |    // Force resolution of object stream
 1737|  39.5k|    Stream obj_stream = qpdf.getObject(obj_stream_number, 0);
 1738|  39.5k|    if (!obj_stream) {
  ------------------
  |  Branch (1738:9): [True: 34.7k, False: 4.74k]
  ------------------
 1739|  34.7k|        throw damagedPDF(
 1740|  34.7k|            "object " + std::to_string(obj_stream_number) + " 0",
 1741|  34.7k|            "supposed object stream " + std::to_string(obj_stream_number) + " is not a stream");
 1742|  34.7k|    }
 1743|       |
 1744|       |    // For linearization data in the object, use the data from the object stream for the objects in
 1745|       |    // the stream.
 1746|  4.74k|    QPDFObjGen stream_og(obj_stream_number, 0);
 1747|  4.74k|    qpdf_offset_t end_before_space = m->obj_cache[stream_og].end_before_space;
 1748|  4.74k|    qpdf_offset_t end_after_space = m->obj_cache[stream_og].end_after_space;
 1749|       |
 1750|  4.74k|    QPDFObjectHandle dict = obj_stream.getDict();
 1751|  4.74k|    if (!dict.isDictionaryOfType("/ObjStm")) {
  ------------------
  |  Branch (1751:9): [True: 1.99k, False: 2.75k]
  ------------------
 1752|  1.99k|        warn(damagedPDF(
 1753|  1.99k|            "object " + std::to_string(obj_stream_number) + " 0",
 1754|  1.99k|            "supposed object stream " + std::to_string(obj_stream_number) + " has wrong type"));
 1755|  1.99k|    }
 1756|       |
 1757|  4.74k|    unsigned int n{0};
 1758|  4.74k|    int first{0};
 1759|  4.74k|    if (!(dict.getKey("/N").getValueAsUInt(n) && dict.getKey("/First").getValueAsInt(first))) {
  ------------------
  |  Branch (1759:9): [True: 578, False: 4.16k]
  |  Branch (1759:11): [True: 2.54k, False: 2.19k]
  |  Branch (1759:50): [True: 2.48k, False: 55]
  ------------------
 1760|    578|        throw damagedPDF(
 1761|    578|            "object " + std::to_string(obj_stream_number) + " 0",
 1762|    578|            "object stream " + std::to_string(obj_stream_number) + " has incorrect keys");
 1763|    578|    }
 1764|       |
 1765|       |    // id, offset, size
 1766|  4.16k|    std::vector<std::tuple<int, qpdf_offset_t, size_t>> offsets;
 1767|       |
 1768|  4.16k|    auto stream_data = obj_stream.getStreamData(qpdf_dl_specialized);
 1769|       |
 1770|  4.16k|    is::OffsetBuffer input("", stream_data);
 1771|       |
 1772|  4.16k|    const auto b_size = stream_data.size();
 1773|  4.16k|    const auto end_offset = static_cast<qpdf_offset_t>(b_size);
 1774|  4.16k|    auto b_start = stream_data.data();
 1775|       |
 1776|  4.16k|    if (first >= end_offset) {
  ------------------
  |  Branch (1776:9): [True: 221, False: 3.94k]
  ------------------
 1777|    221|        throw damagedPDF(
 1778|    221|            "object " + std::to_string(obj_stream_number) + " 0",
 1779|    221|            "object stream " + std::to_string(obj_stream_number) + " has invalid /First entry");
 1780|    221|    }
 1781|       |
 1782|  3.94k|    int id = 0;
 1783|  3.94k|    long long last_offset = -1;
 1784|  3.94k|    bool is_first = true;
 1785|  63.1k|    for (unsigned int i = 0; i < n; ++i) {
  ------------------
  |  Branch (1785:30): [True: 59.5k, False: 3.61k]
  ------------------
 1786|  59.5k|        auto tnum = readToken(input);
 1787|  59.5k|        auto id_offset = input.getLastOffset();
 1788|  59.5k|        auto toffset = readToken(input);
 1789|  59.5k|        if (!(tnum.isInteger() && toffset.isInteger())) {
  ------------------
  |  Branch (1789:15): [True: 59.3k, False: 215]
  |  Branch (1789:35): [True: 59.2k, False: 115]
  ------------------
 1790|    330|            throw damaged(0, input.getLastOffset(), "expected integer in object stream header");
 1791|    330|        }
 1792|       |
 1793|  59.2k|        int num = QUtil::string_to_int(tnum.getValue().c_str());
 1794|  59.2k|        long long offset = QUtil::string_to_int(toffset.getValue().c_str());
 1795|       |
 1796|  59.2k|        if (num == obj_stream_number) {
  ------------------
  |  Branch (1796:13): [True: 368, False: 58.8k]
  ------------------
 1797|    368|            warn(damaged(num, id_offset, "object stream claims to contain itself"));
 1798|    368|            continue;
 1799|    368|        }
 1800|       |
 1801|  58.8k|        if (num < 1) {
  ------------------
  |  Branch (1801:13): [True: 868, False: 57.9k]
  ------------------
 1802|    868|            warn(damaged(num, id_offset, "object id is invalid"s));
 1803|    868|            continue;
 1804|    868|        }
 1805|       |
 1806|  57.9k|        if (offset <= last_offset) {
  ------------------
  |  Branch (1806:13): [True: 10.4k, False: 47.5k]
  ------------------
 1807|  10.4k|            warn(damaged(
 1808|  10.4k|                num,
 1809|  10.4k|                input.getLastOffset(),
 1810|  10.4k|                "offset " + std::to_string(offset) +
 1811|  10.4k|                    " is invalid (must be larger than previous offset " +
 1812|  10.4k|                    std::to_string(last_offset) + ")"));
 1813|  10.4k|            continue;
 1814|  10.4k|        }
 1815|       |
 1816|  47.5k|        if (num > m->xref_table_max_id) {
  ------------------
  |  Branch (1816:13): [True: 2.09k, False: 45.4k]
  ------------------
 1817|  2.09k|            continue;
 1818|  2.09k|        }
 1819|       |
 1820|  45.4k|        if (first + offset >= end_offset) {
  ------------------
  |  Branch (1820:13): [True: 8.74k, False: 36.7k]
  ------------------
 1821|  8.74k|            warn(damaged(
 1822|  8.74k|                num, input.getLastOffset(), "offset " + std::to_string(offset) + " is too large"));
 1823|  8.74k|            continue;
 1824|  8.74k|        }
 1825|       |
 1826|  36.7k|        if (is_first) {
  ------------------
  |  Branch (1826:13): [True: 1.16k, False: 35.5k]
  ------------------
 1827|  1.16k|            is_first = false;
 1828|  35.5k|        } else {
 1829|  35.5k|            offsets.emplace_back(
 1830|  35.5k|                id, last_offset + first, static_cast<size_t>(offset - last_offset));
 1831|  35.5k|        }
 1832|       |
 1833|  36.7k|        last_offset = offset;
 1834|  36.7k|        id = num;
 1835|  36.7k|    }
 1836|       |
 1837|  3.61k|    if (!is_first) {
  ------------------
  |  Branch (1837:9): [True: 968, False: 2.64k]
  ------------------
 1838|       |        // We found at least one valid entry.
 1839|    968|        offsets.emplace_back(
 1840|    968|            id, last_offset + first, b_size - static_cast<size_t>(last_offset + first));
 1841|    968|    }
 1842|       |
 1843|       |    // To avoid having to read the object stream multiple times, store all objects that would be
 1844|       |    // found here in the cache.  Remember that some objects stored here might have been overridden
 1845|       |    // by new objects appended to the file, so it is necessary to recheck the xref table and only
 1846|       |    // cache what would actually be resolved here.
 1847|  30.3k|    for (auto const& [obj_id, obj_offset, obj_size]: offsets) {
  ------------------
  |  Branch (1847:52): [True: 30.3k, False: 3.61k]
  ------------------
 1848|  30.3k|        QPDFObjGen og(obj_id, 0);
 1849|  30.3k|        auto entry = m->xref_table.find(og);
 1850|  30.3k|        if (entry != m->xref_table.end() && entry->second.getType() == 2 &&
  ------------------
  |  Branch (1850:13): [True: 27.1k, False: 3.23k]
  |  Branch (1850:13): [True: 24.7k, False: 5.61k]
  |  Branch (1850:45): [True: 26.6k, False: 453]
  ------------------
 1851|  26.6k|            entry->second.getObjStreamNumber() == obj_stream_number) {
  ------------------
  |  Branch (1851:13): [True: 24.7k, False: 1.92k]
  ------------------
 1852|  24.7k|            is::OffsetBuffer in("", {b_start + obj_offset, obj_size}, obj_offset);
 1853|  24.7k|            if (auto oh = Parser::parse(in, obj_stream_number, obj_id, m->tokenizer, qpdf)) {
  ------------------
  |  Branch (1853:22): [True: 22.1k, False: 2.64k]
  ------------------
 1854|  22.1k|                updateCache(og, oh.obj_sp(), end_before_space, end_after_space);
 1855|  22.1k|            }
 1856|  24.7k|        } else {
 1857|  5.61k|            QTC::TC("qpdf", "QPDF not caching overridden objstm object");
 1858|  5.61k|        }
 1859|  30.3k|    }
 1860|  3.61k|}
_ZN4QPDF3Doc7Objects11newIndirectE10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEE:
 1864|  6.86k|{
 1865|  6.86k|    obj->setDefaultDescription(&qpdf, og);
 1866|  6.86k|    return {obj};
 1867|  6.86k|}
_ZN4QPDF3Doc7Objects11updateCacheE10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEExxb:
 1876|   264k|{
 1877|   264k|    object->setObjGen(&qpdf, og);
 1878|   264k|    if (isCached(og)) {
  ------------------
  |  Branch (1878:9): [True: 120k, False: 143k]
  ------------------
 1879|   120k|        auto& cache = m->obj_cache[og];
 1880|   120k|        object->move_to(cache.object, destroy);
 1881|   120k|        cache.end_before_space = end_before_space;
 1882|   120k|        cache.end_after_space = end_after_space;
 1883|   143k|    } else {
 1884|   143k|        m->obj_cache[og] = ObjCache(object, end_before_space, end_after_space);
 1885|   143k|    }
 1886|   264k|}
_ZN4QPDF3Doc7Objects8isCachedE10QPDFObjGen:
 1890|   924k|{
 1891|   924k|    return m->obj_cache.contains(og);
 1892|   924k|}
_ZN4QPDF3Doc7Objects12isUnresolvedE10QPDFObjGen:
 1896|   660k|{
 1897|   660k|    return !isCached(og) || m->obj_cache[og].object->isUnresolved();
  ------------------
  |  Branch (1897:12): [True: 386k, False: 273k]
  |  Branch (1897:29): [True: 192k, False: 81.1k]
  ------------------
 1898|   660k|}
_ZN4QPDF3Doc7Objects10nextObjGenEv:
 1902|  6.90k|{
 1903|  6.90k|    int max_objid = toI(qpdf.getObjectCount());
 1904|  6.90k|    if (max_objid == std::numeric_limits<int>::max()) {
  ------------------
  |  Branch (1904:9): [True: 0, False: 6.90k]
  ------------------
 1905|      0|        throw std::range_error("max object id is too high to create new objects");
 1906|      0|    }
 1907|  6.90k|    return {max_objid + 1, 0};
 1908|  6.90k|}
_ZN4QPDF3Doc7Objects26makeIndirectFromQPDFObjectERKNSt3__110shared_ptrI10QPDFObjectEE:
 1912|  6.90k|{
 1913|  6.90k|    QPDFObjGen next{nextObjGen()};
 1914|  6.90k|    m->obj_cache[next] = ObjCache(obj, -1, -1);
 1915|  6.90k|    return newIndirect(next, m->obj_cache[next].object);
 1916|  6.90k|}
_ZN4QPDF18makeIndirectObjectE16QPDFObjectHandle:
 1920|  6.90k|{
 1921|  6.90k|    if (!oh) {
  ------------------
  |  Branch (1921:9): [True: 0, False: 6.90k]
  ------------------
 1922|      0|        throw std::logic_error("attempted to make an uninitialized QPDFObjectHandle indirect");
 1923|      0|    }
 1924|  6.90k|    return m->objects.makeIndirectFromQPDFObject(oh.obj_sp());
 1925|  6.90k|}
_ZN4QPDF3Doc7Objects18getObjectForParserEiib:
 1929|   265k|{
 1930|       |    // This method is called by the parser and therefore must not resolve any objects.
 1931|   265k|    auto og = QPDFObjGen(id, gen);
 1932|   265k|    if (auto iter = m->obj_cache.find(og); iter != m->obj_cache.end()) {
  ------------------
  |  Branch (1932:44): [True: 178k, False: 87.1k]
  ------------------
 1933|   178k|        return iter->second.object;
 1934|   178k|    }
 1935|  87.1k|    if (m->xref_table.contains(og) || (!m->parsed && og.getObj() < m->xref_table_max_id)) {
  ------------------
  |  Branch (1935:9): [True: 49.9k, False: 37.2k]
  |  Branch (1935:40): [True: 32.3k, False: 4.88k]
  |  Branch (1935:54): [True: 29.5k, False: 2.77k]
  ------------------
 1936|  79.5k|        return m->obj_cache.insert({og, QPDFObject::create<QPDF_Unresolved>(&qpdf, og)})
 1937|  79.5k|            .first->second.object;
 1938|  79.5k|    }
 1939|  7.65k|    if (parse_pdf) {
  ------------------
  |  Branch (1939:9): [True: 7.65k, False: 0]
  ------------------
 1940|  7.65k|        return QPDFObject::create<QPDF_Null>();
 1941|  7.65k|    }
 1942|      0|    return m->obj_cache.insert({og, QPDFObject::create<QPDF_Null>(&qpdf, og)}).first->second.object;
 1943|  7.65k|}
_ZN4QPDF9getObjectE10QPDFObjGen:
 1961|  88.9k|{
 1962|  88.9k|    if (auto it = m->obj_cache.find(og); it != m->obj_cache.end()) {
  ------------------
  |  Branch (1962:42): [True: 19.3k, False: 69.5k]
  ------------------
 1963|  19.3k|        return {it->second.object};
 1964|  69.5k|    } else if (m->parsed && !m->xref_table.contains(og)) {
  ------------------
  |  Branch (1964:16): [True: 13.6k, False: 55.8k]
  |  Branch (1964:29): [True: 12.5k, False: 1.09k]
  ------------------
 1965|  12.5k|        return QPDFObject::create<QPDF_Null>();
 1966|  56.9k|    } else {
 1967|  56.9k|        auto result =
 1968|  56.9k|            m->obj_cache.try_emplace(og, QPDFObject::create<QPDF_Unresolved>(this, og), -1, -1);
 1969|  56.9k|        return {result.first->second.object};
 1970|  56.9k|    }
 1971|  88.9k|}
_ZN4QPDF12removeObjectE10QPDFObjGen:
 1990|  23.6k|{
 1991|  23.6k|    m->xref_table.erase(og);
 1992|  23.6k|    if (auto cached = m->obj_cache.find(og); cached != m->obj_cache.end()) {
  ------------------
  |  Branch (1992:46): [True: 1.08k, False: 22.5k]
  ------------------
 1993|       |        // Take care of any object handles that may be floating around.
 1994|  1.08k|        cached->second.object->assign_null();
 1995|  1.08k|        cached->second.object->setObjGen(nullptr, QPDFObjGen());
 1996|  1.08k|        m->obj_cache.erase(cached);
 1997|  1.08k|    }
 1998|  23.6k|}
_ZN4QPDF3Doc7Objects13PatternFinderC2ERS1_MS1_FbvE:
  147|  62.8k|        o(o),
  148|  62.8k|        checker(checker)
  149|  62.8k|    {
  150|  62.8k|    }
_ZN4QPDF3Doc7Objects13PatternFinder5checkEv:
  154|  37.7k|    {
  155|  37.7k|        return (this->o.*checker)();
  156|  37.7k|    }
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects16reconstruct_xrefER7QPDFExcbENK3$_0clEv:
  324|  1.18M|    auto check_warnings = [this, max_warnings]() {
  325|  1.18M|        if (m->warnings.size() > max_warnings) {
  ------------------
  |  Branch (325:13): [True: 0, False: 1.18M]
  ------------------
  326|      0|            throw damagedPDF("", -1, "too many errors while reconstructing cross-reference table");
  327|      0|        }
  328|  1.18M|    };
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects17processXRefStreamExR16QPDFObjectHandlebENK3$_0clENSt3__117basic_string_viewIcNS5_11char_traitsIcEEEE:
 1037|  5.91k|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1038|  5.91k|        return damagedPDF("xref stream", xref_offset, msg.data());
 1039|  5.91k|    };
_ZN4QPDF15ResolveRecorderC2ERS_RK10QPDFObjGen:
  129|   258k|        qpdf(qpdf),
  130|   258k|        iter(qpdf.m->resolving.insert(og).first)
  131|   258k|    {
  132|   258k|    }
_ZN4QPDF15ResolveRecorderD2Ev:
  134|   258k|    {
  135|   258k|        qpdf.m->resolving.erase(iter);
  136|   258k|    }
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects22resolveObjectsInStreamEiENK3$_0clEixRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 1722|  20.7k|        [this, obj_stream_number](int id, qpdf_offset_t offset, std::string const& msg) -> QPDFExc {
 1723|  20.7k|        return {
 1724|  20.7k|            qpdf_e_damaged_pdf,
 1725|  20.7k|            m->file->getName() + " object stream " + std::to_string(obj_stream_number),
 1726|  20.7k|            +"object " + std::to_string(id) + " 0",
 1727|  20.7k|            offset,
 1728|  20.7k|            msg,
 1729|  20.7k|            true};
 1730|  20.7k|    };

_ZN4QPDF3Doc5Pages5cacheEv:
   53|  14.1k|{
   54|       |    // Note that pushInheritedAttributesToPage may also be used to initialize m->all_pages.
   55|  14.1k|    if (all_pages.empty() && !invalid_page_found) {
  ------------------
  |  Branch (55:9): [True: 12.4k, False: 1.74k]
  |  Branch (55:30): [True: 10.9k, False: 1.44k]
  ------------------
   56|  10.9k|        ever_called_get_all_pages_ = true;
   57|  10.9k|        auto root = qpdf.getRoot();
   58|  10.9k|        QPDFObjGen::set visited;
   59|  10.9k|        QPDFObjGen::set seen;
   60|  10.9k|        QPDFObjectHandle pages = root.getKey("/Pages");
   61|  10.9k|        bool warned = false;
   62|  10.9k|        bool changed_pages = false;
   63|  11.4k|        while (pages.isDictionary() && pages.hasKey("/Parent")) {
  ------------------
  |  Branch (63:16): [True: 4.55k, False: 6.91k]
  |  Branch (63:16): [True: 585, False: 10.8k]
  |  Branch (63:40): [True: 585, False: 3.97k]
  ------------------
   64|    585|            if (!seen.add(pages)) {
  ------------------
  |  Branch (64:17): [True: 73, False: 512]
  ------------------
   65|       |                // loop -- will be detected again and reported later
   66|     73|                break;
   67|     73|            }
   68|       |            // Files have been found in the wild where /Pages in the catalog points to the first
   69|       |            // page. Try to work around this and similar cases with this heuristic.
   70|    512|            if (!warned) {
  ------------------
  |  Branch (70:17): [True: 194, False: 318]
  ------------------
   71|    194|                root.warn(
   72|    194|                    "document page tree root (root -> /Pages) doesn't point"
   73|    194|                    " to the root of the page tree; attempting to correct");
   74|    194|                warned = true;
   75|    194|            }
   76|    512|            changed_pages = true;
   77|    512|            pages = pages.getKey("/Parent");
   78|    512|        }
   79|  10.9k|        if (changed_pages) {
  ------------------
  |  Branch (79:13): [True: 193, False: 10.7k]
  ------------------
   80|    193|            root.replaceKey("/Pages", pages);
   81|    193|        }
   82|  10.9k|        seen.clear();
   83|  10.9k|        if (!pages.hasKey("/Kids")) {
  ------------------
  |  Branch (83:13): [True: 153, False: 10.8k]
  ------------------
   84|       |            // Ensure we actually found a /Pages object.
   85|    153|            throw QPDFExc(
   86|    153|                qpdf_e_pages, m->file->getName(), "", 0, "root of pages tree has no /Kids array");
   87|    153|        }
   88|  10.8k|        try {
   89|  10.8k|            getAllPagesInternal(pages, 0, visited, seen, false, false);
   90|  10.8k|        } catch (...) {
   91|    139|            all_pages.clear();
   92|    139|            invalid_page_found = false;
   93|    139|            throw;
   94|    139|        }
   95|  3.87k|        if (invalid_page_found) {
  ------------------
  |  Branch (95:13): [True: 3.18k, False: 689]
  ------------------
   96|  3.18k|            flattenPagesTree();
   97|  3.18k|            invalid_page_found = false;
   98|  3.18k|        }
   99|  3.87k|    }
  100|  7.06k|    return all_pages;
  101|  14.1k|}
_ZN4QPDF3Doc5Pages19getAllPagesInternalE16QPDFObjectHandlejRN10QPDFObjGen3setES5_bb:
  111|  7.83k|{
  112|  7.83k|    static uint32_t constexpr max_level = 100;
  113|  7.83k|    if (++level > max_level) {
  ------------------
  |  Branch (113:9): [True: 0, False: 7.83k]
  ------------------
  114|      0|        throw QPDFExc(
  115|      0|            qpdf_e_pages,
  116|      0|            m->file->getName(),
  117|      0|            "object " + cur_node.getObjGen().unparse(' '),
  118|      0|            0,
  119|      0|            "/Pages structure too deeply nested (getAllPages)");
  120|      0|    }
  121|  7.83k|    if (!visited.add(cur_node)) {
  ------------------
  |  Branch (121:9): [True: 33, False: 7.79k]
  ------------------
  122|     33|        throw QPDFExc(
  123|     33|            qpdf_e_pages,
  124|     33|            m->file->getName(),
  125|     33|            "object " + cur_node.getObjGen().unparse(' '),
  126|     33|            0,
  127|     33|            "Loop detected in /Pages structure (getAllPages)");
  128|     33|    }
  129|  7.79k|    if (!cur_node.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (129:9): [True: 7.26k, False: 532]
  ------------------
  130|       |        // During fuzzing files were encountered where the root object appeared in the pages tree.
  131|       |        // Unconditionally setting the /Type to /Pages could cause problems, but trying to
  132|       |        // accommodate the possibility may be excessive.
  133|  7.26k|        cur_node.warn("/Type key should be /Pages but is not; overriding");
  134|  7.26k|        cur_node.replaceKey("/Type", Name("/Pages"));
  135|  7.26k|    }
  136|  7.79k|    if (!media_box) {
  ------------------
  |  Branch (136:9): [True: 7.72k, False: 73]
  ------------------
  137|  7.72k|        media_box = cur_node.getKey("/MediaBox").isRectangle();
  138|  7.72k|        QTC::TC("qpdf", "QPDF inherit mediabox", media_box ? 0 : 1);
  ------------------
  |  Branch (138:50): [True: 311, False: 7.41k]
  ------------------
  139|  7.72k|    }
  140|  7.79k|    if (!resources) {
  ------------------
  |  Branch (140:9): [True: 7.71k, False: 81]
  ------------------
  141|  7.71k|        resources = cur_node.getKey("/Resources").isDictionary();
  142|  7.71k|    }
  143|  7.79k|    auto kids = cur_node.getKey("/Kids");
  144|  7.79k|    if (!visited.add(kids)) {
  ------------------
  |  Branch (144:9): [True: 35, False: 7.76k]
  ------------------
  145|     35|        throw QPDFExc(
  146|     35|            qpdf_e_pages,
  147|     35|            m->file->getName(),
  148|     35|            "object " + cur_node.getObjGen().unparse(' '),
  149|     35|            0,
  150|     35|            "Loop detected in /Pages structure (getAllPages)");
  151|     35|    }
  152|  7.76k|    int i = -1;
  153|  39.4k|    for (auto& kid: kids.as_array()) {
  ------------------
  |  Branch (153:19): [True: 39.4k, False: 7.76k]
  ------------------
  154|  39.4k|        ++i;
  155|  39.4k|        int errors = 0;
  156|       |
  157|  39.4k|        if (!kid.isDictionary()) {
  ------------------
  |  Branch (157:13): [True: 25.0k, False: 14.4k]
  ------------------
  158|  25.0k|            kid.warn("Pages tree includes non-dictionary object; ignoring");
  159|  25.0k|            invalid_page_found = true;
  160|  25.0k|            continue;
  161|  25.0k|        }
  162|  14.4k|        if (!kid.isIndirect()) {
  ------------------
  |  Branch (162:13): [True: 5.37k, False: 9.09k]
  ------------------
  163|  5.37k|            cur_node.warn(
  164|  5.37k|                "kid " + std::to_string(i) + " (from 0) is direct; converting to indirect");
  165|  5.37k|            kid = qpdf.makeIndirectObject(kid);
  166|  5.37k|            ++errors;
  167|  5.37k|        }
  168|  14.4k|        if (kid.hasKey("/Kids")) {
  ------------------
  |  Branch (168:13): [True: 3.81k, False: 10.6k]
  ------------------
  169|  3.81k|            getAllPagesInternal(kid, level, visited, seen, media_box, resources);
  170|  10.6k|        } else {
  171|  10.6k|            if (!media_box && !kid.getKey("/MediaBox").isRectangle()) {
  ------------------
  |  Branch (171:17): [True: 9.57k, False: 1.08k]
  |  Branch (171:17): [True: 4.47k, False: 6.18k]
  |  Branch (171:31): [True: 4.47k, False: 5.10k]
  ------------------
  172|  4.47k|                kid.warn(
  173|  4.47k|                    "kid " + std::to_string(i) +
  174|  4.47k|                    " (from 0) MediaBox is undefined; setting to letter / ANSI A");
  175|  4.47k|                kid.replaceKey(
  176|  4.47k|                    "/MediaBox",
  177|  4.47k|                    QPDFObjectHandle::newArray(QPDFObjectHandle::Rectangle(0, 0, 612, 792)));
  178|  4.47k|                ++errors;
  179|  4.47k|            }
  180|  10.6k|            if (!resources) {
  ------------------
  |  Branch (180:17): [True: 9.59k, False: 1.05k]
  ------------------
  181|  9.59k|                auto res = kid.getKey("/Resources");
  182|       |
  183|  9.59k|                if (!res.isDictionary()) {
  ------------------
  |  Branch (183:21): [True: 4.08k, False: 5.51k]
  ------------------
  184|  4.08k|                    ++errors;
  185|  4.08k|                    kid.warn(
  186|  4.08k|                        "kid " + std::to_string(i) +
  187|  4.08k|                        " (from 0) Resources is missing or invalid; repairing");
  188|  4.08k|                    kid.replaceKey("/Resources", QPDFObjectHandle::newDictionary());
  189|  4.08k|                }
  190|  9.59k|            }
  191|  10.6k|            auto annots = kid.getKey("/Annots");
  192|  10.6k|            if (!annots.null()) {
  ------------------
  |  Branch (192:17): [True: 1.65k, False: 8.99k]
  ------------------
  193|  1.65k|                if (!annots.isArray()) {
  ------------------
  |  Branch (193:21): [True: 21, False: 1.63k]
  ------------------
  194|     21|                    kid.warn(
  195|     21|                        "kid " + std::to_string(i) + " (from 0) Annots is not an array; removing");
  196|     21|                    kid.removeKey("/Annots");
  197|     21|                    ++errors;
  198|  1.63k|                } else {
  199|  1.63k|                    QPDFObjGen::set seen_annots;
  200|  50.6k|                    for (auto& annot: annots.as_array()) {
  ------------------
  |  Branch (200:37): [True: 50.6k, False: 1.63k]
  ------------------
  201|  50.6k|                        if (!seen_annots.add(annot)) {
  ------------------
  |  Branch (201:29): [True: 578, False: 50.0k]
  ------------------
  202|    578|                            kid.warn(
  203|    578|                                "kid " + std::to_string(i) +
  204|    578|                                " (from 0) Annots has duplicate entry for annotation " +
  205|    578|                                annot.id_gen().unparse(' '));
  206|    578|                            ++errors;
  207|    578|                        }
  208|  50.6k|                    }
  209|  1.63k|                }
  210|  1.65k|            }
  211|       |
  212|  10.6k|            if (!seen.add(kid)) {
  ------------------
  |  Branch (212:17): [True: 4.36k, False: 6.29k]
  ------------------
  213|       |                // Make a copy of the page. This does the same as shallowCopyPage in
  214|       |                // QPDFPageObjectHelper.
  215|  4.36k|                if (!m->reconstructed_xref) {
  ------------------
  |  Branch (215:21): [True: 195, False: 4.16k]
  ------------------
  216|    195|                    cur_node.warn(
  217|    195|                        "kid " + std::to_string(i) +
  218|    195|                        " (from 0) appears more than once in the pages tree;"
  219|    195|                        " creating a new page object as a copy");
  220|       |                    // This needs to be fixed. shallowCopy does not necessarily produce a valid
  221|       |                    // page.
  222|    195|                    kid = qpdf.makeIndirectObject(QPDFObjectHandle(kid).shallowCopy());
  223|    195|                    seen.add(kid);
  224|  4.16k|                } else {
  225|  4.16k|                    cur_node.warn(
  226|  4.16k|                        "kid " + std::to_string(i) +
  227|  4.16k|                        " (from 0) appears more than once in the pages tree; ignoring duplicate");
  228|  4.16k|                    invalid_page_found = true;
  229|  4.16k|                    kid = QPDFObjectHandle::newNull();
  230|  4.16k|                    continue;
  231|  4.16k|                }
  232|    195|                if (!kid.getKey("/Parent").isSameObjectAs(cur_node)) {
  ------------------
  |  Branch (232:21): [True: 133, False: 62]
  ------------------
  233|       |                    // Consider fixing and adding an information message.
  234|    133|                    ++errors;
  235|    133|                }
  236|    195|            }
  237|  6.48k|            if (!kid.isDictionaryOfType("/Page")) {
  ------------------
  |  Branch (237:17): [True: 3.47k, False: 3.01k]
  ------------------
  238|  3.47k|                kid.warn("/Type key should be /Page but is not; overriding");
  239|  3.47k|                kid.replaceKey("/Type", Name("/Page"));
  240|  3.47k|                ++errors;
  241|  3.47k|            }
  242|  6.48k|            if (m->reconstructed_xref && errors > 2) {
  ------------------
  |  Branch (242:17): [True: 5.67k, False: 812]
  |  Branch (242:42): [True: 1.92k, False: 3.75k]
  ------------------
  243|  1.92k|                cur_node.warn(
  244|  1.92k|                    "kid " + std::to_string(i) + " (from 0) has too many errors; ignoring page");
  245|  1.92k|                invalid_page_found = true;
  246|  1.92k|                kid = QPDFObjectHandle::newNull();
  247|  1.92k|                continue;
  248|  1.92k|            }
  249|  4.56k|            all_pages.emplace_back(kid);
  250|  4.56k|        }
  251|  14.4k|    }
  252|  7.76k|}
_ZN4QPDF3Doc5Pages16flattenPagesTreeEv:
  274|  3.18k|{
  275|       |    // If not already done, flatten the /Pages structure and initialize pageobj_to_pages_pos.
  276|       |
  277|  3.18k|    if (!pageobj_to_pages_pos.empty()) {
  ------------------
  |  Branch (277:9): [True: 0, False: 3.18k]
  ------------------
  278|      0|        return;
  279|      0|    }
  280|       |
  281|       |    // Push inherited objects down to the /Page level.  As a side effect all_pages will also be
  282|       |    // generated.
  283|  3.18k|    pushInheritedAttributesToPage(true, true);
  284|       |
  285|  3.18k|    QPDFObjectHandle pages = qpdf.getRoot().getKey("/Pages");
  286|       |
  287|  3.18k|    size_t const len = all_pages.size();
  288|  6.37k|    for (size_t pos = 0; pos < len; ++pos) {
  ------------------
  |  Branch (288:26): [True: 3.18k, False: 3.18k]
  ------------------
  289|       |        // Populate pageobj_to_pages_pos and fix parent pointer. There should be no duplicates at
  290|       |        // this point because pushInheritedAttributesToPage calls getAllPages which resolves
  291|       |        // duplicates.
  292|  3.18k|        insertPageobjToPage(all_pages.at(pos), toI(pos), true);
  293|  3.18k|        all_pages.at(pos).replaceKey("/Parent", pages);
  294|  3.18k|    }
  295|       |
  296|  3.18k|    pages.replaceKey("/Kids", Array(all_pages));
  297|       |    // /Count has not changed
  298|  3.18k|    if (pages.getKey("/Count").getUIntValue() != len) {
  ------------------
  |  Branch (298:9): [True: 1.84k, False: 1.34k]
  ------------------
  299|  1.84k|        if (invalid_page_found && pages.getKey("/Count").getUIntValue() > len) {
  ------------------
  |  Branch (299:13): [True: 1.84k, False: 0]
  |  Branch (299:13): [True: 1.78k, False: 57]
  |  Branch (299:35): [True: 1.78k, False: 57]
  ------------------
  300|  1.78k|            pages.replaceKey("/Count", Integer(len));
  301|  1.78k|        } else {
  302|     57|            throw std::runtime_error("/Count is wrong after flattening pages tree");
  303|     57|        }
  304|  1.84k|    }
  305|  3.18k|}
_ZN4QPDF3Doc5Pages29pushInheritedAttributesToPageEbb:
  316|  3.18k|{
  317|       |    // Traverse pages tree pushing all inherited resources down to the page level.
  318|       |
  319|       |    // The record of whether we've done this is cleared by updateAllPagesCache().  If we're warning
  320|       |    // for skipped keys, re-traverse unconditionally.
  321|  3.18k|    if (pushed_inherited_attributes_to_pages && !warn_skipped_keys) {
  ------------------
  |  Branch (321:9): [True: 0, False: 3.18k]
  |  Branch (321:49): [True: 0, False: 0]
  ------------------
  322|      0|        return;
  323|      0|    }
  324|       |
  325|       |    // Calling cache() resolves any duplicated page objects, repairs broken nodes, and detects
  326|       |    // loops, so we don't have to do those activities here.
  327|  3.18k|    (void)cache();
  328|       |
  329|       |    // key_ancestors is a mapping of page attribute keys to a stack of Pages nodes that contain
  330|       |    // values for them.
  331|  3.18k|    std::map<std::string, std::vector<QPDFObjectHandle>> key_ancestors;
  332|  3.18k|    pushInheritedAttributesToPageInternal(
  333|  3.18k|        m->trailer.getKey("/Root").getKey("/Pages"),
  334|  3.18k|        key_ancestors,
  335|  3.18k|        allow_changes,
  336|  3.18k|        warn_skipped_keys);
  337|  3.18k|    util::assertion(
  338|  3.18k|        key_ancestors.empty(),
  339|  3.18k|        "key_ancestors not empty after pushing inherited attributes to pages");
  340|  3.18k|    pushed_inherited_attributes_to_pages = true;
  341|  3.18k|    ever_pushed_inherited_attributes_to_pages_ = true;
  342|  3.18k|}
_ZN4QPDF3Doc5Pages37pushInheritedAttributesToPageInternalE16QPDFObjectHandleRNSt3__13mapINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS3_6vectorIS2_NS8_IS2_EEEENS3_4lessISA_EENS8_INS3_4pairIKSA_SD_EEEEEEbb:
  350|  6.42k|{
  351|       |    // Make a list of inheritable keys. Only the keys /MediaBox, /CropBox, /Resources, and /Rotate
  352|       |    // are inheritable attributes. Push this object onto the stack of pages nodes that have values
  353|       |    // for this attribute.
  354|       |
  355|  6.42k|    std::set<std::string> inheritable_keys;
  356|  24.5k|    for (auto const& key: cur_pages.getKeys()) {
  ------------------
  |  Branch (356:25): [True: 24.5k, False: 6.42k]
  ------------------
  357|  24.5k|        if (key == "/MediaBox" || key == "/CropBox" || key == "/Resources" || key == "/Rotate") {
  ------------------
  |  Branch (357:13): [True: 1.80k, False: 22.7k]
  |  Branch (357:35): [True: 297, False: 22.4k]
  |  Branch (357:56): [True: 1.62k, False: 20.8k]
  |  Branch (357:79): [True: 426, False: 20.3k]
  ------------------
  358|  4.14k|            if (!allow_changes) {
  ------------------
  |  Branch (358:17): [True: 0, False: 4.14k]
  ------------------
  359|      0|                throw QPDFExc(
  360|      0|                    qpdf_e_internal,
  361|      0|                    m->file->getName(),
  362|      0|                    "/Pages object " + cur_pages.id_gen().unparse(' '),
  363|      0|                    cur_pages.offset(),
  364|      0|                    "pushInheritedAttributesToPage detected an inheritable attribute when called "
  365|      0|                    "in no-change mode");
  366|      0|            }
  367|       |
  368|       |            // This is an inheritable resource
  369|  4.14k|            inheritable_keys.insert(key);
  370|  4.14k|            auto oh = cur_pages[key];
  371|  4.14k|            QTC::TC("qpdf", "QPDF opt direct pages resource", oh.indirect() ? 0 : 1);
  ------------------
  |  Branch (371:63): [True: 50, False: 4.09k]
  ------------------
  372|  4.14k|            if (!oh.indirect()) {
  ------------------
  |  Branch (372:17): [True: 4.09k, False: 50]
  ------------------
  373|  4.09k|                if (!oh.isScalar()) {
  ------------------
  |  Branch (373:21): [True: 372, False: 3.72k]
  ------------------
  374|       |                    // Replace shared direct object non-scalar resources with indirect objects to
  375|       |                    // avoid copying large structures around.
  376|    372|                    cur_pages.replaceKey(key, qpdf.makeIndirectObject(oh));
  377|    372|                    oh = cur_pages[key];
  378|  3.72k|                } else {
  379|       |                    // It's okay to copy scalars.
  380|  3.72k|                }
  381|  4.09k|            }
  382|  4.14k|            key_ancestors[key].emplace_back(oh);
  383|  4.14k|            if (key_ancestors[key].size() > 1) {
  ------------------
  |  Branch (383:17): [True: 714, False: 3.43k]
  ------------------
  384|    714|            }
  385|       |            // Remove this resource from this node.  It will be reattached at the page level.
  386|  4.14k|            cur_pages.erase(key);
  387|  20.3k|        } else if (!(key == "/Type" || key == "/Parent" || key == "/Kids" || key == "/Count")) {
  ------------------
  |  Branch (387:22): [True: 6.39k, False: 13.9k]
  |  Branch (387:40): [True: 237, False: 13.7k]
  |  Branch (387:60): [True: 6.41k, False: 7.34k]
  |  Branch (387:78): [True: 1.90k, False: 5.43k]
  ------------------
  388|       |            // Warn when flattening, but not if the key is at the top level (i.e. "/Parent" not
  389|       |            // set), as we don't change these; but flattening removes intermediate /Pages nodes.
  390|  5.43k|            if (warn_skipped_keys && cur_pages.contains("/Parent")) {
  ------------------
  |  Branch (390:17): [True: 5.43k, False: 0]
  |  Branch (390:17): [True: 1.07k, False: 4.36k]
  |  Branch (390:38): [True: 1.07k, False: 4.36k]
  ------------------
  391|  1.07k|                warn(
  392|  1.07k|                    qpdf_e_pages,
  393|  1.07k|                    "Pages object: object " + cur_pages.id_gen().unparse(' '),
  394|  1.07k|                    cur_pages.offset(),
  395|  1.07k|                    ("Unknown key " + key +
  396|  1.07k|                     " in /Pages object is being discarded as a result of flattening the /Pages "
  397|  1.07k|                     "tree"));
  398|  1.07k|            }
  399|  5.43k|        }
  400|  24.5k|    }
  401|       |
  402|       |    // Process descendant nodes. This method does not perform loop detection because all code paths
  403|       |    // that lead here follow a call to getAllPages, which already throws an exception in the event
  404|       |    // of a loop in the pages tree.
  405|  31.1k|    for (auto& kid: Array(cur_pages["/Kids"])) {
  ------------------
  |  Branch (405:19): [True: 31.1k, False: 6.42k]
  ------------------
  406|  31.1k|        if (kid.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (406:13): [True: 3.23k, False: 27.8k]
  ------------------
  407|  3.23k|            pushInheritedAttributesToPageInternal(
  408|  3.23k|                kid, key_ancestors, allow_changes, warn_skipped_keys);
  409|  27.8k|        } else {
  410|       |            // Add all available inheritable attributes not present in this object to this object.
  411|  27.8k|            for (auto const& [key, values]: key_ancestors) {
  ------------------
  |  Branch (411:43): [True: 4.73k, False: 27.8k]
  ------------------
  412|  4.73k|                if (!kid.contains(key)) {
  ------------------
  |  Branch (412:21): [True: 4.63k, False: 95]
  ------------------
  413|  4.63k|                    kid.replaceKey(key, values.back());
  414|  4.63k|                } else {
  415|     95|                    QTC::TC("qpdf", "QPDF opt page resource hides ancestor");
  416|     95|                }
  417|  4.73k|            }
  418|  27.8k|        }
  419|  31.1k|    }
  420|       |
  421|       |    // For each inheritable key, pop the stack.  If the stack becomes empty, remove it from the map.
  422|       |    // That way, the invariant that the list of keys in key_ancestors is exactly those keys for
  423|       |    // which inheritable attributes are available.
  424|       |
  425|  6.42k|    if (!inheritable_keys.empty()) {
  ------------------
  |  Branch (425:9): [True: 2.03k, False: 4.39k]
  ------------------
  426|  3.65k|        for (auto const& key: inheritable_keys) {
  ------------------
  |  Branch (426:29): [True: 3.65k, False: 2.03k]
  ------------------
  427|  3.65k|            key_ancestors[key].pop_back();
  428|  3.65k|            if (key_ancestors[key].empty()) {
  ------------------
  |  Branch (428:17): [True: 2.94k, False: 710]
  ------------------
  429|  2.94k|                key_ancestors.erase(key);
  430|  2.94k|            }
  431|  3.65k|        }
  432|  4.39k|    } else {
  433|  4.39k|        QTC::TC("qpdf", "QPDF opt no inheritable keys");
  434|  4.39k|    }
  435|  6.42k|}
_ZN4QPDF3Doc5Pages19insertPageobjToPageERK16QPDFObjectHandleib:
  439|  3.18k|{
  440|  3.18k|    QPDFObjGen og(obj.getObjGen());
  441|  3.18k|    if (check_duplicate) {
  ------------------
  |  Branch (441:9): [True: 3.18k, False: 0]
  ------------------
  442|  3.18k|        if (!pageobj_to_pages_pos.insert(std::make_pair(og, pos)).second) {
  ------------------
  |  Branch (442:13): [True: 0, False: 3.18k]
  ------------------
  443|       |            // The library never calls insertPageobjToPage in a way that causes this to happen.
  444|      0|            throw QPDFExc(
  445|      0|                qpdf_e_pages,
  446|      0|                m->file->getName(),
  447|      0|                "page " + std::to_string(pos) + " (numbered from zero): object " + og.unparse(' '),
  448|      0|                0,
  449|      0|                "duplicate page reference found; this would cause loss of data");
  450|      0|        }
  451|  3.18k|    } else {
  452|      0|        pageobj_to_pages_pos[og] = pos;
  453|      0|    }
  454|  3.18k|}

_ZN5QUtil16double_to_stringEdib:
  355|  17.8k|{
  356|       |    // Backward compatibility -- this code used to use sprintf and treated decimal_places <= 0 to
  357|       |    // mean to use the default, which was six decimal places. Starting in 10.2, we trim trailing
  358|       |    // zeroes by default.
  359|  17.8k|    if (decimal_places <= 0) {
  ------------------
  |  Branch (359:9): [True: 17.8k, False: 0]
  ------------------
  360|  17.8k|        decimal_places = 6;
  361|  17.8k|    }
  362|  17.8k|    std::ostringstream buf;
  363|  17.8k|    buf.imbue(std::locale::classic());
  364|  17.8k|    buf << std::setprecision(decimal_places) << std::fixed << num;
  365|  17.8k|    std::string result = buf.str();
  366|  17.8k|    if (trim_trailing_zeroes) {
  ------------------
  |  Branch (366:9): [True: 17.8k, False: 0]
  ------------------
  367|   125k|        while ((result.length() > 1) && (result.back() == '0')) {
  ------------------
  |  Branch (367:16): [True: 125k, False: 0]
  |  Branch (367:41): [True: 107k, False: 17.8k]
  ------------------
  368|   107k|            result.pop_back();
  369|   107k|        }
  370|  17.8k|        if ((result.length() > 1) && (result.back() == '.')) {
  ------------------
  |  Branch (370:13): [True: 17.8k, False: 0]
  |  Branch (370:38): [True: 17.8k, False: 0]
  ------------------
  371|  17.8k|            result.pop_back();
  372|  17.8k|        }
  373|  17.8k|    }
  374|  17.8k|    return result;
  375|  17.8k|}
_ZN5QUtil12string_to_llEPKc:
  379|  7.98M|{
  380|  7.98M|    errno = 0;
  381|       |#ifdef _MSC_VER
  382|       |    long long result = _strtoi64(str, 0, 10);
  383|       |#else
  384|  7.98M|    long long result = strtoll(str, nullptr, 10);
  385|  7.98M|#endif
  386|  7.98M|    if (errno == ERANGE) {
  ------------------
  |  Branch (386:9): [True: 710, False: 7.98M]
  ------------------
  387|    710|        throw std::range_error(
  388|    710|            std::string("overflow/underflow converting ") + str + " to 64-bit integer");
  389|    710|    }
  390|  7.98M|    return result;
  391|  7.98M|}
_ZN5QUtil13string_to_intEPKc:
  395|   522k|{
  396|       |    // QIntC::to_int does range checking
  397|   522k|    return QIntC::to_int(string_to_ll(str));
  398|   522k|}
_ZN5QUtil21unsigned_char_pointerERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  447|   132k|{
  448|   132k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str.c_str()));
  449|   132k|}
_ZN5QUtil21unsigned_char_pointerEPKc:
  453|  5.03k|{
  454|  5.03k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str));
  455|  5.03k|}
_ZN5QUtil16make_unique_cstrERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  717|  5.03k|{
  718|  5.03k|    auto result = std::make_unique<char[]>(str.length() + 1);
  719|       |    // Use memcpy in case string contains nulls
  720|  5.03k|    result.get()[str.length()] = '\0';
  721|  5.03k|    memcpy(result.get(), str.c_str(), str.length());
  722|  5.03k|    return result;
  723|  5.03k|}
_ZN5QUtil7get_envERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPS6_:
  812|      1|{
  813|       |    // This was basically ripped out of wxWindows.
  814|       |#ifdef _WIN32
  815|       |# ifdef NO_GET_ENVIRONMENT
  816|       |    return false;
  817|       |# else
  818|       |    // first get the size of the buffer
  819|       |    DWORD len = ::GetEnvironmentVariable(var.c_str(), NULL, 0);
  820|       |    if (len == 0) {
  821|       |        // this means that there is no such variable
  822|       |        return false;
  823|       |    }
  824|       |
  825|       |    if (value) {
  826|       |        auto t = QUtil::make_shared_array<char>(len + 1);
  827|       |        ::GetEnvironmentVariable(var.c_str(), t.get(), len);
  828|       |        *value = t.get();
  829|       |    }
  830|       |
  831|       |    return true;
  832|       |# endif
  833|       |#else
  834|      1|    char* p = getenv(var.c_str());
  835|      1|    if (p == nullptr) {
  ------------------
  |  Branch (835:9): [True: 1, False: 0]
  ------------------
  836|      1|        return false;
  837|      1|    }
  838|      0|    if (value) {
  ------------------
  |  Branch (838:9): [True: 0, False: 0]
  ------------------
  839|      0|        *value = p;
  840|      0|    }
  841|       |
  842|      0|    return true;
  843|      1|#endif
  844|      1|}
_ZN5QUtil6toUTF8Em:
 1004|   207M|{
 1005|   207M|    std::string result;
 1006|       |
 1007|       |    // A UTF-8 encoding of a Unicode value is a single byte for Unicode values <= 127.  For larger
 1008|       |    // values, the first byte of the UTF-8 encoding has '1' as each of its n highest bits and '0'
 1009|       |    // for its (n+1)th highest bit where n is the total number of bytes required.  Subsequent bytes
 1010|       |    // start with '10' and have the remaining 6 bits free for encoding.  For example, an 11-bit
 1011|       |    // Unicode value can be stored in two bytes where the first is 110zzzzz, the second is 10zzzzzz,
 1012|       |    // and the z's represent the remaining bits.
 1013|       |
 1014|   207M|    if (uval > 0x7fffffff) {
  ------------------
  |  Branch (1014:9): [True: 0, False: 207M]
  ------------------
 1015|      0|        throw std::runtime_error("bounds error in QUtil::toUTF8");
 1016|   207M|    } else if (uval < 128) {
  ------------------
  |  Branch (1016:16): [True: 42.0M, False: 164M]
  ------------------
 1017|  42.0M|        result += static_cast<char>(uval);
 1018|   164M|    } else {
 1019|   164M|        unsigned char bytes[7];
 1020|   164M|        bytes[6] = '\0';
 1021|   164M|        unsigned char* cur_byte = &bytes[5];
 1022|       |
 1023|       |        // maximum value that will fit in the current number of bytes
 1024|   164M|        unsigned char maxval = 0x3f; // six bits
 1025|       |
 1026|   478M|        while (uval > QIntC::to_ulong(maxval)) {
  ------------------
  |  Branch (1026:16): [True: 313M, False: 164M]
  ------------------
 1027|       |            // Assign low six bits plus 10000000 to lowest unused byte position, then shift
 1028|   313M|            *cur_byte = static_cast<unsigned char>(0x80 + (uval & 0x3f));
 1029|   313M|            uval >>= 6;
 1030|       |            // Maximum that will fit in high byte now shrinks by one bit
 1031|   313M|            maxval = static_cast<unsigned char>(maxval >> 1);
 1032|       |            // Slide to the left one byte
 1033|   313M|            if (cur_byte <= bytes) {
  ------------------
  |  Branch (1033:17): [True: 0, False: 313M]
  ------------------
 1034|      0|                throw std::logic_error("QUtil::toUTF8: overflow error");
 1035|      0|            }
 1036|   313M|            --cur_byte;
 1037|   313M|        }
 1038|       |        // If maxval is k bits long, the high (7 - k) bits of the resulting byte must be high.
 1039|   164M|        *cur_byte = static_cast<unsigned char>(QIntC::to_ulong(0xff - (1 + (maxval << 1))) + uval);
 1040|       |
 1041|   164M|        result += reinterpret_cast<char*>(cur_byte);
 1042|   164M|    }
 1043|       |
 1044|   207M|    return result;
 1045|   207M|}
_ZN5QUtil7toUTF16Em:
 1049|  2.89M|{
 1050|  2.89M|    std::string result;
 1051|  2.89M|    if ((uval >= 0xd800) && (uval <= 0xdfff)) {
  ------------------
  |  Branch (1051:9): [True: 12.0k, False: 2.88M]
  |  Branch (1051:29): [True: 438, False: 11.6k]
  ------------------
 1052|    438|        result = "\xff\xfd";
 1053|  2.89M|    } else if (uval <= 0xffff) {
  ------------------
  |  Branch (1053:16): [True: 2.89M, False: 2.43k]
  ------------------
 1054|  2.89M|        char out[2];
 1055|  2.89M|        out[0] = static_cast<char>((uval & 0xff00) >> 8);
 1056|  2.89M|        out[1] = static_cast<char>(uval & 0xff);
 1057|  2.89M|        result = std::string(out, 2);
 1058|  2.89M|    } else if (uval <= 0x10ffff) {
  ------------------
  |  Branch (1058:16): [True: 1.40k, False: 1.03k]
  ------------------
 1059|  1.40k|        char out[4];
 1060|  1.40k|        uval -= 0x10000;
 1061|  1.40k|        unsigned short high = static_cast<unsigned short>(((uval & 0xffc00) >> 10) + 0xd800);
 1062|  1.40k|        unsigned short low = static_cast<unsigned short>((uval & 0x3ff) + 0xdc00);
 1063|  1.40k|        out[0] = static_cast<char>((high & 0xff00) >> 8);
 1064|  1.40k|        out[1] = static_cast<char>(high & 0xff);
 1065|  1.40k|        out[2] = static_cast<char>((low & 0xff00) >> 8);
 1066|  1.40k|        out[3] = static_cast<char>(low & 0xff);
 1067|  1.40k|        result = std::string(out, 4);
 1068|  1.40k|    } else {
 1069|  1.03k|        result = "\xff\xfd";
 1070|  1.03k|    }
 1071|       |
 1072|  2.89M|    return result;
 1073|  2.89M|}
_ZN5QUtil21getRandomDataProviderEv:
 1126|    319|{
 1127|    319|    return getRandomDataProviderProvider()->getProvider();
 1128|    319|}
_ZN5QUtil25initializeWithRandomBytesEPhm:
 1132|    319|{
 1133|    319|    getRandomDataProvider()->provideRandomData(data, len);
 1134|    319|}
_ZN5QUtil23get_next_utf8_codepointERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERmRb:
 1479|  45.9M|{
 1480|  45.9M|    auto o_pos = pos;
 1481|  45.9M|    size_t len = utf8_val.length();
 1482|  45.9M|    unsigned char ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1483|  45.9M|    error = false;
 1484|  45.9M|    if (ch < 128) {
  ------------------
  |  Branch (1484:9): [True: 4.91M, False: 41.0M]
  ------------------
 1485|  4.91M|        return static_cast<unsigned long>(ch);
 1486|  4.91M|    }
 1487|       |
 1488|  41.0M|    size_t bytes_needed = 0;
 1489|  41.0M|    unsigned bit_check = 0x40;
 1490|  41.0M|    unsigned char to_clear = 0x80;
 1491|  69.8M|    while (ch & bit_check) {
  ------------------
  |  Branch (1491:12): [True: 28.8M, False: 41.0M]
  ------------------
 1492|  28.8M|        ++bytes_needed;
 1493|  28.8M|        to_clear = static_cast<unsigned char>(to_clear | bit_check);
 1494|  28.8M|        bit_check >>= 1;
 1495|  28.8M|    }
 1496|  41.0M|    if (((bytes_needed > 5) || (bytes_needed < 1)) || ((pos + bytes_needed) > len)) {
  ------------------
  |  Branch (1496:10): [True: 159k, False: 40.8M]
  |  Branch (1496:32): [True: 25.7M, False: 15.1M]
  |  Branch (1496:55): [True: 424, False: 15.1M]
  ------------------
 1497|  25.8M|        error = true;
 1498|  25.8M|        return 0xfffd;
 1499|  25.8M|    }
 1500|       |
 1501|  15.1M|    auto codepoint = static_cast<unsigned long>(ch & ~to_clear);
 1502|  40.9M|    while (bytes_needed > 0) {
  ------------------
  |  Branch (1502:12): [True: 27.2M, False: 13.7M]
  ------------------
 1503|  27.2M|        --bytes_needed;
 1504|  27.2M|        ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1505|  27.2M|        if ((ch & 0xc0) != 0x80) {
  ------------------
  |  Branch (1505:13): [True: 1.37M, False: 25.8M]
  ------------------
 1506|  1.37M|            --pos;
 1507|  1.37M|            error = true;
 1508|  1.37M|            return 0xfffd;
 1509|  1.37M|        }
 1510|  25.8M|        codepoint <<= 6;
 1511|  25.8M|        codepoint += (ch & 0x3f);
 1512|  25.8M|    }
 1513|  13.7M|    unsigned long lower_bound = 0;
 1514|  13.7M|    switch (pos - o_pos) {
 1515|  1.71M|    case 2:
  ------------------
  |  Branch (1515:5): [True: 1.71M, False: 12.0M]
  ------------------
 1516|  1.71M|        lower_bound = 1 << 7;
 1517|  1.71M|        break;
 1518|  12.0M|    case 3:
  ------------------
  |  Branch (1518:5): [True: 12.0M, False: 1.72M]
  ------------------
 1519|  12.0M|        lower_bound = 1 << 11;
 1520|  12.0M|        break;
 1521|  3.72k|    case 4:
  ------------------
  |  Branch (1521:5): [True: 3.72k, False: 13.7M]
  ------------------
 1522|  3.72k|        lower_bound = 1 << 16;
 1523|  3.72k|        break;
 1524|    762|    case 5:
  ------------------
  |  Branch (1524:5): [True: 762, False: 13.7M]
  ------------------
 1525|    762|        lower_bound = 1 << 12;
 1526|    762|        break;
 1527|    428|    case 6:
  ------------------
  |  Branch (1527:5): [True: 428, False: 13.7M]
  ------------------
 1528|    428|        lower_bound = 1 << 26;
 1529|    428|        break;
 1530|      0|    default:
  ------------------
  |  Branch (1530:5): [True: 0, False: 13.7M]
  ------------------
 1531|      0|        lower_bound = 0;
 1532|  13.7M|    }
 1533|       |
 1534|  13.7M|    if (lower_bound > 0 && codepoint < lower_bound) {
  ------------------
  |  Branch (1534:9): [True: 13.7M, False: 0]
  |  Branch (1534:28): [True: 6.81k, False: 13.7M]
  ------------------
 1535|       |        // Too many bytes were used, but return whatever character was encoded.
 1536|  6.81k|        error = true;
 1537|  6.81k|    }
 1538|  13.7M|    return codepoint;
 1539|  13.7M|}
_ZN5QUtil13utf8_to_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1637|    712|{
 1638|    712|    return transcode_utf8(utf8, e_utf16, 0);
 1639|    712|}
_ZN5QUtil15utf8_to_pdf_docERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERS6_c:
 1685|  2.98k|{
 1686|  2.98k|    return transcode_utf8(utf8, pdfdoc, e_pdfdoc, unknown_char);
 1687|  2.98k|}
_ZN5QUtil8is_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1691|  45.6k|{
 1692|  45.6k|    return util::is_utf16(val);
 1693|  45.6k|}
_ZN5QUtil13utf16_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1703|  45.6k|{
 1704|  45.6k|    std::string result;
 1705|       |    // This code uses unsigned long and unsigned short to hold codepoint values. It requires
 1706|       |    // unsigned long to be at least 32 bits and unsigned short to be at least 16 bits, but it will
 1707|       |    // work fine if they are larger.
 1708|  45.6k|    unsigned long codepoint = 0L;
 1709|  45.6k|    size_t len = val.length();
 1710|  45.6k|    size_t start = 0;
 1711|  45.6k|    bool is_le = false;
 1712|  45.6k|    if (is_utf16(val)) {
  ------------------
  |  Branch (1712:9): [True: 45.6k, False: 0]
  ------------------
 1713|  45.6k|        if (static_cast<unsigned char>(val.at(0)) == 0xff) {
  ------------------
  |  Branch (1713:13): [True: 33.3k, False: 12.2k]
  ------------------
 1714|  33.3k|            is_le = true;
 1715|  33.3k|        }
 1716|  45.6k|        start += 2;
 1717|  45.6k|    }
 1718|       |    // If the string has an odd number of bytes, the last byte is ignored.
 1719|  16.3M|    for (size_t i = start; i + 1 < len; i += 2) {
  ------------------
  |  Branch (1719:28): [True: 16.3M, False: 45.6k]
  ------------------
 1720|       |        // Convert from UTF16-BE.  If we get a malformed codepoint, this code will generate
 1721|       |        // incorrect output without giving a warning.  Specifically, a high codepoint not followed
 1722|       |        // by a low codepoint will be discarded, and a low codepoint not preceded by a high
 1723|       |        // codepoint will just get its low 10 bits output.
 1724|  16.3M|        auto msb = is_le ? i + 1 : i;
  ------------------
  |  Branch (1724:20): [True: 1.16M, False: 15.1M]
  ------------------
 1725|  16.3M|        auto lsb = is_le ? i : i + 1;
  ------------------
  |  Branch (1725:20): [True: 1.16M, False: 15.1M]
  ------------------
 1726|  16.3M|        unsigned short bits = QIntC::to_ushort(
 1727|  16.3M|            (static_cast<unsigned char>(val.at(msb)) << 8) +
 1728|  16.3M|            static_cast<unsigned char>(val.at(lsb)));
 1729|  16.3M|        if ((bits & 0xFC00) == 0xD800) {
  ------------------
  |  Branch (1729:13): [True: 3.34k, False: 16.3M]
  ------------------
 1730|  3.34k|            codepoint = 0x10000U + ((bits & 0x3FFU) << 10U);
 1731|  3.34k|            continue;
 1732|  16.3M|        } else if ((bits & 0xFC00) == 0xDC00) {
  ------------------
  |  Branch (1732:20): [True: 5.08k, False: 16.3M]
  ------------------
 1733|  5.08k|            if (codepoint != 0) {
  ------------------
  |  Branch (1733:17): [True: 1.49k, False: 3.59k]
  ------------------
 1734|  1.49k|                QTC::TC("qpdf", "QUtil non-trivial UTF-16");
 1735|  1.49k|            }
 1736|  5.08k|            codepoint += bits & 0x3FF;
 1737|  16.3M|        } else {
 1738|  16.3M|            codepoint = bits;
 1739|  16.3M|        }
 1740|       |
 1741|  16.3M|        result += QUtil::toUTF8(codepoint);
 1742|  16.3M|        codepoint = 0;
 1743|  16.3M|    }
 1744|  45.6k|    return result;
 1745|  45.6k|}
_ZN5QUtil15pdf_doc_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1781|   678k|{
 1782|   678k|    std::string result;
 1783|   678k|    size_t len = val.length();
 1784|   191M|    for (unsigned int i = 0; i < len; ++i) {
  ------------------
  |  Branch (1784:30): [True: 190M, False: 678k]
  ------------------
 1785|   190M|        unsigned char ch = static_cast<unsigned char>(val.at(i));
 1786|   190M|        unsigned short ch_short = ch;
 1787|   190M|        if ((ch >= 127) && (ch <= 160)) {
  ------------------
  |  Branch (1787:13): [True: 152M, False: 38.5M]
  |  Branch (1787:28): [True: 137M, False: 14.6M]
  ------------------
 1788|   137M|            ch_short = pdf_doc_to_unicode[ch - 127];
 1789|   137M|        } else if ((ch >= 24) && (ch <= 31)) {
  ------------------
  |  Branch (1789:20): [True: 46.0M, False: 7.15M]
  |  Branch (1789:34): [True: 554k, False: 45.4M]
  ------------------
 1790|   554k|            ch_short = pdf_doc_low_to_unicode[ch - 24];
 1791|  52.6M|        } else if (ch == 173) {
  ------------------
  |  Branch (1791:20): [True: 15.1k, False: 52.6M]
  ------------------
 1792|  15.1k|            ch_short = 0xfffd;
 1793|  15.1k|        }
 1794|   190M|        result += QUtil::toUTF8(ch_short);
 1795|   190M|    }
 1796|   678k|    return result;
 1797|   678k|}
QUtil.cc:_ZL29getRandomDataProviderProviderv:
 1112|    319|{
 1113|       |    // Thread-safe static initializer
 1114|    319|    static RandomDataProviderProvider rdpp;
 1115|    319|    return &rdpp;
 1116|    319|}
QUtil.cc:_ZN12_GLOBAL__N_126RandomDataProviderProviderC2Ev:
 1093|      1|    default_provider(CryptoRandomDataProvider::getInstance())
 1094|      1|{
 1095|      1|    this->current_provider = default_provider;
 1096|      1|}
QUtil.cc:_ZN12_GLOBAL__N_126RandomDataProviderProvider11getProviderEv:
 1100|    319|{
 1101|    319|    return this->current_provider;
 1102|    319|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE10encoding_ec:
 1629|    712|{
 1630|    712|    std::string result;
 1631|    712|    transcode_utf8(utf8_val, result, encoding, unknown);
 1632|    712|    return result;
 1633|    712|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERS5_10encoding_ec:
 1543|  3.69k|{
 1544|  3.69k|    bool okay = true;
 1545|  3.69k|    result.clear();
 1546|  3.69k|    size_t len = utf8_val.length();
 1547|  3.69k|    switch (encoding) {
 1548|    712|    case e_utf16:
  ------------------
  |  Branch (1548:5): [True: 712, False: 2.98k]
  ------------------
 1549|    712|        result += "\xfe\xff";
 1550|    712|        break;
 1551|  2.98k|    case e_pdfdoc:
  ------------------
  |  Branch (1551:5): [True: 2.98k, False: 712]
  ------------------
 1552|       |        // We need to avoid having the result start with something that will be interpreted as
 1553|       |        // UTF-16 or UTF-8, meaning we can't end up with a string that starts with "fe ff",
 1554|       |        // (UTF-16-BE) "ff fe" (UTF-16-LE, not officially part of the PDF spec, but recognized by
 1555|       |        // most readers including qpdf), or "ef bb bf" (UTF-8). It's more efficient to check the
 1556|       |        // input string to see if it will map to one of those sequences than to check the output
 1557|       |        // string since all cases start with the same starting character.
 1558|  2.98k|        if ((len >= 4) && (utf8_val[0] == '\xc3')) {
  ------------------
  |  Branch (1558:13): [True: 2.35k, False: 629]
  |  Branch (1558:27): [True: 1.25k, False: 1.09k]
  ------------------
 1559|  1.25k|            static std::string fe_ff("\xbe\xc3\xbf");
 1560|  1.25k|            static std::string ff_fe("\xbf\xc3\xbe");
 1561|  1.25k|            static std::string ef_bb_bf("\xaf\xc2\xbb\xc2\xbf");
 1562|       |            // C++-20 has starts_with, but when this was written, qpdf had a minimum supported
 1563|       |            // version of C++-17.
 1564|  1.25k|            if ((utf8_val.compare(1, 3, fe_ff) == 0) || (utf8_val.compare(1, 3, ff_fe) == 0) ||
  ------------------
  |  Branch (1564:17): [True: 23, False: 1.23k]
  |  Branch (1564:57): [True: 25, False: 1.20k]
  ------------------
 1565|  1.20k|                (utf8_val.compare(1, 5, ef_bb_bf) == 0)) {
  ------------------
  |  Branch (1565:17): [True: 40, False: 1.16k]
  ------------------
 1566|     88|                result += unknown;
 1567|     88|                okay = false;
 1568|     88|            }
 1569|  1.25k|        }
 1570|  2.98k|        break;
 1571|      0|    default:
  ------------------
  |  Branch (1571:5): [True: 0, False: 3.69k]
  ------------------
 1572|      0|        break;
 1573|  3.69k|    }
 1574|  3.69k|    size_t pos = 0;
 1575|  45.9M|    while (pos < len) {
  ------------------
  |  Branch (1575:12): [True: 45.9M, False: 3.69k]
  ------------------
 1576|  45.9M|        bool error = false;
 1577|  45.9M|        unsigned long codepoint = QUtil::get_next_utf8_codepoint(utf8_val, pos, error);
 1578|  45.9M|        if (error) {
  ------------------
  |  Branch (1578:13): [True: 27.2M, False: 18.6M]
  ------------------
 1579|  27.2M|            okay = false;
 1580|  27.2M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1580:17): [True: 13.6M, False: 13.6M]
  ------------------
 1581|  13.6M|                result += "\xff\xfd";
 1582|  13.6M|            } else {
 1583|  13.6M|                result.append(1, unknown);
 1584|  13.6M|            }
 1585|  27.2M|        } else if (codepoint < 128) {
  ------------------
  |  Branch (1585:20): [True: 4.91M, False: 13.7M]
  ------------------
 1586|  4.91M|            char ch = static_cast<char>(codepoint);
 1587|  4.91M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1587:17): [True: 1.85M, False: 3.06M]
  ------------------
 1588|  1.85M|                result += QUtil::toUTF16(QIntC::to_ulong(ch));
 1589|  3.06M|            } else if ((encoding == e_pdfdoc) && (((ch >= 0x18) && (ch <= 0x1f)) || (ch == 127))) {
  ------------------
  |  Branch (1589:24): [True: 3.06M, False: 0]
  |  Branch (1589:52): [True: 2.45M, False: 607k]
  |  Branch (1589:68): [True: 51.9k, False: 2.40M]
  |  Branch (1589:85): [True: 9.64k, False: 3.00M]
  ------------------
 1590|       |                // PDFDocEncoding maps some low characters to Unicode, so if we encounter those
 1591|       |                // invalid UTF-8 code points, map them to unknown so reversing the mapping doesn't
 1592|       |                // change them into other characters.
 1593|  61.6k|                okay = false;
 1594|  61.6k|                result.append(1, unknown);
 1595|  3.00M|            } else {
 1596|  3.00M|                result.append(1, ch);
 1597|  3.00M|            }
 1598|  13.7M|        } else if (encoding == e_utf16) {
  ------------------
  |  Branch (1598:20): [True: 1.04M, False: 12.6M]
  ------------------
 1599|  1.04M|            result += QUtil::toUTF16(codepoint);
 1600|  12.6M|        } else if ((codepoint == 0xad) && (encoding == e_pdfdoc)) {
  ------------------
  |  Branch (1600:20): [True: 230, False: 12.6M]
  |  Branch (1600:43): [True: 230, False: 0]
  ------------------
 1601|       |            // PDFDocEncoding omits 0x00ad (soft hyphen).
 1602|    230|            okay = false;
 1603|    230|            result.append(1, unknown);
 1604|  12.6M|        } else if (
 1605|  12.6M|            (codepoint > 160) && (codepoint < 256) &&
  ------------------
  |  Branch (1605:13): [True: 12.6M, False: 934]
  |  Branch (1605:34): [True: 1.40M, False: 11.2M]
  ------------------
 1606|  1.40M|            ((encoding == e_winansi) || (encoding == e_pdfdoc))) {
  ------------------
  |  Branch (1606:14): [True: 0, False: 1.40M]
  |  Branch (1606:41): [True: 1.40M, False: 0]
  ------------------
 1607|  1.40M|            result.append(1, static_cast<char>(codepoint & 0xff));
 1608|  11.2M|        } else {
 1609|  11.2M|            unsigned char ch = '\0';
 1610|  11.2M|            if (encoding == e_winansi) {
  ------------------
  |  Branch (1610:17): [True: 0, False: 11.2M]
  ------------------
 1611|      0|                ch = encode_winansi(codepoint);
 1612|  11.2M|            } else if (encoding == e_macroman) {
  ------------------
  |  Branch (1612:24): [True: 0, False: 11.2M]
  ------------------
 1613|      0|                ch = encode_macroman(codepoint);
 1614|  11.2M|            } else if (encoding == e_pdfdoc) {
  ------------------
  |  Branch (1614:24): [True: 11.2M, False: 0]
  ------------------
 1615|  11.2M|                ch = encode_pdfdoc(codepoint);
 1616|  11.2M|            }
 1617|  11.2M|            if (ch == '\0') {
  ------------------
  |  Branch (1617:17): [True: 1.03M, False: 10.2M]
  ------------------
 1618|  1.03M|                okay = false;
 1619|  1.03M|                ch = static_cast<unsigned char>(unknown);
 1620|  1.03M|            }
 1621|  11.2M|            result.append(1, static_cast<char>(ch));
 1622|  11.2M|        }
 1623|  45.9M|    }
 1624|  3.69k|    return okay;
 1625|  3.69k|}
QUtil.cc:_ZL13encode_pdfdocm:
 1469|  11.2M|{
 1470|  11.2M|    auto i = unicode_to_pdf_doc.find(codepoint);
 1471|  11.2M|    if (i != unicode_to_pdf_doc.end()) {
  ------------------
  |  Branch (1471:9): [True: 10.2M, False: 1.03M]
  ------------------
 1472|  10.2M|        return i->second;
 1473|  10.2M|    }
 1474|  1.03M|    return '\0';
 1475|  11.2M|}

_ZN3RC4C2EPKhi:
    6|  36.6k|    crypto(QPDFCryptoProvider::getImpl())
    7|  36.6k|{
    8|  36.6k|    crypto->RC4_init(key_data, key_len);
    9|  36.6k|}
_ZN3RC47processEPKhmPh:
   13|  36.6k|{
   14|  36.6k|    crypto->RC4_process(in_data, len, out_data);
   15|  36.6k|}
_ZN3RC47processENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEERNS0_12basic_stringIcS3_NS0_9allocatorIcEEEE:
   19|  31.3k|{
   20|  31.3k|    RC4 rc4(reinterpret_cast<unsigned char const*>(key.data()), static_cast<int>(key.size()));
   21|  31.3k|    rc4.process(
   22|  31.3k|        reinterpret_cast<unsigned char const*>(data.data()),
   23|  31.3k|        data.size(),
   24|  31.3k|        reinterpret_cast<unsigned char*>(data.data()));
   25|  31.3k|}

_ZN10RC4_nativeC2EPKhi:
   18|  36.6k|{
   19|  36.6k|    if (key_len == -1) {
  ------------------
  |  Branch (19:9): [True: 0, False: 36.6k]
  ------------------
   20|      0|        key_len = QIntC::to_int(strlen(reinterpret_cast<char const*>(key_data)));
   21|      0|    }
   22|       |
   23|  9.41M|    for (int i = 0; i < 256; ++i) {
  ------------------
  |  Branch (23:21): [True: 9.38M, False: 36.6k]
  ------------------
   24|  9.38M|        key.state[i] = static_cast<unsigned char>(i);
   25|  9.38M|    }
   26|  36.6k|    key.x = 0;
   27|  36.6k|    key.y = 0;
   28|       |
   29|  36.6k|    int i1 = 0;
   30|  36.6k|    int i2 = 0;
   31|  9.41M|    for (int i = 0; i < 256; ++i) {
  ------------------
  |  Branch (31:21): [True: 9.38M, False: 36.6k]
  ------------------
   32|  9.38M|        i2 = (key_data[i1] + key.state[i] + i2) % 256;
   33|  9.38M|        swap_byte(key.state[i], key.state[i2]);
   34|  9.38M|        i1 = (i1 + 1) % key_len;
   35|  9.38M|    }
   36|  36.6k|}
_ZN10RC4_native7processEPKhmPh:
   40|  36.6k|{
   41|  8.61M|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (41:24): [True: 8.57M, False: 36.6k]
  ------------------
   42|  8.57M|        key.x = static_cast<unsigned char>((key.x + 1) % 256);
   43|  8.57M|        key.y = static_cast<unsigned char>((key.state[key.x] + key.y) % 256);
   44|  8.57M|        swap_byte(key.state[key.x], key.state[key.y]);
   45|  8.57M|        int xor_index = (key.state[key.x] + key.state[key.y]) % 256;
   46|  8.57M|        out_data[i] = in_data[i] ^ key.state[xor_index];
   47|  8.57M|    }
   48|  36.6k|}
RC4_native.cc:_ZL9swap_byteRhS_:
    9|  17.9M|{
   10|  17.9M|    unsigned char t;
   11|       |
   12|  17.9M|    t = a;
   13|  17.9M|    a = b;
   14|  17.9M|    b = t;
   15|  17.9M|}

_ZN17SF_FlateLzwDecode14setDecodeParmsE16QPDFObjectHandle:
   13|  9.28k|{
   14|  9.28k|    if (decode_parms.null()) {
  ------------------
  |  Branch (14:9): [True: 4.20k, False: 5.08k]
  ------------------
   15|  4.20k|        return true;
   16|  4.20k|    }
   17|       |
   18|  5.08k|    auto memory_limit = Pl_Flate::memory_limit();
   19|       |
   20|  5.08k|    std::set<std::string> keys = decode_parms.getKeys();
   21|  11.6k|    for (auto const& key: keys) {
  ------------------
  |  Branch (21:25): [True: 11.6k, False: 4.97k]
  ------------------
   22|  11.6k|        QPDFObjectHandle value = decode_parms.getKey(key);
   23|  11.6k|        if (key == "/Predictor") {
  ------------------
  |  Branch (23:13): [True: 3.05k, False: 8.59k]
  ------------------
   24|  3.05k|            if (value.isInteger()) {
  ------------------
  |  Branch (24:17): [True: 3.05k, False: 3]
  ------------------
   25|  3.05k|                predictor = value.getIntValueAsInt();
   26|  3.05k|                if (!(predictor == 1 || predictor == 2 || (predictor >= 10 && predictor <= 15))) {
  ------------------
  |  Branch (26:23): [True: 69, False: 2.98k]
  |  Branch (26:41): [True: 898, False: 2.08k]
  |  Branch (26:60): [True: 2.05k, False: 37]
  |  Branch (26:79): [True: 2.02k, False: 21]
  ------------------
   27|     58|                    return false;
   28|     58|                }
   29|  3.05k|            } else {
   30|      3|                return false;
   31|      3|            }
   32|  8.59k|        } else if (key == "/Columns" || key == "/Colors" || key == "/BitsPerComponent") {
  ------------------
  |  Branch (32:20): [True: 1.82k, False: 6.77k]
  |  Branch (32:41): [True: 600, False: 6.17k]
  |  Branch (32:61): [True: 539, False: 5.63k]
  ------------------
   33|  2.96k|            if (value.isInteger()) {
  ------------------
  |  Branch (33:17): [True: 2.96k, False: 3]
  ------------------
   34|  2.96k|                int val = value.getIntValueAsInt();
   35|  2.96k|                if (memory_limit && static_cast<unsigned int>(val) > memory_limit) {
  ------------------
  |  Branch (35:21): [True: 2.96k, False: 1]
  |  Branch (35:37): [True: 15, False: 2.94k]
  ------------------
   36|     15|                    QPDFLogger::defaultLogger()->warn(
   37|     15|                        "SF_FlateLzwDecode parameter exceeds PL_Flate memory limit\n");
   38|     15|                    return false;
   39|     15|                }
   40|  2.94k|                if (key == "/Columns") {
  ------------------
  |  Branch (40:21): [True: 1.81k, False: 1.13k]
  ------------------
   41|  1.81k|                    columns = val;
   42|  1.81k|                } else if (key == "/Colors") {
  ------------------
  |  Branch (42:28): [True: 599, False: 536]
  ------------------
   43|    599|                    colors = val;
   44|    599|                } else if (key == "/BitsPerComponent") {
  ------------------
  |  Branch (44:28): [True: 535, False: 1]
  ------------------
   45|    535|                    bits_per_component = val;
   46|    535|                }
   47|  2.94k|            } else {
   48|      3|                return false;
   49|      3|            }
   50|  5.63k|        } else if (lzw && (key == "/EarlyChange")) {
  ------------------
  |  Branch (50:20): [True: 5.05k, False: 580]
  |  Branch (50:27): [True: 168, False: 4.88k]
  ------------------
   51|    168|            if (value.isInteger()) {
  ------------------
  |  Branch (51:17): [True: 165, False: 3]
  ------------------
   52|    165|                int earlychange = value.getIntValueAsInt();
   53|    165|                early_code_change = (earlychange == 1);
   54|    165|                if (!(earlychange == 0 || earlychange == 1)) {
  ------------------
  |  Branch (54:23): [True: 66, False: 99]
  |  Branch (54:43): [True: 68, False: 31]
  ------------------
   55|     31|                    return false;
   56|     31|                }
   57|    165|            } else {
   58|      3|                return false;
   59|      3|            }
   60|    168|        }
   61|  11.6k|    }
   62|       |
   63|  4.97k|    if (predictor > 1 && columns == 0) {
  ------------------
  |  Branch (63:9): [True: 2.92k, False: 2.04k]
  |  Branch (63:26): [True: 3, False: 2.92k]
  ------------------
   64|      3|        return false;
   65|      3|    }
   66|       |
   67|  4.97k|    return true;
   68|  4.97k|}
_ZN17SF_FlateLzwDecode17getDecodePipelineEP8Pipeline:
   72|  9.07k|{
   73|  9.07k|    std::unique_ptr<Pipeline> pipeline;
   74|  9.07k|    if (predictor >= 10 && predictor <= 15) {
  ------------------
  |  Branch (74:9): [True: 1.98k, False: 7.08k]
  |  Branch (74:28): [True: 1.98k, False: 0]
  ------------------
   75|  1.98k|        QTC::TC("qpdf", "SF_FlateLzwDecode PNG filter");
   76|  1.98k|        pipeline = std::make_unique<Pl_PNGFilter>(
   77|  1.98k|            "png decode",
   78|  1.98k|            next,
   79|  1.98k|            Pl_PNGFilter::a_decode,
   80|  1.98k|            QIntC::to_uint(columns),
   81|  1.98k|            QIntC::to_uint(colors),
   82|  1.98k|            QIntC::to_uint(bits_per_component));
   83|  1.98k|        next = pipeline.get();
   84|  1.98k|        pipelines.push_back(std::move(pipeline));
   85|  7.08k|    } else if (predictor == 2) {
  ------------------
  |  Branch (85:16): [True: 852, False: 6.23k]
  ------------------
   86|    852|        QTC::TC("qpdf", "SF_FlateLzwDecode TIFF predictor");
   87|    852|        pipeline = std::make_unique<Pl_TIFFPredictor>(
   88|    852|            "tiff decode",
   89|    852|            next,
   90|    852|            Pl_TIFFPredictor::a_decode,
   91|    852|            QIntC::to_uint(columns),
   92|    852|            QIntC::to_uint(colors),
   93|    852|            QIntC::to_uint(bits_per_component));
   94|    852|        next = pipeline.get();
   95|    852|        pipelines.push_back(std::move(pipeline));
   96|    852|    }
   97|       |
   98|  9.07k|    if (lzw) {
  ------------------
  |  Branch (98:9): [True: 3.47k, False: 5.59k]
  ------------------
   99|  3.47k|        pipeline = std::make_unique<Pl_LZWDecoder>("lzw decode", next, early_code_change);
  100|  5.59k|    } else {
  101|  5.59k|        pipeline = std::make_unique<Pl_Flate>("stream inflate", next, Pl_Flate::a_inflate);
  102|  5.59k|    }
  103|  9.07k|    next = pipeline.get();
  104|  9.07k|    pipelines.push_back(std::move(pipeline));
  105|  9.07k|    return next;
  106|  9.07k|}

_ZN11SHA2_nativeC2Ei:
    8|   129k|    bits(bits)
    9|   129k|{
   10|   129k|    switch (bits) {
   11|  45.1k|    case 256:
  ------------------
  |  Branch (11:5): [True: 45.1k, False: 84.4k]
  ------------------
   12|  45.1k|        sph_sha256_init(&ctx256);
   13|  45.1k|        break;
   14|  41.5k|    case 384:
  ------------------
  |  Branch (14:5): [True: 41.5k, False: 88.0k]
  ------------------
   15|  41.5k|        sph_sha384_init(&ctx384);
   16|  41.5k|        break;
   17|  42.9k|    case 512:
  ------------------
  |  Branch (17:5): [True: 42.9k, False: 86.6k]
  ------------------
   18|  42.9k|        sph_sha512_init(&ctx512);
   19|  42.9k|        break;
   20|      0|    default:
  ------------------
  |  Branch (20:5): [True: 0, False: 129k]
  ------------------
   21|      0|        badBits();
   22|      0|        break;
   23|   129k|    }
   24|   129k|}
_ZN11SHA2_native6updateEPKhm:
   34|   130k|{
   35|   130k|    switch (bits) {
   36|  45.9k|    case 256:
  ------------------
  |  Branch (36:5): [True: 45.9k, False: 84.4k]
  ------------------
   37|  45.9k|        sph_sha256(&ctx256, buf, len);
  ------------------
  |  |  169|  45.9k|#define sph_sha256   sph_sha224
  ------------------
   38|  45.9k|        break;
   39|  41.5k|    case 384:
  ------------------
  |  Branch (39:5): [True: 41.5k, False: 88.8k]
  ------------------
   40|  41.5k|        sph_sha384(&ctx384, buf, len);
   41|  41.5k|        break;
   42|  42.9k|    case 512:
  ------------------
  |  Branch (42:5): [True: 42.9k, False: 87.4k]
  ------------------
   43|  42.9k|        sph_sha512(&ctx512, buf, len);
  ------------------
  |  |  329|  42.9k|#define sph_sha512   sph_sha384
  ------------------
   44|  42.9k|        break;
   45|      0|    default:
  ------------------
  |  Branch (45:5): [True: 0, False: 130k]
  ------------------
   46|      0|        badBits();
   47|      0|        break;
   48|   130k|    }
   49|   130k|}
_ZN11SHA2_native8finalizeEv:
   53|   129k|{
   54|   129k|    switch (bits) {
   55|  45.1k|    case 256:
  ------------------
  |  Branch (55:5): [True: 45.1k, False: 84.4k]
  ------------------
   56|  45.1k|        sph_sha256_close(&ctx256, sha256sum);
   57|  45.1k|        break;
   58|  41.5k|    case 384:
  ------------------
  |  Branch (58:5): [True: 41.5k, False: 88.0k]
  ------------------
   59|  41.5k|        sph_sha384_close(&ctx384, sha384sum);
   60|  41.5k|        break;
   61|  42.9k|    case 512:
  ------------------
  |  Branch (61:5): [True: 42.9k, False: 86.6k]
  ------------------
   62|  42.9k|        sph_sha512_close(&ctx512, sha512sum);
   63|  42.9k|        break;
   64|      0|    default:
  ------------------
  |  Branch (64:5): [True: 0, False: 129k]
  ------------------
   65|      0|        badBits();
   66|      0|        break;
   67|   129k|    }
   68|   129k|}
_ZN11SHA2_native12getRawDigestEv:
   72|   129k|{
   73|   129k|    std::string result;
   74|   129k|    switch (bits) {
   75|  45.1k|    case 256:
  ------------------
  |  Branch (75:5): [True: 45.1k, False: 84.4k]
  ------------------
   76|  45.1k|        result = std::string(reinterpret_cast<char*>(sha256sum), sizeof(sha256sum));
   77|  45.1k|        break;
   78|  41.5k|    case 384:
  ------------------
  |  Branch (78:5): [True: 41.5k, False: 88.0k]
  ------------------
   79|  41.5k|        result = std::string(reinterpret_cast<char*>(sha384sum), sizeof(sha384sum));
   80|  41.5k|        break;
   81|  42.9k|    case 512:
  ------------------
  |  Branch (81:5): [True: 42.9k, False: 86.6k]
  ------------------
   82|  42.9k|        result = std::string(reinterpret_cast<char*>(sha512sum), sizeof(sha512sum));
   83|  42.9k|        break;
   84|      0|    default:
  ------------------
  |  Branch (84:5): [True: 0, False: 129k]
  ------------------
   85|      0|        badBits();
   86|      0|        break;
   87|   129k|    }
   88|   129k|    return result;
   89|   129k|}

_ZN24SecureRandomDataProvider17provideRandomDataEPhm:
   81|    319|{
   82|       |# if defined(_WIN32)
   83|       |
   84|       |    // Optimization: make the WindowsCryptProvider static as long as
   85|       |    // it can be done in a thread-safe fashion.
   86|       |    WindowsCryptProvider c;
   87|       |    if (!CryptGenRandom(c.crypt_prov, static_cast<DWORD>(len), reinterpret_cast<BYTE*>(data))) {
   88|       |        throw std::runtime_error("unable to generate secure random data");
   89|       |    }
   90|       |
   91|       |# else
   92|    319|    static std::unique_ptr<QUtil::FileCloser> random_device = []() {
   93|    319|        FILE* f = fopen("/dev/urandom", "rb");
   94|    319|        if (f == nullptr) {
   95|    319|            f = fopen("/dev/arandom", "rb");
   96|    319|        }
   97|    319|        if (f == nullptr) {
   98|    319|            f = fopen("/dev/random", "rb");
   99|    319|        }
  100|    319|        if (f == nullptr) {
  101|    319|            throw std::runtime_error("unable to find device in /dev for generating random numbers");
  102|    319|        }
  103|    319|        return std::make_unique<QUtil::FileCloser>(f);
  104|    319|    }();
  105|       |
  106|    319|    size_t fr = fread(data, 1, len, random_device->f);
  107|    319|    if (fr != len) {
  ------------------
  |  Branch (107:9): [True: 0, False: 319]
  ------------------
  108|      0|        throw std::runtime_error(
  109|      0|            "unable to read " + std::to_string(len) + " bytes from random number device");
  110|      0|    }
  111|       |
  112|    319|# endif
  113|    319|}
_ZN24SecureRandomDataProvider11getInstanceEv:
  117|      1|{
  118|      1|    static SecureRandomDataProvider instance;
  119|      1|    return &instance;
  120|      1|}
SecureRandomDataProvider.cc:_ZZN24SecureRandomDataProvider17provideRandomDataEPhmENK3$_0clEv:
   92|      1|    static std::unique_ptr<QUtil::FileCloser> random_device = []() {
   93|      1|        FILE* f = fopen("/dev/urandom", "rb");
   94|      1|        if (f == nullptr) {
  ------------------
  |  Branch (94:13): [True: 0, False: 1]
  ------------------
   95|      0|            f = fopen("/dev/arandom", "rb");
   96|      0|        }
   97|      1|        if (f == nullptr) {
  ------------------
  |  Branch (97:13): [True: 0, False: 1]
  ------------------
   98|      0|            f = fopen("/dev/random", "rb");
   99|      0|        }
  100|      1|        if (f == nullptr) {
  ------------------
  |  Branch (100:13): [True: 0, False: 1]
  ------------------
  101|      0|            throw std::runtime_error("unable to find device in /dev for generating random numbers");
  102|      0|        }
  103|      1|        return std::make_unique<QUtil::FileCloser>(f);
  104|      1|    }();

_ZN4qpdf6global7Options9fuzz_modeEb:
   13|  20.8k|{
   14|  20.8k|    if (value) {
  ------------------
  |  Branch (14:9): [True: 20.8k, False: 0]
  ------------------
   15|  20.8k|        o.fuzz_mode_ = true;
   16|       |        // Limit the memory used to decompress JPEG files during fuzzing. Excessive memory use
   17|       |        // during fuzzing is due to corrupt JPEG data which sometimes cannot be detected before
   18|       |        // jpeg_start_decompress is called. During normal use of qpdf very large JPEGs can
   19|       |        // occasionally occur legitimately and therefore must be allowed during normal operations.
   20|  20.8k|        Limits::dct_max_memory(10'000'000);
   21|  20.8k|        Limits::dct_max_progressive_scans(50);
   22|       |        // Do not decompress corrupt data. This may cause extended runtime within jpeglib without
   23|       |        // exercising additional code paths in qpdf.
   24|  20.8k|        dct_throw_on_corrupt_data(true);
   25|  20.8k|        Limits::png_max_memory(1'000'000);
   26|  20.8k|        Limits::flate_max_memory(200'000);
   27|  20.8k|        Limits::run_length_max_memory(1'000'000);
   28|  20.8k|        Limits::tiff_max_memory(1'000'000);
   29|       |        // Set a reasonable default maximum warnings per document for fuzzing to avoid time-outs due
   30|       |        // to extensive recovery efforts.
   31|  20.8k|        Limits::doc_max_warnings(200);
   32|  20.8k|    }
   33|  20.8k|}
qpdf_global_set_uint32:
  129|  20.8k|{
  130|  20.8k|    switch (param) {
  131|      0|    case qpdf_p_inspection_mode:
  ------------------
  |  Branch (131:5): [True: 0, False: 20.8k]
  ------------------
  132|      0|        Options::inspection_mode(value);
  133|      0|        return qpdf_r_ok;
  134|  20.8k|    case qpdf_p_fuzz_mode:
  ------------------
  |  Branch (134:5): [True: 20.8k, False: 0]
  ------------------
  135|  20.8k|        Options::fuzz_mode(value);
  136|  20.8k|        return qpdf_r_ok;
  137|      0|    case qpdf_p_default_limits:
  ------------------
  |  Branch (137:5): [True: 0, False: 20.8k]
  ------------------
  138|      0|        Options::default_limits(value);
  139|      0|        return qpdf_r_ok;
  140|      0|    case qpdf_p_dct_throw_on_corrupt_data:
  ------------------
  |  Branch (140:5): [True: 0, False: 20.8k]
  ------------------
  141|      0|        Options::dct_throw_on_corrupt_data(value);
  142|      0|        return qpdf_r_ok;
  143|      0|    case qpdf_p_doc_max_warnings:
  ------------------
  |  Branch (143:5): [True: 0, False: 20.8k]
  ------------------
  144|      0|        Limits::doc_max_warnings(value);
  145|      0|        return qpdf_r_ok;
  146|      0|    case qpdf_p_parser_max_nesting:
  ------------------
  |  Branch (146:5): [True: 0, False: 20.8k]
  ------------------
  147|      0|        Limits::parser_max_nesting(value);
  148|      0|        return qpdf_r_ok;
  149|      0|    case qpdf_p_parser_max_errors:
  ------------------
  |  Branch (149:5): [True: 0, False: 20.8k]
  ------------------
  150|      0|        Limits::parser_max_errors(value);
  151|      0|        return qpdf_r_ok;
  152|      0|    case qpdf_p_parser_max_container_size:
  ------------------
  |  Branch (152:5): [True: 0, False: 20.8k]
  ------------------
  153|      0|        Limits::parser_max_container_size(false, value);
  154|      0|        return qpdf_r_ok;
  155|      0|    case qpdf_p_parser_max_container_size_damaged:
  ------------------
  |  Branch (155:5): [True: 0, False: 20.8k]
  ------------------
  156|      0|        Limits::parser_max_container_size(true, value);
  157|      0|        return qpdf_r_ok;
  158|      0|    case qpdf_p_max_stream_filters:
  ------------------
  |  Branch (158:5): [True: 0, False: 20.8k]
  ------------------
  159|      0|        Limits::max_stream_filters(value);
  160|      0|        return qpdf_r_ok;
  161|      0|    case qpdf_p_dct_max_memory:
  ------------------
  |  Branch (161:5): [True: 0, False: 20.8k]
  ------------------
  162|      0|        Limits::dct_max_memory(util::fits<long>(value) ? static_cast<long>(value) : 0);
  ------------------
  |  Branch (162:32): [True: 0, False: 0]
  ------------------
  163|      0|        return qpdf_r_ok;
  164|      0|    case qpdf_p_dct_max_progressive_scans:
  ------------------
  |  Branch (164:5): [True: 0, False: 20.8k]
  ------------------
  165|      0|        Limits::dct_max_progressive_scans(util::fits<int>(value) ? static_cast<int>(value) : 0);
  ------------------
  |  Branch (165:43): [True: 0, False: 0]
  ------------------
  166|      0|        return qpdf_r_ok;
  167|      0|    case qpdf_p_flate_max_memory:
  ------------------
  |  Branch (167:5): [True: 0, False: 20.8k]
  ------------------
  168|      0|        Limits::flate_max_memory(value);
  169|      0|        return qpdf_r_ok;
  170|      0|    case qpdf_p_png_max_memory:
  ------------------
  |  Branch (170:5): [True: 0, False: 20.8k]
  ------------------
  171|      0|        Limits::png_max_memory(value);
  172|      0|        return qpdf_r_ok;
  173|      0|    case qpdf_p_run_length_max_memory:
  ------------------
  |  Branch (173:5): [True: 0, False: 20.8k]
  ------------------
  174|      0|        Limits::run_length_max_memory(value);
  175|      0|        return qpdf_r_ok;
  176|      0|    case qpdf_p_tiff_max_memory:
  ------------------
  |  Branch (176:5): [True: 0, False: 20.8k]
  ------------------
  177|      0|        Limits::tiff_max_memory(value);
  178|      0|        return qpdf_r_ok;
  179|      0|    default:
  ------------------
  |  Branch (179:5): [True: 0, False: 20.8k]
  ------------------
  180|      0|        return qpdf_r_bad_parameter;
  181|  20.8k|    }
  182|  20.8k|}

_ZN14AES_PDF_nativeD2Ev:
   18|   138k|    ~AES_PDF_native() = default;

_ZN17ContentNormalizerC2Ev:
    9|  10.9k|    ContentNormalizer() = default;
_ZNK17ContentNormalizer12anyBadTokensEv:
   15|  8.33k|    {
   16|  8.33k|        return any_bad_tokens;
   17|  8.33k|    }

_ZNK4qpdf2is12OffsetBuffer7getNameEv:
   48|   818k|        {
   49|   818k|            return description;
   50|   818k|        }
_ZN4qpdf2is12OffsetBuffer4tellEv:
   54|  27.0M|        {
   55|  27.0M|            return pos + global_offset;
   56|  27.0M|        }
_ZN4qpdf2is12OffsetBuffer8unreadChEc:
   70|  23.1k|        {
   71|  23.1k|            if (pos > 0) {
  ------------------
  |  Branch (71:17): [True: 23.1k, False: 0]
  ------------------
   72|  23.1k|                --pos;
   73|  23.1k|            }
   74|  23.1k|        }
_ZN4qpdf2is12OffsetBufferD2Ev:
   42|  47.1k|        ~OffsetBuffer() final = default;
_ZN4qpdf2is12OffsetBufferC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_17basic_string_viewIcS5_EEx:
   21|  47.1k|            description(description),
   22|  47.1k|            view_(view),
   23|  47.1k|            global_offset(global_offset)
   24|  47.1k|        {
   25|  47.1k|            if (global_offset < 0) {
  ------------------
  |  Branch (25:17): [True: 44, False: 47.1k]
  ------------------
   26|     44|                throw std::logic_error("is::OffsetBuffer constructed with negative offset");
   27|     44|            }
   28|  47.1k|            last_offset = global_offset;
   29|  47.1k|        }
_ZN11InputSource4readERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   87|  21.8k|{
   88|  21.8k|    if (at >= 0) {
  ------------------
  |  Branch (88:9): [True: 10.8k, False: 10.9k]
  ------------------
   89|       |        seek(at, SEEK_SET);
   90|  10.8k|    }
   91|  21.8k|    str.resize(count);
   92|  21.8k|    str.resize(read(str.data(), count));
   93|  21.8k|    return str.size();
   94|  21.8k|}
_ZN11InputSource4readEmx:
   98|  10.8k|{
   99|  10.8k|    std::string result(count, '\0');
  100|  10.8k|    (void)read(result, count, at);
  101|  10.8k|    return result;
  102|  10.8k|}
_ZN11InputSource10loadBufferEv:
  106|  2.98M|{
  107|  2.98M|    buf_idx = 0;
  108|  2.98M|    buf_len = qpdf_offset_t(read(buffer, buf_size));
  109|       |    // NB read sets last_offset
  110|  2.98M|    buf_start = last_offset;
  111|  2.98M|}
_ZN11InputSource8fastTellEv:
  115|  22.7M|{
  116|  22.7M|    if (buf_len == 0) {
  ------------------
  |  Branch (116:9): [True: 76.4k, False: 22.6M]
  ------------------
  117|  76.4k|        loadBuffer();
  118|  22.6M|    } else {
  119|  22.6M|        auto curr = tell();
  120|  22.6M|        if (curr < buf_start || curr >= (buf_start + buf_len)) {
  ------------------
  |  Branch (120:13): [True: 48.9k, False: 22.6M]
  |  Branch (120:33): [True: 2.85M, False: 19.7M]
  ------------------
  121|  2.90M|            loadBuffer();
  122|  19.7M|        } else {
  123|  19.7M|            last_offset = curr;
  124|  19.7M|            buf_idx = curr - buf_start;
  125|  19.7M|        }
  126|  22.6M|    }
  127|  22.7M|    return last_offset;
  128|  22.7M|}
_ZN11InputSource8fastReadERc:
  132|   362M|{
  133|       |    // Before calling fastRead, fastTell must be called to prepare the buffer. Once reading is
  134|       |    // complete, fastUnread must be called to set the correct file position.
  135|   362M|    if (buf_idx < buf_len) {
  ------------------
  |  Branch (135:9): [True: 359M, False: 2.65M]
  ------------------
  136|   359M|        ch = buffer[buf_idx];
  137|   359M|        ++(buf_idx);
  138|   359M|        ++(last_offset);
  139|   359M|        return true;
  140|       |
  141|   359M|    } else if (buf_len == 0) {
  ------------------
  |  Branch (141:16): [True: 38.2k, False: 2.61M]
  ------------------
  142|  38.2k|        return false;
  143|  2.61M|    } else {
  144|       |        seek(buf_start + buf_len, SEEK_SET);
  145|  2.61M|        fastTell();
  146|  2.61M|        return fastRead(ch);
  147|  2.61M|    }
  148|   362M|}
_ZN11InputSource10fastUnreadEb:
  152|  20.1M|{
  153|  20.1M|    last_offset -= back ? 1 : 0;
  ------------------
  |  Branch (153:20): [True: 19.0M, False: 1.08M]
  ------------------
  154|       |    seek(last_offset, SEEK_SET);
  155|  20.1M|}

_ZN3MD523encodeDataIncrementallyENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
   36|  6.84k|    {
   37|  6.84k|        crypto->MD5_update(
   38|  6.84k|            reinterpret_cast<unsigned char*>(const_cast<char*>(input_data.data())),
   39|  6.84k|            input_data.size());
   40|  6.84k|    }
_ZN3MD523encodeDataIncrementallyEPKcm:
   29|  94.8k|    {
   30|  94.8k|        crypto->MD5_update(reinterpret_cast<unsigned char*>(const_cast<char*>(input_data)), len);
   31|  94.8k|    }

_ZNK10NNTreeImpl8itemsKeyEv:
  185|   372k|    {
  186|   372k|        return items_key;
  187|   372k|    }
_ZNK14NNTreeIterator5validEv:
   29|   125k|    {
   30|   125k|        return item_number >= 0;
   31|   125k|    }
_ZN14NNTreeIterator13setItemNumberERK16QPDFObjectHandlei:
  102|  41.5k|    {
  103|  41.5k|        node = a_node;
  104|  41.5k|        item_number = n;
  105|  41.5k|        updateIValue();
  106|  41.5k|    }
_ZNK10NNTreeImpl8keyValidE16QPDFObjectHandle:
  190|   492k|    {
  191|   492k|        return o.resolved_type_code() == key_type;
  192|   492k|    }
_ZN14NNTreeIteratorD2Ev:
   24|  71.8k|    ~NNTreeIterator() = default;
_ZN14NNTreeIterator14addPathElementERK16QPDFObjectHandlei:
  109|  15.7k|    {
  110|  15.7k|        path.emplace_back(a_node, kid_number);
  111|  15.7k|    }
_ZN14NNTreeIterator11PathElementC2ERKN4qpdf10DictionaryEi:
   85|  16.0k|            node(node),
   86|  16.0k|            kid_number(kid_number)
   87|  16.0k|        {
   88|  16.0k|        }
_ZN14NNTreeIteratorC2ER10NNTreeImpl:
   95|  48.5k|        impl(impl)
   96|  48.5k|    {
   97|  48.5k|    }
_ZN10NNTreeImplC2ER4QPDFN4qpdf10DictionaryE18qpdf_object_type_eNSt3__18functionIFbRK16QPDFObjectHandleEEEb:
  139|  2.09k|        qpdf(qpdf),
  140|  2.09k|        tree_root(std::move(tree_root)),
  141|  2.09k|        key_type(key_type),
  142|  2.09k|        items_key(key_type == ::ot_string ? "/Names" : "/Nums"),
  ------------------
  |  Branch (142:19): [True: 2.09k, False: 0]
  ------------------
  143|  2.09k|        value_valid(value_validator),
  144|  2.09k|        auto_repair(auto_repair)
  145|  2.09k|    {
  146|  2.09k|    }
_ZN10NNTreeImpl3endEv:
  150|  6.93k|    {
  151|  6.93k|        return {*this};
  152|  6.93k|    }
_ZNK14NNTreeIteratorneERKS_:
   73|  34.4k|    {
   74|  34.4k|        return !operator==(other);
   75|  34.4k|    }
_ZN14NNTreeIteratordeEv:
   60|  33.1k|    {
   61|  33.1k|        updateIValue(false);
   62|  33.1k|        return ivalue;
   63|  33.1k|    }
_ZN14NNTreeIteratorppEv:
   34|  32.5k|    {
   35|  32.5k|        increment(false);
   36|  32.5k|        return *this;
   37|  32.5k|    }
_ZN14NNTreeIteratorptEv:
   66|  73.9k|    {
   67|  73.9k|        updateIValue(false);
   68|  73.9k|        return &ivalue;
   69|  73.9k|    }

_ZN17OffsetInputSourceD2Ev:
   13|    622|    ~OffsetInputSource() override = default;

_ZN4qpdf2pl6StringC2ERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
   23|  11.0k|            Pipeline("", nullptr),
   24|  11.0k|            str(str)
   25|  11.0k|        {
   26|  11.0k|        }
_ZN4qpdf2pl6String5writeEPKhm:
   32|  6.27M|        {
   33|  6.27M|            if (len) {
  ------------------
  |  Branch (33:17): [True: 6.27M, False: 525]
  ------------------
   34|  6.27M|                str.append(reinterpret_cast<char const*>(buf), len);
   35|  6.27M|            }
   36|  6.27M|        }
_ZN4qpdf2pl6String6finishEv:
   40|  10.2k|        {
   41|  10.2k|        }

_ZN10Pl_AES_PDFD2Ev:
   15|   138k|    ~Pl_AES_PDF() final = default;

_ZN13Pl_LZWDecoderD2Ev:
   13|  3.47k|    ~Pl_LZWDecoder() final = default;

_ZN12Pl_PNGFilterD2Ev:
   26|  1.92k|    ~Pl_PNGFilter() final = default;

_ZN6Pl_RC4D2Ev:
   16|    227|    ~Pl_RC4() final = default;

_ZN7Pl_SHA2D2Ev:
   20|   129k|    ~Pl_SHA2() final = default;

_ZN16Pl_TIFFPredictorD2Ev:
   24|    796|    ~Pl_TIFFPredictor() override = default;

_ZN17QPDFCrypto_nativeC2Ev:
   15|   401k|    QPDFCrypto_native() = default;
_ZN17QPDFCrypto_nativeD2Ev:
   17|   401k|    ~QPDFCrypto_native() final = default;

_ZNK4qpdf10BaseHandle13raw_type_codeEv:
  933|  18.2M|    {
  934|  18.2M|        return obj ? static_cast<qpdf_object_type_e>(obj->value.index()) : ::ot_uninitialized;
  ------------------
  |  Branch (934:16): [True: 18.2M, False: 0]
  ------------------
  935|  18.2M|    }
_ZNK4qpdf10BaseHandle4qpdfEv:
  927|   288k|    {
  928|   288k|        return obj ? obj->qpdf : nullptr;
  ------------------
  |  Branch (928:16): [True: 288k, False: 0]
  ------------------
  929|   288k|    }
_ZNK4qpdf10BaseHandle6offsetEv:
  921|  27.9k|    {
  922|  27.9k|        return obj ? obj->parsed_offset : -1;
  ------------------
  |  Branch (922:16): [True: 27.9k, False: 0]
  ------------------
  923|  27.9k|    }
_ZNK4qpdf10BaseHandle9type_codeEv:
  951|  2.67M|    {
  952|  2.67M|        if (!obj) {
  ------------------
  |  Branch (952:13): [True: 72.5k, False: 2.60M]
  ------------------
  953|  72.5k|            return ::ot_uninitialized;
  954|  72.5k|        }
  955|  2.60M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (955:13): [True: 124k, False: 2.47M]
  ------------------
  956|   124k|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  957|   124k|        }
  958|  2.47M|        if (raw_type_code() == ::ot_reference) {
  ------------------
  |  Branch (958:13): [True: 0, False: 2.47M]
  ------------------
  959|      0|            return std::get<QPDF_Reference>(obj->value).obj->getTypeCode();
  960|      0|        }
  961|  2.47M|        return raw_type_code();
  962|  2.47M|    }
_ZNK4qpdf10BaseHandle8indirectEv:
  860|  4.45M|    {
  861|  4.45M|        return obj ? obj->og.isIndirect() : false;
  ------------------
  |  Branch (861:16): [True: 4.45M, False: 519]
  ------------------
  862|  4.45M|    }
_ZNK4qpdf10BaseHandle4nullEv:
  907|   233k|    {
  908|   233k|        return !obj || type_code() == ::ot_null;
  ------------------
  |  Branch (908:16): [True: 50.1k, False: 183k]
  |  Branch (908:24): [True: 53.9k, False: 129k]
  ------------------
  909|   233k|    }
_ZN4qpdf5ArrayC2ERK16QPDFObjectHandle:
   57|   414k|            BaseHandle(oh.resolved_type_code() == ::ot_array ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (57:24): [True: 360k, False: 54.3k]
  ------------------
   58|   414k|        {
   59|   414k|        }
_ZNK4qpdf10BaseHandle18resolved_type_codeEv:
  939|  1.25M|    {
  940|  1.25M|        if (!obj) {
  ------------------
  |  Branch (940:13): [True: 47.8k, False: 1.21M]
  ------------------
  941|  47.8k|            return ::ot_uninitialized;
  942|  47.8k|        }
  943|  1.21M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (943:13): [True: 609, False: 1.21M]
  ------------------
  944|    609|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  945|    609|        }
  946|  1.21M|        return raw_type_code();
  947|  1.21M|    }
_ZN4qpdf10BaseHandleC2ERK16QPDFObjectHandle:
  788|  1.28M|        obj(oh.obj)
  789|  1.28M|    {
  790|  1.28M|    }
_ZN4qpdf10DictionaryC2ERK16QPDFObjectHandle:
  268|   154k|            BaseDictionary(oh)
  269|   154k|        {
  270|   154k|        }
_ZN4qpdf14BaseDictionaryC2ERK16QPDFObjectHandle:
  238|   154k|            BaseHandle(oh.resolved_type_code() == ::ot_dictionary ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (238:24): [True: 146k, False: 7.86k]
  ------------------
  239|   154k|        {
  240|   154k|        }
_ZN4qpdf14BaseDictionary5beginEv:
  141|  1.90k|        {
  142|  1.90k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (142:22): [True: 1.52k, False: 380]
  ------------------
  143|  1.52k|                return d->items.begin();
  144|  1.52k|            }
  145|    380|            return {};
  146|  1.90k|        }
_ZNK4qpdf10BaseHandle2asI15QPDF_DictionaryEEPT_v:
  770|   959k|    {
  771|   959k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 5.18k, False: 953k]
  ------------------
  772|  5.18k|            return nullptr;
  773|  5.18k|        }
  774|   953k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 947k, False: 6.79k]
  ------------------
  775|   947k|            return &std::get<T>(obj->value);
  776|   947k|        }
  777|  6.79k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 207, False: 6.58k]
  ------------------
  778|    207|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|    207|        }
  780|  6.58k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 6.58k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  6.58k|        return nullptr;
  785|  6.58k|    }
_ZN4qpdf14BaseDictionary3endEv:
  150|  1.90k|        {
  151|  1.90k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (151:22): [True: 1.52k, False: 379]
  ------------------
  152|  1.52k|                return d->items.end();
  153|  1.52k|            }
  154|    379|            return {};
  155|  1.90k|        }
_ZNK4qpdf10BaseHandle6id_genEv:
  854|  12.5k|    {
  855|  12.5k|        return obj ? obj->og : QPDFObjGen();
  ------------------
  |  Branch (855:16): [True: 12.5k, False: 0]
  ------------------
  856|  12.5k|    }
_ZNK4qpdf6Stream7getDictEv:
  554|  54.6k|        {
  555|  54.6k|            return {stream()->stream_dict};
  556|  54.6k|        }
_ZNK4qpdf6Stream6streamEv:
  697|   116k|        {
  698|   116k|            if (auto s = as<QPDF_Stream>()) {
  ------------------
  |  Branch (698:22): [True: 116k, False: 0]
  ------------------
  699|   116k|                if (auto ptr = s->m.get()) {
  ------------------
  |  Branch (699:26): [True: 116k, False: 2]
  ------------------
  700|   116k|                    return ptr;
  701|   116k|                }
  702|      2|                throw std::logic_error("QPDF_Stream: unexpected nullptr");
  703|   116k|            }
  704|      0|            throw std::runtime_error("operation for stream attempted on non-stream object");
  705|      0|            return nullptr; // unreachable
  706|   116k|        }
_ZNK4qpdf10BaseHandle2asI11QPDF_StreamEEPT_v:
  770|   116k|    {
  771|   116k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 116k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   116k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 116k, False: 0]
  ------------------
  775|   116k|            return &std::get<T>(obj->value);
  776|   116k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZN4qpdf7IntegerC2ERK16QPDFObjectHandle:
  319|   597k|            BaseHandle(oh.type_code() == ::ot_integer ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (319:24): [True: 143k, False: 454k]
  ------------------
  320|   597k|        {
  321|   597k|        }
_ZNK4qpdf7IntegercvbEv:
  330|   292k|        {
  331|   292k|            return obj != nullptr;
  332|   292k|        }
_ZN4qpdfeqERKNS_4NameENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  473|   103k|        {
  474|   103k|            return lhs && lhs.value() == rhs;
  ------------------
  |  Branch (474:20): [True: 63.2k, False: 40.1k]
  |  Branch (474:27): [True: 35.7k, False: 27.4k]
  ------------------
  475|   103k|        }
_ZN4qpdf4NameC2ERK16QPDFObjectHandle:
  449|   114k|            BaseHandle(oh.type_code() == ::ot_name ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (449:24): [True: 70.9k, False: 43.4k]
  ------------------
  450|   114k|        {
  451|   114k|        }
_ZNK4qpdf10BaseHandle2ohEv:
  805|  12.7k|    {
  806|  12.7k|        return {obj};
  807|  12.7k|    }
_ZN10QPDFObject6createI9QPDF_NullJEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|   311k|{
  989|   311k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   311k|}
_ZNK4qpdf7Integer5valueITkNSt3__18integralEiEET_v:
  361|  51.9k|        {
  362|  51.9k|            try {
  363|  51.9k|                return static_cast<T>(*this);
  364|  51.9k|            } catch (std::underflow_error&) {
  365|     80|                if constexpr (std::is_same_v<T, int>) {
  366|     80|                    warn("requested value of integer is too small; returning INT_MIN");
  367|       |                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|       |                    warn("unsigned integer value request for negative number; returning 0");
  369|       |                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|       |                    warn("unsigned value request for negative number; returning 0");
  371|       |                } else {
  372|       |                    warn(
  373|       |                        "underflow while converting integer object; returning smallest possible "
  374|       |                        "value");
  375|       |                }
  376|     80|                return std::numeric_limits<T>::min();
  377|     80|            } catch (std::overflow_error&) {
  378|     43|                if constexpr (std::is_same_v<T, int>) {
  379|     43|                    warn("requested value of integer is too big; returning INT_MAX");
  380|       |                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|       |                    warn("requested value of unsigned integer is too big; returning UINT_MAX");
  382|       |                } else {
  383|       |                    warn(
  384|       |                        "overflow while converting integer object; returning largest possible "
  385|       |                        "value");
  386|       |                }
  387|     43|                return std::numeric_limits<T>::max();
  388|     43|            }
  389|  51.9k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEiEEv:
  339|  51.9k|        {
  340|  51.9k|            auto v = value();
  341|       |
  342|  51.9k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 43, False: 51.8k]
  ------------------
  343|     43|                throw std::overflow_error("Integer conversion overflow");
  344|     43|            }
  345|  51.8k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 80, False: 51.7k]
  ------------------
  346|     80|                throw std::underflow_error("Integer conversion underflow");
  347|     80|            }
  348|  51.7k|            return static_cast<T>(v);
  349|  51.8k|        }
_ZN4qpdf5ArrayaSERKS0_:
   36|  17.8k|        {
   37|  17.8k|            if (obj != other.obj) {
  ------------------
  |  Branch (37:17): [True: 17.8k, False: 0]
  ------------------
   38|  17.8k|                obj = other.obj;
   39|  17.8k|            }
   40|  17.8k|            return *this;
   41|  17.8k|        }
_ZN4qpdf5ArrayC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
   47|  21.1k|            BaseHandle(obj)
   48|  21.1k|        {
   49|  21.1k|        }
_ZN4qpdf5ArrayC2EONSt3__110shared_ptrI10QPDFObjectEE:
   52|  6.62k|            BaseHandle(std::move(obj))
   53|  6.62k|        {
   54|  6.62k|        }
_ZN4qpdf5ArrayaSERK16QPDFObjectHandle:
   63|  50.9k|        {
   64|  50.9k|            assign(::ot_array, oh);
   65|  50.9k|            return *this;
   66|  50.9k|        }
_ZN4qpdf5ArrayC2EO16QPDFObjectHandle:
   69|     17|            BaseHandle(oh.resolved_type_code() == ::ot_array ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (69:24): [True: 0, False: 17]
  ------------------
   70|     17|        {
   71|     17|        }
_ZN4qpdf14BaseDictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  220|  1.66k|            BaseHandle(QPDFObject::create<QPDF_Dictionary>(std::move(dict)))
  221|  1.66k|        {
  222|  1.66k|        }
_ZN4qpdf14BaseDictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  225|  47.3k|            BaseHandle(obj)
  226|  47.3k|        {
  227|  47.3k|        }
_ZN4qpdf14BaseDictionaryC2EO16QPDFObjectHandle:
  243|  1.74k|            BaseHandle(
  244|  1.74k|                oh.resolved_type_code() == ::ot_dictionary ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (244:17): [True: 1.24k, False: 497]
  ------------------
  245|  1.74k|        {
  246|  1.74k|        }
_ZN4qpdf10DictionaryaSERK16QPDFObjectHandle:
  274|  48.3k|        {
  275|  48.3k|            assign(::ot_dictionary, oh);
  276|  48.3k|            return *this;
  277|  48.3k|        }
_ZN4qpdf10DictionaryC2EO16QPDFObjectHandle:
  280|  1.74k|            BaseDictionary(std::move(oh))
  281|  1.74k|        {
  282|  1.74k|        }
_ZN4qpdf10DictionaryaSEO16QPDFObjectHandle:
  286|     16|        {
  287|     16|            assign(::ot_dictionary, std::move(oh));
  288|     16|            return *this;
  289|     16|        }
_ZNKR4qpdf4NamecvNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEv:
  461|  9.53k|        {
  462|  9.53k|            return value();
  463|  9.53k|        }
_ZN4qpdf4NullC2Ev:
  483|      2|            BaseHandle(QPDFObject::create<QPDF_Null>())
  484|      2|        {
  485|      2|        }
_ZN4qpdf6StreamC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  515|  59.7k|            BaseHandle(obj)
  516|  59.7k|        {
  517|  59.7k|        }
_ZN4qpdf6StreamC2EONSt3__110shared_ptrI10QPDFObjectEE:
  520|  30.8k|            BaseHandle(std::move(obj))
  521|  30.8k|        {
  522|  30.8k|        }
_ZN4qpdf6StreamC2EO16QPDFObjectHandle:
  537|  39.5k|            BaseHandle(oh.type_code() == ::ot_stream ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (537:24): [True: 3.33k, False: 36.1k]
  ------------------
  538|  39.5k|        {
  539|  39.5k|        }
_ZNK4qpdf6Stream4TypeEv:
  601|  26.5k|        {
  602|  26.5k|            return {getDict()["/Type"]};
  603|  26.5k|        }
_ZN4qpdf6StringC2EO16QPDFObjectHandle:
  737|   733k|            BaseHandle(oh.type_code() == ::ot_string ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (737:24): [True: 733k, False: 0]
  ------------------
  738|   733k|        {
  739|   733k|        }
_ZNK4qpdf10BaseHandle6obj_spEv:
  799|  89.4k|    {
  800|  89.4k|        return obj;
  801|  89.4k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eRKS0_:
  838|  99.2k|    {
  839|  99.2k|        if (obj != other.obj) {
  ------------------
  |  Branch (839:13): [True: 47.9k, False: 51.3k]
  ------------------
  840|  47.9k|            obj = other.resolved_type_code() == required ? other.obj : nullptr;
  ------------------
  |  Branch (840:19): [True: 46.9k, False: 942]
  ------------------
  841|  47.9k|        }
  842|  99.2k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eOS0_:
  846|     16|    {
  847|     16|        if (obj != other.obj) {
  ------------------
  |  Branch (847:13): [True: 0, False: 16]
  ------------------
  848|      0|            obj = other.resolved_type_code() == required ? std::move(other.obj) : nullptr;
  ------------------
  |  Branch (848:19): [True: 0, False: 0]
  ------------------
  849|      0|        }
  850|     16|    }
_ZNK4qpdf10BaseHandle3getERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  901|   263k|    {
  902|   263k|        return (*this)[key];
  903|   263k|    }
_ZN9QPDF_Null6createENSt3__110shared_ptrI10QPDFObjectEERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS6_NS0_9allocatorIcEEEE:
  974|  75.4k|{
  975|  75.4k|    auto n = QPDFObject::create<QPDF_Null>();
  976|  75.4k|    n->setChildDescription(parent->getQPDF(), parent, static_descr, var_descr);
  977|  75.4k|    return n;
  978|  75.4k|}
_ZNK16QPDFObjectHandle8as_arrayEN4qpdf5typedE:
 1006|  26.5k|{
 1007|  26.5k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1007:9): [True: 0, False: 26.5k]
  ------------------
 1008|      0|        assertType("array", false);
 1009|      0|    }
 1010|  26.5k|    if (options & qpdf::any_flag || type_code() == ::ot_array ||
  ------------------
  |  Branch (1010:9): [True: 9.39k, False: 17.1k]
  |  Branch (1010:37): [True: 10.5k, False: 6.62k]
  ------------------
 1011|  19.9k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1011:10): [True: 0, False: 6.62k]
  |  Branch (1011:38): [True: 0, False: 0]
  ------------------
 1012|  19.9k|        return qpdf::Array(obj);
 1013|  19.9k|    }
 1014|  6.62k|    return qpdf::Array(std::shared_ptr<QPDFObject>());
 1015|  26.5k|}
_ZNK16QPDFObjectHandle13as_dictionaryEN4qpdf5typedE:
 1019|  47.3k|{
 1020|  47.3k|    if (options & qpdf::any_flag || type_code() == ::ot_dictionary ||
  ------------------
  |  Branch (1020:9): [True: 1.06k, False: 46.2k]
  |  Branch (1020:37): [True: 42.4k, False: 3.76k]
  ------------------
 1021|  43.5k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1021:10): [True: 0, False: 3.76k]
  |  Branch (1021:38): [True: 0, False: 0]
  ------------------
 1022|  43.5k|        return qpdf::Dictionary(obj);
 1023|  43.5k|    }
 1024|  3.76k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1024:9): [True: 0, False: 3.76k]
  ------------------
 1025|      0|        assertType("dictionary", false);
 1026|      0|    }
 1027|  3.76k|    return qpdf::Dictionary(std::shared_ptr<QPDFObject>());
 1028|  47.3k|}
_ZNK16QPDFObjectHandle9as_streamEN4qpdf5typedE:
 1032|  93.7k|{
 1033|  93.7k|    if (options & qpdf::any_flag || type_code() == ::ot_stream ||
  ------------------
  |  Branch (1033:9): [True: 0, False: 93.7k]
  |  Branch (1033:37): [True: 62.9k, False: 30.8k]
  ------------------
 1034|  59.7k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1034:10): [True: 0, False: 30.8k]
  |  Branch (1034:38): [True: 0, False: 0]
  ------------------
 1035|  59.7k|        return qpdf::Stream(obj);
 1036|  59.7k|    }
 1037|  33.9k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1037:9): [True: 0, False: 33.9k]
  ------------------
 1038|      0|        assertType("stream", false);
 1039|      0|    }
 1040|  33.9k|    return qpdf::Stream(std::shared_ptr<QPDFObject>());
 1041|  93.7k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRKNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  5.90k|{
  989|  5.90k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  5.90k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   129k|{
  989|   129k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   129k|}
_ZN4qpdf10BaseHandleC2EO16QPDFObjectHandle:
  793|   772k|        obj(std::move(oh.obj))
  794|   772k|    {
  795|   772k|    }
_ZN4qpdf10DictionaryC2Ev:
  256|  48.7k|        Dictionary() = default;
_ZN4qpdf14BaseDictionaryC2Ev:
  212|  48.7k|        BaseDictionary() = default;
_ZN4qpdf10DictionaryC2ERKS0_:
  262|   126k|        Dictionary(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryC2ERKS0_:
  232|   126k|        BaseDictionary(BaseDictionary const&) = default;
_ZN10QPDFObject6createI9QPDF_BoolJRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|    257|{
  989|    257|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    257|}
_ZN10QPDFObject6createI12QPDF_IntegerJRxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  6.90M|{
  989|  6.90M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  6.90M|}
_ZN10QPDFObject6createI9QPDF_RealJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    591|{
  989|    591|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    591|}
_ZN10QPDFObject6createI11QPDF_StringJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  18.1k|{
  989|  18.1k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  18.1k|}
_ZN10QPDFObject6createI9QPDF_NameJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   113k|{
  989|   113k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   113k|}
_ZN10QPDFObject6createI10QPDF_ArrayJS1_EEENSt3__110shared_ptrIS_EEDpOT0_:
  988|     24|{
  989|     24|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|     24|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEbEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    994|{
  989|    994|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    994|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    722|{
  989|    722|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    722|}
_ZNK4qpdf10BaseHandle2asI9QPDF_BoolEEPT_v:
  770|      3|    {
  771|      3|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 3]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|      3|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 3, False: 0]
  ------------------
  775|      3|            return &std::get<T>(obj->value);
  776|      3|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZNK4qpdf10BaseHandle2asI12QPDF_IntegerEEPT_v:
  770|   145k|    {
  771|   145k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 1.53k, False: 143k]
  ------------------
  772|  1.53k|            return nullptr;
  773|  1.53k|        }
  774|   143k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 143k, False: 0]
  ------------------
  775|   143k|            return &std::get<T>(obj->value);
  776|   143k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralExEEv:
  339|  65.8k|        {
  340|  65.8k|            auto v = value();
  341|       |
  342|  65.8k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 65.8k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  65.8k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 0, False: 65.8k]
  ------------------
  346|      0|                throw std::underflow_error("Integer conversion underflow");
  347|      0|            }
  348|  65.8k|            return static_cast<T>(v);
  349|  65.8k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEyEET_v:
  361|  17.0k|        {
  362|  17.0k|            try {
  363|  17.0k|                return static_cast<T>(*this);
  364|  17.0k|            } catch (std::underflow_error&) {
  365|       |                if constexpr (std::is_same_v<T, int>) {
  366|       |                    warn("requested value of integer is too small; returning INT_MIN");
  367|       |                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|       |                    warn("unsigned integer value request for negative number; returning 0");
  369|    203|                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|    203|                    warn("unsigned value request for negative number; returning 0");
  371|       |                } else {
  372|       |                    warn(
  373|       |                        "underflow while converting integer object; returning smallest possible "
  374|       |                        "value");
  375|       |                }
  376|    203|                return std::numeric_limits<T>::min();
  377|    203|            } catch (std::overflow_error&) {
  378|       |                if constexpr (std::is_same_v<T, int>) {
  379|       |                    warn("requested value of integer is too big; returning INT_MAX");
  380|       |                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|       |                    warn("requested value of unsigned integer is too big; returning UINT_MAX");
  382|      0|                } else {
  383|      0|                    warn(
  384|      0|                        "overflow while converting integer object; returning largest possible "
  385|      0|                        "value");
  386|      0|                }
  387|      0|                return std::numeric_limits<T>::max();
  388|      0|            }
  389|  17.0k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEyEEv:
  339|  17.0k|        {
  340|  17.0k|            auto v = value();
  341|       |
  342|  17.0k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 17.0k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  17.0k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 203, False: 16.8k]
  ------------------
  346|    203|                throw std::underflow_error("Integer conversion underflow");
  347|    203|            }
  348|  16.8k|            return static_cast<T>(v);
  349|  17.0k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEjEET_v:
  361|  10.2k|        {
  362|  10.2k|            try {
  363|  10.2k|                return static_cast<T>(*this);
  364|  10.2k|            } catch (std::underflow_error&) {
  365|       |                if constexpr (std::is_same_v<T, int>) {
  366|       |                    warn("requested value of integer is too small; returning INT_MIN");
  367|    148|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|    148|                    warn("unsigned integer value request for negative number; returning 0");
  369|       |                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|       |                    warn("unsigned value request for negative number; returning 0");
  371|       |                } else {
  372|       |                    warn(
  373|       |                        "underflow while converting integer object; returning smallest possible "
  374|       |                        "value");
  375|       |                }
  376|    148|                return std::numeric_limits<T>::min();
  377|    148|            } catch (std::overflow_error&) {
  378|       |                if constexpr (std::is_same_v<T, int>) {
  379|       |                    warn("requested value of integer is too big; returning INT_MAX");
  380|    138|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|    138|                    warn("requested value of unsigned integer is too big; returning UINT_MAX");
  382|       |                } else {
  383|       |                    warn(
  384|       |                        "overflow while converting integer object; returning largest possible "
  385|       |                        "value");
  386|       |                }
  387|    138|                return std::numeric_limits<T>::max();
  388|    138|            }
  389|  10.2k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEjEEv:
  339|  10.2k|        {
  340|  10.2k|            auto v = value();
  341|       |
  342|  10.2k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 138, False: 10.0k]
  ------------------
  343|    138|                throw std::overflow_error("Integer conversion overflow");
  344|    138|            }
  345|  10.0k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 148, False: 9.92k]
  ------------------
  346|    148|                throw std::underflow_error("Integer conversion underflow");
  347|    148|            }
  348|  9.92k|            return static_cast<T>(v);
  349|  10.0k|        }
_ZN10QPDFObject6createI9QPDF_NameJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  8.86M|{
  989|  8.86M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  8.86M|}
_ZN10QPDFObject6createI9QPDF_NameJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  12.1k|{
  989|  12.1k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  12.1k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_NameEEPT_v:
  770|  78.9k|    {
  771|  78.9k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 78.9k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  78.9k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 78.9k, False: 0]
  ------------------
  775|  78.9k|            return &std::get<T>(obj->value);
  776|  78.9k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZN10QPDFObject6createI11QPDF_StringJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   138k|{
  989|   138k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   138k|}
_ZN10QPDFObject6createI11QPDF_StringJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    712|{
  989|    712|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    712|}
_ZNK4qpdf10BaseHandle2asI11QPDF_StringEEPT_v:
  770|   733k|    {
  771|   733k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 733k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   733k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 733k, False: 0]
  ------------------
  775|   733k|            return &std::get<T>(obj->value);
  776|   733k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZN10QPDFObject6createI9QPDF_RealJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  61.3k|{
  989|  61.3k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  61.3k|}
_ZN10QPDFObject6createI9QPDF_RealJRdRiRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  17.8k|{
  989|  17.8k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  17.8k|}
_ZN9QPDF_RealC2Edib:
  981|  17.8k|    val(QUtil::double_to_string(value, decimal_places, trim_trailing_zeroes))
  982|  17.8k|{
  983|  17.8k|}
_ZN10QPDFObject6createI10QPDF_ArrayJRKNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  7.30k|{
  989|  7.30k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  7.30k|}
_ZN15QPDF_DictionaryC2EONSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
  967|   129k|    items(std::move(items))
  968|   129k|{
  969|   129k|}
_ZN10QPDFObject6createI9QPDF_BoolJbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  8.89k|{
  989|  8.89k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  8.89k|}
_ZN10QPDFObject6createI12QPDF_IntegerJxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  8.85k|{
  989|  8.85k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  8.85k|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  83.0k|{
  989|  83.0k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  83.0k|}
_ZNK4qpdf10BaseHandle2asI10QPDF_ArrayEEPT_v:
  770|  1.23M|    {
  771|  1.23M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 80.2k, False: 1.15M]
  ------------------
  772|  80.2k|            return nullptr;
  773|  80.2k|        }
  774|  1.15M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 1.14M, False: 6.21k]
  ------------------
  775|  1.14M|            return &std::get<T>(obj->value);
  776|  1.14M|        }
  777|  6.21k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 6.21k]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|  6.21k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 6.21k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  6.21k|        return nullptr;
  785|  6.21k|    }
_ZN4qpdf7IntegerC2ITkNSt3__18integralEmEET_:
  307|  1.78k|            Integer(static_cast<long long>(value))
  308|  1.78k|        {
  309|       |            if constexpr (std::cmp_greater(
  310|       |                              std::numeric_limits<decltype(value)>::max(),
  311|  1.78k|                              std::numeric_limits<long long>::max())) {
  312|  1.78k|                if (std::cmp_greater(value, std::numeric_limits<long long>::max())) {
  ------------------
  |  Branch (312:21): [True: 0, False: 1.78k]
  ------------------
  313|      0|                    throw std::overflow_error("overflow constructing Integer");
  314|      0|                }
  315|  1.78k|            }
  316|  1.78k|        }
_ZN4qpdf10DictionaryC2EOS0_:
  264|  2.36k|        Dictionary(Dictionary&&) = default;
_ZN4qpdf14BaseDictionaryC2EOS0_:
  234|  2.36k|        BaseDictionary(BaseDictionary&&) = default;
_ZN4qpdf10DictionaryaSERKS0_:
  263|  9.46k|        Dictionary& operator=(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryaSERKS0_:
  233|  9.46k|        BaseDictionary& operator=(BaseDictionary const&) = default;
_ZN4qpdf5ArrayC2Ev:
   21|  17.8k|        Array() = default;

_ZNK10QPDFObject11getTypeCodeEv:
  329|   462k|    {
  330|   462k|        return static_cast<qpdf_object_type_e>(value.index());
  331|   462k|    }
_ZN10QPDFObjectC2I9QPDF_NullEEOT_:
  300|   311k|        value(std::forward<T>(value))
  301|   311k|    {
  302|   311k|    }
_ZN10QPDF_ArrayC2ERKNSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEE:
   67|  7.30k|        elements(items)
   68|  7.30k|    {
   69|  7.30k|    }
_ZN10QPDF_ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEE:
   73|  83.0k|        elements(std::move(items))
   74|  83.0k|    {
   75|  83.0k|    }
_ZNK10QPDF_Array4sizeEv:
   79|  12.7k|    {
   80|  12.7k|        return sp ? sp->size : elements.size();
  ------------------
  |  Branch (80:16): [True: 111, False: 12.6k]
  ------------------
   81|  12.7k|    }
_ZN9QPDF_BoolC2Eb:
   94|  9.14k|        val(val)
   95|  9.14k|    {
   96|  9.14k|    }
_ZN15QPDF_DictionaryC2ERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
  111|  6.62k|        items(items)
  112|  6.62k|    {
  113|  6.62k|    }
_ZN12QPDF_IntegerC2Ex:
  140|  6.91M|        val(val)
  141|  6.91M|    {
  142|  6.91M|    }
_ZN9QPDF_NameC2ENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  154|  8.99M|        name(std::move(name))
  155|  8.99M|    {
  156|  8.99M|    }
_ZN9QPDF_RealC2ENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  193|  61.9k|        val(std::move(val))
  194|  61.9k|    {
  195|  61.9k|    }
_ZN11QPDF_Stream7MembersC2E16QPDFObjectHandlem:
  232|  28.9k|            stream_dict(std::move(stream_dict)),
  233|  28.9k|            length(length)
  234|  28.9k|        {
  235|  28.9k|        }
_ZN11QPDF_StreamC2E16QPDFObjectHandlem:
  254|  28.9k|        m(std::make_unique<Members>(stream_dict, length))
  255|  28.9k|    {
  256|  28.9k|        if (!stream_dict.isDictionary()) {
  ------------------
  |  Branch (256:13): [True: 0, False: 28.9k]
  ------------------
  257|      0|            throw std::logic_error(
  258|      0|                "stream object instantiated with non-dictionary object for dictionary");
  259|      0|        }
  260|  28.9k|    }
_ZN11QPDF_StringC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  279|   156k|        val(val)
  280|   156k|    {
  281|   156k|    }
_ZN11QPDF_StringC2EONSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  283|    712|        val(std::move(val))
  284|    712|    {
  285|    712|    }
_ZN10QPDFObject11assign_nullEv:
  334|  1.08k|    {
  335|  1.08k|        value = QPDF_Null();
  336|  1.08k|        qpdf = nullptr;
  337|  1.08k|        og = QPDFObjGen();
  338|  1.08k|        object_description = nullptr;
  339|  1.08k|        parsed_offset = -1;
  340|  1.08k|    }
_ZN10QPDFObject7move_toERNSt3__110shared_ptrIS_EEb:
  343|   120k|    {
  344|   120k|        o->value = std::move(value);
  345|   120k|        o->qpdf = qpdf;
  346|   120k|        o->og = og;
  347|   120k|        o->object_description = object_description;
  348|   120k|        o->parsed_offset = parsed_offset;
  349|   120k|        if (!destroy) {
  ------------------
  |  Branch (349:13): [True: 0, False: 120k]
  ------------------
  350|      0|            value = QPDF_Reference(o);
  351|      0|        }
  352|   120k|    }
_ZN10QPDFObject9setObjGenEP4QPDF10QPDFObjGen:
  364|   265k|    {
  365|   265k|        qpdf = a_qpdf;
  366|   265k|        og = a_og;
  367|   265k|    }
_ZNK10QPDFObject12isUnresolvedEv:
  371|   273k|    {
  372|   273k|        return getTypeCode() == ::ot_unresolved;
  373|   273k|    }
_ZN10QPDFObject10ChildDescrC2ENSt3__110shared_ptrIS_EERKNS1_17basic_string_viewIcNS1_11char_traitsIcEEEENS1_12basic_stringIcS6_NS1_9allocatorIcEEEE:
  393|  75.4k|            parent(parent),
  394|  75.4k|            static_descr(static_descr),
  395|  75.4k|            var_descr(var_descr)
  396|  75.4k|        {
  397|  75.4k|        }
_ZN10QPDFObject14ObjStreamDescrC2Eii:
  407|  24.7k|            stream_id(stream_id),
  408|  24.7k|            obj_id(obj_id) {};
_ZN10QPDFObject14setDescriptionEP4QPDFRNSt3__110shared_ptrINS2_7variantIJNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS_10JSON_DescrENS_10ChildDescrENS_14ObjStreamDescrEEEEEEx:
  419|  16.2M|    {
  420|  16.2M|        qpdf = qpdf_p;
  421|  16.2M|        object_description = description;
  422|  16.2M|        setParsedOffset(offset);
  423|  16.2M|    }
_ZN10QPDFObject21setDefaultDescriptionEP4QPDFRK10QPDFObjGen:
  426|   247k|    {
  427|   247k|        qpdf = a_qpdf;
  428|   247k|        og = a_og;
  429|   247k|    }
_ZN10QPDFObject19setChildDescriptionEP4QPDFNSt3__110shared_ptrIS_EERKNS2_17basic_string_viewIcNS2_11char_traitsIcEEEENS2_12basic_stringIcS7_NS2_9allocatorIcEEEE:
  436|  75.4k|    {
  437|  75.4k|        object_description =
  438|  75.4k|            std::make_shared<Description>(ChildDescr(parent, static_descr, var_descr));
  439|  75.4k|        qpdf = a_qpdf;
  440|  75.4k|    }
_ZN10QPDFObject14hasDescriptionEv:
  444|  28.9k|    {
  445|  28.9k|        return object_description || og.isIndirect();
  ------------------
  |  Branch (445:16): [True: 28.9k, False: 0]
  |  Branch (445:38): [True: 0, False: 0]
  ------------------
  446|  28.9k|    }
_ZN10QPDFObject15setParsedOffsetEx:
  449|  16.2M|    {
  450|  16.2M|        if (parsed_offset < 0) {
  ------------------
  |  Branch (450:13): [True: 16.2M, False: 0]
  ------------------
  451|  16.2M|            parsed_offset = offset;
  452|  16.2M|        }
  453|  16.2M|    }
_ZN10QPDFObject7getQPDFEv:
  456|   137k|    {
  457|   137k|        return qpdf;
  458|   137k|    }
_ZN10QPDFObject9getObjGenEv:
  461|   182k|    {
  462|   182k|        return og;
  463|   182k|    }
_ZN10QPDF_ArrayC2Ev:
   52|     24|    QPDF_Array() = default;
_ZN10QPDFObjectC2I15QPDF_DictionaryEEOT_:
  300|   136k|        value(std::forward<T>(value))
  301|   136k|    {
  302|   136k|    }
_ZN10QPDFObjectC2I9QPDF_BoolEEOT_:
  300|  9.14k|        value(std::forward<T>(value))
  301|  9.14k|    {
  302|  9.14k|    }
_ZN10QPDFObjectC2I12QPDF_IntegerEEOT_:
  300|  6.91M|        value(std::forward<T>(value))
  301|  6.91M|    {
  302|  6.91M|    }
_ZN10QPDFObjectC2I9QPDF_RealEEOT_:
  300|  79.8k|        value(std::forward<T>(value))
  301|  79.8k|    {
  302|  79.8k|    }
_ZN10QPDFObjectC2I11QPDF_StringEEOT_:
  300|   156k|        value(std::forward<T>(value))
  301|   156k|    {
  302|   156k|    }
_ZN10QPDFObjectC2I9QPDF_NameEEOT_:
  300|  8.99M|        value(std::forward<T>(value))
  301|  8.99M|    {
  302|  8.99M|    }
_ZN10QPDFObjectC2I10QPDF_ArrayEEOT_:
  300|  91.3k|        value(std::forward<T>(value))
  301|  91.3k|    {
  302|  91.3k|    }
_ZN10QPDF_ArrayC2EOS_:
   58|  92.7k|    QPDF_Array(QPDF_Array&&) = default;
_ZN10QPDFObject6createI11QPDF_StreamJ16QPDFObjectHandleRmEEENSt3__110shared_ptrIS_EEP4QPDF10QPDFObjGenDpOT0_:
  318|  28.9k|    {
  319|  28.9k|        return std::make_shared<QPDFObject>(
  320|  28.9k|            qpdf, og, std::forward<T>(T(std::forward<Args>(args)...)));
  321|  28.9k|    }
_ZN10QPDFObjectC2I11QPDF_StreamEEP4QPDF10QPDFObjGenOT_:
  306|  28.9k|        value(std::forward<T>(value)),
  307|  28.9k|        qpdf(qpdf),
  308|  28.9k|        og(og)
  309|  28.9k|    {
  310|  28.9k|    }
_ZN10QPDF_ArrayaSEOS_:
   59|     55|    QPDF_Array& operator=(QPDF_Array&&) = default;
_ZN10QPDFObject6createI15QPDF_UnresolvedJEEENSt3__110shared_ptrIS_EEP4QPDF10QPDFObjGenDpOT0_:
  318|   136k|    {
  319|   136k|        return std::make_shared<QPDFObject>(
  320|   136k|            qpdf, og, std::forward<T>(T(std::forward<Args>(args)...)));
  321|   136k|    }
_ZN10QPDFObjectC2I15QPDF_UnresolvedEEP4QPDF10QPDFObjGenOT_:
  306|   136k|        value(std::forward<T>(value)),
  307|   136k|        qpdf(qpdf),
  308|   136k|        og(og)
  309|   136k|    {
  310|   136k|    }

_ZN4qpdf4impl6Parser16make_descriptionERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  110|   109k|        {
  111|   109k|            using namespace std::literals;
  112|   109k|            return std::make_shared<QPDFObject::Description>(
  113|   109k|                input_name + ", " + object_description + " at offset $PO");
  114|   109k|        }
_ZN4qpdf4impl6ParserC2ER11InputSourceNSt3__110shared_ptrINS4_7variantIJNS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEN10QPDFObject10JSON_DescrENSD_10ChildDescrENSD_14ObjStreamDescrEEEEEERKSC_RNS_9TokenizerEPN16QPDFObjectHandle15StringDecrypterEP4QPDFbiib:
  139|   134k|            input_(input),
  140|   134k|            object_description_(object_description),
  141|   134k|            tokenizer_(tokenizer),
  142|   134k|            decrypter_(decrypter),
  143|   134k|            context_(context),
  144|   134k|            description_(std::move(sp_description)),
  145|   134k|            parse_pdf_(parse_pdf),
  146|   134k|            stream_id_(stream_id),
  147|   134k|            obj_id_(obj_id),
  148|   134k|            sanity_checks_(sanity_checks)
  149|   134k|        {
  150|   134k|        }
_ZN4qpdf4impl6Parser10StackFrameC2ER11InputSourceNS1_14parser_state_eE:
  160|   332k|                state(state),
  161|   332k|                offset(input.tell())
  162|   332k|            {
  163|   332k|            }
_ZN4qpdf4impl6Parser5ErrorC2Ev:
   31|  8.63k|            Error() = default;

_ZNK4qpdf9Tokenizer7getTypeEv:
   64|  18.9M|        {
   65|  18.9M|            return this->type;
   66|  18.9M|        }
_ZNK4qpdf9Tokenizer8getValueEv:
   69|  17.6M|        {
   70|  17.6M|            return (this->type == QPDFTokenizer::tt_name || this->type == QPDFTokenizer::tt_string)
  ------------------
  |  Branch (70:21): [True: 9.34M, False: 8.26M]
  |  Branch (70:61): [True: 135k, False: 8.12M]
  ------------------
   71|  17.6M|                ? this->val
   72|  17.6M|                : this->raw_val;
   73|  17.6M|        }
_ZNK4qpdf9Tokenizer15getErrorMessageEv:
   81|  38.9k|        {
   82|  38.9k|            return this->error_message;
   83|  38.9k|        }

_ZN4QPDF3DocC2ERS_PNS_7MembersE:
  357|  20.8k|        qpdf(qpdf),
  358|  20.8k|        m(m)
  359|  20.8k|    {
  360|  20.8k|    }
_ZN4qpdf3Doc6ConfigC2Ev:
   43|  20.8k|                log_(QPDFLogger::defaultLogger())
   44|  20.8k|            {
   45|  20.8k|            }
_ZN4QPDF3Doc6CommonC2ERS_PNS_7MembersE:
 1334|  83.2k|    qpdf(qpdf),
 1335|  83.2k|    m(m),
 1336|  83.2k|    cf(m->cf),
 1337|  83.2k|    pages(m->pages),
 1338|  83.2k|    objects(m->objects)
 1339|  83.2k|{
 1340|  83.2k|}
_ZN4QPDF3Doc13LinearizationC2ERS0_:
  607|  20.8k|        Common(doc)
  608|  20.8k|    {
  609|  20.8k|    }
_ZN4QPDF3Doc6CommonC2ERS0_:
 1343|  62.4k|    Common(doc.qpdf, doc.m)
 1344|  62.4k|{
 1345|  62.4k|}
_ZN4QPDF3Doc7ObjectsC2ERS0_:
 1044|  20.8k|        Common(doc),
 1045|  20.8k|        foreign_(*this),
 1046|  20.8k|        streams_(*this)
 1047|  20.8k|    {
 1048|  20.8k|    }
_ZN4QPDF3Doc7Objects7ForeignC2ERNS0_6CommonE:
  959|  20.8k|            Common(common)
  960|  20.8k|        {
  961|  20.8k|        }
_ZN4QPDF3Doc7Objects7ForeignD2Ev:
  968|  20.8k|        ~Foreign() = default;
_ZN4QPDF3Doc5PagesC2ERS0_:
 1187|  20.8k|        Common(doc)
 1188|  20.8k|    {
 1189|  20.8k|    }
_ZN4QPDF3Doc5PagesD2Ev:
 1184|  20.8k|    ~Pages() = default;
_ZN4QPDF3Doc7ObjectsD2Ev:
 1041|  20.8k|    ~Objects() = default;
_ZN4QPDF3Doc7Objects7StreamsD2Ev:
  997|  20.8k|        ~Streams() = default;
_ZN4QPDF3Doc13LinearizationD2Ev:
  604|  20.8k|    ~Linearization() = default;
_ZN4QPDF3DocD2Ev:
  354|  20.8k|    ~Doc() = default;
_ZN4qpdf3Doc6Config12max_warningsEm:
  107|  1.92k|            {
  108|  1.92k|                max_warnings_ = val;
  109|  1.92k|                return *this;
  110|  1.92k|            }
_ZNK4qpdf3Doc6Config3logEv:
   75|   670k|            {
   76|   670k|                return log_;
   77|   670k|            }
_ZNK4qpdf3Doc6Config12max_warningsEv:
  101|  1.36M|            {
  102|  1.36M|                return max_warnings_;
  103|  1.36M|            }
_ZNK4qpdf3Doc6Config17suppress_warningsEv:
   88|   670k|            {
   89|   670k|                return suppress_warnings_;
   90|   670k|            }
_ZN4QPDF3docEv:
 1373|  2.27k|{
 1374|  2.27k|    return *m;
 1375|  2.27k|}
_ZN4QPDF3Doc8Resolver8resolvedEPS_10QPDFObjGen:
 1328|   125k|    {
 1329|   125k|        return qpdf->m->objects.resolve(og);
 1330|   125k|    }
_ZNK4QPDF3Doc7Objects12root_checkedEv:
 1076|  12.7k|    {
 1077|  12.7k|        return root_checked_;
 1078|  12.7k|    }
_ZN4QPDF3Doc7Objects12root_checkedEb:
 1082|  4.23k|    {
 1083|  4.23k|        root_checked_ = val;
 1084|  4.23k|    }
_ZN4QPDF20EncryptionParametersC2Ev:
  191|  20.8k|    EncryptionParameters() = default;
_ZN4QPDF7MembersD2Ev:
 1287|  20.8k|    ~Members() = default;
_ZN4QPDF15StringDecrypter13decryptStringERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  240|  16.0k|    {
  241|  16.0k|        qpdf->decryptString(val, og);
  242|  16.0k|    }
_ZNK4qpdf3Doc6Config19password_is_hex_keyEv:
   49|  1.13k|            {
   50|  1.13k|                return password_is_hex_key_;
   51|  1.13k|            }
_ZNK4qpdf3Doc6Config19ignore_xref_streamsEv:
   62|  11.1k|            {
   63|  11.1k|                return ignore_xref_streams_;
   64|  11.1k|            }
_ZNK4qpdf3Doc6Config17surpress_recoveryEv:
  114|   132k|            {
  115|   132k|                return surpress_recovery_;
  116|   132k|            }
_ZN4QPDF8ObjCacheC2ENSt3__110shared_ptrI10QPDFObjectEExx:
  175|   287k|        object(std::move(object)),
  176|   287k|        end_before_space(end_before_space),
  177|   287k|        end_after_space(end_after_space)
  178|   287k|    {
  179|   287k|    }
_ZN4QPDF20EncryptionParameters1REv:
  204|  2.64k|    {
  205|  2.64k|        return R_;
  206|  2.64k|    }
_ZN4QPDF3Doc8outlinesEv:
  426|  1.92k|    {
  427|  1.92k|        if (!outlines_) {
  ------------------
  |  Branch (427:13): [True: 1.92k, False: 0]
  ------------------
  428|  1.92k|            no_inspection();
  429|  1.92k|            outlines_ = std::make_unique<QPDFOutlineDocumentHelper>(qpdf);
  430|  1.92k|        }
  431|  1.92k|        return *outlines_;
  432|  1.92k|    }
_ZN4QPDF3Doc13no_inspectionEv:
  457|  1.92k|    {
  458|  1.92k|        if (global::Options::inspection_mode()) {
  ------------------
  |  Branch (458:13): [True: 0, False: 1.92k]
  ------------------
  459|      0|            throw std::logic_error("Attempted unsupported operation in inspection mode");
  460|      0|        }
  461|  1.92k|    }
_ZN4QPDF3Doc10EncryptionC2EiiiiRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_SA_SA_SA_SA_b:
  496|  1.13k|        V(V),
  497|  1.13k|        R(R),
  498|  1.13k|        Length_bytes(Length_bytes),
  499|  1.13k|        P(static_cast<unsigned long long>(P)),
  500|  1.13k|        O(O),
  501|  1.13k|        U(U),
  502|  1.13k|        OE(OE),
  503|  1.13k|        UE(UE),
  504|  1.13k|        Perms(Perms),
  505|  1.13k|        id1(id1),
  506|  1.13k|        encrypt_metadata(encrypt_metadata)
  507|  1.13k|    {
  508|  1.13k|    }
_ZN4QPDF3Doc7Objects7Streams14pipeStreamDataEPS_10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
 1011|  10.8k|        {
 1012|  10.8k|            return qpdf->pipeStreamData(
 1013|  10.8k|                og,
 1014|  10.8k|                offset,
 1015|  10.8k|                length,
 1016|  10.8k|                dict,
 1017|  10.8k|                is_root_metadata,
 1018|  10.8k|                pipeline,
 1019|  10.8k|                suppress_warnings,
 1020|  10.8k|                will_retry);
 1021|  10.8k|        }
_ZN4QPDF3Doc5Pages3allEv:
 1193|  12.7k|    {
 1194|  12.7k|        return !all_pages.empty() ? all_pages : cache();
  ------------------
  |  Branch (1194:16): [True: 1.79k, False: 10.9k]
  ------------------
 1195|  12.7k|    }
_ZN4QPDF3Doc5Pages5emptyEv:
 1199|  12.7k|    {
 1200|  12.7k|        return all().empty();
 1201|  12.7k|    }
_ZNK4QPDF3Doc18reconstructed_xrefEv:
 1367|    355|{
 1368|    355|    return m->reconstructed_xref;
 1369|    355|}
_ZN4QPDF3Doc6Common3toOImEExRKT_:
  319|  1.07M|        {
  320|  1.07M|            return QIntC::to_offset(i);
  321|  1.07M|        }
_ZN4QPDF3Doc6Common3toIIlEEiRKT_:
  331|  9.02k|        {
  332|  9.02k|            return QIntC::to_int(i);
  333|  9.02k|        }
_ZN4QPDF3Doc6Common3toIIxEEiRKT_:
  331|  3.97M|        {
  332|  3.97M|            return QIntC::to_int(i);
  333|  3.97M|        }
_ZN4QPDF3Doc6Common3toSIiEEmRKT_:
  325|  13.3k|        {
  326|  13.3k|            return QIntC::to_size(i);
  327|  13.3k|        }
_ZN4QPDF3Doc6Common3toSIyEEmRKT_:
  325|  12.2k|        {
  326|  12.2k|            return QIntC::to_size(i);
  327|  12.2k|        }
_ZN4QPDF3Doc6Common3toSIxEEmRKT_:
  325|  20.2k|        {
  326|  20.2k|            return QIntC::to_size(i);
  327|  20.2k|        }
_ZN4QPDF8ObjCacheC2Ev:
  170|   150k|    ObjCache() = default;
_ZN4QPDF3Doc6Common3toIImEEiRKT_:
  331|  10.0k|        {
  332|  10.0k|            return QIntC::to_int(i);
  333|  10.0k|        }

_ZN16SF_ASCII85Decode7factoryEv:
   23|    799|    {
   24|    799|        return std::make_shared<SF_ASCII85Decode>();
   25|    799|    }
_ZN16SF_ASCII85DecodeC2Ev:
   11|    799|    SF_ASCII85Decode() = default;
_ZN16SF_ASCII85DecodeD2Ev:
   12|    799|    ~SF_ASCII85Decode() override = default;
_ZN16SF_ASCII85Decode17getDecodePipelineEP8Pipeline:
   16|    683|    {
   17|    683|        this->pipeline = std::make_shared<Pl_ASCII85Decoder>("ascii85 decode", next);
   18|    683|        return this->pipeline.get();
   19|    683|    }

_ZN17SF_ASCIIHexDecode7factoryEv:
   23|    529|    {
   24|    529|        return std::make_shared<SF_ASCIIHexDecode>();
   25|    529|    }
_ZN17SF_ASCIIHexDecodeC2Ev:
   11|    529|    SF_ASCIIHexDecode() = default;
_ZN17SF_ASCIIHexDecodeD2Ev:
   12|    529|    ~SF_ASCIIHexDecode() override = default;
_ZN17SF_ASCIIHexDecode17getDecodePipelineEP8Pipeline:
   16|    453|    {
   17|    453|        this->pipeline = std::make_shared<Pl_ASCIIHexDecoder>("asciiHex decode", next);
   18|    453|        return this->pipeline.get();
   19|    453|    }

_ZN12SF_DCTDecode7factoryEv:
   23|    165|    {
   24|    165|        return std::make_shared<SF_DCTDecode>();
   25|    165|    }
_ZN12SF_DCTDecodeC2Ev:
   11|    165|    SF_DCTDecode() = default;
_ZN12SF_DCTDecodeD2Ev:
   12|    165|    ~SF_DCTDecode() override = default;
_ZN12SF_DCTDecode18isLossyCompressionEv:
   35|     22|    {
   36|     22|        return true;
   37|     22|    }

_ZN17SF_FlateLzwDecode13flate_factoryEv:
   22|  5.76k|    {
   23|  5.76k|        return std::make_shared<SF_FlateLzwDecode>(false);
   24|  5.76k|    }
_ZN17SF_FlateLzwDecodeC2Eb:
   12|  9.56k|        lzw(lzw)
   13|  9.56k|    {
   14|  9.56k|    }
_ZN17SF_FlateLzwDecodeD2Ev:
   15|  9.56k|    ~SF_FlateLzwDecode() final = default;
_ZN17SF_FlateLzwDecode11lzw_factoryEv:
   27|  3.80k|    {
   28|  3.80k|        return std::make_shared<SF_FlateLzwDecode>(true);
   29|  3.80k|    }

_ZN18SF_RunLengthDecode7factoryEv:
   24|  1.26k|    {
   25|  1.26k|        return std::make_shared<SF_RunLengthDecode>();
   26|  1.26k|    }
_ZN18SF_RunLengthDecodeC2Ev:
   11|  1.26k|    SF_RunLengthDecode() = default;
_ZN18SF_RunLengthDecodeD2Ev:
   12|  1.26k|    ~SF_RunLengthDecode() override = default;
_ZN18SF_RunLengthDecode17getDecodePipelineEP8Pipeline:
   16|  1.05k|    {
   17|  1.05k|        this->pipeline =
   18|  1.05k|            std::make_shared<Pl_RunLength>("runlength decode", next, Pl_RunLength::a_decode);
   19|  1.05k|        return this->pipeline.get();
   20|  1.05k|    }

_ZN4qpdf4util17internal_error_ifIRA28_KcEEvbOT_:
   36|  4.59M|    {
   37|  4.59M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 0, False: 4.59M]
  ------------------
   38|      0|            throw std::logic_error("INTERNAL ERROR: "s.append(std::forward<T>(msg))
   39|      0|                                       .append(
   40|      0|                                           "\nThis is a qpdf bug. Please report at "
   41|      0|                                           "https://github.com/qpdf/qpdf/issues"));
   42|      0|        }
   43|  4.59M|    }
_ZN4qpdf4util9assertionIRA44_KcEEvbOT_:
   27|  69.6k|    {
   28|  69.6k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 69.6k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  69.6k|    }
_ZN4qpdf4util15hex_decode_charEc:
   99|   269k|    {
  100|   269k|        return digit <= '9' && digit >= '0'
  ------------------
  |  Branch (100:16): [True: 184k, False: 85.3k]
  |  Branch (100:32): [True: 139k, False: 45.2k]
  ------------------
  101|   269k|            ? char(digit - '0')
  102|   269k|            : (digit >= 'a' ? char(digit - 'a' + 10)
  ------------------
  |  Branch (102:16): [True: 23.6k, False: 107k]
  ------------------
  103|   130k|                            : (digit >= 'A' ? char(digit - 'A' + 10) : '\20'));
  ------------------
  |  Branch (103:32): [True: 46.0k, False: 60.9k]
  ------------------
  104|   269k|    }
_ZN4qpdf4util8is_spaceEc:
  114|  30.7M|    {
  115|  30.7M|        return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || ch == '\v';
  ------------------
  |  Branch (115:16): [True: 9.71M, False: 21.0M]
  |  Branch (115:29): [True: 504k, False: 20.5M]
  |  Branch (115:43): [True: 123k, False: 20.3M]
  |  Branch (115:57): [True: 54.4k, False: 20.3M]
  |  Branch (115:71): [True: 66.8k, False: 20.2M]
  |  Branch (115:85): [True: 23.6k, False: 20.2M]
  ------------------
  116|  30.7M|    }
_ZN4qpdf4util8is_digitEc:
  120|  25.1M|    {
  121|  25.1M|        return (ch >= '0' && ch <= '9');
  ------------------
  |  Branch (121:17): [True: 16.7M, False: 8.38M]
  |  Branch (121:30): [True: 16.6M, False: 90.4k]
  ------------------
  122|  25.1M|    }
_ZN4qpdf4util8is_utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  149|   774k|    {
  150|   774k|        return str.starts_with("\xfe\xff") || str.starts_with("\xff\xfe");
  ------------------
  |  Branch (150:16): [True: 24.4k, False: 750k]
  |  Branch (150:47): [True: 66.7k, False: 683k]
  ------------------
  151|   774k|    }
_ZN4qpdf4util16is_explicit_utf8ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  155|   683k|    {
  156|       |        // QPDF_String.cc knows that this is a 3-byte sequence.
  157|   683k|        return str.starts_with("\xef\xbb\xbf");
  158|   683k|    }
_ZN4qpdf4util9assertionIRA83_KcEEvbOT_:
   27|  68.9k|    {
   28|  68.9k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 68.9k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  68.9k|    }
_ZN4qpdf4util9assertionIRA57_KcEEvbOT_:
   27|    683|    {
   28|    683|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 683]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    683|    }
_ZN4qpdf4util9assertionIRA51_KcEEvbOT_:
   27|    622|    {
   28|    622|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 622]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    622|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralElQsr3stdE8integralIT_EEEbT0_:
   63|  20.8k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  20.8k|                          std::numeric_limits<T>::min())) {
   67|  20.8k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 20.8k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  20.8k|        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|  20.8k|                          std::numeric_limits<T>::max())) {
   74|  20.8k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 0, False: 20.8k]
  ------------------
   75|      0|                return false;
   76|      0|            }
   77|  20.8k|        }
   78|  20.8k|        return true;
   79|  20.8k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEiQsr3stdE8integralIT_EEEbT0_:
   63|  20.8k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  20.8k|                          std::numeric_limits<T>::min())) {
   67|  20.8k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 20.8k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  20.8k|        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|       |                          std::numeric_limits<T>::max())) {
   74|       |            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
   75|       |                return false;
   76|       |            }
   77|       |        }
   78|  20.8k|        return true;
   79|  20.8k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEyQsr3stdE8integralIT_EEEbT0_:
   63|  88.7k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|       |                          std::numeric_limits<T>::min())) {
   67|       |            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
   68|       |                return false;
   69|       |            }
   70|       |        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|  88.7k|                          std::numeric_limits<T>::max())) {
   74|  88.7k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 6, False: 88.7k]
  ------------------
   75|      6|                return false;
   76|      6|            }
   77|  88.7k|        }
   78|  88.7k|        return true;
   79|  88.7k|    }
_ZN4qpdf4util9assertionINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   27|   236k|    {
   28|   236k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 236k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   236k|    }
_ZN4qpdf4util9assertionIRA45_KcEEvbOT_:
   27|   578k|    {
   28|   578k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 578k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   578k|    }
_ZN4qpdf4util9assertionIRA54_KcEEvbOT_:
   27|   175k|    {
   28|   175k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 175k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   175k|    }
_ZN4qpdf4util9assertionIRA53_KcEEvbOT_:
   27|  3.47k|    {
   28|  3.47k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 3.47k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  3.47k|    }
_ZN4qpdf4util9assertionIRA35_KcEEvbOT_:
   27|  3.22k|    {
   28|  3.22k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 3.22k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  3.22k|    }
_ZN4qpdf4util17internal_error_ifIRA34_KcEEvbOT_:
   36|   268k|    {
   37|   268k|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 1, False: 268k]
  ------------------
   38|      1|            throw std::logic_error("INTERNAL ERROR: "s.append(std::forward<T>(msg))
   39|      1|                                       .append(
   40|      1|                                           "\nThis is a qpdf bug. Please report at "
   41|      1|                                           "https://github.com/qpdf/qpdf/issues"));
   42|      1|        }
   43|   268k|    }
_ZN4qpdf4util9assertionIRA68_KcEEvbOT_:
   27|  2.84k|    {
   28|  2.84k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.84k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.84k|    }
_ZN4qpdf4util9assertionIRA65_KcEEvbOT_:
   27|  2.44k|    {
   28|  2.44k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.44k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.44k|    }
_ZN4qpdf4util9assertionIRA49_KcEEvbOT_:
   27|  17.8k|    {
   28|  17.8k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 17.8k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  17.8k|    }
_ZN4qpdf4util9assertionIRA43_KcEEvbOT_:
   27|  9.18k|    {
   28|  9.18k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 9.18k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  9.18k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA51_KcEEvbOT_:
   48|  1.18M|    {
   49|  1.18M|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 30, False: 1.18M]
  ------------------
   50|     30|            throw std::runtime_error(std::forward<T>(msg));
   51|     30|        }
   52|  1.18M|    }
_ZN4qpdf4util9assertionIRA50_KcEEvbOT_:
   27|   268k|    {
   28|   268k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 268k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   268k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA23_KcEEvbOT_:
   48|  3.08M|    {
   49|  3.08M|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 17, False: 3.08M]
  ------------------
   50|     17|            throw std::runtime_error(std::forward<T>(msg));
   51|     17|        }
   52|  3.08M|    }
_ZN4qpdf4util9assertionIRA52_KcEEvbOT_:
   27|  35.1M|    {
   28|  35.1M|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 35.1M]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  35.1M|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA44_KcEEvbOT_:
   48|  10.7k|    {
   49|  10.7k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 18, False: 10.7k]
  ------------------
   50|     18|            throw std::runtime_error(std::forward<T>(msg));
   51|     18|        }
   52|  10.7k|    }
_ZN4qpdf4util9assertionIRA58_KcEEvbOT_:
   27|    453|    {
   28|    453|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 453]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    453|    }
_ZN4qpdf4util9assertionIRA48_KcEEvbOT_:
   27|  5.47k|    {
   28|  5.47k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 5.47k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  5.47k|    }
_ZN4qpdf4util9assertionIRA46_KcEEvbOT_:
   27|    227|    {
   28|    227|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 227]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    227|    }
_ZN4qpdf4util17no_ci_rt_error_ifINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   48|  22.0k|    {
   49|  22.0k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 22.0k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  22.0k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA69_KcEEvbOT_:
   48|  7.45k|    {
   49|  7.45k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 23, False: 7.43k]
  ------------------
   50|     23|            throw std::runtime_error(std::forward<T>(msg));
   51|     23|        }
   52|  7.45k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA59_KcEEvbOT_:
   48|   113k|    {
   49|   113k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 113k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|   113k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA42_KcEEvbOT_:
   48|  11.2k|    {
   49|  11.2k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 11.2k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  11.2k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA49_KcEEvbOT_:
   48|  2.81k|    {
   49|  2.81k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 6, False: 2.81k]
  ------------------
   50|      6|            throw std::runtime_error(std::forward<T>(msg));
   51|      6|        }
   52|  2.81k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA88_KcEEvbOT_:
   48|  1.95k|    {
   49|  1.95k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.95k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.95k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEjQsr3stdE8integralIT_EEEbT0_:
   63|  1.95k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|       |                          std::numeric_limits<T>::min())) {
   67|       |            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
   68|       |                return false;
   69|       |            }
   70|       |        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|       |                          std::numeric_limits<T>::max())) {
   74|       |            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
   75|       |                return false;
   76|       |            }
   77|       |        }
   78|  1.95k|        return true;
   79|  1.95k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA58_KcEEvbOT_:
   48|  1.95k|    {
   49|  1.95k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.95k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.95k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA45_KcEEvbOT_:
   48|  1.95k|    {
   49|  1.95k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 1.95k]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|  1.95k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA32_KcEEvbOT_:
   48|  1.95k|    {
   49|  1.95k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 35, False: 1.92k]
  ------------------
   50|     35|            throw std::runtime_error(std::forward<T>(msg));
   51|     35|        }
   52|  1.95k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA35_KcEEvbOT_:
   48|  19.6k|    {
   49|  19.6k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 29, False: 19.6k]
  ------------------
   50|     29|            throw std::runtime_error(std::forward<T>(msg));
   51|     29|        }
   52|  19.6k|    }
_ZN4qpdf4util9assertionIRA47_KcEEvbOT_:
   27|   129k|    {
   28|   129k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 129k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   129k|    }
_ZN4qpdf4util9assertionIRA56_KcEEvbOT_:
   27|    852|    {
   28|    852|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 852]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    852|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA53_KcEEvbOT_:
   48|    852|    {
   49|    852|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 849]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|    852|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA92_KcEEvbOT_:
   48|    834|    {
   49|    834|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 834]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|    834|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA36_KcEEvbOT_:
   48|    831|    {
   49|    831|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 35, False: 796]
  ------------------
   50|     35|            throw std::runtime_error(std::forward<T>(msg));
   51|     35|        }
   52|    831|    }

BitStream.cc:_ZL9read_bitsRPKhRmS2_m:
   21|  1.82M|{
   22|       |    // View p as a stream of bits:
   23|       |
   24|       |    // 76543210 76543210 ....
   25|       |
   26|       |    // bit_offset is the bit number within the first byte that marks
   27|       |    // the first bit that we would read.
   28|       |
   29|  1.82M|    if (bits_wanted > bits_available) {
  ------------------
  |  Branch (29:9): [True: 0, False: 1.82M]
  ------------------
   30|      0|        throw std::runtime_error(
   31|      0|            "overflow reading bit stream: wanted = " + std::to_string(bits_wanted) +
   32|      0|            "; available = " + std::to_string(bits_available));
   33|      0|    }
   34|  1.82M|    if (bits_wanted > 32) {
  ------------------
  |  Branch (34:9): [True: 16, False: 1.82M]
  ------------------
   35|     16|        throw std::out_of_range("read_bits: too many bits requested");
   36|     16|    }
   37|       |
   38|  1.82M|    unsigned long result = 0;
   39|       |# ifdef BITS_TESTING
   40|       |    if (bits_wanted == 0) {
   41|       |        QTC::TC("libtests", "bits zero bits wanted");
   42|       |    }
   43|       |# endif
   44|  7.96M|    while (bits_wanted > 0) {
  ------------------
  |  Branch (44:12): [True: 6.13M, False: 1.82M]
  ------------------
   45|       |        // Grab bits from the first byte clearing anything before
   46|       |        // bit_offset.
   47|  6.13M|        unsigned char byte = static_cast<unsigned char>(*p & ((1U << (bit_offset + 1U)) - 1U));
   48|       |
   49|       |        // There are bit_offset + 1 bits available in the first byte.
   50|  6.13M|        size_t to_copy = std::min(bits_wanted, bit_offset + 1);
   51|  6.13M|        size_t leftover = (bit_offset + 1) - to_copy;
   52|       |
   53|       |# ifdef BITS_TESTING
   54|       |        QTC::TC("libtests", "bits bit_offset", ((bit_offset == 0) ? 0 : (bit_offset == 7) ? 1 : 2));
   55|       |        QTC::TC("libtests", "bits leftover", (leftover > 0) ? 1 : 0);
   56|       |# endif
   57|       |
   58|       |        // Right shift so that all the bits we want are right justified.
   59|  6.13M|        byte = static_cast<unsigned char>(byte >> leftover);
   60|       |
   61|       |        // Copy the bits into result
   62|  6.13M|        result <<= to_copy;
   63|  6.13M|        result |= byte;
   64|       |
   65|       |        // Update pointers
   66|  6.13M|        if (leftover) {
  ------------------
  |  Branch (66:13): [True: 1.01M, False: 5.11M]
  ------------------
   67|  1.01M|            bit_offset = leftover - 1;
   68|  5.11M|        } else {
   69|  5.11M|            bit_offset = 7;
   70|  5.11M|            ++p;
   71|  5.11M|        }
   72|  6.13M|        bits_wanted -= to_copy;
   73|  6.13M|        bits_available -= to_copy;
   74|       |
   75|       |# ifdef BITS_TESTING
   76|       |        QTC::TC("libtests", "bits iterations", ((bits_wanted > 8) ? 0 : (bits_wanted > 0) ? 1 : 2));
   77|       |# endif
   78|  6.13M|    }
   79|       |
   80|  1.82M|    return result;
   81|  1.82M|}
BitWriter.cc:_ZL10write_bitsRhRmymP8Pipeline:
   88|  1.83M|{
   89|  1.83M|    if (bits > 32) {
  ------------------
  |  Branch (89:9): [True: 0, False: 1.83M]
  ------------------
   90|      0|        throw std::out_of_range("write_bits: too many bits requested");
   91|      0|    }
   92|       |
   93|       |    // bit_offset + 1 is the number of bits left in ch
   94|       |# ifdef BITS_TESTING
   95|       |    if (bits == 0) {
   96|       |        QTC::TC("libtests", "bits write zero bits");
   97|       |    }
   98|       |# endif
   99|  7.96M|    while (bits > 0) {
  ------------------
  |  Branch (99:12): [True: 6.13M, False: 1.83M]
  ------------------
  100|  6.13M|        size_t bits_to_write = std::min(bits, bit_offset + 1);
  101|  6.13M|        unsigned char newval = static_cast<unsigned char>(
  102|  6.13M|            (val >> (bits - bits_to_write)) & ((1U << bits_to_write) - 1));
  103|  6.13M|        size_t bits_left_in_ch = bit_offset + 1 - bits_to_write;
  104|  6.13M|        newval = static_cast<unsigned char>(newval << bits_left_in_ch);
  105|  6.13M|        ch |= newval;
  106|  6.13M|        if (bits_left_in_ch == 0) {
  ------------------
  |  Branch (106:13): [True: 5.11M, False: 1.01M]
  ------------------
  107|       |# ifdef BITS_TESTING
  108|       |            QTC::TC("libtests", "bits write pipeline");
  109|       |# endif
  110|  5.11M|            pipeline->write(&ch, 1);
  111|  5.11M|            bit_offset = 7;
  112|  5.11M|            ch = 0;
  113|  5.11M|        } else {
  114|       |# ifdef BITS_TESTING
  115|       |            QTC::TC("libtests", "bits write leftover");
  116|       |# endif
  117|  1.01M|            bit_offset -= bits_to_write;
  118|  1.01M|        }
  119|  6.13M|        bits -= bits_to_write;
  120|       |# ifdef BITS_TESTING
  121|       |        QTC::TC("libtests", "bits write iterations", ((bits > 8) ? 0 : (bits > 0) ? 1 : 2));
  122|       |# endif
  123|  6.13M|    }
  124|  1.83M|}

_ZN4qpdf6global6Limits16doc_max_warningsEv:
   22|  20.8k|        {
   23|  20.8k|            return l.doc_max_warnings_;
   24|  20.8k|        }
_ZN4qpdf6global7Options15inspection_modeEv:
  197|  22.7k|        {
  198|  22.7k|            return static_cast<bool>(o.inspection_mode_);
  199|  22.7k|        }
_ZN4qpdf6global6Limits16doc_max_warningsEj:
   28|  20.8k|        {
   29|  20.8k|            l.doc_max_warnings_ = value;
   30|  20.8k|        }
_ZN4qpdf6global6Limits18parser_max_nestingEv:
   34|      2|        {
   35|      2|            return l.parser_max_nesting_;
   36|      2|        }
_ZN4qpdf6global6Limits17parser_max_errorsEv:
   46|   134k|        {
   47|   134k|            return l.parser_max_errors_;
   48|   134k|        }
_ZN4qpdf6global6Limits25parser_max_container_sizeEb:
   59|  9.28M|        {
   60|  9.28M|            return damaged ? l.parser_max_container_size_damaged_ : l.parser_max_container_size_;
  ------------------
  |  Branch (60:20): [True: 2.66M, False: 6.61M]
  ------------------
   61|  9.28M|        }
_ZN4qpdf6global6Limits18max_stream_filtersEv:
   67|  7.12k|        {
   68|  7.12k|            return l.max_stream_filters_;
   69|  7.12k|        }
_ZN4qpdf6global6Limits14dct_max_memoryEv:
   80|      2|        {
   81|      2|            return l.dct_max_memory_;
   82|      2|        }
_ZN4qpdf6global6Limits14dct_max_memoryEl:
   86|  20.8k|        {
   87|  20.8k|            l.dct_max_memory_ = util::fits<uint32_t>(value) ? value : 0;
  ------------------
  |  Branch (87:33): [True: 20.8k, False: 0]
  ------------------
   88|  20.8k|        }
_ZN4qpdf6global6Limits25dct_max_progressive_scansEv:
   92|      2|        {
   93|      2|            return l.dct_max_progressive_scans_;
   94|      2|        }
_ZN4qpdf6global6Limits25dct_max_progressive_scansEi:
   98|  20.8k|        {
   99|  20.8k|            l.dct_max_progressive_scans_ = util::fits<uint32_t>(value) ? value : 0;
  ------------------
  |  Branch (99:44): [True: 20.8k, False: 0]
  ------------------
  100|  20.8k|        }
_ZN4qpdf6global6Limits16flate_max_memoryEv:
  104|      2|        {
  105|      2|            return l.flate_max_memory_;
  106|      2|        }
_ZN4qpdf6global6Limits16flate_max_memoryEy:
  110|  20.8k|        {
  111|  20.8k|            l.flate_max_memory_ = util::fits<uint32_t>(value) ? value : 0;
  ------------------
  |  Branch (111:35): [True: 20.8k, False: 0]
  ------------------
  112|  20.8k|        }
_ZN4qpdf6global6Limits14png_max_memoryEv:
  116|      2|        {
  117|      2|            return l.png_max_memory_;
  118|      2|        }
_ZN4qpdf6global6Limits14png_max_memoryEy:
  122|  20.8k|        {
  123|  20.8k|            l.png_max_memory_ = util::fits<uint32_t>(value) ? value : 0;
  ------------------
  |  Branch (123:33): [True: 20.8k, False: 0]
  ------------------
  124|  20.8k|        }
_ZN4qpdf6global6Limits21run_length_max_memoryEv:
  128|      2|        {
  129|      2|            return l.run_length_max_memory_;
  130|      2|        }
_ZN4qpdf6global6Limits21run_length_max_memoryEy:
  134|  20.8k|        {
  135|  20.8k|            l.run_length_max_memory_ = util::fits<uint32_t>(value) ? value : 0;
  ------------------
  |  Branch (135:40): [True: 20.8k, False: 0]
  ------------------
  136|  20.8k|        }
_ZN4qpdf6global6Limits15tiff_max_memoryEv:
  140|      2|        {
  141|      2|            return l.tiff_max_memory_;
  142|      2|        }
_ZN4qpdf6global6Limits15tiff_max_memoryEy:
  146|  20.8k|        {
  147|  20.8k|            l.tiff_max_memory_ = util::fits<uint32_t>(value) ? value : 0;
  ------------------
  |  Branch (147:34): [True: 20.8k, False: 0]
  ------------------
  148|  20.8k|        }
_ZN4qpdf6global6Limits5errorEv:
  153|  2.16k|        {
  154|  2.16k|            if (l.errors_ < std::numeric_limits<uint32_t>::max()) {
  ------------------
  |  Branch (154:17): [True: 2.16k, False: 0]
  ------------------
  155|  2.16k|                ++l.errors_;
  156|  2.16k|            }
  157|  2.16k|        }
_ZN4qpdf6global7Options25dct_throw_on_corrupt_dataEv:
  234|      2|        {
  235|      2|            return o.dct_throw_on_corrupt_data_;
  236|      2|        }
_ZN4qpdf6global7Options25dct_throw_on_corrupt_dataEb:
  240|  20.8k|        {
  241|  20.8k|            o.dct_throw_on_corrupt_data_ = value;
  242|  20.8k|        }

_Z20rijndaelSetupEncryptPjPKhm:
  715|   138k|{
  716|   138k|  int i = 0;
  717|   138k|  u32 temp;
  718|       |
  719|   138k|  rk[0] = GETU32(key     );
  ------------------
  |  |  698|   138k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   138k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   138k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   138k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  720|   138k|  rk[1] = GETU32(key +  4);
  ------------------
  |  |  698|   138k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   138k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   138k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   138k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  721|   138k|  rk[2] = GETU32(key +  8);
  ------------------
  |  |  698|   138k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   138k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   138k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   138k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  722|   138k|  rk[3] = GETU32(key + 12);
  ------------------
  |  |  698|   138k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   138k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   138k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   138k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  723|   138k|  if (keybits == 128)
  ------------------
  |  Branch (723:7): [True: 134k, False: 4.22k]
  ------------------
  724|   134k|  {
  725|   134k|    for (;;)
  726|  1.34M|    {
  727|  1.34M|      temp  = rk[3];
  728|  1.34M|      rk[4] = rk[0] ^
  729|  1.34M|        (Te4[(temp >> 16) & 0xff] & 0xff000000) ^
  730|  1.34M|        (Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^
  731|  1.34M|        (Te4[(temp      ) & 0xff] & 0x0000ff00) ^
  732|  1.34M|        (Te4[(temp >> 24)       ] & 0x000000ff) ^
  733|  1.34M|        rcon[i];
  734|  1.34M|      rk[5] = rk[1] ^ rk[4];
  735|  1.34M|      rk[6] = rk[2] ^ rk[5];
  736|  1.34M|      rk[7] = rk[3] ^ rk[6];
  737|  1.34M|      if (++i == 10)
  ------------------
  |  Branch (737:11): [True: 134k, False: 1.21M]
  ------------------
  738|   134k|        return 10;
  739|  1.21M|      rk += 4;
  740|  1.21M|    }
  741|   134k|  }
  742|  4.22k|  rk[4] = GETU32(key + 16);
  ------------------
  |  |  698|  4.22k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  4.22k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  4.22k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  4.22k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  743|  4.22k|  rk[5] = GETU32(key + 20);
  ------------------
  |  |  698|  4.22k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  4.22k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  4.22k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  4.22k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  744|  4.22k|  if (keybits == 192)
  ------------------
  |  Branch (744:7): [True: 0, False: 4.22k]
  ------------------
  745|      0|  {
  746|      0|    for (;;)
  747|      0|    {
  748|      0|      temp = rk[ 5];
  749|      0|      rk[ 6] = rk[ 0] ^
  750|      0|        (Te4[(temp >> 16) & 0xff] & 0xff000000) ^
  751|      0|        (Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^
  752|      0|        (Te4[(temp      ) & 0xff] & 0x0000ff00) ^
  753|      0|        (Te4[(temp >> 24)       ] & 0x000000ff) ^
  754|      0|        rcon[i];
  755|      0|      rk[ 7] = rk[ 1] ^ rk[ 6];
  756|      0|      rk[ 8] = rk[ 2] ^ rk[ 7];
  757|      0|      rk[ 9] = rk[ 3] ^ rk[ 8];
  758|      0|      if (++i == 8)
  ------------------
  |  Branch (758:11): [True: 0, False: 0]
  ------------------
  759|      0|        return 12;
  760|      0|      rk[10] = rk[ 4] ^ rk[ 9];
  761|      0|      rk[11] = rk[ 5] ^ rk[10];
  762|      0|      rk += 6;
  763|      0|    }
  764|      0|  }
  765|  4.22k|  rk[6] = GETU32(key + 24);
  ------------------
  |  |  698|  4.22k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  4.22k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  4.22k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  4.22k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  766|  4.22k|  rk[7] = GETU32(key + 28);
  ------------------
  |  |  698|  4.22k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  4.22k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  4.22k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  4.22k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  767|  4.22k|  if (keybits == 256)
  ------------------
  |  Branch (767:7): [True: 4.22k, False: 0]
  ------------------
  768|  4.22k|  {
  769|  4.22k|    for (;;)
  770|  29.5k|    {
  771|  29.5k|      temp = rk[ 7];
  772|  29.5k|      rk[ 8] = rk[ 0] ^
  773|  29.5k|        (Te4[(temp >> 16) & 0xff] & 0xff000000) ^
  774|  29.5k|        (Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^
  775|  29.5k|        (Te4[(temp      ) & 0xff] & 0x0000ff00) ^
  776|  29.5k|        (Te4[(temp >> 24)       ] & 0x000000ff) ^
  777|  29.5k|        rcon[i];
  778|  29.5k|      rk[ 9] = rk[ 1] ^ rk[ 8];
  779|  29.5k|      rk[10] = rk[ 2] ^ rk[ 9];
  780|  29.5k|      rk[11] = rk[ 3] ^ rk[10];
  781|  29.5k|      if (++i == 7)
  ------------------
  |  Branch (781:11): [True: 4.22k, False: 25.3k]
  ------------------
  782|  4.22k|        return 14;
  783|  25.3k|      temp = rk[11];
  784|  25.3k|      rk[12] = rk[ 4] ^
  785|  25.3k|        (Te4[(temp >> 24)       ] & 0xff000000) ^
  786|  25.3k|        (Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^
  787|  25.3k|        (Te4[(temp >>  8) & 0xff] & 0x0000ff00) ^
  788|  25.3k|        (Te4[(temp      ) & 0xff] & 0x000000ff);
  789|  25.3k|      rk[13] = rk[ 5] ^ rk[12];
  790|  25.3k|      rk[14] = rk[ 6] ^ rk[13];
  791|  25.3k|      rk[15] = rk[ 7] ^ rk[14];
  792|  25.3k|      rk += 8;
  793|  25.3k|    }
  794|  4.22k|  }
  795|      0|  return 0;
  796|  4.22k|}
_Z20rijndaelSetupDecryptPjPKhm:
  804|  11.2k|{
  805|  11.2k|  unsigned int nrounds, i, j;
  806|  11.2k|  u32 temp;
  807|       |
  808|       |  /* expand the cipher key: */
  809|  11.2k|  nrounds = rijndaelSetupEncrypt(rk, key, keybits);
  810|       |  /* invert the order of the round keys: */
  811|  75.8k|  for (i = 0, j = 4*nrounds; i < j; i += 4, j -= 4)
  ------------------
  |  Branch (811:30): [True: 64.5k, False: 11.2k]
  ------------------
  812|  64.5k|  {
  813|  64.5k|    temp = rk[i    ]; rk[i    ] = rk[j    ]; rk[j    ] = temp;
  814|  64.5k|    temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp;
  815|  64.5k|    temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp;
  816|  64.5k|    temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp;
  817|  64.5k|  }
  818|       |  /* apply the inverse MixColumn transform to all round keys but the first and the last: */
  819|   129k|  for (i = 1; i < nrounds; i++)
  ------------------
  |  Branch (819:15): [True: 117k, False: 11.2k]
  ------------------
  820|   117k|  {
  821|   117k|    rk += 4;
  822|   117k|    rk[0] =
  823|   117k|      Td0[Te4[(rk[0] >> 24)       ] & 0xff] ^
  824|   117k|      Td1[Te4[(rk[0] >> 16) & 0xff] & 0xff] ^
  825|   117k|      Td2[Te4[(rk[0] >>  8) & 0xff] & 0xff] ^
  826|   117k|      Td3[Te4[(rk[0]      ) & 0xff] & 0xff];
  827|   117k|    rk[1] =
  828|   117k|      Td0[Te4[(rk[1] >> 24)       ] & 0xff] ^
  829|   117k|      Td1[Te4[(rk[1] >> 16) & 0xff] & 0xff] ^
  830|   117k|      Td2[Te4[(rk[1] >>  8) & 0xff] & 0xff] ^
  831|   117k|      Td3[Te4[(rk[1]      ) & 0xff] & 0xff];
  832|   117k|    rk[2] =
  833|   117k|      Td0[Te4[(rk[2] >> 24)       ] & 0xff] ^
  834|   117k|      Td1[Te4[(rk[2] >> 16) & 0xff] & 0xff] ^
  835|   117k|      Td2[Te4[(rk[2] >>  8) & 0xff] & 0xff] ^
  836|   117k|      Td3[Te4[(rk[2]      ) & 0xff] & 0xff];
  837|   117k|    rk[3] =
  838|   117k|      Td0[Te4[(rk[3] >> 24)       ] & 0xff] ^
  839|   117k|      Td1[Te4[(rk[3] >> 16) & 0xff] & 0xff] ^
  840|   117k|      Td2[Te4[(rk[3] >>  8) & 0xff] & 0xff] ^
  841|   117k|      Td3[Te4[(rk[3]      ) & 0xff] & 0xff];
  842|   117k|  }
  843|  11.2k|  return nrounds;
  844|  11.2k|}
_Z15rijndaelEncryptPKjjPKhPh:
  849|  34.6M|{
  850|  34.6M|  u32 s0, s1, s2, s3, t0, t1, t2, t3;
  851|       |#ifndef FULL_UNROLL
  852|       |    int r;
  853|       |#endif /* ?FULL_UNROLL */
  854|       |  /*
  855|       |   * map byte array block to cipher state
  856|       |   * and add initial round key:
  857|       |  */
  858|  34.6M|  s0 = GETU32(plaintext     ) ^ rk[0];
  ------------------
  |  |  698|  34.6M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  34.6M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  34.6M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  34.6M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  859|  34.6M|  s1 = GETU32(plaintext +  4) ^ rk[1];
  ------------------
  |  |  698|  34.6M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  34.6M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  34.6M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  34.6M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  860|  34.6M|  s2 = GETU32(plaintext +  8) ^ rk[2];
  ------------------
  |  |  698|  34.6M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  34.6M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  34.6M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  34.6M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  861|  34.6M|  s3 = GETU32(plaintext + 12) ^ rk[3];
  ------------------
  |  |  698|  34.6M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  34.6M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  34.6M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  34.6M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  862|  34.6M|#ifdef FULL_UNROLL
  863|       |    /* round 1: */
  864|  34.6M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4];
  865|  34.6M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5];
  866|  34.6M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6];
  867|  34.6M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[ 7];
  868|       |    /* round 2: */
  869|  34.6M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[ 8];
  870|  34.6M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9];
  871|  34.6M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10];
  872|  34.6M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11];
  873|       |    /* round 3: */
  874|  34.6M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12];
  875|  34.6M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13];
  876|  34.6M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14];
  877|  34.6M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[15];
  878|       |    /* round 4: */
  879|  34.6M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[16];
  880|  34.6M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17];
  881|  34.6M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18];
  882|  34.6M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19];
  883|       |    /* round 5: */
  884|  34.6M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20];
  885|  34.6M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21];
  886|  34.6M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22];
  887|  34.6M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[23];
  888|       |    /* round 6: */
  889|  34.6M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[24];
  890|  34.6M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25];
  891|  34.6M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26];
  892|  34.6M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27];
  893|       |    /* round 7: */
  894|  34.6M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28];
  895|  34.6M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29];
  896|  34.6M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30];
  897|  34.6M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[31];
  898|       |    /* round 8: */
  899|  34.6M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[32];
  900|  34.6M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33];
  901|  34.6M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34];
  902|  34.6M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35];
  903|       |    /* round 9: */
  904|  34.6M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36];
  905|  34.6M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37];
  906|  34.6M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38];
  907|  34.6M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39];
  908|  34.6M|    if (nrounds > 10)
  ------------------
  |  Branch (908:9): [True: 0, False: 34.6M]
  ------------------
  909|      0|    {
  910|       |      /* round 10: */
  911|      0|      s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[40];
  912|      0|      s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[41];
  913|      0|      s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[42];
  914|      0|      s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[43];
  915|       |      /* round 11: */
  916|      0|      t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[44];
  917|      0|      t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[45];
  918|      0|      t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[46];
  919|      0|      t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[47];
  920|      0|      if (nrounds > 12)
  ------------------
  |  Branch (920:11): [True: 0, False: 0]
  ------------------
  921|      0|      {
  922|       |        /* round 12: */
  923|      0|        s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[48];
  924|      0|        s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[49];
  925|      0|        s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[50];
  926|      0|        s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[51];
  927|       |        /* round 13: */
  928|      0|        t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[52];
  929|      0|        t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[53];
  930|      0|        t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[54];
  931|      0|        t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[55];
  932|      0|      }
  933|      0|    }
  934|  34.6M|    rk += nrounds << 2;
  935|       |#else  /* !FULL_UNROLL */
  936|       |    /*
  937|       |    * nrounds - 1 full rounds:
  938|       |    */
  939|       |    r = nrounds >> 1;
  940|       |    for (;;)
  941|       |    {
  942|       |      t0 =
  943|       |        Te0[(s0 >> 24)       ] ^
  944|       |        Te1[(s1 >> 16) & 0xff] ^
  945|       |        Te2[(s2 >>  8) & 0xff] ^
  946|       |        Te3[(s3      ) & 0xff] ^
  947|       |        rk[4];
  948|       |      t1 =
  949|       |        Te0[(s1 >> 24)       ] ^
  950|       |        Te1[(s2 >> 16) & 0xff] ^
  951|       |        Te2[(s3 >>  8) & 0xff] ^
  952|       |        Te3[(s0      ) & 0xff] ^
  953|       |        rk[5];
  954|       |      t2 =
  955|       |        Te0[(s2 >> 24)       ] ^
  956|       |        Te1[(s3 >> 16) & 0xff] ^
  957|       |        Te2[(s0 >>  8) & 0xff] ^
  958|       |        Te3[(s1      ) & 0xff] ^
  959|       |        rk[6];
  960|       |      t3 =
  961|       |        Te0[(s3 >> 24)       ] ^
  962|       |        Te1[(s0 >> 16) & 0xff] ^
  963|       |        Te2[(s1 >>  8) & 0xff] ^
  964|       |        Te3[(s2      ) & 0xff] ^
  965|       |        rk[7];
  966|       |        rk += 8;
  967|       |        if (--r == 0)
  968|       |            break;
  969|       |      s0 =
  970|       |        Te0[(t0 >> 24)       ] ^
  971|       |        Te1[(t1 >> 16) & 0xff] ^
  972|       |        Te2[(t2 >>  8) & 0xff] ^
  973|       |        Te3[(t3      ) & 0xff] ^
  974|       |        rk[0];
  975|       |      s1 =
  976|       |        Te0[(t1 >> 24)       ] ^
  977|       |        Te1[(t2 >> 16) & 0xff] ^
  978|       |        Te2[(t3 >>  8) & 0xff] ^
  979|       |        Te3[(t0      ) & 0xff] ^
  980|       |        rk[1];
  981|       |      s2 =
  982|       |        Te0[(t2 >> 24)       ] ^
  983|       |        Te1[(t3 >> 16) & 0xff] ^
  984|       |        Te2[(t0 >>  8) & 0xff] ^
  985|       |        Te3[(t1      ) & 0xff] ^
  986|       |        rk[2];
  987|       |      s3 =
  988|       |        Te0[(t3 >> 24)       ] ^
  989|       |        Te1[(t0 >> 16) & 0xff] ^
  990|       |        Te2[(t1 >>  8) & 0xff] ^
  991|       |        Te3[(t2      ) & 0xff] ^
  992|       |        rk[3];
  993|       |     }
  994|       |#endif /* ?FULL_UNROLL */
  995|       |  /*
  996|       |  * apply last round and
  997|       |  * map cipher state to byte array block:
  998|       |  */
  999|  34.6M|  s0 =
 1000|  34.6M|    (Te4[(t0 >> 24)       ] & 0xff000000) ^
 1001|  34.6M|    (Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^
 1002|  34.6M|    (Te4[(t2 >>  8) & 0xff] & 0x0000ff00) ^
 1003|  34.6M|    (Te4[(t3      ) & 0xff] & 0x000000ff) ^
 1004|  34.6M|    rk[0];
 1005|  34.6M|  PUTU32(ciphertext     , s0);
  ------------------
  |  |  703|  34.6M|#define PUTU32(ciphertext, st) { \
  |  |  704|  34.6M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  34.6M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  34.6M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  34.6M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1006|  34.6M|  s1 =
 1007|  34.6M|    (Te4[(t1 >> 24)       ] & 0xff000000) ^
 1008|  34.6M|    (Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
 1009|  34.6M|    (Te4[(t3 >>  8) & 0xff] & 0x0000ff00) ^
 1010|  34.6M|    (Te4[(t0      ) & 0xff] & 0x000000ff) ^
 1011|  34.6M|    rk[1];
 1012|  34.6M|  PUTU32(ciphertext +  4, s1);
  ------------------
  |  |  703|  34.6M|#define PUTU32(ciphertext, st) { \
  |  |  704|  34.6M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  34.6M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  34.6M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  34.6M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1013|  34.6M|  s2 =
 1014|  34.6M|    (Te4[(t2 >> 24)       ] & 0xff000000) ^
 1015|  34.6M|    (Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^
 1016|  34.6M|    (Te4[(t0 >>  8) & 0xff] & 0x0000ff00) ^
 1017|  34.6M|    (Te4[(t1      ) & 0xff] & 0x000000ff) ^
 1018|  34.6M|    rk[2];
 1019|  34.6M|  PUTU32(ciphertext +  8, s2);
  ------------------
  |  |  703|  34.6M|#define PUTU32(ciphertext, st) { \
  |  |  704|  34.6M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  34.6M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  34.6M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  34.6M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1020|  34.6M|  s3 =
 1021|  34.6M|    (Te4[(t3 >> 24)       ] & 0xff000000) ^
 1022|  34.6M|    (Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
 1023|  34.6M|    (Te4[(t1 >>  8) & 0xff] & 0x0000ff00) ^
 1024|  34.6M|    (Te4[(t2      ) & 0xff] & 0x000000ff) ^
 1025|  34.6M|    rk[3];
 1026|  34.6M|  PUTU32(ciphertext + 12, s3);
  ------------------
  |  |  703|  34.6M|#define PUTU32(ciphertext, st) { \
  |  |  704|  34.6M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  34.6M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  34.6M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  34.6M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1027|  34.6M|}
_Z15rijndaelDecryptPKjjPKhPh:
 1032|   538k|{
 1033|   538k|  u32 s0, s1, s2, s3, t0, t1, t2, t3;
 1034|       |#ifndef FULL_UNROLL
 1035|       |    int r;
 1036|       |#endif /* ?FULL_UNROLL */
 1037|       |
 1038|       |  /*
 1039|       |  * map byte array block to cipher state
 1040|       |  * and add initial round key:
 1041|       |  */
 1042|   538k|    s0 = GETU32(ciphertext     ) ^ rk[0];
  ------------------
  |  |  698|   538k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   538k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   538k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   538k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1043|   538k|    s1 = GETU32(ciphertext +  4) ^ rk[1];
  ------------------
  |  |  698|   538k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   538k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   538k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   538k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1044|   538k|    s2 = GETU32(ciphertext +  8) ^ rk[2];
  ------------------
  |  |  698|   538k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   538k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   538k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   538k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1045|   538k|    s3 = GETU32(ciphertext + 12) ^ rk[3];
  ------------------
  |  |  698|   538k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   538k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   538k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   538k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1046|   538k|#ifdef FULL_UNROLL
 1047|       |    /* round 1: */
 1048|   538k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4];
 1049|   538k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[ 5];
 1050|   538k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[ 6];
 1051|   538k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[ 7];
 1052|       |    /* round 2: */
 1053|   538k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[ 8];
 1054|   538k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[ 9];
 1055|   538k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[10];
 1056|   538k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[11];
 1057|       |    /* round 3: */
 1058|   538k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[12];
 1059|   538k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[13];
 1060|   538k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[14];
 1061|   538k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[15];
 1062|       |    /* round 4: */
 1063|   538k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[16];
 1064|   538k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[17];
 1065|   538k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[18];
 1066|   538k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[19];
 1067|       |    /* round 5: */
 1068|   538k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[20];
 1069|   538k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[21];
 1070|   538k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[22];
 1071|   538k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[23];
 1072|       |    /* round 6: */
 1073|   538k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[24];
 1074|   538k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[25];
 1075|   538k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[26];
 1076|   538k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[27];
 1077|       |    /* round 7: */
 1078|   538k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[28];
 1079|   538k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[29];
 1080|   538k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[30];
 1081|   538k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[31];
 1082|       |    /* round 8: */
 1083|   538k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[32];
 1084|   538k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[33];
 1085|   538k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[34];
 1086|   538k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[35];
 1087|       |    /* round 9: */
 1088|   538k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[36];
 1089|   538k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37];
 1090|   538k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38];
 1091|   538k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39];
 1092|   538k|    if (nrounds > 10)
  ------------------
  |  Branch (1092:9): [True: 281k, False: 256k]
  ------------------
 1093|   281k|    {
 1094|       |      /* round 10: */
 1095|   281k|      s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40];
 1096|   281k|      s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41];
 1097|   281k|      s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[42];
 1098|   281k|      s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[43];
 1099|       |      /* round 11: */
 1100|   281k|      t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[44];
 1101|   281k|      t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45];
 1102|   281k|      t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46];
 1103|   281k|      t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47];
 1104|   281k|      if (nrounds > 12)
  ------------------
  |  Branch (1104:11): [True: 281k, False: 0]
  ------------------
 1105|   281k|      {
 1106|       |        /* round 12: */
 1107|   281k|        s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48];
 1108|   281k|        s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49];
 1109|   281k|        s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[50];
 1110|   281k|        s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[51];
 1111|       |        /* round 13: */
 1112|   281k|        t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[52];
 1113|   281k|        t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[53];
 1114|   281k|        t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[54];
 1115|   281k|        t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55];
 1116|   281k|      }
 1117|   281k|    }
 1118|   538k|    rk += nrounds << 2;
 1119|       |#else  /* !FULL_UNROLL */
 1120|       |    /*
 1121|       |    * nrounds - 1 full rounds:
 1122|       |    */
 1123|       |    r = nrounds >> 1;
 1124|       |    for (;;)
 1125|       |    {
 1126|       |      t0 =
 1127|       |        Td0[(s0 >> 24)       ] ^
 1128|       |        Td1[(s3 >> 16) & 0xff] ^
 1129|       |        Td2[(s2 >>  8) & 0xff] ^
 1130|       |        Td3[(s1      ) & 0xff] ^
 1131|       |        rk[4];
 1132|       |      t1 =
 1133|       |        Td0[(s1 >> 24)       ] ^
 1134|       |        Td1[(s0 >> 16) & 0xff] ^
 1135|       |        Td2[(s3 >>  8) & 0xff] ^
 1136|       |        Td3[(s2      ) & 0xff] ^
 1137|       |        rk[5];
 1138|       |      t2 =
 1139|       |        Td0[(s2 >> 24)       ] ^
 1140|       |        Td1[(s1 >> 16) & 0xff] ^
 1141|       |        Td2[(s0 >>  8) & 0xff] ^
 1142|       |        Td3[(s3      ) & 0xff] ^
 1143|       |        rk[6];
 1144|       |      t3 =
 1145|       |        Td0[(s3 >> 24)       ] ^
 1146|       |        Td1[(s2 >> 16) & 0xff] ^
 1147|       |        Td2[(s1 >>  8) & 0xff] ^
 1148|       |        Td3[(s0      ) & 0xff] ^
 1149|       |        rk[7];
 1150|       |      rk += 8;
 1151|       |      if (--r == 0)
 1152|       |          break;
 1153|       |      s0 =
 1154|       |        Td0[(t0 >> 24)       ] ^
 1155|       |        Td1[(t3 >> 16) & 0xff] ^
 1156|       |        Td2[(t2 >>  8) & 0xff] ^
 1157|       |        Td3[(t1      ) & 0xff] ^
 1158|       |        rk[0];
 1159|       |      s1 =
 1160|       |        Td0[(t1 >> 24)       ] ^
 1161|       |        Td1[(t0 >> 16) & 0xff] ^
 1162|       |        Td2[(t3 >>  8) & 0xff] ^
 1163|       |        Td3[(t2      ) & 0xff] ^
 1164|       |        rk[1];
 1165|       |      s2 =
 1166|       |        Td0[(t2 >> 24)       ] ^
 1167|       |        Td1[(t1 >> 16) & 0xff] ^
 1168|       |        Td2[(t0 >>  8) & 0xff] ^
 1169|       |        Td3[(t3      ) & 0xff] ^
 1170|       |        rk[2];
 1171|       |      s3 =
 1172|       |        Td0[(t3 >> 24)       ] ^
 1173|       |        Td1[(t2 >> 16) & 0xff] ^
 1174|       |        Td2[(t1 >>  8) & 0xff] ^
 1175|       |        Td3[(t0      ) & 0xff] ^
 1176|       |        rk[3];
 1177|       |    }
 1178|       |#endif /* ?FULL_UNROLL */
 1179|       |  /*
 1180|       |  * apply last round and
 1181|       |  * map cipher state to byte array block:
 1182|       |  */
 1183|   538k|  s0 =
 1184|   538k|    (Td4[(t0 >> 24)       ] & 0xff000000) ^
 1185|   538k|    (Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^
 1186|   538k|    (Td4[(t2 >>  8) & 0xff] & 0x0000ff00) ^
 1187|   538k|    (Td4[(t1      ) & 0xff] & 0x000000ff) ^
 1188|   538k|    rk[0];
 1189|   538k|  PUTU32(plaintext     , s0);
  ------------------
  |  |  703|   538k|#define PUTU32(ciphertext, st) { \
  |  |  704|   538k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   538k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   538k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   538k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1190|   538k|  s1 =
 1191|   538k|    (Td4[(t1 >> 24)       ] & 0xff000000) ^
 1192|   538k|    (Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
 1193|   538k|    (Td4[(t3 >>  8) & 0xff] & 0x0000ff00) ^
 1194|   538k|    (Td4[(t2      ) & 0xff] & 0x000000ff) ^
 1195|   538k|    rk[1];
 1196|   538k|  PUTU32(plaintext +  4, s1);
  ------------------
  |  |  703|   538k|#define PUTU32(ciphertext, st) { \
  |  |  704|   538k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   538k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   538k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   538k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1197|   538k|  s2 =
 1198|   538k|    (Td4[(t2 >> 24)       ] & 0xff000000) ^
 1199|   538k|    (Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^
 1200|   538k|    (Td4[(t0 >>  8) & 0xff] & 0x0000ff00) ^
 1201|   538k|    (Td4[(t3      ) & 0xff] & 0x000000ff) ^
 1202|   538k|    rk[2];
 1203|   538k|  PUTU32(plaintext +  8, s2);
  ------------------
  |  |  703|   538k|#define PUTU32(ciphertext, st) { \
  |  |  704|   538k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   538k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   538k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   538k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1204|   538k|  s3 =
 1205|   538k|    (Td4[(t3 >> 24)       ] & 0xff000000) ^
 1206|   538k|    (Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
 1207|   538k|    (Td4[(t1 >>  8) & 0xff] & 0x0000ff00) ^
 1208|   538k|    (Td4[(t0      ) & 0xff] & 0x000000ff) ^
 1209|   538k|    rk[3];
 1210|   538k|  PUTU32(plaintext + 12, s3);
  ------------------
  |  |  703|   538k|#define PUTU32(ciphertext, st) { \
  |  |  704|   538k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   538k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   538k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   538k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1211|   538k|}

sph_sha256_init:
  635|  90.2k|{
  636|  90.2k|        sph_sha256_context *sc;
  637|       |
  638|  90.2k|        sc = cc;
  639|  90.2k|        memcpy(sc->val, H256, sizeof H256);
  640|  90.2k|#if SPH_64
  641|  90.2k|        sc->count = 0;
  642|       |#else
  643|       |        sc->count_high = sc->count_low = 0;
  644|       |#endif
  645|  90.2k|}
sph_sha256_close:
  671|  45.1k|{
  672|  45.1k|        sha224_close(cc, dst, 8);
  673|  45.1k|        sph_sha256_init(cc);
  674|  45.1k|}
sha2.c:sha2_round:
  611|  2.99M|{
  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  ------------------
  |  |  197|  2.99M|#define SHA2_ROUND_BODY(in, r)   do { \
  |  |  198|  2.99M|                sph_u32 A, B, C, D, E, F, G, H, T1, T2; \
  |  |  199|  2.99M|                sph_u32 W00, W01, W02, W03, W04, W05, W06, W07; \
  |  |  200|  2.99M|                sph_u32 W08, W09, W10, W11, W12, W13, W14, W15; \
  |  |  201|  2.99M| \
  |  |  202|  2.99M|                A = (r)[0]; \
  |  |  203|  2.99M|                B = (r)[1]; \
  |  |  204|  2.99M|                C = (r)[2]; \
  |  |  205|  2.99M|                D = (r)[3]; \
  |  |  206|  2.99M|                E = (r)[4]; \
  |  |  207|  2.99M|                F = (r)[5]; \
  |  |  208|  2.99M|                G = (r)[6]; \
  |  |  209|  2.99M|                H = (r)[7]; \
  |  |  210|  2.99M|                W00 = in(0); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  211|  2.99M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  212|  2.99M|                        + SPH_C32(0x428A2F98) + W00); \
  |  |  213|  2.99M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  214|  2.99M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  215|  2.99M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  216|  2.99M|                W01 = in(1); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  217|  2.99M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  218|  2.99M|                        + SPH_C32(0x71374491) + W01); \
  |  |  219|  2.99M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  220|  2.99M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  221|  2.99M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  222|  2.99M|                W02 = in(2); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  223|  2.99M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  224|  2.99M|                        + SPH_C32(0xB5C0FBCF) + W02); \
  |  |  225|  2.99M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  226|  2.99M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  227|  2.99M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|  2.99M|                W03 = in(3); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  229|  2.99M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  230|  2.99M|                        + SPH_C32(0xE9B5DBA5) + W03); \
  |  |  231|  2.99M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  232|  2.99M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  233|  2.99M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  234|  2.99M|                W04 = in(4); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  235|  2.99M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  236|  2.99M|                        + SPH_C32(0x3956C25B) + W04); \
  |  |  237|  2.99M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  238|  2.99M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  239|  2.99M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  240|  2.99M|                W05 = in(5); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  241|  2.99M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  242|  2.99M|                        + SPH_C32(0x59F111F1) + W05); \
  |  |  243|  2.99M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  244|  2.99M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  245|  2.99M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  246|  2.99M|                W06 = in(6); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  247|  2.99M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  248|  2.99M|                        + SPH_C32(0x923F82A4) + W06); \
  |  |  249|  2.99M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  250|  2.99M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  251|  2.99M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  252|  2.99M|                W07 = in(7); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  253|  2.99M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  254|  2.99M|                        + SPH_C32(0xAB1C5ED5) + W07); \
  |  |  255|  2.99M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  256|  2.99M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  257|  2.99M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  258|  2.99M|                W08 = in(8); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  259|  2.99M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  260|  2.99M|                        + SPH_C32(0xD807AA98) + W08); \
  |  |  261|  2.99M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  262|  2.99M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  263|  2.99M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  264|  2.99M|                W09 = in(9); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  265|  2.99M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  266|  2.99M|                        + SPH_C32(0x12835B01) + W09); \
  |  |  267|  2.99M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  268|  2.99M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  269|  2.99M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  270|  2.99M|                W10 = in(10); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  271|  2.99M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  272|  2.99M|                        + SPH_C32(0x243185BE) + W10); \
  |  |  273|  2.99M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  274|  2.99M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  275|  2.99M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  276|  2.99M|                W11 = in(11); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  277|  2.99M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  278|  2.99M|                        + SPH_C32(0x550C7DC3) + W11); \
  |  |  279|  2.99M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|  2.99M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  281|  2.99M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  282|  2.99M|                W12 = in(12); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  283|  2.99M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  284|  2.99M|                        + SPH_C32(0x72BE5D74) + W12); \
  |  |  285|  2.99M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  286|  2.99M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  287|  2.99M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  288|  2.99M|                W13 = in(13); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  289|  2.99M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  290|  2.99M|                        + SPH_C32(0x80DEB1FE) + W13); \
  |  |  291|  2.99M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  292|  2.99M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  293|  2.99M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  294|  2.99M|                W14 = in(14); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  295|  2.99M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  296|  2.99M|                        + SPH_C32(0x9BDC06A7) + W14); \
  |  |  297|  2.99M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  298|  2.99M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  299|  2.99M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  300|  2.99M|                W15 = in(15); \
  |  |  ------------------
  |  |  |  |  613|  2.99M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  2.99M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  301|  2.99M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  302|  2.99M|                        + SPH_C32(0xC19BF174) + W15); \
  |  |  303|  2.99M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  304|  2.99M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  305|  2.99M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  306|  2.99M|                W00 = SPH_T32(SSG2_1(W14) + W09 + SSG2_0(W01) + W00); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  307|  2.99M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  308|  2.99M|                        + SPH_C32(0xE49B69C1) + W00); \
  |  |  309|  2.99M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  2.99M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  311|  2.99M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  312|  2.99M|                W01 = SPH_T32(SSG2_1(W15) + W10 + SSG2_0(W02) + W01); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  313|  2.99M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  314|  2.99M|                        + SPH_C32(0xEFBE4786) + W01); \
  |  |  315|  2.99M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  316|  2.99M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  317|  2.99M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  318|  2.99M|                W02 = SPH_T32(SSG2_1(W00) + W11 + SSG2_0(W03) + W02); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  319|  2.99M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  320|  2.99M|                        + SPH_C32(0x0FC19DC6) + W02); \
  |  |  321|  2.99M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  322|  2.99M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  323|  2.99M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  324|  2.99M|                W03 = SPH_T32(SSG2_1(W01) + W12 + SSG2_0(W04) + W03); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  325|  2.99M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  2.99M|                        + SPH_C32(0x240CA1CC) + W03); \
  |  |  327|  2.99M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  328|  2.99M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  329|  2.99M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  330|  2.99M|                W04 = SPH_T32(SSG2_1(W02) + W13 + SSG2_0(W05) + W04); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  331|  2.99M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  332|  2.99M|                        + SPH_C32(0x2DE92C6F) + W04); \
  |  |  333|  2.99M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  334|  2.99M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  335|  2.99M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  336|  2.99M|                W05 = SPH_T32(SSG2_1(W03) + W14 + SSG2_0(W06) + W05); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  337|  2.99M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  338|  2.99M|                        + SPH_C32(0x4A7484AA) + W05); \
  |  |  339|  2.99M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  340|  2.99M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  341|  2.99M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  342|  2.99M|                W06 = SPH_T32(SSG2_1(W04) + W15 + SSG2_0(W07) + W06); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  343|  2.99M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  344|  2.99M|                        + SPH_C32(0x5CB0A9DC) + W06); \
  |  |  345|  2.99M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  346|  2.99M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  347|  2.99M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  348|  2.99M|                W07 = SPH_T32(SSG2_1(W05) + W00 + SSG2_0(W08) + W07); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  349|  2.99M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  350|  2.99M|                        + SPH_C32(0x76F988DA) + W07); \
  |  |  351|  2.99M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  352|  2.99M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  353|  2.99M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  354|  2.99M|                W08 = SPH_T32(SSG2_1(W06) + W01 + SSG2_0(W09) + W08); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  355|  2.99M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  356|  2.99M|                        + SPH_C32(0x983E5152) + W08); \
  |  |  357|  2.99M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  358|  2.99M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  359|  2.99M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  360|  2.99M|                W09 = SPH_T32(SSG2_1(W07) + W02 + SSG2_0(W10) + W09); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  361|  2.99M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  362|  2.99M|                        + SPH_C32(0xA831C66D) + W09); \
  |  |  363|  2.99M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  364|  2.99M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  365|  2.99M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  366|  2.99M|                W10 = SPH_T32(SSG2_1(W08) + W03 + SSG2_0(W11) + W10); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  367|  2.99M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  368|  2.99M|                        + SPH_C32(0xB00327C8) + W10); \
  |  |  369|  2.99M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  370|  2.99M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  371|  2.99M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  2.99M|                W11 = SPH_T32(SSG2_1(W09) + W04 + SSG2_0(W12) + W11); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  373|  2.99M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  374|  2.99M|                        + SPH_C32(0xBF597FC7) + W11); \
  |  |  375|  2.99M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  376|  2.99M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  377|  2.99M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  378|  2.99M|                W12 = SPH_T32(SSG2_1(W10) + W05 + SSG2_0(W13) + W12); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  379|  2.99M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  2.99M|                        + SPH_C32(0xC6E00BF3) + W12); \
  |  |  381|  2.99M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  382|  2.99M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  383|  2.99M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  384|  2.99M|                W13 = SPH_T32(SSG2_1(W11) + W06 + SSG2_0(W14) + W13); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  385|  2.99M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  386|  2.99M|                        + SPH_C32(0xD5A79147) + W13); \
  |  |  387|  2.99M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  388|  2.99M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  389|  2.99M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  390|  2.99M|                W14 = SPH_T32(SSG2_1(W12) + W07 + SSG2_0(W15) + W14); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  391|  2.99M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  392|  2.99M|                        + SPH_C32(0x06CA6351) + W14); \
  |  |  393|  2.99M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  394|  2.99M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  395|  2.99M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  396|  2.99M|                W15 = SPH_T32(SSG2_1(W13) + W08 + SSG2_0(W00) + W15); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  397|  2.99M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  398|  2.99M|                        + SPH_C32(0x14292967) + W15); \
  |  |  399|  2.99M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  400|  2.99M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  401|  2.99M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  402|  2.99M|                W00 = SPH_T32(SSG2_1(W14) + W09 + SSG2_0(W01) + W00); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  403|  2.99M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  404|  2.99M|                        + SPH_C32(0x27B70A85) + W00); \
  |  |  405|  2.99M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  406|  2.99M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  407|  2.99M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  408|  2.99M|                W01 = SPH_T32(SSG2_1(W15) + W10 + SSG2_0(W02) + W01); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  409|  2.99M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  410|  2.99M|                        + SPH_C32(0x2E1B2138) + W01); \
  |  |  411|  2.99M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  412|  2.99M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  413|  2.99M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  414|  2.99M|                W02 = SPH_T32(SSG2_1(W00) + W11 + SSG2_0(W03) + W02); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  415|  2.99M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  416|  2.99M|                        + SPH_C32(0x4D2C6DFC) + W02); \
  |  |  417|  2.99M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  418|  2.99M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  419|  2.99M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  420|  2.99M|                W03 = SPH_T32(SSG2_1(W01) + W12 + SSG2_0(W04) + W03); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  421|  2.99M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  422|  2.99M|                        + SPH_C32(0x53380D13) + W03); \
  |  |  423|  2.99M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  424|  2.99M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  425|  2.99M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  426|  2.99M|                W04 = SPH_T32(SSG2_1(W02) + W13 + SSG2_0(W05) + W04); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  427|  2.99M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  428|  2.99M|                        + SPH_C32(0x650A7354) + W04); \
  |  |  429|  2.99M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  430|  2.99M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  431|  2.99M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  432|  2.99M|                W05 = SPH_T32(SSG2_1(W03) + W14 + SSG2_0(W06) + W05); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  433|  2.99M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  434|  2.99M|                        + SPH_C32(0x766A0ABB) + W05); \
  |  |  435|  2.99M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  436|  2.99M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  437|  2.99M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  438|  2.99M|                W06 = SPH_T32(SSG2_1(W04) + W15 + SSG2_0(W07) + W06); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  439|  2.99M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  440|  2.99M|                        + SPH_C32(0x81C2C92E) + W06); \
  |  |  441|  2.99M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  442|  2.99M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  443|  2.99M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  444|  2.99M|                W07 = SPH_T32(SSG2_1(W05) + W00 + SSG2_0(W08) + W07); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  445|  2.99M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  446|  2.99M|                        + SPH_C32(0x92722C85) + W07); \
  |  |  447|  2.99M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  448|  2.99M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  449|  2.99M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  450|  2.99M|                W08 = SPH_T32(SSG2_1(W06) + W01 + SSG2_0(W09) + W08); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  451|  2.99M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  452|  2.99M|                        + SPH_C32(0xA2BFE8A1) + W08); \
  |  |  453|  2.99M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  454|  2.99M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  455|  2.99M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  456|  2.99M|                W09 = SPH_T32(SSG2_1(W07) + W02 + SSG2_0(W10) + W09); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  457|  2.99M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  458|  2.99M|                        + SPH_C32(0xA81A664B) + W09); \
  |  |  459|  2.99M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  460|  2.99M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  461|  2.99M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  462|  2.99M|                W10 = SPH_T32(SSG2_1(W08) + W03 + SSG2_0(W11) + W10); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  463|  2.99M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  464|  2.99M|                        + SPH_C32(0xC24B8B70) + W10); \
  |  |  465|  2.99M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  466|  2.99M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  467|  2.99M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  468|  2.99M|                W11 = SPH_T32(SSG2_1(W09) + W04 + SSG2_0(W12) + W11); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  469|  2.99M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  470|  2.99M|                        + SPH_C32(0xC76C51A3) + W11); \
  |  |  471|  2.99M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  472|  2.99M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  473|  2.99M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  474|  2.99M|                W12 = SPH_T32(SSG2_1(W10) + W05 + SSG2_0(W13) + W12); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  475|  2.99M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  476|  2.99M|                        + SPH_C32(0xD192E819) + W12); \
  |  |  477|  2.99M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  478|  2.99M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  479|  2.99M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  480|  2.99M|                W13 = SPH_T32(SSG2_1(W11) + W06 + SSG2_0(W14) + W13); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  481|  2.99M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  482|  2.99M|                        + SPH_C32(0xD6990624) + W13); \
  |  |  483|  2.99M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  484|  2.99M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  485|  2.99M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  486|  2.99M|                W14 = SPH_T32(SSG2_1(W12) + W07 + SSG2_0(W15) + W14); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  487|  2.99M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  2.99M|                        + SPH_C32(0xF40E3585) + W14); \
  |  |  489|  2.99M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  490|  2.99M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  491|  2.99M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  492|  2.99M|                W15 = SPH_T32(SSG2_1(W13) + W08 + SSG2_0(W00) + W15); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  493|  2.99M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  494|  2.99M|                        + SPH_C32(0x106AA070) + W15); \
  |  |  495|  2.99M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  496|  2.99M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  497|  2.99M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  498|  2.99M|                W00 = SPH_T32(SSG2_1(W14) + W09 + SSG2_0(W01) + W00); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  499|  2.99M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  500|  2.99M|                        + SPH_C32(0x19A4C116) + W00); \
  |  |  501|  2.99M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  502|  2.99M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  503|  2.99M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  504|  2.99M|                W01 = SPH_T32(SSG2_1(W15) + W10 + SSG2_0(W02) + W01); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  505|  2.99M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  506|  2.99M|                        + SPH_C32(0x1E376C08) + W01); \
  |  |  507|  2.99M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  508|  2.99M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  509|  2.99M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  510|  2.99M|                W02 = SPH_T32(SSG2_1(W00) + W11 + SSG2_0(W03) + W02); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  511|  2.99M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  512|  2.99M|                        + SPH_C32(0x2748774C) + W02); \
  |  |  513|  2.99M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  514|  2.99M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  515|  2.99M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  516|  2.99M|                W03 = SPH_T32(SSG2_1(W01) + W12 + SSG2_0(W04) + W03); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  517|  2.99M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  518|  2.99M|                        + SPH_C32(0x34B0BCB5) + W03); \
  |  |  519|  2.99M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  520|  2.99M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  521|  2.99M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  522|  2.99M|                W04 = SPH_T32(SSG2_1(W02) + W13 + SSG2_0(W05) + W04); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|  2.99M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  524|  2.99M|                        + SPH_C32(0x391C0CB3) + W04); \
  |  |  525|  2.99M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  526|  2.99M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  527|  2.99M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  528|  2.99M|                W05 = SPH_T32(SSG2_1(W03) + W14 + SSG2_0(W06) + W05); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  529|  2.99M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  530|  2.99M|                        + SPH_C32(0x4ED8AA4A) + W05); \
  |  |  531|  2.99M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  532|  2.99M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  533|  2.99M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  534|  2.99M|                W06 = SPH_T32(SSG2_1(W04) + W15 + SSG2_0(W07) + W06); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  535|  2.99M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  536|  2.99M|                        + SPH_C32(0x5B9CCA4F) + W06); \
  |  |  537|  2.99M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  538|  2.99M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  539|  2.99M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  540|  2.99M|                W07 = SPH_T32(SSG2_1(W05) + W00 + SSG2_0(W08) + W07); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  541|  2.99M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  542|  2.99M|                        + SPH_C32(0x682E6FF3) + W07); \
  |  |  543|  2.99M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  544|  2.99M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  545|  2.99M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  546|  2.99M|                W08 = SPH_T32(SSG2_1(W06) + W01 + SSG2_0(W09) + W08); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  547|  2.99M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  548|  2.99M|                        + SPH_C32(0x748F82EE) + W08); \
  |  |  549|  2.99M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  550|  2.99M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  551|  2.99M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  552|  2.99M|                W09 = SPH_T32(SSG2_1(W07) + W02 + SSG2_0(W10) + W09); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  553|  2.99M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  554|  2.99M|                        + SPH_C32(0x78A5636F) + W09); \
  |  |  555|  2.99M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  556|  2.99M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  557|  2.99M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  558|  2.99M|                W10 = SPH_T32(SSG2_1(W08) + W03 + SSG2_0(W11) + W10); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  559|  2.99M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  560|  2.99M|                        + SPH_C32(0x84C87814) + W10); \
  |  |  561|  2.99M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  562|  2.99M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  563|  2.99M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  564|  2.99M|                W11 = SPH_T32(SSG2_1(W09) + W04 + SSG2_0(W12) + W11); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|  2.99M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  566|  2.99M|                        + SPH_C32(0x8CC70208) + W11); \
  |  |  567|  2.99M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  568|  2.99M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  569|  2.99M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  570|  2.99M|                W12 = SPH_T32(SSG2_1(W10) + W05 + SSG2_0(W13) + W12); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  571|  2.99M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  572|  2.99M|                        + SPH_C32(0x90BEFFFA) + W12); \
  |  |  573|  2.99M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  574|  2.99M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  575|  2.99M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  576|  2.99M|                W13 = SPH_T32(SSG2_1(W11) + W06 + SSG2_0(W14) + W13); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  577|  2.99M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  578|  2.99M|                        + SPH_C32(0xA4506CEB) + W13); \
  |  |  579|  2.99M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  580|  2.99M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  581|  2.99M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  582|  2.99M|                W14 = SPH_T32(SSG2_1(W12) + W07 + SSG2_0(W15) + W14); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  583|  2.99M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  584|  2.99M|                        + SPH_C32(0xBEF9A3F7) + W14); \
  |  |  585|  2.99M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  586|  2.99M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  587|  2.99M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  588|  2.99M|                W15 = SPH_T32(SSG2_1(W13) + W08 + SSG2_0(W00) + W15); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  589|  2.99M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  590|  2.99M|                        + SPH_C32(0xC67178F2) + W15); \
  |  |  591|  2.99M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  592|  2.99M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  593|  2.99M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  594|  2.99M|                (r)[0] = SPH_T32((r)[0] + A); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  595|  2.99M|                (r)[1] = SPH_T32((r)[1] + B); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  596|  2.99M|                (r)[2] = SPH_T32((r)[2] + C); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  597|  2.99M|                (r)[3] = SPH_T32((r)[3] + D); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  598|  2.99M|                (r)[4] = SPH_T32((r)[4] + E); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  599|  2.99M|                (r)[5] = SPH_T32((r)[5] + F); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  600|  2.99M|                (r)[6] = SPH_T32((r)[6] + G); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  601|  2.99M|                (r)[7] = SPH_T32((r)[7] + H); \
  |  |  ------------------
  |  |  |  |  938|  2.99M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  2.99M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  602|  2.99M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (602:18): [Folded, False: 2.99M]
  |  |  ------------------
  ------------------
  614|  2.99M|#undef SHA2_IN
  615|  2.99M|}

sph_sha384_init:
  183|  83.0k|{
  184|  83.0k|        sph_sha384_context *sc;
  185|       |
  186|  83.0k|        sc = cc;
  187|  83.0k|        memcpy(sc->val, H384, sizeof H384);
  188|  83.0k|        sc->count = 0;
  189|  83.0k|}
sph_sha512_init:
  194|  85.8k|{
  195|  85.8k|        sph_sha512_context *sc;
  196|       |
  197|  85.8k|        sc = cc;
  198|  85.8k|        memcpy(sc->val, H512, sizeof H512);
  199|  85.8k|        sc->count = 0;
  200|  85.8k|}
sph_sha384_close:
  210|  41.5k|{
  211|  41.5k|        sha384_close(cc, dst, 6);
  212|  41.5k|        sph_sha384_init(cc);
  213|  41.5k|}
sph_sha512_close:
  226|  42.9k|{
  227|  42.9k|        sha384_close(cc, dst, 8);
  228|  42.9k|        sph_sha512_init(cc);
  229|  42.9k|}
sha2big.c:sha3_round:
  174|  2.94M|{
  175|  2.94M|#define SHA3_IN(x)   sph_dec64be_aligned(data + (8 * (x)))
  176|  2.94M|        SHA3_ROUND_BODY(SHA3_IN, r);
  ------------------
  |  |  131|  2.94M|#define SHA3_ROUND_BODY(in, r)   do { \
  |  |  132|  2.94M|                int i; \
  |  |  133|  2.94M|                sph_u64 A, B, C, D, E, F, G, H; \
  |  |  134|  2.94M|                sph_u64 W[80]; \
  |  |  135|  2.94M| \
  |  |  136|  50.0M|                for (i = 0; i < 16; i ++) \
  |  |  ------------------
  |  |  |  Branch (136:29): [True: 47.0M, False: 2.94M]
  |  |  ------------------
  |  |  137|  47.0M|                        W[i] = in(i); \
  |  |  ------------------
  |  |  |  |  176|  47.0M|        SHA3_ROUND_BODY(SHA3_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|  47.0M|#define SHA3_IN(x)   sph_dec64be_aligned(data + (8 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|   191M|                for (i = 16; i < 80; i ++) \
  |  |  ------------------
  |  |  |  Branch (138:30): [True: 188M, False: 2.94M]
  |  |  ------------------
  |  |  139|   188M|                        W[i] = SPH_T64(SSG5_1(W[i - 2]) + W[i - 7] \
  |  |  ------------------
  |  |  |  |  944|   188M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|   188M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  140|  2.94M|                                + SSG5_0(W[i - 15]) + W[i - 16]); \
  |  |  141|  2.94M|                A = (r)[0]; \
  |  |  142|  2.94M|                B = (r)[1]; \
  |  |  143|  2.94M|                C = (r)[2]; \
  |  |  144|  2.94M|                D = (r)[3]; \
  |  |  145|  2.94M|                E = (r)[4]; \
  |  |  146|  2.94M|                F = (r)[5]; \
  |  |  147|  2.94M|                G = (r)[6]; \
  |  |  148|  2.94M|                H = (r)[7]; \
  |  |  149|  32.3M|                for (i = 0; i < 80; i += 8) { \
  |  |  ------------------
  |  |  |  Branch (149:29): [True: 29.4M, False: 2.94M]
  |  |  ------------------
  |  |  150|  29.4M|                        SHA3_STEP(A, B, C, D, E, F, G, H, i + 0); \
  |  |  ------------------
  |  |  |  |  123|  29.4M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  29.4M|                sph_u64 T1, T2; \
  |  |  |  |  125|  29.4M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  29.4M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  29.4M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  29.4M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  29.4M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 29.4M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  151|  29.4M|                        SHA3_STEP(H, A, B, C, D, E, F, G, i + 1); \
  |  |  ------------------
  |  |  |  |  123|  29.4M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  29.4M|                sph_u64 T1, T2; \
  |  |  |  |  125|  29.4M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  29.4M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  29.4M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  29.4M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  29.4M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 29.4M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|  29.4M|                        SHA3_STEP(G, H, A, B, C, D, E, F, i + 2); \
  |  |  ------------------
  |  |  |  |  123|  29.4M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  29.4M|                sph_u64 T1, T2; \
  |  |  |  |  125|  29.4M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  29.4M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  29.4M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  29.4M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  29.4M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 29.4M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  29.4M|                        SHA3_STEP(F, G, H, A, B, C, D, E, i + 3); \
  |  |  ------------------
  |  |  |  |  123|  29.4M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  29.4M|                sph_u64 T1, T2; \
  |  |  |  |  125|  29.4M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  29.4M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  29.4M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  29.4M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  29.4M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 29.4M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  29.4M|                        SHA3_STEP(E, F, G, H, A, B, C, D, i + 4); \
  |  |  ------------------
  |  |  |  |  123|  29.4M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  29.4M|                sph_u64 T1, T2; \
  |  |  |  |  125|  29.4M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  29.4M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  29.4M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  29.4M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  29.4M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 29.4M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  29.4M|                        SHA3_STEP(D, E, F, G, H, A, B, C, i + 5); \
  |  |  ------------------
  |  |  |  |  123|  29.4M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  29.4M|                sph_u64 T1, T2; \
  |  |  |  |  125|  29.4M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  29.4M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  29.4M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  29.4M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  29.4M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 29.4M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  156|  29.4M|                        SHA3_STEP(C, D, E, F, G, H, A, B, i + 6); \
  |  |  ------------------
  |  |  |  |  123|  29.4M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  29.4M|                sph_u64 T1, T2; \
  |  |  |  |  125|  29.4M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  29.4M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  29.4M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  29.4M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  29.4M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 29.4M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  157|  29.4M|                        SHA3_STEP(B, C, D, E, F, G, H, A, i + 7); \
  |  |  ------------------
  |  |  |  |  123|  29.4M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  29.4M|                sph_u64 T1, T2; \
  |  |  |  |  125|  29.4M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  29.4M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  29.4M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  29.4M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  29.4M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  29.4M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  29.4M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 29.4M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  158|  29.4M|                } \
  |  |  159|  2.94M|                (r)[0] = SPH_T64((r)[0] + A); \
  |  |  ------------------
  |  |  |  |  944|  2.94M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  2.94M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  160|  2.94M|                (r)[1] = SPH_T64((r)[1] + B); \
  |  |  ------------------
  |  |  |  |  944|  2.94M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  2.94M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  161|  2.94M|                (r)[2] = SPH_T64((r)[2] + C); \
  |  |  ------------------
  |  |  |  |  944|  2.94M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  2.94M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  162|  2.94M|                (r)[3] = SPH_T64((r)[3] + D); \
  |  |  ------------------
  |  |  |  |  944|  2.94M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  2.94M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  2.94M|                (r)[4] = SPH_T64((r)[4] + E); \
  |  |  ------------------
  |  |  |  |  944|  2.94M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  2.94M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  164|  2.94M|                (r)[5] = SPH_T64((r)[5] + F); \
  |  |  ------------------
  |  |  |  |  944|  2.94M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  2.94M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  165|  2.94M|                (r)[6] = SPH_T64((r)[6] + G); \
  |  |  ------------------
  |  |  |  |  944|  2.94M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  2.94M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  166|  2.94M|                (r)[7] = SPH_T64((r)[7] + H); \
  |  |  ------------------
  |  |  |  |  944|  2.94M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  2.94M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  167|  2.94M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (167:18): [Folded, False: 2.94M]
  |  |  ------------------
  ------------------
  177|  2.94M|#undef SHA3_IN
  178|  2.94M|}

sph_sha224:
  173|  45.9k|{
  174|  45.9k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  45.9k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  45.9k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|  45.9k|        unsigned current;
  176|  45.9k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|  45.9k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   95|  45.9k|#define SPH_BLEN     64U
  ------------------
  |  Branch (181:13): [True: 2.63k, False: 43.2k]
  ------------------
  182|  2.63k|                SPH_XCAT(HASH, _short)(cc, data, len);
  ------------------
  |  |   85|  2.63k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  2.63k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  183|  2.63k|                return;
  184|  2.63k|        }
  185|  43.2k|        sc = cc;
  186|  43.2k|#if SPH_64
  187|  43.2k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  43.2k|#define SPH_BLEN     64U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|  43.2k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 43.2k]
  ------------------
  192|      0|                unsigned t;
  193|       |
  194|      0|                t = SPH_BLEN - current;
  ------------------
  |  |   95|      0|#define SPH_BLEN     64U
  ------------------
  195|      0|                SPH_XCAT(HASH, _short)(cc, data, t);
  ------------------
  |  |   85|      0|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|      0|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  196|      0|                data = (const unsigned char *)data + t;
  197|      0|                len -= t;
  198|      0|        }
  199|       |#if !SPH_UNALIGNED
  200|       |        if (((SPH_UPTR)data & (SPH_WLEN - 1U)) != 0) {
  201|       |                SPH_XCAT(HASH, _short)(cc, data, len);
  202|       |                return;
  203|       |        }
  204|       |#endif
  205|  43.2k|        orig_len = len;
  206|  2.98M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   95|  2.98M|#define SPH_BLEN     64U
  ------------------
  |  Branch (206:16): [True: 2.94M, False: 43.2k]
  ------------------
  207|  2.94M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  647|  2.94M|#define RFUN   sha2_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  2.94M|#define SPH_VAL   sc->val
  ------------------
  208|  2.94M|                len -= SPH_BLEN;
  ------------------
  |  |   95|  2.94M|#define SPH_BLEN     64U
  ------------------
  209|  2.94M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   95|  2.94M|#define SPH_BLEN     64U
  ------------------
  210|  2.94M|        }
  211|  43.2k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 0, False: 43.2k]
  ------------------
  212|      0|                memcpy(sc->buf, data, len);
  213|  43.2k|#if SPH_64
  214|  43.2k|        sc->count += (sph_u64)orig_len;
  215|       |#else
  216|       |        clow = sc->count_low;
  217|       |        clow2 = SPH_T32(clow + orig_len);
  218|       |        sc->count_low = clow2;
  219|       |        if (clow2 < clow)
  220|       |                sc->count_high ++;
  221|       |        /*
  222|       |         * This code handles the improbable situation where "size_t" is
  223|       |         * greater than 32 bits, and yet we do not have a 64-bit type.
  224|       |         */
  225|       |        orig_len >>= 12;
  226|       |        orig_len >>= 10;
  227|       |        orig_len >>= 10;
  228|       |        sc->count_high += orig_len;
  229|       |#endif
  230|  43.2k|}
sha2.c:sha224_short:
  131|  2.63k|{
  132|  2.63k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  2.63k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  2.63k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  133|  2.63k|        unsigned current;
  134|       |
  135|  2.63k|        sc = cc;
  136|  2.63k|#if SPH_64
  137|  2.63k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  2.63k|#define SPH_BLEN     64U
  ------------------
  138|       |#else
  139|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  140|       |#endif
  141|  5.27k|        while (len > 0) {
  ------------------
  |  Branch (141:16): [True: 2.63k, False: 2.63k]
  ------------------
  142|  2.63k|                unsigned clen;
  143|       |#if !SPH_64
  144|       |                sph_u32 clow, clow2;
  145|       |#endif
  146|       |
  147|  2.63k|                clen = SPH_BLEN - current;
  ------------------
  |  |   95|  2.63k|#define SPH_BLEN     64U
  ------------------
  148|  2.63k|                if (clen > len)
  ------------------
  |  Branch (148:21): [True: 2.63k, False: 0]
  ------------------
  149|  2.63k|                        clen = (unsigned)len;
  150|  2.63k|                memcpy(sc->buf + current, data, clen);
  151|  2.63k|                data = (const unsigned char *)data + clen;
  152|  2.63k|                current += clen;
  153|  2.63k|                len -= clen;
  154|  2.63k|                if (current == SPH_BLEN) {
  ------------------
  |  |   95|  2.63k|#define SPH_BLEN     64U
  ------------------
  |  Branch (154:21): [True: 0, False: 2.63k]
  ------------------
  155|      0|                        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|      0|#define RFUN   sha2_round
  ------------------
                                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|      0|#define SPH_VAL   sc->val
  ------------------
  156|      0|                        current = 0;
  157|      0|                }
  158|  2.63k|#if SPH_64
  159|  2.63k|                sc->count += clen;
  160|       |#else
  161|       |                clow = sc->count_low;
  162|       |                clow2 = SPH_T32(clow + clen);
  163|       |                sc->count_low = clow2;
  164|       |                if (clow2 < clow)
  165|       |                        sc->count_high ++;
  166|       |#endif
  167|  2.63k|        }
  168|  2.63k|}
sha2.c:sha224_close:
  345|  45.1k|{
  346|  45.1k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|  45.1k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  45.1k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|  45.1k|}
sha2.c:sha224_addbits_and_close:
  242|  45.1k|{
  243|  45.1k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  45.1k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  45.1k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|  45.1k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|  45.1k|        sc = cc;
  250|  45.1k|#if SPH_64
  251|  45.1k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  45.1k|#define SPH_BLEN     64U
  ------------------
  252|       |#else
  253|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  254|       |#endif
  255|       |#ifdef PW01
  256|       |        sc->buf[current ++] = (0x100 | (ub & 0xFF)) >> (8 - n);
  257|       |#else
  258|  45.1k|        {
  259|  45.1k|                unsigned z;
  260|       |
  261|  45.1k|                z = 0x80U >> n;
  262|  45.1k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|  45.1k|        }
  264|  45.1k|#endif
  265|  45.1k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|  45.1k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  45.1k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  45.1k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 786, False: 44.3k]
  ------------------
  266|    786|                memset(sc->buf + current, 0, SPH_BLEN - current);
  ------------------
  |  |   95|    786|#define SPH_BLEN     64U
  ------------------
  267|    786|                RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|    786|#define RFUN   sha2_round
  ------------------
                              RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|    786|#define SPH_VAL   sc->val
  ------------------
  268|    786|                memset(sc->buf, 0, SPH_MAXPAD);
  ------------------
  |  |  110|    786|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|    786|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|    786|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  269|  44.3k|        } else {
  270|  44.3k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|  44.3k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  44.3k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  44.3k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  271|  44.3k|        }
  272|       |#if defined BE64
  273|       |#if defined PLW1
  274|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  275|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  276|       |#elif defined PLW4
  277|       |        memset(sc->buf + SPH_MAXPAD, 0, 2 * SPH_WLEN);
  278|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + 2 * SPH_WLEN,
  279|       |                sc->count >> 61);
  280|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + 3 * SPH_WLEN,
  281|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  282|       |#else
  283|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD, sc->count >> 61);
  284|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  285|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  286|       |#endif
  287|       |#elif defined LE64
  288|       |#if defined PLW1
  289|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  290|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  291|       |#elif defined PLW1
  292|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  293|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  294|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN, sc->count >> 61);
  295|       |        memset(sc->buf + SPH_MAXPAD + 2 * SPH_WLEN, 0, 2 * SPH_WLEN);
  296|       |#else
  297|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  298|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  299|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN, sc->count >> 61);
  300|       |#endif
  301|       |#else
  302|  45.1k|#if SPH_64
  303|  45.1k|#ifdef BE32
  304|  45.1k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  ------------------
  |  |  110|  45.1k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  45.1k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  45.1k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  305|  45.1k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|  45.1k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|  45.1k|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  ------------------
  ------------------
  306|       |#else
  307|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  308|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  309|       |#endif
  310|       |#else
  311|       |        low = sc->count_low;
  312|       |        high = SPH_T32((sc->count_high << 3) | (low >> 29));
  313|       |        low = SPH_T32(low << 3) + (sph_u32)n;
  314|       |#ifdef BE32
  315|       |        sph_enc32be(sc->buf + SPH_MAXPAD, high);
  316|       |        sph_enc32be(sc->buf + SPH_MAXPAD + SPH_WLEN, low);
  317|       |#else
  318|       |        sph_enc32le(sc->buf + SPH_MAXPAD, low);
  319|       |        sph_enc32le(sc->buf + SPH_MAXPAD + SPH_WLEN, high);
  320|       |#endif
  321|       |#endif
  322|  45.1k|#endif
  323|  45.1k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|  45.1k|#define RFUN   sha2_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|  45.1k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|   406k|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 360k, False: 45.1k]
  ------------------
  330|       |#if defined BE64
  331|       |                sph_enc64be((unsigned char *)dst + 8 * u, sc->val[u]);
  332|       |#elif defined LE64
  333|       |                sph_enc64le((unsigned char *)dst + 8 * u, sc->val[u]);
  334|       |#elif defined BE32
  335|       |                sph_enc32be((unsigned char *)dst + 4 * u, sc->val[u]);
  336|       |#else
  337|       |                sph_enc32le((unsigned char *)dst + 4 * u, sc->val[u]);
  338|       |#endif
  339|   360k|        }
  340|  45.1k|#endif
  341|  45.1k|}
sph_sha384:
  173|  84.4k|{
  174|  84.4k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  84.4k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  84.4k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|  84.4k|        unsigned current;
  176|  84.4k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|  84.4k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   92|  84.4k|#define SPH_BLEN    128U
  ------------------
  |  Branch (181:13): [True: 0, False: 84.4k]
  ------------------
  182|      0|                SPH_XCAT(HASH, _short)(cc, data, len);
  ------------------
  |  |   85|      0|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|      0|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  183|      0|                return;
  184|      0|        }
  185|  84.4k|        sc = cc;
  186|  84.4k|#if SPH_64
  187|  84.4k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|  84.4k|#define SPH_BLEN    128U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|  84.4k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 84.4k]
  ------------------
  192|      0|                unsigned t;
  193|       |
  194|      0|                t = SPH_BLEN - current;
  ------------------
  |  |   92|      0|#define SPH_BLEN    128U
  ------------------
  195|      0|                SPH_XCAT(HASH, _short)(cc, data, t);
  ------------------
  |  |   85|      0|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|      0|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  196|      0|                data = (const unsigned char *)data + t;
  197|      0|                len -= t;
  198|      0|        }
  199|       |#if !SPH_UNALIGNED
  200|       |        if (((SPH_UPTR)data & (SPH_WLEN - 1U)) != 0) {
  201|       |                SPH_XCAT(HASH, _short)(cc, data, len);
  202|       |                return;
  203|       |        }
  204|       |#endif
  205|  84.4k|        orig_len = len;
  206|  2.94M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   92|  2.94M|#define SPH_BLEN    128U
  ------------------
  |  Branch (206:16): [True: 2.85M, False: 84.4k]
  ------------------
  207|  2.85M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  202|  2.85M|#define RFUN   sha3_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  2.85M|#define SPH_VAL   sc->val
  ------------------
  208|  2.85M|                len -= SPH_BLEN;
  ------------------
  |  |   92|  2.85M|#define SPH_BLEN    128U
  ------------------
  209|  2.85M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   92|  2.85M|#define SPH_BLEN    128U
  ------------------
  210|  2.85M|        }
  211|  84.4k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 0, False: 84.4k]
  ------------------
  212|      0|                memcpy(sc->buf, data, len);
  213|  84.4k|#if SPH_64
  214|  84.4k|        sc->count += (sph_u64)orig_len;
  215|       |#else
  216|       |        clow = sc->count_low;
  217|       |        clow2 = SPH_T32(clow + orig_len);
  218|       |        sc->count_low = clow2;
  219|       |        if (clow2 < clow)
  220|       |                sc->count_high ++;
  221|       |        /*
  222|       |         * This code handles the improbable situation where "size_t" is
  223|       |         * greater than 32 bits, and yet we do not have a 64-bit type.
  224|       |         */
  225|       |        orig_len >>= 12;
  226|       |        orig_len >>= 10;
  227|       |        orig_len >>= 10;
  228|       |        sc->count_high += orig_len;
  229|       |#endif
  230|  84.4k|}
sha2big.c:sha384_close:
  345|  84.4k|{
  346|  84.4k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|  84.4k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  84.4k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|  84.4k|}
sha2big.c:sha384_addbits_and_close:
  242|  84.4k|{
  243|  84.4k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  84.4k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  84.4k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|  84.4k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|  84.4k|        sc = cc;
  250|  84.4k|#if SPH_64
  251|  84.4k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|  84.4k|#define SPH_BLEN    128U
  ------------------
  252|       |#else
  253|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  254|       |#endif
  255|       |#ifdef PW01
  256|       |        sc->buf[current ++] = (0x100 | (ub & 0xFF)) >> (8 - n);
  257|       |#else
  258|  84.4k|        {
  259|  84.4k|                unsigned z;
  260|       |
  261|  84.4k|                z = 0x80U >> n;
  262|  84.4k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|  84.4k|        }
  264|  84.4k|#endif
  265|  84.4k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|  84.4k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  84.4k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  84.4k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 0, False: 84.4k]
  ------------------
  266|      0|                memset(sc->buf + current, 0, SPH_BLEN - current);
  ------------------
  |  |   92|      0|#define SPH_BLEN    128U
  ------------------
  267|      0|                RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  202|      0|#define RFUN   sha3_round
  ------------------
                              RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|      0|#define SPH_VAL   sc->val
  ------------------
  268|      0|                memset(sc->buf, 0, SPH_MAXPAD);
  ------------------
  |  |  110|      0|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|      0|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|      0|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  269|  84.4k|        } else {
  270|  84.4k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|  84.4k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  84.4k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  84.4k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  271|  84.4k|        }
  272|  84.4k|#if defined BE64
  273|       |#if defined PLW1
  274|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  275|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  276|       |#elif defined PLW4
  277|       |        memset(sc->buf + SPH_MAXPAD, 0, 2 * SPH_WLEN);
  278|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + 2 * SPH_WLEN,
  279|       |                sc->count >> 61);
  280|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + 3 * SPH_WLEN,
  281|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  282|       |#else
  283|  84.4k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD, sc->count >> 61);
  ------------------
  |  |  110|  84.4k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  84.4k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  84.4k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  284|  84.4k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |  110|  84.4k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  84.4k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  84.4k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
                      sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |   93|  84.4k|#define SPH_WLEN      8U
  ------------------
  285|  84.4k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|  84.4k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|  84.4k|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  ------------------
  ------------------
  286|  84.4k|#endif
  287|       |#elif defined LE64
  288|       |#if defined PLW1
  289|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  290|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  291|       |#elif defined PLW1
  292|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  293|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  294|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN, sc->count >> 61);
  295|       |        memset(sc->buf + SPH_MAXPAD + 2 * SPH_WLEN, 0, 2 * SPH_WLEN);
  296|       |#else
  297|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  298|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  299|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN, sc->count >> 61);
  300|       |#endif
  301|       |#else
  302|       |#if SPH_64
  303|       |#ifdef BE32
  304|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  305|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  306|       |#else
  307|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  308|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  309|       |#endif
  310|       |#else
  311|       |        low = sc->count_low;
  312|       |        high = SPH_T32((sc->count_high << 3) | (low >> 29));
  313|       |        low = SPH_T32(low << 3) + (sph_u32)n;
  314|       |#ifdef BE32
  315|       |        sph_enc32be(sc->buf + SPH_MAXPAD, high);
  316|       |        sph_enc32be(sc->buf + SPH_MAXPAD + SPH_WLEN, low);
  317|       |#else
  318|       |        sph_enc32le(sc->buf + SPH_MAXPAD, low);
  319|       |        sph_enc32le(sc->buf + SPH_MAXPAD + SPH_WLEN, high);
  320|       |#endif
  321|       |#endif
  322|       |#endif
  323|  84.4k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  202|  84.4k|#define RFUN   sha3_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|  84.4k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|   676k|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 592k, False: 84.4k]
  ------------------
  330|   592k|#if defined BE64
  331|   592k|                sph_enc64be((unsigned char *)dst + 8 * u, sc->val[u]);
  332|       |#elif defined LE64
  333|       |                sph_enc64le((unsigned char *)dst + 8 * u, sc->val[u]);
  334|       |#elif defined BE32
  335|       |                sph_enc32be((unsigned char *)dst + 4 * u, sc->val[u]);
  336|       |#else
  337|       |                sph_enc32le((unsigned char *)dst + 4 * u, sc->val[u]);
  338|       |#endif
  339|   592k|        }
  340|  84.4k|#endif
  341|  84.4k|}

sha2.c:sph_dec32be_aligned:
 1471|  47.8M|{
 1472|  47.8M|#if SPH_LITTLE_ENDIAN
 1473|  47.8M|        return sph_bswap32(*(const sph_u32 *)src);
 1474|       |#elif SPH_BIG_ENDIAN
 1475|       |        return *(const sph_u32 *)src;
 1476|       |#else
 1477|       |        return ((sph_u32)(((const unsigned char *)src)[0]) << 24)
 1478|       |                | ((sph_u32)(((const unsigned char *)src)[1]) << 16)
 1479|       |                | ((sph_u32)(((const unsigned char *)src)[2]) << 8)
 1480|       |                | (sph_u32)(((const unsigned char *)src)[3]);
 1481|       |#endif
 1482|  47.8M|}
sha2.c:sph_bswap32:
 1220|  48.2M|{
 1221|  48.2M|        __asm__ __volatile__ ("bswapl %0" : "=r" (x) : "0" (x));
 1222|  48.2M|        return x;
 1223|  48.2M|}
sha2.c:sph_enc64be_aligned:
 1706|  45.1k|{
 1707|  45.1k|#if SPH_LITTLE_ENDIAN
 1708|  45.1k|        *(sph_u64 *)dst = sph_bswap64(val);
 1709|       |#elif SPH_BIG_ENDIAN
 1710|       |        *(sph_u64 *)dst = val;
 1711|       |#else
 1712|       |        ((unsigned char *)dst)[0] = (unsigned char)(val >> 56);
 1713|       |        ((unsigned char *)dst)[1] = (unsigned char)(val >> 48);
 1714|       |        ((unsigned char *)dst)[2] = (unsigned char)(val >> 40);
 1715|       |        ((unsigned char *)dst)[3] = (unsigned char)(val >> 32);
 1716|       |        ((unsigned char *)dst)[4] = (unsigned char)(val >> 24);
 1717|       |        ((unsigned char *)dst)[5] = (unsigned char)(val >> 16);
 1718|       |        ((unsigned char *)dst)[6] = (unsigned char)(val >> 8);
 1719|       |        ((unsigned char *)dst)[7] = (unsigned char)(val);
 1720|       |#endif
 1721|  45.1k|}
sha2.c:sph_bswap64:
 1229|  45.1k|{
 1230|  45.1k|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|  45.1k|        return x;
 1232|  45.1k|}
sha2.c:sph_enc32be:
 1374|   360k|{
 1375|   360k|#if defined SPH_UPTR
 1376|   360k|#if SPH_UNALIGNED
 1377|   360k|#if SPH_LITTLE_ENDIAN
 1378|   360k|        val = sph_bswap32(val);
 1379|   360k|#endif
 1380|   360k|        *(sph_u32 *)dst = val;
 1381|       |#else
 1382|       |        if (((SPH_UPTR)dst & 3) == 0) {
 1383|       |#if SPH_LITTLE_ENDIAN
 1384|       |                val = sph_bswap32(val);
 1385|       |#endif
 1386|       |                *(sph_u32 *)dst = val;
 1387|       |        } else {
 1388|       |                ((unsigned char *)dst)[0] = (unsigned char)(val >> 24);
 1389|       |                ((unsigned char *)dst)[1] = (unsigned char)(val >> 16);
 1390|       |                ((unsigned char *)dst)[2] = (unsigned char)(val >> 8);
 1391|       |                ((unsigned char *)dst)[3] = (unsigned char)(val);
 1392|       |        }
 1393|       |#endif
 1394|       |#else
 1395|       |        ((unsigned char *)dst)[0] = (unsigned char)(val >> 24);
 1396|       |        ((unsigned char *)dst)[1] = (unsigned char)(val >> 16);
 1397|       |        ((unsigned char *)dst)[2] = (unsigned char)(val >> 8);
 1398|       |        ((unsigned char *)dst)[3] = (unsigned char)(val);
 1399|       |#endif
 1400|   360k|}
sha2big.c:sph_dec64be_aligned:
 1778|  47.0M|{
 1779|  47.0M|#if SPH_LITTLE_ENDIAN
 1780|  47.0M|        return sph_bswap64(*(const sph_u64 *)src);
 1781|       |#elif SPH_BIG_ENDIAN
 1782|       |        return *(const sph_u64 *)src;
 1783|       |#else
 1784|       |        return ((sph_u64)(((const unsigned char *)src)[0]) << 56)
 1785|       |                | ((sph_u64)(((const unsigned char *)src)[1]) << 48)
 1786|       |                | ((sph_u64)(((const unsigned char *)src)[2]) << 40)
 1787|       |                | ((sph_u64)(((const unsigned char *)src)[3]) << 32)
 1788|       |                | ((sph_u64)(((const unsigned char *)src)[4]) << 24)
 1789|       |                | ((sph_u64)(((const unsigned char *)src)[5]) << 16)
 1790|       |                | ((sph_u64)(((const unsigned char *)src)[6]) << 8)
 1791|       |                | (sph_u64)(((const unsigned char *)src)[7]);
 1792|       |#endif
 1793|  47.0M|}
sha2big.c:sph_bswap64:
 1229|  47.8M|{
 1230|  47.8M|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|  47.8M|        return x;
 1232|  47.8M|}
sha2big.c:sph_enc64be_aligned:
 1706|   168k|{
 1707|   168k|#if SPH_LITTLE_ENDIAN
 1708|   168k|        *(sph_u64 *)dst = sph_bswap64(val);
 1709|       |#elif SPH_BIG_ENDIAN
 1710|       |        *(sph_u64 *)dst = val;
 1711|       |#else
 1712|       |        ((unsigned char *)dst)[0] = (unsigned char)(val >> 56);
 1713|       |        ((unsigned char *)dst)[1] = (unsigned char)(val >> 48);
 1714|       |        ((unsigned char *)dst)[2] = (unsigned char)(val >> 40);
 1715|       |        ((unsigned char *)dst)[3] = (unsigned char)(val >> 32);
 1716|       |        ((unsigned char *)dst)[4] = (unsigned char)(val >> 24);
 1717|       |        ((unsigned char *)dst)[5] = (unsigned char)(val >> 16);
 1718|       |        ((unsigned char *)dst)[6] = (unsigned char)(val >> 8);
 1719|       |        ((unsigned char *)dst)[7] = (unsigned char)(val);
 1720|       |#endif
 1721|   168k|}
sha2big.c:sph_enc64be:
 1661|   592k|{
 1662|   592k|#if defined SPH_UPTR
 1663|   592k|#if SPH_UNALIGNED
 1664|   592k|#if SPH_LITTLE_ENDIAN
 1665|   592k|        val = sph_bswap64(val);
 1666|   592k|#endif
 1667|   592k|        *(sph_u64 *)dst = val;
 1668|       |#else
 1669|       |        if (((SPH_UPTR)dst & 7) == 0) {
 1670|       |#if SPH_LITTLE_ENDIAN
 1671|       |                val = sph_bswap64(val);
 1672|       |#endif
 1673|       |                *(sph_u64 *)dst = val;
 1674|       |        } else {
 1675|       |                ((unsigned char *)dst)[0] = (val >> 56);
 1676|       |                ((unsigned char *)dst)[1] = (val >> 48);
 1677|       |                ((unsigned char *)dst)[2] = (val >> 40);
 1678|       |                ((unsigned char *)dst)[3] = (val >> 32);
 1679|       |                ((unsigned char *)dst)[4] = (val >> 24);
 1680|       |                ((unsigned char *)dst)[5] = (val >> 16);
 1681|       |                ((unsigned char *)dst)[6] = (val >> 8);
 1682|       |                ((unsigned char *)dst)[7] = val;
 1683|       |        }
 1684|       |#endif
 1685|       |#else
 1686|       |        ((unsigned char *)dst)[0] = (unsigned char)(val >> 56);
 1687|       |        ((unsigned char *)dst)[1] = (unsigned char)(val >> 48);
 1688|       |        ((unsigned char *)dst)[2] = (unsigned char)(val >> 40);
 1689|       |        ((unsigned char *)dst)[3] = (unsigned char)(val >> 32);
 1690|       |        ((unsigned char *)dst)[4] = (unsigned char)(val >> 24);
 1691|       |        ((unsigned char *)dst)[5] = (unsigned char)(val >> 16);
 1692|       |        ((unsigned char *)dst)[6] = (unsigned char)(val >> 8);
 1693|       |        ((unsigned char *)dst)[7] = (unsigned char)(val);
 1694|       |#endif
 1695|   592k|}

adler32_z:
   61|   112k|uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
   62|   112k|    unsigned long sum2;
   63|   112k|    unsigned n;
   64|       |
   65|       |    /* split Adler-32 into component sums */
   66|   112k|    sum2 = (adler >> 16) & 0xffff;
   67|   112k|    adler &= 0xffff;
   68|       |
   69|       |    /* in case user likes doing a byte at a time, keep it fast */
   70|   112k|    if (len == 1) {
  ------------------
  |  Branch (70:9): [True: 2.44k, False: 109k]
  ------------------
   71|  2.44k|        adler += buf[0];
   72|  2.44k|        if (adler >= BASE)
  ------------------
  |  |   10|  2.44k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  |  Branch (72:13): [True: 24, False: 2.42k]
  ------------------
   73|     24|            adler -= BASE;
  ------------------
  |  |   10|     24|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   74|  2.44k|        sum2 += adler;
   75|  2.44k|        if (sum2 >= BASE)
  ------------------
  |  |   10|  2.44k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  |  Branch (75:13): [True: 1.03k, False: 1.41k]
  ------------------
   76|  1.03k|            sum2 -= BASE;
  ------------------
  |  |   10|  1.03k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   77|  2.44k|        return adler | (sum2 << 16);
   78|  2.44k|    }
   79|       |
   80|       |    /* initial Adler-32 value (deferred check for len == 1 speed) */
   81|   109k|    if (buf == Z_NULL)
  ------------------
  |  |  216|   109k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (81:9): [True: 4.56k, False: 105k]
  ------------------
   82|  4.56k|        return 1L;
   83|       |
   84|       |    /* in case short lengths are provided, keep it somewhat fast */
   85|   105k|    if (len < 16) {
  ------------------
  |  Branch (85:9): [True: 39.1k, False: 66.1k]
  ------------------
   86|   278k|        while (len--) {
  ------------------
  |  Branch (86:16): [True: 239k, False: 39.1k]
  ------------------
   87|   239k|            adler += *buf++;
   88|   239k|            sum2 += adler;
   89|   239k|        }
   90|  39.1k|        if (adler >= BASE)
  ------------------
  |  |   10|  39.1k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  |  Branch (90:13): [True: 252, False: 38.9k]
  ------------------
   91|    252|            adler -= BASE;
  ------------------
  |  |   10|    252|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   92|  39.1k|        MOD28(sum2);            /* only added so many BASE's */
  ------------------
  |  |   56|  39.1k|#  define MOD28(a) a %= BASE
  |  |  ------------------
  |  |  |  |   10|  39.1k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
   93|  39.1k|        return adler | (sum2 << 16);
   94|  39.1k|    }
   95|       |
   96|       |    /* do length NMAX blocks -- requires just one modulo operation */
   97|  76.2k|    while (len >= NMAX) {
  ------------------
  |  |   11|  76.2k|#define NMAX 5552
  ------------------
  |  Branch (97:12): [True: 10.1k, False: 66.1k]
  ------------------
   98|  10.1k|        len -= NMAX;
  ------------------
  |  |   11|  10.1k|#define NMAX 5552
  ------------------
   99|  10.1k|        n = NMAX / 16;          /* NMAX is divisible by 16 */
  ------------------
  |  |   11|  10.1k|#define NMAX 5552
  ------------------
  100|  3.50M|        do {
  101|  3.50M|            DO16(buf);          /* 16 sums unrolled */
  ------------------
  |  |   18|  3.50M|#define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   17|  3.50M|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  3.50M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  3.50M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  3.50M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  3.50M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  3.50M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  3.50M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   17|  3.50M|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  3.50M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  3.50M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  3.50M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  3.50M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  3.50M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  3.50M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  3.50M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  102|  3.50M|            buf += 16;
  103|  3.50M|        } while (--n);
  ------------------
  |  Branch (103:18): [True: 3.49M, False: 10.1k]
  ------------------
  104|  10.1k|        MOD(adler);
  ------------------
  |  |   55|  10.1k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   10|  10.1k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  105|  10.1k|        MOD(sum2);
  ------------------
  |  |   55|  10.1k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   10|  10.1k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  106|  10.1k|    }
  107|       |
  108|       |    /* do remaining bytes (less than NMAX, still just one modulo) */
  109|  66.1k|    if (len) {                  /* avoid modulos if none remaining */
  ------------------
  |  Branch (109:9): [True: 66.0k, False: 6]
  ------------------
  110|   877k|        while (len >= 16) {
  ------------------
  |  Branch (110:16): [True: 811k, False: 66.0k]
  ------------------
  111|   811k|            len -= 16;
  112|   811k|            DO16(buf);
  ------------------
  |  |   18|   811k|#define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   17|   811k|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|   811k|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|   811k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|   811k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|   811k|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|   811k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|   811k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   17|   811k|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|   811k|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|   811k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|   811k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|   811k|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|   811k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|   811k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|   811k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  113|   811k|            buf += 16;
  114|   811k|        }
  115|   764k|        while (len--) {
  ------------------
  |  Branch (115:16): [True: 698k, False: 66.0k]
  ------------------
  116|   698k|            adler += *buf++;
  117|   698k|            sum2 += adler;
  118|   698k|        }
  119|  66.0k|        MOD(adler);
  ------------------
  |  |   55|  66.0k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   10|  66.0k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  120|  66.0k|        MOD(sum2);
  ------------------
  |  |   55|  66.0k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   10|  66.0k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  121|  66.0k|    }
  122|       |
  123|       |    /* return recombined sums */
  124|  66.1k|    return adler | (sum2 << 16);
  125|   105k|}
adler32:
  128|   112k|uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
  129|   112k|    return adler32_z(adler, buf, len);
  130|   112k|}

inflate_fast:
   50|   118k|void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
   51|   118k|    struct inflate_state FAR *state;
   52|   118k|    z_const unsigned char FAR *in;      /* local strm->next_in */
   53|   118k|    z_const unsigned char FAR *last;    /* have enough input while in < last */
   54|   118k|    unsigned char FAR *out;     /* local strm->next_out */
   55|   118k|    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
   56|   118k|    unsigned char FAR *end;     /* while out < end, enough space available */
   57|       |#ifdef INFLATE_STRICT
   58|       |    unsigned dmax;              /* maximum distance from zlib header */
   59|       |#endif
   60|   118k|    unsigned wsize;             /* window size or zero if not using window */
   61|   118k|    unsigned whave;             /* valid bytes in the window */
   62|   118k|    unsigned wnext;             /* window write index */
   63|   118k|    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
   64|   118k|    unsigned long hold;         /* local strm->hold */
   65|   118k|    unsigned bits;              /* local strm->bits */
   66|   118k|    code const FAR *lcode;      /* local strm->lencode */
   67|   118k|    code const FAR *dcode;      /* local strm->distcode */
   68|   118k|    unsigned lmask;             /* mask for first level of length codes */
   69|   118k|    unsigned dmask;             /* mask for first level of distance codes */
   70|   118k|    code const *here;           /* retrieved table entry */
   71|   118k|    unsigned op;                /* code bits, operation, extra bits, or */
   72|       |                                /*  window position, window bytes to copy */
   73|   118k|    unsigned len;               /* match length, unused bytes */
   74|   118k|    unsigned dist;              /* match distance */
   75|   118k|    unsigned char FAR *from;    /* where to copy match from */
   76|       |
   77|       |    /* copy state to local variables */
   78|   118k|    state = (struct inflate_state FAR *)strm->state;
   79|   118k|    in = strm->next_in;
   80|   118k|    last = in + (strm->avail_in - 5);
   81|   118k|    out = strm->next_out;
   82|   118k|    beg = out - (start - strm->avail_out);
   83|   118k|    end = out + (strm->avail_out - 257);
   84|       |#ifdef INFLATE_STRICT
   85|       |    dmax = state->dmax;
   86|       |#endif
   87|   118k|    wsize = state->wsize;
   88|   118k|    whave = state->whave;
   89|   118k|    wnext = state->wnext;
   90|   118k|    window = state->window;
   91|   118k|    hold = state->hold;
   92|   118k|    bits = state->bits;
   93|   118k|    lcode = state->lencode;
   94|   118k|    dcode = state->distcode;
   95|   118k|    lmask = (1U << state->lenbits) - 1;
   96|   118k|    dmask = (1U << state->distbits) - 1;
   97|       |
   98|       |    /* decode literals and length/distances until end-of-block or not enough
   99|       |       input data or output space */
  100|  3.47M|    do {
  101|  3.47M|        if (bits < 15) {
  ------------------
  |  Branch (101:13): [True: 1.56M, False: 1.90M]
  ------------------
  102|  1.56M|            hold += (unsigned long)(*in++) << bits;
  103|  1.56M|            bits += 8;
  104|  1.56M|            hold += (unsigned long)(*in++) << bits;
  105|  1.56M|            bits += 8;
  106|  1.56M|        }
  107|  3.47M|        here = lcode + (hold & lmask);
  108|  3.56M|      dolen:
  109|  3.56M|        op = (unsigned)(here->bits);
  110|  3.56M|        hold >>= op;
  111|  3.56M|        bits -= op;
  112|  3.56M|        op = (unsigned)(here->op);
  113|  3.56M|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (113:13): [True: 1.93M, False: 1.62M]
  ------------------
  114|  1.93M|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  115|  1.93M|                    "inflate:         literal '%c'\n" :
  116|  1.93M|                    "inflate:         literal 0x%02x\n", here->val));
  117|  1.93M|            *out++ = (unsigned char)(here->val);
  118|  1.93M|        }
  119|  1.62M|        else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (119:18): [True: 1.52M, False: 101k]
  ------------------
  120|  1.52M|            len = (unsigned)(here->val);
  121|  1.52M|            op &= 15;                           /* number of extra bits */
  122|  1.52M|            if (op) {
  ------------------
  |  Branch (122:17): [True: 285k, False: 1.24M]
  ------------------
  123|   285k|                if (bits < op) {
  ------------------
  |  Branch (123:21): [True: 1.93k, False: 283k]
  ------------------
  124|  1.93k|                    hold += (unsigned long)(*in++) << bits;
  125|  1.93k|                    bits += 8;
  126|  1.93k|                }
  127|   285k|                len += (unsigned)hold & ((1U << op) - 1);
  128|   285k|                hold >>= op;
  129|   285k|                bits -= op;
  130|   285k|            }
  131|  1.52M|            Tracevv((stderr, "inflate:         length %u\n", len));
  132|  1.52M|            if (bits < 15) {
  ------------------
  |  Branch (132:17): [True: 422k, False: 1.10M]
  ------------------
  133|   422k|                hold += (unsigned long)(*in++) << bits;
  134|   422k|                bits += 8;
  135|   422k|                hold += (unsigned long)(*in++) << bits;
  136|   422k|                bits += 8;
  137|   422k|            }
  138|  1.52M|            here = dcode + (hold & dmask);
  139|  1.61M|          dodist:
  140|  1.61M|            op = (unsigned)(here->bits);
  141|  1.61M|            hold >>= op;
  142|  1.61M|            bits -= op;
  143|  1.61M|            op = (unsigned)(here->op);
  144|  1.61M|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (144:17): [True: 1.52M, False: 82.3k]
  ------------------
  145|  1.52M|                dist = (unsigned)(here->val);
  146|  1.52M|                op &= 15;                       /* number of extra bits */
  147|  1.52M|                if (bits < op) {
  ------------------
  |  Branch (147:21): [True: 1.79k, False: 1.52M]
  ------------------
  148|  1.79k|                    hold += (unsigned long)(*in++) << bits;
  149|  1.79k|                    bits += 8;
  150|  1.79k|                    if (bits < op) {
  ------------------
  |  Branch (150:25): [True: 0, False: 1.79k]
  ------------------
  151|      0|                        hold += (unsigned long)(*in++) << bits;
  152|      0|                        bits += 8;
  153|      0|                    }
  154|  1.79k|                }
  155|  1.52M|                dist += (unsigned)hold & ((1U << op) - 1);
  156|       |#ifdef INFLATE_STRICT
  157|       |                if (dist > dmax) {
  158|       |                    strm->msg = (z_const char *)
  159|       |                        "invalid distance too far back";
  160|       |                    state->mode = BAD;
  161|       |                    break;
  162|       |                }
  163|       |#endif
  164|  1.52M|                hold >>= op;
  165|  1.52M|                bits -= op;
  166|  1.52M|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  167|  1.52M|                op = (unsigned)(out - beg);     /* max distance in output */
  168|  1.52M|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (168:21): [True: 108k, False: 1.41M]
  ------------------
  169|   108k|                    op = dist - op;             /* distance back in window */
  170|   108k|                    if (op > whave) {
  ------------------
  |  Branch (170:25): [True: 132, False: 108k]
  ------------------
  171|    132|                        if (state->sane) {
  ------------------
  |  Branch (171:29): [True: 132, False: 0]
  ------------------
  172|    132|                            strm->msg = (z_const char *)
  173|    132|                                "invalid distance too far back";
  174|    132|                            state->mode = BAD;
  175|    132|                            break;
  176|    132|                        }
  177|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
  178|       |                        if (len <= op - whave) {
  179|       |                            do {
  180|       |                                *out++ = 0;
  181|       |                            } while (--len);
  182|       |                            continue;
  183|       |                        }
  184|       |                        len -= op - whave;
  185|       |                        do {
  186|       |                            *out++ = 0;
  187|       |                        } while (--op > whave);
  188|       |                        if (op == 0) {
  189|       |                            from = out - dist;
  190|       |                            do {
  191|       |                                *out++ = *from++;
  192|       |                            } while (--len);
  193|       |                            continue;
  194|       |                        }
  195|       |#endif
  196|    132|                    }
  197|   108k|                    from = window;
  198|   108k|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (198:25): [True: 4.28k, False: 104k]
  ------------------
  199|  4.28k|                        from += wsize - op;
  200|  4.28k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (200:29): [True: 250, False: 4.03k]
  ------------------
  201|    250|                            len -= op;
  202|  13.1k|                            do {
  203|  13.1k|                                *out++ = *from++;
  204|  13.1k|                            } while (--op);
  ------------------
  |  Branch (204:38): [True: 12.8k, False: 250]
  ------------------
  205|    250|                            from = out - dist;  /* rest from output */
  206|    250|                        }
  207|  4.28k|                    }
  208|   104k|                    else if (wnext < op) {      /* wrap around window */
  ------------------
  |  Branch (208:30): [True: 1.20k, False: 103k]
  ------------------
  209|  1.20k|                        from += wsize + wnext - op;
  210|  1.20k|                        op -= wnext;
  211|  1.20k|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (211:29): [True: 46, False: 1.16k]
  ------------------
  212|     46|                            len -= op;
  213|    725|                            do {
  214|    725|                                *out++ = *from++;
  215|    725|                            } while (--op);
  ------------------
  |  Branch (215:38): [True: 679, False: 46]
  ------------------
  216|     46|                            from = window;
  217|     46|                            if (wnext < len) {  /* some from start of window */
  ------------------
  |  Branch (217:33): [True: 9, False: 37]
  ------------------
  218|      9|                                op = wnext;
  219|      9|                                len -= op;
  220|     93|                                do {
  221|     93|                                    *out++ = *from++;
  222|     93|                                } while (--op);
  ------------------
  |  Branch (222:42): [True: 84, False: 9]
  ------------------
  223|      9|                                from = out - dist;      /* rest from output */
  224|      9|                            }
  225|     46|                        }
  226|  1.20k|                    }
  227|   103k|                    else {                      /* contiguous in window */
  228|   103k|                        from += wnext - op;
  229|   103k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (229:29): [True: 1.51k, False: 101k]
  ------------------
  230|  1.51k|                            len -= op;
  231|  7.73k|                            do {
  232|  7.73k|                                *out++ = *from++;
  233|  7.73k|                            } while (--op);
  ------------------
  |  Branch (233:38): [True: 6.21k, False: 1.51k]
  ------------------
  234|  1.51k|                            from = out - dist;  /* rest from output */
  235|  1.51k|                        }
  236|   103k|                    }
  237|   506k|                    while (len > 2) {
  ------------------
  |  Branch (237:28): [True: 397k, False: 108k]
  ------------------
  238|   397k|                        *out++ = *from++;
  239|   397k|                        *out++ = *from++;
  240|   397k|                        *out++ = *from++;
  241|   397k|                        len -= 3;
  242|   397k|                    }
  243|   108k|                    if (len) {
  ------------------
  |  Branch (243:25): [True: 65.1k, False: 43.6k]
  ------------------
  244|  65.1k|                        *out++ = *from++;
  245|  65.1k|                        if (len > 1)
  ------------------
  |  Branch (245:29): [True: 34.6k, False: 30.5k]
  ------------------
  246|  34.6k|                            *out++ = *from++;
  247|  65.1k|                    }
  248|   108k|                }
  249|  1.41M|                else {
  250|  1.41M|                    from = out - dist;          /* copy direct from output */
  251|  20.0M|                    do {                        /* minimum length is three */
  252|  20.0M|                        *out++ = *from++;
  253|  20.0M|                        *out++ = *from++;
  254|  20.0M|                        *out++ = *from++;
  255|  20.0M|                        len -= 3;
  256|  20.0M|                    } while (len > 2);
  ------------------
  |  Branch (256:30): [True: 18.6M, False: 1.41M]
  ------------------
  257|  1.41M|                    if (len) {
  ------------------
  |  Branch (257:25): [True: 811k, False: 608k]
  ------------------
  258|   811k|                        *out++ = *from++;
  259|   811k|                        if (len > 1)
  ------------------
  |  Branch (259:29): [True: 429k, False: 381k]
  ------------------
  260|   429k|                            *out++ = *from++;
  261|   811k|                    }
  262|  1.41M|                }
  263|  1.52M|            }
  264|  82.3k|            else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (264:22): [True: 82.3k, False: 34]
  ------------------
  265|  82.3k|                here = dcode + here->val + (hold & ((1U << op) - 1));
  266|  82.3k|                goto dodist;
  267|  82.3k|            }
  268|     34|            else {
  269|     34|                strm->msg = (z_const char *)"invalid distance code";
  270|     34|                state->mode = BAD;
  271|     34|                break;
  272|     34|            }
  273|  1.61M|        }
  274|   101k|        else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (274:18): [True: 95.9k, False: 5.10k]
  ------------------
  275|  95.9k|            here = lcode + here->val + (hold & ((1U << op) - 1));
  276|  95.9k|            goto dolen;
  277|  95.9k|        }
  278|  5.10k|        else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (278:18): [True: 5.10k, False: 6]
  ------------------
  279|  5.10k|            Tracevv((stderr, "inflate:         end of block\n"));
  280|  5.10k|            state->mode = TYPE;
  281|  5.10k|            break;
  282|  5.10k|        }
  283|      6|        else {
  284|      6|            strm->msg = (z_const char *)"invalid literal/length code";
  285|      6|            state->mode = BAD;
  286|      6|            break;
  287|      6|        }
  288|  3.56M|    } while (in < last && out < end);
  ------------------
  |  Branch (288:14): [True: 3.35M, False: 112k]
  |  Branch (288:27): [True: 3.35M, False: 609]
  ------------------
  289|       |
  290|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  291|   118k|    len = bits >> 3;
  292|   118k|    in -= len;
  293|   118k|    bits -= len << 3;
  294|   118k|    hold &= (1U << bits) - 1;
  295|       |
  296|       |    /* update state and return */
  297|   118k|    strm->next_in = in;
  298|   118k|    strm->next_out = out;
  299|   118k|    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
  ------------------
  |  Branch (299:33): [True: 77.4k, False: 40.9k]
  ------------------
  300|   118k|    strm->avail_out = (unsigned)(out < end ?
  ------------------
  |  Branch (300:34): [True: 117k, False: 629]
  ------------------
  301|   117k|                                 257 + (end - out) : 257 - (out - end));
  302|   118k|    state->hold = hold;
  303|   118k|    state->bits = bits;
  304|   118k|    return;
  305|   118k|}

inflateResetKeep:
  100|  5.00k|int ZEXPORT inflateResetKeep(z_streamp strm) {
  101|  5.00k|    struct inflate_state FAR *state;
  102|       |
  103|  5.00k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (103:9): [True: 0, False: 5.00k]
  ------------------
  104|  5.00k|    state = (struct inflate_state FAR *)strm->state;
  105|  5.00k|    strm->total_in = strm->total_out = state->total = 0;
  106|  5.00k|    strm->msg = Z_NULL;
  ------------------
  |  |  216|  5.00k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  107|  5.00k|    strm->data_type = 0;
  108|  5.00k|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (108:9): [True: 5.00k, False: 0]
  ------------------
  109|  5.00k|        strm->adler = state->wrap & 1;
  110|  5.00k|    state->mode = HEAD;
  111|  5.00k|    state->last = 0;
  112|  5.00k|    state->havedict = 0;
  113|  5.00k|    state->flags = -1;
  114|  5.00k|    state->dmax = 32768U;
  115|  5.00k|    state->head = Z_NULL;
  ------------------
  |  |  216|  5.00k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  116|  5.00k|    state->hold = 0;
  117|  5.00k|    state->bits = 0;
  118|  5.00k|    state->lencode = state->distcode = state->next = state->codes;
  119|  5.00k|    state->sane = 1;
  120|  5.00k|    state->back = -1;
  121|  5.00k|    Tracev((stderr, "inflate: reset\n"));
  122|  5.00k|    return Z_OK;
  ------------------
  |  |  181|  5.00k|#define Z_OK            0
  ------------------
  123|  5.00k|}
inflateReset:
  125|  5.00k|int ZEXPORT inflateReset(z_streamp strm) {
  126|  5.00k|    struct inflate_state FAR *state;
  127|       |
  128|  5.00k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (128:9): [True: 0, False: 5.00k]
  ------------------
  129|  5.00k|    state = (struct inflate_state FAR *)strm->state;
  130|  5.00k|    state->wsize = 0;
  131|  5.00k|    state->whave = 0;
  132|  5.00k|    state->wnext = 0;
  133|  5.00k|    return inflateResetKeep(strm);
  134|  5.00k|}
inflateReset2:
  136|  5.00k|int ZEXPORT inflateReset2(z_streamp strm, int windowBits) {
  137|  5.00k|    int wrap;
  138|  5.00k|    struct inflate_state FAR *state;
  139|       |
  140|       |    /* get the state */
  141|  5.00k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (141:9): [True: 0, False: 5.00k]
  ------------------
  142|  5.00k|    state = (struct inflate_state FAR *)strm->state;
  143|       |
  144|       |    /* extract wrap request from windowBits parameter */
  145|  5.00k|    if (windowBits < 0) {
  ------------------
  |  Branch (145:9): [True: 0, False: 5.00k]
  ------------------
  146|      0|        if (windowBits < -15)
  ------------------
  |  Branch (146:13): [True: 0, False: 0]
  ------------------
  147|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  148|      0|        wrap = 0;
  149|      0|        windowBits = -windowBits;
  150|      0|    }
  151|  5.00k|    else {
  152|  5.00k|        wrap = (windowBits >> 4) + 5;
  153|  5.00k|#ifdef GUNZIP
  154|  5.00k|        if (windowBits < 48)
  ------------------
  |  Branch (154:13): [True: 5.00k, False: 0]
  ------------------
  155|  5.00k|            windowBits &= 15;
  156|  5.00k|#endif
  157|  5.00k|    }
  158|       |
  159|       |    /* set number of window bits, free window if different */
  160|  5.00k|    if (windowBits && (windowBits < 8 || windowBits > 15))
  ------------------
  |  Branch (160:9): [True: 5.00k, False: 0]
  |  Branch (160:24): [True: 0, False: 5.00k]
  |  Branch (160:42): [True: 0, False: 5.00k]
  ------------------
  161|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  162|  5.00k|    if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
  ------------------
  |  |  216|  10.0k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (162:9): [True: 0, False: 5.00k]
  |  Branch (162:36): [True: 0, False: 0]
  ------------------
  163|      0|        ZFREE(strm, state->window);
  ------------------
  |  |  254|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  164|      0|        state->window = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  165|      0|    }
  166|       |
  167|       |    /* update state and reset the rest of it */
  168|  5.00k|    state->wrap = wrap;
  169|  5.00k|    state->wbits = (unsigned)windowBits;
  170|  5.00k|    return inflateReset(strm);
  171|  5.00k|}
inflateInit2_:
  174|  5.00k|                          const char *version, int stream_size) {
  175|  5.00k|    int ret;
  176|  5.00k|    struct inflate_state FAR *state;
  177|       |
  178|  5.00k|    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |  216|  10.0k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |   44|  5.00k|#define ZLIB_VERSION "1.3.2.1-motley"
  ------------------
  |  Branch (178:9): [True: 0, False: 5.00k]
  |  Branch (178:30): [True: 0, False: 5.00k]
  ------------------
  179|  5.00k|        stream_size != (int)(sizeof(z_stream)))
  ------------------
  |  Branch (179:9): [True: 0, False: 5.00k]
  ------------------
  180|      0|        return Z_VERSION_ERROR;
  ------------------
  |  |  189|      0|#define Z_VERSION_ERROR (-6)
  ------------------
  181|  5.00k|    if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  216|  5.00k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (181:9): [True: 0, False: 5.00k]
  ------------------
  182|  5.00k|    strm->msg = Z_NULL;                 /* in case we return an error */
  ------------------
  |  |  216|  5.00k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  183|  5.00k|    if (strm->zalloc == (alloc_func)0) {
  ------------------
  |  Branch (183:9): [True: 5.00k, False: 0]
  ------------------
  184|       |#ifdef Z_SOLO
  185|       |        return Z_STREAM_ERROR;
  186|       |#else
  187|  5.00k|        strm->zalloc = zcalloc;
  188|  5.00k|        strm->opaque = (voidpf)0;
  189|  5.00k|#endif
  190|  5.00k|    }
  191|  5.00k|    if (strm->zfree == (free_func)0)
  ------------------
  |  Branch (191:9): [True: 5.00k, False: 0]
  ------------------
  192|       |#ifdef Z_SOLO
  193|       |        return Z_STREAM_ERROR;
  194|       |#else
  195|  5.00k|        strm->zfree = zcfree;
  196|  5.00k|#endif
  197|  5.00k|    state = (struct inflate_state FAR *)
  198|  5.00k|            ZALLOC(strm, 1, sizeof(struct inflate_state));
  ------------------
  |  |  253|  5.00k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  199|  5.00k|    if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  216|  5.00k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
  |  Branch (199:9): [True: 0, False: 5.00k]
  ------------------
  200|  5.00k|    zmemzero(state, sizeof(struct inflate_state));
  ------------------
  |  |  218|  5.00k|#    define zmemzero(dest, len) memset(dest, 0, len)
  ------------------
  201|  5.00k|    Tracev((stderr, "inflate: allocated\n"));
  202|  5.00k|    strm->state = (struct internal_state FAR *)state;
  203|  5.00k|    state->strm = strm;
  204|  5.00k|    state->window = Z_NULL;
  ------------------
  |  |  216|  5.00k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  205|  5.00k|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  206|  5.00k|    ret = inflateReset2(strm, windowBits);
  207|  5.00k|    if (ret != Z_OK) {
  ------------------
  |  |  181|  5.00k|#define Z_OK            0
  ------------------
  |  Branch (207:9): [True: 0, False: 5.00k]
  ------------------
  208|      0|        ZFREE(strm, state);
  ------------------
  |  |  254|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  209|      0|        strm->state = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  210|      0|    }
  211|  5.00k|    return ret;
  212|  5.00k|}
inflateInit_:
  215|  5.00k|                         int stream_size) {
  216|  5.00k|    return inflateInit2_(strm, DEF_WBITS, version, stream_size);
  ------------------
  |  |   76|  5.00k|#  define DEF_WBITS MAX_WBITS
  |  |  ------------------
  |  |  |  |  287|  5.00k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  |  |  ------------------
  ------------------
  217|  5.00k|}
inflate:
  474|   114k|int ZEXPORT inflate(z_streamp strm, int flush) {
  475|   114k|    struct inflate_state FAR *state;
  476|   114k|    z_const unsigned char FAR *next;    /* next input */
  477|   114k|    unsigned char FAR *put;     /* next output */
  478|   114k|    unsigned have, left;        /* available input and output */
  479|   114k|    unsigned long hold;         /* bit buffer */
  480|   114k|    unsigned bits;              /* bits in bit buffer */
  481|   114k|    unsigned in, out;           /* save starting available input and output */
  482|   114k|    unsigned copy;              /* number of stored or match bytes to copy */
  483|   114k|    unsigned char FAR *from;    /* where to copy match bytes from */
  484|   114k|    code here;                  /* current decoding table entry */
  485|   114k|    code last;                  /* parent table entry */
  486|   114k|    unsigned len;               /* length to copy for repeats, bits to drop */
  487|   114k|    int ret;                    /* return code */
  488|   114k|#ifdef GUNZIP
  489|   114k|    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
  490|   114k|#endif
  491|   114k|    static const unsigned short order[19] = /* permutation of code lengths */
  492|   114k|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  493|       |
  494|   114k|    if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
  ------------------
  |  |  216|   228k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (494:9): [True: 0, False: 114k]
  |  Branch (494:36): [True: 0, False: 114k]
  ------------------
  495|   114k|        (strm->next_in == Z_NULL && strm->avail_in != 0))
  ------------------
  |  |  216|   228k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (495:10): [True: 0, False: 114k]
  |  Branch (495:37): [True: 0, False: 0]
  ------------------
  496|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  497|       |
  498|   114k|    state = (struct inflate_state FAR *)strm->state;
  499|   114k|    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */
  ------------------
  |  Branch (499:9): [True: 147, False: 114k]
  ------------------
  500|   114k|    LOAD();
  ------------------
  |  |  329|   114k|    do { \
  |  |  330|   114k|        put = strm->next_out; \
  |  |  331|   114k|        left = strm->avail_out; \
  |  |  332|   114k|        next = strm->next_in; \
  |  |  333|   114k|        have = strm->avail_in; \
  |  |  334|   114k|        hold = state->hold; \
  |  |  335|   114k|        bits = state->bits; \
  |  |  336|   114k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (336:14): [Folded, False: 114k]
  |  |  ------------------
  ------------------
  501|   114k|    in = have;
  502|   114k|    out = left;
  503|   114k|    ret = Z_OK;
  ------------------
  |  |  181|   114k|#define Z_OK            0
  ------------------
  504|   114k|    for (;;)
  505|   952k|        switch (state->mode) {
  506|  5.05k|        case HEAD:
  ------------------
  |  Branch (506:9): [True: 5.05k, False: 947k]
  ------------------
  507|  5.05k|            if (state->wrap == 0) {
  ------------------
  |  Branch (507:17): [True: 0, False: 5.05k]
  ------------------
  508|      0|                state->mode = TYPEDO;
  509|      0|                break;
  510|      0|            }
  511|  5.05k|            NEEDBITS(16);
  ------------------
  |  |  369|  5.05k|    do { \
  |  |  370|  15.0k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 10.0k, False: 4.96k]
  |  |  ------------------
  |  |  371|  10.0k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  10.0k|    do { \
  |  |  |  |  360|  10.0k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 91, False: 9.97k]
  |  |  |  |  ------------------
  |  |  |  |  361|  10.0k|        have--; \
  |  |  |  |  362|  9.97k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  9.97k|        bits += 8; \
  |  |  |  |  364|  9.97k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 9.97k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  5.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 4.96k]
  |  |  ------------------
  ------------------
  512|  4.96k|#ifdef GUNZIP
  513|  4.96k|            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
  ------------------
  |  Branch (513:17): [True: 0, False: 4.96k]
  |  Branch (513:38): [True: 0, False: 0]
  ------------------
  514|      0|                if (state->wbits == 0)
  ------------------
  |  Branch (514:21): [True: 0, False: 0]
  ------------------
  515|      0|                    state->wbits = 15;
  516|      0|                state->check = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  517|      0|                CRC2(state->check, hold);
  ------------------
  |  |  311|      0|    do { \
  |  |  312|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  313|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  314|      0|        check = crc32(check, hbuf, 2); \
  |  |  315|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (315:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  518|      0|                INITBITS();
  ------------------
  |  |  351|      0|    do { \
  |  |  352|      0|        hold = 0; \
  |  |  353|      0|        bits = 0; \
  |  |  354|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  519|      0|                state->mode = FLAGS;
  520|      0|                break;
  521|      0|            }
  522|  4.96k|            if (state->head != Z_NULL)
  ------------------
  |  |  216|  4.96k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (522:17): [True: 0, False: 4.96k]
  ------------------
  523|      0|                state->head->done = -1;
  524|  4.96k|            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
  ------------------
  |  Branch (524:17): [True: 0, False: 4.96k]
  ------------------
  525|       |#else
  526|       |            if (
  527|       |#endif
  528|  4.96k|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  376|  4.96k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  |  Branch (528:17): [True: 308, False: 4.66k]
  ------------------
  529|    308|                strm->msg = (z_const char *)"incorrect header check";
  530|    308|                state->mode = BAD;
  531|    308|                break;
  532|    308|            }
  533|  4.66k|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  376|  4.66k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  213|  4.66k|#define Z_DEFLATED   8
  ------------------
  |  Branch (533:17): [True: 81, False: 4.57k]
  ------------------
  534|     81|                strm->msg = (z_const char *)"unknown compression method";
  535|     81|                state->mode = BAD;
  536|     81|                break;
  537|     81|            }
  538|  4.57k|            DROPBITS(4);
  ------------------
  |  |  380|  4.57k|    do { \
  |  |  381|  4.57k|        hold >>= (n); \
  |  |  382|  4.57k|        bits -= (unsigned)(n); \
  |  |  383|  4.57k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 4.57k]
  |  |  ------------------
  ------------------
  539|  4.57k|            len = BITS(4) + 8;
  ------------------
  |  |  376|  4.57k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  540|  4.57k|            if (state->wbits == 0)
  ------------------
  |  Branch (540:17): [True: 0, False: 4.57k]
  ------------------
  541|      0|                state->wbits = len;
  542|  4.57k|            if (len > 15 || len > state->wbits) {
  ------------------
  |  Branch (542:17): [True: 18, False: 4.56k]
  |  Branch (542:29): [True: 0, False: 4.56k]
  ------------------
  543|     18|                strm->msg = (z_const char *)"invalid window size";
  544|     18|                state->mode = BAD;
  545|     18|                break;
  546|     18|            }
  547|  4.56k|            state->dmax = 1U << len;
  548|  4.56k|            state->flags = 0;               /* indicate zlib header */
  549|  4.56k|            Tracev((stderr, "inflate:   zlib header ok\n"));
  550|  4.56k|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  216|  4.56k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  551|  4.56k|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (551:27): [True: 62, False: 4.49k]
  ------------------
  552|  4.56k|            INITBITS();
  ------------------
  |  |  351|  4.56k|    do { \
  |  |  352|  4.56k|        hold = 0; \
  |  |  353|  4.56k|        bits = 0; \
  |  |  354|  4.56k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 4.56k]
  |  |  ------------------
  ------------------
  553|  4.56k|            break;
  554|      0|#ifdef GUNZIP
  555|      0|        case FLAGS:
  ------------------
  |  Branch (555:9): [True: 0, False: 952k]
  ------------------
  556|      0|            NEEDBITS(16);
  ------------------
  |  |  369|      0|    do { \
  |  |  370|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  371|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|      0|    do { \
  |  |  |  |  360|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  361|      0|        have--; \
  |  |  |  |  362|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|      0|        bits += 8; \
  |  |  |  |  364|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  557|      0|            state->flags = (int)(hold);
  558|      0|            if ((state->flags & 0xff) != Z_DEFLATED) {
  ------------------
  |  |  213|      0|#define Z_DEFLATED   8
  ------------------
  |  Branch (558:17): [True: 0, False: 0]
  ------------------
  559|      0|                strm->msg = (z_const char *)"unknown compression method";
  560|      0|                state->mode = BAD;
  561|      0|                break;
  562|      0|            }
  563|      0|            if (state->flags & 0xe000) {
  ------------------
  |  Branch (563:17): [True: 0, False: 0]
  ------------------
  564|      0|                strm->msg = (z_const char *)"unknown header flags set";
  565|      0|                state->mode = BAD;
  566|      0|                break;
  567|      0|            }
  568|      0|            if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (568:17): [True: 0, False: 0]
  ------------------
  569|      0|                state->head->text = (int)((hold >> 8) & 1);
  570|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (570:17): [True: 0, False: 0]
  |  Branch (570:44): [True: 0, False: 0]
  ------------------
  571|      0|                CRC2(state->check, hold);
  ------------------
  |  |  311|      0|    do { \
  |  |  312|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  313|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  314|      0|        check = crc32(check, hbuf, 2); \
  |  |  315|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (315:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  572|      0|            INITBITS();
  ------------------
  |  |  351|      0|    do { \
  |  |  352|      0|        hold = 0; \
  |  |  353|      0|        bits = 0; \
  |  |  354|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  573|      0|            state->mode = TIME;
  574|       |                /* fallthrough */
  575|      0|        case TIME:
  ------------------
  |  Branch (575:9): [True: 0, False: 952k]
  ------------------
  576|      0|            NEEDBITS(32);
  ------------------
  |  |  369|      0|    do { \
  |  |  370|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  371|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|      0|    do { \
  |  |  |  |  360|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  361|      0|        have--; \
  |  |  |  |  362|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|      0|        bits += 8; \
  |  |  |  |  364|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  577|      0|            if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (577:17): [True: 0, False: 0]
  ------------------
  578|      0|                state->head->time = hold;
  579|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (579:17): [True: 0, False: 0]
  |  Branch (579:44): [True: 0, False: 0]
  ------------------
  580|      0|                CRC4(state->check, hold);
  ------------------
  |  |  318|      0|    do { \
  |  |  319|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  320|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  321|      0|        hbuf[2] = (unsigned char)((word) >> 16); \
  |  |  322|      0|        hbuf[3] = (unsigned char)((word) >> 24); \
  |  |  323|      0|        check = crc32(check, hbuf, 4); \
  |  |  324|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (324:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  581|      0|            INITBITS();
  ------------------
  |  |  351|      0|    do { \
  |  |  352|      0|        hold = 0; \
  |  |  353|      0|        bits = 0; \
  |  |  354|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  582|      0|            state->mode = OS;
  583|       |                /* fallthrough */
  584|      0|        case OS:
  ------------------
  |  Branch (584:9): [True: 0, False: 952k]
  ------------------
  585|      0|            NEEDBITS(16);
  ------------------
  |  |  369|      0|    do { \
  |  |  370|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  371|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|      0|    do { \
  |  |  |  |  360|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  361|      0|        have--; \
  |  |  |  |  362|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|      0|        bits += 8; \
  |  |  |  |  364|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  586|      0|            if (state->head != Z_NULL) {
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (586:17): [True: 0, False: 0]
  ------------------
  587|      0|                state->head->xflags = (int)(hold & 0xff);
  588|      0|                state->head->os = (int)(hold >> 8);
  589|      0|            }
  590|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (590:17): [True: 0, False: 0]
  |  Branch (590:44): [True: 0, False: 0]
  ------------------
  591|      0|                CRC2(state->check, hold);
  ------------------
  |  |  311|      0|    do { \
  |  |  312|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  313|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  314|      0|        check = crc32(check, hbuf, 2); \
  |  |  315|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (315:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  592|      0|            INITBITS();
  ------------------
  |  |  351|      0|    do { \
  |  |  352|      0|        hold = 0; \
  |  |  353|      0|        bits = 0; \
  |  |  354|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  593|      0|            state->mode = EXLEN;
  594|       |                /* fallthrough */
  595|      0|        case EXLEN:
  ------------------
  |  Branch (595:9): [True: 0, False: 952k]
  ------------------
  596|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (596:17): [True: 0, False: 0]
  ------------------
  597|      0|                NEEDBITS(16);
  ------------------
  |  |  369|      0|    do { \
  |  |  370|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  371|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|      0|    do { \
  |  |  |  |  360|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  361|      0|        have--; \
  |  |  |  |  362|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|      0|        bits += 8; \
  |  |  |  |  364|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  598|      0|                state->length = (unsigned)(hold);
  599|      0|                if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (599:21): [True: 0, False: 0]
  ------------------
  600|      0|                    state->head->extra_len = (unsigned)hold;
  601|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (601:21): [True: 0, False: 0]
  |  Branch (601:48): [True: 0, False: 0]
  ------------------
  602|      0|                    CRC2(state->check, hold);
  ------------------
  |  |  311|      0|    do { \
  |  |  312|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  313|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  314|      0|        check = crc32(check, hbuf, 2); \
  |  |  315|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (315:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  603|      0|                INITBITS();
  ------------------
  |  |  351|      0|    do { \
  |  |  352|      0|        hold = 0; \
  |  |  353|      0|        bits = 0; \
  |  |  354|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  604|      0|            }
  605|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (605:22): [True: 0, False: 0]
  ------------------
  606|      0|                state->head->extra = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  607|      0|            state->mode = EXTRA;
  608|       |                /* fallthrough */
  609|      0|        case EXTRA:
  ------------------
  |  Branch (609:9): [True: 0, False: 952k]
  ------------------
  610|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (610:17): [True: 0, False: 0]
  ------------------
  611|      0|                copy = state->length;
  612|      0|                if (copy > have) copy = have;
  ------------------
  |  Branch (612:21): [True: 0, False: 0]
  ------------------
  613|      0|                if (copy) {
  ------------------
  |  Branch (613:21): [True: 0, False: 0]
  ------------------
  614|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (614:25): [True: 0, False: 0]
  ------------------
  615|      0|                        state->head->extra != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (615:25): [True: 0, False: 0]
  ------------------
  616|      0|                        (len = state->head->extra_len - state->length) <
  ------------------
  |  Branch (616:25): [True: 0, False: 0]
  ------------------
  617|      0|                            state->head->extra_max) {
  618|      0|                        zmemcpy(state->head->extra + len, next,
  ------------------
  |  |  216|      0|#    define zmemcpy memcpy
  ------------------
  619|      0|                                len + copy > state->head->extra_max ?
  ------------------
  |  Branch (619:33): [True: 0, False: 0]
  ------------------
  620|      0|                                state->head->extra_max - len : copy);
  621|      0|                    }
  622|      0|                    if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (622:25): [True: 0, False: 0]
  |  Branch (622:52): [True: 0, False: 0]
  ------------------
  623|      0|                        state->check = crc32(state->check, next, copy);
  624|      0|                    have -= copy;
  625|      0|                    next += copy;
  626|      0|                    state->length -= copy;
  627|      0|                }
  628|      0|                if (state->length) goto inf_leave;
  ------------------
  |  Branch (628:21): [True: 0, False: 0]
  ------------------
  629|      0|            }
  630|      0|            state->length = 0;
  631|      0|            state->mode = NAME;
  632|       |                /* fallthrough */
  633|      0|        case NAME:
  ------------------
  |  Branch (633:9): [True: 0, False: 952k]
  ------------------
  634|      0|            if (state->flags & 0x0800) {
  ------------------
  |  Branch (634:17): [True: 0, False: 0]
  ------------------
  635|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (635:21): [True: 0, False: 0]
  ------------------
  636|      0|                copy = 0;
  637|      0|                do {
  638|      0|                    len = (unsigned)(next[copy++]);
  639|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (639:25): [True: 0, False: 0]
  ------------------
  640|      0|                            state->head->name != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (640:29): [True: 0, False: 0]
  ------------------
  641|      0|                            state->length < state->head->name_max)
  ------------------
  |  Branch (641:29): [True: 0, False: 0]
  ------------------
  642|      0|                        state->head->name[state->length++] = (Bytef)len;
  643|      0|                } while (len && copy < have);
  ------------------
  |  Branch (643:26): [True: 0, False: 0]
  |  Branch (643:33): [True: 0, False: 0]
  ------------------
  644|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (644:21): [True: 0, False: 0]
  |  Branch (644:48): [True: 0, False: 0]
  ------------------
  645|      0|                    state->check = crc32(state->check, next, copy);
  646|      0|                have -= copy;
  647|      0|                next += copy;
  648|      0|                if (len) goto inf_leave;
  ------------------
  |  Branch (648:21): [True: 0, False: 0]
  ------------------
  649|      0|            }
  650|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (650:22): [True: 0, False: 0]
  ------------------
  651|      0|                state->head->name = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  652|      0|            state->length = 0;
  653|      0|            state->mode = COMMENT;
  654|       |                /* fallthrough */
  655|      0|        case COMMENT:
  ------------------
  |  Branch (655:9): [True: 0, False: 952k]
  ------------------
  656|      0|            if (state->flags & 0x1000) {
  ------------------
  |  Branch (656:17): [True: 0, False: 0]
  ------------------
  657|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (657:21): [True: 0, False: 0]
  ------------------
  658|      0|                copy = 0;
  659|      0|                do {
  660|      0|                    len = (unsigned)(next[copy++]);
  661|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (661:25): [True: 0, False: 0]
  ------------------
  662|      0|                            state->head->comment != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (662:29): [True: 0, False: 0]
  ------------------
  663|      0|                            state->length < state->head->comm_max)
  ------------------
  |  Branch (663:29): [True: 0, False: 0]
  ------------------
  664|      0|                        state->head->comment[state->length++] = (Bytef)len;
  665|      0|                } while (len && copy < have);
  ------------------
  |  Branch (665:26): [True: 0, False: 0]
  |  Branch (665:33): [True: 0, False: 0]
  ------------------
  666|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (666:21): [True: 0, False: 0]
  |  Branch (666:48): [True: 0, False: 0]
  ------------------
  667|      0|                    state->check = crc32(state->check, next, copy);
  668|      0|                have -= copy;
  669|      0|                next += copy;
  670|      0|                if (len) goto inf_leave;
  ------------------
  |  Branch (670:21): [True: 0, False: 0]
  ------------------
  671|      0|            }
  672|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (672:22): [True: 0, False: 0]
  ------------------
  673|      0|                state->head->comment = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  674|      0|            state->mode = HCRC;
  675|       |                /* fallthrough */
  676|      0|        case HCRC:
  ------------------
  |  Branch (676:9): [True: 0, False: 952k]
  ------------------
  677|      0|            if (state->flags & 0x0200) {
  ------------------
  |  Branch (677:17): [True: 0, False: 0]
  ------------------
  678|      0|                NEEDBITS(16);
  ------------------
  |  |  369|      0|    do { \
  |  |  370|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  371|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|      0|    do { \
  |  |  |  |  360|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  361|      0|        have--; \
  |  |  |  |  362|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|      0|        bits += 8; \
  |  |  |  |  364|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  679|      0|                if ((state->wrap & 4) && hold != (state->check & 0xffff)) {
  ------------------
  |  Branch (679:21): [True: 0, False: 0]
  |  Branch (679:42): [True: 0, False: 0]
  ------------------
  680|      0|                    strm->msg = (z_const char *)"header crc mismatch";
  681|      0|                    state->mode = BAD;
  682|      0|                    break;
  683|      0|                }
  684|      0|                INITBITS();
  ------------------
  |  |  351|      0|    do { \
  |  |  352|      0|        hold = 0; \
  |  |  353|      0|        bits = 0; \
  |  |  354|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  685|      0|            }
  686|      0|            if (state->head != Z_NULL) {
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (686:17): [True: 0, False: 0]
  ------------------
  687|      0|                state->head->hcrc = (int)((state->flags >> 9) & 1);
  688|      0|                state->head->done = 1;
  689|      0|            }
  690|      0|            strm->adler = state->check = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  691|      0|            state->mode = TYPE;
  692|      0|            break;
  693|      0|#endif
  694|     73|        case DICTID:
  ------------------
  |  Branch (694:9): [True: 73, False: 951k]
  ------------------
  695|     73|            NEEDBITS(32);
  ------------------
  |  |  369|     73|    do { \
  |  |  370|    308|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 252, False: 56]
  |  |  ------------------
  |  |  371|    252|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|    252|    do { \
  |  |  |  |  360|    252|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 17, False: 235]
  |  |  |  |  ------------------
  |  |  |  |  361|    252|        have--; \
  |  |  |  |  362|    235|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|    235|        bits += 8; \
  |  |  |  |  364|    235|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 235]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|     73|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 56]
  |  |  ------------------
  ------------------
  696|     56|            strm->adler = state->check = ZSWAP32(hold);
  ------------------
  |  |  258|     56|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  259|     56|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
  697|     56|            INITBITS();
  ------------------
  |  |  351|     56|    do { \
  |  |  352|     56|        hold = 0; \
  |  |  353|     56|        bits = 0; \
  |  |  354|     56|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 56]
  |  |  ------------------
  ------------------
  698|     56|            state->mode = DICT;
  699|       |                /* fallthrough */
  700|    114|        case DICT:
  ------------------
  |  Branch (700:9): [True: 58, False: 952k]
  ------------------
  701|    114|            if (state->havedict == 0) {
  ------------------
  |  Branch (701:17): [True: 114, False: 0]
  ------------------
  702|    114|                RESTORE();
  ------------------
  |  |  340|    114|    do { \
  |  |  341|    114|        strm->next_out = put; \
  |  |  342|    114|        strm->avail_out = left; \
  |  |  343|    114|        strm->next_in = next; \
  |  |  344|    114|        strm->avail_in = have; \
  |  |  345|    114|        state->hold = hold; \
  |  |  346|    114|        state->bits = bits; \
  |  |  347|    114|    } while (0)
  |  |  ------------------
  |  |  |  Branch (347:14): [Folded, False: 114]
  |  |  ------------------
  ------------------
  703|    114|                return Z_NEED_DICT;
  ------------------
  |  |  183|    114|#define Z_NEED_DICT     2
  ------------------
  704|    114|            }
  705|      0|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  706|      0|            state->mode = TYPE;
  707|       |                /* fallthrough */
  708|  11.5k|        case TYPE:
  ------------------
  |  Branch (708:9): [True: 11.5k, False: 940k]
  ------------------
  709|  11.5k|            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  177|  23.1k|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  11.5k|#define Z_TREES         6
  ------------------
  |  Branch (709:17): [True: 0, False: 11.5k]
  |  Branch (709:37): [True: 0, False: 11.5k]
  ------------------
  710|       |                /* fallthrough */
  711|  11.7k|        case TYPEDO:
  ------------------
  |  Branch (711:9): [True: 150, False: 951k]
  ------------------
  712|  11.7k|            if (state->last) {
  ------------------
  |  Branch (712:17): [True: 1.10k, False: 10.6k]
  ------------------
  713|  1.10k|                BYTEBITS();
  ------------------
  |  |  387|  1.10k|    do { \
  |  |  388|  1.10k|        hold >>= bits & 7; \
  |  |  389|  1.10k|        bits -= bits & 7; \
  |  |  390|  1.10k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (390:14): [Folded, False: 1.10k]
  |  |  ------------------
  ------------------
  714|  1.10k|                state->mode = CHECK;
  715|  1.10k|                break;
  716|  1.10k|            }
  717|  10.6k|            NEEDBITS(3);
  ------------------
  |  |  369|  10.6k|    do { \
  |  |  370|  18.4k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 8.08k, False: 10.4k]
  |  |  ------------------
  |  |  371|  10.6k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  8.08k|    do { \
  |  |  |  |  360|  8.08k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 211, False: 7.87k]
  |  |  |  |  ------------------
  |  |  |  |  361|  8.08k|        have--; \
  |  |  |  |  362|  7.87k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  7.87k|        bits += 8; \
  |  |  |  |  364|  7.87k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 7.87k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  10.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 10.4k]
  |  |  ------------------
  ------------------
  718|  10.4k|            state->last = BITS(1);
  ------------------
  |  |  376|  10.4k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  719|  10.4k|            DROPBITS(1);
  ------------------
  |  |  380|  10.4k|    do { \
  |  |  381|  10.4k|        hold >>= (n); \
  |  |  382|  10.4k|        bits -= (unsigned)(n); \
  |  |  383|  10.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 10.4k]
  |  |  ------------------
  ------------------
  720|  10.4k|            switch (BITS(2)) {
  ------------------
  |  |  376|  10.4k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  721|    869|            case 0:                             /* stored block */
  ------------------
  |  Branch (721:13): [True: 869, False: 9.53k]
  ------------------
  722|    869|                Tracev((stderr, "inflate:     stored block%s\n",
  723|    869|                        state->last ? " (last)" : ""));
  724|    869|                state->mode = STORED;
  725|    869|                break;
  726|  5.68k|            case 1:                             /* fixed block */
  ------------------
  |  Branch (726:13): [True: 5.68k, False: 4.71k]
  ------------------
  727|  5.68k|                inflate_fixed(state);
  728|  5.68k|                Tracev((stderr, "inflate:     fixed codes block%s\n",
  729|  5.68k|                        state->last ? " (last)" : ""));
  730|  5.68k|                state->mode = LEN_;             /* decode codes */
  731|  5.68k|                if (flush == Z_TREES) {
  ------------------
  |  |  178|  5.68k|#define Z_TREES         6
  ------------------
  |  Branch (731:21): [True: 0, False: 5.68k]
  ------------------
  732|      0|                    DROPBITS(2);
  ------------------
  |  |  380|      0|    do { \
  |  |  381|      0|        hold >>= (n); \
  |  |  382|      0|        bits -= (unsigned)(n); \
  |  |  383|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  733|      0|                    goto inf_leave;
  734|      0|                }
  735|  5.68k|                break;
  736|  5.68k|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (736:13): [True: 3.79k, False: 6.60k]
  ------------------
  737|  3.79k|                Tracev((stderr, "inflate:     dynamic codes block%s\n",
  738|  3.79k|                        state->last ? " (last)" : ""));
  739|  3.79k|                state->mode = TABLE;
  740|  3.79k|                break;
  741|     52|            default:
  ------------------
  |  Branch (741:13): [True: 52, False: 10.3k]
  ------------------
  742|     52|                strm->msg = (z_const char *)"invalid block type";
  743|     52|                state->mode = BAD;
  744|  10.4k|            }
  745|  10.4k|            DROPBITS(2);
  ------------------
  |  |  380|  10.4k|    do { \
  |  |  381|  10.4k|        hold >>= (n); \
  |  |  382|  10.4k|        bits -= (unsigned)(n); \
  |  |  383|  10.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 10.4k]
  |  |  ------------------
  ------------------
  746|  10.4k|            break;
  747|  1.02k|        case STORED:
  ------------------
  |  Branch (747:9): [True: 1.02k, False: 951k]
  ------------------
  748|  1.02k|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  387|  1.02k|    do { \
  |  |  388|  1.02k|        hold >>= bits & 7; \
  |  |  389|  1.02k|        bits -= bits & 7; \
  |  |  390|  1.02k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (390:14): [Folded, False: 1.02k]
  |  |  ------------------
  ------------------
  749|  1.02k|            NEEDBITS(32);
  ------------------
  |  |  369|  1.02k|    do { \
  |  |  370|  4.06k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 3.32k, False: 745]
  |  |  ------------------
  |  |  371|  3.32k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  3.32k|    do { \
  |  |  |  |  360|  3.32k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 280, False: 3.04k]
  |  |  |  |  ------------------
  |  |  |  |  361|  3.32k|        have--; \
  |  |  |  |  362|  3.04k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  3.04k|        bits += 8; \
  |  |  |  |  364|  3.04k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 3.04k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  1.02k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 745]
  |  |  ------------------
  ------------------
  750|    745|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (750:17): [True: 100, False: 645]
  ------------------
  751|    100|                strm->msg = (z_const char *)"invalid stored block lengths";
  752|    100|                state->mode = BAD;
  753|    100|                break;
  754|    100|            }
  755|    645|            state->length = (unsigned)hold & 0xffff;
  756|    645|            Tracev((stderr, "inflate:       stored length %u\n",
  757|    645|                    state->length));
  758|    645|            INITBITS();
  ------------------
  |  |  351|    645|    do { \
  |  |  352|    645|        hold = 0; \
  |  |  353|    645|        bits = 0; \
  |  |  354|    645|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 645]
  |  |  ------------------
  ------------------
  759|    645|            state->mode = COPY_;
  760|    645|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|    645|#define Z_TREES         6
  ------------------
  |  Branch (760:17): [True: 0, False: 645]
  ------------------
  761|       |                /* fallthrough */
  762|    645|        case COPY_:
  ------------------
  |  Branch (762:9): [True: 0, False: 952k]
  ------------------
  763|    645|            state->mode = COPY;
  764|       |                /* fallthrough */
  765|  3.92k|        case COPY:
  ------------------
  |  Branch (765:9): [True: 3.27k, False: 948k]
  ------------------
  766|  3.92k|            copy = state->length;
  767|  3.92k|            if (copy) {
  ------------------
  |  Branch (767:17): [True: 3.33k, False: 593]
  ------------------
  768|  3.33k|                if (copy > have) copy = have;
  ------------------
  |  Branch (768:21): [True: 3.20k, False: 128]
  ------------------
  769|  3.33k|                if (copy > left) copy = left;
  ------------------
  |  Branch (769:21): [True: 48, False: 3.28k]
  ------------------
  770|  3.33k|                if (copy == 0) goto inf_leave;
  ------------------
  |  Branch (770:21): [True: 1.64k, False: 1.68k]
  ------------------
  771|  1.68k|                zmemcpy(put, next, copy);
  ------------------
  |  |  216|  1.68k|#    define zmemcpy memcpy
  ------------------
  772|  1.68k|                have -= copy;
  773|  1.68k|                next += copy;
  774|  1.68k|                left -= copy;
  775|  1.68k|                put += copy;
  776|  1.68k|                state->length -= copy;
  777|  1.68k|                break;
  778|  3.33k|            }
  779|    593|            Tracev((stderr, "inflate:       stored end\n"));
  780|    593|            state->mode = TYPE;
  781|    593|            break;
  782|  3.85k|        case TABLE:
  ------------------
  |  Branch (782:9): [True: 3.85k, False: 948k]
  ------------------
  783|  3.85k|            NEEDBITS(14);
  ------------------
  |  |  369|  3.85k|    do { \
  |  |  370|  11.3k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 7.61k, False: 3.78k]
  |  |  ------------------
  |  |  371|  7.61k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  7.61k|    do { \
  |  |  |  |  360|  7.61k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 75, False: 7.54k]
  |  |  |  |  ------------------
  |  |  |  |  361|  7.61k|        have--; \
  |  |  |  |  362|  7.54k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  7.54k|        bits += 8; \
  |  |  |  |  364|  7.54k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 7.54k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  3.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 3.78k]
  |  |  ------------------
  ------------------
  784|  3.78k|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  376|  3.78k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  785|  3.78k|            DROPBITS(5);
  ------------------
  |  |  380|  3.78k|    do { \
  |  |  381|  3.78k|        hold >>= (n); \
  |  |  382|  3.78k|        bits -= (unsigned)(n); \
  |  |  383|  3.78k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 3.78k]
  |  |  ------------------
  ------------------
  786|  3.78k|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  376|  3.78k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  787|  3.78k|            DROPBITS(5);
  ------------------
  |  |  380|  3.78k|    do { \
  |  |  381|  3.78k|        hold >>= (n); \
  |  |  382|  3.78k|        bits -= (unsigned)(n); \
  |  |  383|  3.78k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 3.78k]
  |  |  ------------------
  ------------------
  788|  3.78k|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  376|  3.78k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  789|  3.78k|            DROPBITS(4);
  ------------------
  |  |  380|  3.78k|    do { \
  |  |  381|  3.78k|        hold >>= (n); \
  |  |  382|  3.78k|        bits -= (unsigned)(n); \
  |  |  383|  3.78k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 3.78k]
  |  |  ------------------
  ------------------
  790|  3.78k|#ifndef PKZIP_BUG_WORKAROUND
  791|  3.78k|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (791:17): [True: 6, False: 3.77k]
  |  Branch (791:38): [True: 7, False: 3.76k]
  ------------------
  792|     13|                strm->msg = (z_const char *)
  793|     13|                    "too many length or distance symbols";
  794|     13|                state->mode = BAD;
  795|     13|                break;
  796|     13|            }
  797|  3.76k|#endif
  798|  3.76k|            Tracev((stderr, "inflate:       table sizes ok\n"));
  799|  3.76k|            state->have = 0;
  800|  3.76k|            state->mode = LENLENS;
  801|       |                /* fallthrough */
  802|  3.82k|        case LENLENS:
  ------------------
  |  Branch (802:9): [True: 55, False: 952k]
  ------------------
  803|  64.5k|            while (state->have < state->ncode) {
  ------------------
  |  Branch (803:20): [True: 60.8k, False: 3.73k]
  ------------------
  804|  60.8k|                NEEDBITS(3);
  ------------------
  |  |  369|  60.8k|    do { \
  |  |  370|  82.0k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 21.3k, False: 60.7k]
  |  |  ------------------
  |  |  371|  60.8k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  21.3k|    do { \
  |  |  |  |  360|  21.3k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 90, False: 21.2k]
  |  |  |  |  ------------------
  |  |  |  |  361|  21.3k|        have--; \
  |  |  |  |  362|  21.2k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  21.2k|        bits += 8; \
  |  |  |  |  364|  21.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 21.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  60.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 60.7k]
  |  |  ------------------
  ------------------
  805|  60.7k|                state->lens[order[state->have++]] = (unsigned short)BITS(3);
  ------------------
  |  |  376|  60.7k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  806|  60.7k|                DROPBITS(3);
  ------------------
  |  |  380|  60.7k|    do { \
  |  |  381|  60.7k|        hold >>= (n); \
  |  |  382|  60.7k|        bits -= (unsigned)(n); \
  |  |  383|  60.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 60.7k]
  |  |  ------------------
  ------------------
  807|  60.7k|            }
  808|  14.1k|            while (state->have < 19)
  ------------------
  |  Branch (808:20): [True: 10.4k, False: 3.73k]
  ------------------
  809|  10.4k|                state->lens[order[state->have++]] = 0;
  810|  3.73k|            state->next = state->codes;
  811|  3.73k|            state->lencode = state->distcode = (const code FAR *)(state->next);
  812|  3.73k|            state->lenbits = 7;
  813|  3.73k|            ret = inflate_table(CODES, state->lens, 19, &(state->next),
  814|  3.73k|                                &(state->lenbits), state->work);
  815|  3.73k|            if (ret) {
  ------------------
  |  Branch (815:17): [True: 114, False: 3.61k]
  ------------------
  816|    114|                strm->msg = (z_const char *)"invalid code lengths set";
  817|    114|                state->mode = BAD;
  818|    114|                break;
  819|    114|            }
  820|  3.61k|            Tracev((stderr, "inflate:       code lengths ok\n"));
  821|  3.61k|            state->have = 0;
  822|  3.61k|            state->mode = CODELENS;
  823|       |                /* fallthrough */
  824|  4.13k|        case CODELENS:
  ------------------
  |  Branch (824:9): [True: 519, False: 951k]
  ------------------
  825|   345k|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (825:20): [True: 341k, False: 3.37k]
  ------------------
  826|   458k|                for (;;) {
  827|   458k|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  376|   458k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  828|   458k|                    if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (828:25): [True: 341k, False: 117k]
  ------------------
  829|   117k|                    PULLBYTE();
  ------------------
  |  |  359|   117k|    do { \
  |  |  360|   117k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 418, False: 116k]
  |  |  ------------------
  |  |  361|   117k|        have--; \
  |  |  362|   116k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|   116k|        bits += 8; \
  |  |  364|   116k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 116k]
  |  |  ------------------
  ------------------
  830|   117k|                }
  831|   341k|                if (here.val < 16) {
  ------------------
  |  Branch (831:21): [True: 304k, False: 37.2k]
  ------------------
  832|   304k|                    DROPBITS(here.bits);
  ------------------
  |  |  380|   304k|    do { \
  |  |  381|   304k|        hold >>= (n); \
  |  |  382|   304k|        bits -= (unsigned)(n); \
  |  |  383|   304k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 304k]
  |  |  ------------------
  ------------------
  833|   304k|                    state->lens[state->have++] = here.val;
  834|   304k|                }
  835|  37.2k|                else {
  836|  37.2k|                    if (here.val == 16) {
  ------------------
  |  Branch (836:25): [True: 15.2k, False: 22.0k]
  ------------------
  837|  15.2k|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  369|  15.2k|    do { \
  |  |  370|  19.0k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 3.90k, False: 15.1k]
  |  |  ------------------
  |  |  371|  15.2k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  3.90k|    do { \
  |  |  |  |  360|  3.90k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 58, False: 3.84k]
  |  |  |  |  ------------------
  |  |  |  |  361|  3.90k|        have--; \
  |  |  |  |  362|  3.84k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  3.84k|        bits += 8; \
  |  |  |  |  364|  3.84k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 3.84k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  15.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 15.1k]
  |  |  ------------------
  ------------------
  838|  15.1k|                        DROPBITS(here.bits);
  ------------------
  |  |  380|  15.1k|    do { \
  |  |  381|  15.1k|        hold >>= (n); \
  |  |  382|  15.1k|        bits -= (unsigned)(n); \
  |  |  383|  15.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 15.1k]
  |  |  ------------------
  ------------------
  839|  15.1k|                        if (state->have == 0) {
  ------------------
  |  Branch (839:29): [True: 11, False: 15.1k]
  ------------------
  840|     11|                            strm->msg = (z_const char *)
  841|     11|                                "invalid bit length repeat";
  842|     11|                            state->mode = BAD;
  843|     11|                            break;
  844|     11|                        }
  845|  15.1k|                        len = state->lens[state->have - 1];
  846|  15.1k|                        copy = 3 + BITS(2);
  ------------------
  |  |  376|  15.1k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  847|  15.1k|                        DROPBITS(2);
  ------------------
  |  |  380|  15.1k|    do { \
  |  |  381|  15.1k|        hold >>= (n); \
  |  |  382|  15.1k|        bits -= (unsigned)(n); \
  |  |  383|  15.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 15.1k]
  |  |  ------------------
  ------------------
  848|  15.1k|                    }
  849|  22.0k|                    else if (here.val == 17) {
  ------------------
  |  Branch (849:30): [True: 10.4k, False: 11.5k]
  ------------------
  850|  10.4k|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  369|  10.4k|    do { \
  |  |  370|  13.7k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 3.41k, False: 10.3k]
  |  |  ------------------
  |  |  371|  10.4k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  3.41k|    do { \
  |  |  |  |  360|  3.41k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 118, False: 3.29k]
  |  |  |  |  ------------------
  |  |  |  |  361|  3.41k|        have--; \
  |  |  |  |  362|  3.29k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  3.29k|        bits += 8; \
  |  |  |  |  364|  3.29k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 3.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  10.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 10.3k]
  |  |  ------------------
  ------------------
  851|  10.3k|                        DROPBITS(here.bits);
  ------------------
  |  |  380|  10.3k|    do { \
  |  |  381|  10.3k|        hold >>= (n); \
  |  |  382|  10.3k|        bits -= (unsigned)(n); \
  |  |  383|  10.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 10.3k]
  |  |  ------------------
  ------------------
  852|  10.3k|                        len = 0;
  853|  10.3k|                        copy = 3 + BITS(3);
  ------------------
  |  |  376|  10.3k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  854|  10.3k|                        DROPBITS(3);
  ------------------
  |  |  380|  10.3k|    do { \
  |  |  381|  10.3k|        hold >>= (n); \
  |  |  382|  10.3k|        bits -= (unsigned)(n); \
  |  |  383|  10.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 10.3k]
  |  |  ------------------
  ------------------
  855|  10.3k|                    }
  856|  11.5k|                    else {
  857|  11.5k|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  369|  11.5k|    do { \
  |  |  370|  22.4k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 10.9k, False: 11.4k]
  |  |  ------------------
  |  |  371|  11.5k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  10.9k|    do { \
  |  |  |  |  360|  10.9k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 60, False: 10.9k]
  |  |  |  |  ------------------
  |  |  |  |  361|  10.9k|        have--; \
  |  |  |  |  362|  10.9k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  10.9k|        bits += 8; \
  |  |  |  |  364|  10.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 10.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  11.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 11.4k]
  |  |  ------------------
  ------------------
  858|  11.4k|                        DROPBITS(here.bits);
  ------------------
  |  |  380|  11.4k|    do { \
  |  |  381|  11.4k|        hold >>= (n); \
  |  |  382|  11.4k|        bits -= (unsigned)(n); \
  |  |  383|  11.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 11.4k]
  |  |  ------------------
  ------------------
  859|  11.4k|                        len = 0;
  860|  11.4k|                        copy = 11 + BITS(7);
  ------------------
  |  |  376|  11.4k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  861|  11.4k|                        DROPBITS(7);
  ------------------
  |  |  380|  11.4k|    do { \
  |  |  381|  11.4k|        hold >>= (n); \
  |  |  382|  11.4k|        bits -= (unsigned)(n); \
  |  |  383|  11.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 11.4k]
  |  |  ------------------
  ------------------
  862|  11.4k|                    }
  863|  36.9k|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (863:25): [True: 96, False: 36.8k]
  ------------------
  864|     96|                        strm->msg = (z_const char *)
  865|     96|                            "invalid bit length repeat";
  866|     96|                        state->mode = BAD;
  867|     96|                        break;
  868|     96|                    }
  869|   800k|                    while (copy--)
  ------------------
  |  Branch (869:28): [True: 763k, False: 36.8k]
  ------------------
  870|   763k|                        state->lens[state->have++] = (unsigned short)len;
  871|  36.8k|                }
  872|   341k|            }
  873|       |
  874|       |            /* handle error breaks in while */
  875|  3.48k|            if (state->mode == BAD) break;
  ------------------
  |  Branch (875:17): [True: 107, False: 3.37k]
  ------------------
  876|       |
  877|       |            /* check for end-of-block code (better have one) */
  878|  3.37k|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (878:17): [True: 18, False: 3.35k]
  ------------------
  879|     18|                strm->msg = (z_const char *)
  880|     18|                    "invalid code -- missing end-of-block";
  881|     18|                state->mode = BAD;
  882|     18|                break;
  883|     18|            }
  884|       |
  885|       |            /* build code tables -- note: do not change the lenbits or distbits
  886|       |               values here (9 and 6) without reading the comments in inftrees.h
  887|       |               concerning the ENOUGH constants, which depend on those values */
  888|  3.35k|            state->next = state->codes;
  889|  3.35k|            state->lencode = (const code FAR *)(state->next);
  890|  3.35k|            state->lenbits = 9;
  891|  3.35k|            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
  892|  3.35k|                                &(state->lenbits), state->work);
  893|  3.35k|            if (ret) {
  ------------------
  |  Branch (893:17): [True: 69, False: 3.29k]
  ------------------
  894|     69|                strm->msg = (z_const char *)"invalid literal/lengths set";
  895|     69|                state->mode = BAD;
  896|     69|                break;
  897|     69|            }
  898|  3.29k|            state->distcode = (const code FAR *)(state->next);
  899|  3.29k|            state->distbits = 6;
  900|  3.29k|            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
  901|  3.29k|                            &(state->next), &(state->distbits), state->work);
  902|  3.29k|            if (ret) {
  ------------------
  |  Branch (902:17): [True: 55, False: 3.23k]
  ------------------
  903|     55|                strm->msg = (z_const char *)"invalid distances set";
  904|     55|                state->mode = BAD;
  905|     55|                break;
  906|     55|            }
  907|  3.23k|            Tracev((stderr, "inflate:       codes ok\n"));
  908|  3.23k|            state->mode = LEN_;
  909|  3.23k|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  3.23k|#define Z_TREES         6
  ------------------
  |  Branch (909:17): [True: 0, False: 3.23k]
  ------------------
  910|       |                /* fallthrough */
  911|  8.92k|        case LEN_:
  ------------------
  |  Branch (911:9): [True: 5.68k, False: 946k]
  ------------------
  912|  8.92k|            state->mode = LEN;
  913|       |                /* fallthrough */
  914|   571k|        case LEN:
  ------------------
  |  Branch (914:9): [True: 562k, False: 389k]
  ------------------
  915|   571k|            if (have >= 6 && left >= 258) {
  ------------------
  |  Branch (915:17): [True: 131k, False: 440k]
  |  Branch (915:30): [True: 118k, False: 12.8k]
  ------------------
  916|   118k|                RESTORE();
  ------------------
  |  |  340|   118k|    do { \
  |  |  341|   118k|        strm->next_out = put; \
  |  |  342|   118k|        strm->avail_out = left; \
  |  |  343|   118k|        strm->next_in = next; \
  |  |  344|   118k|        strm->avail_in = have; \
  |  |  345|   118k|        state->hold = hold; \
  |  |  346|   118k|        state->bits = bits; \
  |  |  347|   118k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (347:14): [Folded, False: 118k]
  |  |  ------------------
  ------------------
  917|   118k|                inflate_fast(strm, out);
  918|   118k|                LOAD();
  ------------------
  |  |  329|   118k|    do { \
  |  |  330|   118k|        put = strm->next_out; \
  |  |  331|   118k|        left = strm->avail_out; \
  |  |  332|   118k|        next = strm->next_in; \
  |  |  333|   118k|        have = strm->avail_in; \
  |  |  334|   118k|        hold = state->hold; \
  |  |  335|   118k|        bits = state->bits; \
  |  |  336|   118k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (336:14): [Folded, False: 118k]
  |  |  ------------------
  ------------------
  919|   118k|                if (state->mode == TYPE)
  ------------------
  |  Branch (919:21): [True: 5.10k, False: 113k]
  ------------------
  920|  5.10k|                    state->back = -1;
  921|   118k|                break;
  922|   118k|            }
  923|   452k|            state->back = 0;
  924|   780k|            for (;;) {
  925|   780k|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  376|   780k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  926|   780k|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (926:21): [True: 400k, False: 379k]
  ------------------
  927|   379k|                PULLBYTE();
  ------------------
  |  |  359|   379k|    do { \
  |  |  360|   379k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 52.0k, False: 327k]
  |  |  ------------------
  |  |  361|   379k|        have--; \
  |  |  362|   327k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|   327k|        bits += 8; \
  |  |  364|   327k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 327k]
  |  |  ------------------
  ------------------
  928|   379k|            }
  929|   400k|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (929:17): [True: 115k, False: 285k]
  |  Branch (929:28): [True: 9.74k, False: 105k]
  ------------------
  930|  9.74k|                last = here;
  931|  10.2k|                for (;;) {
  932|  10.2k|                    here = state->lencode[last.val +
  933|  10.2k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  376|  10.2k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  934|  10.2k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (934:25): [True: 9.69k, False: 549]
  ------------------
  935|    549|                    PULLBYTE();
  ------------------
  |  |  359|    549|    do { \
  |  |  360|    549|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 53, False: 496]
  |  |  ------------------
  |  |  361|    549|        have--; \
  |  |  362|    496|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|    496|        bits += 8; \
  |  |  364|    496|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 496]
  |  |  ------------------
  ------------------
  936|    549|                }
  937|  9.69k|                DROPBITS(last.bits);
  ------------------
  |  |  380|  9.69k|    do { \
  |  |  381|  9.69k|        hold >>= (n); \
  |  |  382|  9.69k|        bits -= (unsigned)(n); \
  |  |  383|  9.69k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 9.69k]
  |  |  ------------------
  ------------------
  938|  9.69k|                state->back += last.bits;
  939|  9.69k|            }
  940|   400k|            DROPBITS(here.bits);
  ------------------
  |  |  380|   400k|    do { \
  |  |  381|   400k|        hold >>= (n); \
  |  |  382|   400k|        bits -= (unsigned)(n); \
  |  |  383|   400k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 400k]
  |  |  ------------------
  ------------------
  941|   400k|            state->back += here.bits;
  942|   400k|            state->length = (unsigned)here.val;
  943|   400k|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (943:17): [True: 294k, False: 106k]
  ------------------
  944|   294k|                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
  945|   294k|                        "inflate:         literal '%c'\n" :
  946|   294k|                        "inflate:         literal 0x%02x\n", here.val));
  947|   294k|                state->mode = LIT;
  948|   294k|                break;
  949|   294k|            }
  950|   106k|            if (here.op & 32) {
  ------------------
  |  Branch (950:17): [True: 1.37k, False: 104k]
  ------------------
  951|  1.37k|                Tracevv((stderr, "inflate:         end of block\n"));
  952|  1.37k|                state->back = -1;
  953|  1.37k|                state->mode = TYPE;
  954|  1.37k|                break;
  955|  1.37k|            }
  956|   104k|            if (here.op & 64) {
  ------------------
  |  Branch (956:17): [True: 8, False: 104k]
  ------------------
  957|      8|                strm->msg = (z_const char *)"invalid literal/length code";
  958|      8|                state->mode = BAD;
  959|      8|                break;
  960|      8|            }
  961|   104k|            state->extra = (unsigned)(here.op) & 15;
  962|   104k|            state->mode = LENEXT;
  963|       |                /* fallthrough */
  964|   127k|        case LENEXT:
  ------------------
  |  Branch (964:9): [True: 23.1k, False: 928k]
  ------------------
  965|   127k|            if (state->extra) {
  ------------------
  |  Branch (965:17): [True: 73.9k, False: 53.9k]
  ------------------
  966|  73.9k|                NEEDBITS(state->extra);
  ------------------
  |  |  369|  73.9k|    do { \
  |  |  370|   112k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 62.0k, False: 50.6k]
  |  |  ------------------
  |  |  371|  73.9k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  62.0k|    do { \
  |  |  |  |  360|  62.0k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 23.2k, False: 38.8k]
  |  |  |  |  ------------------
  |  |  |  |  361|  62.0k|        have--; \
  |  |  |  |  362|  38.8k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  38.8k|        bits += 8; \
  |  |  |  |  364|  38.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 38.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  73.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 50.6k]
  |  |  ------------------
  ------------------
  967|  50.6k|                state->length += BITS(state->extra);
  ------------------
  |  |  376|  50.6k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  968|  50.6k|                DROPBITS(state->extra);
  ------------------
  |  |  380|  50.6k|    do { \
  |  |  381|  50.6k|        hold >>= (n); \
  |  |  382|  50.6k|        bits -= (unsigned)(n); \
  |  |  383|  50.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 50.6k]
  |  |  ------------------
  ------------------
  969|  50.6k|                state->back += state->extra;
  970|  50.6k|            }
  971|   104k|            Tracevv((stderr, "inflate:         length %u\n", state->length));
  972|   104k|            state->was = state->length;
  973|   104k|            state->mode = DIST;
  974|       |                /* fallthrough */
  975|   112k|        case DIST:
  ------------------
  |  Branch (975:9): [True: 7.65k, False: 944k]
  ------------------
  976|   160k|            for (;;) {
  977|   160k|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  376|   160k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  978|   160k|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (978:21): [True: 104k, False: 56.2k]
  ------------------
  979|  56.2k|                PULLBYTE();
  ------------------
  |  |  359|  56.2k|    do { \
  |  |  360|  56.2k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 7.94k, False: 48.2k]
  |  |  ------------------
  |  |  361|  56.2k|        have--; \
  |  |  362|  48.2k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|  48.2k|        bits += 8; \
  |  |  364|  48.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 48.2k]
  |  |  ------------------
  ------------------
  980|  56.2k|            }
  981|   104k|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (981:17): [True: 846, False: 103k]
  ------------------
  982|    846|                last = here;
  983|  1.21k|                for (;;) {
  984|  1.21k|                    here = state->distcode[last.val +
  985|  1.21k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  376|  1.21k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  986|  1.21k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (986:25): [True: 728, False: 484]
  ------------------
  987|    484|                    PULLBYTE();
  ------------------
  |  |  359|    484|    do { \
  |  |  360|    484|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 118, False: 366]
  |  |  ------------------
  |  |  361|    484|        have--; \
  |  |  362|    366|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|    366|        bits += 8; \
  |  |  364|    366|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 366]
  |  |  ------------------
  ------------------
  988|    484|                }
  989|    728|                DROPBITS(last.bits);
  ------------------
  |  |  380|    728|    do { \
  |  |  381|    728|        hold >>= (n); \
  |  |  382|    728|        bits -= (unsigned)(n); \
  |  |  383|    728|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 728]
  |  |  ------------------
  ------------------
  990|    728|                state->back += last.bits;
  991|    728|            }
  992|   104k|            DROPBITS(here.bits);
  ------------------
  |  |  380|   104k|    do { \
  |  |  381|   104k|        hold >>= (n); \
  |  |  382|   104k|        bits -= (unsigned)(n); \
  |  |  383|   104k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 104k]
  |  |  ------------------
  ------------------
  993|   104k|            state->back += here.bits;
  994|   104k|            if (here.op & 64) {
  ------------------
  |  Branch (994:17): [True: 23, False: 104k]
  ------------------
  995|     23|                strm->msg = (z_const char *)"invalid distance code";
  996|     23|                state->mode = BAD;
  997|     23|                break;
  998|     23|            }
  999|   104k|            state->offset = (unsigned)here.val;
 1000|   104k|            state->extra = (unsigned)(here.op) & 15;
 1001|   104k|            state->mode = DISTEXT;
 1002|       |                /* fallthrough */
 1003|   125k|        case DISTEXT:
  ------------------
  |  Branch (1003:9): [True: 21.7k, False: 930k]
  ------------------
 1004|   125k|            if (state->extra) {
  ------------------
  |  Branch (1004:17): [True: 106k, False: 19.4k]
  ------------------
 1005|   106k|                NEEDBITS(state->extra);
  ------------------
  |  |  369|   106k|    do { \
  |  |  370|   183k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 99.2k, False: 84.1k]
  |  |  ------------------
  |  |  371|   106k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  99.2k|    do { \
  |  |  |  |  360|  99.2k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 22.3k, False: 76.9k]
  |  |  |  |  ------------------
  |  |  |  |  361|  99.2k|        have--; \
  |  |  |  |  362|  76.9k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  76.9k|        bits += 8; \
  |  |  |  |  364|  76.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 76.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   106k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 84.1k]
  |  |  ------------------
  ------------------
 1006|  84.1k|                state->offset += BITS(state->extra);
  ------------------
  |  |  376|  84.1k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1007|  84.1k|                DROPBITS(state->extra);
  ------------------
  |  |  380|  84.1k|    do { \
  |  |  381|  84.1k|        hold >>= (n); \
  |  |  382|  84.1k|        bits -= (unsigned)(n); \
  |  |  383|  84.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 84.1k]
  |  |  ------------------
  ------------------
 1008|  84.1k|                state->back += state->extra;
 1009|  84.1k|            }
 1010|       |#ifdef INFLATE_STRICT
 1011|       |            if (state->offset > state->dmax) {
 1012|       |                strm->msg = (z_const char *)"invalid distance too far back";
 1013|       |                state->mode = BAD;
 1014|       |                break;
 1015|       |            }
 1016|       |#endif
 1017|   103k|            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
 1018|   103k|            state->mode = MATCH;
 1019|       |                /* fallthrough */
 1020|   109k|        case MATCH:
  ------------------
  |  Branch (1020:9): [True: 5.63k, False: 946k]
  ------------------
 1021|   109k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1021:17): [True: 592, False: 108k]
  ------------------
 1022|   108k|            copy = out - left;
 1023|   108k|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1023:17): [True: 64.1k, False: 44.4k]
  ------------------
 1024|  64.1k|                copy = state->offset - copy;
 1025|  64.1k|                if (copy > state->whave) {
  ------------------
  |  Branch (1025:21): [True: 76, False: 64.1k]
  ------------------
 1026|     76|                    if (state->sane) {
  ------------------
  |  Branch (1026:25): [True: 76, False: 0]
  ------------------
 1027|     76|                        strm->msg = (z_const char *)
 1028|     76|                            "invalid distance too far back";
 1029|     76|                        state->mode = BAD;
 1030|     76|                        break;
 1031|     76|                    }
 1032|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
 1033|       |                    Trace((stderr, "inflate.c too far\n"));
 1034|       |                    copy -= state->whave;
 1035|       |                    if (copy > state->length) copy = state->length;
 1036|       |                    if (copy > left) copy = left;
 1037|       |                    left -= copy;
 1038|       |                    state->length -= copy;
 1039|       |                    do {
 1040|       |                        *put++ = 0;
 1041|       |                    } while (--copy);
 1042|       |                    if (state->length == 0) state->mode = LEN;
 1043|       |                    break;
 1044|       |#endif
 1045|     76|                }
 1046|  64.1k|                if (copy > state->wnext) {
  ------------------
  |  Branch (1046:21): [True: 7.70k, False: 56.4k]
  ------------------
 1047|  7.70k|                    copy -= state->wnext;
 1048|  7.70k|                    from = state->window + (state->wsize - copy);
 1049|  7.70k|                }
 1050|  56.4k|                else
 1051|  56.4k|                    from = state->window + (state->wnext - copy);
 1052|  64.1k|                if (copy > state->length) copy = state->length;
  ------------------
  |  Branch (1052:21): [True: 59.4k, False: 4.63k]
  ------------------
 1053|  64.1k|            }
 1054|  44.4k|            else {                              /* copy from output */
 1055|  44.4k|                from = put - state->offset;
 1056|  44.4k|                copy = state->length;
 1057|  44.4k|            }
 1058|   108k|            if (copy > left) copy = left;
  ------------------
  |  Branch (1058:17): [True: 570, False: 108k]
  ------------------
 1059|   108k|            left -= copy;
 1060|   108k|            state->length -= copy;
 1061|  4.24M|            do {
 1062|  4.24M|                *put++ = *from++;
 1063|  4.24M|            } while (--copy);
  ------------------
  |  Branch (1063:22): [True: 4.13M, False: 108k]
  ------------------
 1064|   108k|            if (state->length == 0) state->mode = LEN;
  ------------------
  |  Branch (1064:17): [True: 103k, False: 5.05k]
  ------------------
 1065|   108k|            break;
 1066|   294k|        case LIT:
  ------------------
  |  Branch (1066:9): [True: 294k, False: 657k]
  ------------------
 1067|   294k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1067:17): [True: 36, False: 294k]
  ------------------
 1068|   294k|            *put++ = (unsigned char)(state->length);
 1069|   294k|            left--;
 1070|   294k|            state->mode = LEN;
 1071|   294k|            break;
 1072|  1.22k|        case CHECK:
  ------------------
  |  Branch (1072:9): [True: 1.22k, False: 950k]
  ------------------
 1073|  1.22k|            if (state->wrap) {
  ------------------
  |  Branch (1073:17): [True: 1.22k, False: 0]
  ------------------
 1074|  1.22k|                NEEDBITS(32);
  ------------------
  |  |  369|  1.22k|    do { \
  |  |  370|  5.44k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 4.41k, False: 1.02k]
  |  |  ------------------
  |  |  371|  4.41k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  4.41k|    do { \
  |  |  |  |  360|  4.41k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 195, False: 4.22k]
  |  |  |  |  ------------------
  |  |  |  |  361|  4.41k|        have--; \
  |  |  |  |  362|  4.22k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  4.22k|        bits += 8; \
  |  |  |  |  364|  4.22k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 4.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  1.22k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 1.02k]
  |  |  ------------------
  ------------------
 1075|  1.02k|                out -= left;
 1076|  1.02k|                strm->total_out += out;
 1077|  1.02k|                state->total += out;
 1078|  1.02k|                if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1078:21): [True: 1.02k, False: 0]
  |  Branch (1078:42): [True: 975, False: 50]
  ------------------
 1079|    975|                    strm->adler = state->check =
 1080|    975|                        UPDATE_CHECK(state->check, put - out, out);
  ------------------
  |  |  303|    975|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (303:6): [True: 0, False: 975]
  |  |  ------------------
  ------------------
 1081|  1.02k|                out = left;
 1082|  1.02k|                if ((state->wrap & 4) && (
  ------------------
  |  Branch (1082:21): [True: 1.02k, False: 0]
  |  Branch (1082:42): [True: 568, False: 457]
  ------------------
 1083|  1.02k|#ifdef GUNZIP
 1084|  1.02k|                     state->flags ? hold :
  ------------------
  |  Branch (1084:22): [True: 0, False: 1.02k]
  ------------------
 1085|  1.02k|#endif
 1086|  1.02k|                     ZSWAP32(hold)) != state->check) {
  ------------------
  |  |  258|  1.02k|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  259|  1.02k|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
 1087|    568|                    strm->msg = (z_const char *)"incorrect data check";
 1088|    568|                    state->mode = BAD;
 1089|    568|                    break;
 1090|    568|                }
 1091|    457|                INITBITS();
  ------------------
  |  |  351|    457|    do { \
  |  |  352|    457|        hold = 0; \
  |  |  353|    457|        bits = 0; \
  |  |  354|    457|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 457]
  |  |  ------------------
  ------------------
 1092|    457|                Tracev((stderr, "inflate:   check matches trailer\n"));
 1093|    457|            }
 1094|    457|#ifdef GUNZIP
 1095|    457|            state->mode = LENGTH;
 1096|       |                /* fallthrough */
 1097|    457|        case LENGTH:
  ------------------
  |  Branch (1097:9): [True: 0, False: 952k]
  ------------------
 1098|    457|            if (state->wrap && state->flags) {
  ------------------
  |  Branch (1098:17): [True: 457, False: 0]
  |  Branch (1098:32): [True: 0, False: 457]
  ------------------
 1099|      0|                NEEDBITS(32);
  ------------------
  |  |  369|      0|    do { \
  |  |  370|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  371|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|      0|    do { \
  |  |  |  |  360|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  361|      0|        have--; \
  |  |  |  |  362|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|      0|        bits += 8; \
  |  |  |  |  364|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1100|      0|                if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) {
  ------------------
  |  Branch (1100:21): [True: 0, False: 0]
  |  Branch (1100:42): [True: 0, False: 0]
  ------------------
 1101|      0|                    strm->msg = (z_const char *)"incorrect length check";
 1102|      0|                    state->mode = BAD;
 1103|      0|                    break;
 1104|      0|                }
 1105|      0|                INITBITS();
  ------------------
  |  |  351|      0|    do { \
  |  |  352|      0|        hold = 0; \
  |  |  353|      0|        bits = 0; \
  |  |  354|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1106|      0|                Tracev((stderr, "inflate:   length matches trailer\n"));
 1107|      0|            }
 1108|    457|#endif
 1109|    457|            state->mode = DONE;
 1110|       |                /* fallthrough */
 1111|  1.01k|        case DONE:
  ------------------
  |  Branch (1111:9): [True: 553, False: 951k]
  ------------------
 1112|  1.01k|            ret = Z_STREAM_END;
  ------------------
  |  |  182|  1.01k|#define Z_STREAM_END    1
  ------------------
 1113|  1.01k|            goto inf_leave;
 1114|  3.60k|        case BAD:
  ------------------
  |  Branch (1114:9): [True: 3.60k, False: 948k]
  ------------------
 1115|  3.60k|            ret = Z_DATA_ERROR;
  ------------------
  |  |  186|  3.60k|#define Z_DATA_ERROR   (-3)
  ------------------
 1116|  3.60k|            goto inf_leave;
 1117|      0|        case MEM:
  ------------------
  |  Branch (1117:9): [True: 0, False: 952k]
  ------------------
 1118|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1119|      0|        case SYNC:
  ------------------
  |  Branch (1119:9): [True: 0, False: 952k]
  ------------------
 1120|       |                /* fallthrough */
 1121|      0|        default:
  ------------------
  |  Branch (1121:9): [True: 0, False: 952k]
  ------------------
 1122|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1123|   952k|        }
 1124|       |
 1125|       |    /*
 1126|       |       Return from inflate(), updating the total counts and the check value.
 1127|       |       If there was no progress during the inflate() call, return a buffer
 1128|       |       error.  Call updatewindow() to create and/or update the window state.
 1129|       |       Note: a memory error from inflate() is non-recoverable.
 1130|       |     */
 1131|   114k|  inf_leave:
 1132|   114k|    RESTORE();
  ------------------
  |  |  340|   114k|    do { \
  |  |  341|   114k|        strm->next_out = put; \
  |  |  342|   114k|        strm->avail_out = left; \
  |  |  343|   114k|        strm->next_in = next; \
  |  |  344|   114k|        strm->avail_in = have; \
  |  |  345|   114k|        state->hold = hold; \
  |  |  346|   114k|        state->bits = bits; \
  |  |  347|   114k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (347:14): [Folded, False: 114k]
  |  |  ------------------
  ------------------
 1133|   114k|    if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1133:9): [True: 106k, False: 7.54k]
  |  Branch (1133:26): [True: 3.04k, False: 4.49k]
  |  Branch (1133:52): [True: 2.72k, False: 318]
  ------------------
 1134|  2.72k|            (state->mode < CHECK || flush != Z_FINISH)))
  ------------------
  |  |  176|     63|#define Z_FINISH        4
  ------------------
  |  Branch (1134:14): [True: 2.66k, False: 63]
  |  Branch (1134:37): [True: 63, False: 0]
  ------------------
 1135|   109k|        if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
  ------------------
  |  Branch (1135:13): [True: 0, False: 109k]
  ------------------
 1136|      0|            state->mode = MEM;
 1137|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1138|      0|        }
 1139|   114k|    in -= strm->avail_in;
 1140|   114k|    out -= strm->avail_out;
 1141|   114k|    strm->total_in += in;
 1142|   114k|    strm->total_out += out;
 1143|   114k|    state->total += out;
 1144|   114k|    if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1144:9): [True: 114k, False: 0]
  |  Branch (1144:30): [True: 106k, False: 7.47k]
  ------------------
 1145|   106k|        strm->adler = state->check =
 1146|   106k|            UPDATE_CHECK(state->check, strm->next_out - out, out);
  ------------------
  |  |  303|   106k|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (303:6): [True: 0, False: 106k]
  |  |  ------------------
  ------------------
 1147|   114k|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1147:43): [True: 4.47k, False: 109k]
  ------------------
 1148|   114k|                      (state->mode == TYPE ? 128 : 0) +
  ------------------
  |  Branch (1148:24): [True: 147, False: 114k]
  ------------------
 1149|   114k|                      (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1149:24): [True: 0, False: 114k]
  |  Branch (1149:47): [True: 0, False: 114k]
  ------------------
 1150|   114k|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  176|   109k|#define Z_FINISH        4
  ------------------
                  if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  181|  4.95k|#define Z_OK            0
  ------------------
  |  Branch (1150:11): [True: 4.97k, False: 109k]
  |  Branch (1150:22): [True: 4.95k, False: 26]
  |  Branch (1150:35): [True: 0, False: 109k]
  |  Branch (1150:57): [True: 2.57k, False: 2.37k]
  ------------------
 1151|  2.57k|        ret = Z_BUF_ERROR;
  ------------------
  |  |  188|  2.57k|#define Z_BUF_ERROR    (-5)
  ------------------
 1152|   114k|    return ret;
 1153|   114k|}
inflateEnd:
 1155|  5.00k|int ZEXPORT inflateEnd(z_streamp strm) {
 1156|  5.00k|    struct inflate_state FAR *state;
 1157|  5.00k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1157:9): [True: 0, False: 5.00k]
  ------------------
 1158|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1159|  5.00k|    state = (struct inflate_state FAR *)strm->state;
 1160|  5.00k|    if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  216|  5.00k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  254|  2.72k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  |  Branch (1160:9): [True: 2.72k, False: 2.27k]
  ------------------
 1161|  5.00k|    ZFREE(strm, strm->state);
  ------------------
  |  |  254|  5.00k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
 1162|  5.00k|    strm->state = Z_NULL;
  ------------------
  |  |  216|  5.00k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1163|  5.00k|    Tracev((stderr, "inflate: end\n"));
 1164|  5.00k|    return Z_OK;
  ------------------
  |  |  181|  5.00k|#define Z_OK            0
  ------------------
 1165|  5.00k|}
inflate.c:inflateStateCheck:
   88|   134k|local int inflateStateCheck(z_streamp strm) {
   89|   134k|    struct inflate_state FAR *state;
   90|   134k|    if (strm == Z_NULL ||
  ------------------
  |  |  216|   268k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (90:9): [True: 0, False: 134k]
  ------------------
   91|   134k|        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (91:9): [True: 0, False: 134k]
  |  Branch (91:42): [True: 0, False: 134k]
  ------------------
   92|      0|        return 1;
   93|   134k|    state = (struct inflate_state FAR *)strm->state;
   94|   134k|    if (state == Z_NULL || state->strm != strm ||
  ------------------
  |  |  216|   268k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (94:9): [True: 0, False: 134k]
  |  Branch (94:28): [True: 0, False: 134k]
  ------------------
   95|   134k|        state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (95:9): [True: 0, False: 134k]
  |  Branch (95:31): [True: 0, False: 134k]
  ------------------
   96|      0|        return 1;
   97|   134k|    return 0;
   98|   134k|}
inflate.c:updatewindow:
  252|   109k|local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) {
  253|   109k|    struct inflate_state FAR *state;
  254|   109k|    unsigned dist;
  255|       |
  256|   109k|    state = (struct inflate_state FAR *)strm->state;
  257|       |
  258|       |    /* if it hasn't been done already, allocate space for the window */
  259|   109k|    if (state->window == Z_NULL) {
  ------------------
  |  |  216|   109k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (259:9): [True: 2.72k, False: 106k]
  ------------------
  260|  2.72k|        state->window = (unsigned char FAR *)
  261|  2.72k|                        ZALLOC(strm, 1U << state->wbits,
  ------------------
  |  |  253|  2.72k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  262|  2.72k|                               sizeof(unsigned char));
  263|  2.72k|        if (state->window == Z_NULL) return 1;
  ------------------
  |  |  216|  2.72k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (263:13): [True: 0, False: 2.72k]
  ------------------
  264|  2.72k|    }
  265|       |
  266|       |    /* if window not in use yet, initialize */
  267|   109k|    if (state->wsize == 0) {
  ------------------
  |  Branch (267:9): [True: 2.72k, False: 106k]
  ------------------
  268|  2.72k|        state->wsize = 1U << state->wbits;
  269|  2.72k|        state->wnext = 0;
  270|  2.72k|        state->whave = 0;
  271|  2.72k|    }
  272|       |
  273|       |    /* copy state->wsize or less output bytes into the circular window */
  274|   109k|    if (copy >= state->wsize) {
  ------------------
  |  Branch (274:9): [True: 816, False: 108k]
  ------------------
  275|    816|        zmemcpy(state->window, end - state->wsize, state->wsize);
  ------------------
  |  |  216|    816|#    define zmemcpy memcpy
  ------------------
  276|    816|        state->wnext = 0;
  277|    816|        state->whave = state->wsize;
  278|    816|    }
  279|   108k|    else {
  280|   108k|        dist = state->wsize - state->wnext;
  281|   108k|        if (dist > copy) dist = copy;
  ------------------
  |  Branch (281:13): [True: 108k, False: 118]
  ------------------
  282|   108k|        zmemcpy(state->window + state->wnext, end - copy, dist);
  ------------------
  |  |  216|   108k|#    define zmemcpy memcpy
  ------------------
  283|   108k|        copy -= dist;
  284|   108k|        if (copy) {
  ------------------
  |  Branch (284:13): [True: 106, False: 108k]
  ------------------
  285|    106|            zmemcpy(state->window, end - copy, copy);
  ------------------
  |  |  216|    106|#    define zmemcpy memcpy
  ------------------
  286|    106|            state->wnext = copy;
  287|    106|            state->whave = state->wsize;
  288|    106|        }
  289|   108k|        else {
  290|   108k|            state->wnext += dist;
  291|   108k|            if (state->wnext == state->wsize) state->wnext = 0;
  ------------------
  |  Branch (291:17): [True: 12, False: 108k]
  ------------------
  292|   108k|            if (state->whave < state->wsize) state->whave += dist;
  ------------------
  |  Branch (292:17): [True: 51.8k, False: 56.6k]
  ------------------
  293|   108k|        }
  294|   108k|    }
  295|   109k|    return 0;
  296|   109k|}

inflate_table:
   48|  10.3k|                                unsigned FAR *bits, unsigned short FAR *work) {
   49|  10.3k|    unsigned len;               /* a code's length in bits */
   50|  10.3k|    unsigned sym;               /* index of code symbols */
   51|  10.3k|    unsigned min, max;          /* minimum and maximum code lengths */
   52|  10.3k|    unsigned root;              /* number of index bits for root table */
   53|  10.3k|    unsigned curr;              /* number of index bits for current table */
   54|  10.3k|    unsigned drop;              /* code bits to drop for sub-table */
   55|  10.3k|    int left;                   /* number of prefix codes available */
   56|  10.3k|    unsigned used;              /* code entries in table used */
   57|  10.3k|    unsigned huff;              /* Huffman code */
   58|  10.3k|    unsigned incr;              /* for incrementing code, index */
   59|  10.3k|    unsigned fill;              /* index for replicating entries */
   60|  10.3k|    unsigned low;               /* low bits for current root entry */
   61|  10.3k|    unsigned mask;              /* mask for low root bits */
   62|  10.3k|    code here;                  /* table entry for duplication */
   63|  10.3k|    code FAR *next;             /* next available space in table */
   64|  10.3k|    const unsigned short FAR *base = NULL;  /* base value table to use */
   65|  10.3k|    const unsigned short FAR *extra = NULL; /* extra bits table to use */
   66|  10.3k|    unsigned match = 0;         /* use base and extra for symbol >= match */
   67|  10.3k|    unsigned short count[MAXBITS+1];    /* number of codes of each length */
   68|  10.3k|    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
   69|  10.3k|    static const unsigned short lbase[31] = { /* Length codes 257..285 base */
   70|  10.3k|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   71|  10.3k|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
   72|  10.3k|    static const unsigned short lext[31] = { /* Length codes 257..285 extra */
   73|  10.3k|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
   74|  10.3k|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 68, 193};
   75|  10.3k|    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
   76|  10.3k|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   77|  10.3k|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   78|  10.3k|        8193, 12289, 16385, 24577, 0, 0};
   79|  10.3k|    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
   80|  10.3k|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
   81|  10.3k|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
   82|  10.3k|        28, 28, 29, 29, 64, 64};
   83|       |
   84|       |    /*
   85|       |       Process a set of code lengths to create a canonical Huffman code.  The
   86|       |       code lengths are lens[0..codes-1].  Each length corresponds to the
   87|       |       symbols 0..codes-1.  The Huffman code is generated by first sorting the
   88|       |       symbols by length from short to long, and retaining the symbol order
   89|       |       for codes with equal lengths.  Then the code starts with all zero bits
   90|       |       for the first code of the shortest length, and the codes are integer
   91|       |       increments for the same length, and zeros are appended as the length
   92|       |       increases.  For the deflate format, these bits are stored backwards
   93|       |       from their more natural integer increment ordering, and so when the
   94|       |       decoding tables are built in the large loop below, the integer codes
   95|       |       are incremented backwards.
   96|       |
   97|       |       This routine assumes, but does not check, that all of the entries in
   98|       |       lens[] are in the range 0..MAXBITS.  The caller must assure this.
   99|       |       1..MAXBITS is interpreted as that code length.  zero means that that
  100|       |       symbol does not occur in this code.
  101|       |
  102|       |       The codes are sorted by computing a count of codes for each length,
  103|       |       creating from that a table of starting indices for each length in the
  104|       |       sorted table, and then entering the symbols in order in the sorted
  105|       |       table.  The sorted table is work[], with that space being provided by
  106|       |       the caller.
  107|       |
  108|       |       The length counts are used for other purposes as well, i.e. finding
  109|       |       the minimum and maximum length codes, determining if there are any
  110|       |       codes at all, checking for a valid set of lengths, and looking ahead
  111|       |       at length counts to determine sub-table sizes when building the
  112|       |       decoding tables.
  113|       |     */
  114|       |
  115|       |    /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
  116|   176k|    for (len = 0; len <= MAXBITS; len++)
  ------------------
  |  |   23|   176k|#define MAXBITS 15
  ------------------
  |  Branch (116:19): [True: 166k, False: 10.3k]
  ------------------
  117|   166k|        count[len] = 0;
  118|  1.09M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (118:19): [True: 1.08M, False: 10.3k]
  ------------------
  119|  1.08M|        count[lens[sym]]++;
  120|       |
  121|       |    /* bound code lengths, force root to be within code lengths */
  122|  10.3k|    root = *bits;
  123|   108k|    for (max = MAXBITS; max >= 1; max--)
  ------------------
  |  |   23|  10.3k|#define MAXBITS 15
  ------------------
  |  Branch (123:25): [True: 108k, False: 29]
  ------------------
  124|   108k|        if (count[max] != 0) break;
  ------------------
  |  Branch (124:13): [True: 10.3k, False: 98.5k]
  ------------------
  125|  10.3k|    if (root > max) root = max;
  ------------------
  |  Branch (125:9): [True: 6.16k, False: 4.21k]
  ------------------
  126|  10.3k|    if (max == 0) {                     /* no symbols to code at all */
  ------------------
  |  Branch (126:9): [True: 29, False: 10.3k]
  ------------------
  127|     29|        here.op = (unsigned char)64;    /* invalid code marker */
  128|     29|        here.bits = (unsigned char)1;
  129|     29|        here.val = (unsigned short)0;
  130|     29|        *(*table)++ = here;             /* make a table to force an error */
  131|     29|        *(*table)++ = here;
  132|     29|        *bits = 1;
  133|     29|        return 0;     /* no symbols, but wait for decoding to report error */
  134|     29|    }
  135|  19.4k|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (135:19): [True: 18.2k, False: 1.18k]
  ------------------
  136|  18.2k|        if (count[min] != 0) break;
  ------------------
  |  Branch (136:13): [True: 9.16k, False: 9.12k]
  ------------------
  137|  10.3k|    if (root < min) root = min;
  ------------------
  |  Branch (137:9): [True: 10, False: 10.3k]
  ------------------
  138|       |
  139|       |    /* check for an over-subscribed or incomplete set of lengths */
  140|  10.3k|    left = 1;
  141|   164k|    for (len = 1; len <= MAXBITS; len++) {
  ------------------
  |  |   23|   164k|#define MAXBITS 15
  ------------------
  |  Branch (141:19): [True: 153k, False: 10.2k]
  ------------------
  142|   153k|        left <<= 1;
  143|   153k|        left -= count[len];
  144|   153k|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (144:13): [True: 135, False: 153k]
  ------------------
  145|   153k|    }
  146|  10.2k|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (146:9): [True: 588, False: 9.63k]
  |  Branch (146:22): [True: 40, False: 548]
  |  Branch (146:39): [True: 63, False: 485]
  ------------------
  147|    103|        return -1;                      /* incomplete set */
  148|       |
  149|       |    /* generate offsets into symbol table for each length for sorting */
  150|  10.1k|    offs[1] = 0;
  151|   151k|    for (len = 1; len < MAXBITS; len++)
  ------------------
  |  |   23|   151k|#define MAXBITS 15
  ------------------
  |  Branch (151:19): [True: 141k, False: 10.1k]
  ------------------
  152|   141k|        offs[len + 1] = offs[len] + count[len];
  153|       |
  154|       |    /* sort symbols by length, by symbol order within each length */
  155|  1.07M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (155:19): [True: 1.06M, False: 10.1k]
  ------------------
  156|  1.06M|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
  ------------------
  |  Branch (156:13): [True: 337k, False: 728k]
  ------------------
  157|       |
  158|       |    /*
  159|       |       Create and fill in decoding tables.  In this loop, the table being
  160|       |       filled is at next and has curr index bits.  The code being used is huff
  161|       |       with length len.  That code is converted to an index by dropping drop
  162|       |       bits off of the bottom.  For codes where len is less than drop + curr,
  163|       |       those top drop + curr - len bits are incremented through all values to
  164|       |       fill the table with replicated entries.
  165|       |
  166|       |       root is the number of index bits for the root table.  When len exceeds
  167|       |       root, sub-tables are created pointed to by the root entry with an index
  168|       |       of the low root bits of huff.  This is saved in low to check for when a
  169|       |       new sub-table should be started.  drop is zero when the root table is
  170|       |       being filled, and drop is root when sub-tables are being filled.
  171|       |
  172|       |       When a new sub-table is needed, it is necessary to look ahead in the
  173|       |       code lengths to determine what size sub-table is needed.  The length
  174|       |       counts are used for this, and so count[] is decremented as codes are
  175|       |       entered in the tables.
  176|       |
  177|       |       used keeps track of how many table entries have been allocated from the
  178|       |       provided *table space.  It is checked for LENS and DIST tables against
  179|       |       the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
  180|       |       the initial root table size constants.  See the comments in inftrees.h
  181|       |       for more information.
  182|       |
  183|       |       sym increments through all symbols, and the loop terminates when
  184|       |       all codes of length max, i.e. all codes, have been processed.  This
  185|       |       routine permits incomplete codes, so another loop after this one fills
  186|       |       in the rest of the decoding tables with invalid code markers.
  187|       |     */
  188|       |
  189|       |    /* set up for code type */
  190|  10.1k|    switch (type) {
  ------------------
  |  Branch (190:13): [True: 10.1k, False: 0]
  ------------------
  191|  3.59k|    case CODES:
  ------------------
  |  Branch (191:5): [True: 3.59k, False: 6.52k]
  ------------------
  192|  3.59k|        match = 20;
  193|  3.59k|        break;
  194|  3.29k|    case LENS:
  ------------------
  |  Branch (194:5): [True: 3.29k, False: 6.82k]
  ------------------
  195|  3.29k|        base = lbase;
  196|  3.29k|        extra = lext;
  197|  3.29k|        match = 257;
  198|  3.29k|        break;
  199|  3.23k|    case DISTS:
  ------------------
  |  Branch (199:5): [True: 3.23k, False: 6.88k]
  ------------------
  200|  3.23k|        base = dbase;
  201|  3.23k|        extra = dext;
  202|  10.1k|    }
  203|       |
  204|       |    /* initialize state for loop */
  205|  10.1k|    huff = 0;                   /* starting code */
  206|  10.1k|    sym = 0;                    /* starting code symbol */
  207|  10.1k|    len = min;                  /* starting code length */
  208|  10.1k|    next = *table;              /* current table to fill in */
  209|  10.1k|    curr = root;                /* current table index bits */
  210|  10.1k|    drop = 0;                   /* current bits to drop from code for index */
  211|  10.1k|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  212|  10.1k|    used = 1U << root;          /* use root table entries */
  213|  10.1k|    mask = used - 1;            /* mask for comparing low */
  214|       |
  215|       |    /* check available table space */
  216|  10.1k|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   50|  3.29k|#  define ENOUGH_LENS 852
  ------------------
  |  Branch (216:10): [True: 3.29k, False: 6.82k]
  |  Branch (216:26): [True: 0, False: 3.29k]
  ------------------
  217|  10.1k|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   51|  3.23k|#  define ENOUGH_DISTS 592
  ------------------
  |  Branch (217:10): [True: 3.23k, False: 6.88k]
  |  Branch (217:27): [True: 0, False: 3.23k]
  ------------------
  218|      0|        return 1;
  219|       |
  220|       |    /* process all codes and make table entries */
  221|   337k|    for (;;) {
  222|       |        /* create table entry */
  223|   337k|        here.bits = (unsigned char)(len - drop);
  224|   337k|        if (work[sym] + 1U < match) {
  ------------------
  |  Branch (224:13): [True: 272k, False: 64.7k]
  ------------------
  225|   272k|            here.op = (unsigned char)0;
  226|   272k|            here.val = work[sym];
  227|   272k|        }
  228|  64.7k|        else if (work[sym] >= match) {
  ------------------
  |  Branch (228:18): [True: 61.4k, False: 3.29k]
  ------------------
  229|  61.4k|            here.op = (unsigned char)(extra[work[sym] - match]);
  230|  61.4k|            here.val = base[work[sym] - match];
  231|  61.4k|        }
  232|  3.29k|        else {
  233|  3.29k|            here.op = (unsigned char)(32 + 64);         /* end of block */
  234|  3.29k|            here.val = 0;
  235|  3.29k|        }
  236|       |
  237|       |        /* replicate for those indices with low len bits equal to huff */
  238|   337k|        incr = 1U << (len - drop);
  239|   337k|        fill = 1U << curr;
  240|   337k|        min = fill;                 /* save offset to next table */
  241|  1.20M|        do {
  242|  1.20M|            fill -= incr;
  243|  1.20M|            next[(huff >> drop) + fill] = here;
  244|  1.20M|        } while (fill != 0);
  ------------------
  |  Branch (244:18): [True: 866k, False: 337k]
  ------------------
  245|       |
  246|       |        /* backwards increment the len-bit code huff */
  247|   337k|        incr = 1U << (len - 1);
  248|   665k|        while (huff & incr)
  ------------------
  |  Branch (248:16): [True: 327k, False: 337k]
  ------------------
  249|   327k|            incr >>= 1;
  250|   337k|        if (incr != 0) {
  ------------------
  |  Branch (250:13): [True: 328k, False: 9.63k]
  ------------------
  251|   328k|            huff &= incr - 1;
  252|   328k|            huff += incr;
  253|   328k|        }
  254|  9.63k|        else
  255|  9.63k|            huff = 0;
  256|       |
  257|       |        /* go to next symbol, update count, len */
  258|   337k|        sym++;
  259|   337k|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (259:13): [True: 43.8k, False: 293k]
  ------------------
  260|  43.8k|            if (len == max) break;
  ------------------
  |  Branch (260:17): [True: 10.1k, False: 33.7k]
  ------------------
  261|  33.7k|            len = lens[work[sym]];
  262|  33.7k|        }
  263|       |
  264|       |        /* create new sub-table if needed */
  265|   327k|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (265:13): [True: 91.6k, False: 235k]
  |  Branch (265:27): [True: 43.5k, False: 48.1k]
  ------------------
  266|       |            /* if first time, transition to sub-tables */
  267|  43.5k|            if (drop == 0)
  ------------------
  |  Branch (267:17): [True: 2.88k, False: 40.6k]
  ------------------
  268|  2.88k|                drop = root;
  269|       |
  270|       |            /* increment past last table */
  271|  43.5k|            next += min;            /* here min is 1 << curr */
  272|       |
  273|       |            /* determine length of next table */
  274|  43.5k|            curr = len - drop;
  275|  43.5k|            left = (int)(1 << curr);
  276|  45.2k|            while (curr + drop < max) {
  ------------------
  |  Branch (276:20): [True: 3.75k, False: 41.4k]
  ------------------
  277|  3.75k|                left -= count[curr + drop];
  278|  3.75k|                if (left <= 0) break;
  ------------------
  |  Branch (278:21): [True: 2.04k, False: 1.71k]
  ------------------
  279|  1.71k|                curr++;
  280|  1.71k|                left <<= 1;
  281|  1.71k|            }
  282|       |
  283|       |            /* check for enough space */
  284|  43.5k|            used += 1U << curr;
  285|  43.5k|            if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   50|  41.7k|#  define ENOUGH_LENS 852
  ------------------
  |  Branch (285:18): [True: 41.7k, False: 1.77k]
  |  Branch (285:34): [True: 0, False: 41.7k]
  ------------------
  286|  43.5k|                (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   51|  1.77k|#  define ENOUGH_DISTS 592
  ------------------
  |  Branch (286:18): [True: 1.77k, False: 41.7k]
  |  Branch (286:35): [True: 0, False: 1.77k]
  ------------------
  287|      0|                return 1;
  288|       |
  289|       |            /* point entry in root table to sub-table */
  290|  43.5k|            low = huff & mask;
  291|  43.5k|            (*table)[low].op = (unsigned char)curr;
  292|  43.5k|            (*table)[low].bits = (unsigned char)root;
  293|  43.5k|            (*table)[low].val = (unsigned short)(next - *table);
  294|  43.5k|        }
  295|   327k|    }
  296|       |
  297|       |    /* fill in remaining table entry if code is incomplete (guaranteed to have
  298|       |       at most one remaining entry, since if the code is incomplete, the
  299|       |       maximum code length that was allowed to get this far is one bit) */
  300|  10.1k|    if (huff != 0) {
  ------------------
  |  Branch (300:9): [True: 485, False: 9.63k]
  ------------------
  301|    485|        here.op = (unsigned char)64;            /* invalid code marker */
  302|    485|        here.bits = (unsigned char)(len - drop);
  303|    485|        here.val = (unsigned short)0;
  304|    485|        next[huff] = here;
  305|    485|    }
  306|       |
  307|       |    /* set return parameters */
  308|  10.1k|    *table += used;
  309|  10.1k|    *bits = root;
  310|  10.1k|    return 0;
  311|  10.1k|}
inflate_fixed:
  364|  5.68k|void inflate_fixed(struct inflate_state FAR *state) {
  365|       |#ifdef BUILDFIXED
  366|       |    z_once(&built, buildtables);
  367|       |#endif /* BUILDFIXED */
  368|  5.68k|    state->lencode = lenfix;
  369|  5.68k|    state->lenbits = 9;
  370|  5.68k|    state->distcode = distfix;
  371|  5.68k|    state->distbits = 5;
  372|  5.68k|}

zcalloc:
  299|  7.72k|voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
  300|  7.72k|    (void)opaque;
  301|  7.72k|    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
  ------------------
  |  Branch (301:12): [True: 7.72k, Folded]
  ------------------
  302|  7.72k|                              (voidpf)calloc(items, size);
  303|  7.72k|}
zcfree:
  305|  7.72k|void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
  306|  7.72k|    (void)opaque;
  307|  7.72k|    free(ptr);
  308|  7.72k|}

