LLVMFuzzerTestOneInput:
   55|  18.5k|{
   56|  18.5k|#ifndef _WIN32
   57|       |    // Used by jpeg library to work around false positives in memory sanitizer.
   58|  18.5k|    setenv("JSIMD_FORCENONE", "1", 1);
   59|  18.5k|#endif
   60|  18.5k|    FuzzHelper f(data, size);
   61|  18.5k|    f.run();
   62|  18.5k|    return 0;
   63|  18.5k|}
_ZN10FuzzHelperC2EPKhm:
   15|  18.5k|        input_buffer(const_cast<unsigned char*>(data), size)
   16|  18.5k|    {
   17|  18.5k|    }
_ZN10FuzzHelper3runEv:
   21|  18.5k|    {
   22|  18.5k|        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|  18.5k|        try {
   28|  18.5k|            std::cerr << "\ninfo: starting testOutlines\n";
   29|       |
   30|  18.5k|            auto is = std::make_shared<BufferInputSource>("fuzz input", &input_buffer);
   31|  18.5k|            QPDF qpdf;
   32|  18.5k|            qpdf.processInputSource(is);
   33|  18.5k|            std::list<std::vector<QPDFOutlineObjectHelper>> queue;
   34|  18.5k|            auto& odh = QPDFOutlineDocumentHelper::get(qpdf);
   35|  18.5k|            queue.push_back(odh.getTopLevelOutlines());
   36|  27.6k|            while (!queue.empty()) {
  ------------------
  |  Branch (36:20): [True: 9.13k, False: 18.5k]
  ------------------
   37|  9.13k|                for (auto& ol: *(queue.begin())) {
  ------------------
  |  Branch (37:30): [True: 7.61k, False: 9.13k]
  ------------------
   38|  7.61k|                    ol.getDestPage();
   39|  7.61k|                    queue.push_back(ol.getKids());
   40|  7.61k|                }
   41|  9.13k|                queue.pop_front();
   42|  9.13k|            }
   43|  18.5k|        } catch (std::runtime_error const& e) {
   44|  16.9k|            std::cerr << "runtime_error: " << e.what() << '\n';
   45|  16.9k|        }
   46|  18.5k|    }

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

_ZN4qpdf10BaseHandleD2Ev:
  131|  45.4M|        ~BaseHandle() = default;
_ZNK4qpdf10BaseHandleeqERKS0_:
   67|  7.67k|        {
   68|  7.67k|            return obj == other.obj;
   69|  7.67k|        }
_ZNK4qpdf10BaseHandle5emptyEv:
   82|  7.43k|        {
   83|  7.43k|            return size() == 0;
   84|  7.43k|        }
_ZN4qpdf10BaseHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  120|  1.74M|            obj(obj) {};
_ZN4qpdf10BaseHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
  122|  14.0M|            obj(std::move(obj)) {};
_ZN4qpdf10BaseHandleC2Ev:
  118|  3.65M|        BaseHandle() = default;
_ZN4qpdf10BaseHandleC2ERKS0_:
  123|  3.88M|        BaseHandle(BaseHandle const&) = default;
_ZN4qpdf10BaseHandleaSEOS0_:
  126|  3.23M|        BaseHandle& operator=(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleC2EOS0_:
  125|  20.0M|        BaseHandle(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleaSERKS0_:
  124|   407k|        BaseHandle& operator=(BaseHandle const&) = default;

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

_ZN5QIntC11range_checkIxEEvRKT_S3_:
  274|  99.8k|    {
  275|  99.8k|        if ((delta > 0) != (cur > 0)) {
  ------------------
  |  Branch (275:13): [True: 89.1k, False: 10.6k]
  ------------------
  276|  89.1k|            return;
  277|  89.1k|        }
  278|  10.6k|        QIntC::range_check_error<T>(cur, delta);
  279|  10.6k|    }
_ZN5QIntC17range_check_errorIxEEvRKT_S3_:
  257|  10.6k|    {
  258|  10.6k|        if ((delta > 0) && ((std::numeric_limits<T>::max() - cur) < delta)) {
  ------------------
  |  Branch (258:13): [True: 10.6k, False: 0]
  |  Branch (258:28): [True: 34, False: 10.6k]
  ------------------
  259|     34|            std::ostringstream msg;
  260|     34|            msg.imbue(std::locale::classic());
  261|     34|            msg << "adding " << delta << " to " << cur << " would cause an integer overflow";
  262|     34|            throw std::range_error(msg.str());
  263|  10.6k|        } else if ((delta < 0) && ((std::numeric_limits<T>::min() - cur) > delta)) {
  ------------------
  |  Branch (263:20): [True: 0, False: 10.6k]
  |  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|  10.6k|    }
_ZN5QIntC7to_sizeIxEEmRKT_:
  215|  2.98M|    {
  216|  2.98M|        return IntConverter<T, size_t>::convert(i);
  217|  2.98M|    }
_ZN5QIntC12IntConverterIxmLb1ELb0EE7convertERKx:
  119|  2.98M|        {
  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|  2.98M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  2.98M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 2.98M]
  |  Branch (124:28): [True: 0, False: 2.98M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  2.98M|            return static_cast<To>(i);
  128|  2.98M|        }
_ZN5QIntC9to_offsetImEExRKT_:
  222|  4.01M|    {
  223|  4.01M|        return IntConverter<T, qpdf_offset_t>::convert(i);
  224|  4.01M|    }
_ZN5QIntC12IntConverterImxLb0ELb1EE7convertERKm:
  147|  4.01M|        {
  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.01M|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|  4.01M|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 0, False: 4.01M]
  ------------------
  152|      0|                error(i);
  153|      0|            }
  154|  4.01M|            return static_cast<To>(i);
  155|  4.01M|        }
_ZN5QIntC7to_sizeIlEEmRKT_:
  215|   490k|    {
  216|   490k|        return IntConverter<T, size_t>::convert(i);
  217|   490k|    }
_ZN5QIntC12IntConverterIlmLb1ELb0EE7convertERKl:
  119|   490k|        {
  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|   490k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   490k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 490k]
  |  Branch (124:28): [True: 0, False: 490k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   490k|            return static_cast<To>(i);
  128|   490k|        }
_ZN5QIntC6to_intImEEiRKT_:
  201|  13.6k|    {
  202|  13.6k|        return IntConverter<T, int>::convert(i);
  203|  13.6k|    }
_ZN5QIntC12IntConverterImiLb0ELb1EE7convertERKm:
  147|  13.6k|        {
  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|  13.6k|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|  13.6k|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 0, False: 13.6k]
  ------------------
  152|      0|                error(i);
  153|      0|            }
  154|  13.6k|            return static_cast<To>(i);
  155|  13.6k|        }
_ZN5QIntC7to_sizeIiEEmRKT_:
  215|  21.7k|    {
  216|  21.7k|        return IntConverter<T, size_t>::convert(i);
  217|  21.7k|    }
_ZN5QIntC12IntConverterIimLb1ELb0EE7convertERKi:
  119|   122M|        {
  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|   122M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   122M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 122M]
  |  Branch (124:28): [True: 0, False: 122M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   122M|            return static_cast<To>(i);
  128|   122M|        }
_ZN5QIntC6to_intIxEEiRKT_:
  201|  5.52M|    {
  202|  5.52M|        return IntConverter<T, int>::convert(i);
  203|  5.52M|    }
_ZN5QIntC12IntConverterIxiLb1ELb1EE7convertERKx:
   94|  5.52M|        {
   95|       |            // From and To are both signed.
   96|  5.52M|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 1.06k, False: 5.52M]
  |  Branch (96:57): [True: 928, False: 5.52M]
  ------------------
   97|  1.98k|                error(i);
   98|  1.98k|            }
   99|  5.52M|            return static_cast<To>(i);
  100|  5.52M|        }
_ZN5QIntC12IntConverterIxiLb1ELb1EE5errorEx:
  104|  1.98k|        {
  105|  1.98k|            std::ostringstream msg;
  106|  1.98k|            msg.imbue(std::locale::classic());
  107|  1.98k|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  108|  1.98k|                << "-byte signed type to a " << sizeof(To) << "-byte signed type";
  109|  1.98k|            throw std::range_error(msg.str());
  110|  1.98k|        }
_ZN5QIntC7to_sizeImEEmRKT_:
  215|     38|    {
  216|     38|        return IntConverter<T, size_t>::convert(i);
  217|     38|    }
_ZN5QIntC12IntConverterImmLb0ELb0EE7convertERKm:
   69|   114k|        {
   70|       |            // From and To are both unsigned.
   71|   114k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 114k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   114k|            return static_cast<To>(i);
   75|   114k|        }
_ZN5QIntC7to_uintIiEEjRKT_:
  208|  25.2k|    {
  209|  25.2k|        return IntConverter<T, unsigned int>::convert(i);
  210|  25.2k|    }
_ZN5QIntC12IntConverterIijLb1ELb0EE7convertERKi:
  119|  25.2k|        {
  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.2k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  25.2k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 25.2k]
  |  Branch (124:28): [True: 0, False: 25.2k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  25.2k|            return static_cast<To>(i);
  128|  25.2k|        }
_ZN5QIntC6to_intIlEEiRKT_:
  201|  8.02k|    {
  202|  8.02k|        return IntConverter<T, int>::convert(i);
  203|  8.02k|    }
_ZN5QIntC12IntConverterIliLb1ELb1EE7convertERKl:
   94|  8.02k|        {
   95|       |            // From and To are both signed.
   96|  8.02k|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 0, False: 8.02k]
  |  Branch (96:57): [True: 0, False: 8.02k]
  ------------------
   97|      0|                error(i);
   98|      0|            }
   99|  8.02k|            return static_cast<To>(i);
  100|  8.02k|        }
_ZN5QIntC7to_sizeIyEEmRKT_:
  215|  10.9k|    {
  216|  10.9k|        return IntConverter<T, size_t>::convert(i);
  217|  10.9k|    }
_ZN5QIntC12IntConverterIymLb0ELb0EE7convertERKy:
   69|  10.9k|        {
   70|       |            // From and To are both unsigned.
   71|  10.9k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 10.9k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  10.9k|            return static_cast<To>(i);
   75|  10.9k|        }
_ZN5QIntC8to_ulongIcEEmRKT_:
  236|  1.81M|    {
  237|  1.81M|        return IntConverter<T, unsigned long>::convert(i);
  238|  1.81M|    }
_ZN5QIntC12IntConverterIcmLb1ELb0EE7convertERKc:
  119|  1.81M|        {
  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.81M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  1.81M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 1.81M]
  |  Branch (124:28): [True: 0, False: 1.81M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  1.81M|            return static_cast<To>(i);
  128|  1.81M|        }
_ZN5QIntC8to_ulongIhEEmRKT_:
  236|   358M|    {
  237|   358M|        return IntConverter<T, unsigned long>::convert(i);
  238|   358M|    }
_ZN5QIntC12IntConverterIhmLb0ELb0EE7convertERKh:
   69|   358M|        {
   70|       |            // From and To are both unsigned.
   71|   358M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 358M]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   358M|            return static_cast<To>(i);
   75|   358M|        }
_ZN5QIntC8to_ulongIiEEmRKT_:
  236|   122M|    {
  237|   122M|        return IntConverter<T, unsigned long>::convert(i);
  238|   122M|    }
_ZN5QIntC9to_ushortIiEEtRKT_:
  194|  14.2M|    {
  195|  14.2M|        return IntConverter<T, unsigned short>::convert(i);
  196|  14.2M|    }
_ZN5QIntC12IntConverterIitLb1ELb0EE7convertERKi:
  119|  14.2M|        {
  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|  14.2M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  14.2M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 14.2M]
  |  Branch (124:28): [True: 0, False: 14.2M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  14.2M|            return static_cast<To>(i);
  128|  14.2M|        }
_ZN5QIntC7to_sizeIjEEmRKT_:
  215|  5.17k|    {
  216|  5.17k|        return IntConverter<T, size_t>::convert(i);
  217|  5.17k|    }
_ZN5QIntC12IntConverterIjmLb0ELb0EE7convertERKj:
   69|  5.17k|        {
   70|       |            // From and To are both unsigned.
   71|  5.17k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 5.17k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  5.17k|            return static_cast<To>(i);
   75|  5.17k|        }
_ZN5QIntC7to_uintImEEjRKT_:
  208|  3.14M|    {
  209|  3.14M|        return IntConverter<T, unsigned int>::convert(i);
  210|  3.14M|    }
_ZN5QIntC12IntConverterImjLb0ELb0EE7convertERKm:
   69|  3.14M|        {
   70|       |            // From and To are both unsigned.
   71|  3.14M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 3.14M]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  3.14M|            return static_cast<To>(i);
   75|  3.14M|        }
_ZN5QIntC8to_ulongImEEmRKT_:
  236|   114k|    {
  237|   114k|        return IntConverter<T, unsigned long>::convert(i);
  238|   114k|    }

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

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

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

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

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

_ZN10QPDFObjGenC2Eii:
   40|  1.54M|        obj(obj),
   41|  1.54M|        gen(gen)
   42|  1.54M|    {
   43|  1.54M|    }
_ZNK10QPDFObjGenltERKS_:
   46|  59.1M|    {
   47|  59.1M|        return (obj < rhs.obj) || (obj == rhs.obj && gen < rhs.gen);
  ------------------
  |  Branch (47:16): [True: 33.6M, False: 25.4M]
  |  Branch (47:36): [True: 4.44M, False: 21.0M]
  |  Branch (47:54): [True: 188k, False: 4.25M]
  ------------------
   48|  59.1M|    }
_ZNK10QPDFObjGeneqERKS_:
   51|   105k|    {
   52|   105k|        return obj == rhs.obj && gen == rhs.gen;
  ------------------
  |  Branch (52:16): [True: 100k, False: 4.85k]
  |  Branch (52:34): [True: 100k, False: 130]
  ------------------
   53|   105k|    }
_ZNK10QPDFObjGenneERKS_:
   56|  90.1k|    {
   57|  90.1k|        return !(*this == rhs);
   58|  90.1k|    }
_ZNK10QPDFObjGen6getObjEv:
   61|  1.47M|    {
   62|  1.47M|        return obj;
   63|  1.47M|    }
_ZNK10QPDFObjGen6getGenEv:
   66|  2.57k|    {
   67|  2.57k|        return gen;
   68|  2.57k|    }
_ZNK10QPDFObjGen10isIndirectEv:
   71|  3.62M|    {
   72|  3.62M|        return obj != 0;
   73|  3.62M|    }
_ZNK10QPDFObjGen7unparseEc:
   76|   194k|    {
   77|   194k|        return std::to_string(obj) + separator + std::to_string(gen);
   78|   194k|    }
_ZN10QPDFObjGen3set3addES_:
  111|   146k|        {
  112|   146k|            if (og.isIndirect()) {
  ------------------
  |  Branch (112:17): [True: 58.8k, False: 88.0k]
  ------------------
  113|  58.8k|                if (count(og)) {
  ------------------
  |  Branch (113:21): [True: 8.83k, False: 49.9k]
  ------------------
  114|  8.83k|                    return false;
  115|  8.83k|                }
  116|  49.9k|                emplace(og);
  117|  49.9k|            }
  118|   137k|            return true;
  119|   146k|        }
_ZN10QPDFObjGenC2Ev:
   38|  17.3M|    QPDFObjGen() = default;

_ZN16QPDFObjectHandle9RectangleC2Edddd:
  243|  4.12k|            llx(llx),
  244|  4.12k|            lly(lly),
  245|  4.12k|            urx(urx),
  246|  4.12k|            ury(ury)
  247|  4.12k|        {
  248|  4.12k|        }
_ZN16QPDFObjectHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
 1315|  1.32M|        qpdf::BaseHandle(obj)
 1316|  1.32M|    {
 1317|  1.32M|    }
_ZN16QPDFObjectHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
 1319|  13.9M|        qpdf::BaseHandle(std::move(obj))
 1320|  13.9M|    {
 1321|  13.9M|    }
_ZN16QPDFObjectHandle6getObjEv:
 1324|  8.95k|    {
 1325|  8.95k|        return obj;
 1326|  8.95k|    }
_ZNK4qpdf10BaseHandlecvbEv:
 1559|  2.24M|    {
 1560|  2.24M|        return static_cast<bool>(obj);
 1561|  2.24M|    }
_ZNK4qpdf10BaseHandlecv16QPDFObjectHandleEv:
 1565|   138k|    {
 1566|   138k|        return {obj};
 1567|   138k|    }
_ZN16QPDFObjectHandleC2Ev:
  289|  3.58M|    QPDFObjectHandle() = default;
_ZN16QPDFObjectHandleC2ERKS_:
  290|  3.73M|    QPDFObjectHandle(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandleaSEOS_:
  293|  3.23M|    QPDFObjectHandle& operator=(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleC2EOS_:
  292|  20.0M|    QPDFObjectHandle(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleaSERKS_:
  291|   398k|    QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilterC2Ev:
  163|  9.91k|        TokenFilter() = default;

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

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

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

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

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

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

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

_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.06k|    {
  184|  9.06k|        return std::shared_ptr<T>(new T[n], std::default_delete<T[]>());
  185|  9.06k|    }

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

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

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

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

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

_ZN17BufferInputSourceC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEP6Bufferb:
  170|  18.5k|    m(std::make_unique<Members>(description, buf, own_memory))
  171|  18.5k|{
  172|  18.5k|}
_ZN17BufferInputSourceD2Ev:
  178|  18.5k|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|   847k|{
  190|   847k|    return m->is.getName();
  191|   847k|}
_ZN17BufferInputSource4tellEv:
  194|  22.0M|{
  195|  22.0M|    return m->is.tell();
  196|  22.0M|}
_ZN17BufferInputSource4seekExi:
  199|  18.9M|{
  200|  18.9M|    m->is.seek(offset, whence);
  201|  18.9M|}
_ZN17BufferInputSource4readEPcm:
  209|  2.96M|{
  210|  2.96M|    auto result = m->is.read(buffer, length);
  211|  2.96M|    last_offset = m->is.getLastOffset();
  212|  2.96M|    return result;
  213|  2.96M|}
_ZN17BufferInputSource8unreadChEc:
  216|  20.2k|{
  217|  20.2k|    m->is.unreadCh(ch);
  218|  20.2k|}
_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: 5.86k, False: 1.04M]
  ------------------
  228|  5.86k|        last_offset = end_pos + global_offset;
  229|  5.86k|        pos = end_pos;
  230|  5.86k|        return end_pos + global_offset;
  231|  5.86k|    }
  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|   212M|    while (p < end && !(*p == '\r' || *p == '\n')) {
  ------------------
  |  Branch (238:12): [True: 212M, False: 12.1k]
  |  Branch (238:25): [True: 376k, False: 212M]
  |  Branch (238:39): [True: 652k, False: 211M]
  ------------------
  239|   211M|        ++p;
  240|   211M|    }
  241|  1.04M|    if (p < end) {
  ------------------
  |  Branch (241:9): [True: 1.02M, False: 12.1k]
  ------------------
  242|  1.02M|        result = p - buffer;
  243|  1.02M|        pos = result + 1;
  244|  1.02M|        ++p;
  245|  1.90M|        while (pos < end_pos && (*p == '\r' || *p == '\n')) {
  ------------------
  |  Branch (245:16): [True: 1.90M, False: 1.52k]
  |  Branch (245:34): [True: 37.2k, False: 1.86M]
  |  Branch (245:48): [True: 836k, False: 1.02M]
  ------------------
  246|   874k|            ++p;
  247|   874k|            ++pos;
  248|   874k|        }
  249|  1.02M|    } else {
  250|  12.1k|        pos = end_pos;
  251|  12.1k|        result = end_pos;
  252|  12.1k|    }
  253|  1.04M|    return result + global_offset;
  254|  1.04M|}
_ZN4qpdf2is12OffsetBuffer4seekExi:
  258|  20.3M|{
  259|  20.3M|    switch (whence) {
  260|  20.2M|    case SEEK_SET:
  ------------------
  |  Branch (260:5): [True: 20.2M, False: 99.8k]
  ------------------
  261|  20.2M|        pos = offset - global_offset;
  262|  20.2M|        break;
  263|       |
  264|  36.1k|    case SEEK_END:
  ------------------
  |  Branch (264:5): [True: 36.1k, False: 20.2M]
  ------------------
  265|  36.1k|        QIntC::range_check(static_cast<qpdf_offset_t>(view_.size()), offset);
  266|  36.1k|        pos = static_cast<qpdf_offset_t>(view_.size()) + offset;
  267|  36.1k|        break;
  268|       |
  269|  63.6k|    default:
  ------------------
  |  Branch (269:5): [True: 63.6k, False: 20.2M]
  ------------------
  270|  63.6k|        util::assertion(whence == SEEK_CUR, "invalid argument to BufferInputSource::seek");
  271|  63.6k|        QIntC::range_check(pos, offset);
  272|  63.6k|        pos += offset;
  273|  20.3M|    }
  274|       |
  275|  20.3M|    if (pos < 0) {
  ------------------
  |  Branch (275:9): [True: 349, False: 20.3M]
  ------------------
  276|    349|        throw std::runtime_error(description + ": seek before beginning of buffer");
  277|    349|    }
  278|  20.3M|}
_ZN4qpdf2is12OffsetBuffer4readEPcm:
  282|  3.01M|{
  283|  3.01M|    util::internal_error_if(pos < 0, "is::OffsetBuffer offset < 0");
  284|  3.01M|    auto end_pos = static_cast<qpdf_offset_t>(view_.size());
  285|  3.01M|    if (pos >= end_pos) {
  ------------------
  |  Branch (285:9): [True: 67.3k, False: 2.94M]
  ------------------
  286|  67.3k|        last_offset = end_pos + global_offset;
  287|  67.3k|        return 0;
  288|  67.3k|    }
  289|       |
  290|  2.94M|    last_offset = pos + global_offset;
  291|  2.94M|    size_t len = std::min(QIntC::to_size(end_pos - pos), length);
  292|  2.94M|    memcpy(buffer, view_.data() + pos, len);
  293|  2.94M|    pos += QIntC::to_offset(len);
  294|  2.94M|    return len;
  295|  3.01M|}
_ZN17BufferInputSource7MembersC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6Bufferb:
  148|  18.5k|        buf(own_memory ? buf : nullptr),
  ------------------
  |  Branch (148:13): [True: 0, False: 18.5k]
  ------------------
  149|  18.5k|        is(description,
  150|  18.5k|           buf && buf->getSize() > 0
  ------------------
  |  Branch (150:12): [True: 18.5k, False: 0]
  |  Branch (150:19): [True: 18.5k, False: 0]
  ------------------
  151|  18.5k|               ? std::string_view(reinterpret_cast<const char*>(buf->getBuffer()), buf->getSize())
  152|  18.5k|               : std::string_view())
  153|  18.5k|    {
  154|  18.5k|    }
_ZN17BufferInputSource7MembersD2Ev:
  162|  18.5k|    ~Members() = default;

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

_ZN11InputSource13setLastOffsetEx:
   15|  17.6M|{
   16|  17.6M|    this->last_offset = offset;
   17|  17.6M|}
_ZNK11InputSource13getLastOffsetEv:
   21|  18.6M|{
   22|  18.6M|    return this->last_offset;
   23|  18.6M|}
_ZN11InputSource9read_lineERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   27|  10.1k|{
   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.1k|    read(str, count, at);
   34|  10.1k|    auto eol = str.find_first_of("\n\r"sv);
   35|  10.1k|    if (eol != std::string::npos) {
  ------------------
  |  Branch (35:9): [True: 8.05k, False: 2.12k]
  ------------------
   36|  8.05k|        auto next_line = str.find_first_not_of("\n\r"sv, eol);
   37|  8.05k|        str.resize(eol);
   38|  8.05k|        if (next_line != std::string::npos) {
  ------------------
  |  Branch (38:13): [True: 7.59k, False: 454]
  ------------------
   39|  7.59k|            seek(last_offset + static_cast<qpdf_offset_t>(next_line), SEEK_SET);
   40|  7.59k|            return eol;
   41|  7.59k|        }
   42|  8.05k|    }
   43|       |    // We did not necessarily find the end of the trailing newline sequence.
   44|  2.58k|    seek(last_offset, SEEK_SET);
   45|  2.58k|    findAndSkipNextEOL();
   46|  2.58k|    return eol;
   47|  10.1k|}
_ZN11InputSource8readLineEm:
   51|  10.1k|{
   52|  10.1k|    return read_line(max_line_length);
   53|  10.1k|}
_ZN11InputSource9findFirstEPKcxmRNS_6FinderE:
   65|  61.5k|{
   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|  61.5k|    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|  61.5k|    size_t size = sizeof(buf) - 1;
   79|  61.5k|    util::assertion(
   80|  61.5k|        !(strlen(start_chars) < 1 || strlen(start_chars) > size),
  ------------------
  |  Branch (80:11): [True: 0, False: 61.5k]
  |  Branch (80:38): [True: 0, False: 61.5k]
  ------------------
   81|  61.5k|        "InputSource::findSource called with too small or too large of a character sequence" //
   82|  61.5k|    );
   83|       |
   84|  61.5k|    char* p = nullptr;
   85|  61.5k|    qpdf_offset_t buf_offset = offset;
   86|  61.5k|    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|   526k|    while (true) {
  ------------------
  |  Branch (91:12): [True: 526k, 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|   526k|        if ((p == nullptr) || ((p + strlen(start_chars)) > (buf + bytes_read))) {
  ------------------
  |  Branch (97:13): [True: 61.5k, False: 465k]
  |  Branch (97:31): [True: 180k, False: 285k]
  ------------------
   98|   241k|            if (p) {
  ------------------
  |  Branch (98:17): [True: 180k, False: 61.5k]
  ------------------
   99|   180k|                QTC::TC(
  100|   180k|                    "libtests", "InputSource read next block", ((p == buf + bytes_read) ? 0 : 1));
  ------------------
  |  Branch (100:65): [True: 177k, False: 3.04k]
  ------------------
  101|   180k|                buf_offset += (p - buf);
  102|   180k|            }
  103|   241k|            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|   241k|            bytes_read = this->read(buf, size);
  108|   241k|            if (bytes_read < strlen(start_chars)) {
  ------------------
  |  Branch (108:17): [True: 36.0k, False: 205k]
  ------------------
  109|  36.0k|                QTC::TC("libtests", "InputSource find EOF", bytes_read == 0 ? 0 : 1);
  ------------------
  |  Branch (109:61): [True: 29.9k, False: 6.04k]
  ------------------
  110|  36.0k|                return false;
  111|  36.0k|            }
  112|   205k|            memset(buf + bytes_read, '\0', 1 + (size - bytes_read));
  113|   205k|            p = buf;
  114|   205k|        }
  115|       |
  116|       |        // Search for the first character.
  117|   490k|        if ((p = static_cast<char*>(
  ------------------
  |  Branch (117:13): [True: 313k, False: 177k]
  ------------------
  118|       |                 // line-break
  119|   490k|                 memchr(p, start_chars[0], bytes_read - QIntC::to_size(p - buf)))) != nullptr) {
  120|   313k|            if (p == buf) {
  ------------------
  |  Branch (120:17): [True: 3.38k, False: 310k]
  ------------------
  121|  3.38k|                QTC::TC("libtests", "InputSource found match at buf[0]");
  122|  3.38k|            }
  123|       |            // Found first letter.
  124|   313k|            if (len != 0) {
  ------------------
  |  Branch (124:17): [True: 16.7k, False: 296k]
  ------------------
  125|       |                // Make sure it's in range.
  126|  16.7k|                size_t p_relative_offset = QIntC::to_size((p - buf) + (buf_offset - offset));
  127|  16.7k|                if (p_relative_offset >= len) {
  ------------------
  |  Branch (127:21): [True: 1.14k, False: 15.6k]
  ------------------
  128|       |                    // out of range
  129|  1.14k|                    QTC::TC("libtests", "InputSource out of range");
  130|  1.14k|                    return false;
  131|  1.14k|                }
  132|  16.7k|            }
  133|   312k|            if ((p + strlen(start_chars)) > (buf + bytes_read)) {
  ------------------
  |  Branch (133:17): [True: 2.25k, False: 310k]
  ------------------
  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.25k|                QTC::TC("libtests", "InputSource not enough bytes");
  137|  2.25k|                continue;
  138|  2.25k|            }
  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|   310k|            if (strncmp(p, start_chars, strlen(start_chars)) == 0) {
  ------------------
  |  Branch (142:17): [True: 33.4k, False: 276k]
  ------------------
  143|       |                // Call finder.check() with the input source positioned to the point of the match.
  144|  33.4k|                this->seek(buf_offset + (p - buf), SEEK_SET);
  145|  33.4k|                if (finder.check()) {
  ------------------
  |  Branch (145:21): [True: 24.3k, False: 9.05k]
  ------------------
  146|  24.3k|                    return true;
  147|  24.3k|                } else {
  148|  9.05k|                    QTC::TC("libtests", "InputSource start_chars matched but not check");
  149|  9.05k|                }
  150|   276k|            } else {
  151|   276k|                QTC::TC("libtests", "InputSource first char matched but not string");
  152|   276k|            }
  153|       |            // This occurrence of the first character wasn't a match. Skip over it and keep
  154|       |            // searching.
  155|   285k|            ++p;
  156|   285k|        } else {
  157|       |            // Trigger reading the next block
  158|   177k|            p = buf + bytes_read;
  159|   177k|        }
  160|   490k|    }
  161|  61.5k|}
_ZN11InputSource8findLastEPKcxmRNS_6FinderE:
  165|  18.5k|{
  166|  18.5k|    bool found = false;
  167|  18.5k|    qpdf_offset_t after_found_offset = 0;
  168|  18.5k|    qpdf_offset_t cur_offset = offset;
  169|  18.5k|    size_t cur_len = len;
  170|  23.9k|    while (this->findFirst(start_chars, cur_offset, cur_len, finder)) {
  ------------------
  |  Branch (170:12): [True: 5.46k, False: 18.5k]
  ------------------
  171|  5.46k|        if (found) {
  ------------------
  |  Branch (171:13): [True: 361, False: 5.10k]
  ------------------
  172|    361|            QTC::TC("libtests", "InputSource findLast found more than one");
  173|  5.10k|        } else {
  174|  5.10k|            found = true;
  175|  5.10k|        }
  176|  5.46k|        after_found_offset = this->tell();
  177|  5.46k|        cur_offset = after_found_offset;
  178|  5.46k|        cur_len = len - QIntC::to_size((cur_offset - offset));
  179|  5.46k|    }
  180|  18.5k|    if (found) {
  ------------------
  |  Branch (180:9): [True: 5.10k, False: 13.4k]
  ------------------
  181|       |        this->seek(after_found_offset, SEEK_SET);
  182|  5.10k|    }
  183|  18.5k|    return found;
  184|  18.5k|}
_ZN11InputSource9read_lineEmx:
   57|  10.1k|{
   58|  10.1k|    std::string result(count, '\0');
   59|  10.1k|    read_line(result, count, at);
   60|  10.1k|    return result;
   61|  10.1k|}

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

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

_ZN10NNTreeImpl4warnERK16QPDFObjectHandleRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   32|  4.23k|{
   33|  4.23k|    qpdf.warn(qpdf_e_damaged_pdf, get_description(node), 0, msg);
   34|  4.23k|    if (++error_count > 5 && qpdf.doc().reconstructed_xref()) {
  ------------------
  |  Branch (34:9): [True: 307, False: 3.92k]
  |  Branch (34:30): [True: 213, False: 94]
  ------------------
   35|    213|        error(node, "too many errors - giving up");
   36|    213|    }
   37|  4.23k|}
_ZNK10NNTreeImpl5errorERK16QPDFObjectHandleRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   41|    897|{
   42|    897|    throw QPDFExc(qpdf_e_damaged_pdf, qpdf.getFilename(), get_description(node), 0, msg);
   43|    897|}
_ZN14NNTreeIterator12updateIValueEb:
   47|   149k|{
   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|   149k|    Array items = node[impl.itemsKey()];
   62|   149k|    ivalue.first = items[item_number];
   63|   149k|    ivalue.second = items[item_number + 1];
   64|   149k|    if (ivalue.second) {
  ------------------
  |  Branch (64:9): [True: 147k, False: 2.40k]
  ------------------
   65|   147k|        return;
   66|   147k|    }
   67|       |
   68|  2.40k|    if (item_number < 0 || !node) {
  ------------------
  |  Branch (68:9): [True: 2.40k, False: 4]
  |  Branch (68:28): [True: 0, False: 4]
  ------------------
   69|  2.40k|        util::assertion(
   70|  2.40k|            allow_invalid, "attempt made to dereference an invalid name/number tree iterator");
   71|  2.40k|        return;
   72|  2.40k|    }
   73|      4|    impl.error(node, "update ivalue: items array is too short");
   74|      4|}
_ZN14NNTreeIterator10getNextKidERNS_11PathElementEb:
   78|    554|{
   79|    761|    while (true) {
  ------------------
  |  Branch (79:12): [True: 718, Folded]
  ------------------
   80|    718|        pe.kid_number += backward ? -1 : 1;
  ------------------
  |  Branch (80:26): [True: 0, False: 718]
  ------------------
   81|    718|        Dictionary result = pe.node["/Kids"][pe.kid_number];
   82|    718|        if (result.contains("/Kids") || result.contains(impl.itemsKey())) {
  ------------------
  |  Branch (82:13): [True: 233, False: 485]
  |  Branch (82:13): [True: 282, False: 436]
  |  Branch (82:41): [True: 49, False: 436]
  ------------------
   83|    282|            return result;
   84|    282|        }
   85|    436|        if (pe.kid_number < 0 || std::cmp_greater_equal(pe.kid_number, pe.node["/Kids"].size())) {
  ------------------
  |  Branch (85:13): [True: 0, False: 436]
  |  Branch (85:13): [True: 229, False: 207]
  |  Branch (85:34): [True: 229, False: 207]
  ------------------
   86|    229|            return {};
   87|    229|        }
   88|    207|        impl.warn(pe.node, "skipping over invalid kid at index " + std::to_string(pe.kid_number));
   89|    207|    }
   90|    554|}
_ZN14NNTreeIterator9incrementEb:
   93|  49.6k|{
   94|  49.6k|    if (item_number < 0) {
  ------------------
  |  Branch (94:9): [True: 0, False: 49.6k]
  ------------------
   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: 838]
  ------------------
  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: 933, False: 50.7k]
  ------------------
  103|    933|            setItemNumber(QPDFObjectHandle(), -1);
  104|  1.30k|            while (!path.empty()) {
  ------------------
  |  Branch (104:20): [True: 554, False: 746]
  ------------------
  105|    554|                auto& element = path.back();
  106|    554|                if (auto pe_node = getNextKid(element, backward)) {
  ------------------
  |  Branch (106:26): [True: 282, False: 272]
  ------------------
  107|    282|                    if (deepen(pe_node, !backward, false)) {
  ------------------
  |  Branch (107:25): [True: 187, False: 95]
  ------------------
  108|    187|                        break;
  109|    187|                    }
  110|    282|                } else {
  111|    272|                    path.pop_back();
  112|    272|                }
  113|    554|            }
  114|    933|        }
  115|  51.6k|        if (item_number >= 0) {
  ------------------
  |  Branch (115:13): [True: 50.9k, False: 746]
  ------------------
  116|  50.9k|            items = node[impl.itemsKey()];
  117|  50.9k|            if (std::cmp_greater_equal(item_number + 1, items.size())) {
  ------------------
  |  Branch (117:17): [True: 455, False: 50.4k]
  ------------------
  118|    455|                impl.warn(node, "items array doesn't have enough elements");
  119|  50.4k|            } else if (!impl.keyValid(items[item_number])) {
  ------------------
  |  Branch (119:24): [True: 819, False: 49.6k]
  ------------------
  120|    819|                impl.warn(node, ("item " + std::to_string(item_number) + " has the wrong type"));
  121|  49.6k|            } else if (!impl.value_valid(items[item_number + 1])) {
  ------------------
  |  Branch (121:24): [True: 824, False: 48.8k]
  ------------------
  122|    824|                impl.warn(node, "item " + std::to_string(item_number + 1) + " is invalid");
  123|  48.8k|            } else {
  124|  48.8k|                return;
  125|  48.8k|            }
  126|  50.9k|        }
  127|  51.6k|    }
  128|  49.6k|}
_ZN14NNTreeIterator11resetLimitsEN4qpdf10DictionaryENSt3__115__list_iteratorINS_11PathElementEPvEE:
  132|  19.3k|{
  133|  19.3k|    while (true) {
  ------------------
  |  Branch (133:12): [True: 19.3k, Folded]
  ------------------
  134|  19.3k|        if (parent == path.end()) {
  ------------------
  |  Branch (134:13): [True: 11.6k, False: 7.67k]
  ------------------
  135|  11.6k|            a_node.erase("/Limits");
  136|  11.6k|            return;
  137|  11.6k|        }
  138|       |
  139|  7.67k|        QPDFObjectHandle first;
  140|  7.67k|        QPDFObjectHandle last;
  141|  7.67k|        Array items = a_node[impl.itemsKey()];
  142|  7.67k|        size_t nitems = items.size();
  143|  7.67k|        if (nitems >= 2) {
  ------------------
  |  Branch (143:13): [True: 7.33k, False: 340]
  ------------------
  144|  7.33k|            first = items[0];
  145|  7.33k|            last = items[(nitems - 1u) & ~1u];
  146|  7.33k|        } else {
  147|    340|            Array kids = a_node["/Kids"];
  148|    340|            size_t nkids = kids.size();
  149|    340|            if (nkids > 0) {
  ------------------
  |  Branch (149:17): [True: 340, False: 0]
  ------------------
  150|    340|                Array first_limits = kids[0]["/Limits"];
  151|    340|                if (first_limits.size() >= 2) {
  ------------------
  |  Branch (151:21): [True: 340, False: 0]
  ------------------
  152|    340|                    first = first_limits[0];
  153|    340|                    last = kids[nkids - 1u]["/Limits"][1];
  154|    340|                }
  155|    340|            }
  156|    340|        }
  157|  7.67k|        if (!(first && last)) {
  ------------------
  |  Branch (157:15): [True: 7.67k, False: 0]
  |  Branch (157:24): [True: 7.67k, False: 0]
  ------------------
  158|      0|            impl.warn(a_node, "unable to determine limits");
  159|  7.67k|        } else {
  160|  7.67k|            Array olimits = a_node["/Limits"];
  161|  7.67k|            if (olimits.size() == 2) {
  ------------------
  |  Branch (161:17): [True: 6.37k, False: 1.30k]
  ------------------
  162|  6.37k|                auto ofirst = olimits[0];
  163|  6.37k|                auto olast = olimits[1];
  164|  6.37k|                if (impl.keyValid(ofirst) && impl.keyValid(olast) &&
  ------------------
  |  Branch (164:21): [True: 6.37k, False: 0]
  |  Branch (164:21): [True: 0, False: 6.37k]
  |  Branch (164:46): [True: 6.37k, False: 0]
  ------------------
  165|  6.37k|                    impl.compareKeys(first, ofirst) == 0 && impl.compareKeys(last, olast) == 0) {
  ------------------
  |  Branch (165:21): [True: 6.37k, False: 0]
  |  Branch (165:61): [True: 0, False: 6.37k]
  ------------------
  166|      0|                    return;
  167|      0|                }
  168|  6.37k|            }
  169|  7.67k|            if (a_node != path.begin()->node) {
  ------------------
  |  Branch (169:17): [True: 7.33k, False: 340]
  ------------------
  170|  7.33k|                a_node.replace("/Limits", Array({first, last}));
  171|  7.33k|            }
  172|  7.67k|        }
  173|       |
  174|  7.67k|        if (parent == path.begin()) {
  ------------------
  |  Branch (174:13): [True: 7.67k, False: 0]
  ------------------
  175|  7.67k|            return;
  176|  7.67k|        }
  177|      0|        a_node = parent->node;
  178|      0|        --parent;
  179|      0|    }
  180|  19.3k|}
_ZN14NNTreeIterator5splitEN4qpdf10DictionaryENSt3__115__list_iteratorINS_11PathElementEPvEE:
  184|  18.0k|{
  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|  18.0k|    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|  18.0k|    Array kids = to_split["/Kids"];
  216|  18.0k|    size_t nkids = kids.size();
  217|  18.0k|    Array items = to_split[impl.itemsKey()];
  218|  18.0k|    size_t nitems = items.size();
  219|       |
  220|  18.0k|    Array first_half;
  221|  18.0k|    size_t n = 0;
  222|  18.0k|    std::string key;
  223|  18.0k|    size_t threshold = static_cast<size_t>(impl.split_threshold);
  224|  18.0k|    if (nkids > 0) {
  ------------------
  |  Branch (224:9): [True: 340, False: 17.7k]
  ------------------
  225|    340|        first_half = kids;
  226|    340|        n = nkids;
  227|    340|        key = "/Kids";
  228|  17.7k|    } else {
  229|  17.7k|        util::assertion(nitems > 0, "NNTreeIterator::split called on invalid node");
  230|  17.7k|        first_half = items;
  231|  17.7k|        n = nitems;
  232|  17.7k|        threshold *= 2;
  233|  17.7k|        key = impl.itemsKey();
  234|  17.7k|    }
  235|       |
  236|  18.0k|    if (n <= threshold) {
  ------------------
  |  Branch (236:9): [True: 17.4k, False: 651]
  ------------------
  237|  17.4k|        return;
  238|  17.4k|    }
  239|       |
  240|    651|    bool is_root = parent == path.end();
  241|    651|    bool is_leaf = nitems > 0;
  242|       |
  243|       |    // CURRENT STATE: tree is in original state; iterator is valid and unchanged.
  244|       |
  245|    651|    if (is_root) {
  ------------------
  |  Branch (245:9): [True: 311, False: 340]
  ------------------
  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|    311|        Dictionary first_node = impl.qpdf.makeIndirectObject(Dictionary({{key, first_half}}));
  261|    311|        auto new_kids = Array::empty();
  262|    311|        new_kids.push_back(first_node);
  263|    311|        to_split.erase("/Limits"); // already shouldn't be there for root
  264|    311|        to_split.erase(impl.itemsKey());
  265|    311|        to_split.replace("/Kids", new_kids);
  266|    311|        if (is_leaf) {
  ------------------
  |  Branch (266:13): [True: 311, False: 0]
  ------------------
  267|    311|            node = first_node;
  268|    311|        } else {
  269|      0|            auto next = path.begin();
  270|      0|            next->node = first_node;
  271|      0|        }
  272|    311|        this->path.emplace_front(to_split, 0);
  273|    311|        parent = path.begin();
  274|    311|        to_split = first_node;
  275|    311|    }
  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|    651|    auto second_half = Array::empty();
  283|    651|    auto start_idx = static_cast<int>((n / 2) & ~1u);
  284|  22.7k|    while (std::cmp_greater(first_half.size(), start_idx)) {
  ------------------
  |  Branch (284:12): [True: 22.1k, False: 651]
  ------------------
  285|  22.1k|        second_half.push_back(first_half[start_idx]);
  286|  22.1k|        first_half.erase(start_idx);
  287|  22.1k|    }
  288|    651|    resetLimits(to_split, parent);
  289|       |
  290|       |    // Create a new node to contain the second half
  291|    651|    Dictionary second_node = impl.qpdf.makeIndirectObject(Dictionary({{key, second_half}}));
  292|    651|    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|    651|    Array parent_kids = parent->node["/Kids"];
  303|    651|    if (!parent_kids) {
  ------------------
  |  Branch (303:9): [True: 0, False: 651]
  ------------------
  304|      0|        impl.error(parent->node, "parent node has no /Kids array");
  305|      0|    }
  306|    651|    parent_kids.insert(parent->kid_number + 1, second_node);
  307|    651|    auto cur_elem = parent;
  308|    651|    ++cur_elem; // points to end() for leaf nodes
  309|    651|    int old_idx = (is_leaf ? item_number : cur_elem->kid_number);
  ------------------
  |  Branch (309:20): [True: 651, False: 0]
  ------------------
  310|    651|    if (old_idx >= start_idx) {
  ------------------
  |  Branch (310:9): [True: 651, False: 0]
  ------------------
  311|    651|        ++parent->kid_number;
  312|    651|        if (is_leaf) {
  ------------------
  |  Branch (312:13): [True: 651, False: 0]
  ------------------
  313|    651|            setItemNumber(second_node, item_number - start_idx);
  314|    651|        } else {
  315|      0|            cur_elem->node = second_node;
  316|      0|            cur_elem->kid_number -= start_idx;
  317|      0|        }
  318|    651|    }
  319|    651|    if (!is_root) {
  ------------------
  |  Branch (319:9): [True: 340, False: 311]
  ------------------
  320|    340|        auto next = parent->node;
  321|    340|        resetLimits(next, parent);
  322|    340|        --parent;
  323|    340|        split(next, parent);
  324|    340|    }
  325|    651|}
_ZN14NNTreeIterator15lastPathElementEv:
  329|  35.4k|{
  330|  35.4k|    return path.empty() ? path.end() : std::prev(path.end());
  ------------------
  |  Branch (330:12): [True: 23.3k, False: 12.0k]
  ------------------
  331|  35.4k|}
_ZN14NNTreeIterator11insertAfterERK16QPDFObjectHandleS2_:
  335|  17.2k|{
  336|  17.2k|    if (!valid()) {
  ------------------
  |  Branch (336:9): [True: 0, False: 17.2k]
  ------------------
  337|      0|        impl.insertFirst(key, value);
  338|      0|        deepen(impl.tree_root, true, false);
  339|      0|        return;
  340|      0|    }
  341|       |
  342|  17.2k|    Array items = node[impl.itemsKey()];
  343|  17.2k|    if (!items) {
  ------------------
  |  Branch (343:9): [True: 0, False: 17.2k]
  ------------------
  344|      0|        impl.error(node, "node contains no items array");
  345|      0|    }
  346|       |
  347|  17.2k|    if (std::cmp_less(items.size(), item_number + 2)) {
  ------------------
  |  Branch (347:9): [True: 0, False: 17.2k]
  ------------------
  348|      0|        impl.error(node, "insert: items array is too short");
  349|      0|    }
  350|  17.2k|    if (!(key && value)) {
  ------------------
  |  Branch (350:11): [True: 17.2k, False: 0]
  |  Branch (350:18): [True: 17.2k, False: 0]
  ------------------
  351|      0|        impl.error(node, "insert: key or value is null");
  352|      0|    }
  353|  17.2k|    if (!impl.value_valid(value)) {
  ------------------
  |  Branch (353:9): [True: 0, False: 17.2k]
  ------------------
  354|      0|        impl.error(node, "insert: value is invalid");
  355|      0|    }
  356|  17.2k|    items.insert(item_number + 2, key);
  357|  17.2k|    items.insert(item_number + 3, value);
  358|  17.2k|    resetLimits(node, lastPathElement());
  359|  17.2k|    split(node, lastPathElement());
  360|  17.2k|    increment(false);
  361|  17.2k|}
_ZNK14NNTreeIteratoreqERKS_:
  455|  36.9k|{
  456|  36.9k|    if (item_number == -1 && other.item_number == -1) {
  ------------------
  |  Branch (456:9): [True: 3.35k, False: 33.6k]
  |  Branch (456:30): [True: 3.35k, False: 0]
  ------------------
  457|  3.35k|        return true;
  458|  3.35k|    }
  459|  33.6k|    if (path.size() != other.path.size()) {
  ------------------
  |  Branch (459:9): [True: 8.55k, False: 25.0k]
  ------------------
  460|  8.55k|        return false;
  461|  8.55k|    }
  462|  25.0k|    auto tpi = path.begin();
  463|  25.0k|    auto opi = other.path.begin();
  464|  25.0k|    while (tpi != path.end()) {
  ------------------
  |  Branch (464:12): [True: 0, False: 25.0k]
  ------------------
  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|  25.0k|    return item_number == other.item_number;
  472|  25.0k|}
_ZN14NNTreeIterator6deepenEN4qpdf10DictionaryEbb:
  476|  23.2k|{
  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.2k|    auto opath = path;
  481|       |
  482|  23.2k|    auto fail = [this, &opath](Dictionary const& failed_node, std::string const& msg) {
  483|  23.2k|        impl.warn(failed_node, msg);
  484|  23.2k|        path = opath;
  485|  23.2k|        return false;
  486|  23.2k|    };
  487|       |
  488|  23.2k|    QPDFObjGen::set seen;
  489|  23.2k|    for (auto const& i: path) {
  ------------------
  |  Branch (489:23): [True: 611, False: 23.2k]
  ------------------
  490|    611|        seen.add(i.node);
  491|    611|    }
  492|  31.6k|    while (true) {
  ------------------
  |  Branch (492:12): [True: 31.6k, Folded]
  ------------------
  493|  31.6k|        if (!seen.add(a_node)) {
  ------------------
  |  Branch (493:13): [True: 68, False: 31.5k]
  ------------------
  494|     68|            return fail(a_node, "loop detected while traversing name/number tree");
  495|     68|        }
  496|       |
  497|  31.5k|        if (!a_node) {
  ------------------
  |  Branch (497:13): [True: 0, False: 31.5k]
  ------------------
  498|      0|            return fail(a_node, "non-dictionary node while traversing name/number tree");
  499|      0|        }
  500|       |
  501|  31.5k|        Array items = a_node[impl.itemsKey()];
  502|  31.5k|        int nitems = static_cast<int>(items.size());
  503|  31.5k|        if (nitems > 1) {
  ------------------
  |  Branch (503:13): [True: 20.5k, False: 11.0k]
  ------------------
  504|  20.5k|            setItemNumber(a_node, first ? 0 : nitems - 2);
  ------------------
  |  Branch (504:35): [True: 20.5k, False: 0]
  ------------------
  505|  20.5k|            return true;
  506|  20.5k|        }
  507|       |
  508|  11.0k|        Array kids = a_node["/Kids"];
  509|  11.0k|        int nkids = static_cast<int>(kids.size());
  510|  11.0k|        if (nkids == 0) {
  ------------------
  |  Branch (510:13): [True: 2.47k, False: 8.60k]
  ------------------
  511|  2.47k|            if (allow_empty && items) {
  ------------------
  |  Branch (511:17): [True: 2.44k, False: 31]
  |  Branch (511:32): [True: 1.52k, False: 920]
  ------------------
  512|  1.52k|                setItemNumber(a_node, -1);
  513|  1.52k|                return true;
  514|  1.52k|            }
  515|    951|            return fail(
  516|    951|                a_node,
  517|    951|                "name/number tree node has neither non-empty " + impl.itemsKey() + " nor /Kids");
  518|  2.47k|        }
  519|       |
  520|  8.60k|        int kid_number = first ? 0 : nkids - 1;
  ------------------
  |  Branch (520:26): [True: 8.60k, False: 0]
  ------------------
  521|  8.60k|        addPathElement(a_node, kid_number);
  522|  8.60k|        Dictionary next = kids[kid_number];
  523|  8.60k|        if (!next) {
  ------------------
  |  Branch (523:13): [True: 173, False: 8.43k]
  ------------------
  524|    173|            return fail(a_node, "kid number " + std::to_string(kid_number) + " is invalid");
  525|    173|        }
  526|  8.43k|        if (!next.indirect()) {
  ------------------
  |  Branch (526:13): [True: 23, False: 8.40k]
  ------------------
  527|     23|            if (impl.auto_repair) {
  ------------------
  |  Branch (527:17): [True: 23, False: 0]
  ------------------
  528|     23|                impl.warn(
  529|     23|                    a_node,
  530|     23|                    "converting kid number " + std::to_string(kid_number) +
  531|     23|                        " to an indirect object");
  532|     23|                next = impl.qpdf.makeIndirectObject(next);
  533|     23|                kids.set(kid_number, next);
  534|     23|            } 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|     23|        }
  540|       |
  541|  8.43k|        a_node = next;
  542|  8.43k|    }
  543|  23.2k|}
_ZN10NNTreeImpl5beginEv:
  547|  22.9k|{
  548|  22.9k|    iterator result(*this);
  549|  22.9k|    result.deepen(tree_root, true, true);
  550|  22.9k|    return result;
  551|  22.9k|}
_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.84k, False: 131k]
  |  Branch (570:32): [True: 124k, False: 7.55k]
  ------------------
  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.5k|{
  585|  25.5k|    size_t max_idx = std::bit_ceil(num_items);
  586|       |
  587|  25.5k|    int step = static_cast<int>(max_idx / 2);
  588|  25.5k|    int checks = static_cast<int>(std::bit_width(max_idx)); // AppImage gcc version returns size_t
  589|  25.5k|    int idx = step;
  590|  25.5k|    int found_idx = -1;
  591|       |
  592|   144k|    for (int i = 0; i < checks; ++i) {
  ------------------
  |  Branch (592:21): [True: 120k, False: 24.3k]
  ------------------
  593|   120k|        int status = -1;
  594|   120k|        if (std::cmp_less(idx, num_items)) {
  ------------------
  |  Branch (594:13): [True: 73.3k, False: 46.7k]
  ------------------
  595|  73.3k|            status = search_kids ? compareKeyKid(key, items, idx) : compareKeyItem(key, items, idx);
  ------------------
  |  Branch (595:22): [True: 14.3k, False: 59.0k]
  ------------------
  596|  73.3k|            if (status == 0) {
  ------------------
  |  Branch (596:17): [True: 1.23k, False: 72.1k]
  ------------------
  597|  1.23k|                return idx;
  598|  1.23k|            }
  599|  72.1k|            if (status > 0) {
  ------------------
  |  Branch (599:17): [True: 68.7k, False: 3.40k]
  ------------------
  600|  68.7k|                found_idx = idx;
  601|  68.7k|            }
  602|  72.1k|        }
  603|   118k|        step = std::max(step / 2, 1);
  604|   118k|        idx += status * step;
  605|   118k|    }
  606|  24.3k|    return return_prev_if_not_found ? found_idx : -1;
  ------------------
  |  Branch (606:12): [True: 23.2k, False: 1.03k]
  ------------------
  607|  25.5k|}
_ZNK10NNTreeImpl14compareKeyItemERK16QPDFObjectHandleRKN4qpdf5ArrayEi:
  611|  59.0k|{
  612|  59.0k|    if (!keyValid(items[2 * idx])) {
  ------------------
  |  Branch (612:9): [True: 24, False: 59.0k]
  ------------------
  613|     24|        error(tree_root, ("item at index " + std::to_string(2 * idx) + " is not the right type"));
  614|     24|    }
  615|  59.0k|    return compareKeys(key, items[2 * idx]);
  616|  59.0k|}
_ZNK10NNTreeImpl13compareKeyKidERK16QPDFObjectHandleRKN4qpdf5ArrayEi:
  620|  14.3k|{
  621|  14.3k|    Dictionary kid = kids[idx];
  622|  14.3k|    if (!kid) {
  ------------------
  |  Branch (622:9): [True: 7, False: 14.3k]
  ------------------
  623|      7|        error(tree_root, "invalid kid at index " + std::to_string(idx));
  624|      7|    }
  625|  14.3k|    Array limits = kid["/Limits"];
  626|  14.3k|    if (!(keyValid(limits[0]) && keyValid(limits[1]))) {
  ------------------
  |  Branch (626:9): [True: 17, False: 14.3k]
  |  Branch (626:11): [True: 14.3k, False: 20]
  |  Branch (626:34): [True: 14.3k, False: 4]
  ------------------
  627|     17|        error(kids[idx], "node is missing /Limits");
  628|     17|    }
  629|  14.3k|    if (compareKeys(key, limits[0]) < 0) {
  ------------------
  |  Branch (629:9): [True: 633, False: 13.6k]
  ------------------
  630|    633|        return -1;
  631|    633|    }
  632|  13.6k|    if (compareKeys(key, limits[1]) > 0) {
  ------------------
  |  Branch (632:9): [True: 12.9k, False: 734]
  ------------------
  633|  12.9k|        return 1;
  634|  12.9k|    }
  635|    734|    return 0;
  636|  13.6k|}
_ZN10NNTreeImpl6repairEv:
  657|    672|{
  658|    672|    auto new_node = Dictionary({{itemsKey(), Array::empty()}});
  659|    672|    NNTreeImpl repl(qpdf, new_node, key_type, value_valid, false);
  660|    672|    std::map<QPDFObjectHandle, QPDFObjectHandle, Cmp> items;
  661|  31.5k|    for (auto const& [key, value]: *this) {
  ------------------
  |  Branch (661:34): [True: 31.5k, False: 672]
  ------------------
  662|  31.5k|        if (key && value && repl.keyValid(key) && repl.value_valid(value)) {
  ------------------
  |  Branch (662:13): [True: 31.5k, False: 2]
  |  Branch (662:13): [True: 31.3k, False: 222]
  |  Branch (662:20): [True: 31.5k, False: 0]
  |  Branch (662:29): [True: 31.5k, False: 38]
  |  Branch (662:51): [True: 31.3k, False: 182]
  ------------------
  663|  31.3k|            items.insert_or_assign(key, value);
  664|  31.3k|        }
  665|  31.5k|    }
  666|  17.7k|    for (auto const& [key, value]: items) {
  ------------------
  |  Branch (666:34): [True: 17.7k, False: 672]
  ------------------
  667|  17.7k|        repl.insert(key, value);
  668|  17.7k|    }
  669|    672|    tree_root.replace("/Kids", new_node["/Kids"]);
  670|    672|    tree_root.replace(itemsKey(), new_node[itemsKey()]);
  671|    672|}
_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|     75|        if (auto_repair) {
  ------------------
  |  Branch (679:13): [True: 75, False: 0]
  ------------------
  680|     75|            warn(tree_root, std::string("attempting to repair after error: ") + e.what());
  681|     75|            repair();
  682|     75|            return findInternal(key, return_prev_if_not_found);
  683|     75|        } else {
  684|      0|            throw;
  685|      0|        }
  686|     75|    }
  687|  20.4k|}
_ZN10NNTreeImpl12findInternalERK16QPDFObjectHandleb:
  691|  20.5k|{
  692|  20.5k|    auto first_item = begin();
  693|  20.5k|    if (!first_item.valid()) {
  ------------------
  |  Branch (693:9): [True: 1.64k, False: 18.8k]
  ------------------
  694|  1.64k|        return end();
  695|  1.64k|    }
  696|  18.8k|    if (!keyValid(first_item->first)) {
  ------------------
  |  Branch (696:9): [True: 0, False: 18.8k]
  ------------------
  697|      0|        error(tree_root, "encountered invalid key in find");
  698|      0|    }
  699|  18.8k|    if (!value_valid(first_item->second)) {
  ------------------
  |  Branch (699:9): [True: 0, False: 18.8k]
  ------------------
  700|      0|        error(tree_root, "encountered invalid value in find");
  701|      0|    }
  702|  18.8k|    if (compareKeys(key, first_item->first) < 0) {
  ------------------
  |  Branch (702:9): [True: 92, False: 18.7k]
  ------------------
  703|       |        // Before the first key
  704|     92|        return end();
  705|     92|    }
  706|       |
  707|  18.7k|    QPDFObjGen::set seen;
  708|  18.7k|    auto node = tree_root;
  709|  18.7k|    iterator result(*this);
  710|       |
  711|  25.6k|    while (true) {
  ------------------
  |  Branch (711:12): [True: 25.5k, Folded]
  ------------------
  712|  25.5k|        if (!seen.add(node)) {
  ------------------
  |  Branch (712:13): [True: 0, False: 25.5k]
  ------------------
  713|      0|            error(node, "loop detected in find");
  714|      0|        }
  715|       |
  716|  25.5k|        Array items = node[itemsKey()];
  717|  25.5k|        size_t nitems = items.size();
  718|  25.5k|        if (nitems > 1) {
  ------------------
  |  Branch (718:13): [True: 18.7k, False: 6.81k]
  ------------------
  719|  18.7k|            int idx = binarySearch(key, items, nitems / 2, return_prev_if_not_found, false);
  720|  18.7k|            if (idx >= 0) {
  ------------------
  |  Branch (720:17): [True: 17.7k, False: 1.00k]
  ------------------
  721|  17.7k|                result.setItemNumber(node, 2 * idx);
  722|  17.7k|                if (!result.impl.keyValid(result.ivalue.first)) {
  ------------------
  |  Branch (722:21): [True: 0, False: 17.7k]
  ------------------
  723|      0|                    error(node, "encountered invalid key in find");
  724|      0|                }
  725|  17.7k|                if (!result.impl.value_valid(result.ivalue.second)) {
  ------------------
  |  Branch (725:21): [True: 5, False: 17.7k]
  ------------------
  726|      5|                    error(tree_root, "encountered invalid value in find");
  727|      5|                }
  728|  17.7k|            }
  729|  18.7k|            return result;
  730|  18.7k|        }
  731|       |
  732|  6.81k|        Array kids = node["/Kids"];
  733|  6.81k|        size_t nkids = kids.size();
  734|  6.81k|        if (nkids == 0) {
  ------------------
  |  Branch (734:13): [True: 2, False: 6.81k]
  ------------------
  735|      2|            error(node, "bad node during find");
  736|      2|        }
  737|  6.81k|        int idx = binarySearch(key, kids, nkids, true, true);
  738|  6.81k|        if (idx == -1) {
  ------------------
  |  Branch (738:13): [True: 1, False: 6.81k]
  ------------------
  739|      1|            error(node, "unexpected -1 from binary search of kids; limits may by wrong");
  740|      1|        }
  741|  6.81k|        result.addPathElement(node, idx);
  742|  6.81k|        node = kids[idx];
  743|  6.81k|    }
  744|  18.7k|}
_ZN10NNTreeImpl11insertFirstERK16QPDFObjectHandleS2_:
  748|    503|{
  749|    503|    auto iter = begin();
  750|    503|    Array items = iter.node[items_key];
  751|    503|    if (!items) {
  ------------------
  |  Branch (751:9): [True: 0, False: 503]
  ------------------
  752|      0|        error(tree_root, "unable to find a valid items node");
  753|      0|    }
  754|    503|    if (!(key && value)) {
  ------------------
  |  Branch (754:11): [True: 503, False: 0]
  |  Branch (754:18): [True: 503, False: 0]
  ------------------
  755|      0|        error(tree_root, "unable to insert null key or value");
  756|      0|    }
  757|    503|    if (!value_valid(value)) {
  ------------------
  |  Branch (757:9): [True: 0, False: 503]
  ------------------
  758|      0|        error(tree_root, "attempting to insert an invalid value");
  759|      0|    }
  760|    503|    items.insert(0, key);
  761|    503|    items.insert(1, value);
  762|    503|    iter.setItemNumber(iter.node, 0);
  763|    503|    iter.resetLimits(iter.node, iter.lastPathElement());
  764|    503|    iter.split(iter.node, iter.lastPathElement());
  765|    503|    return iter;
  766|    503|}
_ZN10NNTreeImpl6insertERK16QPDFObjectHandleS2_:
  770|  17.7k|{
  771|  17.7k|    auto iter = find(key, true);
  772|  17.7k|    if (!iter.valid()) {
  ------------------
  |  Branch (772:9): [True: 503, False: 17.2k]
  ------------------
  773|    503|        return insertFirst(key, value);
  774|  17.2k|    } else if (compareKeys(key, iter->first) == 0) {
  ------------------
  |  Branch (774:16): [True: 0, False: 17.2k]
  ------------------
  775|      0|        Array items = iter.node[itemsKey()];
  776|      0|        items.set(iter.item_number + 1, value);
  777|      0|        iter.updateIValue();
  778|  17.2k|    } else {
  779|  17.2k|        iter.insertAfter(key, value);
  780|  17.2k|    }
  781|  17.2k|    return iter;
  782|  17.7k|}
_ZN10NNTreeImpl8validateEb:
  800|  1.24k|{
  801|  1.24k|    bool first = true;
  802|  1.24k|    QPDFObjectHandle last_key;
  803|  1.24k|    try {
  804|  1.54k|        for (auto const& [key, value]: *this) {
  ------------------
  |  Branch (804:38): [True: 1.54k, False: 1.24k]
  ------------------
  805|  1.54k|            if (!keyValid(key)) {
  ------------------
  |  Branch (805:17): [True: 40, False: 1.50k]
  ------------------
  806|     40|                error(tree_root, "invalid key in validate");
  807|     40|            }
  808|  1.54k|            if (!value_valid(value)) {
  ------------------
  |  Branch (808:17): [True: 182, False: 1.36k]
  ------------------
  809|    182|                error(tree_root, "invalid value in validate");
  810|    182|            }
  811|  1.54k|            if (first) {
  ------------------
  |  Branch (811:17): [True: 570, False: 977]
  ------------------
  812|    570|                first = false;
  813|    977|            } else if (last_key && compareKeys(last_key, key) != -1) {
  ------------------
  |  Branch (813:24): [True: 755, False: 222]
  |  Branch (813:24): [True: 402, False: 575]
  |  Branch (813:36): [True: 402, False: 353]
  ------------------
  814|    402|                error(tree_root, "keys are not sorted in validate");
  815|    402|            }
  816|  1.54k|            last_key = key;
  817|  1.54k|        }
  818|  1.24k|    } catch (QPDFExc& e) {
  819|    638|        if (a_repair) {
  ------------------
  |  Branch (819:13): [True: 638, False: 0]
  ------------------
  820|    638|            warn(tree_root, std::string("attempting to repair after error: ") + e.what());
  821|    638|            repair();
  822|    638|        }
  823|    638|        return false;
  824|    638|    }
  825|    608|    return true;
  826|  1.24k|}
_ZN24QPDFNameTreeObjectHelperD2Ev:
  847|  1.24k|QPDFNameTreeObjectHelper::~QPDFNameTreeObjectHelper() = default;
_ZN24QPDFNameTreeObjectHelperC2E16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS0_EEEb:
  860|  1.24k|    QPDFObjectHelper(oh),
  861|  1.24k|    m(std::make_shared<Members>(oh, q, value_validator, auto_repair))
  862|  1.24k|{
  863|  1.24k|}
_ZN24QPDFNameTreeObjectHelper8iteratorC2ERKNSt3__110shared_ptrI14NNTreeIteratorEE:
  872|  5.49k|    impl(i)
  873|  5.49k|{
  874|  5.49k|}
_ZN24QPDFNameTreeObjectHelper8iterator12updateIValueEv:
  900|    524|{
  901|    524|    if (impl->valid()) {
  ------------------
  |  Branch (901:9): [True: 524, False: 0]
  ------------------
  902|    524|        auto p = *impl;
  903|    524|        ivalue.first = p->first.getUTF8Value();
  904|    524|        ivalue.second = p->second;
  905|    524|    } else {
  906|      0|        ivalue.first = "";
  907|      0|        ivalue.second = QPDFObjectHandle();
  908|      0|    }
  909|    524|}
_ZN24QPDFNameTreeObjectHelper8iteratorptEv:
  920|    524|{
  921|    524|    updateIValue();
  922|    524|    return &ivalue;
  923|    524|}
_ZNK24QPDFNameTreeObjectHelper8iteratoreqERKS0_:
  927|  2.74k|{
  928|  2.74k|    return *(impl) == *(other.impl);
  929|  2.74k|}
_ZNK24QPDFNameTreeObjectHelper3endEv:
  953|  2.74k|{
  954|  2.74k|    return {std::make_shared<NNTreeIterator>(m->impl.end())};
  955|  2.74k|}
_ZN24QPDFNameTreeObjectHelper4findERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEb:
  965|  2.78k|{
  966|  2.78k|    auto i = m->impl.find(QPDFObjectHandle::newUnicodeString(key), return_prev_if_not_found);
  967|  2.78k|    return {std::make_shared<NNTreeIterator>(i)};
  968|  2.78k|}
_ZN24QPDFNameTreeObjectHelper10findObjectERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEER16QPDFObjectHandle:
  992|  2.78k|{
  993|  2.78k|    auto i = find(name);
  994|  2.78k|    if (i == end()) {
  ------------------
  |  Branch (994:9): [True: 2.22k, False: 560]
  ------------------
  995|  2.22k|        return false;
  996|  2.22k|    }
  997|    560|    oh = i->second;
  998|    560|    return true;
  999|  2.78k|}
_ZN24QPDFNameTreeObjectHelper8validateEb:
 1017|  1.24k|{
 1018|  1.24k|    return m->impl.validate(repair);
 1019|  1.24k|}
NNTree.cc:_ZL15get_descriptionRK16QPDFObjectHandle:
   22|  5.13k|{
   23|  5.13k|    std::string result("Name/Number tree node");
   24|  5.13k|    if (node.indirect()) {
  ------------------
  |  Branch (24:9): [True: 5.09k, False: 35]
  ------------------
   25|  5.09k|        result += " (object " + std::to_string(node.getObjectID()) + ")";
   26|  5.09k|    }
   27|  5.13k|    return result;
   28|  5.13k|}
NNTree.cc:_ZZN14NNTreeIterator6deepenEN4qpdf10DictionaryEbbENK3$_0clERKS1_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  482|  1.19k|    auto fail = [this, &opath](Dictionary const& failed_node, std::string const& msg) {
  483|  1.19k|        impl.warn(failed_node, msg);
  484|  1.19k|        path = opath;
  485|  1.19k|        return false;
  486|  1.19k|    };
NNTree.cc:_ZNK12_GLOBAL__N_13CmpclERK16QPDFObjectHandleS3_:
  644|   231k|        {
  645|   231k|            Integer l = lhs;
  646|   231k|            Integer r = rhs;
  647|   231k|            if (l && r) {
  ------------------
  |  Branch (647:17): [True: 0, False: 231k]
  |  Branch (647:22): [True: 0, False: 0]
  ------------------
  648|      0|                return l.value() < r.value();
  649|      0|            }
  650|   231k|            return lhs.getUTF8Value() < rhs.getUTF8Value();
  651|   231k|        }
_ZN24QPDFNameTreeObjectHelper7MembersC2ER16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS1_EEEb:
  836|  1.24k|        impl(q, oh, ::ot_string, value_validator, auto_repair)
  837|  1.24k|    {
  838|  1.24k|    }
_ZN24QPDFNameTreeObjectHelper7MembersD2Ev:
  840|  1.24k|    ~Members() = default;

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

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

_ZN10Pl_AES_PDFC2EPKcP8PipelinebNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
   16|   143k|    Pipeline(identifier, next),
   17|   143k|    key(key),
   18|   143k|    crypto(QPDFCryptoProvider::getImpl()),
   19|   143k|    encrypt(encrypt)
   20|   143k|{
   21|   143k|    util::assertion(next, "Attempt to create Pl_AES_PDF with nullptr as next");
   22|   143k|    util::no_ci_rt_error_if(!(key.size() == 32 || key.size() == 16), "unsupported key length");
  ------------------
  |  Branch (22:31): [True: 8.62k, False: 134k]
  |  Branch (22:51): [True: 134k, False: 5]
  ------------------
   23|   143k|    std::memset(this->inbuf, 0, this->buf_size);
   24|   143k|    std::memset(this->outbuf, 0, this->buf_size);
   25|   143k|    std::memset(this->cbc_block, 0, this->buf_size);
   26|   143k|}
_ZN10Pl_AES_PDF9useZeroIVEv:
   30|    660|{
   31|    660|    use_zero_iv = true;
   32|    660|}
_ZN10Pl_AES_PDF14disablePaddingEv:
   36|   130k|{
   37|   130k|    disable_padding = true;
   38|   130k|}
_ZN10Pl_AES_PDF5setIVEPKhm:
   42|   129k|{
   43|   129k|    util::assertion(
   44|   129k|        bytes == buf_size,
   45|   129k|        "Pl_AES_PDF: specified initialization vector size in bytes must be " +
   46|   129k|            std::to_string(bytes));
   47|   129k|    use_specified_iv = true;
   48|   129k|    memcpy(specified_iv, iv, bytes);
   49|   129k|}
_ZN10Pl_AES_PDF5writeEPKhm:
   65|  8.32M|{
   66|  8.32M|    size_t bytes_left = len;
   67|  8.32M|    unsigned char const* p = data;
   68|       |
   69|  43.6M|    while (bytes_left > 0) {
  ------------------
  |  Branch (69:12): [True: 35.3M, False: 8.32M]
  ------------------
   70|  35.3M|        if (offset == buf_size) {
  ------------------
  |  Branch (70:13): [True: 35.1M, False: 142k]
  ------------------
   71|  35.1M|            flush(false);
   72|  35.1M|        }
   73|       |
   74|  35.3M|        size_t available = buf_size - offset;
   75|  35.3M|        size_t bytes = (bytes_left < available ? bytes_left : available);
  ------------------
  |  Branch (75:25): [True: 10.5k, False: 35.3M]
  ------------------
   76|  35.3M|        bytes_left -= bytes;
   77|  35.3M|        std::memcpy(inbuf + offset, p, bytes);
   78|  35.3M|        offset += bytes;
   79|  35.3M|        p += bytes;
   80|  35.3M|    }
   81|  8.32M|}
_ZN10Pl_AES_PDF6finishEv:
   85|   143k|{
   86|   143k|    if (encrypt) {
  ------------------
  |  Branch (86:9): [True: 129k, False: 13.2k]
  ------------------
   87|   129k|        if (offset == buf_size) {
  ------------------
  |  Branch (87:13): [True: 129k, False: 0]
  ------------------
   88|   129k|            flush(false);
   89|   129k|        }
   90|   129k|        if (!disable_padding) {
  ------------------
  |  Branch (90:13): [True: 0, False: 129k]
  ------------------
   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|   129k|    } else {
   99|  13.2k|        if (offset != buf_size) {
  ------------------
  |  Branch (99:13): [True: 11.2k, False: 2.05k]
  ------------------
  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|  11.2k|            util::assertion(offset < buf_size, "buffer overflow in AES encryption pipeline");
  104|  11.2k|            std::memset(inbuf + offset, 0, buf_size - offset);
  105|  11.2k|            offset = buf_size;
  106|  11.2k|        }
  107|  13.2k|        flush(!disable_padding);
  108|  13.2k|    }
  109|   143k|    crypto->rijndael_finalize();
  110|   143k|    next()->finish();
  111|   143k|}
_ZN10Pl_AES_PDF16initializeVectorEv:
  115|   130k|{
  116|   130k|    if (use_zero_iv) {
  ------------------
  |  Branch (116:9): [True: 660, False: 129k]
  ------------------
  117|  11.2k|        for (unsigned int i = 0; i < buf_size; ++i) {
  ------------------
  |  Branch (117:34): [True: 10.5k, False: 660]
  ------------------
  118|  10.5k|            cbc_block[i] = 0;
  119|  10.5k|        }
  120|   129k|    } else if (use_specified_iv) {
  ------------------
  |  Branch (120:16): [True: 129k, False: 0]
  ------------------
  121|   129k|        std::memcpy(cbc_block, specified_iv, buf_size);
  122|   129k|    } 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|   130k|}
_ZN10Pl_AES_PDF5flushEb:
  133|  35.3M|{
  134|  35.3M|    util::assertion(offset == buf_size, "AES pipeline: flush called when buffer was not full");
  135|       |
  136|  35.3M|    if (first) {
  ------------------
  |  Branch (136:9): [True: 143k, False: 35.1M]
  ------------------
  137|   143k|        first = false;
  138|   143k|        bool return_after_init = false;
  139|   143k|        if (cbc_mode) {
  ------------------
  |  Branch (139:13): [True: 143k, False: 0]
  ------------------
  140|   143k|            if (encrypt) {
  ------------------
  |  Branch (140:17): [True: 129k, False: 13.2k]
  ------------------
  141|       |                // Set cbc_block to the initialization vector, and if not zero, write it to the
  142|       |                // output stream.
  143|   129k|                initializeVector();
  144|   129k|                if (!(use_zero_iv || use_specified_iv)) {
  ------------------
  |  Branch (144:23): [True: 0, False: 129k]
  |  Branch (144:38): [True: 129k, False: 0]
  ------------------
  145|      0|                    next()->write(cbc_block, buf_size);
  146|      0|                }
  147|   129k|            } else if (use_zero_iv || use_specified_iv) {
  ------------------
  |  Branch (147:24): [True: 660, False: 12.6k]
  |  Branch (147:39): [True: 0, False: 12.6k]
  ------------------
  148|       |                // Initialize vector with zeroes; zero vector was not written to the beginning of
  149|       |                // the input file.
  150|    660|                initializeVector();
  151|  12.6k|            } else {
  152|       |                // Take the first block of input as the initialization vector.  There's nothing to
  153|       |                // write at this time.
  154|  12.6k|                memcpy(cbc_block, inbuf, buf_size);
  155|  12.6k|                offset = 0;
  156|  12.6k|                return_after_init = true;
  157|  12.6k|            }
  158|   143k|        }
  159|   143k|        crypto->rijndael_init(
  160|   143k|            encrypt,
  161|   143k|            reinterpret_cast<const unsigned char*>(key.data()),
  162|   143k|            key.size(),
  163|   143k|            cbc_mode,
  164|   143k|            cbc_block);
  165|   143k|        if (return_after_init) {
  ------------------
  |  Branch (165:13): [True: 12.6k, False: 130k]
  ------------------
  166|  12.6k|            return;
  167|  12.6k|        }
  168|   143k|    }
  169|       |
  170|  35.3M|    crypto->rijndael_process(inbuf, outbuf);
  171|  35.3M|    unsigned int bytes = buf_size;
  172|  35.3M|    if (strip_padding) {
  ------------------
  |  Branch (172:9): [True: 10.0k, False: 35.2M]
  ------------------
  173|  10.0k|        unsigned char last = outbuf[buf_size - 1];
  174|  10.0k|        if (last <= buf_size) {
  ------------------
  |  Branch (174:13): [True: 1.59k, False: 8.44k]
  ------------------
  175|  1.59k|            bool strip = true;
  176|  2.89k|            for (unsigned int i = 1; i <= last; ++i) {
  ------------------
  |  Branch (176:38): [True: 1.97k, False: 923]
  ------------------
  177|  1.97k|                if (outbuf[buf_size - i] != last) {
  ------------------
  |  Branch (177:21): [True: 671, False: 1.30k]
  ------------------
  178|    671|                    strip = false;
  179|    671|                    break;
  180|    671|                }
  181|  1.97k|            }
  182|  1.59k|            if (strip) {
  ------------------
  |  Branch (182:17): [True: 923, False: 671]
  ------------------
  183|    923|                bytes -= last;
  184|    923|            }
  185|  1.59k|        }
  186|  10.0k|    }
  187|  35.3M|    offset = 0;
  188|  35.3M|    next()->write(outbuf, bytes);
  189|  35.3M|}

_ZN17Pl_ASCII85DecoderC2EPKcP8Pipeline:
   12|    609|    Pipeline(identifier, next)
   13|    609|{
   14|    609|    util::assertion(next, "Attempt to create Pl_ASCII85Decoder with nullptr as next");
   15|    609|}
_ZN17Pl_ASCII85Decoder5writeEPKhm:
   19|    750|{
   20|    750|    if (eod > 1) {
  ------------------
  |  Branch (20:9): [True: 0, False: 750]
  ------------------
   21|      0|        return;
   22|      0|    }
   23|   290k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (23:24): [True: 289k, False: 536]
  ------------------
   24|   289k|        switch (buf[i]) {
  ------------------
  |  Branch (24:17): [True: 5.83k, False: 283k]
  ------------------
   25|    829|        case ' ':
  ------------------
  |  Branch (25:9): [True: 829, False: 288k]
  ------------------
   26|  1.42k|        case '\f':
  ------------------
  |  Branch (26:9): [True: 598, False: 288k]
  ------------------
   27|  1.72k|        case '\v':
  ------------------
  |  Branch (27:9): [True: 297, False: 289k]
  ------------------
   28|  2.00k|        case '\t':
  ------------------
  |  Branch (28:9): [True: 284, False: 289k]
  ------------------
   29|  4.74k|        case '\r':
  ------------------
  |  Branch (29:9): [True: 2.73k, False: 286k]
  ------------------
   30|  5.83k|        case '\n':
  ------------------
  |  Branch (30:9): [True: 1.08k, False: 288k]
  ------------------
   31|  5.83k|            QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
   32|       |            // ignore whitespace
   33|  5.83k|            continue;
   34|   289k|        }
   35|   283k|        if (eod > 1) {
  ------------------
  |  Branch (35:13): [True: 5, False: 283k]
  ------------------
   36|      5|            break;
   37|   283k|        } else if (eod == 1) {
  ------------------
  |  Branch (37:20): [True: 24, False: 283k]
  ------------------
   38|     24|            util::no_ci_rt_error_if(buf[i] != '>', "broken end-of-data sequence in base 85 data");
   39|     24|            flush();
   40|     24|            eod = 2;
   41|   283k|        } else {
   42|   283k|            switch (buf[i]) {
   43|     27|            case '~':
  ------------------
  |  Branch (43:13): [True: 27, False: 283k]
  ------------------
   44|     27|                eod = 1;
   45|     27|                break;
   46|       |
   47|    461|            case 'z':
  ------------------
  |  Branch (47:13): [True: 461, False: 283k]
  ------------------
   48|    461|                if (pos != 0) {
  ------------------
  |  Branch (48:21): [True: 19, False: 442]
  ------------------
   49|     19|                    throw std::runtime_error("unexpected z during base 85 decode");
   50|     19|                }
   51|    442|                unsigned char zeroes[4];
   52|    442|                memset(zeroes, '\0', 4);
   53|    442|                next()->write(zeroes, 4);
   54|    442|                break;
   55|       |
   56|   283k|            default:
  ------------------
  |  Branch (56:13): [True: 283k, False: 488]
  ------------------
   57|   283k|                if (buf[i] < 33 || buf[i] > 117) {
  ------------------
  |  Branch (57:21): [True: 38, False: 283k]
  |  Branch (57:36): [True: 108, False: 283k]
  ------------------
   58|    146|                    error = true;
   59|    146|                    throw std::runtime_error("character out of range during base 85 decode");
   60|   283k|                } else {
   61|   283k|                    this->inbuf[this->pos++] = buf[i];
   62|   283k|                    if (pos == 5) {
  ------------------
  |  Branch (62:25): [True: 56.4k, False: 226k]
  ------------------
   63|  56.4k|                        flush();
   64|  56.4k|                    }
   65|   283k|                }
   66|   283k|                break;
   67|   283k|            }
   68|   283k|        }
   69|   283k|    }
   70|    750|}
_ZN17Pl_ASCII85Decoder5flushEv:
   74|  56.8k|{
   75|  56.8k|    if (this->pos == 0) {
  ------------------
  |  Branch (75:9): [True: 194, False: 56.6k]
  ------------------
   76|    194|        return;
   77|    194|    }
   78|  56.6k|    unsigned long lval = 0;
   79|   340k|    for (int i = 0; i < 5; ++i) {
  ------------------
  |  Branch (79:21): [True: 283k, False: 56.6k]
  ------------------
   80|   283k|        lval *= 85;
   81|   283k|        lval += (this->inbuf[i] - 33U);
   82|   283k|    }
   83|       |
   84|  56.6k|    unsigned char outbuf[4];
   85|  56.6k|    memset(outbuf, 0, 4);
   86|   283k|    for (int i = 3; i >= 0; --i) {
  ------------------
  |  Branch (86:21): [True: 226k, False: 56.6k]
  ------------------
   87|   226k|        outbuf[i] = lval & 0xff;
   88|   226k|        lval >>= 8;
   89|   226k|    }
   90|       |
   91|  56.6k|    QTC::TC("libtests", "Pl_ASCII85Decoder partial flush", (this->pos == 5) ? 0 : 1);
  ------------------
  |  Branch (91:60): [True: 56.4k, False: 225]
  ------------------
   92|       |    // Reset before calling getNext()->write in case that throws an exception.
   93|  56.6k|    auto t = this->pos - 1;
   94|  56.6k|    this->pos = 0;
   95|  56.6k|    memset(this->inbuf, 117, 5);
   96|       |
   97|  56.6k|    next()->write(outbuf, t);
   98|  56.6k|}
_ZN17Pl_ASCII85Decoder6finishEv:
  102|    540|{
  103|    540|    if (error) {
  ------------------
  |  Branch (103:9): [True: 127, False: 413]
  ------------------
  104|    127|        return;
  105|    127|    }
  106|    413|    flush();
  107|    413|    next()->finish();
  108|    413|}

_ZN18Pl_ASCIIHexDecoderC2EPKcP8Pipeline:
   13|    419|    Pipeline(identifier, next)
   14|    419|{
   15|    419|    util::assertion(next, "Attempt to create Pl_ASCIIHexDecoder with nullptr as next");
   16|    419|}
_ZN18Pl_ASCIIHexDecoder5writeEPKhm:
   20|    722|{
   21|    722|    if (eod) {
  ------------------
  |  Branch (21:9): [True: 208, False: 514]
  ------------------
   22|    208|        return;
   23|    208|    }
   24|  4.87k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (24:24): [True: 4.50k, False: 373]
  ------------------
   25|  4.50k|        char ch = static_cast<char>(toupper(buf[i]));
   26|  4.50k|        switch (ch) {
   27|    290|        case ' ':
  ------------------
  |  Branch (27:9): [True: 290, False: 4.21k]
  ------------------
   28|    547|        case '\f':
  ------------------
  |  Branch (28:9): [True: 257, False: 4.24k]
  ------------------
   29|    837|        case '\v':
  ------------------
  |  Branch (29:9): [True: 290, False: 4.21k]
  ------------------
   30|  1.12k|        case '\t':
  ------------------
  |  Branch (30:9): [True: 289, False: 4.21k]
  ------------------
   31|  1.43k|        case '\r':
  ------------------
  |  Branch (31:9): [True: 308, False: 4.19k]
  ------------------
   32|  1.75k|        case '\n':
  ------------------
  |  Branch (32:9): [True: 316, False: 4.18k]
  ------------------
   33|  1.75k|            QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space");
   34|       |            // ignore whitespace
   35|  1.75k|            break;
   36|       |
   37|     37|        case '>':
  ------------------
  |  Branch (37:9): [True: 37, False: 4.46k]
  ------------------
   38|     37|            eod = true;
   39|     37|            flush();
   40|     37|            break;
   41|       |
   42|  2.71k|        default:
  ------------------
  |  Branch (42:9): [True: 2.71k, False: 1.78k]
  ------------------
   43|  2.71k|            if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F')) {
  ------------------
  |  Branch (43:18): [True: 2.66k, False: 58]
  |  Branch (43:31): [True: 2.06k, False: 600]
  |  Branch (43:46): [True: 596, False: 62]
  |  Branch (43:59): [True: 556, False: 40]
  ------------------
   44|  2.61k|                inbuf[pos++] = ch;
   45|  2.61k|                if (pos == 2) {
  ------------------
  |  Branch (45:21): [True: 1.25k, False: 1.36k]
  ------------------
   46|  1.25k|                    flush();
   47|  1.25k|                }
   48|  2.61k|            } else {
   49|    102|                char t[2];
   50|    102|                t[0] = ch;
   51|    102|                t[1] = 0;
   52|    102|                throw std::runtime_error("character out of range during base Hex decode: "s + t);
   53|    102|            }
   54|  2.61k|            break;
   55|  4.50k|        }
   56|  4.40k|        if (eod) {
  ------------------
  |  Branch (56:13): [True: 37, False: 4.36k]
  ------------------
   57|     37|            break;
   58|     37|        }
   59|  4.40k|    }
   60|    514|}
_ZN18Pl_ASCIIHexDecoder5flushEv:
   64|  1.60k|{
   65|  1.60k|    if (pos == 0) {
  ------------------
  |  Branch (65:9): [True: 253, False: 1.35k]
  ------------------
   66|    253|        QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush");
   67|    253|        return;
   68|    253|    }
   69|  1.35k|    int b[2];
   70|  4.06k|    for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (70:21): [True: 2.71k, False: 1.35k]
  ------------------
   71|  2.71k|        if (inbuf[i] >= 'A') {
  ------------------
  |  Branch (71:13): [True: 556, False: 2.15k]
  ------------------
   72|    556|            b[i] = inbuf[i] - 'A' + 10;
   73|  2.15k|        } else {
   74|  2.15k|            b[i] = inbuf[i] - '0';
   75|  2.15k|        }
   76|  2.71k|    }
   77|  1.35k|    auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
   78|       |
   79|  1.35k|    QTC::TC("libtests", "Pl_ASCIIHexDecoder partial flush", (pos == 2) ? 0 : 1);
  ------------------
  |  Branch (79:61): [True: 1.25k, False: 102]
  ------------------
   80|       |    // Reset before calling getNext()->write in case that throws an exception.
   81|  1.35k|    pos = 0;
   82|  1.35k|    inbuf[0] = '0';
   83|  1.35k|    inbuf[1] = '0';
   84|  1.35k|    inbuf[2] = '\0';
   85|       |
   86|  1.35k|    next()->write(&ch, 1);
   87|  1.35k|}
_ZN18Pl_ASCIIHexDecoder6finishEv:
   91|    318|{
   92|    318|    flush();
   93|    318|    next()->finish();
   94|    318|}

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

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

_ZN8Pl_Flate7MembersC2EmNS_8action_eE:
   27|  5.17k|    out_bufsize(out_bufsize),
   28|  5.17k|    action(action),
   29|  5.17k|    initialized(false),
   30|  5.17k|    zdata(nullptr)
   31|  5.17k|{
   32|  5.17k|    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.17k|    zdata = new z_stream;
   37|       |
   38|  5.17k|    util::no_ci_rt_error_if(
   39|  5.17k|        out_bufsize > UINT_MAX,
   40|  5.17k|        "Pl_Flate: zlib doesn't support buffer sizes larger than unsigned int");
   41|       |
   42|  5.17k|    z_stream& zstream = *(static_cast<z_stream*>(this->zdata));
   43|  5.17k|    zstream.zalloc = nullptr;
   44|  5.17k|    zstream.zfree = nullptr;
   45|  5.17k|    zstream.opaque = nullptr;
   46|  5.17k|    zstream.next_in = nullptr;
   47|  5.17k|    zstream.avail_in = 0;
   48|  5.17k|    zstream.next_out = this->outbuf.get();
   49|  5.17k|    zstream.avail_out = QIntC::to_uint(out_bufsize);
   50|       |
   51|  5.17k|    if (action == a_deflate && Pl_Flate::zopfli_enabled()) {
  ------------------
  |  Branch (51:9): [True: 0, False: 5.17k]
  |  Branch (51:32): [True: 0, False: 0]
  ------------------
   52|      0|        zopfli_buf = std::make_unique<std::string>();
   53|      0|    }
   54|  5.17k|}
_ZN8Pl_Flate7MembersD2Ev:
   57|  5.17k|{
   58|  5.17k|    if (initialized) {
  ------------------
  |  Branch (58:9): [True: 1.44k, False: 3.73k]
  ------------------
   59|  1.44k|        z_stream& zstream = *(static_cast<z_stream*>(zdata));
   60|  1.44k|        if (action == a_deflate) {
  ------------------
  |  Branch (60:13): [True: 0, False: 1.44k]
  ------------------
   61|      0|            deflateEnd(&zstream);
   62|  1.44k|        } else {
   63|  1.44k|            inflateEnd(&zstream);
   64|  1.44k|        }
   65|  1.44k|    }
   66|       |
   67|  5.17k|    delete static_cast<z_stream*>(this->zdata);
   68|  5.17k|    zdata = nullptr;
   69|  5.17k|}
_ZN8Pl_FlateC2EPKcP8PipelineNS_8action_eEj:
   73|  5.17k|    Pipeline(identifier, next),
   74|  5.17k|    m(std::make_unique<Members>(QIntC::to_size(out_bufsize_int), action))
   75|  5.17k|{
   76|  5.17k|    util::assertion(next, "Attempt to create Pl_Flate with nullptr as next");
   77|  5.17k|}
_ZN8Pl_FlateD2Ev:
   80|  5.17k|Pl_Flate::~Pl_Flate() = default;
_ZN8Pl_Flate12memory_limitEv:
   84|  4.88k|{
   85|  4.88k|    return ::memory_limit;
   86|  4.88k|}
_ZN8Pl_Flate15setWarnCallbackENSt3__18functionIFvPKciEEE:
   96|  5.96k|{
   97|  5.96k|    m->callback = callback;
   98|  5.96k|}
_ZN8Pl_Flate4warnEPKci:
  102|  2.34k|{
  103|  2.34k|    if (m->callback) {
  ------------------
  |  Branch (103:9): [True: 2.34k, False: 0]
  ------------------
  104|  2.34k|        m->callback(msg, code);
  105|  2.34k|    }
  106|  2.34k|}
_ZN8Pl_Flate5writeEPKhm:
  110|   114k|{
  111|   114k|    util::assertion(
  112|   114k|        m->outbuf.get(), identifier + ": Pl_Flate: write() called after finish() called");
  113|   114k|    if (m->zopfli_buf) {
  ------------------
  |  Branch (113:9): [True: 0, False: 114k]
  ------------------
  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|   114k|    static size_t const max_bytes = 1 << 30;
  120|   114k|    size_t bytes_left = len;
  121|   114k|    unsigned char const* buf = data;
  122|   228k|    while (bytes_left > 0) {
  ------------------
  |  Branch (122:12): [True: 114k, False: 114k]
  ------------------
  123|   114k|        size_t bytes = (bytes_left >= max_bytes ? max_bytes : bytes_left);
  ------------------
  |  Branch (123:25): [True: 0, False: 114k]
  ------------------
  124|   114k|        handleData(buf, bytes, (m->action == a_inflate ? Z_SYNC_FLUSH : Z_NO_FLUSH));
  ------------------
  |  Branch (124:33): [True: 114k, False: 0]
  ------------------
  125|   114k|        bytes_left -= bytes;
  126|   114k|        buf += bytes;
  127|   114k|    }
  128|   114k|}
_ZN8Pl_Flate10handleDataEPKhmi:
  132|   118k|{
  133|   118k|    util::no_ci_rt_error_if(
  134|   118k|        len > UINT_MAX, "Pl_Flate: zlib doesn't support data blocks larger than int");
  135|   118k|    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|   118k|    zstream.next_in = const_cast<unsigned char*>(data);
  139|   118k|    zstream.avail_in = QIntC::to_uint(len);
  140|       |
  141|   118k|    if (!m->initialized) {
  ------------------
  |  Branch (141:9): [True: 4.67k, False: 114k]
  ------------------
  142|  4.67k|        int err = Z_OK;
  143|       |
  144|       |        // deflateInit and inflateInit are macros that use old-style casts.
  145|  4.67k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  146|  4.67k|# pragma GCC diagnostic push
  147|  4.67k|# pragma GCC diagnostic ignored "-Wold-style-cast"
  148|  4.67k|#endif
  149|  4.67k|        if (m->action == a_deflate) {
  ------------------
  |  Branch (149:13): [True: 0, False: 4.67k]
  ------------------
  150|      0|            err = deflateInit(&zstream, compression_level);
  151|  4.67k|        } else {
  152|  4.67k|            err = inflateInit(&zstream);
  153|  4.67k|        }
  154|  4.67k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  155|  4.67k|# pragma GCC diagnostic pop
  156|  4.67k|#endif
  157|       |
  158|  4.67k|        checkError("Init", err);
  159|  4.67k|        m->initialized = true;
  160|  4.67k|    }
  161|       |
  162|   118k|    int err = Z_OK;
  163|       |
  164|   118k|    bool done = false;
  165|   235k|    while (!done) {
  ------------------
  |  Branch (165:12): [True: 119k, False: 116k]
  ------------------
  166|   119k|        if (m->action == a_deflate) {
  ------------------
  |  Branch (166:13): [True: 0, False: 119k]
  ------------------
  167|      0|            err = deflate(&zstream, flush);
  168|   119k|        } else {
  169|   119k|            err = inflate(&zstream, flush);
  170|   119k|        }
  171|   119k|        if ((m->action == a_inflate) && (err != Z_OK) && zstream.msg &&
  ------------------
  |  Branch (171:13): [True: 119k, False: 0]
  |  Branch (171:41): [True: 7.08k, False: 112k]
  |  Branch (171:58): [True: 3.46k, False: 3.62k]
  ------------------
  172|  3.46k|            (strcmp(zstream.msg, "incorrect data check") == 0)) {
  ------------------
  |  Branch (172:13): [True: 1.16k, False: 2.30k]
  ------------------
  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.16k|            err = Z_STREAM_END;
  176|  1.16k|        }
  177|   119k|        switch (err) {
  178|  2.34k|        case Z_BUF_ERROR:
  ------------------
  |  Branch (178:9): [True: 2.34k, False: 117k]
  ------------------
  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.34k|            warn("input stream is complete but output may still be valid", err);
  186|  2.34k|            done = true;
  187|  2.34k|            break;
  188|       |
  189|  2.33k|        case Z_STREAM_END:
  ------------------
  |  Branch (189:9): [True: 2.33k, False: 117k]
  ------------------
  190|  2.33k|            done = true;
  191|       |            // fall through
  192|       |
  193|   114k|        case Z_OK:
  ------------------
  |  Branch (193:9): [True: 112k, False: 7.08k]
  ------------------
  194|   114k|            {
  195|   114k|                if ((zstream.avail_in == 0) && (zstream.avail_out > 0)) {
  ------------------
  |  Branch (195:21): [True: 113k, False: 1.60k]
  |  Branch (195:48): [True: 113k, False: 37]
  ------------------
  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|   113k|                    done = true;
  199|   113k|                }
  200|   114k|                uLong ready = QIntC::to_ulong(m->out_bufsize - zstream.avail_out);
  201|   114k|                if (ready > 0) {
  ------------------
  |  Branch (201:21): [True: 112k, False: 2.18k]
  ------------------
  202|   112k|                    if (::memory_limit && m->action != a_deflate) {
  ------------------
  |  Branch (202:25): [True: 112k, False: 0]
  |  Branch (202:43): [True: 112k, False: 0]
  ------------------
  203|   112k|                        m->written += ready;
  204|   112k|                        if (m->written > ::memory_limit) {
  ------------------
  |  Branch (204:29): [True: 56, False: 112k]
  ------------------
  205|     56|                            throw std::runtime_error("PL_Flate memory limit exceeded");
  206|     56|                        }
  207|   112k|                    }
  208|   112k|                    next()->write(m->outbuf.get(), ready);
  209|   112k|                    zstream.next_out = m->outbuf.get();
  210|   112k|                    zstream.avail_out = QIntC::to_uint(m->out_bufsize);
  211|   112k|                }
  212|   114k|            }
  213|   114k|            break;
  214|       |
  215|   114k|        default:
  ------------------
  |  Branch (215:9): [True: 2.40k, False: 116k]
  ------------------
  216|  2.40k|            checkError("data", err);
  217|   119k|        }
  218|   119k|    }
  219|   118k|}
_ZN8Pl_Flate6finishEv:
  223|  4.78k|{
  224|  4.78k|    if (m->written > ::memory_limit) {
  ------------------
  |  Branch (224:9): [True: 50, False: 4.73k]
  ------------------
  225|     50|        throw std::runtime_error("PL_Flate memory limit exceeded");
  226|     50|    }
  227|  4.73k|    try {
  228|  4.73k|        if (m->zopfli_buf) {
  ------------------
  |  Branch (228:13): [True: 0, False: 4.73k]
  ------------------
  229|      0|            finish_zopfli();
  230|  4.73k|        } else if (m->outbuf.get()) {
  ------------------
  |  Branch (230:20): [True: 4.73k, False: 0]
  ------------------
  231|  4.73k|            if (m->initialized) {
  ------------------
  |  Branch (231:17): [True: 4.30k, False: 429]
  ------------------
  232|  4.30k|                z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  233|  4.30k|                unsigned char buf[1];
  234|  4.30k|                buf[0] = '\0';
  235|  4.30k|                handleData(buf, 0, Z_FINISH);
  236|  4.30k|                int err = Z_OK;
  237|  4.30k|                if (m->action == a_deflate) {
  ------------------
  |  Branch (237:21): [True: 0, False: 4.30k]
  ------------------
  238|      0|                    err = deflateEnd(&zstream);
  239|  4.30k|                } else {
  240|  4.30k|                    err = inflateEnd(&zstream);
  241|  4.30k|                }
  242|  4.30k|                m->initialized = false;
  243|  4.30k|                checkError("End", err);
  244|  4.30k|            }
  245|       |
  246|  4.73k|            m->outbuf = nullptr;
  247|  4.73k|        }
  248|  4.73k|    } catch (std::exception& e) {
  249|  1.07k|        try {
  250|  1.07k|            next()->finish();
  251|  1.07k|        } catch (...) {
  252|       |            // ignore secondary exception
  253|     12|        }
  254|  1.07k|        throw std::runtime_error(e.what());
  255|  1.07k|    }
  256|  3.66k|    next()->finish();
  257|  3.66k|}
_ZN8Pl_Flate10checkErrorEPKci:
  267|  10.3k|{
  268|  10.3k|    z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  269|  10.3k|    if (error_code != Z_OK) {
  ------------------
  |  Branch (269:9): [True: 2.40k, False: 7.90k]
  ------------------
  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.30k, False: 106]
  ------------------
  274|  2.30k|            msg += zstream.msg;
  275|  2.30k|        } else {
  276|    106|            switch (error_code) {
  277|      0|            case Z_ERRNO:
  ------------------
  |  Branch (277:13): [True: 0, False: 106]
  ------------------
  278|      0|                msg += "zlib system error";
  279|      0|                break;
  280|       |
  281|      0|            case Z_STREAM_ERROR:
  ------------------
  |  Branch (281:13): [True: 0, False: 106]
  ------------------
  282|      0|                msg += "zlib stream error";
  283|      0|                break;
  284|       |
  285|      0|            case Z_DATA_ERROR:
  ------------------
  |  Branch (285:13): [True: 0, False: 106]
  ------------------
  286|      0|                msg += "zlib data error";
  287|      0|                break;
  288|       |
  289|      0|            case Z_MEM_ERROR:
  ------------------
  |  Branch (289:13): [True: 0, False: 106]
  ------------------
  290|      0|                msg += "zlib memory error";
  291|      0|                break;
  292|       |
  293|      0|            case Z_BUF_ERROR:
  ------------------
  |  Branch (293:13): [True: 0, False: 106]
  ------------------
  294|      0|                msg += "zlib buffer error";
  295|      0|                break;
  296|       |
  297|      0|            case Z_VERSION_ERROR:
  ------------------
  |  Branch (297:13): [True: 0, False: 106]
  ------------------
  298|      0|                msg += "zlib version error";
  299|      0|                break;
  300|       |
  301|    106|            default:
  ------------------
  |  Branch (301:13): [True: 106, False: 0]
  ------------------
  302|    106|                msg += std::string("zlib unknown error (") + std::to_string(error_code) + ")";
  303|    106|                break;
  304|    106|            }
  305|    106|        }
  306|       |
  307|  2.40k|        throw std::runtime_error(msg);
  308|  2.40k|    }
  309|  10.3k|}

_ZN13Pl_LZWDecoderC2EPKcP8Pipelineb:
   12|  3.53k|    Pipeline(identifier, next),
   13|  3.53k|    code_change_delta(early_code_change)
   14|  3.53k|{
   15|  3.53k|    util::assertion(next, "Attempt to create Pl_LZWDecoder with nullptr as next");
   16|  3.53k|}
_ZN13Pl_LZWDecoder5writeEPKhm:
   20|  3.82k|{
   21|  4.20M|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (21:24): [True: 4.20M, False: 3.82k]
  ------------------
   22|  4.20M|        buf[next_char_++] = bytes[i];
   23|  4.20M|        if (next_char_ == 3) {
  ------------------
  |  Branch (23:13): [True: 1.39M, False: 2.80M]
  ------------------
   24|  1.39M|            next_char_ = 0;
   25|  1.39M|        }
   26|  4.20M|        bits_available += 8;
   27|  4.20M|        if (bits_available >= code_size) {
  ------------------
  |  Branch (27:13): [True: 3.41M, False: 784k]
  ------------------
   28|  3.41M|            sendNextCode();
   29|  3.41M|        }
   30|  4.20M|    }
   31|  3.82k|}
_ZN13Pl_LZWDecoder6finishEv:
   35|  3.44k|{
   36|  3.44k|    next()->finish();
   37|  3.44k|}
_ZN13Pl_LZWDecoder12sendNextCodeEv:
   41|  3.41M|{
   42|  3.41M|    unsigned int high = byte_pos;
   43|  3.41M|    unsigned int med = (byte_pos + 1) % 3;
   44|  3.41M|    unsigned int low = (byte_pos + 2) % 3;
   45|       |
   46|  3.41M|    unsigned int bits_from_high = 8 - bit_pos;
   47|  3.41M|    unsigned int bits_from_med = code_size - bits_from_high;
   48|  3.41M|    unsigned int bits_from_low = 0;
   49|  3.41M|    if (bits_from_med > 8) {
  ------------------
  |  Branch (49:9): [True: 379k, False: 3.03M]
  ------------------
   50|   379k|        bits_from_low = bits_from_med - 8;
   51|   379k|        bits_from_med = 8;
   52|   379k|    }
   53|  3.41M|    unsigned int high_mask = (1U << bits_from_high) - 1U;
   54|  3.41M|    unsigned int med_mask = 0xff - ((1U << (8 - bits_from_med)) - 1U);
   55|  3.41M|    unsigned int low_mask = 0xff - ((1U << (8 - bits_from_low)) - 1U);
   56|  3.41M|    unsigned int code = 0;
   57|  3.41M|    code += (buf[high] & high_mask) << bits_from_med;
   58|  3.41M|    code += ((buf[med] & med_mask) >> (8 - bits_from_med));
   59|  3.41M|    if (bits_from_low) {
  ------------------
  |  Branch (59:9): [True: 379k, False: 3.03M]
  ------------------
   60|   379k|        code <<= bits_from_low;
   61|   379k|        code += ((buf[low] & low_mask) >> (8 - bits_from_low));
   62|   379k|        byte_pos = low;
   63|   379k|        bit_pos = bits_from_low;
   64|  3.03M|    } else {
   65|  3.03M|        byte_pos = med;
   66|  3.03M|        bit_pos = bits_from_med;
   67|  3.03M|    }
   68|  3.41M|    if (bit_pos == 8) {
  ------------------
  |  Branch (68:9): [True: 404k, False: 3.01M]
  ------------------
   69|   404k|        bit_pos = 0;
   70|   404k|        ++byte_pos;
   71|   404k|        byte_pos %= 3;
   72|   404k|    }
   73|  3.41M|    bits_available -= code_size;
   74|       |
   75|  3.41M|    handleCode(code);
   76|  3.41M|}
_ZN13Pl_LZWDecoder12getFirstCharEj:
   80|  14.6k|{
   81|  14.6k|    if (code < 256) {
  ------------------
  |  Branch (81:9): [True: 284, False: 14.3k]
  ------------------
   82|    284|        return static_cast<unsigned char>(code);
   83|    284|    }
   84|  14.3k|    util::no_ci_rt_error_if(
   85|  14.3k|        code <= 257,
   86|  14.3k|        "Pl_LZWDecoder::getFirstChar called with invalid code (" + std::to_string(code) + ")");
   87|       |
   88|  14.3k|    unsigned int idx = code - 258;
   89|  14.3k|    util::no_ci_rt_error_if(idx >= table.size(), "Pl_LZWDecoder::getFirstChar: table overflow");
   90|  14.3k|    Buffer& b = table.at(idx);
   91|  14.3k|    return b.getBuffer()[0];
   92|  14.6k|}
_ZN13Pl_LZWDecoder10addToTableEh:
   96|  2.89M|{
   97|  2.89M|    unsigned int last_size = 0;
   98|  2.89M|    unsigned char const* last_data = nullptr;
   99|  2.89M|    unsigned char tmp[1];
  100|       |
  101|  2.89M|    if (last_code < 256) {
  ------------------
  |  Branch (101:9): [True: 2.87M, False: 14.5k]
  ------------------
  102|  2.87M|        tmp[0] = static_cast<unsigned char>(last_code);
  103|  2.87M|        last_data = tmp;
  104|  2.87M|        last_size = 1;
  105|  2.87M|    } else {
  106|  14.5k|        util::no_ci_rt_error_if(
  107|  14.5k|            last_code <= 257,
  108|  14.5k|            "Pl_LZWDecoder::addToTable called with invalid code (" + std::to_string(last_code) +
  109|  14.5k|                ")");
  110|  14.5k|        unsigned int idx = last_code - 258;
  111|  14.5k|        util::no_ci_rt_error_if(idx >= table.size(), "Pl_LZWDecoder::addToTable: table overflow");
  112|  14.5k|        Buffer& b = table.at(idx);
  113|  14.5k|        last_data = b.getBuffer();
  114|  14.5k|        last_size = QIntC::to_uint(b.getSize());
  115|  14.5k|    }
  116|       |
  117|  2.89M|    Buffer entry(1 + last_size);
  118|  2.89M|    unsigned char* new_data = entry.getBuffer();
  119|  2.89M|    memcpy(new_data, last_data, last_size);
  120|  2.89M|    new_data[last_size] = c;
  121|  2.89M|    table.push_back(std::move(entry));
  122|  2.89M|}
_ZN13Pl_LZWDecoder10handleCodeEj:
  126|  3.41M|{
  127|  3.41M|    if (eod) {
  ------------------
  |  Branch (127:9): [True: 504k, False: 2.91M]
  ------------------
  128|   504k|        return;
  129|   504k|    }
  130|       |
  131|  2.91M|    if (code == 256) {
  ------------------
  |  Branch (131:9): [True: 9.58k, False: 2.90M]
  ------------------
  132|  9.58k|        if (!table.empty()) {
  ------------------
  |  Branch (132:13): [True: 9.33k, False: 255]
  ------------------
  133|  9.33k|            QTC::TC("libtests", "Pl_LZWDecoder intermediate reset");
  134|  9.33k|        }
  135|  9.58k|        table.clear();
  136|  9.58k|        code_size = 9;
  137|  2.90M|    } else if (code == 257) {
  ------------------
  |  Branch (137:16): [True: 48, False: 2.90M]
  ------------------
  138|     48|        eod = true;
  139|  2.90M|    } else {
  140|  2.90M|        if (last_code != 256) {
  ------------------
  |  Branch (140:13): [True: 2.89M, False: 10.5k]
  ------------------
  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.89M|            unsigned char next_c = '\0';
  144|  2.89M|            unsigned int table_size = QIntC::to_uint(table.size());
  145|  2.89M|            if (code < 256) {
  ------------------
  |  Branch (145:17): [True: 2.87M, False: 14.7k]
  ------------------
  146|       |                // just read < 256; last time's next_c was code
  147|  2.87M|                next_c = static_cast<unsigned char>(code);
  148|  2.87M|            } else if (code > 257) {
  ------------------
  |  Branch (148:24): [True: 14.7k, False: 0]
  ------------------
  149|  14.7k|                size_t idx = code - 258;
  150|  14.7k|                if (idx > table_size) {
  ------------------
  |  Branch (150:21): [True: 172, False: 14.6k]
  ------------------
  151|    172|                    throw std::runtime_error("LZWDecoder: bad code received");
  152|  14.6k|                } else if (idx == table_size) {
  ------------------
  |  Branch (152:28): [True: 284, False: 14.3k]
  ------------------
  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|    284|                    next_c = getFirstChar(last_code);
  156|  14.3k|                } else {
  157|  14.3k|                    next_c = getFirstChar(code);
  158|  14.3k|                }
  159|  14.7k|            }
  160|  2.89M|            unsigned int new_idx = 258 + table_size;
  161|  2.89M|            util::no_ci_rt_error_if(new_idx == 4096, "LZWDecoder: table full");
  162|  2.89M|            addToTable(next_c);
  163|  2.89M|            unsigned int change_idx = new_idx + code_change_delta;
  164|  2.89M|            if (change_idx == 511 || change_idx == 1023 || change_idx == 2047) {
  ------------------
  |  Branch (164:17): [True: 3.40k, False: 2.88M]
  |  Branch (164:38): [True: 819, False: 2.88M]
  |  Branch (164:60): [True: 382, False: 2.88M]
  ------------------
  165|  4.59k|                ++code_size;
  166|  4.59k|            }
  167|  2.89M|        }
  168|       |
  169|  2.90M|        if (code < 256) {
  ------------------
  |  Branch (169:13): [True: 2.88M, False: 14.6k]
  ------------------
  170|  2.88M|            auto ch = static_cast<unsigned char>(code);
  171|  2.88M|            next()->write(&ch, 1);
  172|  2.88M|        } else {
  173|  14.6k|            unsigned int idx = code - 258;
  174|  14.6k|            if (idx >= table.size()) {
  ------------------
  |  Branch (174:17): [True: 49, False: 14.6k]
  ------------------
  175|     49|                throw std::runtime_error("Pl_LZWDecoder::handleCode: table overflow");
  176|     49|            }
  177|  14.6k|            Buffer& b = table.at(idx);
  178|  14.6k|            next()->write(b.getBuffer(), b.getSize());
  179|  14.6k|        }
  180|  2.90M|    }
  181|       |
  182|  2.91M|    last_code = code;
  183|  2.91M|}

_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.13M|{
   30|  2.13M|    m->os.write(reinterpret_cast<char const*>(buf), static_cast<std::streamsize>(len));
   31|  2.13M|}
_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.87k|    Pipeline(identifier, next),
   31|  1.87k|    action(action)
   32|  1.87k|{
   33|  1.87k|    util::assertion(next, "Attempt to create Pl_PNGFilter with nullptr as next");
   34|  1.87k|    util::no_ci_rt_error_if(
   35|  1.87k|        samples_per_pixel < 1, "PNGFilter created with invalid samples_per_pixel");
   36|  1.87k|    util::no_ci_rt_error_if(
   37|  1.87k|        !(bits_per_sample == 1 || bits_per_sample == 2 || bits_per_sample == 4 ||
  ------------------
  |  Branch (37:11): [True: 132, False: 1.74k]
  |  Branch (37:35): [True: 69, False: 1.67k]
  |  Branch (37:59): [True: 69, False: 1.60k]
  ------------------
   38|  1.60k|          bits_per_sample == 8 || bits_per_sample == 16),
  ------------------
  |  Branch (38:11): [True: 1.55k, False: 49]
  |  Branch (38:35): [True: 33, False: 16]
  ------------------
   39|  1.87k|        "PNGFilter created with invalid bits_per_sample not 1, 2, 4, 8, or 16");
   40|  1.87k|    auto bits_per_pixel = 1ULL * bits_per_sample * samples_per_pixel;
   41|  1.87k|    util::no_ci_rt_error_if(
   42|  1.87k|        !util::fits<uint32_t>(bits_per_pixel + 7),
   43|  1.87k|        "PNGFilter created with bits_per_sample and samples_per_pixel values that cause overflow");
   44|  1.87k|    util::no_ci_rt_error_if(
   45|  1.87k|        !util::fits<uint32_t>(columns),
   46|  1.87k|        "PNGFilter created with columns value that causes overflow");
   47|  1.87k|    bytes_per_pixel = static_cast<uint32_t>((bits_per_pixel + 7) / 8);
   48|  1.87k|    auto bpr = ((columns * bits_per_pixel) + 7) / 8;
   49|  1.87k|    util::no_ci_rt_error_if(
   50|  1.87k|        bpr == 0 || !util::fits<uint32_t>(bpr + 1), "PNGFilter created with invalid columns value");
  ------------------
  |  Branch (50:9): [True: 19, False: 1.85k]
  |  Branch (50:21): [True: 3, False: 1.85k]
  ------------------
   51|  1.87k|    util::no_ci_rt_error_if(
   52|  1.87k|        memory_limit > 0 && bpr > (memory_limit / 2U), "PNGFilter memory limit exceeded");
  ------------------
  |  Branch (52:9): [True: 1.85k, False: 22]
  |  Branch (52:29): [True: 21, False: 1.83k]
  ------------------
   53|  1.87k|    bytes_per_row = static_cast<uint32_t>(bpr);
   54|  1.87k|    buf1 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   55|  1.87k|    buf2 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   56|  1.87k|    memset(buf1.get(), 0, bytes_per_row + 1);
   57|  1.87k|    memset(buf2.get(), 0, bytes_per_row + 1);
   58|  1.87k|    cur_row = buf1.get();
   59|  1.87k|    prev_row = buf2.get();
   60|       |
   61|       |    // number of bytes per incoming row
   62|  1.87k|    incoming = (action == a_encode ? bytes_per_row : bytes_per_row + 1);
  ------------------
  |  Branch (62:17): [True: 0, False: 1.87k]
  ------------------
   63|  1.87k|}
_ZN12Pl_PNGFilter5writeEPKhm:
   73|   385k|{
   74|   385k|    size_t left = incoming - pos;
   75|   385k|    size_t offset = 0;
   76|  1.33M|    while (len >= left) {
  ------------------
  |  Branch (76:12): [True: 953k, False: 385k]
  ------------------
   77|       |        // finish off current row
   78|   953k|        memcpy(cur_row + pos, data + offset, left);
   79|   953k|        offset += left;
   80|   953k|        len -= left;
   81|       |
   82|   953k|        processRow();
   83|       |
   84|       |        // Swap rows
   85|   953k|        unsigned char* t = prev_row;
   86|   953k|        prev_row = cur_row;
   87|   953k|        cur_row = t ? t : buf2.get();
  ------------------
  |  Branch (87:19): [True: 953k, False: 4]
  ------------------
   88|   953k|        memset(cur_row, 0, bytes_per_row + 1);
   89|   953k|        left = incoming;
   90|   953k|        pos = 0;
   91|   953k|    }
   92|   385k|    if (len) {
  ------------------
  |  Branch (92:9): [True: 384k, False: 700]
  ------------------
   93|   384k|        memcpy(cur_row + pos, data + offset, len);
   94|   384k|    }
   95|   385k|    pos += len;
   96|   385k|}
_ZN12Pl_PNGFilter10processRowEv:
  100|   954k|{
  101|   954k|    if (action == a_encode) {
  ------------------
  |  Branch (101:9): [True: 0, False: 954k]
  ------------------
  102|      0|        encodeRow();
  103|   954k|    } else {
  104|   954k|        decodeRow();
  105|   954k|    }
  106|   954k|}
_ZN12Pl_PNGFilter9decodeRowEv:
  110|   954k|{
  111|   954k|    int filter = cur_row[0];
  112|   954k|    if (prev_row) {
  ------------------
  |  Branch (112:9): [True: 954k, False: 0]
  ------------------
  113|   954k|        switch (filter) {
  114|   257k|        case 0:
  ------------------
  |  Branch (114:9): [True: 257k, False: 696k]
  ------------------
  115|   257k|            break;
  116|   197k|        case 1:
  ------------------
  |  Branch (116:9): [True: 197k, False: 757k]
  ------------------
  117|   197k|            decodeSub();
  118|   197k|            break;
  119|   435k|        case 2:
  ------------------
  |  Branch (119:9): [True: 435k, False: 519k]
  ------------------
  120|   435k|            decodeUp();
  121|   435k|            break;
  122|    371|        case 3:
  ------------------
  |  Branch (122:9): [True: 371, False: 953k]
  ------------------
  123|    371|            decodeAverage();
  124|    371|            break;
  125|  7.17k|        case 4:
  ------------------
  |  Branch (125:9): [True: 7.17k, False: 947k]
  ------------------
  126|  7.17k|            decodePaeth();
  127|  7.17k|            break;
  128|  56.7k|        default:
  ------------------
  |  Branch (128:9): [True: 56.7k, False: 897k]
  ------------------
  129|       |            // ignore
  130|  56.7k|            break;
  131|   954k|        }
  132|   954k|    }
  133|       |
  134|   954k|    next()->write(cur_row + 1, bytes_per_row);
  135|   954k|}
_ZN12Pl_PNGFilter9decodeSubEv:
  139|   197k|{
  140|   197k|    unsigned char* buffer = cur_row + 1;
  141|   197k|    unsigned int bpp = bytes_per_pixel;
  142|       |
  143|  2.83M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (143:30): [True: 2.64M, False: 197k]
  ------------------
  144|  2.64M|        unsigned char left = 0;
  145|       |
  146|  2.64M|        if (i >= bpp) {
  ------------------
  |  Branch (146:13): [True: 2.43M, False: 210k]
  ------------------
  147|  2.43M|            left = buffer[i - bpp];
  148|  2.43M|        }
  149|       |
  150|  2.64M|        buffer[i] = static_cast<unsigned char>(buffer[i] + left);
  151|  2.64M|    }
  152|   197k|}
_ZN12Pl_PNGFilter8decodeUpEv:
  156|   435k|{
  157|   435k|    unsigned char* buffer = cur_row + 1;
  158|   435k|    unsigned char* above_buffer = prev_row + 1;
  159|       |
  160|  3.04M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (160:30): [True: 2.60M, False: 435k]
  ------------------
  161|  2.60M|        unsigned char up = above_buffer[i];
  162|  2.60M|        buffer[i] = static_cast<unsigned char>(buffer[i] + up);
  163|  2.60M|    }
  164|   435k|}
_ZN12Pl_PNGFilter13decodeAverageEv:
  168|    371|{
  169|    371|    unsigned char* buffer = cur_row + 1;
  170|    371|    unsigned char* above_buffer = prev_row + 1;
  171|    371|    auto bpp = bytes_per_pixel;
  172|       |
  173|   719k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (173:30): [True: 719k, False: 371]
  ------------------
  174|   719k|        int left = 0;
  175|   719k|        int up = 0;
  176|       |
  177|   719k|        if (i >= bpp) {
  ------------------
  |  Branch (177:13): [True: 460k, False: 258k]
  ------------------
  178|   460k|            left = buffer[i - bpp];
  179|   460k|        }
  180|       |
  181|   719k|        up = above_buffer[i];
  182|   719k|        buffer[i] = static_cast<unsigned char>(buffer[i] + (left + up) / 2);
  183|   719k|    }
  184|    371|}
_ZN12Pl_PNGFilter11decodePaethEv:
  188|  7.17k|{
  189|  7.17k|    unsigned char* buffer = cur_row + 1;
  190|  7.17k|    unsigned char* above_buffer = prev_row + 1;
  191|  7.17k|    auto bpp = bytes_per_pixel;
  192|       |
  193|   274k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (193:30): [True: 267k, False: 7.17k]
  ------------------
  194|   267k|        int left = 0;
  195|   267k|        int up = above_buffer[i];
  196|   267k|        int upper_left = 0;
  197|       |
  198|   267k|        if (i >= bpp) {
  ------------------
  |  Branch (198:13): [True: 244k, False: 22.5k]
  ------------------
  199|   244k|            left = buffer[i - bpp];
  200|   244k|            upper_left = above_buffer[i - bpp];
  201|   244k|        }
  202|       |
  203|   267k|        buffer[i] = static_cast<unsigned char>(buffer[i] + PaethPredictor(left, up, upper_left));
  204|   267k|    }
  205|  7.17k|}
_ZN12Pl_PNGFilter14PaethPredictorEiii:
  209|   267k|{
  210|   267k|    int p = a + b - c;
  211|   267k|    int pa = abs_diff(p, a);
  212|   267k|    int pb = abs_diff(p, b);
  213|   267k|    int pc = abs_diff(p, c);
  214|       |
  215|   267k|    if (pa <= pb && pa <= pc) {
  ------------------
  |  Branch (215:9): [True: 248k, False: 19.0k]
  |  Branch (215:21): [True: 247k, False: 1.12k]
  ------------------
  216|   247k|        return a;
  217|   247k|    }
  218|  20.1k|    if (pb <= pc) {
  ------------------
  |  Branch (218:9): [True: 18.6k, False: 1.46k]
  ------------------
  219|  18.6k|        return b;
  220|  18.6k|    }
  221|  1.46k|    return c;
  222|  20.1k|}
_ZN12Pl_PNGFilter6finishEv:
  242|  1.81k|{
  243|  1.81k|    if (pos) {
  ------------------
  |  Branch (243:9): [True: 848, False: 963]
  ------------------
  244|       |        // write partial row
  245|    848|        processRow();
  246|    848|    }
  247|  1.81k|    prev_row = nullptr;
  248|  1.81k|    cur_row = buf1.get();
  249|  1.81k|    pos = 0;
  250|  1.81k|    memset(cur_row, 0, bytes_per_row + 1);
  251|       |
  252|  1.81k|    next()->finish();
  253|  1.81k|}
Pl_PNGFilter.cc:_ZL8abs_diffii:
   19|   802k|{
   20|   802k|    return a > b ? a - b : b - a;
  ------------------
  |  Branch (20:12): [True: 207k, False: 594k]
  ------------------
   21|   802k|}

_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|    485|    while (bytes_left > 0) {
  ------------------
  |  Branch (25:12): [True: 258, False: 227]
  ------------------
   26|    258|        size_t bytes = (bytes_left < this->out_bufsize ? bytes_left : out_bufsize);
  ------------------
  |  Branch (26:25): [True: 200, False: 58]
  ------------------
   27|    258|        bytes_left -= bytes;
   28|    258|        rc4.process(p, bytes, outbuf.get());
   29|    258|        p += bytes;
   30|    258|        next()->write(outbuf.get(), bytes);
   31|    258|    }
   32|    227|}
_ZN6Pl_RC46finishEv:
   36|    227|{
   37|    227|    outbuf = nullptr;
   38|    227|    next()->finish();
   39|    227|}

_ZN12Pl_RunLengthC2EPKcP8PipelineNS_8action_eE:
   32|    974|    Pipeline(identifier, next),
   33|    974|    m(std::make_unique<Members>(action))
   34|    974|{
   35|    974|    util::assertion(next, "Attempt to create Pl_RunLength with nullptr as next");
   36|    974|}
_ZN12Pl_RunLengthD2Ev:
   44|    974|Pl_RunLength::~Pl_RunLength() = default;
_ZN12Pl_RunLength5writeEPKhm:
   48|  27.8k|{
   49|  27.8k|    if (m->action == a_encode) {
  ------------------
  |  Branch (49:9): [True: 0, False: 27.8k]
  ------------------
   50|      0|        encode(data, len);
   51|  27.8k|    } else {
   52|  27.8k|        decode(data, len);
   53|  27.8k|    }
   54|  27.8k|}
_ZN12Pl_RunLength6decodeEPKhm:
   90|  27.8k|{
   91|  27.8k|    util::no_ci_rt_error_if(
   92|  27.8k|        memory_limit && (len + m->out.size()) > memory_limit, "Pl_RunLength memory limit exceeded");
  ------------------
  |  Branch (92:9): [True: 27.8k, False: 0]
  |  Branch (92:25): [True: 37, False: 27.7k]
  ------------------
   93|  27.8k|    m->out.reserve(len);
   94|  13.4M|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (94:24): [True: 13.3M, False: 27.8k]
  ------------------
   95|  13.3M|        unsigned char const& ch = data[i];
   96|  13.3M|        switch (m->state) {
  ------------------
  |  Branch (96:17): [True: 13.3M, False: 0]
  ------------------
   97|  5.87M|        case st_top:
  ------------------
  |  Branch (97:9): [True: 5.87M, False: 7.50M]
  ------------------
   98|  5.87M|            if (ch < 128) {
  ------------------
  |  Branch (98:17): [True: 142k, False: 5.73M]
  ------------------
   99|       |                // length represents remaining number of bytes to copy
  100|   142k|                m->length = 1U + ch;
  101|   142k|                m->state = st_copying;
  102|  5.73M|            } else if (ch > 128) {
  ------------------
  |  Branch (102:24): [True: 5.73M, False: 1.41k]
  ------------------
  103|       |                // length represents number of copies of next byte
  104|  5.73M|                m->length = 257U - ch;
  105|  5.73M|                m->state = st_run;
  106|  5.73M|            } else // ch == 128
  107|  1.41k|            {
  108|       |                // EOD; stay in this state
  109|  1.41k|            }
  110|  5.87M|            break;
  111|       |
  112|  1.77M|        case st_copying:
  ------------------
  |  Branch (112:9): [True: 1.77M, False: 11.6M]
  ------------------
  113|  1.77M|            m->out.append(1, static_cast<char>(ch));
  114|  1.77M|            if (--m->length == 0) {
  ------------------
  |  Branch (114:17): [True: 142k, False: 1.62M]
  ------------------
  115|   142k|                m->state = st_top;
  116|   142k|            }
  117|  1.77M|            break;
  118|       |
  119|  5.73M|        case st_run:
  ------------------
  |  Branch (119:9): [True: 5.73M, False: 7.64M]
  ------------------
  120|  5.73M|            m->out.append(m->length, static_cast<char>(ch));
  121|  5.73M|            m->state = st_top;
  122|  5.73M|            break;
  123|  13.3M|        }
  124|  13.3M|    }
  125|  27.8k|}
_ZN12Pl_RunLength6finishEv:
  159|    884|{
  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|    884|    if (m->action == a_encode) {
  ------------------
  |  Branch (163:9): [True: 0, False: 884]
  ------------------
  164|      0|        flush_encode();
  165|      0|        unsigned char ch = 128;
  166|      0|        next()->write(&ch, 1);
  167|    884|    } else {
  168|    884|        if (memory_limit && (m->out.size()) > memory_limit) {
  ------------------
  |  Branch (168:13): [True: 884, False: 0]
  |  Branch (168:29): [True: 56, False: 828]
  ------------------
  169|     56|            throw std::runtime_error("Pl_RunLength memory limit exceeded");
  170|     56|        }
  171|    828|        next()->writeString(m->out);
  172|    828|    }
  173|    828|    next()->finish();
  174|    828|}
_ZN12Pl_RunLength7MembersC2ENS_8action_eE:
   18|    974|        action(action)
   19|    974|    {
   20|    974|    }
_ZN12Pl_RunLength7MembersD2Ev:
   22|    974|    ~Members() = default;

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

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

_ZN4QPDF15StringDecrypterC2EPS_10QPDFObjGen:
  118|  80.9k|    qpdf(qpdf),
  119|  80.9k|    og(og)
  120|  80.9k|{
  121|  80.9k|}
_ZN4QPDF7MembersC2ERS_:
  131|  18.5k|    Doc(qpdf, this),
  132|  18.5k|    c(qpdf, this),
  133|  18.5k|    lin(*this),
  134|  18.5k|    objects(*this),
  135|  18.5k|    pages(*this),
  136|  18.5k|    file(std::make_shared<InvalidInputSource>()),
  137|  18.5k|    encp(std::make_shared<EncryptionParameters>())
  138|  18.5k|{
  139|  18.5k|}
_ZN4QPDFC2Ev:
  142|  18.5k|    m(std::make_unique<Members>(*this))
  143|  18.5k|{
  144|  18.5k|    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|  18.5k|    static std::atomic<unsigned long long> unique_id{0};
  148|  18.5k|    m->unique_id = unique_id.fetch_add(1ULL);
  149|  18.5k|}
_ZN4QPDFD2Ev:
  186|  18.5k|{
  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|  18.5k|    m->xref_table.clear();
  200|   298k|    for (auto const& iter: m->obj_cache) {
  ------------------
  |  Branch (200:26): [True: 298k, False: 18.5k]
  ------------------
  201|   298k|        Disconnect(iter.second.object).disconnect();
  202|   298k|    }
  203|  18.5k|}
_ZN4QPDF18processInputSourceENSt3__110shared_ptrI11InputSourceEEPKc:
  235|  18.5k|{
  236|  18.5k|    m->file = source;
  237|  18.5k|    m->objects.parse(password);
  238|  18.5k|}
_ZN4QPDF4warnERK7QPDFExc:
  337|   434k|{
  338|   434k|    m->c.warn(e);
  339|   434k|}
_ZN4QPDF3Doc6Common4warnERK7QPDFExc:
  343|   739k|{
  344|   739k|    if (cf.max_warnings() > 0 && m->warnings.size() >= cf.max_warnings()) {
  ------------------
  |  Branch (344:9): [True: 620k, False: 118k]
  |  Branch (344:34): [True: 34.4k, False: 586k]
  ------------------
  345|  34.4k|        stopOnError("Too many warnings - file is too badly damaged");
  346|  34.4k|    }
  347|   739k|    m->warnings.emplace_back(e);
  348|   739k|    if (!cf.suppress_warnings()) {
  ------------------
  |  Branch (348:9): [True: 705k, False: 34.4k]
  ------------------
  349|   705k|        *cf.log()->getWarn() << "WARNING: " << m->warnings.back().what() << "\n";
  350|   705k|    }
  351|   739k|}
_ZN4QPDF4warnE17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEExS9_:
  359|  6.64k|{
  360|  6.64k|    m->c.warn(QPDFExc(error_code, getFilename(), object, offset, message));
  361|  6.64k|}
_ZN4QPDF3Doc6Common4warnE17qpdf_error_code_eRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEExSB_:
  369|  1.20k|{
  370|  1.20k|    warn(QPDFExc(error_code, qpdf.getFilename(), object, offset, message));
  371|  1.20k|}
_ZN4QPDF9getObjectEii:
  410|  40.1k|{
  411|  40.1k|    return getObject({objid, generation});
  412|  40.1k|}
_ZNK4QPDF11getFilenameEv:
  625|  53.1k|{
  626|  53.1k|    return m->file->getName();
  627|  53.1k|}
_ZN4QPDF7getRootEv:
  669|  17.8k|{
  670|  17.8k|    Dictionary Root = m->trailer["/Root"];
  671|  17.8k|    if (!Root) {
  ------------------
  |  Branch (671:9): [True: 6.13k, False: 11.7k]
  ------------------
  672|  6.13k|        throw m->c.damagedPDF("", -1, "unable to find /Root dictionary");
  673|  6.13k|    }
  674|  11.7k|    if (!m->objects.root_checked()) {
  ------------------
  |  Branch (674:9): [True: 3.93k, False: 7.76k]
  ------------------
  675|  3.93k|        m->objects.root_checked(true);
  676|  3.93k|        if (Name(Root["/Type"]) != "/Catalog") {
  ------------------
  |  Branch (676:13): [True: 1.29k, False: 2.63k]
  ------------------
  677|  1.29k|            warn(m->c.damagedPDF(
  678|  1.29k|                "", -1, "Catalog: setting missing or invalid /Type entry to /Catalog"));
  679|  1.29k|            if (!global::Options::inspection_mode()) {
  ------------------
  |  Branch (679:17): [True: 1.29k, False: 1]
  ------------------
  680|  1.29k|                Root.replace("/Type", Name("/Catalog"));
  681|  1.29k|            }
  682|  1.29k|        }
  683|  3.93k|    }
  684|  11.7k|    return Root.oh();
  685|  17.8k|}
_ZN4QPDF14pipeStreamDataENSt3__110shared_ptrINS_20EncryptionParametersEEENS1_I11InputSourceEERS_10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
  713|  9.81k|{
  714|  9.81k|    std::unique_ptr<Pipeline> to_delete;
  715|  9.81k|    if (encp->encrypted) {
  ------------------
  |  Branch (715:9): [True: 606, False: 9.20k]
  ------------------
  716|    606|        decryptStream(
  717|    606|            encp, file, qpdf_for_warning, pipeline, og, stream_dict, is_root_metadata, to_delete);
  718|    606|    }
  719|       |
  720|  9.81k|    bool attempted_finish = false;
  721|  9.81k|    try {
  722|  9.81k|        auto buf = file->read(length, offset);
  723|  9.81k|        if (buf.size() != length) {
  ------------------
  |  Branch (723:13): [True: 0, False: 9.81k]
  ------------------
  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|  9.81k|        pipeline->write(buf.data(), length);
  731|  9.81k|        attempted_finish = true;
  732|  9.81k|        pipeline->finish();
  733|  9.81k|        return true;
  734|  9.81k|    } 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.87k|    } catch (std::exception& e) {
  739|  1.87k|        if (!suppress_warnings) {
  ------------------
  |  Branch (739:13): [True: 1.87k, False: 0]
  ------------------
  740|  1.87k|            QTC::TC("qpdf", "QPDF decoding error warning");
  741|  1.87k|            qpdf_for_warning.warn(
  742|       |                // line-break
  743|  1.87k|                qpdf_for_warning.m->c.damagedPDF(
  744|  1.87k|                    *file,
  745|  1.87k|                    "",
  746|  1.87k|                    file->getLastOffset(),
  747|  1.87k|                    ("error decoding stream data for object " + og.unparse(' ') + ": " +
  748|  1.87k|                     e.what())));
  749|  1.87k|            if (will_retry) {
  ------------------
  |  Branch (749:17): [True: 0, False: 1.87k]
  ------------------
  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.87k|        }
  759|  1.87k|    }
  760|  1.79k|    if (!attempted_finish) {
  ------------------
  |  Branch (760:9): [True: 1.64k, False: 159]
  ------------------
  761|  1.64k|        try {
  762|  1.64k|            pipeline->finish();
  763|  1.64k|        } catch (std::exception&) {
  764|       |            // ignore
  765|  1.26k|        }
  766|  1.64k|    }
  767|  1.79k|    return false;
  768|  1.79k|}
_ZN4QPDF14pipeStreamDataE10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
  780|  9.81k|{
  781|  9.81k|    return pipeStreamData(
  782|  9.81k|        m->encp,
  783|  9.81k|        m->file,
  784|  9.81k|        *this,
  785|  9.81k|        og,
  786|  9.81k|        offset,
  787|  9.81k|        length,
  788|  9.81k|        stream_dict,
  789|  9.81k|        is_root_metadata,
  790|  9.81k|        pipeline,
  791|  9.81k|        suppress_warnings,
  792|  9.81k|        will_retry);
  793|  9.81k|}
_ZN4QPDF3Doc6Common11stopOnErrorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  799|  34.4k|{
  800|  34.4k|    throw damagedPDF("", message);
  801|  34.4k|}
_ZN4QPDF3Doc6Common10damagedPDFER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEExSC_:
  807|  40.0k|{
  808|  40.0k|    return {qpdf_e_damaged_pdf, input.getName(), object, offset, message, true};
  809|  40.0k|}
_ZNK4QPDF3Doc6Common10damagedPDFER11InputSourcexRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
  815|  38.1k|{
  816|  38.1k|    return damagedPDF(input, m->last_object_description, offset, message);
  817|  38.1k|}
_ZNK4QPDF3Doc6Common10damagedPDFERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEExSA_:
  823|   271k|{
  824|   271k|    return {qpdf_e_damaged_pdf, m->file->getName(), object, offset, message, true};
  825|   271k|}
_ZNK4QPDF3Doc6Common10damagedPDFERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  831|  87.7k|{
  832|  87.7k|    return damagedPDF(object, m->file->getLastOffset(), message);
  833|  87.7k|}
_ZNK4QPDF3Doc6Common10damagedPDFExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  839|  52.5k|{
  840|  52.5k|    return damagedPDF(m->last_object_description, offset, message);
  841|  52.5k|}
_ZNK4QPDF3Doc6Common10damagedPDFERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  847|  29.2k|{
  848|  29.2k|    return damagedPDF(m->last_object_description, m->file->getLastOffset(), message);
  849|  29.2k|}
_ZN10DisconnectC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  172|   298k|        BaseHandle(obj)
  173|   298k|    {
  174|   298k|    }
_ZN10Disconnect10disconnectEv:
  177|   298k|    {
  178|   298k|        BaseHandle::disconnect(false);
  179|   298k|        if (raw_type_code() != ::ot_null) {
  ------------------
  |  Branch (179:13): [True: 95.5k, False: 203k]
  ------------------
  180|  95.5k|            obj->value = QPDF_Destroyed();
  181|  95.5k|        }
  182|   298k|    }

_ZN18QPDFCryptoProvider7getImplEv:
   19|   390k|{
   20|   390k|    QPDFCryptoProvider& p = getInstance();
   21|   390k|    if (p.m->default_provider.empty()) {
  ------------------
  |  Branch (21:9): [True: 0, False: 390k]
  ------------------
   22|      0|        throw std::logic_error("QPDFCryptoProvider::getImpl called with no default provider.");
   23|      0|    }
   24|   390k|    return p.getImpl_internal(p.m->default_provider);
   25|   390k|}
_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|   390k|{
   67|   390k|    static QPDFCryptoProvider instance;
   68|   390k|    return instance;
   69|   390k|}
_ZNK18QPDFCryptoProvider16getImpl_internalERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   73|   390k|{
   74|   390k|    auto iter = m->providers.find(name);
   75|   390k|    if (iter == m->providers.end()) {
  ------------------
  |  Branch (75:9): [True: 0, False: 390k]
  ------------------
   76|      0|        throw std::logic_error(
   77|      0|            "QPDFCryptoProvider requested unknown implementation \"" + name + "\"");
   78|      0|    }
   79|   390k|    return m->providers[name]();
   80|   390k|}
_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|    330|{
   37|    330|    getRandomProvider()->provideRandomData(data, len);
   38|    330|}
_ZN17QPDFCrypto_native8MD5_initEv:
   42|  84.0k|{
   43|  84.0k|    md5 = std::make_shared<MD5_native>();
   44|  84.0k|}
_ZN17QPDFCrypto_native10MD5_updateEPKhm:
   48|  88.6k|{
   49|  88.6k|    md5->update(const_cast<unsigned char*>(data), len);
   50|  88.6k|}
_ZN17QPDFCrypto_native12MD5_finalizeEv:
   54|  84.0k|{
   55|  84.0k|    md5->finalize();
   56|  84.0k|}
_ZN17QPDFCrypto_native10MD5_digestEPh:
   60|  84.0k|{
   61|  84.0k|    md5->digest(d);
   62|  84.0k|}
_ZN17QPDFCrypto_native8RC4_initEPKhi:
   66|  31.5k|{
   67|  31.5k|    rc4 = std::make_shared<RC4_native>(key_data, key_len);
   68|  31.5k|}
_ZN17QPDFCrypto_native11RC4_processEPKhmPh:
   72|  31.5k|{
   73|  31.5k|    rc4->process(in_data, len, out_data);
   74|  31.5k|}
_ZN17QPDFCrypto_native9SHA2_initEi:
   83|   131k|{
   84|   131k|    sha2 = std::make_shared<SHA2_native>(bits);
   85|   131k|}
_ZN17QPDFCrypto_native11SHA2_updateEPKhm:
   89|   132k|{
   90|   132k|    sha2->update(data, len);
   91|   132k|}
_ZN17QPDFCrypto_native13SHA2_finalizeEv:
   95|   131k|{
   96|   131k|    sha2->finalize();
   97|   131k|}
_ZN17QPDFCrypto_native11SHA2_digestEv:
  101|   131k|{
  102|   131k|    return sha2->getRawDigest();
  103|   131k|}
_ZN17QPDFCrypto_native13rijndael_initEbPKhmbPh:
  113|   143k|{
  114|   143k|    aes_pdf = std::make_shared<AES_PDF_native>(encrypt, key_data, key_len, cbc_mode, cbc_block);
  115|   143k|}
_ZN17QPDFCrypto_native16rijndael_processEPhS0_:
  119|  35.3M|{
  120|  35.3M|    aes_pdf->update(in_data, out_data);
  121|  35.3M|}
_ZN17QPDFCrypto_native17rijndael_finalizeEv:
  125|   142k|{
  126|   142k|}
QPDFCrypto_native.cc:_ZL17getRandomProviderv:
   12|    330|{
   13|       |#ifdef USE_INSECURE_RANDOM
   14|       |    static RandomDataProvider* insecure_random_data_provider =
   15|       |        InsecureRandomDataProvider::getInstance();
   16|       |#else
   17|    330|    static RandomDataProvider* insecure_random_data_provider = nullptr;
   18|    330|#endif
   19|    330|    static RandomDataProvider* secure_random_data_provider =
   20|    330|        SecureRandomDataProvider::getInstance();
   21|       |
   22|    330|    static RandomDataProvider* provider =
   23|    330|        (secure_random_data_provider         ? secure_random_data_provider
  ------------------
  |  Branch (23:10): [True: 1, False: 329]
  ------------------
   24|    330|             : insecure_random_data_provider ? insecure_random_data_provider
  ------------------
  |  Branch (24:16): [True: 0, False: 329]
  ------------------
   25|    329|                                             : nullptr);
   26|       |
   27|    330|    if (provider == nullptr) {
  ------------------
  |  Branch (27:9): [True: 0, False: 330]
  ------------------
   28|      0|        throw std::logic_error("QPDFCrypto_native has no random data provider");
   29|      0|    }
   30|       |
   31|    330|    return provider;
   32|    330|}

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

_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_:
    9|   441k|    std::runtime_error(createWhat(filename, object, (offset ? offset : -1), message)),
  ------------------
  |  Branch (9:54): [True: 382k, False: 58.6k]
  ------------------
   10|   441k|    error_code(error_code),
   11|   441k|    filename(filename),
   12|   441k|    object(object),
   13|   441k|    offset(offset ? offset : -1),
  ------------------
  |  Branch (13:12): [True: 382k, False: 58.6k]
  ------------------
   14|   441k|    message(message)
   15|   441k|{
   16|   441k|}
_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_b:
   25|   329k|    std::runtime_error(
   26|   329k|        createWhat(filename, object, (offset || zero_offset_valid ? offset : -1), message)),
  ------------------
  |  Branch (26:39): [True: 329k, False: 83]
  |  Branch (26:49): [True: 83, False: 0]
  ------------------
   27|   329k|    error_code(error_code),
   28|   329k|    filename(filename),
   29|   329k|    object(object),
   30|   329k|    offset(offset || zero_offset_valid ? offset : -1),
  ------------------
  |  Branch (30:12): [True: 329k, False: 83]
  |  Branch (30:22): [True: 83, False: 0]
  ------------------
   31|   329k|    message(message)
   32|   329k|{
   33|   329k|}
_ZN7QPDFExc10createWhatERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_xS8_:
   41|   771k|{
   42|   771k|    std::string result;
   43|   771k|    if (!filename.empty()) {
  ------------------
  |  Branch (43:9): [True: 718k, False: 52.9k]
  ------------------
   44|   718k|        result += filename;
   45|   718k|    }
   46|   771k|    if (!(object.empty() && offset < 0)) {
  ------------------
  |  Branch (46:11): [True: 139k, False: 631k]
  |  Branch (46:29): [True: 95.4k, False: 43.7k]
  ------------------
   47|   675k|        if (!filename.empty()) {
  ------------------
  |  Branch (47:13): [True: 623k, False: 52.6k]
  ------------------
   48|   623k|            result += " (";
   49|   623k|        }
   50|   675k|        if (!object.empty()) {
  ------------------
  |  Branch (50:13): [True: 631k, False: 43.7k]
  ------------------
   51|   631k|            result += object;
   52|   631k|            if (offset >= 0) {
  ------------------
  |  Branch (52:17): [True: 573k, False: 58.0k]
  ------------------
   53|   573k|                result += ", ";
   54|   573k|            }
   55|   631k|        }
   56|   675k|        if (offset >= 0) {
  ------------------
  |  Branch (56:13): [True: 617k, False: 58.0k]
  ------------------
   57|   617k|            result += "offset " + std::to_string(offset);
   58|   617k|        }
   59|   675k|        if (!filename.empty()) {
  ------------------
  |  Branch (59:13): [True: 623k, False: 52.6k]
  ------------------
   60|   623k|            result += ")";
   61|   623k|        }
   62|   675k|    }
   63|   771k|    if (!result.empty()) {
  ------------------
  |  Branch (63:9): [True: 770k, False: 298]
  ------------------
   64|   770k|        result += ": ";
   65|   770k|    }
   66|   771k|    result += message;
   67|   771k|    return result;
   68|   771k|}

_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|  26.7k|{
   78|  26.7k|    static auto l = create();
   79|  26.7k|    return l;
   80|  26.7k|}
_ZN10QPDFLogger4warnEPKc:
  102|     15|{
  103|     15|    getWarn(false)->writeCStr(s);
  104|     15|}
_ZN10QPDFLogger7getWarnEb:
  114|   705k|{
  115|   705k|    if (m->p_warn) {
  ------------------
  |  Branch (115:9): [True: 0, False: 705k]
  ------------------
  116|      0|        return m->p_warn;
  117|      0|    }
  118|   705k|    return getError(null_okay);
  119|   705k|}
_ZN10QPDFLogger8getErrorEb:
  135|   713k|{
  136|   713k|    return throwIfNull(m->p_error, null_okay);
  137|   713k|}
_ZN10QPDFLogger11throwIfNullENSt3__110shared_ptrI8PipelineEEb:
  254|   713k|{
  255|   713k|    if (!(null_okay || p)) {
  ------------------
  |  Branch (255:11): [True: 0, False: 713k]
  |  Branch (255:24): [True: 713k, False: 0]
  ------------------
  256|      0|        throw std::logic_error("QPDFLogger: requested a null pipeline without null_okay == true");
  257|      0|    }
  258|   713k|    return p;
  259|   713k|}
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|  54.2k|{
    6|  54.2k|    qpdf_offset_t shift = (getTypeCode() == ::ot_dictionary) ? 2
  ------------------
  |  Branch (6:27): [True: 35.0k, False: 19.2k]
  ------------------
    7|  54.2k|        : (getTypeCode() == ::ot_array)                      ? 1
  ------------------
  |  Branch (7:11): [True: 48, False: 19.2k]
  ------------------
    8|  19.2k|                                                             : 0;
    9|       |
   10|  54.2k|    if (object_description) {
  ------------------
  |  Branch (10:9): [True: 49.2k, False: 5.01k]
  ------------------
   11|  49.2k|        switch (object_description->index()) {
  ------------------
  |  Branch (11:17): [True: 49.2k, False: 0]
  ------------------
   12|  46.8k|        case 0:
  ------------------
  |  Branch (12:9): [True: 46.8k, False: 2.43k]
  ------------------
   13|  46.8k|            {
   14|       |                // Simple template string
   15|  46.8k|                auto description = std::get<0>(*object_description);
   16|       |
   17|  46.8k|                if (auto pos = description.find("$OG"); pos != std::string::npos) {
  ------------------
  |  Branch (17:57): [True: 0, False: 46.8k]
  ------------------
   18|      0|                    description.replace(pos, 3, og.unparse(' '));
   19|      0|                }
   20|  46.8k|                if (auto pos = description.find("$PO"); pos != std::string::npos) {
  ------------------
  |  Branch (20:57): [True: 46.6k, False: 222]
  ------------------
   21|  46.6k|                    description.replace(pos, 3, std::to_string(parsed_offset + shift));
   22|  46.6k|                }
   23|  46.8k|                return description;
   24|      0|            }
   25|      0|        case 1:
  ------------------
  |  Branch (25:9): [True: 0, False: 49.2k]
  ------------------
   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.38k|        case 2:
  ------------------
  |  Branch (33:9): [True: 1.38k, False: 47.8k]
  ------------------
   34|  1.38k|            {
   35|       |                // Child object description
   36|  1.38k|                auto j_descr = std::get<2>(*object_description);
   37|  1.38k|                std::string result;
   38|  1.38k|                if (auto p = j_descr.parent.lock()) {
  ------------------
  |  Branch (38:26): [True: 1.38k, False: 0]
  ------------------
   39|  1.38k|                    result = p->getDescription();
   40|  1.38k|                }
   41|  1.38k|                result += j_descr.static_descr;
   42|  1.38k|                if (auto pos = result.find("$VD"); pos != std::string::npos) {
  ------------------
  |  Branch (42:52): [True: 1.38k, False: 0]
  ------------------
   43|  1.38k|                    result.replace(pos, 3, j_descr.var_descr);
   44|  1.38k|                }
   45|  1.38k|                return result;
   46|      0|            }
   47|  1.05k|        case 3:
  ------------------
  |  Branch (47:9): [True: 1.05k, False: 48.2k]
  ------------------
   48|  1.05k|            auto [stream_id, obj_id] = std::get<3>(*object_description);
   49|  1.05k|            std::string result = qpdf ? qpdf->getFilename() : "";
  ------------------
  |  Branch (49:34): [True: 1.05k, False: 0]
  ------------------
   50|  1.05k|            result += " object stream " + std::to_string(stream_id) + ", object " +
   51|  1.05k|                std::to_string(obj_id) + " 0 at offset " + std::to_string(parsed_offset + shift);
   52|  1.05k|            return result;
   53|  49.2k|        }
   54|       |
   55|  49.2k|    } else if (og.isIndirect()) {
  ------------------
  |  Branch (55:16): [True: 4.71k, False: 298]
  ------------------
   56|  4.71k|        return "object " + og.unparse(' ');
   57|  4.71k|    }
   58|    298|    return {};
   59|  54.2k|}

_ZNK4qpdf10BaseHandlecv10QPDFObjGenEv:
   35|   139k|{
   36|   139k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (36:12): [True: 139k, False: 0]
  ------------------
   37|   139k|}
_ZN16QPDFObjectHandle18StreamDataProviderC2Eb:
   47|  18.5k|    supports_retry(supports_retry)
   48|  18.5k|{
   49|  18.5k|}
_ZN16QPDFObjectHandle18StreamDataProviderD2Ev:
   52|  18.5k|{
   53|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   54|  18.5k|}
_ZNK4qpdf10BaseHandle4copyEb:
  258|   101k|{
  259|   101k|    switch (resolved_type_code()) {
  ------------------
  |  Branch (259:13): [True: 101k, False: 0]
  ------------------
  260|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (260:5): [True: 0, False: 101k]
  ------------------
  261|      0|        throw std::logic_error("QPDFObjectHandle: attempting to copy an uninitialized object");
  262|      0|        return {}; // does not return
  263|      0|    case ::ot_reserved:
  ------------------
  |  Branch (263:5): [True: 0, False: 101k]
  ------------------
  264|      0|        return QPDFObject::create<QPDF_Reserved>();
  265|    503|    case ::ot_null:
  ------------------
  |  Branch (265:5): [True: 503, False: 101k]
  ------------------
  266|    503|        return QPDFObject::create<QPDF_Null>();
  267|    235|    case ::ot_boolean:
  ------------------
  |  Branch (267:5): [True: 235, False: 101k]
  ------------------
  268|    235|        return QPDFObject::create<QPDF_Bool>(std::get<QPDF_Bool>(obj->value).val);
  269|  1.34k|    case ::ot_integer:
  ------------------
  |  Branch (269:5): [True: 1.34k, False: 100k]
  ------------------
  270|  1.34k|        return QPDFObject::create<QPDF_Integer>(std::get<QPDF_Integer>(obj->value).val);
  271|    541|    case ::ot_real:
  ------------------
  |  Branch (271:5): [True: 541, False: 101k]
  ------------------
  272|    541|        return QPDFObject::create<QPDF_Real>(std::get<QPDF_Real>(obj->value).val);
  273|  1.66k|    case ::ot_string:
  ------------------
  |  Branch (273:5): [True: 1.66k, False: 100k]
  ------------------
  274|  1.66k|        return QPDFObject::create<QPDF_String>(std::get<QPDF_String>(obj->value).val);
  275|  96.6k|    case ::ot_name:
  ------------------
  |  Branch (275:5): [True: 96.6k, False: 5.32k]
  ------------------
  276|  96.6k|        return QPDFObject::create<QPDF_Name>(std::get<QPDF_Name>(obj->value).name);
  277|    420|    case ::ot_array:
  ------------------
  |  Branch (277:5): [True: 420, False: 101k]
  ------------------
  278|    420|        {
  279|    420|            auto const& a = std::get<QPDF_Array>(obj->value);
  280|    420|            if (shallow) {
  ------------------
  |  Branch (280:17): [True: 0, False: 420]
  ------------------
  281|      0|                return QPDFObject::create<QPDF_Array>(a);
  282|    420|            } else {
  283|    420|                QTC::TC("qpdf", "QPDF_Array copy", a.sp ? 0 : 1);
  ------------------
  |  Branch (283:52): [True: 30, False: 390]
  ------------------
  284|    420|                if (a.sp) {
  ------------------
  |  Branch (284:21): [True: 30, False: 390]
  ------------------
  285|     30|                    QPDF_Array result;
  286|     30|                    result.sp = std::make_unique<QPDF_Array::Sparse>();
  287|     30|                    result.sp->size = a.sp->size;
  288|  6.74k|                    for (auto const& [idx, oh]: a.sp->elements) {
  ------------------
  |  Branch (288:47): [True: 6.74k, False: 30]
  ------------------
  289|  6.74k|                        result.sp->elements[idx] = oh.indirect() ? oh : oh.copy();
  ------------------
  |  Branch (289:52): [True: 111, False: 6.63k]
  ------------------
  290|  6.74k|                    }
  291|     30|                    return QPDFObject::create<QPDF_Array>(std::move(result));
  292|    390|                } else {
  293|    390|                    std::vector<QPDFObjectHandle> result;
  294|    390|                    result.reserve(a.elements.size());
  295|  94.3k|                    for (auto const& element: a.elements) {
  ------------------
  |  Branch (295:45): [True: 94.3k, False: 390]
  ------------------
  296|  94.3k|                        result.emplace_back(
  297|  94.3k|                            element ? (element.indirect() ? element : element.copy()) : element);
  ------------------
  |  Branch (297:29): [True: 94.3k, False: 0]
  |  Branch (297:40): [True: 1.33k, False: 92.9k]
  ------------------
  298|  94.3k|                    }
  299|    390|                    return QPDFObject::create<QPDF_Array>(std::move(result), false);
  300|    390|                }
  301|    420|            }
  302|    420|        }
  303|    612|    case ::ot_dictionary:
  ------------------
  |  Branch (303:5): [True: 612, False: 101k]
  ------------------
  304|    612|        {
  305|    612|            auto const& d = std::get<QPDF_Dictionary>(obj->value);
  306|    612|            if (shallow) {
  ------------------
  |  Branch (306:17): [True: 0, False: 612]
  ------------------
  307|      0|                return QPDFObject::create<QPDF_Dictionary>(d.items);
  308|    612|            } else {
  309|    612|                std::map<std::string, QPDFObjectHandle> new_items;
  310|  2.56k|                for (auto const& [key, val]: d.items) {
  ------------------
  |  Branch (310:44): [True: 2.56k, False: 612]
  ------------------
  311|  2.56k|                    new_items[key] = val.indirect() ? val : val.copy();
  ------------------
  |  Branch (311:38): [True: 405, False: 2.16k]
  ------------------
  312|  2.56k|                }
  313|    612|                return QPDFObject::create<QPDF_Dictionary>(new_items);
  314|    612|            }
  315|    612|        }
  316|      0|    case ::ot_stream:
  ------------------
  |  Branch (316:5): [True: 0, False: 101k]
  ------------------
  317|      0|        QTC::TC("qpdf", "QPDF_Stream ERR shallow copy stream");
  318|      0|        throw std::runtime_error("stream objects cannot be cloned");
  319|      0|        return {}; // does not return
  320|      0|    case ::ot_operator:
  ------------------
  |  Branch (320:5): [True: 0, False: 101k]
  ------------------
  321|      0|        return QPDFObject::create<QPDF_Operator>(std::get<QPDF_Operator>(obj->value).val);
  322|      0|    case ::ot_inlineimage:
  ------------------
  |  Branch (322:5): [True: 0, False: 101k]
  ------------------
  323|      0|        return QPDFObject::create<QPDF_InlineImage>(std::get<QPDF_InlineImage>(obj->value).val);
  324|      0|    case ::ot_unresolved:
  ------------------
  |  Branch (324:5): [True: 0, False: 101k]
  ------------------
  325|      0|        throw std::logic_error("QPDFObjectHandle: attempting to unparse a reserved object");
  326|      0|        return {}; // does not return
  327|      0|    case ::ot_destroyed:
  ------------------
  |  Branch (327:5): [True: 0, False: 101k]
  ------------------
  328|      0|        throw std::logic_error("attempted to shallow copy QPDFObjectHandle from destroyed QPDF");
  329|      0|        return {}; // does not return
  330|      0|    case ::ot_reference:
  ------------------
  |  Branch (330:5): [True: 0, False: 101k]
  ------------------
  331|      0|        return referenced_object().obj_sp();
  332|   101k|    }
  333|      0|    return {}; // unreachable
  334|   101k|}
_ZN4qpdf10BaseHandle10disconnectEb:
  693|  3.39M|{
  694|       |    // QPDF::~QPDF() calls disconnect for indirect objects, so we don't do that here.
  695|  3.39M|    if (only_direct && indirect()) {
  ------------------
  |  Branch (695:9): [True: 3.10M, False: 298k]
  |  Branch (695:24): [True: 93.2k, False: 3.00M]
  ------------------
  696|  93.2k|        return;
  697|  93.2k|    }
  698|       |
  699|  3.30M|    switch (raw_type_code()) {
  700|  47.7k|    case ::ot_array:
  ------------------
  |  Branch (700:5): [True: 47.7k, False: 3.25M]
  ------------------
  701|  47.7k|        {
  702|  47.7k|            auto& a = std::get<QPDF_Array>(obj->value);
  703|  47.7k|            if (a.sp) {
  ------------------
  |  Branch (703:17): [True: 177, False: 47.5k]
  ------------------
  704|  1.35M|                for (auto& item: a.sp->elements) {
  ------------------
  |  Branch (704:32): [True: 1.35M, False: 177]
  ------------------
  705|  1.35M|                    item.second.disconnect();
  706|  1.35M|                }
  707|  47.5k|            } else {
  708|  1.40M|                for (auto& oh: a.elements) {
  ------------------
  |  Branch (708:30): [True: 1.40M, False: 47.5k]
  ------------------
  709|  1.40M|                    oh.disconnect();
  710|  1.40M|                }
  711|  47.5k|            }
  712|  47.7k|        }
  713|  47.7k|        break;
  714|  88.1k|    case ::ot_dictionary:
  ------------------
  |  Branch (714:5): [True: 88.1k, False: 3.21M]
  ------------------
  715|   322k|        for (auto& iter: std::get<QPDF_Dictionary>(obj->value).items) {
  ------------------
  |  Branch (715:24): [True: 322k, False: 88.1k]
  ------------------
  716|   322k|            iter.second.disconnect();
  717|   322k|        }
  718|  88.1k|        break;
  719|  18.1k|    case ::ot_stream:
  ------------------
  |  Branch (719:5): [True: 18.1k, False: 3.28M]
  ------------------
  720|  18.1k|        {
  721|  18.1k|            auto& s = std::get<QPDF_Stream>(obj->value);
  722|  18.1k|            s.m->stream_provider = nullptr;
  723|  18.1k|            s.m->stream_dict.disconnect();
  724|  18.1k|        }
  725|  18.1k|        break;
  726|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (726:5): [True: 0, False: 3.30M]
  ------------------
  727|      0|        return;
  728|  3.15M|    default:
  ------------------
  |  Branch (728:5): [True: 3.15M, False: 154k]
  ------------------
  729|  3.15M|        break;
  730|  3.30M|    }
  731|  3.30M|    obj->qpdf = nullptr;
  732|  3.30M|    obj->og = QPDFObjGen();
  733|  3.30M|}
_ZNK16QPDFObjectHandle14isSameObjectAsERKS_:
  737|    159|{
  738|    159|    return obj == rhs.obj;
  739|    159|}
_ZNK4qpdf10BaseHandle9type_nameEv:
  749|  5.15k|{
  750|  5.15k|    static constexpr std::array<char const*, 16> tn{
  751|  5.15k|        "uninitialized",
  752|  5.15k|        "reserved",
  753|  5.15k|        "null",
  754|  5.15k|        "boolean",
  755|  5.15k|        "integer",
  756|  5.15k|        "real",
  757|  5.15k|        "string",
  758|  5.15k|        "name",
  759|  5.15k|        "array",
  760|  5.15k|        "dictionary",
  761|  5.15k|        "stream",
  762|  5.15k|        "operator",
  763|  5.15k|        "inline-image",
  764|  5.15k|        "unresolved",
  765|  5.15k|        "destroyed",
  766|  5.15k|        "reference"};
  767|  5.15k|    return tn[type_code()];
  768|  5.15k|}
_ZNK16QPDFObjectHandle6isBoolEv:
  784|  4.86k|{
  785|  4.86k|    return type_code() == ::ot_boolean;
  786|  4.86k|}
_ZNK16QPDFObjectHandle6isNullEv:
  798|  2.19k|{
  799|  2.19k|    return type_code() == ::ot_null;
  800|  2.19k|}
_ZNK16QPDFObjectHandle9isIntegerEv:
  804|   119k|{
  805|   119k|    return type_code() == ::ot_integer;
  806|   119k|}
_ZNK16QPDFObjectHandle6isRealEv:
  810|  13.3k|{
  811|  13.3k|    return type_code() == ::ot_real;
  812|  13.3k|}
_ZNK16QPDFObjectHandle8isNumberEv:
  816|  17.5k|{
  817|  17.5k|    return (isInteger() || isReal());
  ------------------
  |  Branch (817:13): [True: 4.68k, False: 12.8k]
  |  Branch (817:28): [True: 12.7k, False: 166]
  ------------------
  818|  17.5k|}
_ZNK16QPDFObjectHandle6isNameEv:
  846|  17.7k|{
  847|  17.7k|    return type_code() == ::ot_name;
  848|  17.7k|}
_ZNK16QPDFObjectHandle8isStringEv:
  852|  11.1k|{
  853|  11.1k|    return type_code() == ::ot_string;
  854|  11.1k|}
_ZNK16QPDFObjectHandle7isArrayEv:
  870|   147k|{
  871|   147k|    return type_code() == ::ot_array;
  872|   147k|}
_ZNK16QPDFObjectHandle12isDictionaryEv:
  876|   423k|{
  877|   423k|    return type_code() == ::ot_dictionary;
  878|   423k|}
_ZNK16QPDFObjectHandle8isScalarEv:
  894|  3.89k|{
  895|  3.89k|    return isBool() || isInteger() || isName() || isNull() || isReal() || isString();
  ------------------
  |  Branch (895:12): [True: 12, False: 3.88k]
  |  Branch (895:24): [True: 200, False: 3.68k]
  |  Branch (895:39): [True: 3.20k, False: 478]
  |  Branch (895:51): [True: 0, False: 478]
  |  Branch (895:63): [True: 93, False: 385]
  |  Branch (895:75): [True: 38, False: 347]
  ------------------
  896|  3.89k|}
_ZNK16QPDFObjectHandle15isNameAndEqualsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  900|  2.69k|{
  901|  2.69k|    return Name(*this) == name;
  902|  2.69k|}
_ZNK16QPDFObjectHandle18isDictionaryOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  906|   143k|{
  907|   143k|    return isDictionary() && (type.empty() || Name((*this)["/Type"]) == type) &&
  ------------------
  |  Branch (907:12): [True: 54.4k, False: 88.6k]
  |  Branch (907:31): [True: 0, False: 54.4k]
  |  Branch (907:47): [True: 10.0k, False: 44.4k]
  ------------------
  908|  9.98k|        (subtype.empty() || Name((*this)["/Subtype"]) == subtype);
  ------------------
  |  Branch (908:10): [True: 9.92k, False: 66]
  |  Branch (908:29): [True: 23, False: 43]
  ------------------
  909|   143k|}
_ZNK16QPDFObjectHandle14isStreamOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  913|  56.2k|{
  914|  56.2k|    if (auto stream = as_stream()) {
  ------------------
  |  Branch (914:14): [True: 23.5k, False: 32.7k]
  ------------------
  915|  23.5k|        return stream && (type.empty() || stream.Type() == type) &&
  ------------------
  |  Branch (915:16): [True: 23.5k, False: 0]
  |  Branch (915:27): [True: 0, False: 23.5k]
  |  Branch (915:43): [True: 15.1k, False: 8.40k]
  ------------------
  916|  15.1k|            (subtype.empty() || stream.Subtype() == subtype);
  ------------------
  |  Branch (916:14): [True: 15.1k, False: 0]
  |  Branch (916:33): [True: 0, False: 0]
  ------------------
  917|  23.5k|    }
  918|  32.7k|    return false;
  919|  56.2k|}
_ZNK16QPDFObjectHandle12getBoolValueEv:
  925|      3|{
  926|      3|    if (auto boolean = as<QPDF_Bool>()) {
  ------------------
  |  Branch (926:14): [True: 3, False: 0]
  ------------------
  927|      3|        return boolean->val;
  928|      3|    } else {
  929|      0|        typeWarning("boolean", "returning false");
  930|      0|        QTC::TC("qpdf", "QPDFObjectHandle boolean returning false");
  931|      0|        return false;
  932|      0|    }
  933|      3|}
_ZN4qpdf7IntegerC2Ex:
  948|  1.64k|    BaseHandle(QPDFObject::create<QPDF_Integer>(value))
  949|  1.64k|{
  950|  1.64k|}
_ZNK4qpdf7Integer5valueEv:
  960|   102k|{
  961|   102k|    auto* i = as<QPDF_Integer>();
  962|   102k|    if (!i) {
  ------------------
  |  Branch (962:9): [True: 1.38k, False: 101k]
  ------------------
  963|  1.38k|        throw invalid_error("Integer");
  964|  1.38k|    }
  965|   101k|    return i->val;
  966|   102k|}
_ZNK16QPDFObjectHandle11getIntValueEv:
  970|  24.2k|{
  971|  24.2k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (971:20): [True: 24.2k, False: 0]
  ------------------
  972|  24.2k|        return integer;
  973|  24.2k|    } else {
  974|      0|        typeWarning("integer", "returning 0");
  975|      0|        return 0;
  976|      0|    }
  977|  24.2k|}
_ZNK16QPDFObjectHandle13getValueAsIntERx:
  981|  7.99k|{
  982|  7.99k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (982:20): [True: 7.96k, False: 29]
  ------------------
  983|  7.96k|        value = integer;
  984|  7.96k|        return true;
  985|  7.96k|    }
  986|     29|    return false;
  987|  7.99k|}
_ZNK16QPDFObjectHandle16getIntValueAsIntEv:
  991|  46.1k|{
  992|  46.1k|    try {
  993|  46.1k|        return Integer(*this).value<int>();
  994|  46.1k|    } catch (std::invalid_argument&) {
  995|     26|        typeWarning("integer", "returning 0");
  996|     26|        return 0;
  997|     26|    }
  998|  46.1k|}
_ZNK16QPDFObjectHandle13getValueAsIntERi:
 1002|  2.40k|{
 1003|  2.40k|    if (!isInteger()) {
  ------------------
  |  Branch (1003:9): [True: 49, False: 2.35k]
  ------------------
 1004|     49|        return false;
 1005|     49|    }
 1006|  2.35k|    value = getIntValueAsInt();
 1007|  2.35k|    return true;
 1008|  2.40k|}
_ZNK16QPDFObjectHandle12getUIntValueEv:
 1012|  15.3k|{
 1013|  15.3k|    try {
 1014|  15.3k|        return Integer(*this).value<unsigned long long>();
 1015|  15.3k|    } catch (std::invalid_argument&) {
 1016|  1.00k|        typeWarning("integer", "returning 0");
 1017|  1.00k|        return 0;
 1018|  1.00k|    }
 1019|  15.3k|}
_ZNK16QPDFObjectHandle18getUIntValueAsUIntEv:
 1033|  9.13k|{
 1034|  9.13k|    try {
 1035|  9.13k|        return Integer(*this).value<unsigned int>();
 1036|  9.13k|    } catch (std::invalid_argument&) {
 1037|    355|        typeWarning("integer", "returning 0");
 1038|    355|        return 0;
 1039|    355|    }
 1040|  9.13k|}
_ZNK16QPDFObjectHandle14getValueAsUIntERj:
 1044|  2.76k|{
 1045|  2.76k|    if (!isInteger()) {
  ------------------
  |  Branch (1045:9): [True: 350, False: 2.41k]
  ------------------
 1046|    350|        return false;
 1047|    350|    }
 1048|  2.41k|    value = getUIntValueAsUInt();
 1049|  2.41k|    return true;
 1050|  2.76k|}
_ZN4qpdf4NameC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1088|  11.4k|    BaseHandle(QPDFObject::create<QPDF_Name>(std::move(name)))
 1089|  11.4k|{
 1090|  11.4k|}
_ZNK4qpdf4Name5valueEv:
 1094|  68.2k|{
 1095|  68.2k|    auto* n = as<QPDF_Name>();
 1096|  68.2k|    if (!n) {
  ------------------
  |  Branch (1096:9): [True: 0, False: 68.2k]
  ------------------
 1097|      0|        throw invalid_error("Name");
 1098|      0|    }
 1099|  68.2k|    return n->name;
 1100|  68.2k|}
_ZNK16QPDFObjectHandle7getNameEv:
 1104|  5.76k|{
 1105|  5.76k|    if (auto* name = as<QPDF_Name>()) {
  ------------------
  |  Branch (1105:15): [True: 5.76k, False: 0]
  ------------------
 1106|  5.76k|        return name->name;
 1107|  5.76k|    }
 1108|      0|    typeWarning("name", "returning dummy name");
 1109|      0|    return "/QPDFFakeName";
 1110|  5.76k|}
_ZN16QPDFObjectHandle9newStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1126|     31|{
 1127|     31|    return {QPDFObject::create<QPDF_String>(str)};
 1128|     31|}
_ZN16QPDFObjectHandle16newUnicodeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1132|  2.78k|{
 1133|  2.78k|    return {String::utf16(utf8_str).obj_sp()};
 1134|  2.78k|}
_ZN4qpdf6StringC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1137|  2.14k|    BaseHandle(QPDFObject::create<QPDF_String>(str))
 1138|  2.14k|{
 1139|  2.14k|}
_ZN4qpdf6StringC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1142|    636|    BaseHandle(QPDFObject::create<QPDF_String>(std::move(str)))
 1143|    636|{
 1144|    636|}
_ZN4qpdf6String5utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1148|  2.78k|{
 1149|  2.78k|    std::string result;
 1150|  2.78k|    if (QUtil::utf8_to_pdf_doc(utf8_str, result, '?')) {
  ------------------
  |  Branch (1150:9): [True: 2.14k, False: 636]
  ------------------
 1151|  2.14k|        return String(result);
 1152|  2.14k|    }
 1153|    636|    return String(QUtil::utf8_to_utf16(utf8_str));
 1154|  2.78k|}
_ZNK4qpdf6String5valueEv:
 1158|  3.74k|{
 1159|  3.74k|    auto* s = as<QPDF_String>();
 1160|  3.74k|    if (!s) {
  ------------------
  |  Branch (1160:9): [True: 0, False: 3.74k]
  ------------------
 1161|      0|        throw invalid_error("String");
 1162|      0|    }
 1163|  3.74k|    return s->val;
 1164|  3.74k|}
_ZNK4qpdf6String10utf8_valueEv:
 1168|   739k|{
 1169|   739k|    auto* s = as<QPDF_String>();
 1170|   739k|    if (!s) {
  ------------------
  |  Branch (1170:9): [True: 0, False: 739k]
  ------------------
 1171|      0|        throw invalid_error("String");
 1172|      0|    }
 1173|   739k|    if (util::is_utf16(s->val)) {
  ------------------
  |  Branch (1173:9): [True: 48.5k, False: 690k]
  ------------------
 1174|  48.5k|        return QUtil::utf16_to_utf8(s->val);
 1175|  48.5k|    }
 1176|   690k|    if (util::is_explicit_utf8(s->val)) {
  ------------------
  |  Branch (1176:9): [True: 4.93k, False: 685k]
  ------------------
 1177|       |        // PDF 2.0 allows UTF-8 strings when explicitly prefixed with the three-byte representation
 1178|       |        // of U+FEFF.
 1179|  4.93k|        return s->val.substr(3);
 1180|  4.93k|    }
 1181|   685k|    return QUtil::pdf_doc_to_utf8(s->val);
 1182|   690k|}
_ZNK16QPDFObjectHandle14getStringValueEv:
 1186|  3.74k|{
 1187|  3.74k|    try {
 1188|  3.74k|        return String(obj).value();
 1189|  3.74k|    } catch (std::invalid_argument&) {
 1190|      0|        typeWarning("string", "returning empty string");
 1191|      0|        return {};
 1192|      0|    }
 1193|  3.74k|}
_ZNK16QPDFObjectHandle12getUTF8ValueEv:
 1208|   739k|{
 1209|   739k|    try {
 1210|   739k|        return String(obj).utf8_value();
 1211|   739k|    } catch (std::invalid_argument&) {
 1212|      0|        typeWarning("string", "returning empty string");
 1213|      0|        return {};
 1214|      0|    }
 1215|   739k|}
_ZNK16QPDFObjectHandle11isOrHasNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1290|    555|{
 1291|    555|    if (isNameAndEquals(value)) {
  ------------------
  |  Branch (1291:9): [True: 1, False: 554]
  ------------------
 1292|      1|        return true;
 1293|    554|    } else if (isArray()) {
  ------------------
  |  Branch (1293:16): [True: 73, False: 481]
  ------------------
 1294|  1.96k|        for (auto& item: getArrayAsVector()) {
  ------------------
  |  Branch (1294:24): [True: 1.96k, False: 44]
  ------------------
 1295|  1.96k|            if (item.isNameAndEquals(value)) {
  ------------------
  |  Branch (1295:17): [True: 29, False: 1.93k]
  ------------------
 1296|     29|                return true;
 1297|     29|            }
 1298|  1.96k|        }
 1299|     73|    }
 1300|    525|    return false;
 1301|    555|}
_ZN16QPDFObjectHandle7newNullEv:
 1896|  17.9k|{
 1897|  17.9k|    return {QPDFObject::create<QPDF_Null>()};
 1898|  17.9k|}
_ZN16QPDFObjectHandle7newRealEdib:
 1908|  16.4k|{
 1909|  16.4k|    return {QPDFObject::create<QPDF_Real>(value, decimal_places, trim_trailing_zeroes)};
 1910|  16.4k|}
_ZN16QPDFObjectHandle8newArrayERKNSt3__16vectorIS_NS0_9allocatorIS_EEEE:
 1932|  4.12k|{
 1933|  4.12k|    return {QPDFObject::create<QPDF_Array>(items)};
 1934|  4.12k|}
_ZN16QPDFObjectHandle8newArrayERKNS_9RectangleE:
 1938|  4.12k|{
 1939|  4.12k|    return newArray({newReal(rect.llx), newReal(rect.lly), newReal(rect.urx), newReal(rect.ury)});
 1940|  4.12k|}
_ZN16QPDFObjectHandle13newDictionaryEv:
 1986|  5.37k|{
 1987|  5.37k|    return newDictionary(std::map<std::string, QPDFObjectHandle>());
 1988|  5.37k|}
_ZN16QPDFObjectHandle13newDictionaryERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S_EEEEEE:
 1992|  5.37k|{
 1993|  5.37k|    return {QPDFObject::create<QPDF_Dictionary>(items)};
 1994|  5.37k|}
_ZNK4qpdf10BaseHandle11descriptionEv:
 2037|  52.9k|{
 2038|  52.9k|    return obj ? obj->getDescription() : ""s;
  ------------------
  |  Branch (2038:12): [True: 52.9k, False: 0]
  ------------------
 2039|  52.9k|}
_ZNK16QPDFObjectHandle20hasObjectDescriptionEv:
 2052|  25.6k|{
 2053|  25.6k|    return obj && obj->hasDescription();
  ------------------
  |  Branch (2053:12): [True: 25.6k, False: 0]
  |  Branch (2053:19): [True: 25.6k, False: 0]
  ------------------
 2054|  25.6k|}
_ZN16QPDFObjectHandle11shallowCopyEv:
 2058|    171|{
 2059|    171|    if (!obj) {
  ------------------
  |  Branch (2059:9): [True: 0, False: 171]
  ------------------
 2060|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2061|      0|    }
 2062|    171|    return {copy()};
 2063|    171|}
_ZNK4qpdf10BaseHandle13invalid_errorERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2138|  1.38k|{
 2139|  1.38k|    return std::invalid_argument(method + " operation attempted on invalid object");
 2140|  1.38k|}
_ZNK4qpdf10BaseHandle10type_errorEPKcRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 2150|  5.15k|{
 2151|  5.15k|    return {
 2152|  5.15k|        qpdf_e_object,
 2153|  5.15k|        "",
 2154|  5.15k|        description(),
 2155|  5.15k|        0,
 2156|  5.15k|        "operation for "s + expected_type + " attempted on object of type " + type_name() + ": " +
 2157|  5.15k|            message};
 2158|  5.15k|}
_ZNK16QPDFObjectHandle11typeWarningEPKcRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2162|  5.15k|{
 2163|  5.15k|    if (!obj) {
  ------------------
  |  Branch (2163:9): [True: 0, False: 5.15k]
  ------------------
 2164|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 2165|      0|    }
 2166|  5.15k|    warn(type_error(expected_type, message));
 2167|  5.15k|}
_ZNK4qpdf10BaseHandle4warnEO7QPDFExc:
 2339|  52.9k|{
 2340|  52.9k|    if (!qpdf()) {
  ------------------
  |  Branch (2340:9): [True: 298, False: 52.6k]
  ------------------
 2341|    298|        throw std::move(e);
 2342|    298|    }
 2343|  52.6k|    qpdf()->warn(std::move(e));
 2344|  52.6k|}
_ZNK4qpdf10BaseHandle4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2348|  55.9k|{
 2349|  55.9k|    if (qpdf()) {
  ------------------
  |  Branch (2349:9): [True: 47.7k, False: 8.19k]
  ------------------
 2350|  47.7k|        warn({qpdf_e_damaged_pdf, "", description(), 0, warning});
 2351|  47.7k|    } else {
 2352|  8.19k|        *QPDFLogger::defaultLogger()->getError() << warning << "\n";
 2353|  8.19k|    }
 2354|  55.9k|}
_ZNK16QPDFObjectHandle9getObjGenEv:
 2523|  34.3k|{
 2524|  34.3k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (2524:12): [True: 34.3k, False: 0]
  ------------------
 2525|  34.3k|}
_ZNK16QPDFObjectHandle11getObjectIDEv:
 2529|  23.6k|{
 2530|  23.6k|    return getObjGen().getObj();
 2531|  23.6k|}
_ZNK16QPDFObjectHandle10isIndirectEv:
 2541|  18.5k|{
 2542|  18.5k|    return getObjectID() != 0;
 2543|  18.5k|}
_ZNK16QPDFObjectHandle13getOwningQPDFEv:
 2548|  57.8k|{
 2549|  57.8k|    return obj ? obj->getQPDF() : nullptr;
  ------------------
  |  Branch (2549:12): [True: 57.8k, False: 0]
  ------------------
 2550|  57.8k|}
_ZN16QPDFObjectHandle15setParsedOffsetEx:
 2563|     31|{
 2564|     31|    if (obj) {
  ------------------
  |  Branch (2564:9): [True: 31, False: 0]
  ------------------
 2565|     31|        obj->setParsedOffset(offset);
 2566|     31|    }
 2567|     31|}

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

_ZN25QPDFOutlineDocumentHelper8Accessor9checkSeenERS_10QPDFObjGen:
   23|  7.70k|{
   24|  7.70k|    return !dh.m->seen.add(og);
   25|  7.70k|}
_ZN25QPDFOutlineDocumentHelperC2ER4QPDF:
   28|  1.75k|    QPDFDocumentHelper(qpdf),
   29|  1.75k|    m(std::make_shared<Members>())
   30|  1.75k|{
   31|  1.75k|    validate();
   32|  1.75k|}
_ZN25QPDFOutlineDocumentHelper3getER4QPDF:
   36|  1.75k|{
   37|  1.75k|    return qpdf.doc().outlines();
   38|  1.75k|}
_ZN25QPDFOutlineDocumentHelper8validateEb:
   42|  1.75k|{
   43|  1.75k|    m->outlines.clear();
   44|  1.75k|    m->names_dest = nullptr;
   45|       |
   46|  1.75k|    QPDFObjectHandle root = qpdf.getRoot();
   47|  1.75k|    if (!root.hasKey("/Outlines")) {
  ------------------
  |  Branch (47:9): [True: 245, False: 1.51k]
  ------------------
   48|    245|        return;
   49|    245|    }
   50|  1.51k|    auto outlines = root.getKey("/Outlines");
   51|  1.51k|    if (!(outlines.isDictionary() && outlines.hasKey("/First"))) {
  ------------------
  |  Branch (51:9): [True: 19, False: 1.49k]
  |  Branch (51:11): [True: 1.50k, False: 3]
  |  Branch (51:38): [True: 1.49k, False: 16]
  ------------------
   52|     19|        return;
   53|     19|    }
   54|  1.49k|    QPDFObjectHandle cur = outlines.getKey("/First");
   55|  1.49k|    QPDFObjGen::set seen;
   56|  3.83k|    while (!cur.null()) {
  ------------------
  |  Branch (56:12): [True: 2.41k, False: 1.41k]
  ------------------
   57|  2.41k|        if (!seen.add(cur)) {
  ------------------
  |  Branch (57:13): [True: 74, False: 2.34k]
  ------------------
   58|     74|            cur.warn("Loop detected loop in /Outlines tree");
   59|     74|            return;
   60|     74|        }
   61|  2.34k|        m->outlines.emplace_back(QPDFOutlineObjectHelper::Accessor::create(cur, *this, 1));
   62|  2.34k|        cur = cur.getKey("/Next");
   63|  2.34k|    }
   64|  1.49k|}
_ZN25QPDFOutlineDocumentHelper19getTopLevelOutlinesEv:
   74|  1.75k|{
   75|  1.75k|    return m->outlines;
   76|  1.75k|}
_ZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandle:
  107|  3.39k|{
  108|  3.39k|    QPDFObjectHandle result;
  109|  3.39k|    if (name.isName()) {
  ------------------
  |  Branch (109:9): [True: 233, False: 3.16k]
  ------------------
  110|    233|        if (!m->dest_dict) {
  ------------------
  |  Branch (110:13): [True: 86, False: 147]
  ------------------
  111|     86|            m->dest_dict = qpdf.getRoot().getKey("/Dests");
  112|     86|        }
  113|    233|        result = m->dest_dict.getKeyIfDict(name.getName());
  114|  3.16k|    } else if (name.isString()) {
  ------------------
  |  Branch (114:16): [True: 3.16k, False: 0]
  ------------------
  115|  3.16k|        if (!m->names_dest) {
  ------------------
  |  Branch (115:13): [True: 1.47k, False: 1.68k]
  ------------------
  116|  1.47k|            auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests");
  117|  1.47k|            if (dests.isDictionary()) {
  ------------------
  |  Branch (117:17): [True: 1.24k, False: 233]
  ------------------
  118|  1.24k|                m->names_dest = std::make_unique<QPDFNameTreeObjectHelper>(
  119|  1.24k|                    dests,
  120|  1.24k|                    qpdf,
  121|  1.24k|                    [](QPDFObjectHandle const& o) -> bool {
  122|  1.24k|                        return o.isArray() || o.contains("/D");
  123|  1.24k|                    },
  124|  1.24k|                    true);
  125|  1.24k|                m->names_dest->validate();
  126|  1.24k|            }
  127|  1.47k|        }
  128|  3.16k|        if (m->names_dest) {
  ------------------
  |  Branch (128:13): [True: 2.78k, False: 381]
  ------------------
  129|  2.78k|            if (m->names_dest->findObject(name.getUTF8Value(), result)) {
  ------------------
  |  Branch (129:17): [True: 524, False: 2.25k]
  ------------------
  130|    524|                QTC::TC("qpdf", "QPDFOutlineDocumentHelper string named dest");
  131|    524|            }
  132|  2.78k|        }
  133|  3.16k|    }
  134|  3.39k|    if (!result) {
  ------------------
  |  Branch (134:9): [True: 2.45k, False: 941]
  ------------------
  135|  2.45k|        return QPDFObjectHandle::newNull();
  136|  2.45k|    }
  137|    941|    if (result.isDictionary()) {
  ------------------
  |  Branch (137:9): [True: 298, False: 643]
  ------------------
  138|    298|        return result.getKey("/D");
  139|    298|    }
  140|    643|    return result;
  141|    941|}
_ZN25QPDFOutlineDocumentHelper7MembersC2Ev:
   10|  1.75k|    Members() = default;
_ZN25QPDFOutlineDocumentHelper7MembersD2Ev:
   12|  1.75k|    ~Members() = default;
QPDFOutlineDocumentHelper.cc:_ZZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandleENK3$_0clERKS0_:
  121|   137k|                    [](QPDFObjectHandle const& o) -> bool {
  122|   137k|                        return o.isArray() || o.contains("/D");
  ------------------
  |  Branch (122:32): [True: 132k, False: 4.92k]
  |  Branch (122:47): [True: 3.72k, False: 1.19k]
  ------------------
  123|   137k|                    },

_ZN23QPDFOutlineObjectHelper7MembersC2ER25QPDFOutlineDocumentHelper:
    8|  7.70k|    dh(dh)
    9|  7.70k|{
   10|  7.70k|}
_ZN23QPDFOutlineObjectHelperC2E16QPDFObjectHandleR25QPDFOutlineDocumentHelperi:
   14|  7.70k|    QPDFObjectHelper(a_oh),
   15|  7.70k|    m(new Members(dh))
   16|  7.70k|{
   17|  7.70k|    if (depth > 50) {
  ------------------
  |  Branch (17:9): [True: 0, False: 7.70k]
  ------------------
   18|       |        // Not exercised in test suite, but was tested manually by temporarily changing max depth
   19|       |        // to 1.
   20|      0|        return;
   21|      0|    }
   22|  7.70k|    if (QPDFOutlineDocumentHelper::Accessor::checkSeen(m->dh, a_oh.getObjGen())) {
  ------------------
  |  Branch (22:9): [True: 4.35k, False: 3.34k]
  ------------------
   23|  4.35k|        a_oh.warn("Loop detected loop in /Outlines tree");
   24|  4.35k|        return;
   25|  4.35k|    }
   26|       |
   27|  3.34k|    QPDFObjGen::set children;
   28|  3.34k|    QPDFObjectHandle cur = a_oh.getKey("/First");
   29|  8.70k|    while (!cur.null() && cur.isIndirect()) {
  ------------------
  |  Branch (29:12): [True: 5.75k, False: 2.95k]
  |  Branch (29:27): [True: 5.66k, False: 90]
  ------------------
   30|  5.66k|        if (!children.add(cur)) {
  ------------------
  |  Branch (30:13): [True: 303, False: 5.36k]
  ------------------
   31|    303|            cur.warn("Loop detected loop in /Outlines tree");
   32|    303|            break;
   33|    303|        }
   34|  5.36k|        QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth);
   35|  5.36k|        new_ooh.m->parent = std::make_shared<QPDFOutlineObjectHelper>(*this);
   36|  5.36k|        m->kids.emplace_back(new_ooh);
   37|  5.36k|        cur = cur.getKey("/Next");
   38|  5.36k|    }
   39|  3.34k|}
_ZN23QPDFOutlineObjectHelper7getKidsEv:
   49|  7.43k|{
   50|  7.43k|    return m->kids;
   51|  7.43k|}
_ZN23QPDFOutlineObjectHelper7getDestEv:
   55|  7.61k|{
   56|  7.61k|    auto dest = get("/Dest");
   57|  7.61k|    if (dest.null()) {
  ------------------
  |  Branch (57:9): [True: 6.51k, False: 1.09k]
  ------------------
   58|  6.51k|        auto const& A = get("/A");
   59|  6.51k|        if (Name(A["/S"]) == "/GoTo") {
  ------------------
  |  Branch (59:13): [True: 2.95k, False: 3.56k]
  ------------------
   60|  2.95k|            dest = A["/D"];
   61|  2.95k|        }
   62|  6.51k|    }
   63|  7.61k|    if (dest.null()) {
  ------------------
  |  Branch (63:9): [True: 3.60k, False: 4.00k]
  ------------------
   64|  3.60k|        return QPDFObjectHandle::newNull();
   65|  3.60k|    }
   66|  4.00k|    if (dest.isName() || dest.isString()) {
  ------------------
  |  Branch (66:9): [True: 233, False: 3.77k]
  |  Branch (66:26): [True: 3.16k, False: 609]
  ------------------
   67|  3.39k|        return m->dh.resolveNamedDest(dest);
   68|  3.39k|    }
   69|    609|    return dest;
   70|  4.00k|}
_ZN23QPDFOutlineObjectHelper11getDestPageEv:
   74|  7.61k|{
   75|  7.61k|    QPDFObjectHandle dest = getDest();
   76|  7.61k|    if (!dest.empty() && dest.isArray()) {
  ------------------
  |  Branch (76:9): [True: 1.13k, False: 6.48k]
  |  Branch (76:26): [True: 755, False: 377]
  ------------------
   77|    755|        return dest.getArrayItem(0);
   78|    755|    }
   79|  6.85k|    return QPDFObjectHandle::newNull();
   80|  7.61k|}

_ZN4qpdf4impl6Parser5parseER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERNS_9TokenizerEPN16QPDFObjectHandle15StringDecrypterER4QPDFb:
  129|   102k|{
  130|   102k|    return Parser(
  131|   102k|               input,
  132|   102k|               make_description(input.getName(), object_description),
  133|   102k|               object_description,
  134|   102k|               tokenizer,
  135|   102k|               decrypter,
  136|   102k|               &context,
  137|   102k|               true,
  138|   102k|               0,
  139|   102k|               0,
  140|   102k|               sanity_checks)
  141|   102k|        .parse();
  142|   102k|}
_ZN4qpdf4impl6Parser5parseERNS_2is12OffsetBufferEiiRNS_9TokenizerER4QPDF:
  147|  22.6k|{
  148|  22.6k|    return Parser(
  149|  22.6k|               input,
  150|  22.6k|               std::make_shared<QPDFObject::Description>(
  151|  22.6k|                   QPDFObject::ObjStreamDescr(stream_id, obj_id)),
  152|  22.6k|               "",
  153|  22.6k|               tokenizer,
  154|  22.6k|               nullptr,
  155|  22.6k|               &context,
  156|  22.6k|               true,
  157|  22.6k|               stream_id,
  158|  22.6k|               obj_id)
  159|  22.6k|        .parse();
  160|  22.6k|}
_ZN4qpdf4impl6Parser5parseEb:
  164|   125k|{
  165|   125k|    try {
  166|   125k|        return parse_first(content_stream);
  167|   125k|    } catch (Error&) {
  168|  7.62k|        return {};
  169|  7.62k|    } catch (QPDFExc& e) {
  170|  4.42k|        throw e;
  171|  4.42k|    } catch (std::logic_error& e) {
  172|      1|        throw e;
  173|  1.34k|    } catch (std::exception& e) {
  174|  1.34k|        warn("treating object as null because of error during parsing: "s + e.what());
  175|  1.34k|        return {};
  176|  1.34k|    }
  177|   125k|}
_ZN4qpdf4impl6Parser11parse_firstEb:
  181|   125k|{
  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|   125k|    QPDF::Doc::ParseGuard pg(context_);
  188|   125k|    start_ = input_.tell();
  189|   125k|    if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (189:9): [True: 1.48k, False: 123k]
  ------------------
  190|  1.48k|        warn(tokenizer_.getErrorMessage());
  191|  1.48k|    }
  192|       |
  193|   125k|    switch (tokenizer_.getType()) {
  194|    345|    case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (194:5): [True: 345, False: 124k]
  ------------------
  195|    345|        if (content_stream) {
  ------------------
  |  Branch (195:13): [True: 0, False: 345]
  ------------------
  196|       |            // In content stream mode, leave object uninitialized to indicate EOF
  197|      0|            empty_ = true;
  198|      0|            return {};
  199|      0|        }
  200|    345|        warn("unexpected EOF");
  201|    345|        return {};
  202|       |
  203|  1.33k|    case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (203:5): [True: 1.33k, False: 123k]
  ------------------
  204|  1.33k|        return {};
  205|       |
  206|    351|    case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (206:5): [True: 351, False: 124k]
  ------------------
  207|    454|    case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (207:5): [True: 103, False: 125k]
  ------------------
  208|    454|        warn("treating unexpected brace token as null");
  209|    454|        return {};
  210|       |
  211|    381|    case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (211:5): [True: 381, False: 124k]
  ------------------
  212|    381|        warn("treating unexpected array close token as null");
  213|    381|        return {};
  214|       |
  215|    314|    case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (215:5): [True: 314, False: 124k]
  ------------------
  216|    314|        warn("unexpected dictionary close token");
  217|    314|        return {};
  218|       |
  219|  10.0k|    case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (219:5): [True: 10.0k, False: 115k]
  ------------------
  220|   101k|    case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (220:5): [True: 91.7k, False: 33.4k]
  ------------------
  221|   101k|        stack_.clear();
  222|   101k|        stack_.emplace_back(
  223|   101k|            input_,
  224|   101k|            (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array : st_dictionary_key);
  ------------------
  |  Branch (224:13): [True: 10.0k, False: 91.7k]
  ------------------
  225|   101k|        frame_ = &stack_.back();
  226|   101k|        return parse_remainder(content_stream);
  227|       |
  228|    315|    case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (228:5): [True: 315, False: 124k]
  ------------------
  229|    315|        return with_description<QPDF_Bool>(tokenizer_.getValue() == "true");
  230|       |
  231|    119|    case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (231:5): [True: 119, False: 125k]
  ------------------
  232|    119|        return {QPDFObject::create<QPDF_Null>()};
  233|       |
  234|  9.07k|    case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (234:5): [True: 9.07k, False: 116k]
  ------------------
  235|  9.07k|        return with_description<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  236|       |
  237|  1.20k|    case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (237:5): [True: 1.20k, False: 124k]
  ------------------
  238|  1.20k|        return with_description<QPDF_Real>(tokenizer_.getValue());
  239|       |
  240|  1.67k|    case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (240:5): [True: 1.67k, False: 123k]
  ------------------
  241|  1.67k|        return with_description<QPDF_Name>(tokenizer_.getValue());
  242|       |
  243|  7.57k|    case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (243:5): [True: 7.57k, False: 117k]
  ------------------
  244|  7.57k|        {
  245|  7.57k|            auto const& value = tokenizer_.getValue();
  246|  7.57k|            if (content_stream) {
  ------------------
  |  Branch (246:17): [True: 0, False: 7.57k]
  ------------------
  247|      0|                return with_description<QPDF_Operator>(value);
  248|  7.57k|            } else if (value == "endobj") {
  ------------------
  |  Branch (248:24): [True: 216, False: 7.36k]
  ------------------
  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|    216|                empty_ = true;
  254|    216|                input_.seek(input_.getLastOffset(), SEEK_SET);
  255|    216|                if (!content_stream) {
  ------------------
  |  Branch (255:21): [True: 216, False: 0]
  ------------------
  256|    216|                    warn("empty object treated as null");
  257|    216|                }
  258|    216|                return {};
  259|  7.36k|            } else {
  260|  7.36k|                warn("unknown token while reading object; treating as string");
  261|  7.36k|                return with_description<QPDF_String>(value);
  262|  7.36k|            }
  263|  7.57k|        }
  264|       |
  265|    510|    case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (265:5): [True: 510, False: 124k]
  ------------------
  266|    510|        if (decrypter_) {
  ------------------
  |  Branch (266:13): [True: 92, False: 418]
  ------------------
  267|     92|            std::string s{tokenizer_.getValue()};
  268|     92|            decrypter_->decryptString(s);
  269|     92|            return with_description<QPDF_String>(s);
  270|    418|        } else {
  271|    418|            return with_description<QPDF_String>(tokenizer_.getValue());
  272|    418|        }
  273|       |
  274|      0|    default:
  ------------------
  |  Branch (274:5): [True: 0, False: 125k]
  ------------------
  275|      0|        warn("treating unknown token type as null while reading object");
  276|      0|        return {};
  277|   125k|    }
  278|   125k|}
_ZN4qpdf4impl6Parser15parse_remainderEb:
  282|   101k|{
  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|   101k|    bad_count_ = 0;
  289|   101k|    bool b_contents = false;
  290|       |
  291|  15.2M|    while (true) {
  ------------------
  |  Branch (291:12): [True: 15.2M, Folded]
  ------------------
  292|  15.2M|        if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (292:13): [True: 34.6k, False: 15.1M]
  ------------------
  293|  34.6k|            warn(tokenizer_.getErrorMessage());
  294|  34.6k|        }
  295|  15.2M|        ++good_count_; // optimistically
  296|       |
  297|  15.2M|        if (int_count_ != 0) {
  ------------------
  |  Branch (297:13): [True: 5.86M, False: 9.36M]
  ------------------
  298|       |            // Special handling of indirect references. Treat integer tokens as part of an indirect
  299|       |            // reference until proven otherwise.
  300|  5.86M|            if (tokenizer_.getType() == QPDFTokenizer::tt_integer) {
  ------------------
  |  Branch (300:17): [True: 5.43M, False: 431k]
  ------------------
  301|  5.43M|                if (++int_count_ > 2) {
  ------------------
  |  Branch (301:21): [True: 5.12M, False: 310k]
  ------------------
  302|       |                    // Process the oldest buffered integer.
  303|  5.12M|                    add_int(int_count_);
  304|  5.12M|                }
  305|  5.43M|                last_offset_buffer_[int_count_ % 2] = input_.getLastOffset();
  306|  5.43M|                int_buffer_[int_count_ % 2] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  307|  5.43M|                continue;
  308|       |
  309|  5.43M|            } else if (
  310|   431k|                int_count_ >= 2 && tokenizer_.getType() == QPDFTokenizer::tt_word &&
  ------------------
  |  Branch (310:17): [True: 310k, False: 120k]
  |  Branch (310:36): [True: 275k, False: 35.1k]
  ------------------
  311|   275k|                tokenizer_.getValue() == "R") {
  ------------------
  |  Branch (311:17): [True: 260k, False: 15.1k]
  ------------------
  312|   260k|                if (!context_) {
  ------------------
  |  Branch (312:21): [True: 0, False: 260k]
  ------------------
  313|      0|                    throw std::logic_error(
  314|      0|                        "Parser::parse called without context on an object with indirect "
  315|      0|                        "references");
  316|      0|                }
  317|   260k|                auto id = QIntC::to_int(int_buffer_[(int_count_ - 1) % 2]);
  318|   260k|                auto gen = QIntC::to_int(int_buffer_[(int_count_) % 2]);
  319|   260k|                if (!(id < 1 || gen < 0 || gen >= 65535)) {
  ------------------
  |  Branch (319:23): [True: 2.09k, False: 257k]
  |  Branch (319:33): [True: 280, False: 257k]
  |  Branch (319:44): [True: 378, False: 257k]
  ------------------
  320|   257k|                    add(ParseGuard::getObject(context_, id, gen, parse_pdf_));
  321|   257k|                } else {
  322|  2.75k|                    add_bad_null(
  323|  2.75k|                        "treating bad indirect reference (" + std::to_string(id) + " " +
  324|  2.75k|                        std::to_string(gen) + " R) as null");
  325|  2.75k|                }
  326|   260k|                int_count_ = 0;
  327|   260k|                continue;
  328|       |
  329|   260k|            } else if (int_count_ > 0) {
  ------------------
  |  Branch (329:24): [True: 171k, False: 0]
  ------------------
  330|       |                // Process the buffered integers before processing the current token.
  331|   171k|                if (int_count_ > 1) {
  ------------------
  |  Branch (331:21): [True: 50.3k, False: 120k]
  ------------------
  332|  50.3k|                    add_int(int_count_ - 1);
  333|  50.3k|                }
  334|   171k|                add_int(int_count_);
  335|   171k|                int_count_ = 0;
  336|   171k|            }
  337|  5.86M|        }
  338|       |
  339|  9.53M|        switch (tokenizer_.getType()) {
  340|  7.08k|        case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (340:9): [True: 7.08k, False: 9.52M]
  ------------------
  341|  7.08k|            warn("parse error while reading object");
  342|  7.08k|            if (content_stream) {
  ------------------
  |  Branch (342:17): [True: 0, False: 7.08k]
  ------------------
  343|       |                // In content stream mode, leave object uninitialized to indicate EOF
  344|      0|                return {};
  345|      0|            }
  346|  7.08k|            warn("unexpected EOF");
  347|  7.08k|            return {};
  348|       |
  349|  27.4k|        case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (349:9): [True: 27.4k, False: 9.50M]
  ------------------
  350|  27.4k|            check_too_many_bad_tokens();
  351|  27.4k|            add_null();
  352|  27.4k|            continue;
  353|       |
  354|  1.68k|        case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (354:9): [True: 1.68k, False: 9.53M]
  ------------------
  355|  3.83k|        case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (355:9): [True: 2.14k, False: 9.53M]
  ------------------
  356|  3.83k|            add_bad_null("treating unexpected brace token as null");
  357|  3.83k|            continue;
  358|       |
  359|  64.7k|        case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (359:9): [True: 64.7k, False: 9.46M]
  ------------------
  360|  64.7k|            if (frame_->state == st_array) {
  ------------------
  |  Branch (360:17): [True: 62.6k, False: 2.09k]
  ------------------
  361|  62.6k|                auto object = frame_->null_count > 100
  ------------------
  |  Branch (361:31): [True: 556, False: 62.1k]
  ------------------
  362|  62.6k|                    ? QPDFObject::create<QPDF_Array>(std::move(frame_->olist), true)
  363|  62.6k|                    : QPDFObject::create<QPDF_Array>(std::move(frame_->olist));
  364|  62.6k|                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|  62.6k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (369:21): [True: 1.84k, False: 60.8k]
  ------------------
  370|  1.84k|                    return object;
  371|  1.84k|                }
  372|  60.8k|                stack_.pop_back();
  373|  60.8k|                frame_ = &stack_.back();
  374|  60.8k|                add(std::move(object));
  375|  60.8k|            } else {
  376|  2.09k|                if (sanity_checks_) {
  ------------------
  |  Branch (376:21): [True: 1.44k, False: 648]
  ------------------
  377|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  378|       |                    // unusable.
  379|  1.44k|                    warn("unexpected array close token; giving up on reading object");
  380|  1.44k|                    return {};
  381|  1.44k|                }
  382|    648|                add_bad_null("treating unexpected array close token as null");
  383|    648|            }
  384|  61.4k|            continue;
  385|       |
  386|   121k|        case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (386:9): [True: 121k, False: 9.41M]
  ------------------
  387|   121k|            if (frame_->state <= st_dictionary_value) {
  ------------------
  |  Branch (387:17): [True: 120k, False: 1.12k]
  ------------------
  388|       |                // Attempt to recover more or less gracefully from invalid dictionaries.
  389|   120k|                auto& dict = frame_->dict;
  390|       |
  391|   120k|                if (frame_->state == st_dictionary_value) {
  ------------------
  |  Branch (391:21): [True: 8.98k, False: 111k]
  ------------------
  392|  8.98k|                    warn(
  393|  8.98k|                        frame_->offset,
  394|  8.98k|                        "dictionary ended prematurely; using null as value for last key");
  395|  8.98k|                    dict[frame_->key] = QPDFObject::create<QPDF_Null>();
  396|  8.98k|                }
  397|   120k|                if (!frame_->olist.empty()) {
  ------------------
  |  Branch (397:21): [True: 34.0k, False: 86.4k]
  ------------------
  398|  34.0k|                    if (sanity_checks_) {
  ------------------
  |  Branch (398:25): [True: 31.1k, False: 2.94k]
  ------------------
  399|  31.1k|                        warn(
  400|  31.1k|                            frame_->offset,
  401|  31.1k|                            "expected dictionary keys but found non-name objects; ignoring");
  402|  31.1k|                    } else {
  403|  2.94k|                        fix_missing_keys();
  404|  2.94k|                    }
  405|  34.0k|                }
  406|       |
  407|   120k|                if (!frame_->contents_string.empty() && dict.contains("/Type") &&
  ------------------
  |  Branch (407:21): [True: 324, False: 120k]
  |  Branch (407:21): [True: 31, False: 120k]
  |  Branch (407:57): [True: 171, False: 153]
  ------------------
  408|    171|                    dict["/Type"].isNameAndEquals("/Sig") && dict.contains("/ByteRange") &&
  ------------------
  |  Branch (408:21): [True: 64, False: 107]
  |  Branch (408:62): [True: 41, False: 23]
  ------------------
  409|     41|                    dict.contains("/Contents") && dict["/Contents"].isString()) {
  ------------------
  |  Branch (409:21): [True: 31, False: 10]
  |  Branch (409:51): [True: 31, False: 0]
  ------------------
  410|     31|                    dict["/Contents"] = QPDFObjectHandle::newString(frame_->contents_string);
  411|     31|                    dict["/Contents"].setParsedOffset(frame_->contents_offset);
  412|     31|                }
  413|   120k|                auto object = QPDFObject::create<QPDF_Dictionary>(std::move(dict));
  414|   120k|                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|   120k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (419:21): [True: 78.0k, False: 42.5k]
  ------------------
  420|  78.0k|                    return object;
  421|  78.0k|                }
  422|  42.5k|                stack_.pop_back();
  423|  42.5k|                frame_ = &stack_.back();
  424|  42.5k|                add(std::move(object));
  425|  42.5k|            } else {
  426|  1.12k|                if (sanity_checks_) {
  ------------------
  |  Branch (426:21): [True: 630, False: 496]
  ------------------
  427|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  428|       |                    // unusable.
  429|    630|                    warn("unexpected dictionary close token; giving up on reading object");
  430|    630|                    return {};
  431|    630|                }
  432|    496|                add_bad_null("unexpected dictionary close token");
  433|    496|            }
  434|  43.0k|            continue;
  435|       |
  436|   135k|        case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (436:9): [True: 135k, False: 9.39M]
  ------------------
  437|   199k|        case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (437:9): [True: 63.7k, False: 9.46M]
  ------------------
  438|   199k|            if (stack_.size() > max_nesting) {
  ------------------
  |  Branch (438:17): [True: 41, False: 199k]
  ------------------
  439|     41|                limits_error(
  440|     41|                    "parser-max-nesting", "ignoring excessively deeply nested data structure");
  441|     41|            }
  442|   199k|            b_contents = false;
  443|   199k|            stack_.emplace_back(
  444|   199k|                input_,
  445|   199k|                (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array
  ------------------
  |  Branch (445:17): [True: 135k, False: 63.7k]
  ------------------
  446|   199k|                                                                       : st_dictionary_key);
  447|   199k|            frame_ = &stack_.back();
  448|   199k|            continue;
  449|       |
  450|  8.49k|        case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (450:9): [True: 8.49k, False: 9.52M]
  ------------------
  451|  8.49k|            add_scalar<QPDF_Bool>(tokenizer_.getValue() == "true");
  452|  8.49k|            continue;
  453|       |
  454|  65.3k|        case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (454:9): [True: 65.3k, False: 9.46M]
  ------------------
  455|  65.3k|            add_null();
  456|  65.3k|            continue;
  457|       |
  458|   431k|        case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (458:9): [True: 431k, False: 9.10M]
  ------------------
  459|   431k|            if (!content_stream) {
  ------------------
  |  Branch (459:17): [True: 431k, False: 0]
  ------------------
  460|       |                // Buffer token in case it is part of an indirect reference.
  461|   431k|                last_offset_buffer_[1] = input_.getLastOffset();
  462|   431k|                int_buffer_[1] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  463|   431k|                int_count_ = 1;
  464|   431k|            } else {
  465|      0|                add_scalar<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  466|      0|            }
  467|   431k|            continue;
  468|       |
  469|  57.5k|        case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (469:9): [True: 57.5k, False: 9.47M]
  ------------------
  470|  57.5k|            add_scalar<QPDF_Real>(tokenizer_.getValue());
  471|  57.5k|            continue;
  472|       |
  473|  8.24M|        case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (473:9): [True: 8.24M, False: 1.28M]
  ------------------
  474|  8.24M|            if (frame_->state == st_dictionary_key) {
  ------------------
  |  Branch (474:17): [True: 531k, False: 7.71M]
  ------------------
  475|   531k|                frame_->key = tokenizer_.getValue();
  476|   531k|                frame_->state = st_dictionary_value;
  477|   531k|                b_contents = decrypter_ && frame_->key == "/Contents";
  ------------------
  |  Branch (477:30): [True: 102k, False: 429k]
  |  Branch (477:44): [True: 701, False: 101k]
  ------------------
  478|   531k|                continue;
  479|  7.71M|            } else {
  480|  7.71M|                add_scalar<QPDF_Name>(tokenizer_.getValue());
  481|  7.71M|            }
  482|  7.71M|            continue;
  483|       |
  484|  7.71M|        case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (484:9): [True: 159k, False: 9.37M]
  ------------------
  485|   159k|            if (content_stream) {
  ------------------
  |  Branch (485:17): [True: 0, False: 159k]
  ------------------
  486|      0|                add_scalar<QPDF_Operator>(tokenizer_.getValue());
  487|      0|                continue;
  488|      0|            }
  489|       |
  490|   159k|            if (sanity_checks_) {
  ------------------
  |  Branch (490:17): [True: 151k, False: 7.80k]
  ------------------
  491|   151k|                if (tokenizer_.getValue() == "endobj" || tokenizer_.getValue() == "endstream") {
  ------------------
  |  Branch (491:21): [True: 983, False: 150k]
  |  Branch (491:58): [True: 325, False: 149k]
  ------------------
  492|       |                    // During sanity checks, assume an unexpected endobj or endstream indicates that
  493|       |                    // we are parsing past the end of the object.
  494|  1.30k|                    warn(
  495|  1.30k|                        "unexpected 'endobj' or 'endstream' while reading object; giving up on "
  496|  1.30k|                        "reading object");
  497|  1.30k|                    return {};
  498|  1.30k|                }
  499|       |
  500|   149k|                add_bad_null("unknown token while reading object; treating as null");
  501|   149k|                continue;
  502|   151k|            }
  503|       |
  504|  7.80k|            warn("unknown token while reading object; treating as string");
  505|  7.80k|            check_too_many_bad_tokens();
  506|  7.80k|            add_scalar<QPDF_String>(tokenizer_.getValue());
  507|       |
  508|  7.80k|            continue;
  509|       |
  510|   139k|        case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (510:9): [True: 139k, False: 9.39M]
  ------------------
  511|   139k|            {
  512|   139k|                auto const& val = tokenizer_.getValue();
  513|   139k|                if (decrypter_) {
  ------------------
  |  Branch (513:21): [True: 17.1k, False: 122k]
  ------------------
  514|  17.1k|                    if (b_contents) {
  ------------------
  |  Branch (514:25): [True: 646, False: 16.5k]
  ------------------
  515|    646|                        frame_->contents_string = val;
  516|    646|                        frame_->contents_offset = input_.getLastOffset();
  517|    646|                        b_contents = false;
  518|    646|                    }
  519|  17.1k|                    std::string s{val};
  520|  17.1k|                    decrypter_->decryptString(s);
  521|  17.1k|                    add_scalar<QPDF_String>(s);
  522|   122k|                } else {
  523|   122k|                    add_scalar<QPDF_String>(val);
  524|   122k|                }
  525|   139k|            }
  526|   139k|            continue;
  527|       |
  528|      0|        default:
  ------------------
  |  Branch (528:9): [True: 0, False: 9.53M]
  ------------------
  529|      0|            add_bad_null("treating unknown token type as null while reading object");
  530|  9.53M|        }
  531|  9.53M|    }
  532|   101k|}
_ZN4qpdf4impl6Parser3addEONSt3__110shared_ptrI10QPDFObjectEE:
  536|  13.6M|{
  537|  13.6M|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (537:9): [True: 13.1M, False: 491k]
  ------------------
  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|  13.1M|        frame_->olist.emplace_back(std::move(obj));
  541|  13.1M|    } else {
  542|   491k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, std::move(obj)); !res.second) {
  ------------------
  |  Branch (542:84): [True: 88.1k, False: 403k]
  ------------------
  543|  88.1k|            warn_duplicate_key();
  544|  88.1k|        }
  545|   491k|        frame_->state = st_dictionary_key;
  546|   491k|    }
  547|  13.6M|}
_ZN4qpdf4impl6Parser8add_nullEv:
  551|   240k|{
  552|   240k|    const static ObjectPtr null_obj = QPDFObject::create<QPDF_Null>();
  553|       |
  554|   240k|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (554:9): [True: 217k, False: 23.3k]
  ------------------
  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|   217k|        frame_->olist.emplace_back(null_obj);
  558|   217k|    } else {
  559|  23.3k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, null_obj); !res.second) {
  ------------------
  |  Branch (559:78): [True: 1.91k, False: 21.4k]
  ------------------
  560|  1.91k|            warn_duplicate_key();
  561|  1.91k|        }
  562|  23.3k|        frame_->state = st_dictionary_key;
  563|  23.3k|    }
  564|   240k|    ++frame_->null_count;
  565|   240k|}
_ZN4qpdf4impl6Parser12add_bad_nullERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  569|   157k|{
  570|   157k|    warn(msg);
  571|   157k|    check_too_many_bad_tokens();
  572|   157k|    add_null();
  573|   157k|}
_ZN4qpdf4impl6Parser7add_intEi:
  577|  5.34M|{
  578|  5.34M|    auto obj = QPDFObject::create<QPDF_Integer>(int_buffer_[count % 2]);
  579|  5.34M|    obj->setDescription(context_, description_, last_offset_buffer_[count % 2]);
  580|  5.34M|    add(std::move(obj));
  581|  5.34M|}
_ZN4qpdf4impl6Parser15set_descriptionERNSt3__110shared_ptrI10QPDFObjectEEx:
  610|   182k|{
  611|   182k|    if (obj) {
  ------------------
  |  Branch (611:9): [True: 182k, False: 0]
  ------------------
  612|   182k|        obj->setDescription(context_, description_, parsed_offset);
  613|   182k|    }
  614|   182k|}
_ZN4qpdf4impl6Parser16fix_missing_keysEv:
  618|  2.94k|{
  619|  2.94k|    std::set<std::string> names;
  620|  10.4k|    for (auto& obj: frame_->olist) {
  ------------------
  |  Branch (620:19): [True: 10.4k, False: 2.94k]
  ------------------
  621|  10.4k|        if (obj.raw_type_code() == ::ot_name) {
  ------------------
  |  Branch (621:13): [True: 545, False: 9.88k]
  ------------------
  622|    545|            names.insert(obj.getName());
  623|    545|        }
  624|  10.4k|    }
  625|  2.94k|    int next_fake_key = 1;
  626|  9.89k|    for (auto const& item: frame_->olist) {
  ------------------
  |  Branch (626:26): [True: 9.89k, False: 2.94k]
  ------------------
  627|  9.97k|        while (true) {
  ------------------
  |  Branch (627:16): [True: 9.97k, Folded]
  ------------------
  628|  9.97k|            const std::string key = "/QPDFFake" + std::to_string(next_fake_key++);
  629|  9.97k|            const bool found_fake = !frame_->dict.contains(key) && !names.contains(key);
  ------------------
  |  Branch (629:37): [True: 9.91k, False: 66]
  |  Branch (629:68): [True: 9.89k, False: 18]
  ------------------
  630|  9.97k|            QTC::TC("qpdf", "QPDFParser found fake", (found_fake ? 0 : 1));
  ------------------
  |  Branch (630:55): [True: 9.89k, False: 84]
  ------------------
  631|  9.97k|            if (found_fake) {
  ------------------
  |  Branch (631:17): [True: 9.89k, False: 84]
  ------------------
  632|  9.89k|                warn(
  633|  9.89k|                    frame_->offset,
  634|  9.89k|                    "expected dictionary key but found non-name object; inserting key " + key);
  635|  9.89k|                frame_->dict[key] = item;
  636|  9.89k|                break;
  637|  9.89k|            }
  638|  9.97k|        }
  639|  9.89k|    }
  640|  2.94k|}
_ZN4qpdf4impl6Parser25check_too_many_bad_tokensEv:
  644|   190k|{
  645|   190k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (645:52): [True: 145k, False: 44.8k]
  |  Branch (645:66): [True: 41.8k, False: 2.92k]
  ------------------
  646|   190k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (646:9): [True: 533, False: 190k]
  |  Branch (646:42): [True: 0, False: 190k]
  ------------------
  647|    533|        if (bad_count_) {
  ------------------
  |  Branch (647:13): [True: 452, False: 81]
  ------------------
  648|    452|            limits_error(
  649|    452|                "parser-max-container-size-damaged",
  650|    452|                "encountered errors while parsing an array or dictionary with more than " +
  651|    452|                    std::to_string(limit) + " elements; giving up on reading object");
  652|    452|        }
  653|    533|        limits_error(
  654|    533|            "parser-max-container-size",
  655|    533|            "encountered an array or dictionary with more than " + std::to_string(limit) +
  656|    533|                " elements during xref recovery; giving up on reading object");
  657|    533|    }
  658|   190k|    if (max_bad_count_ && --max_bad_count_ == 0) {
  ------------------
  |  Branch (658:9): [True: 190k, False: 533]
  |  Branch (658:27): [True: 1.50k, False: 188k]
  ------------------
  659|  1.50k|        limits_error(
  660|  1.50k|            "parser-max-errors", "too many errors during parsing; treating object as null");
  661|  1.50k|    }
  662|   190k|    if (good_count_ > 4) {
  ------------------
  |  Branch (662:9): [True: 61.5k, False: 129k]
  ------------------
  663|  61.5k|        good_count_ = 0;
  664|  61.5k|        bad_count_ = 1;
  665|  61.5k|        return;
  666|  61.5k|    }
  667|   129k|    if (++bad_count_ > 5 ||
  ------------------
  |  Branch (667:9): [True: 5.88k, False: 123k]
  ------------------
  668|   123k|        (frame_->state != st_array && std::cmp_less(max_bad_count_, frame_->olist.size()))) {
  ------------------
  |  Branch (668:10): [True: 72.2k, False: 51.1k]
  |  Branch (668:39): [True: 1.73k, False: 70.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|  5.58k|        warn("too many errors; giving up on reading object");
  672|  5.58k|        throw Error();
  673|  5.58k|    }
  674|   123k|    good_count_ = 0;
  675|   123k|}
_ZN4qpdf4impl6Parser12limits_errorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  679|  2.08k|{
  680|  2.08k|    Limits::error();
  681|  2.08k|    warn("limits error("s + limit + "): " + msg);
  682|  2.08k|    throw Error();
  683|  2.08k|}
_ZNK4qpdf4impl6Parser4warnERK7QPDFExc:
  687|   376k|{
  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|   376k|    if (context_) {
  ------------------
  |  Branch (691:9): [True: 376k, False: 0]
  ------------------
  692|   376k|        context_->warn(e);
  693|   376k|    } else {
  694|      0|        throw e;
  695|      0|    }
  696|   376k|}
_ZN4qpdf4impl6Parser18warn_duplicate_keyEv:
  700|  90.0k|{
  701|  90.0k|    warn(
  702|  90.0k|        frame_->offset,
  703|  90.0k|        "dictionary has duplicated key " + frame_->key +
  704|  90.0k|            "; last occurrence overrides earlier ones");
  705|  90.0k|}
_ZNK4qpdf4impl6Parser4warnExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  709|   376k|{
  710|   376k|    if (stream_id_) {
  ------------------
  |  Branch (710:9): [True: 15.3k, False: 361k]
  ------------------
  711|  15.3k|        std::string descr = "object "s + std::to_string(obj_id_) + " 0";
  712|  15.3k|        std::string name = context_->getFilename() + " object stream " + std::to_string(stream_id_);
  713|  15.3k|        warn(QPDFExc(qpdf_e_damaged_pdf, name, descr, offset, msg));
  714|   361k|    } else {
  715|   361k|        warn(QPDFExc(qpdf_e_damaged_pdf, input_.getName(), object_description_, offset, msg));
  716|   361k|    }
  717|   376k|}
_ZNK4qpdf4impl6Parser4warnERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  721|   236k|{
  722|   236k|    warn(input_.getLastOffset(), msg);
  723|   236k|}
_ZN4QPDF3Doc10ParseGuardC2EPS_:
   26|   125k|        objects(qpdf ? &qpdf->m->objects : nullptr)
  ------------------
  |  Branch (26:17): [True: 125k, False: 0]
  ------------------
   27|   125k|    {
   28|   125k|        if (objects) {
  ------------------
  |  Branch (28:13): [True: 125k, False: 0]
  ------------------
   29|   125k|            objects->inParse(true);
   30|   125k|        }
   31|   125k|    }
_ZN4QPDF3Doc10ParseGuardD2Ev:
   40|   125k|    {
   41|   125k|        if (objects) {
  ------------------
  |  Branch (41:13): [True: 125k, False: 0]
  ------------------
   42|   125k|            objects->inParse(false);
   43|   125k|        }
   44|   125k|    }
_ZN4QPDF3Doc10ParseGuard9getObjectEPS_iib:
   35|   257k|    {
   36|   257k|        return qpdf->m->objects.getObjectForParser(id, gen, parse_pdf);
   37|   257k|    }
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_BoolJbEEE16QPDFObjectHandleDpOT0_:
  602|    315|{
  603|    315|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    315|    obj->setDescription(context_, description_, start_);
  605|    315|    return {obj};
  606|    315|}
_ZN4qpdf4impl6Parser16with_descriptionI12QPDF_IntegerJxEEE16QPDFObjectHandleDpOT0_:
  602|  8.51k|{
  603|  8.51k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  8.51k|    obj->setDescription(context_, description_, start_);
  605|  8.51k|    return {obj};
  606|  8.51k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  1.20k|{
  603|  1.20k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.20k|    obj->setDescription(context_, description_, start_);
  605|  1.20k|    return {obj};
  606|  1.20k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  1.67k|{
  603|  1.67k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.67k|    obj->setDescription(context_, description_, start_);
  605|  1.67k|    return {obj};
  606|  1.67k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  7.28k|{
  603|  7.28k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  7.28k|    obj->setDescription(context_, description_, start_);
  605|  7.28k|    return {obj};
  606|  7.28k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|     89|{
  603|     89|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|     89|    obj->setDescription(context_, description_, start_);
  605|     89|    return {obj};
  606|     89|}
_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.71k, False: 2.78k]
  |  Branch (587:66): [True: 2.02k, False: 761]
  ------------------
  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|  57.5k|{
  587|  57.5k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 10.7k, False: 46.7k]
  |  Branch (587:66): [True: 44.8k, False: 1.91k]
  ------------------
  588|  57.5k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 82, False: 57.4k]
  |  Branch (588:42): [True: 0, False: 57.4k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     82|        max_bad_count_ = 1;
  592|     82|        check_too_many_bad_tokens(); // always throws Error()
  593|     82|    }
  594|  57.5k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  57.5k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  57.5k|    add(std::move(obj));
  597|  57.5k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  7.71M|{
  587|  7.71M|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 2.17M, False: 5.54M]
  |  Branch (587:66): [True: 473k, False: 5.06M]
  ------------------
  588|  7.71M|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 275, False: 7.71M]
  |  Branch (588:42): [True: 0, False: 7.71M]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|    275|        max_bad_count_ = 1;
  592|    275|        check_too_many_bad_tokens(); // always throws Error()
  593|    275|    }
  594|  7.71M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  7.71M|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  7.71M|    add(std::move(obj));
  597|  7.71M|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   129k|{
  587|   129k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 107k, False: 22.2k]
  |  Branch (587:66): [True: 18.3k, False: 3.95k]
  ------------------
  588|   129k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 83, False: 129k]
  |  Branch (588:42): [True: 0, False: 129k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     83|        max_bad_count_ = 1;
  592|     83|        check_too_many_bad_tokens(); // always throws Error()
  593|     83|    }
  594|   129k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   129k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   129k|    add(std::move(obj));
  597|   129k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  17.1k|{
  587|  17.1k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 11.9k, False: 5.18k]
  |  Branch (587:66): [True: 5.14k, False: 39]
  ------------------
  588|  17.1k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 19, False: 17.1k]
  |  Branch (588:42): [True: 0, False: 17.1k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     19|        max_bad_count_ = 1;
  592|     19|        check_too_many_bad_tokens(); // always throws Error()
  593|     19|    }
  594|  17.1k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  17.1k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  17.1k|    add(std::move(obj));
  597|  17.1k|}

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

_ZN4qpdf9Tokenizer5resetEv:
   85|  19.2M|{
   86|  19.2M|    state = st_before_token;
   87|  19.2M|    type = tt::tt_bad;
   88|  19.2M|    val.clear();
   89|  19.2M|    raw_val.clear();
   90|  19.2M|    error_message = "";
   91|  19.2M|    before_token = true;
   92|  19.2M|    in_token = false;
   93|  19.2M|    char_to_unread = '\0';
   94|  19.2M|    inline_image_bytes = 0;
   95|  19.2M|    string_depth = 0;
   96|  19.2M|    bad = false;
   97|  19.2M|}
_ZN4qpdf9TokenizerC2Ev:
  119|  18.5k|{
  120|  18.5k|    reset();
  121|  18.5k|}
_ZN4qpdf9Tokenizer8allowEOFEv:
  131|  18.5k|{
  132|  18.5k|    allow_eof = true;
  133|  18.5k|}
_ZN4qpdf9Tokenizer7isSpaceEc:
  149|  27.7M|{
  150|  27.7M|    return (ch == '\0' || util::is_space(ch));
  ------------------
  |  Branch (150:13): [True: 1.88M, False: 25.8M]
  |  Branch (150:27): [True: 8.53M, False: 17.3M]
  ------------------
  151|  27.7M|}
_ZN4qpdf9Tokenizer11isDelimiterEc:
  155|   125M|{
  156|   125M|    return is_delimiter(ch);
  157|   125M|}
_ZN4qpdf9Tokenizer16presentCharacterEc:
  167|  16.2k|{
  168|  16.2k|    handleCharacter(ch);
  169|       |
  170|  16.2k|    if (in_token) {
  ------------------
  |  Branch (170:9): [True: 0, False: 16.2k]
  ------------------
  171|      0|        raw_val += ch;
  172|      0|    }
  173|  16.2k|}
_ZN4qpdf9Tokenizer15handleCharacterEc:
  177|   299M|{
  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|   299M|    switch (state) {
  182|      0|    case st_top:
  ------------------
  |  Branch (182:5): [True: 0, False: 299M]
  ------------------
  183|      0|        inTop(ch);
  184|      0|        return;
  185|       |
  186|      0|    case st_in_space:
  ------------------
  |  Branch (186:5): [True: 0, False: 299M]
  ------------------
  187|      0|        inSpace(ch);
  188|      0|        return;
  189|       |
  190|   851k|    case st_in_comment:
  ------------------
  |  Branch (190:5): [True: 851k, False: 298M]
  ------------------
  191|   851k|        inComment(ch);
  192|   851k|        return;
  193|       |
  194|   241k|    case st_lt:
  ------------------
  |  Branch (194:5): [True: 241k, False: 299M]
  ------------------
  195|   241k|        inLt(ch);
  196|   241k|        return;
  197|       |
  198|   164k|    case st_gt:
  ------------------
  |  Branch (198:5): [True: 164k, False: 299M]
  ------------------
  199|   164k|        inGt(ch);
  200|   164k|        return;
  201|       |
  202|   131M|    case st_in_string:
  ------------------
  |  Branch (202:5): [True: 131M, False: 168M]
  ------------------
  203|   131M|        inString(ch);
  204|   131M|        return;
  205|       |
  206|  84.8M|    case st_name:
  ------------------
  |  Branch (206:5): [True: 84.8M, False: 214M]
  ------------------
  207|  84.8M|        inName(ch);
  208|  84.8M|        return;
  209|       |
  210|  19.5M|    case st_number:
  ------------------
  |  Branch (210:5): [True: 19.5M, False: 280M]
  ------------------
  211|  19.5M|        inNumber(ch);
  212|  19.5M|        return;
  213|       |
  214|   238k|    case st_real:
  ------------------
  |  Branch (214:5): [True: 238k, False: 299M]
  ------------------
  215|   238k|        inReal(ch);
  216|   238k|        return;
  217|       |
  218|   197k|    case st_string_after_cr:
  ------------------
  |  Branch (218:5): [True: 197k, False: 299M]
  ------------------
  219|   197k|        inStringAfterCR(ch);
  220|   197k|        return;
  221|       |
  222|  26.8k|    case st_string_escape:
  ------------------
  |  Branch (222:5): [True: 26.8k, False: 299M]
  ------------------
  223|  26.8k|        inStringEscape(ch);
  224|  26.8k|        return;
  225|       |
  226|  5.04k|    case st_char_code:
  ------------------
  |  Branch (226:5): [True: 5.04k, False: 299M]
  ------------------
  227|  5.04k|        inCharCode(ch);
  228|  5.04k|        return;
  229|       |
  230|  33.9M|    case st_literal:
  ------------------
  |  Branch (230:5): [True: 33.9M, False: 265M]
  ------------------
  231|  33.9M|        inLiteral(ch);
  232|  33.9M|        return;
  233|       |
  234|      0|    case st_inline_image:
  ------------------
  |  Branch (234:5): [True: 0, False: 299M]
  ------------------
  235|      0|        inInlineImage(ch);
  236|      0|        return;
  237|       |
  238|  83.9k|    case st_in_hexstring:
  ------------------
  |  Branch (238:5): [True: 83.9k, False: 299M]
  ------------------
  239|  83.9k|        inHexstring(ch);
  240|  83.9k|        return;
  241|       |
  242|  90.0k|    case st_in_hexstring_2nd:
  ------------------
  |  Branch (242:5): [True: 90.0k, False: 299M]
  ------------------
  243|  90.0k|        inHexstring2nd(ch);
  244|  90.0k|        return;
  245|       |
  246|  20.5k|    case st_name_hex1:
  ------------------
  |  Branch (246:5): [True: 20.5k, False: 299M]
  ------------------
  247|  20.5k|        inNameHex1(ch);
  248|  20.5k|        return;
  249|       |
  250|  8.84k|    case st_name_hex2:
  ------------------
  |  Branch (250:5): [True: 8.84k, False: 299M]
  ------------------
  251|  8.84k|        inNameHex2(ch);
  252|  8.84k|        return;
  253|       |
  254|  18.0k|    case st_sign:
  ------------------
  |  Branch (254:5): [True: 18.0k, False: 299M]
  ------------------
  255|  18.0k|        inSign(ch);
  256|  18.0k|        return;
  257|       |
  258|  8.15k|    case st_decimal:
  ------------------
  |  Branch (258:5): [True: 8.15k, False: 299M]
  ------------------
  259|  8.15k|        inDecimal(ch);
  260|  8.15k|        return;
  261|       |
  262|  27.7M|    case (st_before_token):
  ------------------
  |  Branch (262:5): [True: 27.7M, False: 272M]
  ------------------
  263|  27.7M|        inBeforeToken(ch);
  264|  27.7M|        return;
  265|       |
  266|      0|    case (st_token_ready):
  ------------------
  |  Branch (266:5): [True: 0, False: 299M]
  ------------------
  267|      0|        inTokenReady(ch);
  268|      0|        return;
  269|       |
  270|      0|    default:
  ------------------
  |  Branch (270:5): [True: 0, False: 299M]
  ------------------
  271|      0|        throw std::logic_error("INTERNAL ERROR: invalid state while reading token");
  272|   299M|    }
  273|   299M|}
_ZN4qpdf9Tokenizer13inBeforeTokenEc:
  284|  27.7M|{
  285|       |    // Note: we specifically do not use ctype here.  It is locale-dependent.
  286|  27.7M|    if (isSpace(ch)) {
  ------------------
  |  Branch (286:9): [True: 10.4M, False: 17.3M]
  ------------------
  287|  10.4M|        before_token = !include_ignorable;
  288|  10.4M|        in_token = include_ignorable;
  289|  10.4M|        if (include_ignorable) {
  ------------------
  |  Branch (289:13): [True: 0, False: 10.4M]
  ------------------
  290|      0|            state = st_in_space;
  291|      0|        }
  292|  17.3M|    } else if (ch == '%') {
  ------------------
  |  Branch (292:16): [True: 18.0k, False: 17.2M]
  ------------------
  293|  18.0k|        before_token = !include_ignorable;
  294|  18.0k|        in_token = include_ignorable;
  295|  18.0k|        state = st_in_comment;
  296|  17.2M|    } else {
  297|  17.2M|        before_token = false;
  298|  17.2M|        in_token = true;
  299|  17.2M|        inTop(ch);
  300|  17.2M|    }
  301|  27.7M|}
_ZN4qpdf9Tokenizer5inTopEc:
  305|  17.2M|{
  306|  17.2M|    switch (ch) {
  307|   136k|    case '(':
  ------------------
  |  Branch (307:5): [True: 136k, False: 17.1M]
  ------------------
  308|   136k|        string_depth = 1;
  309|   136k|        state = st_in_string;
  310|   136k|        return;
  311|       |
  312|   242k|    case '<':
  ------------------
  |  Branch (312:5): [True: 242k, False: 17.0M]
  ------------------
  313|   242k|        state = st_lt;
  314|   242k|        return;
  315|       |
  316|   164k|    case '>':
  ------------------
  |  Branch (316:5): [True: 164k, False: 17.1M]
  ------------------
  317|   164k|        state = st_gt;
  318|   164k|        return;
  319|       |
  320|  16.1k|    case (')'):
  ------------------
  |  Branch (320:5): [True: 16.1k, False: 17.2M]
  ------------------
  321|  16.1k|        type = tt::tt_bad;
  322|  16.1k|        QTC::TC("qpdf", "QPDFTokenizer bad )");
  323|  16.1k|        error_message = "unexpected )";
  324|  16.1k|        state = st_token_ready;
  325|  16.1k|        return;
  326|       |
  327|   150k|    case '[':
  ------------------
  |  Branch (327:5): [True: 150k, False: 17.1M]
  ------------------
  328|   150k|        type = tt::tt_array_open;
  329|   150k|        state = st_token_ready;
  330|   150k|        return;
  331|       |
  332|  76.3k|    case ']':
  ------------------
  |  Branch (332:5): [True: 76.3k, False: 17.2M]
  ------------------
  333|  76.3k|        type = tt::tt_array_close;
  334|  76.3k|        state = st_token_ready;
  335|  76.3k|        return;
  336|       |
  337|  3.41k|    case '{':
  ------------------
  |  Branch (337:5): [True: 3.41k, False: 17.2M]
  ------------------
  338|  3.41k|        type = tt::tt_brace_open;
  339|  3.41k|        state = st_token_ready;
  340|  3.41k|        return;
  341|       |
  342|  3.50k|    case '}':
  ------------------
  |  Branch (342:5): [True: 3.50k, False: 17.2M]
  ------------------
  343|  3.50k|        type = tt::tt_brace_close;
  344|  3.50k|        state = st_token_ready;
  345|  3.50k|        return;
  346|       |
  347|  8.36M|    case '/':
  ------------------
  |  Branch (347:5): [True: 8.36M, False: 8.92M]
  ------------------
  348|  8.36M|        state = st_name;
  349|  8.36M|        val += ch;
  350|  8.36M|        return;
  351|       |
  352|   711k|    case '0':
  ------------------
  |  Branch (352:5): [True: 711k, False: 16.5M]
  ------------------
  353|  1.70M|    case '1':
  ------------------
  |  Branch (353:5): [True: 989k, False: 16.3M]
  ------------------
  354|  2.20M|    case '2':
  ------------------
  |  Branch (354:5): [True: 505k, False: 16.7M]
  ------------------
  355|  2.43M|    case '3':
  ------------------
  |  Branch (355:5): [True: 232k, False: 17.0M]
  ------------------
  356|  2.79M|    case '4':
  ------------------
  |  Branch (356:5): [True: 354k, False: 16.9M]
  ------------------
  357|  3.55M|    case '5':
  ------------------
  |  Branch (357:5): [True: 763k, False: 16.5M]
  ------------------
  358|  5.03M|    case '6':
  ------------------
  |  Branch (358:5): [True: 1.47M, False: 15.8M]
  ------------------
  359|  6.29M|    case '7':
  ------------------
  |  Branch (359:5): [True: 1.25M, False: 16.0M]
  ------------------
  360|  6.61M|    case '8':
  ------------------
  |  Branch (360:5): [True: 325k, False: 16.9M]
  ------------------
  361|  6.73M|    case '9':
  ------------------
  |  Branch (361:5): [True: 114k, False: 17.1M]
  ------------------
  362|  6.73M|        state = st_number;
  363|  6.73M|        return;
  364|       |
  365|  2.41k|    case '+':
  ------------------
  |  Branch (365:5): [True: 2.41k, False: 17.2M]
  ------------------
  366|  18.0k|    case '-':
  ------------------
  |  Branch (366:5): [True: 15.6k, False: 17.2M]
  ------------------
  367|  18.0k|        state = st_sign;
  368|  18.0k|        return;
  369|       |
  370|  7.93k|    case '.':
  ------------------
  |  Branch (370:5): [True: 7.93k, False: 17.2M]
  ------------------
  371|  7.93k|        state = st_decimal;
  372|  7.93k|        return;
  373|       |
  374|  1.37M|    default:
  ------------------
  |  Branch (374:5): [True: 1.37M, False: 15.9M]
  ------------------
  375|  1.37M|        state = st_literal;
  376|  1.37M|        return;
  377|  17.2M|    }
  378|  17.2M|}
_ZN4qpdf9Tokenizer9inCommentEc:
  394|   851k|{
  395|   851k|    if ((ch == '\r') || (ch == '\n')) {
  ------------------
  |  Branch (395:9): [True: 4.21k, False: 847k]
  |  Branch (395:25): [True: 12.9k, False: 834k]
  ------------------
  396|  17.1k|        if (include_ignorable) {
  ------------------
  |  Branch (396:13): [True: 0, False: 17.1k]
  ------------------
  397|      0|            type = tt::tt_comment;
  398|      0|            in_token = false;
  399|      0|            char_to_unread = ch;
  400|      0|            state = st_token_ready;
  401|  17.1k|        } else {
  402|  17.1k|            state = st_before_token;
  403|  17.1k|        }
  404|  17.1k|    }
  405|   851k|}
_ZN4qpdf9Tokenizer8inStringEc:
  409|   131M|{
  410|   131M|    switch (ch) {
  411|  26.9k|    case '\\':
  ------------------
  |  Branch (411:5): [True: 26.9k, False: 131M]
  ------------------
  412|  26.9k|        state = st_string_escape;
  413|  26.9k|        return;
  414|       |
  415|  88.7k|    case '(':
  ------------------
  |  Branch (415:5): [True: 88.7k, False: 131M]
  ------------------
  416|  88.7k|        val += ch;
  417|  88.7k|        ++string_depth;
  418|  88.7k|        return;
  419|       |
  420|   192k|    case ')':
  ------------------
  |  Branch (420:5): [True: 192k, False: 131M]
  ------------------
  421|   192k|        if (--string_depth == 0) {
  ------------------
  |  Branch (421:13): [True: 130k, False: 61.3k]
  ------------------
  422|   130k|            type = tt::tt_string;
  423|   130k|            state = st_token_ready;
  424|   130k|            return;
  425|   130k|        }
  426|       |
  427|  61.3k|        val += ch;
  428|  61.3k|        return;
  429|       |
  430|   196k|    case '\r':
  ------------------
  |  Branch (430:5): [True: 196k, False: 131M]
  ------------------
  431|       |        // CR by itself is converted to LF
  432|   196k|        val += '\n';
  433|   196k|        state = st_string_after_cr;
  434|   196k|        return;
  435|       |
  436|   298k|    case '\n':
  ------------------
  |  Branch (436:5): [True: 298k, False: 131M]
  ------------------
  437|   298k|        val += ch;
  438|   298k|        return;
  439|       |
  440|   131M|    default:
  ------------------
  |  Branch (440:5): [True: 131M, False: 802k]
  ------------------
  441|   131M|        val += ch;
  442|   131M|        return;
  443|   131M|    }
  444|   131M|}
_ZN4qpdf9Tokenizer6inNameEc:
  448|  84.8M|{
  449|  84.8M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (449:9): [True: 8.35M, False: 76.4M]
  ------------------
  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|  8.35M|        type = bad ? tt::tt_bad : tt::tt_name;
  ------------------
  |  Branch (456:16): [True: 211, False: 8.35M]
  ------------------
  457|  8.35M|        in_token = false;
  458|  8.35M|        char_to_unread = ch;
  459|  8.35M|        state = st_token_ready;
  460|  76.4M|    } else if (ch == '#') {
  ------------------
  |  Branch (460:16): [True: 20.5k, False: 76.4M]
  ------------------
  461|  20.5k|        char_code = 0;
  462|  20.5k|        state = st_name_hex1;
  463|  76.4M|    } else {
  464|  76.4M|        val += ch;
  465|  76.4M|    }
  466|  84.8M|}
_ZN4qpdf9Tokenizer10inNameHex1Ec:
  470|  20.5k|{
  471|  20.5k|    hex_char = ch;
  472|       |
  473|  20.5k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (473:48): [True: 8.84k, False: 11.7k]
  ------------------
  474|  8.84k|        char_code = int(hval) << 4;
  475|  8.84k|        state = st_name_hex2;
  476|  11.7k|    } else {
  477|  11.7k|        QTC::TC("qpdf", "QPDFTokenizer bad name 1");
  478|  11.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|  11.7k|        val += '\0';
  481|  11.7k|        state = st_name;
  482|  11.7k|        inName(ch);
  483|  11.7k|    }
  484|  20.5k|}
_ZN4qpdf9Tokenizer10inNameHex2Ec:
  488|  8.84k|{
  489|  8.84k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (489:48): [True: 2.28k, False: 6.55k]
  ------------------
  490|  2.28k|        char_code |= int(hval);
  491|  6.55k|    } else {
  492|  6.55k|        QTC::TC("qpdf", "QPDFTokenizer bad name 2");
  493|  6.55k|        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|  6.55k|        val += '\0';
  496|  6.55k|        val += hex_char;
  497|  6.55k|        state = st_name;
  498|  6.55k|        inName(ch);
  499|  6.55k|        return;
  500|  6.55k|    }
  501|  2.28k|    if (char_code == 0) {
  ------------------
  |  Branch (501:9): [True: 1.63k, False: 653]
  ------------------
  502|  1.63k|        QTC::TC("qpdf", "QPDFTokenizer null in name");
  503|  1.63k|        error_message = "null character not allowed in name token";
  504|  1.63k|        val += "#00";
  505|  1.63k|        state = st_name;
  506|  1.63k|        bad = true;
  507|  1.63k|    } else {
  508|    653|        val += char(char_code);
  509|    653|        state = st_name;
  510|    653|    }
  511|  2.28k|}
_ZN4qpdf9Tokenizer6inSignEc:
  515|  18.0k|{
  516|  18.0k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (516:9): [True: 12.6k, False: 5.44k]
  ------------------
  517|  12.6k|        state = st_number;
  518|  12.6k|    } else if (ch == '.') {
  ------------------
  |  Branch (518:16): [True: 220, False: 5.22k]
  ------------------
  519|    220|        state = st_decimal;
  520|  5.22k|    } else {
  521|  5.22k|        state = st_literal;
  522|  5.22k|        inLiteral(ch);
  523|  5.22k|    }
  524|  18.0k|}
_ZN4qpdf9Tokenizer9inDecimalEc:
  528|  8.15k|{
  529|  8.15k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (529:9): [True: 5.15k, False: 3.00k]
  ------------------
  530|  5.15k|        state = st_real;
  531|  5.15k|    } else {
  532|  3.00k|        state = st_literal;
  533|  3.00k|        inLiteral(ch);
  534|  3.00k|    }
  535|  8.15k|}
_ZN4qpdf9Tokenizer8inNumberEc:
  539|  19.5M|{
  540|  19.5M|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (540:9): [True: 12.9M, False: 6.67M]
  ------------------
  541|  12.9M|    } else if (ch == '.') {
  ------------------
  |  Branch (541:16): [True: 60.8k, False: 6.61M]
  ------------------
  542|  60.8k|        state = st_real;
  543|  6.61M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (543:16): [True: 6.57M, False: 36.3k]
  ------------------
  544|  6.57M|        type = tt::tt_integer;
  545|  6.57M|        state = st_token_ready;
  546|  6.57M|        in_token = false;
  547|  6.57M|        char_to_unread = ch;
  548|  6.57M|    } else {
  549|  36.3k|        state = st_literal;
  550|  36.3k|    }
  551|  19.5M|}
_ZN4qpdf9Tokenizer6inRealEc:
  555|   238k|{
  556|   238k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (556:9): [True: 172k, False: 65.9k]
  ------------------
  557|   172k|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (557:16): [True: 64.3k, False: 1.65k]
  ------------------
  558|  64.3k|        type = tt::tt_real;
  559|  64.3k|        state = st_token_ready;
  560|  64.3k|        in_token = false;
  561|  64.3k|        char_to_unread = ch;
  562|  64.3k|    } else {
  563|  1.65k|        state = st_literal;
  564|  1.65k|    }
  565|   238k|}
_ZN4qpdf9Tokenizer14inStringEscapeEc:
  568|  26.8k|{
  569|  26.8k|    state = st_in_string;
  570|  26.8k|    switch (ch) {
  571|    943|    case '0':
  ------------------
  |  Branch (571:5): [True: 943, False: 25.9k]
  ------------------
  572|  1.34k|    case '1':
  ------------------
  |  Branch (572:5): [True: 404, False: 26.4k]
  ------------------
  573|  2.27k|    case '2':
  ------------------
  |  Branch (573:5): [True: 929, False: 25.9k]
  ------------------
  574|  2.99k|    case '3':
  ------------------
  |  Branch (574:5): [True: 719, False: 26.1k]
  ------------------
  575|  3.53k|    case '4':
  ------------------
  |  Branch (575:5): [True: 536, False: 26.3k]
  ------------------
  576|  3.83k|    case '5':
  ------------------
  |  Branch (576:5): [True: 305, False: 26.5k]
  ------------------
  577|  4.11k|    case '6':
  ------------------
  |  Branch (577:5): [True: 280, False: 26.5k]
  ------------------
  578|  4.48k|    case '7':
  ------------------
  |  Branch (578:5): [True: 372, False: 26.4k]
  ------------------
  579|  4.48k|        state = st_char_code;
  580|  4.48k|        char_code = 0;
  581|  4.48k|        digit_count = 0;
  582|  4.48k|        inCharCode(ch);
  583|  4.48k|        return;
  584|       |
  585|    386|    case 'n':
  ------------------
  |  Branch (585:5): [True: 386, False: 26.4k]
  ------------------
  586|    386|        val += '\n';
  587|    386|        return;
  588|       |
  589|    704|    case 'r':
  ------------------
  |  Branch (589:5): [True: 704, False: 26.1k]
  ------------------
  590|    704|        val += '\r';
  591|    704|        return;
  592|       |
  593|    292|    case 't':
  ------------------
  |  Branch (593:5): [True: 292, False: 26.5k]
  ------------------
  594|    292|        val += '\t';
  595|    292|        return;
  596|       |
  597|    296|    case 'b':
  ------------------
  |  Branch (597:5): [True: 296, False: 26.5k]
  ------------------
  598|    296|        val += '\b';
  599|    296|        return;
  600|       |
  601|    366|    case 'f':
  ------------------
  |  Branch (601:5): [True: 366, False: 26.4k]
  ------------------
  602|    366|        val += '\f';
  603|    366|        return;
  604|       |
  605|    247|    case '\n':
  ------------------
  |  Branch (605:5): [True: 247, False: 26.6k]
  ------------------
  606|    247|        return;
  607|       |
  608|    336|    case '\r':
  ------------------
  |  Branch (608:5): [True: 336, False: 26.5k]
  ------------------
  609|    336|        state = st_string_after_cr;
  610|    336|        return;
  611|       |
  612|  19.7k|    default:
  ------------------
  |  Branch (612:5): [True: 19.7k, False: 7.11k]
  ------------------
  613|       |        // PDF spec says backslash is ignored before anything else
  614|  19.7k|        val += ch;
  615|  19.7k|        return;
  616|  26.8k|    }
  617|  26.8k|}
_ZN4qpdf9Tokenizer15inStringAfterCREc:
  621|   197k|{
  622|   197k|    state = st_in_string;
  623|   197k|    if (ch != '\n') {
  ------------------
  |  Branch (623:9): [True: 93.2k, False: 103k]
  ------------------
  624|  93.2k|        inString(ch);
  625|  93.2k|    }
  626|   197k|}
_ZN4qpdf9Tokenizer4inLtEc:
  630|   241k|{
  631|   241k|    if (ch == '<') {
  ------------------
  |  Branch (631:9): [True: 215k, False: 26.2k]
  ------------------
  632|   215k|        type = tt::tt_dict_open;
  633|   215k|        state = st_token_ready;
  634|   215k|        return;
  635|   215k|    }
  636|       |
  637|  26.2k|    state = st_in_hexstring;
  638|  26.2k|    inHexstring(ch);
  639|  26.2k|}
_ZN4qpdf9Tokenizer4inGtEc:
  643|   164k|{
  644|   164k|    if (ch == '>') {
  ------------------
  |  Branch (644:9): [True: 152k, False: 12.1k]
  ------------------
  645|   152k|        type = tt::tt_dict_close;
  646|   152k|        state = st_token_ready;
  647|   152k|    } 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|   164k|}
_ZN4qpdf9Tokenizer9inLiteralEc:
  659|  33.9M|{
  660|  33.9M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (660:9): [True: 1.30M, False: 32.6M]
  ------------------
  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.30M|        in_token = false;
  667|  1.30M|        char_to_unread = ch;
  668|  1.30M|        state = st_token_ready;
  669|  1.30M|        type = (raw_val == "true") || (raw_val == "false")
  ------------------
  |  Branch (669:16): [True: 8.88k, False: 1.29M]
  |  Branch (669:39): [True: 1.33k, False: 1.29M]
  ------------------
  670|  1.30M|            ? tt::tt_bool
  671|  1.30M|            : (raw_val == "null" ? tt::tt_null : tt::tt_word);
  ------------------
  |  Branch (671:16): [True: 65.8k, False: 1.23M]
  ------------------
  672|  1.30M|    }
  673|  33.9M|}
_ZN4qpdf9Tokenizer11inHexstringEc:
  677|   110k|{
  678|   110k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (678:48): [True: 80.7k, False: 29.4k]
  ------------------
  679|  80.7k|        char_code = int(hval) << 4;
  680|  80.7k|        state = st_in_hexstring_2nd;
  681|       |
  682|  80.7k|    } else if (ch == '>') {
  ------------------
  |  Branch (682:16): [True: 7.26k, False: 22.2k]
  ------------------
  683|  7.26k|        type = tt::tt_string;
  684|  7.26k|        state = st_token_ready;
  685|       |
  686|  22.2k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (686:16): [True: 9.70k, False: 12.5k]
  ------------------
  687|       |        // ignore
  688|       |
  689|  12.5k|    } else {
  690|  12.5k|        type = tt::tt_bad;
  691|  12.5k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring character");
  692|  12.5k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  693|  12.5k|        state = st_token_ready;
  694|  12.5k|    }
  695|   110k|}
_ZN4qpdf9Tokenizer14inHexstring2ndEc:
  699|  90.0k|{
  700|  90.0k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (700:48): [True: 74.4k, False: 15.6k]
  ------------------
  701|  74.4k|        val += char(char_code) | hval;
  702|  74.4k|        state = st_in_hexstring;
  703|       |
  704|  74.4k|    } else if (ch == '>') {
  ------------------
  |  Branch (704:16): [True: 3.55k, False: 12.0k]
  ------------------
  705|       |        // PDF spec says odd hexstrings have implicit trailing 0.
  706|  3.55k|        val += char(char_code);
  707|  3.55k|        type = tt::tt_string;
  708|  3.55k|        state = st_token_ready;
  709|       |
  710|  12.0k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (710:16): [True: 9.52k, False: 2.54k]
  ------------------
  711|       |        // ignore
  712|       |
  713|  9.52k|    } else {
  714|  2.54k|        type = tt::tt_bad;
  715|  2.54k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character");
  716|  2.54k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  717|  2.54k|        state = st_token_ready;
  718|  2.54k|    }
  719|  90.0k|}
_ZN4qpdf9Tokenizer10inCharCodeEc:
  723|  9.53k|{
  724|  9.53k|    bool handled = false;
  725|  9.53k|    if (('0' <= ch) && (ch <= '7')) {
  ------------------
  |  Branch (725:9): [True: 8.47k, False: 1.06k]
  |  Branch (725:24): [True: 5.42k, False: 3.04k]
  ------------------
  726|  5.42k|        char_code = 8 * char_code + (int(ch) - int('0'));
  727|  5.42k|        if (++(digit_count) < 3) {
  ------------------
  |  Branch (727:13): [True: 5.18k, False: 244]
  ------------------
  728|  5.18k|            return;
  729|  5.18k|        }
  730|    244|        handled = true;
  731|    244|    }
  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|  4.35k|    val += char(char_code % 256);
  735|  4.35k|    state = st_in_string;
  736|  4.35k|    if (!handled) {
  ------------------
  |  Branch (736:9): [True: 4.10k, False: 244]
  ------------------
  737|  4.10k|        inString(ch);
  738|  4.10k|    }
  739|  4.35k|}
_ZN4qpdf9Tokenizer10presentEOFEv:
  760|  34.5k|{
  761|  34.5k|    switch (state) {
  762|  1.83k|    case st_name:
  ------------------
  |  Branch (762:5): [True: 1.83k, False: 32.7k]
  ------------------
  763|  1.98k|    case st_name_hex1:
  ------------------
  |  Branch (763:5): [True: 151, False: 34.4k]
  ------------------
  764|  2.10k|    case st_name_hex2:
  ------------------
  |  Branch (764:5): [True: 127, False: 34.4k]
  ------------------
  765|  7.46k|    case st_number:
  ------------------
  |  Branch (765:5): [True: 5.35k, False: 29.2k]
  ------------------
  766|  7.72k|    case st_real:
  ------------------
  |  Branch (766:5): [True: 258, False: 34.3k]
  ------------------
  767|  7.87k|    case st_sign:
  ------------------
  |  Branch (767:5): [True: 152, False: 34.4k]
  ------------------
  768|  8.00k|    case st_decimal:
  ------------------
  |  Branch (768:5): [True: 133, False: 34.4k]
  ------------------
  769|  16.2k|    case st_literal:
  ------------------
  |  Branch (769:5): [True: 8.28k, False: 26.3k]
  ------------------
  770|  16.2k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token");
  771|       |        // Push any delimiter to the state machine to finish off the final token.
  772|  16.2k|        presentCharacter('\f');
  773|  16.2k|        in_token = true;
  774|  16.2k|        break;
  775|       |
  776|      0|    case st_top:
  ------------------
  |  Branch (776:5): [True: 0, False: 34.5k]
  ------------------
  777|  14.3k|    case st_before_token:
  ------------------
  |  Branch (777:5): [True: 14.3k, False: 20.2k]
  ------------------
  778|  14.3k|        type = tt::tt_eof;
  779|  14.3k|        break;
  780|       |
  781|      0|    case st_in_space:
  ------------------
  |  Branch (781:5): [True: 0, False: 34.5k]
  ------------------
  782|      0|        type = include_ignorable ? tt::tt_space : tt::tt_eof;
  ------------------
  |  Branch (782:16): [True: 0, False: 0]
  ------------------
  783|      0|        break;
  784|       |
  785|    885|    case st_in_comment:
  ------------------
  |  Branch (785:5): [True: 885, False: 33.7k]
  ------------------
  786|    885|        type = include_ignorable ? tt::tt_comment : tt::tt_bad;
  ------------------
  |  Branch (786:16): [True: 0, False: 885]
  ------------------
  787|    885|        break;
  788|       |
  789|      0|    case st_token_ready:
  ------------------
  |  Branch (789:5): [True: 0, False: 34.5k]
  ------------------
  790|      0|        break;
  791|       |
  792|  3.02k|    default:
  ------------------
  |  Branch (792:5): [True: 3.02k, False: 31.5k]
  ------------------
  793|  3.02k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading token");
  794|  3.02k|        type = tt::tt_bad;
  795|  3.02k|        error_message = "EOF while reading token";
  796|  34.5k|    }
  797|  34.5k|    state = st_token_ready;
  798|  34.5k|}
_ZN4qpdf9Tokenizer8getTokenERN13QPDFTokenizer5TokenERbRc:
  916|  1.96M|{
  917|  1.96M|    bool ready = (state == st_token_ready);
  918|  1.96M|    unread_char = !in_token && !before_token;
  ------------------
  |  Branch (918:19): [True: 1.62M, False: 333k]
  |  Branch (918:32): [True: 1.62M, False: 7.69k]
  ------------------
  919|  1.96M|    ch = char_to_unread;
  920|  1.96M|    if (ready) {
  ------------------
  |  Branch (920:9): [True: 1.96M, False: 0]
  ------------------
  921|  1.96M|        token = (!(type == tt::tt_name || type == tt::tt_string))
  ------------------
  |  Branch (921:20): [True: 109k, False: 1.85M]
  |  Branch (921:43): [True: 1.90k, False: 1.85M]
  ------------------
  922|  1.96M|            ? Token(type, raw_val, raw_val, error_message)
  923|  1.96M|            : Token(type, val, raw_val, error_message);
  924|       |
  925|  1.96M|        reset();
  926|  1.96M|    }
  927|  1.96M|    return ready;
  928|  1.96M|}
_ZN4qpdf9Tokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbm:
  958|  1.96M|{
  959|  1.96M|    nextToken(input, context, max_len);
  960|       |
  961|  1.96M|    Token token;
  962|  1.96M|    bool unread_char;
  963|  1.96M|    char char_to_unread;
  964|  1.96M|    getToken(token, unread_char, char_to_unread);
  965|       |
  966|  1.96M|    if (token.getType() == tt::tt_bad) {
  ------------------
  |  Branch (966:9): [True: 217k, False: 1.74M]
  ------------------
  967|   217k|        if (allow_bad) {
  ------------------
  |  Branch (967:13): [True: 217k, False: 0]
  ------------------
  968|   217k|            QTC::TC("qpdf", "QPDFTokenizer allowing bad token");
  969|   217k|        } 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|   217k|    }
  978|  1.96M|    return token;
  979|  1.96M|}
_ZN4qpdf9Tokenizer9nextTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEm:
  983|  17.3M|{
  984|  17.3M|    if (state != st_inline_image) {
  ------------------
  |  Branch (984:9): [True: 17.3M, False: 0]
  ------------------
  985|  17.3M|        reset();
  986|  17.3M|    }
  987|  17.3M|    qpdf_offset_t offset = input.fastTell();
  988|       |
  989|   317M|    while (state != st_token_ready) {
  ------------------
  |  Branch (989:12): [True: 299M, False: 17.3M]
  ------------------
  990|   299M|        char ch;
  991|   299M|        if (!input.fastRead(ch)) {
  ------------------
  |  Branch (991:13): [True: 34.5k, False: 299M]
  ------------------
  992|  34.5k|            presentEOF();
  993|       |
  994|  34.5k|            if ((type == tt::tt_eof) && (!allow_eof)) {
  ------------------
  |  Branch (994:17): [True: 14.3k, False: 20.2k]
  |  Branch (994:41): [True: 0, False: 14.3k]
  ------------------
  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|   299M|        } else {
 1002|   299M|            handleCharacter(ch);
 1003|   299M|            if (before_token) {
  ------------------
  |  Branch (1003:17): [True: 11.2M, False: 288M]
  ------------------
 1004|  11.2M|                ++offset;
 1005|  11.2M|            }
 1006|   299M|            if (in_token) {
  ------------------
  |  Branch (1006:17): [True: 272M, False: 27.5M]
  ------------------
 1007|   272M|                raw_val += ch;
 1008|   272M|            }
 1009|   299M|            if (max_len && (raw_val.length() >= max_len) && (state != st_token_ready)) {
  ------------------
  |  Branch (1009:17): [True: 9.63M, False: 290M]
  |  Branch (1009:28): [True: 199k, False: 9.43M]
  |  Branch (1009:61): [True: 198k, False: 867]
  ------------------
 1010|       |                // terminate this token now
 1011|   198k|                QTC::TC("qpdf", "QPDFTokenizer block long token");
 1012|   198k|                type = tt::tt_bad;
 1013|   198k|                state = st_token_ready;
 1014|   198k|                error_message = "exceeded allowable length while reading token";
 1015|   198k|            }
 1016|   299M|        }
 1017|   299M|    }
 1018|       |
 1019|  17.3M|    input.fastUnread(!in_token && !before_token);
  ------------------
  |  Branch (1019:22): [True: 16.3M, False: 992k]
  |  Branch (1019:35): [True: 16.3M, False: 15.2k]
  ------------------
 1020|       |
 1021|  17.3M|    if (type != tt::tt_eof) {
  ------------------
  |  Branch (1021:9): [True: 17.2M, False: 14.3k]
  ------------------
 1022|  17.2M|        input.setLastOffset(offset);
 1023|  17.2M|    }
 1024|       |
 1025|  17.3M|    return error_message.empty();
 1026|  17.3M|}
QPDFTokenizer.cc:_ZL12is_delimiterc:
   25|   125M|{
   26|   125M|    return (
   27|   125M|        ch == ' ' || ch == '\n' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (27:9): [True: 6.99M, False: 118M]
  |  Branch (27:22): [True: 528k, False: 117M]
  |  Branch (27:36): [True: 7.95M, False: 110M]
  |  Branch (27:49): [True: 29.0k, False: 109M]
  |  Branch (27:62): [True: 34.5k, False: 109M]
  |  Branch (27:75): [True: 8.25k, False: 109M]
  |  Branch (27:88): [True: 7.96k, False: 109M]
  ------------------
   28|   109M|        ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch == '\t' || ch == '\r' ||
  ------------------
  |  Branch (28:9): [True: 98.1k, False: 109M]
  |  Branch (28:22): [True: 77.4k, False: 109M]
  |  Branch (28:35): [True: 93.6k, False: 109M]
  |  Branch (28:48): [True: 58.1k, False: 109M]
  |  Branch (28:61): [True: 12.0k, False: 109M]
  |  Branch (28:74): [True: 27.1k, False: 109M]
  |  Branch (28:88): [True: 206k, False: 109M]
  ------------------
   29|   109M|        ch == '\v' || ch == '\f' || ch == 0);
  ------------------
  |  Branch (29:9): [True: 13.5k, False: 109M]
  |  Branch (29:23): [True: 58.4k, False: 109M]
  |  Branch (29:37): [True: 101k, False: 109M]
  ------------------
   30|   125M|}

_ZN10QPDF_ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEEb:
   39|    946|{
   40|    946|    if (sparse) {
  ------------------
  |  Branch (40:9): [True: 556, False: 390]
  ------------------
   41|    556|        sp = std::make_unique<Sparse>();
   42|  2.77M|        for (auto& item: v) {
  ------------------
  |  Branch (42:24): [True: 2.77M, False: 556]
  ------------------
   43|  2.77M|            if (item.raw_type_code() != ::ot_null || item.indirect()) {
  ------------------
  |  Branch (43:17): [True: 2.70M, False: 62.9k]
  |  Branch (43:54): [True: 236, False: 62.7k]
  ------------------
   44|  2.70M|                sp->elements[sp->size] = std::move(item);
   45|  2.70M|            }
   46|  2.77M|            ++sp->size;
   47|  2.77M|        }
   48|    556|    } else {
   49|    390|        elements = std::move(v);
   50|    390|    }
   51|    946|}
_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.60k|    BaseHandle(QPDFObject::create<QPDF_Array>(items))
   66|  2.60k|{
   67|  2.60k|}
_ZN4qpdf5ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   70|  8.97k|    BaseHandle(QPDFObject::create<QPDF_Array>(std::move(items)))
   71|  8.97k|{
   72|  8.97k|}
_ZN4qpdf5Array5emptyEv:
   76|  1.63k|{
   77|  1.63k|    return Array(std::vector<QPDFObjectHandle>());
   78|  1.63k|}
_ZN4qpdf5Array5beginEv:
   82|  31.6k|{
   83|  31.6k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (83:14): [True: 15.2k, False: 16.4k]
  ------------------
   84|  15.2k|        if (!a->sp) {
  ------------------
  |  Branch (84:13): [True: 14.7k, False: 470]
  ------------------
   85|  14.7k|            return a->elements.begin();
   86|  14.7k|        }
   87|    470|        if (!sp_elements) {
  ------------------
  |  Branch (87:13): [True: 470, False: 0]
  ------------------
   88|    470|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
   89|    470|        }
   90|    470|        return sp_elements->begin();
   91|  15.2k|    }
   92|  16.4k|    return {};
   93|  31.6k|}
_ZN4qpdf5Array3endEv:
   97|  31.6k|{
   98|  31.6k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (98:14): [True: 15.2k, False: 16.4k]
  ------------------
   99|  15.2k|        if (!a->sp) {
  ------------------
  |  Branch (99:13): [True: 14.7k, False: 470]
  ------------------
  100|  14.7k|            return a->elements.end();
  101|  14.7k|        }
  102|    470|        if (!sp_elements) {
  ------------------
  |  Branch (102:13): [True: 0, False: 470]
  ------------------
  103|      0|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
  104|      0|        }
  105|    470|        return sp_elements->end();
  106|  15.2k|    }
  107|  16.4k|    return {};
  108|  31.6k|}
_ZNK4qpdf5Array4sizeEv:
  178|   344k|{
  179|   344k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (179:14): [True: 295k, False: 49.4k]
  ------------------
  180|   295k|        return a->sp ? a->sp->size : a->elements.size();
  ------------------
  |  Branch (180:16): [True: 1.46k, False: 293k]
  ------------------
  181|   295k|    }
  182|  49.4k|    return 0;
  183|   344k|}
_ZNK4qpdf5ArrayixEm:
  187|   678k|{
  188|   678k|    static const QPDFObjectHandle null_obj;
  189|   678k|    auto a = as<QPDF_Array>();
  190|   678k|    if (!a) {
  ------------------
  |  Branch (190:9): [True: 945, False: 677k]
  ------------------
  191|    945|        return null_obj;
  192|    945|    }
  193|   677k|    if (a->sp) {
  ------------------
  |  Branch (193:9): [True: 873, False: 677k]
  ------------------
  194|    873|        auto const& iter = a->sp->elements.find(n);
  195|    873|        return iter == a->sp->elements.end() ? null_obj : iter->second;
  ------------------
  |  Branch (195:16): [True: 108, False: 765]
  ------------------
  196|    873|    }
  197|   677k|    return n >= a->elements.size() ? null_obj : a->elements[n];
  ------------------
  |  Branch (197:12): [True: 1.70k, False: 675k]
  ------------------
  198|   677k|}
_ZNK4qpdf5ArrayixEi:
  202|   672k|{
  203|   672k|    static const QPDFObjectHandle null_obj;
  204|   672k|    if (n < 0) {
  ------------------
  |  Branch (204:9): [True: 2.45k, False: 670k]
  ------------------
  205|  2.45k|        return null_obj;
  206|  2.45k|    }
  207|   670k|    return (*this)[static_cast<size_t>(n)];
  208|   672k|}
_ZNK4qpdf5Array3getEm:
  212|    137|{
  213|    137|    if (n >= size()) {
  ------------------
  |  Branch (213:9): [True: 0, False: 137]
  ------------------
  214|      0|        return {};
  215|      0|    }
  216|    137|    auto a = array();
  217|    137|    if (!a->sp) {
  ------------------
  |  Branch (217:9): [True: 137, False: 0]
  ------------------
  218|    137|        return a->elements[n];
  219|    137|    }
  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|    137|}
_ZNK4qpdf5Array3getEi:
  226|    137|{
  227|    137|    if (n < 0) {
  ------------------
  |  Branch (227:9): [True: 0, False: 137]
  ------------------
  228|      0|        return {};
  229|      0|    }
  230|    137|    return get(to_s(n));
  231|    137|}
_ZNK4qpdf5Array11getAsVectorEv:
  235|  9.87k|{
  236|  9.87k|    auto a = array();
  237|  9.87k|    if (a->sp) {
  ------------------
  |  Branch (237:9): [True: 500, False: 9.37k]
  ------------------
  238|    500|        std::vector<QPDFObjectHandle> v;
  239|    500|        v.reserve(size());
  240|   702k|        for (auto const& item: a->sp->elements) {
  ------------------
  |  Branch (240:30): [True: 702k, False: 500]
  ------------------
  241|   702k|            v.resize(item.first, null_oh);
  242|   702k|            v.emplace_back(item.second);
  243|   702k|        }
  244|    500|        v.resize(size(), null_oh);
  245|    500|        return v;
  246|  9.37k|    } else {
  247|  9.37k|        return a->elements;
  248|  9.37k|    }
  249|  9.87k|}
_ZN4qpdf5Array3setEmRK16QPDFObjectHandle:
  253|     22|{
  254|     22|    if (at >= size()) {
  ------------------
  |  Branch (254:9): [True: 0, False: 22]
  ------------------
  255|      0|        return false;
  256|      0|    }
  257|     22|    auto a = array();
  258|     22|    checkOwnership(oh);
  259|     22|    if (a->sp) {
  ------------------
  |  Branch (259:9): [True: 5, False: 17]
  ------------------
  260|      5|        a->sp->elements[at] = oh;
  261|     17|    } else {
  262|     17|        a->elements[at] = oh;
  263|     17|    }
  264|     22|    return true;
  265|     22|}
_ZN4qpdf5Array3setEiRK16QPDFObjectHandle:
  269|     22|{
  270|     22|    if (at < 0) {
  ------------------
  |  Branch (270:9): [True: 0, False: 22]
  ------------------
  271|      0|        return false;
  272|      0|    }
  273|     22|    return set(to_s(at), oh);
  274|     22|}
_ZN4qpdf5Array6insertEmRK16QPDFObjectHandle:
  290|  36.0k|{
  291|  36.0k|    auto a = array();
  292|  36.0k|    size_t sz = size();
  293|  36.0k|    if (at > sz) {
  ------------------
  |  Branch (293:9): [True: 0, False: 36.0k]
  ------------------
  294|      0|        return false;
  295|      0|    }
  296|  36.0k|    checkOwnership(item);
  297|  36.0k|    if (at == sz) {
  ------------------
  |  Branch (297:9): [True: 36.0k, False: 0]
  ------------------
  298|       |        // As special case, also allow insert beyond the end
  299|  36.0k|        push_back(item);
  300|  36.0k|        return true;
  301|  36.0k|    }
  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|  36.0k|{
  325|  36.0k|    if (at_i < 0) {
  ------------------
  |  Branch (325:9): [True: 0, False: 36.0k]
  ------------------
  326|      0|        return false;
  327|      0|    }
  328|  36.0k|    return insert(to_s(at_i), item);
  329|  36.0k|}
_ZN4qpdf5Array9push_backERK16QPDFObjectHandle:
  333|  58.5k|{
  334|  58.5k|    auto a = array();
  335|  58.5k|    checkOwnership(item);
  336|  58.5k|    if (a->sp) {
  ------------------
  |  Branch (336:9): [True: 0, False: 58.5k]
  ------------------
  337|      0|        a->sp->elements[(a->sp->size)++] = item;
  338|  58.5k|    } else {
  339|  58.5k|        a->elements.emplace_back(item);
  340|  58.5k|    }
  341|  58.5k|}
_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|  25.4k|{
  394|  25.4k|    if (auto array = Array(*this)) {
  ------------------
  |  Branch (394:14): [True: 25.4k, False: 0]
  ------------------
  395|  25.4k|        if (auto result = array[n]) {
  ------------------
  |  Branch (395:18): [True: 25.4k, False: 43]
  ------------------
  396|  25.4k|            return result;
  397|  25.4k|        }
  398|     43|        if (n >= 0 && std::cmp_less(n, array.size())) {
  ------------------
  |  Branch (398:13): [True: 43, False: 0]
  |  Branch (398:23): [True: 43, False: 0]
  ------------------
  399|       |            // sparse array null
  400|     43|            return newNull();
  401|     43|        }
  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|  25.4k|}
_ZNK16QPDFObjectHandle11isRectangleEv:
  412|  15.4k|{
  413|  15.4k|    Array array(*this);
  414|  17.5k|    for (auto const& oh: array) {
  ------------------
  |  Branch (414:24): [True: 17.5k, False: 15.2k]
  ------------------
  415|  17.5k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (415:13): [True: 166, False: 17.4k]
  ------------------
  416|    166|            return false;
  417|    166|        }
  418|  17.5k|    }
  419|  15.2k|    return array.size() == 4;
  420|  15.4k|}
_ZNK16QPDFObjectHandle16getArrayAsVectorEv:
  472|  9.40k|{
  473|  9.40k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (473:14): [True: 9.40k, False: 0]
  ------------------
  474|  9.40k|        return array.getAsVector();
  475|  9.40k|    }
  476|      0|    typeWarning("array", "treating as empty");
  477|      0|    QTC::TC("qpdf", "QPDFObjectHandle array treating as empty vector");
  478|      0|    return {};
  479|  9.40k|}
_ZNK4qpdf10BaseHandle4sizeEv:
  566|  24.2k|{
  567|  24.2k|    switch (resolved_type_code()) {
  568|  11.4k|    case ::ot_array:
  ------------------
  |  Branch (568:5): [True: 11.4k, False: 12.8k]
  ------------------
  569|  11.4k|        return as<QPDF_Array>()->size();
  570|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (570:5): [True: 0, False: 24.2k]
  ------------------
  571|      0|    case ::ot_reserved:
  ------------------
  |  Branch (571:5): [True: 0, False: 24.2k]
  ------------------
  572|  7.42k|    case ::ot_null:
  ------------------
  |  Branch (572:5): [True: 7.42k, False: 16.8k]
  ------------------
  573|  7.42k|    case ::ot_destroyed:
  ------------------
  |  Branch (573:5): [True: 0, False: 24.2k]
  ------------------
  574|  7.42k|    case ::ot_unresolved:
  ------------------
  |  Branch (574:5): [True: 0, False: 24.2k]
  ------------------
  575|  7.42k|    case ::ot_reference:
  ------------------
  |  Branch (575:5): [True: 0, False: 24.2k]
  ------------------
  576|  7.42k|        return 0;
  577|     19|    case ::ot_boolean:
  ------------------
  |  Branch (577:5): [True: 19, False: 24.2k]
  ------------------
  578|     95|    case ::ot_integer:
  ------------------
  |  Branch (578:5): [True: 76, False: 24.1k]
  ------------------
  579|    163|    case ::ot_real:
  ------------------
  |  Branch (579:5): [True: 68, False: 24.2k]
  ------------------
  580|    238|    case ::ot_string:
  ------------------
  |  Branch (580:5): [True: 75, False: 24.1k]
  ------------------
  581|  5.33k|    case ::ot_name:
  ------------------
  |  Branch (581:5): [True: 5.09k, False: 19.1k]
  ------------------
  582|  5.36k|    case ::ot_dictionary:
  ------------------
  |  Branch (582:5): [True: 35, False: 24.2k]
  ------------------
  583|  5.38k|    case ::ot_stream:
  ------------------
  |  Branch (583:5): [True: 19, False: 24.2k]
  ------------------
  584|  5.38k|    case ::ot_inlineimage:
  ------------------
  |  Branch (584:5): [True: 0, False: 24.2k]
  ------------------
  585|  5.38k|    case ::ot_operator:
  ------------------
  |  Branch (585:5): [True: 0, False: 24.2k]
  ------------------
  586|  5.38k|        return 1;
  587|      0|    default:
  ------------------
  |  Branch (587:5): [True: 0, False: 24.2k]
  ------------------
  588|      0|        throw std::logic_error("Unexpected type code in size"); // unreachable
  589|      0|        return 0;                                               // unreachable
  590|  24.2k|    }
  591|  24.2k|}
_ZNK4qpdf10BaseHandleixEm:
  595|  1.05k|{
  596|  1.05k|    if (resolved_type_code() == ::ot_array) {
  ------------------
  |  Branch (596:9): [True: 1.05k, False: 0]
  ------------------
  597|  1.05k|        return Array(obj)[n];
  598|  1.05k|    }
  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.05k|{
  608|  1.05k|    if (n < 0) {
  ------------------
  |  Branch (608:9): [True: 0, False: 1.05k]
  ------------------
  609|      0|        return {};
  610|      0|    }
  611|  1.05k|    return (*this)[static_cast<size_t>(n)];
  612|  1.05k|}
QPDF_Array.cc:_ZL4to_si:
   15|  58.3k|{
   16|  58.3k|    return static_cast<size_t>(n);
   17|  58.3k|}
_ZNK4qpdf5Array14checkOwnershipERK16QPDFObjectHandle:
   27|  94.6k|{
   28|  94.6k|    if (!item) {
  ------------------
  |  Branch (28:9): [True: 0, False: 94.6k]
  ------------------
   29|      0|        throw std::logic_error("Attempting to add an uninitialized object to a QPDF_Array.");
   30|      0|    }
   31|  94.6k|    if (qpdf() && item.qpdf() && qpdf() != item.qpdf()) {
  ------------------
  |  Branch (31:9): [True: 22, False: 94.5k]
  |  Branch (31:19): [True: 22, False: 0]
  |  Branch (31:34): [True: 0, False: 22]
  ------------------
   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|  94.6k|}
QPDF_Array.cc:_ZL4to_im:
   21|  22.1k|{
   22|  22.1k|    return static_cast<int>(n);
   23|  22.1k|}

_ZNK4qpdf14BaseDictionary4dictEv:
   12|  10.8k|{
   13|  10.8k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (13:14): [True: 10.8k, False: 0]
  ------------------
   14|  10.8k|        return d;
   15|  10.8k|    }
   16|      0|    throw std::runtime_error("Expected a dictionary but found a non-dictionary object");
   17|      0|    return nullptr; // unreachable
   18|  10.8k|}
_ZNK4qpdf10BaseHandleixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   22|   842k|{
   23|   842k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (23:14): [True: 832k, False: 9.94k]
  ------------------
   24|   832k|        auto it = d->items.find(key);
   25|   832k|        if (it != d->items.end()) {
  ------------------
  |  Branch (25:13): [True: 647k, False: 184k]
  ------------------
   26|   647k|            return it->second;
   27|   647k|        }
   28|   832k|    }
   29|   194k|    static const QPDFObjectHandle null_obj;
   30|   194k|    return null_obj;
   31|   842k|}
_ZNK4qpdf10BaseHandle8containsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   63|  52.4k|{
   64|  52.4k|    return !(*this)[key].null();
   65|  52.4k|}
_ZN4qpdf14BaseDictionary7getKeysEv:
   99|  10.8k|{
  100|  10.8k|    std::set<std::string> result;
  101|  37.7k|    for (auto& iter: dict()->items) {
  ------------------
  |  Branch (101:20): [True: 37.7k, False: 10.8k]
  ------------------
  102|  37.7k|        if (!iter.second.null()) {
  ------------------
  |  Branch (102:13): [True: 34.8k, False: 2.86k]
  ------------------
  103|  34.8k|            result.insert(iter.first);
  104|  34.8k|        }
  105|  37.7k|    }
  106|  10.8k|    return result;
  107|  10.8k|}
_ZN4qpdf10BaseHandle5eraseERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  117|  16.2k|{
  118|       |    // no-op if key does not exist
  119|  16.2k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (119:14): [True: 16.2k, False: 0]
  ------------------
  120|  16.2k|        return d->items.erase(key);
  121|  16.2k|    }
  122|      0|    return 0;
  123|  16.2k|}
_ZN4qpdf10BaseHandle7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  140|  38.9k|{
  141|  38.9k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (141:14): [True: 38.9k, False: 0]
  ------------------
  142|  38.9k|        if (value.null() && !value.indirect()) {
  ------------------
  |  Branch (142:13): [True: 529, False: 38.4k]
  |  Branch (142:29): [True: 529, 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|    529|            d->items.erase(key);
  147|  38.4k|        } else {
  148|       |            // add or replace value
  149|  38.4k|            d->items[key] = value;
  150|  38.4k|        }
  151|  38.9k|        return true;
  152|  38.9k|    }
  153|      0|    return false;
  154|  38.9k|}
_ZN4qpdf14BaseDictionary7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  172|  38.9k|{
  173|  38.9k|    if (!BaseHandle::replace(key, value)) {
  ------------------
  |  Branch (173:9): [True: 0, False: 38.9k]
  ------------------
  174|      0|        (void)dict();
  175|      0|    }
  176|  38.9k|}
_ZN4qpdf10DictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  179|  1.63k|    BaseDictionary(std::move(dict))
  180|  1.63k|{
  181|  1.63k|}
_ZN4qpdf10DictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  184|  44.1k|    BaseDictionary(obj)
  185|  44.1k|{
  186|  44.1k|}
_ZNK16QPDFObjectHandle14checkOwnershipERKS_:
  196|  28.9k|{
  197|  28.9k|    auto qpdf = getOwningQPDF();
  198|  28.9k|    auto item_qpdf = item.getOwningQPDF();
  199|  28.9k|    if (qpdf && item_qpdf && qpdf != item_qpdf) {
  ------------------
  |  Branch (199:9): [True: 27.3k, False: 1.61k]
  |  Branch (199:17): [True: 5.06k, False: 22.2k]
  |  Branch (199:30): [True: 0, False: 5.06k]
  ------------------
  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|  28.9k|}
_ZNK16QPDFObjectHandle6hasKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  208|  33.6k|{
  209|  33.6k|    if (Dictionary dict = *this) {
  ------------------
  |  Branch (209:20): [True: 33.5k, False: 146]
  ------------------
  210|  33.5k|        return dict.contains(key);
  211|  33.5k|    } else {
  212|    146|        typeWarning("dictionary", "returning false for a key containment request");
  213|    146|        QTC::TC("qpdf", "QPDFObjectHandle dictionary false for hasKey");
  214|    146|        return false;
  215|    146|    }
  216|  33.6k|}
_ZNK16QPDFObjectHandle6getKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  220|   224k|{
  221|   224k|    if (auto result = get(key)) {
  ------------------
  |  Branch (221:14): [True: 156k, False: 67.8k]
  ------------------
  222|   156k|        return result;
  223|   156k|    }
  224|  67.8k|    if (isDictionary()) {
  ------------------
  |  Branch (224:9): [True: 67.5k, False: 229]
  ------------------
  225|  67.5k|        static auto constexpr msg = " -> dictionary key $VD"sv;
  226|  67.5k|        return QPDF_Null::create(obj, msg, key);
  227|  67.5k|    }
  228|    229|    typeWarning("dictionary", "returning null for attempted key retrieval");
  229|    229|    static auto constexpr msg = " -> null returned from getting key $VD from non-Dictionary"sv;
  230|    229|    return QPDF_Null::create(obj, msg, "");
  231|  67.8k|}
_ZNK16QPDFObjectHandle12getKeyIfDictERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  235|  1.71k|{
  236|  1.71k|    return isNull() ? newNull() : getKey(key);
  ------------------
  |  Branch (236:12): [True: 256, False: 1.45k]
  ------------------
  237|  1.71k|}
_ZNK16QPDFObjectHandle7getKeysEv:
  241|  10.9k|{
  242|  10.9k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (242:14): [True: 10.8k, False: 166]
  ------------------
  243|  10.8k|        return dict.getKeys();
  244|  10.8k|    }
  245|    166|    typeWarning("dictionary", "treating as empty");
  246|    166|    QTC::TC("qpdf", "QPDFObjectHandle dictionary empty set for getKeys");
  247|    166|    return {};
  248|  10.9k|}
_ZN16QPDFObjectHandle10replaceKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  263|  32.1k|{
  264|  32.1k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (264:14): [True: 28.9k, False: 3.22k]
  ------------------
  265|  28.9k|        checkOwnership(value);
  266|  28.9k|        dict.replace(key, value);
  267|  28.9k|        return;
  268|  28.9k|    }
  269|  3.22k|    typeWarning("dictionary", "ignoring key replacement request");
  270|  3.22k|}
_ZN16QPDFObjectHandle9removeKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  289|     21|{
  290|     21|    if (erase(key) || isDictionary()) {
  ------------------
  |  Branch (290:9): [True: 21, False: 0]
  |  Branch (290:23): [True: 0, False: 0]
  ------------------
  291|     21|        return;
  292|     21|    }
  293|      0|    typeWarning("dictionary", "ignoring key removal request");
  294|      0|}

_ZN4QPDF3Doc7Objects7StreamsC2ERNS0_6CommonE:
  126|  18.5k|    Common(common),
  127|  18.5k|    copier_(std::make_shared<Copier>(*this))
  128|  18.5k|{
  129|  18.5k|}
_ZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  225|  13.1k|{
  226|  13.1k|    if (filter_factories_registered) [[unlikely]] {
  ------------------
  |  Branch (226:9): [True: 0, False: 13.1k]
  ------------------
  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.1k|    if (name == "/FlateDecode") {
  ------------------
  |  Branch (235:9): [True: 3.27k, False: 9.83k]
  ------------------
  236|  3.27k|        return SF_FlateLzwDecode::flate_factory;
  237|  3.27k|    }
  238|  9.83k|    if (name == "/Crypt") {
  ------------------
  |  Branch (238:9): [True: 1.01k, False: 8.82k]
  ------------------
  239|  1.01k|        return []() { return std::make_shared<SF_Crypt>(); };
  240|  1.01k|    }
  241|  8.82k|    if (name == "/LZWDecode") {
  ------------------
  |  Branch (241:9): [True: 566, False: 8.25k]
  ------------------
  242|    566|        return SF_FlateLzwDecode::lzw_factory;
  243|    566|    }
  244|  8.25k|    if (name == "/RunLengthDecode") {
  ------------------
  |  Branch (244:9): [True: 68, False: 8.18k]
  ------------------
  245|     68|        return SF_RunLengthDecode::factory;
  246|     68|    }
  247|  8.18k|    if (name == "/DCTDecode") {
  ------------------
  |  Branch (247:9): [True: 20, False: 8.16k]
  ------------------
  248|     20|        return SF_DCTDecode::factory;
  249|     20|    }
  250|  8.16k|    if (name == "/ASCII85Decode") {
  ------------------
  |  Branch (250:9): [True: 476, False: 7.69k]
  ------------------
  251|    476|        return SF_ASCII85Decode::factory;
  252|    476|    }
  253|  7.69k|    if (name == "/ASCIIHexDecode") {
  ------------------
  |  Branch (253:9): [True: 7, False: 7.68k]
  ------------------
  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|  7.68k|    if (name == "/Fl") {
  ------------------
  |  Branch (260:9): [True: 2.10k, False: 5.57k]
  ------------------
  261|  2.10k|        return SF_FlateLzwDecode::flate_factory;
  262|  2.10k|    }
  263|  5.57k|    if (name == "/AHx") {
  ------------------
  |  Branch (263:9): [True: 491, False: 5.08k]
  ------------------
  264|    491|        return SF_ASCIIHexDecode::factory;
  265|    491|    }
  266|  5.08k|    if (name == "/A85") {
  ------------------
  |  Branch (266:9): [True: 231, False: 4.85k]
  ------------------
  267|    231|        return SF_ASCII85Decode::factory;
  268|    231|    }
  269|  4.85k|    if (name == "/LZW") {
  ------------------
  |  Branch (269:9): [True: 3.27k, False: 1.57k]
  ------------------
  270|  3.27k|        return SF_FlateLzwDecode::lzw_factory;
  271|  3.27k|    }
  272|  1.57k|    if (name == "/RL") {
  ------------------
  |  Branch (272:9): [True: 1.10k, False: 476]
  ------------------
  273|  1.10k|        return SF_RunLengthDecode::factory;
  274|  1.10k|    }
  275|    476|    if (name == "/DCT") {
  ------------------
  |  Branch (275:9): [True: 92, False: 384]
  ------------------
  276|     92|        return SF_DCTDecode::factory;
  277|     92|    }
  278|    384|    return nullptr;
  279|    476|}
_ZN4qpdf6StreamC2ER4QPDF10QPDFObjGen16QPDFObjectHandlexm:
  283|  25.6k|    BaseHandle(QPDFObject::create<QPDF_Stream>(&qpdf, og, std::move(stream_dict), length))
  284|  25.6k|{
  285|  25.6k|    auto descr = std::make_shared<QPDFObject::Description>(
  286|  25.6k|        qpdf.getFilename() + ", stream object " + og.unparse(' '));
  287|  25.6k|    obj->setDescription(&qpdf, descr, offset);
  288|  25.6k|    setDictDescription();
  289|  25.6k|}
_ZN4qpdf6Stream18setDictDescriptionEv:
  451|  25.6k|{
  452|  25.6k|    auto s = stream();
  453|  25.6k|    if (!s->stream_dict.hasObjectDescription()) {
  ------------------
  |  Branch (453:9): [True: 0, False: 25.6k]
  ------------------
  454|      0|        s->stream_dict.setObjectDescription(
  455|      0|            obj->getQPDF(), obj->getDescription() + " -> stream dictionary");
  456|      0|    }
  457|  25.6k|}
_ZN4qpdf6Stream13getStreamDataE26qpdf_stream_decode_level_e:
  461|  9.92k|{
  462|  9.92k|    std::string result;
  463|  9.92k|    pl::String buf(result);
  464|  9.92k|    bool filtered;
  465|  9.92k|    pipeStreamData(&buf, &filtered, 0, decode_level, false, false);
  466|  9.92k|    if (!filtered) {
  ------------------
  |  Branch (466:9): [True: 2.41k, False: 7.51k]
  ------------------
  467|  2.41k|        throw QPDFExc(
  468|  2.41k|            qpdf_e_unsupported,
  469|  2.41k|            qpdf()->getFilename(),
  470|  2.41k|            "",
  471|  2.41k|            offset(),
  472|  2.41k|            "getStreamData called on unfilterable stream");
  473|  2.41k|    }
  474|  7.51k|    return result;
  475|  9.92k|}
_ZNK4qpdf6Stream14isRootMetadataEv:
  495|  9.82k|{
  496|  9.82k|    if (!stream()->stream_dict.isDictionaryOfType("/Metadata", "/XML")) {
  ------------------
  |  Branch (496:9): [True: 9.79k, False: 23]
  ------------------
  497|  9.79k|        return false;
  498|  9.79k|    }
  499|     23|    return qpdf()->getRoot()["/Metadata"].isSameObjectAs(obj);
  500|  9.82k|}
_ZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEE:
  506|  9.92k|{
  507|  9.92k|    auto s = stream();
  508|       |    // Check filters
  509|       |
  510|  9.92k|    auto const& filter_obj = s->stream_dict["/Filter"];
  511|       |
  512|  9.92k|    if (filter_obj.null()) {
  ------------------
  |  Branch (512:9): [True: 3.23k, False: 6.69k]
  ------------------
  513|       |        // No filters
  514|  3.23k|        return true;
  515|  3.23k|    }
  516|  6.69k|    if (filter_obj.size() > global::Limits::max_stream_filters()) {
  ------------------
  |  Branch (516:9): [True: 22, False: 6.67k]
  ------------------
  517|     22|        global::Limits::error();
  518|     22|        warn(
  519|     22|            "limits error(max-stream-filters): too many filters for stream; treating stream as "
  520|     22|            "not filterable");
  521|     22|        return false;
  522|     22|    }
  523|  6.67k|    if (filter_obj.isName()) {
  ------------------
  |  Branch (523:9): [True: 4.98k, False: 1.68k]
  ------------------
  524|       |        // One filter
  525|  4.98k|        auto ff = s->filter_factory(filter_obj.getName());
  526|  4.98k|        if (!ff) {
  ------------------
  |  Branch (526:13): [True: 210, False: 4.77k]
  ------------------
  527|    210|            return false;
  528|    210|        }
  529|  4.77k|        filters.emplace_back(ff());
  530|  4.77k|    } else if (Array array = filter_obj) {
  ------------------
  |  Branch (530:22): [True: 1.67k, False: 7]
  ------------------
  531|       |        // Potentially multiple filters
  532|  8.15k|        for (Name item: array) {
  ------------------
  |  Branch (532:23): [True: 8.15k, False: 1.48k]
  ------------------
  533|  8.15k|            if (!item) {
  ------------------
  |  Branch (533:17): [True: 23, False: 8.12k]
  ------------------
  534|     23|                warn("stream filter type is not name or array");
  535|     23|                return false;
  536|     23|            }
  537|  8.12k|            auto ff = s->filter_factory(item);
  538|  8.12k|            if (!ff) {
  ------------------
  |  Branch (538:17): [True: 174, False: 7.95k]
  ------------------
  539|    174|                filters.clear();
  540|    174|                return false;
  541|    174|            }
  542|  7.95k|            filters.emplace_back(ff());
  543|  7.95k|        }
  544|  1.67k|    } else {
  545|      7|        warn("stream filter type is not name or array");
  546|      7|        return false;
  547|      7|    }
  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.25k|    auto decode_obj = s->stream_dict.getKey("/DecodeParms");
  553|       |
  554|  6.25k|    auto can_filter = // linebreak
  555|  6.25k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  6.25k|        if (!filter.setDecodeParms(d_obj) ||
  557|  6.25k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  558|  6.25k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  559|  6.25k|            return false;
  560|  6.25k|        }
  561|  6.25k|        return true;
  562|  6.25k|    };
  563|       |
  564|  6.25k|    auto decode_array = decode_obj.as_array(strict);
  565|  6.25k|    if (!decode_array || decode_array.size() == 0) {
  ------------------
  |  Branch (565:9): [True: 6.20k, False: 47]
  |  Branch (565:26): [True: 6, False: 41]
  ------------------
  566|  6.21k|        if (decode_array) {
  ------------------
  |  Branch (566:13): [True: 6, False: 6.20k]
  ------------------
  567|      6|            decode_obj = QPDFObjectHandle::newNull();
  568|      6|        }
  569|       |
  570|  11.8k|        for (auto& filter: filters) {
  ------------------
  |  Branch (570:26): [True: 11.8k, False: 6.04k]
  ------------------
  571|  11.8k|            if (!can_filter(decode_level, *filter, decode_obj)) {
  ------------------
  |  Branch (571:17): [True: 170, False: 11.6k]
  ------------------
  572|    170|                return false;
  573|    170|            }
  574|  11.8k|        }
  575|  6.21k|    } 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|     41|        if (!filters.empty() && QIntC::to_size(decode_array.size()) != filters.size()) {
  ------------------
  |  Branch (578:13): [True: 38, False: 3]
  |  Branch (578:13): [True: 7, False: 34]
  |  Branch (578:33): [True: 7, False: 31]
  ------------------
  579|      7|            warn("stream /DecodeParms length is inconsistent with filters");
  580|      7|            return false;
  581|      7|        }
  582|       |
  583|     34|        int i = -1;
  584|    137|        for (auto& filter: filters) {
  ------------------
  |  Branch (584:26): [True: 137, False: 26]
  ------------------
  585|    137|            auto d_obj = decode_array.get(++i);
  586|    137|            if (!can_filter(decode_level, *filter, d_obj)) {
  ------------------
  |  Branch (586:17): [True: 8, False: 129]
  ------------------
  587|      8|                return false;
  588|      8|            }
  589|    137|        }
  590|     34|    }
  591|       |
  592|  6.07k|    return true;
  593|  6.25k|}
_ZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebb:
  603|  9.92k|{
  604|  9.92k|    auto s = stream();
  605|  9.92k|    std::vector<std::shared_ptr<QPDFStreamFilter>> filters;
  606|  9.92k|    bool ignored;
  607|  9.92k|    if (!filterp) {
  ------------------
  |  Branch (607:9): [True: 0, False: 9.92k]
  ------------------
  608|      0|        filterp = &ignored;
  609|      0|    }
  610|  9.92k|    bool& filter = *filterp;
  611|       |
  612|  9.92k|    const bool empty_stream = !s->stream_provider && !s->stream_data && s->length == 0;
  ------------------
  |  Branch (612:31): [True: 9.92k, False: 0]
  |  Branch (612:54): [True: 9.92k, False: 0]
  |  Branch (612:73): [True: 762, False: 9.16k]
  ------------------
  613|  9.92k|    const bool empty_stream_data = s->stream_data && s->stream_data->getSize() == 0;
  ------------------
  |  Branch (613:36): [True: 0, False: 9.92k]
  |  Branch (613:54): [True: 0, False: 0]
  ------------------
  614|  9.92k|    const bool empty = empty_stream || empty_stream_data;
  ------------------
  |  Branch (614:24): [True: 762, False: 9.16k]
  |  Branch (614:40): [True: 0, False: 9.16k]
  ------------------
  615|       |
  616|  9.92k|    if (empty_stream || empty_stream_data) {
  ------------------
  |  Branch (616:9): [True: 762, False: 9.16k]
  |  Branch (616:25): [True: 0, False: 9.16k]
  ------------------
  617|    762|        filter = true;
  618|    762|    }
  619|       |
  620|  9.92k|    filter = empty || encode_flags || decode_level != qpdf_dl_none;
  ------------------
  |  Branch (620:14): [True: 762, False: 9.16k]
  |  Branch (620:23): [True: 0, False: 9.16k]
  |  Branch (620:39): [True: 9.16k, False: 0]
  ------------------
  621|  9.92k|    if (filter) {
  ------------------
  |  Branch (621:9): [True: 9.92k, False: 0]
  ------------------
  622|  9.92k|        filter = filterable(decode_level, filters);
  623|  9.92k|    }
  624|       |
  625|  9.92k|    if (!pipeline) {
  ------------------
  |  Branch (625:9): [True: 0, False: 9.92k]
  ------------------
  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|  9.92k|    std::vector<std::unique_ptr<Pipeline>> to_delete;
  635|       |
  636|  9.92k|    ContentNormalizer normalizer;
  637|  9.92k|    if (filter) {
  ------------------
  |  Branch (637:9): [True: 9.30k, False: 627]
  ------------------
  638|  9.30k|        if (encode_flags & qpdf_ef_compress) {
  ------------------
  |  Branch (638:13): [True: 0, False: 9.30k]
  ------------------
  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|  9.30k|        if (encode_flags & qpdf_ef_normalize) {
  ------------------
  |  Branch (645:13): [True: 0, False: 9.30k]
  ------------------
  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|  9.30k|        for (auto iter = s->token_filters.rbegin(); iter != s->token_filters.rend(); ++iter) {
  ------------------
  |  Branch (652:53): [True: 0, False: 9.30k]
  ------------------
  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|  21.0k|        for (auto f_iter = filters.rbegin(); f_iter != filters.rend(); ++f_iter) {
  ------------------
  |  Branch (659:46): [True: 11.7k, False: 9.30k]
  ------------------
  660|  11.7k|            if (auto decode_pipeline = (*f_iter)->getDecodePipeline(pipeline)) {
  ------------------
  |  Branch (660:22): [True: 10.7k, False: 1.02k]
  ------------------
  661|  10.7k|                pipeline = decode_pipeline;
  662|  10.7k|            }
  663|  11.7k|            auto* flate = dynamic_cast<Pl_Flate*>(pipeline);
  664|  11.7k|            if (flate) {
  ------------------
  |  Branch (664:17): [True: 5.96k, False: 5.78k]
  ------------------
  665|  5.96k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });
  666|  5.96k|            }
  667|  11.7k|        }
  668|  9.30k|    }
  669|       |
  670|  9.92k|    if (s->stream_data.get()) {
  ------------------
  |  Branch (670:9): [True: 0, False: 9.92k]
  ------------------
  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|  9.92k|    } else if (s->stream_provider.get()) {
  ------------------
  |  Branch (674:16): [True: 0, False: 9.92k]
  ------------------
  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|  9.92k|    } else {
  699|  9.92k|        if (offset() == 0) {
  ------------------
  |  Branch (699:13): [True: 0, False: 9.92k]
  ------------------
  700|      0|            throw std::logic_error("pipeStreamData called for stream with no data");
  701|      0|        }
  702|  9.92k|        if (!Streams::pipeStreamData(
  ------------------
  |  Branch (702:13): [True: 1.79k, False: 8.12k]
  ------------------
  703|  9.92k|                qpdf(),
  704|  9.92k|                id_gen(),
  705|  9.92k|                offset(),
  706|  9.92k|                s->length,
  707|  9.92k|                s->stream_dict,
  708|  9.92k|                isRootMetadata(),
  709|  9.92k|                pipeline,
  710|  9.92k|                suppress_warnings,
  711|  9.92k|                will_retry)) {
  712|  1.79k|            filter = false;
  713|  1.79k|            return false;
  714|  1.79k|        }
  715|  9.92k|    }
  716|       |
  717|  8.12k|    if (filter && !suppress_warnings && normalizer.anyBadTokens()) {
  ------------------
  |  Branch (717:9): [True: 7.32k, False: 803]
  |  Branch (717:19): [True: 7.32k, False: 0]
  |  Branch (717:41): [True: 0, False: 7.32k]
  ------------------
  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|  8.12k|    return true;
  733|  9.92k|}
_ZN4qpdf6Stream4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  789|  2.40k|{
  790|  2.40k|    qpdf()->warn(qpdf_e_damaged_pdf, "", offset(), message);
  791|  2.40k|}
_ZNK16QPDFObjectHandle7getDictEv:
  795|  21.7k|{
  796|  21.7k|    return as_stream(error).getDict();
  797|  21.7k|}
_ZN16QPDFObjectHandle13getStreamDataE26qpdf_stream_decode_level_e:
  831|  7.58k|{
  832|  7.58k|    return std::make_shared<Buffer>(as_stream(error).getStreamData(level));
  833|  7.58k|}
QPDF_Stream.cc:_ZZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEEENK3$_0clIS1_S5_16QPDFObjectHandleEEbT_RT0_RT1_:
  555|  11.9k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  11.9k|        if (!filter.setDecodeParms(d_obj) ||
  ------------------
  |  Branch (556:13): [True: 172, False: 11.8k]
  |  Branch (556:13): [True: 178, False: 11.8k]
  ------------------
  557|  11.8k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  ------------------
  |  Branch (557:14): [True: 11.8k, False: 0]
  |  Branch (557:39): [True: 12, False: 11.8k]
  ------------------
  558|  11.8k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  ------------------
  |  Branch (558:14): [True: 0, False: 11.8k]
  |  Branch (558:47): [True: 0, False: 0]
  ------------------
  559|    178|            return false;
  560|    178|        }
  561|  11.8k|        return true;
  562|  11.9k|    };
_ZN4QPDF3Doc7Objects7Streams6CopierC2ERS2_:
   67|  18.5k|        QPDFObjectHandle::StreamDataProvider(true),
   68|  18.5k|        streams(streams)
   69|  18.5k|    {
   70|  18.5k|    }
_ZN4QPDF3Doc7Objects7Streams6CopierD2Ev:
   64|  18.5k|    ~Copier() final = default;
QPDF_Stream.cc:_ZZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_0clEv:
  239|  1.01k|        return []() { return std::make_shared<SF_Crypt>(); };
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_CryptC2Ev:
  136|  1.01k|        SF_Crypt() = default;
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt14setDecodeParmsE16QPDFObjectHandle:
  141|    971|        {
  142|       |            // we only validate here - processing happens in decryptStream
  143|    971|            if (Dictionary dict = decode_parms) {
  ------------------
  |  Branch (143:28): [True: 828, False: 143]
  ------------------
  144|  2.59k|                for (auto const& [key, value]: dict) {
  ------------------
  |  Branch (144:46): [True: 2.59k, False: 796]
  ------------------
  145|  2.59k|                    if (key == "/Type" &&
  ------------------
  |  Branch (145:25): [True: 163, False: 2.43k]
  |  Branch (145:25): [True: 149, False: 2.44k]
  ------------------
  146|    163|                        (value.null() || Name(value) == "/CryptFilterDecodeParms")) {
  ------------------
  |  Branch (146:26): [True: 83, False: 80]
  |  Branch (146:42): [True: 66, False: 14]
  ------------------
  147|    149|                        continue;
  148|    149|                    }
  149|  2.44k|                    if (key == "/Name") {
  ------------------
  |  Branch (149:25): [True: 78, False: 2.36k]
  ------------------
  150|     78|                        continue;
  151|     78|                    }
  152|  2.36k|                    if (!value.null()) {
  ------------------
  |  Branch (152:25): [True: 32, False: 2.33k]
  ------------------
  153|     32|                        return false;
  154|     32|                    }
  155|  2.36k|                }
  156|    796|                return true;
  157|    828|            }
  158|    143|            return decode_parms.null();
  159|    971|        }
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt17getDecodePipelineEP8Pipeline:
  163|    929|        {
  164|       |            // Not used -- handled by pipeStreamData
  165|    929|            return nullptr;
  166|    929|        }
QPDF_Stream.cc:_ZZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebbENK3$_0clEPKci:
  665|  2.34k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });

_ZNK4QPDF3Doc10Encryption4getVEv:
  131|  4.27k|{
  132|  4.27k|    return this->V;
  133|  4.27k|}
_ZNK4QPDF3Doc10Encryption4getREv:
  137|  7.46k|{
  138|  7.46k|    return this->R;
  139|  7.46k|}
_ZNK4QPDF3Doc10Encryption14getLengthBytesEv:
  143|  3.37k|{
  144|  3.37k|    return this->Length_bytes;
  145|  3.37k|}
_ZNK4QPDF3Doc10Encryption4getPEv:
  149|  1.56k|{
  150|  1.56k|    return static_cast<int>(P.to_ulong());
  151|  1.56k|}
_ZNK4QPDF3Doc10Encryption4getOEv:
  169|  2.80k|{
  170|  2.80k|    return this->O;
  171|  2.80k|}
_ZNK4QPDF3Doc10Encryption4getUEv:
  175|  3.62k|{
  176|  3.62k|    return this->U;
  177|  3.62k|}
_ZNK4QPDF3Doc10Encryption5getOEEv:
  181|      8|{
  182|      8|    return this->OE;
  183|      8|}
_ZNK4QPDF3Doc10Encryption5getUEEv:
  187|    322|{
  188|    322|    return this->UE;
  189|    322|}
_ZNK4QPDF3Doc10Encryption8getPermsEv:
  193|    330|{
  194|    330|    return this->Perms;
  195|    330|}
_ZNK4QPDF3Doc10Encryption6getId1Ev:
  199|  2.06k|{
  200|  2.06k|    return this->id1;
  201|  2.06k|}
_ZNK4QPDF3Doc10Encryption18getEncryptMetadataEv:
  205|  1.27k|{
  206|  1.27k|    return this->encrypt_metadata;
  207|  1.27k|}
_ZN4QPDF18trim_user_passwordERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  257|    197|{
  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|    197|    if (user_password.size() < key_bytes) {
  ------------------
  |  Branch (260:9): [True: 0, False: 197]
  ------------------
  261|      0|        return;
  262|      0|    }
  263|       |
  264|    197|    auto idx = user_password.find('\x28');
  265|       |
  266|    204|    while (idx != user_password.npos) {
  ------------------
  |  Branch (266:12): [True: 7, False: 197]
  ------------------
  267|      7|        if (padding_string.starts_with(user_password.substr(idx))) {
  ------------------
  |  Branch (267:13): [True: 0, False: 7]
  ------------------
  268|      0|            user_password.resize(idx);
  269|      0|            return;
  270|      0|        }
  271|      7|        QTC::TC("qpdf", "QPDF_encryption skip 0x28");
  272|      7|        idx = user_password.find('\x28', ++idx);
  273|      7|    }
  274|    197|}
_ZNK4QPDF3Doc10Encryption7hash_V5ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_SA_:
  346|  1.88k|{
  347|  1.88k|    Pl_SHA2 hash(256);
  348|  1.88k|    hash.writeString(password);
  349|  1.88k|    hash.writeString(salt);
  350|  1.88k|    hash.writeString(udata);
  351|  1.88k|    hash.finish();
  352|  1.88k|    std::string K = hash.getRawDigest();
  353|       |
  354|  1.88k|    std::string result;
  355|  1.88k|    if (getR() < 6) {
  ------------------
  |  Branch (355:9): [True: 94, False: 1.78k]
  ------------------
  356|     94|        result = K;
  357|  1.78k|    } else {
  358|       |        // Algorithm 2.B from ISO 32000-1 chapter 7: Computing a hash
  359|       |
  360|  1.78k|        int round_number = 0;
  361|  1.78k|        bool done = false;
  362|   131k|        while (!done) {
  ------------------
  |  Branch (362:16): [True: 129k, False: 1.78k]
  ------------------
  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|   129k|            ++round_number;
  376|   129k|            std::string K1 = password + K + udata;
  377|   129k|            qpdf_assert_debug(K.length() >= 32);
  ------------------
  |  |   11|   129k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (377:13): [True: 129k, False: 0]
  ------------------
  378|   129k|            std::string E = process_with_aes(
  379|   129k|                K.substr(0, 16),
  380|   129k|                true,
  381|   129k|                K1,
  382|   129k|                0,
  383|   129k|                64,
  384|   129k|                QUtil::unsigned_char_pointer(K.substr(16, 16)),
  385|   129k|                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|   129k|            int E_mod_3 = 0;
  392|  2.20M|            for (unsigned int i = 0; i < 16; ++i) {
  ------------------
  |  Branch (392:38): [True: 2.07M, False: 129k]
  ------------------
  393|  2.07M|                E_mod_3 += static_cast<unsigned char>(E.at(i));
  394|  2.07M|            }
  395|   129k|            E_mod_3 %= 3;
  396|   129k|            int next_hash = ((E_mod_3 == 0) ? 256 : (E_mod_3 == 1) ? 384 : 512);
  ------------------
  |  Branch (396:30): [True: 43.7k, False: 86.0k]
  |  Branch (396:53): [True: 42.5k, False: 43.4k]
  ------------------
  397|   129k|            Pl_SHA2 sha2(next_hash);
  398|   129k|            sha2.writeString(E);
  399|   129k|            sha2.finish();
  400|   129k|            K = sha2.getRawDigest();
  401|       |
  402|   129k|            if (round_number >= 64) {
  ------------------
  |  Branch (402:17): [True: 17.3k, False: 112k]
  ------------------
  403|  17.3k|                unsigned int ch = static_cast<unsigned char>(*(E.rbegin()));
  404|       |
  405|  17.3k|                if (ch <= QIntC::to_uint(round_number - 32)) {
  ------------------
  |  Branch (405:21): [True: 1.78k, False: 15.5k]
  ------------------
  406|  1.78k|                    done = true;
  407|  1.78k|                }
  408|  17.3k|            }
  409|   129k|        }
  410|  1.78k|        result = K.substr(0, 32);
  411|  1.78k|    }
  412|       |
  413|  1.88k|    return result;
  414|  1.88k|}
_ZN4QPDF16compute_data_keyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEiibii:
  433|  2.57k|{
  434|       |    // Algorithm 3.1 from the PDF 1.7 Reference Manual
  435|       |
  436|  2.57k|    std::string result = encryption_key;
  437|       |
  438|  2.57k|    if (encryption_V >= 5) {
  ------------------
  |  Branch (438:9): [True: 1.07k, False: 1.49k]
  ------------------
  439|       |        // Algorithm 3.1a (PDF 1.7 extension level 3): just use encryption key straight.
  440|  1.07k|        return result;
  441|  1.07k|    }
  442|       |
  443|       |    // Append low three bytes of object ID and low two bytes of generation
  444|  1.49k|    result.append(1, static_cast<char>(objid & 0xff));
  445|  1.49k|    result.append(1, static_cast<char>((objid >> 8) & 0xff));
  446|  1.49k|    result.append(1, static_cast<char>((objid >> 16) & 0xff));
  447|  1.49k|    result.append(1, static_cast<char>(generation & 0xff));
  448|  1.49k|    result.append(1, static_cast<char>((generation >> 8) & 0xff));
  449|  1.49k|    if (use_aes) {
  ------------------
  |  Branch (449:9): [True: 881, False: 616]
  ------------------
  450|    881|        result += "sAlT";
  451|    881|    }
  452|  1.49k|    return MD5::digest(result).substr(0, result.size());
  453|  2.57k|}
_ZNK4QPDF3Doc10Encryption22compute_encryption_keyERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  475|  1.23k|{
  476|  1.23k|    if (getV() >= 5) {
  ------------------
  |  Branch (476:9): [True: 0, False: 1.23k]
  ------------------
  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.23k|    } else {
  481|       |        // For V < 5, the encryption key is derived from the user
  482|       |        // password.
  483|  1.23k|        return compute_encryption_key_from_password(password);
  484|  1.23k|    }
  485|  1.23k|}
_ZNK4QPDF3Doc10Encryption36compute_encryption_key_from_passwordERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  489|  1.23k|{
  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.23k|    MD5 md5;
  498|  1.23k|    md5.encodeDataIncrementally(pad_or_truncate_password_V4(password));
  499|  1.23k|    md5.encodeDataIncrementally(getO());
  500|  1.23k|    char pbytes[4];
  501|  1.23k|    int p = getP();
  502|  1.23k|    pbytes[0] = static_cast<char>(p & 0xff);
  503|  1.23k|    pbytes[1] = static_cast<char>((p >> 8) & 0xff);
  504|  1.23k|    pbytes[2] = static_cast<char>((p >> 16) & 0xff);
  505|  1.23k|    pbytes[3] = static_cast<char>((p >> 24) & 0xff);
  506|  1.23k|    md5.encodeDataIncrementally(pbytes, 4);
  507|  1.23k|    md5.encodeDataIncrementally(getId1());
  508|  1.23k|    if (getR() >= 4 && !getEncryptMetadata()) {
  ------------------
  |  Branch (508:9): [True: 942, False: 292]
  |  Branch (508:24): [True: 2, False: 940]
  ------------------
  509|      2|        md5.encodeDataIncrementally("\xff\xff\xff\xff");
  510|      2|    }
  511|  1.23k|    return iterate_md5_digest(md5, (getR() >= 3 ? 50 : 0), getLengthBytes());
  ------------------
  |  Branch (511:37): [True: 1.08k, False: 147]
  ------------------
  512|  1.23k|}
_ZNK4QPDF3Doc10Encryption17compute_O_rc4_keyERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  517|    585|{
  518|    585|    if (getV() >= 5) {
  ------------------
  |  Branch (518:9): [True: 0, False: 585]
  ------------------
  519|      0|        throw std::logic_error("compute_O_rc4_key called for file with V >= 5");
  520|      0|    }
  521|    585|    std::string password = owner_password.empty() ? user_password : owner_password;
  ------------------
  |  Branch (521:28): [True: 585, False: 0]
  ------------------
  522|    585|    MD5 md5;
  523|    585|    md5.encodeDataIncrementally(pad_or_truncate_password_V4(password));
  524|    585|    return iterate_md5_digest(md5, (getR() >= 3 ? 50 : 0), getLengthBytes());
  ------------------
  |  Branch (524:37): [True: 512, False: 73]
  ------------------
  525|    585|}
_ZNK4QPDF3Doc10Encryption18compute_U_value_R2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  542|    146|{
  543|       |    // Algorithm 3.4 from the PDF 1.7 Reference Manual
  544|       |
  545|    146|    std::string k1 = compute_encryption_key(user_password);
  546|    146|    auto udata = padding_string;
  547|    146|    pad_short_parameter(k1, QIntC::to_size(getLengthBytes()));
  548|    146|    iterate_rc4(udata, k1, 1, false);
  549|    146|    return udata;
  550|    146|}
_ZNK4QPDF3Doc10Encryption18compute_U_value_R3ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  554|    827|{
  555|       |    // Algorithm 3.5 from the PDF 1.7 Reference Manual
  556|       |
  557|    827|    std::string k1 = compute_encryption_key(user_password);
  558|    827|    MD5 md5;
  559|    827|    md5.encodeDataIncrementally(padding_string);
  560|    827|    md5.encodeDataIncrementally(getId1());
  561|    827|    auto result = md5.digest();
  562|    827|    pad_short_parameter(k1, QIntC::to_size(getLengthBytes()));
  563|    827|    iterate_rc4(result, k1, 20, false);
  564|       |    // pad with arbitrary data -- make it consistent for the sake of testing
  565|    827|    result += "\x0\x21\x44\x69\x90\xb9\xe4\x11\x40\x71\xa4\xd9\x10\x49\x84\xc1"s;
  566|    827|    return result;
  567|    827|}
_ZNK4QPDF3Doc10Encryption15compute_U_valueERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  571|    973|{
  572|    973|    if (getR() >= 3) {
  ------------------
  |  Branch (572:9): [True: 827, False: 146]
  ------------------
  573|    827|        return compute_U_value_R3(user_password);
  574|    827|    }
  575|       |
  576|    146|    return compute_U_value_R2(user_password);
  577|    973|}
_ZNK4QPDF3Doc10Encryption22check_user_password_V4ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  581|    973|{
  582|       |    // Algorithm 3.6 from the PDF 1.7 Reference Manual
  583|       |
  584|    973|    std::string u_value = compute_U_value(user_password);
  585|    973|    size_t to_compare = (getR() >= 3 ? sizeof(MD5::Digest) : key_bytes);
  ------------------
  |  Branch (585:26): [True: 827, False: 146]
  ------------------
  586|    973|    return memcmp(getU().c_str(), u_value.c_str(), to_compare) == 0;
  587|    973|}
_ZNK4QPDF3Doc10Encryption22check_user_password_V5ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  591|    771|{
  592|       |    // Algorithm 3.11 from the PDF 1.7 extension level 3
  593|       |
  594|    771|    std::string user_data = getU().substr(0, 32);
  595|    771|    std::string validation_salt = getU().substr(32, 8);
  596|    771|    std::string password = user_password.substr(0, 127);
  597|    771|    return hash_V5(user_password.substr(0, 127), validation_salt, "") == user_data;
  598|    771|}
_ZNK4QPDF3Doc10Encryption19check_user_passwordERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  602|  1.42k|{
  603|  1.42k|    if (getV() < 5) {
  ------------------
  |  Branch (603:9): [True: 973, False: 449]
  ------------------
  604|    973|        return check_user_password_V4(user_password);
  605|    973|    } else {
  606|    449|        return check_user_password_V5(user_password);
  607|    449|    }
  608|  1.42k|}
_ZNK4QPDF3Doc10Encryption23check_owner_password_V4ERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKS8_:
  613|    585|{
  614|       |    // Algorithm 3.7 from the PDF 1.7 Reference Manual
  615|       |
  616|    585|    auto key = compute_O_rc4_key(user_password, owner_password);
  617|    585|    pad_short_parameter(key, QIntC::to_size(getLengthBytes()));
  618|    585|    auto new_user_password = O.substr(0, key_bytes);
  619|    585|    iterate_rc4(new_user_password, key, (getR() >= 3) ? 20 : 1, true);
  ------------------
  |  Branch (619:41): [True: 512, False: 73]
  ------------------
  620|    585|    if (check_user_password(new_user_password)) {
  ------------------
  |  Branch (620:9): [True: 197, False: 388]
  ------------------
  621|    197|        user_password = new_user_password;
  622|    197|        return true;
  623|    197|    }
  624|    388|    return false;
  625|    585|}
_ZNK4QPDF3Doc10Encryption23check_owner_password_V5ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  629|    779|{
  630|       |    // Algorithm 3.12 from the PDF 1.7 extension level 3
  631|       |
  632|    779|    std::string user_data = getU().substr(0, 48);
  633|    779|    std::string owner_data = getO().substr(0, 32);
  634|    779|    std::string validation_salt = getO().substr(32, 8);
  635|    779|    return hash_V5(owner_password.substr(0, 127), validation_salt, user_data) == owner_data;
  636|    779|}
_ZNK4QPDF3Doc10Encryption20check_owner_passwordERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKS8_:
  641|  1.03k|{
  642|  1.03k|    if (getV() < 5) {
  ------------------
  |  Branch (642:9): [True: 585, False: 449]
  ------------------
  643|    585|        return check_owner_password_V4(user_password, owner_password);
  644|    585|    } else {
  645|    449|        return check_owner_password_V5(owner_password);
  646|    449|    }
  647|  1.03k|}
_ZNK4QPDF3Doc10Encryption28compute_Perms_value_V5_clearEv:
  659|    330|{
  660|       |    // From algorithm 3.10 from the PDF 1.7 extension level 3
  661|       |    // cSpell:ignore Tadb
  662|    330|    std::string k = "    \xff\xff\xff\xffTadb    ";
  663|    330|    int perms = getP();
  664|  1.65k|    for (size_t i = 0; i < 4; ++i) {
  ------------------
  |  Branch (664:24): [True: 1.32k, False: 330]
  ------------------
  665|  1.32k|        k[i] = static_cast<char>(perms & 0xff);
  666|  1.32k|        perms >>= 8;
  667|  1.32k|    }
  668|    330|    if (!getEncryptMetadata()) {
  ------------------
  |  Branch (668:9): [True: 1, False: 329]
  ------------------
  669|      1|        k[8] = 'F';
  670|      1|    }
  671|    330|    QUtil::initializeWithRandomBytes(reinterpret_cast<unsigned char*>(&k[12]), 4);
  672|    330|    return k;
  673|    330|}
_ZNK4QPDF3Doc10Encryption36recover_encryption_key_with_passwordERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERb:
  678|    330|{
  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|    330|    perms_valid = false;
  686|    330|    std::string key_password = password.substr(0, 127);
  687|    330|    std::string key_salt;
  688|    330|    std::string user_data;
  689|    330|    std::string encrypted_file_key;
  690|    330|    if (check_owner_password_V5(key_password)) {
  ------------------
  |  Branch (690:9): [True: 8, False: 322]
  ------------------
  691|      8|        key_salt = getO().substr(40, 8);
  692|      8|        user_data = getU().substr(0, 48);
  693|      8|        encrypted_file_key = getOE().substr(0, 32);
  694|    322|    } else if (check_user_password_V5(key_password)) {
  ------------------
  |  Branch (694:16): [True: 322, False: 0]
  ------------------
  695|    322|        key_salt = getU().substr(40, 8);
  696|    322|        encrypted_file_key = getUE().substr(0, 32);
  697|    322|    }
  698|    330|    std::string intermediate_key = hash_V5(key_password, key_salt, user_data);
  699|    330|    std::string file_key = process_with_aes(intermediate_key, false, encrypted_file_key);
  700|       |
  701|       |    // Decrypt Perms and check against expected value
  702|    330|    auto perms_check = process_with_aes(file_key, false, getPerms()).substr(0, 12);
  703|    330|    perms_valid = compute_Perms_value_V5_clear().substr(0, 12) == perms_check;
  704|    330|    return file_key;
  705|    330|}
_ZNK4QPDF20EncryptionParameters11interpretCFERKN4qpdf4NameE:
  709|  2.08k|{
  710|  2.08k|    if (!cf) {
  ------------------
  |  Branch (710:9): [True: 1.11k, False: 978]
  ------------------
  711|       |        // Default: /Identity
  712|  1.11k|        return e_none;
  713|  1.11k|    }
  714|    978|    auto it = crypt_filters.find(cf);
  715|    978|    if (it != crypt_filters.end()) {
  ------------------
  |  Branch (715:9): [True: 374, False: 604]
  ------------------
  716|    374|        return it->second;
  717|    374|    }
  718|    604|    if (cf == "/Identity") {
  ------------------
  |  Branch (718:9): [True: 1, False: 603]
  ------------------
  719|      1|        return e_none;
  720|      1|    }
  721|    603|    return e_unknown;
  722|    604|}
_ZN4QPDF20EncryptionParameters10initializeERS_:
  732|  3.13k|{
  733|  3.13k|    if (encryption_initialized) {
  ------------------
  |  Branch (733:9): [True: 1, False: 3.13k]
  ------------------
  734|      1|        return;
  735|      1|    }
  736|  3.13k|    encryption_initialized = true;
  737|       |
  738|  3.13k|    auto& c = qpdf.m->c;
  739|  3.13k|    auto& qm = *qpdf.m;
  740|  3.13k|    auto& trailer = qm.trailer;
  741|  3.13k|    auto& file = qm.file;
  742|       |
  743|  3.13k|    auto warn_damaged_pdf = [&qpdf, c](std::string const& msg) {
  744|  3.13k|        qpdf.warn(c.damagedPDF("encryption dictionary", msg));
  745|  3.13k|    };
  746|  3.13k|    auto throw_damaged_pdf = [&qpdf](std::string const& msg) {
  747|  3.13k|        throw qpdf.m->c.damagedPDF("encryption dictionary", msg);
  748|  3.13k|    };
  749|  3.13k|    auto unsupported = [&file](std::string const& msg) -> QPDFExc {
  750|  3.13k|        return {
  751|  3.13k|            qpdf_e_unsupported,
  752|  3.13k|            file->getName(),
  753|  3.13k|            "encryption dictionary",
  754|  3.13k|            file->getLastOffset(),
  755|  3.13k|            msg};
  756|  3.13k|    };
  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.13k|    if (!trailer.contains("/Encrypt")) {
  ------------------
  |  Branch (762:9): [True: 1.85k, False: 1.28k]
  ------------------
  763|  1.85k|        return;
  764|  1.85k|    }
  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.28k|    encrypted = true;
  769|       |
  770|  1.28k|    std::string id1;
  771|  1.28k|    auto id_obj = trailer.getKey("/ID");
  772|  1.28k|    if (id_obj.size() != 2 || !id_obj.getArrayItem(0).isString()) {
  ------------------
  |  Branch (772:9): [True: 1.12k, False: 158]
  |  Branch (772:9): [True: 1.12k, False: 155]
  |  Branch (772:31): [True: 4, False: 154]
  ------------------
  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.12k|        qpdf.warn(qpdf.m->c.damagedPDF("trailer", "invalid /ID in trailer dictionary"));
  776|  1.12k|    } else {
  777|    155|        id1 = id_obj.getArrayItem(0).getStringValue();
  778|    155|    }
  779|       |
  780|  1.28k|    auto encryption_dict = trailer.getKey("/Encrypt");
  781|  1.28k|    if (!encryption_dict.isDictionary()) {
  ------------------
  |  Branch (781:9): [True: 1, False: 1.28k]
  ------------------
  782|      1|        throw qpdf.m->c.damagedPDF("/Encrypt in trailer dictionary is not a dictionary");
  783|      1|    }
  784|       |
  785|  1.28k|    if (Name(encryption_dict["/Filter"]) != "/Standard") {
  ------------------
  |  Branch (785:9): [True: 77, False: 1.20k]
  ------------------
  786|     77|        throw unsupported("unsupported encryption filter");
  787|     77|    }
  788|  1.20k|    if (!encryption_dict.getKey("/SubFilter").null()) {
  ------------------
  |  Branch (788:9): [True: 3, False: 1.20k]
  ------------------
  789|      3|        qpdf.warn(unsupported("file uses encryption SubFilters, which qpdf does not support"));
  790|      3|    }
  791|       |
  792|  1.20k|    if (!(encryption_dict.getKey("/V").isInteger() && encryption_dict.getKey("/R").isInteger() &&
  ------------------
  |  Branch (792:9): [True: 79, False: 1.12k]
  |  Branch (792:11): [True: 1.17k, False: 30]
  |  Branch (792:55): [True: 1.16k, False: 12]
  ------------------
  793|  1.16k|          encryption_dict.getKey("/O").isString() && encryption_dict.getKey("/U").isString() &&
  ------------------
  |  Branch (793:11): [True: 1.13k, False: 30]
  |  Branch (793:54): [True: 1.12k, False: 5]
  ------------------
  794|  1.12k|          encryption_dict.getKey("/P").isInteger())) {
  ------------------
  |  Branch (794:11): [True: 1.11k, False: 12]
  ------------------
  795|     79|        throw_damaged_pdf("some encryption dictionary parameters are missing or the wrong type");
  796|     79|    }
  797|       |
  798|  1.20k|    int V = encryption_dict.getKey("/V").getIntValueAsInt();
  799|  1.20k|    int R = encryption_dict.getKey("/R").getIntValueAsInt();
  800|  1.20k|    std::string O = encryption_dict.getKey("/O").getStringValue();
  801|  1.20k|    std::string U = encryption_dict.getKey("/U").getStringValue();
  802|  1.20k|    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.20k|    if (!(2 <= R && R <= 6 && (V == 1 || V == 2 || V == 4 || V == 5))) {
  ------------------
  |  Branch (806:11): [True: 1.11k, False: 93]
  |  Branch (806:21): [True: 1.09k, False: 14]
  |  Branch (806:32): [True: 11, False: 1.08k]
  |  Branch (806:42): [True: 62, False: 1.02k]
  |  Branch (806:52): [True: 524, False: 501]
  |  Branch (806:62): [True: 456, False: 45]
  ------------------
  807|     62|        throw unsupported(
  808|     62|            "Unsupported /R or /V in encryption dictionary; R = " + std::to_string(R) +
  809|     62|            " (max 6), V = " + std::to_string(V) + " (max 5)");
  810|     62|    }
  811|       |
  812|  1.14k|    P_ = std::bitset<32>(static_cast<unsigned long long>(p));
  813|  1.14k|    encryption_V = V;
  814|  1.14k|    R_ = R;
  815|       |
  816|       |    // OE, UE, and Perms are only present if V >= 5.
  817|  1.14k|    std::string OE;
  818|  1.14k|    std::string UE;
  819|  1.14k|    std::string Perms;
  820|       |
  821|  1.14k|    if (V < 5) {
  ------------------
  |  Branch (821:9): [True: 597, False: 546]
  ------------------
  822|       |        // These must be exactly the right number of bytes.
  823|    597|        pad_short_parameter(O, key_bytes);
  824|    597|        pad_short_parameter(U, key_bytes);
  825|    597|        if (!(O.length() == key_bytes && U.length() == key_bytes)) {
  ------------------
  |  Branch (825:15): [True: 589, False: 8]
  |  Branch (825:42): [True: 587, False: 2]
  ------------------
  826|     10|            throw_damaged_pdf("incorrect length for /O and/or /U in encryption dictionary");
  827|     10|        }
  828|    597|    } else {
  829|    546|        if (!(encryption_dict.getKey("/OE").isString() &&
  ------------------
  |  Branch (829:13): [True: 4, False: 542]
  |  Branch (829:15): [True: 455, False: 91]
  ------------------
  830|    455|              encryption_dict.getKey("/UE").isString() &&
  ------------------
  |  Branch (830:15): [True: 453, False: 2]
  ------------------
  831|    453|              encryption_dict.getKey("/Perms").isString())) {
  ------------------
  |  Branch (831:15): [True: 452, False: 1]
  ------------------
  832|      4|            throw_damaged_pdf(
  833|      4|                "some V=5 encryption dictionary parameters are missing or the wrong type");
  834|      4|        }
  835|    546|        OE = encryption_dict.getKey("/OE").getStringValue();
  836|    546|        UE = encryption_dict.getKey("/UE").getStringValue();
  837|    546|        Perms = encryption_dict.getKey("/Perms").getStringValue();
  838|       |
  839|       |        // These may be longer than the minimum number of bytes.
  840|    546|        pad_short_parameter(O, OU_key_bytes_V5);
  841|    546|        pad_short_parameter(U, OU_key_bytes_V5);
  842|    546|        pad_short_parameter(OE, OUE_key_bytes_V5);
  843|    546|        pad_short_parameter(UE, OUE_key_bytes_V5);
  844|    546|        pad_short_parameter(Perms, Perms_key_bytes_V5);
  845|    546|    }
  846|       |
  847|  1.14k|    int Length = 128; // Just take a guess.
  848|  1.14k|    if (V <= 1) {
  ------------------
  |  Branch (848:9): [True: 10, False: 1.13k]
  ------------------
  849|     10|        Length = 40;
  850|  1.13k|    } else if (V == 4) {
  ------------------
  |  Branch (850:16): [True: 518, False: 615]
  ------------------
  851|    518|        Length = 128;
  852|    615|    } else if (V == 5) {
  ------------------
  |  Branch (852:16): [True: 452, False: 163]
  ------------------
  853|    452|        Length = 256;
  854|    452|    } else {
  855|    163|        if (encryption_dict.getKey("/Length").isInteger()) {
  ------------------
  |  Branch (855:13): [True: 10, False: 153]
  ------------------
  856|     10|            Length = encryption_dict.getKey("/Length").getIntValueAsInt();
  857|     10|            if (Length % 8 || Length < 40 || Length > 128) {
  ------------------
  |  Branch (857:17): [True: 1, False: 9]
  |  Branch (857:31): [True: 1, False: 8]
  |  Branch (857:46): [True: 1, False: 7]
  ------------------
  858|      3|                Length = 128; // Just take a guess.
  859|      3|            }
  860|     10|        }
  861|    163|    }
  862|       |
  863|  1.14k|    encrypt_metadata = true;
  864|  1.14k|    if (V >= 4 && encryption_dict.getKey("/EncryptMetadata").isBool()) {
  ------------------
  |  Branch (864:9): [True: 970, False: 173]
  |  Branch (864:9): [True: 3, False: 1.14k]
  |  Branch (864:19): [True: 3, False: 967]
  ------------------
  865|      3|        encrypt_metadata = encryption_dict.getKey("/EncryptMetadata").getBoolValue();
  866|      3|    }
  867|       |
  868|  1.14k|    if (V == 4 || V == 5) {
  ------------------
  |  Branch (868:9): [True: 623, False: 520]
  |  Branch (868:19): [True: 451, False: 69]
  ------------------
  869|    969|        auto CF = encryption_dict.getKey("/CF");
  870|  3.13k|        for (auto const& [filter, cdict]: CF.as_dictionary()) {
  ------------------
  |  Branch (870:41): [True: 3.13k, False: 969]
  ------------------
  871|  3.13k|            if (cdict.isDictionary()) {
  ------------------
  |  Branch (871:17): [True: 1.97k, False: 1.15k]
  ------------------
  872|  1.97k|                encryption_method_e method = e_none;
  873|  1.97k|                if (Name const& CFM = cdict["/CFM"]) {
  ------------------
  |  Branch (873:33): [True: 828, False: 1.14k]
  ------------------
  874|    828|                    if (CFM == "/V2") {
  ------------------
  |  Branch (874:25): [True: 164, False: 664]
  ------------------
  875|    164|                        method = e_rc4;
  876|    664|                    } else if (CFM == "/AESV2") {
  ------------------
  |  Branch (876:32): [True: 113, False: 551]
  ------------------
  877|    113|                        method = e_aes;
  878|    551|                    } else if (CFM == "/AESV3") {
  ------------------
  |  Branch (878:32): [True: 96, False: 455]
  ------------------
  879|     96|                        method = e_aesv3;
  880|    455|                    } else {
  881|       |                        // Don't complain now -- maybe we won't need to reference this type.
  882|    455|                        method = e_unknown;
  883|    455|                    }
  884|    828|                }
  885|  1.97k|                crypt_filters[filter] = method;
  886|  1.97k|            }
  887|  3.13k|        }
  888|       |
  889|    969|        cf_stream = interpretCF(encryption_dict["/StmF"]);
  890|    969|        cf_string = interpretCF(encryption_dict["/StrF"]);
  891|    969|        if (Name const& EFF = encryption_dict["/EFF"]) {
  ------------------
  |  Branch (891:25): [True: 153, False: 816]
  ------------------
  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|    153|            cf_file = interpretCF(EFF);
  902|    816|        } else {
  903|    816|            cf_file = cf_stream;
  904|    816|        }
  905|    969|    }
  906|       |
  907|  1.14k|    Encryption data(V, R, Length / 8, p, O, U, OE, UE, Perms, id1, encrypt_metadata);
  908|  1.14k|    if (qm.cf.password_is_hex_key()) {
  ------------------
  |  Branch (908:9): [True: 0, False: 1.14k]
  ------------------
  909|       |        // ignore passwords in file
  910|      0|        encryption_key = QUtil::hex_decode(provided_password);
  911|      0|        return;
  912|      0|    }
  913|       |
  914|  1.14k|    owner_password_matched = data.check_owner_password(user_password, provided_password);
  915|  1.14k|    if (owner_password_matched && V < 5) {
  ------------------
  |  Branch (915:9): [True: 205, False: 938]
  |  Branch (915:35): [True: 197, False: 8]
  ------------------
  916|       |        // password supplied was owner password; user_password has been initialized for V < 5
  917|    197|        if (qpdf.getTrimmedUserPassword() == provided_password) {
  ------------------
  |  Branch (917:13): [True: 0, False: 197]
  ------------------
  918|      0|            user_password_matched = true;
  919|      0|            QTC::TC("qpdf", "QPDF_encryption user matches owner V < 5");
  920|      0|        }
  921|    946|    } else {
  922|    946|        user_password_matched = data.check_user_password(provided_password);
  923|    946|        if (user_password_matched) {
  ------------------
  |  Branch (923:13): [True: 386, False: 560]
  ------------------
  924|    386|            user_password = provided_password;
  925|    386|        }
  926|    946|    }
  927|  1.14k|    if (user_password_matched && owner_password_matched) {
  ------------------
  |  Branch (927:9): [True: 386, False: 757]
  |  Branch (927:34): [True: 0, False: 386]
  ------------------
  928|      0|        QTC::TC("qpdf", "QPDF_encryption same password", (V < 5) ? 0 : 1);
  ------------------
  |  Branch (928:58): [True: 0, False: 0]
  ------------------
  929|      0|    }
  930|  1.14k|    if (!(owner_password_matched || user_password_matched)) {
  ------------------
  |  Branch (930:11): [True: 314, False: 829]
  |  Branch (930:37): [True: 386, False: 443]
  ------------------
  931|    443|        throw QPDFExc(qpdf_e_password, file->getName(), "", 0, "invalid password");
  932|    443|    }
  933|       |
  934|    700|    if (V < 5) {
  ------------------
  |  Branch (934:9): [True: 261, False: 439]
  ------------------
  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|    261|        encryption_key = data.compute_encryption_key(user_password);
  938|    439|    } 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|    439|        bool perms_valid;
  942|    439|        encryption_key = data.recover_encryption_key_with_password(provided_password, perms_valid);
  943|    439|        if (!perms_valid) {
  ------------------
  |  Branch (943:13): [True: 310, False: 129]
  ------------------
  944|    310|            warn_damaged_pdf("/Perms field in encryption dictionary doesn't match expected value");
  945|    310|        }
  946|    439|    }
  947|    700|}
_ZN4QPDF15getKeyForObjectENSt3__110shared_ptrINS_20EncryptionParametersEEE10QPDFObjGenb:
  951|  17.1k|{
  952|  17.1k|    if (!encp->encrypted) {
  ------------------
  |  Branch (952:9): [True: 0, False: 17.1k]
  ------------------
  953|      0|        throw std::logic_error("request for encryption key in non-encrypted PDF");
  954|      0|    }
  955|       |
  956|  17.1k|    if (og != encp->cached_key_og) {
  ------------------
  |  Branch (956:9): [True: 2.57k, False: 14.5k]
  ------------------
  957|  2.57k|        encp->cached_object_encryption_key = compute_data_key(
  958|  2.57k|            encp->encryption_key, og.getObj(), og.getGen(), use_aes, encp->encryption_V, encp->R());
  959|  2.57k|        encp->cached_key_og = og;
  960|  2.57k|    }
  961|       |
  962|  17.1k|    return encp->cached_object_encryption_key;
  963|  17.1k|}
_ZN4QPDF13decryptStringERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE10QPDFObjGen:
  967|  17.2k|{
  968|  17.2k|    if (!og.isIndirect()) {
  ------------------
  |  Branch (968:9): [True: 0, False: 17.2k]
  ------------------
  969|      0|        return;
  970|      0|    }
  971|  17.2k|    bool use_aes = false;
  972|  17.2k|    if (m->encp->encryption_V >= 4) {
  ------------------
  |  Branch (972:9): [True: 13.1k, False: 4.08k]
  ------------------
  973|  13.1k|        switch (m->encp->cf_string) {
  974|    682|        case e_none:
  ------------------
  |  Branch (974:9): [True: 682, False: 12.5k]
  ------------------
  975|    682|            return;
  976|       |
  977|  11.2k|        case e_aes:
  ------------------
  |  Branch (977:9): [True: 11.2k, False: 1.89k]
  ------------------
  978|  11.2k|            use_aes = true;
  979|  11.2k|            break;
  980|       |
  981|    834|        case e_aesv3:
  ------------------
  |  Branch (981:9): [True: 834, False: 12.3k]
  ------------------
  982|    834|            use_aes = true;
  983|    834|            break;
  984|       |
  985|    198|        case e_rc4:
  ------------------
  |  Branch (985:9): [True: 198, False: 12.9k]
  ------------------
  986|    198|            break;
  987|       |
  988|    176|        default:
  ------------------
  |  Branch (988:9): [True: 176, False: 13.0k]
  ------------------
  989|    176|            warn(m->c.damagedPDF(
  990|    176|                "unknown encryption filter for strings (check /StrF in "
  991|    176|                "/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|    176|            m->encp->cf_string = e_aes;
  994|    176|            use_aes = true;
  995|    176|            break;
  996|  13.1k|        }
  997|  13.1k|    }
  998|       |
  999|  16.5k|    std::string key = getKeyForObject(m->encp, og, use_aes);
 1000|  16.5k|    try {
 1001|  16.5k|        if (use_aes) {
  ------------------
  |  Branch (1001:13): [True: 12.3k, False: 4.28k]
  ------------------
 1002|  12.3k|            QTC::TC("qpdf", "QPDF_encryption aes decode string");
 1003|  12.3k|            Pl_Buffer bufpl("decrypted string");
 1004|  12.3k|            Pl_AES_PDF pl("aes decrypt string", &bufpl, false, key);
 1005|  12.3k|            pl.writeString(str);
 1006|  12.3k|            pl.finish();
 1007|  12.3k|            str = bufpl.getString();
 1008|  12.3k|        } else {
 1009|  4.28k|            QTC::TC("qpdf", "QPDF_encryption rc4 decode string");
 1010|  4.28k|            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|  4.28k|            auto tmp = QUtil::make_unique_cstr(str);
 1014|  4.28k|            RC4 rc4(QUtil::unsigned_char_pointer(key), QIntC::to_int(key.length()));
 1015|  4.28k|            auto data = QUtil::unsigned_char_pointer(tmp.get());
 1016|  4.28k|            rc4.process(data, vlen, data);
 1017|  4.28k|            str = std::string(tmp.get(), vlen);
 1018|  4.28k|        }
 1019|  16.5k|    } 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|  16.5k|}
_ZN4QPDF13decryptStreamENSt3__110shared_ptrINS_20EncryptionParametersEEENS1_I11InputSourceEERS_RP8Pipeline10QPDFObjGenR16QPDFObjectHandlebRNS0_10unique_ptrIS7_NS0_14default_deleteIS7_EEEE:
 1040|    606|{
 1041|    606|    if (Name(stream_dict["/Type"]) == "/XRef") {
  ------------------
  |  Branch (1041:9): [True: 13, False: 593]
  ------------------
 1042|     13|        return;
 1043|     13|    }
 1044|    593|    bool use_aes = false;
 1045|    593|    if (encp->encryption_V >= 4) {
  ------------------
  |  Branch (1045:9): [True: 555, False: 38]
  ------------------
 1046|    555|        encryption_method_e method = e_unknown;
 1047|    555|        std::string method_source = "/StmF from /Encrypt dictionary";
 1048|       |
 1049|    555|        if (stream_dict.getKey("/Filter").isOrHasName("/Crypt")) {
  ------------------
  |  Branch (1049:13): [True: 30, False: 525]
  ------------------
 1050|     30|            if (Dictionary decode_parms = stream_dict["/DecodeParms"]) {
  ------------------
  |  Branch (1050:28): [True: 15, False: 15]
  ------------------
 1051|     15|                if (Name(decode_parms["/Type"]) == "/CryptFilterDecodeParms") {
  ------------------
  |  Branch (1051:21): [True: 2, False: 13]
  ------------------
 1052|      2|                    method = encp->interpretCF(decode_parms["/Name"]);
 1053|      2|                    method_source = "stream's Crypt decode parameters";
 1054|      2|                }
 1055|     15|            } else {
 1056|     15|                Array filter = stream_dict["/Filter"];
 1057|     15|                Array decode = stream_dict.getKey("/DecodeParms");
 1058|     15|                if (filter.size() == decode.size()) {
  ------------------
  |  Branch (1058:21): [True: 1, False: 14]
  ------------------
 1059|      1|                    size_t i = 0;
 1060|      1|                    for (Name item: filter) {
  ------------------
  |  Branch (1060:35): [True: 0, False: 1]
  ------------------
 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|      1|                }
 1071|     15|            }
 1072|     30|        }
 1073|       |
 1074|    555|        if (method == e_unknown) {
  ------------------
  |  Branch (1074:13): [True: 553, False: 2]
  ------------------
 1075|    553|            if (!encp->encrypt_metadata && is_root_metadata) {
  ------------------
  |  Branch (1075:17): [True: 0, False: 553]
  |  Branch (1075:44): [True: 0, False: 0]
  ------------------
 1076|      0|                method = e_none;
 1077|    553|            } else {
 1078|    553|                method = encp->cf_stream;
 1079|    553|            }
 1080|    553|        }
 1081|    555|        use_aes = false;
 1082|    555|        switch (method) {
 1083|     59|        case e_none:
  ------------------
  |  Branch (1083:9): [True: 59, False: 496]
  ------------------
 1084|     59|            return;
 1085|      0|            break;
 1086|       |
 1087|    229|        case e_aes:
  ------------------
  |  Branch (1087:9): [True: 229, False: 326]
  ------------------
 1088|    229|            use_aes = true;
 1089|    229|            break;
 1090|       |
 1091|     22|        case e_aesv3:
  ------------------
  |  Branch (1091:9): [True: 22, False: 533]
  ------------------
 1092|     22|            use_aes = true;
 1093|     22|            break;
 1094|       |
 1095|    189|        case e_rc4:
  ------------------
  |  Branch (1095:9): [True: 189, False: 366]
  ------------------
 1096|    189|            break;
 1097|       |
 1098|     56|        default:
  ------------------
  |  Branch (1098:9): [True: 56, False: 499]
  ------------------
 1099|       |            // filter local to this stream.
 1100|     56|            qpdf_for_warning.warn(
 1101|     56|                {qpdf_e_damaged_pdf,
 1102|     56|                 file->getName(),
 1103|     56|                 "",
 1104|     56|                 file->getLastOffset(),
 1105|     56|                 "unknown encryption filter for streams (check " + method_source +
 1106|     56|                     "); streams may be decrypted improperly"});
 1107|       |            // To avoid repeated warnings, reset cf_stream.  Assume we'd want to use AES if V == 4.
 1108|     56|            encp->cf_stream = e_aes;
 1109|     56|            use_aes = true;
 1110|     56|            break;
 1111|    555|        }
 1112|    555|    }
 1113|    534|    std::string key = getKeyForObject(encp, og, use_aes);
 1114|    534|    if (use_aes) {
  ------------------
  |  Branch (1114:9): [True: 307, False: 227]
  ------------------
 1115|    307|        decrypt_pipeline =
 1116|    307|            std::make_unique<Pl_AES_PDF>("AES stream decryption", pipeline, false, key);
 1117|    307|    } else {
 1118|    227|        decrypt_pipeline = std::make_unique<Pl_RC4>("RC4 stream decryption", pipeline, key);
 1119|    227|    }
 1120|    534|    pipeline = decrypt_pipeline.get();
 1121|    534|}
_ZNK4QPDF22getTrimmedUserPasswordEv:
 1219|    197|{
 1220|    197|    std::string result = m->encp->user_password;
 1221|    197|    trim_user_password(result);
 1222|    197|    return result;
 1223|    197|}
QPDF_encryption.cc:_ZL16process_with_aesRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEbS7_mjPKhm:
  323|   130k|{
  324|   130k|    Pl_Buffer buffer("buffer");
  325|   130k|    Pl_AES_PDF aes("aes", &buffer, encrypt, key);
  326|   130k|    if (iv) {
  ------------------
  |  Branch (326:9): [True: 129k, False: 660]
  ------------------
  327|   129k|        aes.setIV(iv, iv_length);
  328|   129k|    } else {
  329|    660|        aes.useZeroIV();
  330|    660|    }
  331|   130k|    aes.disablePadding();
  332|  8.44M|    for (unsigned int i = 0; i < repetitions; ++i) {
  ------------------
  |  Branch (332:30): [True: 8.31M, False: 130k]
  ------------------
  333|  8.31M|        aes.writeString(data);
  334|  8.31M|    }
  335|   130k|    aes.finish();
  336|   130k|    if (outlength == 0) {
  ------------------
  |  Branch (336:9): [True: 130k, False: 0]
  ------------------
  337|   130k|        return buffer.getString();
  338|   130k|    } else {
  339|      0|        return buffer.getString().substr(0, outlength);
  340|      0|    }
  341|   130k|}
QPDF_encryption.cc:_ZL27pad_or_truncate_password_V4NSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE:
  278|  1.81k|{
  279|  1.81k|    if (password.size() < key_bytes) {
  ------------------
  |  Branch (279:9): [True: 1.03k, False: 782]
  ------------------
  280|  1.03k|        password.append(padding_string);
  281|  1.03k|    }
  282|  1.81k|    password.resize(key_bytes);
  283|  1.81k|    return password;
  284|  1.81k|}
QPDF_encryption.cc:_ZL18iterate_md5_digestR3MD5ii:
  288|  1.81k|{
  289|  1.81k|    MD5::Digest digest;
  290|  1.81k|    md5.digest(digest);
  291|  1.81k|    auto len = std::min(QIntC::to_size(key_len), sizeof(digest));
  292|  81.7k|    for (int i = 0; i < iterations; ++i) {
  ------------------
  |  Branch (292:21): [True: 79.9k, False: 1.81k]
  ------------------
  293|  79.9k|        MD5 m;
  294|  79.9k|        m.encodeDataIncrementally(reinterpret_cast<char*>(digest), len);
  295|  79.9k|        m.digest(digest);
  296|  79.9k|    }
  297|  1.81k|    return {reinterpret_cast<char*>(digest), len};
  298|  1.81k|}
QPDF_encryption.cc:_ZL19pad_short_parameterRNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEm:
  418|  5.01k|{
  419|  5.01k|    if (param.length() < max_len) {
  ------------------
  |  Branch (419:9): [True: 2.83k, False: 2.17k]
  ------------------
  420|  2.83k|        QTC::TC("qpdf", "QPDF_encryption pad short parameter");
  421|  2.83k|        param.append(max_len - param.length(), '\0');
  422|  2.83k|    }
  423|  5.01k|}
QPDF_encryption.cc:_ZL11iterate_rc4RNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_17basic_string_viewIcS2_EEib:
  302|  1.55k|{
  303|  1.55k|    auto len = okey.size();
  304|  1.55k|    std::string key(len, '\0');
  305|  28.5k|    for (int i = 0; i < iterations; ++i) {
  ------------------
  |  Branch (305:21): [True: 26.9k, False: 1.55k]
  ------------------
  306|  26.9k|        int const xor_value = (reverse ? iterations - 1 - i : i);
  ------------------
  |  Branch (306:32): [True: 10.3k, False: 16.6k]
  ------------------
  307|   454k|        for (size_t j = 0; j < len; ++j) {
  ------------------
  |  Branch (307:28): [True: 427k, False: 26.9k]
  ------------------
  308|   427k|            key[j] = static_cast<char>(okey[j] ^ xor_value);
  309|   427k|        }
  310|  26.9k|        RC4::process(key, data);
  311|  26.9k|    }
  312|  1.55k|}
QPDF_encryption.cc:_ZZN4QPDF20EncryptionParameters10initializeERS_ENK3$_2clERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  749|    142|    auto unsupported = [&file](std::string const& msg) -> QPDFExc {
  750|    142|        return {
  751|    142|            qpdf_e_unsupported,
  752|    142|            file->getName(),
  753|    142|            "encryption dictionary",
  754|    142|            file->getLastOffset(),
  755|    142|            msg};
  756|    142|    };
QPDF_encryption.cc:_ZZN4QPDF20EncryptionParameters10initializeERS_ENK3$_1clERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  746|     93|    auto throw_damaged_pdf = [&qpdf](std::string const& msg) {
  747|     93|        throw qpdf.m->c.damagedPDF("encryption dictionary", msg);
  748|     93|    };
QPDF_encryption.cc:_ZZN4QPDF20EncryptionParameters10initializeERS_ENK3$_0clERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  743|    310|    auto warn_damaged_pdf = [&qpdf, c](std::string const& msg) {
  744|    310|        qpdf.warn(c.damagedPDF("encryption dictionary", msg));
  745|    310|    };

_ZN13QPDFXRefEntryC2Ev:
   30|   679k|QPDFXRefEntry::QPDFXRefEntry() = default;
_ZNK13QPDFXRefEntry7getTypeEv:
   42|   859k|{
   43|   859k|    return type;
   44|   859k|}
_ZNK13QPDFXRefEntry9getOffsetEv:
   48|   407k|{
   49|   407k|    util::assertion(type == 1, "getOffset called for xref entry of type != 1");
   50|   407k|    return this->field1;
   51|   407k|}
_ZNK13QPDFXRefEntry18getObjStreamNumberEv:
   55|   194k|{
   56|   194k|    util::assertion(type == 2, "getObjStreamNumber called for xref entry of type != 2");
   57|   194k|    return QIntC::to_int(field1);
   58|   194k|}
_ZN4QPDF3Doc7Objects18validatePDFVersionERPKcRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  165|  3.04k|{
  166|  3.04k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (166:9): [True: 1.21k, False: 1.83k]
  ------------------
  167|  1.21k|        return false;
  168|  1.21k|    }
  169|  6.07k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (169:12): [True: 4.23k, False: 1.83k]
  ------------------
  170|  4.23k|        version.append(1, *p++);
  171|  4.23k|    }
  172|  1.83k|    if (!(*p == '.' && util::is_digit(*(p + 1)))) {
  ------------------
  |  Branch (172:11): [True: 1.34k, False: 494]
  |  Branch (172:24): [True: 820, False: 522]
  ------------------
  173|  1.01k|        return false;
  174|  1.01k|    }
  175|    820|    version.append(1, *p++);
  176|  2.34k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (176:12): [True: 1.52k, False: 820]
  ------------------
  177|  1.52k|        version.append(1, *p++);
  178|  1.52k|    }
  179|    820|    return true;
  180|  1.83k|}
_ZN4QPDF3Doc7Objects10findHeaderEv:
  184|  3.04k|{
  185|  3.04k|    qpdf_offset_t global_offset = m->file->tell();
  186|  3.04k|    std::string line = m->file->readLine(1024);
  187|  3.04k|    char const* p = line.data();
  188|  3.04k|    util::assertion(strncmp(p, "%PDF-", 5) == 0, "findHeader is not looking at %PDF-");
  189|  3.04k|    p += 5;
  190|  3.04k|    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.04k|    if (!validatePDFVersion(p, version)) {
  ------------------
  |  Branch (193:9): [True: 2.22k, False: 820]
  ------------------
  194|  2.22k|        return false;
  195|  2.22k|    }
  196|    820|    m->pdf_version = version;
  197|    820|    if (global_offset != 0) {
  ------------------
  |  Branch (197:9): [True: 543, False: 277]
  ------------------
  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|    543|        m->file = std::make_shared<OffsetInputSource>(m->file, global_offset);
  202|    543|    }
  203|    820|    return true;
  204|  3.04k|}
_ZN4QPDF3Doc7Objects13findStartxrefEv:
  208|  7.60k|{
  209|  7.60k|    if (readToken(*m->file).isWord("startxref") && readToken(*m->file).isInteger()) {
  ------------------
  |  Branch (209:9): [True: 7.03k, False: 567]
  |  Branch (209:9): [True: 5.46k, False: 2.14k]
  |  Branch (209:52): [True: 5.46k, False: 1.57k]
  ------------------
  210|       |        // Position in front of offset token
  211|  5.46k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
  212|  5.46k|        return true;
  213|  5.46k|    }
  214|  2.14k|    return false;
  215|  7.60k|}
_ZN4QPDF3Doc7Objects5parseEPKc:
  219|  18.5k|{
  220|  18.5k|    if (password) {
  ------------------
  |  Branch (220:9): [True: 0, False: 18.5k]
  ------------------
  221|      0|        m->encp->provided_password = password;
  222|      0|    }
  223|       |
  224|       |    // Find the header anywhere in the first 1024 bytes of the file.
  225|  18.5k|    PatternFinder hf(*this, &Objects::findHeader);
  226|  18.5k|    if (!m->file->findFirst("%PDF-", 0, 1024, hf)) {
  ------------------
  |  Branch (226:9): [True: 17.6k, False: 820]
  ------------------
  227|  17.6k|        warn(damagedPDF("", -1, "can't find PDF header"));
  228|       |        // QPDFWriter writes files that usually require at least version 1.2 for /FlateDecode
  229|  17.6k|        m->pdf_version = "1.2";
  230|  17.6k|    }
  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|  18.5k|    m->file->seek(0, SEEK_END);
  235|  18.5k|    qpdf_offset_t end_offset = m->file->tell();
  236|  18.5k|    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|  18.5k|    if (m->xref_table_max_id > m->xref_table_max_offset / 3) {
  ------------------
  |  Branch (239:9): [True: 18.5k, False: 0]
  ------------------
  240|  18.5k|        m->xref_table_max_id = static_cast<int>(m->xref_table_max_offset / 3);
  241|  18.5k|    }
  242|  18.5k|    qpdf_offset_t start_offset = (end_offset > 1054 ? end_offset - 1054 : 0);
  ------------------
  |  Branch (242:35): [True: 2.77k, False: 15.7k]
  ------------------
  243|  18.5k|    PatternFinder sf(*this, &Objects::findStartxref);
  244|  18.5k|    qpdf_offset_t xref_offset = 0;
  245|  18.5k|    if (m->file->findLast("startxref", start_offset, 0, sf)) {
  ------------------
  |  Branch (245:9): [True: 5.10k, False: 13.4k]
  ------------------
  246|  5.10k|        xref_offset = QUtil::string_to_ll(readToken(*m->file).getValue().c_str());
  247|  5.10k|    }
  248|       |
  249|  18.5k|    try {
  250|  18.5k|        if (xref_offset == 0) {
  ------------------
  |  Branch (250:13): [True: 13.4k, False: 5.07k]
  ------------------
  251|  13.4k|            throw damagedPDF("", -1, "can't find startxref");
  252|  13.4k|        }
  253|  5.07k|        try {
  254|  5.07k|            read_xref(xref_offset);
  255|  5.07k|        } catch (QPDFExc&) {
  256|  3.26k|            throw;
  257|  3.26k|        } catch (std::exception& e) {
  258|    692|            throw damagedPDF("", -1, std::string("error reading xref: ") + e.what());
  259|    692|        }
  260|  17.3k|    } catch (QPDFExc& e) {
  261|  17.3k|        if (global::Options::inspection_mode()) {
  ------------------
  |  Branch (261:13): [True: 0, False: 17.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|  17.3k|        if (cf.surpress_recovery()) {
  ------------------
  |  Branch (272:13): [True: 0, False: 17.3k]
  ------------------
  273|      0|            throw;
  274|      0|        }
  275|  17.3k|        reconstruct_xref(e, xref_offset > 0);
  276|  17.3k|    }
  277|       |
  278|  3.13k|    m->encp->initialize(qpdf);
  279|  3.13k|    m->parsed = true;
  280|  3.13k|    if (!m->xref_table.empty() && !qpdf.getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (280:9): [True: 2.19k, False: 943]
  |  Branch (280:9): [True: 21, False: 3.11k]
  |  Branch (280:35): [True: 21, False: 2.17k]
  ------------------
  281|       |        // QPDFs created from JSON have an empty xref table and no root object yet.
  282|     21|        throw damagedPDF("", -1, "unable to find page tree");
  283|     21|    }
  284|  3.11k|    if (m->cf.max_warnings()) {
  ------------------
  |  Branch (284:9): [True: 2.06k, False: 1.04k]
  ------------------
  285|  2.06k|        if (m->pages.empty()) {
  ------------------
  |  Branch (285:13): [True: 9, False: 2.05k]
  ------------------
  286|      9|            throw damagedPDF("", -1, "no pages found");
  287|      9|        }
  288|  2.05k|        (void)m->cf.max_warnings(0);
  289|  2.05k|    }
  290|  3.11k|}
_ZN4QPDF3Doc7Objects7inParseEb:
  294|   250k|{
  295|   250k|    util::internal_error_if(
  296|   250k|        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|   250k|    );
  300|   250k|    m->in_parse = v;
  301|   250k|}
_ZN4QPDF3Doc7Objects10setTrailerE16QPDFObjectHandle:
  305|  8.34k|{
  306|  8.34k|    if (m->trailer) {
  ------------------
  |  Branch (306:9): [True: 612, False: 7.73k]
  ------------------
  307|    612|        return;
  308|    612|    }
  309|  7.73k|    m->trailer = obj;
  310|  7.73k|}
_ZN4QPDF3Doc7Objects16reconstruct_xrefER7QPDFExcb:
  314|  22.0k|{
  315|  22.0k|    if (m->reconstructed_xref) {
  ------------------
  |  Branch (315:9): [True: 4.36k, False: 17.6k]
  ------------------
  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.36k|        throw e;
  319|  4.36k|    }
  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|  17.6k|    const auto max_warnings = m->warnings.size() + 1000U;
  324|  17.6k|    auto check_warnings = [this, max_warnings]() {
  325|  17.6k|        if (m->warnings.size() > max_warnings) {
  326|  17.6k|            throw damagedPDF("", -1, "too many errors while reconstructing cross-reference table");
  327|  17.6k|        }
  328|  17.6k|    };
  329|       |
  330|  17.6k|    m->reconstructed_xref = true;
  331|       |    // We may find more objects, which may contain dangling references.
  332|  17.6k|    m->fixed_dangling_refs = false;
  333|       |
  334|  17.6k|    warn(damagedPDF("", -1, "file is damaged"));
  335|  17.6k|    warn(e);
  336|  17.6k|    warn(damagedPDF("", -1, "Attempting to reconstruct cross-reference table"));
  337|       |
  338|       |    // Delete all references to type 1 (uncompressed) objects
  339|  17.6k|    std::vector<QPDFObjGen> to_delete;
  340|   185k|    for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (340:26): [True: 185k, False: 17.6k]
  ------------------
  341|   185k|        if (iter.second.getType() == 1) {
  ------------------
  |  Branch (341:13): [True: 167k, False: 18.1k]
  ------------------
  342|   167k|            to_delete.emplace_back(iter.first);
  343|   167k|        }
  344|   185k|    }
  345|   167k|    for (auto const& iter: to_delete) {
  ------------------
  |  Branch (345:26): [True: 167k, False: 17.6k]
  ------------------
  346|   167k|        m->xref_table.erase(iter);
  347|   167k|    }
  348|       |
  349|  17.6k|    std::vector<std::tuple<int, int, qpdf_offset_t>> found_objects;
  350|  17.6k|    std::vector<qpdf_offset_t> trailers;
  351|  17.6k|    std::vector<qpdf_offset_t> startxrefs;
  352|       |
  353|  17.6k|    m->file->seek(0, SEEK_END);
  354|  17.6k|    qpdf_offset_t eof = m->file->tell();
  355|  17.6k|    m->file->seek(0, SEEK_SET);
  356|       |    // Don't allow very long tokens here during recovery. All the interesting tokens are covered.
  357|  17.6k|    static size_t const MAX_LEN = 10;
  358|  1.06M|    while (m->file->tell() < eof) {
  ------------------
  |  Branch (358:12): [True: 1.04M, False: 17.6k]
  ------------------
  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: 210k, False: 832k]
  ------------------
  362|   210k|            auto pos = m->file->tell();
  363|   210k|            auto t2 = m->objects.readToken(*m->file, MAX_LEN);
  364|   210k|            if (t2.isInteger() && m->objects.readToken(*m->file, MAX_LEN).isWord("obj")) {
  ------------------
  |  Branch (364:17): [True: 165k, False: 45.2k]
  |  Branch (364:17): [True: 95.3k, False: 115k]
  |  Branch (364:35): [True: 95.3k, False: 70.3k]
  ------------------
  365|  95.3k|                int obj = QUtil::string_to_int(t1.getValue().c_str());
  366|  95.3k|                if (obj > 0) {
  ------------------
  |  Branch (366:21): [True: 94.5k, False: 758]
  ------------------
  367|  94.5k|                    int gen = QUtil::string_to_int(t2.getValue().c_str());
  368|  94.5k|                    if (0 <= gen && gen < 65535) {
  ------------------
  |  Branch (368:25): [True: 94.3k, False: 252]
  |  Branch (368:37): [True: 94.0k, False: 252]
  ------------------
  369|  94.0k|                        if (obj <= m->xref_table_max_id) {
  ------------------
  |  Branch (369:29): [True: 92.7k, False: 1.34k]
  ------------------
  370|  92.7k|                            found_objects.emplace_back(obj, gen, token_start);
  371|  92.7k|                        } else {
  372|  1.34k|                            warn(damagedPDF(
  373|  1.34k|                                "",
  374|  1.34k|                                -1,
  375|  1.34k|                                "ignoring object with impossibly large id " + std::to_string(obj)));
  376|  1.34k|                        }
  377|  94.0k|                    }
  378|  94.5k|                }
  379|  95.3k|            }
  380|   210k|            m->file->seek(pos, SEEK_SET);
  381|   832k|        } else if (!m->trailer && t1.isWord("trailer")) {
  ------------------
  |  Branch (381:20): [True: 716k, False: 116k]
  |  Branch (381:20): [True: 110k, False: 722k]
  |  Branch (381:35): [True: 110k, False: 606k]
  ------------------
  382|   110k|            trailers.emplace_back(m->file->tell());
  383|   722k|        } else if (!found_startxref && t1.isWord("startxref")) {
  ------------------
  |  Branch (383:20): [True: 537k, False: 184k]
  |  Branch (383:20): [True: 18.4k, False: 703k]
  |  Branch (383:40): [True: 18.4k, False: 519k]
  ------------------
  384|  18.4k|            startxrefs.emplace_back(m->file->tell());
  385|  18.4k|        }
  386|  1.04M|        check_warnings();
  387|  1.04M|        m->file->findAndSkipNextEOL();
  388|  1.04M|    }
  389|       |
  390|  17.6k|    if (!found_startxref && !startxrefs.empty() && !found_objects.empty() &&
  ------------------
  |  Branch (390:9): [True: 13.6k, False: 4.06k]
  |  Branch (390:29): [True: 589, False: 13.0k]
  |  Branch (390:52): [True: 465, False: 124]
  ------------------
  391|    465|        startxrefs.back() > std::get<2>(found_objects.back())) {
  ------------------
  |  Branch (391:9): [True: 298, False: 167]
  ------------------
  392|    298|        auto xref_backup{m->xref_table};
  393|    298|        try {
  394|    298|            m->file->seek(startxrefs.back(), SEEK_SET);
  395|    298|            if (auto offset = QUtil::string_to_ll(readToken(*m->file).getValue().data())) {
  ------------------
  |  Branch (395:22): [True: 252, False: 46]
  ------------------
  396|    252|                read_xref(offset);
  397|       |
  398|    252|                if (qpdf.getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (398:21): [True: 1, False: 251]
  ------------------
  399|      1|                    warn(damagedPDF(
  400|      1|                        "", -1, "startxref was more than 1024 bytes before end of file"));
  401|      1|                    m->encp->initialize(qpdf);
  402|      1|                    m->parsed = true;
  403|      1|                    m->reconstructed_xref = false;
  404|      1|                    return;
  405|      1|                }
  406|    252|            }
  407|    298|        } catch (...) {
  408|       |            // ok, bad luck. Do recovery.
  409|    250|        }
  410|    297|        m->xref_table = std::move(xref_backup);
  411|    297|    }
  412|       |
  413|  17.6k|    auto rend = found_objects.rend();
  414|   110k|    for (auto it = found_objects.rbegin(); it != rend; it++) {
  ------------------
  |  Branch (414:44): [True: 92.5k, False: 17.6k]
  ------------------
  415|  92.5k|        auto [obj, gen, token_start] = *it;
  416|  92.5k|        insertXrefEntry(obj, 1, token_start, gen);
  417|  92.5k|        check_warnings();
  418|  92.5k|    }
  419|  17.6k|    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|  17.6k|    int end_index = trailers.size() > 100 ? static_cast<int>(trailers.size()) - 100 : 0;
  ------------------
  |  Branch (423:21): [True: 28, False: 17.6k]
  ------------------
  424|  36.7k|    for (auto it = trailers.rbegin(); it != std::prev(trailers.rend(), end_index); it++) {
  ------------------
  |  Branch (424:39): [True: 20.5k, False: 16.2k]
  ------------------
  425|  20.5k|        m->file->seek(*it, SEEK_SET);
  426|  20.5k|        auto t = readTrailer();
  427|  20.5k|        if (!t.isDictionary()) {
  ------------------
  |  Branch (427:13): [True: 18.0k, False: 2.40k]
  ------------------
  428|       |            // Oh well.  It was worth a try.
  429|  18.0k|        } else {
  430|  2.40k|            if (t.hasKey("/Root")) {
  ------------------
  |  Branch (430:17): [True: 1.39k, False: 1.00k]
  ------------------
  431|  1.39k|                m->trailer = t;
  432|  1.39k|                break;
  433|  1.39k|            }
  434|  1.00k|            warn(damagedPDF("trailer", *it, "recovered trailer has no /Root entry"));
  435|  1.00k|        }
  436|  19.1k|        check_warnings();
  437|  19.1k|    }
  438|       |
  439|  17.6k|    if (!m->trailer) {
  ------------------
  |  Branch (439:9): [True: 15.3k, False: 2.33k]
  ------------------
  440|  15.3k|        qpdf_offset_t max_offset{0};
  441|  15.3k|        size_t max_size{0};
  442|       |        // If there are any xref streams, take the last one to appear.
  443|  47.6k|        for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (443:30): [True: 47.6k, False: 15.3k]
  ------------------
  444|  47.6k|            auto entry = iter.second;
  445|  47.6k|            if (entry.getType() != 1) {
  ------------------
  |  Branch (445:17): [True: 1.22k, False: 46.3k]
  ------------------
  446|  1.22k|                continue;
  447|  1.22k|            }
  448|  46.3k|            auto oh = qpdf.getObject(iter.first);
  449|  46.3k|            try {
  450|  46.3k|                if (!oh.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (450:21): [True: 35.8k, False: 10.4k]
  ------------------
  451|  35.8k|                    continue;
  452|  35.8k|                }
  453|  46.3k|            } catch (std::exception&) {
  454|  3.76k|                continue;
  455|  3.76k|            }
  456|  6.72k|            auto offset = entry.getOffset();
  457|  6.72k|            auto size = oh.getDict().getKey("/Size").getUIntValueAsUInt();
  458|  6.72k|            if (size > max_size || (size == max_size && offset > max_offset)) {
  ------------------
  |  Branch (458:17): [True: 5.10k, False: 1.62k]
  |  Branch (458:37): [True: 1.62k, False: 0]
  |  Branch (458:57): [True: 1.53k, False: 88]
  ------------------
  459|  6.63k|                max_offset = offset;
  460|  6.63k|                setTrailer(oh.getDict());
  461|  6.63k|            }
  462|  6.72k|            check_warnings();
  463|  6.72k|        }
  464|  15.3k|        if (max_offset > 0) {
  ------------------
  |  Branch (464:13): [True: 6.02k, False: 9.33k]
  ------------------
  465|  6.02k|            try {
  466|  6.02k|                read_xref(max_offset, true);
  467|  6.02k|            } catch (std::exception&) {
  468|  3.41k|                warn(damagedPDF(
  469|  3.41k|                    "", -1, "error decoding candidate xref stream while recovering damaged file"));
  470|  3.41k|            }
  471|  6.02k|            QTC::TC("qpdf", "QPDF recover xref stream");
  472|  5.96k|        }
  473|  15.3k|    }
  474|       |
  475|  17.6k|    if (!m->trailer || (!m->parsed && !m->trailer.getKey("/Root").isDictionary())) {
  ------------------
  |  Branch (475:9): [True: 9.37k, False: 8.25k]
  |  Branch (475:9): [True: 15.8k, False: 1.76k]
  |  Branch (475:25): [True: 7.97k, False: 281]
  |  Branch (475:39): [True: 6.54k, False: 1.43k]
  ------------------
  476|       |        // Try to find a Root dictionary. As a quick fix try the one with the highest object id.
  477|  15.8k|        QPDFObjectHandle root;
  478|  89.8k|        for (auto const& iter: m->obj_cache) {
  ------------------
  |  Branch (478:30): [True: 89.8k, False: 15.8k]
  ------------------
  479|  89.8k|            try {
  480|  89.8k|                if (QPDFObjectHandle(iter.second.object).isDictionaryOfType("/Catalog")) {
  ------------------
  |  Branch (480:21): [True: 2.37k, False: 87.4k]
  ------------------
  481|  2.37k|                    root = iter.second.object;
  482|  2.37k|                }
  483|  89.8k|            } catch (std::exception&) {
  484|  5.83k|                continue;
  485|  5.83k|            }
  486|  89.8k|        }
  487|  15.8k|        if (root) {
  ------------------
  |  Branch (487:13): [True: 2.30k, False: 13.5k]
  ------------------
  488|  2.30k|            if (!m->trailer) {
  ------------------
  |  Branch (488:17): [True: 1.61k, False: 686]
  ------------------
  489|  1.61k|                warn(damagedPDF(
  490|  1.61k|                    "", -1, "unable to find trailer dictionary while recovering damaged file"));
  491|  1.61k|                m->trailer = QPDFObjectHandle::newDictionary();
  492|  1.61k|            }
  493|  2.30k|            m->trailer.replaceKey("/Root", root);
  494|  2.30k|        }
  495|  15.8k|    }
  496|       |
  497|  17.6k|    if (!m->trailer) {
  ------------------
  |  Branch (497:9): [True: 7.71k, False: 9.92k]
  ------------------
  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|  7.71k|        throw damagedPDF("", -1, "unable to find trailer dictionary while recovering damaged file");
  503|  7.71k|    }
  504|  9.92k|    if (m->xref_table.empty()) {
  ------------------
  |  Branch (504:9): [True: 351, False: 9.57k]
  ------------------
  505|       |        // We cannot check for an empty xref table in parse because empty tables are valid when
  506|       |        // creating QPDF objects from JSON.
  507|    351|        throw damagedPDF("", -1, "unable to find objects while recovering damaged file");
  508|    351|    }
  509|  9.57k|    check_warnings();
  510|  9.57k|    if (!m->parsed) {
  ------------------
  |  Branch (510:9): [True: 9.23k, False: 336]
  ------------------
  511|  9.23k|        m->parsed = !m->pages.empty();
  512|  9.23k|        if (!m->parsed) {
  ------------------
  |  Branch (512:13): [True: 1.02k, False: 8.21k]
  ------------------
  513|  1.02k|            throw damagedPDF("", -1, "unable to find any pages while recovering damaged file");
  514|  1.02k|        }
  515|  8.21k|        check_warnings();
  516|  8.21k|    }
  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|  9.57k|}
_ZN4QPDF3Doc7Objects9read_xrefExb:
  527|  11.3k|{
  528|  11.3k|    std::map<int, int> free_table;
  529|  11.3k|    std::set<qpdf_offset_t> visited;
  530|  23.5k|    while (xref_offset) {
  ------------------
  |  Branch (530:12): [True: 12.5k, False: 11.0k]
  ------------------
  531|  12.5k|        visited.insert(xref_offset);
  532|  12.5k|        char buf[7];
  533|  12.5k|        memset(buf, 0, sizeof(buf));
  534|  12.5k|        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|  12.5k|        bool done = false;
  540|  12.5k|        bool skipped_space = false;
  541|  28.7k|        while (!done) {
  ------------------
  |  Branch (541:16): [True: 16.1k, False: 12.5k]
  ------------------
  542|  16.1k|            char ch;
  543|  16.1k|            if (1 == m->file->read(&ch, 1)) {
  ------------------
  |  Branch (543:17): [True: 15.7k, False: 420]
  ------------------
  544|  15.7k|                if (util::is_space(ch)) {
  ------------------
  |  Branch (544:21): [True: 4.06k, False: 11.7k]
  ------------------
  545|  4.06k|                    skipped_space = true;
  546|  11.7k|                } else {
  547|  11.7k|                    m->file->unreadCh(ch);
  548|  11.7k|                    done = true;
  549|  11.7k|                }
  550|  15.7k|            } else {
  551|    420|                QTC::TC("qpdf", "QPDF eof skipping spaces before xref", skipped_space ? 0 : 1);
  ------------------
  |  Branch (551:73): [True: 0, False: 420]
  ------------------
  552|    420|                done = true;
  553|    420|            }
  554|  16.1k|        }
  555|       |
  556|  12.5k|        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|  12.5k|        if ((strncmp(buf, "xref", 4) == 0) && util::is_space(buf[4])) {
  ------------------
  |  Branch (559:13): [True: 2.35k, False: 10.1k]
  |  Branch (559:47): [True: 2.34k, False: 14]
  ------------------
  560|  2.34k|            if (skipped_space) {
  ------------------
  |  Branch (560:17): [True: 112, False: 2.23k]
  ------------------
  561|    112|                warn(damagedPDF("", -1, "extraneous whitespace seen before xref"));
  562|    112|            }
  563|  2.34k|            QTC::TC(
  564|  2.34k|                "qpdf",
  565|  2.34k|                "QPDF xref space",
  566|  2.34k|                ((buf[4] == '\n')       ? 0
  ------------------
  |  Branch (566:18): [True: 325, False: 2.01k]
  ------------------
  567|  2.34k|                     : (buf[4] == '\r') ? 1
  ------------------
  |  Branch (567:24): [True: 1.64k, False: 371]
  ------------------
  568|  2.01k|                     : (buf[4] == ' ')  ? 2
  ------------------
  |  Branch (568:24): [True: 223, False: 148]
  ------------------
  569|    371|                                        : 9999));
  570|  2.34k|            int skip = 4;
  571|       |            // buf is null-terminated, and util::is_space('\0') is false, so this won't overrun.
  572|  4.98k|            while (util::is_space(buf[skip])) {
  ------------------
  |  Branch (572:20): [True: 2.64k, False: 2.34k]
  ------------------
  573|  2.64k|                ++skip;
  574|  2.64k|            }
  575|  2.34k|            xref_offset = read_xrefTable(xref_offset + skip);
  576|  10.1k|        } else {
  577|  10.1k|            xref_offset = read_xrefStream(xref_offset, in_stream_recovery);
  578|  10.1k|        }
  579|  12.5k|        if (visited.contains(xref_offset)) {
  ------------------
  |  Branch (579:13): [True: 332, False: 12.1k]
  ------------------
  580|    332|            throw damagedPDF("", -1, "loop detected following xref tables");
  581|    332|        }
  582|  12.5k|    }
  583|       |
  584|  11.0k|    if (!m->trailer) {
  ------------------
  |  Branch (584:9): [True: 0, False: 11.0k]
  ------------------
  585|      0|        throw damagedPDF("", -1, "unable to find trailer while reading xref");
  586|      0|    }
  587|  11.0k|    int size = m->trailer.getKey("/Size").getIntValueAsInt();
  588|  11.0k|    int max_obj = 0;
  589|  11.0k|    if (!m->xref_table.empty()) {
  ------------------
  |  Branch (589:9): [True: 3.33k, False: 7.68k]
  ------------------
  590|  3.33k|        max_obj = m->xref_table.rbegin()->first.getObj();
  591|  3.33k|    }
  592|  11.0k|    if (!m->deleted_objects.empty()) {
  ------------------
  |  Branch (592:9): [True: 929, False: 10.0k]
  ------------------
  593|    929|        max_obj = std::max(max_obj, *(m->deleted_objects.rbegin()));
  594|    929|    }
  595|  11.0k|    if (size < 1 || (size - 1) != max_obj) {
  ------------------
  |  Branch (595:9): [True: 8.02k, False: 2.99k]
  |  Branch (595:21): [True: 2.36k, False: 628]
  ------------------
  596|  3.13k|        if (size == (max_obj + 2) && qpdf.getObject(max_obj + 1, 0).isStreamOfType("/XRef")) {
  ------------------
  |  Branch (596:13): [True: 154, False: 2.98k]
  |  Branch (596:13): [True: 5, False: 3.13k]
  |  Branch (596:38): [True: 5, False: 149]
  ------------------
  597|      5|            warn(damagedPDF(
  598|      5|                "",
  599|      5|                -1,
  600|      5|                "xref entry for the xref stream itself is missing - a common error handled "
  601|      5|                "correctly by qpdf and most other applications"));
  602|  3.13k|        } else {
  603|  3.13k|            warn(damagedPDF(
  604|  3.13k|                "",
  605|  3.13k|                -1,
  606|  3.13k|                ("reported number of objects (" + std::to_string(size) +
  607|  3.13k|                 ") is not one plus the highest object number (" + std::to_string(max_obj) + ")")));
  608|  3.13k|        }
  609|  3.13k|    }
  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|  11.0k|    m->deleted_objects.clear();
  614|       |
  615|       |    // Make sure we keep only the highest generation for any object.
  616|  11.0k|    QPDFObjGen last_og{-1, 0};
  617|   451k|    for (auto const& item: m->xref_table) {
  ------------------
  |  Branch (617:26): [True: 451k, False: 11.0k]
  ------------------
  618|   451k|        auto id = item.first.getObj();
  619|   451k|        if (id == last_og.getObj() && id > 0) {
  ------------------
  |  Branch (619:13): [True: 23.9k, False: 427k]
  |  Branch (619:39): [True: 23.9k, False: 0]
  ------------------
  620|  23.9k|            qpdf.removeObject(last_og);
  621|  23.9k|        }
  622|   451k|        last_og = item.first;
  623|   451k|    }
  624|  11.0k|}
_ZN4QPDF3Doc7Objects15parse_xrefFirstERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERiSB_SB_:
  628|  8.49k|{
  629|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  630|       |    // buffer.
  631|  8.49k|    char const* p = line.c_str();
  632|  8.49k|    char const* start = line.c_str();
  633|       |
  634|       |    // Skip zero or more spaces
  635|  9.88k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (635:12): [True: 1.39k, False: 8.49k]
  ------------------
  636|  1.39k|        ++p;
  637|  1.39k|    }
  638|       |    // Require digit
  639|  8.49k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (639:9): [True: 223, False: 8.26k]
  ------------------
  640|    223|        return false;
  641|    223|    }
  642|       |    // Gather digits
  643|  8.26k|    std::string obj_str;
  644|  28.1k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (644:12): [True: 19.8k, False: 8.26k]
  ------------------
  645|  19.8k|        obj_str.append(1, *p++);
  646|  19.8k|    }
  647|       |    // Require space
  648|  8.26k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (648:9): [True: 138, False: 8.12k]
  ------------------
  649|    138|        return false;
  650|    138|    }
  651|       |    // Skip spaces
  652|  27.1k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (652:12): [True: 19.0k, False: 8.12k]
  ------------------
  653|  19.0k|        ++p;
  654|  19.0k|    }
  655|       |    // Require digit
  656|  8.12k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (656:9): [True: 105, False: 8.02k]
  ------------------
  657|    105|        return false;
  658|    105|    }
  659|       |    // Gather digits
  660|  8.02k|    std::string num_str;
  661|  19.5k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (661:12): [True: 11.4k, False: 8.02k]
  ------------------
  662|  11.4k|        num_str.append(1, *p++);
  663|  11.4k|    }
  664|       |    // Skip any space including line terminators
  665|  28.0k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (665:12): [True: 20.0k, False: 8.02k]
  ------------------
  666|  20.0k|        ++p;
  667|  20.0k|    }
  668|  8.02k|    bytes = toI(p - start);
  669|  8.02k|    obj = QUtil::string_to_int(obj_str.c_str());
  670|  8.02k|    num = QUtil::string_to_int(num_str.c_str());
  671|  8.02k|    return true;
  672|  8.12k|}
_ZN4QPDF3Doc7Objects18read_bad_xrefEntryERxRiRc:
  676|  7.13k|{
  677|       |    // Reposition after initial read attempt and reread.
  678|  7.13k|    m->file->seek(m->file->getLastOffset(), SEEK_SET);
  679|  7.13k|    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.13k|    char const* p = line.data();
  684|       |
  685|       |    // Skip zero or more spaces. There aren't supposed to be any.
  686|  7.13k|    bool invalid = false;
  687|  8.57k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (687:12): [True: 1.44k, False: 7.13k]
  ------------------
  688|  1.44k|        ++p;
  689|  1.44k|        invalid = true;
  690|  1.44k|    }
  691|       |    // Require digit
  692|  7.13k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (692:9): [True: 45, False: 7.08k]
  ------------------
  693|     45|        return false;
  694|     45|    }
  695|       |    // Gather digits
  696|  7.08k|    std::string f1_str;
  697|  34.9k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (697:12): [True: 27.8k, False: 7.08k]
  ------------------
  698|  27.8k|        f1_str.append(1, *p++);
  699|  27.8k|    }
  700|       |    // Require space
  701|  7.08k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (701:9): [True: 56, False: 7.02k]
  ------------------
  702|     56|        return false;
  703|     56|    }
  704|  7.02k|    if (util::is_space(*(p + 1))) {
  ------------------
  |  Branch (704:9): [True: 895, False: 6.13k]
  ------------------
  705|    895|        invalid = true;
  706|    895|    }
  707|       |    // Skip spaces
  708|  15.3k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (708:12): [True: 8.35k, False: 7.02k]
  ------------------
  709|  8.35k|        ++p;
  710|  8.35k|    }
  711|       |    // Require digit
  712|  7.02k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (712:9): [True: 85, False: 6.94k]
  ------------------
  713|     85|        return false;
  714|     85|    }
  715|       |    // Gather digits
  716|  6.94k|    std::string f2_str;
  717|  28.6k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (717:12): [True: 21.7k, False: 6.94k]
  ------------------
  718|  21.7k|        f2_str.append(1, *p++);
  719|  21.7k|    }
  720|       |    // Require space
  721|  6.94k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (721:9): [True: 71, False: 6.87k]
  ------------------
  722|     71|        return false;
  723|     71|    }
  724|  6.87k|    if (util::is_space(*(p + 1))) {
  ------------------
  |  Branch (724:9): [True: 1.49k, False: 5.37k]
  ------------------
  725|  1.49k|        invalid = true;
  726|  1.49k|    }
  727|       |    // Skip spaces
  728|  16.6k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (728:12): [True: 9.81k, False: 6.87k]
  ------------------
  729|  9.81k|        ++p;
  730|  9.81k|    }
  731|  6.87k|    if ((*p == 'f') || (*p == 'n')) {
  ------------------
  |  Branch (731:9): [True: 1.65k, False: 5.22k]
  |  Branch (731:24): [True: 5.13k, False: 92]
  ------------------
  732|  6.78k|        type = *p;
  733|  6.78k|    } else {
  734|     92|        return false;
  735|     92|    }
  736|  6.78k|    if ((f1_str.length() != 10) || (f2_str.length() != 5)) {
  ------------------
  |  Branch (736:9): [True: 5.81k, False: 964]
  |  Branch (736:36): [True: 736, False: 228]
  ------------------
  737|  6.55k|        invalid = true;
  738|  6.55k|    }
  739|       |
  740|  6.78k|    if (invalid) {
  ------------------
  |  Branch (740:9): [True: 6.56k, False: 221]
  ------------------
  741|  6.56k|        warn(damagedPDF("xref table", "accepting invalid xref table entry"));
  742|  6.56k|    }
  743|       |
  744|  6.78k|    f1 = QUtil::string_to_ll(f1_str.c_str());
  745|  6.78k|    f2 = QUtil::string_to_int(f2_str.c_str());
  746|       |
  747|  6.78k|    return true;
  748|  6.87k|}
_ZN4QPDF3Doc7Objects14read_xrefEntryERxRiRc:
  754|  30.0k|{
  755|  30.0k|    std::array<char, 21> line;
  756|  30.0k|    if (m->file->read(line.data(), 20) != 20) {
  ------------------
  |  Branch (756:9): [True: 253, False: 29.8k]
  ------------------
  757|       |        // C++20: [[unlikely]]
  758|    253|        return false;
  759|    253|    }
  760|  29.8k|    line[20] = '\0';
  761|  29.8k|    char const* p = line.data();
  762|       |
  763|  29.8k|    int f1_len = 0;
  764|  29.8k|    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|   176k|    while (*p == '0') {
  ------------------
  |  Branch (770:12): [True: 146k, False: 29.8k]
  ------------------
  771|   146k|        ++f1_len;
  772|   146k|        ++p;
  773|   146k|    }
  774|   131k|    while (util::is_digit(*p) && f1_len++ < 10) {
  ------------------
  |  Branch (774:12): [True: 101k, False: 29.7k]
  |  Branch (774:34): [True: 101k, False: 11]
  ------------------
  775|   101k|        f1 *= 10;
  776|   101k|        f1 += *p++ - '0';
  777|   101k|    }
  778|       |    // Require space
  779|  29.8k|    if (!util::is_space(*p++)) {
  ------------------
  |  Branch (779:9): [True: 117, False: 29.6k]
  ------------------
  780|       |        // Entry doesn't start with space or digit.
  781|       |        // C++20: [[unlikely]]
  782|    117|        return false;
  783|    117|    }
  784|       |    // Gather digits. NB No risk of overflow as 99'999 < max int.
  785|   138k|    while (*p == '0') {
  ------------------
  |  Branch (785:12): [True: 108k, False: 29.6k]
  ------------------
  786|   108k|        ++f2_len;
  787|   108k|        ++p;
  788|   108k|    }
  789|  55.2k|    while (util::is_digit(*p) && f2_len++ < 5) {
  ------------------
  |  Branch (789:12): [True: 26.2k, False: 29.0k]
  |  Branch (789:34): [True: 25.5k, False: 674]
  ------------------
  790|  25.5k|        f2 *= 10;
  791|  25.5k|        f2 += static_cast<int>(*p++ - '0');
  792|  25.5k|    }
  793|  29.6k|    if (util::is_space(*p++) && (*p == 'f' || *p == 'n')) {
  ------------------
  |  Branch (793:9): [True: 28.7k, False: 967]
  |  Branch (793:34): [True: 3.64k, False: 25.0k]
  |  Branch (793:47): [True: 22.9k, False: 2.09k]
  ------------------
  794|       |        // C++20: [[likely]]
  795|  26.6k|        type = *p;
  796|       |        // No test for valid line[19].
  797|  26.6k|        if (*(++p) && *(++p) && (*p == '\n' || *p == '\r') && f1_len == 10 && f2_len == 5) {
  ------------------
  |  Branch (797:13): [True: 26.4k, False: 179]
  |  Branch (797:23): [True: 26.3k, False: 114]
  |  Branch (797:34): [True: 23.9k, False: 2.42k]
  |  Branch (797:48): [True: 401, False: 2.02k]
  |  Branch (797:63): [True: 23.1k, False: 1.21k]
  |  Branch (797:79): [True: 22.5k, False: 541]
  ------------------
  798|       |            // C++20: [[likely]]
  799|  22.5k|            return true;
  800|  22.5k|        }
  801|  26.6k|    }
  802|  7.13k|    return read_bad_xrefEntry(f1, f2, type);
  803|  29.6k|}
_ZN4QPDF3Doc7Objects14read_xrefTableEx:
  808|  2.34k|{
  809|  2.34k|    m->file->seek(xref_offset, SEEK_SET);
  810|  2.34k|    std::string line;
  811|  8.51k|    while (true) {
  ------------------
  |  Branch (811:12): [True: 8.49k, Folded]
  ------------------
  812|  8.49k|        line.assign(50, '\0');
  813|  8.49k|        m->file->read(line.data(), line.size());
  814|  8.49k|        int obj = 0;
  815|  8.49k|        int num = 0;
  816|  8.49k|        int bytes = 0;
  817|  8.49k|        if (!parse_xrefFirst(line, obj, num, bytes)) {
  ------------------
  |  Branch (817:13): [True: 466, False: 8.02k]
  ------------------
  818|    466|            throw damagedPDF("xref table", "xref syntax invalid");
  819|    466|        }
  820|  8.02k|        m->file->seek(m->file->getLastOffset() + bytes, SEEK_SET);
  821|  37.3k|        for (qpdf_offset_t i = obj; i - num < obj; ++i) {
  ------------------
  |  Branch (821:37): [True: 30.0k, False: 7.30k]
  ------------------
  822|  30.0k|            if (i == 0) {
  ------------------
  |  Branch (822:17): [True: 788, False: 29.2k]
  ------------------
  823|       |                // This is needed by checkLinearization()
  824|    788|                first_xref_item_offset_ = m->file->tell();
  825|    788|            }
  826|       |            // For xref_table, these will always be small enough to be ints
  827|  30.0k|            qpdf_offset_t f1 = 0;
  828|  30.0k|            int f2 = 0;
  829|  30.0k|            char type = '\0';
  830|  30.0k|            if (!read_xrefEntry(f1, f2, type)) {
  ------------------
  |  Branch (830:17): [True: 719, False: 29.3k]
  ------------------
  831|    719|                throw damagedPDF(
  832|    719|                    "xref table", "invalid xref entry (obj=" + std::to_string(i) + ")");
  833|    719|            }
  834|  29.3k|            if (type == 'f') {
  ------------------
  |  Branch (834:17): [True: 4.60k, False: 24.7k]
  ------------------
  835|  4.60k|                insertFreeXrefEntry(QPDFObjGen(toI(i), f2));
  836|  24.7k|            } else {
  837|  24.7k|                insertXrefEntry(toI(i), 1, f1, f2);
  838|  24.7k|            }
  839|  29.3k|        }
  840|  7.30k|        qpdf_offset_t pos = m->file->tell();
  841|  7.30k|        if (readToken(*m->file).isWord("trailer")) {
  ------------------
  |  Branch (841:13): [True: 1.12k, False: 6.17k]
  ------------------
  842|  1.12k|            break;
  843|  6.17k|        } else {
  844|  6.17k|            m->file->seek(pos, SEEK_SET);
  845|  6.17k|        }
  846|  7.30k|    }
  847|       |
  848|       |    // Set offset to previous xref table if any
  849|  1.15k|    QPDFObjectHandle cur_trailer = m->objects.readTrailer();
  850|  1.15k|    if (!cur_trailer.isDictionary()) {
  ------------------
  |  Branch (850:9): [True: 105, False: 1.05k]
  ------------------
  851|    105|        throw damagedPDF("", "expected trailer dictionary");
  852|    105|    }
  853|       |
  854|  1.05k|    if (!m->trailer) {
  ------------------
  |  Branch (854:9): [True: 961, False: 90]
  ------------------
  855|    961|        setTrailer(cur_trailer);
  856|       |
  857|    961|        if (!m->trailer.hasKey("/Size")) {
  ------------------
  |  Branch (857:13): [True: 127, False: 834]
  ------------------
  858|    127|            throw damagedPDF("trailer", "trailer dictionary lacks /Size key");
  859|    127|        }
  860|    834|        if (!m->trailer.getKey("/Size").isInteger()) {
  ------------------
  |  Branch (860:13): [True: 2, False: 832]
  ------------------
  861|      2|            throw damagedPDF("trailer", "/Size key in trailer dictionary is not an integer");
  862|      2|        }
  863|    834|    }
  864|       |
  865|    922|    if (cur_trailer.hasKey("/XRefStm")) {
  ------------------
  |  Branch (865:9): [True: 27, False: 895]
  ------------------
  866|     27|        if (cf.ignore_xref_streams()) {
  ------------------
  |  Branch (866:13): [True: 0, False: 27]
  ------------------
  867|      0|            QTC::TC("qpdf", "QPDF ignoring XRefStm in trailer");
  868|     27|        } else {
  869|     27|            if (cur_trailer.getKey("/XRefStm").isInteger()) {
  ------------------
  |  Branch (869:17): [True: 26, 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|     26|                (void)read_xrefStream(cur_trailer.getKey("/XRefStm").getIntValue());
  873|     26|            } else {
  874|      1|                throw damagedPDF("xref stream", xref_offset, "invalid /XRefStm");
  875|      1|            }
  876|     27|        }
  877|     27|    }
  878|       |
  879|    921|    if (cur_trailer.hasKey("/Prev")) {
  ------------------
  |  Branch (879:9): [True: 220, False: 701]
  ------------------
  880|    220|        if (!cur_trailer.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (880:13): [True: 1, False: 219]
  ------------------
  881|      1|            throw damagedPDF("trailer", "/Prev key in trailer dictionary is not an integer");
  882|      1|        }
  883|    219|        return cur_trailer.getKey("/Prev").getIntValue();
  884|    220|    }
  885|       |
  886|    701|    return 0;
  887|    921|}
_ZN4QPDF3Doc7Objects15read_xrefStreamExb:
  892|  9.81k|{
  893|  9.81k|    if (!cf.ignore_xref_streams()) {
  ------------------
  |  Branch (893:9): [True: 9.81k, False: 0]
  ------------------
  894|  9.81k|        QPDFObjectHandle xref_obj;
  895|  9.81k|        try {
  896|  9.81k|            m->in_read_xref_stream = true;
  897|  9.81k|            xref_obj = readObjectAtOffset(xref_offset, "xref stream", true);
  898|  9.81k|        } catch (QPDFExc&) {
  899|       |            // ignore -- report error below
  900|  1.18k|        }
  901|  9.81k|        m->in_read_xref_stream = false;
  902|  9.75k|        if (xref_obj.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (902:13): [True: 8.43k, False: 1.32k]
  ------------------
  903|  8.43k|            return processXRefStream(xref_offset, xref_obj, in_stream_recovery);
  904|  8.43k|        }
  905|  9.75k|    }
  906|       |
  907|  1.32k|    throw damagedPDF("", xref_offset, "xref not found");
  908|      0|    return 0; // unreachable
  909|  9.81k|}
_ZN4QPDF3Doc7Objects12processXRefWER16QPDFObjectHandleNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  914|  8.43k|{
  915|  8.43k|    auto W_obj = dict.getKey("/W");
  916|  8.43k|    if (!(W_obj.size() >= 3 && W_obj.getArrayItem(0).isInteger() &&
  ------------------
  |  Branch (916:9): [True: 333, False: 8.09k]
  |  Branch (916:11): [True: 8.15k, False: 271]
  |  Branch (916:32): [True: 8.14k, False: 14]
  ------------------
  917|  8.14k|          W_obj.getArrayItem(1).isInteger() && W_obj.getArrayItem(2).isInteger())) {
  ------------------
  |  Branch (917:11): [True: 8.12k, False: 19]
  |  Branch (917:48): [True: 8.09k, False: 29]
  ------------------
  918|    333|        throw damaged("Cross-reference stream does not have a proper /W key");
  919|    333|    }
  920|       |
  921|  8.09k|    std::array<int, 3> W;
  922|  8.09k|    int entry_size = 0;
  923|  8.09k|    auto w_vector = W_obj.getArrayAsVector();
  924|  8.09k|    int max_bytes = sizeof(qpdf_offset_t);
  925|  32.1k|    for (size_t i = 0; i < 3; ++i) {
  ------------------
  |  Branch (925:24): [True: 24.1k, False: 8.00k]
  ------------------
  926|  24.1k|        W[i] = w_vector[i].getIntValueAsInt();
  927|  24.1k|        if (W[i] > max_bytes) {
  ------------------
  |  Branch (927:13): [True: 47, False: 24.1k]
  ------------------
  928|     47|            throw damaged("Cross-reference stream's /W contains impossibly large values");
  929|     47|        }
  930|  24.1k|        if (W[i] < 0) {
  ------------------
  |  Branch (930:13): [True: 48, False: 24.0k]
  ------------------
  931|     48|            throw damaged("Cross-reference stream's /W contains negative values");
  932|     48|        }
  933|  24.0k|        entry_size += W[i];
  934|  24.0k|    }
  935|  8.00k|    if (entry_size == 0) {
  ------------------
  |  Branch (935:9): [True: 3, False: 7.99k]
  ------------------
  936|      3|        throw damaged("Cross-reference stream's /W indicates entry size of 0");
  937|      3|    }
  938|  7.99k|    return {entry_size, W};
  939|  8.00k|}
_ZN4QPDF3Doc7Objects15processXRefSizeER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  945|  7.99k|{
  946|       |    // Number of entries is limited by the highest possible object id and stream size.
  947|  7.99k|    auto max_num_entries = std::numeric_limits<int>::max();
  948|  7.99k|    if (max_num_entries > (std::numeric_limits<qpdf_offset_t>::max() / entry_size)) {
  ------------------
  |  Branch (948:9): [True: 0, False: 7.99k]
  ------------------
  949|      0|        max_num_entries = toI(std::numeric_limits<qpdf_offset_t>::max() / entry_size);
  950|      0|    }
  951|       |
  952|  7.99k|    auto Size_obj = dict.getKey("/Size");
  953|  7.99k|    long long size;
  954|  7.99k|    if (!dict.getKey("/Size").getValueAsInt(size)) {
  ------------------
  |  Branch (954:9): [True: 29, False: 7.96k]
  ------------------
  955|     29|        throw damaged("Cross-reference stream does not have a proper /Size key");
  956|  7.96k|    } else if (size < 0) {
  ------------------
  |  Branch (956:16): [True: 67, False: 7.90k]
  ------------------
  957|     67|        throw damaged("Cross-reference stream has a negative /Size key");
  958|  7.90k|    } else if (size >= max_num_entries) {
  ------------------
  |  Branch (958:16): [True: 71, False: 7.83k]
  ------------------
  959|     71|        throw damaged("Cross-reference stream has an impossibly large /Size key");
  960|     71|    }
  961|       |    // We are not validating that Size <= (Size key of parent xref / trailer).
  962|  7.83k|    return max_num_entries;
  963|  7.99k|}
_ZN4QPDF3Doc7Objects16processXRefIndexER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  969|  7.83k|{
  970|  7.83k|    auto size = dict.getKey("/Size").getIntValueAsInt();
  971|  7.83k|    auto Index_obj = dict.getKey("/Index");
  972|       |
  973|  7.83k|    if (Index_obj.isArray()) {
  ------------------
  |  Branch (973:9): [True: 1.23k, False: 6.60k]
  ------------------
  974|  1.23k|        std::vector<std::pair<int, int>> indx;
  975|  1.23k|        int num_entries = 0;
  976|  1.23k|        auto index_vec = Index_obj.getArrayAsVector();
  977|  1.23k|        if ((index_vec.size() % 2) || index_vec.size() < 2) {
  ------------------
  |  Branch (977:13): [True: 16, False: 1.21k]
  |  Branch (977:39): [True: 3, False: 1.21k]
  ------------------
  978|     19|            throw damaged("Cross-reference stream's /Index has an invalid number of values");
  979|     19|        }
  980|       |
  981|  1.21k|        int i = 0;
  982|  1.21k|        long long first = 0;
  983|  21.6k|        for (auto& val: index_vec) {
  ------------------
  |  Branch (983:23): [True: 21.6k, False: 991]
  ------------------
  984|  21.6k|            if (val.isInteger()) {
  ------------------
  |  Branch (984:17): [True: 21.6k, False: 25]
  ------------------
  985|  21.6k|                if (i % 2) {
  ------------------
  |  Branch (985:21): [True: 10.7k, False: 10.8k]
  ------------------
  986|  10.7k|                    auto count = val.getIntValue();
  987|  10.7k|                    if (count <= 0) {
  ------------------
  |  Branch (987:25): [True: 59, False: 10.7k]
  ------------------
  988|     59|                        throw damaged(
  989|     59|                            "Cross-reference stream section claims to contain " +
  990|     59|                            std::to_string(count) + " entries");
  991|     59|                    }
  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|  10.7k|                    if (first > (max_num_entries - count) ||
  ------------------
  |  Branch (997:25): [True: 58, False: 10.6k]
  ------------------
  998|  10.6k|                        count > (max_num_entries - num_entries)) {
  ------------------
  |  Branch (998:25): [True: 4, False: 10.6k]
  ------------------
  999|     62|                        throw damaged(
 1000|     62|                            "Cross-reference stream claims to contain too many entries: " +
 1001|     62|                            std::to_string(first) + " " + std::to_string(max_num_entries) + " " +
 1002|     62|                            std::to_string(num_entries));
 1003|     62|                    }
 1004|  10.6k|                    indx.emplace_back(static_cast<int>(first), static_cast<int>(count));
 1005|  10.6k|                    num_entries += static_cast<int>(count);
 1006|  10.8k|                } else {
 1007|  10.8k|                    first = val.getIntValue();
 1008|  10.8k|                    if (first < 0) {
  ------------------
  |  Branch (1008:25): [True: 46, False: 10.8k]
  ------------------
 1009|     46|                        throw damaged(
 1010|     46|                            "Cross-reference stream's /Index contains a negative object id");
 1011|  10.8k|                    } else if (first > max_num_entries) {
  ------------------
  |  Branch (1011:32): [True: 28, False: 10.7k]
  ------------------
 1012|     28|                        throw damaged(
 1013|     28|                            "Cross-reference stream's /Index contains an impossibly "
 1014|     28|                            "large object id");
 1015|     28|                    }
 1016|  10.8k|                }
 1017|  21.6k|            } else {
 1018|     25|                throw damaged(
 1019|     25|                    "Cross-reference stream's /Index's item " + std::to_string(i) +
 1020|     25|                    " is not an integer");
 1021|     25|            }
 1022|  21.4k|            i++;
 1023|  21.4k|        }
 1024|    991|        QTC::TC("qpdf", "QPDF xref /Index is array", index_vec.size() == 2 ? 0 : 1);
  ------------------
  |  Branch (1024:54): [True: 649, False: 342]
  ------------------
 1025|    991|        return {num_entries, indx};
 1026|  6.60k|    } else if (Index_obj.null()) {
  ------------------
  |  Branch (1026:16): [True: 6.59k, False: 6]
  ------------------
 1027|  6.59k|        return {size, {{0, size}}};
 1028|  6.59k|    } else {
 1029|      6|        throw damaged("Cross-reference stream does not have a proper /Index key");
 1030|      6|    }
 1031|  7.83k|}
_ZN4QPDF3Doc7Objects17processXRefStreamExR16QPDFObjectHandleb:
 1036|  8.43k|{
 1037|  8.43k|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1038|  8.43k|        return damagedPDF("xref stream", xref_offset, msg.data());
 1039|  8.43k|    };
 1040|       |
 1041|  8.43k|    auto dict = xref_obj.getDict();
 1042|       |
 1043|  8.43k|    auto [entry_size, W] = processXRefW(dict, damaged);
 1044|  8.43k|    int max_num_entries = processXRefSize(dict, entry_size, damaged);
 1045|  8.43k|    auto [num_entries, indx] = processXRefIndex(dict, max_num_entries, damaged);
 1046|       |
 1047|  8.43k|    std::shared_ptr<Buffer> bp = xref_obj.getStreamData(qpdf_dl_specialized);
 1048|  8.43k|    size_t actual_size = bp->getSize();
 1049|  8.43k|    auto expected_size = toS(entry_size) * toS(num_entries);
 1050|       |
 1051|  8.43k|    if (expected_size != actual_size) {
  ------------------
  |  Branch (1051:9): [True: 4.42k, False: 4.00k]
  ------------------
 1052|  4.42k|        QPDFExc x = damaged(
 1053|  4.42k|            "Cross-reference stream data has the wrong size; expected = " +
 1054|  4.42k|            std::to_string(expected_size) + "; actual = " + std::to_string(actual_size));
 1055|  4.42k|        if (expected_size > actual_size) {
  ------------------
  |  Branch (1055:13): [True: 863, False: 3.56k]
  ------------------
 1056|    863|            throw x;
 1057|  3.56k|        } else {
 1058|  3.56k|            warn(x);
 1059|  3.56k|        }
 1060|  4.42k|    }
 1061|       |
 1062|  7.56k|    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|  7.56k|    auto p = bp->getBuffer();
 1067|  7.56k|    for (auto [obj, sec_entries]: indx) {
  ------------------
  |  Branch (1067:33): [True: 7.25k, False: 7.56k]
  ------------------
 1068|       |        // Process a subsection.
 1069|  2.02M|        for (int i = 0; i < sec_entries; ++i) {
  ------------------
  |  Branch (1069:25): [True: 2.01M, False: 7.25k]
  ------------------
 1070|       |            // Read this entry
 1071|  2.01M|            std::array<qpdf_offset_t, 3> fields{};
 1072|  2.01M|            if (W[0] == 0) {
  ------------------
  |  Branch (1072:17): [True: 565k, False: 1.45M]
  ------------------
 1073|   565k|                fields[0] = 1;
 1074|   565k|            }
 1075|  8.06M|            for (size_t j = 0; j < 3; ++j) {
  ------------------
  |  Branch (1075:32): [True: 6.04M, False: 2.01M]
  ------------------
 1076|  12.7M|                for (int k = 0; k < W[j]; ++k) {
  ------------------
  |  Branch (1076:33): [True: 6.66M, False: 6.04M]
  ------------------
 1077|  6.66M|                    fields[j] <<= 8;
 1078|  6.66M|                    fields[j] |= *p++;
 1079|  6.66M|                }
 1080|  6.04M|            }
 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.01M|            if (saw_first_compressed_object) {
  ------------------
  |  Branch (1084:17): [True: 1.19M, False: 822k]
  ------------------
 1085|  1.19M|                if (fields[0] != 2) {
  ------------------
  |  Branch (1085:21): [True: 730k, False: 463k]
  ------------------
 1086|   730k|                    uncompressed_after_compressed_ = true;
 1087|   730k|                }
 1088|  1.19M|            } else if (fields[0] == 2) {
  ------------------
  |  Branch (1088:24): [True: 2.37k, False: 820k]
  ------------------
 1089|  2.37k|                saw_first_compressed_object = true;
 1090|  2.37k|            }
 1091|  2.01M|            if (obj == 0) {
  ------------------
  |  Branch (1091:17): [True: 3.87k, False: 2.01M]
  ------------------
 1092|       |                // This is needed by checkLinearization()
 1093|  3.87k|                first_xref_item_offset_ = xref_offset;
 1094|  2.01M|            } else if (fields[0] == 0) {
  ------------------
  |  Branch (1094:24): [True: 372k, False: 1.64M]
  ------------------
 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|   372k|                insertFreeXrefEntry(QPDFObjGen(obj, 0));
 1099|  1.64M|            } else {
 1100|  1.64M|                auto typ = toI(fields[0]);
 1101|  1.64M|                if (!in_stream_recovery || typ == 2) {
  ------------------
  |  Branch (1101:21): [True: 766k, False: 874k]
  |  Branch (1101:44): [True: 393k, False: 480k]
  ------------------
 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.15M|                    insertXrefEntry(obj, toI(fields[0]), fields[1], toI(fields[2]));
 1106|  1.15M|                }
 1107|  1.64M|            }
 1108|  2.01M|            ++obj;
 1109|  2.01M|        }
 1110|  7.25k|    }
 1111|       |
 1112|  7.56k|    if (!m->trailer) {
  ------------------
  |  Branch (1112:9): [True: 752, False: 6.81k]
  ------------------
 1113|    752|        setTrailer(dict);
 1114|    752|    }
 1115|       |
 1116|  7.56k|    if (dict.hasKey("/Prev")) {
  ------------------
  |  Branch (1116:9): [True: 1.32k, False: 6.24k]
  ------------------
 1117|  1.32k|        if (!dict.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (1117:13): [True: 42, False: 1.27k]
  ------------------
 1118|     42|            throw damagedPDF(
 1119|     42|                "xref stream", "/Prev key in xref stream dictionary is not an integer");
 1120|     42|        }
 1121|  1.27k|        return dict.getKey("/Prev").getIntValue();
 1122|  6.24k|    } else {
 1123|  6.24k|        return 0;
 1124|  6.24k|    }
 1125|  7.56k|}
_ZN4QPDF3Doc7Objects15insertXrefEntryEiixi:
 1129|  1.27M|{
 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.27M|    int new_gen = f0 == 2 ? 0 : f2;
  ------------------
  |  Branch (1136:19): [True: 465k, False: 810k]
  ------------------
 1137|       |
 1138|  1.27M|    if (!(f0 == 1 || f0 == 2)) {
  ------------------
  |  Branch (1138:11): [True: 695k, False: 581k]
  |  Branch (1138:22): [True: 465k, False: 115k]
  ------------------
 1139|   115k|        return;
 1140|   115k|    }
 1141|       |
 1142|  1.16M|    if (!(obj > 0 && obj <= m->xref_table_max_id && 0 <= f2 && new_gen < 65535)) {
  ------------------
  |  Branch (1142:11): [True: 1.16M, False: 503]
  |  Branch (1142:22): [True: 757k, False: 402k]
  |  Branch (1142:53): [True: 757k, False: 89]
  |  Branch (1142:64): [True: 755k, False: 2.59k]
  ------------------
 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|   405k|        return;
 1148|   405k|    }
 1149|       |
 1150|   755k|    if (m->deleted_objects.contains(obj)) {
  ------------------
  |  Branch (1150:9): [True: 1.99k, False: 753k]
  ------------------
 1151|  1.99k|        return;
 1152|  1.99k|    }
 1153|       |
 1154|   753k|    if (f0 == 2) {
  ------------------
  |  Branch (1154:9): [True: 352k, False: 400k]
  ------------------
 1155|   352k|        if (f1 == obj) {
  ------------------
  |  Branch (1155:13): [True: 501, False: 352k]
  ------------------
 1156|    501|            warn(
 1157|    501|                damagedPDF("xref stream", "self-referential object stream " + std::to_string(obj)));
 1158|    501|            return;
 1159|    501|        }
 1160|   352k|        if (f1 > m->xref_table_max_id) {
  ------------------
  |  Branch (1160:13): [True: 4.98k, False: 347k]
  ------------------
 1161|       |            // ignore impossibly large object stream ids
 1162|  4.98k|            warn(damagedPDF(
 1163|  4.98k|                "xref stream",
 1164|  4.98k|                "object stream id " + std::to_string(f1) + " for object " + std::to_string(obj) +
 1165|  4.98k|                    " is impossibly large"));
 1166|  4.98k|            return;
 1167|  4.98k|        }
 1168|   352k|    }
 1169|       |
 1170|   747k|    auto [iter, created] = m->xref_table.try_emplace(QPDFObjGen(obj, (f0 == 2 ? 0 : f2)));
  ------------------
  |  Branch (1170:71): [True: 347k, False: 400k]
  ------------------
 1171|   747k|    if (!created) {
  ------------------
  |  Branch (1171:9): [True: 67.9k, False: 679k]
  ------------------
 1172|  67.9k|        return;
 1173|  67.9k|    }
 1174|       |
 1175|   679k|    switch (f0) {
 1176|   340k|    case 1:
  ------------------
  |  Branch (1176:5): [True: 340k, False: 338k]
  ------------------
 1177|       |        // f2 is generation
 1178|   340k|        QTC::TC("qpdf", "QPDF xref gen > 0", ((f2 > 0) ? 1 : 0));
  ------------------
  |  Branch (1178:47): [True: 250k, False: 90.2k]
  ------------------
 1179|   340k|        iter->second = QPDFXRefEntry(f1);
 1180|   340k|        break;
 1181|       |
 1182|   338k|    case 2:
  ------------------
  |  Branch (1182:5): [True: 338k, False: 340k]
  ------------------
 1183|   338k|        iter->second = QPDFXRefEntry(toI(f1), f2);
 1184|   338k|        break;
 1185|       |
 1186|      0|    default:
  ------------------
  |  Branch (1186:5): [True: 0, False: 679k]
  ------------------
 1187|      0|        throw damagedPDF("xref stream", "unknown xref stream entry type " + std::to_string(f0));
 1188|      0|        break;
 1189|   679k|    }
 1190|   679k|}
_ZN4QPDF3Doc7Objects19insertFreeXrefEntryE10QPDFObjGen:
 1194|   376k|{
 1195|   376k|    if (!m->xref_table.contains(og) && og.getObj() <= m->xref_table_max_id) {
  ------------------
  |  Branch (1195:9): [True: 374k, False: 2.35k]
  |  Branch (1195:40): [True: 126k, False: 248k]
  ------------------
 1196|   126k|        m->deleted_objects.insert(og.getObj());
 1197|   126k|    }
 1198|   376k|}
_ZN4QPDF3Doc7Objects16resolveXRefTableEv:
 1230|  1.56k|{
 1231|  1.56k|    bool may_change = !m->reconstructed_xref;
 1232|   173k|    for (auto& iter: m->xref_table) {
  ------------------
  |  Branch (1232:20): [True: 173k, False: 1.47k]
  ------------------
 1233|   173k|        if (isUnresolved(iter.first)) {
  ------------------
  |  Branch (1233:13): [True: 155k, False: 17.5k]
  ------------------
 1234|   155k|            resolve(iter.first);
 1235|   155k|            if (may_change && m->reconstructed_xref) {
  ------------------
  |  Branch (1235:17): [True: 1.37k, False: 154k]
  |  Branch (1235:31): [True: 90, False: 1.28k]
  ------------------
 1236|     90|                return false;
 1237|     90|            }
 1238|   155k|        }
 1239|   173k|    }
 1240|  1.47k|    return true;
 1241|  1.56k|}
_ZN4QPDF21fixDanglingReferencesEb:
 1247|  6.61k|{
 1248|  6.61k|    if (m->fixed_dangling_refs) {
  ------------------
  |  Branch (1248:9): [True: 5.14k, False: 1.47k]
  ------------------
 1249|  5.14k|        return;
 1250|  5.14k|    }
 1251|  1.47k|    if (!m->objects.resolveXRefTable()) {
  ------------------
  |  Branch (1251:9): [True: 90, False: 1.38k]
  ------------------
 1252|     90|        m->objects.resolveXRefTable();
 1253|     90|    }
 1254|  1.47k|    m->fixed_dangling_refs = true;
 1255|  1.47k|}
_ZN4QPDF14getObjectCountEv:
 1259|  6.61k|{
 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.61k|    fixDanglingReferences();
 1264|  6.61k|    QPDFObjGen og;
 1265|  6.61k|    if (!m->obj_cache.empty()) {
  ------------------
  |  Branch (1265:9): [True: 6.52k, False: 91]
  ------------------
 1266|  6.52k|        og = (*(m->obj_cache.rbegin())).first;
 1267|  6.52k|    }
 1268|  6.61k|    return QIntC::to_size(og.getObj());
 1269|  6.61k|}
_ZN4QPDF3Doc7Objects24setLastObjectDescriptionERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1285|   158k|{
 1286|   158k|    m->last_object_description.clear();
 1287|   158k|    if (!description.empty()) {
  ------------------
  |  Branch (1287:9): [True: 8.69k, False: 150k]
  ------------------
 1288|  8.69k|        m->last_object_description += description;
 1289|  8.69k|        if (og.isIndirect()) {
  ------------------
  |  Branch (1289:13): [True: 8.69k, False: 0]
  ------------------
 1290|  8.69k|            m->last_object_description += ": ";
 1291|  8.69k|        }
 1292|  8.69k|    }
 1293|   158k|    if (og.isIndirect()) {
  ------------------
  |  Branch (1293:9): [True: 158k, False: 0]
  ------------------
 1294|   158k|        m->last_object_description += "object " + og.unparse(' ');
 1295|   158k|    }
 1296|   158k|}
_ZN4QPDF3Doc7Objects11readTrailerEv:
 1300|  21.6k|{
 1301|  21.6k|    qpdf_offset_t offset = m->file->tell();
 1302|  21.6k|    auto object =
 1303|  21.6k|        Parser::parse(*m->file, "trailer", m->tokenizer, nullptr, qpdf, m->reconstructed_xref);
 1304|  21.6k|    if (object.isDictionary() && m->objects.readToken(*m->file).isWord("stream")) {
  ------------------
  |  Branch (1304:9): [True: 3.39k, False: 18.2k]
  |  Branch (1304:9): [True: 92, False: 21.5k]
  |  Branch (1304:34): [True: 92, False: 3.29k]
  ------------------
 1305|     92|        warn(damagedPDF("trailer", m->file->tell(), "stream keyword found in trailer"));
 1306|     92|    }
 1307|       |    // Override last_offset so that it points to the beginning of the object we just read
 1308|  21.6k|    m->file->setLastOffset(offset);
 1309|  21.6k|    return object;
 1310|  21.6k|}
_ZN4QPDF3Doc7Objects10readObjectERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1314|  80.9k|{
 1315|  80.9k|    setLastObjectDescription(description, og);
 1316|  80.9k|    qpdf_offset_t offset = m->file->tell();
 1317|       |
 1318|  80.9k|    StringDecrypter decrypter{&qpdf, og};
 1319|  80.9k|    StringDecrypter* decrypter_ptr = m->encp->encrypted ? &decrypter : nullptr;
  ------------------
  |  Branch (1319:38): [True: 4.01k, False: 76.9k]
  ------------------
 1320|  80.9k|    auto object = Parser::parse(
 1321|  80.9k|        *m->file,
 1322|  80.9k|        m->last_object_description,
 1323|  80.9k|        m->tokenizer,
 1324|  80.9k|        decrypter_ptr,
 1325|  80.9k|        qpdf,
 1326|  80.9k|        m->reconstructed_xref || m->in_read_xref_stream);
  ------------------
  |  Branch (1326:9): [True: 76.2k, False: 4.71k]
  |  Branch (1326:34): [True: 2.15k, False: 2.55k]
  ------------------
 1327|  80.9k|    if (!object) {
  ------------------
  |  Branch (1327:9): [True: 5.70k, False: 75.2k]
  ------------------
 1328|  5.70k|        return {};
 1329|  5.70k|    }
 1330|  75.2k|    auto token = readToken(*m->file);
 1331|  75.2k|    if (object.isDictionary() && token.isWord("stream")) {
  ------------------
  |  Branch (1331:9): [True: 62.2k, False: 13.0k]
  |  Branch (1331:9): [True: 35.4k, False: 39.8k]
  |  Branch (1331:34): [True: 35.4k, False: 26.7k]
  ------------------
 1332|  35.4k|        readStream(object, og, offset);
 1333|  35.4k|        token = readToken(*m->file);
 1334|  35.4k|    }
 1335|  75.2k|    if (!token.isWord("endobj")) {
  ------------------
  |  Branch (1335:9): [True: 24.7k, False: 50.5k]
  ------------------
 1336|  24.7k|        warn(damagedPDF("expected endobj"));
 1337|  24.7k|    }
 1338|  75.2k|    return object;
 1339|  80.9k|}
_ZN4QPDF3Doc7Objects10readStreamER16QPDFObjectHandle10QPDFObjGenx:
 1344|  35.4k|{
 1345|  35.4k|    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|  35.4k|    qpdf_offset_t stream_offset = m->file->tell();
 1350|  35.4k|    size_t length = 0;
 1351|       |
 1352|  35.4k|    try {
 1353|  35.4k|        auto length_obj = object.getKey("/Length");
 1354|       |
 1355|  35.4k|        if (!length_obj.isInteger()) {
  ------------------
  |  Branch (1355:13): [True: 16.4k, False: 18.9k]
  ------------------
 1356|  16.4k|            if (length_obj.null()) {
  ------------------
  |  Branch (1356:17): [True: 16.2k, False: 194]
  ------------------
 1357|  16.2k|                throw damagedPDF(offset, "stream dictionary lacks /Length key");
 1358|  16.2k|            }
 1359|    194|            throw damagedPDF(offset, "/Length key in stream dictionary is not an integer");
 1360|  16.4k|        }
 1361|       |
 1362|  18.9k|        length = toS(length_obj.getUIntValue());
 1363|       |        // Seek in two steps to avoid potential integer overflow
 1364|  18.9k|        m->file->seek(stream_offset, SEEK_SET);
 1365|  18.9k|        m->file->seek(toO(length), SEEK_CUR);
 1366|  18.9k|        if (!readToken(*m->file).isWord("endstream")) {
  ------------------
  |  Branch (1366:13): [True: 4.30k, False: 14.6k]
  ------------------
 1367|  4.30k|            throw damagedPDF("expected endstream");
 1368|  4.30k|        }
 1369|  28.5k|    } catch (QPDFExc& e) {
 1370|  28.5k|        if (!cf.surpress_recovery()) {
  ------------------
  |  Branch (1370:13): [True: 28.5k, False: 0]
  ------------------
 1371|  28.5k|            warn(e);
 1372|  28.5k|            length = recoverStreamLength(m->file, og, stream_offset);
 1373|  28.5k|        } else {
 1374|      0|            throw;
 1375|      0|        }
 1376|  28.5k|    }
 1377|  28.5k|    object = QPDFObjectHandle(qpdf::Stream(qpdf, og, object, stream_offset, length));
 1378|  25.6k|}
_ZN4QPDF3Doc7Objects21validateStreamLineEndER16QPDFObjectHandle10QPDFObjGenx:
 1382|  35.4k|{
 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|  55.6k|    while (true) {
  ------------------
  |  Branch (1390:12): [True: 55.5k, Folded]
  ------------------
 1391|  55.5k|        char ch;
 1392|  55.5k|        if (m->file->read(&ch, 1) == 0) {
  ------------------
  |  Branch (1392:13): [True: 297, False: 55.2k]
  ------------------
 1393|       |            // A premature EOF here will result in some other problem that will get reported at
 1394|       |            // another time.
 1395|    297|            return;
 1396|    297|        }
 1397|  55.2k|        if (ch == '\n') {
  ------------------
  |  Branch (1397:13): [True: 15.7k, False: 39.5k]
  ------------------
 1398|       |            // ready to read stream data
 1399|  15.7k|            return;
 1400|  15.7k|        }
 1401|  39.5k|        if (ch == '\r') {
  ------------------
  |  Branch (1401:13): [True: 12.8k, False: 26.7k]
  ------------------
 1402|       |            // Read another character
 1403|  12.8k|            if (m->file->read(&ch, 1) != 0) {
  ------------------
  |  Branch (1403:17): [True: 12.8k, False: 35]
  ------------------
 1404|  12.8k|                if (ch == '\n') {
  ------------------
  |  Branch (1404:21): [True: 10.7k, False: 2.08k]
  ------------------
 1405|       |                    // Ready to read stream data
 1406|  10.7k|                    QTC::TC("qpdf", "QPDF stream with CRNL");
 1407|  10.7k|                } 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.08k|                    m->file->unreadCh(ch);
 1411|  2.08k|                    warn(damagedPDF(
 1412|  2.08k|                        m->file->tell(), "stream keyword followed by carriage return only"));
 1413|  2.08k|                }
 1414|  12.8k|            }
 1415|  12.8k|            return;
 1416|  12.8k|        }
 1417|  26.7k|        if (!util::is_space(ch)) {
  ------------------
  |  Branch (1417:13): [True: 6.46k, False: 20.2k]
  ------------------
 1418|  6.46k|            m->file->unreadCh(ch);
 1419|  6.46k|            warn(damagedPDF(
 1420|  6.46k|                m->file->tell(), "stream keyword not followed by proper line terminator"));
 1421|  6.46k|            return;
 1422|  6.46k|        }
 1423|  20.2k|        warn(damagedPDF(m->file->tell(), "stream keyword followed by extraneous whitespace"));
 1424|  20.2k|    }
 1425|  35.4k|}
_ZN4QPDF3Doc7Objects13findEndstreamEv:
 1429|  22.7k|{
 1430|       |    // Find endstream or endobj. Position the input at that token.
 1431|  22.7k|    auto t = readToken(*m->file, 20);
 1432|  22.7k|    if (t.isWord("endobj") || t.isWord("endstream")) {
  ------------------
  |  Branch (1432:9): [True: 12.8k, False: 9.92k]
  |  Branch (1432:9): [True: 18.0k, False: 4.68k]
  |  Branch (1432:31): [True: 5.23k, False: 4.68k]
  ------------------
 1433|  18.0k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1434|  18.0k|        return true;
 1435|  18.0k|    }
 1436|  4.68k|    return false;
 1437|  22.7k|}
_ZN4QPDF3Doc7Objects19recoverStreamLengthENSt3__110shared_ptrI11InputSourceEE10QPDFObjGenx:
 1442|  19.0k|{
 1443|       |    // Try to reconstruct stream length by looking for endstream or endobj
 1444|  19.0k|    warn(damagedPDF(*input, stream_offset, "attempting to recover stream length"));
 1445|       |
 1446|  19.0k|    PatternFinder ef(*this, &Objects::findEndstream);
 1447|  19.0k|    size_t length = 0;
 1448|  19.0k|    if (m->file->findFirst("end", stream_offset, 0, ef)) {
  ------------------
  |  Branch (1448:9): [True: 18.0k, False: 1.00k]
  ------------------
 1449|  18.0k|        length = toS(m->file->tell() - stream_offset);
 1450|       |        // Reread endstream but, if it was endobj, don't skip that.
 1451|  18.0k|        QPDFTokenizer::Token t = readToken(*m->file);
 1452|  18.0k|        if (t.getValue() == "endobj") {
  ------------------
  |  Branch (1452:13): [True: 12.8k, False: 5.23k]
  ------------------
 1453|  12.8k|            m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1454|  12.8k|        }
 1455|  18.0k|    }
 1456|       |
 1457|  19.0k|    if (length) {
  ------------------
  |  Branch (1457:9): [True: 17.2k, False: 1.84k]
  ------------------
 1458|  17.2k|        auto end = stream_offset + toO(length);
 1459|  17.2k|        qpdf_offset_t found_offset = 0;
 1460|  17.2k|        QPDFObjGen found_og;
 1461|       |
 1462|       |        // Make sure this is inside this object
 1463|   353k|        for (auto const& [current_og, entry]: m->xref_table) {
  ------------------
  |  Branch (1463:45): [True: 353k, False: 17.2k]
  ------------------
 1464|   353k|            if (entry.getType() == 1) {
  ------------------
  |  Branch (1464:17): [True: 322k, False: 30.8k]
  ------------------
 1465|   322k|                qpdf_offset_t obj_offset = entry.getOffset();
 1466|   322k|                if (found_offset < obj_offset && obj_offset < end) {
  ------------------
  |  Branch (1466:21): [True: 245k, False: 77.8k]
  |  Branch (1466:50): [True: 70.8k, False: 174k]
  ------------------
 1467|  70.8k|                    found_offset = obj_offset;
 1468|  70.8k|                    found_og = current_og;
 1469|  70.8k|                }
 1470|   322k|            }
 1471|   353k|        }
 1472|  17.2k|        if (!found_offset || found_og == og) {
  ------------------
  |  Branch (1472:13): [True: 1.89k, False: 15.3k]
  |  Branch (1472:30): [True: 13.6k, False: 1.72k]
  ------------------
 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|  15.5k|        } else {
 1478|  1.72k|            length = 0;
 1479|  1.72k|        }
 1480|  17.2k|    }
 1481|       |
 1482|  19.0k|    if (length == 0) {
  ------------------
  |  Branch (1482:9): [True: 3.55k, False: 15.5k]
  ------------------
 1483|  3.55k|        warn(damagedPDF(
 1484|  3.55k|            *input, stream_offset, "unable to recover stream data; treating stream as empty"));
 1485|  15.5k|    } else {
 1486|  15.5k|        warn(damagedPDF(
 1487|  15.5k|            *input, stream_offset, "recovered stream length: " + std::to_string(length)));
 1488|  15.5k|    }
 1489|       |
 1490|  19.0k|    return length;
 1491|  19.0k|}
_ZN4QPDF3Doc7Objects9readTokenER11InputSourcem:
 1495|  1.96M|{
 1496|  1.96M|    return m->tokenizer.readToken(input, m->last_object_description, true, max_len);
 1497|  1.96M|}
_ZN4QPDF3Doc7Objects17read_object_startEx:
 1501|  87.4k|{
 1502|  87.4k|    m->file->seek(offset, SEEK_SET);
 1503|  87.4k|    QPDFTokenizer::Token tobjid = readToken(*m->file);
 1504|  87.4k|    bool objidok = tobjid.isInteger();
 1505|  87.4k|    if (!objidok) {
  ------------------
  |  Branch (1505:9): [True: 2.98k, False: 84.4k]
  ------------------
 1506|  2.98k|        throw damagedPDF(offset, "expected n n obj");
 1507|  2.98k|    }
 1508|  84.4k|    QPDFTokenizer::Token tgen = readToken(*m->file);
 1509|  84.4k|    bool genok = tgen.isInteger();
 1510|  84.4k|    if (!genok) {
  ------------------
  |  Branch (1510:9): [True: 366, False: 84.0k]
  ------------------
 1511|    366|        throw damagedPDF(offset, "expected n n obj");
 1512|    366|    }
 1513|  84.0k|    QPDFTokenizer::Token tobj = readToken(*m->file);
 1514|       |
 1515|  84.0k|    bool objok = tobj.isWord("obj");
 1516|       |
 1517|  84.0k|    if (!objok) {
  ------------------
  |  Branch (1517:9): [True: 893, False: 83.1k]
  ------------------
 1518|    893|        throw damagedPDF(offset, "expected n n obj");
 1519|    893|    }
 1520|  83.1k|    int objid = QUtil::string_to_int(tobjid.getValue().c_str());
 1521|  83.1k|    int generation = QUtil::string_to_int(tgen.getValue().c_str());
 1522|  83.1k|    if (objid <= 0 || objid >= m->xref_table_max_id || generation < 0 || generation >= 65535) {
  ------------------
  |  Branch (1522:9): [True: 976, False: 82.2k]
  |  Branch (1522:23): [True: 339, False: 81.8k]
  |  Branch (1522:56): [True: 118, False: 81.7k]
  |  Branch (1522:74): [True: 81, False: 81.6k]
  ------------------
 1523|    792|        throw damagedPDF(
 1524|    792|            offset,
 1525|    792|            "object " + std::to_string(objid) + " " + std::to_string(generation) +
 1526|    792|                " has an invalid or impossibly large ID or generation");
 1527|    792|    }
 1528|  82.4k|    return {objid, generation};
 1529|  83.1k|}
_ZN4QPDF3Doc7Objects18readObjectAtOffsetEbxRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1534|  77.8k|{
 1535|  77.8k|    QPDFObjGen og;
 1536|  77.8k|    setLastObjectDescription(description, exp_og);
 1537|       |
 1538|  77.8k|    if (cf.surpress_recovery()) {
  ------------------
  |  Branch (1538:9): [True: 0, False: 77.8k]
  ------------------
 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|  77.8k|    if (offset == 0) {
  ------------------
  |  Branch (1546:9): [True: 256, False: 77.6k]
  ------------------
 1547|    256|        warn(damagedPDF(
 1548|    256|            -1,
 1549|    256|            "object has offset 0 - a common error handled correctly by qpdf and most other "
 1550|    256|            "applications"));
 1551|    256|        return;
 1552|    256|    }
 1553|       |
 1554|  77.6k|    try {
 1555|  77.6k|        og = read_object_start(offset);
 1556|  77.6k|        if (exp_og != og) {
  ------------------
  |  Branch (1556:13): [True: 689, False: 76.9k]
  ------------------
 1557|    689|            QPDFExc e = damagedPDF(offset, "expected " + exp_og.unparse(' ') + " obj");
 1558|    689|            if (try_recovery) {
  ------------------
  |  Branch (1558:17): [True: 689, False: 0]
  ------------------
 1559|       |                // Will be retried below
 1560|    689|                throw e;
 1561|    689|            } else {
 1562|       |                // We can try reading the object anyway even if the ID doesn't match.
 1563|      0|                warn(e);
 1564|      0|            }
 1565|    689|        }
 1566|  77.6k|    } catch (QPDFExc& e) {
 1567|  4.67k|        if (!try_recovery) {
  ------------------
  |  Branch (1567:13): [True: 1, False: 4.67k]
  ------------------
 1568|      1|            throw;
 1569|      1|        }
 1570|       |        // Try again after reconstructing xref table
 1571|  4.67k|        reconstruct_xref(e);
 1572|  4.67k|        if (m->xref_table.contains(exp_og) && m->xref_table[exp_og].getType() == 1) {
  ------------------
  |  Branch (1572:13): [True: 155, False: 4.51k]
  |  Branch (1572:47): [True: 155, False: 0]
  ------------------
 1573|    155|            qpdf_offset_t new_offset = m->xref_table[exp_og].getOffset();
 1574|    155|            readObjectAtOffset(false, new_offset, description, exp_og);
 1575|    155|            return;
 1576|    155|        }
 1577|  4.51k|        warn(damagedPDF(
 1578|  4.51k|            "",
 1579|  4.51k|            -1,
 1580|  4.51k|            ("object " + exp_og.unparse(' ') +
 1581|  4.51k|             " not found in file after regenerating cross reference table")));
 1582|  4.51k|        return;
 1583|  4.67k|    }
 1584|       |
 1585|  72.2k|    if (auto oh = readObject(description, og)) {
  ------------------
  |  Branch (1585:14): [True: 51.7k, False: 20.5k]
  ------------------
 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|  51.7k|        qpdf_offset_t end_before_space = m->file->tell();
 1590|       |
 1591|       |        // skip over spaces
 1592|   106k|        while (true) {
  ------------------
  |  Branch (1592:16): [True: 106k, Folded]
  ------------------
 1593|   106k|            char ch;
 1594|   106k|            if (!m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1594:17): [True: 1.20k, False: 105k]
  ------------------
 1595|  1.20k|                throw damagedPDF(m->file->tell(), "EOF after endobj");
 1596|  1.20k|            }
 1597|   105k|            if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1597:17): [True: 50.5k, False: 54.8k]
  ------------------
 1598|  50.5k|                m->file->seek(-1, SEEK_CUR);
 1599|  50.5k|                break;
 1600|  50.5k|            }
 1601|   105k|        }
 1602|  50.5k|        m->objects.updateCache(og, oh.obj_sp(), end_before_space, m->file->tell());
 1603|  50.5k|    }
 1604|  72.2k|}
_ZN4QPDF3Doc7Objects18readObjectAtOffsetExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb:
 1609|  9.81k|{
 1610|  9.81k|    auto og = read_object_start(offset);
 1611|  9.81k|    auto oh = readObject(description, og);
 1612|       |
 1613|  9.81k|    if (!oh || !m->objects.isUnresolved(og)) {
  ------------------
  |  Branch (1613:9): [True: 1.20k, False: 8.61k]
  |  Branch (1613:16): [True: 6.29k, False: 2.32k]
  ------------------
 1614|  6.35k|        return oh;
 1615|  6.35k|    }
 1616|       |
 1617|  3.46k|    if (skip_cache_if_in_xref && m->xref_table.contains(og)) {
  ------------------
  |  Branch (1617:9): [True: 2.32k, False: 1.14k]
  |  Branch (1617:34): [True: 13, False: 2.30k]
  ------------------
 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|     13|        QTC::TC("qpdf", "QPDF skipping cache for known unchecked object");
 1643|     13|        return oh;
 1644|     13|    }
 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.45k|    qpdf_offset_t end_before_space = m->file->tell();
 1650|       |
 1651|       |    // skip over spaces
 1652|  5.93k|    while (true) {
  ------------------
  |  Branch (1652:12): [True: 4.79k, Folded]
  ------------------
 1653|  4.79k|        char ch;
 1654|  4.79k|        if (!m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1654:13): [True: 110, False: 4.68k]
  ------------------
 1655|    110|            throw damagedPDF(m->file->tell(), "EOF after endobj");
 1656|    110|        }
 1657|  4.68k|        if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1657:13): [True: 2.19k, False: 2.48k]
  ------------------
 1658|  2.19k|            m->file->seek(-1, SEEK_CUR);
 1659|  2.19k|            break;
 1660|  2.19k|        }
 1661|  4.68k|    }
 1662|  3.34k|    m->objects.updateCache(og, oh.obj_sp(), end_before_space, m->file->tell());
 1663|       |
 1664|  3.34k|    return oh;
 1665|  3.45k|}
_ZN4QPDF3Doc7Objects7resolveE10QPDFObjGen:
 1669|   273k|{
 1670|   273k|    if (!isUnresolved(og)) {
  ------------------
  |  Branch (1670:9): [True: 0, False: 273k]
  ------------------
 1671|      0|        return m->obj_cache[og].object;
 1672|      0|    }
 1673|       |
 1674|   273k|    if (m->resolving.contains(og)) {
  ------------------
  |  Branch (1674:9): [True: 209, False: 273k]
  ------------------
 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|    209|        warn(damagedPDF("", "loop detected resolving object " + og.unparse(' ')));
 1678|    209|        updateCache(og, QPDFObject::create<QPDF_Null>(), -1, -1);
 1679|    209|        return m->obj_cache[og].object;
 1680|    209|    }
 1681|   273k|    ResolveRecorder rr(qpdf, og);
 1682|       |
 1683|   273k|    if (m->xref_table.contains(og)) {
  ------------------
  |  Branch (1683:9): [True: 247k, False: 25.2k]
  ------------------
 1684|   247k|        QPDFXRefEntry const& entry = m->xref_table[og];
 1685|   247k|        try {
 1686|   247k|            switch (entry.getType()) {
 1687|  77.7k|            case 1:
  ------------------
  |  Branch (1687:13): [True: 77.7k, False: 170k]
  ------------------
 1688|       |                // Object stored in cache by readObjectAtOffset
 1689|  77.7k|                readObjectAtOffset(true, entry.getOffset(), "", og);
 1690|  77.7k|                break;
 1691|       |
 1692|   170k|            case 2:
  ------------------
  |  Branch (1692:13): [True: 170k, False: 77.7k]
  ------------------
 1693|   170k|                resolveObjectsInStream(entry.getObjStreamNumber());
 1694|   170k|                break;
 1695|       |
 1696|     10|            default:
  ------------------
  |  Branch (1696:13): [True: 10, False: 247k]
  ------------------
 1697|     10|                throw damagedPDF(
 1698|     10|                    "", -1, ("object " + og.unparse('/') + " has unexpected xref entry type"));
 1699|   247k|            }
 1700|   247k|        } catch (QPDFExc& e) {
 1701|  59.7k|            warn(e);
 1702|  59.7k|        } catch (std::exception& e) {
 1703|    789|            warn(damagedPDF(
 1704|    789|                "", -1, ("object " + og.unparse('/') + ": error reading object: " + e.what())));
 1705|    789|        }
 1706|   247k|    }
 1707|       |
 1708|   254k|    if (isUnresolved(og)) {
  ------------------
  |  Branch (1708:9): [True: 203k, False: 51.0k]
  ------------------
 1709|       |        // PDF spec says unknown objects resolve to the null object.
 1710|   203k|        updateCache(og, QPDFObject::create<QPDF_Null>(), -1, -1);
 1711|   203k|    }
 1712|       |
 1713|   254k|    auto& result(m->obj_cache[og].object);
 1714|   254k|    result->setDefaultDescription(&qpdf, og);
 1715|   254k|    return result;
 1716|   273k|}
_ZN4QPDF3Doc7Objects22resolveObjectsInStreamEi:
 1720|   170k|{
 1721|   170k|    auto damaged =
 1722|   170k|        [this, obj_stream_number](int id, qpdf_offset_t offset, std::string const& msg) -> QPDFExc {
 1723|   170k|        return {
 1724|   170k|            qpdf_e_damaged_pdf,
 1725|   170k|            m->file->getName() + " object stream " + std::to_string(obj_stream_number),
 1726|   170k|            +"object " + std::to_string(id) + " 0",
 1727|   170k|            offset,
 1728|   170k|            msg,
 1729|   170k|            true};
 1730|   170k|    };
 1731|       |
 1732|   170k|    if (m->resolved_object_streams.contains(obj_stream_number)) {
  ------------------
  |  Branch (1732:9): [True: 130k, False: 39.9k]
  ------------------
 1733|   130k|        return;
 1734|   130k|    }
 1735|  39.9k|    m->resolved_object_streams.insert(obj_stream_number);
 1736|       |    // Force resolution of object stream
 1737|  39.9k|    Stream obj_stream = qpdf.getObject(obj_stream_number, 0);
 1738|  39.9k|    if (!obj_stream) {
  ------------------
  |  Branch (1738:9): [True: 35.7k, False: 4.20k]
  ------------------
 1739|  35.7k|        throw damagedPDF(
 1740|  35.7k|            "object " + std::to_string(obj_stream_number) + " 0",
 1741|  35.7k|            "supposed object stream " + std::to_string(obj_stream_number) + " is not a stream");
 1742|  35.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.20k|    QPDFObjGen stream_og(obj_stream_number, 0);
 1747|  4.20k|    qpdf_offset_t end_before_space = m->obj_cache[stream_og].end_before_space;
 1748|  4.20k|    qpdf_offset_t end_after_space = m->obj_cache[stream_og].end_after_space;
 1749|       |
 1750|  4.20k|    QPDFObjectHandle dict = obj_stream.getDict();
 1751|  4.20k|    if (!dict.isDictionaryOfType("/ObjStm")) {
  ------------------
  |  Branch (1751:9): [True: 1.61k, False: 2.58k]
  ------------------
 1752|  1.61k|        warn(damagedPDF(
 1753|  1.61k|            "object " + std::to_string(obj_stream_number) + " 0",
 1754|  1.61k|            "supposed object stream " + std::to_string(obj_stream_number) + " has wrong type"));
 1755|  1.61k|    }
 1756|       |
 1757|  4.20k|    unsigned int n{0};
 1758|  4.20k|    int first{0};
 1759|  4.20k|    if (!(dict.getKey("/N").getValueAsUInt(n) && dict.getKey("/First").getValueAsInt(first))) {
  ------------------
  |  Branch (1759:9): [True: 399, False: 3.80k]
  |  Branch (1759:11): [True: 2.40k, False: 1.79k]
  |  Branch (1759:50): [True: 2.34k, False: 62]
  ------------------
 1760|    399|        throw damagedPDF(
 1761|    399|            "object " + std::to_string(obj_stream_number) + " 0",
 1762|    399|            "object stream " + std::to_string(obj_stream_number) + " has incorrect keys");
 1763|    399|    }
 1764|       |
 1765|       |    // id, offset, size
 1766|  3.80k|    std::vector<std::tuple<int, qpdf_offset_t, size_t>> offsets;
 1767|       |
 1768|  3.80k|    auto stream_data = obj_stream.getStreamData(qpdf_dl_specialized);
 1769|       |
 1770|  3.80k|    is::OffsetBuffer input("", stream_data);
 1771|       |
 1772|  3.80k|    const auto b_size = stream_data.size();
 1773|  3.80k|    const auto end_offset = static_cast<qpdf_offset_t>(b_size);
 1774|  3.80k|    auto b_start = stream_data.data();
 1775|       |
 1776|  3.80k|    if (first >= end_offset) {
  ------------------
  |  Branch (1776:9): [True: 260, False: 3.54k]
  ------------------
 1777|    260|        throw damagedPDF(
 1778|    260|            "object " + std::to_string(obj_stream_number) + " 0",
 1779|    260|            "object stream " + std::to_string(obj_stream_number) + " has invalid /First entry");
 1780|    260|    }
 1781|       |
 1782|  3.54k|    int id = 0;
 1783|  3.54k|    long long last_offset = -1;
 1784|  3.54k|    bool is_first = true;
 1785|  56.2k|    for (unsigned int i = 0; i < n; ++i) {
  ------------------
  |  Branch (1785:30): [True: 52.9k, False: 3.27k]
  ------------------
 1786|  52.9k|        auto tnum = readToken(input);
 1787|  52.9k|        auto id_offset = input.getLastOffset();
 1788|  52.9k|        auto toffset = readToken(input);
 1789|  52.9k|        if (!(tnum.isInteger() && toffset.isInteger())) {
  ------------------
  |  Branch (1789:15): [True: 52.7k, False: 182]
  |  Branch (1789:35): [True: 52.6k, False: 88]
  ------------------
 1790|    270|            throw damaged(0, input.getLastOffset(), "expected integer in object stream header");
 1791|    270|        }
 1792|       |
 1793|  52.6k|        int num = QUtil::string_to_int(tnum.getValue().c_str());
 1794|  52.6k|        long long offset = QUtil::string_to_int(toffset.getValue().c_str());
 1795|       |
 1796|  52.6k|        if (num == obj_stream_number) {
  ------------------
  |  Branch (1796:13): [True: 368, False: 52.3k]
  ------------------
 1797|    368|            warn(damaged(num, id_offset, "object stream claims to contain itself"));
 1798|    368|            continue;
 1799|    368|        }
 1800|       |
 1801|  52.3k|        if (num < 1) {
  ------------------
  |  Branch (1801:13): [True: 687, False: 51.6k]
  ------------------
 1802|    687|            warn(damaged(num, id_offset, "object id is invalid"s));
 1803|    687|            continue;
 1804|    687|        }
 1805|       |
 1806|  51.6k|        if (offset <= last_offset) {
  ------------------
  |  Branch (1806:13): [True: 8.79k, False: 42.8k]
  ------------------
 1807|  8.79k|            warn(damaged(
 1808|  8.79k|                num,
 1809|  8.79k|                input.getLastOffset(),
 1810|  8.79k|                "offset " + std::to_string(offset) +
 1811|  8.79k|                    " is invalid (must be larger than previous offset " +
 1812|  8.79k|                    std::to_string(last_offset) + ")"));
 1813|  8.79k|            continue;
 1814|  8.79k|        }
 1815|       |
 1816|  42.8k|        if (num > m->xref_table_max_id) {
  ------------------
  |  Branch (1816:13): [True: 1.45k, False: 41.3k]
  ------------------
 1817|  1.45k|            continue;
 1818|  1.45k|        }
 1819|       |
 1820|  41.3k|        if (first + offset >= end_offset) {
  ------------------
  |  Branch (1820:13): [True: 7.74k, False: 33.6k]
  ------------------
 1821|  7.74k|            warn(damaged(
 1822|  7.74k|                num, input.getLastOffset(), "offset " + std::to_string(offset) + " is too large"));
 1823|  7.74k|            continue;
 1824|  7.74k|        }
 1825|       |
 1826|  33.6k|        if (is_first) {
  ------------------
  |  Branch (1826:13): [True: 943, False: 32.7k]
  ------------------
 1827|    943|            is_first = false;
 1828|  32.7k|        } else {
 1829|  32.7k|            offsets.emplace_back(
 1830|  32.7k|                id, last_offset + first, static_cast<size_t>(offset - last_offset));
 1831|  32.7k|        }
 1832|       |
 1833|  33.6k|        last_offset = offset;
 1834|  33.6k|        id = num;
 1835|  33.6k|    }
 1836|       |
 1837|  3.27k|    if (!is_first) {
  ------------------
  |  Branch (1837:9): [True: 771, False: 2.50k]
  ------------------
 1838|       |        // We found at least one valid entry.
 1839|    771|        offsets.emplace_back(
 1840|    771|            id, last_offset + first, b_size - static_cast<size_t>(last_offset + first));
 1841|    771|    }
 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. Also leave alone objects that were replaced
 1847|       |    // (with replaceObject, e.g. by --update-from-json) before this object stream was read, or the
 1848|       |    // replacement would be silently lost. Objects being resolved are still filled: resolve may
 1849|       |    // have set them to null after detecting a loop.
 1850|  27.8k|    for (auto const& [obj_id, obj_offset, obj_size]: offsets) {
  ------------------
  |  Branch (1850:52): [True: 27.8k, False: 3.27k]
  ------------------
 1851|  27.8k|        QPDFObjGen og(obj_id, 0);
 1852|  27.8k|        auto entry = m->xref_table.find(og);
 1853|  27.8k|        if (entry != m->xref_table.end() && entry->second.getType() == 2 &&
  ------------------
  |  Branch (1853:13): [True: 24.8k, False: 3.02k]
  |  Branch (1853:13): [True: 22.9k, False: 4.86k]
  |  Branch (1853:45): [True: 24.4k, False: 349]
  ------------------
 1854|  24.4k|            entry->second.getObjStreamNumber() == obj_stream_number) {
  ------------------
  |  Branch (1854:13): [True: 22.9k, False: 1.49k]
  ------------------
 1855|  22.9k|            if (!isUnresolved(og) && !m->resolving.contains(og)) {
  ------------------
  |  Branch (1855:17): [True: 328, False: 22.6k]
  |  Branch (1855:38): [True: 262, False: 66]
  ------------------
 1856|    262|                QTC::TC("qpdf", "QPDF not caching replaced objstm object");
 1857|    262|                continue;
 1858|    262|            }
 1859|  22.7k|            is::OffsetBuffer in("", {b_start + obj_offset, obj_size}, obj_offset);
 1860|  22.7k|            if (auto oh = Parser::parse(in, obj_stream_number, obj_id, m->tokenizer, qpdf)) {
  ------------------
  |  Branch (1860:22): [True: 20.2k, False: 2.46k]
  ------------------
 1861|  20.2k|                updateCache(og, oh.obj_sp(), end_before_space, end_after_space);
 1862|  20.2k|            }
 1863|  22.7k|        } else {
 1864|  4.86k|            QTC::TC("qpdf", "QPDF not caching overridden objstm object");
 1865|  4.86k|        }
 1866|  27.8k|    }
 1867|  3.27k|}
_ZN4QPDF3Doc7Objects11newIndirectE10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEE:
 1871|  6.53k|{
 1872|  6.53k|    obj->setDefaultDescription(&qpdf, og);
 1873|  6.53k|    return {obj};
 1874|  6.53k|}
_ZN4QPDF3Doc7Objects11updateCacheE10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEExxb:
 1883|   276k|{
 1884|   276k|    object->setObjGen(&qpdf, og);
 1885|   276k|    if (isCached(og)) {
  ------------------
  |  Branch (1885:9): [True: 111k, False: 165k]
  ------------------
 1886|   111k|        auto& cache = m->obj_cache[og];
 1887|   111k|        object->move_to(cache.object, destroy);
 1888|   111k|        cache.end_before_space = end_before_space;
 1889|   111k|        cache.end_after_space = end_after_space;
 1890|   165k|    } else {
 1891|   165k|        m->obj_cache[og] = ObjCache(object, end_before_space, end_after_space);
 1892|   165k|    }
 1893|   276k|}
_ZN4QPDF3Doc7Objects8isCachedE10QPDFObjGen:
 1897|  1.00M|{
 1898|  1.00M|    return m->obj_cache.contains(og);
 1899|  1.00M|}
_ZN4QPDF3Doc7Objects12isUnresolvedE10QPDFObjGen:
 1903|   732k|{
 1904|   732k|    return !isCached(og) || m->obj_cache[og].object->isUnresolved();
  ------------------
  |  Branch (1904:12): [True: 468k, False: 264k]
  |  Branch (1904:29): [True: 188k, False: 75.2k]
  ------------------
 1905|   732k|}
_ZN4QPDF3Doc7Objects10nextObjGenEv:
 1909|  6.61k|{
 1910|  6.61k|    int max_objid = toI(qpdf.getObjectCount());
 1911|  6.61k|    if (max_objid == std::numeric_limits<int>::max()) {
  ------------------
  |  Branch (1911:9): [True: 0, False: 6.61k]
  ------------------
 1912|      0|        throw std::range_error("max object id is too high to create new objects");
 1913|      0|    }
 1914|  6.61k|    return {max_objid + 1, 0};
 1915|  6.61k|}
_ZN4QPDF3Doc7Objects26makeIndirectFromQPDFObjectERKNSt3__110shared_ptrI10QPDFObjectEE:
 1919|  6.61k|{
 1920|  6.61k|    QPDFObjGen next{nextObjGen()};
 1921|  6.61k|    m->obj_cache[next] = ObjCache(obj, -1, -1);
 1922|  6.61k|    return newIndirect(next, m->obj_cache[next].object);
 1923|  6.61k|}
_ZN4QPDF18makeIndirectObjectE16QPDFObjectHandle:
 1927|  6.61k|{
 1928|  6.61k|    if (!oh) {
  ------------------
  |  Branch (1928:9): [True: 0, False: 6.61k]
  ------------------
 1929|      0|        throw std::logic_error("attempted to make an uninitialized QPDFObjectHandle indirect");
 1930|      0|    }
 1931|  6.61k|    return m->objects.makeIndirectFromQPDFObject(oh.obj_sp());
 1932|  6.61k|}
_ZN4QPDF3Doc7Objects18getObjectForParserEiib:
 1936|   257k|{
 1937|       |    // This method is called by the parser and therefore must not resolve any objects.
 1938|   257k|    auto og = QPDFObjGen(id, gen);
 1939|   257k|    if (auto iter = m->obj_cache.find(og); iter != m->obj_cache.end()) {
  ------------------
  |  Branch (1939:44): [True: 174k, False: 82.4k]
  ------------------
 1940|   174k|        return iter->second.object;
 1941|   174k|    }
 1942|  82.4k|    if (m->xref_table.contains(og) || (!m->parsed && og.getObj() < m->xref_table_max_id)) {
  ------------------
  |  Branch (1942:9): [True: 46.8k, False: 35.6k]
  |  Branch (1942:40): [True: 30.2k, False: 5.39k]
  |  Branch (1942:54): [True: 27.7k, False: 2.45k]
  ------------------
 1943|  74.6k|        return m->obj_cache.insert({og, QPDFObject::create<QPDF_Unresolved>(&qpdf, og)})
 1944|  74.6k|            .first->second.object;
 1945|  74.6k|    }
 1946|  7.84k|    if (parse_pdf) {
  ------------------
  |  Branch (1946:9): [True: 7.84k, False: 0]
  ------------------
 1947|  7.84k|        return QPDFObject::create<QPDF_Null>();
 1948|  7.84k|    }
 1949|      0|    return m->obj_cache.insert({og, QPDFObject::create<QPDF_Null>(&qpdf, og)}).first->second.object;
 1950|  7.84k|}
_ZN4QPDF9getObjectE10QPDFObjGen:
 1968|  86.5k|{
 1969|  86.5k|    if (auto it = m->obj_cache.find(og); it != m->obj_cache.end()) {
  ------------------
  |  Branch (1969:42): [True: 18.5k, False: 67.9k]
  ------------------
 1970|  18.5k|        return {it->second.object};
 1971|  67.9k|    } else if (m->parsed && !m->xref_table.contains(og)) {
  ------------------
  |  Branch (1971:16): [True: 15.4k, False: 52.4k]
  |  Branch (1971:29): [True: 14.6k, False: 873]
  ------------------
 1972|  14.6k|        return QPDFObject::create<QPDF_Null>();
 1973|  53.3k|    } else {
 1974|  53.3k|        auto result =
 1975|  53.3k|            m->obj_cache.try_emplace(og, QPDFObject::create<QPDF_Unresolved>(this, og), -1, -1);
 1976|  53.3k|        return {result.first->second.object};
 1977|  53.3k|    }
 1978|  86.5k|}
_ZN4QPDF12removeObjectE10QPDFObjGen:
 1997|  23.9k|{
 1998|  23.9k|    m->xref_table.erase(og);
 1999|  23.9k|    if (auto cached = m->obj_cache.find(og); cached != m->obj_cache.end()) {
  ------------------
  |  Branch (1999:46): [True: 947, False: 23.0k]
  ------------------
 2000|       |        // Take care of any object handles that may be floating around.
 2001|    947|        cached->second.object->assign_null();
 2002|    947|        cached->second.object->setObjGen(nullptr, QPDFObjGen());
 2003|    947|        m->obj_cache.erase(cached);
 2004|    947|    }
 2005|  23.9k|}
_ZN4QPDF3Doc7Objects13PatternFinderC2ERS1_MS1_FbvE:
  147|  56.0k|        o(o),
  148|  56.0k|        checker(checker)
  149|  56.0k|    {
  150|  56.0k|    }
_ZN4QPDF3Doc7Objects13PatternFinder5checkEv:
  154|  33.4k|    {
  155|  33.4k|        return (this->o.*checker)();
  156|  33.4k|    }
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects16reconstruct_xrefER7QPDFExcbENK3$_0clEv:
  324|  1.17M|    auto check_warnings = [this, max_warnings]() {
  325|  1.17M|        if (m->warnings.size() > max_warnings) {
  ------------------
  |  Branch (325:13): [True: 0, False: 1.17M]
  ------------------
  326|      0|            throw damagedPDF("", -1, "too many errors while reconstructing cross-reference table");
  327|      0|        }
  328|  1.17M|    };
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects17processXRefStreamExR16QPDFObjectHandlebENK3$_0clENSt3__117basic_string_viewIcNS5_11char_traitsIcEEEE:
 1037|  5.26k|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1038|  5.26k|        return damagedPDF("xref stream", xref_offset, msg.data());
 1039|  5.26k|    };
_ZN4QPDF15ResolveRecorderC2ERS_RK10QPDFObjGen:
  129|   273k|        qpdf(qpdf),
  130|   273k|        iter(qpdf.m->resolving.insert(og).first)
  131|   273k|    {
  132|   273k|    }
_ZN4QPDF15ResolveRecorderD2Ev:
  134|   273k|    {
  135|   273k|        qpdf.m->resolving.erase(iter);
  136|   273k|    }
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects22resolveObjectsInStreamEiENK3$_0clEixRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 1722|  17.8k|        [this, obj_stream_number](int id, qpdf_offset_t offset, std::string const& msg) -> QPDFExc {
 1723|  17.8k|        return {
 1724|  17.8k|            qpdf_e_damaged_pdf,
 1725|  17.8k|            m->file->getName() + " object stream " + std::to_string(obj_stream_number),
 1726|  17.8k|            +"object " + std::to_string(id) + " 0",
 1727|  17.8k|            offset,
 1728|  17.8k|            msg,
 1729|  17.8k|            true};
 1730|  17.8k|    };

_ZN4QPDF3Doc5Pages5cacheEv:
   53|  12.6k|{
   54|       |    // Note that pushInheritedAttributesToPage may also be used to initialize m->all_pages.
   55|  12.6k|    if (all_pages.empty() && !invalid_page_found) {
  ------------------
  |  Branch (55:9): [True: 11.0k, False: 1.60k]
  |  Branch (55:30): [True: 9.66k, False: 1.34k]
  ------------------
   56|  9.66k|        ever_called_get_all_pages_ = true;
   57|  9.66k|        auto root = qpdf.getRoot();
   58|  9.66k|        QPDFObjGen::set visited;
   59|  9.66k|        QPDFObjGen::set seen;
   60|  9.66k|        QPDFObjectHandle pages = root.getKey("/Pages");
   61|  9.66k|        bool warned = false;
   62|  9.66k|        bool changed_pages = false;
   63|  10.0k|        while (pages.isDictionary() && pages.hasKey("/Parent")) {
  ------------------
  |  Branch (63:16): [True: 4.14k, False: 5.89k]
  |  Branch (63:16): [True: 462, False: 9.57k]
  |  Branch (63:40): [True: 462, False: 3.68k]
  ------------------
   64|    462|            if (!seen.add(pages)) {
  ------------------
  |  Branch (64:17): [True: 86, False: 376]
  ------------------
   65|       |                // loop -- will be detected again and reported later
   66|     86|                break;
   67|     86|            }
   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|    376|            if (!warned) {
  ------------------
  |  Branch (70:17): [True: 199, False: 177]
  ------------------
   71|    199|                root.warn(
   72|    199|                    "document page tree root (root -> /Pages) doesn't point"
   73|    199|                    " to the root of the page tree; attempting to correct");
   74|    199|                warned = true;
   75|    199|            }
   76|    376|            changed_pages = true;
   77|    376|            pages = pages.getKey("/Parent");
   78|    376|        }
   79|  9.66k|        if (changed_pages) {
  ------------------
  |  Branch (79:13): [True: 198, False: 9.46k]
  ------------------
   80|    198|            root.replaceKey("/Pages", pages);
   81|    198|        }
   82|  9.66k|        seen.clear();
   83|  9.66k|        if (!pages.hasKey("/Kids")) {
  ------------------
  |  Branch (83:13): [True: 129, False: 9.53k]
  ------------------
   84|       |            // Ensure we actually found a /Pages object.
   85|    129|            throw QPDFExc(
   86|    129|                qpdf_e_pages, m->file->getName(), "", 0, "root of pages tree has no /Kids array");
   87|    129|        }
   88|  9.53k|        try {
   89|  9.53k|            getAllPagesInternal(pages, 0, visited, seen, false, false);
   90|  9.53k|        } catch (...) {
   91|    176|            all_pages.clear();
   92|    176|            invalid_page_found = false;
   93|    176|            throw;
   94|    176|        }
   95|  3.56k|        if (invalid_page_found) {
  ------------------
  |  Branch (95:13): [True: 2.94k, False: 623]
  ------------------
   96|  2.94k|            flattenPagesTree();
   97|  2.94k|            invalid_page_found = false;
   98|  2.94k|        }
   99|  3.56k|    }
  100|  6.50k|    return all_pages;
  101|  12.6k|}
_ZN4QPDF3Doc5Pages19getAllPagesInternalE16QPDFObjectHandlejRN10QPDFObjGen3setES5_bb:
  111|  7.44k|{
  112|  7.44k|    static uint32_t constexpr max_level = 100;
  113|  7.44k|    if (++level > max_level) {
  ------------------
  |  Branch (113:9): [True: 0, False: 7.44k]
  ------------------
  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.44k|    if (!visited.add(cur_node)) {
  ------------------
  |  Branch (121:9): [True: 32, False: 7.41k]
  ------------------
  122|     32|        throw QPDFExc(
  123|     32|            qpdf_e_pages,
  124|     32|            m->file->getName(),
  125|     32|            "object " + cur_node.getObjGen().unparse(' '),
  126|     32|            0,
  127|     32|            "Loop detected in /Pages structure (getAllPages)");
  128|     32|    }
  129|  7.41k|    if (!cur_node.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (129:9): [True: 6.89k, False: 520]
  ------------------
  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|  6.89k|        cur_node.warn("/Type key should be /Pages but is not; overriding");
  134|  6.89k|        cur_node.replaceKey("/Type", Name("/Pages"));
  135|  6.89k|    }
  136|  7.41k|    if (!media_box) {
  ------------------
  |  Branch (136:9): [True: 7.33k, False: 77]
  ------------------
  137|  7.33k|        media_box = cur_node.getKey("/MediaBox").isRectangle();
  138|  7.33k|        QTC::TC("qpdf", "QPDF inherit mediabox", media_box ? 0 : 1);
  ------------------
  |  Branch (138:50): [True: 278, False: 7.05k]
  ------------------
  139|  7.33k|    }
  140|  7.41k|    if (!resources) {
  ------------------
  |  Branch (140:9): [True: 7.32k, False: 84]
  ------------------
  141|  7.32k|        resources = cur_node.getKey("/Resources").isDictionary();
  142|  7.32k|    }
  143|  7.41k|    auto kids = cur_node.getKey("/Kids");
  144|  7.41k|    if (!visited.add(kids)) {
  ------------------
  |  Branch (144:9): [True: 35, False: 7.37k]
  ------------------
  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.37k|    int i = -1;
  153|  34.5k|    for (auto& kid: kids.as_array()) {
  ------------------
  |  Branch (153:19): [True: 34.5k, False: 7.37k]
  ------------------
  154|  34.5k|        ++i;
  155|  34.5k|        int errors = 0;
  156|       |
  157|  34.5k|        if (!kid.isDictionary()) {
  ------------------
  |  Branch (157:13): [True: 21.7k, False: 12.8k]
  ------------------
  158|  21.7k|            kid.warn("Pages tree includes non-dictionary object; ignoring");
  159|  21.7k|            invalid_page_found = true;
  160|  21.7k|            continue;
  161|  21.7k|        }
  162|  12.8k|        if (!kid.isIndirect()) {
  ------------------
  |  Branch (162:13): [True: 5.11k, False: 7.70k]
  ------------------
  163|  5.11k|            cur_node.warn(
  164|  5.11k|                "kid " + std::to_string(i) + " (from 0) is direct; converting to indirect");
  165|  5.11k|            kid = qpdf.makeIndirectObject(kid);
  166|  5.11k|            ++errors;
  167|  5.11k|        }
  168|  12.8k|        if (kid.hasKey("/Kids")) {
  ------------------
  |  Branch (168:13): [True: 3.70k, False: 9.11k]
  ------------------
  169|  3.70k|            getAllPagesInternal(kid, level, visited, seen, media_box, resources);
  170|  9.11k|        } else {
  171|  9.11k|            if (!media_box && !kid.getKey("/MediaBox").isRectangle()) {
  ------------------
  |  Branch (171:17): [True: 8.09k, False: 1.02k]
  |  Branch (171:17): [True: 4.12k, False: 4.98k]
  |  Branch (171:31): [True: 4.12k, False: 3.96k]
  ------------------
  172|  4.12k|                kid.warn(
  173|  4.12k|                    "kid " + std::to_string(i) +
  174|  4.12k|                    " (from 0) MediaBox is undefined; setting to letter / ANSI A");
  175|  4.12k|                kid.replaceKey(
  176|  4.12k|                    "/MediaBox",
  177|  4.12k|                    QPDFObjectHandle::newArray(QPDFObjectHandle::Rectangle(0, 0, 612, 792)));
  178|  4.12k|                ++errors;
  179|  4.12k|            }
  180|  9.11k|            if (!resources) {
  ------------------
  |  Branch (180:17): [True: 8.22k, False: 890]
  ------------------
  181|  8.22k|                auto res = kid.getKey("/Resources");
  182|       |
  183|  8.22k|                if (!res.isDictionary()) {
  ------------------
  |  Branch (183:21): [True: 3.76k, False: 4.46k]
  ------------------
  184|  3.76k|                    ++errors;
  185|  3.76k|                    kid.warn(
  186|  3.76k|                        "kid " + std::to_string(i) +
  187|  3.76k|                        " (from 0) Resources is missing or invalid; repairing");
  188|  3.76k|                    kid.replaceKey("/Resources", QPDFObjectHandle::newDictionary());
  189|  3.76k|                }
  190|  8.22k|            }
  191|  9.11k|            auto annots = kid.getKey("/Annots");
  192|  9.11k|            if (!annots.null()) {
  ------------------
  |  Branch (192:17): [True: 1.18k, False: 7.93k]
  ------------------
  193|  1.18k|                if (!annots.isArray()) {
  ------------------
  |  Branch (193:21): [True: 22, False: 1.16k]
  ------------------
  194|     22|                    kid.warn(
  195|     22|                        "kid " + std::to_string(i) + " (from 0) Annots is not an array; removing");
  196|     22|                    kid.removeKey("/Annots");
  197|     22|                    ++errors;
  198|  1.16k|                } else {
  199|  1.16k|                    QPDFObjGen::set seen_annots;
  200|  48.6k|                    for (auto& annot: annots.as_array()) {
  ------------------
  |  Branch (200:37): [True: 48.6k, False: 1.16k]
  ------------------
  201|  48.6k|                        if (!seen_annots.add(annot)) {
  ------------------
  |  Branch (201:29): [True: 435, False: 48.2k]
  ------------------
  202|    435|                            kid.warn(
  203|    435|                                "kid " + std::to_string(i) +
  204|    435|                                " (from 0) Annots has duplicate entry for annotation " +
  205|    435|                                annot.id_gen().unparse(' '));
  206|    435|                            ++errors;
  207|    435|                        }
  208|  48.6k|                    }
  209|  1.16k|                }
  210|  1.18k|            }
  211|       |
  212|  9.11k|            if (!seen.add(kid)) {
  ------------------
  |  Branch (212:17): [True: 3.44k, False: 5.66k]
  ------------------
  213|       |                // Make a copy of the page. This does the same as shallowCopyPage in
  214|       |                // QPDFPageObjectHelper.
  215|  3.44k|                if (!m->reconstructed_xref) {
  ------------------
  |  Branch (215:21): [True: 174, False: 3.27k]
  ------------------
  216|    174|                    cur_node.warn(
  217|    174|                        "kid " + std::to_string(i) +
  218|    174|                        " (from 0) appears more than once in the pages tree;"
  219|    174|                        " creating a new page object as a copy");
  220|       |                    // This needs to be fixed. shallowCopy does not necessarily produce a valid
  221|       |                    // page.
  222|    174|                    kid = qpdf.makeIndirectObject(QPDFObjectHandle(kid).shallowCopy());
  223|    174|                    seen.add(kid);
  224|  3.27k|                } else {
  225|  3.27k|                    cur_node.warn(
  226|  3.27k|                        "kid " + std::to_string(i) +
  227|  3.27k|                        " (from 0) appears more than once in the pages tree; ignoring duplicate");
  228|  3.27k|                    invalid_page_found = true;
  229|  3.27k|                    kid = QPDFObjectHandle::newNull();
  230|  3.27k|                    continue;
  231|  3.27k|                }
  232|    174|                if (!kid.getKey("/Parent").isSameObjectAs(cur_node)) {
  ------------------
  |  Branch (232:21): [True: 92, False: 82]
  ------------------
  233|       |                    // Consider fixing and adding an information message.
  234|     92|                    ++errors;
  235|     92|                }
  236|    174|            }
  237|  5.84k|            if (!kid.isDictionaryOfType("/Page")) {
  ------------------
  |  Branch (237:17): [True: 3.24k, False: 2.59k]
  ------------------
  238|  3.24k|                kid.warn("/Type key should be /Page but is not; overriding");
  239|  3.24k|                kid.replaceKey("/Type", Name("/Page"));
  240|  3.24k|                ++errors;
  241|  3.24k|            }
  242|  5.84k|            if (m->reconstructed_xref && errors > 2) {
  ------------------
  |  Branch (242:17): [True: 5.04k, False: 798]
  |  Branch (242:42): [True: 1.69k, False: 3.35k]
  ------------------
  243|  1.69k|                cur_node.warn(
  244|  1.69k|                    "kid " + std::to_string(i) + " (from 0) has too many errors; ignoring page");
  245|  1.69k|                invalid_page_found = true;
  246|  1.69k|                kid = QPDFObjectHandle::newNull();
  247|  1.69k|                continue;
  248|  1.69k|            }
  249|  4.14k|            all_pages.emplace_back(kid);
  250|  4.14k|        }
  251|  12.8k|    }
  252|  7.37k|}
_ZN4QPDF3Doc5Pages16flattenPagesTreeEv:
  274|  2.94k|{
  275|       |    // If not already done, flatten the /Pages structure and initialize pageobj_to_pages_pos.
  276|       |
  277|  2.94k|    if (!pageobj_to_pages_pos.empty()) {
  ------------------
  |  Branch (277:9): [True: 0, False: 2.94k]
  ------------------
  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|  2.94k|    pushInheritedAttributesToPage(true, true);
  284|       |
  285|  2.94k|    QPDFObjectHandle pages = qpdf.getRoot().getKey("/Pages");
  286|       |
  287|  2.94k|    size_t const len = all_pages.size();
  288|  5.82k|    for (size_t pos = 0; pos < len; ++pos) {
  ------------------
  |  Branch (288:26): [True: 2.88k, False: 2.94k]
  ------------------
  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|  2.88k|        insertPageobjToPage(all_pages.at(pos), toI(pos), true);
  293|  2.88k|        all_pages.at(pos).replaceKey("/Parent", pages);
  294|  2.88k|    }
  295|       |
  296|  2.94k|    pages.replaceKey("/Kids", Array(all_pages));
  297|       |    // /Count has not changed
  298|  2.94k|    if (pages.getKey("/Count").getUIntValue() != len) {
  ------------------
  |  Branch (298:9): [True: 1.70k, False: 1.23k]
  ------------------
  299|  1.70k|        if (invalid_page_found && pages.getKey("/Count").getUIntValue() > len) {
  ------------------
  |  Branch (299:13): [True: 1.70k, False: 0]
  |  Branch (299:13): [True: 1.64k, False: 62]
  |  Branch (299:35): [True: 1.64k, False: 62]
  ------------------
  300|  1.64k|            pages.replaceKey("/Count", Integer(len));
  301|  1.64k|        } else {
  302|     62|            throw std::runtime_error("/Count is wrong after flattening pages tree");
  303|     62|        }
  304|  1.70k|    }
  305|  2.94k|}
_ZN4QPDF3Doc5Pages29pushInheritedAttributesToPageEbb:
  316|  2.94k|{
  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|  2.94k|    if (pushed_inherited_attributes_to_pages && !warn_skipped_keys) {
  ------------------
  |  Branch (321:9): [True: 0, False: 2.94k]
  |  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|  2.94k|    (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|  2.94k|    std::map<std::string, std::vector<QPDFObjectHandle>> key_ancestors;
  332|  2.94k|    pushInheritedAttributesToPageInternal(
  333|  2.94k|        m->trailer.getKey("/Root").getKey("/Pages"),
  334|  2.94k|        key_ancestors,
  335|  2.94k|        allow_changes,
  336|  2.94k|        warn_skipped_keys);
  337|  2.94k|    util::assertion(
  338|  2.94k|        key_ancestors.empty(),
  339|  2.94k|        "key_ancestors not empty after pushing inherited attributes to pages");
  340|  2.94k|    pushed_inherited_attributes_to_pages = true;
  341|  2.94k|    ever_pushed_inherited_attributes_to_pages_ = true;
  342|  2.94k|}
_ZN4QPDF3Doc5Pages37pushInheritedAttributesToPageInternalE16QPDFObjectHandleRNSt3__13mapINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS3_6vectorIS2_NS8_IS2_EEEENS3_4lessISA_EENS8_INS3_4pairIKSA_SD_EEEEEEbb:
  350|  6.08k|{
  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.08k|    std::set<std::string> inheritable_keys;
  356|  23.4k|    for (auto const& key: cur_pages.getKeys()) {
  ------------------
  |  Branch (356:25): [True: 23.4k, False: 6.08k]
  ------------------
  357|  23.4k|        if (key == "/MediaBox" || key == "/CropBox" || key == "/Resources" || key == "/Rotate") {
  ------------------
  |  Branch (357:13): [True: 1.71k, False: 21.7k]
  |  Branch (357:35): [True: 269, False: 21.5k]
  |  Branch (357:56): [True: 1.49k, False: 20.0k]
  |  Branch (357:79): [True: 452, False: 19.5k]
  ------------------
  358|  3.93k|            if (!allow_changes) {
  ------------------
  |  Branch (358:17): [True: 0, False: 3.93k]
  ------------------
  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|  3.93k|            inheritable_keys.insert(key);
  370|  3.93k|            auto oh = cur_pages[key];
  371|  3.93k|            QTC::TC("qpdf", "QPDF opt direct pages resource", oh.indirect() ? 0 : 1);
  ------------------
  |  Branch (371:63): [True: 45, False: 3.89k]
  ------------------
  372|  3.93k|            if (!oh.indirect()) {
  ------------------
  |  Branch (372:17): [True: 3.89k, False: 45]
  ------------------
  373|  3.89k|                if (!oh.isScalar()) {
  ------------------
  |  Branch (373:21): [True: 347, False: 3.54k]
  ------------------
  374|       |                    // Replace shared direct object non-scalar resources with indirect objects to
  375|       |                    // avoid copying large structures around.
  376|    347|                    cur_pages.replaceKey(key, qpdf.makeIndirectObject(oh));
  377|    347|                    oh = cur_pages[key];
  378|  3.54k|                } else {
  379|       |                    // It's okay to copy scalars.
  380|  3.54k|                }
  381|  3.89k|            }
  382|  3.93k|            key_ancestors[key].emplace_back(oh);
  383|  3.93k|            if (key_ancestors[key].size() > 1) {
  ------------------
  |  Branch (383:17): [True: 610, False: 3.32k]
  ------------------
  384|    610|            }
  385|       |            // Remove this resource from this node.  It will be reattached at the page level.
  386|  3.93k|            cur_pages.erase(key);
  387|  19.5k|        } else if (!(key == "/Type" || key == "/Parent" || key == "/Kids" || key == "/Count")) {
  ------------------
  |  Branch (387:22): [True: 6.05k, False: 13.5k]
  |  Branch (387:40): [True: 290, False: 13.2k]
  |  Branch (387:60): [True: 6.08k, False: 7.13k]
  |  Branch (387:78): [True: 1.80k, False: 5.33k]
  ------------------
  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.33k|            if (warn_skipped_keys && cur_pages.contains("/Parent")) {
  ------------------
  |  Branch (390:17): [True: 5.33k, False: 0]
  |  Branch (390:17): [True: 1.20k, False: 4.12k]
  |  Branch (390:38): [True: 1.20k, False: 4.12k]
  ------------------
  391|  1.20k|                warn(
  392|  1.20k|                    qpdf_e_pages,
  393|  1.20k|                    "Pages object: object " + cur_pages.id_gen().unparse(' '),
  394|  1.20k|                    cur_pages.offset(),
  395|  1.20k|                    ("Unknown key " + key +
  396|  1.20k|                     " in /Pages object is being discarded as a result of flattening the /Pages "
  397|  1.20k|                     "tree"));
  398|  1.20k|            }
  399|  5.33k|        }
  400|  23.4k|    }
  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|  27.2k|    for (auto& kid: Array(cur_pages["/Kids"])) {
  ------------------
  |  Branch (405:19): [True: 27.2k, False: 6.08k]
  ------------------
  406|  27.2k|        if (kid.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (406:13): [True: 3.14k, False: 24.1k]
  ------------------
  407|  3.14k|            pushInheritedAttributesToPageInternal(
  408|  3.14k|                kid, key_ancestors, allow_changes, warn_skipped_keys);
  409|  24.1k|        } else {
  410|       |            // Add all available inheritable attributes not present in this object to this object.
  411|  24.1k|            for (auto const& [key, values]: key_ancestors) {
  ------------------
  |  Branch (411:43): [True: 4.31k, False: 24.1k]
  ------------------
  412|  4.31k|                if (!kid.contains(key)) {
  ------------------
  |  Branch (412:21): [True: 4.21k, False: 106]
  ------------------
  413|  4.21k|                    kid.replaceKey(key, values.back());
  414|  4.21k|                } else {
  415|    106|                    QTC::TC("qpdf", "QPDF opt page resource hides ancestor");
  416|    106|                }
  417|  4.31k|            }
  418|  24.1k|        }
  419|  27.2k|    }
  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.08k|    if (!inheritable_keys.empty()) {
  ------------------
  |  Branch (425:9): [True: 1.93k, False: 4.15k]
  ------------------
  426|  3.48k|        for (auto const& key: inheritable_keys) {
  ------------------
  |  Branch (426:29): [True: 3.48k, False: 1.93k]
  ------------------
  427|  3.48k|            key_ancestors[key].pop_back();
  428|  3.48k|            if (key_ancestors[key].empty()) {
  ------------------
  |  Branch (428:17): [True: 2.88k, False: 607]
  ------------------
  429|  2.88k|                key_ancestors.erase(key);
  430|  2.88k|            }
  431|  3.48k|        }
  432|  4.15k|    } else {
  433|  4.15k|        QTC::TC("qpdf", "QPDF opt no inheritable keys");
  434|  4.15k|    }
  435|  6.08k|}
_ZN4QPDF3Doc5Pages19insertPageobjToPageERK16QPDFObjectHandleib:
  439|  2.88k|{
  440|  2.88k|    QPDFObjGen og(obj.getObjGen());
  441|  2.88k|    if (check_duplicate) {
  ------------------
  |  Branch (441:9): [True: 2.88k, False: 0]
  ------------------
  442|  2.88k|        if (!pageobj_to_pages_pos.insert(std::make_pair(og, pos)).second) {
  ------------------
  |  Branch (442:13): [True: 0, False: 2.88k]
  ------------------
  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|  2.88k|    } else {
  452|      0|        pageobj_to_pages_pos[og] = pos;
  453|      0|    }
  454|  2.88k|}

_ZN5QUtil16double_to_stringEdib:
  358|  16.4k|{
  359|       |    // Backward compatibility -- this code used to use sprintf and treated decimal_places <= 0 to
  360|       |    // mean to use the default, which was six decimal places. Starting in 10.2, we trim trailing
  361|       |    // zeroes by default.
  362|  16.4k|    if (decimal_places <= 0) {
  ------------------
  |  Branch (362:9): [True: 16.4k, False: 0]
  ------------------
  363|  16.4k|        decimal_places = 6;
  364|  16.4k|    }
  365|  16.4k|    std::ostringstream buf;
  366|  16.4k|    buf.imbue(std::locale::classic());
  367|  16.4k|    buf << std::setprecision(decimal_places) << std::fixed << num;
  368|  16.4k|    std::string result = buf.str();
  369|  16.4k|    if (trim_trailing_zeroes) {
  ------------------
  |  Branch (369:9): [True: 16.4k, False: 0]
  ------------------
  370|   115k|        while ((result.length() > 1) && (result.back() == '0')) {
  ------------------
  |  Branch (370:16): [True: 115k, False: 0]
  |  Branch (370:41): [True: 98.9k, False: 16.4k]
  ------------------
  371|  98.9k|            result.pop_back();
  372|  98.9k|        }
  373|  16.4k|        if ((result.length() > 1) && (result.back() == '.')) {
  ------------------
  |  Branch (373:13): [True: 16.4k, False: 0]
  |  Branch (373:38): [True: 16.4k, False: 0]
  ------------------
  374|  16.4k|            result.pop_back();
  375|  16.4k|        }
  376|  16.4k|    }
  377|  16.4k|    return result;
  378|  16.4k|}
_ZN5QUtil12string_to_llEPKc:
  394|  6.36M|{
  395|  6.36M|    errno = 0;
  396|       |#ifdef _MSC_VER
  397|       |    long long result = _strtoi64(str, 0, 10);
  398|       |#else
  399|  6.36M|    long long result = strtoll(str, nullptr, 10);
  400|  6.36M|#endif
  401|  6.36M|    if (errno == ERANGE) {
  ------------------
  |  Branch (401:9): [True: 757, False: 6.36M]
  ------------------
  402|    757|        throw std::range_error(
  403|    757|            std::string("overflow/underflow converting ") + str + " to 64-bit integer");
  404|    757|    }
  405|  6.36M|    return result;
  406|  6.36M|}
_ZN5QUtil13string_to_intEPKc:
  410|   483k|{
  411|       |    // QIntC::to_int does range checking
  412|   483k|    return QIntC::to_int(string_to_ll(str));
  413|   483k|}
_ZN5QUtil21unsigned_char_pointerERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  462|   134k|{
  463|   134k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str.c_str()));
  464|   134k|}
_ZN5QUtil21unsigned_char_pointerEPKc:
  468|  4.28k|{
  469|  4.28k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str));
  470|  4.28k|}
_ZN5QUtil16make_unique_cstrERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  732|  4.28k|{
  733|  4.28k|    auto result = std::make_unique<char[]>(str.length() + 1);
  734|       |    // Use memcpy in case string contains nulls
  735|  4.28k|    result.get()[str.length()] = '\0';
  736|  4.28k|    memcpy(result.get(), str.c_str(), str.length());
  737|  4.28k|    return result;
  738|  4.28k|}
_ZN5QUtil7get_envERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPS6_:
  827|      1|{
  828|       |    // This was basically ripped out of wxWindows.
  829|       |#ifdef _WIN32
  830|       |# ifdef NO_GET_ENVIRONMENT
  831|       |    return false;
  832|       |# else
  833|       |    // first get the size of the buffer
  834|       |    DWORD len = ::GetEnvironmentVariable(var.c_str(), NULL, 0);
  835|       |    if (len == 0) {
  836|       |        // this means that there is no such variable
  837|       |        return false;
  838|       |    }
  839|       |
  840|       |    if (value) {
  841|       |        auto t = QUtil::make_shared_array<char>(len + 1);
  842|       |        ::GetEnvironmentVariable(var.c_str(), t.get(), len);
  843|       |        *value = t.get();
  844|       |    }
  845|       |
  846|       |    return true;
  847|       |# endif
  848|       |#else
  849|      1|    char* p = getenv(var.c_str());
  850|      1|    if (p == nullptr) {
  ------------------
  |  Branch (850:9): [True: 1, False: 0]
  ------------------
  851|      1|        return false;
  852|      1|    }
  853|      0|    if (value) {
  ------------------
  |  Branch (853:9): [True: 0, False: 0]
  ------------------
  854|      0|        *value = p;
  855|      0|    }
  856|       |
  857|      0|    return true;
  858|      1|#endif
  859|      1|}
_ZN5QUtil6toUTF8Em:
 1036|   158M|{
 1037|   158M|    std::string result;
 1038|       |
 1039|       |    // A UTF-8 encoding of a Unicode value is a single byte for Unicode values <= 127.  For larger
 1040|       |    // values, the first byte of the UTF-8 encoding has '1' as each of its n highest bits and '0'
 1041|       |    // for its (n+1)th highest bit where n is the total number of bytes required.  Subsequent bytes
 1042|       |    // start with '10' and have the remaining 6 bits free for encoding.  For example, an 11-bit
 1043|       |    // Unicode value can be stored in two bytes where the first is 110zzzzz, the second is 10zzzzzz,
 1044|       |    // and the z's represent the remaining bits.
 1045|       |
 1046|   158M|    if (uval > 0x7fffffff) {
  ------------------
  |  Branch (1046:9): [True: 0, False: 158M]
  ------------------
 1047|      0|        throw std::runtime_error("bounds error in QUtil::toUTF8");
 1048|   158M|    } else if (uval < 128) {
  ------------------
  |  Branch (1048:16): [True: 35.7M, False: 122M]
  ------------------
 1049|  35.7M|        result += static_cast<char>(uval);
 1050|   122M|    } else {
 1051|   122M|        unsigned char bytes[7];
 1052|   122M|        bytes[6] = '\0';
 1053|   122M|        unsigned char* cur_byte = &bytes[5];
 1054|       |
 1055|       |        // maximum value that will fit in the current number of bytes
 1056|   122M|        unsigned char maxval = 0x3f; // six bits
 1057|       |
 1058|   358M|        while (uval > QIntC::to_ulong(maxval)) {
  ------------------
  |  Branch (1058:16): [True: 236M, False: 122M]
  ------------------
 1059|       |            // Assign low six bits plus 10000000 to lowest unused byte position, then shift
 1060|   236M|            *cur_byte = static_cast<unsigned char>(0x80 + (uval & 0x3f));
 1061|   236M|            uval >>= 6;
 1062|       |            // Maximum that will fit in high byte now shrinks by one bit
 1063|   236M|            maxval = static_cast<unsigned char>(maxval >> 1);
 1064|       |            // Slide to the left one byte
 1065|   236M|            if (cur_byte <= bytes) {
  ------------------
  |  Branch (1065:17): [True: 0, False: 236M]
  ------------------
 1066|      0|                throw std::logic_error("QUtil::toUTF8: overflow error");
 1067|      0|            }
 1068|   236M|            --cur_byte;
 1069|   236M|        }
 1070|       |        // If maxval is k bits long, the high (7 - k) bits of the resulting byte must be high.
 1071|   122M|        *cur_byte = static_cast<unsigned char>(QIntC::to_ulong(0xff - (1 + (maxval << 1))) + uval);
 1072|       |
 1073|   122M|        result += reinterpret_cast<char*>(cur_byte);
 1074|   122M|    }
 1075|       |
 1076|   158M|    return result;
 1077|   158M|}
_ZN5QUtil7toUTF16Em:
 1081|  3.33M|{
 1082|  3.33M|    std::string result;
 1083|  3.33M|    if ((uval >= 0xd800) && (uval <= 0xdfff)) {
  ------------------
  |  Branch (1083:9): [True: 8.76k, False: 3.32M]
  |  Branch (1083:29): [True: 355, False: 8.41k]
  ------------------
 1084|    355|        result = "\xff\xfd";
 1085|  3.33M|    } else if (uval <= 0xffff) {
  ------------------
  |  Branch (1085:16): [True: 3.32M, False: 2.00k]
  ------------------
 1086|  3.32M|        char out[2];
 1087|  3.32M|        out[0] = static_cast<char>((uval & 0xff00) >> 8);
 1088|  3.32M|        out[1] = static_cast<char>(uval & 0xff);
 1089|  3.32M|        result = std::string(out, 2);
 1090|  3.32M|    } else if (uval <= 0x10ffff) {
  ------------------
  |  Branch (1090:16): [True: 1.13k, False: 874]
  ------------------
 1091|  1.13k|        char out[4];
 1092|  1.13k|        uval -= 0x10000;
 1093|  1.13k|        unsigned short high = static_cast<unsigned short>(((uval & 0xffc00) >> 10) + 0xd800);
 1094|  1.13k|        unsigned short low = static_cast<unsigned short>((uval & 0x3ff) + 0xdc00);
 1095|  1.13k|        out[0] = static_cast<char>((high & 0xff00) >> 8);
 1096|  1.13k|        out[1] = static_cast<char>(high & 0xff);
 1097|  1.13k|        out[2] = static_cast<char>((low & 0xff00) >> 8);
 1098|  1.13k|        out[3] = static_cast<char>(low & 0xff);
 1099|  1.13k|        result = std::string(out, 4);
 1100|  1.13k|    } else {
 1101|    874|        result = "\xff\xfd";
 1102|    874|    }
 1103|       |
 1104|  3.33M|    return result;
 1105|  3.33M|}
_ZN5QUtil21getRandomDataProviderEv:
 1158|    330|{
 1159|    330|    return getRandomDataProviderProvider()->getProvider();
 1160|    330|}
_ZN5QUtil25initializeWithRandomBytesEPhm:
 1164|    330|{
 1165|    330|    getRandomDataProvider()->provideRandomData(data, len);
 1166|    330|}
_ZN5QUtil23get_next_utf8_codepointERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERmRb:
 1511|  44.2M|{
 1512|  44.2M|    auto o_pos = pos;
 1513|  44.2M|    size_t len = utf8_val.length();
 1514|  44.2M|    unsigned char ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1515|  44.2M|    error = false;
 1516|  44.2M|    if (ch < 128) {
  ------------------
  |  Branch (1516:9): [True: 4.35M, False: 39.9M]
  ------------------
 1517|  4.35M|        return static_cast<unsigned long>(ch);
 1518|  4.35M|    }
 1519|       |
 1520|  39.9M|    size_t bytes_needed = 0;
 1521|  39.9M|    unsigned bit_check = 0x40;
 1522|  39.9M|    unsigned char to_clear = 0x80;
 1523|  71.9M|    while (ch & bit_check) {
  ------------------
  |  Branch (1523:12): [True: 31.9M, False: 39.9M]
  ------------------
 1524|  31.9M|        ++bytes_needed;
 1525|  31.9M|        to_clear = static_cast<unsigned char>(to_clear | bit_check);
 1526|  31.9M|        bit_check >>= 1;
 1527|  31.9M|    }
 1528|  39.9M|    if (((bytes_needed > 5) || (bytes_needed < 1)) || ((pos + bytes_needed) > len)) {
  ------------------
  |  Branch (1528:10): [True: 117k, False: 39.8M]
  |  Branch (1528:32): [True: 23.8M, False: 15.9M]
  |  Branch (1528:55): [True: 308, False: 15.9M]
  ------------------
 1529|  24.0M|        error = true;
 1530|  24.0M|        return 0xfffd;
 1531|  24.0M|    }
 1532|       |
 1533|  15.9M|    auto codepoint = static_cast<unsigned long>(ch & ~to_clear);
 1534|  46.2M|    while (bytes_needed > 0) {
  ------------------
  |  Branch (1534:12): [True: 30.8M, False: 15.4M]
  ------------------
 1535|  30.8M|        --bytes_needed;
 1536|  30.8M|        ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1537|  30.8M|        if ((ch & 0xc0) != 0x80) {
  ------------------
  |  Branch (1537:13): [True: 446k, False: 30.3M]
  ------------------
 1538|   446k|            --pos;
 1539|   446k|            error = true;
 1540|   446k|            return 0xfffd;
 1541|   446k|        }
 1542|  30.3M|        codepoint <<= 6;
 1543|  30.3M|        codepoint += (ch & 0x3f);
 1544|  30.3M|    }
 1545|  15.4M|    unsigned long lower_bound = 0;
 1546|  15.4M|    switch (pos - o_pos) {
 1547|   664k|    case 2:
  ------------------
  |  Branch (1547:5): [True: 664k, False: 14.8M]
  ------------------
 1548|   664k|        lower_bound = 1 << 7;
 1549|   664k|        break;
 1550|  14.8M|    case 3:
  ------------------
  |  Branch (1550:5): [True: 14.8M, False: 668k]
  ------------------
 1551|  14.8M|        lower_bound = 1 << 11;
 1552|  14.8M|        break;
 1553|  2.86k|    case 4:
  ------------------
  |  Branch (1553:5): [True: 2.86k, False: 15.4M]
  ------------------
 1554|  2.86k|        lower_bound = 1 << 16;
 1555|  2.86k|        break;
 1556|    848|    case 5:
  ------------------
  |  Branch (1556:5): [True: 848, False: 15.4M]
  ------------------
 1557|    848|        lower_bound = 1 << 21;
 1558|    848|        break;
 1559|    328|    case 6:
  ------------------
  |  Branch (1559:5): [True: 328, False: 15.4M]
  ------------------
 1560|    328|        lower_bound = 1 << 26;
 1561|    328|        break;
 1562|      0|    default:
  ------------------
  |  Branch (1562:5): [True: 0, False: 15.4M]
  ------------------
 1563|      0|        lower_bound = 0;
 1564|  15.4M|    }
 1565|       |
 1566|  15.4M|    if (lower_bound > 0 && codepoint < lower_bound) {
  ------------------
  |  Branch (1566:9): [True: 15.4M, False: 0]
  |  Branch (1566:28): [True: 4.15k, False: 15.4M]
  ------------------
 1567|       |        // Too many bytes were used, but return whatever character was encoded.
 1568|  4.15k|        error = true;
 1569|  4.15k|    }
 1570|  15.4M|    return codepoint;
 1571|  15.4M|}
_ZN5QUtil13utf8_to_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1669|    636|{
 1670|    636|    return transcode_utf8(utf8, e_utf16, 0);
 1671|    636|}
_ZN5QUtil15utf8_to_pdf_docERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERS6_c:
 1717|  2.78k|{
 1718|  2.78k|    return transcode_utf8(utf8, pdfdoc, e_pdfdoc, unknown_char);
 1719|  2.78k|}
_ZN5QUtil8is_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1723|  48.5k|{
 1724|  48.5k|    return util::is_utf16(val);
 1725|  48.5k|}
_ZN5QUtil13utf16_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1735|  48.5k|{
 1736|  48.5k|    std::string result;
 1737|       |    // This code uses unsigned long and unsigned short to hold codepoint values. It requires
 1738|       |    // unsigned long to be at least 32 bits and unsigned short to be at least 16 bits, but it will
 1739|       |    // work fine if they are larger.
 1740|  48.5k|    unsigned long codepoint = 0L;
 1741|  48.5k|    size_t len = val.length();
 1742|  48.5k|    size_t start = 0;
 1743|  48.5k|    bool is_le = false;
 1744|  48.5k|    if (is_utf16(val)) {
  ------------------
  |  Branch (1744:9): [True: 48.5k, False: 0]
  ------------------
 1745|  48.5k|        if (static_cast<unsigned char>(val.at(0)) == 0xff) {
  ------------------
  |  Branch (1745:13): [True: 34.9k, False: 13.6k]
  ------------------
 1746|  34.9k|            is_le = true;
 1747|  34.9k|        }
 1748|  48.5k|        start += 2;
 1749|  48.5k|    }
 1750|       |    // If the string has an odd number of bytes, the last byte is ignored.
 1751|  14.2M|    for (size_t i = start; i + 1 < len; i += 2) {
  ------------------
  |  Branch (1751:28): [True: 14.2M, False: 48.5k]
  ------------------
 1752|       |        // Convert from UTF16-BE.  If we get a malformed codepoint, this code will generate
 1753|       |        // incorrect output without giving a warning.  Specifically, a high codepoint not followed
 1754|       |        // by a low codepoint will be discarded, and a low codepoint not preceded by a high
 1755|       |        // codepoint will just get its low 10 bits output.
 1756|  14.2M|        auto msb = is_le ? i + 1 : i;
  ------------------
  |  Branch (1756:20): [True: 764k, False: 13.4M]
  ------------------
 1757|  14.2M|        auto lsb = is_le ? i : i + 1;
  ------------------
  |  Branch (1757:20): [True: 764k, False: 13.4M]
  ------------------
 1758|  14.2M|        unsigned short bits = QIntC::to_ushort(
 1759|  14.2M|            (static_cast<unsigned char>(val.at(msb)) << 8) +
 1760|  14.2M|            static_cast<unsigned char>(val.at(lsb)));
 1761|  14.2M|        if ((bits & 0xFC00) == 0xD800) {
  ------------------
  |  Branch (1761:13): [True: 2.44k, False: 14.1M]
  ------------------
 1762|  2.44k|            codepoint = 0x10000U + ((bits & 0x3FFU) << 10U);
 1763|  2.44k|            continue;
 1764|  14.1M|        } else if ((bits & 0xFC00) == 0xDC00) {
  ------------------
  |  Branch (1764:20): [True: 5.10k, False: 14.1M]
  ------------------
 1765|  5.10k|            if (codepoint != 0) {
  ------------------
  |  Branch (1765:17): [True: 1.38k, False: 3.71k]
  ------------------
 1766|  1.38k|                QTC::TC("qpdf", "QUtil non-trivial UTF-16");
 1767|  1.38k|            }
 1768|  5.10k|            codepoint += bits & 0x3FF;
 1769|  14.1M|        } else {
 1770|  14.1M|            codepoint = bits;
 1771|  14.1M|        }
 1772|       |
 1773|  14.1M|        result += QUtil::toUTF8(codepoint);
 1774|  14.1M|        codepoint = 0;
 1775|  14.1M|    }
 1776|  48.5k|    return result;
 1777|  48.5k|}
_ZN5QUtil15pdf_doc_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1813|   685k|{
 1814|   685k|    std::string result;
 1815|   685k|    size_t len = val.length();
 1816|   145M|    for (unsigned int i = 0; i < len; ++i) {
  ------------------
  |  Branch (1816:30): [True: 144M, False: 685k]
  ------------------
 1817|   144M|        unsigned char ch = static_cast<unsigned char>(val.at(i));
 1818|   144M|        unsigned short ch_short = ch;
 1819|   144M|        if ((ch >= 127) && (ch <= 160)) {
  ------------------
  |  Branch (1819:13): [True: 111M, False: 32.8M]
  |  Branch (1819:28): [True: 102M, False: 8.58M]
  ------------------
 1820|   102M|            ch_short = pdf_doc_to_unicode[ch - 127];
 1821|   102M|        } else if ((ch >= 24) && (ch <= 31)) {
  ------------------
  |  Branch (1821:20): [True: 34.9M, False: 6.46M]
  |  Branch (1821:34): [True: 369k, False: 34.5M]
  ------------------
 1822|   369k|            ch_short = pdf_doc_low_to_unicode[ch - 24];
 1823|  41.0M|        } else if (ch == 173) {
  ------------------
  |  Branch (1823:20): [True: 15.2k, False: 41.0M]
  ------------------
 1824|  15.2k|            ch_short = 0xfffd;
 1825|  15.2k|        }
 1826|   144M|        result += QUtil::toUTF8(ch_short);
 1827|   144M|    }
 1828|   685k|    return result;
 1829|   685k|}
QUtil.cc:_ZL29getRandomDataProviderProviderv:
 1144|    330|{
 1145|       |    // Thread-safe static initializer
 1146|    330|    static RandomDataProviderProvider rdpp;
 1147|    330|    return &rdpp;
 1148|    330|}
QUtil.cc:_ZN12_GLOBAL__N_126RandomDataProviderProviderC2Ev:
 1125|      1|    default_provider(CryptoRandomDataProvider::getInstance())
 1126|      1|{
 1127|      1|    this->current_provider = default_provider;
 1128|      1|}
QUtil.cc:_ZN12_GLOBAL__N_126RandomDataProviderProvider11getProviderEv:
 1132|    330|{
 1133|    330|    return this->current_provider;
 1134|    330|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE10encoding_ec:
 1661|    636|{
 1662|    636|    std::string result;
 1663|    636|    transcode_utf8(utf8_val, result, encoding, unknown);
 1664|    636|    return result;
 1665|    636|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERS5_10encoding_ec:
 1575|  3.41k|{
 1576|  3.41k|    bool okay = true;
 1577|  3.41k|    result.clear();
 1578|  3.41k|    size_t len = utf8_val.length();
 1579|  3.41k|    switch (encoding) {
 1580|    636|    case e_utf16:
  ------------------
  |  Branch (1580:5): [True: 636, False: 2.78k]
  ------------------
 1581|    636|        result += "\xfe\xff";
 1582|    636|        break;
 1583|  2.78k|    case e_pdfdoc:
  ------------------
  |  Branch (1583:5): [True: 2.78k, False: 636]
  ------------------
 1584|       |        // We need to avoid having the result start with something that will be interpreted as
 1585|       |        // UTF-16 or UTF-8, meaning we can't end up with a string that starts with "fe ff",
 1586|       |        // (UTF-16-BE) "ff fe" (UTF-16-LE, not officially part of the PDF spec, but recognized by
 1587|       |        // most readers including qpdf), or "ef bb bf" (UTF-8). It's more efficient to check the
 1588|       |        // input string to see if it will map to one of those sequences than to check the output
 1589|       |        // string since all cases start with the same starting character.
 1590|  2.78k|        if ((len >= 4) && (utf8_val[0] == '\xc3')) {
  ------------------
  |  Branch (1590:13): [True: 2.19k, False: 584]
  |  Branch (1590:27): [True: 1.23k, False: 965]
  ------------------
 1591|  1.23k|            static std::string fe_ff("\xbe\xc3\xbf");
 1592|  1.23k|            static std::string ff_fe("\xbf\xc3\xbe");
 1593|  1.23k|            static std::string ef_bb_bf("\xaf\xc2\xbb\xc2\xbf");
 1594|       |            // C++-20 has starts_with, but when this was written, qpdf had a minimum supported
 1595|       |            // version of C++-17.
 1596|  1.23k|            if ((utf8_val.compare(1, 3, fe_ff) == 0) || (utf8_val.compare(1, 3, ff_fe) == 0) ||
  ------------------
  |  Branch (1596:17): [True: 20, False: 1.21k]
  |  Branch (1596:57): [True: 19, False: 1.19k]
  ------------------
 1597|  1.19k|                (utf8_val.compare(1, 5, ef_bb_bf) == 0)) {
  ------------------
  |  Branch (1597:17): [True: 22, False: 1.17k]
  ------------------
 1598|     61|                result += unknown;
 1599|     61|                okay = false;
 1600|     61|            }
 1601|  1.23k|        }
 1602|  2.78k|        break;
 1603|      0|    default:
  ------------------
  |  Branch (1603:5): [True: 0, False: 3.41k]
  ------------------
 1604|      0|        break;
 1605|  3.41k|    }
 1606|  3.41k|    size_t pos = 0;
 1607|  44.2M|    while (pos < len) {
  ------------------
  |  Branch (1607:12): [True: 44.2M, False: 3.41k]
  ------------------
 1608|  44.2M|        bool error = false;
 1609|  44.2M|        unsigned long codepoint = QUtil::get_next_utf8_codepoint(utf8_val, pos, error);
 1610|  44.2M|        if (error) {
  ------------------
  |  Branch (1610:13): [True: 24.4M, False: 19.8M]
  ------------------
 1611|  24.4M|            okay = false;
 1612|  24.4M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1612:17): [True: 12.2M, False: 12.2M]
  ------------------
 1613|  12.2M|                result += "\xff\xfd";
 1614|  12.2M|            } else {
 1615|  12.2M|                result.append(1, unknown);
 1616|  12.2M|            }
 1617|  24.4M|        } else if (codepoint < 128) {
  ------------------
  |  Branch (1617:20): [True: 4.35M, False: 15.4M]
  ------------------
 1618|  4.35M|            char ch = static_cast<char>(codepoint);
 1619|  4.35M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1619:17): [True: 1.81M, False: 2.53M]
  ------------------
 1620|  1.81M|                result += QUtil::toUTF16(QIntC::to_ulong(ch));
 1621|  2.53M|            } else if ((encoding == e_pdfdoc) && (((ch >= 0x18) && (ch <= 0x1f)) || (ch == 127))) {
  ------------------
  |  Branch (1621:24): [True: 2.53M, False: 0]
  |  Branch (1621:52): [True: 2.14M, False: 396k]
  |  Branch (1621:68): [True: 36.6k, False: 2.10M]
  |  Branch (1621:85): [True: 11.2k, False: 2.49M]
  ------------------
 1622|       |                // PDFDocEncoding maps some low characters to Unicode, so if we encounter those
 1623|       |                // invalid UTF-8 code points, map them to unknown so reversing the mapping doesn't
 1624|       |                // change them into other characters.
 1625|  47.9k|                okay = false;
 1626|  47.9k|                result.append(1, unknown);
 1627|  2.49M|            } else {
 1628|  2.49M|                result.append(1, ch);
 1629|  2.49M|            }
 1630|  15.4M|        } else if (encoding == e_utf16) {
  ------------------
  |  Branch (1630:20): [True: 1.51M, False: 13.9M]
  ------------------
 1631|  1.51M|            result += QUtil::toUTF16(codepoint);
 1632|  13.9M|        } else if ((codepoint == 0xad) && (encoding == e_pdfdoc)) {
  ------------------
  |  Branch (1632:20): [True: 86, False: 13.9M]
  |  Branch (1632:43): [True: 86, False: 0]
  ------------------
 1633|       |            // PDFDocEncoding omits 0x00ad (soft hyphen).
 1634|     86|            okay = false;
 1635|     86|            result.append(1, unknown);
 1636|  13.9M|        } else if (
 1637|  13.9M|            (codepoint > 160) && (codepoint < 256) &&
  ------------------
  |  Branch (1637:13): [True: 13.9M, False: 656]
  |  Branch (1637:34): [True: 490k, False: 13.4M]
  ------------------
 1638|   490k|            ((encoding == e_winansi) || (encoding == e_pdfdoc))) {
  ------------------
  |  Branch (1638:14): [True: 0, False: 490k]
  |  Branch (1638:41): [True: 490k, False: 0]
  ------------------
 1639|   490k|            result.append(1, static_cast<char>(codepoint & 0xff));
 1640|  13.4M|        } else {
 1641|  13.4M|            unsigned char ch = '\0';
 1642|  13.4M|            if (encoding == e_winansi) {
  ------------------
  |  Branch (1642:17): [True: 0, False: 13.4M]
  ------------------
 1643|      0|                ch = encode_winansi(codepoint);
 1644|  13.4M|            } else if (encoding == e_macroman) {
  ------------------
  |  Branch (1644:24): [True: 0, False: 13.4M]
  ------------------
 1645|      0|                ch = encode_macroman(codepoint);
 1646|  13.4M|            } else if (encoding == e_pdfdoc) {
  ------------------
  |  Branch (1646:24): [True: 13.4M, False: 0]
  ------------------
 1647|  13.4M|                ch = encode_pdfdoc(codepoint);
 1648|  13.4M|            }
 1649|  13.4M|            if (ch == '\0') {
  ------------------
  |  Branch (1649:17): [True: 1.51M, False: 11.9M]
  ------------------
 1650|  1.51M|                okay = false;
 1651|  1.51M|                ch = static_cast<unsigned char>(unknown);
 1652|  1.51M|            }
 1653|  13.4M|            result.append(1, static_cast<char>(ch));
 1654|  13.4M|        }
 1655|  44.2M|    }
 1656|  3.41k|    return okay;
 1657|  3.41k|}
QUtil.cc:_ZL13encode_pdfdocm:
 1501|  13.4M|{
 1502|  13.4M|    auto i = unicode_to_pdf_doc.find(codepoint);
 1503|  13.4M|    if (i != unicode_to_pdf_doc.end()) {
  ------------------
  |  Branch (1503:9): [True: 11.9M, False: 1.51M]
  ------------------
 1504|  11.9M|        return i->second;
 1505|  11.9M|    }
 1506|  1.51M|    return '\0';
 1507|  13.4M|}

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

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

_ZN17SF_FlateLzwDecode14setDecodeParmsE16QPDFObjectHandle:
   13|  9.00k|{
   14|  9.00k|    if (decode_parms.null()) {
  ------------------
  |  Branch (14:9): [True: 4.11k, False: 4.88k]
  ------------------
   15|  4.11k|        return true;
   16|  4.11k|    }
   17|       |
   18|  4.88k|    auto memory_limit = Pl_Flate::memory_limit();
   19|       |
   20|  4.88k|    std::set<std::string> keys = decode_parms.getKeys();
   21|  11.2k|    for (auto const& key: keys) {
  ------------------
  |  Branch (21:25): [True: 11.2k, False: 4.76k]
  ------------------
   22|  11.2k|        QPDFObjectHandle value = decode_parms.getKey(key);
   23|  11.2k|        if (key == "/Predictor") {
  ------------------
  |  Branch (23:13): [True: 2.83k, False: 8.45k]
  ------------------
   24|  2.83k|            if (value.isInteger()) {
  ------------------
  |  Branch (24:17): [True: 2.83k, False: 4]
  ------------------
   25|  2.83k|                predictor = value.getIntValueAsInt();
   26|  2.83k|                if (!(predictor == 1 || predictor == 2 || (predictor >= 10 && predictor <= 15))) {
  ------------------
  |  Branch (26:23): [True: 81, False: 2.75k]
  |  Branch (26:41): [True: 800, False: 1.95k]
  |  Branch (26:60): [True: 1.91k, False: 38]
  |  Branch (26:79): [True: 1.89k, False: 20]
  ------------------
   27|     58|                    return false;
   28|     58|                }
   29|  2.83k|            } else {
   30|      4|                return false;
   31|      4|            }
   32|  8.45k|        } else if (key == "/Columns" || key == "/Colors" || key == "/BitsPerComponent") {
  ------------------
  |  Branch (32:20): [True: 1.71k, False: 6.74k]
  |  Branch (32:41): [True: 555, False: 6.18k]
  |  Branch (32:61): [True: 449, False: 5.73k]
  ------------------
   33|  2.71k|            if (value.isInteger()) {
  ------------------
  |  Branch (33:17): [True: 2.71k, False: 3]
  ------------------
   34|  2.71k|                int val = value.getIntValueAsInt();
   35|  2.71k|                if (memory_limit && static_cast<unsigned int>(val) > memory_limit) {
  ------------------
  |  Branch (35:21): [True: 2.71k, False: 1]
  |  Branch (35:37): [True: 15, False: 2.69k]
  ------------------
   36|     15|                    QPDFLogger::defaultLogger()->warn(
   37|     15|                        "SF_FlateLzwDecode parameter exceeds PL_Flate memory limit\n");
   38|     15|                    return false;
   39|     15|                }
   40|  2.69k|                if (key == "/Columns") {
  ------------------
  |  Branch (40:21): [True: 1.70k, False: 996]
  ------------------
   41|  1.70k|                    columns = val;
   42|  1.70k|                } else if (key == "/Colors") {
  ------------------
  |  Branch (42:28): [True: 551, False: 445]
  ------------------
   43|    551|                    colors = val;
   44|    551|                } else if (key == "/BitsPerComponent") {
  ------------------
  |  Branch (44:28): [True: 444, False: 1]
  ------------------
   45|    444|                    bits_per_component = val;
   46|    444|                }
   47|  2.69k|            } else {
   48|      3|                return false;
   49|      3|            }
   50|  5.73k|        } else if (lzw && (key == "/EarlyChange")) {
  ------------------
  |  Branch (50:20): [True: 5.17k, False: 564]
  |  Branch (50:27): [True: 181, False: 4.99k]
  ------------------
   51|    181|            if (value.isInteger()) {
  ------------------
  |  Branch (51:17): [True: 178, False: 3]
  ------------------
   52|    178|                int earlychange = value.getIntValueAsInt();
   53|    178|                early_code_change = (earlychange == 1);
   54|    178|                if (!(earlychange == 0 || earlychange == 1)) {
  ------------------
  |  Branch (54:23): [True: 66, False: 112]
  |  Branch (54:43): [True: 78, False: 34]
  ------------------
   55|     34|                    return false;
   56|     34|                }
   57|    178|            } else {
   58|      3|                return false;
   59|      3|            }
   60|    181|        }
   61|  11.2k|    }
   62|       |
   63|  4.76k|    if (predictor > 1 && columns == 0) {
  ------------------
  |  Branch (63:9): [True: 2.69k, False: 2.07k]
  |  Branch (63:26): [True: 3, False: 2.69k]
  ------------------
   64|      3|        return false;
   65|      3|    }
   66|       |
   67|  4.76k|    return true;
   68|  4.76k|}
_ZN17SF_FlateLzwDecode17getDecodePipelineEP8Pipeline:
   72|  8.81k|{
   73|  8.81k|    std::unique_ptr<Pipeline> pipeline;
   74|  8.81k|    if (predictor >= 10 && predictor <= 15) {
  ------------------
  |  Branch (74:9): [True: 1.87k, False: 6.94k]
  |  Branch (74:28): [True: 1.87k, False: 0]
  ------------------
   75|  1.87k|        QTC::TC("qpdf", "SF_FlateLzwDecode PNG filter");
   76|  1.87k|        pipeline = std::make_unique<Pl_PNGFilter>(
   77|  1.87k|            "png decode",
   78|  1.87k|            next,
   79|  1.87k|            Pl_PNGFilter::a_decode,
   80|  1.87k|            QIntC::to_uint(columns),
   81|  1.87k|            QIntC::to_uint(colors),
   82|  1.87k|            QIntC::to_uint(bits_per_component));
   83|  1.87k|        next = pipeline.get();
   84|  1.87k|        pipelines.push_back(std::move(pipeline));
   85|  6.94k|    } else if (predictor == 2) {
  ------------------
  |  Branch (85:16): [True: 763, False: 6.17k]
  ------------------
   86|    763|        QTC::TC("qpdf", "SF_FlateLzwDecode TIFF predictor");
   87|    763|        pipeline = std::make_unique<Pl_TIFFPredictor>(
   88|    763|            "tiff decode",
   89|    763|            next,
   90|    763|            Pl_TIFFPredictor::a_decode,
   91|    763|            QIntC::to_uint(columns),
   92|    763|            QIntC::to_uint(colors),
   93|    763|            QIntC::to_uint(bits_per_component));
   94|    763|        next = pipeline.get();
   95|    763|        pipelines.push_back(std::move(pipeline));
   96|    763|    }
   97|       |
   98|  8.81k|    if (lzw) {
  ------------------
  |  Branch (98:9): [True: 3.53k, False: 5.27k]
  ------------------
   99|  3.53k|        pipeline = std::make_unique<Pl_LZWDecoder>("lzw decode", next, early_code_change);
  100|  5.27k|    } else {
  101|  5.27k|        pipeline = std::make_unique<Pl_Flate>("stream inflate", next, Pl_Flate::a_inflate);
  102|  5.27k|    }
  103|  8.81k|    next = pipeline.get();
  104|  8.81k|    pipelines.push_back(std::move(pipeline));
  105|  8.81k|    return next;
  106|  8.81k|}

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

_ZN24SecureRandomDataProvider17provideRandomDataEPhm:
   81|    330|{
   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|    330|    static std::unique_ptr<QUtil::FileCloser> random_device = []() {
   93|    330|        FILE* f = fopen("/dev/urandom", "rb");
   94|    330|        if (f == nullptr) {
   95|    330|            f = fopen("/dev/arandom", "rb");
   96|    330|        }
   97|    330|        if (f == nullptr) {
   98|    330|            f = fopen("/dev/random", "rb");
   99|    330|        }
  100|    330|        if (f == nullptr) {
  101|    330|            throw std::runtime_error("unable to find device in /dev for generating random numbers");
  102|    330|        }
  103|    330|        return std::make_unique<QUtil::FileCloser>(f);
  104|    330|    }();
  105|       |
  106|    330|    size_t fr = fread(data, 1, len, random_device->f);
  107|    330|    if (fr != len) {
  ------------------
  |  Branch (107:9): [True: 0, False: 330]
  ------------------
  108|      0|        throw std::runtime_error(
  109|      0|            "unable to read " + std::to_string(len) + " bytes from random number device");
  110|      0|    }
  111|       |
  112|    330|# endif
  113|    330|}
_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|  18.5k|{
   14|  18.5k|    if (value) {
  ------------------
  |  Branch (14:9): [True: 18.5k, False: 0]
  ------------------
   15|  18.5k|        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|  18.5k|        Limits::dct_max_memory(10'000'000);
   21|  18.5k|        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|  18.5k|        dct_throw_on_corrupt_data(true);
   25|  18.5k|        Limits::png_max_memory(1'000'000);
   26|  18.5k|        Limits::flate_max_memory(200'000);
   27|  18.5k|        Limits::run_length_max_memory(1'000'000);
   28|  18.5k|        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|  18.5k|        Limits::doc_max_warnings(200);
   32|  18.5k|    }
   33|  18.5k|}
qpdf_global_set_uint32:
  129|  18.5k|{
  130|  18.5k|    switch (param) {
  131|      0|    case qpdf_p_inspection_mode:
  ------------------
  |  Branch (131:5): [True: 0, False: 18.5k]
  ------------------
  132|      0|        Options::inspection_mode(value);
  133|      0|        return qpdf_r_ok;
  134|  18.5k|    case qpdf_p_fuzz_mode:
  ------------------
  |  Branch (134:5): [True: 18.5k, False: 0]
  ------------------
  135|  18.5k|        Options::fuzz_mode(value);
  136|  18.5k|        return qpdf_r_ok;
  137|      0|    case qpdf_p_default_limits:
  ------------------
  |  Branch (137:5): [True: 0, False: 18.5k]
  ------------------
  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: 18.5k]
  ------------------
  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: 18.5k]
  ------------------
  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: 18.5k]
  ------------------
  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: 18.5k]
  ------------------
  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: 18.5k]
  ------------------
  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: 18.5k]
  ------------------
  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: 18.5k]
  ------------------
  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: 18.5k]
  ------------------
  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: 18.5k]
  ------------------
  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: 18.5k]
  ------------------
  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: 18.5k]
  ------------------
  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: 18.5k]
  ------------------
  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: 18.5k]
  ------------------
  177|      0|        Limits::tiff_max_memory(value);
  178|      0|        return qpdf_r_ok;
  179|      0|    default:
  ------------------
  |  Branch (179:5): [True: 0, False: 18.5k]
  ------------------
  180|      0|        return qpdf_r_bad_parameter;
  181|  18.5k|    }
  182|  18.5k|}

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

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

_ZNK4qpdf2is12OffsetBuffer7getNameEv:
   48|   847k|        {
   49|   847k|            return description;
   50|   847k|        }
_ZN4qpdf2is12OffsetBuffer4tellEv:
   54|  23.3M|        {
   55|  23.3M|            return pos + global_offset;
   56|  23.3M|        }
_ZN4qpdf2is12OffsetBuffer8unreadChEc:
   70|  20.2k|        {
   71|  20.2k|            if (pos > 0) {
  ------------------
  |  Branch (71:17): [True: 20.2k, False: 0]
  ------------------
   72|  20.2k|                --pos;
   73|  20.2k|            }
   74|  20.2k|        }
_ZN4qpdf2is12OffsetBufferD2Ev:
   42|  42.6k|        ~OffsetBuffer() final = default;
_ZN4qpdf2is12OffsetBufferC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_17basic_string_viewIcS5_EEx:
   21|  42.6k|            description(description),
   22|  42.6k|            view_(view),
   23|  42.6k|            global_offset(global_offset)
   24|  42.6k|        {
   25|  42.6k|            if (global_offset < 0) {
  ------------------
  |  Branch (25:17): [True: 37, False: 42.6k]
  ------------------
   26|     37|                throw std::logic_error("is::OffsetBuffer constructed with negative offset");
   27|     37|            }
   28|  42.6k|            last_offset = global_offset;
   29|  42.6k|        }
_ZN11InputSource4readERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   87|  19.9k|{
   88|  19.9k|    if (at >= 0) {
  ------------------
  |  Branch (88:9): [True: 9.81k, False: 10.1k]
  ------------------
   89|       |        seek(at, SEEK_SET);
   90|  9.81k|    }
   91|  19.9k|    str.resize(count);
   92|  19.9k|    str.resize(read(str.data(), count));
   93|  19.9k|    return str.size();
   94|  19.9k|}
_ZN11InputSource4readEmx:
   98|  9.81k|{
   99|  9.81k|    std::string result(count, '\0');
  100|  9.81k|    (void)read(result, count, at);
  101|  9.81k|    return result;
  102|  9.81k|}
_ZN11InputSource10loadBufferEv:
  106|  2.50M|{
  107|  2.50M|    buf_idx = 0;
  108|  2.50M|    buf_len = qpdf_offset_t(read(buffer, buf_size));
  109|       |    // NB read sets last_offset
  110|  2.50M|    buf_start = last_offset;
  111|  2.50M|}
_ZN11InputSource8fastTellEv:
  115|  19.4M|{
  116|  19.4M|    if (buf_len == 0) {
  ------------------
  |  Branch (116:9): [True: 69.0k, False: 19.4M]
  ------------------
  117|  69.0k|        loadBuffer();
  118|  19.4M|    } else {
  119|  19.4M|        auto curr = tell();
  120|  19.4M|        if (curr < buf_start || curr >= (buf_start + buf_len)) {
  ------------------
  |  Branch (120:13): [True: 47.3k, False: 19.3M]
  |  Branch (120:33): [True: 2.38M, False: 16.9M]
  ------------------
  121|  2.43M|            loadBuffer();
  122|  16.9M|        } else {
  123|  16.9M|            last_offset = curr;
  124|  16.9M|            buf_idx = curr - buf_start;
  125|  16.9M|        }
  126|  19.4M|    }
  127|  19.4M|    return last_offset;
  128|  19.4M|}
_ZN11InputSource8fastReadERc:
  132|   302M|{
  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|   302M|    if (buf_idx < buf_len) {
  ------------------
  |  Branch (135:9): [True: 299M, False: 2.20M]
  ------------------
  136|   299M|        ch = buffer[buf_idx];
  137|   299M|        ++(buf_idx);
  138|   299M|        ++(last_offset);
  139|   299M|        return true;
  140|       |
  141|   299M|    } else if (buf_len == 0) {
  ------------------
  |  Branch (141:16): [True: 34.5k, False: 2.17M]
  ------------------
  142|  34.5k|        return false;
  143|  2.17M|    } else {
  144|       |        seek(buf_start + buf_len, SEEK_SET);
  145|  2.17M|        fastTell();
  146|  2.17M|        return fastRead(ch);
  147|  2.17M|    }
  148|   302M|}
_ZN11InputSource10fastUnreadEb:
  152|  17.3M|{
  153|  17.3M|    last_offset -= back ? 1 : 0;
  ------------------
  |  Branch (153:20): [True: 16.3M, False: 1.00M]
  ------------------
  154|       |    seek(last_offset, SEEK_SET);
  155|  17.3M|}

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

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

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

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

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

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

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

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

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

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

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

_ZNK4qpdf10BaseHandle13raw_type_codeEv:
  934|  15.8M|    {
  935|  15.8M|        return obj ? static_cast<qpdf_object_type_e>(obj->value.index()) : ::ot_uninitialized;
  ------------------
  |  Branch (935:16): [True: 15.8M, False: 0]
  ------------------
  936|  15.8M|    }
_ZNK4qpdf10BaseHandle4qpdfEv:
  928|   270k|    {
  929|   270k|        return obj ? obj->qpdf : nullptr;
  ------------------
  |  Branch (929:16): [True: 270k, False: 0]
  ------------------
  930|   270k|    }
_ZNK4qpdf10BaseHandle6offsetEv:
  922|  25.6k|    {
  923|  25.6k|        return obj ? obj->parsed_offset : -1;
  ------------------
  |  Branch (923:16): [True: 25.6k, False: 0]
  ------------------
  924|  25.6k|    }
_ZNK4qpdf10BaseHandle9type_codeEv:
  952|  2.51M|    {
  953|  2.51M|        if (!obj) {
  ------------------
  |  Branch (953:13): [True: 67.0k, False: 2.44M]
  ------------------
  954|  67.0k|            return ::ot_uninitialized;
  955|  67.0k|        }
  956|  2.44M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (956:13): [True: 116k, False: 2.32M]
  ------------------
  957|   116k|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  958|   116k|        }
  959|  2.32M|        if (raw_type_code() == ::ot_reference) {
  ------------------
  |  Branch (959:13): [True: 0, False: 2.32M]
  ------------------
  960|      0|            return std::get<QPDF_Reference>(obj->value).obj->getTypeCode();
  961|      0|        }
  962|  2.32M|        return raw_type_code();
  963|  2.32M|    }
_ZNK4qpdf10BaseHandle8indirectEv:
  861|  3.28M|    {
  862|  3.28M|        return obj ? obj->og.isIndirect() : false;
  ------------------
  |  Branch (862:16): [True: 3.28M, False: 529]
  ------------------
  863|  3.28M|    }
_ZNK4qpdf10BaseHandle4nullEv:
  908|   213k|    {
  909|   213k|        return !obj || type_code() == ::ot_null;
  ------------------
  |  Branch (909:16): [True: 44.2k, False: 169k]
  |  Branch (909:24): [True: 48.6k, False: 120k]
  ------------------
  910|   213k|    }
_ZN4qpdf5ArrayC2ERK16QPDFObjectHandle:
   57|   410k|            BaseHandle(oh.resolved_type_code() == ::ot_array ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (57:24): [True: 357k, False: 52.9k]
  ------------------
   58|   410k|        {
   59|   410k|        }
_ZNK4qpdf10BaseHandle18resolved_type_codeEv:
  940|  1.22M|    {
  941|  1.22M|        if (!obj) {
  ------------------
  |  Branch (941:13): [True: 46.3k, False: 1.17M]
  ------------------
  942|  46.3k|            return ::ot_uninitialized;
  943|  46.3k|        }
  944|  1.17M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (944:13): [True: 483, False: 1.17M]
  ------------------
  945|    483|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  946|    483|        }
  947|  1.17M|        return raw_type_code();
  948|  1.17M|    }
_ZN4qpdf10BaseHandleC2ERK16QPDFObjectHandle:
  789|  1.22M|        obj(oh.obj)
  790|  1.22M|    {
  791|  1.22M|    }
_ZN4qpdf10DictionaryC2ERK16QPDFObjectHandle:
  268|   140k|            BaseDictionary(oh)
  269|   140k|        {
  270|   140k|        }
_ZN4qpdf14BaseDictionaryC2ERK16QPDFObjectHandle:
  238|   140k|            BaseHandle(oh.resolved_type_code() == ::ot_dictionary ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (238:24): [True: 133k, False: 6.62k]
  ------------------
  239|   140k|        {
  240|   140k|        }
_ZN4qpdf14BaseDictionary5beginEv:
  141|  1.79k|        {
  142|  1.79k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (142:22): [True: 1.45k, False: 347]
  ------------------
  143|  1.45k|                return d->items.begin();
  144|  1.45k|            }
  145|    347|            return {};
  146|  1.79k|        }
_ZNK4qpdf10BaseHandle2asI15QPDF_DictionaryEEPT_v:
  771|   912k|    {
  772|   912k|        if (!obj) {
  ------------------
  |  Branch (772:13): [True: 4.60k, False: 907k]
  ------------------
  773|  4.60k|            return nullptr;
  774|  4.60k|        }
  775|   907k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (775:13): [True: 901k, False: 6.35k]
  ------------------
  776|   901k|            return &std::get<T>(obj->value);
  777|   901k|        }
  778|  6.35k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (778:13): [True: 321, False: 6.03k]
  ------------------
  779|    321|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  780|    321|        }
  781|  6.03k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (781:13): [True: 0, False: 6.03k]
  ------------------
  782|       |            // see comment in QPDF_Reference.
  783|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  784|      0|        }
  785|  6.03k|        return nullptr;
  786|  6.03k|    }
_ZN4qpdf14BaseDictionary3endEv:
  150|  1.79k|        {
  151|  1.79k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (151:22): [True: 1.45k, False: 346]
  ------------------
  152|  1.45k|                return d->items.end();
  153|  1.45k|            }
  154|    346|            return {};
  155|  1.79k|        }
_ZNK4qpdf10BaseHandle6id_genEv:
  855|  11.4k|    {
  856|  11.4k|        return obj ? obj->og : QPDFObjGen();
  ------------------
  |  Branch (856:16): [True: 11.4k, False: 0]
  ------------------
  857|  11.4k|    }
_ZNK4qpdf6Stream7getDictEv:
  555|  48.3k|        {
  556|  48.3k|            return {stream()->stream_dict};
  557|  48.3k|        }
_ZNK4qpdf6Stream6streamEv:
  698|   103k|        {
  699|   103k|            if (auto s = as<QPDF_Stream>()) {
  ------------------
  |  Branch (699:22): [True: 103k, False: 0]
  ------------------
  700|   103k|                if (auto ptr = s->m.get()) {
  ------------------
  |  Branch (700:26): [True: 103k, False: 2]
  ------------------
  701|   103k|                    return ptr;
  702|   103k|                }
  703|      2|                throw std::logic_error("QPDF_Stream: unexpected nullptr");
  704|   103k|            }
  705|      0|            throw std::runtime_error("operation for stream attempted on non-stream object");
  706|      0|            return nullptr; // unreachable
  707|   103k|        }
_ZNK4qpdf10BaseHandle2asI11QPDF_StreamEEPT_v:
  771|   103k|    {
  772|   103k|        if (!obj) {
  ------------------
  |  Branch (772:13): [True: 0, False: 103k]
  ------------------
  773|      0|            return nullptr;
  774|      0|        }
  775|   103k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (775:13): [True: 103k, False: 0]
  ------------------
  776|   103k|            return &std::get<T>(obj->value);
  777|   103k|        }
  778|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (778:13): [True: 0, False: 0]
  ------------------
  779|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  780|      0|        }
  781|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (781:13): [True: 0, False: 0]
  ------------------
  782|       |            // see comment in QPDF_Reference.
  783|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  784|      0|        }
  785|      0|        return nullptr;
  786|      0|    }
_ZN4qpdf7IntegerC2ERK16QPDFObjectHandle:
  319|   565k|            BaseHandle(oh.type_code() == ::ot_integer ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (319:24): [True: 101k, False: 464k]
  ------------------
  320|   565k|        {
  321|   565k|        }
_ZNK4qpdf7IntegercvbEv:
  330|   263k|        {
  331|   263k|            return obj != nullptr;
  332|   263k|        }
_ZN4qpdfeqERKNS_4NameENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  474|  95.8k|        {
  475|  95.8k|            return lhs && lhs.value() == rhs;
  ------------------
  |  Branch (475:20): [True: 59.1k, False: 36.7k]
  |  Branch (475:27): [True: 32.5k, False: 26.6k]
  ------------------
  476|  95.8k|        }
_ZN4qpdf4NameC2ERK16QPDFObjectHandle:
  450|   106k|            BaseHandle(oh.type_code() == ::ot_name ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (450:24): [True: 66.4k, False: 39.8k]
  ------------------
  451|   106k|        {
  452|   106k|        }
_ZNK4qpdf10BaseHandle2ohEv:
  806|  11.6k|    {
  807|  11.6k|        return {obj};
  808|  11.6k|    }
_ZN10QPDFObject6createI9QPDF_NullJEEENSt3__110shared_ptrIS_EEDpOT0_:
  989|   321k|{
  990|   321k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|   321k|}
_ZNK4qpdf7Integer5valueITkNSt3__18integralEiEET_v:
  361|  46.1k|        {
  362|  46.1k|            try {
  363|  46.1k|                return static_cast<T>(*this);
  364|  46.1k|            } catch (std::underflow_error&) {
  365|     68|                if constexpr (std::is_same_v<T, int>) {
  366|     68|                    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|     68|                return std::numeric_limits<T>::min();
  377|     68|            } catch (std::overflow_error&) {
  378|     32|                if constexpr (std::is_same_v<T, int>) {
  379|     32|                    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|     32|                return std::numeric_limits<T>::max();
  388|     32|            }
  389|  46.1k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEiEEv:
  339|  46.1k|        {
  340|  46.1k|            auto v = value();
  341|       |
  342|  46.1k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 32, False: 46.0k]
  ------------------
  343|     32|                throw std::overflow_error("Integer conversion overflow");
  344|     32|            }
  345|  46.0k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 68, False: 46.0k]
  ------------------
  346|     68|                throw std::underflow_error("Integer conversion underflow");
  347|     68|            }
  348|  46.0k|            return static_cast<T>(v);
  349|  46.0k|        }
_ZN4qpdf5ArrayaSERKS0_:
   36|  18.0k|        {
   37|  18.0k|            if (obj != other.obj) {
  ------------------
  |  Branch (37:17): [True: 18.0k, False: 0]
  ------------------
   38|  18.0k|                obj = other.obj;
   39|  18.0k|            }
   40|  18.0k|            return *this;
   41|  18.0k|        }
_ZN4qpdf5ArrayC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
   47|  19.0k|            BaseHandle(obj)
   48|  19.0k|        {
   49|  19.0k|        }
_ZN4qpdf5ArrayC2EONSt3__110shared_ptrI10QPDFObjectEE:
   52|  6.20k|            BaseHandle(std::move(obj))
   53|  6.20k|        {
   54|  6.20k|        }
_ZN4qpdf5ArrayaSERK16QPDFObjectHandle:
   63|  50.9k|        {
   64|  50.9k|            assign(::ot_array, oh);
   65|  50.9k|            return *this;
   66|  50.9k|        }
_ZN4qpdf5ArrayC2EO16QPDFObjectHandle:
   69|     15|            BaseHandle(oh.resolved_type_code() == ::ot_array ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (69:24): [True: 0, False: 15]
  ------------------
   70|     15|        {
   71|     15|        }
_ZN4qpdf14BaseDictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  220|  1.63k|            BaseHandle(QPDFObject::create<QPDF_Dictionary>(std::move(dict)))
  221|  1.63k|        {
  222|  1.63k|        }
_ZN4qpdf14BaseDictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  225|  44.1k|            BaseHandle(obj)
  226|  44.1k|        {
  227|  44.1k|        }
_ZN4qpdf14BaseDictionaryC2EO16QPDFObjectHandle:
  243|  1.68k|            BaseHandle(
  244|  1.68k|                oh.resolved_type_code() == ::ot_dictionary ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (244:17): [True: 1.26k, False: 419]
  ------------------
  245|  1.68k|        {
  246|  1.68k|        }
_ZN4qpdf10DictionaryaSERK16QPDFObjectHandle:
  274|  48.6k|        {
  275|  48.6k|            assign(::ot_dictionary, oh);
  276|  48.6k|            return *this;
  277|  48.6k|        }
_ZN4qpdf10DictionaryC2EO16QPDFObjectHandle:
  280|  1.68k|            BaseDictionary(std::move(oh))
  281|  1.68k|        {
  282|  1.68k|        }
_ZN4qpdf10DictionaryaSEO16QPDFObjectHandle:
  286|     22|        {
  287|     22|            assign(::ot_dictionary, std::move(oh));
  288|     22|            return *this;
  289|     22|        }
_ZNKR4qpdf4NamecvNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEv:
  462|  9.10k|        {
  463|  9.10k|            return value();
  464|  9.10k|        }
_ZN4qpdf4NullC2Ev:
  484|      2|            BaseHandle(QPDFObject::create<QPDF_Null>())
  485|      2|        {
  486|      2|        }
_ZN4qpdf6StreamC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  516|  52.9k|            BaseHandle(obj)
  517|  52.9k|        {
  518|  52.9k|        }
_ZN4qpdf6StreamC2EONSt3__110shared_ptrI10QPDFObjectEE:
  521|  28.9k|            BaseHandle(std::move(obj))
  522|  28.9k|        {
  523|  28.9k|        }
_ZN4qpdf6StreamC2EO16QPDFObjectHandle:
  538|  39.9k|            BaseHandle(oh.type_code() == ::ot_stream ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (538:24): [True: 2.97k, False: 37.0k]
  ------------------
  539|  39.9k|        {
  540|  39.9k|        }
_ZNK4qpdf6Stream4TypeEv:
  602|  23.5k|        {
  603|  23.5k|            return {getDict()["/Type"]};
  604|  23.5k|        }
_ZN4qpdf6StringC2EO16QPDFObjectHandle:
  738|   742k|            BaseHandle(oh.type_code() == ::ot_string ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (738:24): [True: 742k, False: 0]
  ------------------
  739|   742k|        {
  740|   742k|        }
_ZNK4qpdf10BaseHandle6obj_spEv:
  800|  82.3k|    {
  801|  82.3k|        return obj;
  802|  82.3k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eRKS0_:
  839|  99.6k|    {
  840|  99.6k|        if (obj != other.obj) {
  ------------------
  |  Branch (840:13): [True: 48.1k, False: 51.4k]
  ------------------
  841|  48.1k|            obj = other.resolved_type_code() == required ? other.obj : nullptr;
  ------------------
  |  Branch (841:19): [True: 47.2k, False: 933]
  ------------------
  842|  48.1k|        }
  843|  99.6k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eOS0_:
  847|     22|    {
  848|     22|        if (obj != other.obj) {
  ------------------
  |  Branch (848:13): [True: 0, False: 22]
  ------------------
  849|      0|            obj = other.resolved_type_code() == required ? std::move(other.obj) : nullptr;
  ------------------
  |  Branch (849:19): [True: 0, False: 0]
  ------------------
  850|      0|        }
  851|     22|    }
_ZNK4qpdf10BaseHandle3getERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  902|   238k|    {
  903|   238k|        return (*this)[key];
  904|   238k|    }
_ZN9QPDF_Null6createENSt3__110shared_ptrI10QPDFObjectEERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS6_NS0_9allocatorIcEEEE:
  975|  67.8k|{
  976|  67.8k|    auto n = QPDFObject::create<QPDF_Null>();
  977|  67.8k|    n->setChildDescription(parent->getQPDF(), parent, static_descr, var_descr);
  978|  67.8k|    return n;
  979|  67.8k|}
_ZNK16QPDFObjectHandle8as_arrayEN4qpdf5typedE:
 1007|  24.1k|{
 1008|  24.1k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1008:9): [True: 0, False: 24.1k]
  ------------------
 1009|      0|        assertType("array", false);
 1010|      0|    }
 1011|  24.1k|    if (options & qpdf::any_flag || type_code() == ::ot_array ||
  ------------------
  |  Branch (1011:9): [True: 8.52k, False: 15.6k]
  |  Branch (1011:37): [True: 9.44k, False: 6.20k]
  ------------------
 1012|  17.9k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1012:10): [True: 0, False: 6.20k]
  |  Branch (1012:38): [True: 0, False: 0]
  ------------------
 1013|  17.9k|        return qpdf::Array(obj);
 1014|  17.9k|    }
 1015|  6.20k|    return qpdf::Array(std::shared_ptr<QPDFObject>());
 1016|  24.1k|}
_ZNK16QPDFObjectHandle13as_dictionaryEN4qpdf5typedE:
 1020|  44.1k|{
 1021|  44.1k|    if (options & qpdf::any_flag || type_code() == ::ot_dictionary ||
  ------------------
  |  Branch (1021:9): [True: 969, False: 43.1k]
  |  Branch (1021:37): [True: 39.7k, False: 3.39k]
  ------------------
 1022|  40.7k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1022:10): [True: 0, False: 3.39k]
  |  Branch (1022:38): [True: 0, False: 0]
  ------------------
 1023|  40.7k|        return qpdf::Dictionary(obj);
 1024|  40.7k|    }
 1025|  3.39k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1025:9): [True: 0, False: 3.39k]
  ------------------
 1026|      0|        assertType("dictionary", false);
 1027|      0|    }
 1028|  3.39k|    return qpdf::Dictionary(std::shared_ptr<QPDFObject>());
 1029|  44.1k|}
_ZNK16QPDFObjectHandle9as_streamEN4qpdf5typedE:
 1033|  85.6k|{
 1034|  85.6k|    if (options & qpdf::any_flag || type_code() == ::ot_stream ||
  ------------------
  |  Branch (1034:9): [True: 0, False: 85.6k]
  |  Branch (1034:37): [True: 56.7k, False: 28.9k]
  ------------------
 1035|  52.9k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1035:10): [True: 0, False: 28.9k]
  |  Branch (1035:38): [True: 0, False: 0]
  ------------------
 1036|  52.9k|        return qpdf::Stream(obj);
 1037|  52.9k|    }
 1038|  32.7k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1038:9): [True: 0, False: 32.7k]
  ------------------
 1039|      0|        assertType("stream", false);
 1040|      0|    }
 1041|  32.7k|    return qpdf::Stream(std::shared_ptr<QPDFObject>());
 1042|  85.6k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRKNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  989|  5.37k|{
  990|  5.37k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|  5.37k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  989|   121k|{
  990|   121k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|   121k|}
_ZN4qpdf10BaseHandleC2EO16QPDFObjectHandle:
  794|   783k|        obj(std::move(oh.obj))
  795|   783k|    {
  796|   783k|    }
_ZN4qpdf10DictionaryC2Ev:
  256|  48.3k|        Dictionary() = default;
_ZN4qpdf14BaseDictionaryC2Ev:
  212|  48.3k|        BaseDictionary() = default;
_ZN4qpdf10DictionaryC2ERKS0_:
  262|   127k|        Dictionary(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryC2ERKS0_:
  232|   127k|        BaseDictionary(BaseDictionary const&) = default;
_ZN10QPDFObject6createI9QPDF_BoolJRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  989|    235|{
  990|    235|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|    235|}
_ZN10QPDFObject6createI12QPDF_IntegerJRxEEENSt3__110shared_ptrIS_EEDpOT0_:
  989|  5.34M|{
  990|  5.34M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|  5.34M|}
_ZN10QPDFObject6createI9QPDF_RealJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  989|    541|{
  990|    541|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|    541|}
_ZN10QPDFObject6createI11QPDF_StringJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  989|  18.9k|{
  990|  18.9k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|  18.9k|}
_ZN10QPDFObject6createI9QPDF_NameJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  989|  96.6k|{
  990|  96.6k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|  96.6k|}
_ZN10QPDFObject6createI10QPDF_ArrayJS1_EEENSt3__110shared_ptrIS_EEDpOT0_:
  989|     30|{
  990|     30|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|     30|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEbEEENS2_10shared_ptrIS_EEDpOT0_:
  989|    946|{
  990|    946|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|    946|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  989|    612|{
  990|    612|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|    612|}
_ZNK4qpdf10BaseHandle2asI9QPDF_BoolEEPT_v:
  771|      3|    {
  772|      3|        if (!obj) {
  ------------------
  |  Branch (772:13): [True: 0, False: 3]
  ------------------
  773|      0|            return nullptr;
  774|      0|        }
  775|      3|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (775:13): [True: 3, False: 0]
  ------------------
  776|      3|            return &std::get<T>(obj->value);
  777|      3|        }
  778|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (778:13): [True: 0, False: 0]
  ------------------
  779|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  780|      0|        }
  781|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (781:13): [True: 0, False: 0]
  ------------------
  782|       |            // see comment in QPDF_Reference.
  783|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  784|      0|        }
  785|      0|        return nullptr;
  786|      0|    }
_ZNK4qpdf10BaseHandle2asI12QPDF_IntegerEEPT_v:
  771|   102k|    {
  772|   102k|        if (!obj) {
  ------------------
  |  Branch (772:13): [True: 1.38k, False: 101k]
  ------------------
  773|  1.38k|            return nullptr;
  774|  1.38k|        }
  775|   101k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (775:13): [True: 101k, False: 0]
  ------------------
  776|   101k|            return &std::get<T>(obj->value);
  777|   101k|        }
  778|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (778:13): [True: 0, False: 0]
  ------------------
  779|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  780|      0|        }
  781|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (781:13): [True: 0, False: 0]
  ------------------
  782|       |            // see comment in QPDF_Reference.
  783|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  784|      0|        }
  785|      0|        return nullptr;
  786|      0|    }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralExEEv:
  339|  32.2k|        {
  340|  32.2k|            auto v = value();
  341|       |
  342|  32.2k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 32.2k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  32.2k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 0, False: 32.2k]
  ------------------
  346|      0|                throw std::underflow_error("Integer conversion underflow");
  347|      0|            }
  348|  32.2k|            return static_cast<T>(v);
  349|  32.2k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEyEET_v:
  361|  15.3k|        {
  362|  15.3k|            try {
  363|  15.3k|                return static_cast<T>(*this);
  364|  15.3k|            } 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|    173|                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|    173|                    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|    173|                return std::numeric_limits<T>::min();
  377|    173|            } 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|  15.3k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEyEEv:
  339|  15.3k|        {
  340|  15.3k|            auto v = value();
  341|       |
  342|  15.3k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 15.3k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  15.3k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 173, False: 15.1k]
  ------------------
  346|    173|                throw std::underflow_error("Integer conversion underflow");
  347|    173|            }
  348|  15.1k|            return static_cast<T>(v);
  349|  15.3k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEjEET_v:
  361|  9.13k|        {
  362|  9.13k|            try {
  363|  9.13k|                return static_cast<T>(*this);
  364|  9.13k|            } 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|    122|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|    122|                    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|    122|                return std::numeric_limits<T>::min();
  377|    132|            } 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|    132|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|    132|                    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|    132|                return std::numeric_limits<T>::max();
  388|    132|            }
  389|  9.13k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEjEEv:
  339|  9.13k|        {
  340|  9.13k|            auto v = value();
  341|       |
  342|  9.13k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 132, False: 9.00k]
  ------------------
  343|    132|                throw std::overflow_error("Integer conversion overflow");
  344|    132|            }
  345|  9.00k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 122, False: 8.88k]
  ------------------
  346|    122|                throw std::underflow_error("Integer conversion underflow");
  347|    122|            }
  348|  8.88k|            return static_cast<T>(v);
  349|  9.00k|        }
_ZN10QPDFObject6createI9QPDF_NameJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  989|  7.71M|{
  990|  7.71M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|  7.71M|}
_ZN10QPDFObject6createI9QPDF_NameJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  989|  11.4k|{
  990|  11.4k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|  11.4k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_NameEEPT_v:
  771|  74.0k|    {
  772|  74.0k|        if (!obj) {
  ------------------
  |  Branch (772:13): [True: 0, False: 74.0k]
  ------------------
  773|      0|            return nullptr;
  774|      0|        }
  775|  74.0k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (775:13): [True: 74.0k, False: 0]
  ------------------
  776|  74.0k|            return &std::get<T>(obj->value);
  777|  74.0k|        }
  778|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (778:13): [True: 0, False: 0]
  ------------------
  779|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  780|      0|        }
  781|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (781:13): [True: 0, False: 0]
  ------------------
  782|       |            // see comment in QPDF_Reference.
  783|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  784|      0|        }
  785|      0|        return nullptr;
  786|      0|    }
_ZN10QPDFObject6createI11QPDF_StringJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  989|   139k|{
  990|   139k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|   139k|}
_ZN10QPDFObject6createI11QPDF_StringJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  989|    636|{
  990|    636|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|    636|}
_ZNK4qpdf10BaseHandle2asI11QPDF_StringEEPT_v:
  771|   742k|    {
  772|   742k|        if (!obj) {
  ------------------
  |  Branch (772:13): [True: 0, False: 742k]
  ------------------
  773|      0|            return nullptr;
  774|      0|        }
  775|   742k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (775:13): [True: 742k, False: 0]
  ------------------
  776|   742k|            return &std::get<T>(obj->value);
  777|   742k|        }
  778|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (778:13): [True: 0, False: 0]
  ------------------
  779|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  780|      0|        }
  781|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (781:13): [True: 0, False: 0]
  ------------------
  782|       |            // see comment in QPDF_Reference.
  783|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  784|      0|        }
  785|      0|        return nullptr;
  786|      0|    }
_ZN10QPDFObject6createI9QPDF_RealJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  989|  58.6k|{
  990|  58.6k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|  58.6k|}
_ZN10QPDFObject6createI9QPDF_RealJRdRiRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  989|  16.4k|{
  990|  16.4k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|  16.4k|}
_ZN9QPDF_RealC2Edib:
  982|  16.4k|    val(QUtil::double_to_string(value, decimal_places, trim_trailing_zeroes))
  983|  16.4k|{
  984|  16.4k|}
_ZN10QPDFObject6createI10QPDF_ArrayJRKNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  989|  6.73k|{
  990|  6.73k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|  6.73k|}
_ZN15QPDF_DictionaryC2EONSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
  968|   121k|    items(std::move(items))
  969|   121k|{
  970|   121k|}
_ZN10QPDFObject6createI9QPDF_BoolJbEEENSt3__110shared_ptrIS_EEDpOT0_:
  989|  8.74k|{
  990|  8.74k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|  8.74k|}
_ZN10QPDFObject6createI12QPDF_IntegerJxEEENSt3__110shared_ptrIS_EEDpOT0_:
  989|  8.51k|{
  990|  8.51k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|  8.51k|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  989|  71.0k|{
  990|  71.0k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  991|  71.0k|}
_ZNK4qpdf10BaseHandle2asI10QPDF_ArrayEEPT_v:
  771|  1.22M|    {
  772|  1.22M|        if (!obj) {
  ------------------
  |  Branch (772:13): [True: 77.3k, False: 1.14M]
  ------------------
  773|  77.3k|            return nullptr;
  774|  77.3k|        }
  775|  1.14M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (775:13): [True: 1.14M, False: 5.91k]
  ------------------
  776|  1.14M|            return &std::get<T>(obj->value);
  777|  1.14M|        }
  778|  5.91k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (778:13): [True: 0, False: 5.91k]
  ------------------
  779|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  780|      0|        }
  781|  5.91k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (781:13): [True: 0, False: 5.91k]
  ------------------
  782|       |            // see comment in QPDF_Reference.
  783|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  784|      0|        }
  785|  5.91k|        return nullptr;
  786|  5.91k|    }
_ZN4qpdf7IntegerC2ITkNSt3__18integralEmEET_:
  307|  1.64k|            Integer(static_cast<long long>(value))
  308|  1.64k|        {
  309|       |            if constexpr (std::cmp_greater(
  310|       |                              std::numeric_limits<decltype(value)>::max(),
  311|  1.64k|                              std::numeric_limits<long long>::max())) {
  312|  1.64k|                if (std::cmp_greater(value, std::numeric_limits<long long>::max())) {
  ------------------
  |  Branch (312:21): [True: 0, False: 1.64k]
  ------------------
  313|      0|                    throw std::overflow_error("overflow constructing Integer");
  314|      0|                }
  315|  1.64k|            }
  316|  1.64k|        }
_ZN4qpdf10DictionaryC2EOS0_:
  264|  2.20k|        Dictionary(Dictionary&&) = default;
_ZN4qpdf14BaseDictionaryC2EOS0_:
  234|  2.20k|        BaseDictionary(BaseDictionary&&) = default;
_ZN4qpdf10DictionaryaSERKS0_:
  263|  9.27k|        Dictionary& operator=(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryaSERKS0_:
  233|  9.27k|        BaseDictionary& operator=(BaseDictionary const&) = default;
_ZN4qpdf5ArrayC2Ev:
   21|  18.0k|        Array() = default;

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

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

_ZNK4qpdf9Tokenizer7getTypeEv:
   64|  16.1M|        {
   65|  16.1M|            return this->type;
   66|  16.1M|        }
_ZNK4qpdf9Tokenizer8getValueEv:
   69|  14.9M|        {
   70|  14.9M|            return (this->type == QPDFTokenizer::tt_name || this->type == QPDFTokenizer::tt_string)
  ------------------
  |  Branch (70:21): [True: 8.24M, False: 6.67M]
  |  Branch (70:61): [True: 139k, False: 6.53M]
  ------------------
   71|  14.9M|                ? this->val
   72|  14.9M|                : this->raw_val;
   73|  14.9M|        }
_ZNK4qpdf9Tokenizer15getErrorMessageEv:
   81|  36.1k|        {
   82|  36.1k|            return this->error_message;
   83|  36.1k|        }

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

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

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

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

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

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

_ZN4qpdf4util17internal_error_ifIRA28_KcEEvbOT_:
   38|  4.06M|    {
   39|  4.06M|        if (cond) {
  ------------------
  |  Branch (39:13): [True: 0, False: 4.06M]
  ------------------
   40|      0|            throw std::logic_error("INTERNAL ERROR: "s.append(std::forward<T>(msg))
   41|      0|                                       .append(
   42|      0|                                           "\nThis is a qpdf bug. Please report at "
   43|      0|                                           "https://github.com/qpdf/qpdf/issues"));
   44|      0|        }
   45|  4.06M|    }
_ZN4qpdf4util9assertionIRA44_KcEEvbOT_:
   29|  63.6k|    {
   30|  63.6k|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 63.6k]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|  63.6k|    }
_ZN4qpdf4util15hex_decode_charEc:
  101|   229k|    {
  102|   229k|        return digit <= '9' && digit >= '0'
  ------------------
  |  Branch (102:16): [True: 153k, False: 75.7k]
  |  Branch (102:32): [True: 114k, False: 39.4k]
  ------------------
  103|   229k|            ? char(digit - '0')
  104|   229k|            : (digit >= 'a' ? char(digit - 'a' + 10)
  ------------------
  |  Branch (104:16): [True: 24.1k, False: 91.0k]
  ------------------
  105|   115k|                            : (digit >= 'A' ? char(digit - 'A' + 10) : '\20'));
  ------------------
  |  Branch (105:32): [True: 36.6k, False: 54.3k]
  ------------------
  106|   229k|    }
_ZN4qpdf4util8is_spaceEc:
  116|  26.1M|    {
  117|  26.1M|        return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || ch == '\v';
  ------------------
  |  Branch (117:16): [True: 7.84M, False: 18.2M]
  |  Branch (117:29): [True: 504k, False: 17.7M]
  |  Branch (117:43): [True: 168k, False: 17.5M]
  |  Branch (117:57): [True: 94.8k, False: 17.4M]
  |  Branch (117:71): [True: 65.4k, False: 17.4M]
  |  Branch (117:85): [True: 22.1k, False: 17.4M]
  ------------------
  118|  26.1M|    }
_ZN4qpdf4util8is_digitEc:
  122|  20.1M|    {
  123|  20.1M|        return (ch >= '0' && ch <= '9');
  ------------------
  |  Branch (123:17): [True: 13.4M, False: 6.76M]
  |  Branch (123:30): [True: 13.3M, False: 81.5k]
  ------------------
  124|  20.1M|    }
_ZN4qpdf4util8is_utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  151|   787k|    {
  152|   787k|        return str.starts_with("\xfe\xff") || str.starts_with("\xff\xfe");
  ------------------
  |  Branch (152:16): [True: 27.3k, False: 760k]
  |  Branch (152:47): [True: 69.8k, False: 690k]
  ------------------
  153|   787k|    }
_ZN4qpdf4util16is_explicit_utf8ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  157|   690k|    {
  158|       |        // QPDF_String.cc knows that this is a 3-byte sequence.
  159|   690k|        return str.starts_with("\xef\xbb\xbf");
  160|   690k|    }
_ZN4qpdf4util9assertionIRA83_KcEEvbOT_:
   29|  61.5k|    {
   30|  61.5k|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 61.5k]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|  61.5k|    }
_ZN4qpdf4util9assertionIRA57_KcEEvbOT_:
   29|    609|    {
   30|    609|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 609]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|    609|    }
_ZN4qpdf4util9assertionIRA51_KcEEvbOT_:
   29|    543|    {
   30|    543|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 543]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|    543|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralElQsr3stdE8integralIT_EEEbT0_:
   65|  18.5k|    {
   66|       |        if constexpr (std::cmp_less(
   67|       |                          std::numeric_limits<decltype(val)>::min(),
   68|  18.5k|                          std::numeric_limits<T>::min())) {
   69|  18.5k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (69:17): [True: 0, False: 18.5k]
  ------------------
   70|      0|                return false;
   71|      0|            }
   72|  18.5k|        }
   73|       |        if constexpr (std::cmp_greater(
   74|       |                          std::numeric_limits<decltype(val)>::max(),
   75|  18.5k|                          std::numeric_limits<T>::max())) {
   76|  18.5k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (76:17): [True: 0, False: 18.5k]
  ------------------
   77|      0|                return false;
   78|      0|            }
   79|  18.5k|        }
   80|  18.5k|        return true;
   81|  18.5k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEiQsr3stdE8integralIT_EEEbT0_:
   65|  18.5k|    {
   66|       |        if constexpr (std::cmp_less(
   67|       |                          std::numeric_limits<decltype(val)>::min(),
   68|  18.5k|                          std::numeric_limits<T>::min())) {
   69|  18.5k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (69:17): [True: 0, False: 18.5k]
  ------------------
   70|      0|                return false;
   71|      0|            }
   72|  18.5k|        }
   73|       |        if constexpr (std::cmp_greater(
   74|       |                          std::numeric_limits<decltype(val)>::max(),
   75|       |                          std::numeric_limits<T>::max())) {
   76|       |            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
   77|       |                return false;
   78|       |            }
   79|       |        }
   80|  18.5k|        return true;
   81|  18.5k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEyQsr3stdE8integralIT_EEEbT0_:
   65|  79.2k|    {
   66|       |        if constexpr (std::cmp_less(
   67|       |                          std::numeric_limits<decltype(val)>::min(),
   68|       |                          std::numeric_limits<T>::min())) {
   69|       |            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
   70|       |                return false;
   71|       |            }
   72|       |        }
   73|       |        if constexpr (std::cmp_greater(
   74|       |                          std::numeric_limits<decltype(val)>::max(),
   75|  79.2k|                          std::numeric_limits<T>::max())) {
   76|  79.2k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (76:17): [True: 8, False: 79.2k]
  ------------------
   77|      8|                return false;
   78|      8|            }
   79|  79.2k|        }
   80|  79.2k|        return true;
   81|  79.2k|    }
_ZN4qpdf4util9assertionINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   29|   244k|    {
   30|   244k|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 244k]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|   244k|    }
_ZN4qpdf4util9assertionIRA45_KcEEvbOT_:
   29|   568k|    {
   30|   568k|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 568k]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|   568k|    }
_ZN4qpdf4util9assertionIRA54_KcEEvbOT_:
   29|   194k|    {
   30|   194k|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 194k]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|   194k|    }
_ZN4qpdf4util9assertionIRA53_KcEEvbOT_:
   29|  3.53k|    {
   30|  3.53k|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 3.53k]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|  3.53k|    }
_ZN4qpdf4util9assertionIRA35_KcEEvbOT_:
   29|  3.04k|    {
   30|  3.04k|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 3.04k]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|  3.04k|    }
_ZN4qpdf4util17internal_error_ifIRA34_KcEEvbOT_:
   38|   250k|    {
   39|   250k|        if (cond) {
  ------------------
  |  Branch (39:13): [True: 1, False: 250k]
  ------------------
   40|      1|            throw std::logic_error("INTERNAL ERROR: "s.append(std::forward<T>(msg))
   41|      1|                                       .append(
   42|      1|                                           "\nThis is a qpdf bug. Please report at "
   43|      1|                                           "https://github.com/qpdf/qpdf/issues"));
   44|      1|        }
   45|   250k|    }
_ZN4qpdf4util9assertionIRA68_KcEEvbOT_:
   29|  2.60k|    {
   30|  2.60k|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 2.60k]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|  2.60k|    }
_ZN4qpdf4util9assertionIRA65_KcEEvbOT_:
   29|  2.40k|    {
   30|  2.40k|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 2.40k]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|  2.40k|    }
_ZN4qpdf4util9assertionIRA49_KcEEvbOT_:
   29|  18.0k|    {
   30|  18.0k|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 18.0k]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|  18.0k|    }
_ZN4qpdf4util9assertionIRA43_KcEEvbOT_:
   29|  11.2k|    {
   30|  11.2k|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 11.2k]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|  11.2k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA51_KcEEvbOT_:
   50|   767k|    {
   51|   767k|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 28, False: 767k]
  ------------------
   52|     28|            throw std::runtime_error(std::forward<T>(msg));
   53|     28|        }
   54|   767k|    }
_ZN4qpdf4util9assertionIRA50_KcEEvbOT_:
   29|   274k|    {
   30|   274k|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 274k]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|   274k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA23_KcEEvbOT_:
   50|  3.03M|    {
   51|  3.03M|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 14, False: 3.03M]
  ------------------
   52|     14|            throw std::runtime_error(std::forward<T>(msg));
   53|     14|        }
   54|  3.03M|    }
_ZN4qpdf4util9assertionIRA52_KcEEvbOT_:
   29|  35.3M|    {
   30|  35.3M|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 35.3M]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|  35.3M|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA44_KcEEvbOT_:
   50|  14.3k|    {
   51|  14.3k|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 18, False: 14.3k]
  ------------------
   52|     18|            throw std::runtime_error(std::forward<T>(msg));
   53|     18|        }
   54|  14.3k|    }
_ZN4qpdf4util9assertionIRA58_KcEEvbOT_:
   29|    419|    {
   30|    419|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 419]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|    419|    }
_ZN4qpdf4util9assertionIRA48_KcEEvbOT_:
   29|  5.17k|    {
   30|  5.17k|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 5.17k]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|  5.17k|    }
_ZN4qpdf4util9assertionIRA46_KcEEvbOT_:
   29|    227|    {
   30|    227|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 227]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|    227|    }
_ZN4qpdf4util17no_ci_rt_error_ifINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   50|  28.9k|    {
   51|  28.9k|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 0, False: 28.9k]
  ------------------
   52|      0|            throw std::runtime_error(std::forward<T>(msg));
   53|      0|        }
   54|  28.9k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA69_KcEEvbOT_:
   50|  7.04k|    {
   51|  7.04k|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 16, False: 7.03k]
  ------------------
   52|     16|            throw std::runtime_error(std::forward<T>(msg));
   53|     16|        }
   54|  7.04k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA59_KcEEvbOT_:
   50|   118k|    {
   51|   118k|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 0, False: 118k]
  ------------------
   52|      0|            throw std::runtime_error(std::forward<T>(msg));
   53|      0|        }
   54|   118k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA42_KcEEvbOT_:
   50|  14.5k|    {
   51|  14.5k|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 0, False: 14.5k]
  ------------------
   52|      0|            throw std::runtime_error(std::forward<T>(msg));
   53|      0|        }
   54|  14.5k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA49_KcEEvbOT_:
   50|  2.62k|    {
   51|  2.62k|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 8, False: 2.61k]
  ------------------
   52|      8|            throw std::runtime_error(std::forward<T>(msg));
   53|      8|        }
   54|  2.62k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA88_KcEEvbOT_:
   50|  1.85k|    {
   51|  1.85k|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 0, False: 1.85k]
  ------------------
   52|      0|            throw std::runtime_error(std::forward<T>(msg));
   53|      0|        }
   54|  1.85k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEjQsr3stdE8integralIT_EEEbT0_:
   65|  1.85k|    {
   66|       |        if constexpr (std::cmp_less(
   67|       |                          std::numeric_limits<decltype(val)>::min(),
   68|       |                          std::numeric_limits<T>::min())) {
   69|       |            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
   70|       |                return false;
   71|       |            }
   72|       |        }
   73|       |        if constexpr (std::cmp_greater(
   74|       |                          std::numeric_limits<decltype(val)>::max(),
   75|       |                          std::numeric_limits<T>::max())) {
   76|       |            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
   77|       |                return false;
   78|       |            }
   79|       |        }
   80|  1.85k|        return true;
   81|  1.85k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA58_KcEEvbOT_:
   50|  1.85k|    {
   51|  1.85k|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 0, False: 1.85k]
  ------------------
   52|      0|            throw std::runtime_error(std::forward<T>(msg));
   53|      0|        }
   54|  1.85k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA45_KcEEvbOT_:
   50|  1.85k|    {
   51|  1.85k|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 3, False: 1.85k]
  ------------------
   52|      3|            throw std::runtime_error(std::forward<T>(msg));
   53|      3|        }
   54|  1.85k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA32_KcEEvbOT_:
   50|  1.85k|    {
   51|  1.85k|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 21, False: 1.83k]
  ------------------
   52|     21|            throw std::runtime_error(std::forward<T>(msg));
   53|     21|        }
   54|  1.85k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA35_KcEEvbOT_:
   50|  27.8k|    {
   51|  27.8k|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 37, False: 27.7k]
  ------------------
   52|     37|            throw std::runtime_error(std::forward<T>(msg));
   53|     37|        }
   54|  27.8k|    }
_ZN4qpdf4util9assertionIRA47_KcEEvbOT_:
   29|   131k|    {
   30|   131k|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 131k]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|   131k|    }
_ZN4qpdf4util9assertionIRA56_KcEEvbOT_:
   29|    763|    {
   30|    763|        if (!cond) {
  ------------------
  |  Branch (30:13): [True: 0, False: 763]
  ------------------
   31|      0|            throw std::logic_error(std::forward<T>(msg));
   32|      0|        }
   33|    763|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA53_KcEEvbOT_:
   50|    763|    {
   51|    763|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 3, False: 760]
  ------------------
   52|      3|            throw std::runtime_error(std::forward<T>(msg));
   53|      3|        }
   54|    763|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA92_KcEEvbOT_:
   50|    748|    {
   51|    748|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 0, False: 748]
  ------------------
   52|      0|            throw std::runtime_error(std::forward<T>(msg));
   53|      0|        }
   54|    748|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA36_KcEEvbOT_:
   50|    743|    {
   51|    743|        if (cond) {
  ------------------
  |  Branch (51:13): [True: 34, False: 709]
  ------------------
   52|     34|            throw std::runtime_error(std::forward<T>(msg));
   53|     34|        }
   54|    743|    }

BitStream.cc:_ZL9read_bitsRPKhRmS2_m:
   21|  1.68M|{
   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.68M|    if (bits_wanted > bits_available) {
  ------------------
  |  Branch (29:9): [True: 0, False: 1.68M]
  ------------------
   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.68M|    if (bits_wanted > 32) {
  ------------------
  |  Branch (34:9): [True: 13, False: 1.68M]
  ------------------
   35|     13|        throw std::out_of_range("read_bits: too many bits requested");
   36|     13|    }
   37|       |
   38|  1.68M|    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.22M|    while (bits_wanted > 0) {
  ------------------
  |  Branch (44:12): [True: 5.53M, False: 1.68M]
  ------------------
   45|       |        // Grab bits from the first byte clearing anything before
   46|       |        // bit_offset.
   47|  5.53M|        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|  5.53M|        size_t to_copy = std::min(bits_wanted, bit_offset + 1);
   51|  5.53M|        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|  5.53M|        byte = static_cast<unsigned char>(byte >> leftover);
   60|       |
   61|       |        // Copy the bits into result
   62|  5.53M|        result <<= to_copy;
   63|  5.53M|        result |= byte;
   64|       |
   65|       |        // Update pointers
   66|  5.53M|        if (leftover) {
  ------------------
  |  Branch (66:13): [True: 1.14M, False: 4.39M]
  ------------------
   67|  1.14M|            bit_offset = leftover - 1;
   68|  4.39M|        } else {
   69|  4.39M|            bit_offset = 7;
   70|  4.39M|            ++p;
   71|  4.39M|        }
   72|  5.53M|        bits_wanted -= to_copy;
   73|  5.53M|        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|  5.53M|    }
   79|       |
   80|  1.68M|    return result;
   81|  1.68M|}
BitWriter.cc:_ZL10write_bitsRhRmymP8Pipeline:
   88|  1.68M|{
   89|  1.68M|    if (bits > 32) {
  ------------------
  |  Branch (89:9): [True: 0, False: 1.68M]
  ------------------
   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.22M|    while (bits > 0) {
  ------------------
  |  Branch (99:12): [True: 5.53M, False: 1.68M]
  ------------------
  100|  5.53M|        size_t bits_to_write = std::min(bits, bit_offset + 1);
  101|  5.53M|        unsigned char newval = static_cast<unsigned char>(
  102|  5.53M|            (val >> (bits - bits_to_write)) & ((1U << bits_to_write) - 1));
  103|  5.53M|        size_t bits_left_in_ch = bit_offset + 1 - bits_to_write;
  104|  5.53M|        newval = static_cast<unsigned char>(newval << bits_left_in_ch);
  105|  5.53M|        ch |= newval;
  106|  5.53M|        if (bits_left_in_ch == 0) {
  ------------------
  |  Branch (106:13): [True: 4.39M, False: 1.14M]
  ------------------
  107|       |# ifdef BITS_TESTING
  108|       |            QTC::TC("libtests", "bits write pipeline");
  109|       |# endif
  110|  4.39M|            pipeline->write(&ch, 1);
  111|  4.39M|            bit_offset = 7;
  112|  4.39M|            ch = 0;
  113|  4.39M|        } else {
  114|       |# ifdef BITS_TESTING
  115|       |            QTC::TC("libtests", "bits write leftover");
  116|       |# endif
  117|  1.14M|            bit_offset -= bits_to_write;
  118|  1.14M|        }
  119|  5.53M|        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|  5.53M|    }
  124|  1.68M|}

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

_Z20rijndaelSetupEncryptPjPKhm:
  715|   143k|{
  716|   143k|  int i = 0;
  717|   143k|  u32 temp;
  718|       |
  719|   143k|  rk[0] = GETU32(key     );
  ------------------
  |  |  698|   143k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   143k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   143k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   143k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  720|   143k|  rk[1] = GETU32(key +  4);
  ------------------
  |  |  698|   143k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   143k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   143k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   143k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  721|   143k|  rk[2] = GETU32(key +  8);
  ------------------
  |  |  698|   143k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   143k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   143k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   143k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  722|   143k|  rk[3] = GETU32(key + 12);
  ------------------
  |  |  698|   143k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   143k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   143k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   143k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  723|   143k|  if (keybits == 128)
  ------------------
  |  Branch (723:7): [True: 134k, False: 8.62k]
  ------------------
  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|  8.62k|  rk[4] = GETU32(key + 16);
  ------------------
  |  |  698|  8.62k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  8.62k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  8.62k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  8.62k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  743|  8.62k|  rk[5] = GETU32(key + 20);
  ------------------
  |  |  698|  8.62k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  8.62k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  8.62k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  8.62k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  744|  8.62k|  if (keybits == 192)
  ------------------
  |  Branch (744:7): [True: 0, False: 8.62k]
  ------------------
  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|  8.62k|  rk[6] = GETU32(key + 24);
  ------------------
  |  |  698|  8.62k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  8.62k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  8.62k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  8.62k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  766|  8.62k|  rk[7] = GETU32(key + 28);
  ------------------
  |  |  698|  8.62k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  8.62k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  8.62k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  8.62k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  767|  8.62k|  if (keybits == 256)
  ------------------
  |  Branch (767:7): [True: 8.62k, False: 0]
  ------------------
  768|  8.62k|  {
  769|  8.62k|    for (;;)
  770|  60.3k|    {
  771|  60.3k|      temp = rk[ 7];
  772|  60.3k|      rk[ 8] = rk[ 0] ^
  773|  60.3k|        (Te4[(temp >> 16) & 0xff] & 0xff000000) ^
  774|  60.3k|        (Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^
  775|  60.3k|        (Te4[(temp      ) & 0xff] & 0x0000ff00) ^
  776|  60.3k|        (Te4[(temp >> 24)       ] & 0x000000ff) ^
  777|  60.3k|        rcon[i];
  778|  60.3k|      rk[ 9] = rk[ 1] ^ rk[ 8];
  779|  60.3k|      rk[10] = rk[ 2] ^ rk[ 9];
  780|  60.3k|      rk[11] = rk[ 3] ^ rk[10];
  781|  60.3k|      if (++i == 7)
  ------------------
  |  Branch (781:11): [True: 8.62k, False: 51.7k]
  ------------------
  782|  8.62k|        return 14;
  783|  51.7k|      temp = rk[11];
  784|  51.7k|      rk[12] = rk[ 4] ^
  785|  51.7k|        (Te4[(temp >> 24)       ] & 0xff000000) ^
  786|  51.7k|        (Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^
  787|  51.7k|        (Te4[(temp >>  8) & 0xff] & 0x0000ff00) ^
  788|  51.7k|        (Te4[(temp      ) & 0xff] & 0x000000ff);
  789|  51.7k|      rk[13] = rk[ 5] ^ rk[12];
  790|  51.7k|      rk[14] = rk[ 6] ^ rk[13];
  791|  51.7k|      rk[15] = rk[ 7] ^ rk[14];
  792|  51.7k|      rk += 8;
  793|  51.7k|    }
  794|  8.62k|  }
  795|      0|  return 0;
  796|  8.62k|}
_Z20rijndaelSetupDecryptPjPKhm:
  804|  13.2k|{
  805|  13.2k|  unsigned int nrounds, i, j;
  806|  13.2k|  u32 temp;
  807|       |
  808|       |  /* expand the cipher key: */
  809|  13.2k|  nrounds = rijndaelSetupEncrypt(rk, key, keybits);
  810|       |  /* invert the order of the round keys: */
  811|  96.8k|  for (i = 0, j = 4*nrounds; i < j; i += 4, j -= 4)
  ------------------
  |  Branch (811:30): [True: 83.5k, False: 13.2k]
  ------------------
  812|  83.5k|  {
  813|  83.5k|    temp = rk[i    ]; rk[i    ] = rk[j    ]; rk[j    ] = temp;
  814|  83.5k|    temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp;
  815|  83.5k|    temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp;
  816|  83.5k|    temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp;
  817|  83.5k|  }
  818|       |  /* apply the inverse MixColumn transform to all round keys but the first and the last: */
  819|   167k|  for (i = 1; i < nrounds; i++)
  ------------------
  |  Branch (819:15): [True: 153k, False: 13.2k]
  ------------------
  820|   153k|  {
  821|   153k|    rk += 4;
  822|   153k|    rk[0] =
  823|   153k|      Td0[Te4[(rk[0] >> 24)       ] & 0xff] ^
  824|   153k|      Td1[Te4[(rk[0] >> 16) & 0xff] & 0xff] ^
  825|   153k|      Td2[Te4[(rk[0] >>  8) & 0xff] & 0xff] ^
  826|   153k|      Td3[Te4[(rk[0]      ) & 0xff] & 0xff];
  827|   153k|    rk[1] =
  828|   153k|      Td0[Te4[(rk[1] >> 24)       ] & 0xff] ^
  829|   153k|      Td1[Te4[(rk[1] >> 16) & 0xff] & 0xff] ^
  830|   153k|      Td2[Te4[(rk[1] >>  8) & 0xff] & 0xff] ^
  831|   153k|      Td3[Te4[(rk[1]      ) & 0xff] & 0xff];
  832|   153k|    rk[2] =
  833|   153k|      Td0[Te4[(rk[2] >> 24)       ] & 0xff] ^
  834|   153k|      Td1[Te4[(rk[2] >> 16) & 0xff] & 0xff] ^
  835|   153k|      Td2[Te4[(rk[2] >>  8) & 0xff] & 0xff] ^
  836|   153k|      Td3[Te4[(rk[2]      ) & 0xff] & 0xff];
  837|   153k|    rk[3] =
  838|   153k|      Td0[Te4[(rk[3] >> 24)       ] & 0xff] ^
  839|   153k|      Td1[Te4[(rk[3] >> 16) & 0xff] & 0xff] ^
  840|   153k|      Td2[Te4[(rk[3] >>  8) & 0xff] & 0xff] ^
  841|   153k|      Td3[Te4[(rk[3]      ) & 0xff] & 0xff];
  842|   153k|  }
  843|  13.2k|  return nrounds;
  844|  13.2k|}
_Z15rijndaelEncryptPKjjPKhPh:
  849|  34.9M|{
  850|  34.9M|  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.9M|  s0 = GETU32(plaintext     ) ^ rk[0];
  ------------------
  |  |  698|  34.9M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  34.9M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  34.9M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  34.9M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  859|  34.9M|  s1 = GETU32(plaintext +  4) ^ rk[1];
  ------------------
  |  |  698|  34.9M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  34.9M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  34.9M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  34.9M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  860|  34.9M|  s2 = GETU32(plaintext +  8) ^ rk[2];
  ------------------
  |  |  698|  34.9M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  34.9M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  34.9M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  34.9M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  861|  34.9M|  s3 = GETU32(plaintext + 12) ^ rk[3];
  ------------------
  |  |  698|  34.9M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  34.9M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  34.9M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  34.9M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  862|  34.9M|#ifdef FULL_UNROLL
  863|       |    /* round 1: */
  864|  34.9M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4];
  865|  34.9M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5];
  866|  34.9M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6];
  867|  34.9M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[ 7];
  868|       |    /* round 2: */
  869|  34.9M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[ 8];
  870|  34.9M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9];
  871|  34.9M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10];
  872|  34.9M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11];
  873|       |    /* round 3: */
  874|  34.9M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12];
  875|  34.9M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13];
  876|  34.9M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14];
  877|  34.9M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[15];
  878|       |    /* round 4: */
  879|  34.9M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[16];
  880|  34.9M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17];
  881|  34.9M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18];
  882|  34.9M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19];
  883|       |    /* round 5: */
  884|  34.9M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20];
  885|  34.9M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21];
  886|  34.9M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22];
  887|  34.9M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[23];
  888|       |    /* round 6: */
  889|  34.9M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[24];
  890|  34.9M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25];
  891|  34.9M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26];
  892|  34.9M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27];
  893|       |    /* round 7: */
  894|  34.9M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28];
  895|  34.9M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29];
  896|  34.9M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30];
  897|  34.9M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[31];
  898|       |    /* round 8: */
  899|  34.9M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[32];
  900|  34.9M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33];
  901|  34.9M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34];
  902|  34.9M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35];
  903|       |    /* round 9: */
  904|  34.9M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36];
  905|  34.9M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37];
  906|  34.9M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38];
  907|  34.9M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39];
  908|  34.9M|    if (nrounds > 10)
  ------------------
  |  Branch (908:9): [True: 0, False: 34.9M]
  ------------------
  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.9M|    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.9M|  s0 =
 1000|  34.9M|    (Te4[(t0 >> 24)       ] & 0xff000000) ^
 1001|  34.9M|    (Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^
 1002|  34.9M|    (Te4[(t2 >>  8) & 0xff] & 0x0000ff00) ^
 1003|  34.9M|    (Te4[(t3      ) & 0xff] & 0x000000ff) ^
 1004|  34.9M|    rk[0];
 1005|  34.9M|  PUTU32(ciphertext     , s0);
  ------------------
  |  |  703|  34.9M|#define PUTU32(ciphertext, st) { \
  |  |  704|  34.9M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  34.9M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  34.9M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  34.9M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1006|  34.9M|  s1 =
 1007|  34.9M|    (Te4[(t1 >> 24)       ] & 0xff000000) ^
 1008|  34.9M|    (Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
 1009|  34.9M|    (Te4[(t3 >>  8) & 0xff] & 0x0000ff00) ^
 1010|  34.9M|    (Te4[(t0      ) & 0xff] & 0x000000ff) ^
 1011|  34.9M|    rk[1];
 1012|  34.9M|  PUTU32(ciphertext +  4, s1);
  ------------------
  |  |  703|  34.9M|#define PUTU32(ciphertext, st) { \
  |  |  704|  34.9M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  34.9M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  34.9M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  34.9M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1013|  34.9M|  s2 =
 1014|  34.9M|    (Te4[(t2 >> 24)       ] & 0xff000000) ^
 1015|  34.9M|    (Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^
 1016|  34.9M|    (Te4[(t0 >>  8) & 0xff] & 0x0000ff00) ^
 1017|  34.9M|    (Te4[(t1      ) & 0xff] & 0x000000ff) ^
 1018|  34.9M|    rk[2];
 1019|  34.9M|  PUTU32(ciphertext +  8, s2);
  ------------------
  |  |  703|  34.9M|#define PUTU32(ciphertext, st) { \
  |  |  704|  34.9M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  34.9M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  34.9M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  34.9M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1020|  34.9M|  s3 =
 1021|  34.9M|    (Te4[(t3 >> 24)       ] & 0xff000000) ^
 1022|  34.9M|    (Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
 1023|  34.9M|    (Te4[(t1 >>  8) & 0xff] & 0x0000ff00) ^
 1024|  34.9M|    (Te4[(t2      ) & 0xff] & 0x000000ff) ^
 1025|  34.9M|    rk[3];
 1026|  34.9M|  PUTU32(ciphertext + 12, s3);
  ------------------
  |  |  703|  34.9M|#define PUTU32(ciphertext, st) { \
  |  |  704|  34.9M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  34.9M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  34.9M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  34.9M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1027|  34.9M|}
_Z15rijndaelDecryptPKjjPKhPh:
 1032|   340k|{
 1033|   340k|  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|   340k|    s0 = GETU32(ciphertext     ) ^ rk[0];
  ------------------
  |  |  698|   340k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   340k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   340k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   340k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1043|   340k|    s1 = GETU32(ciphertext +  4) ^ rk[1];
  ------------------
  |  |  698|   340k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   340k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   340k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   340k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1044|   340k|    s2 = GETU32(ciphertext +  8) ^ rk[2];
  ------------------
  |  |  698|   340k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   340k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   340k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   340k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1045|   340k|    s3 = GETU32(ciphertext + 12) ^ rk[3];
  ------------------
  |  |  698|   340k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   340k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   340k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   340k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1046|   340k|#ifdef FULL_UNROLL
 1047|       |    /* round 1: */
 1048|   340k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4];
 1049|   340k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[ 5];
 1050|   340k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[ 6];
 1051|   340k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[ 7];
 1052|       |    /* round 2: */
 1053|   340k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[ 8];
 1054|   340k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[ 9];
 1055|   340k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[10];
 1056|   340k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[11];
 1057|       |    /* round 3: */
 1058|   340k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[12];
 1059|   340k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[13];
 1060|   340k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[14];
 1061|   340k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[15];
 1062|       |    /* round 4: */
 1063|   340k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[16];
 1064|   340k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[17];
 1065|   340k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[18];
 1066|   340k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[19];
 1067|       |    /* round 5: */
 1068|   340k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[20];
 1069|   340k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[21];
 1070|   340k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[22];
 1071|   340k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[23];
 1072|       |    /* round 6: */
 1073|   340k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[24];
 1074|   340k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[25];
 1075|   340k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[26];
 1076|   340k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[27];
 1077|       |    /* round 7: */
 1078|   340k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[28];
 1079|   340k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[29];
 1080|   340k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[30];
 1081|   340k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[31];
 1082|       |    /* round 8: */
 1083|   340k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[32];
 1084|   340k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[33];
 1085|   340k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[34];
 1086|   340k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[35];
 1087|       |    /* round 9: */
 1088|   340k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[36];
 1089|   340k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37];
 1090|   340k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38];
 1091|   340k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39];
 1092|   340k|    if (nrounds > 10)
  ------------------
  |  Branch (1092:9): [True: 198k, False: 141k]
  ------------------
 1093|   198k|    {
 1094|       |      /* round 10: */
 1095|   198k|      s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40];
 1096|   198k|      s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41];
 1097|   198k|      s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[42];
 1098|   198k|      s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[43];
 1099|       |      /* round 11: */
 1100|   198k|      t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[44];
 1101|   198k|      t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45];
 1102|   198k|      t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46];
 1103|   198k|      t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47];
 1104|   198k|      if (nrounds > 12)
  ------------------
  |  Branch (1104:11): [True: 198k, False: 0]
  ------------------
 1105|   198k|      {
 1106|       |        /* round 12: */
 1107|   198k|        s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48];
 1108|   198k|        s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49];
 1109|   198k|        s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[50];
 1110|   198k|        s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[51];
 1111|       |        /* round 13: */
 1112|   198k|        t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[52];
 1113|   198k|        t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[53];
 1114|   198k|        t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[54];
 1115|   198k|        t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55];
 1116|   198k|      }
 1117|   198k|    }
 1118|   340k|    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|   340k|  s0 =
 1184|   340k|    (Td4[(t0 >> 24)       ] & 0xff000000) ^
 1185|   340k|    (Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^
 1186|   340k|    (Td4[(t2 >>  8) & 0xff] & 0x0000ff00) ^
 1187|   340k|    (Td4[(t1      ) & 0xff] & 0x000000ff) ^
 1188|   340k|    rk[0];
 1189|   340k|  PUTU32(plaintext     , s0);
  ------------------
  |  |  703|   340k|#define PUTU32(ciphertext, st) { \
  |  |  704|   340k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   340k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   340k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   340k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1190|   340k|  s1 =
 1191|   340k|    (Td4[(t1 >> 24)       ] & 0xff000000) ^
 1192|   340k|    (Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
 1193|   340k|    (Td4[(t3 >>  8) & 0xff] & 0x0000ff00) ^
 1194|   340k|    (Td4[(t2      ) & 0xff] & 0x000000ff) ^
 1195|   340k|    rk[1];
 1196|   340k|  PUTU32(plaintext +  4, s1);
  ------------------
  |  |  703|   340k|#define PUTU32(ciphertext, st) { \
  |  |  704|   340k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   340k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   340k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   340k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1197|   340k|  s2 =
 1198|   340k|    (Td4[(t2 >> 24)       ] & 0xff000000) ^
 1199|   340k|    (Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^
 1200|   340k|    (Td4[(t0 >>  8) & 0xff] & 0x0000ff00) ^
 1201|   340k|    (Td4[(t3      ) & 0xff] & 0x000000ff) ^
 1202|   340k|    rk[2];
 1203|   340k|  PUTU32(plaintext +  8, s2);
  ------------------
  |  |  703|   340k|#define PUTU32(ciphertext, st) { \
  |  |  704|   340k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   340k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   340k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   340k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1204|   340k|  s3 =
 1205|   340k|    (Td4[(t3 >> 24)       ] & 0xff000000) ^
 1206|   340k|    (Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
 1207|   340k|    (Td4[(t1 >>  8) & 0xff] & 0x0000ff00) ^
 1208|   340k|    (Td4[(t0      ) & 0xff] & 0x000000ff) ^
 1209|   340k|    rk[3];
 1210|   340k|  PUTU32(plaintext + 12, s3);
  ------------------
  |  |  703|   340k|#define PUTU32(ciphertext, st) { \
  |  |  704|   340k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   340k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   340k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   340k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1211|   340k|}

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

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

sph_sha224:
  173|  46.4k|{
  174|  46.4k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  46.4k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  46.4k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|  46.4k|        unsigned current;
  176|  46.4k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|  46.4k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   95|  46.4k|#define SPH_BLEN     64U
  ------------------
  |  Branch (181:13): [True: 2.66k, False: 43.7k]
  ------------------
  182|  2.66k|                SPH_XCAT(HASH, _short)(cc, data, len);
  ------------------
  |  |   85|  2.66k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  2.66k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  183|  2.66k|                return;
  184|  2.66k|        }
  185|  43.7k|        sc = cc;
  186|  43.7k|#if SPH_64
  187|  43.7k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  43.7k|#define SPH_BLEN     64U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|  43.7k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 43.7k]
  ------------------
  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.7k|        orig_len = len;
  206|  2.99M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   95|  2.99M|#define SPH_BLEN     64U
  ------------------
  |  Branch (206:16): [True: 2.95M, False: 43.7k]
  ------------------
  207|  2.95M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  647|  2.95M|#define RFUN   sha2_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  2.95M|#define SPH_VAL   sc->val
  ------------------
  208|  2.95M|                len -= SPH_BLEN;
  ------------------
  |  |   95|  2.95M|#define SPH_BLEN     64U
  ------------------
  209|  2.95M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   95|  2.95M|#define SPH_BLEN     64U
  ------------------
  210|  2.95M|        }
  211|  43.7k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 0, False: 43.7k]
  ------------------
  212|      0|                memcpy(sc->buf, data, len);
  213|  43.7k|#if SPH_64
  214|  43.7k|        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.7k|}
sha2.c:sha224_short:
  131|  2.66k|{
  132|  2.66k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  2.66k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  2.66k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  133|  2.66k|        unsigned current;
  134|       |
  135|  2.66k|        sc = cc;
  136|  2.66k|#if SPH_64
  137|  2.66k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  2.66k|#define SPH_BLEN     64U
  ------------------
  138|       |#else
  139|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  140|       |#endif
  141|  5.33k|        while (len > 0) {
  ------------------
  |  Branch (141:16): [True: 2.66k, False: 2.66k]
  ------------------
  142|  2.66k|                unsigned clen;
  143|       |#if !SPH_64
  144|       |                sph_u32 clow, clow2;
  145|       |#endif
  146|       |
  147|  2.66k|                clen = SPH_BLEN - current;
  ------------------
  |  |   95|  2.66k|#define SPH_BLEN     64U
  ------------------
  148|  2.66k|                if (clen > len)
  ------------------
  |  Branch (148:21): [True: 2.66k, False: 0]
  ------------------
  149|  2.66k|                        clen = (unsigned)len;
  150|  2.66k|                memcpy(sc->buf + current, data, clen);
  151|  2.66k|                data = (const unsigned char *)data + clen;
  152|  2.66k|                current += clen;
  153|  2.66k|                len -= clen;
  154|  2.66k|                if (current == SPH_BLEN) {
  ------------------
  |  |   95|  2.66k|#define SPH_BLEN     64U
  ------------------
  |  Branch (154:21): [True: 0, False: 2.66k]
  ------------------
  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.66k|#if SPH_64
  159|  2.66k|                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.66k|        }
  168|  2.66k|}
sha2.c:sha224_close:
  345|  45.6k|{
  346|  45.6k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|  45.6k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  45.6k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|  45.6k|}
sha2.c:sha224_addbits_and_close:
  242|  45.6k|{
  243|  45.6k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  45.6k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  45.6k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|  45.6k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|  45.6k|        sc = cc;
  250|  45.6k|#if SPH_64
  251|  45.6k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  45.6k|#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.6k|        {
  259|  45.6k|                unsigned z;
  260|       |
  261|  45.6k|                z = 0x80U >> n;
  262|  45.6k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|  45.6k|        }
  264|  45.6k|#endif
  265|  45.6k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|  45.6k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  45.6k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  45.6k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 787, False: 44.8k]
  ------------------
  266|    787|                memset(sc->buf + current, 0, SPH_BLEN - current);
  ------------------
  |  |   95|    787|#define SPH_BLEN     64U
  ------------------
  267|    787|                RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|    787|#define RFUN   sha2_round
  ------------------
                              RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|    787|#define SPH_VAL   sc->val
  ------------------
  268|    787|                memset(sc->buf, 0, SPH_MAXPAD);
  ------------------
  |  |  110|    787|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|    787|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|    787|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  269|  44.8k|        } else {
  270|  44.8k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|  44.8k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  44.8k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  44.8k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  271|  44.8k|        }
  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.6k|#if SPH_64
  303|  45.6k|#ifdef BE32
  304|  45.6k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  ------------------
  |  |  110|  45.6k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  45.6k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  45.6k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  305|  45.6k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|  45.6k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|  45.6k|#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.6k|#endif
  323|  45.6k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|  45.6k|#define RFUN   sha2_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|  45.6k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|   410k|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 365k, False: 45.6k]
  ------------------
  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|   365k|        }
  340|  45.6k|#endif
  341|  45.6k|}
sph_sha384:
  173|  86.0k|{
  174|  86.0k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  86.0k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  86.0k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|  86.0k|        unsigned current;
  176|  86.0k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|  86.0k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   92|  86.0k|#define SPH_BLEN    128U
  ------------------
  |  Branch (181:13): [True: 0, False: 86.0k]
  ------------------
  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|  86.0k|        sc = cc;
  186|  86.0k|#if SPH_64
  187|  86.0k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|  86.0k|#define SPH_BLEN    128U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|  86.0k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 86.0k]
  ------------------
  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|  86.0k|        orig_len = len;
  206|  2.97M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   92|  2.97M|#define SPH_BLEN    128U
  ------------------
  |  Branch (206:16): [True: 2.89M, False: 86.0k]
  ------------------
  207|  2.89M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  202|  2.89M|#define RFUN   sha3_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  2.89M|#define SPH_VAL   sc->val
  ------------------
  208|  2.89M|                len -= SPH_BLEN;
  ------------------
  |  |   92|  2.89M|#define SPH_BLEN    128U
  ------------------
  209|  2.89M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   92|  2.89M|#define SPH_BLEN    128U
  ------------------
  210|  2.89M|        }
  211|  86.0k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 0, False: 86.0k]
  ------------------
  212|      0|                memcpy(sc->buf, data, len);
  213|  86.0k|#if SPH_64
  214|  86.0k|        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|  86.0k|}
sha2big.c:sha384_close:
  345|  86.0k|{
  346|  86.0k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|  86.0k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  86.0k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|  86.0k|}
sha2big.c:sha384_addbits_and_close:
  242|  86.0k|{
  243|  86.0k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  86.0k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  86.0k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|  86.0k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|  86.0k|        sc = cc;
  250|  86.0k|#if SPH_64
  251|  86.0k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|  86.0k|#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|  86.0k|        {
  259|  86.0k|                unsigned z;
  260|       |
  261|  86.0k|                z = 0x80U >> n;
  262|  86.0k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|  86.0k|        }
  264|  86.0k|#endif
  265|  86.0k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|  86.0k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  86.0k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  86.0k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 0, False: 86.0k]
  ------------------
  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|  86.0k|        } else {
  270|  86.0k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|  86.0k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  86.0k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  86.0k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  271|  86.0k|        }
  272|  86.0k|#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|  86.0k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD, sc->count >> 61);
  ------------------
  |  |  110|  86.0k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  86.0k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  86.0k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  284|  86.0k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |  110|  86.0k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  86.0k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  86.0k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
                      sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |   93|  86.0k|#define SPH_WLEN      8U
  ------------------
  285|  86.0k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|  86.0k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|  86.0k|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  ------------------
  ------------------
  286|  86.0k|#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|  86.0k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  202|  86.0k|#define RFUN   sha3_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|  86.0k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|   689k|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 603k, False: 86.0k]
  ------------------
  330|   603k|#if defined BE64
  331|   603k|                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|   603k|        }
  340|  86.0k|#endif
  341|  86.0k|}

sha2.c:sph_dec32be_aligned:
 1471|  48.0M|{
 1472|  48.0M|#if SPH_LITTLE_ENDIAN
 1473|  48.0M|        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|  48.0M|}
sha2.c:sph_bswap32:
 1220|  48.3M|{
 1221|  48.3M|        __asm__ __volatile__ ("bswapl %0" : "=r" (x) : "0" (x));
 1222|  48.3M|        return x;
 1223|  48.3M|}
sha2.c:sph_enc64be_aligned:
 1706|  45.6k|{
 1707|  45.6k|#if SPH_LITTLE_ENDIAN
 1708|  45.6k|        *(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.6k|}
sha2.c:sph_bswap64:
 1229|  45.6k|{
 1230|  45.6k|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|  45.6k|        return x;
 1232|  45.6k|}
sha2.c:sph_enc32be:
 1374|   365k|{
 1375|   365k|#if defined SPH_UPTR
 1376|   365k|#if SPH_UNALIGNED
 1377|   365k|#if SPH_LITTLE_ENDIAN
 1378|   365k|        val = sph_bswap32(val);
 1379|   365k|#endif
 1380|   365k|        *(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|   365k|}
sha2big.c:sph_dec64be_aligned:
 1778|  47.6M|{
 1779|  47.6M|#if SPH_LITTLE_ENDIAN
 1780|  47.6M|        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.6M|}
sha2big.c:sph_bswap64:
 1229|  48.4M|{
 1230|  48.4M|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|  48.4M|        return x;
 1232|  48.4M|}
sha2big.c:sph_enc64be_aligned:
 1706|   172k|{
 1707|   172k|#if SPH_LITTLE_ENDIAN
 1708|   172k|        *(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|   172k|}
sha2big.c:sph_enc64be:
 1661|   603k|{
 1662|   603k|#if defined SPH_UPTR
 1663|   603k|#if SPH_UNALIGNED
 1664|   603k|#if SPH_LITTLE_ENDIAN
 1665|   603k|        val = sph_bswap64(val);
 1666|   603k|#endif
 1667|   603k|        *(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|   603k|}

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

inflate_fast:
  215|   161k|void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
  216|   161k|    struct inflate_state FAR *state;
  217|   161k|    z_const unsigned char FAR *in;      /* local strm->next_in */
  218|   161k|    z_const unsigned char FAR *last;    /* have enough input while in < last */
  219|   161k|    unsigned char FAR *out;     /* local strm->next_out */
  220|   161k|    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
  221|   161k|    unsigned char FAR *end;     /* while out < end, enough space available */
  222|       |#ifdef INFLATE_STRICT
  223|       |    unsigned dmax;              /* maximum distance from zlib header */
  224|       |#endif
  225|   161k|    unsigned wsize;             /* window size or zero if not using window */
  226|   161k|    unsigned whave;             /* valid bytes in the window */
  227|   161k|    unsigned wnext;             /* window write index */
  228|   161k|    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
  229|   161k|#if Z_INFLATE_FETCH != 8
  230|   161k|    int back;                   /* decoding into the window: inflateBack() */
  231|   161k|#endif
  232|   161k|    unsigned long hold;         /* local strm->hold */
  233|   161k|    unsigned bits;              /* local strm->bits */
  234|   161k|    code const FAR *lcode;      /* local strm->lencode */
  235|   161k|    code const FAR *dcode;      /* local strm->distcode */
  236|   161k|    unsigned lmask;             /* mask for first level of length codes */
  237|   161k|    unsigned dmask;             /* mask for first level of distance codes */
  238|   161k|    code const *here;           /* retrieved table entry */
  239|   161k|    unsigned op;                /* code bits, operation, extra bits, or */
  240|       |                                /*  window position, window bytes to copy */
  241|   161k|    unsigned len;               /* match length, unused bytes */
  242|   161k|    unsigned dist;              /* match distance */
  243|   161k|    unsigned char FAR *from;    /* where to copy match from */
  244|   161k|#if Z_INFLATE_FETCH == 64
  245|   161k|    Z_U8 hold8;                 /* 64-bit bit buffer of the fast loop */
  ------------------
  |  |   56|   161k|#    define Z_U8 unsigned long
  ------------------
  246|   161k|    z_const unsigned char FAR *last8;   /* two refills fit after in */
  247|   161k|    unsigned char FAR *end8;    /* room for two literals, a match, 15 more */
  248|   161k|#endif
  249|       |#if Z_INFLATE_FETCH == 32
  250|       |    Z_U4 hold4;                 /* 32-bit bit buffer of the fast loop */
  251|       |    z_const unsigned char FAR *last4;   /* three refills fit after in */
  252|       |    unsigned char FAR *end4;    /* room for a match and fifteen more */
  253|       |#endif
  254|       |
  255|       |    /* copy state to local variables */
  256|   161k|    state = (struct inflate_state FAR *)strm->state;
  257|   161k|    in = strm->next_in;
  258|   161k|    last = in + (strm->avail_in - 5);
  259|   161k|    out = strm->next_out;
  260|   161k|    beg = out - (start - strm->avail_out);
  261|   161k|    end = out + (strm->avail_out - 257);
  262|       |#ifdef INFLATE_STRICT
  263|       |    dmax = state->dmax;
  264|       |#endif
  265|   161k|    wsize = state->wsize;
  266|   161k|    whave = state->whave;
  267|   161k|    wnext = state->wnext;
  268|   161k|    window = state->window;
  269|   161k|#if Z_INFLATE_FETCH != 8
  270|       |    /* For inflateBack(), only use the loop at the end, which does not write
  271|       |       past the end of the copy. */
  272|   161k|    back = window != Z_NULL && out + strm->avail_out == window + wsize;
  ------------------
  |  |  216|   322k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (272:12): [True: 152k, False: 9.19k]
  |  Branch (272:32): [True: 0, False: 152k]
  ------------------
  273|   161k|#endif
  274|   161k|    hold = state->hold;
  275|   161k|    bits = state->bits;
  276|   161k|    lcode = state->lencode;
  277|   161k|    dcode = state->distcode;
  278|   161k|    lmask = (1U << state->lenbits) - 1;
  279|   161k|    dmask = (1U << state->distbits) - 1;
  280|       |
  281|   161k|#if Z_INFLATE_FETCH == 64
  282|       |    /* Fast loop, while sixteen bytes are available at in (two refills of eight
  283|       |       bytes, the first advancing in by up to seven) and the output has room
  284|       |       for the longest match plus 17 bytes (one iteration can write two
  285|       |       literals and then a match, and copy_back() may write 15 bytes past the
  286|       |       match). Each length/literal code starts with at least 56 bits in hold8,
  287|       |       enough for a length/distance pair (at most 48 bits). */
  288|   161k|    if (!back && strm->avail_in >= 16 && strm->avail_out >= 2 + 258 + 15) {
  ------------------
  |  Branch (288:9): [True: 161k, False: 0]
  |  Branch (288:18): [True: 25.9k, False: 135k]
  |  Branch (288:42): [True: 25.9k, False: 6]
  ------------------
  289|  25.9k|        last8 = in + (strm->avail_in - 16);
  290|  25.9k|        end8 = out + (strm->avail_out - (2 + 258 + 15));
  291|  25.9k|        hold8 = hold;
  292|  1.83M|        do {
  293|  1.83M|            hold8 |= load64(in) << bits;
  294|  1.83M|            in += (63 - bits) >> 3;
  295|  1.83M|            bits |= 56;
  296|  1.83M|            here = lcode + (hold8 & lmask);
  297|  1.83M|            if (here->op == 0) {        /* up to three literals a refill */
  ------------------
  |  Branch (297:17): [True: 728k, False: 1.10M]
  ------------------
  298|   728k|                hold8 >>= here->bits;
  299|   728k|                bits -= here->bits;
  300|   728k|                TRACE_LITERAL(here);
  301|   728k|                *out++ = (unsigned char)(here->val);
  302|   728k|                here = lcode + (hold8 & lmask);
  303|   728k|                if (here->op == 0) {
  ------------------
  |  Branch (303:21): [True: 413k, False: 314k]
  ------------------
  304|   413k|                    hold8 >>= here->bits;
  305|   413k|                    bits -= here->bits;
  306|   413k|                    TRACE_LITERAL(here);
  307|   413k|                    *out++ = (unsigned char)(here->val);
  308|   413k|                    here = lcode + (hold8 & lmask);
  309|   413k|                    if (here->op == 0) {
  ------------------
  |  Branch (309:25): [True: 310k, False: 102k]
  ------------------
  310|   310k|                        hold8 >>= here->bits;
  311|   310k|                        bits -= here->bits;
  312|   310k|                        TRACE_LITERAL(here);
  313|   310k|                        *out++ = (unsigned char)(here->val);
  314|   310k|                        continue;
  315|   310k|                    }
  316|   413k|                }
  317|   417k|                hold8 |= load64(in) << bits;    /* 56 bits for a pair */
  318|   417k|                in += (63 - bits) >> 3;
  319|   417k|                bits |= 56;
  320|   417k|            }
  321|  1.53M|          dolen8:
  322|  1.53M|            op = (unsigned)(here->bits);
  323|  1.53M|            hold8 >>= op;
  324|  1.53M|            bits -= op;
  325|  1.53M|            op = (unsigned)(here->op);
  326|  1.53M|            if (op == 0) {                      /* literal */
  ------------------
  |  Branch (326:17): [True: 2.20k, False: 1.53M]
  ------------------
  327|  2.20k|                TRACE_LITERAL(here);
  328|  2.20k|                *out++ = (unsigned char)(here->val);
  329|  2.20k|            }
  330|  1.53M|            else if (op & 16) {                 /* length base */
  ------------------
  |  Branch (330:22): [True: 1.51M, False: 14.2k]
  ------------------
  331|  1.51M|                len = (unsigned)(here->val);
  332|  1.51M|                op &= 15;                       /* number of extra bits */
  333|  1.51M|                len += (unsigned)hold8 & ((1U << op) - 1);
  334|  1.51M|                hold8 >>= op;
  335|  1.51M|                bits -= op;
  336|  1.51M|                Tracevv((stderr, "inflate:         length %u\n", len));
  337|  1.51M|                here = dcode + (hold8 & dmask);
  338|  1.52M|              dodist8:
  339|  1.52M|                op = (unsigned)(here->bits);
  340|  1.52M|                hold8 >>= op;
  341|  1.52M|                bits -= op;
  342|  1.52M|                op = (unsigned)(here->op);
  343|  1.52M|                if (op & 16) {                  /* distance base */
  ------------------
  |  Branch (343:21): [True: 1.51M, False: 8.96k]
  ------------------
  344|  1.51M|                    dist = (unsigned)(here->val);
  345|  1.51M|                    op &= 15;                   /* number of extra bits */
  346|  1.51M|                    dist += (unsigned)hold8 & ((1U << op) - 1);
  347|       |#ifdef INFLATE_STRICT
  348|       |                    if (dist > dmax) {
  349|       |                        strm->msg = (z_const char *)
  350|       |                            "invalid distance too far back";
  351|       |                        state->mode = BAD;
  352|       |                        break;
  353|       |                    }
  354|       |#endif
  355|  1.51M|                    hold8 >>= op;
  356|  1.51M|                    bits -= op;
  357|  1.51M|                    Tracevv((stderr, "inflate:         distance %u\n", dist));
  358|  1.51M|                    op = (unsigned)(out - beg); /* max distance in output */
  359|  1.51M|                    if (dist > op) {            /* see if copy from window */
  ------------------
  |  Branch (359:25): [True: 24.0k, False: 1.49M]
  ------------------
  360|  24.0k|                        op = dist - op;         /* distance back in window */
  361|  24.0k|                        if (op > whave) {
  ------------------
  |  Branch (361:29): [True: 82, False: 23.9k]
  ------------------
  362|     82|                            if (state->sane) {
  ------------------
  |  Branch (362:33): [True: 82, False: 0]
  ------------------
  363|     82|                                strm->msg = (z_const char *)
  364|     82|                                    "invalid distance too far back";
  365|     82|                                state->mode = BAD;
  366|     82|                                break;
  367|     82|                            }
  368|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
  369|       |                            if (len <= op - whave) {
  370|       |                                do {
  371|       |                                    *out++ = 0;
  372|       |                                } while (--len);
  373|       |                                continue;
  374|       |                            }
  375|       |                            len -= op - whave;
  376|       |                            do {
  377|       |                                *out++ = 0;
  378|       |                            } while (--op > whave);
  379|       |                            if (op == 0) {
  380|       |                                out = copy_back(out, dist, len);
  381|       |                                continue;
  382|       |                            }
  383|       |#endif
  384|     82|                        }
  385|  23.9k|                        from = window;
  386|  23.9k|                        if (wnext == 0)         /* very common case */
  ------------------
  |  Branch (386:29): [True: 6.10k, False: 17.8k]
  ------------------
  387|  6.10k|                            from += wsize - op;
  388|  17.8k|                        else if (wnext < op) {  /* wrap around window */
  ------------------
  |  Branch (388:34): [True: 156, False: 17.6k]
  ------------------
  389|    156|                            from += wsize + wnext - op;
  390|    156|                            op -= wnext;
  391|    156|                            if (op < len) {     /* end of window, then start */
  ------------------
  |  Branch (391:33): [True: 6, False: 150]
  ------------------
  392|      6|                                zmemcpy(out, from, op);
  ------------------
  |  |  306|      6|#    define zmemcpy memcpy
  ------------------
  393|      6|                                out += op;
  394|      6|                                len -= op;
  395|      6|                                from = window;
  396|      6|                                op = wnext;
  397|      6|                            }
  398|    156|                        }
  399|  17.6k|                        else                    /* contiguous in window */
  400|  17.6k|                            from += wnext - op;
  401|  23.9k|                        if (op > len)
  ------------------
  |  Branch (401:29): [True: 22.5k, False: 1.42k]
  ------------------
  402|  22.5k|                            op = len;
  403|  23.9k|                        zmemcpy(out, from, op); /* from the window */
  ------------------
  |  |  306|  23.9k|#    define zmemcpy memcpy
  ------------------
  404|  23.9k|                        out += op;
  405|  23.9k|                        len -= op;
  406|  23.9k|                        if (len)                /* rest from output */
  ------------------
  |  Branch (406:29): [True: 1.35k, False: 22.5k]
  ------------------
  407|  1.35k|                            out = copy_back(out, dist, len);
  408|  23.9k|                    }
  409|  1.49M|                    else
  410|  1.49M|                        out = copy_back(out, dist, len);
  411|  1.51M|                }
  412|  8.96k|                else if ((op & 64) == 0) {      /* 2nd level distance code */
  ------------------
  |  Branch (412:26): [True: 8.94k, False: 12]
  ------------------
  413|  8.94k|                    here = dcode + here->val + (hold8 & ((1U << op) - 1));
  414|  8.94k|                    goto dodist8;
  415|  8.94k|                }
  416|     12|                else {
  417|     12|                    strm->msg = (z_const char *)"invalid distance code";
  418|     12|                    state->mode = BAD;
  419|     12|                    break;
  420|     12|                }
  421|  1.52M|            }
  422|  14.2k|            else if ((op & 64) == 0) {          /* 2nd level length code */
  ------------------
  |  Branch (422:22): [True: 11.6k, False: 2.66k]
  ------------------
  423|  11.6k|                here = lcode + here->val + (hold8 & ((1U << op) - 1));
  424|  11.6k|                goto dolen8;
  425|  11.6k|            }
  426|  2.66k|            else if (op & 32) {                 /* end-of-block */
  ------------------
  |  Branch (426:22): [True: 2.65k, False: 3]
  ------------------
  427|  2.65k|                Tracevv((stderr, "inflate:         end of block\n"));
  428|  2.65k|                state->mode = TYPE;
  429|  2.65k|                break;
  430|  2.65k|            }
  431|      3|            else {
  432|      3|                strm->msg = (z_const char *)"invalid literal/length code";
  433|      3|                state->mode = BAD;
  434|      3|                break;
  435|      3|            }
  436|  1.82M|        } while (in <= last8 && out <= end8);
  ------------------
  |  Branch (436:18): [True: 1.80M, False: 22.5k]
  |  Branch (436:33): [True: 1.80M, False: 554]
  ------------------
  437|       |
  438|       |        /* return the whole bytes not used, leaving fewer than eight bits */
  439|  25.9k|        len = bits >> 3;
  440|  25.9k|        in -= len;
  441|  25.9k|        bits -= len << 3;
  442|  25.9k|        hold = (unsigned long)(hold8 & ((1U << bits) - 1));
  443|  25.9k|        if (state->mode != LEN || out >= end)
  ------------------
  |  Branch (443:13): [True: 2.75k, False: 23.1k]
  |  Branch (443:35): [True: 314, False: 22.8k]
  ------------------
  444|  3.06k|            goto leave;
  445|  25.9k|    }
  446|   158k|#endif
  447|       |#if Z_INFLATE_FETCH == 32
  448|       |    /* Fast loop with a 32-bit bit buffer, refilled four bytes at a time
  449|       |       without branches. This needs eleven bytes available at in (three refills
  450|       |       of four bytes, the first two advancing in by up to three each) and
  451|       |       enough room in the output for the longest match plus 15 bytes (an
  452|       |       iteration writes up to two literals or one match, which copy_back() may
  453|       |       overrun by fifteen bytes). A refill leaves at least 24 bits, enough for
  454|       |       a length/literal code and its extra bits (at most 20), or a distance
  455|       |       code (at most 15). The distance code gets its own refill, and its extra
  456|       |       bits another refill, when too few bits are left for them. */
  457|       |    if (!back && strm->avail_in >= 11 && strm->avail_out >= 258 + 15) {
  458|       |        last4 = in + (strm->avail_in - 11);
  459|       |        end4 = out + (strm->avail_out - (258 + 15));
  460|       |        hold4 = (Z_U4)hold;
  461|       |        do {
  462|       |            hold4 |= load32(in) << bits;
  463|       |            in += (31 - bits) >> 3;
  464|       |            bits |= 24;
  465|       |            here = lcode + (hold4 & lmask);
  466|       |            if (here->op == 0) {        /* a literal, and another */
  467|       |                hold4 >>= here->bits;
  468|       |                bits -= here->bits;
  469|       |                TRACE_LITERAL(here);
  470|       |                *out++ = (unsigned char)(here->val);
  471|       |                here = lcode + (hold4 & lmask);
  472|       |                if (here->op == 0 && (LENBITS <= 12 || here->bits <= bits)) {
  473|       |                    hold4 >>= here->bits;
  474|       |                    bits -= here->bits;
  475|       |                    TRACE_LITERAL(here);
  476|       |                    *out++ = (unsigned char)(here->val);
  477|       |                }
  478|       |                continue;
  479|       |            }
  480|       |          dolen4:
  481|       |            op = (unsigned)(here->bits);
  482|       |            hold4 >>= op;
  483|       |            bits -= op;
  484|       |            op = (unsigned)(here->op);
  485|       |            if (op == 0) {                      /* literal */
  486|       |                TRACE_LITERAL(here);
  487|       |                *out++ = (unsigned char)(here->val);
  488|       |            }
  489|       |            else if (op & 16) {                 /* length base */
  490|       |                len = (unsigned)(here->val);
  491|       |                op &= 15;                       /* number of extra bits */
  492|       |                len += (unsigned)hold4 & ((1U << op) - 1);
  493|       |                hold4 >>= op;
  494|       |                bits -= op;
  495|       |                Tracevv((stderr, "inflate:         length %u\n", len));
  496|       |                hold4 |= load32(in) << bits;    /* for the distance code */
  497|       |                in += (31 - bits) >> 3;
  498|       |                bits |= 24;
  499|       |                here = dcode + (hold4 & dmask);
  500|       |              dodist4:
  501|       |                op = (unsigned)(here->bits);
  502|       |                hold4 >>= op;
  503|       |                bits -= op;
  504|       |                op = (unsigned)(here->op);
  505|       |                if (op & 16) {                  /* distance base */
  506|       |                    dist = (unsigned)(here->val);
  507|       |                    op &= 15;                   /* number of extra bits */
  508|       |                    if (bits < op) {            /* for long distances */
  509|       |                        hold4 |= load32(in) << bits;
  510|       |                        in += (31 - bits) >> 3;
  511|       |                        bits |= 24;
  512|       |                    }
  513|       |                    dist += (unsigned)hold4 & ((1U << op) - 1);
  514|       |#ifdef INFLATE_STRICT
  515|       |                    if (dist > dmax) {
  516|       |                        strm->msg = (z_const char *)
  517|       |                            "invalid distance too far back";
  518|       |                        state->mode = BAD;
  519|       |                        break;
  520|       |                    }
  521|       |#endif
  522|       |                    hold4 >>= op;
  523|       |                    bits -= op;
  524|       |                    Tracevv((stderr, "inflate:         distance %u\n", dist));
  525|       |                    op = (unsigned)(out - beg); /* max distance in output */
  526|       |                    if (dist > op) {            /* see if copy from window */
  527|       |                        op = dist - op;         /* distance back in window */
  528|       |                        if (op > whave) {
  529|       |                            if (state->sane) {
  530|       |                                strm->msg = (z_const char *)
  531|       |                                    "invalid distance too far back";
  532|       |                                state->mode = BAD;
  533|       |                                break;
  534|       |                            }
  535|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
  536|       |                            if (len <= op - whave) {
  537|       |                                do {
  538|       |                                    *out++ = 0;
  539|       |                                } while (--len);
  540|       |                                continue;
  541|       |                            }
  542|       |                            len -= op - whave;
  543|       |                            do {
  544|       |                                *out++ = 0;
  545|       |                            } while (--op > whave);
  546|       |                            if (op == 0) {
  547|       |                                out = copy_back(out, dist, len);
  548|       |                                continue;
  549|       |                            }
  550|       |#endif
  551|       |                        }
  552|       |                        from = window;
  553|       |                        if (wnext == 0)         /* very common case */
  554|       |                            from += wsize - op;
  555|       |                        else if (wnext < op) {  /* wrap around window */
  556|       |                            from += wsize + wnext - op;
  557|       |                            op -= wnext;
  558|       |                            if (op < len) {     /* end of window, then start */
  559|       |                                zmemcpy(out, from, op);
  560|       |                                out += op;
  561|       |                                len -= op;
  562|       |                                from = window;
  563|       |                                op = wnext;
  564|       |                            }
  565|       |                        }
  566|       |                        else                    /* contiguous in window */
  567|       |                            from += wnext - op;
  568|       |                        if (op > len)
  569|       |                            op = len;
  570|       |                        zmemcpy(out, from, op); /* from the window */
  571|       |                        out += op;
  572|       |                        len -= op;
  573|       |                        if (len)                /* rest from output */
  574|       |                            out = copy_back(out, dist, len);
  575|       |                    }
  576|       |                    else
  577|       |                        out = copy_back(out, dist, len);
  578|       |                }
  579|       |                else if ((op & 64) == 0) {      /* 2nd level distance code */
  580|       |                    here = dcode + here->val + (hold4 & ((1U << op) - 1));
  581|       |                    goto dodist4;
  582|       |                }
  583|       |                else {
  584|       |                    strm->msg = (z_const char *)"invalid distance code";
  585|       |                    state->mode = BAD;
  586|       |                    break;
  587|       |                }
  588|       |            }
  589|       |            else if ((op & 64) == 0) {          /* 2nd level length code */
  590|       |                here = lcode + here->val + (hold4 & ((1U << op) - 1));
  591|       |                goto dolen4;
  592|       |            }
  593|       |            else if (op & 32) {                 /* end-of-block */
  594|       |                Tracevv((stderr, "inflate:         end of block\n"));
  595|       |                state->mode = TYPE;
  596|       |                break;
  597|       |            }
  598|       |            else {
  599|       |                strm->msg = (z_const char *)"invalid literal/length code";
  600|       |                state->mode = BAD;
  601|       |                break;
  602|       |            }
  603|       |        } while (in <= last4 && out <= end4);
  604|       |
  605|       |        /* return the whole bytes not used, leaving fewer than eight bits */
  606|       |        len = bits >> 3;
  607|       |        in -= len;
  608|       |        bits -= len << 3;
  609|       |        hold = (unsigned long)(hold4 & ((1U << bits) - 1));
  610|       |        if (state->mode != LEN || in >= last || out >= end)
  611|       |            goto leave;
  612|       |    }
  613|       |#endif
  614|       |
  615|       |    /* decode literals and length/distances until end-of-block or not enough
  616|       |       input data or output space */
  617|   489k|    do {
  618|   489k|        if (bits < 15) {
  ------------------
  |  Branch (618:13): [True: 301k, False: 187k]
  ------------------
  619|   301k|            hold += (unsigned long)(*in++) << bits;
  620|   301k|            bits += 8;
  621|   301k|            hold += (unsigned long)(*in++) << bits;
  622|   301k|            bits += 8;
  623|   301k|        }
  624|   489k|        here = lcode + (hold & lmask);
  625|   489k|      dolen:
  626|   489k|        op = (unsigned)(here->bits);
  627|   489k|        hold >>= op;
  628|   489k|        bits -= op;
  629|   489k|        op = (unsigned)(here->op);
  630|   489k|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (630:13): [True: 306k, False: 182k]
  ------------------
  631|   306k|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  632|   306k|                    "inflate:         literal '%c'\n" :
  633|   306k|                    "inflate:         literal 0x%02x\n", here->val));
  634|   306k|            *out++ = (unsigned char)(here->val);
  635|   306k|        }
  636|   182k|        else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (636:18): [True: 180k, False: 2.49k]
  ------------------
  637|   180k|            len = (unsigned)(here->val);
  638|   180k|            op &= 15;                           /* number of extra bits */
  639|   180k|            if (op) {
  ------------------
  |  Branch (639:17): [True: 48.9k, False: 131k]
  ------------------
  640|  48.9k|                if (bits < op) {
  ------------------
  |  Branch (640:21): [True: 46, False: 48.9k]
  ------------------
  641|     46|                    hold += (unsigned long)(*in++) << bits;
  642|     46|                    bits += 8;
  643|     46|                }
  644|  48.9k|                len += (unsigned)hold & ((1U << op) - 1);
  645|  48.9k|                hold >>= op;
  646|  48.9k|                bits -= op;
  647|  48.9k|            }
  648|   180k|            Tracevv((stderr, "inflate:         length %u\n", len));
  649|   180k|            if (bits < 15) {
  ------------------
  |  Branch (649:17): [True: 113k, False: 67.3k]
  ------------------
  650|   113k|                hold += (unsigned long)(*in++) << bits;
  651|   113k|                bits += 8;
  652|   113k|                hold += (unsigned long)(*in++) << bits;
  653|   113k|                bits += 8;
  654|   113k|            }
  655|   180k|            here = dcode + (hold & dmask);
  656|   181k|          dodist:
  657|   181k|            op = (unsigned)(here->bits);
  658|   181k|            hold >>= op;
  659|   181k|            bits -= op;
  660|   181k|            op = (unsigned)(here->op);
  661|   181k|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (661:17): [True: 180k, False: 860]
  ------------------
  662|   180k|                dist = (unsigned)(here->val);
  663|   180k|                op &= 15;                       /* number of extra bits */
  664|   180k|                if (bits < op) {
  ------------------
  |  Branch (664:21): [True: 114, False: 180k]
  ------------------
  665|    114|                    hold += (unsigned long)(*in++) << bits;
  666|    114|                    bits += 8;
  667|    114|                    if (bits < op) {
  ------------------
  |  Branch (667:25): [True: 0, False: 114]
  ------------------
  668|      0|                        hold += (unsigned long)(*in++) << bits;
  669|      0|                        bits += 8;
  670|      0|                    }
  671|    114|                }
  672|   180k|                dist += (unsigned)hold & ((1U << op) - 1);
  673|       |#ifdef INFLATE_STRICT
  674|       |                if (dist > dmax) {
  675|       |                    strm->msg = (z_const char *)
  676|       |                        "invalid distance too far back";
  677|       |                    state->mode = BAD;
  678|       |                    break;
  679|       |                }
  680|       |#endif
  681|   180k|                hold >>= op;
  682|   180k|                bits -= op;
  683|   180k|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  684|   180k|                op = (unsigned)(out - beg);     /* max distance in output */
  685|   180k|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (685:21): [True: 127k, False: 53.3k]
  ------------------
  686|   127k|                    op = dist - op;             /* distance back in window */
  687|   127k|                    if (op > whave) {
  ------------------
  |  Branch (687:25): [True: 63, False: 127k]
  ------------------
  688|     63|                        if (state->sane) {
  ------------------
  |  Branch (688:29): [True: 63, False: 0]
  ------------------
  689|     63|                            strm->msg = (z_const char *)
  690|     63|                                "invalid distance too far back";
  691|     63|                            state->mode = BAD;
  692|     63|                            break;
  693|     63|                        }
  694|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
  695|       |                        if (len <= op - whave) {
  696|       |                            do {
  697|       |                                *out++ = 0;
  698|       |                            } while (--len);
  699|       |                            continue;
  700|       |                        }
  701|       |                        len -= op - whave;
  702|       |                        do {
  703|       |                            *out++ = 0;
  704|       |                        } while (--op > whave);
  705|       |                        if (op == 0) {
  706|       |                            from = out - dist;
  707|       |                            do {
  708|       |                                *out++ = *from++;
  709|       |                            } while (--len);
  710|       |                            continue;
  711|       |                        }
  712|       |#endif
  713|     63|                    }
  714|   127k|                    from = window;
  715|   127k|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (715:25): [True: 233, False: 126k]
  ------------------
  716|    233|                        from += wsize - op;
  717|    233|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (717:29): [True: 60, False: 173]
  ------------------
  718|     60|                            len -= op;
  719|  6.37k|                            do {
  720|  6.37k|                                *out++ = *from++;
  721|  6.37k|                            } while (--op);
  ------------------
  |  Branch (721:38): [True: 6.31k, False: 60]
  ------------------
  722|     60|                            from = out - dist;  /* rest from output */
  723|     60|                        }
  724|    233|                    }
  725|   126k|                    else if (wnext < op) {      /* wrap around window */
  ------------------
  |  Branch (725:30): [True: 1.76k, False: 125k]
  ------------------
  726|  1.76k|                        from += wsize + wnext - op;
  727|  1.76k|                        op -= wnext;
  728|  1.76k|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (728:29): [True: 59, False: 1.70k]
  ------------------
  729|     59|                            len -= op;
  730|    852|                            do {
  731|    852|                                *out++ = *from++;
  732|    852|                            } while (--op);
  ------------------
  |  Branch (732:38): [True: 793, False: 59]
  ------------------
  733|     59|                            from = window;
  734|     59|                            if (wnext < len) {  /* some from start of window */
  ------------------
  |  Branch (734:33): [True: 10, False: 49]
  ------------------
  735|     10|                                op = wnext;
  736|     10|                                len -= op;
  737|    107|                                do {
  738|    107|                                    *out++ = *from++;
  739|    107|                                } while (--op);
  ------------------
  |  Branch (739:42): [True: 97, False: 10]
  ------------------
  740|     10|                                from = out - dist;      /* rest from output */
  741|     10|                            }
  742|     59|                        }
  743|  1.76k|                    }
  744|   125k|                    else {                      /* contiguous in window */
  745|   125k|                        from += wnext - op;
  746|   125k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (746:29): [True: 1.36k, False: 123k]
  ------------------
  747|  1.36k|                            len -= op;
  748|  7.10k|                            do {
  749|  7.10k|                                *out++ = *from++;
  750|  7.10k|                            } while (--op);
  ------------------
  |  Branch (750:38): [True: 5.73k, False: 1.36k]
  ------------------
  751|  1.36k|                            from = out - dist;  /* rest from output */
  752|  1.36k|                        }
  753|   125k|                    }
  754|   580k|                    while (len > 2) {
  ------------------
  |  Branch (754:28): [True: 453k, False: 127k]
  ------------------
  755|   453k|                        *out++ = *from++;
  756|   453k|                        *out++ = *from++;
  757|   453k|                        *out++ = *from++;
  758|   453k|                        len -= 3;
  759|   453k|                    }
  760|   127k|                    if (len) {
  ------------------
  |  Branch (760:25): [True: 82.1k, False: 44.8k]
  ------------------
  761|  82.1k|                        *out++ = *from++;
  762|  82.1k|                        if (len > 1)
  ------------------
  |  Branch (762:29): [True: 44.1k, False: 37.9k]
  ------------------
  763|  44.1k|                            *out++ = *from++;
  764|  82.1k|                    }
  765|   127k|                }
  766|  53.3k|                else {
  767|  53.3k|                    from = out - dist;          /* copy direct from output */
  768|  1.45M|                    do {                        /* minimum length is three */
  769|  1.45M|                        *out++ = *from++;
  770|  1.45M|                        *out++ = *from++;
  771|  1.45M|                        *out++ = *from++;
  772|  1.45M|                        len -= 3;
  773|  1.45M|                    } while (len > 2);
  ------------------
  |  Branch (773:30): [True: 1.39M, False: 53.3k]
  ------------------
  774|  53.3k|                    if (len) {
  ------------------
  |  Branch (774:25): [True: 32.8k, False: 20.5k]
  ------------------
  775|  32.8k|                        *out++ = *from++;
  776|  32.8k|                        if (len > 1)
  ------------------
  |  Branch (776:29): [True: 5.59k, False: 27.2k]
  ------------------
  777|  5.59k|                            *out++ = *from++;
  778|  32.8k|                    }
  779|  53.3k|                }
  780|   180k|            }
  781|    860|            else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (781:22): [True: 851, False: 9]
  ------------------
  782|    851|                here = dcode + here->val + (hold & ((1U << op) - 1));
  783|    851|                goto dodist;
  784|    851|            }
  785|      9|            else {
  786|      9|                strm->msg = (z_const char *)"invalid distance code";
  787|      9|                state->mode = BAD;
  788|      9|                break;
  789|      9|            }
  790|   181k|        }
  791|  2.49k|        else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (791:18): [True: 606, False: 1.88k]
  ------------------
  792|    606|            here = lcode + here->val + (hold & ((1U << op) - 1));
  793|    606|            goto dolen;
  794|    606|        }
  795|  1.88k|        else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (795:18): [True: 1.88k, False: 3]
  ------------------
  796|  1.88k|            Tracevv((stderr, "inflate:         end of block\n"));
  797|  1.88k|            state->mode = TYPE;
  798|  1.88k|            break;
  799|  1.88k|        }
  800|      3|        else {
  801|      3|            strm->msg = (z_const char *)"invalid literal/length code";
  802|      3|            state->mode = BAD;
  803|      3|            break;
  804|      3|        }
  805|   489k|    } while (in < last && out < end);
  ------------------
  |  Branch (805:14): [True: 331k, False: 155k]
  |  Branch (805:27): [True: 331k, False: 309]
  ------------------
  806|       |
  807|   158k|#if Z_INFLATE_FETCH != 8
  808|   161k|  leave:
  809|   161k|#endif
  810|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  811|   161k|    len = bits >> 3;
  812|   161k|    in -= len;
  813|   161k|    bits -= len << 3;
  814|   161k|    hold &= (1U << bits) - 1;
  815|       |
  816|       |    /* update state and return */
  817|   161k|    strm->next_in = in;
  818|   161k|    strm->next_out = out;
  819|   161k|    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
  ------------------
  |  Branch (819:33): [True: 105k, False: 55.7k]
  ------------------
  820|   161k|    strm->avail_out = (unsigned)(out < end ?
  ------------------
  |  Branch (820:34): [True: 160k, False: 642]
  ------------------
  821|   160k|                                 257 + (end - out) : 257 - (out - end));
  822|   161k|    state->hold = hold;
  823|   161k|    state->bits = bits;
  824|   161k|    return;
  825|   158k|}
inffast.c:load64:
   76|  2.24M|local Z_U8 load64(z_const unsigned char FAR *p) {
   77|  2.24M|#ifndef Z_INFLATE_BYTES
   78|  2.24M|    Z_U8 v = 1;
  ------------------
  |  |   56|  2.24M|#    define Z_U8 unsigned long
  ------------------
   79|  2.24M|    if (*(unsigned char *)&v) {
  ------------------
  |  Branch (79:9): [True: 2.24M, False: 0]
  ------------------
   80|  2.24M|        zmemcpy(&v, p, 8);
  ------------------
  |  |  306|  2.24M|#    define zmemcpy memcpy
  ------------------
   81|  2.24M|        return v;
   82|  2.24M|    }
   83|      0|#  ifdef Z_BSWAP64
   84|      0|    zmemcpy(&v, p, 8);
  ------------------
  |  |  306|      0|#    define zmemcpy memcpy
  ------------------
   85|      0|    return Z_BSWAP64(v);
  ------------------
  |  |   65|      0|#    define Z_BSWAP64 __builtin_bswap64
  ------------------
   86|      0|#  endif
   87|      0|#endif
   88|      0|    return (Z_U8)p[0] | ((Z_U8)p[1] << 8) | ((Z_U8)p[2] << 16) |
   89|      0|           ((Z_U8)p[3] << 24) | ((Z_U8)p[4] << 32) | ((Z_U8)p[5] << 40) |
   90|      0|           ((Z_U8)p[6] << 48) | ((Z_U8)p[7] << 56);
   91|  2.24M|}
inffast.c:copy_back:
   98|  1.49M|                                   unsigned len) {
   99|  1.49M|    unsigned char FAR *from = out - dist;
  100|  1.49M|    unsigned char FAR *stop = out + len;
  101|       |
  102|  1.49M|    if (dist >= 16) {                   /* sixteen at a time, no overlap */
  ------------------
  |  Branch (102:9): [True: 889k, False: 603k]
  ------------------
  103|  2.14M|        do {
  104|  2.14M|            zmemcpy(out, from, 16);
  ------------------
  |  |  306|  2.14M|#    define zmemcpy memcpy
  ------------------
  105|  2.14M|            out += 16;
  106|  2.14M|            from += 16;
  107|  2.14M|        } while (out < stop);
  ------------------
  |  Branch (107:18): [True: 1.25M, False: 889k]
  ------------------
  108|   889k|        return stop;
  109|   889k|    }
  110|   603k|    if (dist >= 8) {                    /* eight at a time, no overlap */
  ------------------
  |  Branch (110:9): [True: 266k, False: 337k]
  ------------------
  111|   454k|        do {
  112|   454k|            zmemcpy(out, from, 8);
  ------------------
  |  |  306|   454k|#    define zmemcpy memcpy
  ------------------
  113|   454k|            out += 8;
  114|   454k|            from += 8;
  115|   454k|        } while (out < stop);
  ------------------
  |  Branch (115:18): [True: 187k, False: 266k]
  ------------------
  116|   266k|        return stop;
  117|   266k|    }
  118|   337k|    if (dist == 1) {                    /* a run of one byte, eight at once */
  ------------------
  |  Branch (118:9): [True: 77.5k, False: 259k]
  ------------------
  119|  77.5k|#ifdef Z_U8
  120|  77.5k|        Z_U8 run = *from;
  ------------------
  |  |   56|  77.5k|#    define Z_U8 unsigned long
  ------------------
  121|  77.5k|        run |= run << 8;
  122|  77.5k|        run |= run << 16;
  123|  77.5k|        run |= run << 32;
  124|  2.12M|        do {
  125|  2.12M|            zmemcpy(out, &run, 8);
  ------------------
  |  |  306|  2.12M|#    define zmemcpy memcpy
  ------------------
  126|  2.12M|            out += 8;
  127|  2.12M|        } while (out < stop);
  ------------------
  |  Branch (127:18): [True: 2.05M, False: 77.5k]
  ------------------
  128|       |#else
  129|       |        Z_U4 run = *from;
  130|       |        run |= run << 8;
  131|       |        run |= run << 16;
  132|       |        do {
  133|       |            zmemcpy(out, &run, 4);
  134|       |            zmemcpy(out + 4, &run, 4);
  135|       |            out += 8;
  136|       |        } while (out < stop);
  137|       |#endif
  138|  77.5k|        return stop;
  139|  77.5k|    }
  140|       |    /* dist 2..7: eight bytes per step, of which the first dist are right;
  141|       |       the next step rewrites the rest. All eight are read before any are
  142|       |       written, since they overlap. */
  143|  3.16M|    do {
  144|  3.16M|#ifdef Z_U8
  145|  3.16M|        Z_U8 v;
  ------------------
  |  |   56|  3.16M|#    define Z_U8 unsigned long
  ------------------
  146|  3.16M|        zmemcpy(&v, from, 8);
  ------------------
  |  |  306|  3.16M|#    define zmemcpy memcpy
  ------------------
  147|  3.16M|        zmemcpy(out, &v, 8);
  ------------------
  |  |  306|  3.16M|#    define zmemcpy memcpy
  ------------------
  148|       |#else
  149|       |        Z_U4 v0, v1;
  150|       |        zmemcpy(&v0, from, 4);
  151|       |        zmemcpy(&v1, from + 4, 4);
  152|       |        zmemcpy(out, &v0, 4);
  153|       |        zmemcpy(out + 4, &v1, 4);
  154|       |#endif
  155|  3.16M|        out += dist;
  156|  3.16M|        from += dist;
  157|  3.16M|    } while (out < stop);
  ------------------
  |  Branch (157:14): [True: 2.90M, False: 259k]
  ------------------
  158|   259k|    return stop;
  159|   337k|}

inflateResetKeep:
  100|  4.67k|int ZEXPORT inflateResetKeep(z_streamp strm) {
  101|  4.67k|    struct inflate_state FAR *state;
  102|       |
  103|  4.67k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (103:9): [True: 0, False: 4.67k]
  ------------------
  104|  4.67k|    state = (struct inflate_state FAR *)strm->state;
  105|  4.67k|    strm->total_in = strm->total_out = state->total = 0;
  106|  4.67k|    strm->msg = Z_NULL;
  ------------------
  |  |  216|  4.67k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  107|  4.67k|    strm->data_type = 0;
  108|  4.67k|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (108:9): [True: 4.67k, False: 0]
  ------------------
  109|  4.67k|        strm->adler = state->wrap & 1;
  110|  4.67k|    state->mode = HEAD;
  111|  4.67k|    state->last = 0;
  112|  4.67k|    state->havedict = 0;
  113|  4.67k|    state->flags = -1;
  114|  4.67k|    state->dmax = 32768U;
  115|  4.67k|    state->head = Z_NULL;
  ------------------
  |  |  216|  4.67k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  116|  4.67k|    state->hold = 0;
  117|  4.67k|    state->bits = 0;
  118|  4.67k|    state->lencode = state->distcode = state->next = state->codes;
  119|  4.67k|    state->sane = 1;
  120|  4.67k|    state->back = -1;
  121|  4.67k|    Tracev((stderr, "inflate: reset\n"));
  122|  4.67k|    return Z_OK;
  ------------------
  |  |  181|  4.67k|#define Z_OK            0
  ------------------
  123|  4.67k|}
inflateReset:
  125|  4.67k|int ZEXPORT inflateReset(z_streamp strm) {
  126|  4.67k|    struct inflate_state FAR *state;
  127|       |
  128|  4.67k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (128:9): [True: 0, False: 4.67k]
  ------------------
  129|  4.67k|    state = (struct inflate_state FAR *)strm->state;
  130|  4.67k|    if (state->wbits != state->reqbits) {
  ------------------
  |  Branch (130:9): [True: 0, False: 4.67k]
  ------------------
  131|      0|        if (state->window != Z_NULL) {
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (131:13): [True: 0, False: 0]
  ------------------
  132|      0|            ZFREE(strm, state->window);
  ------------------
  |  |  344|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  133|      0|            state->window = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  134|      0|        }
  135|      0|        state->wbits = state->reqbits;
  136|      0|    }
  137|  4.67k|    state->wrap = state->reqwrap;
  138|  4.67k|    state->wsize = 0;
  139|  4.67k|    state->whave = 0;
  140|  4.67k|    state->wnext = 0;
  141|  4.67k|    return inflateResetKeep(strm);
  142|  4.67k|}
inflateReset2:
  144|  4.67k|int ZEXPORT inflateReset2(z_streamp strm, int windowBits) {
  145|  4.67k|    int wrap;
  146|  4.67k|    struct inflate_state FAR *state;
  147|       |
  148|       |    /* get the state */
  149|  4.67k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (149:9): [True: 0, False: 4.67k]
  ------------------
  150|  4.67k|    state = (struct inflate_state FAR *)strm->state;
  151|       |
  152|       |    /* extract wrap request from windowBits parameter */
  153|  4.67k|    if (windowBits < 0) {
  ------------------
  |  Branch (153:9): [True: 0, False: 4.67k]
  ------------------
  154|      0|        if (windowBits < -15)
  ------------------
  |  Branch (154:13): [True: 0, False: 0]
  ------------------
  155|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  156|      0|        wrap = 0;
  157|      0|        windowBits = -windowBits;
  158|      0|    }
  159|  4.67k|    else {
  160|  4.67k|        wrap = (windowBits >> 4) + 5;
  161|  4.67k|#ifdef GUNZIP
  162|  4.67k|        if (windowBits < 48)
  ------------------
  |  Branch (162:13): [True: 4.67k, False: 0]
  ------------------
  163|  4.67k|            windowBits &= 15;
  164|  4.67k|#endif
  165|  4.67k|    }
  166|       |
  167|       |    /* set number of window bits, free window if different */
  168|  4.67k|    if (windowBits && (windowBits < 8 || windowBits > 15))
  ------------------
  |  Branch (168:9): [True: 4.67k, False: 0]
  |  Branch (168:24): [True: 0, False: 4.67k]
  |  Branch (168:42): [True: 0, False: 4.67k]
  ------------------
  169|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  170|  4.67k|    if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
  ------------------
  |  |  216|  9.35k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (170:9): [True: 0, False: 4.67k]
  |  Branch (170:36): [True: 0, False: 0]
  ------------------
  171|      0|        ZFREE(strm, state->window);
  ------------------
  |  |  344|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  172|      0|        state->window = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  173|      0|    }
  174|       |
  175|       |    /* update state and reset the rest of it */
  176|  4.67k|    state->reqwrap = state->wrap = wrap;
  177|  4.67k|    state->reqbits = state->wbits = (unsigned)windowBits;
  178|  4.67k|    return inflateReset(strm);
  179|  4.67k|}
inflateInit2_:
  182|  4.67k|                          const char *version, int stream_size) {
  183|  4.67k|    int ret;
  184|  4.67k|    struct inflate_state FAR *state;
  185|       |
  186|  4.67k|    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |  216|  9.35k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |   44|  4.67k|#define ZLIB_VERSION "1.4.0.1-motley"
  ------------------
  |  Branch (186:9): [True: 0, False: 4.67k]
  |  Branch (186:30): [True: 0, False: 4.67k]
  ------------------
  187|  4.67k|        stream_size != (int)(sizeof(z_stream)))
  ------------------
  |  Branch (187:9): [True: 0, False: 4.67k]
  ------------------
  188|      0|        return Z_VERSION_ERROR;
  ------------------
  |  |  189|      0|#define Z_VERSION_ERROR (-6)
  ------------------
  189|  4.67k|    if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  216|  4.67k|#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 (189:9): [True: 0, False: 4.67k]
  ------------------
  190|  4.67k|    strm->msg = Z_NULL;                 /* in case we return an error */
  ------------------
  |  |  216|  4.67k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  191|  4.67k|    if (strm->zalloc == (alloc_func)0) {
  ------------------
  |  Branch (191:9): [True: 4.67k, False: 0]
  ------------------
  192|       |#ifdef Z_SOLO
  193|       |        return Z_STREAM_ERROR;
  194|       |#else
  195|  4.67k|        strm->zalloc = zcalloc;
  196|  4.67k|        strm->opaque = (voidpf)0;
  197|  4.67k|#endif
  198|  4.67k|    }
  199|  4.67k|    if (strm->zfree == (free_func)0)
  ------------------
  |  Branch (199:9): [True: 4.67k, False: 0]
  ------------------
  200|       |#ifdef Z_SOLO
  201|       |        return Z_STREAM_ERROR;
  202|       |#else
  203|  4.67k|        strm->zfree = zcfree;
  204|  4.67k|#endif
  205|  4.67k|    state = (struct inflate_state FAR *)
  206|  4.67k|            ZALLOC(strm, 1, sizeof(struct inflate_state));
  ------------------
  |  |  343|  4.67k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  207|  4.67k|    if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  216|  4.67k|#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 (207:9): [True: 0, False: 4.67k]
  ------------------
  208|  4.67k|    zmemzero(state, sizeof(struct inflate_state));
  ------------------
  |  |  308|  4.67k|#    define zmemzero(dest, len) memset(dest, 0, len)
  ------------------
  209|  4.67k|    Tracev((stderr, "inflate: allocated\n"));
  210|  4.67k|    strm->state = (struct internal_state FAR *)state;
  211|  4.67k|    state->strm = strm;
  212|  4.67k|    state->window = Z_NULL;
  ------------------
  |  |  216|  4.67k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  213|  4.67k|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  214|  4.67k|    ret = inflateReset2(strm, windowBits);
  215|  4.67k|    if (ret != Z_OK) {
  ------------------
  |  |  181|  4.67k|#define Z_OK            0
  ------------------
  |  Branch (215:9): [True: 0, False: 4.67k]
  ------------------
  216|      0|        ZFREE(strm, state);
  ------------------
  |  |  344|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  217|      0|        strm->state = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  218|      0|    }
  219|  4.67k|    return ret;
  220|  4.67k|}
inflateInit_:
  223|  4.67k|                         int stream_size) {
  224|  4.67k|    return inflateInit2_(strm, DEF_WBITS, version, stream_size);
  ------------------
  |  |  166|  4.67k|#  define DEF_WBITS MAX_WBITS
  |  |  ------------------
  |  |  |  |  287|  4.67k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  |  |  ------------------
  ------------------
  225|  4.67k|}
inflate:
  482|   119k|int ZEXPORT inflate(z_streamp strm, int flush) {
  483|   119k|    struct inflate_state FAR *state;
  484|   119k|    z_const unsigned char FAR *next;    /* next input */
  485|   119k|    unsigned char FAR *put;     /* next output */
  486|   119k|    unsigned have, left;        /* available input and output */
  487|   119k|    unsigned long hold;         /* bit buffer */
  488|   119k|    unsigned bits;              /* bits in bit buffer */
  489|   119k|    unsigned in, out;           /* save starting available input and output */
  490|   119k|    unsigned copy;              /* number of stored or match bytes to copy */
  491|   119k|    unsigned char FAR *from;    /* where to copy match bytes from */
  492|   119k|    code here;                  /* current decoding table entry */
  493|   119k|    code last;                  /* parent table entry */
  494|   119k|    unsigned len;               /* length to copy for repeats, bits to drop */
  495|   119k|    int ret;                    /* return code */
  496|   119k|#ifdef GUNZIP
  497|   119k|    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
  498|   119k|#endif
  499|   119k|    static const unsigned short order[19] = /* permutation of code lengths */
  500|   119k|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  501|       |
  502|   119k|    if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
  ------------------
  |  |  216|   238k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (502:9): [True: 0, False: 119k]
  |  Branch (502:36): [True: 0, False: 119k]
  ------------------
  503|   119k|        (strm->next_in == Z_NULL && strm->avail_in != 0))
  ------------------
  |  |  216|   238k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (503:10): [True: 0, False: 119k]
  |  Branch (503:37): [True: 0, False: 0]
  ------------------
  504|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  505|       |
  506|   119k|    state = (struct inflate_state FAR *)strm->state;
  507|   119k|    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */
  ------------------
  |  Branch (507:9): [True: 184, False: 119k]
  ------------------
  508|   119k|    LOAD();
  ------------------
  |  |  337|   119k|    do { \
  |  |  338|   119k|        put = strm->next_out; \
  |  |  339|   119k|        left = strm->avail_out; \
  |  |  340|   119k|        next = strm->next_in; \
  |  |  341|   119k|        have = strm->avail_in; \
  |  |  342|   119k|        hold = state->hold; \
  |  |  343|   119k|        bits = state->bits; \
  |  |  344|   119k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (344:14): [Folded, False: 119k]
  |  |  ------------------
  ------------------
  509|   119k|    in = have;
  510|   119k|    out = left;
  511|   119k|    ret = Z_OK;
  ------------------
  |  |  181|   119k|#define Z_OK            0
  ------------------
  512|   119k|    for (;;)
  513|  1.08M|        switch (state->mode) {
  514|  4.73k|        case HEAD:
  ------------------
  |  Branch (514:9): [True: 4.73k, False: 1.08M]
  ------------------
  515|  4.73k|            if (state->wrap == 0) {
  ------------------
  |  Branch (515:17): [True: 0, False: 4.73k]
  ------------------
  516|      0|                state->mode = TYPEDO;
  517|      0|                break;
  518|      0|            }
  519|  4.73k|            NEEDBITS(16);
  ------------------
  |  |  377|  4.73k|    do { \
  |  |  378|  14.0k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 9.40k, False: 4.64k]
  |  |  ------------------
  |  |  379|  9.40k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  9.40k|    do { \
  |  |  |  |  368|  9.40k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 89, False: 9.31k]
  |  |  |  |  ------------------
  |  |  |  |  369|  9.40k|        have--; \
  |  |  |  |  370|  9.31k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  9.31k|        bits += 8; \
  |  |  |  |  372|  9.31k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 9.31k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  4.73k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 4.64k]
  |  |  ------------------
  ------------------
  520|  4.64k|#ifdef GUNZIP
  521|  4.64k|            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
  ------------------
  |  Branch (521:17): [True: 0, False: 4.64k]
  |  Branch (521:38): [True: 0, False: 0]
  ------------------
  522|      0|                if (state->wbits == 0)
  ------------------
  |  Branch (522:21): [True: 0, False: 0]
  ------------------
  523|      0|                    state->wbits = 15;
  524|      0|                state->check = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  525|      0|                CRC2(state->check, hold);
  ------------------
  |  |  319|      0|    do { \
  |  |  320|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  321|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  322|      0|        check = crc32(check, hbuf, 2); \
  |  |  323|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (323:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  526|      0|                INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  527|      0|                state->mode = FLAGS;
  528|      0|                break;
  529|      0|            }
  530|  4.64k|            if (state->head != Z_NULL)
  ------------------
  |  |  216|  4.64k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (530:17): [True: 0, False: 4.64k]
  ------------------
  531|      0|                state->head->done = -1;
  532|  4.64k|            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
  ------------------
  |  Branch (532:17): [True: 0, False: 4.64k]
  ------------------
  533|       |#else
  534|       |            if (
  535|       |#endif
  536|  4.64k|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  384|  4.64k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  |  Branch (536:17): [True: 330, False: 4.31k]
  ------------------
  537|    330|                strm->msg = (z_const char *)"incorrect header check";
  538|    330|                state->mode = BAD;
  539|    330|                break;
  540|    330|            }
  541|  4.31k|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  384|  4.31k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  213|  4.31k|#define Z_DEFLATED   8
  ------------------
  |  Branch (541:17): [True: 71, False: 4.24k]
  ------------------
  542|     71|                strm->msg = (z_const char *)"unknown compression method";
  543|     71|                state->mode = BAD;
  544|     71|                break;
  545|     71|            }
  546|  4.24k|            DROPBITS(4);
  ------------------
  |  |  388|  4.24k|    do { \
  |  |  389|  4.24k|        hold >>= (n); \
  |  |  390|  4.24k|        bits -= (unsigned)(n); \
  |  |  391|  4.24k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 4.24k]
  |  |  ------------------
  ------------------
  547|  4.24k|            len = BITS(4) + 8;
  ------------------
  |  |  384|  4.24k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  548|  4.24k|            if (len > 15 || (state->wbits != 0 && len > state->wbits)) {
  ------------------
  |  Branch (548:17): [True: 18, False: 4.22k]
  |  Branch (548:30): [True: 4.22k, False: 0]
  |  Branch (548:51): [True: 0, False: 4.22k]
  ------------------
  549|     18|                strm->msg = (z_const char *)"invalid window size";
  550|     18|                state->mode = BAD;
  551|     18|                break;
  552|     18|            }
  553|  4.22k|            if (state->wbits == 0)
  ------------------
  |  Branch (553:17): [True: 0, False: 4.22k]
  ------------------
  554|      0|                state->wbits = len;
  555|  4.22k|            state->dmax = 1U << len;
  556|  4.22k|            state->flags = 0;               /* indicate zlib header */
  557|  4.22k|            Tracev((stderr, "inflate:   zlib header ok\n"));
  558|  4.22k|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  216|  4.22k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  559|  4.22k|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (559:27): [True: 60, False: 4.16k]
  ------------------
  560|  4.22k|            INITBITS();
  ------------------
  |  |  359|  4.22k|    do { \
  |  |  360|  4.22k|        hold = 0; \
  |  |  361|  4.22k|        bits = 0; \
  |  |  362|  4.22k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 4.22k]
  |  |  ------------------
  ------------------
  561|  4.22k|            break;
  562|      0|#ifdef GUNZIP
  563|      0|        case FLAGS:
  ------------------
  |  Branch (563:9): [True: 0, False: 1.08M]
  ------------------
  564|      0|            NEEDBITS(16);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  565|      0|            state->flags = (int)(hold);
  566|      0|            if ((state->flags & 0xff) != Z_DEFLATED) {
  ------------------
  |  |  213|      0|#define Z_DEFLATED   8
  ------------------
  |  Branch (566:17): [True: 0, False: 0]
  ------------------
  567|      0|                strm->msg = (z_const char *)"unknown compression method";
  568|      0|                state->mode = BAD;
  569|      0|                break;
  570|      0|            }
  571|      0|            if (state->flags & 0xe000) {
  ------------------
  |  Branch (571:17): [True: 0, False: 0]
  ------------------
  572|      0|                strm->msg = (z_const char *)"unknown header flags set";
  573|      0|                state->mode = BAD;
  574|      0|                break;
  575|      0|            }
  576|      0|            if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (576:17): [True: 0, False: 0]
  ------------------
  577|      0|                state->head->text = (int)((hold >> 8) & 1);
  578|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (578:17): [True: 0, False: 0]
  |  Branch (578:44): [True: 0, False: 0]
  ------------------
  579|      0|                CRC2(state->check, hold);
  ------------------
  |  |  319|      0|    do { \
  |  |  320|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  321|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  322|      0|        check = crc32(check, hbuf, 2); \
  |  |  323|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (323:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  580|      0|            INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  581|      0|            state->mode = TIME;
  582|       |                /* fallthrough */
  583|      0|        case TIME:
  ------------------
  |  Branch (583:9): [True: 0, False: 1.08M]
  ------------------
  584|      0|            NEEDBITS(32);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  585|      0|            if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (585:17): [True: 0, False: 0]
  ------------------
  586|      0|                state->head->time = hold;
  587|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (587:17): [True: 0, False: 0]
  |  Branch (587:44): [True: 0, False: 0]
  ------------------
  588|      0|                CRC4(state->check, hold);
  ------------------
  |  |  326|      0|    do { \
  |  |  327|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  328|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  329|      0|        hbuf[2] = (unsigned char)((word) >> 16); \
  |  |  330|      0|        hbuf[3] = (unsigned char)((word) >> 24); \
  |  |  331|      0|        check = crc32(check, hbuf, 4); \
  |  |  332|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (332:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  589|      0|            INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  590|      0|            state->mode = OS;
  591|       |                /* fallthrough */
  592|      0|        case OS:
  ------------------
  |  Branch (592:9): [True: 0, False: 1.08M]
  ------------------
  593|      0|            NEEDBITS(16);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  594|      0|            if (state->head != Z_NULL) {
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (594:17): [True: 0, False: 0]
  ------------------
  595|      0|                state->head->xflags = (int)(hold & 0xff);
  596|      0|                state->head->os = (int)(hold >> 8);
  597|      0|            }
  598|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (598:17): [True: 0, False: 0]
  |  Branch (598:44): [True: 0, False: 0]
  ------------------
  599|      0|                CRC2(state->check, hold);
  ------------------
  |  |  319|      0|    do { \
  |  |  320|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  321|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  322|      0|        check = crc32(check, hbuf, 2); \
  |  |  323|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (323:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  600|      0|            INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  601|      0|            state->mode = EXLEN;
  602|       |                /* fallthrough */
  603|      0|        case EXLEN:
  ------------------
  |  Branch (603:9): [True: 0, False: 1.08M]
  ------------------
  604|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (604:17): [True: 0, False: 0]
  ------------------
  605|      0|                NEEDBITS(16);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  606|      0|                state->length = (unsigned)(hold);
  607|      0|                if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (607:21): [True: 0, False: 0]
  ------------------
  608|      0|                    state->head->extra_len = (unsigned)hold;
  609|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (609:21): [True: 0, False: 0]
  |  Branch (609:48): [True: 0, False: 0]
  ------------------
  610|      0|                    CRC2(state->check, hold);
  ------------------
  |  |  319|      0|    do { \
  |  |  320|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  321|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  322|      0|        check = crc32(check, hbuf, 2); \
  |  |  323|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (323:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  611|      0|                INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  612|      0|            }
  613|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (613:22): [True: 0, False: 0]
  ------------------
  614|      0|                state->head->extra = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  615|      0|            state->mode = EXTRA;
  616|       |                /* fallthrough */
  617|      0|        case EXTRA:
  ------------------
  |  Branch (617:9): [True: 0, False: 1.08M]
  ------------------
  618|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (618:17): [True: 0, False: 0]
  ------------------
  619|      0|                copy = state->length;
  620|      0|                if (copy > have) copy = have;
  ------------------
  |  Branch (620:21): [True: 0, False: 0]
  ------------------
  621|      0|                if (copy) {
  ------------------
  |  Branch (621:21): [True: 0, False: 0]
  ------------------
  622|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (622:25): [True: 0, False: 0]
  ------------------
  623|      0|                        state->head->extra != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (623:25): [True: 0, False: 0]
  ------------------
  624|      0|                        (len = state->head->extra_len - state->length) <
  ------------------
  |  Branch (624:25): [True: 0, False: 0]
  ------------------
  625|      0|                            state->head->extra_max) {
  626|      0|                        zmemcpy(state->head->extra + len, next,
  ------------------
  |  |  306|      0|#    define zmemcpy memcpy
  ------------------
  627|      0|                                len + copy > state->head->extra_max ?
  ------------------
  |  Branch (627:33): [True: 0, False: 0]
  ------------------
  628|      0|                                state->head->extra_max - len : copy);
  629|      0|                    }
  630|      0|                    if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (630:25): [True: 0, False: 0]
  |  Branch (630:52): [True: 0, False: 0]
  ------------------
  631|      0|                        state->check = crc32(state->check, next, copy);
  632|      0|                    have -= copy;
  633|      0|                    next += copy;
  634|      0|                    state->length -= copy;
  635|      0|                }
  636|      0|                if (state->length) goto inf_leave;
  ------------------
  |  Branch (636:21): [True: 0, False: 0]
  ------------------
  637|      0|            }
  638|      0|            state->length = 0;
  639|      0|            state->mode = NAME;
  640|       |                /* fallthrough */
  641|      0|        case NAME:
  ------------------
  |  Branch (641:9): [True: 0, False: 1.08M]
  ------------------
  642|      0|            if (state->flags & 0x0800) {
  ------------------
  |  Branch (642:17): [True: 0, False: 0]
  ------------------
  643|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (643:21): [True: 0, False: 0]
  ------------------
  644|      0|                copy = 0;
  645|      0|                do {
  646|      0|                    len = (unsigned)(next[copy++]);
  647|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (647:25): [True: 0, False: 0]
  ------------------
  648|      0|                            state->head->name != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (648:29): [True: 0, False: 0]
  ------------------
  649|      0|                            state->length < state->head->name_max)
  ------------------
  |  Branch (649:29): [True: 0, False: 0]
  ------------------
  650|      0|                        state->head->name[state->length++] = (Bytef)len;
  651|      0|                } while (len && copy < have);
  ------------------
  |  Branch (651:26): [True: 0, False: 0]
  |  Branch (651:33): [True: 0, False: 0]
  ------------------
  652|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (652:21): [True: 0, False: 0]
  |  Branch (652:48): [True: 0, False: 0]
  ------------------
  653|      0|                    state->check = crc32(state->check, next, copy);
  654|      0|                have -= copy;
  655|      0|                next += copy;
  656|      0|                if (len) goto inf_leave;
  ------------------
  |  Branch (656:21): [True: 0, False: 0]
  ------------------
  657|      0|            }
  658|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (658:22): [True: 0, False: 0]
  ------------------
  659|      0|                state->head->name = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  660|      0|            state->length = 0;
  661|      0|            state->mode = COMMENT;
  662|       |                /* fallthrough */
  663|      0|        case COMMENT:
  ------------------
  |  Branch (663:9): [True: 0, False: 1.08M]
  ------------------
  664|      0|            if (state->flags & 0x1000) {
  ------------------
  |  Branch (664:17): [True: 0, False: 0]
  ------------------
  665|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (665:21): [True: 0, False: 0]
  ------------------
  666|      0|                copy = 0;
  667|      0|                do {
  668|      0|                    len = (unsigned)(next[copy++]);
  669|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (669:25): [True: 0, False: 0]
  ------------------
  670|      0|                            state->head->comment != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (670:29): [True: 0, False: 0]
  ------------------
  671|      0|                            state->length < state->head->comm_max)
  ------------------
  |  Branch (671:29): [True: 0, False: 0]
  ------------------
  672|      0|                        state->head->comment[state->length++] = (Bytef)len;
  673|      0|                } while (len && copy < have);
  ------------------
  |  Branch (673:26): [True: 0, False: 0]
  |  Branch (673:33): [True: 0, False: 0]
  ------------------
  674|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (674:21): [True: 0, False: 0]
  |  Branch (674:48): [True: 0, False: 0]
  ------------------
  675|      0|                    state->check = crc32(state->check, next, copy);
  676|      0|                have -= copy;
  677|      0|                next += copy;
  678|      0|                if (len) goto inf_leave;
  ------------------
  |  Branch (678:21): [True: 0, False: 0]
  ------------------
  679|      0|            }
  680|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (680:22): [True: 0, False: 0]
  ------------------
  681|      0|                state->head->comment = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  682|      0|            state->mode = HCRC;
  683|       |                /* fallthrough */
  684|      0|        case HCRC:
  ------------------
  |  Branch (684:9): [True: 0, False: 1.08M]
  ------------------
  685|      0|            if (state->flags & 0x0200) {
  ------------------
  |  Branch (685:17): [True: 0, False: 0]
  ------------------
  686|      0|                NEEDBITS(16);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  687|      0|                if ((state->wrap & 4) && hold != (state->check & 0xffff)) {
  ------------------
  |  Branch (687:21): [True: 0, False: 0]
  |  Branch (687:42): [True: 0, False: 0]
  ------------------
  688|      0|                    strm->msg = (z_const char *)"header crc mismatch";
  689|      0|                    state->mode = BAD;
  690|      0|                    break;
  691|      0|                }
  692|      0|                INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  693|      0|            }
  694|      0|            if (state->head != Z_NULL) {
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (694:17): [True: 0, False: 0]
  ------------------
  695|      0|                state->head->hcrc = (int)((state->flags >> 9) & 1);
  696|      0|                state->head->done = 1;
  697|      0|            }
  698|      0|            strm->adler = state->check = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  699|      0|            state->mode = TYPE;
  700|      0|            break;
  701|      0|#endif
  702|     69|        case DICTID:
  ------------------
  |  Branch (702:9): [True: 69, False: 1.08M]
  ------------------
  703|     69|            NEEDBITS(32);
  ------------------
  |  |  377|     69|    do { \
  |  |  378|    294|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 241, False: 53]
  |  |  ------------------
  |  |  379|    241|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|    241|    do { \
  |  |  |  |  368|    241|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 16, False: 225]
  |  |  |  |  ------------------
  |  |  |  |  369|    241|        have--; \
  |  |  |  |  370|    225|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|    225|        bits += 8; \
  |  |  |  |  372|    225|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 225]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|     69|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 53]
  |  |  ------------------
  ------------------
  704|     53|            strm->adler = state->check = ZSWAP32(hold);
  ------------------
  |  |  348|     53|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  349|     53|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
  705|     53|            INITBITS();
  ------------------
  |  |  359|     53|    do { \
  |  |  360|     53|        hold = 0; \
  |  |  361|     53|        bits = 0; \
  |  |  362|     53|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 53]
  |  |  ------------------
  ------------------
  706|     53|            state->mode = DICT;
  707|       |                /* fallthrough */
  708|    106|        case DICT:
  ------------------
  |  Branch (708:9): [True: 53, False: 1.08M]
  ------------------
  709|    106|            if (state->havedict == 0) {
  ------------------
  |  Branch (709:17): [True: 106, False: 0]
  ------------------
  710|    106|                RESTORE();
  ------------------
  |  |  348|    106|    do { \
  |  |  349|    106|        strm->next_out = put; \
  |  |  350|    106|        strm->avail_out = left; \
  |  |  351|    106|        strm->next_in = next; \
  |  |  352|    106|        strm->avail_in = have; \
  |  |  353|    106|        state->hold = hold; \
  |  |  354|    106|        state->bits = bits; \
  |  |  355|    106|    } while (0)
  |  |  ------------------
  |  |  |  Branch (355:14): [Folded, False: 106]
  |  |  ------------------
  ------------------
  711|    106|                strm->total_in += in - strm->avail_in;
  712|    106|                return Z_NEED_DICT;
  ------------------
  |  |  183|    106|#define Z_NEED_DICT     2
  ------------------
  713|    106|            }
  714|      0|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  715|      0|            state->mode = TYPE;
  716|       |                /* fallthrough */
  717|  10.8k|        case TYPE:
  ------------------
  |  Branch (717:9): [True: 10.8k, False: 1.07M]
  ------------------
  718|  10.8k|            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  177|  21.6k|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  10.8k|#define Z_TREES         6
  ------------------
  |  Branch (718:17): [True: 0, False: 10.8k]
  |  Branch (718:37): [True: 0, False: 10.8k]
  ------------------
  719|       |                /* fallthrough */
  720|  11.0k|        case TYPEDO:
  ------------------
  |  Branch (720:9): [True: 187, False: 1.08M]
  ------------------
  721|  11.0k|            if (state->last) {
  ------------------
  |  Branch (721:17): [True: 978, False: 10.0k]
  ------------------
  722|    978|                BYTEBITS();
  ------------------
  |  |  395|    978|    do { \
  |  |  396|    978|        hold >>= bits & 7; \
  |  |  397|    978|        bits -= bits & 7; \
  |  |  398|    978|    } while (0)
  |  |  ------------------
  |  |  |  Branch (398:14): [Folded, False: 978]
  |  |  ------------------
  ------------------
  723|    978|                state->mode = CHECK;
  724|    978|                break;
  725|    978|            }
  726|  10.0k|            NEEDBITS(3);
  ------------------
  |  |  377|  10.0k|    do { \
  |  |  378|  17.3k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 7.55k, False: 9.77k]
  |  |  ------------------
  |  |  379|  10.0k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  7.55k|    do { \
  |  |  |  |  368|  7.55k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 257, False: 7.29k]
  |  |  |  |  ------------------
  |  |  |  |  369|  7.55k|        have--; \
  |  |  |  |  370|  7.29k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  7.29k|        bits += 8; \
  |  |  |  |  372|  7.29k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 7.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  10.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 9.77k]
  |  |  ------------------
  ------------------
  727|  9.77k|            state->last = BITS(1);
  ------------------
  |  |  384|  9.77k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  728|  9.77k|            DROPBITS(1);
  ------------------
  |  |  388|  9.77k|    do { \
  |  |  389|  9.77k|        hold >>= (n); \
  |  |  390|  9.77k|        bits -= (unsigned)(n); \
  |  |  391|  9.77k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 9.77k]
  |  |  ------------------
  ------------------
  729|  9.77k|            switch (BITS(2)) {
  ------------------
  |  |  384|  9.77k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  730|    979|            case 0:                             /* stored block */
  ------------------
  |  Branch (730:13): [True: 979, False: 8.79k]
  ------------------
  731|    979|                Tracev((stderr, "inflate:     stored block%s\n",
  732|    979|                        state->last ? " (last)" : ""));
  733|    979|                state->mode = STORED;
  734|    979|                break;
  735|  5.33k|            case 1:                             /* fixed block */
  ------------------
  |  Branch (735:13): [True: 5.33k, False: 4.44k]
  ------------------
  736|  5.33k|                inflate_fixed(state);
  737|  5.33k|                Tracev((stderr, "inflate:     fixed codes block%s\n",
  738|  5.33k|                        state->last ? " (last)" : ""));
  739|  5.33k|                state->mode = LEN_;             /* decode codes */
  740|  5.33k|                if (flush == Z_TREES) {
  ------------------
  |  |  178|  5.33k|#define Z_TREES         6
  ------------------
  |  Branch (740:21): [True: 0, False: 5.33k]
  ------------------
  741|      0|                    DROPBITS(2);
  ------------------
  |  |  388|      0|    do { \
  |  |  389|      0|        hold >>= (n); \
  |  |  390|      0|        bits -= (unsigned)(n); \
  |  |  391|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  742|      0|                    goto inf_leave;
  743|      0|                }
  744|  5.33k|                break;
  745|  5.33k|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (745:13): [True: 3.41k, False: 6.36k]
  ------------------
  746|  3.41k|                Tracev((stderr, "inflate:     dynamic codes block%s\n",
  747|  3.41k|                        state->last ? " (last)" : ""));
  748|  3.41k|                state->mode = TABLE;
  749|  3.41k|                break;
  750|     51|            default:
  ------------------
  |  Branch (750:13): [True: 51, False: 9.72k]
  ------------------
  751|     51|                strm->msg = (z_const char *)"invalid block type";
  752|     51|                state->mode = BAD;
  753|  9.77k|            }
  754|  9.77k|            DROPBITS(2);
  ------------------
  |  |  388|  9.77k|    do { \
  |  |  389|  9.77k|        hold >>= (n); \
  |  |  390|  9.77k|        bits -= (unsigned)(n); \
  |  |  391|  9.77k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 9.77k]
  |  |  ------------------
  ------------------
  755|  9.77k|            break;
  756|  1.12k|        case STORED:
  ------------------
  |  Branch (756:9): [True: 1.12k, False: 1.08M]
  ------------------
  757|  1.12k|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  395|  1.12k|    do { \
  |  |  396|  1.12k|        hold >>= bits & 7; \
  |  |  397|  1.12k|        bits -= bits & 7; \
  |  |  398|  1.12k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (398:14): [Folded, False: 1.12k]
  |  |  ------------------
  ------------------
  758|  1.12k|            NEEDBITS(32);
  ------------------
  |  |  377|  1.12k|    do { \
  |  |  378|  4.66k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 3.80k, False: 865]
  |  |  ------------------
  |  |  379|  3.80k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  3.80k|    do { \
  |  |  |  |  368|  3.80k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 258, False: 3.54k]
  |  |  |  |  ------------------
  |  |  |  |  369|  3.80k|        have--; \
  |  |  |  |  370|  3.54k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  3.54k|        bits += 8; \
  |  |  |  |  372|  3.54k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 3.54k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  1.12k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 865]
  |  |  ------------------
  ------------------
  759|    865|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (759:17): [True: 102, False: 763]
  ------------------
  760|    102|                strm->msg = (z_const char *)"invalid stored block lengths";
  761|    102|                state->mode = BAD;
  762|    102|                break;
  763|    102|            }
  764|    763|            state->length = (unsigned)hold & 0xffff;
  765|    763|            Tracev((stderr, "inflate:       stored length %u\n",
  766|    763|                    state->length));
  767|    763|            INITBITS();
  ------------------
  |  |  359|    763|    do { \
  |  |  360|    763|        hold = 0; \
  |  |  361|    763|        bits = 0; \
  |  |  362|    763|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 763]
  |  |  ------------------
  ------------------
  768|    763|            state->mode = COPY_;
  769|    763|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|    763|#define Z_TREES         6
  ------------------
  |  Branch (769:17): [True: 0, False: 763]
  ------------------
  770|       |                /* fallthrough */
  771|    763|        case COPY_:
  ------------------
  |  Branch (771:9): [True: 0, False: 1.08M]
  ------------------
  772|    763|            state->mode = COPY;
  773|       |                /* fallthrough */
  774|  2.73k|        case COPY:
  ------------------
  |  Branch (774:9): [True: 1.96k, False: 1.08M]
  ------------------
  775|  2.73k|            copy = state->length;
  776|  2.73k|            if (copy) {
  ------------------
  |  Branch (776:17): [True: 2.03k, False: 700]
  ------------------
  777|  2.03k|                if (copy > have) copy = have;
  ------------------
  |  Branch (777:21): [True: 1.96k, False: 69]
  ------------------
  778|  2.03k|                if (copy > left) copy = left;
  ------------------
  |  Branch (778:21): [True: 44, False: 1.98k]
  ------------------
  779|  2.03k|                if (copy == 0) goto inf_leave;
  ------------------
  |  Branch (779:21): [True: 1.02k, False: 1.00k]
  ------------------
  780|  1.00k|                zmemcpy(put, next, copy);
  ------------------
  |  |  306|  1.00k|#    define zmemcpy memcpy
  ------------------
  781|  1.00k|                have -= copy;
  782|  1.00k|                next += copy;
  783|  1.00k|                left -= copy;
  784|  1.00k|                put += copy;
  785|  1.00k|                state->length -= copy;
  786|  1.00k|                break;
  787|  2.03k|            }
  788|    700|            Tracev((stderr, "inflate:       stored end\n"));
  789|    700|            state->mode = TYPE;
  790|    700|            break;
  791|  3.47k|        case TABLE:
  ------------------
  |  Branch (791:9): [True: 3.47k, False: 1.08M]
  ------------------
  792|  3.47k|            NEEDBITS(14);
  ------------------
  |  |  377|  3.47k|    do { \
  |  |  378|  10.2k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 6.85k, False: 3.40k]
  |  |  ------------------
  |  |  379|  6.85k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  6.85k|    do { \
  |  |  |  |  368|  6.85k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 68, False: 6.78k]
  |  |  |  |  ------------------
  |  |  |  |  369|  6.85k|        have--; \
  |  |  |  |  370|  6.78k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  6.78k|        bits += 8; \
  |  |  |  |  372|  6.78k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 6.78k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  3.47k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 3.40k]
  |  |  ------------------
  ------------------
  793|  3.40k|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  384|  3.40k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  794|  3.40k|            DROPBITS(5);
  ------------------
  |  |  388|  3.40k|    do { \
  |  |  389|  3.40k|        hold >>= (n); \
  |  |  390|  3.40k|        bits -= (unsigned)(n); \
  |  |  391|  3.40k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 3.40k]
  |  |  ------------------
  ------------------
  795|  3.40k|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  384|  3.40k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  796|  3.40k|            DROPBITS(5);
  ------------------
  |  |  388|  3.40k|    do { \
  |  |  389|  3.40k|        hold >>= (n); \
  |  |  390|  3.40k|        bits -= (unsigned)(n); \
  |  |  391|  3.40k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 3.40k]
  |  |  ------------------
  ------------------
  797|  3.40k|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  384|  3.40k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  798|  3.40k|            DROPBITS(4);
  ------------------
  |  |  388|  3.40k|    do { \
  |  |  389|  3.40k|        hold >>= (n); \
  |  |  390|  3.40k|        bits -= (unsigned)(n); \
  |  |  391|  3.40k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 3.40k]
  |  |  ------------------
  ------------------
  799|  3.40k|#ifndef PKZIP_BUG_WORKAROUND
  800|  3.40k|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (800:17): [True: 4, False: 3.39k]
  |  Branch (800:38): [True: 8, False: 3.39k]
  ------------------
  801|     12|                strm->msg = (z_const char *)
  802|     12|                    "too many length or distance symbols";
  803|     12|                state->mode = BAD;
  804|     12|                break;
  805|     12|            }
  806|  3.39k|#endif
  807|  3.39k|            Tracev((stderr, "inflate:       table sizes ok\n"));
  808|  3.39k|            state->have = 0;
  809|  3.39k|            state->mode = LENLENS;
  810|       |                /* fallthrough */
  811|  3.44k|        case LENLENS:
  ------------------
  |  Branch (811:9): [True: 56, False: 1.08M]
  ------------------
  812|  58.0k|            while (state->have < state->ncode) {
  ------------------
  |  Branch (812:20): [True: 54.6k, False: 3.35k]
  ------------------
  813|  54.6k|                NEEDBITS(3);
  ------------------
  |  |  377|  54.6k|    do { \
  |  |  378|  73.7k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 19.1k, False: 54.5k]
  |  |  ------------------
  |  |  379|  54.6k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  19.1k|    do { \
  |  |  |  |  368|  19.1k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 92, False: 19.0k]
  |  |  |  |  ------------------
  |  |  |  |  369|  19.1k|        have--; \
  |  |  |  |  370|  19.0k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  19.0k|        bits += 8; \
  |  |  |  |  372|  19.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 19.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  54.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 54.5k]
  |  |  ------------------
  ------------------
  814|  54.5k|                state->lens[order[state->have++]] = (unsigned short)BITS(3);
  ------------------
  |  |  384|  54.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  815|  54.5k|                DROPBITS(3);
  ------------------
  |  |  388|  54.5k|    do { \
  |  |  389|  54.5k|        hold >>= (n); \
  |  |  390|  54.5k|        bits -= (unsigned)(n); \
  |  |  391|  54.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 54.5k]
  |  |  ------------------
  ------------------
  816|  54.5k|            }
  817|  12.7k|            while (state->have < 19)
  ------------------
  |  Branch (817:20): [True: 9.37k, False: 3.35k]
  ------------------
  818|  9.37k|                state->lens[order[state->have++]] = 0;
  819|  3.35k|            state->next = state->codes;
  820|  3.35k|            state->lencode = state->distcode = (const code FAR *)(state->next);
  821|  3.35k|            state->lenbits = 7;
  822|  3.35k|            ret = inflate_table(CODES, state->lens, 19, &(state->next),
  823|  3.35k|                                &(state->lenbits), state->work);
  824|  3.35k|            if (ret) {
  ------------------
  |  Branch (824:17): [True: 118, False: 3.23k]
  ------------------
  825|    118|                strm->msg = (z_const char *)"invalid code lengths set";
  826|    118|                state->mode = BAD;
  827|    118|                break;
  828|    118|            }
  829|  3.23k|            Tracev((stderr, "inflate:       code lengths ok\n"));
  830|  3.23k|            state->have = 0;
  831|  3.23k|            state->mode = CODELENS;
  832|       |                /* fallthrough */
  833|  3.79k|        case CODELENS:
  ------------------
  |  Branch (833:9): [True: 562, False: 1.08M]
  ------------------
  834|   298k|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (834:20): [True: 295k, False: 3.00k]
  ------------------
  835|   398k|                for (;;) {
  836|   398k|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  384|   398k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  837|   398k|                    if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (837:25): [True: 295k, False: 102k]
  ------------------
  838|   102k|                    PULLBYTE();
  ------------------
  |  |  367|   102k|    do { \
  |  |  368|   102k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 446, False: 102k]
  |  |  ------------------
  |  |  369|   102k|        have--; \
  |  |  370|   102k|        hold += (unsigned long)(*next++) << bits; \
  |  |  371|   102k|        bits += 8; \
  |  |  372|   102k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 102k]
  |  |  ------------------
  ------------------
  839|   102k|                }
  840|   295k|                if (here.val < 16) {
  ------------------
  |  Branch (840:21): [True: 262k, False: 33.4k]
  ------------------
  841|   262k|                    DROPBITS(here.bits);
  ------------------
  |  |  388|   262k|    do { \
  |  |  389|   262k|        hold >>= (n); \
  |  |  390|   262k|        bits -= (unsigned)(n); \
  |  |  391|   262k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 262k]
  |  |  ------------------
  ------------------
  842|   262k|                    state->lens[state->have++] = here.val;
  843|   262k|                }
  844|  33.4k|                else {
  845|  33.4k|                    if (here.val == 16) {
  ------------------
  |  Branch (845:25): [True: 12.6k, False: 20.7k]
  ------------------
  846|  12.6k|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  377|  12.6k|    do { \
  |  |  378|  15.8k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 3.24k, False: 12.5k]
  |  |  ------------------
  |  |  379|  12.6k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  3.24k|    do { \
  |  |  |  |  368|  3.24k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 60, False: 3.18k]
  |  |  |  |  ------------------
  |  |  |  |  369|  3.24k|        have--; \
  |  |  |  |  370|  3.18k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  3.18k|        bits += 8; \
  |  |  |  |  372|  3.18k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 3.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  12.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 12.5k]
  |  |  ------------------
  ------------------
  847|  12.5k|                        DROPBITS(here.bits);
  ------------------
  |  |  388|  12.5k|    do { \
  |  |  389|  12.5k|        hold >>= (n); \
  |  |  390|  12.5k|        bits -= (unsigned)(n); \
  |  |  391|  12.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 12.5k]
  |  |  ------------------
  ------------------
  848|  12.5k|                        if (state->have == 0) {
  ------------------
  |  Branch (848:29): [True: 11, False: 12.5k]
  ------------------
  849|     11|                            strm->msg = (z_const char *)
  850|     11|                                "invalid bit length repeat";
  851|     11|                            state->mode = BAD;
  852|     11|                            break;
  853|     11|                        }
  854|  12.5k|                        len = state->lens[state->have - 1];
  855|  12.5k|                        copy = 3 + BITS(2);
  ------------------
  |  |  384|  12.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  856|  12.5k|                        DROPBITS(2);
  ------------------
  |  |  388|  12.5k|    do { \
  |  |  389|  12.5k|        hold >>= (n); \
  |  |  390|  12.5k|        bits -= (unsigned)(n); \
  |  |  391|  12.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 12.5k]
  |  |  ------------------
  ------------------
  857|  12.5k|                    }
  858|  20.7k|                    else if (here.val == 17) {
  ------------------
  |  Branch (858:30): [True: 10.0k, False: 10.7k]
  ------------------
  859|  10.0k|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  377|  10.0k|    do { \
  |  |  378|  13.3k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 3.37k, False: 9.94k]
  |  |  ------------------
  |  |  379|  10.0k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  3.37k|    do { \
  |  |  |  |  368|  3.37k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 118, False: 3.25k]
  |  |  |  |  ------------------
  |  |  |  |  369|  3.37k|        have--; \
  |  |  |  |  370|  3.25k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  3.25k|        bits += 8; \
  |  |  |  |  372|  3.25k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 3.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  10.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 9.94k]
  |  |  ------------------
  ------------------
  860|  9.94k|                        DROPBITS(here.bits);
  ------------------
  |  |  388|  9.94k|    do { \
  |  |  389|  9.94k|        hold >>= (n); \
  |  |  390|  9.94k|        bits -= (unsigned)(n); \
  |  |  391|  9.94k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 9.94k]
  |  |  ------------------
  ------------------
  861|  9.94k|                        len = 0;
  862|  9.94k|                        copy = 3 + BITS(3);
  ------------------
  |  |  384|  9.94k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  863|  9.94k|                        DROPBITS(3);
  ------------------
  |  |  388|  9.94k|    do { \
  |  |  389|  9.94k|        hold >>= (n); \
  |  |  390|  9.94k|        bits -= (unsigned)(n); \
  |  |  391|  9.94k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 9.94k]
  |  |  ------------------
  ------------------
  864|  9.94k|                    }
  865|  10.7k|                    else {
  866|  10.7k|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  377|  10.7k|    do { \
  |  |  378|  20.8k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 10.1k, False: 10.6k]
  |  |  ------------------
  |  |  379|  10.7k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  10.1k|    do { \
  |  |  |  |  368|  10.1k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 64, False: 10.0k]
  |  |  |  |  ------------------
  |  |  |  |  369|  10.1k|        have--; \
  |  |  |  |  370|  10.0k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  10.0k|        bits += 8; \
  |  |  |  |  372|  10.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 10.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  10.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 10.6k]
  |  |  ------------------
  ------------------
  867|  10.6k|                        DROPBITS(here.bits);
  ------------------
  |  |  388|  10.6k|    do { \
  |  |  389|  10.6k|        hold >>= (n); \
  |  |  390|  10.6k|        bits -= (unsigned)(n); \
  |  |  391|  10.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 10.6k]
  |  |  ------------------
  ------------------
  868|  10.6k|                        len = 0;
  869|  10.6k|                        copy = 11 + BITS(7);
  ------------------
  |  |  384|  10.6k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  870|  10.6k|                        DROPBITS(7);
  ------------------
  |  |  388|  10.6k|    do { \
  |  |  389|  10.6k|        hold >>= (n); \
  |  |  390|  10.6k|        bits -= (unsigned)(n); \
  |  |  391|  10.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 10.6k]
  |  |  ------------------
  ------------------
  871|  10.6k|                    }
  872|  33.1k|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (872:25): [True: 95, False: 33.0k]
  ------------------
  873|     95|                        strm->msg = (z_const char *)
  874|     95|                            "invalid bit length repeat";
  875|     95|                        state->mode = BAD;
  876|     95|                        break;
  877|     95|                    }
  878|   724k|                    while (copy--)
  ------------------
  |  Branch (878:28): [True: 691k, False: 33.0k]
  ------------------
  879|   691k|                        state->lens[state->have++] = (unsigned short)len;
  880|  33.0k|                }
  881|   295k|            }
  882|       |
  883|       |            /* handle error breaks in while */
  884|  3.11k|            if (state->mode == BAD) break;
  ------------------
  |  Branch (884:17): [True: 106, False: 3.00k]
  ------------------
  885|       |
  886|       |            /* check for end-of-block code (better have one) */
  887|  3.00k|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (887:17): [True: 17, False: 2.98k]
  ------------------
  888|     17|                strm->msg = (z_const char *)
  889|     17|                    "invalid code -- missing end-of-block";
  890|     17|                state->mode = BAD;
  891|     17|                break;
  892|     17|            }
  893|       |
  894|       |            /* build code tables */
  895|  2.98k|            state->next = state->codes;
  896|  2.98k|            state->lencode = (const code FAR *)(state->next);
  897|  2.98k|            state->lenbits = LENBITS;
  ------------------
  |  |   47|  2.98k|#define LENBITS 10
  ------------------
  898|  2.98k|            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
  899|  2.98k|                                &(state->lenbits), state->work);
  900|  2.98k|            if (ret) {
  ------------------
  |  Branch (900:17): [True: 75, False: 2.91k]
  ------------------
  901|     75|                strm->msg = (z_const char *)"invalid literal/lengths set";
  902|     75|                state->mode = BAD;
  903|     75|                break;
  904|     75|            }
  905|  2.91k|            state->distcode = (const code FAR *)(state->next);
  906|  2.91k|            state->distbits = DISTBITS;
  ------------------
  |  |   48|  2.91k|#define DISTBITS 8
  ------------------
  907|  2.91k|            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
  908|  2.91k|                            &(state->next), &(state->distbits), state->work);
  909|  2.91k|            if (ret) {
  ------------------
  |  Branch (909:17): [True: 38, False: 2.87k]
  ------------------
  910|     38|                strm->msg = (z_const char *)"invalid distances set";
  911|     38|                state->mode = BAD;
  912|     38|                break;
  913|     38|            }
  914|  2.87k|            Tracev((stderr, "inflate:       codes ok\n"));
  915|  2.87k|            state->mode = LEN_;
  916|  2.87k|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  2.87k|#define Z_TREES         6
  ------------------
  |  Branch (916:17): [True: 0, False: 2.87k]
  ------------------
  917|       |                /* fallthrough */
  918|  8.20k|        case LEN_:
  ------------------
  |  Branch (918:9): [True: 5.33k, False: 1.08M]
  ------------------
  919|  8.20k|            state->mode = LEN;
  920|       |                /* fallthrough */
  921|   673k|        case LEN:
  ------------------
  |  Branch (921:9): [True: 665k, False: 422k]
  ------------------
  922|   673k|            if (have >= 6 && left >= 258 && bits < 8) {
  ------------------
  |  Branch (922:17): [True: 172k, False: 501k]
  |  Branch (922:30): [True: 161k, False: 11.3k]
  |  Branch (922:45): [True: 161k, False: 63]
  ------------------
  923|   161k|                RESTORE();
  ------------------
  |  |  348|   161k|    do { \
  |  |  349|   161k|        strm->next_out = put; \
  |  |  350|   161k|        strm->avail_out = left; \
  |  |  351|   161k|        strm->next_in = next; \
  |  |  352|   161k|        strm->avail_in = have; \
  |  |  353|   161k|        state->hold = hold; \
  |  |  354|   161k|        state->bits = bits; \
  |  |  355|   161k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (355:14): [Folded, False: 161k]
  |  |  ------------------
  ------------------
  924|   161k|                inflate_fast(strm, out);
  925|   161k|                LOAD();
  ------------------
  |  |  337|   161k|    do { \
  |  |  338|   161k|        put = strm->next_out; \
  |  |  339|   161k|        left = strm->avail_out; \
  |  |  340|   161k|        next = strm->next_in; \
  |  |  341|   161k|        have = strm->avail_in; \
  |  |  342|   161k|        hold = state->hold; \
  |  |  343|   161k|        bits = state->bits; \
  |  |  344|   161k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (344:14): [Folded, False: 161k]
  |  |  ------------------
  ------------------
  926|   161k|                if (state->mode == TYPE)
  ------------------
  |  Branch (926:21): [True: 4.53k, False: 156k]
  ------------------
  927|  4.53k|                    state->back = -1;
  928|   161k|                break;
  929|   161k|            }
  930|   512k|            state->back = 0;
  931|   869k|            for (;;) {
  932|   869k|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  384|   869k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  933|   869k|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (933:21): [True: 451k, False: 418k]
  ------------------
  934|   418k|                PULLBYTE();
  ------------------
  |  |  367|   418k|    do { \
  |  |  368|   418k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 61.0k, False: 357k]
  |  |  ------------------
  |  |  369|   418k|        have--; \
  |  |  370|   357k|        hold += (unsigned long)(*next++) << bits; \
  |  |  371|   357k|        bits += 8; \
  |  |  372|   357k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 357k]
  |  |  ------------------
  ------------------
  935|   418k|            }
  936|   451k|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (936:17): [True: 118k, False: 332k]
  |  Branch (936:28): [True: 559, False: 118k]
  ------------------
  937|    559|                last = here;
  938|    591|                for (;;) {
  939|    591|                    here = state->lencode[last.val +
  940|    591|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  384|    591|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  941|    591|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (941:25): [True: 536, False: 55]
  ------------------
  942|     55|                    PULLBYTE();
  ------------------
  |  |  367|     55|    do { \
  |  |  368|     55|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 23, False: 32]
  |  |  ------------------
  |  |  369|     55|        have--; \
  |  |  370|     32|        hold += (unsigned long)(*next++) << bits; \
  |  |  371|     32|        bits += 8; \
  |  |  372|     32|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 32]
  |  |  ------------------
  ------------------
  943|     55|                }
  944|    536|                DROPBITS(last.bits);
  ------------------
  |  |  388|    536|    do { \
  |  |  389|    536|        hold >>= (n); \
  |  |  390|    536|        bits -= (unsigned)(n); \
  |  |  391|    536|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 536]
  |  |  ------------------
  ------------------
  945|    536|                state->back += last.bits;
  946|    536|            }
  947|   451k|            DROPBITS(here.bits);
  ------------------
  |  |  388|   451k|    do { \
  |  |  389|   451k|        hold >>= (n); \
  |  |  390|   451k|        bits -= (unsigned)(n); \
  |  |  391|   451k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 451k]
  |  |  ------------------
  ------------------
  948|   451k|            state->back += here.bits;
  949|   451k|            state->length = (unsigned)here.val;
  950|   451k|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (950:17): [True: 333k, False: 118k]
  ------------------
  951|   333k|                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
  952|   333k|                        "inflate:         literal '%c'\n" :
  953|   333k|                        "inflate:         literal 0x%02x\n", here.val));
  954|   333k|                state->mode = LIT;
  955|   333k|                break;
  956|   333k|            }
  957|   118k|            if (here.op & 32) {
  ------------------
  |  Branch (957:17): [True: 1.42k, False: 116k]
  ------------------
  958|  1.42k|                Tracevv((stderr, "inflate:         end of block\n"));
  959|  1.42k|                state->back = -1;
  960|  1.42k|                state->mode = TYPE;
  961|  1.42k|                break;
  962|  1.42k|            }
  963|   116k|            if (here.op & 64) {
  ------------------
  |  Branch (963:17): [True: 11, False: 116k]
  ------------------
  964|     11|                strm->msg = (z_const char *)"invalid literal/length code";
  965|     11|                state->mode = BAD;
  966|     11|                break;
  967|     11|            }
  968|   116k|            state->extra = (unsigned)(here.op) & 15;
  969|   116k|            state->mode = LENEXT;
  970|       |                /* fallthrough */
  971|   145k|        case LENEXT:
  ------------------
  |  Branch (971:9): [True: 28.9k, False: 1.05M]
  ------------------
  972|   145k|            if (state->extra) {
  ------------------
  |  Branch (972:17): [True: 89.5k, False: 56.3k]
  ------------------
  973|  89.5k|                NEEDBITS(state->extra);
  ------------------
  |  |  377|  89.5k|    do { \
  |  |  378|   136k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 75.9k, False: 60.5k]
  |  |  ------------------
  |  |  379|  89.5k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  75.9k|    do { \
  |  |  |  |  368|  75.9k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 29.0k, False: 46.9k]
  |  |  |  |  ------------------
  |  |  |  |  369|  75.9k|        have--; \
  |  |  |  |  370|  46.9k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  46.9k|        bits += 8; \
  |  |  |  |  372|  46.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 46.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  89.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 60.5k]
  |  |  ------------------
  ------------------
  974|  60.5k|                state->length += BITS(state->extra);
  ------------------
  |  |  384|  60.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  975|  60.5k|                DROPBITS(state->extra);
  ------------------
  |  |  388|  60.5k|    do { \
  |  |  389|  60.5k|        hold >>= (n); \
  |  |  390|  60.5k|        bits -= (unsigned)(n); \
  |  |  391|  60.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 60.5k]
  |  |  ------------------
  ------------------
  976|  60.5k|                state->back += state->extra;
  977|  60.5k|            }
  978|   116k|            Tracevv((stderr, "inflate:         length %u\n", state->length));
  979|   116k|            state->was = state->length;
  980|   116k|            state->mode = DIST;
  981|       |                /* fallthrough */
  982|   125k|        case DIST:
  ------------------
  |  Branch (982:9): [True: 8.58k, False: 1.07M]
  ------------------
  983|   187k|            for (;;) {
  984|   187k|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  384|   187k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  985|   187k|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (985:21): [True: 116k, False: 71.1k]
  ------------------
  986|  71.1k|                PULLBYTE();
  ------------------
  |  |  367|  71.1k|    do { \
  |  |  368|  71.1k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 8.94k, False: 62.1k]
  |  |  ------------------
  |  |  369|  71.1k|        have--; \
  |  |  370|  62.1k|        hold += (unsigned long)(*next++) << bits; \
  |  |  371|  62.1k|        bits += 8; \
  |  |  372|  62.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 62.1k]
  |  |  ------------------
  ------------------
  987|  71.1k|            }
  988|   116k|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (988:17): [True: 186, False: 116k]
  ------------------
  989|    186|                last = here;
  990|    213|                for (;;) {
  991|    213|                    here = state->distcode[last.val +
  992|    213|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  384|    213|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  993|    213|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (993:25): [True: 179, False: 34]
  ------------------
  994|     34|                    PULLBYTE();
  ------------------
  |  |  367|     34|    do { \
  |  |  368|     34|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 7, False: 27]
  |  |  ------------------
  |  |  369|     34|        have--; \
  |  |  370|     27|        hold += (unsigned long)(*next++) << bits; \
  |  |  371|     27|        bits += 8; \
  |  |  372|     27|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 27]
  |  |  ------------------
  ------------------
  995|     34|                }
  996|    179|                DROPBITS(last.bits);
  ------------------
  |  |  388|    179|    do { \
  |  |  389|    179|        hold >>= (n); \
  |  |  390|    179|        bits -= (unsigned)(n); \
  |  |  391|    179|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 179]
  |  |  ------------------
  ------------------
  997|    179|                state->back += last.bits;
  998|    179|            }
  999|   116k|            DROPBITS(here.bits);
  ------------------
  |  |  388|   116k|    do { \
  |  |  389|   116k|        hold >>= (n); \
  |  |  390|   116k|        bits -= (unsigned)(n); \
  |  |  391|   116k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 116k]
  |  |  ------------------
  ------------------
 1000|   116k|            state->back += here.bits;
 1001|   116k|            if (here.op & 64) {
  ------------------
  |  Branch (1001:17): [True: 23, False: 116k]
  ------------------
 1002|     23|                strm->msg = (z_const char *)"invalid distance code";
 1003|     23|                state->mode = BAD;
 1004|     23|                break;
 1005|     23|            }
 1006|   116k|            state->offset = (unsigned)here.val;
 1007|   116k|            state->extra = (unsigned)(here.op) & 15;
 1008|   116k|            state->mode = DISTEXT;
 1009|       |                /* fallthrough */
 1010|   128k|        case DISTEXT:
  ------------------
  |  Branch (1010:9): [True: 11.7k, False: 1.07M]
  ------------------
 1011|   128k|            if (state->extra) {
  ------------------
  |  Branch (1011:17): [True: 108k, False: 19.8k]
  ------------------
 1012|   108k|                NEEDBITS(state->extra);
  ------------------
  |  |  377|   108k|    do { \
  |  |  378|   176k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 80.9k, False: 96.0k]
  |  |  ------------------
  |  |  379|   108k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  80.9k|    do { \
  |  |  |  |  368|  80.9k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 12.3k, False: 68.6k]
  |  |  |  |  ------------------
  |  |  |  |  369|  80.9k|        have--; \
  |  |  |  |  370|  68.6k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  68.6k|        bits += 8; \
  |  |  |  |  372|  68.6k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 68.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|   108k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 96.0k]
  |  |  ------------------
  ------------------
 1013|  96.0k|                state->offset += BITS(state->extra);
  ------------------
  |  |  384|  96.0k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1014|  96.0k|                DROPBITS(state->extra);
  ------------------
  |  |  388|  96.0k|    do { \
  |  |  389|  96.0k|        hold >>= (n); \
  |  |  390|  96.0k|        bits -= (unsigned)(n); \
  |  |  391|  96.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 96.0k]
  |  |  ------------------
  ------------------
 1015|  96.0k|                state->back += state->extra;
 1016|  96.0k|            }
 1017|       |#ifdef INFLATE_STRICT
 1018|       |            if (state->offset > state->dmax) {
 1019|       |                strm->msg = (z_const char *)"invalid distance too far back";
 1020|       |                state->mode = BAD;
 1021|       |                break;
 1022|       |            }
 1023|       |#endif
 1024|   115k|            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
 1025|   115k|            state->mode = MATCH;
 1026|       |                /* fallthrough */
 1027|   122k|        case MATCH:
  ------------------
  |  Branch (1027:9): [True: 6.23k, False: 1.08M]
  ------------------
 1028|   122k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1028:17): [True: 613, False: 121k]
  ------------------
 1029|   121k|            copy = out - left;
 1030|   121k|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1030:17): [True: 65.3k, False: 56.1k]
  ------------------
 1031|  65.3k|                copy = state->offset - copy;
 1032|  65.3k|                if (copy > state->whave) {
  ------------------
  |  Branch (1032:21): [True: 60, False: 65.2k]
  ------------------
 1033|     60|                    if (state->sane) {
  ------------------
  |  Branch (1033:25): [True: 60, False: 0]
  ------------------
 1034|     60|                        strm->msg = (z_const char *)
 1035|     60|                            "invalid distance too far back";
 1036|     60|                        state->mode = BAD;
 1037|     60|                        break;
 1038|     60|                    }
 1039|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
 1040|       |                    Trace((stderr, "inflate.c too far\n"));
 1041|       |                    copy -= state->whave;
 1042|       |                    if (copy > state->length) copy = state->length;
 1043|       |                    if (copy > left) copy = left;
 1044|       |                    left -= copy;
 1045|       |                    state->length -= copy;
 1046|       |                    do {
 1047|       |                        *put++ = 0;
 1048|       |                    } while (--copy);
 1049|       |                    if (state->length == 0) state->mode = LEN;
 1050|       |                    break;
 1051|       |#endif
 1052|     60|                }
 1053|  65.2k|                if (copy > state->wnext) {
  ------------------
  |  Branch (1053:21): [True: 2.65k, False: 62.6k]
  ------------------
 1054|  2.65k|                    copy -= state->wnext;
 1055|  2.65k|                    from = state->window + (state->wsize - copy);
 1056|  2.65k|                }
 1057|  62.6k|                else
 1058|  62.6k|                    from = state->window + (state->wnext - copy);
 1059|  65.2k|                if (copy > state->length) copy = state->length;
  ------------------
  |  Branch (1059:21): [True: 59.9k, False: 5.32k]
  ------------------
 1060|  65.2k|            }
 1061|  56.1k|            else {                              /* copy from output */
 1062|  56.1k|                from = put - state->offset;
 1063|  56.1k|                copy = state->length;
 1064|  56.1k|            }
 1065|   121k|            if (copy > left) copy = left;
  ------------------
  |  Branch (1065:17): [True: 591, False: 120k]
  ------------------
 1066|   121k|            left -= copy;
 1067|   121k|            state->length -= copy;
 1068|  4.69M|            do {
 1069|  4.69M|                *put++ = *from++;
 1070|  4.69M|            } while (--copy);
  ------------------
  |  Branch (1070:22): [True: 4.57M, False: 121k]
  ------------------
 1071|   121k|            if (state->length == 0) state->mode = LEN;
  ------------------
  |  Branch (1071:17): [True: 115k, False: 5.64k]
  ------------------
 1072|   121k|            break;
 1073|   333k|        case LIT:
  ------------------
  |  Branch (1073:9): [True: 333k, False: 754k]
  ------------------
 1074|   333k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1074:17): [True: 43, False: 333k]
  ------------------
 1075|   333k|            *put++ = (unsigned char)(state->length);
 1076|   333k|            left--;
 1077|   333k|            state->mode = LEN;
 1078|   333k|            break;
 1079|  1.06k|        case CHECK:
  ------------------
  |  Branch (1079:9): [True: 1.06k, False: 1.08M]
  ------------------
 1080|  1.06k|            if (state->wrap) {
  ------------------
  |  Branch (1080:17): [True: 1.06k, False: 0]
  ------------------
 1081|  1.06k|                NEEDBITS(32);
  ------------------
  |  |  377|  1.06k|    do { \
  |  |  378|  4.87k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 3.94k, False: 933]
  |  |  ------------------
  |  |  379|  3.94k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  3.94k|    do { \
  |  |  |  |  368|  3.94k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 136, False: 3.80k]
  |  |  |  |  ------------------
  |  |  |  |  369|  3.94k|        have--; \
  |  |  |  |  370|  3.80k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  3.80k|        bits += 8; \
  |  |  |  |  372|  3.80k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 3.80k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  1.06k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 933]
  |  |  ------------------
  ------------------
 1082|    933|                out -= left;
 1083|    933|                strm->total_out += out;
 1084|    933|                state->total += out;
 1085|    933|                if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1085:21): [True: 933, False: 0]
  |  Branch (1085:42): [True: 875, False: 58]
  ------------------
 1086|    875|                    strm->adler = state->check =
 1087|    875|                        UPDATE_CHECK(state->check, put - out, out);
  ------------------
  |  |  311|    875|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (311:6): [True: 0, False: 875]
  |  |  ------------------
  ------------------
 1088|    933|                out = left;
 1089|    933|                if ((state->wrap & 4) && (
  ------------------
  |  Branch (1089:21): [True: 933, False: 0]
  |  Branch (1089:42): [True: 477, False: 456]
  ------------------
 1090|    933|#ifdef GUNZIP
 1091|    933|                     state->flags ? hold :
  ------------------
  |  Branch (1091:22): [True: 0, False: 933]
  ------------------
 1092|    933|#endif
 1093|    933|                     ZSWAP32(hold)) != state->check) {
  ------------------
  |  |  348|    933|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  349|    933|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
 1094|    477|                    strm->msg = (z_const char *)"incorrect data check";
 1095|    477|                    state->mode = BAD;
 1096|    477|                    break;
 1097|    477|                }
 1098|    456|                INITBITS();
  ------------------
  |  |  359|    456|    do { \
  |  |  360|    456|        hold = 0; \
  |  |  361|    456|        bits = 0; \
  |  |  362|    456|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 456]
  |  |  ------------------
  ------------------
 1099|    456|                Tracev((stderr, "inflate:   check matches trailer\n"));
 1100|    456|            }
 1101|    456|#ifdef GUNZIP
 1102|    456|            state->mode = LENGTH;
 1103|       |                /* fallthrough */
 1104|    456|        case LENGTH:
  ------------------
  |  Branch (1104:9): [True: 0, False: 1.08M]
  ------------------
 1105|    456|            if (state->wrap && state->flags) {
  ------------------
  |  Branch (1105:17): [True: 456, False: 0]
  |  Branch (1105:32): [True: 0, False: 456]
  ------------------
 1106|      0|                NEEDBITS(32);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1107|      0|                if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) {
  ------------------
  |  Branch (1107:21): [True: 0, False: 0]
  |  Branch (1107:42): [True: 0, False: 0]
  ------------------
 1108|      0|                    strm->msg = (z_const char *)"incorrect length check";
 1109|      0|                    state->mode = BAD;
 1110|      0|                    break;
 1111|      0|                }
 1112|      0|                INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1113|      0|                Tracev((stderr, "inflate:   length matches trailer\n"));
 1114|      0|            }
 1115|    456|#endif
 1116|    456|            state->mode = DONE;
 1117|       |                /* fallthrough */
 1118|  1.16k|        case DONE:
  ------------------
  |  Branch (1118:9): [True: 712, False: 1.08M]
  ------------------
 1119|  1.16k|            ret = Z_STREAM_END;
  ------------------
  |  |  182|  1.16k|#define Z_STREAM_END    1
  ------------------
 1120|  1.16k|            goto inf_leave;
 1121|  3.46k|        case BAD:
  ------------------
  |  Branch (1121:9): [True: 3.46k, False: 1.08M]
  ------------------
 1122|  3.46k|            ret = Z_DATA_ERROR;
  ------------------
  |  |  186|  3.46k|#define Z_DATA_ERROR   (-3)
  ------------------
 1123|  3.46k|            goto inf_leave;
 1124|      0|        case MEM:
  ------------------
  |  Branch (1124:9): [True: 0, False: 1.08M]
  ------------------
 1125|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1126|      0|        case SYNC:
  ------------------
  |  Branch (1126:9): [True: 0, False: 1.08M]
  ------------------
 1127|       |                /* fallthrough */
 1128|      0|        default:
  ------------------
  |  Branch (1128:9): [True: 0, False: 1.08M]
  ------------------
 1129|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1130|  1.08M|        }
 1131|       |
 1132|       |    /*
 1133|       |       Return from inflate(), updating the total counts and the check value.
 1134|       |       If there was no progress during the inflate() call, return a buffer
 1135|       |       error.  Call updatewindow() to create and/or update the window state.
 1136|       |       Note: a memory error from inflate() is non-recoverable.
 1137|       |     */
 1138|   119k|  inf_leave:
 1139|   119k|    RESTORE();
  ------------------
  |  |  348|   119k|    do { \
  |  |  349|   119k|        strm->next_out = put; \
  |  |  350|   119k|        strm->avail_out = left; \
  |  |  351|   119k|        strm->next_in = next; \
  |  |  352|   119k|        strm->avail_in = have; \
  |  |  353|   119k|        state->hold = hold; \
  |  |  354|   119k|        state->bits = bits; \
  |  |  355|   119k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (355:14): [Folded, False: 119k]
  |  |  ------------------
  ------------------
 1140|   119k|    if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1140:9): [True: 112k, False: 7.14k]
  |  Branch (1140:26): [True: 2.84k, False: 4.30k]
  |  Branch (1140:52): [True: 2.53k, False: 306]
  ------------------
 1141|  2.53k|            (state->mode < CHECK || flush != Z_FINISH)))
  ------------------
  |  |  176|     35|#define Z_FINISH        4
  ------------------
  |  Branch (1141:14): [True: 2.50k, False: 35]
  |  Branch (1141:37): [True: 35, False: 0]
  ------------------
 1142|   114k|        if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
  ------------------
  |  Branch (1142:13): [True: 0, False: 114k]
  ------------------
 1143|      0|            state->mode = MEM;
 1144|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1145|      0|        }
 1146|   119k|    in -= strm->avail_in;
 1147|   119k|    out -= strm->avail_out;
 1148|   119k|    strm->total_in += in;
 1149|   119k|    strm->total_out += out;
 1150|   119k|    state->total += out;
 1151|   119k|    if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1151:9): [True: 119k, False: 0]
  |  Branch (1151:30): [True: 111k, False: 7.30k]
  ------------------
 1152|   111k|        strm->adler = state->check =
 1153|   111k|            UPDATE_CHECK(state->check, strm->next_out - out, out);
  ------------------
  |  |  311|   111k|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (311:6): [True: 0, False: 111k]
  |  |  ------------------
  ------------------
 1154|   119k|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1154:43): [True: 4.17k, False: 115k]
  ------------------
 1155|   119k|                      (state->mode == TYPE ? 128 : 0) +
  ------------------
  |  Branch (1155:24): [True: 184, False: 119k]
  ------------------
 1156|   119k|                      (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1156:24): [True: 0, False: 119k]
  |  Branch (1156:47): [True: 0, False: 119k]
  ------------------
 1157|   119k|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  176|   114k|#define Z_FINISH        4
  ------------------
                  if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  181|  4.84k|#define Z_OK            0
  ------------------
  |  Branch (1157:11): [True: 4.86k, False: 114k]
  |  Branch (1157:22): [True: 4.84k, False: 23]
  |  Branch (1157:35): [True: 0, False: 114k]
  |  Branch (1157:57): [True: 2.34k, False: 2.49k]
  ------------------
 1158|  2.34k|        ret = Z_BUF_ERROR;
  ------------------
  |  |  188|  2.34k|#define Z_BUF_ERROR    (-5)
  ------------------
 1159|   119k|    return ret;
 1160|   119k|}
inflateEnd:
 1162|  4.67k|int ZEXPORT inflateEnd(z_streamp strm) {
 1163|  4.67k|    struct inflate_state FAR *state;
 1164|  4.67k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1164:9): [True: 0, False: 4.67k]
  ------------------
 1165|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1166|  4.67k|    state = (struct inflate_state FAR *)strm->state;
 1167|  4.67k|    if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  216|  4.67k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  344|  2.53k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  |  Branch (1167:9): [True: 2.53k, False: 2.13k]
  ------------------
 1168|  4.67k|    ZFREE(strm, strm->state);
  ------------------
  |  |  344|  4.67k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
 1169|  4.67k|    strm->state = Z_NULL;
  ------------------
  |  |  216|  4.67k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1170|  4.67k|    Tracev((stderr, "inflate: end\n"));
 1171|  4.67k|    return Z_OK;
  ------------------
  |  |  181|  4.67k|#define Z_OK            0
  ------------------
 1172|  4.67k|}
inflate.c:inflateStateCheck:
   88|   138k|local int inflateStateCheck(z_streamp strm) {
   89|   138k|    struct inflate_state FAR *state;
   90|   138k|    if (strm == Z_NULL ||
  ------------------
  |  |  216|   276k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (90:9): [True: 0, False: 138k]
  ------------------
   91|   138k|        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (91:9): [True: 0, False: 138k]
  |  Branch (91:42): [True: 0, False: 138k]
  ------------------
   92|      0|        return 1;
   93|   138k|    state = (struct inflate_state FAR *)strm->state;
   94|   138k|    if (state == Z_NULL || state->strm != strm ||
  ------------------
  |  |  216|   276k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (94:9): [True: 0, False: 138k]
  |  Branch (94:28): [True: 0, False: 138k]
  ------------------
   95|   138k|        state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (95:9): [True: 0, False: 138k]
  |  Branch (95:31): [True: 0, False: 138k]
  ------------------
   96|      0|        return 1;
   97|   138k|    return 0;
   98|   138k|}
inflate.c:updatewindow:
  260|   114k|local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) {
  261|   114k|    struct inflate_state FAR *state;
  262|   114k|    unsigned dist;
  263|       |
  264|   114k|    state = (struct inflate_state FAR *)strm->state;
  265|       |
  266|       |    /* if it hasn't been done already, allocate space for the window */
  267|   114k|    if (state->window == Z_NULL) {
  ------------------
  |  |  216|   114k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (267:9): [True: 2.53k, False: 112k]
  ------------------
  268|  2.53k|        state->window = (unsigned char FAR *)
  269|  2.53k|                        ZALLOC(strm, 1U << state->wbits,
  ------------------
  |  |  343|  2.53k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  270|  2.53k|                               sizeof(unsigned char));
  271|  2.53k|        if (state->window == Z_NULL) return 1;
  ------------------
  |  |  216|  2.53k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (271:13): [True: 0, False: 2.53k]
  ------------------
  272|  2.53k|    }
  273|       |
  274|       |    /* if window not in use yet, initialize */
  275|   114k|    if (state->wsize == 0) {
  ------------------
  |  Branch (275:9): [True: 2.53k, False: 112k]
  ------------------
  276|  2.53k|        state->wsize = 1U << state->wbits;
  277|  2.53k|        state->wnext = 0;
  278|  2.53k|        state->whave = 0;
  279|  2.53k|    }
  280|       |
  281|       |    /* copy state->wsize or less output bytes into the circular window */
  282|   114k|    if (copy >= state->wsize) {
  ------------------
  |  Branch (282:9): [True: 810, False: 113k]
  ------------------
  283|    810|        zmemcpy(state->window, end - state->wsize, state->wsize);
  ------------------
  |  |  306|    810|#    define zmemcpy memcpy
  ------------------
  284|    810|        state->wnext = 0;
  285|    810|        state->whave = state->wsize;
  286|    810|    }
  287|   113k|    else {
  288|   113k|        dist = state->wsize - state->wnext;
  289|   113k|        if (dist > copy) dist = copy;
  ------------------
  |  Branch (289:13): [True: 113k, False: 151]
  ------------------
  290|   113k|        zmemcpy(state->window + state->wnext, end - copy, dist);
  ------------------
  |  |  306|   113k|#    define zmemcpy memcpy
  ------------------
  291|   113k|        copy -= dist;
  292|   113k|        if (copy) {
  ------------------
  |  Branch (292:13): [True: 140, False: 113k]
  ------------------
  293|    140|            zmemcpy(state->window, end - copy, copy);
  ------------------
  |  |  306|    140|#    define zmemcpy memcpy
  ------------------
  294|    140|            state->wnext = copy;
  295|    140|            state->whave = state->wsize;
  296|    140|        }
  297|   113k|        else {
  298|   113k|            state->wnext += dist;
  299|   113k|            if (state->wnext == state->wsize) state->wnext = 0;
  ------------------
  |  Branch (299:17): [True: 11, False: 113k]
  ------------------
  300|   113k|            if (state->whave < state->wsize) state->whave += dist;
  ------------------
  |  Branch (300:17): [True: 58.6k, False: 55.1k]
  ------------------
  301|   113k|        }
  302|   113k|    }
  303|   114k|    return 0;
  304|   114k|}

inflate_table:
   48|  9.25k|                                unsigned FAR *bits, unsigned short FAR *work) {
   49|  9.25k|    unsigned len;               /* a code's length in bits */
   50|  9.25k|    unsigned sym;               /* index of code symbols */
   51|  9.25k|    unsigned min, max;          /* minimum and maximum code lengths */
   52|  9.25k|    unsigned root;              /* number of index bits for root table */
   53|  9.25k|    unsigned curr;              /* number of index bits for current table */
   54|  9.25k|    unsigned drop;              /* code bits to drop for sub-table */
   55|  9.25k|    int left;                   /* number of prefix codes available */
   56|  9.25k|    unsigned used;              /* code entries in table used */
   57|  9.25k|    unsigned huff;              /* Huffman code */
   58|  9.25k|    unsigned incr;              /* for incrementing code, index */
   59|  9.25k|    unsigned fill;              /* index for replicating entries */
   60|  9.25k|    unsigned low;               /* low bits for current root entry */
   61|  9.25k|    unsigned mask;              /* mask for low root bits */
   62|  9.25k|    code here;                  /* table entry for duplication */
   63|  9.25k|    code FAR *next;             /* next available space in table */
   64|  9.25k|    const unsigned short FAR *base = NULL;  /* base value table to use */
   65|  9.25k|    const unsigned short FAR *extra = NULL; /* extra bits table to use */
   66|  9.25k|    unsigned match = 0;         /* use base and extra for symbol >= match */
   67|  9.25k|    unsigned short count[MAXBITS+1];    /* number of codes of each length */
   68|  9.25k|    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
   69|  9.25k|    static const unsigned short lbase[31] = { /* Length codes 257..285 base */
   70|  9.25k|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   71|  9.25k|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
   72|  9.25k|    static const unsigned short lext[31] = { /* Length codes 257..285 extra */
   73|  9.25k|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
   74|  9.25k|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 199, 192};
   75|  9.25k|    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
   76|  9.25k|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   77|  9.25k|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   78|  9.25k|        8193, 12289, 16385, 24577, 0, 0};
   79|  9.25k|    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
   80|  9.25k|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
   81|  9.25k|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
   82|  9.25k|        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|   157k|    for (len = 0; len <= MAXBITS; len++)
  ------------------
  |  |   23|   157k|#define MAXBITS 15
  ------------------
  |  Branch (116:19): [True: 148k, False: 9.25k]
  ------------------
  117|   148k|        count[len] = 0;
  118|   978k|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (118:19): [True: 969k, False: 9.25k]
  ------------------
  119|   969k|        count[lens[sym]]++;
  120|       |
  121|       |    /* bound code lengths, force root to be within code lengths */
  122|  9.25k|    root = *bits;
  123|  96.8k|    for (max = MAXBITS; max >= 1; max--)
  ------------------
  |  |   23|  9.25k|#define MAXBITS 15
  ------------------
  |  Branch (123:25): [True: 96.8k, False: 27]
  ------------------
  124|  96.8k|        if (count[max] != 0) break;
  ------------------
  |  Branch (124:13): [True: 9.22k, False: 87.6k]
  ------------------
  125|  9.25k|    if (root > max) root = max;
  ------------------
  |  Branch (125:9): [True: 6.00k, False: 3.25k]
  ------------------
  126|  9.25k|    if (max == 0) {                     /* no symbols to code at all */
  ------------------
  |  Branch (126:9): [True: 27, False: 9.22k]
  ------------------
  127|     27|        here.op = (unsigned char)64;    /* invalid code marker */
  128|     27|        here.bits = (unsigned char)1;
  129|     27|        here.val = (unsigned short)0;
  130|     27|        *(*table)++ = here;             /* make a table to force an error */
  131|     27|        *(*table)++ = here;
  132|     27|        *bits = 1;
  133|     27|        return 0;     /* no symbols, but wait for decoding to report error */
  134|     27|    }
  135|  17.3k|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (135:19): [True: 16.4k, False: 945]
  ------------------
  136|  16.4k|        if (count[min] != 0) break;
  ------------------
  |  Branch (136:13): [True: 8.28k, False: 8.13k]
  ------------------
  137|  9.22k|    if (root < min) root = min;
  ------------------
  |  Branch (137:9): [True: 5, False: 9.22k]
  ------------------
  138|       |
  139|       |    /* check for an over-subscribed or incomplete set of lengths */
  140|  9.22k|    left = 1;
  141|   146k|    for (len = 1; len <= MAXBITS; len++) {
  ------------------
  |  |   23|   146k|#define MAXBITS 15
  ------------------
  |  Branch (141:19): [True: 137k, False: 9.10k]
  ------------------
  142|   137k|        left <<= 1;
  143|   137k|        left -= count[len];
  144|   137k|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (144:13): [True: 129, False: 136k]
  ------------------
  145|   137k|    }
  146|  9.10k|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (146:9): [True: 449, False: 8.65k]
  |  Branch (146:22): [True: 43, False: 406]
  |  Branch (146:39): [True: 59, False: 347]
  ------------------
  147|    102|        return -1;                      /* incomplete set */
  148|       |
  149|       |    /* generate offsets into symbol table for each length for sorting */
  150|  8.99k|    offs[1] = 0;
  151|   134k|    for (len = 1; len < MAXBITS; len++)
  ------------------
  |  |   23|   134k|#define MAXBITS 15
  ------------------
  |  Branch (151:19): [True: 125k, False: 8.99k]
  ------------------
  152|   125k|        offs[len + 1] = offs[len] + count[len];
  153|       |
  154|       |    /* sort symbols by length, by symbol order within each length */
  155|   953k|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (155:19): [True: 944k, False: 8.99k]
  ------------------
  156|   944k|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
  ------------------
  |  Branch (156:13): [True: 286k, False: 658k]
  ------------------
  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|  8.99k|    switch (type) {
  ------------------
  |  Branch (190:13): [True: 8.99k, False: 0]
  ------------------
  191|  3.21k|    case CODES:
  ------------------
  |  Branch (191:5): [True: 3.21k, False: 5.78k]
  ------------------
  192|  3.21k|        match = 20;
  193|  3.21k|        break;
  194|  2.91k|    case LENS:
  ------------------
  |  Branch (194:5): [True: 2.91k, False: 6.08k]
  ------------------
  195|  2.91k|        base = lbase;
  196|  2.91k|        extra = lext;
  197|  2.91k|        match = 257;
  198|  2.91k|        break;
  199|  2.87k|    case DISTS:
  ------------------
  |  Branch (199:5): [True: 2.87k, False: 6.12k]
  ------------------
  200|  2.87k|        base = dbase;
  201|  2.87k|        extra = dext;
  202|  8.99k|    }
  203|       |
  204|       |    /* initialize state for loop */
  205|  8.99k|    huff = 0;                   /* starting code */
  206|  8.99k|    sym = 0;                    /* starting code symbol */
  207|  8.99k|    len = min;                  /* starting code length */
  208|  8.99k|    next = *table;              /* current table to fill in */
  209|  8.99k|    curr = root;                /* current table index bits */
  210|  8.99k|    drop = 0;                   /* current bits to drop from code for index */
  211|  8.99k|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  212|  8.99k|    used = 1U << root;          /* use root table entries */
  213|  8.99k|    mask = used - 1;            /* mask for comparing low */
  214|       |
  215|       |    /* check available table space */
  216|  8.99k|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   50|  2.91k|#  define ENOUGH_LENS 1332
  ------------------
  |  Branch (216:10): [True: 2.91k, False: 6.08k]
  |  Branch (216:26): [True: 0, False: 2.91k]
  ------------------
  217|  8.99k|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   51|  2.87k|#  define ENOUGH_DISTS 400
  ------------------
  |  Branch (217:10): [True: 2.87k, False: 6.12k]
  |  Branch (217:27): [True: 0, False: 2.87k]
  ------------------
  218|      0|        return 1;
  219|       |
  220|       |    /* process all codes and make table entries */
  221|   286k|    for (;;) {
  222|       |        /* create table entry */
  223|   286k|        here.bits = (unsigned char)(len - drop);
  224|   286k|        if (work[sym] + 1U < match) {
  ------------------
  |  Branch (224:13): [True: 228k, False: 58.1k]
  ------------------
  225|   228k|            here.op = (unsigned char)0;
  226|   228k|            here.val = work[sym];
  227|   228k|        }
  228|  58.1k|        else if (work[sym] >= match) {
  ------------------
  |  Branch (228:18): [True: 55.1k, False: 2.91k]
  ------------------
  229|  55.1k|            here.op = (unsigned char)(extra[work[sym] - match]);
  230|  55.1k|            here.val = base[work[sym] - match];
  231|  55.1k|        }
  232|  2.91k|        else {
  233|  2.91k|            here.op = (unsigned char)(32 + 64);         /* end of block */
  234|  2.91k|            here.val = 0;
  235|  2.91k|        }
  236|       |
  237|       |        /* replicate for those indices with low len bits equal to huff */
  238|   286k|        incr = 1U << (len - drop);
  239|   286k|        fill = 1U << curr;
  240|   286k|        min = fill;                 /* save offset to next table */
  241|  1.85M|        do {
  242|  1.85M|            fill -= incr;
  243|  1.85M|            next[(huff >> drop) + fill] = here;
  244|  1.85M|        } while (fill != 0);
  ------------------
  |  Branch (244:18): [True: 1.56M, False: 286k]
  ------------------
  245|       |
  246|       |        /* backwards increment the len-bit code huff */
  247|   286k|        incr = 1U << (len - 1);
  248|   563k|        while (huff & incr)
  ------------------
  |  Branch (248:16): [True: 277k, False: 286k]
  ------------------
  249|   277k|            incr >>= 1;
  250|   286k|        if (incr != 0) {
  ------------------
  |  Branch (250:13): [True: 277k, False: 8.65k]
  ------------------
  251|   277k|            huff &= incr - 1;
  252|   277k|            huff += incr;
  253|   277k|        }
  254|  8.65k|        else
  255|  8.65k|            huff = 0;
  256|       |
  257|       |        /* go to next symbol, update count, len */
  258|   286k|        sym++;
  259|   286k|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (259:13): [True: 39.2k, False: 246k]
  ------------------
  260|  39.2k|            if (len == max) break;
  ------------------
  |  Branch (260:17): [True: 8.99k, False: 30.2k]
  ------------------
  261|  30.2k|            len = lens[work[sym]];
  262|  30.2k|        }
  263|       |
  264|       |        /* create new sub-table if needed */
  265|   277k|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (265:13): [True: 6.80k, False: 270k]
  |  Branch (265:27): [True: 3.11k, False: 3.69k]
  ------------------
  266|       |            /* if first time, transition to sub-tables */
  267|  3.11k|            if (drop == 0)
  ------------------
  |  Branch (267:17): [True: 651, False: 2.45k]
  ------------------
  268|    651|                drop = root;
  269|       |
  270|       |            /* increment past last table */
  271|  3.11k|            next += min;            /* here min is 1 << curr */
  272|       |
  273|       |            /* determine length of next table */
  274|  3.11k|            curr = len - drop;
  275|  3.11k|            left = (int)(1 << curr);
  276|  3.26k|            while (curr + drop < max) {
  ------------------
  |  Branch (276:20): [True: 954, False: 2.30k]
  ------------------
  277|    954|                left -= count[curr + drop];
  278|    954|                if (left <= 0) break;
  ------------------
  |  Branch (278:21): [True: 801, False: 153]
  ------------------
  279|    153|                curr++;
  280|    153|                left <<= 1;
  281|    153|            }
  282|       |
  283|       |            /* check for enough space */
  284|  3.11k|            used += 1U << curr;
  285|  3.11k|            if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   50|  2.82k|#  define ENOUGH_LENS 1332
  ------------------
  |  Branch (285:18): [True: 2.82k, False: 286]
  |  Branch (285:34): [True: 0, False: 2.82k]
  ------------------
  286|  3.11k|                (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   51|    286|#  define ENOUGH_DISTS 400
  ------------------
  |  Branch (286:18): [True: 286, False: 2.82k]
  |  Branch (286:35): [True: 0, False: 286]
  ------------------
  287|      0|                return 1;
  288|       |
  289|       |            /* point entry in root table to sub-table */
  290|  3.11k|            low = huff & mask;
  291|  3.11k|            (*table)[low].op = (unsigned char)curr;
  292|  3.11k|            (*table)[low].bits = (unsigned char)root;
  293|  3.11k|            (*table)[low].val = (unsigned short)(next - *table);
  294|  3.11k|        }
  295|   277k|    }
  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|  8.99k|    if (huff != 0) {
  ------------------
  |  Branch (300:9): [True: 347, False: 8.65k]
  ------------------
  301|    347|        here.op = (unsigned char)64;            /* invalid code marker */
  302|    347|        here.bits = (unsigned char)(len - drop);
  303|    347|        here.val = (unsigned short)0;
  304|    347|        next[huff] = here;
  305|    347|    }
  306|       |
  307|       |    /* set return parameters */
  308|  8.99k|    *table += used;
  309|  8.99k|    *bits = root;
  310|  8.99k|    return 0;
  311|  8.99k|}
inflate_fixed:
  364|  5.33k|void inflate_fixed(struct inflate_state FAR *state) {
  365|       |#ifdef BUILDFIXED
  366|       |    z_once(&built, buildtables);
  367|       |#endif /* BUILDFIXED */
  368|  5.33k|    state->lencode = lenfix;
  369|  5.33k|    state->lenbits = 9;
  370|  5.33k|    state->distcode = distfix;
  371|  5.33k|    state->distbits = 5;
  372|  5.33k|}

zcalloc:
  324|  7.21k|voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
  325|  7.21k|    (void)opaque;
  326|  7.21k|    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
  ------------------
  |  Branch (326:12): [True: 7.21k, Folded]
  ------------------
  327|  7.21k|                              (voidpf)calloc(items, size);
  328|  7.21k|}
zcfree:
  330|  7.21k|void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
  331|  7.21k|    (void)opaque;
  332|  7.21k|    free(ptr);
  333|  7.21k|}

