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

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

_ZN4qpdf10BaseHandleD2Ev:
  131|  15.6M|        ~BaseHandle() = default;
_ZNK4qpdf10BaseHandleeqERKS0_:
   67|  3.16k|        {
   68|  3.16k|            return obj == other.obj;
   69|  3.16k|        }
_ZNK4qpdf10BaseHandle5emptyEv:
   82|  8.42k|        {
   83|  8.42k|            return size() == 0;
   84|  8.42k|        }
_ZN4qpdf10BaseHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  120|  1.28M|            obj(obj) {};
_ZN4qpdf10BaseHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
  122|  4.41M|            obj(std::move(obj)) {};
_ZN4qpdf10BaseHandleC2Ev:
  118|   720k|        BaseHandle() = default;
_ZN4qpdf10BaseHandleC2ERKS0_:
  123|  1.60M|        BaseHandle(BaseHandle const&) = default;
_ZN4qpdf10BaseHandleaSEOS0_:
  126|   283k|        BaseHandle& operator=(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleC2EOS0_:
  125|  6.41M|        BaseHandle(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleaSERKS0_:
  124|   227k|        BaseHandle& operator=(BaseHandle const&) = default;

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

_ZN5QIntC9to_offsetImEExRKT_:
  222|  4.84M|    {
  223|  4.84M|        return IntConverter<T, qpdf_offset_t>::convert(i);
  224|  4.84M|    }
_ZN5QIntC12IntConverterImxLb0ELb1EE7convertERKm:
  147|  4.84M|        {
  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.84M|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|  4.84M|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 0, False: 4.84M]
  ------------------
  152|      0|                error(i);
  153|      0|            }
  154|  4.84M|            return static_cast<To>(i);
  155|  4.84M|        }
_ZN5QIntC11range_checkIxEEvRKT_S3_:
  274|  98.4k|    {
  275|  98.4k|        if ((delta > 0) != (cur > 0)) {
  ------------------
  |  Branch (275:13): [True: 91.4k, False: 7.08k]
  ------------------
  276|  91.4k|            return;
  277|  91.4k|        }
  278|  7.08k|        QIntC::range_check_error<T>(cur, delta);
  279|  7.08k|    }
_ZN5QIntC17range_check_errorIxEEvRKT_S3_:
  257|  7.08k|    {
  258|  7.08k|        if ((delta > 0) && ((std::numeric_limits<T>::max() - cur) < delta)) {
  ------------------
  |  Branch (258:13): [True: 7.08k, False: 0]
  |  Branch (258:28): [True: 86, False: 6.99k]
  ------------------
  259|     86|            std::ostringstream msg;
  260|     86|            msg.imbue(std::locale::classic());
  261|     86|            msg << "adding " << delta << " to " << cur << " would cause an integer overflow";
  262|     86|            throw std::range_error(msg.str());
  263|  6.99k|        } else if ((delta < 0) && ((std::numeric_limits<T>::min() - cur) > delta)) {
  ------------------
  |  Branch (263:20): [True: 0, False: 6.99k]
  |  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|  7.08k|    }
_ZN5QIntC7to_sizeIxEEmRKT_:
  215|  3.51M|    {
  216|  3.51M|        return IntConverter<T, size_t>::convert(i);
  217|  3.51M|    }
_ZN5QIntC12IntConverterIxmLb1ELb0EE7convertERKx:
  119|  3.51M|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|  3.51M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  3.51M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 3.51M]
  |  Branch (124:28): [True: 0, False: 3.51M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  3.51M|            return static_cast<To>(i);
  128|  3.51M|        }
_ZN5QIntC6to_intImEEiRKT_:
  201|  19.0k|    {
  202|  19.0k|        return IntConverter<T, int>::convert(i);
  203|  19.0k|    }
_ZN5QIntC12IntConverterImiLb0ELb1EE7convertERKm:
  147|  19.0k|        {
  148|       |            // From is unsigned, and to is signed. Convert To's max to the
  149|       |            // unsigned version of To and compare i against that.
  150|  19.0k|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|  19.0k|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 0, False: 19.0k]
  ------------------
  152|      0|                error(i);
  153|      0|            }
  154|  19.0k|            return static_cast<To>(i);
  155|  19.0k|        }
_ZN5QIntC7to_sizeIiEEmRKT_:
  215|  19.2k|    {
  216|  19.2k|        return IntConverter<T, size_t>::convert(i);
  217|  19.2k|    }
_ZN5QIntC12IntConverterIimLb1ELb0EE7convertERKi:
  119|   117M|        {
  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|   117M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   117M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 117M]
  |  Branch (124:28): [True: 0, False: 117M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   117M|            return static_cast<To>(i);
  128|   117M|        }
_ZN5QIntC6to_intIxEEiRKT_:
  201|  6.57M|    {
  202|  6.57M|        return IntConverter<T, int>::convert(i);
  203|  6.57M|    }
_ZN5QIntC12IntConverterIxiLb1ELb1EE7convertERKx:
   94|  6.57M|        {
   95|       |            // From and To are both signed.
   96|  6.57M|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 669, False: 6.57M]
  |  Branch (96:57): [True: 720, False: 6.57M]
  ------------------
   97|  1.38k|                error(i);
   98|  1.38k|            }
   99|  6.57M|            return static_cast<To>(i);
  100|  6.57M|        }
_ZN5QIntC12IntConverterIxiLb1ELb1EE5errorEx:
  104|  1.38k|        {
  105|  1.38k|            std::ostringstream msg;
  106|  1.38k|            msg.imbue(std::locale::classic());
  107|  1.38k|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  108|  1.38k|                << "-byte signed type to a " << sizeof(To) << "-byte signed type";
  109|  1.38k|            throw std::range_error(msg.str());
  110|  1.38k|        }
_ZN5QIntC7to_sizeImEEmRKT_:
  215|     28|    {
  216|     28|        return IntConverter<T, size_t>::convert(i);
  217|     28|    }
_ZN5QIntC12IntConverterImmLb0ELb0EE7convertERKm:
   69|  60.4k|        {
   70|       |            // From and To are both unsigned.
   71|  60.4k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 60.4k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  60.4k|            return static_cast<To>(i);
   75|  60.4k|        }
_ZN5QIntC7to_uintIiEEjRKT_:
  208|  25.6k|    {
  209|  25.6k|        return IntConverter<T, unsigned int>::convert(i);
  210|  25.6k|    }
_ZN5QIntC12IntConverterIijLb1ELb0EE7convertERKi:
  119|  25.6k|        {
  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.6k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  25.6k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 25.6k]
  |  Branch (124:28): [True: 0, False: 25.6k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  25.6k|            return static_cast<To>(i);
  128|  25.6k|        }
_ZN5QIntC6to_intIlEEiRKT_:
  201|  6.77k|    {
  202|  6.77k|        return IntConverter<T, int>::convert(i);
  203|  6.77k|    }
_ZN5QIntC12IntConverterIliLb1ELb1EE7convertERKl:
   94|  6.77k|        {
   95|       |            // From and To are both signed.
   96|  6.77k|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 0, False: 6.77k]
  |  Branch (96:57): [True: 0, False: 6.77k]
  ------------------
   97|      0|                error(i);
   98|      0|            }
   99|  6.77k|            return static_cast<To>(i);
  100|  6.77k|        }
_ZN5QIntC7to_sizeIyEEmRKT_:
  215|  7.19k|    {
  216|  7.19k|        return IntConverter<T, size_t>::convert(i);
  217|  7.19k|    }
_ZN5QIntC12IntConverterIymLb0ELb0EE7convertERKy:
   69|  7.19k|        {
   70|       |            // From and To are both unsigned.
   71|  7.19k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 7.19k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  7.19k|            return static_cast<To>(i);
   75|  7.19k|        }
_ZN5QIntC8to_ulongIcEEmRKT_:
  236|  8.98M|    {
  237|  8.98M|        return IntConverter<T, unsigned long>::convert(i);
  238|  8.98M|    }
_ZN5QIntC12IntConverterIcmLb1ELb0EE7convertERKc:
  119|  8.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|  8.98M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  8.98M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 8.98M]
  |  Branch (124:28): [True: 0, False: 8.98M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  8.98M|            return static_cast<To>(i);
  128|  8.98M|        }
_ZN5QIntC8to_ulongIhEEmRKT_:
  236|   330M|    {
  237|   330M|        return IntConverter<T, unsigned long>::convert(i);
  238|   330M|    }
_ZN5QIntC12IntConverterIhmLb0ELb0EE7convertERKh:
   69|   330M|        {
   70|       |            // From and To are both unsigned.
   71|   330M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 330M]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   330M|            return static_cast<To>(i);
   75|   330M|        }
_ZN5QIntC8to_ulongIiEEmRKT_:
  236|   117M|    {
  237|   117M|        return IntConverter<T, unsigned long>::convert(i);
  238|   117M|    }
_ZN5QIntC7to_sizeIlEEmRKT_:
  215|   550k|    {
  216|   550k|        return IntConverter<T, size_t>::convert(i);
  217|   550k|    }
_ZN5QIntC12IntConverterIlmLb1ELb0EE7convertERKl:
  119|   550k|        {
  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|   550k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   550k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 550k]
  |  Branch (124:28): [True: 0, False: 550k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   550k|            return static_cast<To>(i);
  128|   550k|        }
_ZN5QIntC9to_ushortIiEEtRKT_:
  194|  15.0M|    {
  195|  15.0M|        return IntConverter<T, unsigned short>::convert(i);
  196|  15.0M|    }
_ZN5QIntC12IntConverterIitLb1ELb0EE7convertERKi:
  119|  15.0M|        {
  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|  15.0M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  15.0M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 15.0M]
  |  Branch (124:28): [True: 0, False: 15.0M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  15.0M|            return static_cast<To>(i);
  128|  15.0M|        }
_ZN5QIntC7to_sizeIjEEmRKT_:
  215|  5.07k|    {
  216|  5.07k|        return IntConverter<T, size_t>::convert(i);
  217|  5.07k|    }
_ZN5QIntC12IntConverterIjmLb0ELb0EE7convertERKj:
   69|  5.07k|        {
   70|       |            // From and To are both unsigned.
   71|  5.07k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 5.07k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  5.07k|            return static_cast<To>(i);
   75|  5.07k|        }
_ZN5QIntC7to_uintImEEjRKT_:
  208|   987k|    {
  209|   987k|        return IntConverter<T, unsigned int>::convert(i);
  210|   987k|    }
_ZN5QIntC12IntConverterImjLb0ELb0EE7convertERKm:
   69|   987k|        {
   70|       |            // From and To are both unsigned.
   71|   987k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 987k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   987k|            return static_cast<To>(i);
   75|   987k|        }
_ZN5QIntC8to_ulongImEEmRKT_:
  236|  60.3k|    {
  237|  60.3k|        return IntConverter<T, unsigned long>::convert(i);
  238|  60.3k|    }

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

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

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

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

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

_ZN10QPDFObjGenC2Eii:
   40|  1.65M|        obj(obj),
   41|  1.65M|        gen(gen)
   42|  1.65M|    {
   43|  1.65M|    }
_ZNK10QPDFObjGenltERKS_:
   46|  65.2M|    {
   47|  65.2M|        return (obj < rhs.obj) || (obj == rhs.obj && gen < rhs.gen);
  ------------------
  |  Branch (47:16): [True: 37.7M, False: 27.4M]
  |  Branch (47:36): [True: 4.07M, False: 23.3M]
  |  Branch (47:54): [True: 111k, False: 3.96M]
  ------------------
   48|  65.2M|    }
_ZNK10QPDFObjGeneqERKS_:
   51|   138k|    {
   52|   138k|        return obj == rhs.obj && gen == rhs.gen;
  ------------------
  |  Branch (52:16): [True: 134k, False: 4.41k]
  |  Branch (52:34): [True: 134k, False: 194]
  ------------------
   53|   138k|    }
_ZNK10QPDFObjGenneERKS_:
   56|   123k|    {
   57|   123k|        return !(*this == rhs);
   58|   123k|    }
_ZNK10QPDFObjGen6getObjEv:
   61|  1.92M|    {
   62|  1.92M|        return obj;
   63|  1.92M|    }
_ZNK10QPDFObjGen6getGenEv:
   66|  3.00k|    {
   67|  3.00k|        return gen;
   68|  3.00k|    }
_ZNK10QPDFObjGen10isIndirectEv:
   71|  1.01M|    {
   72|  1.01M|        return obj != 0;
   73|  1.01M|    }
_ZNK10QPDFObjGen7unparseEc:
   76|   187k|    {
   77|   187k|        return std::to_string(obj) + separator + std::to_string(gen);
   78|   187k|    }
_ZN10QPDFObjGen3set3addES_:
  111|   153k|        {
  112|   153k|            if (og.isIndirect()) {
  ------------------
  |  Branch (112:17): [True: 56.4k, False: 96.6k]
  ------------------
  113|  56.4k|                if (count(og)) {
  ------------------
  |  Branch (113:21): [True: 9.07k, False: 47.3k]
  ------------------
  114|  9.07k|                    return false;
  115|  9.07k|                }
  116|  47.3k|                emplace(og);
  117|  47.3k|            }
  118|   143k|            return true;
  119|   153k|        }
_ZN10QPDFObjGenC2Ev:
   38|  5.29M|    QPDFObjGen() = default;

_ZN16QPDFObjectHandle9RectangleC2Edddd:
  243|  3.95k|            llx(llx),
  244|  3.95k|            lly(lly),
  245|  3.95k|            urx(urx),
  246|  3.95k|            ury(ury)
  247|  3.95k|        {
  248|  3.95k|        }
_ZN16QPDFObjectHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
 1315|   892k|        qpdf::BaseHandle(obj)
 1316|   892k|    {
 1317|   892k|    }
_ZN16QPDFObjectHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
 1319|  4.32M|        qpdf::BaseHandle(std::move(obj))
 1320|  4.32M|    {
 1321|  4.32M|    }
_ZN16QPDFObjectHandle6getObjEv:
 1324|  10.0k|    {
 1325|  10.0k|        return obj;
 1326|  10.0k|    }
_ZNK4qpdf10BaseHandlecvbEv:
 1559|  2.19M|    {
 1560|  2.19M|        return static_cast<bool>(obj);
 1561|  2.19M|    }
_ZNK4qpdf10BaseHandlecv16QPDFObjectHandleEv:
 1565|   101k|    {
 1566|   101k|        return {obj};
 1567|   101k|    }
_ZN16QPDFObjectHandleC2Ev:
  289|   689k|    QPDFObjectHandle() = default;
_ZN16QPDFObjectHandleC2ERKS_:
  290|  1.51M|    QPDFObjectHandle(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandleaSEOS_:
  293|   283k|    QPDFObjectHandle& operator=(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleC2EOS_:
  292|  6.41M|    QPDFObjectHandle(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleaSERKS_:
  291|   221k|    QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilterC2Ev:
  163|  10.1k|        TokenFilter() = default;

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

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

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

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

_ZN13QPDFTokenizer5TokenC2Ev:
   71|  2.21M|            type(tt_bad)
   72|  2.21M|        {
   73|  2.21M|        }
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES8_S8_:
   81|  2.21M|            type(type),
   82|  2.21M|            value(value),
   83|  2.21M|            raw_value(raw_value),
   84|  2.21M|            error_message(error_message)
   85|  2.21M|        {
   86|  2.21M|        }
_ZNK13QPDFTokenizer5Token7getTypeEv:
   89|  2.21M|        {
   90|  2.21M|            return this->type;
   91|  2.21M|        }
_ZNK13QPDFTokenizer5Token8getValueEv:
   94|  1.81M|        {
   95|  1.81M|            return this->value;
   96|  1.81M|        }
_ZNK13QPDFTokenizer5Token9isIntegerEv:
  116|  1.80M|        {
  117|  1.80M|            return this->type == tt_integer;
  118|  1.80M|        }
_ZNK13QPDFTokenizer5Token6isWordERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  126|  2.14M|        {
  127|  2.14M|            return this->type == tt_word && this->value == value;
  ------------------
  |  Branch (127:20): [True: 1.48M, False: 654k]
  |  Branch (127:45): [True: 620k, False: 865k]
  ------------------
  128|  2.14M|        }

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

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

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

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

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

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

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

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

_ZN17BufferInputSourceC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEP6Bufferb:
   16|  19.8k|    own_memory(own_memory),
   17|  19.8k|    description(description),
   18|  19.8k|    buf(buf),
   19|  19.8k|    cur_offset(0),
   20|  19.8k|    max_offset(buf ? QIntC::to_offset(buf->getSize()) : 0)
  ------------------
  |  Branch (20:16): [True: 19.8k, False: 0]
  ------------------
   21|  19.8k|{
   22|  19.8k|}
_ZN17BufferInputSourceD2Ev:
   35|  19.8k|{
   36|  19.8k|    if (own_memory) {
  ------------------
  |  Branch (36:9): [True: 0, False: 19.8k]
  ------------------
   37|      0|        delete buf;
   38|      0|    }
   39|  19.8k|}
_ZN17BufferInputSource18findAndSkipNextEOLEv:
   43|  1.32M|{
   44|  1.32M|    util::internal_error_if(cur_offset < 0, "BufferInputSource offset < 0");
   45|  1.32M|    qpdf_offset_t end_pos = max_offset;
   46|  1.32M|    if (cur_offset >= end_pos) {
  ------------------
  |  Branch (46:9): [True: 6.07k, False: 1.32M]
  ------------------
   47|  6.07k|        last_offset = end_pos;
   48|  6.07k|        cur_offset = end_pos;
   49|  6.07k|        return end_pos;
   50|  6.07k|    }
   51|       |
   52|  1.32M|    qpdf_offset_t result = 0;
   53|  1.32M|    unsigned char const* buffer = buf->getBuffer();
   54|  1.32M|    unsigned char const* end = buffer + end_pos;
   55|  1.32M|    unsigned char const* p = buffer + cur_offset;
   56|       |
   57|   189M|    while ((p < end) && !((*p == '\r') || (*p == '\n'))) {
  ------------------
  |  Branch (57:12): [True: 189M, False: 12.8k]
  |  Branch (57:27): [True: 427k, False: 189M]
  |  Branch (57:43): [True: 881k, False: 188M]
  ------------------
   58|   188M|        ++p;
   59|   188M|    }
   60|  1.32M|    if (p < end) {
  ------------------
  |  Branch (60:9): [True: 1.30M, False: 12.8k]
  ------------------
   61|  1.30M|        result = p - buffer;
   62|  1.30M|        cur_offset = result + 1;
   63|  1.30M|        ++p;
   64|  1.43M|        while ((cur_offset < end_pos) && ((*p == '\r') || (*p == '\n'))) {
  ------------------
  |  Branch (64:16): [True: 1.42M, False: 1.43k]
  |  Branch (64:43): [True: 6.75k, False: 1.42M]
  |  Branch (64:59): [True: 115k, False: 1.30M]
  ------------------
   65|   121k|            ++p;
   66|   121k|            ++cur_offset;
   67|   121k|        }
   68|  1.30M|    } else {
   69|  12.8k|        cur_offset = end_pos;
   70|  12.8k|        result = end_pos;
   71|  12.8k|    }
   72|  1.32M|    return result;
   73|  1.32M|}
_ZNK17BufferInputSource7getNameEv:
   77|   771k|{
   78|   771k|    return description;
   79|   771k|}
_ZN17BufferInputSource4tellEv:
   83|  14.1M|{
   84|  14.1M|    return cur_offset;
   85|  14.1M|}
_ZN17BufferInputSource4seekExi:
   89|  10.3M|{
   90|  10.3M|    switch (whence) {
   91|  10.2M|    case SEEK_SET:
  ------------------
  |  Branch (91:5): [True: 10.2M, False: 98.4k]
  ------------------
   92|  10.2M|        cur_offset = offset;
   93|  10.2M|        break;
   94|       |
   95|  38.9k|    case SEEK_END:
  ------------------
  |  Branch (95:5): [True: 38.9k, False: 10.3M]
  ------------------
   96|  38.9k|        QIntC::range_check(max_offset, offset);
   97|  38.9k|        cur_offset = max_offset + offset;
   98|  38.9k|        break;
   99|       |
  100|  59.5k|    default:
  ------------------
  |  Branch (100:5): [True: 59.5k, False: 10.3M]
  ------------------
  101|  59.5k|        util::assertion(whence == SEEK_CUR, "invalid argument to BufferInputSource::seek");
  102|  59.5k|        QIntC::range_check(cur_offset, offset);
  103|  59.5k|        cur_offset += offset;
  104|  10.3M|    }
  105|       |
  106|  10.3M|    if (cur_offset < 0) {
  ------------------
  |  Branch (106:9): [True: 375, False: 10.3M]
  ------------------
  107|    375|        throw std::runtime_error(description + ": seek before beginning of buffer");
  108|    375|    }
  109|  10.3M|}
_ZN17BufferInputSource4readEPcm:
  119|  3.43M|{
  120|  3.43M|    util::internal_error_if(cur_offset < 0, "BufferInputSource offset < 0");
  121|  3.43M|    qpdf_offset_t end_pos = max_offset;
  122|  3.43M|    if (cur_offset >= end_pos) {
  ------------------
  |  Branch (122:9): [True: 66.3k, False: 3.37M]
  ------------------
  123|  66.3k|        last_offset = end_pos;
  124|  66.3k|        return 0;
  125|  66.3k|    }
  126|       |
  127|  3.37M|    last_offset = cur_offset;
  128|  3.37M|    size_t len = std::min(QIntC::to_size(end_pos - cur_offset), length);
  129|  3.37M|    memcpy(buffer, buf->getBuffer() + cur_offset, len);
  130|  3.37M|    cur_offset += QIntC::to_offset(len);
  131|  3.37M|    return len;
  132|  3.43M|}
_ZN17BufferInputSource8unreadChEc:
  136|  20.9k|{
  137|  20.9k|    if (cur_offset > 0) {
  ------------------
  |  Branch (137:9): [True: 20.9k, False: 0]
  ------------------
  138|  20.9k|        --cur_offset;
  139|  20.9k|    }
  140|  20.9k|}
_ZN4qpdf2is12OffsetBuffer4seekExi:
  258|  1.04M|{
  259|  1.04M|    switch (whence) {
  260|  1.04M|    case SEEK_SET:
  ------------------
  |  Branch (260:5): [True: 1.04M, False: 0]
  ------------------
  261|  1.04M|        pos = offset - global_offset;
  262|  1.04M|        break;
  263|       |
  264|      0|    case SEEK_END:
  ------------------
  |  Branch (264:5): [True: 0, False: 1.04M]
  ------------------
  265|      0|        QIntC::range_check(static_cast<qpdf_offset_t>(view_.size()), offset);
  266|      0|        pos = static_cast<qpdf_offset_t>(view_.size()) + offset;
  267|      0|        break;
  268|       |
  269|      0|    default:
  ------------------
  |  Branch (269:5): [True: 0, False: 1.04M]
  ------------------
  270|      0|        util::assertion(whence == SEEK_CUR, "invalid argument to BufferInputSource::seek");
  271|      0|        QIntC::range_check(pos, offset);
  272|      0|        pos += offset;
  273|  1.04M|    }
  274|       |
  275|  1.04M|    if (pos < 0) {
  ------------------
  |  Branch (275:9): [True: 0, False: 1.04M]
  ------------------
  276|      0|        throw std::runtime_error(description + ": seek before beginning of buffer");
  277|      0|    }
  278|  1.04M|}
_ZN4qpdf2is12OffsetBuffer4readEPcm:
  282|   107k|{
  283|   107k|    util::internal_error_if(pos < 0, "is::OffsetBuffer offset < 0");
  284|   107k|    auto end_pos = static_cast<qpdf_offset_t>(view_.size());
  285|   107k|    if (pos >= end_pos) {
  ------------------
  |  Branch (285:9): [True: 2.86k, False: 104k]
  ------------------
  286|  2.86k|        last_offset = end_pos + global_offset;
  287|  2.86k|        return 0;
  288|  2.86k|    }
  289|       |
  290|   104k|    last_offset = pos + global_offset;
  291|   104k|    size_t len = std::min(QIntC::to_size(end_pos - pos), length);
  292|   104k|    memcpy(buffer, view_.data() + pos, len);
  293|   104k|    pos += QIntC::to_offset(len);
  294|   104k|    return len;
  295|   107k|}

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

_ZN11InputSource13setLastOffsetEx:
   15|  7.95M|{
   16|  7.95M|    this->last_offset = offset;
   17|  7.95M|}
_ZNK11InputSource13getLastOffsetEv:
   21|  4.85M|{
   22|  4.85M|    return this->last_offset;
   23|  4.85M|}
_ZN11InputSource9read_lineERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   27|  10.9k|{
   28|       |    // Return at most max_line_length characters from the next line. Lines are terminated by one or
   29|       |    // more \r or \n characters. Consume the trailing newline characters but don't return them.
   30|       |    // After this is called, the file will be positioned after a line terminator or at the end of
   31|       |    // the file, and last_offset will point to position the file had when this method was called.
   32|       |
   33|  10.9k|    read(str, count, at);
   34|  10.9k|    auto eol = str.find_first_of("\n\r"sv);
   35|  10.9k|    if (eol != std::string::npos) {
  ------------------
  |  Branch (35:9): [True: 8.35k, False: 2.63k]
  ------------------
   36|  8.35k|        auto next_line = str.find_first_not_of("\n\r"sv, eol);
   37|  8.35k|        str.resize(eol);
   38|  8.35k|        if (eol != std::string::npos) {
  ------------------
  |  Branch (38:13): [True: 8.35k, False: 0]
  ------------------
   39|  8.35k|            seek(last_offset + static_cast<qpdf_offset_t>(next_line), SEEK_SET);
   40|  8.35k|            return eol;
   41|  8.35k|        }
   42|  8.35k|    }
   43|       |    // We did not necessarily find the end of the trailing newline sequence.
   44|  2.63k|    seek(last_offset, SEEK_SET);
   45|  2.63k|    findAndSkipNextEOL();
   46|  2.63k|    return eol;
   47|  10.9k|}
_ZN11InputSource8readLineEm:
   51|  10.9k|{
   52|  10.9k|    return read_line(max_line_length);
   53|  10.9k|}
_ZN11InputSource9findFirstEPKcxmRNS_6FinderE:
   65|  64.4k|{
   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|  64.4k|    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|  64.4k|    size_t size = sizeof(buf) - 1;
   79|  64.4k|    util::assertion(
   80|  64.4k|        !(strlen(start_chars) < 1 || strlen(start_chars) > size),
  ------------------
  |  Branch (80:11): [True: 0, False: 64.4k]
  |  Branch (80:38): [True: 0, False: 64.4k]
  ------------------
   81|  64.4k|        "InputSource::findSource called with too small or too large of a character sequence" //
   82|  64.4k|    );
   83|       |
   84|  64.4k|    char* p = nullptr;
   85|  64.4k|    qpdf_offset_t buf_offset = offset;
   86|  64.4k|    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|   589k|    while (true) {
  ------------------
  |  Branch (91:12): [True: 589k, 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|   589k|        if ((p == nullptr) || ((p + strlen(start_chars)) > (buf + bytes_read))) {
  ------------------
  |  Branch (97:13): [True: 64.4k, False: 525k]
  |  Branch (97:31): [True: 193k, False: 331k]
  ------------------
   98|   257k|            if (p) {
  ------------------
  |  Branch (98:17): [True: 193k, False: 64.4k]
  ------------------
   99|   193k|                QTC::TC(
  100|   193k|                    "libtests", "InputSource read next block", ((p == buf + bytes_read) ? 0 : 1));
  ------------------
  |  Branch (100:65): [True: 189k, False: 3.88k]
  ------------------
  101|   193k|                buf_offset += (p - buf);
  102|   193k|            }
  103|   257k|            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|   257k|            bytes_read = this->read(buf, size);
  108|   257k|            if (bytes_read < strlen(start_chars)) {
  ------------------
  |  Branch (108:17): [True: 38.7k, False: 218k]
  ------------------
  109|  38.7k|                QTC::TC("libtests", "InputSource find EOF", bytes_read == 0 ? 0 : 1);
  ------------------
  |  Branch (109:61): [True: 31.9k, False: 6.73k]
  ------------------
  110|  38.7k|                return false;
  111|  38.7k|            }
  112|   218k|            memset(buf + bytes_read, '\0', 1 + (size - bytes_read));
  113|   218k|            p = buf;
  114|   218k|        }
  115|       |
  116|       |        // Search for the first character.
  117|   550k|        if ((p = static_cast<char*>(
  ------------------
  |  Branch (117:13): [True: 361k, False: 189k]
  ------------------
  118|       |                 // line-break
  119|   550k|                 memchr(p, start_chars[0], bytes_read - QIntC::to_size(p - buf)))) != nullptr) {
  120|   361k|            if (p == buf) {
  ------------------
  |  Branch (120:17): [True: 4.49k, False: 356k]
  ------------------
  121|  4.49k|                QTC::TC("libtests", "InputSource found match at buf[0]");
  122|  4.49k|            }
  123|       |            // Found first letter.
  124|   361k|            if (len != 0) {
  ------------------
  |  Branch (124:17): [True: 18.0k, False: 343k]
  ------------------
  125|       |                // Make sure it's in range.
  126|  18.0k|                size_t p_relative_offset = QIntC::to_size((p - buf) + (buf_offset - offset));
  127|  18.0k|                if (p_relative_offset >= len) {
  ------------------
  |  Branch (127:21): [True: 1.22k, False: 16.8k]
  ------------------
  128|       |                    // out of range
  129|  1.22k|                    QTC::TC("libtests", "InputSource out of range");
  130|  1.22k|                    return false;
  131|  1.22k|                }
  132|  18.0k|            }
  133|   360k|            if ((p + strlen(start_chars)) > (buf + bytes_read)) {
  ------------------
  |  Branch (133:17): [True: 3.15k, False: 356k]
  ------------------
  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|  3.15k|                QTC::TC("libtests", "InputSource not enough bytes");
  137|  3.15k|                continue;
  138|  3.15k|            }
  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|   356k|            if (strncmp(p, start_chars, strlen(start_chars)) == 0) {
  ------------------
  |  Branch (142:17): [True: 33.8k, False: 323k]
  ------------------
  143|       |                // Call finder.check() with the input source positioned to the point of the match.
  144|  33.8k|                this->seek(buf_offset + (p - buf), SEEK_SET);
  145|  33.8k|                if (finder.check()) {
  ------------------
  |  Branch (145:21): [True: 24.4k, False: 9.41k]
  ------------------
  146|  24.4k|                    return true;
  147|  24.4k|                } else {
  148|  9.41k|                    QTC::TC("libtests", "InputSource start_chars matched but not check");
  149|  9.41k|                }
  150|   323k|            } else {
  151|   323k|                QTC::TC("libtests", "InputSource first char matched but not string");
  152|   323k|            }
  153|       |            // This occurrence of the first character wasn't a match. Skip over it and keep
  154|       |            // searching.
  155|   332k|            ++p;
  156|   332k|        } else {
  157|       |            // Trigger reading the next block
  158|   189k|            p = buf + bytes_read;
  159|   189k|        }
  160|   550k|    }
  161|  64.4k|}
_ZN11InputSource8findLastEPKcxmRNS_6FinderE:
  165|  19.8k|{
  166|  19.8k|    bool found = false;
  167|  19.8k|    qpdf_offset_t after_found_offset = 0;
  168|  19.8k|    qpdf_offset_t cur_offset = offset;
  169|  19.8k|    size_t cur_len = len;
  170|  25.5k|    while (this->findFirst(start_chars, cur_offset, cur_len, finder)) {
  ------------------
  |  Branch (170:12): [True: 5.68k, False: 19.8k]
  ------------------
  171|  5.68k|        if (found) {
  ------------------
  |  Branch (171:13): [True: 375, False: 5.31k]
  ------------------
  172|    375|            QTC::TC("libtests", "InputSource findLast found more than one");
  173|  5.31k|        } else {
  174|  5.31k|            found = true;
  175|  5.31k|        }
  176|  5.68k|        after_found_offset = this->tell();
  177|  5.68k|        cur_offset = after_found_offset;
  178|  5.68k|        cur_len = len - QIntC::to_size((cur_offset - offset));
  179|  5.68k|    }
  180|  19.8k|    if (found) {
  ------------------
  |  Branch (180:9): [True: 5.31k, False: 14.5k]
  ------------------
  181|       |        this->seek(after_found_offset, SEEK_SET);
  182|  5.31k|    }
  183|  19.8k|    return found;
  184|  19.8k|}
_ZN11InputSource9read_lineEmx:
   57|  10.9k|{
   58|  10.9k|    std::string result(count, '\0');
   59|  10.9k|    read_line(result, count, at);
   60|  10.9k|    return result;
   61|  10.9k|}

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

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

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

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

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

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

_ZN17Pl_ASCII85DecoderC2EPKcP8Pipeline:
   12|    681|    Pipeline(identifier, next)
   13|    681|{
   14|    681|    util::assertion(next, "Attempt to create Pl_ASCII85Decoder with nullptr as next");
   15|    681|}
_ZN17Pl_ASCII85Decoder5writeEPKhm:
   19|    838|{
   20|    838|    if (eod > 1) {
  ------------------
  |  Branch (20:9): [True: 0, False: 838]
  ------------------
   21|      0|        return;
   22|      0|    }
   23|   840k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (23:24): [True: 840k, False: 476]
  ------------------
   24|   840k|        switch (buf[i]) {
  ------------------
  |  Branch (24:17): [True: 2.58k, False: 837k]
  ------------------
   25|    756|        case ' ':
  ------------------
  |  Branch (25:9): [True: 756, False: 839k]
  ------------------
   26|  1.03k|        case '\f':
  ------------------
  |  Branch (26:9): [True: 279, False: 839k]
  ------------------
   27|  1.33k|        case '\v':
  ------------------
  |  Branch (27:9): [True: 303, False: 839k]
  ------------------
   28|  1.60k|        case '\t':
  ------------------
  |  Branch (28:9): [True: 270, False: 839k]
  ------------------
   29|  1.96k|        case '\r':
  ------------------
  |  Branch (29:9): [True: 357, False: 839k]
  ------------------
   30|  2.58k|        case '\n':
  ------------------
  |  Branch (30:9): [True: 618, False: 839k]
  ------------------
   31|  2.58k|            QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
   32|       |            // ignore whitespace
   33|  2.58k|            continue;
   34|   840k|        }
   35|   837k|        if (eod > 1) {
  ------------------
  |  Branch (35:13): [True: 22, False: 837k]
  ------------------
   36|     22|            break;
   37|   837k|        } else if (eod == 1) {
  ------------------
  |  Branch (37:20): [True: 43, False: 837k]
  ------------------
   38|     43|            util::no_ci_rt_error_if(buf[i] != '>', "broken end-of-data sequence in base 85 data");
   39|     43|            flush();
   40|     43|            eod = 2;
   41|   837k|        } else {
   42|   837k|            switch (buf[i]) {
   43|     45|            case '~':
  ------------------
  |  Branch (43:13): [True: 45, False: 837k]
  ------------------
   44|     45|                eod = 1;
   45|     45|                break;
   46|       |
   47|  1.29k|            case 'z':
  ------------------
  |  Branch (47:13): [True: 1.29k, False: 836k]
  ------------------
   48|  1.29k|                if (pos != 0) {
  ------------------
  |  Branch (48:21): [True: 62, False: 1.23k]
  ------------------
   49|     62|                    throw std::runtime_error("unexpected z during base 85 decode");
   50|     62|                }
   51|  1.23k|                unsigned char zeroes[4];
   52|  1.23k|                memset(zeroes, '\0', 4);
   53|  1.23k|                next()->write(zeroes, 4);
   54|  1.23k|                break;
   55|       |
   56|   836k|            default:
  ------------------
  |  Branch (56:13): [True: 836k, False: 1.33k]
  ------------------
   57|   836k|                if (buf[i] < 33 || buf[i] > 117) {
  ------------------
  |  Branch (57:21): [True: 83, False: 836k]
  |  Branch (57:36): [True: 113, False: 836k]
  ------------------
   58|    196|                    error = true;
   59|    196|                    throw std::runtime_error("character out of range during base 85 decode");
   60|   836k|                } else {
   61|   836k|                    this->inbuf[this->pos++] = buf[i];
   62|   836k|                    if (pos == 5) {
  ------------------
  |  Branch (62:25): [True: 167k, False: 669k]
  ------------------
   63|   167k|                        flush();
   64|   167k|                    }
   65|   836k|                }
   66|   836k|                break;
   67|   837k|            }
   68|   837k|        }
   69|   837k|    }
   70|    838|}
_ZN17Pl_ASCII85Decoder5flushEv:
   74|   167k|{
   75|   167k|    if (this->pos == 0) {
  ------------------
  |  Branch (75:9): [True: 265, False: 167k]
  ------------------
   76|    265|        return;
   77|    265|    }
   78|   167k|    unsigned long lval = 0;
   79|  1.00M|    for (int i = 0; i < 5; ++i) {
  ------------------
  |  Branch (79:21): [True: 836k, False: 167k]
  ------------------
   80|   836k|        lval *= 85;
   81|   836k|        lval += (this->inbuf[i] - 33U);
   82|   836k|    }
   83|       |
   84|   167k|    unsigned char outbuf[4];
   85|   167k|    memset(outbuf, 0, 4);
   86|   836k|    for (int i = 3; i >= 0; --i) {
  ------------------
  |  Branch (86:21): [True: 669k, False: 167k]
  ------------------
   87|   669k|        outbuf[i] = lval & 0xff;
   88|   669k|        lval >>= 8;
   89|   669k|    }
   90|       |
   91|   167k|    QTC::TC("libtests", "Pl_ASCII85Decoder partial flush", (this->pos == 5) ? 0 : 1);
  ------------------
  |  Branch (91:60): [True: 167k, False: 237]
  ------------------
   92|       |    // Reset before calling getNext()->write in case that throws an exception.
   93|   167k|    auto t = this->pos - 1;
   94|   167k|    this->pos = 0;
   95|   167k|    memset(this->inbuf, 117, 5);
   96|       |
   97|   167k|    next()->write(outbuf, t);
   98|   167k|}
_ZN17Pl_ASCII85Decoder6finishEv:
  102|    652|{
  103|    652|    if (error) {
  ------------------
  |  Branch (103:9): [True: 175, False: 477]
  ------------------
  104|    175|        return;
  105|    175|    }
  106|    477|    flush();
  107|    477|    next()->finish();
  108|    477|}

_ZN18Pl_ASCIIHexDecoderC2EPKcP8Pipeline:
   13|    482|    Pipeline(identifier, next)
   14|    482|{
   15|    482|    util::assertion(next, "Attempt to create Pl_ASCIIHexDecoder with nullptr as next");
   16|    482|}
_ZN18Pl_ASCIIHexDecoder5writeEPKhm:
   20|    761|{
   21|    761|    if (eod) {
  ------------------
  |  Branch (21:9): [True: 225, False: 536]
  ------------------
   22|    225|        return;
   23|    225|    }
   24|  5.80k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (24:24): [True: 5.43k, False: 363]
  ------------------
   25|  5.43k|        char ch = static_cast<char>(toupper(buf[i]));
   26|  5.43k|        switch (ch) {
   27|    267|        case ' ':
  ------------------
  |  Branch (27:9): [True: 267, False: 5.17k]
  ------------------
   28|    556|        case '\f':
  ------------------
  |  Branch (28:9): [True: 289, False: 5.14k]
  ------------------
   29|    912|        case '\v':
  ------------------
  |  Branch (29:9): [True: 356, False: 5.08k]
  ------------------
   30|  1.18k|        case '\t':
  ------------------
  |  Branch (30:9): [True: 270, False: 5.16k]
  ------------------
   31|  1.63k|        case '\r':
  ------------------
  |  Branch (31:9): [True: 448, False: 4.99k]
  ------------------
   32|  2.00k|        case '\n':
  ------------------
  |  Branch (32:9): [True: 371, False: 5.06k]
  ------------------
   33|  2.00k|            QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space");
   34|       |            // ignore whitespace
   35|  2.00k|            break;
   36|       |
   37|     44|        case '>':
  ------------------
  |  Branch (37:9): [True: 44, False: 5.39k]
  ------------------
   38|     44|            eod = true;
   39|     44|            flush();
   40|     44|            break;
   41|       |
   42|  3.39k|        default:
  ------------------
  |  Branch (42:9): [True: 3.39k, False: 2.04k]
  ------------------
   43|  3.39k|            if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F')) {
  ------------------
  |  Branch (43:18): [True: 3.31k, False: 77]
  |  Branch (43:31): [True: 2.12k, False: 1.19k]
  |  Branch (43:46): [True: 1.18k, False: 78]
  |  Branch (43:59): [True: 1.14k, False: 49]
  ------------------
   44|  3.26k|                inbuf[pos++] = ch;
   45|  3.26k|                if (pos == 2) {
  ------------------
  |  Branch (45:21): [True: 1.58k, False: 1.68k]
  ------------------
   46|  1.58k|                    flush();
   47|  1.58k|                }
   48|  3.26k|            } else {
   49|    127|                char t[2];
   50|    127|                t[0] = ch;
   51|    127|                t[1] = 0;
   52|    127|                throw std::runtime_error("character out of range during base Hex decode: "s + t);
   53|    127|            }
   54|  3.26k|            break;
   55|  5.43k|        }
   56|  5.30k|        if (eod) {
  ------------------
  |  Branch (56:13): [True: 43, False: 5.26k]
  ------------------
   57|     43|            break;
   58|     43|        }
   59|  5.30k|    }
   60|    536|}
_ZN18Pl_ASCIIHexDecoder5flushEv:
   64|  2.04k|{
   65|  2.04k|    if (pos == 0) {
  ------------------
  |  Branch (65:9): [True: 368, False: 1.68k]
  ------------------
   66|    368|        QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush");
   67|    368|        return;
   68|    368|    }
   69|  1.68k|    int b[2];
   70|  5.04k|    for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (70:21): [True: 3.36k, False: 1.68k]
  ------------------
   71|  3.36k|        if (inbuf[i] >= 'A') {
  ------------------
  |  Branch (71:13): [True: 1.13k, False: 2.22k]
  ------------------
   72|  1.13k|            b[i] = inbuf[i] - 'A' + 10;
   73|  2.22k|        } else {
   74|  2.22k|            b[i] = inbuf[i] - '0';
   75|  2.22k|        }
   76|  3.36k|    }
   77|  1.68k|    auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
   78|       |
   79|  1.68k|    QTC::TC("libtests", "Pl_ASCIIHexDecoder partial flush", (pos == 2) ? 0 : 1);
  ------------------
  |  Branch (79:61): [True: 1.58k, False: 100]
  ------------------
   80|       |    // Reset before calling getNext()->write in case that throws an exception.
   81|  1.68k|    pos = 0;
   82|  1.68k|    inbuf[0] = '0';
   83|  1.68k|    inbuf[1] = '0';
   84|  1.68k|    inbuf[2] = '\0';
   85|       |
   86|  1.68k|    next()->write(&ch, 1);
   87|  1.68k|}
_ZN18Pl_ASCIIHexDecoder6finishEv:
   91|    424|{
   92|    424|    flush();
   93|    424|    next()->finish();
   94|    424|}

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

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

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

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

_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|  1.87M|{
   30|  1.87M|    m->os.write(reinterpret_cast<char const*>(buf), static_cast<std::streamsize>(len));
   31|  1.87M|}
_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.69k|    Pipeline(identifier, next),
   31|  1.69k|    action(action)
   32|  1.69k|{
   33|  1.69k|    util::assertion(next, "Attempt to create Pl_PNGFilter with nullptr as next");
   34|  1.69k|    util::no_ci_rt_error_if(
   35|  1.69k|        samples_per_pixel < 1, "PNGFilter created with invalid samples_per_pixel");
   36|  1.69k|    util::no_ci_rt_error_if(
   37|  1.69k|        !(bits_per_sample == 1 || bits_per_sample == 2 || bits_per_sample == 4 ||
  ------------------
  |  Branch (37:11): [True: 69, False: 1.62k]
  |  Branch (37:35): [True: 66, False: 1.56k]
  |  Branch (37:59): [True: 66, False: 1.49k]
  ------------------
   38|  1.49k|          bits_per_sample == 8 || bits_per_sample == 16),
  ------------------
  |  Branch (38:11): [True: 1.37k, False: 118]
  |  Branch (38:35): [True: 100, False: 18]
  ------------------
   39|  1.69k|        "PNGFilter created with invalid bits_per_sample not 1, 2, 4, 8, or 16");
   40|  1.69k|    auto bits_per_pixel = 1ULL * bits_per_sample * samples_per_pixel;
   41|  1.69k|    util::no_ci_rt_error_if(
   42|  1.69k|        !util::fits<uint32_t>(bits_per_pixel + 7),
   43|  1.69k|        "PNGFilter created with bits_per_sample and samples_per_pixel values that cause overflow");
   44|  1.69k|    bytes_per_pixel = static_cast<uint32_t>((bits_per_pixel + 7) / 8);
   45|  1.69k|    auto bpr = ((columns * bits_per_pixel) + 7) / 8;
   46|  1.69k|    util::no_ci_rt_error_if(
   47|  1.69k|        bpr == 0 || !util::fits<uint32_t>(bpr), "PNGFilter created with invalid columns value");
  ------------------
  |  Branch (47:9): [True: 21, False: 1.67k]
  |  Branch (47:21): [True: 0, False: 1.67k]
  ------------------
   48|  1.69k|    util::no_ci_rt_error_if(
   49|  1.69k|        memory_limit > 0 && bpr > (memory_limit / 2U), "PNGFilter memory limit exceeded");
  ------------------
  |  Branch (49:9): [True: 1.67k, False: 21]
  |  Branch (49:29): [True: 0, False: 1.67k]
  ------------------
   50|  1.69k|    bytes_per_row = static_cast<uint32_t>(bpr);
   51|  1.69k|    buf1 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   52|  1.69k|    buf2 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   53|  1.69k|    memset(buf1.get(), 0, bytes_per_row + 1);
   54|  1.69k|    memset(buf2.get(), 0, bytes_per_row + 1);
   55|  1.69k|    cur_row = buf1.get();
   56|  1.69k|    prev_row = buf2.get();
   57|       |
   58|       |    // number of bytes per incoming row
   59|  1.69k|    incoming = (action == a_encode ? bytes_per_row : bytes_per_row + 1);
  ------------------
  |  Branch (59:17): [True: 0, False: 1.69k]
  ------------------
   60|  1.69k|}
_ZN12Pl_PNGFilter5writeEPKhm:
   70|  56.6k|{
   71|  56.6k|    size_t left = incoming - pos;
   72|  56.6k|    size_t offset = 0;
   73|  1.28M|    while (len >= left) {
  ------------------
  |  Branch (73:12): [True: 1.23M, False: 56.6k]
  ------------------
   74|       |        // finish off current row
   75|  1.23M|        memcpy(cur_row + pos, data + offset, left);
   76|  1.23M|        offset += left;
   77|  1.23M|        len -= left;
   78|       |
   79|  1.23M|        processRow();
   80|       |
   81|       |        // Swap rows
   82|  1.23M|        unsigned char* t = prev_row;
   83|  1.23M|        prev_row = cur_row;
   84|  1.23M|        cur_row = t ? t : buf2.get();
  ------------------
  |  Branch (84:19): [True: 1.23M, False: 2]
  ------------------
   85|  1.23M|        memset(cur_row, 0, bytes_per_row + 1);
   86|  1.23M|        left = incoming;
   87|  1.23M|        pos = 0;
   88|  1.23M|    }
   89|  56.6k|    if (len) {
  ------------------
  |  Branch (89:9): [True: 55.7k, False: 918]
  ------------------
   90|  55.7k|        memcpy(cur_row + pos, data + offset, len);
   91|  55.7k|    }
   92|  56.6k|    pos += len;
   93|  56.6k|}
_ZN12Pl_PNGFilter10processRowEv:
   97|  1.23M|{
   98|  1.23M|    if (action == a_encode) {
  ------------------
  |  Branch (98:9): [True: 0, False: 1.23M]
  ------------------
   99|      0|        encodeRow();
  100|  1.23M|    } else {
  101|  1.23M|        decodeRow();
  102|  1.23M|    }
  103|  1.23M|}
_ZN12Pl_PNGFilter9decodeRowEv:
  107|  1.23M|{
  108|  1.23M|    int filter = cur_row[0];
  109|  1.23M|    if (prev_row) {
  ------------------
  |  Branch (109:9): [True: 1.23M, False: 0]
  ------------------
  110|  1.23M|        switch (filter) {
  111|   258k|        case 0:
  ------------------
  |  Branch (111:9): [True: 258k, False: 974k]
  ------------------
  112|   258k|            break;
  113|   124k|        case 1:
  ------------------
  |  Branch (113:9): [True: 124k, False: 1.10M]
  ------------------
  114|   124k|            decodeSub();
  115|   124k|            break;
  116|   558k|        case 2:
  ------------------
  |  Branch (116:9): [True: 558k, False: 674k]
  ------------------
  117|   558k|            decodeUp();
  118|   558k|            break;
  119|  14.7k|        case 3:
  ------------------
  |  Branch (119:9): [True: 14.7k, False: 1.21M]
  ------------------
  120|  14.7k|            decodeAverage();
  121|  14.7k|            break;
  122|  2.41k|        case 4:
  ------------------
  |  Branch (122:9): [True: 2.41k, False: 1.23M]
  ------------------
  123|  2.41k|            decodePaeth();
  124|  2.41k|            break;
  125|   273k|        default:
  ------------------
  |  Branch (125:9): [True: 273k, False: 958k]
  ------------------
  126|       |            // ignore
  127|   273k|            break;
  128|  1.23M|        }
  129|  1.23M|    }
  130|       |
  131|  1.23M|    next()->write(cur_row + 1, bytes_per_row);
  132|  1.23M|}
_ZN12Pl_PNGFilter9decodeSubEv:
  136|   124k|{
  137|   124k|    unsigned char* buffer = cur_row + 1;
  138|   124k|    unsigned int bpp = bytes_per_pixel;
  139|       |
  140|  1.05M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (140:30): [True: 930k, False: 124k]
  ------------------
  141|   930k|        unsigned char left = 0;
  142|       |
  143|   930k|        if (i >= bpp) {
  ------------------
  |  Branch (143:13): [True: 796k, False: 133k]
  ------------------
  144|   796k|            left = buffer[i - bpp];
  145|   796k|        }
  146|       |
  147|   930k|        buffer[i] = static_cast<unsigned char>(buffer[i] + left);
  148|   930k|    }
  149|   124k|}
_ZN12Pl_PNGFilter8decodeUpEv:
  153|   558k|{
  154|   558k|    unsigned char* buffer = cur_row + 1;
  155|   558k|    unsigned char* above_buffer = prev_row + 1;
  156|       |
  157|  2.65M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (157:30): [True: 2.10M, False: 558k]
  ------------------
  158|  2.10M|        unsigned char up = above_buffer[i];
  159|  2.10M|        buffer[i] = static_cast<unsigned char>(buffer[i] + up);
  160|  2.10M|    }
  161|   558k|}
_ZN12Pl_PNGFilter13decodeAverageEv:
  165|  14.7k|{
  166|  14.7k|    unsigned char* buffer = cur_row + 1;
  167|  14.7k|    unsigned char* above_buffer = prev_row + 1;
  168|  14.7k|    auto bpp = bytes_per_pixel;
  169|       |
  170|   237k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (170:30): [True: 222k, False: 14.7k]
  ------------------
  171|   222k|        int left = 0;
  172|   222k|        int up = 0;
  173|       |
  174|   222k|        if (i >= bpp) {
  ------------------
  |  Branch (174:13): [True: 207k, False: 14.7k]
  ------------------
  175|   207k|            left = buffer[i - bpp];
  176|   207k|        }
  177|       |
  178|   222k|        up = above_buffer[i];
  179|   222k|        buffer[i] = static_cast<unsigned char>(buffer[i] + (left + up) / 2);
  180|   222k|    }
  181|  14.7k|}
_ZN12Pl_PNGFilter11decodePaethEv:
  185|  2.41k|{
  186|  2.41k|    unsigned char* buffer = cur_row + 1;
  187|  2.41k|    unsigned char* above_buffer = prev_row + 1;
  188|  2.41k|    auto bpp = bytes_per_pixel;
  189|       |
  190|   196k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (190:30): [True: 194k, False: 2.41k]
  ------------------
  191|   194k|        int left = 0;
  192|   194k|        int up = above_buffer[i];
  193|   194k|        int upper_left = 0;
  194|       |
  195|   194k|        if (i >= bpp) {
  ------------------
  |  Branch (195:13): [True: 191k, False: 2.41k]
  ------------------
  196|   191k|            left = buffer[i - bpp];
  197|   191k|            upper_left = above_buffer[i - bpp];
  198|   191k|        }
  199|       |
  200|   194k|        buffer[i] = static_cast<unsigned char>(buffer[i] + PaethPredictor(left, up, upper_left));
  201|   194k|    }
  202|  2.41k|}
_ZN12Pl_PNGFilter14PaethPredictorEiii:
  206|   194k|{
  207|   194k|    int p = a + b - c;
  208|   194k|    int pa = abs_diff(p, a);
  209|   194k|    int pb = abs_diff(p, b);
  210|   194k|    int pc = abs_diff(p, c);
  211|       |
  212|   194k|    if (pa <= pb && pa <= pc) {
  ------------------
  |  Branch (212:9): [True: 189k, False: 5.22k]
  |  Branch (212:21): [True: 188k, False: 417]
  ------------------
  213|   188k|        return a;
  214|   188k|    }
  215|  5.63k|    if (pb <= pc) {
  ------------------
  |  Branch (215:9): [True: 4.96k, False: 671]
  ------------------
  216|  4.96k|        return b;
  217|  4.96k|    }
  218|    671|    return c;
  219|  5.63k|}
_ZN12Pl_PNGFilter6finishEv:
  239|  1.63k|{
  240|  1.63k|    if (pos) {
  ------------------
  |  Branch (240:9): [True: 620, False: 1.01k]
  ------------------
  241|       |        // write partial row
  242|    620|        processRow();
  243|    620|    }
  244|  1.63k|    prev_row = nullptr;
  245|  1.63k|    cur_row = buf1.get();
  246|  1.63k|    pos = 0;
  247|  1.63k|    memset(cur_row, 0, bytes_per_row + 1);
  248|       |
  249|  1.63k|    next()->finish();
  250|  1.63k|}
Pl_PNGFilter.cc:_ZL8abs_diffii:
   19|   583k|{
   20|   583k|    return a > b ? a - b : b - a;
  ------------------
  |  Branch (20:12): [True: 28.8k, False: 554k]
  ------------------
   21|   583k|}

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

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

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

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

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

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

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

_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_:
    9|   368k|    std::runtime_error(createWhat(filename, object, (offset ? offset : -1), message)),
  ------------------
  |  Branch (9:54): [True: 312k, False: 56.4k]
  ------------------
   10|   368k|    error_code(error_code),
   11|   368k|    filename(filename),
   12|   368k|    object(object),
   13|   368k|    offset(offset ? offset : -1),
  ------------------
  |  Branch (13:12): [True: 312k, False: 56.4k]
  ------------------
   14|   368k|    message(message)
   15|   368k|{
   16|   368k|}
_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_b:
   25|   325k|    std::runtime_error(
   26|   325k|        createWhat(filename, object, (offset || zero_offset_valid ? offset : -1), message)),
  ------------------
  |  Branch (26:39): [True: 325k, False: 44]
  |  Branch (26:49): [True: 44, False: 0]
  ------------------
   27|   325k|    error_code(error_code),
   28|   325k|    filename(filename),
   29|   325k|    object(object),
   30|   325k|    offset(offset || zero_offset_valid ? offset : -1),
  ------------------
  |  Branch (30:12): [True: 325k, False: 44]
  |  Branch (30:22): [True: 44, False: 0]
  ------------------
   31|   325k|    message(message)
   32|   325k|{
   33|   325k|}
_ZN7QPDFExc10createWhatERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_xS8_:
   41|   693k|{
   42|   693k|    std::string result;
   43|   693k|    if (!filename.empty()) {
  ------------------
  |  Branch (43:9): [True: 643k, False: 50.1k]
  ------------------
   44|   643k|        result += filename;
   45|   643k|    }
   46|   693k|    if (!(object.empty() && offset < 0)) {
  ------------------
  |  Branch (46:11): [True: 151k, False: 542k]
  |  Branch (46:29): [True: 102k, False: 49.4k]
  ------------------
   47|   591k|        if (!filename.empty()) {
  ------------------
  |  Branch (47:13): [True: 541k, False: 49.9k]
  ------------------
   48|   541k|            result += " (";
   49|   541k|        }
   50|   591k|        if (!object.empty()) {
  ------------------
  |  Branch (50:13): [True: 542k, False: 49.4k]
  ------------------
   51|   542k|            result += object;
   52|   542k|            if (offset >= 0) {
  ------------------
  |  Branch (52:17): [True: 486k, False: 55.8k]
  ------------------
   53|   486k|                result += ", ";
   54|   486k|            }
   55|   542k|        }
   56|   591k|        if (offset >= 0) {
  ------------------
  |  Branch (56:13): [True: 535k, False: 55.8k]
  ------------------
   57|   535k|            result += "offset " + std::to_string(offset);
   58|   535k|        }
   59|   591k|        if (!filename.empty()) {
  ------------------
  |  Branch (59:13): [True: 541k, False: 49.9k]
  ------------------
   60|   541k|            result += ")";
   61|   541k|        }
   62|   591k|    }
   63|   693k|    if (!result.empty()) {
  ------------------
  |  Branch (63:9): [True: 693k, False: 175]
  ------------------
   64|   693k|        result += ": ";
   65|   693k|    }
   66|   693k|    result += message;
   67|   693k|    return result;
   68|   693k|}

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

_ZNK4qpdf10BaseHandlecv10QPDFObjGenEv:
   34|   144k|{
   35|   144k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (35:12): [True: 144k, False: 0]
  ------------------
   36|   144k|}
_ZN16QPDFObjectHandle18StreamDataProviderC2Eb:
   46|  19.8k|    supports_retry(supports_retry)
   47|  19.8k|{
   48|  19.8k|}
_ZN16QPDFObjectHandle18StreamDataProviderD2Ev:
   51|  19.8k|{
   52|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   53|  19.8k|}
_ZNK4qpdf10BaseHandle4copyEb:
  252|  7.90k|{
  253|  7.90k|    switch (resolved_type_code()) {
  ------------------
  |  Branch (253:13): [True: 7.90k, False: 0]
  ------------------
  254|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (254:5): [True: 0, False: 7.90k]
  ------------------
  255|      0|        throw std::logic_error("QPDFObjectHandle: attempting to copy an uninitialized object");
  256|      0|        return {}; // does not return
  257|      0|    case ::ot_reserved:
  ------------------
  |  Branch (257:5): [True: 0, False: 7.90k]
  ------------------
  258|      0|        return QPDFObject::create<QPDF_Reserved>();
  259|    385|    case ::ot_null:
  ------------------
  |  Branch (259:5): [True: 385, False: 7.52k]
  ------------------
  260|    385|        return QPDFObject::create<QPDF_Null>();
  261|     22|    case ::ot_boolean:
  ------------------
  |  Branch (261:5): [True: 22, False: 7.88k]
  ------------------
  262|     22|        return QPDFObject::create<QPDF_Bool>(std::get<QPDF_Bool>(obj->value).val);
  263|  2.45k|    case ::ot_integer:
  ------------------
  |  Branch (263:5): [True: 2.45k, False: 5.45k]
  ------------------
  264|  2.45k|        return QPDFObject::create<QPDF_Integer>(std::get<QPDF_Integer>(obj->value).val);
  265|    896|    case ::ot_real:
  ------------------
  |  Branch (265:5): [True: 896, False: 7.01k]
  ------------------
  266|    896|        return QPDFObject::create<QPDF_Real>(std::get<QPDF_Real>(obj->value).val);
  267|  1.84k|    case ::ot_string:
  ------------------
  |  Branch (267:5): [True: 1.84k, False: 6.06k]
  ------------------
  268|  1.84k|        return QPDFObject::create<QPDF_String>(std::get<QPDF_String>(obj->value).val);
  269|    644|    case ::ot_name:
  ------------------
  |  Branch (269:5): [True: 644, False: 7.26k]
  ------------------
  270|    644|        return QPDFObject::create<QPDF_Name>(std::get<QPDF_Name>(obj->value).name);
  271|    592|    case ::ot_array:
  ------------------
  |  Branch (271:5): [True: 592, False: 7.31k]
  ------------------
  272|    592|        {
  273|    592|            auto const& a = std::get<QPDF_Array>(obj->value);
  274|    592|            if (shallow) {
  ------------------
  |  Branch (274:17): [True: 0, False: 592]
  ------------------
  275|      0|                return QPDFObject::create<QPDF_Array>(a);
  276|    592|            } else {
  277|    592|                QTC::TC("qpdf", "QPDF_Array copy", a.sp ? 0 : 1);
  ------------------
  |  Branch (277:52): [True: 0, False: 592]
  ------------------
  278|    592|                if (a.sp) {
  ------------------
  |  Branch (278:21): [True: 0, False: 592]
  ------------------
  279|      0|                    QPDF_Array result;
  280|      0|                    result.sp = std::make_unique<QPDF_Array::Sparse>();
  281|      0|                    result.sp->size = a.sp->size;
  282|      0|                    for (auto const& [idx, oh]: a.sp->elements) {
  ------------------
  |  Branch (282:47): [True: 0, False: 0]
  ------------------
  283|      0|                        result.sp->elements[idx] = oh.indirect() ? oh : oh.copy();
  ------------------
  |  Branch (283:52): [True: 0, False: 0]
  ------------------
  284|      0|                    }
  285|      0|                    return QPDFObject::create<QPDF_Array>(std::move(result));
  286|    592|                } else {
  287|    592|                    std::vector<QPDFObjectHandle> result;
  288|    592|                    result.reserve(a.elements.size());
  289|  2.34k|                    for (auto const& element: a.elements) {
  ------------------
  |  Branch (289:45): [True: 2.34k, False: 592]
  ------------------
  290|  2.34k|                        result.emplace_back(
  291|  2.34k|                            element ? (element.indirect() ? element : element.copy()) : element);
  ------------------
  |  Branch (291:29): [True: 2.34k, False: 0]
  |  Branch (291:40): [True: 53, False: 2.29k]
  ------------------
  292|  2.34k|                    }
  293|    592|                    return QPDFObject::create<QPDF_Array>(std::move(result), false);
  294|    592|                }
  295|    592|            }
  296|    592|        }
  297|  1.07k|    case ::ot_dictionary:
  ------------------
  |  Branch (297:5): [True: 1.07k, False: 6.83k]
  ------------------
  298|  1.07k|        {
  299|  1.07k|            auto const& d = std::get<QPDF_Dictionary>(obj->value);
  300|  1.07k|            if (shallow) {
  ------------------
  |  Branch (300:17): [True: 0, False: 1.07k]
  ------------------
  301|      0|                return QPDFObject::create<QPDF_Dictionary>(d.items);
  302|  1.07k|            } else {
  303|  1.07k|                std::map<std::string, QPDFObjectHandle> new_items;
  304|  6.53k|                for (auto const& [key, val]: d.items) {
  ------------------
  |  Branch (304:44): [True: 6.53k, False: 1.07k]
  ------------------
  305|  6.53k|                    new_items[key] = val.indirect() ? val : val.copy();
  ------------------
  |  Branch (305:38): [True: 1.17k, False: 5.35k]
  ------------------
  306|  6.53k|                }
  307|  1.07k|                return QPDFObject::create<QPDF_Dictionary>(new_items);
  308|  1.07k|            }
  309|  1.07k|        }
  310|      0|    case ::ot_stream:
  ------------------
  |  Branch (310:5): [True: 0, False: 7.90k]
  ------------------
  311|      0|        QTC::TC("qpdf", "QPDF_Stream ERR shallow copy stream");
  312|      0|        throw std::runtime_error("stream objects cannot be cloned");
  313|      0|        return {}; // does not return
  314|      0|    case ::ot_operator:
  ------------------
  |  Branch (314:5): [True: 0, False: 7.90k]
  ------------------
  315|      0|        return QPDFObject::create<QPDF_Operator>(std::get<QPDF_Operator>(obj->value).val);
  316|      0|    case ::ot_inlineimage:
  ------------------
  |  Branch (316:5): [True: 0, False: 7.90k]
  ------------------
  317|      0|        return QPDFObject::create<QPDF_InlineImage>(std::get<QPDF_InlineImage>(obj->value).val);
  318|      0|    case ::ot_unresolved:
  ------------------
  |  Branch (318:5): [True: 0, False: 7.90k]
  ------------------
  319|      0|        throw std::logic_error("QPDFObjectHandle: attempting to unparse a reserved object");
  320|      0|        return {}; // does not return
  321|      0|    case ::ot_destroyed:
  ------------------
  |  Branch (321:5): [True: 0, False: 7.90k]
  ------------------
  322|      0|        throw std::logic_error("attempted to shallow copy QPDFObjectHandle from destroyed QPDF");
  323|      0|        return {}; // does not return
  324|      0|    case ::ot_reference:
  ------------------
  |  Branch (324:5): [True: 0, False: 7.90k]
  ------------------
  325|      0|        return referenced_object().obj_sp();
  326|  7.90k|    }
  327|      0|    return {}; // unreachable
  328|  7.90k|}
_ZN4qpdf10BaseHandle10disconnectEb:
  683|   866k|{
  684|       |    // QPDF::~QPDF() calls disconnect for indirect objects, so we don't do that here.
  685|   866k|    if (only_direct && indirect()) {
  ------------------
  |  Branch (685:9): [True: 587k, False: 278k]
  |  Branch (685:24): [True: 61.4k, False: 526k]
  ------------------
  686|  61.4k|        return;
  687|  61.4k|    }
  688|       |
  689|   805k|    switch (raw_type_code()) {
  690|  39.0k|    case ::ot_array:
  ------------------
  |  Branch (690:5): [True: 39.0k, False: 766k]
  ------------------
  691|  39.0k|        {
  692|  39.0k|            auto& a = std::get<QPDF_Array>(obj->value);
  693|  39.0k|            if (a.sp) {
  ------------------
  |  Branch (693:17): [True: 143, False: 38.9k]
  ------------------
  694|  50.5k|                for (auto& item: a.sp->elements) {
  ------------------
  |  Branch (694:32): [True: 50.5k, False: 143]
  ------------------
  695|  50.5k|                    item.second.disconnect();
  696|  50.5k|                }
  697|  38.9k|            } else {
  698|   257k|                for (auto& oh: a.elements) {
  ------------------
  |  Branch (698:30): [True: 257k, False: 38.9k]
  ------------------
  699|   257k|                    oh.disconnect();
  700|   257k|                }
  701|  38.9k|            }
  702|  39.0k|        }
  703|  39.0k|        break;
  704|  76.5k|    case ::ot_dictionary:
  ------------------
  |  Branch (704:5): [True: 76.5k, False: 728k]
  ------------------
  705|   264k|        for (auto& iter: std::get<QPDF_Dictionary>(obj->value).items) {
  ------------------
  |  Branch (705:24): [True: 264k, False: 76.5k]
  ------------------
  706|   264k|            iter.second.disconnect();
  707|   264k|        }
  708|  76.5k|        break;
  709|  15.4k|    case ::ot_stream:
  ------------------
  |  Branch (709:5): [True: 15.4k, False: 790k]
  ------------------
  710|  15.4k|        {
  711|  15.4k|            auto& s = std::get<QPDF_Stream>(obj->value);
  712|  15.4k|            s.m->stream_provider = nullptr;
  713|  15.4k|            s.m->stream_dict.disconnect();
  714|  15.4k|        }
  715|  15.4k|        break;
  716|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (716:5): [True: 0, False: 805k]
  ------------------
  717|      0|        return;
  718|   674k|    default:
  ------------------
  |  Branch (718:5): [True: 674k, False: 130k]
  ------------------
  719|   674k|        break;
  720|   805k|    }
  721|   805k|    obj->qpdf = nullptr;
  722|   805k|    obj->og = QPDFObjGen();
  723|   805k|}
_ZNK16QPDFObjectHandle14isSameObjectAsERKS_:
  727|    264|{
  728|    264|    return obj == rhs.obj;
  729|    264|}
_ZNK4qpdf10BaseHandle9type_nameEv:
  739|  4.28k|{
  740|  4.28k|    static constexpr std::array<char const*, 16> tn{
  741|  4.28k|        "uninitialized",
  742|  4.28k|        "reserved",
  743|  4.28k|        "null",
  744|  4.28k|        "boolean",
  745|  4.28k|        "integer",
  746|  4.28k|        "real",
  747|  4.28k|        "string",
  748|  4.28k|        "name",
  749|  4.28k|        "array",
  750|  4.28k|        "dictionary",
  751|  4.28k|        "stream",
  752|  4.28k|        "operator",
  753|  4.28k|        "inline-image",
  754|  4.28k|        "unresolved",
  755|  4.28k|        "destroyed",
  756|  4.28k|        "reference"};
  757|  4.28k|    return tn[type_code()];
  758|  4.28k|}
_ZNK16QPDFObjectHandle6isBoolEv:
  774|  2.31k|{
  775|  2.31k|    return type_code() == ::ot_boolean;
  776|  2.31k|}
_ZNK16QPDFObjectHandle6isNullEv:
  788|  2.35k|{
  789|  2.35k|    return type_code() == ::ot_null;
  790|  2.35k|}
_ZNK16QPDFObjectHandle9isIntegerEv:
  794|   110k|{
  795|   110k|    return type_code() == ::ot_integer;
  796|   110k|}
_ZNK16QPDFObjectHandle6isRealEv:
  800|  11.3k|{
  801|  11.3k|    return type_code() == ::ot_real;
  802|  11.3k|}
_ZNK16QPDFObjectHandle8isNumberEv:
  806|  18.9k|{
  807|  18.9k|    return (isInteger() || isReal());
  ------------------
  |  Branch (807:13): [True: 8.00k, False: 10.9k]
  |  Branch (807:28): [True: 10.7k, False: 204]
  ------------------
  808|  18.9k|}
_ZNK16QPDFObjectHandle6isNameEv:
  836|  13.5k|{
  837|  13.5k|    return type_code() == ::ot_name;
  838|  13.5k|}
_ZNK16QPDFObjectHandle8isStringEv:
  842|  11.2k|{
  843|  11.2k|    return type_code() == ::ot_string;
  844|  11.2k|}
_ZNK16QPDFObjectHandle7isArrayEv:
  860|  78.8k|{
  861|  78.8k|    return type_code() == ::ot_array;
  862|  78.8k|}
_ZNK16QPDFObjectHandle12isDictionaryEv:
  866|   436k|{
  867|   436k|    return type_code() == ::ot_dictionary;
  868|   436k|}
_ZNK16QPDFObjectHandle8isScalarEv:
  884|  1.31k|{
  885|  1.31k|    return isBool() || isInteger() || isName() || isNull() || isReal() || isString();
  ------------------
  |  Branch (885:12): [True: 38, False: 1.27k]
  |  Branch (885:24): [True: 747, False: 525]
  |  Branch (885:39): [True: 126, False: 399]
  |  Branch (885:51): [True: 0, False: 399]
  |  Branch (885:63): [True: 40, False: 359]
  |  Branch (885:75): [True: 7, False: 352]
  ------------------
  886|  1.31k|}
_ZNK16QPDFObjectHandle15isNameAndEqualsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  890|  1.76k|{
  891|  1.76k|    return Name(*this) == name;
  892|  1.76k|}
_ZNK16QPDFObjectHandle18isDictionaryOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  896|   154k|{
  897|   154k|    return isDictionary() && (type.empty() || Name((*this)["/Type"]) == type) &&
  ------------------
  |  Branch (897:12): [True: 54.3k, False: 100k]
  |  Branch (897:31): [True: 0, False: 54.3k]
  |  Branch (897:47): [True: 9.81k, False: 44.5k]
  ------------------
  898|  9.81k|        (subtype.empty() || Name((*this)["/Subtype"]) == subtype);
  ------------------
  |  Branch (898:10): [True: 9.75k, False: 56]
  |  Branch (898:29): [True: 17, False: 39]
  ------------------
  899|   154k|}
_ZNK16QPDFObjectHandle14isStreamOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  903|  54.4k|{
  904|  54.4k|    if (auto stream = as_stream()) {
  ------------------
  |  Branch (904:14): [True: 20.9k, False: 33.5k]
  ------------------
  905|  20.9k|        return stream && (type.empty() || stream.Type() == type) &&
  ------------------
  |  Branch (905:16): [True: 20.9k, False: 0]
  |  Branch (905:27): [True: 0, False: 20.9k]
  |  Branch (905:43): [True: 15.7k, False: 5.22k]
  ------------------
  906|  15.7k|            (subtype.empty() || stream.Subtype() == subtype);
  ------------------
  |  Branch (906:14): [True: 15.7k, False: 0]
  |  Branch (906:33): [True: 0, False: 0]
  ------------------
  907|  20.9k|    }
  908|  33.5k|    return false;
  909|  54.4k|}
_ZNK16QPDFObjectHandle12getBoolValueEv:
  915|      2|{
  916|      2|    if (auto boolean = as<QPDF_Bool>()) {
  ------------------
  |  Branch (916:14): [True: 2, False: 0]
  ------------------
  917|      2|        return boolean->val;
  918|      2|    } else {
  919|      0|        typeWarning("boolean", "returning false");
  920|      0|        QTC::TC("qpdf", "QPDFObjectHandle boolean returning false");
  921|      0|        return false;
  922|      0|    }
  923|      2|}
_ZN4qpdf7IntegerC2Ex:
  938|  1.89k|    BaseHandle(QPDFObject::create<QPDF_Integer>(value))
  939|  1.89k|{
  940|  1.89k|}
_ZNK4qpdf7Integer5valueEv:
  950|  95.8k|{
  951|  95.8k|    auto* i = as<QPDF_Integer>();
  952|  95.8k|    if (!i) {
  ------------------
  |  Branch (952:9): [True: 1.74k, False: 94.0k]
  ------------------
  953|  1.74k|        throw invalid_error("Integer");
  954|  1.74k|    }
  955|  94.0k|    return i->val;
  956|  95.8k|}
_ZNK16QPDFObjectHandle11getIntValueEv:
  960|  18.7k|{
  961|  18.7k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (961:20): [True: 18.7k, False: 0]
  ------------------
  962|  18.7k|        return integer;
  963|  18.7k|    } else {
  964|      0|        typeWarning("integer", "returning 0");
  965|      0|        return 0;
  966|      0|    }
  967|  18.7k|}
_ZNK16QPDFObjectHandle13getValueAsIntERx:
  971|  8.34k|{
  972|  8.34k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (972:20): [True: 8.25k, False: 83]
  ------------------
  973|  8.25k|        value = integer;
  974|  8.25k|        return true;
  975|  8.25k|    }
  976|     83|    return false;
  977|  8.34k|}
_ZNK16QPDFObjectHandle16getIntValueAsIntEv:
  981|  47.1k|{
  982|  47.1k|    try {
  983|  47.1k|        return Integer(*this).value<int>();
  984|  47.1k|    } catch (std::invalid_argument&) {
  985|     42|        typeWarning("integer", "returning 0");
  986|     42|        return 0;
  987|     42|    }
  988|  47.1k|}
_ZNK16QPDFObjectHandle13getValueAsIntERi:
  992|  2.46k|{
  993|  2.46k|    if (!isInteger()) {
  ------------------
  |  Branch (993:9): [True: 54, False: 2.41k]
  ------------------
  994|     54|        return false;
  995|     54|    }
  996|  2.41k|    value = getIntValueAsInt();
  997|  2.41k|    return true;
  998|  2.46k|}
_ZNK16QPDFObjectHandle12getUIntValueEv:
 1002|  12.2k|{
 1003|  12.2k|    try {
 1004|  12.2k|        return Integer(*this).value<unsigned long long>();
 1005|  12.2k|    } catch (std::invalid_argument&) {
 1006|  1.12k|        typeWarning("integer", "returning 0");
 1007|  1.12k|        return 0;
 1008|  1.12k|    }
 1009|  12.2k|}
_ZNK16QPDFObjectHandle18getUIntValueAsUIntEv:
 1023|  9.43k|{
 1024|  9.43k|    try {
 1025|  9.43k|        return Integer(*this).value<unsigned int>();
 1026|  9.43k|    } catch (std::invalid_argument&) {
 1027|    577|        typeWarning("integer", "returning 0");
 1028|    577|        return 0;
 1029|    577|    }
 1030|  9.43k|}
_ZNK16QPDFObjectHandle14getValueAsUIntERj:
 1034|  2.64k|{
 1035|  2.64k|    if (!isInteger()) {
  ------------------
  |  Branch (1035:9): [True: 162, False: 2.48k]
  ------------------
 1036|    162|        return false;
 1037|    162|    }
 1038|  2.48k|    value = getUIntValueAsUInt();
 1039|  2.48k|    return true;
 1040|  2.64k|}
_ZN4qpdf4NameC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1078|  11.5k|    BaseHandle(QPDFObject::create<QPDF_Name>(std::move(name)))
 1079|  11.5k|{
 1080|  11.5k|}
_ZNK4qpdf4Name5valueEv:
 1084|  67.8k|{
 1085|  67.8k|    auto* n = as<QPDF_Name>();
 1086|  67.8k|    if (!n) {
  ------------------
  |  Branch (1086:9): [True: 0, False: 67.8k]
  ------------------
 1087|      0|        throw invalid_error("Name");
 1088|      0|    }
 1089|  67.8k|    return n->name;
 1090|  67.8k|}
_ZNK16QPDFObjectHandle7getNameEv:
 1094|  5.83k|{
 1095|  5.83k|    if (auto* name = as<QPDF_Name>()) {
  ------------------
  |  Branch (1095:15): [True: 5.83k, False: 0]
  ------------------
 1096|  5.83k|        return name->name;
 1097|  5.83k|    }
 1098|      0|    typeWarning("name", "returning dummy name");
 1099|      0|    return "/QPDFFakeName";
 1100|  5.83k|}
_ZN16QPDFObjectHandle9newStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1116|     21|{
 1117|     21|    return {QPDFObject::create<QPDF_String>(str)};
 1118|     21|}
_ZN16QPDFObjectHandle16newUnicodeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1122|  2.29k|{
 1123|  2.29k|    return {String::utf16(utf8_str).obj_sp()};
 1124|  2.29k|}
_ZN4qpdf6StringC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1127|  1.54k|    BaseHandle(QPDFObject::create<QPDF_String>(str))
 1128|  1.54k|{
 1129|  1.54k|}
_ZN4qpdf6StringC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1132|    750|    BaseHandle(QPDFObject::create<QPDF_String>(std::move(str)))
 1133|    750|{
 1134|    750|}
_ZN4qpdf6String5utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1138|  2.29k|{
 1139|  2.29k|    std::string result;
 1140|  2.29k|    if (QUtil::utf8_to_pdf_doc(utf8_str, result, '?')) {
  ------------------
  |  Branch (1140:9): [True: 1.54k, False: 750]
  ------------------
 1141|  1.54k|        return String(result);
 1142|  1.54k|    }
 1143|    750|    return String(QUtil::utf8_to_utf16(utf8_str));
 1144|  2.29k|}
_ZNK4qpdf6String5valueEv:
 1148|  4.88k|{
 1149|  4.88k|    auto* s = as<QPDF_String>();
 1150|  4.88k|    if (!s) {
  ------------------
  |  Branch (1150:9): [True: 0, False: 4.88k]
  ------------------
 1151|      0|        throw invalid_error("String");
 1152|      0|    }
 1153|  4.88k|    return s->val;
 1154|  4.88k|}
_ZNK4qpdf6String10utf8_valueEv:
 1158|   348k|{
 1159|   348k|    auto* s = as<QPDF_String>();
 1160|   348k|    if (!s) {
  ------------------
  |  Branch (1160:9): [True: 0, False: 348k]
  ------------------
 1161|      0|        throw invalid_error("String");
 1162|      0|    }
 1163|   348k|    if (util::is_utf16(s->val)) {
  ------------------
  |  Branch (1163:9): [True: 3.84k, False: 344k]
  ------------------
 1164|  3.84k|        return QUtil::utf16_to_utf8(s->val);
 1165|  3.84k|    }
 1166|   344k|    if (util::is_explicit_utf8(s->val)) {
  ------------------
  |  Branch (1166:9): [True: 4.97k, False: 339k]
  ------------------
 1167|       |        // PDF 2.0 allows UTF-8 strings when explicitly prefixed with the three-byte representation
 1168|       |        // of U+FEFF.
 1169|  4.97k|        return s->val.substr(3);
 1170|  4.97k|    }
 1171|   339k|    return QUtil::pdf_doc_to_utf8(s->val);
 1172|   344k|}
_ZNK16QPDFObjectHandle14getStringValueEv:
 1176|  4.88k|{
 1177|  4.88k|    try {
 1178|  4.88k|        return String(obj).value();
 1179|  4.88k|    } catch (std::invalid_argument&) {
 1180|      0|        typeWarning("string", "returning empty string");
 1181|      0|        return {};
 1182|      0|    }
 1183|  4.88k|}
_ZNK16QPDFObjectHandle12getUTF8ValueEv:
 1198|   348k|{
 1199|   348k|    try {
 1200|   348k|        return String(obj).utf8_value();
 1201|   348k|    } catch (std::invalid_argument&) {
 1202|      0|        typeWarning("string", "returning empty string");
 1203|      0|        return {};
 1204|      0|    }
 1205|   348k|}
_ZNK16QPDFObjectHandle11isOrHasNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1280|    426|{
 1281|    426|    if (isNameAndEquals(value)) {
  ------------------
  |  Branch (1281:9): [True: 5, False: 421]
  ------------------
 1282|      5|        return true;
 1283|    421|    } else if (isArray()) {
  ------------------
  |  Branch (1283:16): [True: 46, False: 375]
  ------------------
 1284|  1.27k|        for (auto& item: getArrayAsVector()) {
  ------------------
  |  Branch (1284:24): [True: 1.27k, False: 45]
  ------------------
 1285|  1.27k|            if (item.isNameAndEquals(value)) {
  ------------------
  |  Branch (1285:17): [True: 1, False: 1.27k]
  ------------------
 1286|      1|                return true;
 1287|      1|            }
 1288|  1.27k|        }
 1289|     46|    }
 1290|    420|    return false;
 1291|    426|}
_ZN16QPDFObjectHandle7newNullEv:
 1886|  20.8k|{
 1887|  20.8k|    return {QPDFObject::create<QPDF_Null>()};
 1888|  20.8k|}
_ZN16QPDFObjectHandle7newRealEdib:
 1898|  15.8k|{
 1899|  15.8k|    return {QPDFObject::create<QPDF_Real>(value, decimal_places, trim_trailing_zeroes)};
 1900|  15.8k|}
_ZN16QPDFObjectHandle8newArrayERKNSt3__16vectorIS_NS0_9allocatorIS_EEEE:
 1922|  3.95k|{
 1923|  3.95k|    return {QPDFObject::create<QPDF_Array>(items)};
 1924|  3.95k|}
_ZN16QPDFObjectHandle8newArrayERKNS_9RectangleE:
 1928|  3.95k|{
 1929|  3.95k|    return newArray({newReal(rect.llx), newReal(rect.lly), newReal(rect.urx), newReal(rect.ury)});
 1930|  3.95k|}
_ZN16QPDFObjectHandle13newDictionaryEv:
 1976|  5.84k|{
 1977|  5.84k|    return newDictionary(std::map<std::string, QPDFObjectHandle>());
 1978|  5.84k|}
_ZN16QPDFObjectHandle13newDictionaryERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S_EEEEEE:
 1982|  5.84k|{
 1983|  5.84k|    return {QPDFObject::create<QPDF_Dictionary>(items)};
 1984|  5.84k|}
_ZNK4qpdf10BaseHandle11descriptionEv:
 2027|  50.1k|{
 2028|  50.1k|    return obj ? obj->getDescription() : ""s;
  ------------------
  |  Branch (2028:12): [True: 50.1k, False: 0]
  ------------------
 2029|  50.1k|}
_ZNK16QPDFObjectHandle20hasObjectDescriptionEv:
 2042|  23.2k|{
 2043|  23.2k|    return obj && obj->hasDescription();
  ------------------
  |  Branch (2043:12): [True: 23.2k, False: 0]
  |  Branch (2043:19): [True: 23.2k, False: 0]
  ------------------
 2044|  23.2k|}
_ZN16QPDFObjectHandle11shallowCopyEv:
 2048|    256|{
 2049|    256|    if (!obj) {
  ------------------
  |  Branch (2049:9): [True: 0, False: 256]
  ------------------
 2050|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2051|      0|    }
 2052|    256|    return {copy()};
 2053|    256|}
_ZNK4qpdf10BaseHandle13invalid_errorERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2128|  1.74k|{
 2129|  1.74k|    return std::invalid_argument(method + " operation attempted on invalid object");
 2130|  1.74k|}
_ZNK4qpdf10BaseHandle10type_errorEPKcRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 2140|  4.28k|{
 2141|  4.28k|    return {
 2142|  4.28k|        qpdf_e_object,
 2143|  4.28k|        "",
 2144|  4.28k|        description(),
 2145|  4.28k|        0,
 2146|  4.28k|        "operation for "s + expected_type + " attempted on object of type " + type_name() + ": " +
 2147|  4.28k|            message};
 2148|  4.28k|}
_ZNK16QPDFObjectHandle11typeWarningEPKcRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2152|  4.28k|{
 2153|  4.28k|    if (!obj) {
  ------------------
  |  Branch (2153:9): [True: 0, False: 4.28k]
  ------------------
 2154|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 2155|      0|    }
 2156|  4.28k|    warn(type_error(expected_type, message));
 2157|  4.28k|}
_ZNK4qpdf10BaseHandle4warnEO7QPDFExc:
 2329|  50.1k|{
 2330|  50.1k|    if (!qpdf()) {
  ------------------
  |  Branch (2330:9): [True: 175, False: 49.9k]
  ------------------
 2331|    175|        throw std::move(e);
 2332|    175|    }
 2333|  49.9k|    qpdf()->warn(std::move(e));
 2334|  49.9k|}
_ZNK4qpdf10BaseHandle4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2338|  55.0k|{
 2339|  55.0k|    if (qpdf()) {
  ------------------
  |  Branch (2339:9): [True: 45.8k, False: 9.18k]
  ------------------
 2340|  45.8k|        warn({qpdf_e_damaged_pdf, "", description(), 0, warning});
 2341|  45.8k|    } else {
 2342|  9.18k|        *QPDFLogger::defaultLogger()->getError() << warning << "\n";
 2343|  9.18k|    }
 2344|  55.0k|}
_ZNK16QPDFObjectHandle9getObjGenEv:
 2513|  36.3k|{
 2514|  36.3k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (2514:12): [True: 36.3k, False: 0]
  ------------------
 2515|  36.3k|}
_ZNK16QPDFObjectHandle11getObjectIDEv:
 2519|  24.0k|{
 2520|  24.0k|    return getObjGen().getObj();
 2521|  24.0k|}
_ZNK16QPDFObjectHandle10isIndirectEv:
 2531|  18.6k|{
 2532|  18.6k|    return getObjectID() != 0;
 2533|  18.6k|}
_ZNK16QPDFObjectHandle13getOwningQPDFEv:
 2538|  59.1k|{
 2539|  59.1k|    return obj ? obj->getQPDF() : nullptr;
  ------------------
  |  Branch (2539:12): [True: 59.1k, False: 0]
  ------------------
 2540|  59.1k|}
_ZN16QPDFObjectHandle15setParsedOffsetEx:
 2553|     21|{
 2554|     21|    if (obj) {
  ------------------
  |  Branch (2554:9): [True: 21, False: 0]
  ------------------
 2555|     21|        obj->setParsedOffset(offset);
 2556|     21|    }
 2557|     21|}

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

_ZN25QPDFOutlineDocumentHelper8Accessor9checkSeenERS_10QPDFObjGen:
   23|  8.69k|{
   24|  8.69k|    return !dh.m->seen.add(og);
   25|  8.69k|}
_ZN25QPDFOutlineDocumentHelperC2ER4QPDF:
   28|  1.87k|    QPDFDocumentHelper(qpdf),
   29|  1.87k|    m(std::make_shared<Members>())
   30|  1.87k|{
   31|  1.87k|    validate();
   32|  1.87k|}
_ZN25QPDFOutlineDocumentHelper3getER4QPDF:
   36|  1.87k|{
   37|  1.87k|    return qpdf.doc().outlines();
   38|  1.87k|}
_ZN25QPDFOutlineDocumentHelper8validateEb:
   42|  1.87k|{
   43|  1.87k|    m->outlines.clear();
   44|  1.87k|    m->names_dest = nullptr;
   45|       |
   46|  1.87k|    QPDFObjectHandle root = qpdf.getRoot();
   47|  1.87k|    if (!root.hasKey("/Outlines")) {
  ------------------
  |  Branch (47:9): [True: 224, False: 1.65k]
  ------------------
   48|    224|        return;
   49|    224|    }
   50|  1.65k|    auto outlines = root.getKey("/Outlines");
   51|  1.65k|    if (!(outlines.isDictionary() && outlines.hasKey("/First"))) {
  ------------------
  |  Branch (51:9): [True: 23, False: 1.63k]
  |  Branch (51:11): [True: 1.64k, False: 6]
  |  Branch (51:38): [True: 1.63k, False: 17]
  ------------------
   52|     23|        return;
   53|     23|    }
   54|  1.63k|    QPDFObjectHandle cur = outlines.getKey("/First");
   55|  1.63k|    QPDFObjGen::set seen;
   56|  4.07k|    while (!cur.null()) {
  ------------------
  |  Branch (56:12): [True: 2.47k, False: 1.59k]
  ------------------
   57|  2.47k|        if (!seen.add(cur)) {
  ------------------
  |  Branch (57:13): [True: 32, False: 2.44k]
  ------------------
   58|     32|            cur.warn("Loop detected loop in /Outlines tree");
   59|     32|            return;
   60|     32|        }
   61|  2.44k|        m->outlines.emplace_back(QPDFOutlineObjectHelper::Accessor::create(cur, *this, 1));
   62|  2.44k|        cur = cur.getKey("/Next");
   63|  2.44k|    }
   64|  1.63k|}
_ZN25QPDFOutlineDocumentHelper19getTopLevelOutlinesEv:
   74|  1.87k|{
   75|  1.87k|    return m->outlines;
   76|  1.87k|}
_ZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandle:
  107|  3.02k|{
  108|  3.02k|    QPDFObjectHandle result;
  109|  3.02k|    if (name.isName()) {
  ------------------
  |  Branch (109:9): [True: 249, False: 2.77k]
  ------------------
  110|    249|        if (!m->dest_dict) {
  ------------------
  |  Branch (110:13): [True: 66, False: 183]
  ------------------
  111|     66|            m->dest_dict = qpdf.getRoot().getKey("/Dests");
  112|     66|        }
  113|    249|        result = m->dest_dict.getKeyIfDict(name.getName());
  114|  2.77k|    } else if (name.isString()) {
  ------------------
  |  Branch (114:16): [True: 2.77k, False: 0]
  ------------------
  115|  2.77k|        if (!m->names_dest) {
  ------------------
  |  Branch (115:13): [True: 1.70k, False: 1.07k]
  ------------------
  116|  1.70k|            auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests");
  117|  1.70k|            if (dests.isDictionary()) {
  ------------------
  |  Branch (117:17): [True: 1.38k, False: 316]
  ------------------
  118|  1.38k|                m->names_dest = std::make_unique<QPDFNameTreeObjectHelper>(
  119|  1.38k|                    dests,
  120|  1.38k|                    qpdf,
  121|  1.38k|                    [](QPDFObjectHandle const& o) -> bool {
  122|  1.38k|                        return o.isArray() || o.contains("/D");
  123|  1.38k|                    },
  124|  1.38k|                    true);
  125|  1.38k|                m->names_dest->validate();
  126|  1.38k|            }
  127|  1.70k|        }
  128|  2.77k|        if (m->names_dest) {
  ------------------
  |  Branch (128:13): [True: 2.29k, False: 482]
  ------------------
  129|  2.29k|            if (m->names_dest->findObject(name.getUTF8Value(), result)) {
  ------------------
  |  Branch (129:17): [True: 123, False: 2.17k]
  ------------------
  130|    123|                QTC::TC("qpdf", "QPDFOutlineDocumentHelper string named dest");
  131|    123|            }
  132|  2.29k|        }
  133|  2.77k|    }
  134|  3.02k|    if (!result) {
  ------------------
  |  Branch (134:9): [True: 2.43k, False: 596]
  ------------------
  135|  2.43k|        return QPDFObjectHandle::newNull();
  136|  2.43k|    }
  137|    596|    if (result.isDictionary()) {
  ------------------
  |  Branch (137:9): [True: 95, False: 501]
  ------------------
  138|     95|        return result.getKey("/D");
  139|     95|    }
  140|    501|    return result;
  141|    596|}
_ZN25QPDFOutlineDocumentHelper7MembersC2Ev:
   10|  1.87k|    Members() = default;
_ZN25QPDFOutlineDocumentHelper7MembersD2Ev:
   12|  1.87k|    ~Members() = default;
QPDFOutlineDocumentHelper.cc:_ZZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandleENK3$_0clERKS0_:
  121|  67.9k|                    [](QPDFObjectHandle const& o) -> bool {
  122|  67.9k|                        return o.isArray() || o.contains("/D");
  ------------------
  |  Branch (122:32): [True: 60.5k, False: 7.37k]
  |  Branch (122:47): [True: 6.57k, False: 800]
  ------------------
  123|  67.9k|                    },

_ZN23QPDFOutlineObjectHelper7MembersC2ER25QPDFOutlineDocumentHelper:
    8|  8.69k|    dh(dh)
    9|  8.69k|{
   10|  8.69k|}
_ZN23QPDFOutlineObjectHelperC2E16QPDFObjectHandleR25QPDFOutlineDocumentHelperi:
   14|  8.69k|    QPDFObjectHelper(a_oh),
   15|  8.69k|    m(new Members(dh))
   16|  8.69k|{
   17|  8.69k|    if (depth > 50) {
  ------------------
  |  Branch (17:9): [True: 0, False: 8.69k]
  ------------------
   18|       |        // Not exercised in test suite, but was tested manually by temporarily changing max depth
   19|       |        // to 1.
   20|      0|        return;
   21|      0|    }
   22|  8.69k|    if (QPDFOutlineDocumentHelper::Accessor::checkSeen(m->dh, a_oh.getObjGen())) {
  ------------------
  |  Branch (22:9): [True: 4.56k, False: 4.12k]
  ------------------
   23|  4.56k|        a_oh.warn("Loop detected loop in /Outlines tree");
   24|  4.56k|        return;
   25|  4.56k|    }
   26|       |
   27|  4.12k|    QPDFObjGen::set children;
   28|  4.12k|    QPDFObjectHandle cur = a_oh.getKey("/First");
   29|  10.3k|    while (!cur.null() && cur.isIndirect()) {
  ------------------
  |  Branch (29:12): [True: 6.65k, False: 3.72k]
  |  Branch (29:27): [True: 6.34k, False: 312]
  ------------------
   30|  6.34k|        if (!children.add(cur)) {
  ------------------
  |  Branch (30:13): [True: 92, False: 6.25k]
  ------------------
   31|     92|            cur.warn("Loop detected loop in /Outlines tree");
   32|     92|            break;
   33|     92|        }
   34|  6.25k|        QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth);
   35|  6.25k|        new_ooh.m->parent = std::make_shared<QPDFOutlineObjectHelper>(*this);
   36|  6.25k|        m->kids.emplace_back(new_ooh);
   37|  6.25k|        cur = cur.getKey("/Next");
   38|  6.25k|    }
   39|  4.12k|}
_ZN23QPDFOutlineObjectHelper7getKidsEv:
   49|  8.42k|{
   50|  8.42k|    return m->kids;
   51|  8.42k|}
_ZN23QPDFOutlineObjectHelper7getDestEv:
   55|  8.65k|{
   56|  8.65k|    auto dest = get("/Dest");
   57|  8.65k|    if (dest.null()) {
  ------------------
  |  Branch (57:9): [True: 7.44k, False: 1.20k]
  ------------------
   58|  7.44k|        auto const& A = get("/A");
   59|  7.44k|        if (Name(A["/S"]) == "/GoTo") {
  ------------------
  |  Branch (59:13): [True: 2.27k, False: 5.17k]
  ------------------
   60|  2.27k|            dest = A["/D"];
   61|  2.27k|        }
   62|  7.44k|    }
   63|  8.65k|    if (dest.null()) {
  ------------------
  |  Branch (63:9): [True: 5.26k, False: 3.39k]
  ------------------
   64|  5.26k|        return QPDFObjectHandle::newNull();
   65|  5.26k|    }
   66|  3.39k|    if (dest.isName() || dest.isString()) {
  ------------------
  |  Branch (66:9): [True: 249, False: 3.14k]
  |  Branch (66:26): [True: 2.77k, False: 364]
  ------------------
   67|  3.02k|        return m->dh.resolveNamedDest(dest);
   68|  3.02k|    }
   69|    364|    return dest;
   70|  3.39k|}
_ZN23QPDFOutlineObjectHelper11getDestPageEv:
   74|  8.65k|{
   75|  8.65k|    QPDFObjectHandle dest = getDest();
   76|  8.65k|    if (!dest.empty() && dest.isArray()) {
  ------------------
  |  Branch (76:9): [True: 498, False: 8.15k]
  |  Branch (76:26): [True: 301, False: 197]
  ------------------
   77|    301|        return dest.getArrayItem(0);
   78|    301|    }
   79|  8.35k|    return QPDFObjectHandle::newNull();
   80|  8.65k|}

_ZN4qpdf4impl6Parser5parseER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERNS_9TokenizerEPN16QPDFObjectHandle15StringDecrypterER4QPDFb:
  129|   104k|{
  130|   104k|    return Parser(
  131|   104k|               input,
  132|   104k|               make_description(input.getName(), object_description),
  133|   104k|               object_description,
  134|   104k|               tokenizer,
  135|   104k|               decrypter,
  136|   104k|               &context,
  137|   104k|               true,
  138|   104k|               0,
  139|   104k|               0,
  140|   104k|               sanity_checks)
  141|   104k|        .parse();
  142|   104k|}
_ZN4qpdf4impl6Parser5parseERNS_2is12OffsetBufferEiiRNS_9TokenizerER4QPDF:
  147|  15.4k|{
  148|  15.4k|    return Parser(
  149|  15.4k|               input,
  150|  15.4k|               std::make_shared<QPDFObject::Description>(
  151|  15.4k|                   QPDFObject::ObjStreamDescr(stream_id, obj_id)),
  152|  15.4k|               "",
  153|  15.4k|               tokenizer,
  154|  15.4k|               nullptr,
  155|  15.4k|               &context,
  156|  15.4k|               true,
  157|  15.4k|               stream_id,
  158|  15.4k|               obj_id)
  159|  15.4k|        .parse();
  160|  15.4k|}
_ZN4qpdf4impl6Parser5parseEb:
  164|   119k|{
  165|   119k|    try {
  166|   119k|        return parse_first(content_stream);
  167|   119k|    } catch (Error&) {
  168|  8.81k|        return {};
  169|  8.81k|    } catch (QPDFExc& e) {
  170|  4.08k|        throw e;
  171|  4.08k|    } catch (std::logic_error& e) {
  172|      1|        throw e;
  173|  1.19k|    } catch (std::exception& e) {
  174|  1.19k|        warn("treating object as null because of error during parsing: "s + e.what());
  175|  1.19k|        return {};
  176|  1.19k|    }
  177|   119k|}
_ZN4qpdf4impl6Parser11parse_firstEb:
  181|   119k|{
  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|   119k|    QPDF::Doc::ParseGuard pg(context_);
  188|   119k|    start_ = input_.tell();
  189|   119k|    if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (189:9): [True: 1.83k, False: 117k]
  ------------------
  190|  1.83k|        warn(tokenizer_.getErrorMessage());
  191|  1.83k|    }
  192|       |
  193|   119k|    switch (tokenizer_.getType()) {
  194|    660|    case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (194:5): [True: 660, False: 118k]
  ------------------
  195|    660|        if (content_stream) {
  ------------------
  |  Branch (195:13): [True: 0, False: 660]
  ------------------
  196|       |            // In content stream mode, leave object uninitialized to indicate EOF
  197|      0|            empty_ = true;
  198|      0|            return {};
  199|      0|        }
  200|    660|        warn("unexpected EOF");
  201|    660|        return {};
  202|       |
  203|  1.68k|    case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (203:5): [True: 1.68k, False: 117k]
  ------------------
  204|  1.68k|        return {};
  205|       |
  206|    176|    case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (206:5): [True: 176, False: 119k]
  ------------------
  207|    404|    case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (207:5): [True: 228, False: 119k]
  ------------------
  208|    404|        warn("treating unexpected brace token as null");
  209|    404|        return {};
  210|       |
  211|    217|    case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (211:5): [True: 217, False: 119k]
  ------------------
  212|    217|        warn("treating unexpected array close token as null");
  213|    217|        return {};
  214|       |
  215|    332|    case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (215:5): [True: 332, False: 119k]
  ------------------
  216|    332|        warn("unexpected dictionary close token");
  217|    332|        return {};
  218|       |
  219|  12.8k|    case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (219:5): [True: 12.8k, False: 106k]
  ------------------
  220|  95.8k|    case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (220:5): [True: 83.0k, False: 36.4k]
  ------------------
  221|  95.8k|        stack_.clear();
  222|  95.8k|        stack_.emplace_back(
  223|  95.8k|            input_,
  224|  95.8k|            (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array : st_dictionary_key);
  ------------------
  |  Branch (224:13): [True: 12.8k, False: 83.0k]
  ------------------
  225|  95.8k|        frame_ = &stack_.back();
  226|  95.8k|        return parse_remainder(content_stream);
  227|       |
  228|    405|    case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (228:5): [True: 405, False: 119k]
  ------------------
  229|    405|        return with_description<QPDF_Bool>(tokenizer_.getValue() == "true");
  230|       |
  231|    123|    case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (231:5): [True: 123, False: 119k]
  ------------------
  232|    123|        return {QPDFObject::create<QPDF_Null>()};
  233|       |
  234|  8.98k|    case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (234:5): [True: 8.98k, False: 110k]
  ------------------
  235|  8.98k|        return with_description<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  236|       |
  237|    372|    case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (237:5): [True: 372, False: 119k]
  ------------------
  238|    372|        return with_description<QPDF_Real>(tokenizer_.getValue());
  239|       |
  240|  1.32k|    case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (240:5): [True: 1.32k, False: 118k]
  ------------------
  241|  1.32k|        return with_description<QPDF_Name>(tokenizer_.getValue());
  242|       |
  243|  7.78k|    case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (243:5): [True: 7.78k, False: 111k]
  ------------------
  244|  7.78k|        {
  245|  7.78k|            auto const& value = tokenizer_.getValue();
  246|  7.78k|            if (content_stream) {
  ------------------
  |  Branch (246:17): [True: 0, False: 7.78k]
  ------------------
  247|      0|                return with_description<QPDF_Operator>(value);
  248|  7.78k|            } else if (value == "endobj") {
  ------------------
  |  Branch (248:24): [True: 466, False: 7.31k]
  ------------------
  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|    466|                empty_ = true;
  254|    466|                input_.seek(input_.getLastOffset(), SEEK_SET);
  255|    466|                if (!content_stream) {
  ------------------
  |  Branch (255:21): [True: 466, False: 0]
  ------------------
  256|    466|                    warn("empty object treated as null");
  257|    466|                }
  258|    466|                return {};
  259|  7.31k|            } else {
  260|  7.31k|                warn("unknown token while reading object; treating as string");
  261|  7.31k|                return with_description<QPDF_String>(value);
  262|  7.31k|            }
  263|  7.78k|        }
  264|       |
  265|  1.17k|    case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (265:5): [True: 1.17k, False: 118k]
  ------------------
  266|  1.17k|        if (decrypter_) {
  ------------------
  |  Branch (266:13): [True: 453, False: 724]
  ------------------
  267|    453|            std::string s{tokenizer_.getValue()};
  268|    453|            decrypter_->decryptString(s);
  269|    453|            return with_description<QPDF_String>(s);
  270|    724|        } else {
  271|    724|            return with_description<QPDF_String>(tokenizer_.getValue());
  272|    724|        }
  273|       |
  274|      0|    default:
  ------------------
  |  Branch (274:5): [True: 0, False: 119k]
  ------------------
  275|      0|        warn("treating unknown token type as null while reading object");
  276|      0|        return {};
  277|   119k|    }
  278|   119k|}
_ZN4qpdf4impl6Parser15parse_remainderEb:
  282|  95.8k|{
  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|  95.8k|    bad_count_ = 0;
  289|  95.8k|    bool b_contents = false;
  290|       |
  291|  5.48M|    while (true) {
  ------------------
  |  Branch (291:12): [True: 5.47M, Folded]
  ------------------
  292|  5.47M|        if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (292:13): [True: 38.0k, False: 5.43M]
  ------------------
  293|  38.0k|            warn(tokenizer_.getErrorMessage());
  294|  38.0k|        }
  295|  5.47M|        ++good_count_; // optimistically
  296|       |
  297|  5.47M|        if (int_count_ != 0) {
  ------------------
  |  Branch (297:13): [True: 1.31M, False: 4.15M]
  ------------------
  298|       |            // Special handling of indirect references. Treat integer tokens as part of an indirect
  299|       |            // reference until proven otherwise.
  300|  1.31M|            if (tokenizer_.getType() == QPDFTokenizer::tt_integer) {
  ------------------
  |  Branch (300:17): [True: 941k, False: 378k]
  ------------------
  301|   941k|                if (++int_count_ > 2) {
  ------------------
  |  Branch (301:21): [True: 686k, False: 255k]
  ------------------
  302|       |                    // Process the oldest buffered integer.
  303|   686k|                    add_int(int_count_);
  304|   686k|                }
  305|   941k|                last_offset_buffer_[int_count_ % 2] = input_.getLastOffset();
  306|   941k|                int_buffer_[int_count_ % 2] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  307|   941k|                continue;
  308|       |
  309|   941k|            } else if (
  310|   378k|                int_count_ >= 2 && tokenizer_.getType() == QPDFTokenizer::tt_word &&
  ------------------
  |  Branch (310:17): [True: 255k, False: 123k]
  |  Branch (310:36): [True: 225k, False: 29.2k]
  ------------------
  311|   225k|                tokenizer_.getValue() == "R") {
  ------------------
  |  Branch (311:17): [True: 206k, False: 19.5k]
  ------------------
  312|   206k|                if (!context_) {
  ------------------
  |  Branch (312:21): [True: 0, False: 206k]
  ------------------
  313|      0|                    throw std::logic_error(
  314|      0|                        "Parser::parse called without context on an object with indirect "
  315|      0|                        "references");
  316|      0|                }
  317|   206k|                auto id = QIntC::to_int(int_buffer_[(int_count_ - 1) % 2]);
  318|   206k|                auto gen = QIntC::to_int(int_buffer_[(int_count_) % 2]);
  319|   206k|                if (!(id < 1 || gen < 0 || gen >= 65535)) {
  ------------------
  |  Branch (319:23): [True: 1.65k, False: 204k]
  |  Branch (319:33): [True: 419, False: 204k]
  |  Branch (319:44): [True: 221, False: 203k]
  ------------------
  320|   203k|                    add(ParseGuard::getObject(context_, id, gen, parse_pdf_));
  321|   203k|                } else {
  322|  2.29k|                    add_bad_null(
  323|  2.29k|                        "treating bad indirect reference (" + std::to_string(id) + " " +
  324|  2.29k|                        std::to_string(gen) + " R) as null");
  325|  2.29k|                }
  326|   206k|                int_count_ = 0;
  327|   206k|                continue;
  328|       |
  329|   206k|            } else if (int_count_ > 0) {
  ------------------
  |  Branch (329:24): [True: 172k, False: 0]
  ------------------
  330|       |                // Process the buffered integers before processing the current token.
  331|   172k|                if (int_count_ > 1) {
  ------------------
  |  Branch (331:21): [True: 48.8k, False: 123k]
  ------------------
  332|  48.8k|                    add_int(int_count_ - 1);
  333|  48.8k|                }
  334|   172k|                add_int(int_count_);
  335|   172k|                int_count_ = 0;
  336|   172k|            }
  337|  1.31M|        }
  338|       |
  339|  4.32M|        switch (tokenizer_.getType()) {
  340|  7.40k|        case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (340:9): [True: 7.40k, False: 4.31M]
  ------------------
  341|  7.40k|            warn("parse error while reading object");
  342|  7.40k|            if (content_stream) {
  ------------------
  |  Branch (342:17): [True: 0, False: 7.40k]
  ------------------
  343|       |                // In content stream mode, leave object uninitialized to indicate EOF
  344|      0|                return {};
  345|      0|            }
  346|  7.40k|            warn("unexpected EOF");
  347|  7.40k|            return {};
  348|       |
  349|  31.7k|        case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (349:9): [True: 31.7k, False: 4.29M]
  ------------------
  350|  31.7k|            check_too_many_bad_tokens();
  351|  31.7k|            add_null();
  352|  31.7k|            continue;
  353|       |
  354|  2.24k|        case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (354:9): [True: 2.24k, False: 4.32M]
  ------------------
  355|  3.64k|        case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (355:9): [True: 1.40k, False: 4.32M]
  ------------------
  356|  3.64k|            add_bad_null("treating unexpected brace token as null");
  357|  3.64k|            continue;
  358|       |
  359|  55.6k|        case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (359:9): [True: 55.6k, False: 4.26M]
  ------------------
  360|  55.6k|            if (frame_->state == st_array) {
  ------------------
  |  Branch (360:17): [True: 54.2k, False: 1.44k]
  ------------------
  361|  54.2k|                auto object = frame_->null_count > 100
  ------------------
  |  Branch (361:31): [True: 311, False: 53.9k]
  ------------------
  362|  54.2k|                    ? QPDFObject::create<QPDF_Array>(std::move(frame_->olist), true)
  363|  54.2k|                    : QPDFObject::create<QPDF_Array>(std::move(frame_->olist));
  364|  54.2k|                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|  54.2k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (369:21): [True: 1.05k, False: 53.1k]
  ------------------
  370|  1.05k|                    return object;
  371|  1.05k|                }
  372|  53.1k|                stack_.pop_back();
  373|  53.1k|                frame_ = &stack_.back();
  374|  53.1k|                add(std::move(object));
  375|  53.1k|            } else {
  376|  1.44k|                if (sanity_checks_) {
  ------------------
  |  Branch (376:21): [True: 743, False: 699]
  ------------------
  377|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  378|       |                    // unusable.
  379|    743|                    warn("unexpected array close token; giving up on reading object");
  380|    743|                    return {};
  381|    743|                }
  382|    699|                add_bad_null("treating unexpected array close token as null");
  383|    699|            }
  384|  53.8k|            continue;
  385|       |
  386|   110k|        case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (386:9): [True: 110k, False: 4.21M]
  ------------------
  387|   110k|            if (frame_->state <= st_dictionary_value) {
  ------------------
  |  Branch (387:17): [True: 108k, False: 1.33k]
  ------------------
  388|       |                // Attempt to recover more or less gracefully from invalid dictionaries.
  389|   108k|                auto& dict = frame_->dict;
  390|       |
  391|   108k|                if (frame_->state == st_dictionary_value) {
  ------------------
  |  Branch (391:21): [True: 9.02k, False: 99.7k]
  ------------------
  392|  9.02k|                    warn(
  393|  9.02k|                        frame_->offset,
  394|  9.02k|                        "dictionary ended prematurely; using null as value for last key");
  395|  9.02k|                    dict[frame_->key] = QPDFObject::create<QPDF_Null>();
  396|  9.02k|                }
  397|   108k|                if (!frame_->olist.empty()) {
  ------------------
  |  Branch (397:21): [True: 33.1k, False: 75.5k]
  ------------------
  398|  33.1k|                    if (sanity_checks_) {
  ------------------
  |  Branch (398:25): [True: 30.1k, False: 3.05k]
  ------------------
  399|  30.1k|                        warn(
  400|  30.1k|                            frame_->offset,
  401|  30.1k|                            "expected dictionary keys but found non-name objects; ignoring");
  402|  30.1k|                    } else {
  403|  3.05k|                        fix_missing_keys();
  404|  3.05k|                    }
  405|  33.1k|                }
  406|       |
  407|   108k|                if (!frame_->contents_string.empty() && dict.contains("/Type") &&
  ------------------
  |  Branch (407:21): [True: 86, False: 108k]
  |  Branch (407:21): [True: 21, False: 108k]
  |  Branch (407:57): [True: 56, False: 30]
  ------------------
  408|     56|                    dict["/Type"].isNameAndEquals("/Sig") && dict.contains("/ByteRange") &&
  ------------------
  |  Branch (408:21): [True: 31, False: 25]
  |  Branch (408:62): [True: 21, False: 10]
  ------------------
  409|     21|                    dict.contains("/Contents") && dict["/Contents"].isString()) {
  ------------------
  |  Branch (409:21): [True: 21, False: 0]
  |  Branch (409:51): [True: 21, False: 0]
  ------------------
  410|     21|                    dict["/Contents"] = QPDFObjectHandle::newString(frame_->contents_string);
  411|     21|                    dict["/Contents"].setParsedOffset(frame_->contents_offset);
  412|     21|                }
  413|   108k|                auto object = QPDFObject::create<QPDF_Dictionary>(std::move(dict));
  414|   108k|                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|   108k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (419:21): [True: 71.8k, False: 36.9k]
  ------------------
  420|  71.8k|                    return object;
  421|  71.8k|                }
  422|  36.9k|                stack_.pop_back();
  423|  36.9k|                frame_ = &stack_.back();
  424|  36.9k|                add(std::move(object));
  425|  36.9k|            } else {
  426|  1.33k|                if (sanity_checks_) {
  ------------------
  |  Branch (426:21): [True: 799, False: 537]
  ------------------
  427|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  428|       |                    // unusable.
  429|    799|                    warn("unexpected dictionary close token; giving up on reading object");
  430|    799|                    return {};
  431|    799|                }
  432|    537|                add_bad_null("unexpected dictionary close token");
  433|    537|            }
  434|  37.4k|            continue;
  435|       |
  436|   156k|        case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (436:9): [True: 156k, False: 4.16M]
  ------------------
  437|   256k|        case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (437:9): [True: 99.5k, False: 4.22M]
  ------------------
  438|   256k|            if (stack_.size() > max_nesting) {
  ------------------
  |  Branch (438:17): [True: 171, False: 256k]
  ------------------
  439|    171|                limits_error(
  440|    171|                    "parser-max-nesting", "ignoring excessively deeply nested data structure");
  441|    171|            }
  442|   256k|            b_contents = false;
  443|   256k|            stack_.emplace_back(
  444|   256k|                input_,
  445|   256k|                (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array
  ------------------
  |  Branch (445:17): [True: 156k, False: 99.5k]
  ------------------
  446|   256k|                                                                       : st_dictionary_key);
  447|   256k|            frame_ = &stack_.back();
  448|   256k|            continue;
  449|       |
  450|  3.13k|        case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (450:9): [True: 3.13k, False: 4.32M]
  ------------------
  451|  3.13k|            add_scalar<QPDF_Bool>(tokenizer_.getValue() == "true");
  452|  3.13k|            continue;
  453|       |
  454|  32.2k|        case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (454:9): [True: 32.2k, False: 4.29M]
  ------------------
  455|  32.2k|            add_null();
  456|  32.2k|            continue;
  457|       |
  458|   378k|        case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (458:9): [True: 378k, False: 3.94M]
  ------------------
  459|   378k|            if (!content_stream) {
  ------------------
  |  Branch (459:17): [True: 378k, False: 0]
  ------------------
  460|       |                // Buffer token in case it is part of an indirect reference.
  461|   378k|                last_offset_buffer_[1] = input_.getLastOffset();
  462|   378k|                int_buffer_[1] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  463|   378k|                int_count_ = 1;
  464|   378k|            } else {
  465|      0|                add_scalar<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  466|      0|            }
  467|   378k|            continue;
  468|       |
  469|  45.3k|        case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (469:9): [True: 45.3k, False: 4.27M]
  ------------------
  470|  45.3k|            add_scalar<QPDF_Real>(tokenizer_.getValue());
  471|  45.3k|            continue;
  472|       |
  473|  3.11M|        case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (473:9): [True: 3.11M, False: 1.20M]
  ------------------
  474|  3.11M|            if (frame_->state == st_dictionary_key) {
  ------------------
  |  Branch (474:17): [True: 380k, False: 2.73M]
  ------------------
  475|   380k|                frame_->key = tokenizer_.getValue();
  476|   380k|                frame_->state = st_dictionary_value;
  477|   380k|                b_contents = decrypter_ && frame_->key == "/Contents";
  ------------------
  |  Branch (477:30): [True: 27.6k, False: 352k]
  |  Branch (477:44): [True: 643, False: 27.0k]
  ------------------
  478|   380k|                continue;
  479|  2.73M|            } else {
  480|  2.73M|                add_scalar<QPDF_Name>(tokenizer_.getValue());
  481|  2.73M|            }
  482|  2.73M|            continue;
  483|       |
  484|  2.73M|        case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (484:9): [True: 165k, False: 4.15M]
  ------------------
  485|   165k|            if (content_stream) {
  ------------------
  |  Branch (485:17): [True: 0, False: 165k]
  ------------------
  486|      0|                add_scalar<QPDF_Operator>(tokenizer_.getValue());
  487|      0|                continue;
  488|      0|            }
  489|       |
  490|   165k|            if (sanity_checks_) {
  ------------------
  |  Branch (490:17): [True: 158k, False: 7.33k]
  ------------------
  491|   158k|                if (tokenizer_.getValue() == "endobj" || tokenizer_.getValue() == "endstream") {
  ------------------
  |  Branch (491:21): [True: 1.27k, False: 157k]
  |  Branch (491:58): [True: 223, False: 157k]
  ------------------
  492|       |                    // During sanity checks, assume an unexpected endobj or endstream indicates that
  493|       |                    // we are parsing past the end of the object.
  494|  1.49k|                    warn(
  495|  1.49k|                        "unexpected 'endobj' or 'endstream' while reading object; giving up on "
  496|  1.49k|                        "reading object");
  497|  1.49k|                    return {};
  498|  1.49k|                }
  499|       |
  500|   157k|                add_bad_null("unknown token while reading object; treating as null");
  501|   157k|                continue;
  502|   158k|            }
  503|       |
  504|  7.33k|            warn("unknown token while reading object; treating as string");
  505|  7.33k|            check_too_many_bad_tokens();
  506|  7.33k|            add_scalar<QPDF_String>(tokenizer_.getValue());
  507|       |
  508|  7.33k|            continue;
  509|       |
  510|   119k|        case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (510:9): [True: 119k, False: 4.20M]
  ------------------
  511|   119k|            {
  512|   119k|                auto const& val = tokenizer_.getValue();
  513|   119k|                if (decrypter_) {
  ------------------
  |  Branch (513:21): [True: 51.2k, False: 67.8k]
  ------------------
  514|  51.2k|                    if (b_contents) {
  ------------------
  |  Branch (514:25): [True: 508, False: 50.6k]
  ------------------
  515|    508|                        frame_->contents_string = val;
  516|    508|                        frame_->contents_offset = input_.getLastOffset();
  517|    508|                        b_contents = false;
  518|    508|                    }
  519|  51.2k|                    std::string s{val};
  520|  51.2k|                    decrypter_->decryptString(s);
  521|  51.2k|                    add_scalar<QPDF_String>(s);
  522|  67.8k|                } else {
  523|  67.8k|                    add_scalar<QPDF_String>(val);
  524|  67.8k|                }
  525|   119k|            }
  526|   119k|            continue;
  527|       |
  528|      0|        default:
  ------------------
  |  Branch (528:9): [True: 0, False: 4.32M]
  ------------------
  529|      0|            add_bad_null("treating unknown token type as null while reading object");
  530|  4.32M|        }
  531|  4.32M|    }
  532|  95.8k|}
_ZN4qpdf4impl6Parser3addEONSt3__110shared_ptrI10QPDFObjectEE:
  536|  4.11M|{
  537|  4.11M|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (537:9): [True: 3.76M, False: 342k]
  ------------------
  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|  3.76M|        frame_->olist.emplace_back(std::move(obj));
  541|  3.76M|    } else {
  542|   342k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, std::move(obj)); !res.second) {
  ------------------
  |  Branch (542:84): [True: 6.23k, False: 336k]
  ------------------
  543|  6.23k|            warn_duplicate_key();
  544|  6.23k|        }
  545|   342k|        frame_->state = st_dictionary_key;
  546|   342k|    }
  547|  4.11M|}
_ZN4qpdf4impl6Parser8add_nullEv:
  551|   218k|{
  552|   218k|    const static ObjectPtr null_obj = QPDFObject::create<QPDF_Null>();
  553|       |
  554|   218k|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (554:9): [True: 195k, False: 22.6k]
  ------------------
  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|   195k|        frame_->olist.emplace_back(null_obj);
  558|   195k|    } else {
  559|  22.6k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, null_obj); !res.second) {
  ------------------
  |  Branch (559:78): [True: 1.03k, False: 21.5k]
  ------------------
  560|  1.03k|            warn_duplicate_key();
  561|  1.03k|        }
  562|  22.6k|        frame_->state = st_dictionary_key;
  563|  22.6k|    }
  564|   218k|    ++frame_->null_count;
  565|   218k|}
_ZN4qpdf4impl6Parser12add_bad_nullERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  569|   163k|{
  570|   163k|    warn(msg);
  571|   163k|    check_too_many_bad_tokens();
  572|   163k|    add_null();
  573|   163k|}
_ZN4qpdf4impl6Parser7add_intEi:
  577|   907k|{
  578|   907k|    auto obj = QPDFObject::create<QPDF_Integer>(int_buffer_[count % 2]);
  579|   907k|    obj->setDescription(context_, description_, last_offset_buffer_[count % 2]);
  580|   907k|    add(std::move(obj));
  581|   907k|}
_ZN4qpdf4impl6Parser15set_descriptionERNSt3__110shared_ptrI10QPDFObjectEEx:
  610|   162k|{
  611|   162k|    if (obj) {
  ------------------
  |  Branch (611:9): [True: 162k, False: 0]
  ------------------
  612|   162k|        obj->setDescription(context_, description_, parsed_offset);
  613|   162k|    }
  614|   162k|}
_ZN4qpdf4impl6Parser16fix_missing_keysEv:
  618|  3.05k|{
  619|  3.05k|    std::set<std::string> names;
  620|  11.4k|    for (auto& obj: frame_->olist) {
  ------------------
  |  Branch (620:19): [True: 11.4k, False: 3.05k]
  ------------------
  621|  11.4k|        if (obj.raw_type_code() == ::ot_name) {
  ------------------
  |  Branch (621:13): [True: 556, False: 10.8k]
  ------------------
  622|    556|            names.insert(obj.getName());
  623|    556|        }
  624|  11.4k|    }
  625|  3.05k|    int next_fake_key = 1;
  626|  11.3k|    for (auto const& item: frame_->olist) {
  ------------------
  |  Branch (626:26): [True: 11.3k, False: 3.05k]
  ------------------
  627|  11.4k|        while (true) {
  ------------------
  |  Branch (627:16): [True: 11.4k, Folded]
  ------------------
  628|  11.4k|            const std::string key = "/QPDFFake" + std::to_string(next_fake_key++);
  629|  11.4k|            const bool found_fake = !frame_->dict.contains(key) && !names.contains(key);
  ------------------
  |  Branch (629:37): [True: 11.4k, False: 41]
  |  Branch (629:68): [True: 11.3k, False: 10]
  ------------------
  630|  11.4k|            QTC::TC("qpdf", "QPDFParser found fake", (found_fake ? 0 : 1));
  ------------------
  |  Branch (630:55): [True: 11.3k, False: 51]
  ------------------
  631|  11.4k|            if (found_fake) {
  ------------------
  |  Branch (631:17): [True: 11.3k, False: 51]
  ------------------
  632|  11.3k|                warn(
  633|  11.3k|                    frame_->offset,
  634|  11.3k|                    "expected dictionary key but found non-name object; inserting key " + key);
  635|  11.3k|                frame_->dict[key] = item;
  636|  11.3k|                break;
  637|  11.3k|            }
  638|  11.4k|        }
  639|  11.3k|    }
  640|  3.05k|}
_ZN4qpdf4impl6Parser25check_too_many_bad_tokensEv:
  644|   207k|{
  645|   207k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (645:52): [True: 161k, False: 46.5k]
  |  Branch (645:66): [True: 43.5k, False: 2.96k]
  ------------------
  646|   207k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (646:9): [True: 488, False: 207k]
  |  Branch (646:42): [True: 0, False: 207k]
  ------------------
  647|    488|        if (bad_count_) {
  ------------------
  |  Branch (647:13): [True: 337, False: 151]
  ------------------
  648|    337|            limits_error(
  649|    337|                "parser-max-container-size-damaged",
  650|    337|                "encountered errors while parsing an array or dictionary with more than " +
  651|    337|                    std::to_string(limit) + " elements; giving up on reading object");
  652|    337|        }
  653|    488|        limits_error(
  654|    488|            "parser-max-container-size",
  655|    488|            "encountered an array or dictionary with more than " + std::to_string(limit) +
  656|    488|                " elements during xref recovery; giving up on reading object");
  657|    488|    }
  658|   207k|    if (max_bad_count_ && --max_bad_count_ == 0) {
  ------------------
  |  Branch (658:9): [True: 207k, False: 488]
  |  Branch (658:27): [True: 2.14k, False: 205k]
  ------------------
  659|  2.14k|        limits_error(
  660|  2.14k|            "parser-max-errors", "too many errors during parsing; treating object as null");
  661|  2.14k|    }
  662|   207k|    if (good_count_ > 4) {
  ------------------
  |  Branch (662:9): [True: 63.6k, False: 144k]
  ------------------
  663|  63.6k|        good_count_ = 0;
  664|  63.6k|        bad_count_ = 1;
  665|  63.6k|        return;
  666|  63.6k|    }
  667|   144k|    if (++bad_count_ > 5 ||
  ------------------
  |  Branch (667:9): [True: 7.41k, False: 136k]
  ------------------
  668|   136k|        (frame_->state != st_array && std::cmp_less(max_bad_count_, frame_->olist.size()))) {
  ------------------
  |  Branch (668:10): [True: 70.9k, False: 65.8k]
  |  Branch (668:39): [True: 1.32k, False: 69.6k]
  ------------------
  669|       |        // Give up after 5 errors in close proximity or if the number of missing dictionary keys
  670|       |        // exceeds the remaining number of allowable total errors.
  671|  6.10k|        warn("too many errors; giving up on reading object");
  672|  6.10k|        throw Error();
  673|  6.10k|    }
  674|   138k|    good_count_ = 0;
  675|   138k|}
_ZN4qpdf4impl6Parser12limits_errorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  679|  2.80k|{
  680|  2.80k|    Limits::error();
  681|  2.80k|    warn("limits error("s + limit + "): " + msg);
  682|  2.80k|    throw Error();
  683|  2.80k|}
_ZNK4qpdf4impl6Parser4warnERK7QPDFExc:
  687|   305k|{
  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|   305k|    if (context_) {
  ------------------
  |  Branch (691:9): [True: 305k, False: 0]
  ------------------
  692|   305k|        context_->warn(e);
  693|   305k|    } else {
  694|      0|        throw e;
  695|      0|    }
  696|   305k|}
_ZN4qpdf4impl6Parser18warn_duplicate_keyEv:
  700|  7.26k|{
  701|  7.26k|    warn(
  702|  7.26k|        frame_->offset,
  703|  7.26k|        "dictionary has duplicated key " + frame_->key +
  704|  7.26k|            "; last occurrence overrides earlier ones");
  705|  7.26k|    check_too_many_bad_tokens();
  706|  7.26k|}
_ZNK4qpdf4impl6Parser4warnExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  710|   305k|{
  711|   305k|    if (stream_id_) {
  ------------------
  |  Branch (711:9): [True: 16.2k, False: 289k]
  ------------------
  712|  16.2k|        std::string descr = "object "s + std::to_string(obj_id_) + " 0";
  713|  16.2k|        std::string name = context_->getFilename() + " object stream " + std::to_string(stream_id_);
  714|  16.2k|        warn(QPDFExc(qpdf_e_damaged_pdf, name, descr, offset, msg));
  715|   289k|    } else {
  716|   289k|        warn(QPDFExc(qpdf_e_damaged_pdf, input_.getName(), object_description_, offset, msg));
  717|   289k|    }
  718|   305k|}
_ZNK4qpdf4impl6Parser4warnERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  722|   248k|{
  723|   248k|    warn(input_.getLastOffset(), msg);
  724|   248k|}
_ZN4QPDF3Doc10ParseGuardC2EPS_:
   26|   119k|        objects(qpdf ? &qpdf->m->objects : nullptr)
  ------------------
  |  Branch (26:17): [True: 119k, False: 0]
  ------------------
   27|   119k|    {
   28|   119k|        if (objects) {
  ------------------
  |  Branch (28:13): [True: 119k, False: 0]
  ------------------
   29|   119k|            objects->inParse(true);
   30|   119k|        }
   31|   119k|    }
_ZN4QPDF3Doc10ParseGuardD2Ev:
   40|   119k|    {
   41|   119k|        if (objects) {
  ------------------
  |  Branch (41:13): [True: 119k, False: 0]
  ------------------
   42|   119k|            objects->inParse(false);
   43|   119k|        }
   44|   119k|    }
_ZN4QPDF3Doc10ParseGuard9getObjectEPS_iib:
   35|   203k|    {
   36|   203k|        return qpdf->m->objects.getObjectForParser(id, gen, parse_pdf);
   37|   203k|    }
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_BoolJbEEE16QPDFObjectHandleDpOT0_:
  602|    405|{
  603|    405|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    405|    obj->setDescription(context_, description_, start_);
  605|    405|    return {obj};
  606|    405|}
_ZN4qpdf4impl6Parser16with_descriptionI12QPDF_IntegerJxEEE16QPDFObjectHandleDpOT0_:
  602|  8.58k|{
  603|  8.58k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  8.58k|    obj->setDescription(context_, description_, start_);
  605|  8.58k|    return {obj};
  606|  8.58k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|    372|{
  603|    372|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    372|    obj->setDescription(context_, description_, start_);
  605|    372|    return {obj};
  606|    372|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  1.32k|{
  603|  1.32k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.32k|    obj->setDescription(context_, description_, start_);
  605|  1.32k|    return {obj};
  606|  1.32k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  7.74k|{
  603|  7.74k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  7.74k|    obj->setDescription(context_, description_, start_);
  605|  7.74k|    return {obj};
  606|  7.74k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|    450|{
  603|    450|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    450|    obj->setDescription(context_, description_, start_);
  605|    450|    return {obj};
  606|    450|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_BoolJbEEEvDpOT0_:
  586|  3.13k|{
  587|  3.13k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 2.44k, False: 697]
  |  Branch (587:66): [True: 594, False: 103]
  ------------------
  588|  3.13k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 34, False: 3.10k]
  |  Branch (588:42): [True: 0, False: 3.10k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     34|        max_bad_count_ = 1;
  592|     34|        check_too_many_bad_tokens(); // always throws Error()
  593|     34|    }
  594|  3.13k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  3.13k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  3.13k|    add(std::move(obj));
  597|  3.13k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  45.3k|{
  587|  45.3k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 15.7k, False: 29.6k]
  |  Branch (587:66): [True: 21.1k, False: 8.44k]
  ------------------
  588|  45.3k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 84, False: 45.3k]
  |  Branch (588:42): [True: 0, False: 45.3k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     84|        max_bad_count_ = 1;
  592|     84|        check_too_many_bad_tokens(); // always throws Error()
  593|     84|    }
  594|  45.3k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  45.3k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  45.3k|    add(std::move(obj));
  597|  45.3k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  2.73M|{
  587|  2.73M|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 1.67M, False: 1.06M]
  |  Branch (587:66): [True: 986k, False: 73.8k]
  ------------------
  588|  2.73M|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 312, False: 2.73M]
  |  Branch (588:42): [True: 0, False: 2.73M]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|    312|        max_bad_count_ = 1;
  592|    312|        check_too_many_bad_tokens(); // always throws Error()
  593|    312|    }
  594|  2.73M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  2.73M|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  2.73M|    add(std::move(obj));
  597|  2.73M|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  74.9k|{
  587|  74.9k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 46.8k, False: 28.0k]
  |  Branch (587:66): [True: 26.1k, False: 1.96k]
  ------------------
  588|  74.9k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 45, False: 74.8k]
  |  Branch (588:42): [True: 0, False: 74.8k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     45|        max_bad_count_ = 1;
  592|     45|        check_too_many_bad_tokens(); // always throws Error()
  593|     45|    }
  594|  74.9k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  74.9k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  74.9k|    add(std::move(obj));
  597|  74.9k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  51.2k|{
  587|  51.2k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 45.6k, False: 5.56k]
  |  Branch (587:66): [True: 5.36k, False: 194]
  ------------------
  588|  51.2k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 10, False: 51.1k]
  |  Branch (588:42): [True: 0, False: 51.1k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     10|        max_bad_count_ = 1;
  592|     10|        check_too_many_bad_tokens(); // always throws Error()
  593|     10|    }
  594|  51.2k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  51.2k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  51.2k|    add(std::move(obj));
  597|  51.2k|}

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

_ZN4qpdf9Tokenizer5resetEv:
   85|  10.0M|{
   86|  10.0M|    state = st_before_token;
   87|  10.0M|    type = tt::tt_bad;
   88|  10.0M|    val.clear();
   89|  10.0M|    raw_val.clear();
   90|  10.0M|    error_message = "";
   91|  10.0M|    before_token = true;
   92|  10.0M|    in_token = false;
   93|  10.0M|    char_to_unread = '\0';
   94|  10.0M|    inline_image_bytes = 0;
   95|  10.0M|    string_depth = 0;
   96|  10.0M|    bad = false;
   97|  10.0M|}
_ZN4qpdf9TokenizerC2Ev:
  119|  19.8k|{
  120|  19.8k|    reset();
  121|  19.8k|}
_ZN4qpdf9Tokenizer8allowEOFEv:
  131|  19.8k|{
  132|  19.8k|    allow_eof = true;
  133|  19.8k|}
_ZN4qpdf9Tokenizer7isSpaceEc:
  149|  24.6M|{
  150|  24.6M|    return (ch == '\0' || util::is_space(ch));
  ------------------
  |  Branch (150:13): [True: 13.2M, False: 11.3M]
  |  Branch (150:27): [True: 3.55M, False: 7.82M]
  ------------------
  151|  24.6M|}
_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|   366M|{
  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|   366M|    switch (state) {
  182|      0|    case st_top:
  ------------------
  |  Branch (182:5): [True: 0, False: 366M]
  ------------------
  183|      0|        inTop(ch);
  184|      0|        return;
  185|       |
  186|      0|    case st_in_space:
  ------------------
  |  Branch (186:5): [True: 0, False: 366M]
  ------------------
  187|      0|        inSpace(ch);
  188|      0|        return;
  189|       |
  190|  1.73M|    case st_in_comment:
  ------------------
  |  Branch (190:5): [True: 1.73M, False: 364M]
  ------------------
  191|  1.73M|        inComment(ch);
  192|  1.73M|        return;
  193|       |
  194|   270k|    case st_lt:
  ------------------
  |  Branch (194:5): [True: 270k, False: 365M]
  ------------------
  195|   270k|        inLt(ch);
  196|   270k|        return;
  197|       |
  198|   158k|    case st_gt:
  ------------------
  |  Branch (198:5): [True: 158k, False: 366M]
  ------------------
  199|   158k|        inGt(ch);
  200|   158k|        return;
  201|       |
  202|   211M|    case st_in_string:
  ------------------
  |  Branch (202:5): [True: 211M, False: 154M]
  ------------------
  203|   211M|        inString(ch);
  204|   211M|        return;
  205|       |
  206|  86.0M|    case st_name:
  ------------------
  |  Branch (206:5): [True: 86.0M, False: 280M]
  ------------------
  207|  86.0M|        inName(ch);
  208|  86.0M|        return;
  209|       |
  210|  3.74M|    case st_number:
  ------------------
  |  Branch (210:5): [True: 3.74M, False: 362M]
  ------------------
  211|  3.74M|        inNumber(ch);
  212|  3.74M|        return;
  213|       |
  214|   220k|    case st_real:
  ------------------
  |  Branch (214:5): [True: 220k, False: 365M]
  ------------------
  215|   220k|        inReal(ch);
  216|   220k|        return;
  217|       |
  218|   299k|    case st_string_after_cr:
  ------------------
  |  Branch (218:5): [True: 299k, False: 365M]
  ------------------
  219|   299k|        inStringAfterCR(ch);
  220|   299k|        return;
  221|       |
  222|   141k|    case st_string_escape:
  ------------------
  |  Branch (222:5): [True: 141k, False: 366M]
  ------------------
  223|   141k|        inStringEscape(ch);
  224|   141k|        return;
  225|       |
  226|  19.3k|    case st_char_code:
  ------------------
  |  Branch (226:5): [True: 19.3k, False: 366M]
  ------------------
  227|  19.3k|        inCharCode(ch);
  228|  19.3k|        return;
  229|       |
  230|  36.9M|    case st_literal:
  ------------------
  |  Branch (230:5): [True: 36.9M, False: 329M]
  ------------------
  231|  36.9M|        inLiteral(ch);
  232|  36.9M|        return;
  233|       |
  234|      0|    case st_inline_image:
  ------------------
  |  Branch (234:5): [True: 0, False: 366M]
  ------------------
  235|      0|        inInlineImage(ch);
  236|      0|        return;
  237|       |
  238|  79.2k|    case st_in_hexstring:
  ------------------
  |  Branch (238:5): [True: 79.2k, False: 366M]
  ------------------
  239|  79.2k|        inHexstring(ch);
  240|  79.2k|        return;
  241|       |
  242|  92.3k|    case st_in_hexstring_2nd:
  ------------------
  |  Branch (242:5): [True: 92.3k, False: 366M]
  ------------------
  243|  92.3k|        inHexstring2nd(ch);
  244|  92.3k|        return;
  245|       |
  246|  46.8k|    case st_name_hex1:
  ------------------
  |  Branch (246:5): [True: 46.8k, False: 366M]
  ------------------
  247|  46.8k|        inNameHex1(ch);
  248|  46.8k|        return;
  249|       |
  250|  36.9k|    case st_name_hex2:
  ------------------
  |  Branch (250:5): [True: 36.9k, False: 366M]
  ------------------
  251|  36.9k|        inNameHex2(ch);
  252|  36.9k|        return;
  253|       |
  254|  18.5k|    case st_sign:
  ------------------
  |  Branch (254:5): [True: 18.5k, False: 366M]
  ------------------
  255|  18.5k|        inSign(ch);
  256|  18.5k|        return;
  257|       |
  258|  16.5k|    case st_decimal:
  ------------------
  |  Branch (258:5): [True: 16.5k, False: 366M]
  ------------------
  259|  16.5k|        inDecimal(ch);
  260|  16.5k|        return;
  261|       |
  262|  24.6M|    case (st_before_token):
  ------------------
  |  Branch (262:5): [True: 24.6M, False: 341M]
  ------------------
  263|  24.6M|        inBeforeToken(ch);
  264|  24.6M|        return;
  265|       |
  266|      0|    case (st_token_ready):
  ------------------
  |  Branch (266:5): [True: 0, False: 366M]
  ------------------
  267|      0|        inTokenReady(ch);
  268|      0|        return;
  269|       |
  270|      0|    default:
  ------------------
  |  Branch (270:5): [True: 0, False: 366M]
  ------------------
  271|      0|        throw std::logic_error("INTERNAL ERROR: invalid state while reading token");
  272|   366M|    }
  273|   366M|}
_ZN4qpdf9Tokenizer13inBeforeTokenEc:
  284|  24.6M|{
  285|       |    // Note: we specifically do not use ctype here.  It is locale-dependent.
  286|  24.6M|    if (isSpace(ch)) {
  ------------------
  |  Branch (286:9): [True: 16.8M, False: 7.80M]
  ------------------
  287|  16.8M|        before_token = !include_ignorable;
  288|  16.8M|        in_token = include_ignorable;
  289|  16.8M|        if (include_ignorable) {
  ------------------
  |  Branch (289:13): [True: 0, False: 16.8M]
  ------------------
  290|      0|            state = st_in_space;
  291|      0|        }
  292|  16.8M|    } else if (ch == '%') {
  ------------------
  |  Branch (292:16): [True: 17.7k, False: 7.79M]
  ------------------
  293|  17.7k|        before_token = !include_ignorable;
  294|  17.7k|        in_token = include_ignorable;
  295|  17.7k|        state = st_in_comment;
  296|  7.79M|    } else {
  297|  7.79M|        before_token = false;
  298|  7.79M|        in_token = true;
  299|  7.79M|        inTop(ch);
  300|  7.79M|    }
  301|  24.6M|}
_ZN4qpdf9Tokenizer5inTopEc:
  305|  7.79M|{
  306|  7.79M|    switch (ch) {
  307|   107k|    case '(':
  ------------------
  |  Branch (307:5): [True: 107k, False: 7.68M]
  ------------------
  308|   107k|        string_depth = 1;
  309|   107k|        state = st_in_string;
  310|   107k|        return;
  311|       |
  312|   270k|    case '<':
  ------------------
  |  Branch (312:5): [True: 270k, False: 7.51M]
  ------------------
  313|   270k|        state = st_lt;
  314|   270k|        return;
  315|       |
  316|   158k|    case '>':
  ------------------
  |  Branch (316:5): [True: 158k, False: 7.63M]
  ------------------
  317|   158k|        state = st_gt;
  318|   158k|        return;
  319|       |
  320|  16.1k|    case (')'):
  ------------------
  |  Branch (320:5): [True: 16.1k, False: 7.77M]
  ------------------
  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|   172k|    case '[':
  ------------------
  |  Branch (327:5): [True: 172k, False: 7.61M]
  ------------------
  328|   172k|        type = tt::tt_array_open;
  329|   172k|        state = st_token_ready;
  330|   172k|        return;
  331|       |
  332|  65.5k|    case ']':
  ------------------
  |  Branch (332:5): [True: 65.5k, False: 7.72M]
  ------------------
  333|  65.5k|        type = tt::tt_array_close;
  334|  65.5k|        state = st_token_ready;
  335|  65.5k|        return;
  336|       |
  337|  3.35k|    case '{':
  ------------------
  |  Branch (337:5): [True: 3.35k, False: 7.78M]
  ------------------
  338|  3.35k|        type = tt::tt_brace_open;
  339|  3.35k|        state = st_token_ready;
  340|  3.35k|        return;
  341|       |
  342|  2.52k|    case '}':
  ------------------
  |  Branch (342:5): [True: 2.52k, False: 7.78M]
  ------------------
  343|  2.52k|        type = tt::tt_brace_close;
  344|  2.52k|        state = st_token_ready;
  345|  2.52k|        return;
  346|       |
  347|  3.26M|    case '/':
  ------------------
  |  Branch (347:5): [True: 3.26M, False: 4.52M]
  ------------------
  348|  3.26M|        state = st_name;
  349|  3.26M|        val += ch;
  350|  3.26M|        return;
  351|       |
  352|   528k|    case '0':
  ------------------
  |  Branch (352:5): [True: 528k, False: 7.26M]
  ------------------
  353|   944k|    case '1':
  ------------------
  |  Branch (353:5): [True: 415k, False: 7.37M]
  ------------------
  354|  1.13M|    case '2':
  ------------------
  |  Branch (354:5): [True: 188k, False: 7.60M]
  ------------------
  355|  1.20M|    case '3':
  ------------------
  |  Branch (355:5): [True: 73.5k, False: 7.71M]
  ------------------
  356|  1.65M|    case '4':
  ------------------
  |  Branch (356:5): [True: 448k, False: 7.34M]
  ------------------
  357|  1.79M|    case '5':
  ------------------
  |  Branch (357:5): [True: 143k, False: 7.64M]
  ------------------
  358|  1.85M|    case '6':
  ------------------
  |  Branch (358:5): [True: 59.6k, False: 7.73M]
  ------------------
  359|  1.92M|    case '7':
  ------------------
  |  Branch (359:5): [True: 63.1k, False: 7.72M]
  ------------------
  360|  2.05M|    case '8':
  ------------------
  |  Branch (360:5): [True: 130k, False: 7.66M]
  ------------------
  361|  2.08M|    case '9':
  ------------------
  |  Branch (361:5): [True: 33.5k, False: 7.75M]
  ------------------
  362|  2.08M|        state = st_number;
  363|  2.08M|        return;
  364|       |
  365|  4.68k|    case '+':
  ------------------
  |  Branch (365:5): [True: 4.68k, False: 7.78M]
  ------------------
  366|  18.5k|    case '-':
  ------------------
  |  Branch (366:5): [True: 13.8k, False: 7.77M]
  ------------------
  367|  18.5k|        state = st_sign;
  368|  18.5k|        return;
  369|       |
  370|  16.0k|    case '.':
  ------------------
  |  Branch (370:5): [True: 16.0k, False: 7.77M]
  ------------------
  371|  16.0k|        state = st_decimal;
  372|  16.0k|        return;
  373|       |
  374|  1.60M|    default:
  ------------------
  |  Branch (374:5): [True: 1.60M, False: 6.18M]
  ------------------
  375|  1.60M|        state = st_literal;
  376|  1.60M|        return;
  377|  7.79M|    }
  378|  7.79M|}
_ZN4qpdf9Tokenizer9inCommentEc:
  394|  1.73M|{
  395|  1.73M|    if ((ch == '\r') || (ch == '\n')) {
  ------------------
  |  Branch (395:9): [True: 3.94k, False: 1.73M]
  |  Branch (395:25): [True: 13.0k, False: 1.72M]
  ------------------
  396|  16.9k|        if (include_ignorable) {
  ------------------
  |  Branch (396:13): [True: 0, False: 16.9k]
  ------------------
  397|      0|            type = tt::tt_comment;
  398|      0|            in_token = false;
  399|      0|            char_to_unread = ch;
  400|      0|            state = st_token_ready;
  401|  16.9k|        } else {
  402|  16.9k|            state = st_before_token;
  403|  16.9k|        }
  404|  16.9k|    }
  405|  1.73M|}
_ZN4qpdf9Tokenizer8inStringEc:
  409|   211M|{
  410|   211M|    switch (ch) {
  411|   141k|    case '\\':
  ------------------
  |  Branch (411:5): [True: 141k, False: 211M]
  ------------------
  412|   141k|        state = st_string_escape;
  413|   141k|        return;
  414|       |
  415|   197k|    case '(':
  ------------------
  |  Branch (415:5): [True: 197k, False: 211M]
  ------------------
  416|   197k|        val += ch;
  417|   197k|        ++string_depth;
  418|   197k|        return;
  419|       |
  420|   246k|    case ')':
  ------------------
  |  Branch (420:5): [True: 246k, False: 211M]
  ------------------
  421|   246k|        if (--string_depth == 0) {
  ------------------
  |  Branch (421:13): [True: 98.0k, False: 148k]
  ------------------
  422|  98.0k|            type = tt::tt_string;
  423|  98.0k|            state = st_token_ready;
  424|  98.0k|            return;
  425|  98.0k|        }
  426|       |
  427|   148k|        val += ch;
  428|   148k|        return;
  429|       |
  430|   298k|    case '\r':
  ------------------
  |  Branch (430:5): [True: 298k, False: 211M]
  ------------------
  431|       |        // CR by itself is converted to LF
  432|   298k|        val += '\n';
  433|   298k|        state = st_string_after_cr;
  434|   298k|        return;
  435|       |
  436|   401k|    case '\n':
  ------------------
  |  Branch (436:5): [True: 401k, False: 211M]
  ------------------
  437|   401k|        val += ch;
  438|   401k|        return;
  439|       |
  440|   210M|    default:
  ------------------
  |  Branch (440:5): [True: 210M, False: 1.28M]
  ------------------
  441|   210M|        val += ch;
  442|   210M|        return;
  443|   211M|    }
  444|   211M|}
_ZN4qpdf9Tokenizer6inNameEc:
  448|  86.0M|{
  449|  86.0M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (449:9): [True: 3.25M, False: 82.8M]
  ------------------
  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|  3.25M|        type = bad ? tt::tt_bad : tt::tt_name;
  ------------------
  |  Branch (456:16): [True: 188, False: 3.25M]
  ------------------
  457|  3.25M|        in_token = false;
  458|  3.25M|        char_to_unread = ch;
  459|  3.25M|        state = st_token_ready;
  460|  82.8M|    } else if (ch == '#') {
  ------------------
  |  Branch (460:16): [True: 46.8k, False: 82.7M]
  ------------------
  461|  46.8k|        char_code = 0;
  462|  46.8k|        state = st_name_hex1;
  463|  82.7M|    } else {
  464|  82.7M|        val += ch;
  465|  82.7M|    }
  466|  86.0M|}
_ZN4qpdf9Tokenizer10inNameHex1Ec:
  470|  46.8k|{
  471|  46.8k|    hex_char = ch;
  472|       |
  473|  46.8k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (473:48): [True: 37.0k, False: 9.80k]
  ------------------
  474|  37.0k|        char_code = int(hval) << 4;
  475|  37.0k|        state = st_name_hex2;
  476|  37.0k|    } else {
  477|  9.80k|        QTC::TC("qpdf", "QPDFTokenizer bad name 1");
  478|  9.80k|        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|  9.80k|        val += '\0';
  481|  9.80k|        state = st_name;
  482|  9.80k|        inName(ch);
  483|  9.80k|    }
  484|  46.8k|}
_ZN4qpdf9Tokenizer10inNameHex2Ec:
  488|  36.9k|{
  489|  36.9k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (489:48): [True: 3.32k, False: 33.6k]
  ------------------
  490|  3.32k|        char_code |= int(hval);
  491|  33.6k|    } else {
  492|  33.6k|        QTC::TC("qpdf", "QPDFTokenizer bad name 2");
  493|  33.6k|        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|  33.6k|        val += '\0';
  496|  33.6k|        val += hex_char;
  497|  33.6k|        state = st_name;
  498|  33.6k|        inName(ch);
  499|  33.6k|        return;
  500|  33.6k|    }
  501|  3.32k|    if (char_code == 0) {
  ------------------
  |  Branch (501:9): [True: 1.35k, False: 1.96k]
  ------------------
  502|  1.35k|        QTC::TC("qpdf", "QPDFTokenizer null in name");
  503|  1.35k|        error_message = "null character not allowed in name token";
  504|  1.35k|        val += "#00";
  505|  1.35k|        state = st_name;
  506|  1.35k|        bad = true;
  507|  1.96k|    } else {
  508|  1.96k|        val += char(char_code);
  509|  1.96k|        state = st_name;
  510|  1.96k|    }
  511|  3.32k|}
_ZN4qpdf9Tokenizer6inSignEc:
  515|  18.5k|{
  516|  18.5k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (516:9): [True: 13.8k, False: 4.68k]
  ------------------
  517|  13.8k|        state = st_number;
  518|  13.8k|    } else if (ch == '.') {
  ------------------
  |  Branch (518:16): [True: 533, False: 4.15k]
  ------------------
  519|    533|        state = st_decimal;
  520|  4.15k|    } else {
  521|  4.15k|        state = st_literal;
  522|  4.15k|        inLiteral(ch);
  523|  4.15k|    }
  524|  18.5k|}
_ZN4qpdf9Tokenizer9inDecimalEc:
  528|  16.5k|{
  529|  16.5k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (529:9): [True: 13.8k, False: 2.72k]
  ------------------
  530|  13.8k|        state = st_real;
  531|  13.8k|    } else {
  532|  2.72k|        state = st_literal;
  533|  2.72k|        inLiteral(ch);
  534|  2.72k|    }
  535|  16.5k|}
_ZN4qpdf9Tokenizer8inNumberEc:
  539|  3.74M|{
  540|  3.74M|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (540:9): [True: 1.66M, False: 2.07M]
  ------------------
  541|  2.07M|    } else if (ch == '.') {
  ------------------
  |  Branch (541:16): [True: 38.3k, False: 2.03M]
  ------------------
  542|  38.3k|        state = st_real;
  543|  2.03M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (543:16): [True: 2.00M, False: 36.3k]
  ------------------
  544|  2.00M|        type = tt::tt_integer;
  545|  2.00M|        state = st_token_ready;
  546|  2.00M|        in_token = false;
  547|  2.00M|        char_to_unread = ch;
  548|  2.00M|    } else {
  549|  36.3k|        state = st_literal;
  550|  36.3k|    }
  551|  3.74M|}
_ZN4qpdf9Tokenizer6inRealEc:
  555|   220k|{
  556|   220k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (556:9): [True: 168k, False: 52.0k]
  ------------------
  557|   168k|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (557:16): [True: 50.3k, False: 1.68k]
  ------------------
  558|  50.3k|        type = tt::tt_real;
  559|  50.3k|        state = st_token_ready;
  560|  50.3k|        in_token = false;
  561|  50.3k|        char_to_unread = ch;
  562|  50.3k|    } else {
  563|  1.68k|        state = st_literal;
  564|  1.68k|    }
  565|   220k|}
_ZN4qpdf9Tokenizer14inStringEscapeEc:
  568|   141k|{
  569|   141k|    state = st_in_string;
  570|   141k|    switch (ch) {
  571|  5.04k|    case '0':
  ------------------
  |  Branch (571:5): [True: 5.04k, False: 136k]
  ------------------
  572|  13.3k|    case '1':
  ------------------
  |  Branch (572:5): [True: 8.34k, False: 132k]
  ------------------
  573|  14.4k|    case '2':
  ------------------
  |  Branch (573:5): [True: 1.02k, False: 140k]
  ------------------
  574|  15.2k|    case '3':
  ------------------
  |  Branch (574:5): [True: 843, False: 140k]
  ------------------
  575|  16.1k|    case '4':
  ------------------
  |  Branch (575:5): [True: 862, False: 140k]
  ------------------
  576|  17.3k|    case '5':
  ------------------
  |  Branch (576:5): [True: 1.24k, False: 140k]
  ------------------
  577|  18.2k|    case '6':
  ------------------
  |  Branch (577:5): [True: 924, False: 140k]
  ------------------
  578|  18.9k|    case '7':
  ------------------
  |  Branch (578:5): [True: 635, False: 140k]
  ------------------
  579|  18.9k|        state = st_char_code;
  580|  18.9k|        char_code = 0;
  581|  18.9k|        digit_count = 0;
  582|  18.9k|        inCharCode(ch);
  583|  18.9k|        return;
  584|       |
  585|  1.75k|    case 'n':
  ------------------
  |  Branch (585:5): [True: 1.75k, False: 139k]
  ------------------
  586|  1.75k|        val += '\n';
  587|  1.75k|        return;
  588|       |
  589|  1.97k|    case 'r':
  ------------------
  |  Branch (589:5): [True: 1.97k, False: 139k]
  ------------------
  590|  1.97k|        val += '\r';
  591|  1.97k|        return;
  592|       |
  593|  2.91k|    case 't':
  ------------------
  |  Branch (593:5): [True: 2.91k, False: 138k]
  ------------------
  594|  2.91k|        val += '\t';
  595|  2.91k|        return;
  596|       |
  597|    933|    case 'b':
  ------------------
  |  Branch (597:5): [True: 933, False: 140k]
  ------------------
  598|    933|        val += '\b';
  599|    933|        return;
  600|       |
  601|  3.04k|    case 'f':
  ------------------
  |  Branch (601:5): [True: 3.04k, False: 138k]
  ------------------
  602|  3.04k|        val += '\f';
  603|  3.04k|        return;
  604|       |
  605|    498|    case '\n':
  ------------------
  |  Branch (605:5): [True: 498, False: 140k]
  ------------------
  606|    498|        return;
  607|       |
  608|    786|    case '\r':
  ------------------
  |  Branch (608:5): [True: 786, False: 140k]
  ------------------
  609|    786|        state = st_string_after_cr;
  610|    786|        return;
  611|       |
  612|   110k|    default:
  ------------------
  |  Branch (612:5): [True: 110k, False: 30.8k]
  ------------------
  613|       |        // PDF spec says backslash is ignored before anything else
  614|   110k|        val += ch;
  615|   110k|        return;
  616|   141k|    }
  617|   141k|}
_ZN4qpdf9Tokenizer15inStringAfterCREc:
  621|   299k|{
  622|   299k|    state = st_in_string;
  623|   299k|    if (ch != '\n') {
  ------------------
  |  Branch (623:9): [True: 203k, False: 95.2k]
  ------------------
  624|   203k|        inString(ch);
  625|   203k|    }
  626|   299k|}
_ZN4qpdf9Tokenizer4inLtEc:
  630|   270k|{
  631|   270k|    if (ch == '<') {
  ------------------
  |  Branch (631:9): [True: 232k, False: 37.7k]
  ------------------
  632|   232k|        type = tt::tt_dict_open;
  633|   232k|        state = st_token_ready;
  634|   232k|        return;
  635|   232k|    }
  636|       |
  637|  37.7k|    state = st_in_hexstring;
  638|  37.7k|    inHexstring(ch);
  639|  37.7k|}
_ZN4qpdf9Tokenizer4inGtEc:
  643|   158k|{
  644|   158k|    if (ch == '>') {
  ------------------
  |  Branch (644:9): [True: 144k, False: 13.8k]
  ------------------
  645|   144k|        type = tt::tt_dict_close;
  646|   144k|        state = st_token_ready;
  647|   144k|    } else {
  648|  13.8k|        type = tt::tt_bad;
  649|  13.8k|        QTC::TC("qpdf", "QPDFTokenizer bad >");
  650|  13.8k|        error_message = "unexpected >";
  651|  13.8k|        in_token = false;
  652|  13.8k|        char_to_unread = ch;
  653|  13.8k|        state = st_token_ready;
  654|  13.8k|    }
  655|   158k|}
_ZN4qpdf9Tokenizer9inLiteralEc:
  659|  36.9M|{
  660|  36.9M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (660:9): [True: 1.56M, False: 35.4M]
  ------------------
  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.56M|        in_token = false;
  667|  1.56M|        char_to_unread = ch;
  668|  1.56M|        state = st_token_ready;
  669|  1.56M|        type = (raw_val == "true") || (raw_val == "false")
  ------------------
  |  Branch (669:16): [True: 3.08k, False: 1.55M]
  |  Branch (669:39): [True: 1.74k, False: 1.55M]
  ------------------
  670|  1.56M|            ? tt::tt_bool
  671|  1.56M|            : (raw_val == "null" ? tt::tt_null : tt::tt_word);
  ------------------
  |  Branch (671:16): [True: 33.0k, False: 1.52M]
  ------------------
  672|  1.56M|    }
  673|  36.9M|}
_ZN4qpdf9Tokenizer11inHexstringEc:
  677|   116k|{
  678|   116k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (678:48): [True: 88.6k, False: 28.3k]
  ------------------
  679|  88.6k|        char_code = int(hval) << 4;
  680|  88.6k|        state = st_in_hexstring_2nd;
  681|       |
  682|  88.6k|    } else if (ch == '>') {
  ------------------
  |  Branch (682:16): [True: 5.56k, False: 22.8k]
  ------------------
  683|  5.56k|        type = tt::tt_string;
  684|  5.56k|        state = st_token_ready;
  685|       |
  686|  22.8k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (686:16): [True: 12.7k, False: 10.0k]
  ------------------
  687|       |        // ignore
  688|       |
  689|  12.7k|    } else {
  690|  10.0k|        type = tt::tt_bad;
  691|  10.0k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring character");
  692|  10.0k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  693|  10.0k|        state = st_token_ready;
  694|  10.0k|    }
  695|   116k|}
_ZN4qpdf9Tokenizer14inHexstring2ndEc:
  699|  92.3k|{
  700|  92.3k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (700:48): [True: 66.7k, False: 25.6k]
  ------------------
  701|  66.7k|        val += char(char_code) | hval;
  702|  66.7k|        state = st_in_hexstring;
  703|       |
  704|  66.7k|    } else if (ch == '>') {
  ------------------
  |  Branch (704:16): [True: 19.0k, False: 6.57k]
  ------------------
  705|       |        // PDF spec says odd hexstrings have implicit trailing 0.
  706|  19.0k|        val += char(char_code);
  707|  19.0k|        type = tt::tt_string;
  708|  19.0k|        state = st_token_ready;
  709|       |
  710|  19.0k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (710:16): [True: 3.99k, False: 2.58k]
  ------------------
  711|       |        // ignore
  712|       |
  713|  3.99k|    } else {
  714|  2.58k|        type = tt::tt_bad;
  715|  2.58k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character");
  716|  2.58k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  717|  2.58k|        state = st_token_ready;
  718|  2.58k|    }
  719|  92.3k|}
_ZN4qpdf9Tokenizer10inCharCodeEc:
  723|  38.2k|{
  724|  38.2k|    bool handled = false;
  725|  38.2k|    if (('0' <= ch) && (ch <= '7')) {
  ------------------
  |  Branch (725:9): [True: 30.0k, False: 8.14k]
  |  Branch (725:24): [True: 23.2k, False: 6.81k]
  ------------------
  726|  23.2k|        char_code = 8 * char_code + (int(ch) - int('0'));
  727|  23.2k|        if (++(digit_count) < 3) {
  ------------------
  |  Branch (727:13): [True: 23.0k, False: 251]
  ------------------
  728|  23.0k|            return;
  729|  23.0k|        }
  730|    251|        handled = true;
  731|    251|    }
  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|  15.2k|    val += char(char_code % 256);
  735|  15.2k|    state = st_in_string;
  736|  15.2k|    if (!handled) {
  ------------------
  |  Branch (736:9): [True: 14.9k, False: 251]
  ------------------
  737|  14.9k|        inString(ch);
  738|  14.9k|    }
  739|  15.2k|}
_ZN4qpdf9Tokenizer10presentEOFEv:
  760|  34.6k|{
  761|  34.6k|    switch (state) {
  762|  2.11k|    case st_name:
  ------------------
  |  Branch (762:5): [True: 2.11k, False: 32.5k]
  ------------------
  763|  2.29k|    case st_name_hex1:
  ------------------
  |  Branch (763:5): [True: 175, False: 34.4k]
  ------------------
  764|  2.45k|    case st_name_hex2:
  ------------------
  |  Branch (764:5): [True: 162, False: 34.4k]
  ------------------
  765|  7.76k|    case st_number:
  ------------------
  |  Branch (765:5): [True: 5.31k, False: 29.3k]
  ------------------
  766|  7.99k|    case st_real:
  ------------------
  |  Branch (766:5): [True: 228, False: 34.3k]
  ------------------
  767|  8.23k|    case st_sign:
  ------------------
  |  Branch (767:5): [True: 239, False: 34.3k]
  ------------------
  768|  8.38k|    case st_decimal:
  ------------------
  |  Branch (768:5): [True: 152, False: 34.4k]
  ------------------
  769|  16.2k|    case st_literal:
  ------------------
  |  Branch (769:5): [True: 7.86k, False: 26.7k]
  ------------------
  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.6k]
  ------------------
  777|  14.2k|    case st_before_token:
  ------------------
  |  Branch (777:5): [True: 14.2k, False: 20.3k]
  ------------------
  778|  14.2k|        type = tt::tt_eof;
  779|  14.2k|        break;
  780|       |
  781|      0|    case st_in_space:
  ------------------
  |  Branch (781:5): [True: 0, False: 34.6k]
  ------------------
  782|      0|        type = include_ignorable ? tt::tt_space : tt::tt_eof;
  ------------------
  |  Branch (782:16): [True: 0, False: 0]
  ------------------
  783|      0|        break;
  784|       |
  785|    770|    case st_in_comment:
  ------------------
  |  Branch (785:5): [True: 770, False: 33.8k]
  ------------------
  786|    770|        type = include_ignorable ? tt::tt_comment : tt::tt_bad;
  ------------------
  |  Branch (786:16): [True: 0, False: 770]
  ------------------
  787|    770|        break;
  788|       |
  789|      0|    case st_token_ready:
  ------------------
  |  Branch (789:5): [True: 0, False: 34.6k]
  ------------------
  790|      0|        break;
  791|       |
  792|  3.36k|    default:
  ------------------
  |  Branch (792:5): [True: 3.36k, False: 31.2k]
  ------------------
  793|  3.36k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading token");
  794|  3.36k|        type = tt::tt_bad;
  795|  3.36k|        error_message = "EOF while reading token";
  796|  34.6k|    }
  797|  34.6k|    state = st_token_ready;
  798|  34.6k|}
_ZN4qpdf9Tokenizer8getTokenERN13QPDFTokenizer5TokenERbRc:
  916|  2.21M|{
  917|  2.21M|    bool ready = (state == st_token_ready);
  918|  2.21M|    unread_char = !in_token && !before_token;
  ------------------
  |  Branch (918:19): [True: 1.96M, False: 249k]
  |  Branch (918:32): [True: 1.95M, False: 6.81k]
  ------------------
  919|  2.21M|    ch = char_to_unread;
  920|  2.21M|    if (ready) {
  ------------------
  |  Branch (920:9): [True: 2.21M, False: 0]
  ------------------
  921|  2.21M|        token = (!(type == tt::tt_name || type == tt::tt_string))
  ------------------
  |  Branch (921:20): [True: 139k, False: 2.07M]
  |  Branch (921:43): [True: 2.41k, False: 2.07M]
  ------------------
  922|  2.21M|            ? Token(type, raw_val, raw_val, error_message)
  923|  2.21M|            : Token(type, val, raw_val, error_message);
  924|       |
  925|  2.21M|        reset();
  926|  2.21M|    }
  927|  2.21M|    return ready;
  928|  2.21M|}
_ZN4qpdf9Tokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbm:
  958|  2.21M|{
  959|  2.21M|    nextToken(input, context, max_len);
  960|       |
  961|  2.21M|    Token token;
  962|  2.21M|    bool unread_char;
  963|  2.21M|    char char_to_unread;
  964|  2.21M|    getToken(token, unread_char, char_to_unread);
  965|       |
  966|  2.21M|    if (token.getType() == tt::tt_bad) {
  ------------------
  |  Branch (966:9): [True: 141k, False: 2.07M]
  ------------------
  967|   141k|        if (allow_bad) {
  ------------------
  |  Branch (967:13): [True: 141k, False: 0]
  ------------------
  968|   141k|            QTC::TC("qpdf", "QPDFTokenizer allowing bad token");
  969|   141k|        } 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|   141k|    }
  978|  2.21M|    return token;
  979|  2.21M|}
_ZN4qpdf9Tokenizer9nextTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEm:
  983|  7.80M|{
  984|  7.80M|    if (state != st_inline_image) {
  ------------------
  |  Branch (984:9): [True: 7.80M, False: 0]
  ------------------
  985|  7.80M|        reset();
  986|  7.80M|    }
  987|  7.80M|    qpdf_offset_t offset = input.fastTell();
  988|       |
  989|   374M|    while (state != st_token_ready) {
  ------------------
  |  Branch (989:12): [True: 366M, False: 7.80M]
  ------------------
  990|   366M|        char ch;
  991|   366M|        if (!input.fastRead(ch)) {
  ------------------
  |  Branch (991:13): [True: 34.6k, False: 366M]
  ------------------
  992|  34.6k|            presentEOF();
  993|       |
  994|  34.6k|            if ((type == tt::tt_eof) && (!allow_eof)) {
  ------------------
  |  Branch (994:17): [True: 14.2k, False: 20.3k]
  |  Branch (994:41): [True: 0, False: 14.2k]
  ------------------
  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|   366M|        } else {
 1002|   366M|            handleCharacter(ch);
 1003|   366M|            if (before_token) {
  ------------------
  |  Branch (1003:17): [True: 18.5M, False: 347M]
  ------------------
 1004|  18.5M|                ++offset;
 1005|  18.5M|            }
 1006|   366M|            if (in_token) {
  ------------------
  |  Branch (1006:17): [True: 340M, False: 25.4M]
  ------------------
 1007|   340M|                raw_val += ch;
 1008|   340M|            }
 1009|   366M|            if (max_len && (raw_val.length() >= max_len) && (state != st_token_ready)) {
  ------------------
  |  Branch (1009:17): [True: 12.0M, False: 354M]
  |  Branch (1009:28): [True: 129k, False: 11.9M]
  |  Branch (1009:61): [True: 128k, False: 1.15k]
  ------------------
 1010|       |                // terminate this token now
 1011|   128k|                QTC::TC("qpdf", "QPDFTokenizer block long token");
 1012|   128k|                type = tt::tt_bad;
 1013|   128k|                state = st_token_ready;
 1014|   128k|                error_message = "exceeded allowable length while reading token";
 1015|   128k|            }
 1016|   366M|        }
 1017|   366M|    }
 1018|       |
 1019|  7.80M|    input.fastUnread(!in_token && !before_token);
  ------------------
  |  Branch (1019:22): [True: 6.88M, False: 920k]
  |  Branch (1019:35): [True: 6.87M, False: 15.0k]
  ------------------
 1020|       |
 1021|  7.80M|    if (type != tt::tt_eof) {
  ------------------
  |  Branch (1021:9): [True: 7.79M, False: 14.2k]
  ------------------
 1022|  7.79M|        input.setLastOffset(offset);
 1023|  7.79M|    }
 1024|       |
 1025|  7.80M|    return error_message.empty();
 1026|  7.80M|}
QPDFTokenizer.cc:_ZL12is_delimiterc:
   25|   125M|{
   26|   125M|    return (
   27|   125M|        ch == ' ' || ch == '\n' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (27:9): [True: 2.29M, False: 122M]
  |  Branch (27:22): [True: 831k, False: 122M]
  |  Branch (27:36): [True: 2.86M, False: 119M]
  |  Branch (27:49): [True: 22.0k, False: 119M]
  |  Branch (27:62): [True: 48.6k, False: 119M]
  |  Branch (27:75): [True: 7.36k, False: 119M]
  |  Branch (27:88): [True: 7.25k, False: 119M]
  ------------------
   28|   119M|        ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch == '\t' || ch == '\r' ||
  ------------------
  |  Branch (28:9): [True: 90.8k, False: 118M]
  |  Branch (28:22): [True: 62.7k, False: 118M]
  |  Branch (28:35): [True: 95.6k, False: 118M]
  |  Branch (28:48): [True: 74.5k, False: 118M]
  |  Branch (28:61): [True: 13.9k, False: 118M]
  |  Branch (28:74): [True: 10.3k, False: 118M]
  |  Branch (28:88): [True: 294k, False: 118M]
  ------------------
   29|   118M|        ch == '\v' || ch == '\f' || ch == 0);
  ------------------
  |  Branch (29:9): [True: 10.7k, False: 118M]
  |  Branch (29:23): [True: 58.2k, False: 118M]
  |  Branch (29:37): [True: 84.2k, False: 118M]
  ------------------
   30|   125M|}

_ZN10QPDF_ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEEb:
   39|    903|{
   40|    903|    if (sparse) {
  ------------------
  |  Branch (40:9): [True: 311, False: 592]
  ------------------
   41|    311|        sp = std::make_unique<Sparse>();
   42|   130k|        for (auto& item: v) {
  ------------------
  |  Branch (42:24): [True: 130k, False: 311]
  ------------------
   43|   130k|            if (item.raw_type_code() != ::ot_null || item.indirect()) {
  ------------------
  |  Branch (43:17): [True: 98.5k, False: 32.3k]
  |  Branch (43:54): [True: 224, False: 32.1k]
  ------------------
   44|  98.7k|                sp->elements[sp->size] = std::move(item);
   45|  98.7k|            }
   46|   130k|            ++sp->size;
   47|   130k|        }
   48|    592|    } else {
   49|    592|        elements = std::move(v);
   50|    592|    }
   51|    903|}
_ZNK4qpdf5Array5arrayEv:
   55|  49.5k|{
   56|  49.5k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (56:14): [True: 49.5k, False: 0]
  ------------------
   57|  49.5k|        return a;
   58|  49.5k|    }
   59|       |
   60|      0|    throw std::runtime_error("Expected an array but found a non-array object");
   61|      0|    return nullptr; // unreachable
   62|  49.5k|}
_ZN4qpdf5ArrayC2ERKNSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   65|  3.03k|    BaseHandle(QPDFObject::create<QPDF_Array>(items))
   66|  3.03k|{
   67|  3.03k|}
_ZN4qpdf5ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   70|  3.84k|    BaseHandle(QPDFObject::create<QPDF_Array>(std::move(items)))
   71|  3.84k|{
   72|  3.84k|}
_ZN4qpdf5Array5emptyEv:
   76|    823|{
   77|    823|    return Array(std::vector<QPDFObjectHandle>());
   78|    823|}
_ZN4qpdf5Array5beginEv:
   82|  30.6k|{
   83|  30.6k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (83:14): [True: 17.3k, False: 13.3k]
  ------------------
   84|  17.3k|        if (!a->sp) {
  ------------------
  |  Branch (84:13): [True: 16.5k, False: 724]
  ------------------
   85|  16.5k|            return a->elements.begin();
   86|  16.5k|        }
   87|    724|        if (!sp_elements) {
  ------------------
  |  Branch (87:13): [True: 724, False: 0]
  ------------------
   88|    724|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
   89|    724|        }
   90|    724|        return sp_elements->begin();
   91|  17.3k|    }
   92|  13.3k|    return {};
   93|  30.6k|}
_ZN4qpdf5Array3endEv:
   97|  30.6k|{
   98|  30.6k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (98:14): [True: 17.3k, False: 13.3k]
  ------------------
   99|  17.3k|        if (!a->sp) {
  ------------------
  |  Branch (99:13): [True: 16.5k, False: 724]
  ------------------
  100|  16.5k|            return a->elements.end();
  101|  16.5k|        }
  102|    724|        if (!sp_elements) {
  ------------------
  |  Branch (102:13): [True: 0, False: 724]
  ------------------
  103|      0|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
  104|      0|        }
  105|    724|        return sp_elements->end();
  106|  17.3k|    }
  107|  13.3k|    return {};
  108|  30.6k|}
_ZNK4qpdf5Array4sizeEv:
  178|   164k|{
  179|   164k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (179:14): [True: 134k, False: 29.6k]
  ------------------
  180|   134k|        return a->sp ? a->sp->size : a->elements.size();
  ------------------
  |  Branch (180:16): [True: 1.95k, False: 132k]
  ------------------
  181|   134k|    }
  182|  29.6k|    return 0;
  183|   164k|}
_ZNK4qpdf5ArrayixEm:
  187|   308k|{
  188|   308k|    static const QPDFObjectHandle null_obj;
  189|   308k|    auto a = as<QPDF_Array>();
  190|   308k|    if (!a) {
  ------------------
  |  Branch (190:9): [True: 2.34k, False: 306k]
  ------------------
  191|  2.34k|        return null_obj;
  192|  2.34k|    }
  193|   306k|    if (a->sp) {
  ------------------
  |  Branch (193:9): [True: 828, False: 305k]
  ------------------
  194|    828|        auto const& iter = a->sp->elements.find(n);
  195|    828|        return iter == a->sp->elements.end() ? null_obj : iter->second;
  ------------------
  |  Branch (195:16): [True: 111, False: 717]
  ------------------
  196|    828|    }
  197|   305k|    return n >= a->elements.size() ? null_obj : a->elements[n];
  ------------------
  |  Branch (197:12): [True: 2.05k, False: 303k]
  ------------------
  198|   306k|}
_ZNK4qpdf5ArrayixEi:
  202|   305k|{
  203|   305k|    static const QPDFObjectHandle null_obj;
  204|   305k|    if (n < 0) {
  ------------------
  |  Branch (204:9): [True: 3.46k, False: 301k]
  ------------------
  205|  3.46k|        return null_obj;
  206|  3.46k|    }
  207|   301k|    return (*this)[static_cast<size_t>(n)];
  208|   305k|}
_ZNK4qpdf5Array3getEm:
  212|     65|{
  213|     65|    if (n >= size()) {
  ------------------
  |  Branch (213:9): [True: 0, False: 65]
  ------------------
  214|      0|        return {};
  215|      0|    }
  216|     65|    auto a = array();
  217|     65|    if (!a->sp) {
  ------------------
  |  Branch (217:9): [True: 65, False: 0]
  ------------------
  218|     65|        return a->elements[n];
  219|     65|    }
  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|     65|}
_ZNK4qpdf5Array3getEi:
  226|     65|{
  227|     65|    if (n < 0) {
  ------------------
  |  Branch (227:9): [True: 0, False: 65]
  ------------------
  228|      0|        return {};
  229|      0|    }
  230|     65|    return get(to_s(n));
  231|     65|}
_ZNK4qpdf5Array11getAsVectorEv:
  235|  10.2k|{
  236|  10.2k|    auto a = array();
  237|  10.2k|    if (a->sp) {
  ------------------
  |  Branch (237:9): [True: 759, False: 9.45k]
  ------------------
  238|    759|        std::vector<QPDFObjectHandle> v;
  239|    759|        v.reserve(size());
  240|  31.2k|        for (auto const& item: a->sp->elements) {
  ------------------
  |  Branch (240:30): [True: 31.2k, False: 759]
  ------------------
  241|  31.2k|            v.resize(item.first, null_oh);
  242|  31.2k|            v.emplace_back(item.second);
  243|  31.2k|        }
  244|    759|        v.resize(size(), null_oh);
  245|    759|        return v;
  246|  9.45k|    } else {
  247|  9.45k|        return a->elements;
  248|  9.45k|    }
  249|  10.2k|}
_ZN4qpdf5Array3setEmRK16QPDFObjectHandle:
  253|    319|{
  254|    319|    if (at >= size()) {
  ------------------
  |  Branch (254:9): [True: 0, False: 319]
  ------------------
  255|      0|        return false;
  256|      0|    }
  257|    319|    auto a = array();
  258|    319|    checkOwnership(oh);
  259|    319|    if (a->sp) {
  ------------------
  |  Branch (259:9): [True: 5, False: 314]
  ------------------
  260|      5|        a->sp->elements[at] = oh;
  261|    314|    } else {
  262|    314|        a->elements[at] = oh;
  263|    314|    }
  264|    319|    return true;
  265|    319|}
_ZN4qpdf5Array3setEiRK16QPDFObjectHandle:
  269|    319|{
  270|    319|    if (at < 0) {
  ------------------
  |  Branch (270:9): [True: 0, False: 319]
  ------------------
  271|      0|        return false;
  272|      0|    }
  273|    319|    return set(to_s(at), oh);
  274|    319|}
_ZN4qpdf5Array6insertEmRK16QPDFObjectHandle:
  290|  12.5k|{
  291|  12.5k|    auto a = array();
  292|  12.5k|    size_t sz = size();
  293|  12.5k|    if (at > sz) {
  ------------------
  |  Branch (293:9): [True: 0, False: 12.5k]
  ------------------
  294|      0|        return false;
  295|      0|    }
  296|  12.5k|    checkOwnership(item);
  297|  12.5k|    if (at == sz) {
  ------------------
  |  Branch (297:9): [True: 12.5k, False: 0]
  ------------------
  298|       |        // As special case, also allow insert beyond the end
  299|  12.5k|        push_back(item);
  300|  12.5k|        return true;
  301|  12.5k|    }
  302|      0|    if (!a->sp) {
  ------------------
  |  Branch (302:9): [True: 0, False: 0]
  ------------------
  303|      0|        a->elements.insert(a->elements.cbegin() + to_i(at), item);
  304|      0|        return true;
  305|      0|    }
  306|      0|    auto iter = a->sp->elements.crbegin();
  307|      0|    while (iter != a->sp->elements.crend()) {
  ------------------
  |  Branch (307:12): [True: 0, False: 0]
  ------------------
  308|      0|        auto key = (iter++)->first;
  309|      0|        if (key >= at) {
  ------------------
  |  Branch (309:13): [True: 0, False: 0]
  ------------------
  310|      0|            auto nh = a->sp->elements.extract(key);
  311|      0|            ++nh.key();
  312|      0|            a->sp->elements.insert(std::move(nh));
  313|      0|        } else {
  314|      0|            break;
  315|      0|        }
  316|      0|    }
  317|      0|    a->sp->elements[at] = item;
  318|      0|    ++a->sp->size;
  319|      0|    return true;
  320|      0|}
_ZN4qpdf5Array6insertEiRK16QPDFObjectHandle:
  324|  12.5k|{
  325|  12.5k|    if (at_i < 0) {
  ------------------
  |  Branch (325:9): [True: 0, False: 12.5k]
  ------------------
  326|      0|        return false;
  327|      0|    }
  328|  12.5k|    return insert(to_s(at_i), item);
  329|  12.5k|}
_ZN4qpdf5Array9push_backERK16QPDFObjectHandle:
  333|  19.4k|{
  334|  19.4k|    auto a = array();
  335|  19.4k|    checkOwnership(item);
  336|  19.4k|    if (a->sp) {
  ------------------
  |  Branch (336:9): [True: 0, False: 19.4k]
  ------------------
  337|      0|        a->sp->elements[(a->sp->size)++] = item;
  338|  19.4k|    } else {
  339|  19.4k|        a->elements.emplace_back(item);
  340|  19.4k|    }
  341|  19.4k|}
_ZN4qpdf5Array5eraseEm:
  345|  6.90k|{
  346|  6.90k|    auto a = array();
  347|  6.90k|    if (at >= size()) {
  ------------------
  |  Branch (347:9): [True: 0, False: 6.90k]
  ------------------
  348|      0|        return false;
  349|      0|    }
  350|  6.90k|    if (!a->sp) {
  ------------------
  |  Branch (350:9): [True: 6.90k, False: 0]
  ------------------
  351|  6.90k|        a->elements.erase(a->elements.cbegin() + to_i(at));
  352|  6.90k|        return true;
  353|  6.90k|    }
  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|  6.90k|}
_ZN4qpdf5Array5eraseEi:
  373|  6.90k|{
  374|  6.90k|    if (at_i < 0) {
  ------------------
  |  Branch (374:9): [True: 0, False: 6.90k]
  ------------------
  375|      0|        return false;
  376|      0|    }
  377|  6.90k|    return erase(to_s(at_i));
  378|  6.90k|}
_ZNK16QPDFObjectHandle12getArrayItemEi:
  393|  26.1k|{
  394|  26.1k|    if (auto array = Array(*this)) {
  ------------------
  |  Branch (394:14): [True: 26.1k, False: 0]
  ------------------
  395|  26.1k|        if (auto result = array[n]) {
  ------------------
  |  Branch (395:18): [True: 26.0k, False: 28]
  ------------------
  396|  26.0k|            return result;
  397|  26.0k|        }
  398|     28|        if (n >= 0 && std::cmp_less(n, array.size())) {
  ------------------
  |  Branch (398:13): [True: 28, False: 0]
  |  Branch (398:23): [True: 28, False: 0]
  ------------------
  399|       |            // sparse array null
  400|     28|            return newNull();
  401|     28|        }
  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|  26.1k|}
_ZNK16QPDFObjectHandle11isRectangleEv:
  412|  14.8k|{
  413|  14.8k|    Array array(*this);
  414|  18.9k|    for (auto const& oh: array) {
  ------------------
  |  Branch (414:24): [True: 18.9k, False: 14.6k]
  ------------------
  415|  18.9k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (415:13): [True: 204, False: 18.7k]
  ------------------
  416|    204|            return false;
  417|    204|        }
  418|  18.9k|    }
  419|  14.6k|    return array.size() == 4;
  420|  14.8k|}
_ZNK16QPDFObjectHandle16getArrayAsVectorEv:
  472|  9.49k|{
  473|  9.49k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (473:14): [True: 9.49k, False: 0]
  ------------------
  474|  9.49k|        return array.getAsVector();
  475|  9.49k|    }
  476|      0|    typeWarning("array", "treating as empty");
  477|      0|    QTC::TC("qpdf", "QPDFObjectHandle array treating as empty vector");
  478|      0|    return {};
  479|  9.49k|}
_ZNK4qpdf10BaseHandle4sizeEv:
  566|  26.5k|{
  567|  26.5k|    switch (resolved_type_code()) {
  568|  12.3k|    case ::ot_array:
  ------------------
  |  Branch (568:5): [True: 12.3k, False: 14.2k]
  ------------------
  569|  12.3k|        return as<QPDF_Array>()->size();
  570|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (570:5): [True: 0, False: 26.5k]
  ------------------
  571|      0|    case ::ot_reserved:
  ------------------
  |  Branch (571:5): [True: 0, False: 26.5k]
  ------------------
  572|  8.96k|    case ::ot_null:
  ------------------
  |  Branch (572:5): [True: 8.96k, False: 17.5k]
  ------------------
  573|  8.96k|    case ::ot_destroyed:
  ------------------
  |  Branch (573:5): [True: 0, False: 26.5k]
  ------------------
  574|  8.96k|    case ::ot_unresolved:
  ------------------
  |  Branch (574:5): [True: 0, False: 26.5k]
  ------------------
  575|  8.96k|    case ::ot_reference:
  ------------------
  |  Branch (575:5): [True: 0, False: 26.5k]
  ------------------
  576|  8.96k|        return 0;
  577|     18|    case ::ot_boolean:
  ------------------
  |  Branch (577:5): [True: 18, False: 26.5k]
  ------------------
  578|     74|    case ::ot_integer:
  ------------------
  |  Branch (578:5): [True: 56, False: 26.5k]
  ------------------
  579|    108|    case ::ot_real:
  ------------------
  |  Branch (579:5): [True: 34, False: 26.5k]
  ------------------
  580|    180|    case ::ot_string:
  ------------------
  |  Branch (580:5): [True: 72, False: 26.4k]
  ------------------
  581|  5.21k|    case ::ot_name:
  ------------------
  |  Branch (581:5): [True: 5.03k, False: 21.5k]
  ------------------
  582|  5.25k|    case ::ot_dictionary:
  ------------------
  |  Branch (582:5): [True: 35, False: 26.5k]
  ------------------
  583|  5.26k|    case ::ot_stream:
  ------------------
  |  Branch (583:5): [True: 18, False: 26.5k]
  ------------------
  584|  5.26k|    case ::ot_inlineimage:
  ------------------
  |  Branch (584:5): [True: 0, False: 26.5k]
  ------------------
  585|  5.26k|    case ::ot_operator:
  ------------------
  |  Branch (585:5): [True: 0, False: 26.5k]
  ------------------
  586|  5.26k|        return 1;
  587|      0|    default:
  ------------------
  |  Branch (587:5): [True: 0, False: 26.5k]
  ------------------
  588|      0|        throw std::logic_error("Unexpected type code in size"); // unreachable
  589|      0|        return 0;                                               // unreachable
  590|  26.5k|    }
  591|  26.5k|}
_ZNK4qpdf10BaseHandleixEm:
  595|  3.30k|{
  596|  3.30k|    if (resolved_type_code() == ::ot_array) {
  ------------------
  |  Branch (596:9): [True: 3.30k, False: 0]
  ------------------
  597|  3.30k|        return Array(obj)[n];
  598|  3.30k|    }
  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|  3.30k|{
  608|  3.30k|    if (n < 0) {
  ------------------
  |  Branch (608:9): [True: 0, False: 3.30k]
  ------------------
  609|      0|        return {};
  610|      0|    }
  611|  3.30k|    return (*this)[static_cast<size_t>(n)];
  612|  3.30k|}
QPDF_Array.cc:_ZL4to_si:
   15|  19.8k|{
   16|  19.8k|    return static_cast<size_t>(n);
   17|  19.8k|}
_ZNK4qpdf5Array14checkOwnershipERK16QPDFObjectHandle:
   27|  32.3k|{
   28|  32.3k|    if (!item) {
  ------------------
  |  Branch (28:9): [True: 0, False: 32.3k]
  ------------------
   29|      0|        throw std::logic_error("Attempting to add an uninitialized object to a QPDF_Array.");
   30|      0|    }
   31|  32.3k|    if (qpdf() && item.qpdf() && qpdf() != item.qpdf()) {
  ------------------
  |  Branch (31:9): [True: 319, False: 32.0k]
  |  Branch (31:19): [True: 319, False: 0]
  |  Branch (31:34): [True: 0, False: 319]
  ------------------
   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|  32.3k|}
QPDF_Array.cc:_ZL4to_im:
   21|  6.90k|{
   22|  6.90k|    return static_cast<int>(n);
   23|  6.90k|}

_ZNK4qpdf14BaseDictionary4dictEv:
   12|  10.1k|{
   13|  10.1k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (13:14): [True: 10.1k, False: 0]
  ------------------
   14|  10.1k|        return d;
   15|  10.1k|    }
   16|      0|    throw std::runtime_error("Expected a dictionary but found a non-dictionary object");
   17|      0|    return nullptr; // unreachable
   18|  10.1k|}
_ZNK4qpdf10BaseHandleixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   22|   636k|{
   23|   636k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (23:14): [True: 623k, False: 13.1k]
  ------------------
   24|   623k|        auto it = d->items.find(key);
   25|   623k|        if (it != d->items.end()) {
  ------------------
  |  Branch (25:13): [True: 453k, False: 169k]
  ------------------
   26|   453k|            return it->second;
   27|   453k|        }
   28|   623k|    }
   29|   182k|    static const QPDFObjectHandle null_obj;
   30|   182k|    return null_obj;
   31|   636k|}
_ZNK4qpdf10BaseHandle8containsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   63|  56.5k|{
   64|  56.5k|    return !(*this)[key].null();
   65|  56.5k|}
_ZN4qpdf14BaseDictionary7getKeysEv:
   99|  10.1k|{
  100|  10.1k|    std::set<std::string> result;
  101|  33.9k|    for (auto& iter: dict()->items) {
  ------------------
  |  Branch (101:20): [True: 33.9k, False: 10.1k]
  ------------------
  102|  33.9k|        if (!iter.second.null()) {
  ------------------
  |  Branch (102:13): [True: 31.3k, False: 2.55k]
  ------------------
  103|  31.3k|            result.insert(iter.first);
  104|  31.3k|        }
  105|  33.9k|    }
  106|  10.1k|    return result;
  107|  10.1k|}
_ZN4qpdf10BaseHandle5eraseERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  117|  5.00k|{
  118|       |    // no-op if key does not exist
  119|  5.00k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (119:14): [True: 5.00k, False: 0]
  ------------------
  120|  5.00k|        return d->items.erase(key);
  121|  5.00k|    }
  122|      0|    return 0;
  123|  5.00k|}
_ZN4qpdf10BaseHandle7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  140|  35.1k|{
  141|  35.1k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (141:14): [True: 35.1k, False: 0]
  ------------------
  142|  35.1k|        if (value.null() && !value.indirect()) {
  ------------------
  |  Branch (142:13): [True: 394, False: 34.7k]
  |  Branch (142:29): [True: 394, 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|    394|            d->items.erase(key);
  147|  34.7k|        } else {
  148|       |            // add or replace value
  149|  34.7k|            d->items[key] = value;
  150|  34.7k|        }
  151|  35.1k|        return true;
  152|  35.1k|    }
  153|      0|    return false;
  154|  35.1k|}
_ZN4qpdf14BaseDictionary7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  172|  35.1k|{
  173|  35.1k|    if (!BaseHandle::replace(key, value)) {
  ------------------
  |  Branch (173:9): [True: 0, False: 35.1k]
  ------------------
  174|      0|        (void)dict();
  175|      0|    }
  176|  35.1k|}
_ZN4qpdf10DictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  179|    823|    BaseDictionary(std::move(dict))
  180|    823|{
  181|    823|}
_ZN4qpdf10DictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  184|  42.8k|    BaseDictionary(obj)
  185|  42.8k|{
  186|  42.8k|}
_ZNK16QPDFObjectHandle14checkOwnershipERKS_:
  196|  29.5k|{
  197|  29.5k|    auto qpdf = getOwningQPDF();
  198|  29.5k|    auto item_qpdf = item.getOwningQPDF();
  199|  29.5k|    if (qpdf && item_qpdf && qpdf != item_qpdf) {
  ------------------
  |  Branch (199:9): [True: 27.7k, False: 1.83k]
  |  Branch (199:17): [True: 5.06k, False: 22.6k]
  |  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|  29.5k|}
_ZNK16QPDFObjectHandle6hasKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  208|  33.5k|{
  209|  33.5k|    if (Dictionary dict = *this) {
  ------------------
  |  Branch (209:20): [True: 33.3k, False: 162]
  ------------------
  210|  33.3k|        return dict.contains(key);
  211|  33.3k|    } else {
  212|    162|        typeWarning("dictionary", "returning false for a key containment request");
  213|    162|        QTC::TC("qpdf", "QPDFObjectHandle dictionary false for hasKey");
  214|    162|        return false;
  215|    162|    }
  216|  33.5k|}
_ZNK16QPDFObjectHandle6getKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  220|   230k|{
  221|   230k|    if (auto result = get(key)) {
  ------------------
  |  Branch (221:14): [True: 158k, False: 71.6k]
  ------------------
  222|   158k|        return result;
  223|   158k|    }
  224|  71.6k|    if (isDictionary()) {
  ------------------
  |  Branch (224:9): [True: 71.4k, False: 211]
  ------------------
  225|  71.4k|        static auto constexpr msg = " -> dictionary key $VD"sv;
  226|  71.4k|        return QPDF_Null::create(obj, msg, key);
  227|  71.4k|    }
  228|    211|    typeWarning("dictionary", "returning null for attempted key retrieval");
  229|    211|    static auto constexpr msg = " -> null returned from getting key $VD from non-Dictionary"sv;
  230|    211|    return QPDF_Null::create(obj, msg, "");
  231|  71.6k|}
_ZNK16QPDFObjectHandle12getKeyIfDictERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  235|  1.95k|{
  236|  1.95k|    return isNull() ? newNull() : getKey(key);
  ------------------
  |  Branch (236:12): [True: 350, False: 1.60k]
  ------------------
  237|  1.95k|}
_ZNK16QPDFObjectHandle7getKeysEv:
  241|  10.2k|{
  242|  10.2k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (242:14): [True: 10.1k, False: 116]
  ------------------
  243|  10.1k|        return dict.getKeys();
  244|  10.1k|    }
  245|    116|    typeWarning("dictionary", "treating as empty");
  246|    116|    QTC::TC("qpdf", "QPDFObjectHandle dictionary empty set for getKeys");
  247|    116|    return {};
  248|  10.2k|}
_ZN16QPDFObjectHandle10replaceKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  263|  31.6k|{
  264|  31.6k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (264:14): [True: 29.5k, False: 2.05k]
  ------------------
  265|  29.5k|        checkOwnership(value);
  266|  29.5k|        dict.replace(key, value);
  267|  29.5k|        return;
  268|  29.5k|    }
  269|  2.05k|    typeWarning("dictionary", "ignoring key replacement request");
  270|  2.05k|}
_ZN16QPDFObjectHandle9removeKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  289|     18|{
  290|     18|    if (erase(key) || isDictionary()) {
  ------------------
  |  Branch (290:9): [True: 18, False: 0]
  |  Branch (290:23): [True: 0, False: 0]
  ------------------
  291|     18|        return;
  292|     18|    }
  293|      0|    typeWarning("dictionary", "ignoring key removal request");
  294|      0|}

_ZN4QPDF3Doc7Objects7StreamsC2ERNS0_6CommonE:
  126|  19.8k|    Common(common),
  127|  19.8k|    copier_(std::make_shared<Copier>(*this))
  128|  19.8k|{
  129|  19.8k|}
_ZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  225|  12.7k|{
  226|  12.7k|    if (filter_factories_registered) [[unlikely]] {
  ------------------
  |  Branch (226:9): [True: 0, False: 12.7k]
  ------------------
  227|       |        // We need to check user provided filters first as we allow users to replace qpdf provided
  228|       |        // default filters. This will have a performance impact if the facility to register stream
  229|       |        // filters is actually used. We can optimize this away if necessary.
  230|      0|        auto ff = filter_factories.find(expand_filter_name(name));
  231|      0|        if (ff != filter_factories.end()) {
  ------------------
  |  Branch (231:13): [True: 0, False: 0]
  ------------------
  232|      0|            return ff->second;
  233|      0|        }
  234|      0|    }
  235|  12.7k|    if (name == "/FlateDecode") {
  ------------------
  |  Branch (235:9): [True: 2.63k, False: 10.1k]
  ------------------
  236|  2.63k|        return SF_FlateLzwDecode::flate_factory;
  237|  2.63k|    }
  238|  10.1k|    if (name == "/Crypt") {
  ------------------
  |  Branch (238:9): [True: 885, False: 9.23k]
  ------------------
  239|    885|        return []() { return std::make_shared<SF_Crypt>(); };
  240|    885|    }
  241|  9.23k|    if (name == "/LZWDecode") {
  ------------------
  |  Branch (241:9): [True: 61, False: 9.17k]
  ------------------
  242|     61|        return SF_FlateLzwDecode::lzw_factory;
  243|     61|    }
  244|  9.17k|    if (name == "/RunLengthDecode") {
  ------------------
  |  Branch (244:9): [True: 48, False: 9.12k]
  ------------------
  245|     48|        return SF_RunLengthDecode::factory;
  246|     48|    }
  247|  9.12k|    if (name == "/DCTDecode") {
  ------------------
  |  Branch (247:9): [True: 92, False: 9.03k]
  ------------------
  248|     92|        return SF_DCTDecode::factory;
  249|     92|    }
  250|  9.03k|    if (name == "/ASCII85Decode") {
  ------------------
  |  Branch (250:9): [True: 567, False: 8.46k]
  ------------------
  251|    567|        return SF_ASCII85Decode::factory;
  252|    567|    }
  253|  8.46k|    if (name == "/ASCIIHexDecode") {
  ------------------
  |  Branch (253:9): [True: 100, False: 8.36k]
  ------------------
  254|    100|        return SF_ASCIIHexDecode::factory;
  255|    100|    }
  256|       |    // The PDF specification provides these filter abbreviations for use in inline images, but
  257|       |    // according to table H.1 in the pre-ISO versions of the PDF specification, Adobe Reader
  258|       |    // also accepts them for stream filters.
  259|       |
  260|  8.36k|    if (name == "/Fl") {
  ------------------
  |  Branch (260:9): [True: 2.63k, False: 5.72k]
  ------------------
  261|  2.63k|        return SF_FlateLzwDecode::flate_factory;
  262|  2.63k|    }
  263|  5.72k|    if (name == "/AHx") {
  ------------------
  |  Branch (263:9): [True: 459, False: 5.27k]
  ------------------
  264|    459|        return SF_ASCIIHexDecode::factory;
  265|    459|    }
  266|  5.27k|    if (name == "/A85") {
  ------------------
  |  Branch (266:9): [True: 172, False: 5.09k]
  ------------------
  267|    172|        return SF_ASCII85Decode::factory;
  268|    172|    }
  269|  5.09k|    if (name == "/LZW") {
  ------------------
  |  Branch (269:9): [True: 3.35k, False: 1.74k]
  ------------------
  270|  3.35k|        return SF_FlateLzwDecode::lzw_factory;
  271|  3.35k|    }
  272|  1.74k|    if (name == "/RL") {
  ------------------
  |  Branch (272:9): [True: 1.31k, False: 425]
  ------------------
  273|  1.31k|        return SF_RunLengthDecode::factory;
  274|  1.31k|    }
  275|    425|    if (name == "/DCT") {
  ------------------
  |  Branch (275:9): [True: 60, False: 365]
  ------------------
  276|     60|        return SF_DCTDecode::factory;
  277|     60|    }
  278|    365|    return nullptr;
  279|    425|}
_ZN4qpdf6StreamC2ER4QPDF10QPDFObjGen16QPDFObjectHandlexm:
  283|  23.2k|    BaseHandle(QPDFObject::create<QPDF_Stream>(&qpdf, og, std::move(stream_dict), length))
  284|  23.2k|{
  285|  23.2k|    auto descr = std::make_shared<QPDFObject::Description>(
  286|  23.2k|        qpdf.getFilename() + ", stream object " + og.unparse(' '));
  287|  23.2k|    obj->setDescription(&qpdf, descr, offset);
  288|  23.2k|    setDictDescription();
  289|  23.2k|}
_ZN4qpdf6Stream18setDictDescriptionEv:
  451|  23.2k|{
  452|  23.2k|    auto s = stream();
  453|  23.2k|    if (!s->stream_dict.hasObjectDescription()) {
  ------------------
  |  Branch (453:9): [True: 0, False: 23.2k]
  ------------------
  454|      0|        s->stream_dict.setObjectDescription(
  455|      0|            obj->getQPDF(), obj->getDescription() + " -> stream dictionary");
  456|      0|    }
  457|  23.2k|}
_ZN4qpdf6Stream13getStreamDataE26qpdf_stream_decode_level_e:
  461|  10.1k|{
  462|  10.1k|    std::string result;
  463|  10.1k|    pl::String buf(result);
  464|  10.1k|    bool filtered;
  465|  10.1k|    pipeStreamData(&buf, &filtered, 0, decode_level, false, false);
  466|  10.1k|    if (!filtered) {
  ------------------
  |  Branch (466:9): [True: 2.40k, False: 7.76k]
  ------------------
  467|  2.40k|        throw QPDFExc(
  468|  2.40k|            qpdf_e_unsupported,
  469|  2.40k|            qpdf()->getFilename(),
  470|  2.40k|            "",
  471|  2.40k|            offset(),
  472|  2.40k|            "getStreamData called on unfilterable stream");
  473|  2.40k|    }
  474|  7.76k|    return result;
  475|  10.1k|}
_ZNK4qpdf6Stream14isRootMetadataEv:
  495|  10.1k|{
  496|  10.1k|    if (!stream()->stream_dict.isDictionaryOfType("/Metadata", "/XML")) {
  ------------------
  |  Branch (496:9): [True: 10.0k, False: 17]
  ------------------
  497|  10.0k|        return false;
  498|  10.0k|    }
  499|     17|    return qpdf()->getRoot()["/Metadata"].isSameObjectAs(obj);
  500|  10.1k|}
_ZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEE:
  506|  10.1k|{
  507|  10.1k|    auto s = stream();
  508|       |    // Check filters
  509|       |
  510|  10.1k|    auto const& filter_obj = s->stream_dict["/Filter"];
  511|       |
  512|  10.1k|    if (filter_obj.null()) {
  ------------------
  |  Branch (512:9): [True: 3.54k, False: 6.62k]
  ------------------
  513|       |        // No filters
  514|  3.54k|        return true;
  515|  3.54k|    }
  516|  6.62k|    if (filter_obj.size() > global::Limits::max_stream_filters()) {
  ------------------
  |  Branch (516:9): [True: 32, False: 6.59k]
  ------------------
  517|     32|        global::Limits::error();
  518|     32|        warn(
  519|     32|            "limits error(max-stream-filters): too many filters for stream; treating stream as "
  520|     32|            "not filterable");
  521|     32|        return false;
  522|     32|    }
  523|  6.59k|    if (filter_obj.isName()) {
  ------------------
  |  Branch (523:9): [True: 5.03k, False: 1.56k]
  ------------------
  524|       |        // One filter
  525|  5.03k|        auto ff = s->filter_factory(filter_obj.getName());
  526|  5.03k|        if (!ff) {
  ------------------
  |  Branch (526:13): [True: 205, False: 4.82k]
  ------------------
  527|    205|            return false;
  528|    205|        }
  529|  4.82k|        filters.emplace_back(ff());
  530|  4.82k|    } else if (Array array = filter_obj) {
  ------------------
  |  Branch (530:22): [True: 1.53k, False: 26]
  ------------------
  531|       |        // Potentially multiple filters
  532|  7.74k|        for (Name item: array) {
  ------------------
  |  Branch (532:23): [True: 7.74k, False: 1.34k]
  ------------------
  533|  7.74k|            if (!item) {
  ------------------
  |  Branch (533:17): [True: 25, False: 7.72k]
  ------------------
  534|     25|                warn("stream filter type is not name or array");
  535|     25|                return false;
  536|     25|            }
  537|  7.72k|            auto ff = s->filter_factory(item);
  538|  7.72k|            if (!ff) {
  ------------------
  |  Branch (538:17): [True: 160, False: 7.56k]
  ------------------
  539|    160|                filters.clear();
  540|    160|                return false;
  541|    160|            }
  542|  7.56k|            filters.emplace_back(ff());
  543|  7.56k|        }
  544|  1.53k|    } else {
  545|     26|        warn("stream filter type is not name or array");
  546|     26|        return false;
  547|     26|    }
  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.17k|    auto decode_obj = s->stream_dict.getKey("/DecodeParms");
  553|       |
  554|  6.17k|    auto can_filter = // linebreak
  555|  6.17k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  6.17k|        if (!filter.setDecodeParms(d_obj) ||
  557|  6.17k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  558|  6.17k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  559|  6.17k|            return false;
  560|  6.17k|        }
  561|  6.17k|        return true;
  562|  6.17k|    };
  563|       |
  564|  6.17k|    auto decode_array = decode_obj.as_array(strict);
  565|  6.17k|    if (!decode_array || decode_array.size() == 0) {
  ------------------
  |  Branch (565:9): [True: 6.14k, False: 35]
  |  Branch (565:26): [True: 4, False: 31]
  ------------------
  566|  6.14k|        if (decode_array) {
  ------------------
  |  Branch (566:13): [True: 4, False: 6.13k]
  ------------------
  567|      4|            decode_obj = QPDFObjectHandle::newNull();
  568|      4|        }
  569|       |
  570|  11.3k|        for (auto& filter: filters) {
  ------------------
  |  Branch (570:26): [True: 11.3k, False: 5.96k]
  ------------------
  571|  11.3k|            if (!can_filter(decode_level, *filter, decode_obj)) {
  ------------------
  |  Branch (571:17): [True: 177, False: 11.1k]
  ------------------
  572|    177|                return false;
  573|    177|            }
  574|  11.3k|        }
  575|  6.14k|    } 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|     32|        if (!filters.empty() && QIntC::to_size(decode_array.size()) != filters.size()) {
  ------------------
  |  Branch (578:13): [True: 28, False: 4]
  |  Branch (578:13): [True: 4, False: 28]
  |  Branch (578:33): [True: 4, False: 24]
  ------------------
  579|      4|            warn("stream /DecodeParms length is inconsistent with filters");
  580|      4|            return false;
  581|      4|        }
  582|       |
  583|     28|        int i = -1;
  584|     65|        for (auto& filter: filters) {
  ------------------
  |  Branch (584:26): [True: 65, False: 24]
  ------------------
  585|     65|            auto d_obj = decode_array.get(++i);
  586|     65|            if (!can_filter(decode_level, *filter, d_obj)) {
  ------------------
  |  Branch (586:17): [True: 4, False: 61]
  ------------------
  587|      4|                return false;
  588|      4|            }
  589|     65|        }
  590|     28|    }
  591|       |
  592|  5.99k|    return true;
  593|  6.17k|}
_ZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebb:
  603|  10.1k|{
  604|  10.1k|    auto s = stream();
  605|  10.1k|    std::vector<std::shared_ptr<QPDFStreamFilter>> filters;
  606|  10.1k|    bool ignored;
  607|  10.1k|    if (!filterp) {
  ------------------
  |  Branch (607:9): [True: 0, False: 10.1k]
  ------------------
  608|      0|        filterp = &ignored;
  609|      0|    }
  610|  10.1k|    bool& filter = *filterp;
  611|       |
  612|  10.1k|    const bool empty_stream = !s->stream_provider && !s->stream_data && s->length == 0;
  ------------------
  |  Branch (612:31): [True: 10.1k, False: 0]
  |  Branch (612:54): [True: 10.1k, False: 0]
  |  Branch (612:73): [True: 766, False: 9.40k]
  ------------------
  613|  10.1k|    const bool empty_stream_data = s->stream_data && s->stream_data->getSize() == 0;
  ------------------
  |  Branch (613:36): [True: 0, False: 10.1k]
  |  Branch (613:54): [True: 0, False: 0]
  ------------------
  614|  10.1k|    const bool empty = empty_stream || empty_stream_data;
  ------------------
  |  Branch (614:24): [True: 766, False: 9.40k]
  |  Branch (614:40): [True: 0, False: 9.40k]
  ------------------
  615|       |
  616|  10.1k|    if (empty_stream || empty_stream_data) {
  ------------------
  |  Branch (616:9): [True: 766, False: 9.40k]
  |  Branch (616:25): [True: 0, False: 9.40k]
  ------------------
  617|    766|        filter = true;
  618|    766|    }
  619|       |
  620|  10.1k|    filter = empty || encode_flags || decode_level != qpdf_dl_none;
  ------------------
  |  Branch (620:14): [True: 766, False: 9.40k]
  |  Branch (620:23): [True: 0, False: 9.40k]
  |  Branch (620:39): [True: 9.40k, False: 0]
  ------------------
  621|  10.1k|    if (filter) {
  ------------------
  |  Branch (621:9): [True: 10.1k, False: 0]
  ------------------
  622|  10.1k|        filter = filterable(decode_level, filters);
  623|  10.1k|    }
  624|       |
  625|  10.1k|    if (!pipeline) {
  ------------------
  |  Branch (625:9): [True: 0, False: 10.1k]
  ------------------
  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|  10.1k|    std::vector<std::unique_ptr<Pipeline>> to_delete;
  635|       |
  636|  10.1k|    ContentNormalizer normalizer;
  637|  10.1k|    if (filter) {
  ------------------
  |  Branch (637:9): [True: 9.52k, False: 648]
  ------------------
  638|  9.52k|        if (encode_flags & qpdf_ef_compress) {
  ------------------
  |  Branch (638:13): [True: 0, False: 9.52k]
  ------------------
  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.52k|        if (encode_flags & qpdf_ef_normalize) {
  ------------------
  |  Branch (645:13): [True: 0, False: 9.52k]
  ------------------
  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.52k|        for (auto iter = s->token_filters.rbegin(); iter != s->token_filters.rend(); ++iter) {
  ------------------
  |  Branch (652:53): [True: 0, False: 9.52k]
  ------------------
  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|  20.7k|        for (auto f_iter = filters.rbegin(); f_iter != filters.rend(); ++f_iter) {
  ------------------
  |  Branch (659:46): [True: 11.2k, False: 9.52k]
  ------------------
  660|  11.2k|            if (auto decode_pipeline = (*f_iter)->getDecodePipeline(pipeline)) {
  ------------------
  |  Branch (660:22): [True: 10.4k, False: 729]
  ------------------
  661|  10.4k|                pipeline = decode_pipeline;
  662|  10.4k|            }
  663|  11.2k|            auto* flate = dynamic_cast<Pl_Flate*>(pipeline);
  664|  11.2k|            if (flate) {
  ------------------
  |  Branch (664:17): [True: 5.55k, False: 5.65k]
  ------------------
  665|  5.55k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });
  666|  5.55k|            }
  667|  11.2k|        }
  668|  9.52k|    }
  669|       |
  670|  10.1k|    if (s->stream_data.get()) {
  ------------------
  |  Branch (670:9): [True: 0, False: 10.1k]
  ------------------
  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|  10.1k|    } else if (s->stream_provider.get()) {
  ------------------
  |  Branch (674:16): [True: 0, False: 10.1k]
  ------------------
  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|  10.1k|    } else {
  699|  10.1k|        if (offset() == 0) {
  ------------------
  |  Branch (699:13): [True: 0, False: 10.1k]
  ------------------
  700|      0|            throw std::logic_error("pipeStreamData called for stream with no data");
  701|      0|        }
  702|  10.1k|        if (!Streams::pipeStreamData(
  ------------------
  |  Branch (702:13): [True: 1.78k, False: 8.38k]
  ------------------
  703|  10.1k|                qpdf(),
  704|  10.1k|                id_gen(),
  705|  10.1k|                offset(),
  706|  10.1k|                s->length,
  707|  10.1k|                s->stream_dict,
  708|  10.1k|                isRootMetadata(),
  709|  10.1k|                pipeline,
  710|  10.1k|                suppress_warnings,
  711|  10.1k|                will_retry)) {
  712|  1.78k|            filter = false;
  713|  1.78k|            return false;
  714|  1.78k|        }
  715|  10.1k|    }
  716|       |
  717|  8.38k|    if (filter && !suppress_warnings && normalizer.anyBadTokens()) {
  ------------------
  |  Branch (717:9): [True: 7.57k, False: 811]
  |  Branch (717:19): [True: 7.57k, False: 0]
  |  Branch (717:41): [True: 0, False: 7.57k]
  ------------------
  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.38k|    return true;
  733|  10.1k|}
_ZN4qpdf6Stream4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  789|  2.32k|{
  790|  2.32k|    qpdf()->warn(qpdf_e_damaged_pdf, "", offset(), message);
  791|  2.32k|}
_ZNK16QPDFObjectHandle7getDictEv:
  795|  22.5k|{
  796|  22.5k|    return as_stream(error).getDict();
  797|  22.5k|}
_ZN16QPDFObjectHandle13getStreamDataE26qpdf_stream_decode_level_e:
  831|  7.77k|{
  832|  7.77k|    return std::make_shared<Buffer>(as_stream(error).getStreamData(level));
  833|  7.77k|}
QPDF_Stream.cc:_ZZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEEENK3$_0clIS1_S5_16QPDFObjectHandleEEbT_RT0_RT1_:
  555|  11.4k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  11.4k|        if (!filter.setDecodeParms(d_obj) ||
  ------------------
  |  Branch (556:13): [True: 178, False: 11.2k]
  |  Branch (556:13): [True: 181, False: 11.2k]
  ------------------
  557|  11.2k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  ------------------
  |  Branch (557:14): [True: 11.2k, False: 0]
  |  Branch (557:39): [True: 17, False: 11.2k]
  ------------------
  558|  11.2k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  ------------------
  |  Branch (558:14): [True: 0, False: 11.2k]
  |  Branch (558:47): [True: 0, False: 0]
  ------------------
  559|    181|            return false;
  560|    181|        }
  561|  11.2k|        return true;
  562|  11.4k|    };
_ZN4QPDF3Doc7Objects7Streams6CopierC2ERS2_:
   67|  19.8k|        QPDFObjectHandle::StreamDataProvider(true),
   68|  19.8k|        streams(streams)
   69|  19.8k|    {
   70|  19.8k|    }
_ZN4QPDF3Doc7Objects7Streams6CopierD2Ev:
   64|  19.8k|    ~Copier() final = default;
QPDF_Stream.cc:_ZZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_0clEv:
  239|    885|        return []() { return std::make_shared<SF_Crypt>(); };
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_CryptC2Ev:
  136|    885|        SF_Crypt() = default;
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt14setDecodeParmsE16QPDFObjectHandle:
  141|    710|        {
  142|       |            // we only validate here - processing happens in decryptStream
  143|    710|            if (Dictionary dict = decode_parms) {
  ------------------
  |  Branch (143:28): [True: 596, False: 114]
  ------------------
  144|  2.15k|                for (auto const& [key, value]: dict) {
  ------------------
  |  Branch (144:46): [True: 2.15k, False: 578]
  ------------------
  145|  2.15k|                    if (key == "/Type" &&
  ------------------
  |  Branch (145:25): [True: 78, False: 2.07k]
  |  Branch (145:25): [True: 67, False: 2.08k]
  ------------------
  146|     78|                        (value.null() || Name(value) == "/CryptFilterDecodeParms")) {
  ------------------
  |  Branch (146:26): [True: 67, False: 11]
  |  Branch (146:42): [True: 0, False: 11]
  ------------------
  147|     67|                        continue;
  148|     67|                    }
  149|  2.08k|                    if (key == "/Name") {
  ------------------
  |  Branch (149:25): [True: 124, False: 1.96k]
  ------------------
  150|    124|                        continue;
  151|    124|                    }
  152|  1.96k|                    if (!value.null()) {
  ------------------
  |  Branch (152:25): [True: 18, False: 1.94k]
  ------------------
  153|     18|                        return false;
  154|     18|                    }
  155|  1.96k|                }
  156|    578|                return true;
  157|    596|            }
  158|    114|            return decode_parms.null();
  159|    710|        }
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt17getDecodePipelineEP8Pipeline:
  163|    689|        {
  164|       |            // Not used -- handled by pipeStreamData
  165|    689|            return nullptr;
  166|    689|        }
QPDF_Stream.cc:_ZZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebbENK3$_0clEPKci:
  665|  2.23k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });

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

_ZN13QPDFXRefEntryC2Ev:
   30|   796k|QPDFXRefEntry::QPDFXRefEntry() = default;
_ZNK13QPDFXRefEntry7getTypeEv:
   42|   648k|{
   43|   648k|    return type;
   44|   648k|}
_ZNK13QPDFXRefEntry9getOffsetEv:
   48|   309k|{
   49|   309k|    util::assertion(type == 1, "getOffset called for xref entry of type != 1");
   50|   309k|    return this->field1;
   51|   309k|}
_ZNK13QPDFXRefEntry18getObjStreamNumberEv:
   55|   192k|{
   56|   192k|    util::assertion(type == 2, "getObjStreamNumber called for xref entry of type != 2");
   57|   192k|    return QIntC::to_int(field1);
   58|   192k|}
_ZN4QPDF3Doc7Objects18validatePDFVersionERPKcRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  165|  4.05k|{
  166|  4.05k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (166:9): [True: 2.36k, False: 1.69k]
  ------------------
  167|  2.36k|        return false;
  168|  2.36k|    }
  169|  5.24k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (169:12): [True: 3.55k, False: 1.69k]
  ------------------
  170|  3.55k|        version.append(1, *p++);
  171|  3.55k|    }
  172|  1.69k|    if (!(*p == '.' && util::is_digit(*(p + 1)))) {
  ------------------
  |  Branch (172:11): [True: 1.03k, False: 660]
  |  Branch (172:24): [True: 681, False: 351]
  ------------------
  173|  1.01k|        return false;
  174|  1.01k|    }
  175|    681|    version.append(1, *p++);
  176|  1.68k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (176:12): [True: 1.00k, False: 681]
  ------------------
  177|  1.00k|        version.append(1, *p++);
  178|  1.00k|    }
  179|    681|    return true;
  180|  1.69k|}
_ZN4QPDF3Doc7Objects10findHeaderEv:
  184|  4.06k|{
  185|  4.06k|    qpdf_offset_t global_offset = m->file->tell();
  186|  4.06k|    std::string line = m->file->readLine(1024);
  187|  4.06k|    char const* p = line.data();
  188|  4.06k|    util::assertion(strncmp(p, "%PDF-", 5) == 0, "findHeader is not looking at %PDF-");
  189|  4.06k|    p += 5;
  190|  4.06k|    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|  4.06k|    if (!validatePDFVersion(p, version)) {
  ------------------
  |  Branch (193:9): [True: 3.37k, False: 691]
  ------------------
  194|  3.37k|        return false;
  195|  3.37k|    }
  196|    691|    m->pdf_version = version;
  197|    691|    if (global_offset != 0) {
  ------------------
  |  Branch (197:9): [True: 416, False: 275]
  ------------------
  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|    416|        m->file = std::make_shared<OffsetInputSource>(m->file, global_offset);
  202|    416|    }
  203|    691|    return true;
  204|  4.06k|}
_ZN4QPDF3Doc7Objects13findStartxrefEv:
  208|  8.05k|{
  209|  8.05k|    if (readToken(*m->file).isWord("startxref") && readToken(*m->file).isInteger()) {
  ------------------
  |  Branch (209:9): [True: 7.49k, False: 568]
  |  Branch (209:9): [True: 5.68k, False: 2.37k]
  |  Branch (209:52): [True: 5.68k, False: 1.80k]
  ------------------
  210|       |        // Position in front of offset token
  211|  5.68k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
  212|  5.68k|        return true;
  213|  5.68k|    }
  214|  2.37k|    return false;
  215|  8.05k|}
_ZN4QPDF3Doc7Objects5parseEPKc:
  219|  19.8k|{
  220|  19.8k|    if (password) {
  ------------------
  |  Branch (220:9): [True: 0, False: 19.8k]
  ------------------
  221|      0|        m->encp->provided_password = password;
  222|      0|    }
  223|       |
  224|       |    // Find the header anywhere in the first 1024 bytes of the file.
  225|  19.8k|    PatternFinder hf(*this, &Objects::findHeader);
  226|  19.8k|    if (!m->file->findFirst("%PDF-", 0, 1024, hf)) {
  ------------------
  |  Branch (226:9): [True: 19.1k, False: 691]
  ------------------
  227|  19.1k|        warn(damagedPDF("", -1, "can't find PDF header"));
  228|       |        // QPDFWriter writes files that usually require at least version 1.2 for /FlateDecode
  229|  19.1k|        m->pdf_version = "1.2";
  230|  19.1k|    }
  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|  19.8k|    m->file->seek(0, SEEK_END);
  235|  19.8k|    qpdf_offset_t end_offset = m->file->tell();
  236|  19.8k|    m->xref_table_max_offset = end_offset;
  237|       |    // Sanity check on object ids. All objects must appear in xref table / stream. In all realistic
  238|       |    // scenarios at least 3 bytes are required.
  239|  19.8k|    if (m->xref_table_max_id > m->xref_table_max_offset / 3) {
  ------------------
  |  Branch (239:9): [True: 19.8k, False: 10]
  ------------------
  240|  19.8k|        m->xref_table_max_id = static_cast<int>(m->xref_table_max_offset / 3);
  241|  19.8k|    }
  242|  19.8k|    qpdf_offset_t start_offset = (end_offset > 1054 ? end_offset - 1054 : 0);
  ------------------
  |  Branch (242:35): [True: 2.83k, False: 17.0k]
  ------------------
  243|  19.8k|    PatternFinder sf(*this, &Objects::findStartxref);
  244|  19.8k|    qpdf_offset_t xref_offset = 0;
  245|  19.8k|    if (m->file->findLast("startxref", start_offset, 0, sf)) {
  ------------------
  |  Branch (245:9): [True: 5.31k, False: 14.5k]
  ------------------
  246|  5.31k|        xref_offset = QUtil::string_to_ll(readToken(*m->file).getValue().c_str());
  247|  5.31k|    }
  248|       |
  249|  19.8k|    try {
  250|  19.8k|        if (xref_offset == 0) {
  ------------------
  |  Branch (250:13): [True: 14.5k, False: 5.29k]
  ------------------
  251|  14.5k|            throw damagedPDF("", -1, "can't find startxref");
  252|  14.5k|        }
  253|  5.29k|        try {
  254|  5.29k|            read_xref(xref_offset);
  255|  5.29k|        } catch (QPDFExc&) {
  256|  3.65k|            throw;
  257|  3.65k|        } catch (std::exception& e) {
  258|    464|            throw damagedPDF("", -1, std::string("error reading xref: ") + e.what());
  259|    464|        }
  260|  18.7k|    } catch (QPDFExc& e) {
  261|  18.7k|        if (global::Options::inspection_mode()) {
  ------------------
  |  Branch (261:13): [True: 0, False: 18.7k]
  ------------------
  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|  18.7k|        if (cf.surpress_recovery()) {
  ------------------
  |  Branch (272:13): [True: 0, False: 18.7k]
  ------------------
  273|      0|            throw;
  274|      0|        }
  275|  18.7k|        reconstruct_xref(e, xref_offset > 0);
  276|  18.7k|    }
  277|       |
  278|  3.51k|    m->encp->initialize(qpdf);
  279|  3.51k|    m->parsed = true;
  280|  3.51k|    if (!m->xref_table.empty() && !qpdf.getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (280:9): [True: 2.45k, False: 1.06k]
  |  Branch (280:9): [True: 143, False: 3.37k]
  |  Branch (280:35): [True: 143, False: 2.30k]
  ------------------
  281|       |        // QPDFs created from JSON have an empty xref table and no root object yet.
  282|    143|        throw damagedPDF("", -1, "unable to find page tree");
  283|    143|    }
  284|  3.37k|    if (m->cf.max_warnings()) {
  ------------------
  |  Branch (284:9): [True: 2.10k, False: 1.26k]
  ------------------
  285|  2.10k|        if (m->pages.empty()) {
  ------------------
  |  Branch (285:13): [True: 7, False: 2.10k]
  ------------------
  286|      7|            throw damagedPDF("", -1, "no pages found");
  287|      7|        }
  288|  2.10k|        (void)m->cf.max_warnings(0);
  289|  2.10k|    }
  290|  3.37k|}
_ZN4QPDF3Doc7Objects7inParseEb:
  294|   238k|{
  295|   238k|    util::internal_error_if(
  296|   238k|        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|   238k|    );
  300|   238k|    m->in_parse = v;
  301|   238k|}
_ZN4QPDF3Doc7Objects10setTrailerE16QPDFObjectHandle:
  305|  8.68k|{
  306|  8.68k|    if (m->trailer) {
  ------------------
  |  Branch (306:9): [True: 440, False: 8.24k]
  ------------------
  307|    440|        return;
  308|    440|    }
  309|  8.24k|    m->trailer = obj;
  310|  8.24k|}
_ZN4QPDF3Doc7Objects16reconstruct_xrefER7QPDFExcb:
  314|  20.1k|{
  315|  20.1k|    if (m->reconstructed_xref) {
  ------------------
  |  Branch (315:9): [True: 1.03k, False: 19.1k]
  ------------------
  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|  1.03k|        throw e;
  319|  1.03k|    }
  320|       |
  321|       |    // If recovery generates more than 1000 warnings, the file is so severely damaged that there
  322|       |    // probably is no point trying to continue.
  323|  19.1k|    const auto max_warnings = m->warnings.size() + 1000U;
  324|  19.1k|    auto check_warnings = [this, max_warnings]() {
  325|  19.1k|        if (m->warnings.size() > max_warnings) {
  326|  19.1k|            throw damagedPDF("", -1, "too many errors while reconstructing cross-reference table");
  327|  19.1k|        }
  328|  19.1k|    };
  329|       |
  330|  19.1k|    m->reconstructed_xref = true;
  331|       |    // We may find more objects, which may contain dangling references.
  332|  19.1k|    m->fixed_dangling_refs = false;
  333|       |
  334|  19.1k|    warn(damagedPDF("", -1, "file is damaged"));
  335|  19.1k|    warn(e);
  336|  19.1k|    warn(damagedPDF("", -1, "Attempting to reconstruct cross-reference table"));
  337|       |
  338|       |    // Delete all references to type 1 (uncompressed) objects
  339|  19.1k|    std::vector<QPDFObjGen> to_delete;
  340|  98.8k|    for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (340:26): [True: 98.8k, False: 19.1k]
  ------------------
  341|  98.8k|        if (iter.second.getType() == 1) {
  ------------------
  |  Branch (341:13): [True: 89.6k, False: 9.21k]
  ------------------
  342|  89.6k|            to_delete.emplace_back(iter.first);
  343|  89.6k|        }
  344|  98.8k|    }
  345|  89.6k|    for (auto const& iter: to_delete) {
  ------------------
  |  Branch (345:26): [True: 89.6k, False: 19.1k]
  ------------------
  346|  89.6k|        m->xref_table.erase(iter);
  347|  89.6k|    }
  348|       |
  349|  19.1k|    std::vector<std::tuple<int, int, qpdf_offset_t>> found_objects;
  350|  19.1k|    std::vector<qpdf_offset_t> trailers;
  351|  19.1k|    std::vector<qpdf_offset_t> startxrefs;
  352|       |
  353|  19.1k|    m->file->seek(0, SEEK_END);
  354|  19.1k|    qpdf_offset_t eof = m->file->tell();
  355|  19.1k|    m->file->seek(0, SEEK_SET);
  356|       |    // Don't allow very long tokens here during recovery. All the interesting tokens are covered.
  357|  19.1k|    static size_t const MAX_LEN = 10;
  358|  1.34M|    while (m->file->tell() < eof) {
  ------------------
  |  Branch (358:12): [True: 1.32M, False: 19.1k]
  ------------------
  359|  1.32M|        QPDFTokenizer::Token t1 = m->objects.readToken(*m->file, MAX_LEN);
  360|  1.32M|        qpdf_offset_t token_start = m->file->tell() - toO(t1.getValue().length());
  361|  1.32M|        if (t1.isInteger()) {
  ------------------
  |  Branch (361:13): [True: 217k, False: 1.10M]
  ------------------
  362|   217k|            auto pos = m->file->tell();
  363|   217k|            auto t2 = m->objects.readToken(*m->file, MAX_LEN);
  364|   217k|            if (t2.isInteger() && m->objects.readToken(*m->file, MAX_LEN).isWord("obj")) {
  ------------------
  |  Branch (364:17): [True: 158k, False: 59.5k]
  |  Branch (364:17): [True: 104k, False: 113k]
  |  Branch (364:35): [True: 104k, False: 53.7k]
  ------------------
  365|   104k|                int obj = QUtil::string_to_int(t1.getValue().c_str());
  366|   104k|                int gen = QUtil::string_to_int(t2.getValue().c_str());
  367|   104k|                if (obj <= m->xref_table_max_id) {
  ------------------
  |  Branch (367:21): [True: 102k, False: 1.44k]
  ------------------
  368|   102k|                    found_objects.emplace_back(obj, gen, token_start);
  369|   102k|                } else {
  370|  1.44k|                    warn(damagedPDF(
  371|  1.44k|                        "", -1, "ignoring object with impossibly large id " + std::to_string(obj)));
  372|  1.44k|                }
  373|   104k|            }
  374|   217k|            m->file->seek(pos, SEEK_SET);
  375|  1.10M|        } else if (!m->trailer && t1.isWord("trailer")) {
  ------------------
  |  Branch (375:20): [True: 1.05M, False: 56.7k]
  |  Branch (375:20): [True: 330k, False: 777k]
  |  Branch (375:35): [True: 330k, False: 720k]
  ------------------
  376|   330k|            trailers.emplace_back(m->file->tell());
  377|   777k|        } else if (!found_startxref && t1.isWord("startxref")) {
  ------------------
  |  Branch (377:20): [True: 671k, False: 106k]
  |  Branch (377:20): [True: 2.95k, False: 774k]
  |  Branch (377:40): [True: 2.95k, False: 668k]
  ------------------
  378|  2.95k|            startxrefs.emplace_back(m->file->tell());
  379|  2.95k|        }
  380|  1.32M|        check_warnings();
  381|  1.32M|        m->file->findAndSkipNextEOL();
  382|  1.32M|    }
  383|       |
  384|  19.1k|    if (!found_startxref && !startxrefs.empty() && !found_objects.empty() &&
  ------------------
  |  Branch (384:9): [True: 14.7k, False: 4.37k]
  |  Branch (384:29): [True: 667, False: 14.0k]
  |  Branch (384:52): [True: 509, False: 158]
  ------------------
  385|    509|        startxrefs.back() > std::get<2>(found_objects.back())) {
  ------------------
  |  Branch (385:9): [True: 327, False: 182]
  ------------------
  386|    327|        auto xref_backup{m->xref_table};
  387|    327|        try {
  388|    327|            m->file->seek(startxrefs.back(), SEEK_SET);
  389|    327|            if (auto offset = QUtil::string_to_ll(readToken(*m->file).getValue().data())) {
  ------------------
  |  Branch (389:22): [True: 277, False: 50]
  ------------------
  390|    277|                read_xref(offset);
  391|       |
  392|    277|                if (qpdf.getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (392:21): [True: 4, False: 273]
  ------------------
  393|      4|                    warn(damagedPDF(
  394|      4|                        "", -1, "startxref was more than 1024 bytes before end of file"));
  395|      4|                    m->encp->initialize(qpdf);
  396|      4|                    m->parsed = true;
  397|      4|                    m->reconstructed_xref = false;
  398|      4|                    return;
  399|      4|                }
  400|    277|            }
  401|    327|        } catch (...) {
  402|       |            // ok, bad luck. Do recovery.
  403|    280|        }
  404|    323|        m->xref_table = std::move(xref_backup);
  405|    323|    }
  406|       |
  407|  19.1k|    auto rend = found_objects.rend();
  408|   121k|    for (auto it = found_objects.rbegin(); it != rend; it++) {
  ------------------
  |  Branch (408:44): [True: 102k, False: 19.1k]
  ------------------
  409|   102k|        auto [obj, gen, token_start] = *it;
  410|   102k|        insertXrefEntry(obj, 1, token_start, gen);
  411|   102k|        check_warnings();
  412|   102k|    }
  413|  19.1k|    m->deleted_objects.clear();
  414|       |
  415|       |    // Search at most the last 100 trailer candidates. If none of them are valid, odds are this file
  416|       |    // is deliberately broken.
  417|  19.1k|    int end_index = trailers.size() > 100 ? static_cast<int>(trailers.size()) - 100 : 0;
  ------------------
  |  Branch (417:21): [True: 32, False: 19.0k]
  ------------------
  418|  38.5k|    for (auto it = trailers.rbegin(); it != std::prev(trailers.rend(), end_index); it++) {
  ------------------
  |  Branch (418:39): [True: 21.1k, False: 17.3k]
  ------------------
  419|  21.1k|        m->file->seek(*it, SEEK_SET);
  420|  21.1k|        auto t = readTrailer();
  421|  21.1k|        if (!t.isDictionary()) {
  ------------------
  |  Branch (421:13): [True: 18.5k, False: 2.60k]
  ------------------
  422|       |            // Oh well.  It was worth a try.
  423|  18.5k|        } else {
  424|  2.60k|            if (t.hasKey("/Root")) {
  ------------------
  |  Branch (424:17): [True: 1.75k, False: 851]
  ------------------
  425|  1.75k|                m->trailer = t;
  426|  1.75k|                break;
  427|  1.75k|            }
  428|    851|            warn(damagedPDF("trailer", *it, "recovered trailer has no /Root entry"));
  429|    851|        }
  430|  19.4k|        check_warnings();
  431|  19.4k|    }
  432|       |
  433|  19.1k|    if (!m->trailer) {
  ------------------
  |  Branch (433:9): [True: 16.2k, False: 2.87k]
  ------------------
  434|  16.2k|        qpdf_offset_t max_offset{0};
  435|  16.2k|        size_t max_size{0};
  436|       |        // If there are any xref streams, take the last one to appear.
  437|  44.8k|        for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (437:30): [True: 44.8k, False: 16.2k]
  ------------------
  438|  44.8k|            auto entry = iter.second;
  439|  44.8k|            if (entry.getType() != 1) {
  ------------------
  |  Branch (439:17): [True: 1.16k, False: 43.7k]
  ------------------
  440|  1.16k|                continue;
  441|  1.16k|            }
  442|  43.7k|            auto oh = qpdf.getObject(iter.first);
  443|  43.7k|            try {
  444|  43.7k|                if (!oh.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (444:21): [True: 33.4k, False: 10.2k]
  ------------------
  445|  33.4k|                    continue;
  446|  33.4k|                }
  447|  43.7k|            } catch (std::exception&) {
  448|  3.29k|                continue;
  449|  3.29k|            }
  450|  6.95k|            auto offset = entry.getOffset();
  451|  6.95k|            auto size = oh.getDict().getKey("/Size").getUIntValueAsUInt();
  452|  6.95k|            if (size > max_size || (size == max_size && offset > max_offset)) {
  ------------------
  |  Branch (452:17): [True: 4.75k, False: 2.19k]
  |  Branch (452:37): [True: 2.19k, False: 0]
  |  Branch (452:57): [True: 2.07k, False: 118]
  ------------------
  453|  6.82k|                max_offset = offset;
  454|  6.82k|                setTrailer(oh.getDict());
  455|  6.82k|            }
  456|  6.95k|            check_warnings();
  457|  6.95k|        }
  458|  16.2k|        if (max_offset > 0) {
  ------------------
  |  Branch (458:13): [True: 6.38k, False: 9.83k]
  ------------------
  459|  6.38k|            try {
  460|  6.38k|                read_xref(max_offset, true);
  461|  6.38k|            } catch (std::exception&) {
  462|  3.72k|                warn(damagedPDF(
  463|  3.72k|                    "", -1, "error decoding candidate xref stream while recovering damaged file"));
  464|  3.72k|            }
  465|  6.38k|            QTC::TC("qpdf", "QPDF recover xref stream");
  466|  6.35k|        }
  467|  16.2k|    }
  468|       |
  469|  19.0k|    if (!m->trailer || (!m->parsed && !m->trailer.getKey("/Root").isDictionary())) {
  ------------------
  |  Branch (469:9): [True: 9.88k, False: 9.18k]
  |  Branch (469:9): [True: 16.8k, False: 2.24k]
  |  Branch (469:25): [True: 8.80k, False: 381]
  |  Branch (469:39): [True: 6.99k, False: 1.81k]
  ------------------
  470|       |        // Try to find a Root dictionary. As a quick fix try the one with the highest object id.
  471|  16.8k|        QPDFObjectHandle root;
  472|  98.9k|        for (auto const& iter: m->obj_cache) {
  ------------------
  |  Branch (472:30): [True: 98.9k, False: 16.8k]
  ------------------
  473|  98.9k|            try {
  474|  98.9k|                if (QPDFObjectHandle(iter.second.object).isDictionaryOfType("/Catalog")) {
  ------------------
  |  Branch (474:21): [True: 2.39k, False: 96.5k]
  ------------------
  475|  2.39k|                    root = iter.second.object;
  476|  2.39k|                }
  477|  98.9k|            } catch (std::exception&) {
  478|  8.61k|                continue;
  479|  8.61k|            }
  480|  98.9k|        }
  481|  16.8k|        if (root) {
  ------------------
  |  Branch (481:13): [True: 2.29k, False: 14.5k]
  ------------------
  482|  2.29k|            if (!m->trailer) {
  ------------------
  |  Branch (482:17): [True: 1.83k, False: 454]
  ------------------
  483|  1.83k|                warn(damagedPDF(
  484|  1.83k|                    "", -1, "unable to find trailer dictionary while recovering damaged file"));
  485|  1.83k|                m->trailer = QPDFObjectHandle::newDictionary();
  486|  1.83k|            }
  487|  2.29k|            m->trailer.replaceKey("/Root", root);
  488|  2.29k|        }
  489|  16.8k|    }
  490|       |
  491|  19.0k|    if (!m->trailer) {
  ------------------
  |  Branch (491:9): [True: 7.99k, False: 11.0k]
  ------------------
  492|       |        // We could check the last encountered object to see if it was an xref stream.  If so, we
  493|       |        // could try to get the trailer from there.  This may make it possible to recover files with
  494|       |        // bad startxref pointers even when they have object streams.
  495|       |
  496|  7.99k|        throw damagedPDF("", -1, "unable to find trailer dictionary while recovering damaged file");
  497|  7.99k|    }
  498|  11.0k|    if (m->xref_table.empty()) {
  ------------------
  |  Branch (498:9): [True: 490, False: 10.5k]
  ------------------
  499|       |        // We cannot check for an empty xref table in parse because empty tables are valid when
  500|       |        // creating QPDF objects from JSON.
  501|    490|        throw damagedPDF("", -1, "unable to find objects while recovering damaged file");
  502|    490|    }
  503|  10.5k|    check_warnings();
  504|  10.5k|    if (!m->parsed) {
  ------------------
  |  Branch (504:9): [True: 10.2k, False: 376]
  ------------------
  505|  10.2k|        m->parsed = !m->pages.empty();
  506|  10.2k|        if (!m->parsed) {
  ------------------
  |  Branch (506:13): [True: 1.25k, False: 8.95k]
  ------------------
  507|  1.25k|            throw damagedPDF("", -1, "unable to find any pages while recovering damaged file");
  508|  1.25k|        }
  509|  8.95k|        check_warnings();
  510|  8.95k|    }
  511|       |
  512|       |    // We could iterate through the objects looking for streams and try to find objects inside of
  513|       |    // them, but it's probably not worth the trouble.  Acrobat can't recover files with any errors
  514|       |    // in an xref stream, and this would be a real long shot anyway.  If we wanted to do anything
  515|       |    // that involved looking at stream contents, we'd also have to call initializeEncryption() here.
  516|       |    // It's safe to call it more than once.
  517|  10.5k|}
_ZN4QPDF3Doc7Objects9read_xrefExb:
  521|  11.9k|{
  522|  11.9k|    std::map<int, int> free_table;
  523|  11.9k|    std::set<qpdf_offset_t> visited;
  524|  24.7k|    while (xref_offset) {
  ------------------
  |  Branch (524:12): [True: 13.0k, False: 11.6k]
  ------------------
  525|  13.0k|        visited.insert(xref_offset);
  526|  13.0k|        char buf[7];
  527|  13.0k|        memset(buf, 0, sizeof(buf));
  528|  13.0k|        m->file->seek(xref_offset, SEEK_SET);
  529|       |        // Some files miss the mark a little with startxref. We could do a better job of searching
  530|       |        // in the neighborhood for something that looks like either an xref table or stream, but the
  531|       |        // simple heuristic of skipping whitespace can help with the xref table case and is harmless
  532|       |        // with the stream case.
  533|  13.0k|        bool done = false;
  534|  13.0k|        bool skipped_space = false;
  535|  30.9k|        while (!done) {
  ------------------
  |  Branch (535:16): [True: 17.8k, False: 13.0k]
  ------------------
  536|  17.8k|            char ch;
  537|  17.8k|            if (1 == m->file->read(&ch, 1)) {
  ------------------
  |  Branch (537:17): [True: 17.3k, False: 417]
  ------------------
  538|  17.3k|                if (util::is_space(ch)) {
  ------------------
  |  Branch (538:21): [True: 5.03k, False: 12.3k]
  ------------------
  539|  5.03k|                    skipped_space = true;
  540|  12.3k|                } else {
  541|  12.3k|                    m->file->unreadCh(ch);
  542|  12.3k|                    done = true;
  543|  12.3k|                }
  544|  17.3k|            } else {
  545|    417|                QTC::TC("qpdf", "QPDF eof skipping spaces before xref", skipped_space ? 0 : 1);
  ------------------
  |  Branch (545:73): [True: 0, False: 417]
  ------------------
  546|    417|                done = true;
  547|    417|            }
  548|  17.8k|        }
  549|       |
  550|  13.0k|        m->file->read(buf, sizeof(buf) - 1);
  551|       |        // The PDF spec says xref must be followed by a line terminator, but files exist in the wild
  552|       |        // where it is terminated by arbitrary whitespace.
  553|  13.0k|        if ((strncmp(buf, "xref", 4) == 0) && util::is_space(buf[4])) {
  ------------------
  |  Branch (553:13): [True: 2.18k, False: 10.9k]
  |  Branch (553:47): [True: 2.17k, False: 13]
  ------------------
  554|  2.17k|            if (skipped_space) {
  ------------------
  |  Branch (554:17): [True: 52, False: 2.12k]
  ------------------
  555|     52|                warn(damagedPDF("", -1, "extraneous whitespace seen before xref"));
  556|     52|            }
  557|  2.17k|            QTC::TC(
  558|  2.17k|                "qpdf",
  559|  2.17k|                "QPDF xref space",
  560|  2.17k|                ((buf[4] == '\n')       ? 0
  ------------------
  |  Branch (560:18): [True: 158, False: 2.01k]
  ------------------
  561|  2.17k|                     : (buf[4] == '\r') ? 1
  ------------------
  |  Branch (561:24): [True: 1.51k, False: 503]
  ------------------
  562|  2.01k|                     : (buf[4] == ' ')  ? 2
  ------------------
  |  Branch (562:24): [True: 355, False: 148]
  ------------------
  563|    503|                                        : 9999));
  564|  2.17k|            int skip = 4;
  565|       |            // buf is null-terminated, and util::is_space('\0') is false, so this won't overrun.
  566|  4.48k|            while (util::is_space(buf[skip])) {
  ------------------
  |  Branch (566:20): [True: 2.31k, False: 2.17k]
  ------------------
  567|  2.31k|                ++skip;
  568|  2.31k|            }
  569|  2.17k|            xref_offset = read_xrefTable(xref_offset + skip);
  570|  10.9k|        } else {
  571|  10.9k|            xref_offset = read_xrefStream(xref_offset, in_stream_recovery);
  572|  10.9k|        }
  573|  13.0k|        if (visited.contains(xref_offset)) {
  ------------------
  |  Branch (573:13): [True: 318, False: 12.7k]
  ------------------
  574|    318|            throw damagedPDF("", -1, "loop detected following xref tables");
  575|    318|        }
  576|  13.0k|    }
  577|       |
  578|  11.6k|    if (!m->trailer) {
  ------------------
  |  Branch (578:9): [True: 0, False: 11.6k]
  ------------------
  579|      0|        throw damagedPDF("", -1, "unable to find trailer while reading xref");
  580|      0|    }
  581|  11.6k|    int size = m->trailer.getKey("/Size").getIntValueAsInt();
  582|  11.6k|    int max_obj = 0;
  583|  11.6k|    if (!m->xref_table.empty()) {
  ------------------
  |  Branch (583:9): [True: 3.62k, False: 7.99k]
  ------------------
  584|  3.62k|        max_obj = m->xref_table.rbegin()->first.getObj();
  585|  3.62k|    }
  586|  11.6k|    if (!m->deleted_objects.empty()) {
  ------------------
  |  Branch (586:9): [True: 856, False: 10.7k]
  ------------------
  587|    856|        max_obj = std::max(max_obj, *(m->deleted_objects.rbegin()));
  588|    856|    }
  589|  11.6k|    if (size < 1 || (size - 1) != max_obj) {
  ------------------
  |  Branch (589:9): [True: 8.37k, False: 3.25k]
  |  Branch (589:21): [True: 2.00k, False: 1.25k]
  ------------------
  590|  2.59k|        if (size == (max_obj + 2) && qpdf.getObject(max_obj + 1, 0).isStreamOfType("/XRef")) {
  ------------------
  |  Branch (590:13): [True: 201, False: 2.39k]
  |  Branch (590:13): [True: 33, False: 2.56k]
  |  Branch (590:38): [True: 33, False: 168]
  ------------------
  591|     33|            warn(damagedPDF(
  592|     33|                "",
  593|     33|                -1,
  594|     33|                "xref entry for the xref stream itself is missing - a common error handled "
  595|     33|                "correctly by qpdf and most other applications"));
  596|  2.56k|        } else {
  597|  2.56k|            warn(damagedPDF(
  598|  2.56k|                "",
  599|  2.56k|                -1,
  600|  2.56k|                ("reported number of objects (" + std::to_string(size) +
  601|  2.56k|                 ") is not one plus the highest object number (" + std::to_string(max_obj) + ")")));
  602|  2.56k|        }
  603|  2.59k|    }
  604|       |
  605|       |    // We no longer need the deleted_objects table, so go ahead and clear it out to make sure we
  606|       |    // never depend on its being set.
  607|  11.6k|    m->deleted_objects.clear();
  608|       |
  609|       |    // Make sure we keep only the highest generation for any object.
  610|  11.6k|    QPDFObjGen last_og{-1, 0};
  611|   634k|    for (auto const& item: m->xref_table) {
  ------------------
  |  Branch (611:26): [True: 634k, False: 11.6k]
  ------------------
  612|   634k|        auto id = item.first.getObj();
  613|   634k|        if (id == last_og.getObj() && id > 0) {
  ------------------
  |  Branch (613:13): [True: 23.9k, False: 610k]
  |  Branch (613:39): [True: 23.9k, False: 0]
  ------------------
  614|  23.9k|            qpdf.removeObject(last_og);
  615|  23.9k|        }
  616|   634k|        last_og = item.first;
  617|   634k|    }
  618|  11.6k|}
_ZN4QPDF3Doc7Objects15parse_xrefFirstERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERiSB_SB_:
  622|  7.16k|{
  623|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  624|       |    // buffer.
  625|  7.16k|    char const* p = line.c_str();
  626|  7.16k|    char const* start = line.c_str();
  627|       |
  628|       |    // Skip zero or more spaces
  629|  8.65k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (629:12): [True: 1.49k, False: 7.16k]
  ------------------
  630|  1.49k|        ++p;
  631|  1.49k|    }
  632|       |    // Require digit
  633|  7.16k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (633:9): [True: 171, False: 6.99k]
  ------------------
  634|    171|        return false;
  635|    171|    }
  636|       |    // Gather digits
  637|  6.99k|    std::string obj_str;
  638|  23.2k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (638:12): [True: 16.2k, False: 6.99k]
  ------------------
  639|  16.2k|        obj_str.append(1, *p++);
  640|  16.2k|    }
  641|       |    // Require space
  642|  6.99k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (642:9): [True: 107, False: 6.89k]
  ------------------
  643|    107|        return false;
  644|    107|    }
  645|       |    // Skip spaces
  646|  16.4k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (646:12): [True: 9.57k, False: 6.89k]
  ------------------
  647|  9.57k|        ++p;
  648|  9.57k|    }
  649|       |    // Require digit
  650|  6.89k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (650:9): [True: 117, False: 6.77k]
  ------------------
  651|    117|        return false;
  652|    117|    }
  653|       |    // Gather digits
  654|  6.77k|    std::string num_str;
  655|  21.5k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (655:12): [True: 14.7k, False: 6.77k]
  ------------------
  656|  14.7k|        num_str.append(1, *p++);
  657|  14.7k|    }
  658|       |    // Skip any space including line terminators
  659|  16.3k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (659:12): [True: 9.56k, False: 6.77k]
  ------------------
  660|  9.56k|        ++p;
  661|  9.56k|    }
  662|  6.77k|    bytes = toI(p - start);
  663|  6.77k|    obj = QUtil::string_to_int(obj_str.c_str());
  664|  6.77k|    num = QUtil::string_to_int(num_str.c_str());
  665|  6.77k|    return true;
  666|  6.89k|}
_ZN4QPDF3Doc7Objects18read_bad_xrefEntryERxRiRc:
  670|  6.92k|{
  671|       |    // Reposition after initial read attempt and reread.
  672|  6.92k|    m->file->seek(m->file->getLastOffset(), SEEK_SET);
  673|  6.92k|    auto line = m->file->readLine(30);
  674|       |
  675|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  676|       |    // buffer.
  677|  6.92k|    char const* p = line.data();
  678|       |
  679|       |    // Skip zero or more spaces. There aren't supposed to be any.
  680|  6.92k|    bool invalid = false;
  681|  12.9k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (681:12): [True: 6.00k, False: 6.92k]
  ------------------
  682|  6.00k|        ++p;
  683|  6.00k|        invalid = true;
  684|  6.00k|    }
  685|       |    // Require digit
  686|  6.92k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (686:9): [True: 21, False: 6.89k]
  ------------------
  687|     21|        return false;
  688|     21|    }
  689|       |    // Gather digits
  690|  6.89k|    std::string f1_str;
  691|  28.4k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (691:12): [True: 21.5k, False: 6.89k]
  ------------------
  692|  21.5k|        f1_str.append(1, *p++);
  693|  21.5k|    }
  694|       |    // Require space
  695|  6.89k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (695:9): [True: 33, False: 6.86k]
  ------------------
  696|     33|        return false;
  697|     33|    }
  698|  6.86k|    if (util::is_space(*(p + 1))) {
  ------------------
  |  Branch (698:9): [True: 1.37k, False: 5.49k]
  ------------------
  699|  1.37k|        invalid = true;
  700|  1.37k|    }
  701|       |    // Skip spaces
  702|  17.9k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (702:12): [True: 11.0k, False: 6.86k]
  ------------------
  703|  11.0k|        ++p;
  704|  11.0k|    }
  705|       |    // Require digit
  706|  6.86k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (706:9): [True: 62, False: 6.80k]
  ------------------
  707|     62|        return false;
  708|     62|    }
  709|       |    // Gather digits
  710|  6.80k|    std::string f2_str;
  711|  33.9k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (711:12): [True: 27.1k, False: 6.80k]
  ------------------
  712|  27.1k|        f2_str.append(1, *p++);
  713|  27.1k|    }
  714|       |    // Require space
  715|  6.80k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (715:9): [True: 58, False: 6.74k]
  ------------------
  716|     58|        return false;
  717|     58|    }
  718|  6.74k|    if (util::is_space(*(p + 1))) {
  ------------------
  |  Branch (718:9): [True: 1.35k, False: 5.39k]
  ------------------
  719|  1.35k|        invalid = true;
  720|  1.35k|    }
  721|       |    // Skip spaces
  722|  15.7k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (722:12): [True: 9.04k, False: 6.74k]
  ------------------
  723|  9.04k|        ++p;
  724|  9.04k|    }
  725|  6.74k|    if ((*p == 'f') || (*p == 'n')) {
  ------------------
  |  Branch (725:9): [True: 1.99k, False: 4.74k]
  |  Branch (725:24): [True: 4.53k, False: 217]
  ------------------
  726|  6.52k|        type = *p;
  727|  6.52k|    } else {
  728|    217|        return false;
  729|    217|    }
  730|  6.52k|    if ((f1_str.length() != 10) || (f2_str.length() != 5)) {
  ------------------
  |  Branch (730:9): [True: 5.74k, False: 788]
  |  Branch (730:36): [True: 483, False: 305]
  ------------------
  731|  6.22k|        invalid = true;
  732|  6.22k|    }
  733|       |
  734|  6.52k|    if (invalid) {
  ------------------
  |  Branch (734:9): [True: 6.22k, False: 301]
  ------------------
  735|  6.22k|        warn(damagedPDF("xref table", "accepting invalid xref table entry"));
  736|  6.22k|    }
  737|       |
  738|  6.52k|    f1 = QUtil::string_to_ll(f1_str.c_str());
  739|  6.52k|    f2 = QUtil::string_to_int(f2_str.c_str());
  740|       |
  741|  6.52k|    return true;
  742|  6.74k|}
_ZN4QPDF3Doc7Objects14read_xrefEntryERxRiRc:
  748|  17.6k|{
  749|  17.6k|    std::array<char, 21> line;
  750|  17.6k|    if (m->file->read(line.data(), 20) != 20) {
  ------------------
  |  Branch (750:9): [True: 220, False: 17.4k]
  ------------------
  751|       |        // C++20: [[unlikely]]
  752|    220|        return false;
  753|    220|    }
  754|  17.4k|    line[20] = '\0';
  755|  17.4k|    char const* p = line.data();
  756|       |
  757|  17.4k|    int f1_len = 0;
  758|  17.4k|    int f2_len = 0;
  759|       |
  760|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  761|       |    // buffer.
  762|       |
  763|       |    // Gather f1 digits. NB No risk of overflow as 9'999'999'999 < max long long.
  764|  84.9k|    while (*p == '0') {
  ------------------
  |  Branch (764:12): [True: 67.4k, False: 17.4k]
  ------------------
  765|  67.4k|        ++f1_len;
  766|  67.4k|        ++p;
  767|  67.4k|    }
  768|  72.5k|    while (util::is_digit(*p) && f1_len++ < 10) {
  ------------------
  |  Branch (768:12): [True: 55.0k, False: 17.4k]
  |  Branch (768:34): [True: 55.0k, False: 4]
  ------------------
  769|  55.0k|        f1 *= 10;
  770|  55.0k|        f1 += *p++ - '0';
  771|  55.0k|    }
  772|       |    // Require space
  773|  17.4k|    if (!util::is_space(*p++)) {
  ------------------
  |  Branch (773:9): [True: 97, False: 17.3k]
  ------------------
  774|       |        // Entry doesn't start with space or digit.
  775|       |        // C++20: [[unlikely]]
  776|     97|        return false;
  777|     97|    }
  778|       |    // Gather digits. NB No risk of overflow as 99'999 < max int.
  779|  75.1k|    while (*p == '0') {
  ------------------
  |  Branch (779:12): [True: 57.7k, False: 17.3k]
  ------------------
  780|  57.7k|        ++f2_len;
  781|  57.7k|        ++p;
  782|  57.7k|    }
  783|  31.1k|    while (util::is_digit(*p) && f2_len++ < 5) {
  ------------------
  |  Branch (783:12): [True: 14.6k, False: 16.4k]
  |  Branch (783:34): [True: 13.7k, False: 893]
  ------------------
  784|  13.7k|        f2 *= 10;
  785|  13.7k|        f2 += static_cast<int>(*p++ - '0');
  786|  13.7k|    }
  787|  17.3k|    if (util::is_space(*p++) && (*p == 'f' || *p == 'n')) {
  ------------------
  |  Branch (787:9): [True: 16.2k, False: 1.13k]
  |  Branch (787:34): [True: 2.27k, False: 13.9k]
  |  Branch (787:47): [True: 11.7k, False: 2.24k]
  ------------------
  788|       |        // C++20: [[likely]]
  789|  13.9k|        type = *p;
  790|       |        // No test for valid line[19].
  791|  13.9k|        if (*(++p) && *(++p) && (*p == '\n' || *p == '\r') && f1_len == 10 && f2_len == 5) {
  ------------------
  |  Branch (791:13): [True: 13.5k, False: 474]
  |  Branch (791:23): [True: 12.6k, False: 856]
  |  Branch (791:34): [True: 11.1k, False: 1.50k]
  |  Branch (791:48): [True: 167, False: 1.33k]
  |  Branch (791:63): [True: 10.6k, False: 707]
  |  Branch (791:79): [True: 10.4k, False: 169]
  ------------------
  792|       |            // C++20: [[likely]]
  793|  10.4k|            return true;
  794|  10.4k|        }
  795|  13.9k|    }
  796|  6.92k|    return read_bad_xrefEntry(f1, f2, type);
  797|  17.3k|}
_ZN4QPDF3Doc7Objects14read_xrefTableEx:
  802|  2.17k|{
  803|  2.17k|    m->file->seek(xref_offset, SEEK_SET);
  804|  2.17k|    std::string line;
  805|  7.20k|    while (true) {
  ------------------
  |  Branch (805:12): [True: 7.16k, Folded]
  ------------------
  806|  7.16k|        line.assign(50, '\0');
  807|  7.16k|        m->file->read(line.data(), line.size());
  808|  7.16k|        int obj = 0;
  809|  7.16k|        int num = 0;
  810|  7.16k|        int bytes = 0;
  811|  7.16k|        if (!parse_xrefFirst(line, obj, num, bytes)) {
  ------------------
  |  Branch (811:13): [True: 395, False: 6.77k]
  ------------------
  812|    395|            throw damagedPDF("xref table", "xref syntax invalid");
  813|    395|        }
  814|  6.77k|        m->file->seek(m->file->getLastOffset() + bytes, SEEK_SET);
  815|  23.7k|        for (qpdf_offset_t i = obj; i - num < obj; ++i) {
  ------------------
  |  Branch (815:37): [True: 17.6k, False: 6.06k]
  ------------------
  816|  17.6k|            if (i == 0) {
  ------------------
  |  Branch (816:17): [True: 459, False: 17.2k]
  ------------------
  817|       |                // This is needed by checkLinearization()
  818|    459|                first_xref_item_offset_ = m->file->tell();
  819|    459|            }
  820|       |            // For xref_table, these will always be small enough to be ints
  821|  17.6k|            qpdf_offset_t f1 = 0;
  822|  17.6k|            int f2 = 0;
  823|  17.6k|            char type = '\0';
  824|  17.6k|            if (!read_xrefEntry(f1, f2, type)) {
  ------------------
  |  Branch (824:17): [True: 708, False: 16.9k]
  ------------------
  825|    708|                throw damagedPDF(
  826|    708|                    "xref table", "invalid xref entry (obj=" + std::to_string(i) + ")");
  827|    708|            }
  828|  16.9k|            if (type == 'f') {
  ------------------
  |  Branch (828:17): [True: 3.44k, False: 13.5k]
  ------------------
  829|  3.44k|                insertFreeXrefEntry(QPDFObjGen(toI(i), f2));
  830|  13.5k|            } else {
  831|  13.5k|                insertXrefEntry(toI(i), 1, f1, f2);
  832|  13.5k|            }
  833|  16.9k|        }
  834|  6.06k|        qpdf_offset_t pos = m->file->tell();
  835|  6.06k|        if (readToken(*m->file).isWord("trailer")) {
  ------------------
  |  Branch (835:13): [True: 1.03k, False: 5.03k]
  ------------------
  836|  1.03k|            break;
  837|  5.03k|        } else {
  838|  5.03k|            m->file->seek(pos, SEEK_SET);
  839|  5.03k|        }
  840|  6.06k|    }
  841|       |
  842|       |    // Set offset to previous xref table if any
  843|  1.06k|    QPDFObjectHandle cur_trailer = m->objects.readTrailer();
  844|  1.06k|    if (!cur_trailer.isDictionary()) {
  ------------------
  |  Branch (844:9): [True: 73, False: 996]
  ------------------
  845|     73|        throw damagedPDF("", "expected trailer dictionary");
  846|     73|    }
  847|       |
  848|    996|    if (!m->trailer) {
  ------------------
  |  Branch (848:9): [True: 912, False: 84]
  ------------------
  849|    912|        setTrailer(cur_trailer);
  850|       |
  851|    912|        if (!m->trailer.hasKey("/Size")) {
  ------------------
  |  Branch (851:13): [True: 161, False: 751]
  ------------------
  852|    161|            throw damagedPDF("trailer", "trailer dictionary lacks /Size key");
  853|    161|        }
  854|    751|        if (!m->trailer.getKey("/Size").isInteger()) {
  ------------------
  |  Branch (854:13): [True: 1, False: 750]
  ------------------
  855|      1|            throw damagedPDF("trailer", "/Size key in trailer dictionary is not an integer");
  856|      1|        }
  857|    751|    }
  858|       |
  859|    834|    if (cur_trailer.hasKey("/XRefStm")) {
  ------------------
  |  Branch (859:9): [True: 23, False: 811]
  ------------------
  860|     23|        if (cf.ignore_xref_streams()) {
  ------------------
  |  Branch (860:13): [True: 0, False: 23]
  ------------------
  861|      0|            QTC::TC("qpdf", "QPDF ignoring XRefStm in trailer");
  862|     23|        } else {
  863|     23|            if (cur_trailer.getKey("/XRefStm").isInteger()) {
  ------------------
  |  Branch (863:17): [True: 22, False: 1]
  ------------------
  864|       |                // Read the xref stream but disregard any return value -- we'll use our trailer's
  865|       |                // /Prev key instead of the xref stream's.
  866|     22|                (void)read_xrefStream(cur_trailer.getKey("/XRefStm").getIntValue());
  867|     22|            } else {
  868|      1|                throw damagedPDF("xref stream", xref_offset, "invalid /XRefStm");
  869|      1|            }
  870|     23|        }
  871|     23|    }
  872|       |
  873|    833|    if (cur_trailer.hasKey("/Prev")) {
  ------------------
  |  Branch (873:9): [True: 202, False: 631]
  ------------------
  874|    202|        if (!cur_trailer.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (874:13): [True: 1, False: 201]
  ------------------
  875|      1|            throw damagedPDF("trailer", "/Prev key in trailer dictionary is not an integer");
  876|      1|        }
  877|    201|        return cur_trailer.getKey("/Prev").getIntValue();
  878|    202|    }
  879|       |
  880|    631|    return 0;
  881|    833|}
_ZN4QPDF3Doc7Objects15read_xrefStreamExb:
  886|  10.6k|{
  887|  10.6k|    if (!cf.ignore_xref_streams()) {
  ------------------
  |  Branch (887:9): [True: 10.6k, False: 0]
  ------------------
  888|  10.6k|        QPDFObjectHandle xref_obj;
  889|  10.6k|        try {
  890|  10.6k|            m->in_read_xref_stream = true;
  891|  10.6k|            xref_obj = readObjectAtOffset(xref_offset, "xref stream", true);
  892|  10.6k|        } catch (QPDFExc&) {
  893|       |            // ignore -- report error below
  894|  1.02k|        }
  895|  10.6k|        m->in_read_xref_stream = false;
  896|  10.5k|        if (xref_obj.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (896:13): [True: 8.73k, False: 1.82k]
  ------------------
  897|  8.73k|            return processXRefStream(xref_offset, xref_obj, in_stream_recovery);
  898|  8.73k|        }
  899|  10.5k|    }
  900|       |
  901|  1.82k|    throw damagedPDF("", xref_offset, "xref not found");
  902|      0|    return 0; // unreachable
  903|  10.6k|}
_ZN4QPDF3Doc7Objects12processXRefWER16QPDFObjectHandleNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  908|  8.73k|{
  909|  8.73k|    auto W_obj = dict.getKey("/W");
  910|  8.73k|    if (!(W_obj.size() >= 3 && W_obj.getArrayItem(0).isInteger() &&
  ------------------
  |  Branch (910:9): [True: 312, False: 8.41k]
  |  Branch (910:11): [True: 8.46k, False: 263]
  |  Branch (910:32): [True: 8.45k, False: 15]
  ------------------
  911|  8.45k|          W_obj.getArrayItem(1).isInteger() && W_obj.getArrayItem(2).isInteger())) {
  ------------------
  |  Branch (911:11): [True: 8.43k, False: 14]
  |  Branch (911:48): [True: 8.41k, False: 20]
  ------------------
  912|    312|        throw damaged("Cross-reference stream does not have a proper /W key");
  913|    312|    }
  914|       |
  915|  8.41k|    std::array<int, 3> W;
  916|  8.41k|    int entry_size = 0;
  917|  8.41k|    auto w_vector = W_obj.getArrayAsVector();
  918|  8.41k|    int max_bytes = sizeof(qpdf_offset_t);
  919|  33.4k|    for (size_t i = 0; i < 3; ++i) {
  ------------------
  |  Branch (919:24): [True: 25.1k, False: 8.34k]
  ------------------
  920|  25.1k|        W[i] = w_vector[i].getIntValueAsInt();
  921|  25.1k|        if (W[i] > max_bytes) {
  ------------------
  |  Branch (921:13): [True: 21, False: 25.1k]
  ------------------
  922|     21|            throw damaged("Cross-reference stream's /W contains impossibly large values");
  923|     21|        }
  924|  25.1k|        if (W[i] < 0) {
  ------------------
  |  Branch (924:13): [True: 53, False: 25.0k]
  ------------------
  925|     53|            throw damaged("Cross-reference stream's /W contains negative values");
  926|     53|        }
  927|  25.0k|        entry_size += W[i];
  928|  25.0k|    }
  929|  8.34k|    if (entry_size == 0) {
  ------------------
  |  Branch (929:9): [True: 3, False: 8.34k]
  ------------------
  930|      3|        throw damaged("Cross-reference stream's /W indicates entry size of 0");
  931|      3|    }
  932|  8.34k|    return {entry_size, W};
  933|  8.34k|}
_ZN4QPDF3Doc7Objects15processXRefSizeER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  939|  8.34k|{
  940|       |    // Number of entries is limited by the highest possible object id and stream size.
  941|  8.34k|    auto max_num_entries = std::numeric_limits<int>::max();
  942|  8.34k|    if (max_num_entries > (std::numeric_limits<qpdf_offset_t>::max() / entry_size)) {
  ------------------
  |  Branch (942:9): [True: 0, False: 8.34k]
  ------------------
  943|      0|        max_num_entries = toI(std::numeric_limits<qpdf_offset_t>::max() / entry_size);
  944|      0|    }
  945|       |
  946|  8.34k|    auto Size_obj = dict.getKey("/Size");
  947|  8.34k|    long long size;
  948|  8.34k|    if (!dict.getKey("/Size").getValueAsInt(size)) {
  ------------------
  |  Branch (948:9): [True: 83, False: 8.25k]
  ------------------
  949|     83|        throw damaged("Cross-reference stream does not have a proper /Size key");
  950|  8.25k|    } else if (size < 0) {
  ------------------
  |  Branch (950:16): [True: 65, False: 8.19k]
  ------------------
  951|     65|        throw damaged("Cross-reference stream has a negative /Size key");
  952|  8.19k|    } else if (size >= max_num_entries) {
  ------------------
  |  Branch (952:16): [True: 76, False: 8.11k]
  ------------------
  953|     76|        throw damaged("Cross-reference stream has an impossibly large /Size key");
  954|     76|    }
  955|       |    // We are not validating that Size <= (Size key of parent xref / trailer).
  956|  8.11k|    return max_num_entries;
  957|  8.34k|}
_ZN4QPDF3Doc7Objects16processXRefIndexER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  963|  8.11k|{
  964|  8.11k|    auto size = dict.getKey("/Size").getIntValueAsInt();
  965|  8.11k|    auto Index_obj = dict.getKey("/Index");
  966|       |
  967|  8.11k|    if (Index_obj.isArray()) {
  ------------------
  |  Branch (967:9): [True: 1.03k, False: 7.08k]
  ------------------
  968|  1.03k|        std::vector<std::pair<int, int>> indx;
  969|  1.03k|        int num_entries = 0;
  970|  1.03k|        auto index_vec = Index_obj.getArrayAsVector();
  971|  1.03k|        if ((index_vec.size() % 2) || index_vec.size() < 2) {
  ------------------
  |  Branch (971:13): [True: 6, False: 1.02k]
  |  Branch (971:39): [True: 5, False: 1.01k]
  ------------------
  972|     11|            throw damaged("Cross-reference stream's /Index has an invalid number of values");
  973|     11|        }
  974|       |
  975|  1.01k|        int i = 0;
  976|  1.01k|        long long first = 0;
  977|  16.0k|        for (auto& val: index_vec) {
  ------------------
  |  Branch (977:23): [True: 16.0k, False: 695]
  ------------------
  978|  16.0k|            if (val.isInteger()) {
  ------------------
  |  Branch (978:17): [True: 16.0k, False: 23]
  ------------------
  979|  16.0k|                if (i % 2) {
  ------------------
  |  Branch (979:21): [True: 7.94k, False: 8.07k]
  ------------------
  980|  7.94k|                    auto count = val.getIntValue();
  981|  7.94k|                    if (count <= 0) {
  ------------------
  |  Branch (981:25): [True: 78, False: 7.87k]
  ------------------
  982|     78|                        throw damaged(
  983|     78|                            "Cross-reference stream section claims to contain " +
  984|     78|                            std::to_string(count) + " entries");
  985|     78|                    }
  986|       |                    // We are guarding against the possibility of num_entries * entry_size
  987|       |                    // overflowing. We are not checking that entries are in ascending order as
  988|       |                    // required by the spec, which probably should generate a warning. We are also
  989|       |                    // not checking that for each subsection first object number + number of entries
  990|       |                    // <= /Size. The spec requires us to ignore object number > /Size.
  991|  7.87k|                    if (first > (max_num_entries - count) ||
  ------------------
  |  Branch (991:25): [True: 77, False: 7.79k]
  ------------------
  992|  7.79k|                        count > (max_num_entries - num_entries)) {
  ------------------
  |  Branch (992:25): [True: 31, False: 7.76k]
  ------------------
  993|    108|                        throw damaged(
  994|    108|                            "Cross-reference stream claims to contain too many entries: " +
  995|    108|                            std::to_string(first) + " " + std::to_string(max_num_entries) + " " +
  996|    108|                            std::to_string(num_entries));
  997|    108|                    }
  998|  7.76k|                    indx.emplace_back(static_cast<int>(first), static_cast<int>(count));
  999|  7.76k|                    num_entries += static_cast<int>(count);
 1000|  8.07k|                } else {
 1001|  8.07k|                    first = val.getIntValue();
 1002|  8.07k|                    if (first < 0) {
  ------------------
  |  Branch (1002:25): [True: 34, False: 8.04k]
  ------------------
 1003|     34|                        throw damaged(
 1004|     34|                            "Cross-reference stream's /Index contains a negative object id");
 1005|  8.04k|                    } else if (first > max_num_entries) {
  ------------------
  |  Branch (1005:32): [True: 81, False: 7.96k]
  ------------------
 1006|     81|                        throw damaged(
 1007|     81|                            "Cross-reference stream's /Index contains an impossibly "
 1008|     81|                            "large object id");
 1009|     81|                    }
 1010|  8.07k|                }
 1011|  16.0k|            } else {
 1012|     23|                throw damaged(
 1013|     23|                    "Cross-reference stream's /Index's item " + std::to_string(i) +
 1014|     23|                    " is not an integer");
 1015|     23|            }
 1016|  15.7k|            i++;
 1017|  15.7k|        }
 1018|    695|        QTC::TC("qpdf", "QPDF xref /Index is array", index_vec.size() == 2 ? 0 : 1);
  ------------------
  |  Branch (1018:54): [True: 616, False: 79]
  ------------------
 1019|    695|        return {num_entries, indx};
 1020|  7.08k|    } else if (Index_obj.null()) {
  ------------------
  |  Branch (1020:16): [True: 7.08k, False: 4]
  ------------------
 1021|  7.08k|        return {size, {{0, size}}};
 1022|  7.08k|    } else {
 1023|      4|        throw damaged("Cross-reference stream does not have a proper /Index key");
 1024|      4|    }
 1025|  8.11k|}
_ZN4QPDF3Doc7Objects17processXRefStreamExR16QPDFObjectHandleb:
 1030|  8.73k|{
 1031|  8.73k|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1032|  8.73k|        return damagedPDF("xref stream", xref_offset, msg.data());
 1033|  8.73k|    };
 1034|       |
 1035|  8.73k|    auto dict = xref_obj.getDict();
 1036|       |
 1037|  8.73k|    auto [entry_size, W] = processXRefW(dict, damaged);
 1038|  8.73k|    int max_num_entries = processXRefSize(dict, entry_size, damaged);
 1039|  8.73k|    auto [num_entries, indx] = processXRefIndex(dict, max_num_entries, damaged);
 1040|       |
 1041|  8.73k|    std::shared_ptr<Buffer> bp = xref_obj.getStreamData(qpdf_dl_specialized);
 1042|  8.73k|    size_t actual_size = bp->getSize();
 1043|  8.73k|    auto expected_size = toS(entry_size) * toS(num_entries);
 1044|       |
 1045|  8.73k|    if (expected_size != actual_size) {
  ------------------
  |  Branch (1045:9): [True: 4.56k, False: 4.16k]
  ------------------
 1046|  4.56k|        QPDFExc x = damaged(
 1047|  4.56k|            "Cross-reference stream data has the wrong size; expected = " +
 1048|  4.56k|            std::to_string(expected_size) + "; actual = " + std::to_string(actual_size));
 1049|  4.56k|        if (expected_size > actual_size) {
  ------------------
  |  Branch (1049:13): [True: 902, False: 3.66k]
  ------------------
 1050|    902|            throw x;
 1051|  3.66k|        } else {
 1052|  3.66k|            warn(x);
 1053|  3.66k|        }
 1054|  4.56k|    }
 1055|       |
 1056|  7.82k|    bool saw_first_compressed_object = false;
 1057|       |
 1058|       |    // Actual size vs. expected size check above ensures that we will not overflow any buffers here.
 1059|       |    // We know that entry_size * num_entries is less or equal to the size of the buffer.
 1060|  7.82k|    auto p = bp->getBuffer();
 1061|  7.82k|    for (auto [obj, sec_entries]: indx) {
  ------------------
  |  Branch (1061:33): [True: 5.63k, False: 7.82k]
  ------------------
 1062|       |        // Process a subsection.
 1063|  2.84M|        for (int i = 0; i < sec_entries; ++i) {
  ------------------
  |  Branch (1063:25): [True: 2.84M, False: 5.63k]
  ------------------
 1064|       |            // Read this entry
 1065|  2.84M|            std::array<qpdf_offset_t, 3> fields{};
 1066|  2.84M|            if (W[0] == 0) {
  ------------------
  |  Branch (1066:17): [True: 801k, False: 2.04M]
  ------------------
 1067|   801k|                fields[0] = 1;
 1068|   801k|            }
 1069|  11.3M|            for (size_t j = 0; j < 3; ++j) {
  ------------------
  |  Branch (1069:32): [True: 8.52M, False: 2.84M]
  ------------------
 1070|  18.1M|                for (int k = 0; k < W[j]; ++k) {
  ------------------
  |  Branch (1070:33): [True: 9.67M, False: 8.52M]
  ------------------
 1071|  9.67M|                    fields[j] <<= 8;
 1072|  9.67M|                    fields[j] |= *p++;
 1073|  9.67M|                }
 1074|  8.52M|            }
 1075|       |
 1076|       |            // Get the generation number.  The generation number is 0 unless this is an uncompressed
 1077|       |            // object record, in which case the generation number appears as the third field.
 1078|  2.84M|            if (saw_first_compressed_object) {
  ------------------
  |  Branch (1078:17): [True: 1.99M, False: 844k]
  ------------------
 1079|  1.99M|                if (fields[0] != 2) {
  ------------------
  |  Branch (1079:21): [True: 1.38M, False: 615k]
  ------------------
 1080|  1.38M|                    uncompressed_after_compressed_ = true;
 1081|  1.38M|                }
 1082|  1.99M|            } else if (fields[0] == 2) {
  ------------------
  |  Branch (1082:24): [True: 2.62k, False: 841k]
  ------------------
 1083|  2.62k|                saw_first_compressed_object = true;
 1084|  2.62k|            }
 1085|  2.84M|            if (obj == 0) {
  ------------------
  |  Branch (1085:17): [True: 3.83k, False: 2.83M]
  ------------------
 1086|       |                // This is needed by checkLinearization()
 1087|  3.83k|                first_xref_item_offset_ = xref_offset;
 1088|  2.83M|            } else if (fields[0] == 0) {
  ------------------
  |  Branch (1088:24): [True: 427k, False: 2.40M]
  ------------------
 1089|       |                // Ignore fields[2], which we don't care about in this case. This works around the
 1090|       |                // issue of some PDF files that put invalid values, like -1, here for deleted
 1091|       |                // objects.
 1092|   427k|                insertFreeXrefEntry(QPDFObjGen(obj, 0));
 1093|  2.40M|            } else {
 1094|  2.40M|                auto typ = toI(fields[0]);
 1095|  2.40M|                if (!in_stream_recovery || typ == 2) {
  ------------------
  |  Branch (1095:21): [True: 736k, False: 1.67M]
  |  Branch (1095:44): [True: 586k, False: 1.08M]
  ------------------
 1096|       |                    // If we are in xref stream recovery all actual uncompressed objects have
 1097|       |                    // already been inserted into the xref table. Avoid adding junk data into the
 1098|       |                    // xref table.
 1099|  1.32M|                    insertXrefEntry(obj, toI(fields[0]), fields[1], toI(fields[2]));
 1100|  1.32M|                }
 1101|  2.40M|            }
 1102|  2.84M|            ++obj;
 1103|  2.84M|        }
 1104|  5.63k|    }
 1105|       |
 1106|  7.82k|    if (!m->trailer) {
  ------------------
  |  Branch (1106:9): [True: 939, False: 6.88k]
  ------------------
 1107|    939|        setTrailer(dict);
 1108|    939|    }
 1109|       |
 1110|  7.82k|    if (dict.hasKey("/Prev")) {
  ------------------
  |  Branch (1110:9): [True: 1.35k, False: 6.47k]
  ------------------
 1111|  1.35k|        if (!dict.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (1111:13): [True: 81, False: 1.27k]
  ------------------
 1112|     81|            throw damagedPDF(
 1113|     81|                "xref stream", "/Prev key in xref stream dictionary is not an integer");
 1114|     81|        }
 1115|  1.27k|        return dict.getKey("/Prev").getIntValue();
 1116|  6.47k|    } else {
 1117|  6.47k|        return 0;
 1118|  6.47k|    }
 1119|  7.82k|}
_ZN4QPDF3Doc7Objects15insertXrefEntryEiixi:
 1123|  1.43M|{
 1124|       |    // Populate the xref table in such a way that the first reference to an object that we see,
 1125|       |    // which is the one in the latest xref table in which it appears, is the one that gets stored.
 1126|       |    // This works because we are reading more recent appends before older ones.
 1127|       |
 1128|       |    // If there is already an entry for this object and generation in the table, it means that a
 1129|       |    // later xref table has registered this object.  Disregard this one.
 1130|  1.43M|    int new_gen = f0 == 2 ? 0 : f2;
  ------------------
  |  Branch (1130:19): [True: 617k, False: 820k]
  ------------------
 1131|       |
 1132|  1.43M|    if (!(f0 == 1 || f0 == 2)) {
  ------------------
  |  Branch (1132:11): [True: 742k, False: 695k]
  |  Branch (1132:22): [True: 617k, False: 78.2k]
  ------------------
 1133|  78.2k|        return;
 1134|  78.2k|    }
 1135|       |
 1136|  1.35M|    if (!(obj > 0 && obj <= m->xref_table_max_id && 0 <= f2 && new_gen < 65535)) {
  ------------------
  |  Branch (1136:11): [True: 1.35M, False: 770]
  |  Branch (1136:22): [True: 868k, False: 490k]
  |  Branch (1136:53): [True: 867k, False: 452]
  |  Branch (1136:64): [True: 866k, False: 956]
  ------------------
 1137|       |        // We are ignoring invalid objgens. Most will arrive here from xref reconstruction. There
 1138|       |        // is probably no point having another warning but we could count invalid items in order to
 1139|       |        // decide when to give up.
 1140|       |        // ignore impossibly large object ids or object ids > Size.
 1141|   492k|        return;
 1142|   492k|    }
 1143|       |
 1144|   866k|    if (m->deleted_objects.contains(obj)) {
  ------------------
  |  Branch (1144:9): [True: 1.31k, False: 865k]
  ------------------
 1145|  1.31k|        return;
 1146|  1.31k|    }
 1147|       |
 1148|   865k|    if (f0 == 2) {
  ------------------
  |  Branch (1148:9): [True: 428k, False: 437k]
  ------------------
 1149|   428k|        if (f1 == obj) {
  ------------------
  |  Branch (1149:13): [True: 633, False: 427k]
  ------------------
 1150|    633|            warn(
 1151|    633|                damagedPDF("xref stream", "self-referential object stream " + std::to_string(obj)));
 1152|    633|            return;
 1153|    633|        }
 1154|   427k|        if (f1 > m->xref_table_max_id) {
  ------------------
  |  Branch (1154:13): [True: 5.18k, False: 422k]
  ------------------
 1155|       |            // ignore impossibly large object stream ids
 1156|  5.18k|            warn(damagedPDF(
 1157|  5.18k|                "xref stream",
 1158|  5.18k|                "object stream id " + std::to_string(f1) + " for object " + std::to_string(obj) +
 1159|  5.18k|                    " is impossibly large"));
 1160|  5.18k|            return;
 1161|  5.18k|        }
 1162|   427k|    }
 1163|       |
 1164|   859k|    auto [iter, created] = m->xref_table.try_emplace(QPDFObjGen(obj, (f0 == 2 ? 0 : f2)));
  ------------------
  |  Branch (1164:71): [True: 422k, False: 437k]
  ------------------
 1165|   859k|    if (!created) {
  ------------------
  |  Branch (1165:9): [True: 63.3k, False: 796k]
  ------------------
 1166|  63.3k|        return;
 1167|  63.3k|    }
 1168|       |
 1169|   796k|    switch (f0) {
 1170|   379k|    case 1:
  ------------------
  |  Branch (1170:5): [True: 379k, False: 417k]
  ------------------
 1171|       |        // f2 is generation
 1172|   379k|        QTC::TC("qpdf", "QPDF xref gen > 0", ((f2 > 0) ? 1 : 0));
  ------------------
  |  Branch (1172:47): [True: 111k, False: 267k]
  ------------------
 1173|   379k|        iter->second = QPDFXRefEntry(f1);
 1174|   379k|        break;
 1175|       |
 1176|   417k|    case 2:
  ------------------
  |  Branch (1176:5): [True: 417k, False: 379k]
  ------------------
 1177|   417k|        iter->second = QPDFXRefEntry(toI(f1), f2);
 1178|   417k|        break;
 1179|       |
 1180|      0|    default:
  ------------------
  |  Branch (1180:5): [True: 0, False: 796k]
  ------------------
 1181|      0|        throw damagedPDF("xref stream", "unknown xref stream entry type " + std::to_string(f0));
 1182|      0|        break;
 1183|   796k|    }
 1184|   796k|}
_ZN4QPDF3Doc7Objects19insertFreeXrefEntryE10QPDFObjGen:
 1188|   431k|{
 1189|   431k|    if (!m->xref_table.contains(og) && og.getObj() <= m->xref_table_max_id) {
  ------------------
  |  Branch (1189:9): [True: 429k, False: 1.83k]
  |  Branch (1189:40): [True: 168k, False: 260k]
  ------------------
 1190|   168k|        m->deleted_objects.insert(og.getObj());
 1191|   168k|    }
 1192|   431k|}
_ZN4QPDF3Doc7Objects16resolveXRefTableEv:
 1224|  1.43k|{
 1225|  1.43k|    bool may_change = !m->reconstructed_xref;
 1226|   148k|    for (auto& iter: m->xref_table) {
  ------------------
  |  Branch (1226:20): [True: 148k, False: 1.39k]
  ------------------
 1227|   148k|        if (isUnresolved(iter.first)) {
  ------------------
  |  Branch (1227:13): [True: 135k, False: 12.8k]
  ------------------
 1228|   135k|            resolve(iter.first);
 1229|   135k|            if (may_change && m->reconstructed_xref) {
  ------------------
  |  Branch (1229:17): [True: 2.77k, False: 132k]
  |  Branch (1229:31): [True: 32, False: 2.74k]
  ------------------
 1230|     32|                return false;
 1231|     32|            }
 1232|   135k|        }
 1233|   148k|    }
 1234|  1.39k|    return true;
 1235|  1.43k|}
_ZN4QPDF21fixDanglingReferencesEb:
 1241|  4.96k|{
 1242|  4.96k|    if (m->fixed_dangling_refs) {
  ------------------
  |  Branch (1242:9): [True: 3.56k, False: 1.39k]
  ------------------
 1243|  3.56k|        return;
 1244|  3.56k|    }
 1245|  1.39k|    if (!m->objects.resolveXRefTable()) {
  ------------------
  |  Branch (1245:9): [True: 32, False: 1.36k]
  ------------------
 1246|     32|        m->objects.resolveXRefTable();
 1247|     32|    }
 1248|  1.39k|    m->fixed_dangling_refs = true;
 1249|  1.39k|}
_ZN4QPDF14getObjectCountEv:
 1253|  4.96k|{
 1254|       |    // This method returns the next available indirect object number. makeIndirectObject uses it for
 1255|       |    // this purpose. After fixDanglingReferences is called, all objects in the xref table will also
 1256|       |    // be in obj_cache.
 1257|  4.96k|    fixDanglingReferences();
 1258|  4.96k|    QPDFObjGen og;
 1259|  4.96k|    if (!m->obj_cache.empty()) {
  ------------------
  |  Branch (1259:9): [True: 4.93k, False: 21]
  ------------------
 1260|  4.93k|        og = (*(m->obj_cache.rbegin())).first;
 1261|  4.93k|    }
 1262|  4.96k|    return QIntC::to_size(og.getObj());
 1263|  4.96k|}
_ZN4QPDF3Doc7Objects24setLastObjectDescriptionERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1279|   155k|{
 1280|   155k|    m->last_object_description.clear();
 1281|   155k|    if (!description.empty()) {
  ------------------
  |  Branch (1281:9): [True: 9.70k, False: 146k]
  ------------------
 1282|  9.70k|        m->last_object_description += description;
 1283|  9.70k|        if (og.isIndirect()) {
  ------------------
  |  Branch (1283:13): [True: 9.70k, False: 0]
  ------------------
 1284|  9.70k|            m->last_object_description += ": ";
 1285|  9.70k|        }
 1286|  9.70k|    }
 1287|   155k|    if (og.isIndirect()) {
  ------------------
  |  Branch (1287:9): [True: 155k, False: 0]
  ------------------
 1288|   155k|        m->last_object_description += "object " + og.unparse(' ');
 1289|   155k|    }
 1290|   155k|}
_ZN4QPDF3Doc7Objects11readTrailerEv:
 1294|  22.2k|{
 1295|  22.2k|    qpdf_offset_t offset = m->file->tell();
 1296|  22.2k|    auto object =
 1297|  22.2k|        Parser::parse(*m->file, "trailer", m->tokenizer, nullptr, qpdf, m->reconstructed_xref);
 1298|  22.2k|    if (object.isDictionary() && m->objects.readToken(*m->file).isWord("stream")) {
  ------------------
  |  Branch (1298:9): [True: 3.52k, False: 18.6k]
  |  Branch (1298:9): [True: 138, False: 22.0k]
  |  Branch (1298:34): [True: 138, False: 3.38k]
  ------------------
 1299|    138|        warn(damagedPDF("trailer", m->file->tell(), "stream keyword found in trailer"));
 1300|    138|    }
 1301|       |    // Override last_offset so that it points to the beginning of the object we just read
 1302|  22.2k|    m->file->setLastOffset(offset);
 1303|  22.2k|    return object;
 1304|  22.2k|}
_ZN4QPDF3Doc7Objects10readObjectERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1308|  81.8k|{
 1309|  81.8k|    setLastObjectDescription(description, og);
 1310|  81.8k|    qpdf_offset_t offset = m->file->tell();
 1311|       |
 1312|  81.8k|    StringDecrypter decrypter{&qpdf, og};
 1313|  81.8k|    StringDecrypter* decrypter_ptr = m->encp->encrypted ? &decrypter : nullptr;
  ------------------
  |  Branch (1313:38): [True: 5.62k, False: 76.2k]
  ------------------
 1314|  81.8k|    auto object = Parser::parse(
 1315|  81.8k|        *m->file,
 1316|  81.8k|        m->last_object_description,
 1317|  81.8k|        m->tokenizer,
 1318|  81.8k|        decrypter_ptr,
 1319|  81.8k|        qpdf,
 1320|  81.8k|        m->reconstructed_xref || m->in_read_xref_stream);
  ------------------
  |  Branch (1320:9): [True: 74.1k, False: 7.68k]
  |  Branch (1320:34): [True: 2.87k, False: 4.80k]
  ------------------
 1321|  81.8k|    if (!object) {
  ------------------
  |  Branch (1321:9): [True: 6.76k, False: 75.0k]
  ------------------
 1322|  6.76k|        return {};
 1323|  6.76k|    }
 1324|  75.0k|    auto token = readToken(*m->file);
 1325|  75.0k|    if (object.isDictionary() && token.isWord("stream")) {
  ------------------
  |  Branch (1325:9): [True: 62.4k, False: 12.5k]
  |  Branch (1325:9): [True: 32.9k, False: 42.1k]
  |  Branch (1325:34): [True: 32.9k, False: 29.5k]
  ------------------
 1326|  32.9k|        readStream(object, og, offset);
 1327|  32.9k|        token = readToken(*m->file);
 1328|  32.9k|    }
 1329|  75.0k|    if (!token.isWord("endobj")) {
  ------------------
  |  Branch (1329:9): [True: 24.5k, False: 50.5k]
  ------------------
 1330|  24.5k|        warn(damagedPDF("expected endobj"));
 1331|  24.5k|    }
 1332|  75.0k|    return object;
 1333|  81.8k|}
_ZN4QPDF3Doc7Objects10readStreamER16QPDFObjectHandle10QPDFObjGenx:
 1338|  32.9k|{
 1339|  32.9k|    validateStreamLineEnd(object, og, offset);
 1340|       |
 1341|       |    // Must get offset before accessing any additional objects since resolving a previously
 1342|       |    // unresolved indirect object will change file position.
 1343|  32.9k|    qpdf_offset_t stream_offset = m->file->tell();
 1344|  32.9k|    size_t length = 0;
 1345|       |
 1346|  32.9k|    try {
 1347|  32.9k|        auto length_obj = object.getKey("/Length");
 1348|       |
 1349|  32.9k|        if (!length_obj.isInteger()) {
  ------------------
  |  Branch (1349:13): [True: 17.0k, False: 15.9k]
  ------------------
 1350|  17.0k|            if (length_obj.null()) {
  ------------------
  |  Branch (1350:17): [True: 16.8k, False: 145]
  ------------------
 1351|  16.8k|                throw damagedPDF(offset, "stream dictionary lacks /Length key");
 1352|  16.8k|            }
 1353|    145|            throw damagedPDF(offset, "/Length key in stream dictionary is not an integer");
 1354|  17.0k|        }
 1355|       |
 1356|  15.9k|        length = toS(length_obj.getUIntValue());
 1357|       |        // Seek in two steps to avoid potential integer overflow
 1358|  15.9k|        m->file->seek(stream_offset, SEEK_SET);
 1359|  15.9k|        m->file->seek(toO(length), SEEK_CUR);
 1360|  15.9k|        if (!readToken(*m->file).isWord("endstream")) {
  ------------------
  |  Branch (1360:13): [True: 2.87k, False: 13.0k]
  ------------------
 1361|  2.87k|            throw damagedPDF("expected endstream");
 1362|  2.87k|        }
 1363|  28.3k|    } catch (QPDFExc& e) {
 1364|  28.3k|        if (!cf.surpress_recovery()) {
  ------------------
  |  Branch (1364:13): [True: 28.3k, False: 0]
  ------------------
 1365|  28.3k|            warn(e);
 1366|  28.3k|            length = recoverStreamLength(m->file, og, stream_offset);
 1367|  28.3k|        } else {
 1368|      0|            throw;
 1369|      0|        }
 1370|  28.3k|    }
 1371|  28.3k|    object = QPDFObjectHandle(qpdf::Stream(qpdf, og, object, stream_offset, length));
 1372|  23.2k|}
_ZN4QPDF3Doc7Objects21validateStreamLineEndER16QPDFObjectHandle10QPDFObjGenx:
 1376|  32.9k|{
 1377|       |    // The PDF specification states that the word "stream" should be followed by either a carriage
 1378|       |    // return and a newline or by a newline alone.  It specifically disallowed following it by a
 1379|       |    // carriage return alone since, in that case, there would be no way to tell whether the NL in a
 1380|       |    // CR NL sequence was part of the stream data.  However, some readers, including Adobe reader,
 1381|       |    // accept a carriage return by itself when followed by a non-newline character, so that's what
 1382|       |    // we do here. We have also seen files that have extraneous whitespace between the stream
 1383|       |    // keyword and the newline.
 1384|  43.5k|    while (true) {
  ------------------
  |  Branch (1384:12): [True: 43.5k, Folded]
  ------------------
 1385|  43.5k|        char ch;
 1386|  43.5k|        if (m->file->read(&ch, 1) == 0) {
  ------------------
  |  Branch (1386:13): [True: 293, False: 43.2k]
  ------------------
 1387|       |            // A premature EOF here will result in some other problem that will get reported at
 1388|       |            // another time.
 1389|    293|            return;
 1390|    293|        }
 1391|  43.2k|        if (ch == '\n') {
  ------------------
  |  Branch (1391:13): [True: 14.9k, False: 28.2k]
  ------------------
 1392|       |            // ready to read stream data
 1393|  14.9k|            return;
 1394|  14.9k|        }
 1395|  28.2k|        if (ch == '\r') {
  ------------------
  |  Branch (1395:13): [True: 11.3k, False: 16.8k]
  ------------------
 1396|       |            // Read another character
 1397|  11.3k|            if (m->file->read(&ch, 1) != 0) {
  ------------------
  |  Branch (1397:17): [True: 11.3k, False: 36]
  ------------------
 1398|  11.3k|                if (ch == '\n') {
  ------------------
  |  Branch (1398:21): [True: 8.95k, False: 2.39k]
  ------------------
 1399|       |                    // Ready to read stream data
 1400|  8.95k|                    QTC::TC("qpdf", "QPDF stream with CRNL");
 1401|  8.95k|                } else {
 1402|       |                    // Treat the \r by itself as the whitespace after endstream and start reading
 1403|       |                    // stream data in spite of not having seen a newline.
 1404|  2.39k|                    m->file->unreadCh(ch);
 1405|  2.39k|                    warn(damagedPDF(
 1406|  2.39k|                        m->file->tell(), "stream keyword followed by carriage return only"));
 1407|  2.39k|                }
 1408|  11.3k|            }
 1409|  11.3k|            return;
 1410|  11.3k|        }
 1411|  16.8k|        if (!util::is_space(ch)) {
  ------------------
  |  Branch (1411:13): [True: 6.18k, False: 10.6k]
  ------------------
 1412|  6.18k|            m->file->unreadCh(ch);
 1413|  6.18k|            warn(damagedPDF(
 1414|  6.18k|                m->file->tell(), "stream keyword not followed by proper line terminator"));
 1415|  6.18k|            return;
 1416|  6.18k|        }
 1417|  10.6k|        warn(damagedPDF(m->file->tell(), "stream keyword followed by extraneous whitespace"));
 1418|  10.6k|    }
 1419|  32.9k|}
_ZN4QPDF3Doc7Objects13findEndstreamEv:
 1423|  21.7k|{
 1424|       |    // Find endstream or endobj. Position the input at that token.
 1425|  21.7k|    auto t = readToken(*m->file, 20);
 1426|  21.7k|    if (t.isWord("endobj") || t.isWord("endstream")) {
  ------------------
  |  Branch (1426:9): [True: 14.4k, False: 7.31k]
  |  Branch (1426:9): [True: 18.0k, False: 3.65k]
  |  Branch (1426:31): [True: 3.65k, False: 3.65k]
  ------------------
 1427|  18.0k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1428|  18.0k|        return true;
 1429|  18.0k|    }
 1430|  3.65k|    return false;
 1431|  21.7k|}
_ZN4QPDF3Doc7Objects19recoverStreamLengthENSt3__110shared_ptrI11InputSourceEE10QPDFObjGenx:
 1436|  18.9k|{
 1437|       |    // Try to reconstruct stream length by looking for endstream or endobj
 1438|  18.9k|    warn(damagedPDF(*input, stream_offset, "attempting to recover stream length"));
 1439|       |
 1440|  18.9k|    PatternFinder ef(*this, &Objects::findEndstream);
 1441|  18.9k|    size_t length = 0;
 1442|  18.9k|    if (m->file->findFirst("end", stream_offset, 0, ef)) {
  ------------------
  |  Branch (1442:9): [True: 18.0k, False: 903]
  ------------------
 1443|  18.0k|        length = toS(m->file->tell() - stream_offset);
 1444|       |        // Reread endstream but, if it was endobj, don't skip that.
 1445|  18.0k|        QPDFTokenizer::Token t = readToken(*m->file);
 1446|  18.0k|        if (t.getValue() == "endobj") {
  ------------------
  |  Branch (1446:13): [True: 14.4k, False: 3.65k]
  ------------------
 1447|  14.4k|            m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1448|  14.4k|        }
 1449|  18.0k|    }
 1450|       |
 1451|  18.9k|    if (length) {
  ------------------
  |  Branch (1451:9): [True: 17.0k, False: 1.95k]
  ------------------
 1452|  17.0k|        auto end = stream_offset + toO(length);
 1453|  17.0k|        qpdf_offset_t found_offset = 0;
 1454|  17.0k|        QPDFObjGen found_og;
 1455|       |
 1456|       |        // Make sure this is inside this object
 1457|   237k|        for (auto const& [current_og, entry]: m->xref_table) {
  ------------------
  |  Branch (1457:45): [True: 237k, False: 17.0k]
  ------------------
 1458|   237k|            if (entry.getType() == 1) {
  ------------------
  |  Branch (1458:17): [True: 228k, False: 9.40k]
  ------------------
 1459|   228k|                qpdf_offset_t obj_offset = entry.getOffset();
 1460|   228k|                if (found_offset < obj_offset && obj_offset < end) {
  ------------------
  |  Branch (1460:21): [True: 172k, False: 55.3k]
  |  Branch (1460:50): [True: 43.0k, False: 129k]
  ------------------
 1461|  43.0k|                    found_offset = obj_offset;
 1462|  43.0k|                    found_og = current_og;
 1463|  43.0k|                }
 1464|   228k|            }
 1465|   237k|        }
 1466|  17.0k|        if (!found_offset || found_og == og) {
  ------------------
  |  Branch (1466:13): [True: 1.99k, False: 15.0k]
  |  Branch (1466:30): [True: 13.6k, False: 1.34k]
  ------------------
 1467|       |            // If we are trying to recover an XRef stream the xref table will not contain and
 1468|       |            // won't contain any entries, therefore we cannot check the found length. Otherwise we
 1469|       |            // found endstream\nendobj within the space allowed for this object, so we're probably
 1470|       |            // in good shape.
 1471|  15.6k|        } else {
 1472|  1.34k|            length = 0;
 1473|  1.34k|        }
 1474|  17.0k|    }
 1475|       |
 1476|  18.9k|    if (length == 0) {
  ------------------
  |  Branch (1476:9): [True: 3.28k, False: 15.6k]
  ------------------
 1477|  3.28k|        warn(damagedPDF(
 1478|  3.28k|            *input, stream_offset, "unable to recover stream data; treating stream as empty"));
 1479|  15.6k|    } else {
 1480|  15.6k|        warn(damagedPDF(
 1481|  15.6k|            *input, stream_offset, "recovered stream length: " + std::to_string(length)));
 1482|  15.6k|    }
 1483|       |
 1484|  18.9k|    return length;
 1485|  18.9k|}
_ZN4QPDF3Doc7Objects9readTokenER11InputSourcem:
 1489|  2.21M|{
 1490|  2.21M|    return m->tokenizer.readToken(input, m->last_object_description, true, max_len);
 1491|  2.21M|}
_ZN4QPDF3Doc7Objects17read_object_startEx:
 1495|  84.4k|{
 1496|  84.4k|    m->file->seek(offset, SEEK_SET);
 1497|  84.4k|    QPDFTokenizer::Token tobjid = readToken(*m->file);
 1498|  84.4k|    bool objidok = tobjid.isInteger();
 1499|  84.4k|    if (!objidok) {
  ------------------
  |  Branch (1499:9): [True: 1.44k, False: 82.9k]
  ------------------
 1500|  1.44k|        throw damagedPDF(offset, "expected n n obj");
 1501|  1.44k|    }
 1502|  82.9k|    QPDFTokenizer::Token tgen = readToken(*m->file);
 1503|  82.9k|    bool genok = tgen.isInteger();
 1504|  82.9k|    if (!genok) {
  ------------------
  |  Branch (1504:9): [True: 196, False: 82.7k]
  ------------------
 1505|    196|        throw damagedPDF(offset, "expected n n obj");
 1506|    196|    }
 1507|  82.7k|    QPDFTokenizer::Token tobj = readToken(*m->file);
 1508|       |
 1509|  82.7k|    bool objok = tobj.isWord("obj");
 1510|       |
 1511|  82.7k|    if (!objok) {
  ------------------
  |  Branch (1511:9): [True: 311, False: 82.4k]
  ------------------
 1512|    311|        throw damagedPDF(offset, "expected n n obj");
 1513|    311|    }
 1514|  82.4k|    int objid = QUtil::string_to_int(tobjid.getValue().c_str());
 1515|  82.4k|    int generation = QUtil::string_to_int(tgen.getValue().c_str());
 1516|  82.4k|    if (objid == 0) {
  ------------------
  |  Branch (1516:9): [True: 70, False: 82.4k]
  ------------------
 1517|     70|        throw damagedPDF(offset, "object with ID 0");
 1518|     70|    }
 1519|  82.4k|    return {objid, generation};
 1520|  82.4k|}
_ZN4QPDF3Doc7Objects18readObjectAtOffsetEbxRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1525|  74.0k|{
 1526|  74.0k|    QPDFObjGen og;
 1527|  74.0k|    setLastObjectDescription(description, exp_og);
 1528|       |
 1529|  74.0k|    if (cf.surpress_recovery()) {
  ------------------
  |  Branch (1529:9): [True: 0, False: 74.0k]
  ------------------
 1530|      0|        try_recovery = false;
 1531|      0|    }
 1532|       |
 1533|       |    // Special case: if offset is 0, just return null.  Some PDF writers, in particular
 1534|       |    // "Mac OS X 10.7.5 Quartz PDFContext", may store deleted objects in the xref table as
 1535|       |    // "0000000000 00000 n", which is not correct, but it won't hurt anything for us to ignore
 1536|       |    // these.
 1537|  74.0k|    if (offset == 0) {
  ------------------
  |  Branch (1537:9): [True: 250, False: 73.8k]
  ------------------
 1538|    250|        warn(damagedPDF(
 1539|    250|            -1,
 1540|    250|            "object has offset 0 - a common error handled correctly by qpdf and most other "
 1541|    250|            "applications"));
 1542|    250|        return;
 1543|    250|    }
 1544|       |
 1545|  73.8k|    try {
 1546|  73.8k|        og = read_object_start(offset);
 1547|  73.8k|        if (exp_og != og) {
  ------------------
  |  Branch (1547:13): [True: 269, False: 73.5k]
  ------------------
 1548|    269|            QPDFExc e = damagedPDF(offset, "expected " + exp_og.unparse(' ') + " obj");
 1549|    269|            if (try_recovery) {
  ------------------
  |  Branch (1549:17): [True: 269, False: 0]
  ------------------
 1550|       |                // Will be retried below
 1551|    269|                throw e;
 1552|    269|            } else {
 1553|       |                // We can try reading the object anyway even if the ID doesn't match.
 1554|      0|                warn(e);
 1555|      0|            }
 1556|    269|        }
 1557|  73.8k|    } catch (QPDFExc& e) {
 1558|  1.43k|        if (!try_recovery) {
  ------------------
  |  Branch (1558:13): [True: 0, False: 1.43k]
  ------------------
 1559|      0|            throw;
 1560|      0|        }
 1561|       |        // Try again after reconstructing xref table
 1562|  1.43k|        reconstruct_xref(e);
 1563|  1.43k|        if (m->xref_table.contains(exp_og) && m->xref_table[exp_og].getType() == 1) {
  ------------------
  |  Branch (1563:13): [True: 209, False: 1.22k]
  |  Branch (1563:47): [True: 209, False: 0]
  ------------------
 1564|    209|            qpdf_offset_t new_offset = m->xref_table[exp_og].getOffset();
 1565|    209|            readObjectAtOffset(false, new_offset, description, exp_og);
 1566|    209|            return;
 1567|    209|        }
 1568|  1.22k|        warn(damagedPDF(
 1569|  1.22k|            "",
 1570|  1.22k|            -1,
 1571|  1.22k|            ("object " + exp_og.unparse(' ') +
 1572|  1.22k|             " not found in file after regenerating cross reference table")));
 1573|  1.22k|        return;
 1574|  1.43k|    }
 1575|       |
 1576|  72.1k|    if (auto oh = readObject(description, og)) {
  ------------------
  |  Branch (1576:14): [True: 50.7k, False: 21.4k]
  ------------------
 1577|       |        // Determine the end offset of this object before and after white space.  We use these
 1578|       |        // numbers to validate linearization hint tables.  Offsets and lengths of objects may imply
 1579|       |        // the end of an object to be anywhere between these values.
 1580|  50.7k|        qpdf_offset_t end_before_space = m->file->tell();
 1581|       |
 1582|       |        // skip over spaces
 1583|   104k|        while (true) {
  ------------------
  |  Branch (1583:16): [True: 104k, Folded]
  ------------------
 1584|   104k|            char ch;
 1585|   104k|            if (!m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1585:17): [True: 1.05k, False: 103k]
  ------------------
 1586|  1.05k|                throw damagedPDF(m->file->tell(), "EOF after endobj");
 1587|  1.05k|            }
 1588|   103k|            if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1588:17): [True: 49.6k, False: 53.8k]
  ------------------
 1589|  49.6k|                m->file->seek(-1, SEEK_CUR);
 1590|  49.6k|                break;
 1591|  49.6k|            }
 1592|   103k|        }
 1593|  49.6k|        m->objects.updateCache(og, oh.obj_sp(), end_before_space, m->file->tell());
 1594|  49.6k|    }
 1595|  72.1k|}
_ZN4QPDF3Doc7Objects18readObjectAtOffsetExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb:
 1600|  10.6k|{
 1601|  10.6k|    auto og = read_object_start(offset);
 1602|  10.6k|    auto oh = readObject(description, og);
 1603|       |
 1604|  10.6k|    if (!oh || !m->objects.isUnresolved(og)) {
  ------------------
  |  Branch (1604:9): [True: 1.02k, False: 9.59k]
  |  Branch (1604:16): [True: 6.72k, False: 2.87k]
  ------------------
 1605|  6.81k|        return oh;
 1606|  6.81k|    }
 1607|       |
 1608|  3.81k|    if (skip_cache_if_in_xref && m->xref_table.contains(og)) {
  ------------------
  |  Branch (1608:9): [True: 2.87k, False: 934]
  |  Branch (1608:34): [True: 54, False: 2.82k]
  ------------------
 1609|       |        // In the special case of the xref stream and linearization hint tables, the offset comes
 1610|       |        // from another source. For the specific case of xref streams, the xref stream is read and
 1611|       |        // loaded into the object cache very early in parsing. Ordinarily, when a file is updated by
 1612|       |        // appending, items inserted into the xref table in later updates take precedence over
 1613|       |        // earlier items. In the special case of reusing the object number previously used as the
 1614|       |        // xref stream, we have the following order of events:
 1615|       |        //
 1616|       |        // * reused object gets loaded into the xref table
 1617|       |        // * old object is read here while reading xref streams
 1618|       |        // * original xref entry is ignored (since already in xref table)
 1619|       |        //
 1620|       |        // It is the second step that causes a problem. Even though the xref table is correct in
 1621|       |        // this case, the old object is already in the cache and so effectively prevails over the
 1622|       |        // reused object. To work around this issue, we have a special case for the xref stream (via
 1623|       |        // the skip_cache_if_in_xref): if the object is already in the xref stream, don't cache what
 1624|       |        // we read here.
 1625|       |        //
 1626|       |        // It is likely that the same bug may exist for linearization hint tables, but the existing
 1627|       |        // code uses end_before_space and end_after_space from the cache, so fixing that would
 1628|       |        // require more significant rework. The chances of a linearization hint stream being reused
 1629|       |        // seems smaller because the xref stream is probably the highest object in the file and the
 1630|       |        // linearization hint stream would be some random place in the middle, so I'm leaving that
 1631|       |        // bug unfixed for now. If the bug were to be fixed, we could use !check_og in place of
 1632|       |        // skip_cache_if_in_xref.
 1633|     54|        QTC::TC("qpdf", "QPDF skipping cache for known unchecked object");
 1634|     54|        return oh;
 1635|     54|    }
 1636|       |
 1637|       |    // Determine the end offset of this object before and after white space.  We use these
 1638|       |    // numbers to validate linearization hint tables.  Offsets and lengths of objects may imply
 1639|       |    // the end of an object to be anywhere between these values.
 1640|  3.75k|    qpdf_offset_t end_before_space = m->file->tell();
 1641|       |
 1642|       |    // skip over spaces
 1643|  6.60k|    while (true) {
  ------------------
  |  Branch (1643:12): [True: 5.67k, Folded]
  ------------------
 1644|  5.67k|        char ch;
 1645|  5.67k|        if (!m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1645:13): [True: 161, False: 5.51k]
  ------------------
 1646|    161|            throw damagedPDF(m->file->tell(), "EOF after endobj");
 1647|    161|        }
 1648|  5.51k|        if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1648:13): [True: 2.66k, False: 2.84k]
  ------------------
 1649|  2.66k|            m->file->seek(-1, SEEK_CUR);
 1650|  2.66k|            break;
 1651|  2.66k|        }
 1652|  5.51k|    }
 1653|  3.59k|    m->objects.updateCache(og, oh.obj_sp(), end_before_space, m->file->tell());
 1654|       |
 1655|  3.59k|    return oh;
 1656|  3.75k|}
_ZN4QPDF3Doc7Objects7resolveE10QPDFObjGen:
 1660|   268k|{
 1661|   268k|    if (!isUnresolved(og)) {
  ------------------
  |  Branch (1661:9): [True: 0, False: 268k]
  ------------------
 1662|      0|        return m->obj_cache[og].object;
 1663|      0|    }
 1664|       |
 1665|   268k|    if (m->resolving.contains(og)) {
  ------------------
  |  Branch (1665:9): [True: 255, False: 268k]
  ------------------
 1666|       |        // This can happen if an object references itself directly or indirectly in some key that
 1667|       |        // has to be resolved during object parsing, such as stream length.
 1668|    255|        warn(damagedPDF("", "loop detected resolving object " + og.unparse(' ')));
 1669|    255|        updateCache(og, QPDFObject::create<QPDF_Null>(), -1, -1);
 1670|    255|        return m->obj_cache[og].object;
 1671|    255|    }
 1672|   268k|    ResolveRecorder rr(qpdf, og);
 1673|       |
 1674|   268k|    if (m->xref_table.contains(og)) {
  ------------------
  |  Branch (1674:9): [True: 245k, False: 23.4k]
  ------------------
 1675|   245k|        QPDFXRefEntry const& entry = m->xref_table[og];
 1676|   245k|        try {
 1677|   245k|            switch (entry.getType()) {
 1678|  73.8k|            case 1:
  ------------------
  |  Branch (1678:13): [True: 73.8k, False: 171k]
  ------------------
 1679|       |                // Object stored in cache by readObjectAtOffset
 1680|  73.8k|                readObjectAtOffset(true, entry.getOffset(), "", og);
 1681|  73.8k|                break;
 1682|       |
 1683|   171k|            case 2:
  ------------------
  |  Branch (1683:13): [True: 171k, False: 73.8k]
  ------------------
 1684|   171k|                resolveObjectsInStream(entry.getObjStreamNumber());
 1685|   171k|                break;
 1686|       |
 1687|     18|            default:
  ------------------
  |  Branch (1687:13): [True: 18, False: 245k]
  ------------------
 1688|     18|                throw damagedPDF(
 1689|     18|                    "", -1, ("object " + og.unparse('/') + " has unexpected xref entry type"));
 1690|   245k|            }
 1691|   245k|        } catch (QPDFExc& e) {
 1692|  59.9k|            warn(e);
 1693|  59.9k|        } catch (std::exception& e) {
 1694|    424|            warn(damagedPDF(
 1695|    424|                "", -1, ("object " + og.unparse('/') + ": error reading object: " + e.what())));
 1696|    424|        }
 1697|   245k|    }
 1698|       |
 1699|   244k|    if (isUnresolved(og)) {
  ------------------
  |  Branch (1699:9): [True: 194k, False: 50.1k]
  ------------------
 1700|       |        // PDF spec says unknown objects resolve to the null object.
 1701|   194k|        updateCache(og, QPDFObject::create<QPDF_Null>(), -1, -1);
 1702|   194k|    }
 1703|       |
 1704|   244k|    auto& result(m->obj_cache[og].object);
 1705|   244k|    result->setDefaultDescription(&qpdf, og);
 1706|   244k|    return result;
 1707|   268k|}
_ZN4QPDF3Doc7Objects22resolveObjectsInStreamEi:
 1711|   171k|{
 1712|   171k|    auto damaged =
 1713|   171k|        [this, obj_stream_number](int id, qpdf_offset_t offset, std::string const& msg) -> QPDFExc {
 1714|   171k|        return {
 1715|   171k|            qpdf_e_damaged_pdf,
 1716|   171k|            m->file->getName() + " object stream " + std::to_string(obj_stream_number),
 1717|   171k|            +"object " + std::to_string(id) + " 0",
 1718|   171k|            offset,
 1719|   171k|            msg,
 1720|   171k|            true};
 1721|   171k|    };
 1722|       |
 1723|   171k|    if (m->resolved_object_streams.contains(obj_stream_number)) {
  ------------------
  |  Branch (1723:9): [True: 127k, False: 43.9k]
  ------------------
 1724|   127k|        return;
 1725|   127k|    }
 1726|  43.9k|    m->resolved_object_streams.insert(obj_stream_number);
 1727|       |    // Force resolution of object stream
 1728|  43.9k|    Stream obj_stream = qpdf.getObject(obj_stream_number, 0);
 1729|  43.9k|    if (!obj_stream) {
  ------------------
  |  Branch (1729:9): [True: 37.1k, False: 6.83k]
  ------------------
 1730|  37.1k|        throw damagedPDF(
 1731|  37.1k|            "object " + std::to_string(obj_stream_number) + " 0",
 1732|  37.1k|            "supposed object stream " + std::to_string(obj_stream_number) + " is not a stream");
 1733|  37.1k|    }
 1734|       |
 1735|       |    // For linearization data in the object, use the data from the object stream for the objects in
 1736|       |    // the stream.
 1737|  6.83k|    QPDFObjGen stream_og(obj_stream_number, 0);
 1738|  6.83k|    qpdf_offset_t end_before_space = m->obj_cache[stream_og].end_before_space;
 1739|  6.83k|    qpdf_offset_t end_after_space = m->obj_cache[stream_og].end_after_space;
 1740|       |
 1741|  6.83k|    QPDFObjectHandle dict = obj_stream.getDict();
 1742|  6.83k|    if (!dict.isDictionaryOfType("/ObjStm")) {
  ------------------
  |  Branch (1742:9): [True: 1.43k, False: 5.40k]
  ------------------
 1743|  1.43k|        warn(damagedPDF(
 1744|  1.43k|            "object " + std::to_string(obj_stream_number) + " 0",
 1745|  1.43k|            "supposed object stream " + std::to_string(obj_stream_number) + " has wrong type"));
 1746|  1.43k|    }
 1747|       |
 1748|  6.83k|    unsigned int n{0};
 1749|  6.83k|    int first{0};
 1750|  6.83k|    if (!(dict.getKey("/N").getValueAsUInt(n) && dict.getKey("/First").getValueAsInt(first))) {
  ------------------
  |  Branch (1750:9): [True: 216, False: 6.61k]
  |  Branch (1750:11): [True: 2.46k, False: 4.37k]
  |  Branch (1750:50): [True: 2.39k, False: 71]
  ------------------
 1751|    216|        throw damagedPDF(
 1752|    216|            "object " + std::to_string(obj_stream_number) + " 0",
 1753|    216|            "object stream " + std::to_string(obj_stream_number) + " has incorrect keys");
 1754|    216|    }
 1755|       |
 1756|       |    // id, offset, size
 1757|  6.61k|    std::vector<std::tuple<int, qpdf_offset_t, size_t>> offsets;
 1758|       |
 1759|  6.61k|    auto stream_data = obj_stream.getStreamData(qpdf_dl_specialized);
 1760|       |
 1761|  6.61k|    is::OffsetBuffer input("", stream_data);
 1762|       |
 1763|  6.61k|    const auto b_size = stream_data.size();
 1764|  6.61k|    const auto end_offset = static_cast<qpdf_offset_t>(b_size);
 1765|  6.61k|    auto b_start = stream_data.data();
 1766|       |
 1767|  6.61k|    if (first >= end_offset) {
  ------------------
  |  Branch (1767:9): [True: 230, False: 6.38k]
  ------------------
 1768|    230|        throw damagedPDF(
 1769|    230|            "object " + std::to_string(obj_stream_number) + " 0",
 1770|    230|            "object stream " + std::to_string(obj_stream_number) + " has invalid /First entry");
 1771|    230|    }
 1772|       |
 1773|  6.38k|    int id = 0;
 1774|  6.38k|    long long last_offset = -1;
 1775|  6.38k|    bool is_first = true;
 1776|  51.3k|    for (unsigned int i = 0; i < n; ++i) {
  ------------------
  |  Branch (1776:30): [True: 45.3k, False: 6.07k]
  ------------------
 1777|  45.3k|        auto tnum = readToken(input);
 1778|  45.3k|        auto id_offset = input.getLastOffset();
 1779|  45.3k|        auto toffset = readToken(input);
 1780|  45.3k|        if (!(tnum.isInteger() && toffset.isInteger())) {
  ------------------
  |  Branch (1780:15): [True: 45.0k, False: 217]
  |  Branch (1780:35): [True: 44.9k, False: 99]
  ------------------
 1781|    316|            throw damaged(0, input.getLastOffset(), "expected integer in object stream header");
 1782|    316|        }
 1783|       |
 1784|  44.9k|        int num = QUtil::string_to_int(tnum.getValue().c_str());
 1785|  44.9k|        long long offset = QUtil::string_to_int(toffset.getValue().c_str());
 1786|       |
 1787|  44.9k|        if (num == obj_stream_number) {
  ------------------
  |  Branch (1787:13): [True: 190, False: 44.7k]
  ------------------
 1788|    190|            warn(damaged(num, id_offset, "object stream claims to contain itself"));
 1789|    190|            continue;
 1790|    190|        }
 1791|       |
 1792|  44.7k|        if (num < 1) {
  ------------------
  |  Branch (1792:13): [True: 531, False: 44.2k]
  ------------------
 1793|    531|            warn(damaged(num, id_offset, "object id is invalid"s));
 1794|    531|            continue;
 1795|    531|        }
 1796|       |
 1797|  44.2k|        if (offset <= last_offset) {
  ------------------
  |  Branch (1797:13): [True: 6.44k, False: 37.8k]
  ------------------
 1798|  6.44k|            warn(damaged(
 1799|  6.44k|                num,
 1800|  6.44k|                input.getLastOffset(),
 1801|  6.44k|                "offset " + std::to_string(offset) +
 1802|  6.44k|                    " is invalid (must be larger than previous offset " +
 1803|  6.44k|                    std::to_string(last_offset) + ")"));
 1804|  6.44k|            continue;
 1805|  6.44k|        }
 1806|       |
 1807|  37.8k|        if (num > m->xref_table_max_id) {
  ------------------
  |  Branch (1807:13): [True: 2.01k, False: 35.8k]
  ------------------
 1808|  2.01k|            continue;
 1809|  2.01k|        }
 1810|       |
 1811|  35.8k|        if (first + offset >= end_offset) {
  ------------------
  |  Branch (1811:13): [True: 6.71k, False: 29.1k]
  ------------------
 1812|  6.71k|            warn(damaged(
 1813|  6.71k|                num, input.getLastOffset(), "offset " + std::to_string(offset) + " is too large"));
 1814|  6.71k|            continue;
 1815|  6.71k|        }
 1816|       |
 1817|  29.1k|        if (is_first) {
  ------------------
  |  Branch (1817:13): [True: 1.11k, False: 27.9k]
  ------------------
 1818|  1.11k|            is_first = false;
 1819|  27.9k|        } else {
 1820|  27.9k|            offsets.emplace_back(
 1821|  27.9k|                id, last_offset + first, static_cast<size_t>(offset - last_offset));
 1822|  27.9k|        }
 1823|       |
 1824|  29.1k|        last_offset = offset;
 1825|  29.1k|        id = num;
 1826|  29.1k|    }
 1827|       |
 1828|  6.07k|    if (!is_first) {
  ------------------
  |  Branch (1828:9): [True: 895, False: 5.17k]
  ------------------
 1829|       |        // We found at least one valid entry.
 1830|    895|        offsets.emplace_back(
 1831|    895|            id, last_offset + first, b_size - static_cast<size_t>(last_offset + first));
 1832|    895|    }
 1833|       |
 1834|       |    // To avoid having to read the object stream multiple times, store all objects that would be
 1835|       |    // found here in the cache.  Remember that some objects stored here might have been overridden
 1836|       |    // by new objects appended to the file, so it is necessary to recheck the xref table and only
 1837|       |    // cache what would actually be resolved here.
 1838|  23.8k|    for (auto const& [obj_id, obj_offset, obj_size]: offsets) {
  ------------------
  |  Branch (1838:52): [True: 23.8k, False: 6.07k]
  ------------------
 1839|  23.8k|        QPDFObjGen og(obj_id, 0);
 1840|  23.8k|        auto entry = m->xref_table.find(og);
 1841|  23.8k|        if (entry != m->xref_table.end() && entry->second.getType() == 2 &&
  ------------------
  |  Branch (1841:13): [True: 21.2k, False: 2.54k]
  |  Branch (1841:13): [True: 15.4k, False: 8.32k]
  |  Branch (1841:45): [True: 20.9k, False: 357]
  ------------------
 1842|  20.9k|            entry->second.getObjStreamNumber() == obj_stream_number) {
  ------------------
  |  Branch (1842:13): [True: 15.4k, False: 5.43k]
  ------------------
 1843|  15.4k|            is::OffsetBuffer in("", {b_start + obj_offset, obj_size}, obj_offset);
 1844|  15.4k|            if (auto oh = Parser::parse(in, obj_stream_number, obj_id, m->tokenizer, qpdf)) {
  ------------------
  |  Branch (1844:22): [True: 12.6k, False: 2.87k]
  ------------------
 1845|  12.6k|                updateCache(og, oh.obj_sp(), end_before_space, end_after_space);
 1846|  12.6k|            }
 1847|  15.4k|        } else {
 1848|  8.32k|            QTC::TC("qpdf", "QPDF not caching overridden objstm object");
 1849|  8.32k|        }
 1850|  23.8k|    }
 1851|  6.07k|}
_ZN4QPDF3Doc7Objects11newIndirectE10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEE:
 1855|  4.93k|{
 1856|  4.93k|    obj->setDefaultDescription(&qpdf, og);
 1857|  4.93k|    return {obj};
 1858|  4.93k|}
_ZN4QPDF3Doc7Objects11updateCacheE10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEExxb:
 1867|   259k|{
 1868|   259k|    object->setObjGen(&qpdf, og);
 1869|   259k|    if (isCached(og)) {
  ------------------
  |  Branch (1869:9): [True: 118k, False: 140k]
  ------------------
 1870|   118k|        auto& cache = m->obj_cache[og];
 1871|   118k|        object->move_to(cache.object, destroy);
 1872|   118k|        cache.end_before_space = end_before_space;
 1873|   118k|        cache.end_after_space = end_after_space;
 1874|   140k|    } else {
 1875|   140k|        m->obj_cache[og] = ObjCache(object, end_before_space, end_after_space);
 1876|   140k|    }
 1877|   259k|}
_ZN4QPDF3Doc7Objects8isCachedE10QPDFObjGen:
 1881|   929k|{
 1882|   929k|    return m->obj_cache.contains(og);
 1883|   929k|}
_ZN4QPDF3Doc7Objects12isUnresolvedE10QPDFObjGen:
 1887|   670k|{
 1888|   670k|    return !isCached(og) || m->obj_cache[og].object->isUnresolved();
  ------------------
  |  Branch (1888:12): [True: 392k, False: 278k]
  |  Branch (1888:29): [True: 208k, False: 69.7k]
  ------------------
 1889|   670k|}
_ZN4QPDF3Doc7Objects10nextObjGenEv:
 1893|  4.96k|{
 1894|  4.96k|    int max_objid = toI(qpdf.getObjectCount());
 1895|  4.96k|    if (max_objid == std::numeric_limits<int>::max()) {
  ------------------
  |  Branch (1895:9): [True: 4, False: 4.95k]
  ------------------
 1896|      4|        throw std::range_error("max object id is too high to create new objects");
 1897|      4|    }
 1898|  4.95k|    return {max_objid + 1, 0};
 1899|  4.96k|}
_ZN4QPDF3Doc7Objects26makeIndirectFromQPDFObjectERKNSt3__110shared_ptrI10QPDFObjectEE:
 1903|  4.96k|{
 1904|  4.96k|    QPDFObjGen next{nextObjGen()};
 1905|  4.96k|    m->obj_cache[next] = ObjCache(obj, -1, -1);
 1906|  4.96k|    return newIndirect(next, m->obj_cache[next].object);
 1907|  4.96k|}
_ZN4QPDF18makeIndirectObjectE16QPDFObjectHandle:
 1911|  4.96k|{
 1912|  4.96k|    if (!oh) {
  ------------------
  |  Branch (1912:9): [True: 0, False: 4.96k]
  ------------------
 1913|      0|        throw std::logic_error("attempted to make an uninitialized QPDFObjectHandle indirect");
 1914|      0|    }
 1915|  4.96k|    return m->objects.makeIndirectFromQPDFObject(oh.obj_sp());
 1916|  4.96k|}
_ZN4QPDF3Doc7Objects18getObjectForParserEiib:
 1920|   203k|{
 1921|       |    // This method is called by the parser and therefore must not resolve any objects.
 1922|   203k|    auto og = QPDFObjGen(id, gen);
 1923|   203k|    if (auto iter = m->obj_cache.find(og); iter != m->obj_cache.end()) {
  ------------------
  |  Branch (1923:44): [True: 123k, False: 80.8k]
  ------------------
 1924|   123k|        return iter->second.object;
 1925|   123k|    }
 1926|  80.8k|    if (m->xref_table.contains(og) || (!m->parsed && og.getObj() < m->xref_table_max_id)) {
  ------------------
  |  Branch (1926:9): [True: 52.1k, False: 28.6k]
  |  Branch (1926:40): [True: 22.6k, False: 6.02k]
  |  Branch (1926:54): [True: 20.9k, False: 1.74k]
  ------------------
 1927|  73.1k|        return m->obj_cache.insert({og, QPDFObject::create<QPDF_Unresolved>(&qpdf, og)})
 1928|  73.1k|            .first->second.object;
 1929|  73.1k|    }
 1930|  7.76k|    if (parse_pdf) {
  ------------------
  |  Branch (1930:9): [True: 7.76k, False: 0]
  ------------------
 1931|  7.76k|        return QPDFObject::create<QPDF_Null>();
 1932|  7.76k|    }
 1933|      0|    return m->obj_cache.insert({og, QPDFObject::create<QPDF_Null>(&qpdf, og)}).first->second.object;
 1934|  7.76k|}
_ZN4QPDF9getObjectE10QPDFObjGen:
 1952|  87.8k|{
 1953|  87.8k|    if (auto it = m->obj_cache.find(og); it != m->obj_cache.end()) {
  ------------------
  |  Branch (1953:42): [True: 17.8k, False: 69.9k]
  ------------------
 1954|  17.8k|        return {it->second.object};
 1955|  69.9k|    } else if (m->parsed && !m->xref_table.contains(og)) {
  ------------------
  |  Branch (1955:16): [True: 9.60k, False: 60.3k]
  |  Branch (1955:29): [True: 8.34k, False: 1.25k]
  ------------------
 1956|  8.34k|        return QPDFObject::create<QPDF_Null>();
 1957|  61.6k|    } else {
 1958|  61.6k|        auto result =
 1959|  61.6k|            m->obj_cache.try_emplace(og, QPDFObject::create<QPDF_Unresolved>(this, og), -1, -1);
 1960|  61.6k|        return {result.first->second.object};
 1961|  61.6k|    }
 1962|  87.8k|}
_ZN4QPDF12removeObjectE10QPDFObjGen:
 1981|  23.9k|{
 1982|  23.9k|    m->xref_table.erase(og);
 1983|  23.9k|    if (auto cached = m->obj_cache.find(og); cached != m->obj_cache.end()) {
  ------------------
  |  Branch (1983:46): [True: 826, False: 23.1k]
  ------------------
 1984|       |        // Take care of any object handles that may be floating around.
 1985|    826|        cached->second.object->assign_null();
 1986|    826|        cached->second.object->setObjGen(nullptr, QPDFObjGen());
 1987|    826|        m->obj_cache.erase(cached);
 1988|    826|    }
 1989|  23.9k|}
_ZN4QPDF3Doc7Objects13PatternFinderC2ERS1_MS1_FbvE:
  147|  58.7k|        o(o),
  148|  58.7k|        checker(checker)
  149|  58.7k|    {
  150|  58.7k|    }
_ZN4QPDF3Doc7Objects13PatternFinder5checkEv:
  154|  33.8k|    {
  155|  33.8k|        return (this->o.*checker)();
  156|  33.8k|    }
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects16reconstruct_xrefER7QPDFExcbENK3$_0clEv:
  324|  1.46M|    auto check_warnings = [this, max_warnings]() {
  325|  1.46M|        if (m->warnings.size() > max_warnings) {
  ------------------
  |  Branch (325:13): [True: 0, False: 1.46M]
  ------------------
  326|      0|            throw damagedPDF("", -1, "too many errors while reconstructing cross-reference table");
  327|      0|        }
  328|  1.46M|    };
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects17processXRefStreamExR16QPDFObjectHandlebENK3$_0clENSt3__117basic_string_viewIcNS5_11char_traitsIcEEEE:
 1031|  5.51k|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1032|  5.51k|        return damagedPDF("xref stream", xref_offset, msg.data());
 1033|  5.51k|    };
_ZN4QPDF15ResolveRecorderC2ERS_RK10QPDFObjGen:
  129|   268k|        qpdf(qpdf),
  130|   268k|        iter(qpdf.m->resolving.insert(og).first)
  131|   268k|    {
  132|   268k|    }
_ZN4QPDF15ResolveRecorderD2Ev:
  134|   268k|    {
  135|   268k|        qpdf.m->resolving.erase(iter);
  136|   268k|    }
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects22resolveObjectsInStreamEiENK3$_0clEixRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 1713|  14.1k|        [this, obj_stream_number](int id, qpdf_offset_t offset, std::string const& msg) -> QPDFExc {
 1714|  14.1k|        return {
 1715|  14.1k|            qpdf_e_damaged_pdf,
 1716|  14.1k|            m->file->getName() + " object stream " + std::to_string(obj_stream_number),
 1717|  14.1k|            +"object " + std::to_string(id) + " 0",
 1718|  14.1k|            offset,
 1719|  14.1k|            msg,
 1720|  14.1k|            true};
 1721|  14.1k|    };

_ZN4QPDF3Doc5Pages5cacheEv:
   53|  13.7k|{
   54|       |    // Note that pushInheritedAttributesToPage may also be used to initialize m->all_pages.
   55|  13.7k|    if (all_pages.empty() && !invalid_page_found) {
  ------------------
  |  Branch (55:9): [True: 11.9k, False: 1.80k]
  |  Branch (55:30): [True: 10.5k, False: 1.40k]
  ------------------
   56|  10.5k|        ever_called_get_all_pages_ = true;
   57|  10.5k|        auto root = qpdf.getRoot();
   58|  10.5k|        QPDFObjGen::set visited;
   59|  10.5k|        QPDFObjGen::set seen;
   60|  10.5k|        QPDFObjectHandle pages = root.getKey("/Pages");
   61|  10.5k|        bool warned = false;
   62|  10.5k|        bool changed_pages = false;
   63|  10.6k|        while (pages.isDictionary() && pages.hasKey("/Parent")) {
  ------------------
  |  Branch (63:16): [True: 4.17k, False: 6.48k]
  |  Branch (63:16): [True: 159, False: 10.4k]
  |  Branch (63:40): [True: 159, False: 4.01k]
  ------------------
   64|    159|            if (!seen.add(pages)) {
  ------------------
  |  Branch (64:17): [True: 18, False: 141]
  ------------------
   65|       |                // loop -- will be detected again and reported later
   66|     18|                break;
   67|     18|            }
   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|    141|            if (!warned) {
  ------------------
  |  Branch (70:17): [True: 62, False: 79]
  ------------------
   71|     62|                root.warn(
   72|     62|                    "document page tree root (root -> /Pages) doesn't point"
   73|     62|                    " to the root of the page tree; attempting to correct");
   74|     62|                warned = true;
   75|     62|            }
   76|    141|            changed_pages = true;
   77|    141|            pages = pages.getKey("/Parent");
   78|    141|        }
   79|  10.5k|        if (changed_pages) {
  ------------------
  |  Branch (79:13): [True: 61, False: 10.4k]
  ------------------
   80|     61|            root.replaceKey("/Pages", pages);
   81|     61|        }
   82|  10.5k|        seen.clear();
   83|  10.5k|        if (!pages.hasKey("/Kids")) {
  ------------------
  |  Branch (83:13): [True: 146, False: 10.3k]
  ------------------
   84|       |            // Ensure we actually found a /Pages object.
   85|    146|            throw QPDFExc(
   86|    146|                qpdf_e_pages, m->file->getName(), "", 0, "root of pages tree has no /Kids array");
   87|    146|        }
   88|  10.3k|        try {
   89|  10.3k|            getAllPagesInternal(pages, 0, visited, seen, false, false);
   90|  10.3k|        } catch (...) {
   91|     97|            all_pages.clear();
   92|     97|            invalid_page_found = false;
   93|     97|            throw;
   94|     97|        }
   95|  3.91k|        if (invalid_page_found) {
  ------------------
  |  Branch (95:13): [True: 3.21k, False: 698]
  ------------------
   96|  3.21k|            flattenPagesTree();
   97|  3.21k|            invalid_page_found = false;
   98|  3.21k|        }
   99|  3.91k|    }
  100|  7.13k|    return all_pages;
  101|  13.7k|}
_ZN4QPDF3Doc5Pages19getAllPagesInternalE16QPDFObjectHandlejRN10QPDFObjGen3setES5_bb:
  111|  6.84k|{
  112|  6.84k|    static uint32_t constexpr max_level = 100;
  113|  6.84k|    if (++level > max_level) {
  ------------------
  |  Branch (113:9): [True: 0, False: 6.84k]
  ------------------
  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|  6.84k|    if (!visited.add(cur_node)) {
  ------------------
  |  Branch (121:9): [True: 34, False: 6.80k]
  ------------------
  122|     34|        throw QPDFExc(
  123|     34|            qpdf_e_pages,
  124|     34|            m->file->getName(),
  125|     34|            "object " + cur_node.getObjGen().unparse(' '),
  126|     34|            0,
  127|     34|            "Loop detected in /Pages structure (getAllPages)");
  128|     34|    }
  129|  6.80k|    if (!cur_node.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (129:9): [True: 5.99k, False: 817]
  ------------------
  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|  5.99k|        cur_node.warn("/Type key should be /Pages but is not; overriding");
  134|  5.99k|        cur_node.replaceKey("/Type", Name("/Pages"));
  135|  5.99k|    }
  136|  6.80k|    if (!media_box) {
  ------------------
  |  Branch (136:9): [True: 6.71k, False: 92]
  ------------------
  137|  6.71k|        media_box = cur_node.getKey("/MediaBox").isRectangle();
  138|  6.71k|        QTC::TC("qpdf", "QPDF inherit mediabox", media_box ? 0 : 1);
  ------------------
  |  Branch (138:50): [True: 426, False: 6.29k]
  ------------------
  139|  6.71k|    }
  140|  6.80k|    if (!resources) {
  ------------------
  |  Branch (140:9): [True: 6.57k, False: 239]
  ------------------
  141|  6.57k|        resources = cur_node.getKey("/Resources").isDictionary();
  142|  6.57k|    }
  143|  6.80k|    auto kids = cur_node.getKey("/Kids");
  144|  6.80k|    if (!visited.add(kids)) {
  ------------------
  |  Branch (144:9): [True: 16, False: 6.79k]
  ------------------
  145|     16|        throw QPDFExc(
  146|     16|            qpdf_e_pages,
  147|     16|            m->file->getName(),
  148|     16|            "object " + cur_node.getObjGen().unparse(' '),
  149|     16|            0,
  150|     16|            "Loop detected in /Pages structure (getAllPages)");
  151|     16|    }
  152|  6.79k|    int i = -1;
  153|  33.8k|    for (auto& kid: kids.as_array()) {
  ------------------
  |  Branch (153:19): [True: 33.8k, False: 6.79k]
  ------------------
  154|  33.8k|        ++i;
  155|  33.8k|        int errors = 0;
  156|       |
  157|  33.8k|        if (!kid.isDictionary()) {
  ------------------
  |  Branch (157:13): [True: 21.8k, False: 11.9k]
  ------------------
  158|  21.8k|            kid.warn("Pages tree includes non-dictionary object; ignoring");
  159|  21.8k|            invalid_page_found = true;
  160|  21.8k|            continue;
  161|  21.8k|        }
  162|  11.9k|        if (!kid.isIndirect()) {
  ------------------
  |  Branch (162:13): [True: 3.76k, False: 8.17k]
  ------------------
  163|  3.76k|            cur_node.warn(
  164|  3.76k|                "kid " + std::to_string(i) + " (from 0) is direct; converting to indirect");
  165|  3.76k|            kid = qpdf.makeIndirectObject(kid);
  166|  3.76k|            ++errors;
  167|  3.76k|        }
  168|  11.9k|        if (kid.hasKey("/Kids")) {
  ------------------
  |  Branch (168:13): [True: 2.83k, False: 9.11k]
  ------------------
  169|  2.83k|            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.13k, False: 984]
  |  Branch (171:17): [True: 3.95k, False: 5.15k]
  |  Branch (171:31): [True: 3.95k, False: 4.17k]
  ------------------
  172|  3.95k|                kid.warn(
  173|  3.95k|                    "kid " + std::to_string(i) +
  174|  3.95k|                    " (from 0) MediaBox is undefined; setting to letter / ANSI A");
  175|  3.95k|                kid.replaceKey(
  176|  3.95k|                    "/MediaBox",
  177|  3.95k|                    QPDFObjectHandle::newArray(QPDFObjectHandle::Rectangle(0, 0, 612, 792)));
  178|  3.95k|                ++errors;
  179|  3.95k|            }
  180|  9.11k|            if (!resources) {
  ------------------
  |  Branch (180:17): [True: 8.19k, False: 924]
  ------------------
  181|  8.19k|                auto res = kid.getKey("/Resources");
  182|       |
  183|  8.19k|                if (!res.isDictionary()) {
  ------------------
  |  Branch (183:21): [True: 4.01k, False: 4.17k]
  ------------------
  184|  4.01k|                    ++errors;
  185|  4.01k|                    kid.warn(
  186|  4.01k|                        "kid " + std::to_string(i) +
  187|  4.01k|                        " (from 0) Resources is missing or invalid; repairing");
  188|  4.01k|                    kid.replaceKey("/Resources", QPDFObjectHandle::newDictionary());
  189|  4.01k|                }
  190|  8.19k|            }
  191|  9.11k|            auto annots = kid.getKey("/Annots");
  192|  9.11k|            if (!annots.null()) {
  ------------------
  |  Branch (192:17): [True: 1.80k, False: 7.31k]
  ------------------
  193|  1.80k|                if (!annots.isArray()) {
  ------------------
  |  Branch (193:21): [True: 19, False: 1.78k]
  ------------------
  194|     19|                    kid.warn(
  195|     19|                        "kid " + std::to_string(i) + " (from 0) Annots is not an array; removing");
  196|     19|                    kid.removeKey("/Annots");
  197|     19|                    ++errors;
  198|  1.78k|                } else {
  199|  1.78k|                    QPDFObjGen::set seen_annots;
  200|  82.0k|                    for (auto& annot: annots.as_array()) {
  ------------------
  |  Branch (200:37): [True: 82.0k, False: 1.78k]
  ------------------
  201|  82.0k|                        if (!seen_annots.add(annot)) {
  ------------------
  |  Branch (201:29): [True: 1.43k, False: 80.6k]
  ------------------
  202|  1.43k|                            kid.warn(
  203|  1.43k|                                "kid " + std::to_string(i) +
  204|  1.43k|                                " (from 0) Annots has duplicate entry for annotation " +
  205|  1.43k|                                annot.id_gen().unparse(' '));
  206|  1.43k|                            ++errors;
  207|  1.43k|                        }
  208|  82.0k|                    }
  209|  1.78k|                }
  210|  1.80k|            }
  211|       |
  212|  9.11k|            if (!seen.add(kid)) {
  ------------------
  |  Branch (212:17): [True: 2.84k, False: 6.27k]
  ------------------
  213|       |                // Make a copy of the page. This does the same as shallowCopyPage in
  214|       |                // QPDFPageObjectHelper.
  215|  2.84k|                if (!m->reconstructed_xref) {
  ------------------
  |  Branch (215:21): [True: 257, False: 2.58k]
  ------------------
  216|    257|                    cur_node.warn(
  217|    257|                        "kid " + std::to_string(i) +
  218|    257|                        " (from 0) appears more than once in the pages tree;"
  219|    257|                        " creating a new page object as a copy");
  220|       |                    // This needs to be fixed. shallowCopy does not necessarily produce a valid
  221|       |                    // page.
  222|    257|                    kid = qpdf.makeIndirectObject(QPDFObjectHandle(kid).shallowCopy());
  223|    257|                    seen.add(kid);
  224|  2.58k|                } else {
  225|  2.58k|                    cur_node.warn(
  226|  2.58k|                        "kid " + std::to_string(i) +
  227|  2.58k|                        " (from 0) appears more than once in the pages tree; ignoring duplicate");
  228|  2.58k|                    invalid_page_found = true;
  229|  2.58k|                    kid = QPDFObjectHandle::newNull();
  230|  2.58k|                    continue;
  231|  2.58k|                }
  232|    257|                if (!kid.getKey("/Parent").isSameObjectAs(cur_node)) {
  ------------------
  |  Branch (232:21): [True: 212, False: 45]
  ------------------
  233|       |                    // Consider fixing and adding an information message.
  234|    212|                    ++errors;
  235|    212|                }
  236|    257|            }
  237|  6.52k|            if (!kid.isDictionaryOfType("/Page")) {
  ------------------
  |  Branch (237:17): [True: 3.80k, False: 2.72k]
  ------------------
  238|  3.80k|                kid.warn("/Type key should be /Page but is not; overriding");
  239|  3.80k|                kid.replaceKey("/Type", Name("/Page"));
  240|  3.80k|                ++errors;
  241|  3.80k|            }
  242|  6.52k|            if (m->reconstructed_xref && errors > 2) {
  ------------------
  |  Branch (242:17): [True: 5.35k, False: 1.17k]
  |  Branch (242:42): [True: 2.01k, False: 3.33k]
  ------------------
  243|  2.01k|                cur_node.warn(
  244|  2.01k|                    "kid " + std::to_string(i) + " (from 0) has too many errors; ignoring page");
  245|  2.01k|                invalid_page_found = true;
  246|  2.01k|                kid = QPDFObjectHandle::newNull();
  247|  2.01k|                continue;
  248|  2.01k|            }
  249|  4.51k|            all_pages.emplace_back(kid);
  250|  4.51k|        }
  251|  11.9k|    }
  252|  6.79k|}
_ZN4QPDF3Doc5Pages16flattenPagesTreeEv:
  274|  3.21k|{
  275|       |    // If not already done, flatten the /Pages structure and initialize pageobj_to_pages_pos.
  276|       |
  277|  3.21k|    if (!pageobj_to_pages_pos.empty()) {
  ------------------
  |  Branch (277:9): [True: 0, False: 3.21k]
  ------------------
  278|      0|        return;
  279|      0|    }
  280|       |
  281|       |    // Push inherited objects down to the /Page level.  As a side effect all_pages will also be
  282|       |    // generated.
  283|  3.21k|    pushInheritedAttributesToPage(true, true);
  284|       |
  285|  3.21k|    QPDFObjectHandle pages = qpdf.getRoot().getKey("/Pages");
  286|       |
  287|  3.21k|    size_t const len = all_pages.size();
  288|  6.76k|    for (size_t pos = 0; pos < len; ++pos) {
  ------------------
  |  Branch (288:26): [True: 3.55k, False: 3.21k]
  ------------------
  289|       |        // Populate pageobj_to_pages_pos and fix parent pointer. There should be no duplicates at
  290|       |        // this point because pushInheritedAttributesToPage calls getAllPages which resolves
  291|       |        // duplicates.
  292|  3.55k|        insertPageobjToPage(all_pages.at(pos), toI(pos), true);
  293|  3.55k|        all_pages.at(pos).replaceKey("/Parent", pages);
  294|  3.55k|    }
  295|       |
  296|  3.21k|    pages.replaceKey("/Kids", Array(all_pages));
  297|       |    // /Count has not changed
  298|  3.21k|    if (pages.getKey("/Count").getUIntValue() != len) {
  ------------------
  |  Branch (298:9): [True: 1.94k, False: 1.27k]
  ------------------
  299|  1.94k|        if (invalid_page_found && pages.getKey("/Count").getUIntValue() > len) {
  ------------------
  |  Branch (299:13): [True: 1.94k, False: 0]
  |  Branch (299:13): [True: 1.89k, False: 42]
  |  Branch (299:35): [True: 1.89k, False: 42]
  ------------------
  300|  1.89k|            pages.replaceKey("/Count", Integer(len));
  301|  1.89k|        } else {
  302|     42|            throw std::runtime_error("/Count is wrong after flattening pages tree");
  303|     42|        }
  304|  1.94k|    }
  305|  3.21k|}
_ZN4QPDF3Doc5Pages29pushInheritedAttributesToPageEbb:
  316|  3.21k|{
  317|       |    // Traverse pages tree pushing all inherited resources down to the page level.
  318|       |
  319|       |    // The record of whether we've done this is cleared by updateAllPagesCache().  If we're warning
  320|       |    // for skipped keys, re-traverse unconditionally.
  321|  3.21k|    if (pushed_inherited_attributes_to_pages && !warn_skipped_keys) {
  ------------------
  |  Branch (321:9): [True: 0, False: 3.21k]
  |  Branch (321:49): [True: 0, False: 0]
  ------------------
  322|      0|        return;
  323|      0|    }
  324|       |
  325|       |    // Calling cache() resolves any duplicated page objects, repairs broken nodes, and detects
  326|       |    // loops, so we don't have to do those activities here.
  327|  3.21k|    (void)cache();
  328|       |
  329|       |    // key_ancestors is a mapping of page attribute keys to a stack of Pages nodes that contain
  330|       |    // values for them.
  331|  3.21k|    std::map<std::string, std::vector<QPDFObjectHandle>> key_ancestors;
  332|  3.21k|    pushInheritedAttributesToPageInternal(
  333|  3.21k|        m->trailer.getKey("/Root").getKey("/Pages"),
  334|  3.21k|        key_ancestors,
  335|  3.21k|        allow_changes,
  336|  3.21k|        warn_skipped_keys);
  337|  3.21k|    util::assertion(
  338|  3.21k|        key_ancestors.empty(),
  339|  3.21k|        "key_ancestors not empty after pushing inherited attributes to pages");
  340|  3.21k|    pushed_inherited_attributes_to_pages = true;
  341|  3.21k|    ever_pushed_inherited_attributes_to_pages_ = true;
  342|  3.21k|}
_ZN4QPDF3Doc5Pages37pushInheritedAttributesToPageInternalE16QPDFObjectHandleRNSt3__13mapINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS3_6vectorIS2_NS8_IS2_EEEENS3_4lessISA_EENS8_INS3_4pairIKSA_SD_EEEEEEbb:
  350|  5.75k|{
  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|  5.75k|    std::set<std::string> inheritable_keys;
  356|  19.4k|    for (auto const& key: cur_pages.getKeys()) {
  ------------------
  |  Branch (356:25): [True: 19.4k, False: 5.75k]
  ------------------
  357|  19.4k|        if (key == "/MediaBox" || key == "/CropBox" || key == "/Resources" || key == "/Rotate") {
  ------------------
  |  Branch (357:13): [True: 857, False: 18.6k]
  |  Branch (357:35): [True: 186, False: 18.4k]
  |  Branch (357:56): [True: 175, False: 18.2k]
  |  Branch (357:79): [True: 108, False: 18.1k]
  ------------------
  358|  1.32k|            if (!allow_changes) {
  ------------------
  |  Branch (358:17): [True: 0, False: 1.32k]
  ------------------
  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|  1.32k|            inheritable_keys.insert(key);
  370|  1.32k|            auto oh = cur_pages[key];
  371|  1.32k|            QTC::TC("qpdf", "QPDF opt direct pages resource", oh.indirect() ? 0 : 1);
  ------------------
  |  Branch (371:63): [True: 16, False: 1.31k]
  ------------------
  372|  1.32k|            if (!oh.indirect()) {
  ------------------
  |  Branch (372:17): [True: 1.31k, False: 16]
  ------------------
  373|  1.31k|                if (!oh.isScalar()) {
  ------------------
  |  Branch (373:21): [True: 352, False: 958]
  ------------------
  374|       |                    // Replace shared direct object non-scalar resources with indirect objects to
  375|       |                    // avoid copying large structures around.
  376|    352|                    cur_pages.replaceKey(key, qpdf.makeIndirectObject(oh));
  377|    352|                    oh = cur_pages[key];
  378|    958|                } else {
  379|       |                    // It's okay to copy scalars.
  380|    958|                }
  381|  1.31k|            }
  382|  1.32k|            key_ancestors[key].emplace_back(oh);
  383|  1.32k|            if (key_ancestors[key].size() > 1) {
  ------------------
  |  Branch (383:17): [True: 249, False: 1.07k]
  ------------------
  384|    249|            }
  385|       |            // Remove this resource from this node.  It will be reattached at the page level.
  386|  1.32k|            cur_pages.erase(key);
  387|  18.1k|        } else if (!(key == "/Type" || key == "/Parent" || key == "/Kids" || key == "/Count")) {
  ------------------
  |  Branch (387:22): [True: 5.73k, False: 12.4k]
  |  Branch (387:40): [True: 430, False: 11.9k]
  |  Branch (387:60): [True: 5.74k, False: 6.23k]
  |  Branch (387:78): [True: 2.13k, False: 4.10k]
  ------------------
  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|  4.10k|            if (warn_skipped_keys && cur_pages.contains("/Parent")) {
  ------------------
  |  Branch (390:17): [True: 4.10k, False: 0]
  |  Branch (390:17): [True: 1.12k, False: 2.98k]
  |  Branch (390:38): [True: 1.12k, False: 2.98k]
  ------------------
  391|  1.12k|                warn(
  392|  1.12k|                    qpdf_e_pages,
  393|  1.12k|                    "Pages object: object " + cur_pages.id_gen().unparse(' '),
  394|  1.12k|                    cur_pages.offset(),
  395|  1.12k|                    ("Unknown key " + key +
  396|  1.12k|                     " in /Pages object is being discarded as a result of flattening the /Pages "
  397|  1.12k|                     "tree"));
  398|  1.12k|            }
  399|  4.10k|        }
  400|  19.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|  29.2k|    for (auto& kid: Array(cur_pages["/Kids"])) {
  ------------------
  |  Branch (405:19): [True: 29.2k, False: 5.75k]
  ------------------
  406|  29.2k|        if (kid.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (406:13): [True: 2.53k, False: 26.7k]
  ------------------
  407|  2.53k|            pushInheritedAttributesToPageInternal(
  408|  2.53k|                kid, key_ancestors, allow_changes, warn_skipped_keys);
  409|  26.7k|        } else {
  410|       |            // Add all available inheritable attributes not present in this object to this object.
  411|  26.7k|            for (auto const& [key, values]: key_ancestors) {
  ------------------
  |  Branch (411:43): [True: 2.82k, False: 26.7k]
  ------------------
  412|  2.82k|                if (!kid.contains(key)) {
  ------------------
  |  Branch (412:21): [True: 2.72k, False: 109]
  ------------------
  413|  2.72k|                    kid.replaceKey(key, values.back());
  414|  2.72k|                } else {
  415|    109|                    QTC::TC("qpdf", "QPDF opt page resource hides ancestor");
  416|    109|                }
  417|  2.82k|            }
  418|  26.7k|        }
  419|  29.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|  5.75k|    if (!inheritable_keys.empty()) {
  ------------------
  |  Branch (425:9): [True: 911, False: 4.84k]
  ------------------
  426|  1.07k|        for (auto const& key: inheritable_keys) {
  ------------------
  |  Branch (426:29): [True: 1.07k, False: 911]
  ------------------
  427|  1.07k|            key_ancestors[key].pop_back();
  428|  1.07k|            if (key_ancestors[key].empty()) {
  ------------------
  |  Branch (428:17): [True: 838, False: 238]
  ------------------
  429|    838|                key_ancestors.erase(key);
  430|    838|            }
  431|  1.07k|        }
  432|  4.84k|    } else {
  433|  4.84k|        QTC::TC("qpdf", "QPDF opt no inheritable keys");
  434|  4.84k|    }
  435|  5.75k|}
_ZN4QPDF3Doc5Pages19insertPageobjToPageERK16QPDFObjectHandleib:
  439|  3.55k|{
  440|  3.55k|    QPDFObjGen og(obj.getObjGen());
  441|  3.55k|    if (check_duplicate) {
  ------------------
  |  Branch (441:9): [True: 3.55k, False: 0]
  ------------------
  442|  3.55k|        if (!pageobj_to_pages_pos.insert(std::make_pair(og, pos)).second) {
  ------------------
  |  Branch (442:13): [True: 0, False: 3.55k]
  ------------------
  443|       |            // The library never calls insertPageobjToPage in a way that causes this to happen.
  444|      0|            throw QPDFExc(
  445|      0|                qpdf_e_pages,
  446|      0|                m->file->getName(),
  447|      0|                "page " + std::to_string(pos) + " (numbered from zero): object " + og.unparse(' '),
  448|      0|                0,
  449|      0|                "duplicate page reference found; this would cause loss of data");
  450|      0|        }
  451|  3.55k|    } else {
  452|      0|        pageobj_to_pages_pos[og] = pos;
  453|      0|    }
  454|  3.55k|}

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

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

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

_ZN17SF_FlateLzwDecode14setDecodeParmsE16QPDFObjectHandle:
   13|  8.53k|{
   14|  8.53k|    if (decode_parms.null()) {
  ------------------
  |  Branch (14:9): [True: 4.06k, False: 4.46k]
  ------------------
   15|  4.06k|        return true;
   16|  4.06k|    }
   17|       |
   18|  4.46k|    auto memory_limit = Pl_Flate::memory_limit();
   19|       |
   20|  4.46k|    std::set<std::string> keys = decode_parms.getKeys();
   21|  11.8k|    for (auto const& key: keys) {
  ------------------
  |  Branch (21:25): [True: 11.8k, False: 4.33k]
  ------------------
   22|  11.8k|        QPDFObjectHandle value = decode_parms.getKey(key);
   23|  11.8k|        if (key == "/Predictor") {
  ------------------
  |  Branch (23:13): [True: 2.65k, False: 9.19k]
  ------------------
   24|  2.65k|            if (value.isInteger()) {
  ------------------
  |  Branch (24:17): [True: 2.65k, False: 3]
  ------------------
   25|  2.65k|                predictor = value.getIntValueAsInt();
   26|  2.65k|                if (!(predictor == 1 || predictor == 2 || (predictor >= 10 && predictor <= 15))) {
  ------------------
  |  Branch (26:23): [True: 70, False: 2.58k]
  |  Branch (26:41): [True: 815, False: 1.76k]
  |  Branch (26:60): [True: 1.72k, False: 41]
  |  Branch (26:79): [True: 1.69k, False: 31]
  ------------------
   27|     72|                    return false;
   28|     72|                }
   29|  2.65k|            } else {
   30|      3|                return false;
   31|      3|            }
   32|  9.19k|        } else if (key == "/Columns" || key == "/Colors" || key == "/BitsPerComponent") {
  ------------------
  |  Branch (32:20): [True: 1.45k, False: 7.74k]
  |  Branch (32:41): [True: 374, False: 7.37k]
  |  Branch (32:61): [True: 526, False: 6.84k]
  ------------------
   33|  2.35k|            if (value.isInteger()) {
  ------------------
  |  Branch (33:17): [True: 2.34k, False: 3]
  ------------------
   34|  2.34k|                int val = value.getIntValueAsInt();
   35|  2.34k|                if (memory_limit && static_cast<unsigned int>(val) > memory_limit) {
  ------------------
  |  Branch (35:21): [True: 2.34k, False: 1]
  |  Branch (35:37): [True: 12, False: 2.33k]
  ------------------
   36|     12|                    QPDFLogger::defaultLogger()->warn(
   37|     12|                        "SF_FlateLzwDecode parameter exceeds PL_Flate memory limit\n");
   38|     12|                    return false;
   39|     12|                }
   40|  2.33k|                if (key == "/Columns") {
  ------------------
  |  Branch (40:21): [True: 1.44k, False: 896]
  ------------------
   41|  1.44k|                    columns = val;
   42|  1.44k|                } else if (key == "/Colors") {
  ------------------
  |  Branch (42:28): [True: 369, False: 527]
  ------------------
   43|    369|                    colors = val;
   44|    527|                } else if (key == "/BitsPerComponent") {
  ------------------
  |  Branch (44:28): [True: 526, False: 1]
  ------------------
   45|    526|                    bits_per_component = val;
   46|    526|                }
   47|  2.33k|            } else {
   48|      3|                return false;
   49|      3|            }
   50|  6.84k|        } else if (lzw && (key == "/EarlyChange")) {
  ------------------
  |  Branch (50:20): [True: 6.48k, False: 362]
  |  Branch (50:27): [True: 177, False: 6.30k]
  ------------------
   51|    177|            if (value.isInteger()) {
  ------------------
  |  Branch (51:17): [True: 174, False: 3]
  ------------------
   52|    174|                int earlychange = value.getIntValueAsInt();
   53|    174|                early_code_change = (earlychange == 1);
   54|    174|                if (!(earlychange == 0 || earlychange == 1)) {
  ------------------
  |  Branch (54:23): [True: 66, False: 108]
  |  Branch (54:43): [True: 66, False: 42]
  ------------------
   55|     42|                    return false;
   56|     42|                }
   57|    174|            } else {
   58|      3|                return false;
   59|      3|            }
   60|    177|        }
   61|  11.8k|    }
   62|       |
   63|  4.33k|    if (predictor > 1 && columns == 0) {
  ------------------
  |  Branch (63:9): [True: 2.51k, False: 1.81k]
  |  Branch (63:26): [True: 3, False: 2.50k]
  ------------------
   64|      3|        return false;
   65|      3|    }
   66|       |
   67|  4.32k|    return true;
   68|  4.33k|}
_ZN17SF_FlateLzwDecode17getDecodePipelineEP8Pipeline:
   72|  8.37k|{
   73|  8.37k|    std::unique_ptr<Pipeline> pipeline;
   74|  8.37k|    if (predictor >= 10 && predictor <= 15) {
  ------------------
  |  Branch (74:9): [True: 1.69k, False: 6.67k]
  |  Branch (74:28): [True: 1.69k, False: 0]
  ------------------
   75|  1.69k|        QTC::TC("qpdf", "SF_FlateLzwDecode PNG filter");
   76|  1.69k|        pipeline = std::make_unique<Pl_PNGFilter>(
   77|  1.69k|            "png decode",
   78|  1.69k|            next,
   79|  1.69k|            Pl_PNGFilter::a_decode,
   80|  1.69k|            QIntC::to_uint(columns),
   81|  1.69k|            QIntC::to_uint(colors),
   82|  1.69k|            QIntC::to_uint(bits_per_component));
   83|  1.69k|        next = pipeline.get();
   84|  1.69k|        pipelines.push_back(std::move(pipeline));
   85|  6.67k|    } else if (predictor == 2) {
  ------------------
  |  Branch (85:16): [True: 814, False: 5.86k]
  ------------------
   86|    814|        QTC::TC("qpdf", "SF_FlateLzwDecode TIFF predictor");
   87|    814|        pipeline = std::make_unique<Pl_TIFFPredictor>(
   88|    814|            "tiff decode",
   89|    814|            next,
   90|    814|            Pl_TIFFPredictor::a_decode,
   91|    814|            QIntC::to_uint(columns),
   92|    814|            QIntC::to_uint(colors),
   93|    814|            QIntC::to_uint(bits_per_component));
   94|    814|        next = pipeline.get();
   95|    814|        pipelines.push_back(std::move(pipeline));
   96|    814|    }
   97|       |
   98|  8.37k|    if (lzw) {
  ------------------
  |  Branch (98:9): [True: 3.25k, False: 5.11k]
  ------------------
   99|  3.25k|        pipeline = std::make_unique<Pl_LZWDecoder>("lzw decode", next, early_code_change);
  100|  5.11k|    } else {
  101|  5.11k|        pipeline = std::make_unique<Pl_Flate>("stream inflate", next, Pl_Flate::a_inflate);
  102|  5.11k|    }
  103|  8.37k|    next = pipeline.get();
  104|  8.37k|    pipelines.push_back(std::move(pipeline));
  105|  8.37k|    return next;
  106|  8.37k|}

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

_ZN24SecureRandomDataProvider17provideRandomDataEPhm:
   81|    388|{
   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|    388|    static std::unique_ptr<QUtil::FileCloser> random_device = []() {
   93|    388|        FILE* f = fopen("/dev/urandom", "rb");
   94|    388|        if (f == nullptr) {
   95|    388|            f = fopen("/dev/arandom", "rb");
   96|    388|        }
   97|    388|        if (f == nullptr) {
   98|    388|            f = fopen("/dev/random", "rb");
   99|    388|        }
  100|    388|        if (f == nullptr) {
  101|    388|            throw std::runtime_error("unable to find device in /dev for generating random numbers");
  102|    388|        }
  103|    388|        return std::make_unique<QUtil::FileCloser>(f);
  104|    388|    }();
  105|       |
  106|    388|    size_t fr = fread(data, 1, len, random_device->f);
  107|    388|    if (fr != len) {
  ------------------
  |  Branch (107:9): [True: 0, False: 388]
  ------------------
  108|      0|        throw std::runtime_error(
  109|      0|            "unable to read " + std::to_string(len) + " bytes from random number device");
  110|      0|    }
  111|       |
  112|    388|# endif
  113|    388|}
_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|  19.8k|{
   14|  19.8k|    if (value) {
  ------------------
  |  Branch (14:9): [True: 19.8k, False: 0]
  ------------------
   15|  19.8k|        o.fuzz_mode_ = true;
   16|       |        // Limit the memory used to decompress JPEG files during fuzzing. Excessive memory use
   17|       |        // during fuzzing is due to corrupt JPEG data which sometimes cannot be detected before
   18|       |        // jpeg_start_decompress is called. During normal use of qpdf very large JPEGs can
   19|       |        // occasionally occur legitimately and therefore must be allowed during normal operations.
   20|  19.8k|        Limits::dct_max_memory(10'000'000);
   21|  19.8k|        Limits::dct_max_progressive_scans(50);
   22|       |        // Do not decompress corrupt data. This may cause extended runtime within jpeglib without
   23|       |        // exercising additional code paths in qpdf.
   24|  19.8k|        dct_throw_on_corrupt_data(true);
   25|  19.8k|        Limits::png_max_memory(1'000'000);
   26|  19.8k|        Limits::flate_max_memory(200'000);
   27|  19.8k|        Limits::run_length_max_memory(1'000'000);
   28|  19.8k|        Limits::tiff_max_memory(1'000'000);
   29|       |        // Set a reasonable default maximum warnings per document for fuzzing to avoid time-outs due
   30|       |        // to extensive recovery efforts.
   31|  19.8k|        Limits::doc_max_warnings(200);
   32|  19.8k|    }
   33|  19.8k|}
qpdf_global_set_uint32:
  129|  19.8k|{
  130|  19.8k|    switch (param) {
  131|      0|    case qpdf_p_inspection_mode:
  ------------------
  |  Branch (131:5): [True: 0, False: 19.8k]
  ------------------
  132|      0|        Options::inspection_mode(value);
  133|      0|        return qpdf_r_ok;
  134|  19.8k|    case qpdf_p_fuzz_mode:
  ------------------
  |  Branch (134:5): [True: 19.8k, False: 0]
  ------------------
  135|  19.8k|        Options::fuzz_mode(value);
  136|  19.8k|        return qpdf_r_ok;
  137|      0|    case qpdf_p_default_limits:
  ------------------
  |  Branch (137:5): [True: 0, False: 19.8k]
  ------------------
  138|      0|        Options::default_limits(value);
  139|      0|        return qpdf_r_ok;
  140|      0|    case qpdf_p_dct_throw_on_corrupt_data:
  ------------------
  |  Branch (140:5): [True: 0, False: 19.8k]
  ------------------
  141|      0|        Options::dct_throw_on_corrupt_data(value);
  142|      0|        return qpdf_r_ok;
  143|      0|    case qpdf_p_doc_max_warnings:
  ------------------
  |  Branch (143:5): [True: 0, False: 19.8k]
  ------------------
  144|      0|        Limits::doc_max_warnings(value);
  145|      0|        return qpdf_r_ok;
  146|      0|    case qpdf_p_parser_max_nesting:
  ------------------
  |  Branch (146:5): [True: 0, False: 19.8k]
  ------------------
  147|      0|        Limits::parser_max_nesting(value);
  148|      0|        return qpdf_r_ok;
  149|      0|    case qpdf_p_parser_max_errors:
  ------------------
  |  Branch (149:5): [True: 0, False: 19.8k]
  ------------------
  150|      0|        Limits::parser_max_errors(value);
  151|      0|        return qpdf_r_ok;
  152|      0|    case qpdf_p_parser_max_container_size:
  ------------------
  |  Branch (152:5): [True: 0, False: 19.8k]
  ------------------
  153|      0|        Limits::parser_max_container_size(false, value);
  154|      0|        return qpdf_r_ok;
  155|      0|    case qpdf_p_parser_max_container_size_damaged:
  ------------------
  |  Branch (155:5): [True: 0, False: 19.8k]
  ------------------
  156|      0|        Limits::parser_max_container_size(true, value);
  157|      0|        return qpdf_r_ok;
  158|      0|    case qpdf_p_max_stream_filters:
  ------------------
  |  Branch (158:5): [True: 0, False: 19.8k]
  ------------------
  159|      0|        Limits::max_stream_filters(value);
  160|      0|        return qpdf_r_ok;
  161|      0|    case qpdf_p_dct_max_memory:
  ------------------
  |  Branch (161:5): [True: 0, False: 19.8k]
  ------------------
  162|      0|        Limits::dct_max_memory(util::fits<long>(value) ? static_cast<long>(value) : 0);
  ------------------
  |  Branch (162:32): [True: 0, False: 0]
  ------------------
  163|      0|        return qpdf_r_ok;
  164|      0|    case qpdf_p_dct_max_progressive_scans:
  ------------------
  |  Branch (164:5): [True: 0, False: 19.8k]
  ------------------
  165|      0|        Limits::dct_max_progressive_scans(util::fits<int>(value) ? static_cast<int>(value) : 0);
  ------------------
  |  Branch (165:43): [True: 0, False: 0]
  ------------------
  166|      0|        return qpdf_r_ok;
  167|      0|    case qpdf_p_flate_max_memory:
  ------------------
  |  Branch (167:5): [True: 0, False: 19.8k]
  ------------------
  168|      0|        Limits::flate_max_memory(value);
  169|      0|        return qpdf_r_ok;
  170|      0|    case qpdf_p_png_max_memory:
  ------------------
  |  Branch (170:5): [True: 0, False: 19.8k]
  ------------------
  171|      0|        Limits::png_max_memory(value);
  172|      0|        return qpdf_r_ok;
  173|      0|    case qpdf_p_run_length_max_memory:
  ------------------
  |  Branch (173:5): [True: 0, False: 19.8k]
  ------------------
  174|      0|        Limits::run_length_max_memory(value);
  175|      0|        return qpdf_r_ok;
  176|      0|    case qpdf_p_tiff_max_memory:
  ------------------
  |  Branch (176:5): [True: 0, False: 19.8k]
  ------------------
  177|      0|        Limits::tiff_max_memory(value);
  178|      0|        return qpdf_r_ok;
  179|      0|    default:
  ------------------
  |  Branch (179:5): [True: 0, False: 19.8k]
  ------------------
  180|      0|        return qpdf_r_bad_parameter;
  181|  19.8k|    }
  182|  19.8k|}

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

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

_ZN4qpdf2is12OffsetBufferD2Ev:
   42|  16.9k|        ~OffsetBuffer() final = default;
_ZN4qpdf2is12OffsetBuffer4tellEv:
   54|  1.06M|        {
   55|  1.06M|            return pos + global_offset;
   56|  1.06M|        }
_ZN4qpdf2is12OffsetBufferC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_17basic_string_viewIcS5_EEx:
   21|  17.0k|            description(description),
   22|  17.0k|            view_(view),
   23|  17.0k|            global_offset(global_offset)
   24|  17.0k|        {
   25|  17.0k|            if (global_offset < 0) {
  ------------------
  |  Branch (25:17): [True: 54, False: 16.9k]
  ------------------
   26|     54|                throw std::logic_error("is::OffsetBuffer constructed with negative offset");
   27|     54|            }
   28|  16.9k|            last_offset = global_offset;
   29|  16.9k|        }
_ZN11InputSource4readERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   87|  21.0k|{
   88|  21.0k|    if (at >= 0) {
  ------------------
  |  Branch (88:9): [True: 10.0k, False: 10.9k]
  ------------------
   89|       |        seek(at, SEEK_SET);
   90|  10.0k|    }
   91|  21.0k|    str.resize(count);
   92|  21.0k|    str.resize(read(str.data(), count));
   93|  21.0k|    return str.size();
   94|  21.0k|}
_ZN11InputSource4readEmx:
   98|  10.0k|{
   99|  10.0k|    std::string result(count, '\0');
  100|  10.0k|    (void)read(result, count, at);
  101|  10.0k|    return result;
  102|  10.0k|}
_ZN11InputSource10loadBufferEv:
  106|  3.04M|{
  107|  3.04M|    buf_idx = 0;
  108|  3.04M|    buf_len = qpdf_offset_t(read(buffer, buf_size));
  109|       |    // NB read sets last_offset
  110|  3.04M|    buf_start = last_offset;
  111|  3.04M|}
_ZN11InputSource8fastTellEv:
  115|  10.5M|{
  116|  10.5M|    if (buf_len == 0) {
  ------------------
  |  Branch (116:9): [True: 62.7k, False: 10.5M]
  ------------------
  117|  62.7k|        loadBuffer();
  118|  10.5M|    } else {
  119|  10.5M|        auto curr = tell();
  120|  10.5M|        if (curr < buf_start || curr >= (buf_start + buf_len)) {
  ------------------
  |  Branch (120:13): [True: 49.5k, False: 10.4M]
  |  Branch (120:33): [True: 2.93M, False: 7.52M]
  ------------------
  121|  2.98M|            loadBuffer();
  122|  7.52M|        } else {
  123|  7.52M|            last_offset = curr;
  124|  7.52M|            buf_idx = curr - buf_start;
  125|  7.52M|        }
  126|  10.5M|    }
  127|  10.5M|    return last_offset;
  128|  10.5M|}
_ZN11InputSource8fastReadERc:
  132|   368M|{
  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|   368M|    if (buf_idx < buf_len) {
  ------------------
  |  Branch (135:9): [True: 366M, False: 2.80M]
  ------------------
  136|   366M|        ch = buffer[buf_idx];
  137|   366M|        ++(buf_idx);
  138|   366M|        ++(last_offset);
  139|   366M|        return true;
  140|       |
  141|   366M|    } else if (buf_len == 0) {
  ------------------
  |  Branch (141:16): [True: 34.6k, False: 2.76M]
  ------------------
  142|  34.6k|        return false;
  143|  2.76M|    } else {
  144|       |        seek(buf_start + buf_len, SEEK_SET);
  145|  2.76M|        fastTell();
  146|  2.76M|        return fastRead(ch);
  147|  2.76M|    }
  148|   368M|}
_ZN11InputSource10fastUnreadEb:
  152|  7.80M|{
  153|  7.80M|    last_offset -= back ? 1 : 0;
  ------------------
  |  Branch (153:20): [True: 6.87M, False: 935k]
  ------------------
  154|       |    seek(last_offset, SEEK_SET);
  155|  7.80M|}

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

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

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

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

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

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

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

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

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

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

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

_ZNK4qpdf10BaseHandle13raw_type_codeEv:
  933|  7.36M|    {
  934|  7.36M|        return obj ? static_cast<qpdf_object_type_e>(obj->value.index()) : ::ot_uninitialized;
  ------------------
  |  Branch (934:16): [True: 7.36M, False: 0]
  ------------------
  935|  7.36M|    }
_ZNK4qpdf10BaseHandle4qpdfEv:
  927|   203k|    {
  928|   203k|        return obj ? obj->qpdf : nullptr;
  ------------------
  |  Branch (928:16): [True: 203k, False: 0]
  ------------------
  929|   203k|    }
_ZNK4qpdf10BaseHandle6offsetEv:
  921|  26.0k|    {
  922|  26.0k|        return obj ? obj->parsed_offset : -1;
  ------------------
  |  Branch (922:16): [True: 26.0k, False: 0]
  ------------------
  923|  26.0k|    }
_ZNK4qpdf10BaseHandle9type_codeEv:
  951|  1.82M|    {
  952|  1.82M|        if (!obj) {
  ------------------
  |  Branch (952:13): [True: 66.2k, False: 1.76M]
  ------------------
  953|  66.2k|            return ::ot_uninitialized;
  954|  66.2k|        }
  955|  1.76M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (955:13): [True: 132k, False: 1.62M]
  ------------------
  956|   132k|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  957|   132k|        }
  958|  1.62M|        if (raw_type_code() == ::ot_reference) {
  ------------------
  |  Branch (958:13): [True: 0, False: 1.62M]
  ------------------
  959|      0|            return std::get<QPDF_Reference>(obj->value).obj->getTypeCode();
  960|      0|        }
  961|  1.62M|        return raw_type_code();
  962|  1.62M|    }
_ZNK4qpdf10BaseHandle8indirectEv:
  860|   643k|    {
  861|   643k|        return obj ? obj->og.isIndirect() : false;
  ------------------
  |  Branch (861:16): [True: 642k, False: 394]
  ------------------
  862|   643k|    }
_ZNK4qpdf10BaseHandle4nullEv:
  907|   214k|    {
  908|   214k|        return !obj || type_code() == ::ot_null;
  ------------------
  |  Branch (908:16): [True: 47.4k, False: 167k]
  |  Branch (908:24): [True: 49.1k, False: 118k]
  ------------------
  909|   214k|    }
_ZN4qpdf5ArrayC2ERK16QPDFObjectHandle:
   57|   214k|            BaseHandle(oh.resolved_type_code() == ::ot_array ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (57:24): [True: 180k, False: 33.6k]
  ------------------
   58|   214k|        {
   59|   214k|        }
_ZNK4qpdf10BaseHandle18resolved_type_codeEv:
  939|   593k|    {
  940|   593k|        if (!obj) {
  ------------------
  |  Branch (940:13): [True: 31.4k, False: 561k]
  ------------------
  941|  31.4k|            return ::ot_uninitialized;
  942|  31.4k|        }
  943|   561k|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (943:13): [True: 697, False: 561k]
  ------------------
  944|    697|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  945|    697|        }
  946|   561k|        return raw_type_code();
  947|   561k|    }
_ZN4qpdf10BaseHandleC2ERK16QPDFObjectHandle:
  788|   784k|        obj(oh.obj)
  789|   784k|    {
  790|   784k|    }
_ZN4qpdf10DictionaryC2ERK16QPDFObjectHandle:
  268|   121k|            BaseDictionary(oh)
  269|   121k|        {
  270|   121k|        }
_ZN4qpdf14BaseDictionaryC2ERK16QPDFObjectHandle:
  238|   121k|            BaseHandle(oh.resolved_type_code() == ::ot_dictionary ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (238:24): [True: 114k, False: 7.42k]
  ------------------
  239|   121k|        {
  240|   121k|        }
_ZN4qpdf14BaseDictionary5beginEv:
  141|  1.60k|        {
  142|  1.60k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (142:22): [True: 1.21k, False: 390]
  ------------------
  143|  1.21k|                return d->items.begin();
  144|  1.21k|            }
  145|    390|            return {};
  146|  1.60k|        }
_ZNK4qpdf10BaseHandle2asI15QPDF_DictionaryEEPT_v:
  770|   690k|    {
  771|   690k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 8.09k, False: 682k]
  ------------------
  772|  8.09k|            return nullptr;
  773|  8.09k|        }
  774|   682k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 675k, False: 6.31k]
  ------------------
  775|   675k|            return &std::get<T>(obj->value);
  776|   675k|        }
  777|  6.31k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 458, False: 5.86k]
  ------------------
  778|    458|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|    458|        }
  780|  5.86k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 5.86k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  5.86k|        return nullptr;
  785|  5.86k|    }
_ZN4qpdf14BaseDictionary3endEv:
  150|  1.60k|        {
  151|  1.60k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (151:22): [True: 1.21k, False: 389]
  ------------------
  152|  1.21k|                return d->items.end();
  153|  1.21k|            }
  154|    389|            return {};
  155|  1.60k|        }
_ZNK4qpdf10BaseHandle6id_genEv:
  854|  12.6k|    {
  855|  12.6k|        return obj ? obj->og : QPDFObjGen();
  ------------------
  |  Branch (855:16): [True: 12.6k, False: 0]
  ------------------
  856|  12.6k|    }
_ZNK4qpdf6Stream7getDictEv:
  554|  46.1k|        {
  555|  46.1k|            return {stream()->stream_dict};
  556|  46.1k|        }
_ZNK4qpdf6Stream6streamEv:
  697|  99.8k|        {
  698|  99.8k|            if (auto s = as<QPDF_Stream>()) {
  ------------------
  |  Branch (698:22): [True: 99.8k, False: 0]
  ------------------
  699|  99.8k|                if (auto ptr = s->m.get()) {
  ------------------
  |  Branch (699:26): [True: 99.8k, False: 5]
  ------------------
  700|  99.8k|                    return ptr;
  701|  99.8k|                }
  702|      5|                throw std::logic_error("QPDF_Stream: unexpected nullptr");
  703|  99.8k|            }
  704|      0|            throw std::runtime_error("operation for stream attempted on non-stream object");
  705|      0|            return nullptr; // unreachable
  706|  99.8k|        }
_ZNK4qpdf10BaseHandle2asI11QPDF_StreamEEPT_v:
  770|  99.8k|    {
  771|  99.8k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 99.8k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  99.8k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 99.8k, False: 0]
  ------------------
  775|  99.8k|            return &std::get<T>(obj->value);
  776|  99.8k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZN4qpdf7IntegerC2ERK16QPDFObjectHandle:
  319|   345k|            BaseHandle(oh.type_code() == ::ot_integer ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (319:24): [True: 94.0k, False: 251k]
  ------------------
  320|   345k|        {
  321|   345k|        }
_ZNK4qpdf7IntegercvbEv:
  330|   151k|        {
  331|   151k|            return obj != nullptr;
  332|   151k|        }
_ZN4qpdfeqERKNS_4NameENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  473|  94.5k|        {
  474|  94.5k|            return lhs && lhs.value() == rhs;
  ------------------
  |  Branch (474:20): [True: 59.2k, False: 35.3k]
  |  Branch (474:27): [True: 32.2k, False: 26.9k]
  ------------------
  475|  94.5k|        }
_ZN4qpdf4NameC2ERK16QPDFObjectHandle:
  449|   103k|            BaseHandle(oh.type_code() == ::ot_name ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (449:24): [True: 65.2k, False: 38.1k]
  ------------------
  450|   103k|        {
  451|   103k|        }
_ZNK4qpdf10BaseHandle2ohEv:
  805|  12.9k|    {
  806|  12.9k|        return {obj};
  807|  12.9k|    }
_ZN10QPDFObject6createI9QPDF_NullJEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|   312k|{
  989|   312k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   312k|}
_ZNK4qpdf7Integer5valueITkNSt3__18integralEiEET_v:
  361|  47.1k|        {
  362|  47.1k|            try {
  363|  47.1k|                return static_cast<T>(*this);
  364|  47.1k|            } catch (std::underflow_error&) {
  365|    104|                if constexpr (std::is_same_v<T, int>) {
  366|    104|                    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|    104|                return std::numeric_limits<T>::min();
  377|    104|            } catch (std::overflow_error&) {
  378|     37|                if constexpr (std::is_same_v<T, int>) {
  379|     37|                    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|     37|                return std::numeric_limits<T>::max();
  388|     37|            }
  389|  47.1k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEiEEv:
  339|  47.1k|        {
  340|  47.1k|            auto v = value();
  341|       |
  342|  47.1k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 37, False: 47.0k]
  ------------------
  343|     37|                throw std::overflow_error("Integer conversion overflow");
  344|     37|            }
  345|  47.0k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 104, False: 46.9k]
  ------------------
  346|    104|                throw std::underflow_error("Integer conversion underflow");
  347|    104|            }
  348|  46.9k|            return static_cast<T>(v);
  349|  47.0k|        }
_ZN4qpdf5ArrayaSERKS0_:
   36|  6.30k|        {
   37|  6.30k|            if (obj != other.obj) {
  ------------------
  |  Branch (37:17): [True: 6.30k, False: 0]
  ------------------
   38|  6.30k|                obj = other.obj;
   39|  6.30k|            }
   40|  6.30k|            return *this;
   41|  6.30k|        }
_ZN4qpdf5ArrayC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
   47|  21.4k|            BaseHandle(obj)
   48|  21.4k|        {
   49|  21.4k|        }
_ZN4qpdf5ArrayC2EONSt3__110shared_ptrI10QPDFObjectEE:
   52|  6.13k|            BaseHandle(std::move(obj))
   53|  6.13k|        {
   54|  6.13k|        }
_ZN4qpdf5ArrayaSERK16QPDFObjectHandle:
   63|  28.1k|        {
   64|  28.1k|            assign(::ot_array, oh);
   65|  28.1k|            return *this;
   66|  28.1k|        }
_ZN4qpdf5ArrayC2EO16QPDFObjectHandle:
   69|      3|            BaseHandle(oh.resolved_type_code() == ::ot_array ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (69:24): [True: 0, False: 3]
  ------------------
   70|      3|        {
   71|      3|        }
_ZN4qpdf14BaseDictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  220|    823|            BaseHandle(QPDFObject::create<QPDF_Dictionary>(std::move(dict)))
  221|    823|        {
  222|    823|        }
_ZN4qpdf14BaseDictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  225|  42.8k|            BaseHandle(obj)
  226|  42.8k|        {
  227|  42.8k|        }
_ZN4qpdf14BaseDictionaryC2EO16QPDFObjectHandle:
  243|  3.42k|            BaseHandle(
  244|  3.42k|                oh.resolved_type_code() == ::ot_dictionary ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (244:17): [True: 2.06k, False: 1.36k]
  ------------------
  245|  3.42k|        {
  246|  3.42k|        }
_ZN4qpdf10DictionaryaSERK16QPDFObjectHandle:
  274|  22.3k|        {
  275|  22.3k|            assign(::ot_dictionary, oh);
  276|  22.3k|            return *this;
  277|  22.3k|        }
_ZN4qpdf10DictionaryC2EO16QPDFObjectHandle:
  280|  3.42k|            BaseDictionary(std::move(oh))
  281|  3.42k|        {
  282|  3.42k|        }
_ZN4qpdf10DictionaryaSEO16QPDFObjectHandle:
  286|    319|        {
  287|    319|            assign(::ot_dictionary, std::move(oh));
  288|    319|            return *this;
  289|    319|        }
_ZNKR4qpdf4NamecvNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEv:
  461|  8.61k|        {
  462|  8.61k|            return value();
  463|  8.61k|        }
_ZN4qpdf4NullC2Ev:
  483|      2|            BaseHandle(QPDFObject::create<QPDF_Null>())
  484|      2|        {
  485|      2|        }
_ZN4qpdf6StreamC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  515|  51.2k|            BaseHandle(obj)
  516|  51.2k|        {
  517|  51.2k|        }
_ZN4qpdf6StreamC2EONSt3__110shared_ptrI10QPDFObjectEE:
  520|  30.2k|            BaseHandle(std::move(obj))
  521|  30.2k|        {
  522|  30.2k|        }
_ZN4qpdf6StreamC2EO16QPDFObjectHandle:
  537|  43.9k|            BaseHandle(oh.type_code() == ::ot_stream ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (537:24): [True: 2.73k, False: 41.2k]
  ------------------
  538|  43.9k|        {
  539|  43.9k|        }
_ZNK4qpdf6Stream4TypeEv:
  601|  20.9k|        {
  602|  20.9k|            return {getDict()["/Type"]};
  603|  20.9k|        }
_ZN4qpdf6StringC2EO16QPDFObjectHandle:
  737|   353k|            BaseHandle(oh.type_code() == ::ot_string ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (737:24): [True: 353k, False: 0]
  ------------------
  738|   353k|        {
  739|   353k|        }
_ZNK4qpdf10BaseHandle6obj_spEv:
  799|  72.1k|    {
  800|  72.1k|        return obj;
  801|  72.1k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eRKS0_:
  838|  50.5k|    {
  839|  50.5k|        if (obj != other.obj) {
  ------------------
  |  Branch (839:13): [True: 22.0k, False: 28.4k]
  ------------------
  840|  22.0k|            obj = other.resolved_type_code() == required ? other.obj : nullptr;
  ------------------
  |  Branch (840:19): [True: 19.7k, False: 2.32k]
  ------------------
  841|  22.0k|        }
  842|  50.5k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eOS0_:
  846|    319|    {
  847|    319|        if (obj != other.obj) {
  ------------------
  |  Branch (847:13): [True: 0, False: 319]
  ------------------
  848|      0|            obj = other.resolved_type_code() == required ? std::move(other.obj) : nullptr;
  ------------------
  |  Branch (848:19): [True: 0, False: 0]
  ------------------
  849|      0|        }
  850|    319|    }
_ZNK4qpdf10BaseHandle3getERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  901|   246k|    {
  902|   246k|        return (*this)[key];
  903|   246k|    }
_ZN9QPDF_Null6createENSt3__110shared_ptrI10QPDFObjectEERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS6_NS0_9allocatorIcEEEE:
  974|  71.6k|{
  975|  71.6k|    auto n = QPDFObject::create<QPDF_Null>();
  976|  71.6k|    n->setChildDescription(parent->getQPDF(), parent, static_descr, var_descr);
  977|  71.6k|    return n;
  978|  71.6k|}
_ZNK16QPDFObjectHandle8as_arrayEN4qpdf5typedE:
 1006|  24.2k|{
 1007|  24.2k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1007:9): [True: 0, False: 24.2k]
  ------------------
 1008|      0|        assertType("array", false);
 1009|      0|    }
 1010|  24.2k|    if (options & qpdf::any_flag || type_code() == ::ot_array ||
  ------------------
  |  Branch (1010:9): [True: 8.57k, False: 15.6k]
  |  Branch (1010:37): [True: 9.52k, False: 6.13k]
  ------------------
 1011|  18.1k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1011:10): [True: 0, False: 6.13k]
  |  Branch (1011:38): [True: 0, False: 0]
  ------------------
 1012|  18.1k|        return qpdf::Array(obj);
 1013|  18.1k|    }
 1014|  6.13k|    return qpdf::Array(std::shared_ptr<QPDFObject>());
 1015|  24.2k|}
_ZNK16QPDFObjectHandle13as_dictionaryEN4qpdf5typedE:
 1019|  42.8k|{
 1020|  42.8k|    if (options & qpdf::any_flag || type_code() == ::ot_dictionary ||
  ------------------
  |  Branch (1020:9): [True: 1.00k, False: 41.8k]
  |  Branch (1020:37): [True: 39.6k, False: 2.17k]
  ------------------
 1021|  40.7k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1021:10): [True: 0, False: 2.17k]
  |  Branch (1021:38): [True: 0, False: 0]
  ------------------
 1022|  40.7k|        return qpdf::Dictionary(obj);
 1023|  40.7k|    }
 1024|  2.17k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1024:9): [True: 0, False: 2.17k]
  ------------------
 1025|      0|        assertType("dictionary", false);
 1026|      0|    }
 1027|  2.17k|    return qpdf::Dictionary(std::shared_ptr<QPDFObject>());
 1028|  42.8k|}
_ZNK16QPDFObjectHandle9as_streamEN4qpdf5typedE:
 1032|  84.7k|{
 1033|  84.7k|    if (options & qpdf::any_flag || type_code() == ::ot_stream ||
  ------------------
  |  Branch (1033:9): [True: 0, False: 84.7k]
  |  Branch (1033:37): [True: 54.5k, False: 30.2k]
  ------------------
 1034|  51.2k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1034:10): [True: 0, False: 30.2k]
  |  Branch (1034:38): [True: 0, False: 0]
  ------------------
 1035|  51.2k|        return qpdf::Stream(obj);
 1036|  51.2k|    }
 1037|  33.5k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1037:9): [True: 0, False: 33.5k]
  ------------------
 1038|      0|        assertType("stream", false);
 1039|      0|    }
 1040|  33.5k|    return qpdf::Stream(std::shared_ptr<QPDFObject>());
 1041|  84.7k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRKNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  5.84k|{
  989|  5.84k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  5.84k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   109k|{
  989|   109k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   109k|}
_ZN4qpdf10BaseHandleC2EO16QPDFObjectHandle:
  793|   396k|        obj(std::move(oh.obj))
  794|   396k|    {
  795|   396k|    }
_ZN4qpdf10DictionaryC2Ev:
  256|  24.4k|        Dictionary() = default;
_ZN4qpdf14BaseDictionaryC2Ev:
  212|  24.4k|        BaseDictionary() = default;
_ZN4qpdf10DictionaryC2ERKS0_:
  262|  57.8k|        Dictionary(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryC2ERKS0_:
  232|  57.8k|        BaseDictionary(BaseDictionary const&) = default;
_ZN10QPDFObject6createI9QPDF_BoolJRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|     22|{
  989|     22|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|     22|}
_ZN10QPDFObject6createI12QPDF_IntegerJRxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|   911k|{
  989|   911k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   911k|}
_ZN10QPDFObject6createI9QPDF_RealJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    896|{
  989|    896|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    896|}
_ZN10QPDFObject6createI11QPDF_StringJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  53.4k|{
  989|  53.4k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  53.4k|}
_ZN10QPDFObject6createI9QPDF_NameJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    644|{
  989|    644|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    644|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEbEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    903|{
  989|    903|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    903|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  1.07k|{
  989|  1.07k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  1.07k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_BoolEEPT_v:
  770|      2|    {
  771|      2|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 2]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|      2|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 2, False: 0]
  ------------------
  775|      2|            return &std::get<T>(obj->value);
  776|      2|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZNK4qpdf10BaseHandle2asI12QPDF_IntegerEEPT_v:
  770|  95.8k|    {
  771|  95.8k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 1.74k, False: 94.0k]
  ------------------
  772|  1.74k|            return nullptr;
  773|  1.74k|        }
  774|  94.0k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 94.0k, False: 0]
  ------------------
  775|  94.0k|            return &std::get<T>(obj->value);
  776|  94.0k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralExEEv:
  339|  26.9k|        {
  340|  26.9k|            auto v = value();
  341|       |
  342|  26.9k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 26.9k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  26.9k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 0, False: 26.9k]
  ------------------
  346|      0|                throw std::underflow_error("Integer conversion underflow");
  347|      0|            }
  348|  26.9k|            return static_cast<T>(v);
  349|  26.9k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEyEET_v:
  361|  12.2k|        {
  362|  12.2k|            try {
  363|  12.2k|                return static_cast<T>(*this);
  364|  12.2k|            } catch (std::underflow_error&) {
  365|       |                if constexpr (std::is_same_v<T, int>) {
  366|       |                    warn("requested value of integer is too small; returning INT_MIN");
  367|       |                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|       |                    warn("unsigned integer value request for negative number; returning 0");
  369|    167|                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|    167|                    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|    167|                return std::numeric_limits<T>::min();
  377|    167|            } 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|  12.2k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEyEEv:
  339|  12.2k|        {
  340|  12.2k|            auto v = value();
  341|       |
  342|  12.2k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 12.2k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  12.2k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 167, False: 12.0k]
  ------------------
  346|    167|                throw std::underflow_error("Integer conversion underflow");
  347|    167|            }
  348|  12.0k|            return static_cast<T>(v);
  349|  12.2k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEjEET_v:
  361|  9.42k|        {
  362|  9.42k|            try {
  363|  9.42k|                return static_cast<T>(*this);
  364|  9.42k|            } 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|    147|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|    147|                    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|    147|                return std::numeric_limits<T>::min();
  377|    147|            } 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|    105|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|    105|                    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|    105|                return std::numeric_limits<T>::max();
  388|    105|            }
  389|  9.42k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEjEEv:
  339|  9.42k|        {
  340|  9.42k|            auto v = value();
  341|       |
  342|  9.42k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 105, False: 9.32k]
  ------------------
  343|    105|                throw std::overflow_error("Integer conversion overflow");
  344|    105|            }
  345|  9.32k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 147, False: 9.17k]
  ------------------
  346|    147|                throw std::underflow_error("Integer conversion underflow");
  347|    147|            }
  348|  9.17k|            return static_cast<T>(v);
  349|  9.32k|        }
_ZN10QPDFObject6createI9QPDF_NameJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  2.73M|{
  989|  2.73M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  2.73M|}
_ZN10QPDFObject6createI9QPDF_NameJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  11.5k|{
  989|  11.5k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  11.5k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_NameEEPT_v:
  770|  73.6k|    {
  771|  73.6k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 73.6k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  73.6k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 73.6k, False: 0]
  ------------------
  775|  73.6k|            return &std::get<T>(obj->value);
  776|  73.6k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZN10QPDFObject6createI11QPDF_StringJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  84.1k|{
  989|  84.1k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  84.1k|}
_ZN10QPDFObject6createI11QPDF_StringJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    750|{
  989|    750|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    750|}
_ZNK4qpdf10BaseHandle2asI11QPDF_StringEEPT_v:
  770|   353k|    {
  771|   353k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 353k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   353k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 353k, False: 0]
  ------------------
  775|   353k|            return &std::get<T>(obj->value);
  776|   353k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZN10QPDFObject6createI9QPDF_RealJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  45.6k|{
  989|  45.6k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  45.6k|}
_ZN10QPDFObject6createI9QPDF_RealJRdRiRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  15.8k|{
  989|  15.8k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  15.8k|}
_ZN9QPDF_RealC2Edib:
  981|  15.8k|    val(QUtil::double_to_string(value, decimal_places, trim_trailing_zeroes))
  982|  15.8k|{
  983|  15.8k|}
_ZN10QPDFObject6createI10QPDF_ArrayJRKNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  6.99k|{
  989|  6.99k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  6.99k|}
_ZN15QPDF_DictionaryC2EONSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
  967|   109k|    items(std::move(items))
  968|   109k|{
  969|   109k|}
_ZN10QPDFObject6createI9QPDF_BoolJbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  3.50k|{
  989|  3.50k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  3.50k|}
_ZN10QPDFObject6createI12QPDF_IntegerJxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  8.58k|{
  989|  8.58k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  8.58k|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  57.7k|{
  989|  57.7k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  57.7k|}
_ZNK4qpdf10BaseHandle2asI10QPDF_ArrayEEPT_v:
  770|   595k|    {
  771|   595k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 55.1k, False: 540k]
  ------------------
  772|  55.1k|            return nullptr;
  773|  55.1k|        }
  774|   540k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 536k, False: 3.61k]
  ------------------
  775|   536k|            return &std::get<T>(obj->value);
  776|   536k|        }
  777|  3.61k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 3.61k]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|  3.61k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 3.61k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  3.61k|        return nullptr;
  785|  3.61k|    }
_ZN4qpdf7IntegerC2ITkNSt3__18integralEmEET_:
  307|  1.89k|            Integer(static_cast<long long>(value))
  308|  1.89k|        {
  309|       |            if constexpr (std::cmp_greater(
  310|       |                              std::numeric_limits<decltype(value)>::max(),
  311|  1.89k|                              std::numeric_limits<long long>::max())) {
  312|  1.89k|                if (std::cmp_greater(value, std::numeric_limits<long long>::max())) {
  ------------------
  |  Branch (312:21): [True: 0, False: 1.89k]
  ------------------
  313|      0|                    throw std::overflow_error("overflow constructing Integer");
  314|      0|                }
  315|  1.89k|            }
  316|  1.89k|        }
_ZN4qpdf10DictionaryC2EOS0_:
  264|  3.71k|        Dictionary(Dictionary&&) = default;
_ZN4qpdf14BaseDictionaryC2EOS0_:
  234|  3.71k|        BaseDictionary(BaseDictionary&&) = default;
_ZN4qpdf10DictionaryaSERKS0_:
  263|  5.79k|        Dictionary& operator=(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryaSERKS0_:
  233|  5.79k|        BaseDictionary& operator=(BaseDictionary const&) = default;
_ZN4qpdf5ArrayC2Ev:
   21|  6.30k|        Array() = default;

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

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

_ZNK4qpdf9Tokenizer7getTypeEv:
   64|  6.37M|        {
   65|  6.37M|            return this->type;
   66|  6.37M|        }
_ZNK4qpdf9Tokenizer8getValueEv:
   69|  5.17M|        {
   70|  5.17M|            return (this->type == QPDFTokenizer::tt_name || this->type == QPDFTokenizer::tt_string)
  ------------------
  |  Branch (70:21): [True: 3.11M, False: 2.05M]
  |  Branch (70:61): [True: 120k, False: 1.93M]
  ------------------
   71|  5.17M|                ? this->val
   72|  5.17M|                : this->raw_val;
   73|  5.17M|        }
_ZNK4qpdf9Tokenizer15getErrorMessageEv:
   81|  39.9k|        {
   82|  39.9k|            return this->error_message;
   83|  39.9k|        }

_ZN4QPDF3DocC2ERS_PNS_7MembersE:
  351|  19.8k|        qpdf(qpdf),
  352|  19.8k|        m(m)
  353|  19.8k|    {
  354|  19.8k|    }
_ZN4qpdf3Doc6ConfigC2Ev:
   43|  19.8k|                log_(QPDFLogger::defaultLogger())
   44|  19.8k|            {
   45|  19.8k|            }
_ZN4QPDF3Doc6CommonC2ERS_PNS_7MembersE:
 1285|  79.5k|    qpdf(qpdf),
 1286|  79.5k|    m(m),
 1287|  79.5k|    cf(m->cf),
 1288|  79.5k|    pages(m->pages),
 1289|  79.5k|    objects(m->objects)
 1290|  79.5k|{
 1291|  79.5k|}
_ZN4QPDF3Doc13LinearizationC2ERS0_:
  601|  19.8k|        Common(doc)
  602|  19.8k|    {
  603|  19.8k|    }
_ZN4QPDF3Doc6CommonC2ERS0_:
 1294|  59.6k|    Common(doc.qpdf, doc.m)
 1295|  59.6k|{
 1296|  59.6k|}
_ZN4QPDF3Doc7ObjectsC2ERS0_:
  995|  19.8k|        Common(doc),
  996|  19.8k|        foreign_(*this),
  997|  19.8k|        streams_(*this)
  998|  19.8k|    {
  999|  19.8k|    }
_ZN4QPDF3Doc7Objects7ForeignC2ERNS0_6CommonE:
  910|  19.8k|            Common(common)
  911|  19.8k|        {
  912|  19.8k|        }
_ZN4QPDF3Doc7Objects7ForeignD2Ev:
  919|  19.8k|        ~Foreign() = default;
_ZN4QPDF3Doc5PagesC2ERS0_:
 1138|  19.8k|        Common(doc)
 1139|  19.8k|    {
 1140|  19.8k|    }
_ZN4QPDF3Doc5PagesD2Ev:
 1135|  19.8k|    ~Pages() = default;
_ZN4QPDF3Doc7ObjectsD2Ev:
  992|  19.8k|    ~Objects() = default;
_ZN4QPDF3Doc7Objects7StreamsD2Ev:
  948|  19.8k|        ~Streams() = default;
_ZN4QPDF3Doc13LinearizationD2Ev:
  598|  19.8k|    ~Linearization() = default;
_ZN4QPDF3DocD2Ev:
  348|  19.8k|    ~Doc() = default;
_ZN4qpdf3Doc6Config12max_warningsEm:
  107|  1.87k|            {
  108|  1.87k|                max_warnings_ = val;
  109|  1.87k|                return *this;
  110|  1.87k|            }
_ZNK4qpdf3Doc6Config3logEv:
   75|   618k|            {
   76|   618k|                return log_;
   77|   618k|            }
_ZNK4qpdf3Doc6Config12max_warningsEv:
  101|  1.28M|            {
  102|  1.28M|                return max_warnings_;
  103|  1.28M|            }
_ZNK4qpdf3Doc6Config17suppress_warningsEv:
   88|   618k|            {
   89|   618k|                return suppress_warnings_;
   90|   618k|            }
_ZN4QPDF3docEv:
 1324|  2.29k|{
 1325|  2.29k|    return *m;
 1326|  2.29k|}
_ZN4QPDF3Doc8Resolver8resolvedEPS_10QPDFObjGen:
 1279|   133k|    {
 1280|   133k|        return qpdf->m->objects.resolve(og);
 1281|   133k|    }
_ZNK4QPDF3Doc7Objects12root_checkedEv:
 1027|  12.9k|    {
 1028|  12.9k|        return root_checked_;
 1029|  12.9k|    }
_ZN4QPDF3Doc7Objects12root_checkedEb:
 1033|  4.33k|    {
 1034|  4.33k|        root_checked_ = val;
 1035|  4.33k|    }
_ZN4QPDF20EncryptionParametersC2Ev:
  191|  19.8k|    EncryptionParameters() = default;
_ZN4QPDF7MembersD2Ev:
 1238|  19.8k|    ~Members() = default;
_ZN4QPDF15StringDecrypter13decryptStringERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  240|  51.6k|    {
  241|  51.6k|        qpdf->decryptString(val, og);
  242|  51.6k|    }
_ZNK4qpdf3Doc6Config19password_is_hex_keyEv:
   49|  1.10k|            {
   50|  1.10k|                return password_is_hex_key_;
   51|  1.10k|            }
_ZNK4qpdf3Doc6Config19ignore_xref_streamsEv:
   62|  10.6k|            {
   63|  10.6k|                return ignore_xref_streams_;
   64|  10.6k|            }
_ZNK4qpdf3Doc6Config17surpress_recoveryEv:
  114|   121k|            {
  115|   121k|                return surpress_recovery_;
  116|   121k|            }
_ZN4QPDF8ObjCacheC2ENSt3__110shared_ptrI10QPDFObjectEExx:
  175|   279k|        object(std::move(object)),
  176|   279k|        end_before_space(end_before_space),
  177|   279k|        end_after_space(end_after_space)
  178|   279k|    {
  179|   279k|    }
_ZN4QPDF20EncryptionParameters1REv:
  204|  3.00k|    {
  205|  3.00k|        return R_;
  206|  3.00k|    }
_ZN4QPDF3Doc8outlinesEv:
  420|  1.87k|    {
  421|  1.87k|        if (!outlines_) {
  ------------------
  |  Branch (421:13): [True: 1.87k, False: 0]
  ------------------
  422|  1.87k|            no_inspection();
  423|  1.87k|            outlines_ = std::make_unique<QPDFOutlineDocumentHelper>(qpdf);
  424|  1.87k|        }
  425|  1.87k|        return *outlines_;
  426|  1.87k|    }
_ZN4QPDF3Doc13no_inspectionEv:
  451|  1.87k|    {
  452|  1.87k|        if (global::Options::inspection_mode()) {
  ------------------
  |  Branch (452:13): [True: 0, False: 1.87k]
  ------------------
  453|      0|            throw std::logic_error("Attempted unsupported operation in inspection mode");
  454|      0|        }
  455|  1.87k|    }
_ZN4QPDF3Doc10EncryptionC2EiiiiRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_SA_SA_SA_SA_b:
  490|  1.10k|        V(V),
  491|  1.10k|        R(R),
  492|  1.10k|        Length_bytes(Length_bytes),
  493|  1.10k|        P(static_cast<unsigned long long>(P)),
  494|  1.10k|        O(O),
  495|  1.10k|        U(U),
  496|  1.10k|        OE(OE),
  497|  1.10k|        UE(UE),
  498|  1.10k|        Perms(Perms),
  499|  1.10k|        id1(id1),
  500|  1.10k|        encrypt_metadata(encrypt_metadata)
  501|  1.10k|    {
  502|  1.10k|    }
_ZN4QPDF3Doc7Objects7Streams14pipeStreamDataEPS_10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
  962|  10.0k|        {
  963|  10.0k|            return qpdf->pipeStreamData(
  964|  10.0k|                og,
  965|  10.0k|                offset,
  966|  10.0k|                length,
  967|  10.0k|                dict,
  968|  10.0k|                is_root_metadata,
  969|  10.0k|                pipeline,
  970|  10.0k|                suppress_warnings,
  971|  10.0k|                will_retry);
  972|  10.0k|        }
_ZN4QPDF3Doc5Pages3allEv:
 1144|  12.3k|    {
 1145|  12.3k|        return !all_pages.empty() ? all_pages : cache();
  ------------------
  |  Branch (1145:16): [True: 1.80k, False: 10.5k]
  ------------------
 1146|  12.3k|    }
_ZN4QPDF3Doc5Pages5emptyEv:
 1150|  12.3k|    {
 1151|  12.3k|        return all().empty();
 1152|  12.3k|    }
_ZNK4QPDF3Doc18reconstructed_xrefEv:
 1318|    416|{
 1319|    416|    return m->reconstructed_xref;
 1320|    416|}
_ZN4QPDF3Doc6Common3toOImEExRKT_:
  313|  1.34M|        {
  314|  1.34M|            return QIntC::to_offset(i);
  315|  1.34M|        }
_ZN4QPDF3Doc6Common3toIIlEEiRKT_:
  325|  6.77k|        {
  326|  6.77k|            return QIntC::to_int(i);
  327|  6.77k|        }
_ZN4QPDF3Doc6Common3toIIxEEiRKT_:
  325|  5.48M|        {
  326|  5.48M|            return QIntC::to_int(i);
  327|  5.48M|        }
_ZN4QPDF3Doc6Common3toSIiEEmRKT_:
  319|  12.0k|        {
  320|  12.0k|            return QIntC::to_size(i);
  321|  12.0k|        }
_ZN4QPDF3Doc6Common3toSIyEEmRKT_:
  319|  7.19k|        {
  320|  7.19k|            return QIntC::to_size(i);
  321|  7.19k|        }
_ZN4QPDF3Doc6Common3toSIxEEmRKT_:
  319|  18.0k|        {
  320|  18.0k|            return QIntC::to_size(i);
  321|  18.0k|        }
_ZN4QPDF8ObjCacheC2Ev:
  170|   145k|    ObjCache() = default;
_ZN4QPDF3Doc6Common3toIImEEiRKT_:
  325|  8.48k|        {
  326|  8.48k|            return QIntC::to_int(i);
  327|  8.48k|        }

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

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

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

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

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

_ZN4qpdf4util17internal_error_ifIRA29_KcEEvbOT_:
   36|  4.76M|    {
   37|  4.76M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 0, False: 4.76M]
  ------------------
   38|      0|            throw std::logic_error("INTERNAL ERROR: "s.append(std::forward<T>(msg))
   39|      0|                                       .append(
   40|      0|                                           "\nThis is a qpdf bug. Please report at "
   41|      0|                                           "https://github.com/qpdf/qpdf/issues"));
   42|      0|        }
   43|  4.76M|    }
_ZN4qpdf4util9assertionIRA44_KcEEvbOT_:
   27|  59.5k|    {
   28|  59.5k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 59.5k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  59.5k|    }
_ZN4qpdf4util17internal_error_ifIRA28_KcEEvbOT_:
   36|   107k|    {
   37|   107k|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 0, False: 107k]
  ------------------
   38|      0|            throw std::logic_error("INTERNAL ERROR: "s.append(std::forward<T>(msg))
   39|      0|                                       .append(
   40|      0|                                           "\nThis is a qpdf bug. Please report at "
   41|      0|                                           "https://github.com/qpdf/qpdf/issues"));
   42|      0|        }
   43|   107k|    }
_ZN4qpdf4util15hex_decode_charEc:
   99|   293k|    {
  100|   293k|        return digit <= '9' && digit >= '0'
  ------------------
  |  Branch (100:16): [True: 180k, False: 112k]
  |  Branch (100:32): [True: 144k, False: 35.9k]
  ------------------
  101|   293k|            ? char(digit - '0')
  102|   293k|            : (digit >= 'a' ? char(digit - 'a' + 10)
  ------------------
  |  Branch (102:16): [True: 34.7k, False: 113k]
  ------------------
  103|   148k|                            : (digit >= 'A' ? char(digit - 'A' + 10) : '\20'));
  ------------------
  |  Branch (103:32): [True: 49.8k, False: 63.7k]
  ------------------
  104|   293k|    }
_ZN4qpdf4util8is_spaceEc:
  114|  11.5M|    {
  115|  11.5M|        return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || ch == '\v';
  ------------------
  |  Branch (115:16): [True: 3.05M, False: 8.51M]
  |  Branch (115:29): [True: 405k, False: 8.10M]
  |  Branch (115:43): [True: 102k, False: 8.00M]
  |  Branch (115:57): [True: 25.9k, False: 7.97M]
  |  Branch (115:71): [True: 64.7k, False: 7.91M]
  |  Branch (115:85): [True: 18.9k, False: 7.89M]
  ------------------
  116|  11.5M|    }
_ZN4qpdf4util8is_digitEc:
  120|  4.24M|    {
  121|  4.24M|        return (ch >= '0' && ch <= '9');
  ------------------
  |  Branch (121:17): [True: 2.12M, False: 2.12M]
  |  Branch (121:30): [True: 2.04M, False: 74.7k]
  ------------------
  122|  4.24M|    }
_ZN4qpdf4util8is_utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  149|   352k|    {
  150|   352k|        return str.starts_with("\xfe\xff") || str.starts_with("\xff\xfe");
  ------------------
  |  Branch (150:16): [True: 3.46k, False: 348k]
  |  Branch (150:47): [True: 4.23k, False: 344k]
  ------------------
  151|   352k|    }
_ZN4qpdf4util16is_explicit_utf8ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  155|   344k|    {
  156|       |        // QPDF_String.cc knows that this is a 3-byte sequence.
  157|   344k|        return str.starts_with("\xef\xbb\xbf");
  158|   344k|    }
_ZN4qpdf4util9assertionIRA57_KcEEvbOT_:
   27|    681|    {
   28|    681|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 681]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    681|    }
_ZN4qpdf4util9assertionIRA51_KcEEvbOT_:
   27|    416|    {
   28|    416|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 416]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    416|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralElQsr3stdE8integralIT_EEEbT0_:
   63|  19.8k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  19.8k|                          std::numeric_limits<T>::min())) {
   67|  19.8k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 19.8k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  19.8k|        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|  19.8k|                          std::numeric_limits<T>::max())) {
   74|  19.8k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 0, False: 19.8k]
  ------------------
   75|      0|                return false;
   76|      0|            }
   77|  19.8k|        }
   78|  19.8k|        return true;
   79|  19.8k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEiQsr3stdE8integralIT_EEEbT0_:
   63|  19.8k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  19.8k|                          std::numeric_limits<T>::min())) {
   67|  19.8k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 19.8k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  19.8k|        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|       |                          std::numeric_limits<T>::max())) {
   74|       |            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
   75|       |                return false;
   76|       |            }
   77|       |        }
   78|  19.8k|        return true;
   79|  19.8k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEyQsr3stdE8integralIT_EEEbT0_:
   63|  84.4k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|       |                          std::numeric_limits<T>::min())) {
   67|       |            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
   68|       |                return false;
   69|       |            }
   70|       |        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|  84.4k|                          std::numeric_limits<T>::max())) {
   74|  84.4k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 0, False: 84.4k]
  ------------------
   75|      0|                return false;
   76|      0|            }
   77|  84.4k|        }
   78|  84.4k|        return true;
   79|  84.4k|    }
_ZN4qpdf4util9assertionINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   27|   234k|    {
   28|   234k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 234k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   234k|    }
_ZN4qpdf4util9assertionIRA45_KcEEvbOT_:
   27|   531k|    {
   28|   531k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 531k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   531k|    }
_ZN4qpdf4util9assertionIRA54_KcEEvbOT_:
   27|   192k|    {
   28|   192k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 192k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   192k|    }
_ZN4qpdf4util9assertionIRA53_KcEEvbOT_:
   27|  3.25k|    {
   28|  3.25k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 3.25k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  3.25k|    }
_ZN4qpdf4util9assertionIRA35_KcEEvbOT_:
   27|  4.05k|    {
   28|  4.05k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 4.05k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  4.05k|    }
_ZN4qpdf4util17internal_error_ifIRA34_KcEEvbOT_:
   36|   238k|    {
   37|   238k|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 1, False: 238k]
  ------------------
   38|      1|            throw std::logic_error("INTERNAL ERROR: "s.append(std::forward<T>(msg))
   39|      1|                                       .append(
   40|      1|                                           "\nThis is a qpdf bug. Please report at "
   41|      1|                                           "https://github.com/qpdf/qpdf/issues"));
   42|      1|        }
   43|   238k|    }
_ZN4qpdf4util9assertionIRA68_KcEEvbOT_:
   27|  3.03k|    {
   28|  3.03k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 3.03k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  3.03k|    }
_ZN4qpdf4util9assertionIRA83_KcEEvbOT_:
   27|  64.4k|    {
   28|  64.4k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 64.4k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  64.4k|    }
_ZN4qpdf4util9assertionIRA65_KcEEvbOT_:
   27|  3.41k|    {
   28|  3.41k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 3.41k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  3.41k|    }
_ZN4qpdf4util9assertionIRA49_KcEEvbOT_:
   27|  6.30k|    {
   28|  6.30k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 6.30k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  6.30k|    }
_ZN4qpdf4util9assertionIRA43_KcEEvbOT_:
   27|  40.2k|    {
   28|  40.2k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 40.2k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  40.2k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA51_KcEEvbOT_:
   48|   703k|    {
   49|   703k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 29, False: 703k]
  ------------------
   50|     29|            throw std::runtime_error(std::forward<T>(msg));
   51|     29|        }
   52|   703k|    }
_ZN4qpdf4util9assertionIRA50_KcEEvbOT_:
   27|   393k|    {
   28|   393k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 393k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   393k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA23_KcEEvbOT_:
   48|  1.07M|    {
   49|  1.07M|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 22, False: 1.07M]
  ------------------
   50|     22|            throw std::runtime_error(std::forward<T>(msg));
   51|     22|        }
   52|  1.07M|    }
_ZN4qpdf4util9assertionIRA52_KcEEvbOT_:
   27|  48.1M|    {
   28|  48.1M|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 48.1M]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  48.1M|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA44_KcEEvbOT_:
   48|  5.34k|    {
   49|  5.34k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 18, False: 5.32k]
  ------------------
   50|     18|            throw std::runtime_error(std::forward<T>(msg));
   51|     18|        }
   52|  5.34k|    }
_ZN4qpdf4util9assertionIRA58_KcEEvbOT_:
   27|    482|    {
   28|    482|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 482]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    482|    }
_ZN4qpdf4util9assertionIRA48_KcEEvbOT_:
   27|  5.07k|    {
   28|  5.07k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 5.07k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  5.07k|    }
_ZN4qpdf4util9assertionIRA46_KcEEvbOT_:
   27|    135|    {
   28|    135|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 135]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    135|    }
_ZN4qpdf4util17no_ci_rt_error_ifINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   48|  10.6k|    {
   49|  10.6k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 10.6k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  10.6k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA69_KcEEvbOT_:
   48|  6.77k|    {
   49|  6.77k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 18, False: 6.75k]
  ------------------
   50|     18|            throw std::runtime_error(std::forward<T>(msg));
   51|     18|        }
   52|  6.77k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA59_KcEEvbOT_:
   48|  64.3k|    {
   49|  64.3k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 64.3k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  64.3k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA42_KcEEvbOT_:
   48|  5.36k|    {
   49|  5.36k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 5.36k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  5.36k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA49_KcEEvbOT_:
   48|  2.49k|    {
   49|  2.49k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 2.49k]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|  2.49k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA88_KcEEvbOT_:
   48|  1.67k|    {
   49|  1.67k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.67k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.67k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA45_KcEEvbOT_:
   48|  1.67k|    {
   49|  1.67k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.67k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.67k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA32_KcEEvbOT_:
   48|  1.67k|    {
   49|  1.67k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.67k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.67k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA35_KcEEvbOT_:
   48|   148k|    {
   49|   148k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 15, False: 148k]
  ------------------
   50|     15|            throw std::runtime_error(std::forward<T>(msg));
   51|     15|        }
   52|   148k|    }
_ZN4qpdf4util9assertionIRA47_KcEEvbOT_:
   27|   177k|    {
   28|   177k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 177k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   177k|    }
_ZN4qpdf4util9assertionIRA56_KcEEvbOT_:
   27|    814|    {
   28|    814|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 814]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    814|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA53_KcEEvbOT_:
   48|    814|    {
   49|    814|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 811]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|    814|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA92_KcEEvbOT_:
   48|    798|    {
   49|    798|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 798]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|    798|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA36_KcEEvbOT_:
   48|    798|    {
   49|    798|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 795]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|    798|    }

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

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

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

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

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

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

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

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

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

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

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

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

